@netnodeag/kraftwerk 0.95.0 → 0.97.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 +47 -7
- package/dist/acp.d.ts +31 -3
- package/dist/acp.js +63 -2
- package/dist/cli/boards.js +6 -5
- package/dist/cli/create-brief.js +2 -2
- package/dist/cli/daemon-login.d.ts +1 -1
- package/dist/cli/daemon-login.js +1 -1
- package/dist/cli/doctor.js +6 -3
- package/dist/cli/init.js +2 -0
- package/dist/cli/knowledge.js +9 -6
- package/dist/cli/presentations.js +8 -4
- package/dist/cli/projects.js +3 -3
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +3 -0
- package/dist/client/routes.d.ts +2 -0
- package/dist/client/routes.js +2 -0
- package/dist/config.d.ts +34 -0
- package/dist/config.js +28 -1
- package/dist/core/agents.js +1 -1
- package/dist/core/board-wake.d.ts +1 -1
- package/dist/core/boards.d.ts +1 -1
- package/dist/core/boards.js +10 -6
- package/dist/core/chat/acp.d.ts +6 -0
- package/dist/core/chat/acp.js +33 -7
- package/dist/core/chat/permissions.d.ts +2 -2
- package/dist/core/chat/permissions.js +4 -1
- package/dist/core/chat/pi.d.ts +12 -0
- package/dist/core/chat/pi.js +56 -5
- package/dist/core/chat/sessions.d.ts +13 -5
- package/dist/core/chat/sessions.js +34 -9
- package/dist/core/chat/types.d.ts +3 -1
- package/dist/core/cloud.d.ts +45 -0
- package/dist/core/cloud.js +35 -0
- package/dist/core/knowledge.d.ts +0 -7
- package/dist/core/knowledge.js +6 -6
- package/dist/core/person.d.ts +41 -0
- package/dist/core/person.js +47 -0
- package/dist/core/projects.d.ts +1 -1
- package/dist/core/projects.js +3 -2
- package/dist/harness.d.ts +3 -2
- package/dist/harnesses/acp.js +3 -1
- package/dist/harnesses/registry.js +2 -1
- package/dist/server/api/agents.js +2 -2
- package/dist/server/api/boards.js +1 -1
- package/dist/server/api/chats.d.ts +4 -1
- package/dist/server/api/chats.js +30 -12
- package/dist/server/api/cloud.d.ts +8 -0
- package/dist/server/api/index.d.ts +25 -3
- package/dist/server/api/presentations.js +2 -2
- package/dist/server/api/projects.d.ts +1 -1
- package/dist/server/api/projects.js +1 -1
- package/dist/server/api/router.js +5 -2
- package/dist/server/api/workspace.d.ts +14 -1
- package/dist/server/api/workspace.js +21 -1
- package/dist/server/cloud.d.ts +3 -0
- package/dist/server/cloud.js +20 -4
- package/dist/server/person.d.ts +9 -0
- package/dist/server/person.js +14 -0
- package/dist/server/server.js +60 -4
- package/dist/server/trust.d.ts +5 -1
- package/dist/server/users.d.ts +55 -0
- package/dist/server/users.js +258 -0
- package/package.json +1 -1
- package/schema/kraftwerk.schema.json +8 -0
- package/schema/workflow.schema.json +4 -3
- package/web/dist/assets/{dist--oB2_FQJ.js → dist-BD4ooe-Y.js} +1 -1
- package/web/dist/assets/{dist-WA1PTY07.js → dist-BduOHHOY.js} +1 -1
- package/web/dist/assets/{dist-CRqkyR9b.js → dist-BoajTxbz.js} +1 -1
- package/web/dist/assets/{dist-FlDPUw_l.js → dist-DGLb7wE6.js} +1 -1
- package/web/dist/assets/{dist-SHAE_oEQ.js → dist-DJACzcZZ.js} +1 -1
- package/web/dist/assets/{dist-SL9iU_p4.js → dist-DY6QplYX.js} +1 -1
- package/web/dist/assets/{dist-Tdda9sK7.js → dist-D_uWSMLk.js} +1 -1
- package/web/dist/assets/{dist-Ys1tb91R.js → dist-P7JCq9c3.js} +1 -1
- package/web/dist/assets/dist-ajNgHt2Q.js +1 -0
- package/web/dist/assets/{dist-BlxwNXF3.js → dist-lcPkaK4d.js} +1 -1
- package/web/dist/assets/{dist-DB33yOhN.js → dist-oRcLByHn.js} +1 -1
- package/web/dist/assets/{editor-Clx4xAh9.js → editor-hTceN7Iz.js} +3 -3
- package/web/dist/assets/index-BGgQaaA9.css +2 -0
- package/web/dist/assets/index-BOkjCxut.js +488 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/dist-C3zyJ_nA.js +0 -1
- package/web/dist/assets/index-BJml45iw.js +0 -488
- package/web/dist/assets/index-CWopPK15.css +0 -2
package/dist/config.js
CHANGED
|
@@ -44,6 +44,8 @@ import { readParsed } from "./core/file-cache.js";
|
|
|
44
44
|
* enabled: false # a per-workspace veto; the machine's switch is `kraftwerk cloud on|off` (~/.kraftwerk/cloud.json)
|
|
45
45
|
* # No key here: the daemon registers the MACHINE (its relay id) and `kraftwerk login` claims it.
|
|
46
46
|
* # `url` and `interval` are deprecated: the cloud's origin is the machine's (cloud.json / KRAFTWERK_CLOUD_URL).
|
|
47
|
+
* users: # who works here (see UsersConfig)
|
|
48
|
+
* mode: cloud # local (default): this machine's handle · cloud: sign in with a kraftwerk cloud account
|
|
47
49
|
*/
|
|
48
50
|
/** Stable, versionless URL of the workflow JSON schema (editor validation). */
|
|
49
51
|
export const SCHEMA_URL = "https://raw.githubusercontent.com/NETNODEAG/kraftwerk/main/kraftwerk/schema/workflow.schema.json";
|
|
@@ -123,6 +125,8 @@ export function entitiesRootFor(project, kind) {
|
|
|
123
125
|
return undefined;
|
|
124
126
|
return path.resolve(project.root, e.root ?? entityDefaultRoot(kind));
|
|
125
127
|
}
|
|
128
|
+
/** A workspace's users mode: `cloud` only when kraftwerk.yml says so. */
|
|
129
|
+
export const usersMode = (config) => (config.users?.mode === "cloud" ? "cloud" : "local");
|
|
126
130
|
export const CLOUD_DEFAULT_URL = "https://srv.kraftwerk-cloud.netnode.cloud";
|
|
127
131
|
/** A directory as a .gitignore entry: relative, forward slashes, no trailing slash; undefined outside the root. */
|
|
128
132
|
export function ignoreEntryFor(projectRoot, dir) {
|
|
@@ -258,7 +262,7 @@ export async function addWorkspaceId(configPath) {
|
|
|
258
262
|
await writeFile(configPath, out);
|
|
259
263
|
return id;
|
|
260
264
|
}
|
|
261
|
-
const KNOWN_KEYS = ["id", "name", "slug", "icon", "color", "port", "workflows", "output", "knowledge", "agents", "skills", "switcher", "git", "repos", "vibeables", "projects", "contacts", "places", "events", "boards", "presentations", "cloud"];
|
|
265
|
+
const KNOWN_KEYS = ["id", "name", "slug", "icon", "color", "port", "workflows", "output", "knowledge", "agents", "skills", "switcher", "git", "repos", "vibeables", "projects", "contacts", "places", "events", "boards", "presentations", "cloud", "users"];
|
|
262
266
|
/**
|
|
263
267
|
* Keys an older kraftwerk understood and this one ignores, so the files
|
|
264
268
|
* that still carry them keep loading: `public:` and `tunnel:` (the
|
|
@@ -271,6 +275,19 @@ const LEGACY_KEYS = ["public", "tunnel"];
|
|
|
271
275
|
* unchanged (every request resolves the workspace, so this runs constantly).
|
|
272
276
|
* Each caller gets its own copy.
|
|
273
277
|
*/
|
|
278
|
+
/**
|
|
279
|
+
* The config of a known workspace root, cheap enough for every request (one
|
|
280
|
+
* stat while kraftwerk.yml is unchanged); {} without one or when it does not
|
|
281
|
+
* parse.
|
|
282
|
+
*/
|
|
283
|
+
export async function configAt(root) {
|
|
284
|
+
for (const name of CONFIG_FILENAMES) {
|
|
285
|
+
const loaded = await loadConfig(path.join(root, name)).catch(() => null);
|
|
286
|
+
if (loaded)
|
|
287
|
+
return loaded.config;
|
|
288
|
+
}
|
|
289
|
+
return {};
|
|
290
|
+
}
|
|
274
291
|
async function loadConfig(configPath) {
|
|
275
292
|
try {
|
|
276
293
|
return await readParsed(configPath, (text) => checkConfig(configPath, text), (r) => ({ config: structuredClone(r.config), legacyKeys: [...r.legacyKeys] }));
|
|
@@ -356,6 +373,16 @@ function checkConfig(configPath, text) {
|
|
|
356
373
|
config[key] = {};
|
|
357
374
|
validateCloud(configPath, config[key]);
|
|
358
375
|
}
|
|
376
|
+
else if (key === "users") {
|
|
377
|
+
if (config[key] === null)
|
|
378
|
+
config[key] = {};
|
|
379
|
+
const u = config[key];
|
|
380
|
+
const bad = typeof u !== "object" || Array.isArray(u) || Object.keys(u).some((k) => k !== "mode");
|
|
381
|
+
const mode = u?.mode;
|
|
382
|
+
if (bad || (mode !== undefined && mode !== "local" && mode !== "cloud")) {
|
|
383
|
+
throw new Error(`${path.basename(configPath)}: users must be a mapping with mode: local (default) or mode: cloud`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
359
386
|
else if (typeof config[key] !== "string") {
|
|
360
387
|
throw new Error(`${path.basename(configPath)}: ${key} must be a string`);
|
|
361
388
|
}
|
package/dist/core/agents.js
CHANGED
|
@@ -15,7 +15,7 @@ import { moveToTrash } from "./trash.js";
|
|
|
15
15
|
* Definitions are git-tracked project config (like workflows/), not run
|
|
16
16
|
* state — sessions with a member are ordinary chats scoped to it.
|
|
17
17
|
*/
|
|
18
|
-
export const HARNESSES = ["claude", "codex", "pi"];
|
|
18
|
+
export const HARNESSES = ["claude", "codex", "pi", "antigravity"];
|
|
19
19
|
export const EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
20
20
|
export const toSummary = (a) => ({
|
|
21
21
|
slug: a.slug,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** A chat on the task page: the agent's task session (scope.task) or a chat tagged with the task (meta.task, "work on this"). */
|
|
2
2
|
export interface TaskSession {
|
|
3
3
|
id: string;
|
|
4
|
-
/** The agent slug of a task session; "claude" | "codex" | "pi" for a plain chat tagged with the task. */
|
|
4
|
+
/** The agent slug of a task session; "claude" | "codex" | "pi" | "antigravity" for a plain chat tagged with the task. */
|
|
5
5
|
agent: string;
|
|
6
6
|
/** The agent's display name and emoji when it is one of the workspace's agents. */
|
|
7
7
|
name?: string;
|
package/dist/core/boards.d.ts
CHANGED
|
@@ -146,7 +146,7 @@ export interface TaskInput {
|
|
|
146
146
|
refs?: unknown;
|
|
147
147
|
notes?: string;
|
|
148
148
|
}
|
|
149
|
-
/** Who writes (an actor string:
|
|
149
|
+
/** Who writes (an actor string: lisa/claude, process:…; a person is whoever asks) and an optional message for the log. */
|
|
150
150
|
export interface WriteOpts {
|
|
151
151
|
actor?: string;
|
|
152
152
|
message?: string;
|
package/dist/core/boards.js
CHANGED
|
@@ -10,6 +10,7 @@ import { openProjects, safeProjectSlug } from "./projects.js";
|
|
|
10
10
|
import { findRefs, resolveTokens } from "./refs.js";
|
|
11
11
|
import { SLUG_RE, slugify } from "./slug.js";
|
|
12
12
|
import { moveToTrash } from "./trash.js";
|
|
13
|
+
import { actorFor } from "./person.js";
|
|
13
14
|
/**
|
|
14
15
|
* Boards and tasks: the work of a project (or of the whole workspace) as
|
|
15
16
|
* columns of cards, stored as plain folders so humans, agents and git all
|
|
@@ -666,7 +667,8 @@ async function writeLogLine(dir, title, text, actor, now = new Date()) {
|
|
|
666
667
|
}
|
|
667
668
|
await fs.writeFile(file, lines.join("\n").replace(/\n{3,}/g, "\n\n"));
|
|
668
669
|
}
|
|
669
|
-
|
|
670
|
+
/** An agent's or a process's own name as given; a person is whoever asks (core/person.ts). */
|
|
671
|
+
const cleanActor = (actor) => actorFor(actor);
|
|
670
672
|
const oneLine = (text) => text.trim().replace(/\s*\n\s*/g, " ");
|
|
671
673
|
/** Append a free entry to a task's log: what was done, a comment, a question. */
|
|
672
674
|
export async function appendTaskLog(ref, idOrNumber, entry, actor) {
|
|
@@ -676,7 +678,8 @@ export async function appendTaskLog(ref, idOrNumber, entry, actor) {
|
|
|
676
678
|
const text = oneLine(entry);
|
|
677
679
|
if (!text)
|
|
678
680
|
throw new Error("entry is required");
|
|
679
|
-
|
|
681
|
+
const who = await cleanActor(actor);
|
|
682
|
+
await withTaskLock(t.path, () => writeLogLine(t.path, t.title, text, who));
|
|
680
683
|
changed();
|
|
681
684
|
return (await getTask(ref, t.slug));
|
|
682
685
|
}
|
|
@@ -770,7 +773,7 @@ export async function createTask(ref, input) {
|
|
|
770
773
|
const title = (input.title ?? "").trim();
|
|
771
774
|
if (!title)
|
|
772
775
|
throw new Error("title is required");
|
|
773
|
-
const actor = cleanActor(input.actor);
|
|
776
|
+
const actor = await cleanActor(input.actor);
|
|
774
777
|
const base = emptyTask("0-task", board.columns);
|
|
775
778
|
base.created = localDate(new Date());
|
|
776
779
|
let def = applyInput(base, { ...input, title }, board);
|
|
@@ -815,7 +818,7 @@ export async function saveTask(ref, idOrNumber, input, opts = {}) {
|
|
|
815
818
|
throw new Error(`no task "${idOrNumber}" on board "${boardKey(ref)}"`);
|
|
816
819
|
if (current.configError)
|
|
817
820
|
throw new Error(`task "${current.slug}" cannot be saved until its file is fixed by hand (${current.configError}): ${current.path}`);
|
|
818
|
-
const actor = cleanActor(opts.actor);
|
|
821
|
+
const actor = await cleanActor(opts.actor);
|
|
819
822
|
const { ref: _r, path: _p, updatedAt: _u, configError: _c, files: _f, lastLog: _l, stale: _s, notes: _n, log: _g, fileList: _fl, board: _b, project: _pj, ...def } = current;
|
|
820
823
|
const next = applyInput(def, input, board);
|
|
821
824
|
if (input.status !== undefined && input.status !== def.status && input.order === undefined)
|
|
@@ -900,7 +903,7 @@ export async function pickTask(ref, agent, opts = {}) {
|
|
|
900
903
|
const { ref: _r, path: _p, updatedAt: _u, configError: _c, files: _f, lastLog: _l, stale: _s, ...def } = fresh.summary;
|
|
901
904
|
const next = { ...def, assignee: slugAgent, status: toCol.slug, order: nextOrder(board.items, toCol.slug) };
|
|
902
905
|
await fs.writeFile(path.join(c.path, TASK_FILE), taskToFile(next, fresh.notes));
|
|
903
|
-
await writeLogLine(c.path, next.title, `Picked up (${from.label} → ${toCol.label})`, cleanActor(opts.actor ?? slugAgent));
|
|
906
|
+
await writeLogLine(c.path, next.title, `Picked up (${from.label} → ${toCol.label})`, await cleanActor(opts.actor ?? slugAgent));
|
|
904
907
|
return true;
|
|
905
908
|
});
|
|
906
909
|
if (won) {
|
|
@@ -923,7 +926,8 @@ export async function noteTaskFile(reference, what, file, actor) {
|
|
|
923
926
|
const t = await findTask(reference);
|
|
924
927
|
if (!t)
|
|
925
928
|
return;
|
|
926
|
-
|
|
929
|
+
const who = await cleanActor(actor);
|
|
930
|
+
await withTaskLock(t.path, () => writeLogLine(t.path, t.title, `File ${what}: ${file}`, who));
|
|
927
931
|
changed();
|
|
928
932
|
}
|
|
929
933
|
/* ---------- agent context ---------- */
|
package/dist/core/chat/acp.d.ts
CHANGED
|
@@ -43,6 +43,12 @@ export declare function listAgentSessions(agent: AcpAgent, cwd: string): Promise
|
|
|
43
43
|
updatedAt?: string;
|
|
44
44
|
cwd: string;
|
|
45
45
|
}>>;
|
|
46
|
+
/**
|
|
47
|
+
* The settings a fresh session of the agent offers (model, thinking depth,
|
|
48
|
+
* ... as the agent announces them for this login), from a short-lived
|
|
49
|
+
* adapter that opens one session and closes it without a prompt.
|
|
50
|
+
*/
|
|
51
|
+
export declare function announcedOptions(agent: AcpAgent, cwd: string): Promise<ConfigOption[]>;
|
|
46
52
|
/** Remove one of the agent's sessions for good (its transcript on disk), from a short-lived adapter. */
|
|
47
53
|
export declare function deleteAgentSession(agent: AcpAgent, cwd: string, sessionId: string): Promise<void>;
|
|
48
54
|
export declare function startAcpBackend(agent: AcpAgent, cwd: string, hooks: BackendHooks, tuning?: BackendTuning): Promise<ChatBackend>;
|
package/dist/core/chat/acp.js
CHANGED
|
@@ -2,12 +2,12 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { promises as fs } from "node:fs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { RequestError, } from "@agentclientprotocol/sdk/unstable";
|
|
5
|
-
import { adapterEnv, airMeta, connectAcp, EXT_METHODS, EXT_NOTIFICATIONS, fileChangeReportMeta, openSession, withAdapter, } from "../../acp.js";
|
|
5
|
+
import { adapterEnv, applyTuningConfig, airMeta, connectAcp, EXT_METHODS, EXT_NOTIFICATIONS, fileChangeReportMeta, openSession, withAdapter, } from "../../acp.js";
|
|
6
6
|
import { identityEnv } from "./backend.js";
|
|
7
7
|
import { tempEnv } from "../temp.js";
|
|
8
8
|
import { unattendedMode } from "./permissions.js";
|
|
9
9
|
/**
|
|
10
|
-
* ACP-backed chat: spawn an adapter (claude-agent-acp / codex-acp) as a
|
|
10
|
+
* ACP-backed chat: spawn an adapter (claude-agent-acp / codex-acp / agy acp) as a
|
|
11
11
|
* subprocess, speak Agent Client Protocol over its stdio, and translate
|
|
12
12
|
* session/update notifications into chat events. One subprocess lives for
|
|
13
13
|
* the whole chat; the ACP session id carries the conversation and is
|
|
@@ -340,6 +340,18 @@ export async function listAgentSessions(agent, cwd) {
|
|
|
340
340
|
.sort((a, b) => (b.updatedAt ?? "").localeCompare(a.updatedAt ?? ""));
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* The settings a fresh session of the agent offers (model, thinking depth,
|
|
345
|
+
* ... as the agent announces them for this login), from a short-lived
|
|
346
|
+
* adapter that opens one session and closes it without a prompt.
|
|
347
|
+
*/
|
|
348
|
+
export async function announcedOptions(agent, cwd) {
|
|
349
|
+
return withAdapter(agent, cwd, async (conn) => {
|
|
350
|
+
const s = await conn.newSession({ cwd, mcpServers: [] });
|
|
351
|
+
await conn.closeSession({ sessionId: s.sessionId }).catch(() => { });
|
|
352
|
+
return configOptions(s.configOptions);
|
|
353
|
+
});
|
|
354
|
+
}
|
|
343
355
|
/** Remove one of the agent's sessions for good (its transcript on disk), from a short-lived adapter. */
|
|
344
356
|
export async function deleteAgentSession(agent, cwd, sessionId) {
|
|
345
357
|
await withAdapter(agent, cwd, async (conn) => {
|
|
@@ -353,13 +365,23 @@ export async function startAcpBackend(agent, cwd, hooks, tuning = {}) {
|
|
|
353
365
|
// Usage arrives after nearly every chunk; the thread keeps a step per
|
|
354
366
|
// percent of the window and every cost total (turn ends), not each tick.
|
|
355
367
|
let usagePercent = -1;
|
|
368
|
+
// The slash commands as last announced. An agent may announce them while
|
|
369
|
+
// the session is still opening (agy does, during session/new and while its
|
|
370
|
+
// settings are set) — before the backend object exists.
|
|
371
|
+
let commands;
|
|
372
|
+
let made;
|
|
356
373
|
const client = {
|
|
357
374
|
sessionUpdate(params) {
|
|
358
|
-
|
|
375
|
+
// Nothing but the session being opened can speak before its id is known.
|
|
376
|
+
const opening = !sessionId && params.update.sessionUpdate === "available_commands_update";
|
|
377
|
+
const ev = translateUpdate(opening ? params.sessionId : sessionId, params);
|
|
359
378
|
if (!ev)
|
|
360
379
|
return;
|
|
361
|
-
if (ev.type === "commands")
|
|
362
|
-
|
|
380
|
+
if (ev.type === "commands") {
|
|
381
|
+
commands = ev.commands;
|
|
382
|
+
if (made)
|
|
383
|
+
made.commands = ev.commands;
|
|
384
|
+
}
|
|
363
385
|
if (ev.type === "usage") {
|
|
364
386
|
const pct = ev.size > 0 ? Math.floor((100 * ev.used) / ev.size) : 0;
|
|
365
387
|
if (ev.costUsd == null && pct === usagePercent)
|
|
@@ -440,8 +462,10 @@ export async function startAcpBackend(agent, cwd, hooks, tuning = {}) {
|
|
|
440
462
|
message: `could not resume the previous ${agent} session (${session.resumeError}) — starting a fresh one; the agent gets the conversation so far as context, not as memory`,
|
|
441
463
|
});
|
|
442
464
|
}
|
|
443
|
-
|
|
444
|
-
|
|
465
|
+
// Antigravity takes the agent's or project's model and thinking depth as session settings.
|
|
466
|
+
const opened = await applyTuningConfig(agent, conn, sessionId, tuning, session.configOptions, (message) => hooks.emit({ type: "error", message: `${message} — the ${agent} default applies` }));
|
|
467
|
+
if (opened?.length)
|
|
468
|
+
hooks.emit({ type: "config", options: configOptions(opened) });
|
|
445
469
|
if (tuning.unattended) {
|
|
446
470
|
// Nobody is watching: keep the harness's configured mode unless it is
|
|
447
471
|
// one that never asks (see unattendedMode). The harness keeps deciding
|
|
@@ -467,6 +491,7 @@ export async function startAcpBackend(agent, cwd, hooks, tuning = {}) {
|
|
|
467
491
|
const backend = {
|
|
468
492
|
sessionId,
|
|
469
493
|
resumed: session.resumed,
|
|
494
|
+
...(commands ? { commands } : {}),
|
|
470
495
|
async prompt(text, files) {
|
|
471
496
|
if (dead)
|
|
472
497
|
throw new Error(`${agent} agent process is gone — start a new chat`);
|
|
@@ -567,5 +592,6 @@ export async function startAcpBackend(agent, cwd, hooks, tuning = {}) {
|
|
|
567
592
|
});
|
|
568
593
|
},
|
|
569
594
|
};
|
|
595
|
+
made = backend;
|
|
570
596
|
return backend;
|
|
571
597
|
}
|
|
@@ -29,8 +29,8 @@ export declare function unattendedTimeoutLabel(ms?: number): string;
|
|
|
29
29
|
* to, or null to keep the current one. The harness stays the judge of what
|
|
30
30
|
* needs a human; this only rules out the two presets that never ask —
|
|
31
31
|
* claude bypassPermissions and codex agent-full-access — and lifts claude's
|
|
32
|
-
* plain "default" (ask for every edit) to acceptEdits so a routine can write
|
|
32
|
+
* (and antigravity's) plain "default" (ask for every edit) to acceptEdits so a routine can write
|
|
33
33
|
* inside the project without stalling. claude's "auto" mode (its own
|
|
34
34
|
* classifier decides) and acceptEdits are kept as they are.
|
|
35
35
|
*/
|
|
36
|
-
export declare function unattendedMode(agent: "claude" | "codex", current: string | undefined): string | null;
|
|
36
|
+
export declare function unattendedMode(agent: "claude" | "codex" | "antigravity", current: string | undefined): string | null;
|
|
@@ -31,12 +31,15 @@ export function unattendedTimeoutLabel(ms = UNATTENDED_PERMISSION_TIMEOUT_MS) {
|
|
|
31
31
|
* to, or null to keep the current one. The harness stays the judge of what
|
|
32
32
|
* needs a human; this only rules out the two presets that never ask —
|
|
33
33
|
* claude bypassPermissions and codex agent-full-access — and lifts claude's
|
|
34
|
-
* plain "default" (ask for every edit) to acceptEdits so a routine can write
|
|
34
|
+
* (and antigravity's) plain "default" (ask for every edit) to acceptEdits so a routine can write
|
|
35
35
|
* inside the project without stalling. claude's "auto" mode (its own
|
|
36
36
|
* classifier decides) and acceptEdits are kept as they are.
|
|
37
37
|
*/
|
|
38
38
|
export function unattendedMode(agent, current) {
|
|
39
39
|
if (agent === "codex")
|
|
40
40
|
return current === "agent-full-access" || !current ? "agent" : null;
|
|
41
|
+
// antigravity: "default" asks for every edit; "auto" and "accept-edits" still ask before what matters.
|
|
42
|
+
if (agent === "antigravity")
|
|
43
|
+
return current === "auto" || current === "accept-edits" ? null : "accept-edits";
|
|
41
44
|
return current === "auto" || current === "acceptEdits" ? null : "acceptEdits";
|
|
42
45
|
}
|
package/dist/core/chat/pi.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
import { type BackendHooks, type BackendTuning, type ChatBackend } from "./backend.js";
|
|
2
|
+
import type { ConfigOption } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The models pi can run (`pi --list-models`: its providers with a login or
|
|
5
|
+
* key), as `provider/id`. Empty when pi is missing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function listPiModels(): Promise<string[]>;
|
|
8
|
+
/**
|
|
9
|
+
* pi's model and thinking level in the shape ACP agents announce theirs
|
|
10
|
+
* (a select each, "default" = pi's own setting), so the chat's pickers and
|
|
11
|
+
* a new chat's start options treat pi like the others.
|
|
12
|
+
*/
|
|
13
|
+
export declare function piOptions(models: string[], model?: string, effort?: string): ConfigOption[];
|
|
2
14
|
export declare function startPiBackend(cwd: string, hooks: BackendHooks, tuning?: BackendTuning): ChatBackend;
|
package/dist/core/chat/pi.js
CHANGED
|
@@ -1,8 +1,36 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
1
|
+
import { execFile, spawn } from "node:child_process";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { identityEnv } from "./backend.js";
|
|
4
4
|
import { workspaceEnv } from "../env.js";
|
|
5
5
|
import { tempEnv } from "../temp.js";
|
|
6
|
+
/** pi's --thinking levels. */
|
|
7
|
+
const PI_THINKING = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
8
|
+
/**
|
|
9
|
+
* The models pi can run (`pi --list-models`: its providers with a login or
|
|
10
|
+
* key), as `provider/id`. Empty when pi is missing.
|
|
11
|
+
*/
|
|
12
|
+
export function listPiModels() {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
execFile("pi", ["--list-models"], { env: workspaceEnv(), timeout: 20_000 }, (err, stdout) => {
|
|
15
|
+
if (err)
|
|
16
|
+
return resolve([]);
|
|
17
|
+
const rows = stdout.split("\n").slice(1).map((l) => l.trim().split(/\s+/));
|
|
18
|
+
resolve(rows.filter((r) => r.length >= 2 && r[0] && r[1]).map(([provider, id]) => `${provider}/${id}`));
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* pi's model and thinking level in the shape ACP agents announce theirs
|
|
24
|
+
* (a select each, "default" = pi's own setting), so the chat's pickers and
|
|
25
|
+
* a new chat's start options treat pi like the others.
|
|
26
|
+
*/
|
|
27
|
+
export function piOptions(models, model, effort) {
|
|
28
|
+
const known = model && !models.includes(model) ? [model, ...models] : models;
|
|
29
|
+
return [
|
|
30
|
+
{ id: "model", name: "Model", category: "model", type: "select", value: model ?? "default", choices: [{ value: "default", name: "pi's default" }, ...known.map((m) => ({ value: m, name: m }))] },
|
|
31
|
+
{ id: "thinking", name: "Thinking", category: "thought_level", type: "select", value: effort ?? "default", choices: [{ value: "default", name: "pi's default" }, ...PI_THINKING.map((t) => ({ value: t, name: t }))] },
|
|
32
|
+
];
|
|
33
|
+
}
|
|
6
34
|
const clip = (raw) => {
|
|
7
35
|
const oneLine = String(raw ?? "").replace(/\s+/g, " ").trim();
|
|
8
36
|
return oneLine.length > 120 ? `${oneLine.slice(0, 120)}…` : oneLine;
|
|
@@ -11,11 +39,21 @@ export function startPiBackend(cwd, hooks, tuning = {}) {
|
|
|
11
39
|
const sessionId = randomUUID();
|
|
12
40
|
let child = null;
|
|
13
41
|
let cancelled = false;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
42
|
+
// pi runs one process per message: a changed setting applies from the next one.
|
|
43
|
+
let model = tuning.model;
|
|
44
|
+
let effort = tuning.effort;
|
|
45
|
+
const args = () => [
|
|
46
|
+
...(model ? ["--model", model] : []),
|
|
47
|
+
...(effort ? ["--thinking", effort] : []),
|
|
17
48
|
...(tuning.skillDirs ?? []).flatMap((dir) => ["--skill", dir]),
|
|
18
49
|
];
|
|
50
|
+
const models = listPiModels();
|
|
51
|
+
const announce = async () => {
|
|
52
|
+
const options = piOptions(await models, model, effort);
|
|
53
|
+
hooks.emit({ type: "config", options });
|
|
54
|
+
return options;
|
|
55
|
+
};
|
|
56
|
+
void announce();
|
|
19
57
|
return {
|
|
20
58
|
prompt(text, files) {
|
|
21
59
|
// pi takes text only: name the files, they are on disk for it to open.
|
|
@@ -23,7 +61,7 @@ export function startPiBackend(cwd, hooks, tuning = {}) {
|
|
|
23
61
|
text += `\n\nAttached files:\n${files.map((f) => `- ${f.name} (${f.mimeType}, ${f.path})`).join("\n")}`;
|
|
24
62
|
cancelled = false;
|
|
25
63
|
return new Promise((resolve, reject) => {
|
|
26
|
-
const proc = spawn("pi", ["-p", "--mode", "json", "--session-id", sessionId, ...
|
|
64
|
+
const proc = spawn("pi", ["-p", "--mode", "json", "--session-id", sessionId, ...args()], {
|
|
27
65
|
cwd,
|
|
28
66
|
stdio: ["pipe", "pipe", "pipe"],
|
|
29
67
|
env: { ...workspaceEnv(), ...(tuning.temp ? tempEnv(tuning.temp) : {}), ...identityEnv("pi", tuning) },
|
|
@@ -101,6 +139,19 @@ export function startPiBackend(cwd, hooks, tuning = {}) {
|
|
|
101
139
|
});
|
|
102
140
|
});
|
|
103
141
|
},
|
|
142
|
+
async setConfig(configId, value) {
|
|
143
|
+
const v = typeof value === "string" && value !== "default" ? value : undefined;
|
|
144
|
+
if (configId === "model")
|
|
145
|
+
model = v;
|
|
146
|
+
else if (configId === "thinking") {
|
|
147
|
+
if (v && !PI_THINKING.includes(v))
|
|
148
|
+
throw new Error(`pi has no thinking level "${v}"`);
|
|
149
|
+
effort = v;
|
|
150
|
+
}
|
|
151
|
+
else
|
|
152
|
+
throw new Error(`pi has no setting "${configId}"`);
|
|
153
|
+
return announce();
|
|
154
|
+
},
|
|
104
155
|
cancel() {
|
|
105
156
|
cancelled = true;
|
|
106
157
|
child?.kill("SIGTERM");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Attachment, ChatAgentId, ChatMeta, ChatPerson, ChatScope, ElicitationAnswer, StoredChatEvent } from "./types.js";
|
|
1
|
+
import type { Attachment, ChatAgentId, ChatMeta, ConfigOption, ChatPerson, ChatScope, ElicitationAnswer, StoredChatEvent } from "./types.js";
|
|
2
2
|
import { type Channel } from "../channels.js";
|
|
3
3
|
export { agentFilesContext, agentJournalContext, agentVibeablesContext, vibeableContext } from "./context.js";
|
|
4
4
|
export { disposeAllBackends, disposeWorkspaceBackends } from "./state.js";
|
|
@@ -9,9 +9,9 @@ export { disposeAllBackends, disposeWorkspaceBackends } from "./state.js";
|
|
|
9
9
|
* process (seats.ts) and channel turns (channel-turns.ts).
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* device, a routine's run.
|
|
12
|
+
* The person a chat or message is signed with when nobody else is named:
|
|
13
|
+
* the one the current request runs as, else this machine's (core/person.ts)
|
|
14
|
+
* — local use, a paired device, a routine's run.
|
|
15
15
|
*/
|
|
16
16
|
export declare function localPerson(): Promise<ChatPerson>;
|
|
17
17
|
/**
|
|
@@ -36,6 +36,8 @@ export declare function createChat(opts: {
|
|
|
36
36
|
author?: ChatPerson;
|
|
37
37
|
/** A private routine's run: hidden from remote callers (meta.private). */
|
|
38
38
|
private?: boolean;
|
|
39
|
+
/** Settings to start with (model, thinking depth, by config id): applied before the first prompt (meta.pendingConfig). */
|
|
40
|
+
config?: Record<string, string | boolean>;
|
|
39
41
|
}): Promise<ChatMeta>;
|
|
40
42
|
/** A permission request is waiting for a human in this chat (live state only — a restart drops it with the backend). */
|
|
41
43
|
export declare function chatAwaitingApproval(id: string): boolean;
|
|
@@ -116,7 +118,7 @@ export declare function setChatVibeable(id: string, slug: string | null): Promis
|
|
|
116
118
|
* Fork a chat: a new chat with the same transcript whose agent continues
|
|
117
119
|
* from a copy of this session (session/fork) — try something without
|
|
118
120
|
* losing the original thread. Needs a session to fork: an agent that keeps
|
|
119
|
-
* one (claude
|
|
121
|
+
* one (claude — codex and antigravity have no fork, pi has no ACP session) that has answered at least
|
|
120
122
|
* once. The source's process is (re)spawned if needed; the fork's own
|
|
121
123
|
* process starts with its first message and resumes the forked id.
|
|
122
124
|
*/
|
|
@@ -161,6 +163,12 @@ export declare function listAgentSessionsFor(agent: ChatAgentId): Promise<Array<
|
|
|
161
163
|
updatedAt?: string;
|
|
162
164
|
cwd: string;
|
|
163
165
|
}>>;
|
|
166
|
+
/**
|
|
167
|
+
* The model and thinking depth a new chat on `agent` can start with — the
|
|
168
|
+
* choices the agent itself announces (they depend on its login and
|
|
169
|
+
* version, so there is no fixed list); pi's from `pi --list-models`.
|
|
170
|
+
*/
|
|
171
|
+
export declare function startOptionsFor(agent: ChatAgentId): Promise<ConfigOption[]>;
|
|
164
172
|
export declare function resolvePermission(id: string, requestId: string, optionId: string | null): Promise<{
|
|
165
173
|
error?: string;
|
|
166
174
|
}>;
|
|
@@ -3,9 +3,9 @@ import { workspaceRoot } from "../context.js";
|
|
|
3
3
|
import { safeRunDir } from "../runs.js";
|
|
4
4
|
import { getAgent } from "../agents.js";
|
|
5
5
|
import { resolveVibeable } from "../vibeables.js";
|
|
6
|
-
import { deleteAgentSession, listAgentSessions } from "./acp.js";
|
|
6
|
+
import { announcedOptions, deleteAgentSession, listAgentSessions } from "./acp.js";
|
|
7
|
+
import { listPiModels, piOptions } from "./pi.js";
|
|
7
8
|
import { chatHref, pushNotification } from "../notifications.js";
|
|
8
|
-
import { readIdentity } from "../identity.js";
|
|
9
9
|
import { moveToTrash } from "../trash.js";
|
|
10
10
|
import { removeSessionTemp } from "../temp.js";
|
|
11
11
|
import { attachmentPath, copyChatFiles, listChatMetas, newChatId, readMetaAt, safeChatDir, writeMeta } from "./store.js";
|
|
@@ -13,6 +13,7 @@ import { postChannelMessage } from "./channel-turns.js";
|
|
|
13
13
|
import { expandSkillInvocation, scopeContext } from "./context.js";
|
|
14
14
|
import { ensureBackend } from "./seats.js";
|
|
15
15
|
import { MAIN, chatLabel, chatStates, dropBackend, dropSeat, emit, forgetFailedResume, isBusy, isUnattended, lastEventText, loadState, mainSeat, newSeat, ownerLabel, routineRef } from "./state.js";
|
|
16
|
+
import { currentPerson } from "../person.js";
|
|
16
17
|
export { agentFilesContext, agentJournalContext, agentVibeablesContext, vibeableContext } from "./context.js";
|
|
17
18
|
export { disposeAllBackends, disposeWorkspaceBackends } from "./state.js";
|
|
18
19
|
/**
|
|
@@ -23,12 +24,13 @@ export { disposeAllBackends, disposeWorkspaceBackends } from "./state.js";
|
|
|
23
24
|
*/
|
|
24
25
|
/* ---------- public API (used by server.ts) ---------- */
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* device, a routine's run.
|
|
27
|
+
* The person a chat or message is signed with when nobody else is named:
|
|
28
|
+
* the one the current request runs as, else this machine's (core/person.ts)
|
|
29
|
+
* — local use, a paired device, a routine's run.
|
|
29
30
|
*/
|
|
30
31
|
export async function localPerson() {
|
|
31
|
-
|
|
32
|
+
const p = await currentPerson();
|
|
33
|
+
return { handle: p.handle, ...(p.id ? { id: p.id } : {}), ...(p.email ? { email: p.email } : {}) };
|
|
32
34
|
}
|
|
33
35
|
/** Where a chat's agent runs when no vibeable is open: the run folder for run chats, else the project root. */
|
|
34
36
|
const defaultCwd = (scope) => (scope.kind === "run" ? safeRunDir(scope.runId) : workspaceRoot());
|
|
@@ -59,6 +61,7 @@ export async function createChat(opts) {
|
|
|
59
61
|
...(opts.resume && opts.agent !== "pi" ? { sessions: { [MAIN]: opts.resume } } : {}),
|
|
60
62
|
author,
|
|
61
63
|
...(opts.private ? { private: true } : {}),
|
|
64
|
+
...(opts.config && Object.keys(opts.config).length ? { pendingConfig: opts.config } : {}),
|
|
62
65
|
createdAt: now,
|
|
63
66
|
updatedAt: now,
|
|
64
67
|
};
|
|
@@ -330,7 +333,7 @@ export async function setChatVibeable(id, slug) {
|
|
|
330
333
|
* Fork a chat: a new chat with the same transcript whose agent continues
|
|
331
334
|
* from a copy of this session (session/fork) — try something without
|
|
332
335
|
* losing the original thread. Needs a session to fork: an agent that keeps
|
|
333
|
-
* one (claude
|
|
336
|
+
* one (claude — codex and antigravity have no fork, pi has no ACP session) that has answered at least
|
|
334
337
|
* once. The source's process is (re)spawned if needed; the fork's own
|
|
335
338
|
* process starts with its first message and resumes the forked id.
|
|
336
339
|
*/
|
|
@@ -343,8 +346,8 @@ export async function forkChat(id, by) {
|
|
|
343
346
|
return { error: "a channel cannot be forked", status: 409 };
|
|
344
347
|
if (meta.agent === "pi")
|
|
345
348
|
return { error: "pi chats have no session to fork", status: 409 };
|
|
346
|
-
if (meta.agent === "codex")
|
|
347
|
-
return { error:
|
|
349
|
+
if (meta.agent === "codex" || meta.agent === "antigravity")
|
|
350
|
+
return { error: `fork is not supported by ${meta.agent}`, status: 409 };
|
|
348
351
|
if (!meta.sessions?.[MAIN])
|
|
349
352
|
return { error: "nothing to fork yet — the agent has not answered in this chat", status: 409 };
|
|
350
353
|
if (isBusy(state))
|
|
@@ -493,6 +496,28 @@ export async function listAgentSessionsFor(agent) {
|
|
|
493
496
|
return [];
|
|
494
497
|
return listAgentSessions(agent, workspaceRoot());
|
|
495
498
|
}
|
|
499
|
+
// What each agent offers, per workspace: asking means starting the agent (a second or two), and it changes only with its login or version.
|
|
500
|
+
const offered = new Map();
|
|
501
|
+
const OFFERED_TTL_MS = 30 * 60_000;
|
|
502
|
+
/**
|
|
503
|
+
* The model and thinking depth a new chat on `agent` can start with — the
|
|
504
|
+
* choices the agent itself announces (they depend on its login and
|
|
505
|
+
* version, so there is no fixed list); pi's from `pi --list-models`.
|
|
506
|
+
*/
|
|
507
|
+
export async function startOptionsFor(agent) {
|
|
508
|
+
if (agent === "pi")
|
|
509
|
+
return piOptions(await listPiModels());
|
|
510
|
+
const cwd = workspaceRoot();
|
|
511
|
+
const key = `${cwd}\0${agent}`;
|
|
512
|
+
let hit = offered.get(key);
|
|
513
|
+
if (!hit || Date.now() - hit.at > OFFERED_TTL_MS) {
|
|
514
|
+
hit = { at: Date.now(), options: announcedOptions(agent, cwd).then((all) => all.filter((o) => o.category === "model" || o.category === "thought_level")) };
|
|
515
|
+
offered.set(key, hit);
|
|
516
|
+
// A failed ask (agent not installed, logged out) is asked again next time.
|
|
517
|
+
hit.options.catch(() => offered.delete(key));
|
|
518
|
+
}
|
|
519
|
+
return hit.options;
|
|
520
|
+
}
|
|
496
521
|
export async function resolvePermission(id, requestId, optionId) {
|
|
497
522
|
const state = await loadState(id);
|
|
498
523
|
if (!state)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* truth: the UI replays them to render the thread, and the SSE stream just
|
|
6
6
|
* appends live ones.
|
|
7
7
|
*/
|
|
8
|
-
export type ChatAgentId = "claude" | "codex" | "pi";
|
|
8
|
+
export type ChatAgentId = "claude" | "codex" | "pi" | "antigravity";
|
|
9
9
|
export type ChatScope = {
|
|
10
10
|
kind: "general";
|
|
11
11
|
}
|
|
@@ -46,6 +46,8 @@ export type ChatScope = {
|
|
|
46
46
|
*/
|
|
47
47
|
export interface ChatPerson {
|
|
48
48
|
handle: string;
|
|
49
|
+
/** The cloud account's uuid (a person signed in with `users: cloud`): the same person on every machine. */
|
|
50
|
+
id?: string;
|
|
49
51
|
/** A remote member's account email; absent for this machine's own person. */
|
|
50
52
|
email?: string;
|
|
51
53
|
}
|
package/dist/core/cloud.d.ts
CHANGED
|
@@ -35,6 +35,13 @@
|
|
|
35
35
|
* — the routines that ran here, private ones left out, at most 500; only
|
|
36
36
|
* while claimed, and only when it changed since the cloud last took it.
|
|
37
37
|
*
|
|
38
|
+
* Signing in to a workspace's own UI (kraftwerk.yml `users: cloud`, server/users.ts):
|
|
39
|
+
*
|
|
40
|
+
* browser → <cloud>/signin?workspace=ws_…&machine=<id>&redirect=http://<slug>.localhost:<port>/auth/callback&state=…
|
|
41
|
+
* /api/signin/exchange {id, secret, code, redirect} → {user: {id, email, handle}, workspaceId, role}
|
|
42
|
+
* (404 unknown code, 410 used or expired, 403 no longer a member)
|
|
43
|
+
* /api/signin/verify {id, secret, workspace, user} → {user, role} (404: not a member any more)
|
|
44
|
+
*
|
|
38
45
|
* Membership (remote members, no clone — they reach a workspace through the
|
|
39
46
|
* relay with a workspace-scoped member token, see server/members.ts):
|
|
40
47
|
*
|
|
@@ -72,13 +79,29 @@ export interface RegisterResponse {
|
|
|
72
79
|
interval: number;
|
|
73
80
|
claimCode: string | null;
|
|
74
81
|
account: string | null;
|
|
82
|
+
/** The claiming account's uuid and handle (clouds before 0.97 send neither). */
|
|
83
|
+
accountId?: string | null;
|
|
84
|
+
accountHandle?: string | null;
|
|
75
85
|
}
|
|
76
86
|
export interface HeartbeatResponse {
|
|
77
87
|
ok: boolean;
|
|
78
88
|
interval: number;
|
|
79
89
|
account: string | null;
|
|
90
|
+
accountId?: string | null;
|
|
91
|
+
accountHandle?: string | null;
|
|
80
92
|
claimCode: string | null;
|
|
81
93
|
}
|
|
94
|
+
/** A person the cloud vouches for: the account's uuid (the same on every machine), email and handle. */
|
|
95
|
+
export interface CloudUser {
|
|
96
|
+
id: string;
|
|
97
|
+
email: string;
|
|
98
|
+
handle: string;
|
|
99
|
+
}
|
|
100
|
+
export interface SigninExchange {
|
|
101
|
+
user: CloudUser;
|
|
102
|
+
workspaceId: string;
|
|
103
|
+
role: "owner" | "member";
|
|
104
|
+
}
|
|
82
105
|
/** What the cloud vouches for about a member token in one workspace. */
|
|
83
106
|
export interface MemberVerdict {
|
|
84
107
|
email: string;
|
|
@@ -150,3 +173,25 @@ export declare const machineGoodbye: (base: string, creds: Credentials, version?
|
|
|
150
173
|
export declare const machineUnlink: (base: string, creds: Credentials, version?: string) => Promise<UnlinkResponse>;
|
|
151
174
|
export declare const memberVerify: (base: string, creds: Credentials, token: string, workspaceId: string, version?: string) => Promise<MemberVerdict>;
|
|
152
175
|
export declare const workspaceInvite: (base: string, creds: Credentials, workspaceId: string, role?: "owner" | "member", version?: string) => Promise<InviteResponse>;
|
|
176
|
+
export declare const signinExchange: (base: string, creds: Credentials, code: string, redirect: string, version?: string) => Promise<SigninExchange>;
|
|
177
|
+
export declare const signinVerify: (base: string, creds: Credentials, workspace: string, user: string, version?: string) => Promise<{
|
|
178
|
+
user: CloudUser;
|
|
179
|
+
role: "owner" | "member";
|
|
180
|
+
}>;
|
|
181
|
+
/** Where the browser goes to sign in to workspace `workspaceId` served by machine `machineId`. */
|
|
182
|
+
export declare function signinUrl(base: string, q: {
|
|
183
|
+
workspace: string;
|
|
184
|
+
machine: string;
|
|
185
|
+
redirect: string;
|
|
186
|
+
state: string;
|
|
187
|
+
}): string;
|
|
188
|
+
/**
|
|
189
|
+
* ~/.kraftwerk/account.json — the account that claimed this machine
|
|
190
|
+
* ({id, email, handle}), written by the daemon when the cloud names it and
|
|
191
|
+
* removed when the claim ends. The machine's own shell (the CLI) acts as
|
|
192
|
+
* this person in a `users: cloud` workspace.
|
|
193
|
+
*/
|
|
194
|
+
export declare const accountFilePath: () => string;
|
|
195
|
+
export declare function readAccountFile(): Promise<CloudUser | null>;
|
|
196
|
+
/** Write (or with null remove) account.json; unchanged content is not rewritten. */
|
|
197
|
+
export declare function writeAccountFile(user: CloudUser | null): Promise<void>;
|