volute 0.4.0 → 0.5.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 +22 -22
- package/dist/agent-Z2B6EFEQ.js +75 -0
- package/dist/{agent-manager-AUCKMGPR.js → agent-manager-PXBKA2GK.js} +4 -4
- package/dist/channel-MK5OK2SI.js +113 -0
- package/dist/chunk-5X7HGB6L.js +107 -0
- package/dist/{chunk-YGFIWIOF.js → chunk-7L4AN5D4.js} +1 -1
- package/dist/{chunk-VRVVQIYY.js → chunk-AZEL2IEK.js} +1 -1
- package/dist/chunk-B3R6L2GW.js +24 -0
- package/dist/{chunk-DNOXHLE5.js → chunk-HE67X4T6.js} +1 -1
- package/dist/{chunk-I6OHXCMV.js → chunk-MW2KFO3B.js} +47 -9
- package/dist/{chunk-5OCWMTVS.js → chunk-SMISE4SV.js} +77 -3
- package/dist/{chunk-SOZA2TLP.js → chunk-UAVD2AHX.js} +1 -1
- package/dist/{chunk-3C2XR4IY.js → chunk-UX25Z2ND.js} +113 -107
- package/dist/{chunk-GSPKUPKU.js → chunk-XUA3JUFK.js} +2 -1
- package/dist/chunk-ZYGKG6VC.js +22 -0
- package/dist/cli.js +86 -74
- package/dist/{connector-DKDJTLYZ.js → connector-LYEMXQEV.js} +11 -6
- package/dist/connectors/discord.js +3 -1
- package/dist/connectors/slack.js +14 -5
- package/dist/connectors/telegram.js +21 -2
- package/dist/conversation-ERXEQZTY.js +163 -0
- package/dist/create-RVCZN6HE.js +91 -0
- package/dist/{daemon-client-XR24PUJF.js → daemon-client-ZY6UUN2M.js} +2 -2
- package/dist/daemon.js +629 -177
- package/dist/{delete-55MXCEY5.js → delete-3QH7VYIN.js} +7 -8
- package/dist/{down-3OB6UVAJ.js → down-O7IFZLVJ.js} +1 -1
- package/dist/{env-JB27UAC3.js → env-4D4REPJF.js} +8 -5
- package/dist/{history-BKG74I43.js → history-OEONB53Z.js} +3 -3
- package/dist/{import-4CI2ZUTJ.js → import-MXJB2EII.js} +8 -8
- package/dist/{logs-NXFFGUKY.js → logs-DF342W4M.js} +2 -2
- package/dist/message-ADHWFHSI.js +32 -0
- package/dist/{package-Z2SFO2SV.js → package-VQOE7JNH.js} +1 -1
- package/dist/{schedule-A35SH4HT.js → schedule-NAG6F463.js} +10 -5
- package/dist/send-66QMKRUH.js +75 -0
- package/dist/{setup-2FDVN7OF.js → setup-RPRRGG2F.js} +5 -5
- package/dist/{start-LDPMCMYT.js → start-TUOXDSFL.js} +3 -3
- package/dist/{status-MVSQG54T.js → status-A36EHRO4.js} +3 -3
- package/dist/{stop-5PZTZCLL.js → stop-AOJZLQ5X.js} +6 -7
- package/dist/{up-F7TMTLRE.js → up-7ILD7GU7.js} +2 -2
- package/dist/update-LPSIAWQ2.js +140 -0
- package/dist/update-check-Y33QDCFL.js +17 -0
- package/dist/{upgrade-6ZW2RD64.js → upgrade-FX2TKJ2S.js} +16 -15
- package/dist/{variant-T64BKARF.js → variant-LAB67OC2.js} +15 -10
- package/dist/web-assets/assets/index-BbRmoxoA.js +308 -0
- package/dist/web-assets/index.html +2 -2
- package/drizzle/0003_clean_ego.sql +12 -0
- package/drizzle/meta/0003_snapshot.json +417 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/templates/_base/.init/.config/hooks/startup-context.sh +19 -1
- package/templates/_base/_skills/volute-agent/SKILL.md +110 -14
- package/templates/_base/home/.config/routes.json +10 -0
- package/templates/_base/home/VOLUTE.md +14 -35
- package/templates/_base/src/lib/format-prefix.ts +1 -1
- package/templates/_base/src/lib/router.ts +163 -16
- package/templates/_base/src/lib/routing.ts +55 -18
- package/templates/_base/src/lib/types.ts +3 -1
- package/templates/agent-sdk/.init/.config/routes.json +5 -0
- package/templates/agent-sdk/.init/CLAUDE.md +2 -2
- package/templates/agent-sdk/src/agent.ts +2 -1
- package/templates/agent-sdk/src/server.ts +8 -2
- package/templates/agent-sdk/volute-template.json +1 -1
- package/templates/pi/.init/.config/routes.json +5 -0
- package/templates/pi/.init/AGENTS.md +1 -1
- package/templates/pi/src/agent.ts +5 -3
- package/templates/pi/src/server.ts +1 -1
- package/templates/pi/volute-template.json +1 -1
- package/dist/channel-DQ6UY7QB.js +0 -67
- package/dist/chunk-ZHCE4DPY.js +0 -110
- package/dist/create-ILVOG75A.js +0 -79
- package/dist/send-3U6OTKG7.js +0 -57
- package/dist/web-assets/assets/index-NS621maO.js +0 -296
- package/templates/agent-sdk/.init/.config/sessions.json +0 -4
- package/templates/pi/.init/.config/sessions.json +0 -1
- package/dist/{service-SA4TTMDU.js → service-HZNIDNJF.js} +3 -3
package/dist/channel-DQ6UY7QB.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
resolveAgentName
|
|
4
|
-
} from "./chunk-VRVVQIYY.js";
|
|
5
|
-
import {
|
|
6
|
-
getChannelDriver
|
|
7
|
-
} from "./chunk-5OCWMTVS.js";
|
|
8
|
-
import {
|
|
9
|
-
loadMergedEnv
|
|
10
|
-
} from "./chunk-DNOXHLE5.js";
|
|
11
|
-
import {
|
|
12
|
-
parseArgs
|
|
13
|
-
} from "./chunk-D424ZQGI.js";
|
|
14
|
-
import {
|
|
15
|
-
resolveAgent
|
|
16
|
-
} from "./chunk-3C2XR4IY.js";
|
|
17
|
-
import "./chunk-K3NQKI34.js";
|
|
18
|
-
|
|
19
|
-
// src/commands/channel.ts
|
|
20
|
-
async function run(args) {
|
|
21
|
-
const { positional, flags } = parseArgs(args, {
|
|
22
|
-
agent: { type: "string" },
|
|
23
|
-
limit: { type: "number" }
|
|
24
|
-
});
|
|
25
|
-
const subcommand = positional[0];
|
|
26
|
-
const uri = positional[1];
|
|
27
|
-
const message = positional[2];
|
|
28
|
-
if (!subcommand || !uri || subcommand === "send" && !message) {
|
|
29
|
-
console.error(`Usage:
|
|
30
|
-
volute channel read <channel-uri> [--limit N] [--agent <name>]
|
|
31
|
-
volute channel send <channel-uri> "<message>" [--agent <name>]`);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
const agentName = resolveAgentName(flags);
|
|
35
|
-
const colonIdx = uri.indexOf(":");
|
|
36
|
-
if (colonIdx === -1) {
|
|
37
|
-
console.error(`Invalid channel URI: ${uri} (expected format: platform:id)`);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
const platform = uri.slice(0, colonIdx);
|
|
41
|
-
const channelId = uri.slice(colonIdx + 1);
|
|
42
|
-
const driver = getChannelDriver(platform);
|
|
43
|
-
if (!driver) {
|
|
44
|
-
console.error(`No channel driver for platform: ${platform}`);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
const { dir } = resolveAgent(agentName);
|
|
48
|
-
const env = loadMergedEnv(dir);
|
|
49
|
-
try {
|
|
50
|
-
if (subcommand === "read") {
|
|
51
|
-
const limit = flags.limit ?? 20;
|
|
52
|
-
const output = await driver.read(env, channelId, limit);
|
|
53
|
-
console.log(output);
|
|
54
|
-
} else if (subcommand === "send") {
|
|
55
|
-
await driver.send(env, channelId, message);
|
|
56
|
-
} else {
|
|
57
|
-
console.error(`Unknown subcommand: ${subcommand}`);
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export {
|
|
66
|
-
run
|
|
67
|
-
};
|
package/dist/chunk-ZHCE4DPY.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/lib/format-tool.ts
|
|
4
|
-
function summarizeTool(name, input) {
|
|
5
|
-
if (input && typeof input === "object") {
|
|
6
|
-
const args = input;
|
|
7
|
-
const val = args.path ?? args.command ?? args.query ?? args.url;
|
|
8
|
-
if (typeof val === "string") {
|
|
9
|
-
const brief = val.length > 60 ? `${val.slice(0, 57)}...` : val;
|
|
10
|
-
return `[${name} ${brief}]`;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return `[${name}]`;
|
|
14
|
-
}
|
|
15
|
-
function collectPart(event) {
|
|
16
|
-
if (event.type === "text") return event.content ?? "";
|
|
17
|
-
if (event.type === "tool_use") return summarizeTool(event.name ?? "", event.input);
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/lib/log-buffer.ts
|
|
22
|
-
var LogBuffer = class {
|
|
23
|
-
entries = [];
|
|
24
|
-
maxSize = 1e3;
|
|
25
|
-
subscribers = /* @__PURE__ */ new Set();
|
|
26
|
-
append(entry) {
|
|
27
|
-
this.entries.push(entry);
|
|
28
|
-
if (this.entries.length > this.maxSize) {
|
|
29
|
-
this.entries.shift();
|
|
30
|
-
}
|
|
31
|
-
for (const sub of this.subscribers) {
|
|
32
|
-
sub(entry);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
getEntries() {
|
|
36
|
-
return [...this.entries];
|
|
37
|
-
}
|
|
38
|
-
subscribe(fn) {
|
|
39
|
-
this.subscribers.add(fn);
|
|
40
|
-
return () => this.subscribers.delete(fn);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
var logBuffer = new LogBuffer();
|
|
44
|
-
|
|
45
|
-
// src/lib/logger.ts
|
|
46
|
-
function write(level, msg, data) {
|
|
47
|
-
const entry = {
|
|
48
|
-
level,
|
|
49
|
-
msg,
|
|
50
|
-
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
51
|
-
...data ? { data } : {}
|
|
52
|
-
};
|
|
53
|
-
const line = JSON.stringify(entry);
|
|
54
|
-
process.stderr.write(`${line}
|
|
55
|
-
`);
|
|
56
|
-
logBuffer.append(entry);
|
|
57
|
-
}
|
|
58
|
-
var log = {
|
|
59
|
-
info: (msg, data) => write("info", msg, data),
|
|
60
|
-
warn: (msg, data) => write("warn", msg, data),
|
|
61
|
-
error: (msg, data) => write("error", msg, data)
|
|
62
|
-
};
|
|
63
|
-
var logger_default = log;
|
|
64
|
-
|
|
65
|
-
// src/lib/ndjson.ts
|
|
66
|
-
var MAX_BUFFER_SIZE = 1e6;
|
|
67
|
-
async function* readNdjson(body) {
|
|
68
|
-
const reader = body.getReader();
|
|
69
|
-
const decoder = new TextDecoder();
|
|
70
|
-
let buffer = "";
|
|
71
|
-
try {
|
|
72
|
-
while (true) {
|
|
73
|
-
const { done, value } = await reader.read();
|
|
74
|
-
if (done) break;
|
|
75
|
-
buffer += decoder.decode(value, { stream: true });
|
|
76
|
-
if (buffer.length > MAX_BUFFER_SIZE) {
|
|
77
|
-
logger_default.warn("ndjson: buffer exceeded 1MB, resetting");
|
|
78
|
-
buffer = "";
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
const lines = buffer.split("\n");
|
|
82
|
-
buffer = lines.pop() || "";
|
|
83
|
-
for (const line of lines) {
|
|
84
|
-
if (!line.trim()) continue;
|
|
85
|
-
try {
|
|
86
|
-
yield JSON.parse(line);
|
|
87
|
-
} catch {
|
|
88
|
-
logger_default.warn("ndjson: skipping invalid line", { line: line.slice(0, 100) });
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
if (buffer.trim()) {
|
|
93
|
-
try {
|
|
94
|
-
yield JSON.parse(buffer);
|
|
95
|
-
} catch {
|
|
96
|
-
logger_default.warn("ndjson: skipping invalid line", { line: buffer.slice(0, 100) });
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
} finally {
|
|
100
|
-
reader.releaseLock();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export {
|
|
105
|
-
summarizeTool,
|
|
106
|
-
collectPart,
|
|
107
|
-
logBuffer,
|
|
108
|
-
logger_default,
|
|
109
|
-
readNdjson
|
|
110
|
-
};
|
package/dist/create-ILVOG75A.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
applyInitFiles,
|
|
4
|
-
composeTemplate,
|
|
5
|
-
copyTemplateToDir,
|
|
6
|
-
findTemplatesRoot
|
|
7
|
-
} from "./chunk-GSPKUPKU.js";
|
|
8
|
-
import {
|
|
9
|
-
exec,
|
|
10
|
-
execInherit
|
|
11
|
-
} from "./chunk-5SKQ6J7T.js";
|
|
12
|
-
import {
|
|
13
|
-
parseArgs
|
|
14
|
-
} from "./chunk-D424ZQGI.js";
|
|
15
|
-
import {
|
|
16
|
-
chownAgentDir,
|
|
17
|
-
createAgentUser,
|
|
18
|
-
ensureVoluteGroup
|
|
19
|
-
} from "./chunk-SOZA2TLP.js";
|
|
20
|
-
import {
|
|
21
|
-
addAgent,
|
|
22
|
-
agentDir,
|
|
23
|
-
ensureVoluteHome,
|
|
24
|
-
nextPort
|
|
25
|
-
} from "./chunk-3C2XR4IY.js";
|
|
26
|
-
import "./chunk-K3NQKI34.js";
|
|
27
|
-
|
|
28
|
-
// src/commands/create.ts
|
|
29
|
-
import { existsSync, rmSync } from "fs";
|
|
30
|
-
async function run(args) {
|
|
31
|
-
const { positional, flags } = parseArgs(args, {
|
|
32
|
-
template: { type: "string" }
|
|
33
|
-
});
|
|
34
|
-
const name = positional[0];
|
|
35
|
-
const template = flags.template ?? "agent-sdk";
|
|
36
|
-
if (!name) {
|
|
37
|
-
console.error("Usage: volute create <name> [--template <name>]");
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
ensureVoluteHome();
|
|
41
|
-
const dest = agentDir(name);
|
|
42
|
-
if (existsSync(dest)) {
|
|
43
|
-
console.error(`Agent already exists: ${name}`);
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
const templatesRoot = findTemplatesRoot();
|
|
47
|
-
const { composedDir, manifest } = composeTemplate(templatesRoot, template);
|
|
48
|
-
try {
|
|
49
|
-
copyTemplateToDir(composedDir, dest, name, manifest);
|
|
50
|
-
applyInitFiles(dest);
|
|
51
|
-
} finally {
|
|
52
|
-
rmSync(composedDir, { recursive: true, force: true });
|
|
53
|
-
}
|
|
54
|
-
const port = nextPort();
|
|
55
|
-
addAgent(name, port);
|
|
56
|
-
console.log("Installing dependencies...");
|
|
57
|
-
await execInherit("npm", ["install"], { cwd: dest });
|
|
58
|
-
try {
|
|
59
|
-
await exec("git", ["init"], { cwd: dest });
|
|
60
|
-
await exec("git", ["add", "-A"], { cwd: dest });
|
|
61
|
-
await exec("git", ["commit", "-m", "initial commit"], { cwd: dest });
|
|
62
|
-
} catch {
|
|
63
|
-
console.warn(
|
|
64
|
-
"\nWarning: git init failed (git may not be installed or configured).",
|
|
65
|
-
"\nThe agent will work, but forking/variants won't be available.",
|
|
66
|
-
"\nTo fix: install git and run `git config --global user.name` / `git config --global user.email`"
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
ensureVoluteGroup();
|
|
70
|
-
createAgentUser(name);
|
|
71
|
-
chownAgentDir(dest, name);
|
|
72
|
-
console.log(`
|
|
73
|
-
Created agent: ${name} (port ${port})`);
|
|
74
|
-
console.log(`
|
|
75
|
-
volute start ${name}`);
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
run
|
|
79
|
-
};
|
package/dist/send-3U6OTKG7.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
readNdjson,
|
|
4
|
-
summarizeTool
|
|
5
|
-
} from "./chunk-ZHCE4DPY.js";
|
|
6
|
-
import {
|
|
7
|
-
daemonFetch
|
|
8
|
-
} from "./chunk-YGFIWIOF.js";
|
|
9
|
-
import "./chunk-3C2XR4IY.js";
|
|
10
|
-
import "./chunk-K3NQKI34.js";
|
|
11
|
-
|
|
12
|
-
// src/commands/send.ts
|
|
13
|
-
import { userInfo } from "os";
|
|
14
|
-
async function run(args) {
|
|
15
|
-
const name = args[0];
|
|
16
|
-
const message = args[1];
|
|
17
|
-
if (!name || !message) {
|
|
18
|
-
console.error('Usage: volute send <name> "<message>"');
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
const agentSelf = process.env.VOLUTE_AGENT;
|
|
22
|
-
const sender = agentSelf || userInfo().username;
|
|
23
|
-
const channel = agentSelf ? "agent" : "cli";
|
|
24
|
-
const res = await daemonFetch(`/api/agents/${encodeURIComponent(name)}/message`, {
|
|
25
|
-
method: "POST",
|
|
26
|
-
headers: { "Content-Type": "application/json" },
|
|
27
|
-
body: JSON.stringify({
|
|
28
|
-
content: [{ type: "text", text: message }],
|
|
29
|
-
channel,
|
|
30
|
-
sender
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
if (!res.ok) {
|
|
34
|
-
const data = await res.json();
|
|
35
|
-
console.error(data.error ?? `Failed to send message: ${res.status}`);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
if (!res.body) {
|
|
39
|
-
console.error("No response body");
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
for await (const event of readNdjson(res.body)) {
|
|
43
|
-
if (event.type === "text") {
|
|
44
|
-
process.stdout.write(event.content);
|
|
45
|
-
} else if (event.type === "tool_use") {
|
|
46
|
-
process.stderr.write(`${summarizeTool(event.name, event.input)}
|
|
47
|
-
`);
|
|
48
|
-
}
|
|
49
|
-
if (event.type === "done") {
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
process.stdout.write("\n");
|
|
54
|
-
}
|
|
55
|
-
export {
|
|
56
|
-
run
|
|
57
|
-
};
|