@netnodeag/kraftwerk 0.61.0 → 0.63.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.
Files changed (75) hide show
  1. package/dist/cli/routines.js +2 -3
  2. package/dist/client/index.d.ts +59 -0
  3. package/dist/client/index.js +63 -0
  4. package/dist/client/live.d.ts +34 -0
  5. package/dist/client/live.js +169 -0
  6. package/dist/client/routes.d.ts +125 -0
  7. package/dist/client/routes.js +126 -0
  8. package/dist/inspector/api/agents.d.ts +31 -0
  9. package/dist/inspector/api/agents.js +50 -0
  10. package/dist/inspector/api/attention.d.ts +10 -0
  11. package/dist/inspector/api/attention.js +23 -0
  12. package/dist/inspector/api/channels.d.ts +67 -0
  13. package/dist/inspector/api/channels.js +58 -0
  14. package/dist/inspector/api/chats.d.ts +55 -0
  15. package/dist/inspector/api/chats.js +154 -0
  16. package/dist/inspector/api/files.d.ts +15 -0
  17. package/dist/inspector/api/files.js +43 -0
  18. package/dist/inspector/api/git.d.ts +25 -0
  19. package/dist/inspector/api/git.js +56 -0
  20. package/dist/inspector/api/index.d.ts +334 -0
  21. package/dist/inspector/api/index.js +43 -0
  22. package/dist/inspector/api/knowledge.d.ts +13 -0
  23. package/dist/inspector/api/knowledge.js +56 -0
  24. package/dist/inspector/api/mime.d.ts +2 -0
  25. package/dist/inspector/api/mime.js +18 -0
  26. package/dist/inspector/api/projects.d.ts +11 -0
  27. package/dist/inspector/api/projects.js +32 -0
  28. package/dist/inspector/api/router.d.ts +75 -0
  29. package/dist/inspector/api/router.js +186 -0
  30. package/dist/inspector/api/runs.d.ts +33 -0
  31. package/dist/inspector/api/runs.js +105 -0
  32. package/dist/inspector/api/socket.d.ts +3 -0
  33. package/dist/inspector/api/socket.js +115 -0
  34. package/dist/inspector/api/vibeables.d.ts +4 -0
  35. package/dist/inspector/api/vibeables.js +31 -0
  36. package/dist/inspector/api/workspace.d.ts +55 -0
  37. package/dist/inspector/api/workspace.js +117 -0
  38. package/dist/inspector/chat/sessions.js +31 -19
  39. package/dist/inspector/context.d.ts +5 -7
  40. package/dist/inspector/context.js +6 -20
  41. package/dist/inspector/git.js +52 -43
  42. package/dist/inspector/live.d.ts +42 -0
  43. package/dist/inspector/live.js +91 -0
  44. package/dist/inspector/notifications.js +19 -13
  45. package/dist/inspector/routines.d.ts +22 -1
  46. package/dist/inspector/routines.js +32 -5
  47. package/dist/inspector/runner.js +5 -4
  48. package/dist/inspector/server.d.ts +2 -2
  49. package/dist/inspector/server.js +59 -1389
  50. package/dist/inspector/version.d.ts +9 -0
  51. package/dist/inspector/version.js +27 -0
  52. package/dist/inspector/vibeables.js +25 -23
  53. package/dist/inspector/workspace.d.ts +42 -0
  54. package/dist/inspector/workspace.js +63 -0
  55. package/dist/inspector/ws.d.ts +11 -0
  56. package/dist/inspector/ws.js +143 -0
  57. package/inspector/dist/assets/{dist-B3L4wDm3.js → dist-9RESajfo.js} +1 -1
  58. package/inspector/dist/assets/{dist-Cwukoo61.js → dist-Bm5S1BoZ.js} +1 -1
  59. package/inspector/dist/assets/dist-C8BofvHx.js +1 -0
  60. package/inspector/dist/assets/{dist-wYE0FpHk.js → dist-CIs4wnTu.js} +1 -1
  61. package/inspector/dist/assets/{dist-De7-pK5i.js → dist-CjuETd-_.js} +1 -1
  62. package/inspector/dist/assets/{dist-B58fOC3R.js → dist-CmVK6rgN.js} +1 -1
  63. package/inspector/dist/assets/{dist-zk56dqRQ.js → dist-CryXvMV_.js} +1 -1
  64. package/inspector/dist/assets/{dist-BiWJ3XY1.js → dist-D1hk0iC5.js} +1 -1
  65. package/inspector/dist/assets/{dist-CH9pz3rR.js → dist-DvW9QE1d.js} +1 -1
  66. package/inspector/dist/assets/{dist-Dno2CmWo.js → dist-VD9jMxBv.js} +1 -1
  67. package/inspector/dist/assets/{dist-BKBuUSVQ.js → dist-VlAqWD8T.js} +1 -1
  68. package/inspector/dist/assets/{editor-CMQMyCOv.js → editor-DkWqwl89.js} +3 -3
  69. package/inspector/dist/assets/index-Bra74Nxe.css +2 -0
  70. package/inspector/dist/assets/index-DRJS2pGj.js +229 -0
  71. package/inspector/dist/index.html +2 -2
  72. package/package.json +7 -2
  73. package/inspector/dist/assets/dist-Bj93ipvc.js +0 -1
  74. package/inspector/dist/assets/index-1wfYRgHE.css +0 -2
  75. package/inspector/dist/assets/index-CtygNkZJ.js +0 -229
