@netnodeag/kraftwerk 0.96.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 +30 -0
- package/dist/cli/boards.js +6 -5
- 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 +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +3 -0
- package/dist/client/routes.d.ts +1 -0
- package/dist/client/routes.js +1 -0
- package/dist/config.d.ts +34 -0
- package/dist/config.js +28 -1
- package/dist/core/boards.d.ts +1 -1
- package/dist/core/boards.js +10 -6
- package/dist/core/chat/sessions.d.ts +3 -3
- package/dist/core/chat/sessions.js +6 -5
- package/dist/core/chat/types.d.ts +2 -0
- 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/server/api/agents.js +2 -2
- package/dist/server/api/boards.js +1 -1
- package/dist/server/api/chats.js +11 -7
- package/dist/server/api/cloud.d.ts +8 -0
- package/dist/server/api/index.d.ts +21 -2
- 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/web/dist/assets/{dist-BiyjchCb.js → dist-BD4ooe-Y.js} +1 -1
- package/web/dist/assets/{dist-qkoQQWNK.js → dist-BduOHHOY.js} +1 -1
- package/web/dist/assets/{dist-DkDmdJNX.js → dist-BoajTxbz.js} +1 -1
- package/web/dist/assets/{dist-wkkpVezb.js → dist-DGLb7wE6.js} +1 -1
- package/web/dist/assets/{dist-14HFV7uD.js → dist-DJACzcZZ.js} +1 -1
- package/web/dist/assets/{dist-DO04nOS3.js → dist-DY6QplYX.js} +1 -1
- package/web/dist/assets/{dist-DbBrc07-.js → dist-D_uWSMLk.js} +1 -1
- package/web/dist/assets/{dist-DKQkCBo9.js → dist-P7JCq9c3.js} +1 -1
- package/web/dist/assets/dist-ajNgHt2Q.js +1 -0
- package/web/dist/assets/{dist-BYgXVWBg.js → dist-lcPkaK4d.js} +1 -1
- package/web/dist/assets/{dist-DOW1X_nG.js → dist-oRcLByHn.js} +1 -1
- package/web/dist/assets/{editor-DvkpSp7h.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-CCZcAg77.js +0 -1
- package/web/dist/assets/index-B5PLhJ-C.js +0 -488
- package/web/dist/assets/index-CWopPK15.css +0 -2
package/README.md
CHANGED
|
@@ -535,6 +535,36 @@ names no origin — and `cloud.interval` is ignored: the cloud sets the
|
|
|
535
535
|
cadence.) `/api/meta` and `/api/cloud` report the machine's state and claim
|
|
536
536
|
code; `kraftwerk doctor` prints what happens to the workspace.
|
|
537
537
|
|
|
538
|
+
### Who works here: users
|
|
539
|
+
|
|
540
|
+
Everything a person does — a task created, a log line, a knowledge page
|
|
541
|
+
verified, a chat message — is signed with who did it. `users:` in
|
|
542
|
+
kraftwerk.yml says who that is:
|
|
543
|
+
|
|
544
|
+
```yaml
|
|
545
|
+
users:
|
|
546
|
+
mode: local # default: whoever sits at this machine, as human:<handle> (~/.kraftwerk/identity.json)
|
|
547
|
+
mode: cloud # people sign in with their kraftwerk cloud account
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
With `mode: cloud` this machine's browser signs in before the UI opens: the
|
|
551
|
+
UI sends it to the cloud, the account confirms, and the cloud hands a
|
|
552
|
+
one-time code back that the daemon redeems with the machine's own secret.
|
|
553
|
+
Only accounts on the workspace (its owners and members, an org's people)
|
|
554
|
+
get in. From then on their actions are signed `human:<their handle>`, and
|
|
555
|
+
chats keep the account's uuid — the same person on every machine and clone.
|
|
556
|
+
The cloud is asked again every 15 minutes, so removing someone there signs
|
|
557
|
+
them out here; the person menu in the top bar signs out by hand. The
|
|
558
|
+
machine's own shell (the CLI, scripts on this machine) needs no sign-in: it
|
|
559
|
+
acts as the account that claimed the machine (`~/.kraftwerk/account.json`).
|
|
560
|
+
Paired devices and remote members keep their own credentials. `cloud` needs
|
|
561
|
+
the daemon connected to the cloud and the workspace's `id:`. `GET /api/me`
|
|
562
|
+
says who the caller is.
|
|
563
|
+
|
|
564
|
+
An API caller cannot name another person: a `human:…` actor in a request
|
|
565
|
+
body is replaced by whoever asks. Agents and processes still name
|
|
566
|
+
themselves (`lisa/claude`, `process:sync`).
|
|
567
|
+
|
|
538
568
|
## Projects
|
|
539
569
|
|
|
540
570
|
Turn on `projects:` in `kraftwerk.yml` (or the checkbox in settings) and
|
package/dist/cli/boards.js
CHANGED
|
@@ -5,6 +5,7 @@ import { appendTaskLog, assignTask, createBoard, createTask, DEFAULT_BOARD, dele
|
|
|
5
5
|
import { taskSessions } from "../core/board-wake.js";
|
|
6
6
|
import { initContext as prepare } from "./routines.js";
|
|
7
7
|
import { fmtAgo } from "./workspaces.js";
|
|
8
|
+
import { actorFor } from "../core/person.js";
|
|
8
9
|
/**
|
|
9
10
|
* `kraftwerk boards` and `kraftwerk tasks` — the boards (columns of tasks)
|
|
10
11
|
* of a project or of the workspace, and the tasks on them. The same module
|
|
@@ -36,8 +37,8 @@ const die = (msg) => {
|
|
|
36
37
|
console.error(chalk.red(msg));
|
|
37
38
|
process.exit(1);
|
|
38
39
|
};
|
|
39
|
-
/** Who writes: --actor, else the session's KRAFTWERK_ACTOR, else
|
|
40
|
-
const actorOf = (opt) => (opt ?? process.env.KRAFTWERK_ACTOR ?? "").trim() ||
|
|
40
|
+
/** Who writes: --actor, else the session's KRAFTWERK_ACTOR (an agent), else this machine's person (core/person.ts). */
|
|
41
|
+
const actorOf = (opt) => (opt ?? process.env.KRAFTWERK_ACTOR ?? "").trim() || undefined;
|
|
41
42
|
/** Which agent acts: --as, else the session's KRAFTWERK_AGENT. */
|
|
42
43
|
const agentOf = (opt) => (opt ?? process.env.KRAFTWERK_AGENT ?? "").trim();
|
|
43
44
|
/** The board a command means: --board, else the project's default board when it exists, else the only board. */
|
|
@@ -312,7 +313,7 @@ export function registerBoardCommands(program) {
|
|
|
312
313
|
.option("--file <path>", "The task's markdown (what, done-when, notes) from a file")
|
|
313
314
|
.option("--notes <text>", "The task's markdown inline")
|
|
314
315
|
.option("-m, --message <text>", "A first log line")
|
|
315
|
-
.option("--actor <actor>", "Who writes (default: KRAFTWERK_ACTOR, else human
|
|
316
|
+
.option("--actor <actor>", "Who writes (default: KRAFTWERK_ACTOR, else you: human:<handle>)")
|
|
316
317
|
.option("--json", "Print the task as JSON")
|
|
317
318
|
.action(async (title, opts) => {
|
|
318
319
|
await prepare();
|
|
@@ -420,7 +421,7 @@ export function registerBoardCommands(program) {
|
|
|
420
421
|
.argument("[entry]", "The line to record")
|
|
421
422
|
.option("--file <path>", "Read the entry from a file")
|
|
422
423
|
.option("--tail <n>", "Print the newest n lines instead of writing")
|
|
423
|
-
.option("--actor <actor>", "Who writes (default: KRAFTWERK_ACTOR, else human
|
|
424
|
+
.option("--actor <actor>", "Who writes (default: KRAFTWERK_ACTOR, else you: human:<handle>)")
|
|
424
425
|
.action(async (task, entry, opts) => {
|
|
425
426
|
await prepare();
|
|
426
427
|
try {
|
|
@@ -439,7 +440,7 @@ export function registerBoardCommands(program) {
|
|
|
439
440
|
}
|
|
440
441
|
const text = opts.file ? await readFile(opts.file, "utf8") : entry ?? "";
|
|
441
442
|
const t = await appendTaskLog(ref, task, text, actorOf(opts.actor));
|
|
442
|
-
console.log(`${chalk.green("✔")} logged on ${chalk.cyan(String(t.number))} ${chalk.dim(`(${actorOf(opts.actor)})`)}`);
|
|
443
|
+
console.log(`${chalk.green("✔")} logged on ${chalk.cyan(String(t.number))} ${chalk.dim(`(${await actorFor(actorOf(opts.actor))})`)}`);
|
|
443
444
|
}
|
|
444
445
|
catch (err) {
|
|
445
446
|
die(err.message);
|
package/dist/cli/init.js
CHANGED
|
@@ -38,6 +38,8 @@ skills: ${DATA_DIR}/skills # workspace skills (shared instruction packag
|
|
|
38
38
|
# presentations: # slide decks as folders (deck.md + assets) per project and under ${DATA_DIR}/presentations — rendered from a template into PPTX, PDF and slide images (uncomment to enable)
|
|
39
39
|
# cloud: # the daemon registers this MACHINE with the kraftwerk cloud and lists this workspace (\`kraftwerk login\` claims the machine)
|
|
40
40
|
# enabled: false # uncomment both lines to leave this workspace out (\`kraftwerk cloud off\` turns the cloud off for the whole machine)
|
|
41
|
+
# users: # who works here: local (default) = this machine's handle; cloud = people sign in with their kraftwerk cloud account
|
|
42
|
+
# mode: cloud
|
|
41
43
|
`;
|
|
42
44
|
const WORKFLOW_TEMPLATE = `# yaml-language-server: $schema=${SCHEMA_URL}
|
|
43
45
|
name: hello
|
package/dist/cli/knowledge.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolveWorkspace } from "../config.js";
|
|
|
5
5
|
import { fsck, getConcept, initBundle, knowledgeRoot, listBundles, listConcepts, searchKnowledge, validateBundle, verifyConcept, writeConcept, } from "../okf.js";
|
|
6
6
|
import { deleteBundle } from "../core/knowledge.js";
|
|
7
7
|
import { initContext as prepare } from "./routines.js";
|
|
8
|
+
import { actorFor } from "../core/person.js";
|
|
8
9
|
/**
|
|
9
10
|
* `kraftwerk knowledge` — the CLI surface over OKF bundles (the
|
|
10
11
|
* inspector's Knowledge screen). This is the enforced write path: `put` stamps provenance
|
|
@@ -13,10 +14,11 @@ import { initContext as prepare } from "./routines.js";
|
|
|
13
14
|
*
|
|
14
15
|
* Agents identify via --actor (or KRAFTWERK_ACTOR); the OKF convention is
|
|
15
16
|
* `<producer>/<version>` for agents, `human:<id>` for people,
|
|
16
|
-
* `process:<id>` for automation.
|
|
17
|
+
* `process:<id>` for automation. A person is this machine's
|
|
18
|
+
* (`human:<handle>`, core/person.ts).
|
|
17
19
|
*/
|
|
18
|
-
const DEFAULT_ACTOR = "human
|
|
19
|
-
const actorOf = (opts) => opts.actor?.trim() || process.env.KRAFTWERK_ACTOR?.trim()
|
|
20
|
+
const DEFAULT_ACTOR = "you: human:<handle>";
|
|
21
|
+
const actorOf = (opts) => actorFor(opts.actor?.trim() || process.env.KRAFTWERK_ACTOR?.trim());
|
|
20
22
|
async function root() {
|
|
21
23
|
const project = await resolveWorkspace(process.cwd());
|
|
22
24
|
return knowledgeRoot(project.root, project.config.knowledge);
|
|
@@ -128,9 +130,10 @@ export function registerKnowledgeCommands(program) {
|
|
|
128
130
|
process.exit(2);
|
|
129
131
|
}
|
|
130
132
|
try {
|
|
131
|
-
const
|
|
133
|
+
const actor = await actorOf(opts);
|
|
134
|
+
const result = await writeConcept(await root(), bundle, id, content, actor);
|
|
132
135
|
console.log(`${chalk.green("✔")} ${result.created ? "created" : "updated"} ${chalk.cyan(`${bundle}/${result.concept.id}`)} ` +
|
|
133
|
-
chalk.dim(`(${result.concept.type}, by ${
|
|
136
|
+
chalk.dim(`(${result.concept.type}, by ${actor})`));
|
|
134
137
|
}
|
|
135
138
|
catch (err) {
|
|
136
139
|
console.error(chalk.red(err.message));
|
|
@@ -144,7 +147,7 @@ export function registerKnowledgeCommands(program) {
|
|
|
144
147
|
.option("--by <actor>", `Verifier actor (default: ${DEFAULT_ACTOR})`)
|
|
145
148
|
.action(async (ref, opts) => {
|
|
146
149
|
const { bundle, id } = splitRef(ref);
|
|
147
|
-
const actor = opts.by?.trim() || process.env.KRAFTWERK_ACTOR?.trim()
|
|
150
|
+
const actor = await actorFor(opts.by?.trim() || process.env.KRAFTWERK_ACTOR?.trim());
|
|
148
151
|
try {
|
|
149
152
|
const concept = await verifyConcept(await root(), bundle, id, actor);
|
|
150
153
|
console.log(`${chalk.green("✔")} ${ref} verified by ${actor} → ${tierColor(concept.trustTier)}`);
|
|
@@ -4,6 +4,7 @@ import { readFile } from "node:fs/promises";
|
|
|
4
4
|
import { createDeck, deleteDeck, exportDeck, getDeck, addComment, listComments, updateComment, initTemplate, listAllDecks, listDecks, listTemplates, } from "../core/presentations/index.js";
|
|
5
5
|
import { initContext as prepare } from "./routines.js";
|
|
6
6
|
import { fmtAgo } from "./workspaces.js";
|
|
7
|
+
import { machinePerson } from "../core/person.js";
|
|
7
8
|
/**
|
|
8
9
|
* kraftwerk presentations [list] [--project <slug>] [--all] [--json]
|
|
9
10
|
* kraftwerk presentations show <name> [--project <slug>] [--json] the slides, the template's layouts and slots, the warnings
|
|
@@ -171,8 +172,11 @@ export function registerPresentationCommands(program) {
|
|
|
171
172
|
console.log(`${chalk.green("wrote")} ${f}`);
|
|
172
173
|
printWarnings(warnings);
|
|
173
174
|
});
|
|
174
|
-
/** Who writes: the session's actor (an agent), else
|
|
175
|
-
const actor = () =>
|
|
175
|
+
/** Who writes: the session's actor (an agent), else this machine's person. */
|
|
176
|
+
const actor = async () => {
|
|
177
|
+
const given = (process.env.KRAFTWERK_ACTOR ?? "").trim();
|
|
178
|
+
return given || (await machinePerson()).handle;
|
|
179
|
+
};
|
|
176
180
|
cmd
|
|
177
181
|
.command("comments")
|
|
178
182
|
.description("The comments on a deck's slides and boxes: the open ones, or --all")
|
|
@@ -208,7 +212,7 @@ export function registerPresentationCommands(program) {
|
|
|
208
212
|
.option("--slot <box>", "The box it is about")
|
|
209
213
|
.action(async (name, slide, text, opts) => {
|
|
210
214
|
await prepare();
|
|
211
|
-
const c = await addComment(refOf(name, opts.project), { slide: Number(slide), text, author: actor(), ...(opts.slot ? { slot: opts.slot } : {}) }).catch((err) => die(err.message));
|
|
215
|
+
const c = await addComment(refOf(name, opts.project), { slide: Number(slide), text, author: await actor(), ...(opts.slot ? { slot: opts.slot } : {}) }).catch((err) => die(err.message));
|
|
212
216
|
console.log(`${chalk.green("commented")} ${c.id} on slide ${c.n}`);
|
|
213
217
|
});
|
|
214
218
|
cmd
|
|
@@ -221,7 +225,7 @@ export function registerPresentationCommands(program) {
|
|
|
221
225
|
.option("--reopen", "Open it again instead")
|
|
222
226
|
.action(async (name, id, opts) => {
|
|
223
227
|
await prepare();
|
|
224
|
-
await updateComment(refOf(name, opts.project), id, { resolved: !opts.reopen, author: actor(), ...(opts.reply ? { reply: opts.reply } : {}) }).catch((err) => die(err.message));
|
|
228
|
+
await updateComment(refOf(name, opts.project), id, { resolved: !opts.reopen, author: await actor(), ...(opts.reply ? { reply: opts.reply } : {}) }).catch((err) => die(err.message));
|
|
225
229
|
console.log(`${chalk.green(opts.reopen ? "reopened" : "resolved")} ${id}`);
|
|
226
230
|
});
|
|
227
231
|
cmd
|
package/dist/cli/projects.js
CHANGED
|
@@ -194,7 +194,7 @@ export function registerProjectCommands(program) {
|
|
|
194
194
|
.argument("<slug>", "Project folder name")
|
|
195
195
|
.argument("[entry]", "The line to record; omit with --file")
|
|
196
196
|
.option("--file <path>", "Read the entry from a file")
|
|
197
|
-
.option("--actor <actor>", "Who writes:
|
|
197
|
+
.option("--actor <actor>", "Who writes: <agent>/<harness>, process:<id> (default: you, human:<handle>)")
|
|
198
198
|
.action(async (slug, entry, opts) => {
|
|
199
199
|
await prepare();
|
|
200
200
|
try {
|
package/dist/client/index.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ export interface ClientOptions {
|
|
|
77
77
|
token?: string;
|
|
78
78
|
/** Called when the server says this device is not paired (401 `{pair: true}`) — show the pairing screen. */
|
|
79
79
|
onUnauthorized?: () => void;
|
|
80
|
+
/** Called when the workspace signs people in (kraftwerk.yml `users: cloud`) and this browser is not: 401 `{signin}` names where. */
|
|
81
|
+
onSignin?: (url: string) => void;
|
|
80
82
|
}
|
|
81
83
|
export interface Client {
|
|
82
84
|
call<N extends ApiName>(name: N, ...input: InputArg<N>): Promise<ApiResult<N>>;
|
package/dist/client/index.js
CHANGED
|
@@ -62,6 +62,9 @@ export function createClient(opts = {}) {
|
|
|
62
62
|
fn();
|
|
63
63
|
if (res.status === 401 && data?.pair === true)
|
|
64
64
|
opts.onUnauthorized?.();
|
|
65
|
+
const signin = data?.signin;
|
|
66
|
+
if (res.status === 401 && typeof signin === "string")
|
|
67
|
+
opts.onSignin?.(signin);
|
|
65
68
|
return res.ok ? { ok: true, status: res.status, data } : { ok: false, status: res.status, data, error: errorOf(data) };
|
|
66
69
|
};
|
|
67
70
|
return {
|
package/dist/client/routes.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ export declare const ROUTES: {
|
|
|
101
101
|
readonly "knowledge.list": readonly ["GET", "/api/knowledge"];
|
|
102
102
|
readonly "knowledge.putConcept": readonly ["POST", "/api/knowledge/:bundle/concept"];
|
|
103
103
|
readonly "knowledge.verify": readonly ["POST", "/api/knowledge/:bundle/verify"];
|
|
104
|
+
readonly "me.get": readonly ["GET", "/api/me"];
|
|
104
105
|
readonly "meta.get": readonly ["GET", "/api/meta"];
|
|
105
106
|
readonly "notifications.clear": readonly ["DELETE", "/api/notifications"];
|
|
106
107
|
readonly "notifications.diagnose": readonly ["POST", "/api/notifications/:id/diagnose"];
|
package/dist/client/routes.js
CHANGED
|
@@ -102,6 +102,7 @@ export const ROUTES = {
|
|
|
102
102
|
"knowledge.list": ["GET", "/api/knowledge"],
|
|
103
103
|
"knowledge.putConcept": ["POST", "/api/knowledge/:bundle/concept"],
|
|
104
104
|
"knowledge.verify": ["POST", "/api/knowledge/:bundle/verify"],
|
|
105
|
+
"me.get": ["GET", "/api/me"],
|
|
105
106
|
"meta.get": ["GET", "/api/meta"],
|
|
106
107
|
"notifications.clear": ["DELETE", "/api/notifications"],
|
|
107
108
|
"notifications.diagnose": ["POST", "/api/notifications/:id/diagnose"],
|
package/dist/config.d.ts
CHANGED
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
* enabled: false # a per-workspace veto; the machine's switch is `kraftwerk cloud on|off` (~/.kraftwerk/cloud.json)
|
|
39
39
|
* # No key here: the daemon registers the MACHINE (its relay id) and `kraftwerk login` claims it.
|
|
40
40
|
* # `url` and `interval` are deprecated: the cloud's origin is the machine's (cloud.json / KRAFTWERK_CLOUD_URL).
|
|
41
|
+
* users: # who works here (see UsersConfig)
|
|
42
|
+
* mode: cloud # local (default): this machine's handle · cloud: sign in with a kraftwerk cloud account
|
|
41
43
|
*/
|
|
42
44
|
/** Stable, versionless URL of the workflow JSON schema (editor validation). */
|
|
43
45
|
export declare const SCHEMA_URL = "https://raw.githubusercontent.com/NETNODEAG/kraftwerk/main/kraftwerk/schema/workflow.schema.json";
|
|
@@ -188,6 +190,25 @@ export interface CloudConfig {
|
|
|
188
190
|
/** @deprecated Ignored: the cloud sets the heartbeat interval. */
|
|
189
191
|
interval?: number;
|
|
190
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* kraftwerk.yml `users:` — who the person working in this workspace is.
|
|
195
|
+
*
|
|
196
|
+
* users:
|
|
197
|
+
* mode: local # default: whoever sits at this machine, named by its handle (~/.kraftwerk/identity.json)
|
|
198
|
+
* mode: cloud # people sign in with their kraftwerk cloud account: the UI asks first, and
|
|
199
|
+
* # what they do is signed with their account (uuid, handle) — the same person
|
|
200
|
+
* # on every machine and clone
|
|
201
|
+
*
|
|
202
|
+
* `cloud` needs the machine's daemon connected to the cloud (it redeems the
|
|
203
|
+
* sign-in) and the workspace's `id`. The machine's own shell (the CLI) acts
|
|
204
|
+
* as the account that claimed the machine (`kraftwerk login`).
|
|
205
|
+
*/
|
|
206
|
+
export interface UsersConfig {
|
|
207
|
+
mode?: UsersMode;
|
|
208
|
+
}
|
|
209
|
+
export type UsersMode = "local" | "cloud";
|
|
210
|
+
/** A workspace's users mode: `cloud` only when kraftwerk.yml says so. */
|
|
211
|
+
export declare const usersMode: (config: WorkspaceConfig) => UsersMode;
|
|
191
212
|
export declare const CLOUD_DEFAULT_URL = "https://srv.kraftwerk-cloud.netnode.cloud";
|
|
192
213
|
/** A directory as a .gitignore entry: relative, forward slashes, no trailing slash; undefined outside the root. */
|
|
193
214
|
export declare function ignoreEntryFor(projectRoot: string, dir: string): string | undefined;
|
|
@@ -255,6 +276,8 @@ export interface WorkspaceConfig {
|
|
|
255
276
|
presentations?: PresentationsConfig;
|
|
256
277
|
/** The machine's cloud record lists this workspace. Absent = listed; `enabled: false` leaves it out. */
|
|
257
278
|
cloud?: CloudConfig;
|
|
279
|
+
/** Who the people working here are: local (default) or signed in with a cloud account. */
|
|
280
|
+
users?: UsersConfig;
|
|
258
281
|
}
|
|
259
282
|
export interface ResolvedWorkspace {
|
|
260
283
|
/** Absolute project root the CLI operates on. */
|
|
@@ -317,3 +340,14 @@ export declare function newWorkspaceId(): string;
|
|
|
317
340
|
* Returns the id, or the one already there.
|
|
318
341
|
*/
|
|
319
342
|
export declare function addWorkspaceId(configPath: string): Promise<string>;
|
|
343
|
+
/**
|
|
344
|
+
* kraftwerk.yml, parsed and checked — from the file cache while the file is
|
|
345
|
+
* unchanged (every request resolves the workspace, so this runs constantly).
|
|
346
|
+
* Each caller gets its own copy.
|
|
347
|
+
*/
|
|
348
|
+
/**
|
|
349
|
+
* The config of a known workspace root, cheap enough for every request (one
|
|
350
|
+
* stat while kraftwerk.yml is unchanged); {} without one or when it does not
|
|
351
|
+
* parse.
|
|
352
|
+
*/
|
|
353
|
+
export declare function configAt(root: string): Promise<WorkspaceConfig>;
|
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/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 ---------- */
|
|
@@ -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
|
/**
|
|
@@ -6,7 +6,6 @@ import { resolveVibeable } from "../vibeables.js";
|
|
|
6
6
|
import { announcedOptions, deleteAgentSession, listAgentSessions } from "./acp.js";
|
|
7
7
|
import { listPiModels, piOptions } from "./pi.js";
|
|
8
8
|
import { chatHref, pushNotification } from "../notifications.js";
|
|
9
|
-
import { readIdentity } from "../identity.js";
|
|
10
9
|
import { moveToTrash } from "../trash.js";
|
|
11
10
|
import { removeSessionTemp } from "../temp.js";
|
|
12
11
|
import { attachmentPath, copyChatFiles, listChatMetas, newChatId, readMetaAt, safeChatDir, writeMeta } from "./store.js";
|
|
@@ -14,6 +13,7 @@ import { postChannelMessage } from "./channel-turns.js";
|
|
|
14
13
|
import { expandSkillInvocation, scopeContext } from "./context.js";
|
|
15
14
|
import { ensureBackend } from "./seats.js";
|
|
16
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";
|
|
17
17
|
export { agentFilesContext, agentJournalContext, agentVibeablesContext, vibeableContext } from "./context.js";
|
|
18
18
|
export { disposeAllBackends, disposeWorkspaceBackends } from "./state.js";
|
|
19
19
|
/**
|
|
@@ -24,12 +24,13 @@ export { disposeAllBackends, disposeWorkspaceBackends } from "./state.js";
|
|
|
24
24
|
*/
|
|
25
25
|
/* ---------- public API (used by server.ts) ---------- */
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* 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.
|
|
30
30
|
*/
|
|
31
31
|
export async function localPerson() {
|
|
32
|
-
|
|
32
|
+
const p = await currentPerson();
|
|
33
|
+
return { handle: p.handle, ...(p.id ? { id: p.id } : {}), ...(p.email ? { email: p.email } : {}) };
|
|
33
34
|
}
|
|
34
35
|
/** Where a chat's agent runs when no vibeable is open: the run folder for run chats, else the project root. */
|
|
35
36
|
const defaultCwd = (scope) => (scope.kind === "run" ? safeRunDir(scope.runId) : workspaceRoot());
|
|
@@ -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>;
|
package/dist/core/cloud.js
CHANGED
|
@@ -96,3 +96,38 @@ export const machineGoodbye = (base, creds, version) => cloudPost(base, "/api/ma
|
|
|
96
96
|
export const machineUnlink = (base, creds, version) => cloudPost(base, "/api/machines/unlink", { id: creds.id, secret: creds.secret }, { version });
|
|
97
97
|
export const memberVerify = (base, creds, token, workspaceId, version) => cloudPost(base, "/api/members/verify", { id: creds.id, secret: creds.secret, token, workspaceId }, { version });
|
|
98
98
|
export const workspaceInvite = (base, creds, workspaceId, role, version) => cloudPost(base, `/api/workspaces/${encodeURIComponent(workspaceId)}/invites`, { id: creds.id, secret: creds.secret, ...(role ? { role } : {}) }, { version });
|
|
99
|
+
export const signinExchange = (base, creds, code, redirect, version) => cloudPost(base, "/api/signin/exchange", { id: creds.id, secret: creds.secret, code, redirect }, { version });
|
|
100
|
+
export const signinVerify = (base, creds, workspace, user, version) => cloudPost(base, "/api/signin/verify", { id: creds.id, secret: creds.secret, workspace, user }, { version });
|
|
101
|
+
/** Where the browser goes to sign in to workspace `workspaceId` served by machine `machineId`. */
|
|
102
|
+
export function signinUrl(base, q) {
|
|
103
|
+
return `${base}/signin?${new URLSearchParams(q)}`;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* ~/.kraftwerk/account.json — the account that claimed this machine
|
|
107
|
+
* ({id, email, handle}), written by the daemon when the cloud names it and
|
|
108
|
+
* removed when the claim ends. The machine's own shell (the CLI) acts as
|
|
109
|
+
* this person in a `users: cloud` workspace.
|
|
110
|
+
*/
|
|
111
|
+
export const accountFilePath = () => path.join(kwHome(), "account.json");
|
|
112
|
+
export async function readAccountFile() {
|
|
113
|
+
try {
|
|
114
|
+
const raw = JSON.parse(await fs.readFile(accountFilePath(), "utf8"));
|
|
115
|
+
return typeof raw.id === "string" && typeof raw.email === "string" && typeof raw.handle === "string" ? { id: raw.id, email: raw.email, handle: raw.handle } : null;
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/** Write (or with null remove) account.json; unchanged content is not rewritten. */
|
|
122
|
+
export async function writeAccountFile(user) {
|
|
123
|
+
const file = accountFilePath();
|
|
124
|
+
if (!user)
|
|
125
|
+
return void (await fs.rm(file, { force: true }).catch(() => { }));
|
|
126
|
+
const next = JSON.stringify({ id: user.id, email: user.email, handle: user.handle }, null, 2) + "\n";
|
|
127
|
+
if ((await fs.readFile(file, "utf8").catch(() => "")) === next)
|
|
128
|
+
return;
|
|
129
|
+
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
130
|
+
const tmp = `${file}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
|
|
131
|
+
await fs.writeFile(tmp, next);
|
|
132
|
+
await fs.rename(tmp, file);
|
|
133
|
+
}
|
package/dist/core/knowledge.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { type BundleInfo, type ConceptDetail, type ConceptInfo } from "../okf.js";
|
|
2
|
-
/**
|
|
3
|
-
* Knowledge for the inspector: a thin API layer over the OKF
|
|
4
|
-
* core (src/okf.ts). Writes from the UI are stamped as `human:user` — the
|
|
5
|
-
* browser user is the human in the loop; agents write through the CLI (or
|
|
6
|
-
* chat) with their own actor.
|
|
7
|
-
*/
|
|
8
|
-
export declare const UI_ACTOR = "human:user";
|
|
9
2
|
export interface KnowledgeIndex {
|
|
10
3
|
root: string;
|
|
11
4
|
bundles: BundleInfo[];
|