@vellumai/assistant 0.8.7-dev.202606052135.3e62c5a → 0.8.7-dev.202606052232.2ddc989
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/examples/plugins/echo/README.md +36 -32
- package/examples/plugins/echo/hooks/post-tool-use.ts +18 -0
- package/examples/plugins/echo/hooks/stop.ts +16 -0
- package/examples/plugins/echo/hooks/user-prompt-submit.ts +18 -0
- package/examples/plugins/echo/package.json +1 -2
- package/examples/plugins/echo/src/emit.ts +19 -0
- package/package.json +1 -1
- package/src/__tests__/conversation-runtime-assembly.test.ts +18 -16
- package/src/__tests__/gateway-only-guard.test.ts +12 -2
- package/src/__tests__/plugin-api-shim.test.ts +3 -6
- package/src/__tests__/user-plugin-loader.test.ts +54 -286
- package/src/acp/__tests__/prepare-agent-env.test.ts +137 -0
- package/src/acp/__tests__/session-manager-resume.test.ts +44 -3
- package/src/acp/auto-install.test.ts +75 -4
- package/src/acp/auto-install.ts +8 -5
- package/src/acp/prepare-agent-env.ts +83 -29
- package/src/acp/resolve-agent.test.ts +173 -1
- package/src/acp/resolve-agent.ts +101 -11
- package/src/acp/resume-hint.ts +6 -3
- package/src/acp/session-manager.ts +10 -4
- package/src/acp/types.ts +8 -0
- package/src/config/bundled-skills/acp/SKILL.md +30 -12
- package/src/config/bundled-skills/acp/TOOLS.json +2 -2
- package/src/config/feature-flag-registry.json +2 -1
- package/src/daemon/conversation-agent-loop.ts +0 -4
- package/src/daemon/conversation-runtime-assembly.ts +31 -18
- package/src/daemon/external-plugins-bootstrap.ts +9 -8
- package/src/plugins/external-api.ts +2 -2
- package/src/plugins/types.ts +0 -4
- package/src/plugins/user-loader.ts +30 -127
- package/src/runtime/routes/__tests__/acp-routes.test.ts +30 -0
- package/src/tools/acp/spawn.test.ts +48 -0
- package/src/tools/acp/spawn.ts +18 -5
- package/docs/plugins.md +0 -600
- package/examples/plugins/echo/register.ts +0 -105
|
@@ -14,30 +14,46 @@ one JSON line per hook invocation to `stderr`:
|
|
|
14
14
|
Use this as a starting point for writing your own plugin, or as a quick way
|
|
15
15
|
to eyeball which hooks fire during a conversation.
|
|
16
16
|
|
|
17
|
-
For the full plugin authoring guide,
|
|
18
|
-
|
|
17
|
+
For the full plugin authoring guide — manifest shape, every contribution
|
|
18
|
+
surface, hook patterns, and conventions — see
|
|
19
|
+
[`experimental/plugins/README.md`](../../../../experimental/plugins/README.md).
|
|
20
|
+
[`simple-memory`](../../../../experimental/plugins/simple-memory/) is the
|
|
21
|
+
canonical reference implementation that exercises every wired surface.
|
|
19
22
|
|
|
20
23
|
## What it does
|
|
21
24
|
|
|
22
|
-
-
|
|
25
|
+
- Contributes one observer hook per turn-lifecycle event:
|
|
23
26
|
`user-prompt-submit`, `post-tool-use`, and `stop`.
|
|
24
27
|
- Each hook emits one line to `stderr` and returns `void`, so the threaded
|
|
25
28
|
context flows through unchanged.
|
|
26
29
|
- Never modifies the turn's messages, tool results, or stop decision. It is
|
|
27
30
|
purely observational — safe to stack alongside any other plugin.
|
|
28
31
|
|
|
32
|
+
## Directory layout
|
|
33
|
+
|
|
34
|
+
The assistant discovers a plugin by its `package.json` manifest and builds the
|
|
35
|
+
`Plugin` from the interface directories — `hooks/<name>.ts` files whose default
|
|
36
|
+
export is the hook function. Files under `src/` are internal helpers and are
|
|
37
|
+
not walked by the loader.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
echo/
|
|
41
|
+
├── package.json # Manifest (name + @vellumai/plugin-api range)
|
|
42
|
+
├── README.md
|
|
43
|
+
├── hooks/
|
|
44
|
+
│ ├── user-prompt-submit.ts # default export = hook function
|
|
45
|
+
│ ├── post-tool-use.ts
|
|
46
|
+
│ └── stop.ts
|
|
47
|
+
└── src/
|
|
48
|
+
└── emit.ts # shared stderr emitter (not a surface)
|
|
49
|
+
```
|
|
50
|
+
|
|
29
51
|
## Install locally
|
|
30
52
|
|
|
31
53
|
The assistant scans `<workspaceDir>/plugins/*` (e.g.
|
|
32
|
-
`~/.vellum/workspace/plugins/`) for subdirectories containing a
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
enable it.
|
|
36
|
-
|
|
37
|
-
The plugin reads `registerPlugin` from `globalThis.__vellumPluginRuntime`,
|
|
38
|
-
which the daemon attaches before scanning plugins. This works against both
|
|
39
|
-
the `bun --compile`-bundled daemon binary AND a daemon running from
|
|
40
|
-
source — no special install procedure required either way.
|
|
54
|
+
`~/.vellum/workspace/plugins/`) for subdirectories containing a `package.json`
|
|
55
|
+
and loads each one during assistant startup. Dropping (or symlinking) this
|
|
56
|
+
directory in place is enough to enable it.
|
|
41
57
|
|
|
42
58
|
### Option 1 — symlink from the repo (simplest in-repo dev)
|
|
43
59
|
|
|
@@ -54,23 +70,10 @@ pick up changes.
|
|
|
54
70
|
### Option 2 — standalone copy
|
|
55
71
|
|
|
56
72
|
A plain `cp -R` of this directory into `~/.vellum/workspace/plugins/echo/`
|
|
57
|
-
works
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
at an absolute path inside any checkout — they're erased at compile time
|
|
62
|
-
and have no module-identity effect at runtime:
|
|
63
|
-
|
|
64
|
-
```ts
|
|
65
|
-
// before (repo-local):
|
|
66
|
-
import type { VellumPluginRuntime } from "../../../src/plugins/external-api.js";
|
|
67
|
-
import type { Plugin } from "../../../src/plugins/types.js";
|
|
68
|
-
// after (standalone, edit to your checkout path):
|
|
69
|
-
import type { VellumPluginRuntime } from "/path/to/vellum-assistant/assistant/src/plugins/external-api.js";
|
|
70
|
-
import type { Plugin } from "/path/to/vellum-assistant/assistant/src/plugins/types.js";
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
No runtime-import rewriting is needed — the bridge already handles that.
|
|
73
|
+
works as-is. The hooks import their types from the public `@vellumai/plugin-api`
|
|
74
|
+
specifier, which the daemon materializes as a workspace-level shim before it
|
|
75
|
+
loads any plugin — so the copied directory resolves it without any path
|
|
76
|
+
rewriting, in or out of a vellum-assistant checkout.
|
|
74
77
|
|
|
75
78
|
### Restart the assistant
|
|
76
79
|
|
|
@@ -112,9 +115,10 @@ vellum restart
|
|
|
112
115
|
|
|
113
116
|
## Next steps
|
|
114
117
|
|
|
115
|
-
- Read [`
|
|
116
|
-
plugin authoring guide: manifest shape,
|
|
117
|
-
(observe / transform),
|
|
118
|
+
- Read [`experimental/plugins/README.md`](../../../../experimental/plugins/README.md)
|
|
119
|
+
for the full plugin authoring guide: manifest shape, every contribution
|
|
120
|
+
surface, hook patterns (observe / transform), tool contributions, and
|
|
121
|
+
conventions.
|
|
118
122
|
- Look at the first-party default plugins under
|
|
119
123
|
`assistant/src/plugins/defaults/` for examples of hooks that transform a
|
|
120
124
|
turn rather than just observing it.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `post-tool-use` hook for the echo plugin.
|
|
3
|
+
*
|
|
4
|
+
* Purely observational — logs one structured line to stderr and returns
|
|
5
|
+
* `void`, leaving the tool result untouched.
|
|
6
|
+
*
|
|
7
|
+
* Convention: the default export is the function the harness invokes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { PostToolUseContext } from "@vellumai/plugin-api";
|
|
11
|
+
|
|
12
|
+
import { emit } from "../src/emit.js";
|
|
13
|
+
|
|
14
|
+
export default async function postToolUse(
|
|
15
|
+
ctx: PostToolUseContext,
|
|
16
|
+
): Promise<void> {
|
|
17
|
+
emit("post-tool-use", ctx.conversationId);
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `stop` hook for the echo plugin.
|
|
3
|
+
*
|
|
4
|
+
* Purely observational — logs one structured line to stderr and returns
|
|
5
|
+
* `void`, leaving the stop decision untouched.
|
|
6
|
+
*
|
|
7
|
+
* Convention: the default export is the function the harness invokes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { StopContext } from "@vellumai/plugin-api";
|
|
11
|
+
|
|
12
|
+
import { emit } from "../src/emit.js";
|
|
13
|
+
|
|
14
|
+
export default async function stop(ctx: StopContext): Promise<void> {
|
|
15
|
+
emit("stop", ctx.conversationId);
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `user-prompt-submit` hook for the echo plugin.
|
|
3
|
+
*
|
|
4
|
+
* Purely observational — logs one structured line to stderr and returns
|
|
5
|
+
* `void`, leaving the threaded context (message list, injections) untouched.
|
|
6
|
+
*
|
|
7
|
+
* Convention: the default export is the function the harness invokes.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { UserPromptSubmitContext } from "@vellumai/plugin-api";
|
|
11
|
+
|
|
12
|
+
import { emit } from "../src/emit.js";
|
|
13
|
+
|
|
14
|
+
export default async function userPromptSubmit(
|
|
15
|
+
ctx: UserPromptSubmitContext,
|
|
16
|
+
): Promise<void> {
|
|
17
|
+
emit("user-prompt-submit", ctx.conversationId);
|
|
18
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vellumai/plugin-echo-example",
|
|
3
3
|
"version": "0.1.0",
|
|
4
|
-
"description": "Example plugin that observes every assistant
|
|
4
|
+
"description": "Example plugin that observes every assistant turn-lifecycle hook and logs one structured line per invocation to stderr. Meant as an authoring reference — not shipped with the assistant runtime.",
|
|
5
5
|
"private": true,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main": "./register.ts",
|
|
9
8
|
"engines": {
|
|
10
9
|
"node": ">=20.12.0"
|
|
11
10
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared stderr emitter for the echo plugin's hooks.
|
|
3
|
+
*
|
|
4
|
+
* Files under `src/` are internal helpers — the external-plugin loader does
|
|
5
|
+
* not walk this directory, so it contributes no surface of its own. The
|
|
6
|
+
* `hooks/` files import from here.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const PLUGIN_NAME = "echo";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* One line written to stderr per hook invocation. Kept intentionally compact —
|
|
13
|
+
* pino-style JSON so operators can pipe the assistant's stderr through `jq`
|
|
14
|
+
* without reshaping.
|
|
15
|
+
*/
|
|
16
|
+
export function emit(hook: string, conversationId: string): void {
|
|
17
|
+
const record = { plugin: PLUGIN_NAME, hook, conversationId };
|
|
18
|
+
process.stderr.write(`${JSON.stringify(record)}\n`);
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -151,6 +151,7 @@ function clearWorkspaceContext(): void {
|
|
|
151
151
|
// between tests keeps suites asserting absence unaffected.
|
|
152
152
|
function seedChannelCapabilitiesConversation(
|
|
153
153
|
caps: ChannelCapabilities | null,
|
|
154
|
+
transportHints?: string[],
|
|
154
155
|
): void {
|
|
155
156
|
setConversation("runtime-assembly-fallback", {
|
|
156
157
|
conversationId: "runtime-assembly-fallback",
|
|
@@ -159,6 +160,7 @@ function seedChannelCapabilitiesConversation(
|
|
|
159
160
|
workspaceTopLevelDirty: false,
|
|
160
161
|
surfaceState: new Map(),
|
|
161
162
|
channelCapabilities: caps ?? undefined,
|
|
163
|
+
transportHints,
|
|
162
164
|
} as never);
|
|
163
165
|
}
|
|
164
166
|
|
|
@@ -3046,12 +3048,13 @@ describe("Slack channel chronological rendering — multi-thread", () => {
|
|
|
3046
3048
|
{ loader: () => rows, trustClass: "guardian" },
|
|
3047
3049
|
);
|
|
3048
3050
|
|
|
3049
|
-
seedChannelCapabilitiesConversation(slackChannelCaps
|
|
3051
|
+
seedChannelCapabilitiesConversation(slackChannelCaps, [
|
|
3052
|
+
"thread context: ...",
|
|
3053
|
+
]);
|
|
3050
3054
|
const { messages: result } = await applyRuntimeInjections(
|
|
3051
3055
|
[{ role: "user", content: [{ type: "text", text: "current turn" }] }],
|
|
3052
3056
|
{
|
|
3053
3057
|
slackChronologicalMessages,
|
|
3054
|
-
transportHints: ["thread context: ..."],
|
|
3055
3058
|
},
|
|
3056
3059
|
);
|
|
3057
3060
|
|
|
@@ -3076,12 +3079,10 @@ describe("Slack channel chronological rendering — multi-thread", () => {
|
|
|
3076
3079
|
chatType: "im",
|
|
3077
3080
|
};
|
|
3078
3081
|
|
|
3079
|
-
seedChannelCapabilitiesConversation(slackDmCaps);
|
|
3082
|
+
seedChannelCapabilitiesConversation(slackDmCaps, ["dm context: ..."]);
|
|
3080
3083
|
const { messages: result } = await applyRuntimeInjections(
|
|
3081
3084
|
[{ role: "user", content: [{ type: "text", text: "hi DM" }] }],
|
|
3082
|
-
{
|
|
3083
|
-
transportHints: ["dm context: ..."],
|
|
3084
|
-
},
|
|
3085
|
+
{},
|
|
3085
3086
|
);
|
|
3086
3087
|
|
|
3087
3088
|
const allText = result
|
|
@@ -3095,18 +3096,19 @@ describe("Slack channel chronological rendering — multi-thread", () => {
|
|
|
3095
3096
|
|
|
3096
3097
|
// ── transport_hints kept for non-slack channels ───────────────────────
|
|
3097
3098
|
test("non-slack conversations still receive <transport_hints>", async () => {
|
|
3098
|
-
seedChannelCapabilitiesConversation(
|
|
3099
|
-
channel: "telegram",
|
|
3100
|
-
dashboardCapable: false,
|
|
3101
|
-
supportsDynamicUi: false,
|
|
3102
|
-
supportsVoiceInput: false,
|
|
3103
|
-
chatType: "private",
|
|
3104
|
-
});
|
|
3105
|
-
const { messages: result } = await applyRuntimeInjections(
|
|
3106
|
-
[{ role: "user", content: [{ type: "text", text: "hi" }] }],
|
|
3099
|
+
seedChannelCapabilitiesConversation(
|
|
3107
3100
|
{
|
|
3108
|
-
|
|
3101
|
+
channel: "telegram",
|
|
3102
|
+
dashboardCapable: false,
|
|
3103
|
+
supportsDynamicUi: false,
|
|
3104
|
+
supportsVoiceInput: false,
|
|
3105
|
+
chatType: "private",
|
|
3109
3106
|
},
|
|
3107
|
+
["please answer concisely"],
|
|
3108
|
+
);
|
|
3109
|
+
const { messages: result } = await applyRuntimeInjections(
|
|
3110
|
+
[{ role: "user", content: [{ type: "text", text: "hi" }] }],
|
|
3111
|
+
{},
|
|
3110
3112
|
);
|
|
3111
3113
|
const allText = result
|
|
3112
3114
|
.flatMap((m) => m.content)
|
|
@@ -27,6 +27,7 @@ const ALLOWLIST = new Set([
|
|
|
27
27
|
"clients/shared/App/Auth/PlatformOAuthService.swift", // comment explaining runtimeUrl vs platformUrl
|
|
28
28
|
"clients/macos/vellum-assistant/App/AppDelegate.swift",
|
|
29
29
|
"clients/macos/vellum-assistant/Features/Settings/SettingsConnectTab.swift",
|
|
30
|
+
"apps/macos/src/main/bundle-flow.ts", // Electron main calls the local gateway (gatewayPort) with a Guardian token to scan bundles
|
|
30
31
|
".claude/skills/update/SKILL.md", // daemon health check script
|
|
31
32
|
|
|
32
33
|
// --- Test fixtures that poll the daemon directly (gateway may require auth) ---
|
|
@@ -84,12 +85,21 @@ function isGatewayInternal(filePath: string): boolean {
|
|
|
84
85
|
return filePath.startsWith("gateway/");
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
/** Additional files allowed for the interpolated-port check only (use gateway port, not runtime). */
|
|
89
|
+
const INTERPOLATED_PORT_ALLOWLIST = new Set([
|
|
90
|
+
"apps/macos/src/main/bundle-flow.ts",
|
|
91
|
+
]);
|
|
92
|
+
|
|
87
93
|
/** Shared violation filter: exempt test files, gateway internals, and allowlisted paths. */
|
|
88
|
-
function filterViolations(
|
|
94
|
+
function filterViolations(
|
|
95
|
+
files: string[],
|
|
96
|
+
extraAllowlist?: Set<string>,
|
|
97
|
+
): string[] {
|
|
89
98
|
return files.filter((f) => {
|
|
90
99
|
if (isTestFile(f)) return false;
|
|
91
100
|
if (isGatewayInternal(f)) return false;
|
|
92
101
|
if (ALLOWLIST.has(f)) return false;
|
|
102
|
+
if (extraAllowlist?.has(f)) return false;
|
|
93
103
|
return true;
|
|
94
104
|
});
|
|
95
105
|
}
|
|
@@ -181,7 +191,7 @@ describe("gateway-only API consumption guard", () => {
|
|
|
181
191
|
}
|
|
182
192
|
|
|
183
193
|
const files = grepOutput.split("\n").filter((f) => f.length > 0);
|
|
184
|
-
const violations = filterViolations(files);
|
|
194
|
+
const violations = filterViolations(files, INTERPOLATED_PORT_ALLOWLIST);
|
|
185
195
|
|
|
186
196
|
if (violations.length > 0) {
|
|
187
197
|
const message = [
|
|
@@ -44,10 +44,7 @@ describe("buildShimSource", () => {
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
test("handles an empty export list (today's types-only surface)", () => {
|
|
47
|
-
const source = buildShimSource(
|
|
48
|
-
[],
|
|
49
|
-
Symbol.for("vellum.plugin-api.v1"),
|
|
50
|
-
);
|
|
47
|
+
const source = buildShimSource([], Symbol.for("vellum.plugin-api.v1"));
|
|
51
48
|
expect(source).toBe(
|
|
52
49
|
`const api = globalThis[Symbol.for("vellum.plugin-api.v1")];\n`,
|
|
53
50
|
);
|
|
@@ -109,7 +106,7 @@ describe("ensurePluginApiShim", () => {
|
|
|
109
106
|
const pluginDir = join(workspaceDir, "plugins", "fake-plugin");
|
|
110
107
|
await mkdir(pluginDir, { recursive: true });
|
|
111
108
|
await writeFile(
|
|
112
|
-
join(pluginDir, "
|
|
109
|
+
join(pluginDir, "probe.js"),
|
|
113
110
|
`import * as api from "@vellumai/plugin-api";\nexport { api };\n`,
|
|
114
111
|
);
|
|
115
112
|
|
|
@@ -118,7 +115,7 @@ describe("ensurePluginApiShim", () => {
|
|
|
118
115
|
// → plugin-api namespace. If any link in that chain is broken, this
|
|
119
116
|
// import throws.
|
|
120
117
|
const mod: { api: Record<string, unknown> } = await import(
|
|
121
|
-
join(pluginDir, "
|
|
118
|
+
join(pluginDir, "probe.js")
|
|
122
119
|
);
|
|
123
120
|
expect(mod.api).toBeDefined();
|
|
124
121
|
});
|