@vellumai/assistant 0.8.9 → 0.8.10-dev.202606092334.09948c8
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/AGENTS.md +1 -1
- package/examples/plugins/echo/README.md +3 -3
- package/node_modules/@vellumai/skill-host-contracts/src/tool-types.ts +2 -0
- package/openapi.yaml +38 -12
- package/package.json +1 -1
- package/scripts/sync-llm-catalog.ts +2 -0
- package/src/__tests__/agent-loop-exit-reason.test.ts +21 -15
- package/src/__tests__/approval-cascade.test.ts +1 -0
- package/src/__tests__/build-persisted-content.test.ts +75 -1
- package/src/__tests__/compaction-events.test.ts +1 -0
- package/src/__tests__/config-managed-gemini-defaults.test.ts +2 -46
- package/src/__tests__/context-overflow-reducer.test.ts +264 -124
- package/src/__tests__/context-window-manager-overflow-rung.test.ts +351 -0
- package/src/__tests__/conversation-abort-tool-results.test.ts +1 -0
- package/src/__tests__/conversation-agent-loop-inference-profile.test.ts +11 -0
- package/src/__tests__/conversation-agent-loop-overflow.test.ts +90 -49
- package/src/__tests__/conversation-agent-loop.test.ts +113 -64
- package/src/__tests__/conversation-confirmation-signals.test.ts +1 -0
- package/src/__tests__/conversation-fork-crud.test.ts +110 -0
- package/src/__tests__/conversation-process-callsite.test.ts +1 -0
- package/src/__tests__/conversation-provider-retry-repair.test.ts +48 -48
- package/src/__tests__/conversation-queue.test.ts +1 -0
- package/src/__tests__/conversation-runtime-assembly.test.ts +119 -8
- package/src/__tests__/conversation-slash-queue.test.ts +1 -0
- package/src/__tests__/conversation-slash-unknown.test.ts +1 -0
- package/src/__tests__/conversation-speed-override.test.ts +1 -0
- package/src/__tests__/conversation-surfaces-app-control.test.ts +4 -1
- package/src/__tests__/conversation-tool-setup-app-refresh.test.ts +91 -142
- package/src/__tests__/conversation-tool-setup-skill-attribution.test.ts +116 -0
- package/src/__tests__/conversation-tool-setup-test-helpers.ts +98 -0
- package/src/__tests__/conversation-workspace-cache-state.test.ts +1 -0
- package/src/__tests__/conversation-workspace-injection.test.ts +1 -0
- package/src/__tests__/conversation-workspace-tool-tracking.test.ts +1 -0
- package/src/__tests__/corrected-target.test.ts +93 -0
- package/src/__tests__/credential-execution-feature-gates.test.ts +3 -5
- package/src/__tests__/credential-security-invariants.test.ts +1 -0
- package/src/__tests__/embedding-managed-proxy-selection.test.ts +6 -40
- package/src/__tests__/external-plugin-loader.test.ts +0 -1
- package/src/__tests__/guardian-routing-invariants.test.ts +91 -0
- package/src/__tests__/history-repair-hook.test.ts +2 -0
- package/src/__tests__/host-app-control-proxy.test.ts +45 -0
- package/src/__tests__/llm-catalog-parity.test.ts +4 -0
- package/src/__tests__/memory-retrieval-hook.test.ts +29 -15
- package/src/__tests__/notification-decision-strategy.test.ts +3 -3
- package/src/__tests__/persistence-secret-redaction.test.ts +78 -0
- package/src/__tests__/plugin-bootstrap.test.ts +82 -73
- package/src/__tests__/plugin-tool-contribution.test.ts +7 -4
- package/src/__tests__/plugin-types.test.ts +0 -8
- package/src/__tests__/provider-catalog-visibility.test.ts +1 -9
- package/src/__tests__/retry-thinking-adaptive-only.test.ts +245 -0
- package/src/__tests__/server-history-render.test.ts +39 -0
- package/src/__tests__/skills.test.ts +123 -0
- package/src/__tests__/title-generate-hook.test.ts +2 -0
- package/src/__tests__/tool-audit-listener.test.ts +51 -0
- package/src/__tests__/tool-executor-lifecycle-events.test.ts +32 -0
- package/src/__tests__/tool-start-timestamp.test.ts +218 -0
- package/src/agent/loop.ts +26 -39
- package/src/api/events/tool-result.ts +9 -0
- package/src/api/events/tool-use-start.ts +7 -0
- package/src/api/responses/conversation-message.ts +91 -14
- package/src/approvals/guardian-request-resolvers.ts +26 -0
- package/src/cli/commands/channel-verification-sessions.ts +6 -6
- package/src/cli/commands/inference-providers.ts +0 -8
- package/src/cli/commands/plugins.ts +2 -2
- package/src/cli/lib/__tests__/install-from-github.test.ts +174 -18
- package/src/cli/lib/__tests__/plugin-catalog-cache.test.ts +1 -1
- package/src/cli/lib/__tests__/plugin-details.test.ts +1 -1
- package/src/cli/lib/__tests__/plugin-marketplace.test.ts +1 -1
- package/src/cli/lib/__tests__/search-plugins.test.ts +11 -11
- package/src/cli/lib/install-from-github.ts +130 -19
- package/src/cli/lib/plugin-catalog-cache.ts +1 -1
- package/src/cli/lib/plugin-details.ts +4 -4
- package/src/cli/lib/plugin-marketplace.ts +2 -2
- package/src/cli/lib/search-plugins.ts +6 -6
- package/src/config/bundled-skills/skill-management/SKILL.md +89 -1
- package/src/config/env-registry.ts +12 -0
- package/src/config/feature-flag-registry.json +0 -80
- package/src/config/loader.ts +5 -22
- package/src/config/seed-inference-profiles.ts +1 -1
- package/src/config/skills.ts +101 -47
- package/src/context/strip-injections.ts +7 -4
- package/src/daemon/conversation-agent-loop-handlers.ts +102 -6
- package/src/daemon/conversation-agent-loop.ts +126 -270
- package/src/daemon/conversation-runtime-assembly.ts +44 -8
- package/src/daemon/conversation-tool-setup.ts +9 -1
- package/src/daemon/conversation.ts +13 -0
- package/src/daemon/external-plugins-bootstrap.ts +33 -87
- package/src/daemon/handlers/config-channels.ts +11 -2
- package/src/daemon/handlers/shared.ts +9 -1
- package/src/daemon/handlers/skills.ts +6 -2
- package/src/daemon/host-app-control-proxy.ts +72 -57
- package/src/daemon/message-protocol.ts +0 -7
- package/src/daemon/message-types/skills.ts +4 -0
- package/src/events/tool-audit-listener.ts +7 -1
- package/src/memory/__tests__/tool-invocation-test-helpers.ts +69 -0
- package/src/memory/conversation-crud.ts +44 -1
- package/src/memory/db-init.ts +4 -0
- package/src/memory/embedding-backend.ts +5 -22
- package/src/memory/memory-retrospective-startup-cleanup.ts +1 -1
- package/src/memory/migrations/275-tool-invocations-add-skill-id.test.ts +81 -0
- package/src/memory/migrations/275-tool-invocations-add-skill-id.ts +20 -0
- package/src/memory/migrations/276-tool-invocations-created-at-id-index.test.ts +68 -0
- package/src/memory/migrations/276-tool-invocations-created-at-id-index.ts +20 -0
- package/src/memory/migrations/index.ts +2 -0
- package/src/memory/schema/conversations.ts +3 -0
- package/src/memory/tool-execution-events-store.test.ts +162 -0
- package/src/memory/tool-execution-events-store.ts +73 -0
- package/src/memory/tool-usage-store.ts +4 -3
- package/src/memory/v2/__tests__/injected-block-slugs.test.ts +51 -0
- package/src/memory/v2/activation-store.ts +50 -1
- package/src/memory/v2/injected-block-slugs.ts +30 -0
- package/src/notifications/__tests__/copy-composer.test.ts +244 -0
- package/src/notifications/access-request-copy.ts +298 -0
- package/src/notifications/adapters/slack.ts +3 -3
- package/src/notifications/adapters/telegram.ts +2 -1
- package/src/notifications/copy-composer.ts +49 -267
- package/src/notifications/decision-engine.ts +16 -35
- package/src/notifications/home-feed-side-effect.ts +1 -6
- package/src/platform/client.ts +1 -3
- package/src/platform/feature-gate.ts +3 -12
- package/src/plugin-api/constants.ts +2 -0
- package/src/plugin-api/index.ts +37 -6
- package/src/plugin-api/types.ts +75 -0
- package/src/plugins/defaults/compaction/compact.ts +39 -1
- package/src/plugins/defaults/compaction/context-overflow-reducer.ts +240 -32
- package/src/plugins/defaults/compaction/corrected-target.ts +53 -0
- package/src/plugins/defaults/compaction/window-manager.ts +195 -1
- package/src/plugins/defaults/index.ts +24 -0
- package/src/plugins/defaults/memory-retrieval/hooks/post-compact.ts +76 -112
- package/src/plugins/defaults/memory-retrieval/hooks/{user-prompt-submit-temp.ts → user-prompt-submit.ts} +36 -67
- package/src/plugins/defaults/memory-retrieval/package.json +14 -0
- package/src/plugins/external-api.ts +1 -1
- package/src/plugins/types.ts +5 -51
- package/src/providers/inference/__tests__/base-url-route-validation.test.ts +1 -2
- package/src/providers/model-catalog.ts +57 -1
- package/src/providers/registry.ts +0 -8
- package/src/providers/retry.ts +35 -7
- package/src/runtime/routes/__tests__/acp-routes.test.ts +151 -0
- package/src/runtime/routes/__tests__/inference-provider-connection-routes.test.ts +0 -62
- package/src/runtime/routes/__tests__/plugins-routes.test.ts +4 -4
- package/src/runtime/routes/acp-routes.test.ts +106 -0
- package/src/runtime/routes/acp-routes.ts +248 -2
- package/src/runtime/routes/browser-tabs-routes.ts +1 -1
- package/src/runtime/routes/channel-verification-routes.ts +14 -5
- package/src/runtime/routes/chatgpt-subscription-auth-routes.ts +0 -14
- package/src/runtime/routes/inbound-stages/acl-enforcement.ts +33 -34
- package/src/runtime/routes/inference-provider-connection-routes.ts +0 -45
- package/src/runtime/routes/plugins-routes.ts +3 -3
- package/src/runtime/verification-outbound-actions.ts +147 -2
- package/src/runtime/verification-templates.ts +29 -3
- package/src/telemetry/types.ts +25 -1
- package/src/telemetry/usage-telemetry-reporter.test.ts +141 -7
- package/src/telemetry/usage-telemetry-reporter.ts +63 -7
- package/src/tools/executor.ts +4 -1
- package/src/tools/skills/load.ts +11 -6
- package/src/tools/terminal/safe-env.ts +1 -0
- package/src/tools/types.ts +10 -0
- package/src/__tests__/plugin-skill-contribution.test.ts +0 -355
- package/src/daemon/message-types/browser.ts +0 -10
- package/src/notifications/__tests__/emit-signal-home-feed.test.ts +0 -187
- package/src/plugins/plugin-skill-contributions.ts +0 -292
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verifies that `RetryProvider.normalizeSendMessageOptions` drops a disabled
|
|
3
|
+
* thinking config for adaptive-thinking-only models (Claude Fable), preventing
|
|
4
|
+
* an Anthropic 400: Fable always reasons with always-on adaptive thinking and
|
|
5
|
+
* rejects `thinking: { type: "disabled" }`.
|
|
6
|
+
*
|
|
7
|
+
* Effort and other parameters are unaffected, and models that genuinely support
|
|
8
|
+
* disabling thinking (e.g. Opus) keep their disabled config.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { beforeEach, describe, expect, mock, test } from "bun:test";
|
|
12
|
+
|
|
13
|
+
mock.module("../util/logger.js", () => ({
|
|
14
|
+
getLogger: () =>
|
|
15
|
+
new Proxy({} as Record<string, unknown>, { get: () => () => {} }),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
let mockLlmConfig: Record<string, unknown> = {};
|
|
19
|
+
|
|
20
|
+
mock.module("../config/loader.js", () => ({
|
|
21
|
+
getConfig: () => ({ llm: mockLlmConfig }),
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
import { LLMSchema } from "../config/schemas/llm.js";
|
|
25
|
+
import { RetryProvider } from "../providers/retry.js";
|
|
26
|
+
import type {
|
|
27
|
+
Message,
|
|
28
|
+
Provider,
|
|
29
|
+
ProviderResponse,
|
|
30
|
+
SendMessageOptions,
|
|
31
|
+
} from "../providers/types.js";
|
|
32
|
+
|
|
33
|
+
function setLlmConfig(raw: unknown): void {
|
|
34
|
+
mockLlmConfig = LLMSchema.parse(raw) as Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
mockLlmConfig = LLMSchema.parse({}) as Record<string, unknown>;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function makePipeline(providerName: string): {
|
|
42
|
+
provider: Provider;
|
|
43
|
+
lastConfig: () => Record<string, unknown> | undefined;
|
|
44
|
+
} {
|
|
45
|
+
let captured: Record<string, unknown> | undefined;
|
|
46
|
+
const inner: Provider = {
|
|
47
|
+
name: providerName,
|
|
48
|
+
async sendMessage(
|
|
49
|
+
_messages: Message[],
|
|
50
|
+
options?: SendMessageOptions,
|
|
51
|
+
): Promise<ProviderResponse> {
|
|
52
|
+
captured = options?.config as Record<string, unknown> | undefined;
|
|
53
|
+
return {
|
|
54
|
+
content: [],
|
|
55
|
+
model: "test",
|
|
56
|
+
usage: { inputTokens: 0, outputTokens: 0 },
|
|
57
|
+
stopReason: "stop",
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
provider: new RetryProvider(inner),
|
|
63
|
+
lastConfig: () => captured,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const userMessage: Message = {
|
|
68
|
+
role: "user",
|
|
69
|
+
content: [{ type: "text", text: "hi" }],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
describe("retry normalization: adaptive-only thinking models", () => {
|
|
73
|
+
test("drops resolved thinking: disabled for Claude Fable", async () => {
|
|
74
|
+
// GIVEN a profile that disables thinking for an adaptive-only Fable model
|
|
75
|
+
setLlmConfig({
|
|
76
|
+
default: {
|
|
77
|
+
provider: "anthropic",
|
|
78
|
+
model: "claude-fable-5",
|
|
79
|
+
thinking: { enabled: false },
|
|
80
|
+
effort: "high",
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
const { provider, lastConfig } = makePipeline("anthropic");
|
|
84
|
+
|
|
85
|
+
// WHEN a request resolves through the call-site config
|
|
86
|
+
await provider.sendMessage([userMessage], {
|
|
87
|
+
config: { callSite: "memoryExtraction" },
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// THEN the disabled thinking config is dropped so Fable falls back to its
|
|
91
|
+
// always-on adaptive thinking instead of 400-ing
|
|
92
|
+
expect(lastConfig()?.thinking).toBeUndefined();
|
|
93
|
+
// AND effort is still forwarded
|
|
94
|
+
expect(lastConfig()?.effort).toBe("high");
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("drops explicit thinking: disabled from pass-through callers for Fable", async () => {
|
|
98
|
+
// GIVEN a pass-through caller supplying the wire-shape disabled config
|
|
99
|
+
const { provider, lastConfig } = makePipeline("anthropic");
|
|
100
|
+
|
|
101
|
+
// WHEN sending against a Fable model
|
|
102
|
+
await provider.sendMessage([userMessage], {
|
|
103
|
+
config: {
|
|
104
|
+
model: "claude-fable-5",
|
|
105
|
+
thinking: { type: "disabled" },
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// THEN the disabled thinking config is dropped
|
|
110
|
+
expect(lastConfig()?.thinking).toBeUndefined();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test("drops disabled thinking for OpenRouter-proxied Fable", async () => {
|
|
114
|
+
// GIVEN a profile disabling thinking on the OpenRouter-proxied Fable id
|
|
115
|
+
setLlmConfig({
|
|
116
|
+
default: {
|
|
117
|
+
provider: "openrouter",
|
|
118
|
+
model: "anthropic/claude-fable-5",
|
|
119
|
+
thinking: { enabled: false },
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
const { provider, lastConfig } = makePipeline("openrouter");
|
|
123
|
+
|
|
124
|
+
// WHEN a request resolves through the call-site config
|
|
125
|
+
await provider.sendMessage([userMessage], {
|
|
126
|
+
config: { callSite: "memoryExtraction" },
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// THEN the disabled thinking config is dropped
|
|
130
|
+
expect(lastConfig()?.thinking).toBeUndefined();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("preserves adaptive thinking for Fable", async () => {
|
|
134
|
+
// GIVEN a profile that enables thinking for a Fable model
|
|
135
|
+
setLlmConfig({
|
|
136
|
+
default: {
|
|
137
|
+
provider: "anthropic",
|
|
138
|
+
model: "claude-fable-5",
|
|
139
|
+
thinking: { enabled: true },
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
const { provider, lastConfig } = makePipeline("anthropic");
|
|
143
|
+
|
|
144
|
+
// WHEN a request resolves through the call-site config
|
|
145
|
+
await provider.sendMessage([userMessage], {
|
|
146
|
+
config: { callSite: "memoryExtraction" },
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// THEN adaptive thinking is preserved (only disabled is dropped)
|
|
150
|
+
expect(lastConfig()?.thinking).toEqual({ type: "adaptive" });
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test("preserves disabled thinking for models that support disabling it", async () => {
|
|
154
|
+
// GIVEN a profile disabling thinking for a non-adaptive-only model
|
|
155
|
+
setLlmConfig({
|
|
156
|
+
default: {
|
|
157
|
+
provider: "anthropic",
|
|
158
|
+
model: "claude-opus-4-7",
|
|
159
|
+
thinking: { enabled: false },
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
const { provider, lastConfig } = makePipeline("anthropic");
|
|
163
|
+
|
|
164
|
+
// WHEN a request resolves through the call-site config
|
|
165
|
+
await provider.sendMessage([userMessage], {
|
|
166
|
+
config: { callSite: "memoryExtraction" },
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// THEN the disabled thinking config is preserved for Opus
|
|
170
|
+
expect(lastConfig()?.thinking).toEqual({ type: "disabled" });
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test("drops non-1 temperature for Fable when thinking is disabled", async () => {
|
|
174
|
+
// GIVEN a Fable profile that disables thinking and sets a non-1 temperature
|
|
175
|
+
setLlmConfig({
|
|
176
|
+
default: {
|
|
177
|
+
provider: "anthropic",
|
|
178
|
+
model: "claude-fable-5",
|
|
179
|
+
thinking: { enabled: false },
|
|
180
|
+
temperature: 0.7,
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
const { provider, lastConfig } = makePipeline("anthropic");
|
|
184
|
+
|
|
185
|
+
// WHEN a request resolves through the call-site config
|
|
186
|
+
await provider.sendMessage([userMessage], {
|
|
187
|
+
config: { callSite: "memoryExtraction" },
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// THEN the disabled thinking is dropped (Fable falls back to adaptive) AND
|
|
191
|
+
// the non-1 temperature is dropped, since adaptive mode requires
|
|
192
|
+
// temperature: 1 — leaving it would 400 the request
|
|
193
|
+
expect(lastConfig()?.thinking).toBeUndefined();
|
|
194
|
+
expect(lastConfig()?.temperature).toBeUndefined();
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
test("drops non-1 temperature for Fable with no explicit thinking config", async () => {
|
|
198
|
+
// GIVEN a pass-through caller that sets a non-1 temperature and no thinking
|
|
199
|
+
const { provider, lastConfig } = makePipeline("anthropic");
|
|
200
|
+
|
|
201
|
+
// WHEN sending against a Fable model
|
|
202
|
+
await provider.sendMessage([userMessage], {
|
|
203
|
+
config: {
|
|
204
|
+
model: "claude-fable-5",
|
|
205
|
+
temperature: 0.5,
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// THEN the temperature is dropped: Fable is always in adaptive mode, so the
|
|
210
|
+
// temperature: 1 constraint applies even without an explicit thinking config
|
|
211
|
+
expect(lastConfig()?.temperature).toBeUndefined();
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test("drops non-1 temperature for OpenRouter-proxied Fable", async () => {
|
|
215
|
+
// GIVEN a pass-through caller on the OpenRouter-proxied Fable id
|
|
216
|
+
const { provider, lastConfig } = makePipeline("openrouter");
|
|
217
|
+
|
|
218
|
+
// WHEN sending with a non-1 temperature and no explicit thinking config
|
|
219
|
+
await provider.sendMessage([userMessage], {
|
|
220
|
+
config: {
|
|
221
|
+
model: "anthropic/claude-fable-5",
|
|
222
|
+
temperature: 0.2,
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// THEN the temperature is dropped for the Anthropic-fronted Fable model
|
|
227
|
+
expect(lastConfig()?.temperature).toBeUndefined();
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test("preserves temperature: 1 for Fable", async () => {
|
|
231
|
+
// GIVEN a Fable profile with the only adaptive-mode-valid temperature
|
|
232
|
+
const { provider, lastConfig } = makePipeline("anthropic");
|
|
233
|
+
|
|
234
|
+
// WHEN sending against a Fable model
|
|
235
|
+
await provider.sendMessage([userMessage], {
|
|
236
|
+
config: {
|
|
237
|
+
model: "claude-fable-5",
|
|
238
|
+
temperature: 1,
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// THEN temperature: 1 is preserved (it is valid in adaptive mode)
|
|
243
|
+
expect(lastConfig()?.temperature).toBe(1);
|
|
244
|
+
});
|
|
245
|
+
});
|
|
@@ -808,6 +808,45 @@ describe("renderHistoryContent contentBlocks", () => {
|
|
|
808
808
|
);
|
|
809
809
|
});
|
|
810
810
|
|
|
811
|
+
test("surfaces persisted thinking timing onto the thinking block", () => {
|
|
812
|
+
// GIVEN a thinking block the daemon stamped with internal `_startedAt` /
|
|
813
|
+
// `_completedAt` timing at message_complete
|
|
814
|
+
const output = renderHistoryContent([
|
|
815
|
+
{
|
|
816
|
+
type: "thinking",
|
|
817
|
+
thinking: "reasoning",
|
|
818
|
+
signature: "sig",
|
|
819
|
+
_startedAt: 1000,
|
|
820
|
+
_completedAt: 1500,
|
|
821
|
+
},
|
|
822
|
+
]);
|
|
823
|
+
|
|
824
|
+
// THEN the rendered block exposes them as the wire schema's
|
|
825
|
+
// startedAt/completedAt so the client can show the duration + hover state
|
|
826
|
+
expect(output.contentBlocks).toEqual([
|
|
827
|
+
{
|
|
828
|
+
type: "thinking",
|
|
829
|
+
thinking: "reasoning",
|
|
830
|
+
startedAt: 1000,
|
|
831
|
+
completedAt: 1500,
|
|
832
|
+
},
|
|
833
|
+
]);
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
test("omits thinking timing when the block carries none", () => {
|
|
837
|
+
// GIVEN a thinking block with no persisted timing (older daemon / thinking
|
|
838
|
+
// streaming disabled)
|
|
839
|
+
const output = renderHistoryContent([
|
|
840
|
+
{ type: "thinking", thinking: "reasoning", signature: "sig" },
|
|
841
|
+
]);
|
|
842
|
+
|
|
843
|
+
// THEN the rendered block has no startedAt/completedAt and the client hides
|
|
844
|
+
// the duration, exactly as a tool call with no timing
|
|
845
|
+
expect(output.contentBlocks).toEqual([
|
|
846
|
+
{ type: "thinking", thinking: "reasoning" },
|
|
847
|
+
]);
|
|
848
|
+
});
|
|
849
|
+
|
|
811
850
|
const pdfBlock = {
|
|
812
851
|
type: "file",
|
|
813
852
|
source: {
|
|
@@ -252,6 +252,129 @@ describe("workspace skills", () => {
|
|
|
252
252
|
});
|
|
253
253
|
});
|
|
254
254
|
|
|
255
|
+
describe("plugin-resident skills", () => {
|
|
256
|
+
const pluginsDir = join(TEST_DIR, "plugins");
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Materialize a skill on disk inside an installed plugin directory:
|
|
260
|
+
* `plugins/<plugin>/skills/<skillId>/SKILL.md`. A `package.json` is written
|
|
261
|
+
* for the plugin by default since that is the install gate the discovery
|
|
262
|
+
* scan keys on; pass `withPackageJson: false` to simulate a stray directory.
|
|
263
|
+
*/
|
|
264
|
+
function writePluginSkill(
|
|
265
|
+
pluginName: string,
|
|
266
|
+
skillId: string,
|
|
267
|
+
name: string,
|
|
268
|
+
description: string,
|
|
269
|
+
body: string = "Plugin skill body",
|
|
270
|
+
{
|
|
271
|
+
withPackageJson = true,
|
|
272
|
+
packageName,
|
|
273
|
+
}: { withPackageJson?: boolean; packageName?: string } = {},
|
|
274
|
+
): void {
|
|
275
|
+
const pluginDir = join(pluginsDir, pluginName);
|
|
276
|
+
mkdirSync(pluginDir, { recursive: true });
|
|
277
|
+
if (withPackageJson) {
|
|
278
|
+
writeFileSync(
|
|
279
|
+
join(pluginDir, "package.json"),
|
|
280
|
+
JSON.stringify({ name: packageName ?? pluginName, version: "1.0.0" }),
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
const skillDir = join(pluginDir, "skills", skillId);
|
|
284
|
+
mkdirSync(skillDir, { recursive: true });
|
|
285
|
+
writeFileSync(
|
|
286
|
+
join(skillDir, "SKILL.md"),
|
|
287
|
+
`---\nname: "${name}"\ndescription: "${description}"\n---\n\n${body}\n`,
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
beforeEach(() => {
|
|
292
|
+
mkdirSync(join(TEST_DIR, "skills"), { recursive: true });
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
afterEach(() => {
|
|
296
|
+
for (const dir of [join(TEST_DIR, "skills"), pluginsDir]) {
|
|
297
|
+
if (existsSync(dir)) rmSync(dir, { recursive: true, force: true });
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
test("discovers skills shipped inside an installed plugin, attributed to it", () => {
|
|
302
|
+
writePluginSkill("caveman", "caveman", "Caveman", "Terse mode");
|
|
303
|
+
|
|
304
|
+
const skill = loadSkillCatalog().find((s) => s.id === "caveman");
|
|
305
|
+
expect(skill).toBeDefined();
|
|
306
|
+
expect(skill!.source).toBe("plugin");
|
|
307
|
+
expect(skill!.owner).toEqual({ kind: "plugin", id: "caveman" });
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
test("loadSkillBySelector loads a plugin-resident skill body", () => {
|
|
311
|
+
writePluginSkill(
|
|
312
|
+
"caveman",
|
|
313
|
+
"caveman",
|
|
314
|
+
"Caveman",
|
|
315
|
+
"Terse mode",
|
|
316
|
+
"Full plugin skill body",
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
const result = loadSkillBySelector("caveman");
|
|
320
|
+
expect(result.error).toBeUndefined();
|
|
321
|
+
expect(result.skill).toBeDefined();
|
|
322
|
+
expect(result.skill!.source).toBe("plugin");
|
|
323
|
+
expect(result.skill!.body).toBe("Full plugin skill body");
|
|
324
|
+
expect(result.skill!.owner).toEqual({ kind: "plugin", id: "caveman" });
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test("ignores plugin directories without a package.json (staging/stray dirs)", () => {
|
|
328
|
+
writePluginSkill(
|
|
329
|
+
"half-installed",
|
|
330
|
+
"ghost",
|
|
331
|
+
"Ghost",
|
|
332
|
+
"Should be skipped",
|
|
333
|
+
"body",
|
|
334
|
+
{ withPackageJson: false },
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
const skill = loadSkillCatalog().find((s) => s.id === "ghost");
|
|
338
|
+
expect(skill).toBeUndefined();
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
test("ignores plugin dirs whose package.json name mismatches the directory", () => {
|
|
342
|
+
// Mirrors the loader's recognition gate: an un-adapted clone whose
|
|
343
|
+
// package.json declares `caveman-installer` in a `caveman` dir is skipped.
|
|
344
|
+
writePluginSkill("caveman", "caveman", "Caveman", "Terse mode", "body", {
|
|
345
|
+
packageName: "caveman-installer",
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
const skill = loadSkillCatalog().find((s) => s.id === "caveman");
|
|
349
|
+
expect(skill).toBeUndefined();
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
test("workspace skill overrides a plugin-resident skill with the same id", () => {
|
|
353
|
+
const WORKSPACE_DIR = join(
|
|
354
|
+
tmpdir(),
|
|
355
|
+
`vellum-workspace-test-${crypto.randomUUID()}`,
|
|
356
|
+
);
|
|
357
|
+
const workspaceSkillsDir = join(WORKSPACE_DIR, ".vellum", "skills");
|
|
358
|
+
mkdirSync(join(workspaceSkillsDir, "shared-id"), { recursive: true });
|
|
359
|
+
writeFileSync(
|
|
360
|
+
join(workspaceSkillsDir, "shared-id", "SKILL.md"),
|
|
361
|
+
`---\nname: "Workspace Wins"\ndescription: "Workspace version"\n---\n\nbody\n`,
|
|
362
|
+
);
|
|
363
|
+
writePluginSkill("caveman", "shared-id", "Plugin Loses", "Plugin version");
|
|
364
|
+
|
|
365
|
+
try {
|
|
366
|
+
const skill = loadSkillCatalog(workspaceSkillsDir).find(
|
|
367
|
+
(s) => s.id === "shared-id",
|
|
368
|
+
);
|
|
369
|
+
expect(skill).toBeDefined();
|
|
370
|
+
expect(skill!.source).toBe("workspace");
|
|
371
|
+
expect(skill!.name).toBe("Workspace Wins");
|
|
372
|
+
} finally {
|
|
373
|
+
rmSync(WORKSPACE_DIR, { recursive: true, force: true });
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
|
|
255
378
|
describe("tool manifest detection", () => {
|
|
256
379
|
beforeEach(() => {
|
|
257
380
|
mkdirSync(join(TEST_DIR, "skills"), { recursive: true });
|
|
@@ -28,6 +28,56 @@ describe("tool audit listener", () => {
|
|
|
28
28
|
expect(records[0].decision).toBe("allow");
|
|
29
29
|
expect(records[0].riskLevel).toBe("low");
|
|
30
30
|
expect(records[0].durationMs).toBe(12);
|
|
31
|
+
expect(records[0].skillId).toBeUndefined();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("records the triggering skill id on terminal events", () => {
|
|
35
|
+
const records: ToolInvocationRecord[] = [];
|
|
36
|
+
const listener = createToolAuditListener((record) => records.push(record));
|
|
37
|
+
|
|
38
|
+
listener({
|
|
39
|
+
type: "executed",
|
|
40
|
+
toolName: "task_create",
|
|
41
|
+
input: { title: "t" },
|
|
42
|
+
workingDir: "/tmp",
|
|
43
|
+
conversationId: "conv-skill",
|
|
44
|
+
skillId: "tasks-skill",
|
|
45
|
+
riskLevel: "low",
|
|
46
|
+
decision: "allow",
|
|
47
|
+
durationMs: 4,
|
|
48
|
+
result: { content: "ok", isError: false },
|
|
49
|
+
});
|
|
50
|
+
listener({
|
|
51
|
+
type: "error",
|
|
52
|
+
toolName: "task_create",
|
|
53
|
+
input: { title: "t" },
|
|
54
|
+
workingDir: "/tmp",
|
|
55
|
+
conversationId: "conv-skill",
|
|
56
|
+
skillId: "tasks-skill",
|
|
57
|
+
riskLevel: "low",
|
|
58
|
+
decision: "error",
|
|
59
|
+
durationMs: 6,
|
|
60
|
+
errorMessage: "boom",
|
|
61
|
+
isExpected: false,
|
|
62
|
+
errorCategory: "tool_failure",
|
|
63
|
+
});
|
|
64
|
+
listener({
|
|
65
|
+
type: "permission_denied",
|
|
66
|
+
toolName: "task_create",
|
|
67
|
+
input: { title: "t" },
|
|
68
|
+
workingDir: "/tmp",
|
|
69
|
+
conversationId: "conv-skill",
|
|
70
|
+
skillId: "tasks-skill",
|
|
71
|
+
riskLevel: "high",
|
|
72
|
+
decision: "deny",
|
|
73
|
+
reason: "Permission denied by user",
|
|
74
|
+
durationMs: 8,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
expect(records).toHaveLength(3);
|
|
78
|
+
for (const record of records) {
|
|
79
|
+
expect(record.skillId).toBe("tasks-skill");
|
|
80
|
+
}
|
|
31
81
|
});
|
|
32
82
|
|
|
33
83
|
test("records deny events with expected normalized results", () => {
|
|
@@ -152,5 +202,6 @@ describe("tool audit listener", () => {
|
|
|
152
202
|
expect(records).toHaveLength(1);
|
|
153
203
|
expect(records[0].result).toBe("error: boom");
|
|
154
204
|
expect(records[0].decision).toBe("error");
|
|
205
|
+
expect(records[0].skillId).toBeUndefined();
|
|
155
206
|
});
|
|
156
207
|
});
|
|
@@ -515,6 +515,38 @@ describe("ToolExecutor lifecycle events", () => {
|
|
|
515
515
|
expect(executed.executionTarget).toBe("sandbox");
|
|
516
516
|
});
|
|
517
517
|
|
|
518
|
+
test("stamps context.skillId on lifecycle events for skill-routed calls", async () => {
|
|
519
|
+
const events: ToolLifecycleEvent[] = [];
|
|
520
|
+
const executor = new ToolExecutor(makePrompter());
|
|
521
|
+
|
|
522
|
+
await executor.execute(
|
|
523
|
+
"skill_sandbox_tool",
|
|
524
|
+
{ query: "test" },
|
|
525
|
+
makeContext(events, { skillId: "test-skill" }),
|
|
526
|
+
);
|
|
527
|
+
|
|
528
|
+
expect(events.map((event) => event.type)).toEqual(["start", "executed"]);
|
|
529
|
+
for (const event of events) {
|
|
530
|
+
expect(event.skillId).toBe("test-skill");
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
test("leaves skillId unset on lifecycle events for direct tool calls", async () => {
|
|
535
|
+
const events: ToolLifecycleEvent[] = [];
|
|
536
|
+
const executor = new ToolExecutor(makePrompter());
|
|
537
|
+
|
|
538
|
+
await executor.execute(
|
|
539
|
+
"file_read",
|
|
540
|
+
{ path: "README.md" },
|
|
541
|
+
makeContext(events),
|
|
542
|
+
);
|
|
543
|
+
|
|
544
|
+
expect(events.map((event) => event.type)).toEqual(["start", "executed"]);
|
|
545
|
+
for (const event of events) {
|
|
546
|
+
expect(event.skillId).toBeUndefined();
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
|
|
518
550
|
test("skill tool with sandbox execution_target resolves to sandbox executionTarget", async () => {
|
|
519
551
|
const events: ToolLifecycleEvent[] = [];
|
|
520
552
|
const executor = new ToolExecutor(makePrompter());
|