@vellumai/assistant 0.12.1-dev.202609141913.5e16607 → 0.12.1-dev.202609142113.d1590bc
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/ARCHITECTURE.md +9 -9
- package/openapi.yaml +35 -2
- package/package.json +2 -1
- package/src/__tests__/anthropic-provider.test.ts +0 -63
- package/src/__tests__/assistant-event-hub-machine-name.test.ts +6 -7
- package/src/__tests__/assistant-event-hub.test.ts +44 -0
- package/src/__tests__/computer-use-skill-manifest-regression.test.ts +1 -1
- package/src/__tests__/computer-use-tools.test.ts +2 -2
- package/src/__tests__/heartbeat-service.test.ts +56 -40
- package/src/__tests__/host-cu-proxy.test.ts +539 -0
- package/src/__tests__/list-messages-camera-frame.test.ts +121 -0
- package/src/__tests__/oauth-commands-routes.test.ts +113 -0
- package/src/__tests__/oauth-provider-profiles.test.ts +18 -0
- package/src/__tests__/openai-provider.test.ts +1 -0
- package/src/__tests__/plugin-import-boundary-guard.test.ts +1 -0
- package/src/__tests__/qdrant-manager.test.ts +132 -0
- package/src/__tests__/scaffold-managed-skill-tool.test.ts +229 -6
- package/src/__tests__/skills.test.ts +9 -4
- package/src/__tests__/test-support/computer-use-skill-harness.ts +3 -2
- package/src/__tests__/unicode.test.ts +13 -0
- package/src/acp/agent-process.ts +2 -1
- package/src/agent/loop.ts +1 -0
- package/src/api/events/user-message-echo.ts +7 -1
- package/src/api/responses/conversation-message.ts +5 -0
- package/src/avatar/identity-avatar.ts +7 -2
- package/src/config/bundled-skills/computer-use/SKILL.md +20 -2
- package/src/config/bundled-skills/computer-use/TOOLS.json +99 -0
- package/src/config/bundled-skills/computer-use/tools/computer-use-sequence.ts +12 -0
- package/src/config/bundled-skills/media-processing/services/preprocess.ts +2 -1
- package/src/config/bundled-skills/media-processing/services/processing-pipeline.ts +2 -1
- package/src/config/bundled-skills/media-processing/tools/generate-clip.ts +2 -1
- package/src/config/bundled-skills/playbooks/tools/playbook-create.ts +2 -1
- package/src/config/bundled-skills/playbooks/tools/playbook-update.ts +2 -1
- package/src/config/bundled-skills/skill-management/TOOLS.json +4 -0
- package/src/config/bundled-skills/transcribe/tools/transcribe-media.ts +5 -2
- package/src/credential-health/credential-health-service.ts +11 -17
- package/src/daemon/conversation-error.ts +3 -2
- package/src/daemon/conversation-media-retry.ts +2 -1
- package/src/daemon/conversation-runtime-assembly.ts +2 -1
- package/src/daemon/conversation-surfaces.ts +5 -1
- package/src/daemon/dictation-profile-store.ts +2 -1
- package/src/daemon/handlers/shared.ts +2 -1
- package/src/daemon/handlers/skills.ts +6 -3
- package/src/daemon/host-cu-proxy.ts +186 -19
- package/src/daemon/host-proxy-preactivation.ts +2 -1
- package/src/daemon/reaction-history-render.ts +2 -1
- package/src/heartbeat/heartbeat-service.ts +21 -3
- package/src/live-voice/__tests__/live-voice-sight-frame-echo.test.ts +238 -0
- package/src/live-voice/live-voice-photo.ts +25 -6
- package/src/oauth/AGENTS.md +2 -0
- package/src/oauth/byo-connection.test.ts +60 -0
- package/src/oauth/scope-utils.ts +24 -0
- package/src/oauth/seed-providers.ts +39 -25
- package/src/persistence/conversation-queries.ts +2 -2
- package/src/persistence/embeddings/qdrant-manager.ts +163 -18
- package/src/plugins/defaults/memory/__tests__/memory-retrospective-prompt.test.ts +5 -0
- package/src/plugins/defaults/memory/context-search/agent-runner.ts +3 -2
- package/src/plugins/defaults/memory/context-search/format.ts +3 -2
- package/src/plugins/defaults/memory/context-search/sources/memory-v2.ts +6 -3
- package/src/plugins/defaults/memory/context-search/sources/workspace.ts +3 -2
- package/src/plugins/defaults/memory/graph/capability-seed.ts +2 -1
- package/src/plugins/defaults/memory/host-utils.ts +10 -0
- package/src/plugins/defaults/memory/memory-retrospective-prompt.ts +1 -1
- package/src/plugins/defaults/memory/startup.ts +22 -1
- package/src/plugins/defaults/memory/substrate/page-index.ts +6 -1
- package/src/plugins/defaults/memory/v1/graph/consolidation.ts +4 -2
- package/src/plugins/defaults/memory/v1/graph/extraction.ts +4 -2
- package/src/plugins/defaults/memory/v1/graph/retriever.ts +4 -1
- package/src/plugins/defaults/memory/v2/reranker.ts +6 -1
- package/src/plugins/defaults/memory/v3/__tests__/card.test.ts +24 -0
- package/src/plugins/defaults/memory/v3/__tests__/pool-select.test.ts +39 -3
- package/src/plugins/defaults/memory/v3/__tests__/sections.test.ts +26 -0
- package/src/plugins/defaults/memory/v3/__tests__/shadow-plugin.test.ts +30 -0
- package/src/plugins/defaults/memory/v3/card.ts +3 -2
- package/src/plugins/defaults/memory/v3/pool-select.ts +5 -3
- package/src/plugins/defaults/memory/v3/sections.ts +9 -3
- package/src/plugins/defaults/memory/v3/shadow-plugin.ts +5 -2
- package/src/providers/__tests__/retry-outbound-sanitize.test.ts +176 -0
- package/src/providers/anthropic/client.ts +0 -47
- package/src/providers/openai/__tests__/chat-completions-output-token-limit.test.ts +141 -0
- package/src/providers/openai/chat-completions-provider.ts +20 -1
- package/src/providers/openrouter/client.ts +20 -0
- package/src/providers/outbound-request-sanitize.ts +96 -0
- package/src/providers/retry.ts +24 -3
- package/src/providers/unparseable-tool-args.ts +5 -1
- package/src/runtime/AGENTS.md +1 -1
- package/src/runtime/__tests__/host-observe.test.ts +40 -1
- package/src/runtime/agent-wake.ts +2 -1
- package/src/runtime/assistant-event-hub.ts +21 -3
- package/src/runtime/host-observe.ts +11 -1
- package/src/runtime/routes/conversation-routes.ts +16 -3
- package/src/runtime/routes/diagnostics-routes.ts +6 -1
- package/src/runtime/routes/events-routes.ts +4 -0
- package/src/runtime/routes/host-cu-routes.ts +6 -0
- package/src/runtime/routes/oauth-commands-routes.ts +36 -0
- package/src/runtime/routes/workspace-routes.test.ts +55 -26
- package/src/runtime/routes/workspace-routes.ts +46 -63
- package/src/runtime/routes/workspace-tree-walk.test.ts +244 -0
- package/src/runtime/routes/workspace-tree-walk.ts +240 -0
- package/src/runtime/routes/workspace-utils.ts +17 -0
- package/src/schedule/run-script.ts +2 -1
- package/src/schedule/schedule-store.ts +9 -2
- package/src/security/untrusted-content.ts +3 -1
- package/src/tools/__tests__/side-effect-abort-guard.test.ts +1 -0
- package/src/tools/browser/browser-execution.ts +1 -1
- package/src/tools/browser/cdp-client/accessibility-snapshot.ts +9 -3
- package/src/tools/browser/cdp-client/cdp-inspect/discovery.ts +2 -1
- package/src/tools/browser/cdp-client/extension-cdp-client.ts +3 -2
- package/src/tools/browser/network-recorder.ts +2 -1
- package/src/tools/computer-use/definitions.ts +117 -0
- package/src/tools/filesystem/search.ts +2 -1
- package/src/tools/network/web-search.ts +6 -1
- package/src/tools/skills/scaffold-managed.ts +61 -3
- package/src/types/host-capabilities.ts +5 -3
- package/src/util/unicode.ts +15 -1
- package/src/watch/watch-timeline.ts +2 -2
- package/src/workflows/run-manager.ts +2 -1
- package/src/workspace/git-service.ts +1 -1
|
@@ -25,6 +25,9 @@ interface MockProviderRow {
|
|
|
25
25
|
managedServiceConfigKey: string | null;
|
|
26
26
|
baseUrl: string | null;
|
|
27
27
|
injectionTemplates: string | null;
|
|
28
|
+
defaultScopes?: string;
|
|
29
|
+
authorizeParams?: string | null;
|
|
30
|
+
scopeSeparator?: string;
|
|
28
31
|
pingUrl: string | null;
|
|
29
32
|
pingMethod: string | null;
|
|
30
33
|
pingHeaders: string | null;
|
|
@@ -109,10 +112,15 @@ mock.module("../oauth/oauth-store.js", () => ({
|
|
|
109
112
|
listActiveConnectionsByProvider: (provider: string) =>
|
|
110
113
|
mockActiveConnectionsByProvider[provider] ?? [],
|
|
111
114
|
listConnections: (provider: string) => mockAllConnections[provider] ?? [],
|
|
115
|
+
// Imported by seed-providers.js at module load; the seed data is read here,
|
|
116
|
+
// never written.
|
|
117
|
+
migrateProviderBaseUrl: () => {},
|
|
118
|
+
seedProviders: () => {},
|
|
112
119
|
}));
|
|
113
120
|
|
|
114
121
|
mock.module("../oauth/connection-resolver.js", () => {
|
|
115
122
|
const makeConnection = () => ({
|
|
123
|
+
id: "conn-1",
|
|
116
124
|
accountInfo: "user@example.com",
|
|
117
125
|
request: async (req: unknown) => {
|
|
118
126
|
mockResolveRequests.push(req);
|
|
@@ -155,6 +163,7 @@ mock.module("../security/token-manager.js", () => ({
|
|
|
155
163
|
}));
|
|
156
164
|
|
|
157
165
|
import { loadRawConfig } from "../config/loader.js";
|
|
166
|
+
import { PROVIDER_SEED_DATA } from "../oauth/seed-providers.js";
|
|
158
167
|
import {
|
|
159
168
|
BadRequestError,
|
|
160
169
|
InternalError,
|
|
@@ -899,6 +908,110 @@ describe("POST oauth/request", () => {
|
|
|
899
908
|
]);
|
|
900
909
|
});
|
|
901
910
|
|
|
911
|
+
/** The provider row exactly as seeding writes it, so the seed data is what the guard reads. */
|
|
912
|
+
function seededProvider(provider: keyof typeof PROVIDER_SEED_DATA) {
|
|
913
|
+
const seed = PROVIDER_SEED_DATA[provider];
|
|
914
|
+
return {
|
|
915
|
+
...baseProvider,
|
|
916
|
+
provider,
|
|
917
|
+
managedServiceConfigKey: null,
|
|
918
|
+
baseUrl: seed.baseUrl ?? null,
|
|
919
|
+
injectionTemplates: JSON.stringify(seed.injectionTemplates),
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
test("admits a Slack file URL on both seeded Slack providers", async () => {
|
|
924
|
+
// Each Slack credential reads messages, and a file shared in a message is
|
|
925
|
+
// fetched from its `url_private_download` on files.slack.com with the
|
|
926
|
+
// same token.
|
|
927
|
+
for (const provider of ["slack", "slack_channel"] as const) {
|
|
928
|
+
mockProviders[provider] = seededProvider(provider);
|
|
929
|
+
mockResolveRequests = [];
|
|
930
|
+
|
|
931
|
+
await getRoute("POST", "oauth/request").handler(
|
|
932
|
+
makeArgs({
|
|
933
|
+
body: {
|
|
934
|
+
provider,
|
|
935
|
+
url: "https://files.slack.com/files-pri/T0123-F0456/download/shot.png",
|
|
936
|
+
},
|
|
937
|
+
}),
|
|
938
|
+
);
|
|
939
|
+
|
|
940
|
+
expect(mockResolveRequests).toEqual([
|
|
941
|
+
{
|
|
942
|
+
method: "GET",
|
|
943
|
+
path: "/files-pri/T0123-F0456/download/shot.png",
|
|
944
|
+
baseUrl: "https://files.slack.com",
|
|
945
|
+
},
|
|
946
|
+
]);
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
test("the seeded Slack host policy admits nothing beyond the documented hosts", async () => {
|
|
951
|
+
mockProviders.slack_channel = seededProvider("slack_channel");
|
|
952
|
+
|
|
953
|
+
// A lookalike, an unrelated host, and the CDN host Slack redirects file
|
|
954
|
+
// downloads to: the guard sees only the URL the caller names, and that
|
|
955
|
+
// URL is the documented file host or nothing.
|
|
956
|
+
for (const url of [
|
|
957
|
+
"https://files.slack.com.attacker.example/files-pri/T0123-F0456/x.png",
|
|
958
|
+
"https://attacker.example/files-pri/T0123-F0456/x.png",
|
|
959
|
+
"https://files-origin.slack.com/files-pri/T0123-F0456/x.png",
|
|
960
|
+
]) {
|
|
961
|
+
await expect(
|
|
962
|
+
getRoute("POST", "oauth/request").handler(
|
|
963
|
+
makeArgs({ body: { provider: "slack_channel", url } }),
|
|
964
|
+
),
|
|
965
|
+
).rejects.toBeInstanceOf(BadRequestError);
|
|
966
|
+
}
|
|
967
|
+
expect(mockResolveRequests).toHaveLength(0);
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
test("names the required scopes a stored grant lacks on the request itself", async () => {
|
|
971
|
+
// A connection made before a scope was required keeps working for every
|
|
972
|
+
// call that does not need it, so the caller must be told on the request,
|
|
973
|
+
// not only by the next health check.
|
|
974
|
+
const seed = PROVIDER_SEED_DATA.slack;
|
|
975
|
+
mockProviders.slack = {
|
|
976
|
+
...seededProvider("slack"),
|
|
977
|
+
defaultScopes: JSON.stringify(seed.defaultScopes),
|
|
978
|
+
authorizeParams: JSON.stringify(seed.authorizeParams),
|
|
979
|
+
scopeSeparator: " ",
|
|
980
|
+
};
|
|
981
|
+
const grantedBeforeFilesRead = seed
|
|
982
|
+
.authorizeParams!.user_scope.split(",")
|
|
983
|
+
.filter((scope) => scope !== "files:read");
|
|
984
|
+
mockAllConnections.slack = [
|
|
985
|
+
{
|
|
986
|
+
id: "conn-1",
|
|
987
|
+
provider: "slack",
|
|
988
|
+
grantedScopes: JSON.stringify(grantedBeforeFilesRead),
|
|
989
|
+
},
|
|
990
|
+
];
|
|
991
|
+
|
|
992
|
+
const stale = (await getRoute("POST", "oauth/request").handler(
|
|
993
|
+
makeArgs({ body: { provider: "slack", url: "/conversations.history" } }),
|
|
994
|
+
)) as { ok: boolean; hint?: string };
|
|
995
|
+
|
|
996
|
+
expect(stale.ok).toBe(true);
|
|
997
|
+
expect(stale.hint).toContain("files:read");
|
|
998
|
+
expect(stale.hint).toContain("oauth connect slack");
|
|
999
|
+
|
|
1000
|
+
mockAllConnections.slack = [
|
|
1001
|
+
{
|
|
1002
|
+
id: "conn-1",
|
|
1003
|
+
provider: "slack",
|
|
1004
|
+
grantedScopes: JSON.stringify(
|
|
1005
|
+
seed.authorizeParams!.user_scope.split(","),
|
|
1006
|
+
),
|
|
1007
|
+
},
|
|
1008
|
+
];
|
|
1009
|
+
const current = (await getRoute("POST", "oauth/request").handler(
|
|
1010
|
+
makeArgs({ body: { provider: "slack", url: "/conversations.history" } }),
|
|
1011
|
+
)) as { hint?: string };
|
|
1012
|
+
expect(current.hint).toBeUndefined();
|
|
1013
|
+
});
|
|
1014
|
+
|
|
902
1015
|
test("allows cross-host absolute URLs declared by provider injection templates", async () => {
|
|
903
1016
|
mockProviders.google = {
|
|
904
1017
|
...baseProvider,
|
|
@@ -7,6 +7,7 @@ mock.module("../security/secure-keys.js", () => ({
|
|
|
7
7
|
}));
|
|
8
8
|
|
|
9
9
|
import { getProvider } from "../oauth/oauth-store.js";
|
|
10
|
+
import { expectedScopesForStoredToken } from "../oauth/scope-utils.js";
|
|
10
11
|
import { seedOAuthProviders } from "../oauth/seed-providers.js";
|
|
11
12
|
import { initializeDb } from "../persistence/db-init.js";
|
|
12
13
|
|
|
@@ -22,6 +23,23 @@ describe("oauth provider profiles (DB-seeded)", () => {
|
|
|
22
23
|
expect(scopes).toContain("https://www.googleapis.com/auth/drive");
|
|
23
24
|
});
|
|
24
25
|
|
|
26
|
+
test("slack provider row requests files:read for the token it stores", () => {
|
|
27
|
+
// The flow persists the authed_user token, and credential health measures
|
|
28
|
+
// its grant through the same function used here, so this is the scope set
|
|
29
|
+
// an integration connection must carry to fetch a file from files.slack.com.
|
|
30
|
+
const provider = getProvider("slack");
|
|
31
|
+
|
|
32
|
+
expect(provider).toBeDefined();
|
|
33
|
+
const expected = expectedScopesForStoredToken(
|
|
34
|
+
JSON.parse(provider!.defaultScopes) as string[],
|
|
35
|
+
provider!.authorizeParams
|
|
36
|
+
? (JSON.parse(provider!.authorizeParams) as Record<string, string>)
|
|
37
|
+
: undefined,
|
|
38
|
+
provider!.scopeSeparator ?? undefined,
|
|
39
|
+
);
|
|
40
|
+
expect(expected).toContain("files:read");
|
|
41
|
+
});
|
|
42
|
+
|
|
25
43
|
test("google provider row contains bearer injection templates for 8 Google API hosts", () => {
|
|
26
44
|
const provider = getProvider("google");
|
|
27
45
|
|
|
@@ -982,6 +982,7 @@ describe("OpenAIProvider", () => {
|
|
|
982
982
|
);
|
|
983
983
|
|
|
984
984
|
expect(lastCreateParams!.max_completion_tokens).toBe(64000);
|
|
985
|
+
expect(lastCreateParams).not.toHaveProperty("max_tokens");
|
|
985
986
|
});
|
|
986
987
|
|
|
987
988
|
// -----------------------------------------------------------------------
|
|
@@ -248,6 +248,7 @@ const BASELINE: Record<string, readonly string[]> = {
|
|
|
248
248
|
"../../../util/sqlite-retry.js",
|
|
249
249
|
"../../../util/strip-comment-lines.js",
|
|
250
250
|
"../../../util/truncate.js",
|
|
251
|
+
"../../../util/unicode.js",
|
|
251
252
|
"../../../util/worker-compute.js",
|
|
252
253
|
"../../../util/worker-memory.js",
|
|
253
254
|
"../../../util/worker-process.js",
|
|
@@ -21,7 +21,9 @@ import {
|
|
|
21
21
|
const testDataDir = process.env.VELLUM_WORKSPACE_DIR!;
|
|
22
22
|
|
|
23
23
|
import {
|
|
24
|
+
describeQdrantStartFailure,
|
|
24
25
|
QdrantManager,
|
|
26
|
+
QdrantStartError,
|
|
25
27
|
resolveQdrantReleaseAsset,
|
|
26
28
|
} from "../persistence/embeddings/qdrant-manager.js";
|
|
27
29
|
|
|
@@ -395,6 +397,136 @@ describe("QdrantManager", () => {
|
|
|
395
397
|
// THEN the error carries the stdout explanation, not just the noise
|
|
396
398
|
await expect(mgr.start()).rejects.toThrow("Failed to load local shard");
|
|
397
399
|
}, 10_000);
|
|
400
|
+
|
|
401
|
+
test("classifies a crash as an exit with its code and captured output", async () => {
|
|
402
|
+
// The reporter must not have to parse the message: the step, the exit
|
|
403
|
+
// code and the raw streams travel as fields.
|
|
404
|
+
placeFakeBinary(
|
|
405
|
+
'#!/bin/sh\necho "Panic occurred: no such shard"\nexit 101',
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
const mgr = new QdrantManager({
|
|
409
|
+
url: `http://127.0.0.1:${getTestPort()}`,
|
|
410
|
+
...FAST_TIMEOUTS,
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
let caught: unknown;
|
|
414
|
+
await mgr.start().catch((err) => {
|
|
415
|
+
caught = err;
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
expect(caught).toBeInstanceOf(QdrantStartError);
|
|
419
|
+
const err = caught as QdrantStartError;
|
|
420
|
+
expect(err.kind).toBe("exited");
|
|
421
|
+
expect(err.exitCode).toBe(101);
|
|
422
|
+
expect(err.stdout).toContain("no such shard");
|
|
423
|
+
}, 10_000);
|
|
424
|
+
|
|
425
|
+
test("classifies a readiness timeout as not_ready with no exit code", async () => {
|
|
426
|
+
placeFakeBinary("#!/bin/sh\nexec sleep 300");
|
|
427
|
+
|
|
428
|
+
const mgr = new QdrantManager({
|
|
429
|
+
url: `http://127.0.0.1:${getTestPort()}`,
|
|
430
|
+
...FAST_TIMEOUTS,
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
let caught: unknown;
|
|
434
|
+
await mgr.start().catch((err) => {
|
|
435
|
+
caught = err;
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
expect(caught).toBeInstanceOf(QdrantStartError);
|
|
439
|
+
expect((caught as QdrantStartError).kind).toBe("not_ready");
|
|
440
|
+
expect((caught as QdrantStartError).exitCode).toBeNull();
|
|
441
|
+
}, 10_000);
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
describe("describeQdrantStartFailure", () => {
|
|
445
|
+
const dataDir = "/home/example/workspace-data";
|
|
446
|
+
const failure = (stdout: string, kind: "exited" | "not_ready" = "exited") =>
|
|
447
|
+
new QdrantStartError(
|
|
448
|
+
"boom",
|
|
449
|
+
kind,
|
|
450
|
+
kind === "exited" ? 101 : null,
|
|
451
|
+
stdout,
|
|
452
|
+
"",
|
|
453
|
+
);
|
|
454
|
+
|
|
455
|
+
test("takes the reason from the last panic marker, after the backtrace", () => {
|
|
456
|
+
const stdout =
|
|
457
|
+
" 0: backtrace frame\n 1: another frame\n" +
|
|
458
|
+
"ERROR qdrant::startup: Panic occurred in file mod.rs at line 301: " +
|
|
459
|
+
"Failed to load local shard";
|
|
460
|
+
|
|
461
|
+
expect(describeQdrantStartFailure(failure(stdout), dataDir)).toEqual({
|
|
462
|
+
kind: "exited",
|
|
463
|
+
exit_code: 101,
|
|
464
|
+
panic:
|
|
465
|
+
"Panic occurred in file mod.rs at line 301: Failed to load local shard",
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
test("replaces the data directory wherever it appears", () => {
|
|
470
|
+
const stdout = `Panic occurred: cannot open ${dataDir}/qdrant/collections/x and ${dataDir}/qdrant/wal`;
|
|
471
|
+
|
|
472
|
+
expect(describeQdrantStartFailure(failure(stdout), dataDir).panic).toBe(
|
|
473
|
+
"Panic occurred: cannot open <data>/qdrant/collections/x and <data>/qdrant/wal",
|
|
474
|
+
);
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
test("falls back to the last stdout line when Qdrant died without panicking", () => {
|
|
478
|
+
const stdout =
|
|
479
|
+
"INFO starting\nERROR Address already in use (os error 48)\n";
|
|
480
|
+
|
|
481
|
+
expect(describeQdrantStartFailure(failure(stdout), dataDir).panic).toBe(
|
|
482
|
+
"ERROR Address already in use (os error 48)",
|
|
483
|
+
);
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
test("reports no reason for a silent timeout", () => {
|
|
487
|
+
expect(
|
|
488
|
+
describeQdrantStartFailure(failure("", "not_ready"), dataDir),
|
|
489
|
+
).toEqual({ kind: "not_ready", exit_code: null, panic: null });
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* The telemetry server's measure: JSON with every code unit above 0x7E
|
|
494
|
+
* escaped to six ASCII bytes (`jsonByteLength` in
|
|
495
|
+
* `telemetry-wire.generated.ts`), minus the enclosing quotes.
|
|
496
|
+
*/
|
|
497
|
+
const serverBytes = (s: string) =>
|
|
498
|
+
JSON.stringify(s).replace(/[^\x00-\x7e]/g, "\\uxxxx").length - 2;
|
|
499
|
+
|
|
500
|
+
test("caps an ASCII reason at the byte budget", () => {
|
|
501
|
+
const { panic } = describeQdrantStartFailure(
|
|
502
|
+
failure("Panic occurred: " + "x".repeat(5_000)),
|
|
503
|
+
dataDir,
|
|
504
|
+
);
|
|
505
|
+
|
|
506
|
+
expect(panic?.length).toBe(1_024);
|
|
507
|
+
expect(serverBytes(panic!)).toBe(1_024);
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
test("caps a non-ASCII reason by the server's escaped size, not by characters", () => {
|
|
511
|
+
// Each CJK character serializes to six bytes on the server, so a
|
|
512
|
+
// character cap would overshoot the budget six-fold and the event would
|
|
513
|
+
// be dropped at ingest.
|
|
514
|
+
const { panic } = describeQdrantStartFailure(
|
|
515
|
+
failure("Panic occurred: " + "測".repeat(2_000)),
|
|
516
|
+
dataDir,
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
expect(serverBytes(panic!)).toBeLessThanOrEqual(1_024);
|
|
520
|
+
expect(serverBytes(panic! + "測")).toBeGreaterThan(1_024);
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
test("never drops an unclassified failure", () => {
|
|
524
|
+
expect(describeQdrantStartFailure(new Error("nope"), dataDir)).toEqual({
|
|
525
|
+
kind: "unknown",
|
|
526
|
+
exit_code: null,
|
|
527
|
+
panic: null,
|
|
528
|
+
});
|
|
529
|
+
});
|
|
398
530
|
});
|
|
399
531
|
|
|
400
532
|
// ── Binary Detection ─────────────────────────────────────────
|
|
@@ -1103,6 +1103,7 @@ describe("scaffold_managed_skill tool", () => {
|
|
|
1103
1103
|
activation_hints: HINTS,
|
|
1104
1104
|
overwrite: true,
|
|
1105
1105
|
files: [{ path: "references/failure-modes.md", content: "gotchas" }],
|
|
1106
|
+
change_summary: "Added the failure modes reference.",
|
|
1106
1107
|
},
|
|
1107
1108
|
makeRetrospectiveContext(),
|
|
1108
1109
|
);
|
|
@@ -1550,6 +1551,7 @@ describe("scaffold_managed_skill tool", () => {
|
|
|
1550
1551
|
body_markdown: "V2 procedure.",
|
|
1551
1552
|
activation_hints: HINTS,
|
|
1552
1553
|
overwrite: true,
|
|
1554
|
+
change_summary: "Refined the procedure.",
|
|
1553
1555
|
},
|
|
1554
1556
|
makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
|
|
1555
1557
|
lineageSeam(),
|
|
@@ -1702,6 +1704,7 @@ describe("background skill update notification", () => {
|
|
|
1702
1704
|
body_markdown: "1. Refined steps.",
|
|
1703
1705
|
activation_hints: HINTS,
|
|
1704
1706
|
overwrite: true,
|
|
1707
|
+
change_summary: "Refined the steps.",
|
|
1705
1708
|
},
|
|
1706
1709
|
makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
|
|
1707
1710
|
lineage(),
|
|
@@ -1715,9 +1718,7 @@ describe("background skill update notification", () => {
|
|
|
1715
1718
|
// must be the conversation the work came from, not the hidden fork.
|
|
1716
1719
|
expect(signal.sourceContextId).toBe("source-conv");
|
|
1717
1720
|
expect(signal.contextPayload?.skillId).toBe("weekly-export");
|
|
1718
|
-
expect(
|
|
1719
|
-
"Weekly Report Export",
|
|
1720
|
-
);
|
|
1721
|
+
expect(signal.contextPayload?.summary).toBe("Refined the steps.");
|
|
1721
1722
|
// The home feed falls back to `title`/`body` when no channel copy was
|
|
1722
1723
|
// rendered, which is the intended quiet shape for this signal. Without
|
|
1723
1724
|
// them a suppressed delivery would leave the feed item unwritten.
|
|
@@ -1725,15 +1726,236 @@ describe("background skill update notification", () => {
|
|
|
1725
1726
|
expect(signal.contextPayload?.title).toBe(
|
|
1726
1727
|
"Skill updated: Weekly Report Export",
|
|
1727
1728
|
);
|
|
1728
|
-
expect(
|
|
1729
|
-
"Weekly Report Export",
|
|
1730
|
-
);
|
|
1729
|
+
expect(signal.contextPayload?.body).toBe("Refined the steps.");
|
|
1731
1730
|
// Deduped per skill per day so repeated refinements cannot flood the feed.
|
|
1732
1731
|
expect(signal.dedupeKey).toBe(
|
|
1733
1732
|
`skill-updated:weekly-export:${new Date().toISOString().slice(0, 10)}`,
|
|
1734
1733
|
);
|
|
1735
1734
|
});
|
|
1736
1735
|
|
|
1736
|
+
test("the notice body is the pass's change_summary, so the feed says what changed", async () => {
|
|
1737
|
+
await seedAssistantSkill("weekly-export", "Old body.");
|
|
1738
|
+
|
|
1739
|
+
const result = await executeScaffoldManagedSkill(
|
|
1740
|
+
{
|
|
1741
|
+
skill_id: "weekly-export",
|
|
1742
|
+
name: "Weekly Report Export",
|
|
1743
|
+
description: "export the weekly usage report",
|
|
1744
|
+
body_markdown: "1. Refined steps.",
|
|
1745
|
+
activation_hints: HINTS,
|
|
1746
|
+
overwrite: true,
|
|
1747
|
+
change_summary:
|
|
1748
|
+
"Added the retry after an expired session and the export endpoint that held steady.",
|
|
1749
|
+
},
|
|
1750
|
+
makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
|
|
1751
|
+
lineage(),
|
|
1752
|
+
);
|
|
1753
|
+
|
|
1754
|
+
expect(result.isError).toBe(false);
|
|
1755
|
+
expect(emittedSignals).toHaveLength(1);
|
|
1756
|
+
const payload = emittedSignals[0]!.contextPayload;
|
|
1757
|
+
// The title still names the skill; the body is the change itself.
|
|
1758
|
+
expect(payload?.title).toBe("Skill updated: Weekly Report Export");
|
|
1759
|
+
expect(payload?.body).toBe(
|
|
1760
|
+
"Added the retry after an expired session and the export endpoint that held steady.",
|
|
1761
|
+
);
|
|
1762
|
+
expect(payload?.summary).toBe(payload?.body);
|
|
1763
|
+
});
|
|
1764
|
+
|
|
1765
|
+
test("a background overwrite without a change_summary is refused before the write", async () => {
|
|
1766
|
+
await seedAssistantSkill("weekly-export", "Old body.");
|
|
1767
|
+
const skillFile = join(TEST_DIR, "skills", "weekly-export", "SKILL.md");
|
|
1768
|
+
const before = readFileSync(skillFile, "utf-8");
|
|
1769
|
+
|
|
1770
|
+
for (const input of [
|
|
1771
|
+
{},
|
|
1772
|
+
// Whitespace-only reads as missing, not as an empty notice.
|
|
1773
|
+
{ change_summary: " \n " },
|
|
1774
|
+
]) {
|
|
1775
|
+
const result = await executeScaffoldManagedSkill(
|
|
1776
|
+
{
|
|
1777
|
+
skill_id: "weekly-export",
|
|
1778
|
+
name: "Weekly Report Export",
|
|
1779
|
+
description: "export the weekly usage report",
|
|
1780
|
+
body_markdown: "1. Refined steps.",
|
|
1781
|
+
activation_hints: HINTS,
|
|
1782
|
+
overwrite: true,
|
|
1783
|
+
...input,
|
|
1784
|
+
},
|
|
1785
|
+
makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
|
|
1786
|
+
lineage(),
|
|
1787
|
+
);
|
|
1788
|
+
|
|
1789
|
+
// Self-correcting: the error returns to the pass in the same turn, so
|
|
1790
|
+
// the retry carries the field and nothing was lost meanwhile.
|
|
1791
|
+
expect(result.isError).toBe(true);
|
|
1792
|
+
expect(result.content).toBe(
|
|
1793
|
+
'Error: change_summary is required when updating an existing skill: pass one or two short sentences (under 200 characters) for the person who reads the "Skill updated" notice, naming what you changed and what in the trace prompted it (for example "Added the retry after an expired session and the export endpoint that held steady.").',
|
|
1794
|
+
);
|
|
1795
|
+
expect(readFileSync(skillFile, "utf-8")).toBe(before);
|
|
1796
|
+
expect(emittedSignals).toHaveLength(0);
|
|
1797
|
+
}
|
|
1798
|
+
});
|
|
1799
|
+
|
|
1800
|
+
test("a background call on an existing skill without overwrite hears the overwrite error, not the summary requirement", async () => {
|
|
1801
|
+
await seedAssistantSkill("weekly-export", "Old body.");
|
|
1802
|
+
|
|
1803
|
+
const result = await executeScaffoldManagedSkill(
|
|
1804
|
+
{
|
|
1805
|
+
skill_id: "weekly-export",
|
|
1806
|
+
name: "Weekly Report Export",
|
|
1807
|
+
description: "export the weekly usage report",
|
|
1808
|
+
body_markdown: "1. Refined steps.",
|
|
1809
|
+
activation_hints: HINTS,
|
|
1810
|
+
},
|
|
1811
|
+
makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
|
|
1812
|
+
lineage(),
|
|
1813
|
+
);
|
|
1814
|
+
|
|
1815
|
+
// The flag is what actually blocks this call, so that is the error it
|
|
1816
|
+
// gets: a retry that only adds change_summary would still fail.
|
|
1817
|
+
expect(result.isError).toBe(true);
|
|
1818
|
+
expect(result.content).toContain("Set overwrite=true to replace it.");
|
|
1819
|
+
expect(result.content).not.toContain("change_summary");
|
|
1820
|
+
expect(emittedSignals).toHaveLength(0);
|
|
1821
|
+
});
|
|
1822
|
+
|
|
1823
|
+
test("the ownership backstop speaks before the change_summary requirement", async () => {
|
|
1824
|
+
await executeScaffoldManagedSkill(
|
|
1825
|
+
{
|
|
1826
|
+
skill_id: "user-owned",
|
|
1827
|
+
name: "User Owned",
|
|
1828
|
+
description: "a person wrote this",
|
|
1829
|
+
body_markdown: "V1.",
|
|
1830
|
+
activation_hints: HINTS,
|
|
1831
|
+
},
|
|
1832
|
+
makeContext(),
|
|
1833
|
+
);
|
|
1834
|
+
|
|
1835
|
+
const result = await executeScaffoldManagedSkill(
|
|
1836
|
+
{
|
|
1837
|
+
skill_id: "user-owned",
|
|
1838
|
+
name: "User Owned",
|
|
1839
|
+
description: "a person wrote this",
|
|
1840
|
+
body_markdown: "V2.",
|
|
1841
|
+
activation_hints: HINTS,
|
|
1842
|
+
overwrite: true,
|
|
1843
|
+
},
|
|
1844
|
+
makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
|
|
1845
|
+
lineage(),
|
|
1846
|
+
);
|
|
1847
|
+
|
|
1848
|
+
expect(result.isError).toBe(true);
|
|
1849
|
+
expect(result.content).toContain("not verifiably assistant-authored");
|
|
1850
|
+
});
|
|
1851
|
+
|
|
1852
|
+
test("a user-directed overwrite needs no change_summary: it never notifies", async () => {
|
|
1853
|
+
await executeScaffoldManagedSkill(
|
|
1854
|
+
{
|
|
1855
|
+
skill_id: "user-skill",
|
|
1856
|
+
name: "User Skill",
|
|
1857
|
+
description: "asked for",
|
|
1858
|
+
body_markdown: "V1.",
|
|
1859
|
+
activation_hints: HINTS,
|
|
1860
|
+
},
|
|
1861
|
+
makeContext(),
|
|
1862
|
+
);
|
|
1863
|
+
|
|
1864
|
+
const result = await executeScaffoldManagedSkill(
|
|
1865
|
+
{
|
|
1866
|
+
skill_id: "user-skill",
|
|
1867
|
+
name: "User Skill",
|
|
1868
|
+
description: "asked for",
|
|
1869
|
+
body_markdown: "V2.",
|
|
1870
|
+
activation_hints: HINTS,
|
|
1871
|
+
overwrite: true,
|
|
1872
|
+
},
|
|
1873
|
+
makeContext(),
|
|
1874
|
+
);
|
|
1875
|
+
|
|
1876
|
+
expect(result.isError).toBe(false);
|
|
1877
|
+
});
|
|
1878
|
+
|
|
1879
|
+
test("change_summary is sanitized like any other notification body", async () => {
|
|
1880
|
+
await seedAssistantSkill("weekly-export", "Old body.");
|
|
1881
|
+
|
|
1882
|
+
await executeScaffoldManagedSkill(
|
|
1883
|
+
{
|
|
1884
|
+
skill_id: "weekly-export",
|
|
1885
|
+
name: "Weekly Report Export",
|
|
1886
|
+
description: "export the weekly usage report",
|
|
1887
|
+
body_markdown: "1. Refined steps.",
|
|
1888
|
+
activation_hints: HINTS,
|
|
1889
|
+
overwrite: true,
|
|
1890
|
+
change_summary: `Added\u0007 the retry.\r\n\n\n\nDropped the login step. ${"x".repeat(300)}`,
|
|
1891
|
+
},
|
|
1892
|
+
makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
|
|
1893
|
+
lineage(),
|
|
1894
|
+
);
|
|
1895
|
+
|
|
1896
|
+
const body = String(emittedSignals[0]!.contextPayload?.body);
|
|
1897
|
+
// Control characters go, horizontal whitespace collapses, blank-line runs
|
|
1898
|
+
// collapse to one paragraph break, and the whole thing is clamped to the
|
|
1899
|
+
// shared notification preview budget.
|
|
1900
|
+
expect(
|
|
1901
|
+
body.startsWith("Added the retry.\n\nDropped the login step. xxx"),
|
|
1902
|
+
).toBe(true);
|
|
1903
|
+
expect(body).not.toMatch(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/);
|
|
1904
|
+
expect(body.length).toBe(200);
|
|
1905
|
+
expect(body.endsWith("\u2026")).toBe(true);
|
|
1906
|
+
});
|
|
1907
|
+
|
|
1908
|
+
test("a non-string change_summary is a self-correcting error", async () => {
|
|
1909
|
+
await seedAssistantSkill("weekly-export", "Old body.");
|
|
1910
|
+
|
|
1911
|
+
const result = await executeScaffoldManagedSkill(
|
|
1912
|
+
{
|
|
1913
|
+
skill_id: "weekly-export",
|
|
1914
|
+
name: "Weekly Report Export",
|
|
1915
|
+
description: "export the weekly usage report",
|
|
1916
|
+
body_markdown: "1. Refined steps.",
|
|
1917
|
+
activation_hints: HINTS,
|
|
1918
|
+
overwrite: true,
|
|
1919
|
+
change_summary: ["not", "a", "string"],
|
|
1920
|
+
},
|
|
1921
|
+
makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
|
|
1922
|
+
lineage(),
|
|
1923
|
+
);
|
|
1924
|
+
|
|
1925
|
+
expect(result.isError).toBe(true);
|
|
1926
|
+
expect(result.content).toBe("Error: change_summary must be a string");
|
|
1927
|
+
expect(emittedSignals).toHaveLength(0);
|
|
1928
|
+
});
|
|
1929
|
+
|
|
1930
|
+
test("the registered tool's schema declares change_summary as an optional string", () => {
|
|
1931
|
+
// A call through the registered tool is validated against TOOLS.json
|
|
1932
|
+
// first, and the validator rejects undeclared keys, so the field has to
|
|
1933
|
+
// be in the schema for the executor to ever see it. It stays optional
|
|
1934
|
+
// there: the requirement holds only for a background overwrite of an
|
|
1935
|
+
// existing skill, which the schema cannot express, so the executor
|
|
1936
|
+
// enforces it.
|
|
1937
|
+
const scaffoldTool = readScaffoldToolEntry();
|
|
1938
|
+
expect(scaffoldTool.input_schema.properties.change_summary).toMatchObject({
|
|
1939
|
+
type: "string",
|
|
1940
|
+
});
|
|
1941
|
+
expect(scaffoldTool.input_schema.required).not.toContain("change_summary");
|
|
1942
|
+
|
|
1943
|
+
const result = validateInputAgainstSchema(
|
|
1944
|
+
"scaffold_managed_skill",
|
|
1945
|
+
{
|
|
1946
|
+
skill_id: "s",
|
|
1947
|
+
name: "N",
|
|
1948
|
+
description: "D",
|
|
1949
|
+
body_markdown: "B",
|
|
1950
|
+
activation_hints: HINTS,
|
|
1951
|
+
overwrite: true,
|
|
1952
|
+
change_summary: "Added the retry step.",
|
|
1953
|
+
},
|
|
1954
|
+
scaffoldTool.input_schema,
|
|
1955
|
+
);
|
|
1956
|
+
expect(result.ok).toBe(true);
|
|
1957
|
+
});
|
|
1958
|
+
|
|
1737
1959
|
test("it falls back to the run conversation when fork lineage does not resolve", async () => {
|
|
1738
1960
|
await seedAssistantSkill("weekly-export", "Old body.");
|
|
1739
1961
|
|
|
@@ -1745,6 +1967,7 @@ describe("background skill update notification", () => {
|
|
|
1745
1967
|
body_markdown: "1. Refined steps.",
|
|
1746
1968
|
activation_hints: HINTS,
|
|
1747
1969
|
overwrite: true,
|
|
1970
|
+
change_summary: "Refined the steps.",
|
|
1748
1971
|
},
|
|
1749
1972
|
makeRetrospectiveContext({ conversationId: "retro-run-conv" }),
|
|
1750
1973
|
{ getConversation: () => null },
|
|
@@ -875,7 +875,9 @@ describe("always-candidate frontmatter parsing", () => {
|
|
|
875
875
|
// drops trailing hints and the whole avoid-when list.
|
|
876
876
|
const { DEFAULT_CARD_CHARS, buildSkillContent } =
|
|
877
877
|
await import("../plugins/defaults/memory/substrate/skill-content.js");
|
|
878
|
-
const schedule = loadSkillCatalog().find(
|
|
878
|
+
const schedule = loadSkillCatalog().find(
|
|
879
|
+
(skill) => skill.id === "schedule",
|
|
880
|
+
);
|
|
879
881
|
expect(schedule).toBeDefined();
|
|
880
882
|
|
|
881
883
|
const card = buildSkillContent(schedule!);
|
|
@@ -886,7 +888,9 @@ describe("always-candidate frontmatter parsing", () => {
|
|
|
886
888
|
test("the bundled schedule card carries its monitoring vocabulary", async () => {
|
|
887
889
|
const { buildSkillContent } =
|
|
888
890
|
await import("../plugins/defaults/memory/substrate/skill-content.js");
|
|
889
|
-
const schedule = loadSkillCatalog().find(
|
|
891
|
+
const schedule = loadSkillCatalog().find(
|
|
892
|
+
(skill) => skill.id === "schedule",
|
|
893
|
+
);
|
|
890
894
|
const card = buildSkillContent(schedule!).toLowerCase();
|
|
891
895
|
|
|
892
896
|
for (const term of ["monitor", "page", "dashboard", "status", "alert"]) {
|
|
@@ -1087,14 +1091,14 @@ describe("bundled computer-use skill", () => {
|
|
|
1087
1091
|
expect(cuSkill!.bundled).toBe(true);
|
|
1088
1092
|
});
|
|
1089
1093
|
|
|
1090
|
-
test("computer-use skill has a valid tool manifest with
|
|
1094
|
+
test("computer-use skill has a valid tool manifest with 12 tools", () => {
|
|
1091
1095
|
const catalog = loadSkillCatalog();
|
|
1092
1096
|
const cuSkill = catalog.find((s) => s.id === "computer-use");
|
|
1093
1097
|
expect(cuSkill).toBeDefined();
|
|
1094
1098
|
expect(cuSkill!.toolManifest).toBeDefined();
|
|
1095
1099
|
expect(cuSkill!.toolManifest!.present).toBe(true);
|
|
1096
1100
|
expect(cuSkill!.toolManifest!.valid).toBe(true);
|
|
1097
|
-
expect(cuSkill!.toolManifest!.toolCount).toBe(
|
|
1101
|
+
expect(cuSkill!.toolManifest!.toolCount).toBe(12);
|
|
1098
1102
|
expect(cuSkill!.toolManifest!.toolNames).toEqual([
|
|
1099
1103
|
"computer_use_observe",
|
|
1100
1104
|
"computer_use_click",
|
|
@@ -1105,6 +1109,7 @@ describe("bundled computer-use skill", () => {
|
|
|
1105
1109
|
"computer_use_wait",
|
|
1106
1110
|
"computer_use_open_app",
|
|
1107
1111
|
"computer_use_run_applescript",
|
|
1112
|
+
"computer_use_sequence",
|
|
1108
1113
|
"computer_use_done",
|
|
1109
1114
|
"computer_use_respond",
|
|
1110
1115
|
]);
|