@@ -2,7 +2,7 @@ import { readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import chalk from "chalk";
4
4
  import { resolveProject } from "../config.js";
5
- import { setOutputDir, setProjectRoot } from "../inspector/context.js";
5
+ import { setDefaultWorkspace, Workspace } from "../inspector/workspace.js";
6
6
  import { deleteRoutine, listRoutines, routineStatuses, saveRoutine, } from "../inspector/routines.js";
7
7
  import { getAgent, listAgents } from "../inspector/agents.js";
8
8
  /**
@@ -14,8 +14,7 @@ import { getAgent, listAgents } from "../inspector/agents.js";
14
14
  /** Point the inspector context at this project so agent/routine paths resolve. */
15
15
  export async function initContext() {
16
16
  const project = await resolveProject(process.cwd());
17
- setProjectRoot(project.root);
18
- setOutputDir(project.outputDir);
17
+ setDefaultWorkspace(new Workspace({ root: project.root, outputDir: project.outputDir }));
19
18
  return { port: project.config.port ?? 1981 };
20
19
  }
21
20
  async function requireAgent(slug) {
@@ -0,0 +1,59 @@
1
+ import type { ApiName, ApiPath, ApiResult } from "../inspector/api/index.js";
2
+ /**
3
+ * The kraftwerk client: every control-plane route by name, typed by the
4
+ * server's own handlers. Runs wherever `fetch` does — the web UI, Node (the
5
+ * CLI), a native app's JS runtime. No server code is bundled: the route
6
+ * table is generated (routes.ts), the types are erased.
7
+ *
8
+ * const api = createClient();
9
+ * const project = await api.call("projects.get", { slug });
10
+ * await api.call("projects.log", { slug, body: { entry } });
11
+ *
12
+ * Path parameters go by name next to `query` and `body`. `call` throws an
13
+ * ApiRequestError on any non-2xx answer; `request` returns the status and
14
+ * body instead, for routes whose refusal carries a result (a 409 git commit,
15
+ * a repository with unpushed work).
16
+ */
17
+ export type { ApiName, ApiPath, ApiResult };
18
+ export { createLive, type Live, type LiveOptions, type WatchOptions } from "./live.js";
19
+ type ParamNames<P extends string> = P extends `${string}:${infer Name}/${infer Rest}` ? Name | ParamNames<`/${Rest}`> : P extends `${string}:${infer Name}` ? Name : never;
20
+ type PathParams<N extends ApiName> = {
21
+ [K in ParamNames<ApiPath<N>>]: string;
22
+ };
23
+ export type Query = Record<string, string | number | boolean | undefined | null>;
24
+ /** What a call sends besides the path parameters. A Blob/File/ArrayBuffer body is sent as is (uploads), anything else as JSON. */
25
+ export interface CallExtras {
26
+ query?: Query;
27
+ body?: unknown;
28
+ headers?: Record<string, string>;
29
+ signal?: AbortSignal;
30
+ /** Let the request outlive the page (a save on tab close). */
31
+ keepalive?: boolean;
32
+ }
33
+ export type CallInput<N extends ApiName> = PathParams<N> & CallExtras;
34
+ /** Routes without path parameters may omit the input. */
35
+ type InputArg<N extends ApiName> = [ParamNames<ApiPath<N>>] extends [never] ? [input?: CallInput<N>] : [input: CallInput<N>];
36
+ export declare class ApiRequestError extends Error {
37
+ readonly status: number;
38
+ readonly body: unknown;
39
+ readonly route: string;
40
+ constructor(status: number, body: unknown, route: string);
41
+ }
42
+ export interface ApiResponse<T> {
43
+ ok: boolean;
44
+ status: number;
45
+ /** The result when ok; the error body (usually `{error}`) otherwise. */
46
+ data: T;
47
+ }
48
+ export interface ClientOptions {
49
+ /** Where the server is; "" (the default) is the page's own origin. */
50
+ baseUrl?: string;
51
+ fetch?: typeof fetch;
52
+ }
53
+ export interface Client {
54
+ call<N extends ApiName>(name: N, ...input: InputArg<N>): Promise<ApiResult<N>>;
55
+ request<N extends ApiName>(name: N, ...input: InputArg<N>): Promise<ApiResponse<ApiResult<N>>>;
56
+ /** The URL of a route: for raw routes (a file to show or download, an event stream) and links. */
57
+ url<N extends ApiName>(name: N, ...input: InputArg<N>): string;
58
+ }
59
+ export declare function createClient(opts?: ClientOptions): Client;
@@ -0,0 +1,63 @@
1
+ import { ROUTES } from "./routes.js";
2
+ export { createLive } from "./live.js";
3
+ export class ApiRequestError extends Error {
4
+ status;
5
+ body;
6
+ route;
7
+ constructor(status, body, route) {
8
+ const error = body && typeof body === "object" && "error" in body ? body.error : undefined;
9
+ super(typeof error === "string" && error ? error : `${route}: HTTP ${status}`);
10
+ this.status = status;
11
+ this.body = body;
12
+ this.route = route;
13
+ }
14
+ }
15
+ export function createClient(opts = {}) {
16
+ const base = (opts.baseUrl ?? "").replace(/\/+$/, "");
17
+ const doFetch = opts.fetch ?? ((...a) => fetch(...a));
18
+ const url = (name, input = {}) => {
19
+ const [, pattern] = ROUTES[name];
20
+ const path = pattern.replace(/:([A-Za-z]+)/g, (_, key) => {
21
+ const v = input[key];
22
+ if (v === undefined || v === null || v === "")
23
+ throw new Error(`${name}: missing path parameter ${key}`);
24
+ return encodeURIComponent(String(v));
25
+ });
26
+ const q = new URLSearchParams();
27
+ for (const [k, v] of Object.entries(input.query ?? {}))
28
+ if (v !== undefined && v !== null && v !== false)
29
+ q.set(k, v === true ? "1" : String(v));
30
+ const qs = q.toString();
31
+ return `${base}${path}${qs ? `?${qs}` : ""}`;
32
+ };
33
+ const request = async (name, input = {}) => {
34
+ const [method] = ROUTES[name];
35
+ const { body, headers = {}, signal, keepalive } = input;
36
+ const raw = body instanceof Blob || body instanceof ArrayBuffer || ArrayBuffer.isView(body);
37
+ const res = await doFetch(url(name, input), {
38
+ method,
39
+ cache: "no-store",
40
+ signal,
41
+ keepalive,
42
+ headers: { ...(body !== undefined && !raw ? { "content-type": "application/json" } : {}), ...headers },
43
+ body: body === undefined ? undefined : raw ? body : JSON.stringify(body),
44
+ });
45
+ const text = await res.text();
46
+ let data = text;
47
+ try {
48
+ data = text ? JSON.parse(text) : undefined;
49
+ }
50
+ catch { }
51
+ return { ok: res.ok, status: res.status, data };
52
+ };
53
+ return {
54
+ url: ((name, input) => url(name, input)),
55
+ request: ((name, input) => request(name, input)),
56
+ call: (async (name, input) => {
57
+ const r = await request(name, input);
58
+ if (!r.ok)
59
+ throw new ApiRequestError(r.status, r.data, name);
60
+ return r.data;
61
+ }),
62
+ };
63
+ }
@@ -0,0 +1,34 @@
1
+ import type { ApiName, ApiResult, CallInput, Client } from "./index.js";
2
+ /**
3
+ * Live data over the control plane's socket (/api/ws): route results that
4
+ * stay current (`watch`) and event streams (`subscribe`). One connection
5
+ * carries them all; the server pushes a watched result when it changes,
6
+ * and replays a chat's events from the last one seen after a reconnect.
7
+ *
8
+ * Without a socket — none in this runtime, or the connection is down — a
9
+ * watch polls over HTTP at its interval and a stream uses the server-sent
10
+ * events route where the runtime has EventSource, so callers never notice
11
+ * which one they got. One-off calls stay on the HTTP client.
12
+ */
13
+ export interface WatchOptions {
14
+ /** How stale the result may get when nothing announces a change, in ms (default 6 s). */
15
+ interval?: number;
16
+ }
17
+ export interface Live {
18
+ watch<N extends ApiName>(name: N, input: CallInput<N> | undefined, opts: WatchOptions, onData: (data: ApiResult<N>) => void): () => void;
19
+ /** `chat.<id>` (from the event after seq `after`) or `vibeable.<slug>`. */
20
+ subscribe(topic: string, opts: {
21
+ after?: number;
22
+ }, onEvent: (event: unknown) => void): () => void;
23
+ /** Whether the socket is up (else watches poll and streams use EventSource). */
24
+ readonly connected: boolean;
25
+ close(): void;
26
+ }
27
+ export interface LiveOptions {
28
+ /** The HTTP client for fallbacks; its baseUrl is the server. */
29
+ client: Client;
30
+ baseUrl?: string;
31
+ WebSocket?: typeof WebSocket;
32
+ EventSource?: typeof EventSource;
33
+ }
34
+ export declare function createLive(opts: LiveOptions): Live;
@@ -0,0 +1,169 @@
1
+ const MAX_BACKOFF = 10_000;
2
+ export function createLive(opts) {
3
+ const WS = opts.WebSocket ?? (typeof WebSocket === "undefined" ? undefined : WebSocket);
4
+ const ES = opts.EventSource ?? (typeof EventSource === "undefined" ? undefined : EventSource);
5
+ const { client } = opts;
6
+ const watches = new Map();
7
+ const subs = new Map();
8
+ let socket = null;
9
+ let connected = false;
10
+ let closed = false;
11
+ let backoff = 500;
12
+ let retry;
13
+ let counter = 0;
14
+ const socketUrl = () => {
15
+ const base = opts.baseUrl ?? (typeof location === "undefined" ? "" : location.origin);
16
+ return `${base.replace(/^http/, "ws").replace(/\/+$/, "")}/api/ws`;
17
+ };
18
+ const send = (msg) => {
19
+ if (connected)
20
+ socket?.send(JSON.stringify(msg));
21
+ };
22
+ /* ---------- fallbacks ---------- */
23
+ const poll = (key) => {
24
+ const w = watches.get(key);
25
+ if (!w || connected)
26
+ return;
27
+ clearTimeout(w.timer);
28
+ void client.request(w.name, w.input)
29
+ .then((r) => r.ok && watches.get(key) === w && !connected && w.onData(r.data))
30
+ .catch(() => { })
31
+ .finally(() => {
32
+ if (watches.get(key) === w && !connected)
33
+ w.timer = setTimeout(() => poll(key), w.interval);
34
+ });
35
+ };
36
+ const stream = (key) => {
37
+ const s = subs.get(key);
38
+ if (!s || connected || s.source || !ES)
39
+ return;
40
+ const [kind, ...rest] = s.topic.split(".");
41
+ const name = rest.join(".");
42
+ const url = kind === "chat"
43
+ ? client.url("chats.events", { id: name, query: { after: s.after } })
44
+ : kind === "vibeable"
45
+ ? client.url("vibeables.events", { slug: name })
46
+ : "";
47
+ if (!url)
48
+ return;
49
+ s.source = new ES(url);
50
+ s.source.onmessage = (m) => deliver(key, JSON.parse(m.data));
51
+ };
52
+ const deliver = (key, data) => {
53
+ const s = subs.get(key);
54
+ if (!s)
55
+ return;
56
+ const seq = data?.seq;
57
+ if (typeof seq === "number") {
58
+ // A replay after a reconnect may overlap what arrived already.
59
+ if (seq <= s.after)
60
+ return;
61
+ s.after = seq;
62
+ }
63
+ s.onEvent(data);
64
+ };
65
+ /* ---------- the socket ---------- */
66
+ const resume = () => {
67
+ for (const [key, w] of watches) {
68
+ clearTimeout(w.timer);
69
+ send({ watch: key, name: w.name, input: w.input, interval: w.interval });
70
+ }
71
+ for (const [key, s] of subs) {
72
+ s.source?.close();
73
+ s.source = undefined;
74
+ send({ sub: key, topic: s.topic, after: s.after });
75
+ }
76
+ };
77
+ const fallBack = () => {
78
+ for (const key of watches.keys())
79
+ poll(key);
80
+ for (const key of subs.keys())
81
+ stream(key);
82
+ };
83
+ const connect = () => {
84
+ if (closed || socket || !WS)
85
+ return;
86
+ let ws;
87
+ try {
88
+ ws = new WS(socketUrl());
89
+ }
90
+ catch {
91
+ return fallBack();
92
+ }
93
+ socket = ws;
94
+ ws.onopen = () => {
95
+ connected = true;
96
+ backoff = 500;
97
+ resume();
98
+ };
99
+ ws.onmessage = (m) => {
100
+ let msg;
101
+ try {
102
+ msg = JSON.parse(String(m.data));
103
+ }
104
+ catch {
105
+ return;
106
+ }
107
+ if (msg.watch && "data" in msg)
108
+ watches.get(msg.watch)?.onData(msg.data);
109
+ else if (msg.event)
110
+ deliver(msg.event, msg.data);
111
+ };
112
+ ws.onclose = () => {
113
+ socket = null;
114
+ connected = false;
115
+ if (closed)
116
+ return;
117
+ fallBack();
118
+ retry = setTimeout(connect, backoff);
119
+ backoff = Math.min(MAX_BACKOFF, backoff * 2);
120
+ };
121
+ };
122
+ return {
123
+ get connected() {
124
+ return connected;
125
+ },
126
+ watch(name, input, o, onData) {
127
+ const key = `w${++counter}`;
128
+ watches.set(key, { name, input: (input ?? {}), interval: o.interval ?? 6000, onData: onData });
129
+ if (connected)
130
+ send({ watch: key, name, input: input ?? {}, interval: o.interval ?? 6000 });
131
+ else {
132
+ // Until the socket is up (or for good, without one), poll.
133
+ poll(key);
134
+ connect();
135
+ }
136
+ return () => {
137
+ clearTimeout(watches.get(key)?.timer);
138
+ watches.delete(key);
139
+ send({ unwatch: key });
140
+ };
141
+ },
142
+ subscribe(topic, o, onEvent) {
143
+ const key = `s${++counter}`;
144
+ subs.set(key, { topic, after: o.after ?? 0, onEvent });
145
+ if (connected)
146
+ send({ sub: key, topic, after: o.after ?? 0 });
147
+ else {
148
+ stream(key);
149
+ connect();
150
+ }
151
+ return () => {
152
+ subs.get(key)?.source?.close();
153
+ subs.delete(key);
154
+ send({ unsub: key });
155
+ };
156
+ },
157
+ close() {
158
+ closed = true;
159
+ clearTimeout(retry);
160
+ socket?.close();
161
+ for (const w of watches.values())
162
+ clearTimeout(w.timer);
163
+ for (const s of subs.values())
164
+ s.source?.close();
165
+ watches.clear();
166
+ subs.clear();
167
+ },
168
+ };
169
+ }
@@ -0,0 +1,125 @@
1
+ /** Route name → [method, path pattern, and "raw" (answers a stream or a file) or "upload" (sends file bytes): both HTTP only]. */
2
+ export declare const ROUTES: {
3
+ readonly "agents.addJournal": readonly ["POST", "/api/agents/:slug/journal"];
4
+ readonly "agents.archive": readonly ["POST", "/api/agents/:slug/archive"];
5
+ readonly "agents.create": readonly ["POST", "/api/agents"];
6
+ readonly "agents.delete": readonly ["DELETE", "/api/agents/:slug"];
7
+ readonly "agents.deleteRoutine": readonly ["DELETE", "/api/agents/:slug/routines/:id"];
8
+ readonly "agents.deleteSkill": readonly ["DELETE", "/api/agents/:slug/skills/:name"];
9
+ readonly "agents.get": readonly ["GET", "/api/agents/:slug"];
10
+ readonly "agents.journal": readonly ["GET", "/api/agents/:slug/journal"];
11
+ readonly "agents.list": readonly ["GET", "/api/agents"];
12
+ readonly "agents.routines": readonly ["GET", "/api/agents/:slug/routines"];
13
+ readonly "agents.runRoutine": readonly ["POST", "/api/agents/:slug/routines/:id/run"];
14
+ readonly "agents.save": readonly ["PUT", "/api/agents/:slug"];
15
+ readonly "agents.saveRoutine": readonly ["POST", "/api/agents/:slug/routines"];
16
+ readonly "agents.saveSkill": readonly ["POST", "/api/agents/:slug/skills"];
17
+ readonly "agents.sessions": readonly ["GET", "/api/agent-sessions"];
18
+ readonly "agents.skill": readonly ["GET", "/api/agents/:slug/skills/:name"];
19
+ readonly "agents.skills": readonly ["GET", "/api/agents/:slug/skills"];
20
+ readonly "agents.status": readonly ["GET", "/api/agent-status"];
21
+ readonly "attention.list": readonly ["GET", "/api/attention"];
22
+ readonly "channels.create": readonly ["POST", "/api/channels"];
23
+ readonly "channels.delete": readonly ["DELETE", "/api/channels/:slug"];
24
+ readonly "channels.fromChat": readonly ["POST", "/api/channels/from-chat"];
25
+ readonly "channels.get": readonly ["GET", "/api/channels/:slug"];
26
+ readonly "channels.list": readonly ["GET", "/api/channels"];
27
+ readonly "channels.save": readonly ["PUT", "/api/channels/:slug"];
28
+ readonly "chats.attach": readonly ["POST", "/api/chats/:id/attachments", "upload"];
29
+ readonly "chats.attachment": readonly ["GET", "/api/chats/:id/attachments/:name", "raw"];
30
+ readonly "chats.cancel": readonly ["POST", "/api/chats/:id/cancel"];
31
+ readonly "chats.config": readonly ["POST", "/api/chats/:id/config"];
32
+ readonly "chats.create": readonly ["POST", "/api/chats"];
33
+ readonly "chats.delete": readonly ["DELETE", "/api/chats/:id"];
34
+ readonly "chats.elicitation": readonly ["POST", "/api/chats/:id/elicitation"];
35
+ readonly "chats.events": readonly ["GET", "/api/chats/:id/events", "raw"];
36
+ readonly "chats.fork": readonly ["POST", "/api/chats/:id/fork"];
37
+ readonly "chats.get": readonly ["GET", "/api/chats/:id"];
38
+ readonly "chats.list": readonly ["GET", "/api/chats"];
39
+ readonly "chats.message": readonly ["POST", "/api/chats/:id/message"];
40
+ readonly "chats.permission": readonly ["POST", "/api/chats/:id/permission"];
41
+ readonly "chats.rename": readonly ["PATCH", "/api/chats/:id"];
42
+ readonly "chats.resetSession": readonly ["POST", "/api/chats/:id/reset-session"];
43
+ readonly "chats.setVibeable": readonly ["POST", "/api/chats/:id/vibeable"];
44
+ readonly "chats.steer": readonly ["POST", "/api/chats/:id/steer"];
45
+ readonly "chats.stopTask": readonly ["POST", "/api/chats/:id/task-stop"];
46
+ readonly "files.delete": readonly ["DELETE", "/api/files"];
47
+ readonly "files.list": readonly ["GET", "/api/files/list"];
48
+ readonly "files.mkdir": readonly ["POST", "/api/files/folder"];
49
+ readonly "files.move": readonly ["POST", "/api/files/move"];
50
+ readonly "files.raw": readonly ["GET", "/api/files/raw", "raw"];
51
+ readonly "files.recent": readonly ["GET", "/api/files/recent"];
52
+ readonly "files.scopes": readonly ["GET", "/api/files"];
53
+ readonly "files.upload": readonly ["POST", "/api/files/upload", "upload"];
54
+ readonly "git.commit": readonly ["POST", "/api/git/commit"];
55
+ readonly "git.diff": readonly ["GET", "/api/git/diff"];
56
+ readonly "git.fetch": readonly ["POST", "/api/git/fetch"];
57
+ readonly "git.pull": readonly ["POST", "/api/git/pull"];
58
+ readonly "git.push": readonly ["POST", "/api/git/push"];
59
+ readonly "git.status": readonly ["GET", "/api/git"];
60
+ readonly "knowledge.concept": readonly ["GET", "/api/knowledge/:bundle/concept"];
61
+ readonly "knowledge.create": readonly ["POST", "/api/knowledge"];
62
+ readonly "knowledge.delete": readonly ["DELETE", "/api/knowledge/:bundle"];
63
+ readonly "knowledge.get": readonly ["GET", "/api/knowledge/:bundle"];
64
+ readonly "knowledge.list": readonly ["GET", "/api/knowledge"];
65
+ readonly "knowledge.putConcept": readonly ["POST", "/api/knowledge/:bundle/concept"];
66
+ readonly "knowledge.verify": readonly ["POST", "/api/knowledge/:bundle/verify"];
67
+ readonly "meta.get": readonly ["GET", "/api/meta"];
68
+ readonly "notifications.clear": readonly ["DELETE", "/api/notifications"];
69
+ readonly "notifications.diagnose": readonly ["POST", "/api/notifications/:id/diagnose"];
70
+ readonly "notifications.list": readonly ["GET", "/api/notifications"];
71
+ readonly "notifications.read": readonly ["POST", "/api/notifications/read"];
72
+ readonly "projects.create": readonly ["POST", "/api/projects"];
73
+ readonly "projects.delete": readonly ["DELETE", "/api/projects/:slug"];
74
+ readonly "projects.get": readonly ["GET", "/api/projects/:slug"];
75
+ readonly "projects.link": readonly ["POST", "/api/projects/:slug/links"];
76
+ readonly "projects.list": readonly ["GET", "/api/projects"];
77
+ readonly "projects.log": readonly ["POST", "/api/projects/:slug/log"];
78
+ readonly "projects.save": readonly ["PUT", "/api/projects/:slug"];
79
+ readonly "projects.saveLayout": readonly ["PUT", "/api/projects"];
80
+ readonly "protocol.get": readonly ["GET", "/api/protocol"];
81
+ readonly "repos.add": readonly ["POST", "/api/repos"];
82
+ readonly "repos.commit": readonly ["GET", "/api/repos/:slug/commits/:hash"];
83
+ readonly "repos.diff": readonly ["GET", "/api/repos/:slug/diff"];
84
+ readonly "repos.get": readonly ["GET", "/api/repos/:slug"];
85
+ readonly "repos.list": readonly ["GET", "/api/repos"];
86
+ readonly "repos.remove": readonly ["DELETE", "/api/repos/:slug"];
87
+ readonly "repos.update": readonly ["POST", "/api/repos/:slug/update"];
88
+ readonly "routines.list": readonly ["GET", "/api/routines"];
89
+ readonly "runs.decide": readonly ["POST", "/api/runs/:id/decision"];
90
+ readonly "runs.delete": readonly ["DELETE", "/api/runs/:id"];
91
+ readonly "runs.file": readonly ["GET", "/api/runs/:id/file", "raw"];
92
+ readonly "runs.fileText": readonly ["GET", "/api/runs/:id/text"];
93
+ readonly "runs.get": readonly ["GET", "/api/runs/:id"];
94
+ readonly "runs.list": readonly ["GET", "/api/runs"];
95
+ readonly "runs.stop": readonly ["POST", "/api/runs/:id/stop"];
96
+ readonly "search.agents": readonly ["GET", "/api/search/agents"];
97
+ readonly "server.restart": readonly ["POST", "/api/restart"];
98
+ readonly "settings.get": readonly ["GET", "/api/settings"];
99
+ readonly "settings.save": readonly ["PUT", "/api/settings"];
100
+ readonly "skills.get": readonly ["GET", "/api/skills/:name"];
101
+ readonly "skills.list": readonly ["GET", "/api/skills"];
102
+ readonly "trash.empty": readonly ["DELETE", "/api/trash"];
103
+ readonly "trash.list": readonly ["GET", "/api/trash"];
104
+ readonly "trash.purge": readonly ["POST", "/api/trash/purge"];
105
+ readonly "trash.restore": readonly ["POST", "/api/trash/restore"];
106
+ readonly "update.check": readonly ["GET", "/api/update-check"];
107
+ readonly "update.start": readonly ["POST", "/api/update"];
108
+ readonly "update.status": readonly ["GET", "/api/update"];
109
+ readonly "vibeables.create": readonly ["POST", "/api/vibeables"];
110
+ readonly "vibeables.delete": readonly ["DELETE", "/api/vibeables/:slug"];
111
+ readonly "vibeables.devStart": readonly ["POST", "/api/vibeables/:slug/dev/start"];
112
+ readonly "vibeables.devStop": readonly ["POST", "/api/vibeables/:slug/dev/stop"];
113
+ readonly "vibeables.events": readonly ["GET", "/api/vibeables/:slug/events", "raw"];
114
+ readonly "vibeables.get": readonly ["GET", "/api/vibeables/:slug"];
115
+ readonly "vibeables.list": readonly ["GET", "/api/vibeables"];
116
+ readonly "workflows.delete": readonly ["DELETE", "/api/workflows/:slug"];
117
+ readonly "workflows.get": readonly ["GET", "/api/workflows/:slug"];
118
+ readonly "workflows.list": readonly ["GET", "/api/workflows"];
119
+ readonly "workflows.run": readonly ["POST", "/api/workflows/:slug/run"];
120
+ readonly "workflows.runner": readonly ["GET", "/api/workflows/:slug/run"];
121
+ readonly "workspaces.forget": readonly ["POST", "/api/workspaces/forget"];
122
+ readonly "workspaces.list": readonly ["GET", "/api/workspaces"];
123
+ readonly "workspaces.start": readonly ["POST", "/api/workspaces/start"];
124
+ readonly "workspaces.stop": readonly ["POST", "/api/workspaces/stop"];
125
+ };
@@ -0,0 +1,126 @@
1
+ // Generated by scripts/gen-client-routes.ts from src/inspector/api — do not edit; run `npm run gen:client`.
2
+ /** Route name → [method, path pattern, and "raw" (answers a stream or a file) or "upload" (sends file bytes): both HTTP only]. */
3
+ export const ROUTES = {
4
+ "agents.addJournal": ["POST", "/api/agents/:slug/journal"],
5
+ "agents.archive": ["POST", "/api/agents/:slug/archive"],
6
+ "agents.create": ["POST", "/api/agents"],
7
+ "agents.delete": ["DELETE", "/api/agents/:slug"],
8
+ "agents.deleteRoutine": ["DELETE", "/api/agents/:slug/routines/:id"],
9
+ "agents.deleteSkill": ["DELETE", "/api/agents/:slug/skills/:name"],
10
+ "agents.get": ["GET", "/api/agents/:slug"],
11
+ "agents.journal": ["GET", "/api/agents/:slug/journal"],
12
+ "agents.list": ["GET", "/api/agents"],
13
+ "agents.routines": ["GET", "/api/agents/:slug/routines"],
14
+ "agents.runRoutine": ["POST", "/api/agents/:slug/routines/:id/run"],
15
+ "agents.save": ["PUT", "/api/agents/:slug"],
16
+ "agents.saveRoutine": ["POST", "/api/agents/:slug/routines"],
17
+ "agents.saveSkill": ["POST", "/api/agents/:slug/skills"],
18
+ "agents.sessions": ["GET", "/api/agent-sessions"],
19
+ "agents.skill": ["GET", "/api/agents/:slug/skills/:name"],
20
+ "agents.skills": ["GET", "/api/agents/:slug/skills"],
21
+ "agents.status": ["GET", "/api/agent-status"],
22
+ "attention.list": ["GET", "/api/attention"],
23
+ "channels.create": ["POST", "/api/channels"],
24
+ "channels.delete": ["DELETE", "/api/channels/:slug"],
25
+ "channels.fromChat": ["POST", "/api/channels/from-chat"],
26
+ "channels.get": ["GET", "/api/channels/:slug"],
27
+ "channels.list": ["GET", "/api/channels"],
28
+ "channels.save": ["PUT", "/api/channels/:slug"],
29
+ "chats.attach": ["POST", "/api/chats/:id/attachments", "upload"],
30
+ "chats.attachment": ["GET", "/api/chats/:id/attachments/:name", "raw"],
31
+ "chats.cancel": ["POST", "/api/chats/:id/cancel"],
32
+ "chats.config": ["POST", "/api/chats/:id/config"],
33
+ "chats.create": ["POST", "/api/chats"],
34
+ "chats.delete": ["DELETE", "/api/chats/:id"],
35
+ "chats.elicitation": ["POST", "/api/chats/:id/elicitation"],
36
+ "chats.events": ["GET", "/api/chats/:id/events", "raw"],
37
+ "chats.fork": ["POST", "/api/chats/:id/fork"],
38
+ "chats.get": ["GET", "/api/chats/:id"],
39
+ "chats.list": ["GET", "/api/chats"],
40
+ "chats.message": ["POST", "/api/chats/:id/message"],
41
+ "chats.permission": ["POST", "/api/chats/:id/permission"],
42
+ "chats.rename": ["PATCH", "/api/chats/:id"],
43
+ "chats.resetSession": ["POST", "/api/chats/:id/reset-session"],
44
+ "chats.setVibeable": ["POST", "/api/chats/:id/vibeable"],
45
+ "chats.steer": ["POST", "/api/chats/:id/steer"],
46
+ "chats.stopTask": ["POST", "/api/chats/:id/task-stop"],
47
+ "files.delete": ["DELETE", "/api/files"],
48
+ "files.list": ["GET", "/api/files/list"],
49
+ "files.mkdir": ["POST", "/api/files/folder"],
50
+ "files.move": ["POST", "/api/files/move"],
51
+ "files.raw": ["GET", "/api/files/raw", "raw"],
52
+ "files.recent": ["GET", "/api/files/recent"],
53
+ "files.scopes": ["GET", "/api/files"],
54
+ "files.upload": ["POST", "/api/files/upload", "upload"],
55
+ "git.commit": ["POST", "/api/git/commit"],
56
+ "git.diff": ["GET", "/api/git/diff"],
57
+ "git.fetch": ["POST", "/api/git/fetch"],
58
+ "git.pull": ["POST", "/api/git/pull"],
59
+ "git.push": ["POST", "/api/git/push"],
60
+ "git.status": ["GET", "/api/git"],
61
+ "knowledge.concept": ["GET", "/api/knowledge/:bundle/concept"],
62
+ "knowledge.create": ["POST", "/api/knowledge"],
63
+ "knowledge.delete": ["DELETE", "/api/knowledge/:bundle"],
64
+ "knowledge.get": ["GET", "/api/knowledge/:bundle"],
65
+ "knowledge.list": ["GET", "/api/knowledge"],
66
+ "knowledge.putConcept": ["POST", "/api/knowledge/:bundle/concept"],
67
+ "knowledge.verify": ["POST", "/api/knowledge/:bundle/verify"],
68
+ "meta.get": ["GET", "/api/meta"],
69
+ "notifications.clear": ["DELETE", "/api/notifications"],
70
+ "notifications.diagnose": ["POST", "/api/notifications/:id/diagnose"],
71
+ "notifications.list": ["GET", "/api/notifications"],
72
+ "notifications.read": ["POST", "/api/notifications/read"],
73
+ "projects.create": ["POST", "/api/projects"],
74
+ "projects.delete": ["DELETE", "/api/projects/:slug"],
75
+ "projects.get": ["GET", "/api/projects/:slug"],
76
+ "projects.link": ["POST", "/api/projects/:slug/links"],
77
+ "projects.list": ["GET", "/api/projects"],
78
+ "projects.log": ["POST", "/api/projects/:slug/log"],
79
+ "projects.save": ["PUT", "/api/projects/:slug"],
80
+ "projects.saveLayout": ["PUT", "/api/projects"],
81
+ "protocol.get": ["GET", "/api/protocol"],
82
+ "repos.add": ["POST", "/api/repos"],
83
+ "repos.commit": ["GET", "/api/repos/:slug/commits/:hash"],
84
+ "repos.diff": ["GET", "/api/repos/:slug/diff"],
85
+ "repos.get": ["GET", "/api/repos/:slug"],
86
+ "repos.list": ["GET", "/api/repos"],
87
+ "repos.remove": ["DELETE", "/api/repos/:slug"],
88
+ "repos.update": ["POST", "/api/repos/:slug/update"],
89
+ "routines.list": ["GET", "/api/routines"],
90
+ "runs.decide": ["POST", "/api/runs/:id/decision"],
91
+ "runs.delete": ["DELETE", "/api/runs/:id"],
92
+ "runs.file": ["GET", "/api/runs/:id/file", "raw"],
93
+ "runs.fileText": ["GET", "/api/runs/:id/text"],
94
+ "runs.get": ["GET", "/api/runs/:id"],
95
+ "runs.list": ["GET", "/api/runs"],
96
+ "runs.stop": ["POST", "/api/runs/:id/stop"],
97
+ "search.agents": ["GET", "/api/search/agents"],
98
+ "server.restart": ["POST", "/api/restart"],
99
+ "settings.get": ["GET", "/api/settings"],
100
+ "settings.save": ["PUT", "/api/settings"],
101
+ "skills.get": ["GET", "/api/skills/:name"],
102
+ "skills.list": ["GET", "/api/skills"],
103
+ "trash.empty": ["DELETE", "/api/trash"],
104
+ "trash.list": ["GET", "/api/trash"],
105
+ "trash.purge": ["POST", "/api/trash/purge"],
106
+ "trash.restore": ["POST", "/api/trash/restore"],
107
+ "update.check": ["GET", "/api/update-check"],
108
+ "update.start": ["POST", "/api/update"],
109
+ "update.status": ["GET", "/api/update"],
110
+ "vibeables.create": ["POST", "/api/vibeables"],
111
+ "vibeables.delete": ["DELETE", "/api/vibeables/:slug"],
112
+ "vibeables.devStart": ["POST", "/api/vibeables/:slug/dev/start"],
113
+ "vibeables.devStop": ["POST", "/api/vibeables/:slug/dev/stop"],
114
+ "vibeables.events": ["GET", "/api/vibeables/:slug/events", "raw"],
115
+ "vibeables.get": ["GET", "/api/vibeables/:slug"],
116
+ "vibeables.list": ["GET", "/api/vibeables"],
117
+ "workflows.delete": ["DELETE", "/api/workflows/:slug"],
118
+ "workflows.get": ["GET", "/api/workflows/:slug"],
119
+ "workflows.list": ["GET", "/api/workflows"],
120
+ "workflows.run": ["POST", "/api/workflows/:slug/run"],
121
+ "workflows.runner": ["GET", "/api/workflows/:slug/run"],
122
+ "workspaces.forget": ["POST", "/api/workspaces/forget"],
123
+ "workspaces.list": ["GET", "/api/workspaces"],
124
+ "workspaces.start": ["POST", "/api/workspaces/start"],
125
+ "workspaces.stop": ["POST", "/api/workspaces/stop"],
126
+ };
@@ -0,0 +1,31 @@
1
+ /** Agents (team members): definition, own skills, journal, routines. */
2
+ export declare const agentRoutes: (import("./router.js").Route<"agents.addJournal", {
3
+ journal: string;
4
+ }, "/api/agents/:slug/journal"> | import("./router.js").Route<"agents.archive", import("../agents.js").AgentDetail, "/api/agents/:slug/archive"> | import("./router.js").Route<"agents.create", import("../agents.js").AgentDetail, "/api/agents"> | import("./router.js").Route<"agents.delete", {
5
+ ok: boolean;
6
+ }, "/api/agents/:slug"> | import("./router.js").Route<"agents.deleteRoutine", {
7
+ ok: boolean;
8
+ }, "/api/agents/:slug/routines/:id"> | import("./router.js").Route<"agents.deleteSkill", {
9
+ ok: boolean;
10
+ }, "/api/agents/:slug/skills/:name"> | import("./router.js").Route<"agents.get", import("../agents.js").AgentDetail, "/api/agents/:slug"> | import("./router.js").Route<"agents.journal", {
11
+ journal: string;
12
+ }, "/api/agents/:slug/journal"> | import("./router.js").Route<"agents.list", {
13
+ root: string;
14
+ agents: import("../agents.js").Agent[];
15
+ }, "/api/agents"> | import("./router.js").Route<"agents.routines", {
16
+ routines: import("../routines.js").RoutineStatus[];
17
+ }, "/api/agents/:slug/routines"> | import("./router.js").Route<"agents.runRoutine", {
18
+ chatId: string;
19
+ }, "/api/agents/:slug/routines/:id/run"> | import("./router.js").Route<"agents.save", import("../agents.js").AgentDetail, "/api/agents/:slug"> | import("./router.js").Route<"agents.saveRoutine", import("../routines.js").Routine, "/api/agents/:slug/routines"> | import("./router.js").Route<"agents.saveSkill", import("../skills.js").SkillInfo & {
20
+ content: string;
21
+ }, "/api/agents/:slug/skills"> | import("./router.js").Route<"agents.skill", {
22
+ name: string;
23
+ description: string;
24
+ path: string;
25
+ dir: string;
26
+ source: "workspace" | "project" | "user" | "agent";
27
+ agent?: string;
28
+ content: string;
29
+ }, "/api/agents/:slug/skills/:name"> | import("./router.js").Route<"agents.skills", {
30
+ skills: import("../skills.js").SkillInfo[];
31
+ }, "/api/agents/:slug/skills">)[];