@netnodeag/kraftwerk 0.95.0 → 0.96.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 +17 -7
- package/dist/acp.d.ts +31 -3
- package/dist/acp.js +63 -2
- 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/projects.js +2 -2
- package/dist/client/routes.d.ts +1 -0
- package/dist/client/routes.js +1 -0
- package/dist/core/agents.js +1 -1
- package/dist/core/board-wake.d.ts +1 -1
- 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 +10 -2
- package/dist/core/chat/sessions.js +28 -4
- package/dist/core/chat/types.d.ts +1 -1
- 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/chats.d.ts +4 -1
- package/dist/server/api/chats.js +20 -6
- package/dist/server/api/index.d.ts +4 -1
- package/package.json +1 -1
- package/schema/workflow.schema.json +4 -3
- package/web/dist/assets/{dist-SHAE_oEQ.js → dist-14HFV7uD.js} +1 -1
- package/web/dist/assets/{dist-BlxwNXF3.js → dist-BYgXVWBg.js} +1 -1
- package/web/dist/assets/{dist--oB2_FQJ.js → dist-BiyjchCb.js} +1 -1
- package/web/dist/assets/dist-CCZcAg77.js +1 -0
- package/web/dist/assets/{dist-Ys1tb91R.js → dist-DKQkCBo9.js} +1 -1
- package/web/dist/assets/{dist-SL9iU_p4.js → dist-DO04nOS3.js} +1 -1
- package/web/dist/assets/{dist-DB33yOhN.js → dist-DOW1X_nG.js} +1 -1
- package/web/dist/assets/{dist-Tdda9sK7.js → dist-DbBrc07-.js} +1 -1
- package/web/dist/assets/{dist-CRqkyR9b.js → dist-DkDmdJNX.js} +1 -1
- package/web/dist/assets/{dist-WA1PTY07.js → dist-qkoQQWNK.js} +1 -1
- package/web/dist/assets/{dist-FlDPUw_l.js → dist-wkkpVezb.js} +1 -1
- package/web/dist/assets/{editor-Clx4xAh9.js → editor-DvkpSp7h.js} +3 -3
- package/web/dist/assets/{index-BJml45iw.js → index-B5PLhJ-C.js} +16 -16
- package/web/dist/index.html +1 -1
- package/web/dist/assets/dist-C3zyJ_nA.js +0 -1
|
@@ -3,7 +3,8 @@ 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
9
|
import { readIdentity } from "../identity.js";
|
|
9
10
|
import { moveToTrash } from "../trash.js";
|
|
@@ -59,6 +60,7 @@ export async function createChat(opts) {
|
|
|
59
60
|
...(opts.resume && opts.agent !== "pi" ? { sessions: { [MAIN]: opts.resume } } : {}),
|
|
60
61
|
author,
|
|
61
62
|
...(opts.private ? { private: true } : {}),
|
|
63
|
+
...(opts.config && Object.keys(opts.config).length ? { pendingConfig: opts.config } : {}),
|
|
62
64
|
createdAt: now,
|
|
63
65
|
updatedAt: now,
|
|
64
66
|
};
|
|
@@ -330,7 +332,7 @@ export async function setChatVibeable(id, slug) {
|
|
|
330
332
|
* Fork a chat: a new chat with the same transcript whose agent continues
|
|
331
333
|
* from a copy of this session (session/fork) — try something without
|
|
332
334
|
* losing the original thread. Needs a session to fork: an agent that keeps
|
|
333
|
-
* one (claude
|
|
335
|
+
* one (claude — codex and antigravity have no fork, pi has no ACP session) that has answered at least
|
|
334
336
|
* once. The source's process is (re)spawned if needed; the fork's own
|
|
335
337
|
* process starts with its first message and resumes the forked id.
|
|
336
338
|
*/
|
|
@@ -343,8 +345,8 @@ export async function forkChat(id, by) {
|
|
|
343
345
|
return { error: "a channel cannot be forked", status: 409 };
|
|
344
346
|
if (meta.agent === "pi")
|
|
345
347
|
return { error: "pi chats have no session to fork", status: 409 };
|
|
346
|
-
if (meta.agent === "codex")
|
|
347
|
-
return { error:
|
|
348
|
+
if (meta.agent === "codex" || meta.agent === "antigravity")
|
|
349
|
+
return { error: `fork is not supported by ${meta.agent}`, status: 409 };
|
|
348
350
|
if (!meta.sessions?.[MAIN])
|
|
349
351
|
return { error: "nothing to fork yet — the agent has not answered in this chat", status: 409 };
|
|
350
352
|
if (isBusy(state))
|
|
@@ -493,6 +495,28 @@ export async function listAgentSessionsFor(agent) {
|
|
|
493
495
|
return [];
|
|
494
496
|
return listAgentSessions(agent, workspaceRoot());
|
|
495
497
|
}
|
|
498
|
+
// What each agent offers, per workspace: asking means starting the agent (a second or two), and it changes only with its login or version.
|
|
499
|
+
const offered = new Map();
|
|
500
|
+
const OFFERED_TTL_MS = 30 * 60_000;
|
|
501
|
+
/**
|
|
502
|
+
* The model and thinking depth a new chat on `agent` can start with — the
|
|
503
|
+
* choices the agent itself announces (they depend on its login and
|
|
504
|
+
* version, so there is no fixed list); pi's from `pi --list-models`.
|
|
505
|
+
*/
|
|
506
|
+
export async function startOptionsFor(agent) {
|
|
507
|
+
if (agent === "pi")
|
|
508
|
+
return piOptions(await listPiModels());
|
|
509
|
+
const cwd = workspaceRoot();
|
|
510
|
+
const key = `${cwd}\0${agent}`;
|
|
511
|
+
let hit = offered.get(key);
|
|
512
|
+
if (!hit || Date.now() - hit.at > OFFERED_TTL_MS) {
|
|
513
|
+
hit = { at: Date.now(), options: announcedOptions(agent, cwd).then((all) => all.filter((o) => o.category === "model" || o.category === "thought_level")) };
|
|
514
|
+
offered.set(key, hit);
|
|
515
|
+
// A failed ask (agent not installed, logged out) is asked again next time.
|
|
516
|
+
hit.options.catch(() => offered.delete(key));
|
|
517
|
+
}
|
|
518
|
+
return hit.options;
|
|
519
|
+
}
|
|
496
520
|
export async function resolvePermission(id, requestId, optionId) {
|
|
497
521
|
const state = await loadState(id);
|
|
498
522
|
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
|
}
|
package/dist/harness.d.ts
CHANGED
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
* via resume; across harnesses, context travels through the files in the
|
|
12
12
|
* run directory (the workspace-context contract).
|
|
13
13
|
*/
|
|
14
|
-
export type HarnessId = "claude" | "codex" | "pi";
|
|
14
|
+
export type HarnessId = "claude" | "codex" | "pi" | "antigravity";
|
|
15
15
|
/**
|
|
16
16
|
* How the harness is driven: `cli` spawns the headless CLI per phase
|
|
17
17
|
* (claude -p, codex exec, pi); `acp` keeps one Agent Client Protocol
|
|
18
|
-
* adapter alive for the run (see harnesses/acp.ts). pi has no adapter
|
|
18
|
+
* adapter alive for the run (see harnesses/acp.ts). pi has no adapter;
|
|
19
|
+
* antigravity has nothing but one (`agy acp`), so it always runs over ACP.
|
|
19
20
|
*/
|
|
20
21
|
export type AgentProtocol = "cli" | "acp";
|
|
21
22
|
/**
|
package/dist/harnesses/acp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestError, } from "@agentclientprotocol/sdk/unstable";
|
|
2
|
-
import { acpMcpServers, adapterEnv, connectAcp, openSession } from "../acp.js";
|
|
2
|
+
import { acpMcpServers, adapterEnv, connectAcp, openSession, applyTuningConfig } from "../acp.js";
|
|
3
3
|
import { declineOption, unattendedMode } from "../core/chat/permissions.js";
|
|
4
4
|
const live = new Map();
|
|
5
5
|
// The run process is the adapters' only owner: never leave one behind.
|
|
@@ -101,6 +101,8 @@ async function open(agent, inv, resume) {
|
|
|
101
101
|
console.log(` ⚠ could not resume session ${resume} (${session.resumeError}) — a new ${agent} session starts without the earlier phases in context`);
|
|
102
102
|
}
|
|
103
103
|
state.sessionId = session.sessionId;
|
|
104
|
+
// Antigravity takes model and thinking depth as session settings.
|
|
105
|
+
await applyTuningConfig(agent, conn, session.sessionId, { model: inv.model, effort: inv.effort }, session.configOptions, (message) => console.log(` ⚠ ${message} — the ${agent} default applies`));
|
|
104
106
|
const modeId = unattendedMode(agent, session.modes?.currentModeId);
|
|
105
107
|
if (modeId) {
|
|
106
108
|
await conn.setSessionMode({ sessionId: session.sessionId, modeId }).catch((err) => {
|
|
@@ -14,7 +14,8 @@ const HARNESSES = {
|
|
|
14
14
|
pi: piHarness,
|
|
15
15
|
};
|
|
16
16
|
export function harnessFor(id = "claude", protocol = "cli") {
|
|
17
|
-
|
|
17
|
+
// Antigravity's CLI is its ACP server: there is no other way to drive it.
|
|
18
|
+
if (protocol === "acp" || id === "antigravity")
|
|
18
19
|
return acpHarness(id);
|
|
19
20
|
const harness = HARNESSES[id];
|
|
20
21
|
if (!harness) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
/** Chats: ACP sessions with a coding agent, their event stream, and what a person does in them. */
|
|
3
|
-
export declare const chatRoutes: (import("./router.js").Route<"agents.
|
|
3
|
+
export declare const chatRoutes: (import("./router.js").Route<"agents.options", {
|
|
4
|
+
options: import("../../core/chat/types.js").ConfigOption[];
|
|
5
|
+
}, "/api/agent-options", undefined> | import("./router.js").Route<"agents.sessions", {
|
|
4
6
|
sessions: {
|
|
5
7
|
sessionId: string;
|
|
6
8
|
title?: string;
|
|
@@ -36,6 +38,7 @@ export declare const chatRoutes: (import("./router.js").Route<"agents.sessions",
|
|
|
36
38
|
resume: z.ZodOptional<z.ZodString>;
|
|
37
39
|
project: z.ZodOptional<z.ZodString>;
|
|
38
40
|
task: z.ZodOptional<z.ZodString>;
|
|
41
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
39
42
|
}, z.core.$strip>> | import("./router.js").Route<"chats.delete", import("./router.js").Reply<{
|
|
40
43
|
error?: string;
|
|
41
44
|
}>, "/api/chats/:id", undefined> | import("./router.js").Route<"chats.elicitation", import("./router.js").Reply<{
|
package/dist/server/api/chats.js
CHANGED
|
@@ -2,7 +2,7 @@ import { promises as fs } from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { getAgent } from "../../core/agents.js";
|
|
5
|
-
import { answerElicitation, cancelChat, createChat, deleteChat, forkChat, getChat, listAgentSessionsFor, listChats, localPerson, postMessage, renameChat, resetSession, resolvePermission, setChatConfig, setChatProject, setChatVibeable, steerChat, stopChatTask, subscribeChat, } from "../../core/chat/sessions.js";
|
|
5
|
+
import { answerElicitation, cancelChat, createChat, deleteChat, forkChat, getChat, listAgentSessionsFor, startOptionsFor, listChats, localPerson, postMessage, renameChat, resetSession, resolvePermission, setChatConfig, setChatProject, setChatVibeable, steerChat, stopChatTask, subscribeChat, } from "../../core/chat/sessions.js";
|
|
6
6
|
import { attachmentPath, readMeta, saveAttachment } from "../../core/chat/store.js";
|
|
7
7
|
import { remoteCaller } from "../trust.js";
|
|
8
8
|
import { findTask } from "../../core/boards.js";
|
|
@@ -10,7 +10,7 @@ import { getProject } from "../../core/projects.js";
|
|
|
10
10
|
import { MIME } from "./mime.js";
|
|
11
11
|
import { projectErrors } from "./projects.js";
|
|
12
12
|
import { ApiError, fail, readRawBody, reply, route } from "./router.js";
|
|
13
|
-
const AGENTS = ["claude", "codex", "pi"];
|
|
13
|
+
const AGENTS = ["claude", "codex", "pi", "antigravity"];
|
|
14
14
|
/** A chat id that names no chat folder (or a malformed one) is a 400. */
|
|
15
15
|
const validChat = (p, message = "invalid chat id") => p.catch((err) => {
|
|
16
16
|
throw err instanceof ApiError ? err : new ApiError(400, message);
|
|
@@ -31,6 +31,8 @@ const NewChat = z.object({
|
|
|
31
31
|
project: z.string().optional(),
|
|
32
32
|
/** The board task the chat works on (<project>/<board>/<task> or <board>/<task>): listed on the task's page (meta.task). */
|
|
33
33
|
task: z.string().optional(),
|
|
34
|
+
/** Settings to start with, by config id (see agents.options): applied before the first prompt. */
|
|
35
|
+
config: z.record(z.string(), z.union([z.string(), z.boolean()])).optional(),
|
|
34
36
|
});
|
|
35
37
|
/** An action on a running chat: `{ok}` when it went through, 409 with the reason when the chat refused. */
|
|
36
38
|
const act = (name, path, summary, body, run) => route({ name, method: "POST", path, summary, errors: 400, body }, async (c) => {
|
|
@@ -113,12 +115,12 @@ export const chatRoutes = [
|
|
|
113
115
|
const chats = await listChats();
|
|
114
116
|
return { chats: remoteCaller(c.trust) ? chats.filter((x) => !x.private) : chats };
|
|
115
117
|
}),
|
|
116
|
-
route({ name: "chats.create", method: "POST", path: "/api/chats", summary: "start a chat {agent, scope, resume?, project?, task?}", errors: 404, body: NewChat }, async (c) => {
|
|
118
|
+
route({ name: "chats.create", method: "POST", path: "/api/chats", summary: "start a chat {agent, scope, resume?, project?, task?, config?}", errors: 404, body: NewChat }, async (c) => {
|
|
117
119
|
// `resume` continues one of the agent's own sessions (see agents.sessions).
|
|
118
120
|
const body = await c.body();
|
|
119
121
|
const { agent, scope } = await scopeOf(body);
|
|
120
122
|
if (!AGENTS.includes(agent))
|
|
121
|
-
fail(400, "agent must be claude, codex, or
|
|
123
|
+
fail(400, "agent must be claude, codex, pi, or antigravity");
|
|
122
124
|
if (body.project && scope.kind !== "agent")
|
|
123
125
|
fail(400, "only an agent's chat takes a project");
|
|
124
126
|
const project = body.project ? await projectSlug(body.project) : undefined;
|
|
@@ -131,18 +133,30 @@ export const chatRoutes = [
|
|
|
131
133
|
...(project ? { project } : {}),
|
|
132
134
|
...(task ? { task } : {}),
|
|
133
135
|
...(body.resume ? { resume: body.resume } : {}),
|
|
136
|
+
...(body.config ? { config: body.config } : {}),
|
|
134
137
|
});
|
|
135
138
|
}
|
|
136
139
|
catch (err) {
|
|
137
140
|
throw new ApiError(400, err.message);
|
|
138
141
|
}
|
|
139
142
|
}),
|
|
140
|
-
route({ name: "agents.sessions", method: "GET", path: "/api/agent-sessions", summary: "the agent's own sessions in the workspace ?agent=claude|codex|pi", errors: 502 }, async (c) => {
|
|
143
|
+
route({ name: "agents.sessions", method: "GET", path: "/api/agent-sessions", summary: "the agent's own sessions in the workspace ?agent=claude|codex|pi|antigravity", errors: 502 }, async (c) => {
|
|
141
144
|
const agent = c.query.get("agent") ?? "claude";
|
|
142
145
|
if (!AGENTS.includes(agent))
|
|
143
|
-
fail(400, "agent must be claude, codex, or
|
|
146
|
+
fail(400, "agent must be claude, codex, pi, or antigravity");
|
|
144
147
|
return { sessions: await listAgentSessionsFor(agent) };
|
|
145
148
|
}),
|
|
149
|
+
route({ name: "agents.options", method: "GET", path: "/api/agent-options", summary: "the model and thinking depth a new chat on ?agent= can start with, as the agent announces them", errors: 502 }, async (c) => {
|
|
150
|
+
const agent = c.query.get("agent") ?? "claude";
|
|
151
|
+
if (!AGENTS.includes(agent))
|
|
152
|
+
fail(400, "agent must be claude, codex, pi, or antigravity");
|
|
153
|
+
try {
|
|
154
|
+
return { options: await startOptionsFor(agent) };
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
throw new ApiError(502, `${agent} did not answer: ${err.message}`);
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
146
160
|
route({ name: "chats.get", method: "GET", path: "/api/chats/:id", summary: "the chat's meta and events" }, async (c) => (await validChat(getChat(c.params.id))) ?? fail(404, "not found")),
|
|
147
161
|
route({ name: "chats.delete", method: "DELETE", path: "/api/chats/:id", summary: "delete the chat" }, async (c) => {
|
|
148
162
|
const result = await validChat(deleteChat(c.params.id));
|
|
@@ -56,7 +56,9 @@ export declare const routes: (Route<"agents.addJournal", {
|
|
|
56
56
|
}, "/api/agents/:slug/journal", undefined> | Route<"agents.list", {
|
|
57
57
|
root: string;
|
|
58
58
|
agents: import("../../core/agents.js").Agent[];
|
|
59
|
-
}, "/api/agents", undefined> | Route<"agents.
|
|
59
|
+
}, "/api/agents", undefined> | Route<"agents.options", {
|
|
60
|
+
options: import("../../core/chat/types.js").ConfigOption[];
|
|
61
|
+
}, "/api/agent-options", undefined> | Route<"agents.routines", {
|
|
60
62
|
routines: import("../../core/routines.js").RoutineStatus[];
|
|
61
63
|
}, "/api/agents/:slug/routines", undefined> | Route<"agents.runRoutine", {
|
|
62
64
|
chatId: string;
|
|
@@ -256,6 +258,7 @@ export declare const routes: (Route<"agents.addJournal", {
|
|
|
256
258
|
resume: z.ZodOptional<z.ZodString>;
|
|
257
259
|
project: z.ZodOptional<z.ZodString>;
|
|
258
260
|
task: z.ZodOptional<z.ZodString>;
|
|
261
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
|
|
259
262
|
}, z.core.$strip>> | Route<"chats.delete", import("./router.js").Reply<{
|
|
260
263
|
error?: string;
|
|
261
264
|
}>, "/api/chats/:id", undefined> | Route<"chats.elicitation", import("./router.js").Reply<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netnodeag/kraftwerk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.96.0",
|
|
4
4
|
"description": "Open-source agentic workspace for teams — where people and AI agents get work done together: agents (Claude Code, Codex, Pi), skills, shared knowledge, repeatable workflows, and deterministic verification",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"cli",
|
|
38
38
|
"acp"
|
|
39
39
|
],
|
|
40
|
-
"description": "How agents are driven: cli (default) spawns the harness CLI per phase; acp keeps one Agent Client Protocol adapter (bundled claude-agent-acp / codex-acp, no CLI needed) alive for the run. Per-agent `protocol` overrides. runs-on: pi has no adapter."
|
|
40
|
+
"description": "How agents are driven: cli (default) spawns the harness CLI per phase; acp keeps one Agent Client Protocol adapter (bundled claude-agent-acp / codex-acp, no CLI needed) alive for the run. Per-agent `protocol` overrides. runs-on: pi has no adapter; antigravity (agy acp, needs the agy CLI) has only the adapter."
|
|
41
41
|
},
|
|
42
42
|
"mcp": {
|
|
43
43
|
"type": "object",
|
|
@@ -117,9 +117,10 @@
|
|
|
117
117
|
"enum": [
|
|
118
118
|
"claude",
|
|
119
119
|
"codex",
|
|
120
|
-
"pi"
|
|
120
|
+
"pi",
|
|
121
|
+
"antigravity"
|
|
121
122
|
],
|
|
122
|
-
"description": "Harness that executes this agent (default: claude)"
|
|
123
|
+
"description": "Harness that executes this agent (default: claude). antigravity always runs over the agent protocol (agy acp)."
|
|
123
124
|
},
|
|
124
125
|
"protocol": {
|
|
125
126
|
"enum": [
|