@vellumai/assistant 0.12.2-staging.7 → 0.12.2
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/docs/architecture/memory.md +2 -11
- package/docs/desktop-browser-cli.md +2 -4
- package/node_modules/@vellumai/environments/src/shell.test.ts +0 -21
- package/node_modules/@vellumai/environments/src/shell.ts +0 -24
- package/node_modules/@vellumai/gateway-client/src/inbound-contract.ts +2 -8
- package/openapi.yaml +2 -6
- package/package.json +1 -1
- package/scripts/smoke-desktop-browser-cli.ts +0 -1
- package/src/__tests__/agent-loop.test.ts +0 -124
- package/src/__tests__/approval-interception-trust-gates.test.ts +0 -40
- package/src/__tests__/channel-approval.test.ts +14 -9
- package/src/__tests__/conversation-agent-loop.test.ts +0 -25
- package/src/__tests__/plugin-import-boundary-guard.test.ts +1 -0
- package/src/__tests__/run-conversation-turn-persistence.test.ts +1 -138
- package/src/__tests__/script-proxy-certs.test.ts +1 -1
- package/src/__tests__/subagent-tool-gate-mode.test.ts +0 -169
- package/src/__tests__/terminal-tools.test.ts +0 -8
- package/src/__tests__/unicode.test.ts +0 -36
- package/src/agent/loop.ts +0 -19
- package/src/api/index.ts +0 -6
- package/src/approvals/approval-primitive.ts +2 -5
- package/src/approvals/scoped-approval-grants.ts +2 -6
- package/src/daemon/__tests__/conversation-tool-setup.test.ts +0 -43
- package/src/daemon/conversation-agent-loop.ts +0 -2
- package/src/daemon/conversation-tool-setup.ts +1 -57
- package/src/daemon/conversation.ts +0 -17
- package/src/daemon/daemon-control.ts +6 -2
- package/src/daemon/orphan-reaper.ts +3 -4
- package/src/daemon/tool-setup-types.ts +0 -6
- package/src/daemon/wake-conversation-ops.ts +15 -38
- package/src/desktop/desktop-automation-lease.test.ts +0 -143
- package/src/desktop/desktop-automation-lease.ts +3 -39
- package/src/messaging/provider-message-metadata.ts +3 -3
- package/src/notifications/__tests__/copy-composer.test.ts +0 -70
- package/src/notifications/copy-composer.ts +3 -11
- package/src/oauth/seed-providers.ts +30 -0
- package/src/persistence/conversation-plugin-facade.ts +0 -13
- package/src/persistence/schema/index.ts +0 -1
- package/src/persistence/steps.ts +0 -2
- package/src/plugin-api/conversation-turn.ts +7 -31
- package/src/plugin-api/index.ts +1 -9
- package/src/plugins/defaults/memory/AGENTS.md +2 -14
- package/src/plugins/defaults/memory/__tests__/buffer-format.test.ts +0 -43
- package/src/plugins/defaults/memory/__tests__/memory-retrospective-job.test.ts +0 -46
- package/src/plugins/defaults/memory/buffer-format.ts +0 -40
- package/src/plugins/defaults/memory/context-search/agent-runner.ts +2 -1
- package/src/plugins/defaults/memory/context-search/format.ts +1 -2
- package/src/plugins/defaults/memory/context-search/sources/memory-v2.ts +1 -2
- package/src/plugins/defaults/memory/context-search/sources/workspace.ts +1 -2
- package/src/plugins/defaults/memory/graph/capability-seed.ts +2 -1
- package/src/plugins/defaults/memory/graph/tool-handlers.ts +42 -1
- package/src/plugins/defaults/memory/host-utils.ts +10 -0
- package/src/plugins/defaults/memory/injectors.ts +3 -4
- package/src/plugins/defaults/memory/memory-retrospective-job.ts +181 -55
- package/src/plugins/defaults/memory/substrate/__tests__/consolidation-job.test.ts +99 -407
- package/src/plugins/defaults/memory/substrate/__tests__/consolidation-prompt-flag-gating-guard.test.ts +0 -10
- package/src/plugins/defaults/memory/substrate/__tests__/prompts-consolidation.test.ts +7 -107
- package/src/plugins/defaults/memory/substrate/consolidation-job.ts +86 -307
- package/src/plugins/defaults/memory/substrate/page-index.ts +1 -2
- package/src/plugins/defaults/memory/substrate/prompts/consolidation.ts +49 -89
- package/src/plugins/defaults/memory/substrate/sweep-job.ts +1 -1
- package/src/plugins/defaults/memory/tools.ts +1 -1
- package/src/plugins/defaults/memory/v1/graph/consolidation.ts +2 -2
- package/src/plugins/defaults/memory/v1/graph/extraction.ts +1 -2
- package/src/plugins/defaults/memory/v1/graph/retriever.ts +1 -1
- package/src/plugins/defaults/memory/v2/__tests__/migration.test.ts +0 -5
- package/src/plugins/defaults/memory/v2/__tests__/reranker.test.ts +2 -5
- package/src/plugins/defaults/memory/v2/reranker.ts +1 -2
- package/src/plugins/defaults/memory/v3/__tests__/injection.test.ts +1 -81
- package/src/plugins/defaults/memory/v3/__tests__/orchestrate.test.ts +0 -87
- package/src/plugins/defaults/memory/v3/__tests__/shadow-plugin.test.ts +0 -21
- package/src/plugins/defaults/memory/v3/card.ts +1 -2
- package/src/plugins/defaults/memory/v3/injector.ts +178 -212
- package/src/plugins/defaults/memory/v3/orchestrate.ts +22 -86
- package/src/plugins/defaults/memory/v3/pool-select.ts +7 -10
- package/src/plugins/defaults/memory/v3/sections.ts +1 -2
- package/src/plugins/defaults/memory/v3/shadow-plugin.ts +1 -10
- package/src/plugins/defaults/tool-result-truncate/terminal.ts +46 -1
- package/src/runtime/AGENTS.md +1 -1
- package/src/runtime/__tests__/agent-wake.test.ts +1 -86
- package/src/runtime/agent-wake.ts +4 -20
- package/src/runtime/guardian-action-service.ts +17 -2
- package/src/runtime/guardian-reply-router.ts +8 -1
- package/src/runtime/routes/channel-route-shared.ts +9 -1
- package/src/runtime/routes/desktop-setup-routes.test.ts +2 -2
- package/src/runtime/routes/desktop-setup-routes.ts +3 -7
- package/src/runtime/routes/guardian-approval-interception.ts +0 -24
- package/src/runtime/routes/inbound-message-handler.ts +3 -2
- package/src/runtime/routes/inbound-stages/background-dispatch.test.ts +1 -1
- package/src/runtime/routes/inbound-stages/background-dispatch.ts +4 -7
- package/src/schedule/run-script.ts +2 -2
- package/src/tools/host-terminal/host-shell.ts +6 -12
- package/src/tools/shared/filesystem/file-ops-service.ts +31 -1
- package/src/tools/shared/shell-output.test.ts +0 -10
- package/src/tools/shared/shell-output.ts +2 -14
- package/src/tools/skills/sandbox-runner.ts +2 -13
- package/src/tools/skills/scaffold-managed.ts +1 -2
- package/src/tools/terminal/__tests__/safe-env.test.ts +0 -29
- package/src/tools/terminal/safe-env.ts +1 -30
- package/src/tools/terminal/sanitized-bash.ts +2 -15
- package/src/tools/terminal/shell.test.ts +0 -29
- package/src/tools/terminal/shell.ts +7 -13
- package/src/util/host-process.test.ts +1 -17
- package/src/util/host-process.ts +0 -24
- package/src/util/unicode.ts +0 -29
- package/src/__tests__/db-conversation-tool-surface.test.ts +0 -144
- package/src/api/events/desktop-activity-changed.ts +0 -10
- package/src/persistence/conversation-tool-surface.ts +0 -86
- package/src/persistence/migrations/378-create-conversation-tool-surfaces.test.ts +0 -78
- package/src/persistence/migrations/378-create-conversation-tool-surfaces.ts +0 -29
- package/src/persistence/schema/conversation-tool-surfaces.ts +0 -22
- package/src/plugin-api/plugin-channel-turn-trust.test.ts +0 -133
- package/src/plugin-api/plugin-channel-turn-trust.ts +0 -71
- package/src/plugins/defaults/memory/__tests__/buffer-file.test.ts +0 -320
- package/src/plugins/defaults/memory/__tests__/fixtures/buffer-appender.ts +0 -17
- package/src/plugins/defaults/memory/__tests__/memory-run-evidence.test.ts +0 -161
- package/src/plugins/defaults/memory/buffer-file.ts +0 -354
- package/src/plugins/defaults/memory/memory-run-evidence.ts +0 -213
- package/src/plugins/defaults/memory/substrate/consolidation-tool-surface.ts +0 -34
- package/src/tools/terminal/shell-launch.test.ts +0 -162
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import * as realChildProcess from "node:child_process";
|
|
2
|
-
import { EventEmitter } from "node:events";
|
|
3
|
-
import { existsSync, mkdtempSync, rmSync } from "node:fs";
|
|
4
|
-
import { tmpdir } from "node:os";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
|
|
7
|
-
|
|
8
|
-
import { setConfig } from "../../__tests__/helpers/set-config.js";
|
|
9
|
-
import { SHELL_DID_NOT_START_MESSAGE } from "../shared/shell-output.js";
|
|
10
|
-
import type { ToolContext } from "../types.js";
|
|
11
|
-
|
|
12
|
-
const originalSpawn = realChildProcess.spawn;
|
|
13
|
-
|
|
14
|
-
type FakeChild = EventEmitter & {
|
|
15
|
-
pid?: number;
|
|
16
|
-
stdout: EventEmitter;
|
|
17
|
-
stderr: EventEmitter;
|
|
18
|
-
kill: () => boolean;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
type SpawnImpl = (
|
|
22
|
-
...args: Parameters<typeof realChildProcess.spawn>
|
|
23
|
-
) => ReturnType<typeof realChildProcess.spawn>;
|
|
24
|
-
|
|
25
|
-
const spawnCalls: {
|
|
26
|
-
command: string;
|
|
27
|
-
args: unknown;
|
|
28
|
-
options: realChildProcess.SpawnOptions;
|
|
29
|
-
}[] = [];
|
|
30
|
-
|
|
31
|
-
let spawnImpl: SpawnImpl = originalSpawn as SpawnImpl;
|
|
32
|
-
|
|
33
|
-
const spawnSpy = mock((...args: Parameters<typeof realChildProcess.spawn>) => {
|
|
34
|
-
spawnCalls.push({
|
|
35
|
-
command: args[0] as string,
|
|
36
|
-
args: args[1],
|
|
37
|
-
options: (args[2] ?? {}) as realChildProcess.SpawnOptions,
|
|
38
|
-
});
|
|
39
|
-
return spawnImpl(...args);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
mock.module("node:child_process", () => ({
|
|
43
|
-
...realChildProcess,
|
|
44
|
-
spawn: spawnSpy,
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
const realLogger = await import("../../util/logger.js");
|
|
48
|
-
mock.module("../../util/logger.js", () => ({
|
|
49
|
-
...realLogger,
|
|
50
|
-
getLogger: () =>
|
|
51
|
-
new Proxy({} as Record<string, unknown>, {
|
|
52
|
-
get: () => () => {},
|
|
53
|
-
}),
|
|
54
|
-
}));
|
|
55
|
-
|
|
56
|
-
setConfig("timeouts", { shellDefaultTimeoutSec: 30, shellMaxTimeoutSec: 60 });
|
|
57
|
-
|
|
58
|
-
const realHub = await import("../../runtime/assistant-event-hub.js");
|
|
59
|
-
mock.module("../../runtime/assistant-event-hub.js", () => ({
|
|
60
|
-
...realHub,
|
|
61
|
-
broadcastMessage: () => {},
|
|
62
|
-
}));
|
|
63
|
-
|
|
64
|
-
const realWake = await import("../../runtime/agent-wake.js");
|
|
65
|
-
mock.module("../../runtime/agent-wake.js", () => ({
|
|
66
|
-
...realWake,
|
|
67
|
-
wakeAgentForOpportunity: async () => ({}),
|
|
68
|
-
}));
|
|
69
|
-
|
|
70
|
-
const { shellTool } = await import("./shell.js");
|
|
71
|
-
|
|
72
|
-
function makeContext(workingDir: string): ToolContext {
|
|
73
|
-
return {
|
|
74
|
-
workingDir,
|
|
75
|
-
conversationId: "conv-xyz",
|
|
76
|
-
trustClass: "guardian",
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function fakeChild(): FakeChild {
|
|
81
|
-
const child = new EventEmitter() as FakeChild;
|
|
82
|
-
child.stdout = new EventEmitter();
|
|
83
|
-
child.stderr = new EventEmitter();
|
|
84
|
-
child.kill = () => true;
|
|
85
|
-
return child;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function closeWithoutStart(): ReturnType<typeof realChildProcess.spawn> {
|
|
89
|
-
const child = fakeChild();
|
|
90
|
-
queueMicrotask(() => {
|
|
91
|
-
child.emit("close", 0, null);
|
|
92
|
-
});
|
|
93
|
-
return child as unknown as ReturnType<typeof realChildProcess.spawn>;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function spawnError(
|
|
97
|
-
err: NodeJS.ErrnoException,
|
|
98
|
-
): ReturnType<typeof realChildProcess.spawn> {
|
|
99
|
-
const child = fakeChild();
|
|
100
|
-
queueMicrotask(() => {
|
|
101
|
-
child.emit("error", err);
|
|
102
|
-
});
|
|
103
|
-
return child as unknown as ReturnType<typeof realChildProcess.spawn>;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
describe("bash launch failures are not success", () => {
|
|
107
|
-
let workingDir = "";
|
|
108
|
-
|
|
109
|
-
beforeEach(() => {
|
|
110
|
-
spawnCalls.length = 0;
|
|
111
|
-
spawnImpl = originalSpawn as SpawnImpl;
|
|
112
|
-
workingDir = mkdtempSync(join(tmpdir(), "bash-launch-"));
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
afterEach(() => {
|
|
116
|
-
spawnImpl = originalSpawn as SpawnImpl;
|
|
117
|
-
rmSync(workingDir, { recursive: true, force: true });
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
test("a close with exit 0 and no process start is an error, not command_completed", async () => {
|
|
121
|
-
spawnImpl = () => closeWithoutStart();
|
|
122
|
-
const proof = join(workingDir, "proof.txt");
|
|
123
|
-
|
|
124
|
-
const result = await shellTool.execute(
|
|
125
|
-
{
|
|
126
|
-
command: "printf ran > proof.txt",
|
|
127
|
-
activity: "test",
|
|
128
|
-
},
|
|
129
|
-
makeContext(workingDir),
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
expect(result.isError).toBe(true);
|
|
133
|
-
expect(result.content).toBe(SHELL_DID_NOT_START_MESSAGE);
|
|
134
|
-
expect(result.content).not.toContain("<command_completed />");
|
|
135
|
-
expect(existsSync(proof)).toBe(false);
|
|
136
|
-
expect(spawnCalls).toHaveLength(1);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
test("a failed spawn of the shell is an error", async () => {
|
|
140
|
-
spawnImpl = () => {
|
|
141
|
-
const err = new Error(
|
|
142
|
-
"spawn powershell.exe ENOENT",
|
|
143
|
-
) as NodeJS.ErrnoException;
|
|
144
|
-
err.code = "ENOENT";
|
|
145
|
-
return spawnError(err);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const result = await shellTool.execute(
|
|
149
|
-
{
|
|
150
|
-
command: "assistant browser --help",
|
|
151
|
-
activity: "test",
|
|
152
|
-
},
|
|
153
|
-
makeContext(workingDir),
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
expect(result.isError).toBe(true);
|
|
157
|
-
expect(result.content).toContain("Error spawning command");
|
|
158
|
-
expect(result.content).toContain("The command was not found");
|
|
159
|
-
expect(result.content).not.toContain("<command_completed />");
|
|
160
|
-
expect(existsSync(join(workingDir, "help.txt"))).toBe(false);
|
|
161
|
-
});
|
|
162
|
-
});
|