svamp-cli 0.2.92 → 0.2.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agentCommands-t6HbehoC.mjs → agentCommands-BxnLztnU.mjs} +2 -2
- package/dist/{auth-Dx09pKt3.mjs → auth-BicjH8vK.mjs} +1 -2
- package/dist/cli.mjs +50 -51
- package/dist/{commands-BHSvizSp.mjs → commands-BRg9BTrv.mjs} +1 -2
- package/dist/{commands-Dfyuenmi.mjs → commands-Crvn1XhO.mjs} +5 -5
- package/dist/{commands-BxluPors.mjs → commands-N1FOTq1Y.mjs} +1 -2
- package/dist/{commands-BR_lAgZ0.mjs → commands-fEd97uFk.mjs} +1 -2
- package/dist/{commands-pVw3CcRo.mjs → commands-q6eSqgGo.mjs} +2 -3
- package/dist/{fleet-C3KLMFeD.mjs → fleet-D4Au0GFM.mjs} +1 -2
- package/dist/{frpc-D_1pEpUY.mjs → frpc-ki1LtiZY.mjs} +1 -2
- package/dist/{headlessCli-D-unuCQt.mjs → headlessCli-fjO9JxJW.mjs} +2 -1
- package/dist/index.mjs +1 -2
- package/dist/{package-_Qk8lnvq.mjs → package-DXh7VIhg.mjs} +2 -2
- package/dist/{run-l1OtW948.mjs → run-BERXqjjm.mjs} +1 -2
- package/dist/{run-BF4AmFz8.mjs → run-NLlVMcrd.mjs} +7 -446
- package/dist/{serveCommands-CvhlM4Iz.mjs → serveCommands-BNE_5gzO.mjs} +5 -5
- package/dist/{serveManager-DNlqB0r6.mjs → serveManager-oYpBlNC6.mjs} +2 -3
- package/dist/sideband-BFBWJWur.mjs +79 -0
- package/package.json +2 -2
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z as READ_ONLY_TOOLS, A as loadMachineContext, B as buildMachineInstructions, C as machineToolsForRole, D as buildMachineTools } from './run-NLlVMcrd.mjs';
|
|
2
|
+
import 'node:child_process';
|
|
3
|
+
import 'os';
|
|
4
|
+
import 'fs/promises';
|
|
5
|
+
import 'fs';
|
|
6
|
+
import 'path';
|
|
7
|
+
import 'url';
|
|
8
|
+
import 'child_process';
|
|
9
|
+
import 'crypto';
|
|
10
|
+
import 'node:fs';
|
|
11
|
+
import 'util';
|
|
12
|
+
import 'node:crypto';
|
|
13
|
+
import 'node:path';
|
|
14
|
+
import 'node:os';
|
|
15
|
+
import '@agentclientprotocol/sdk';
|
|
16
|
+
import '@modelcontextprotocol/sdk/client/index.js';
|
|
17
|
+
import '@modelcontextprotocol/sdk/client/stdio.js';
|
|
18
|
+
import '@modelcontextprotocol/sdk/types.js';
|
|
19
|
+
import 'zod';
|
|
20
|
+
import 'node:fs/promises';
|
|
21
|
+
import 'node:util';
|
|
22
|
+
|
|
23
|
+
function toolsForRole(role) {
|
|
24
|
+
if (role === "admin") return [...READ_ONLY_TOOLS, "run_bash", "send_to_session"];
|
|
25
|
+
if (role === "interact") return [...READ_ONLY_TOOLS, "send_to_session"];
|
|
26
|
+
return [...READ_ONLY_TOOLS];
|
|
27
|
+
}
|
|
28
|
+
function toRealtimeTools(tools) {
|
|
29
|
+
return tools.map((t) => ({ type: "function", name: t.name, description: t.description, parameters: t.parameters }));
|
|
30
|
+
}
|
|
31
|
+
function buildVoiceSessionUpdate(instructions, tools, opts) {
|
|
32
|
+
return {
|
|
33
|
+
type: "session.update",
|
|
34
|
+
session: {
|
|
35
|
+
type: "realtime",
|
|
36
|
+
instructions,
|
|
37
|
+
tools: toRealtimeTools(tools),
|
|
38
|
+
tool_choice: "auto",
|
|
39
|
+
...opts?.voice ? { audio: { output: { voice: opts.voice } } } : {}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async function handleRealtimeEvent(ev, tools, send, nameByCallId) {
|
|
44
|
+
if (ev?.type === "response.output_item.added" && ev.item?.type === "function_call") {
|
|
45
|
+
if (nameByCallId && ev.item.call_id) nameByCallId.set(ev.item.call_id, ev.item.name);
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (!ev || ev.type !== "response.function_call_arguments.done") return null;
|
|
49
|
+
const callId = ev.call_id;
|
|
50
|
+
const name = ev.name || nameByCallId && nameByCallId.get(callId) || "";
|
|
51
|
+
let args = {};
|
|
52
|
+
try {
|
|
53
|
+
args = ev.arguments ? JSON.parse(ev.arguments) : {};
|
|
54
|
+
} catch {
|
|
55
|
+
}
|
|
56
|
+
const tool = tools.find((t) => t.name === name);
|
|
57
|
+
let output;
|
|
58
|
+
if (!tool) {
|
|
59
|
+
output = `error: tool "${name}" is not available to this caller`;
|
|
60
|
+
} else {
|
|
61
|
+
try {
|
|
62
|
+
output = await tool.run(args);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
output = `error: ${e?.message || e}`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
send({ type: "conversation.item.create", item: { type: "function_call_output", call_id: callId, output } });
|
|
68
|
+
send({ type: "response.create" });
|
|
69
|
+
return { name, output };
|
|
70
|
+
}
|
|
71
|
+
async function initMachineVoiceSession(init) {
|
|
72
|
+
const ctx = await loadMachineContext(init.deps);
|
|
73
|
+
const instructions = buildMachineInstructions(ctx);
|
|
74
|
+
const allow = new Set(machineToolsForRole(init.role));
|
|
75
|
+
const granted = buildMachineTools(init.deps, ctx.skills).filter((t) => allow.has(t.name));
|
|
76
|
+
return { tools: granted, sessionUpdate: buildVoiceSessionUpdate(instructions, granted, { voice: init.voice }) };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { buildVoiceSessionUpdate, handleRealtimeEvent, initMachineVoiceSession, toRealtimeTools, toolsForRole };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svamp-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.94",
|
|
4
4
|
"description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
|
|
5
5
|
"author": "Amun AI AB",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "rm -rf dist bin/skills && mkdir -p bin/skills && cp -r ../../skills/artifact bin/skills/artifact && tsc --noEmit && pkgroll",
|
|
22
22
|
"typecheck": "tsc --noEmit",
|
|
23
|
-
"test": "npx tsx test/test-context-window.mjs && npx tsx test/test-instance-config.mjs && npx tsx test/test-authorize.mjs && npx tsx test/test-normalize-allowed-user.mjs && npx tsx test/test-share-url.mjs && npx tsx test/test-update-sharing-normalization.mjs && npx tsx test/test-staged-homes-sweep.mjs && npx tsx test/test-session-helpers.mjs && npx tsx test/test-cli-routing.mjs && npx tsx test/test-security-context.mjs && npx tsx test/test-isolation-decision.mjs && npx tsx test/test-ralph-loop.mjs && npx tsx test/test-message-helpers.mjs && npx tsx test/test-agent-config.mjs && npx tsx test/test-wrap-command.mjs && npx tsx test/test-credential-staging.mjs && npx tsx test/test-claude-auth.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-inbox-guard.mjs && npx tsx test/test-agent-types.mjs && npx tsx test/test-transport.mjs && npx tsx test/test-session-update-handlers.mjs && npx tsx test/test-session-scanner.mjs && npx tsx test/test-hypha-client.mjs && npx tsx test/test-hook-settings.mjs && npx tsx test/test-session-service-logic.mjs && npx tsx test/test-daemon-persistence.mjs && npx tsx test/test-detect-isolation.mjs && npx tsx test/test-machine-service-logic.mjs && npx tsx test/test-interactive-helpers.mjs && npx tsx test/test-codex-backend.mjs && npx tsx test/test-acp-backend.mjs && npx tsx test/test-acp-bridge.mjs && npx tsx test/test-hook-server.mjs && npx tsx test/test-session-commands.mjs && npx tsx test/test-interactive-console.mjs && npx tsx test/test-session-messages.mjs && npx tsx test/test-session-send-query.mjs && npx tsx test/test-skills.mjs && npx tsx test/test-agent-grouping.mjs && npx tsx test/test-ralph-loop-integration.mjs && npx tsx test/test-ralph-loop-modes.mjs && npx tsx test/test-machine-list-directory.mjs && npx tsx test/test-service-commands.mjs && npx tsx test/test-supervisor.mjs && npx tsx test/test-supervisor-lock.mjs && node test/test-supervisor-restart.mjs && npx tsx test/test-clear-detection.mjs && npx tsx test/test-session-consolidation.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-session-rpc-dispatch.mjs && npx tsx test/test-sandbox-cli.mjs && npx tsx test/test-serve-manager.mjs && npx tsx test/test-serve-stability.mjs && npx tsx test/test-frpc-e2e.mjs --unit-only && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.mjs && npx tsx test/test-routine.mjs && npx tsx test/test-routine-rpc.mjs && npx tsx test/test-session-file.mjs && npx tsx test/test-channel-rpc.mjs && npx tsx test/test-wise-agent.mjs && npx tsx test/test-channel-agent.mjs && npx tsx test/test-channels-service.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.mjs && npx tsx test/test-wise-voice.mjs && npx tsx test/test-wise-
|
|
23
|
+
"test": "npx tsx test/test-context-window.mjs && npx tsx test/test-instance-config.mjs && npx tsx test/test-authorize.mjs && npx tsx test/test-normalize-allowed-user.mjs && npx tsx test/test-share-url.mjs && npx tsx test/test-update-sharing-normalization.mjs && npx tsx test/test-staged-homes-sweep.mjs && npx tsx test/test-session-helpers.mjs && npx tsx test/test-cli-routing.mjs && npx tsx test/test-security-context.mjs && npx tsx test/test-isolation-decision.mjs && npx tsx test/test-ralph-loop.mjs && npx tsx test/test-message-helpers.mjs && npx tsx test/test-agent-config.mjs && npx tsx test/test-wrap-command.mjs && npx tsx test/test-credential-staging.mjs && npx tsx test/test-claude-auth.mjs && npx tsx test/test-output-formatters.mjs && npx tsx test/test-inbox-guard.mjs && npx tsx test/test-agent-types.mjs && npx tsx test/test-transport.mjs && npx tsx test/test-session-update-handlers.mjs && npx tsx test/test-session-scanner.mjs && npx tsx test/test-hypha-client.mjs && npx tsx test/test-hook-settings.mjs && npx tsx test/test-session-service-logic.mjs && npx tsx test/test-daemon-persistence.mjs && npx tsx test/test-detect-isolation.mjs && npx tsx test/test-machine-service-logic.mjs && npx tsx test/test-interactive-helpers.mjs && npx tsx test/test-codex-backend.mjs && npx tsx test/test-acp-backend.mjs && npx tsx test/test-acp-bridge.mjs && npx tsx test/test-hook-server.mjs && npx tsx test/test-session-commands.mjs && npx tsx test/test-interactive-console.mjs && npx tsx test/test-session-messages.mjs && npx tsx test/test-session-send-query.mjs && npx tsx test/test-skills.mjs && npx tsx test/test-agent-grouping.mjs && npx tsx test/test-ralph-loop-integration.mjs && npx tsx test/test-ralph-loop-modes.mjs && npx tsx test/test-machine-list-directory.mjs && npx tsx test/test-service-commands.mjs && npx tsx test/test-supervisor.mjs && npx tsx test/test-supervisor-lock.mjs && node test/test-supervisor-restart.mjs && npx tsx test/test-clear-detection.mjs && npx tsx test/test-session-consolidation.mjs && npx tsx test/test-inbox.mjs && npx tsx test/test-session-rpc-dispatch.mjs && npx tsx test/test-sandbox-cli.mjs && npx tsx test/test-serve-manager.mjs && npx tsx test/test-serve-stability.mjs && npx tsx test/test-frpc-e2e.mjs --unit-only && node test/pinnedClaudeCode.test.mjs && node test/fleet.test.mjs && npx tsx test/test-routine.mjs && npx tsx test/test-routine-rpc.mjs && npx tsx test/test-session-file.mjs && npx tsx test/test-channel-rpc.mjs && npx tsx test/test-wise-agent.mjs && npx tsx test/test-channel-agent.mjs && npx tsx test/test-channels-service.mjs && npx tsx test/test-wise-agent-auth.mjs && npx tsx test/test-channel-http.mjs && npx tsx test/test-wise-voice.mjs && npx tsx test/test-wise-headless.mjs && npx tsx test/test-wise-machine.mjs",
|
|
24
24
|
"test:hypha": "node --no-warnings test/test-hypha-service.mjs",
|
|
25
25
|
"dev": "tsx src/cli.ts",
|
|
26
26
|
"dev:daemon": "tsx src/cli.ts daemon start-sync",
|