@netnodeag/kraftwerk 0.91.0 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/chat/seats.js +24 -1
- package/dist/core/chat/sessions.js +26 -3
- package/dist/core/chat/types.d.ts +7 -0
- package/package.json +1 -1
- package/web/dist/assets/{dist-MLy_Y-bk.js → dist-BDzDJxBN.js} +1 -1
- package/web/dist/assets/{dist-OqZg6HSo.js → dist-BJHyEMD6.js} +1 -1
- package/web/dist/assets/{dist-Dyuuk1fJ.js → dist-BMw0PFGO.js} +1 -1
- package/web/dist/assets/{dist-C0Jxvhwn.js → dist-BSM_KuBz.js} +1 -1
- package/web/dist/assets/{dist-DiWjZMcB.js → dist-BVlbFMCK.js} +1 -1
- package/web/dist/assets/{dist-Csjcf5LO.js → dist-CM-I3GJQ.js} +1 -1
- package/web/dist/assets/{dist-DG_vz4ve.js → dist-CY76FfB-.js} +1 -1
- package/web/dist/assets/dist-CdbA3SAY.js +1 -0
- package/web/dist/assets/{dist-D7WMKT8o.js → dist-CuJkNA8f.js} +1 -1
- package/web/dist/assets/{dist-oZGvjDYG.js → dist-D2ma_vc1.js} +1 -1
- package/web/dist/assets/{dist-CZxfdtxW.js → dist-DFZMTIk8.js} +1 -1
- package/web/dist/assets/{editor-BVY58sKa.js → editor-JaYZTIcu.js} +3 -3
- package/web/dist/assets/{index-Dx5HEIp7.js → index-63UhW1II.js} +4 -4
- package/web/dist/assets/index-BiOStRo2.css +2 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/dist-C1WqvXAD.js +0 -1
- package/web/dist/assets/index-CeXHhxNI.css +0 -2
package/dist/core/chat/seats.js
CHANGED
|
@@ -10,7 +10,7 @@ import { writeMeta } from "./store.js";
|
|
|
10
10
|
import { availableSkills } from "./context.js";
|
|
11
11
|
import { effectiveCwd } from "./sessions.js";
|
|
12
12
|
import { sessionTemp } from "../temp.js";
|
|
13
|
-
import { emit, isUnattended, ownerLabel, seatAuthor } from "./state.js";
|
|
13
|
+
import { MAIN, emit, isUnattended, ownerLabel, seatAuthor } from "./state.js";
|
|
14
14
|
/**
|
|
15
15
|
* Starting an agent process for a seat: its harness, tuning (model,
|
|
16
16
|
* effort), working folder and context, and wiring its events into the chat.
|
|
@@ -190,5 +190,28 @@ export async function ensureBackend(state, seat) {
|
|
|
190
190
|
// in its window. A fresh process is a fresh context window: re-send the
|
|
191
191
|
// scope context with the next prompt.
|
|
192
192
|
seat.needsContext = !seat.backend.resumed;
|
|
193
|
+
await applyPendingConfig(state, seat);
|
|
193
194
|
return seat.backend;
|
|
194
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Settings picked while the agent was down (meta.pendingConfig), applied to
|
|
198
|
+
* the fresh backend before anything is prompted. One the agent refuses is
|
|
199
|
+
* said in the thread and dropped; the chat goes on with the agent's default.
|
|
200
|
+
*/
|
|
201
|
+
async function applyPendingConfig(state, seat) {
|
|
202
|
+
const pending = state.meta.pendingConfig;
|
|
203
|
+
if (seat.key !== MAIN || !pending)
|
|
204
|
+
return;
|
|
205
|
+
delete state.meta.pendingConfig;
|
|
206
|
+
void writeMeta(state.meta).catch(() => { });
|
|
207
|
+
if (!seat.backend?.setConfig)
|
|
208
|
+
return;
|
|
209
|
+
for (const [configId, value] of Object.entries(pending)) {
|
|
210
|
+
try {
|
|
211
|
+
await seat.backend.setConfig(configId, value);
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
emit(state, { type: "error", message: `could not apply ${configId} = ${String(value)}: ${err.message}` });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
@@ -453,9 +453,12 @@ export async function setChatConfig(id, configId, value) {
|
|
|
453
453
|
const state = await loadState(id);
|
|
454
454
|
if (!state)
|
|
455
455
|
return { error: "not found" };
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
456
|
+
const seat = mainSeat(state);
|
|
457
|
+
const backend = seat.backend;
|
|
458
|
+
if (!backend)
|
|
459
|
+
return pendConfig(state, configId, value);
|
|
460
|
+
if (!backend.setConfig)
|
|
461
|
+
return { error: "this agent does not take settings" };
|
|
459
462
|
try {
|
|
460
463
|
await backend.setConfig(configId, value);
|
|
461
464
|
return {};
|
|
@@ -464,6 +467,26 @@ export async function setChatConfig(id, configId, value) {
|
|
|
464
467
|
return { error: err.message };
|
|
465
468
|
}
|
|
466
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* The agent is not running (idle reaper, restart, or it never started): keep
|
|
472
|
+
* the choice in meta.pendingConfig for the next start, and show it now by
|
|
473
|
+
* re-announcing the last known settings with the new value. Only an option
|
|
474
|
+
* the agent announced before, with a value it offered, is kept.
|
|
475
|
+
*/
|
|
476
|
+
async function pendConfig(state, configId, value) {
|
|
477
|
+
const last = [...state.events].reverse().find((e) => e.type === "config" && !e.from);
|
|
478
|
+
const options = last?.type === "config" ? last.options : [];
|
|
479
|
+
const option = options.find((o) => o.id === configId);
|
|
480
|
+
if (!option)
|
|
481
|
+
return { error: "the agent is not running and has not announced this setting yet — send a message first" };
|
|
482
|
+
if (option.type === "select" ? typeof value !== "string" || !option.choices.some((c) => c.value === value) : typeof value !== "boolean") {
|
|
483
|
+
return { error: `"${String(value)}" is not a choice for ${option.name}` };
|
|
484
|
+
}
|
|
485
|
+
state.meta.pendingConfig = { ...state.meta.pendingConfig, [configId]: value };
|
|
486
|
+
await writeMeta(state.meta);
|
|
487
|
+
emit(state, { type: "config", options: options.map((o) => (o.id === configId ? { ...o, value } : o)) });
|
|
488
|
+
return {};
|
|
489
|
+
}
|
|
467
490
|
/** The agent's own sessions in the project root (Claude Code / Codex transcripts), to continue one as a chat. */
|
|
468
491
|
export async function listAgentSessionsFor(agent) {
|
|
469
492
|
if (agent === "pi")
|
|
@@ -85,6 +85,13 @@ export interface ChatMeta {
|
|
|
85
85
|
* over with the transcript as a summary.
|
|
86
86
|
*/
|
|
87
87
|
sessions?: Record<string, string>;
|
|
88
|
+
/**
|
|
89
|
+
* Settings (model, thinking depth, ...) picked while the chat's agent was
|
|
90
|
+
* not running, by config id. The next backend of the main seat applies
|
|
91
|
+
* them before its first prompt, then they are dropped: switching away
|
|
92
|
+
* from a model that hit its limit must not need a message on that model.
|
|
93
|
+
*/
|
|
94
|
+
pendingConfig?: Record<string, string | boolean>;
|
|
88
95
|
/** Who started the chat (a routine's run: this machine's person). */
|
|
89
96
|
author?: ChatPerson;
|
|
90
97
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netnodeag/kraftwerk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.92.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",
|