@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.
Files changed (161) hide show
  1. package/AGENTS.md +1 -1
  2. package/examples/plugins/echo/README.md +3 -3
  3. package/node_modules/@vellumai/skill-host-contracts/src/tool-types.ts +2 -0
  4. package/openapi.yaml +38 -12
  5. package/package.json +1 -1
  6. package/scripts/sync-llm-catalog.ts +2 -0
  7. package/src/__tests__/agent-loop-exit-reason.test.ts +21 -15
  8. package/src/__tests__/approval-cascade.test.ts +1 -0
  9. package/src/__tests__/build-persisted-content.test.ts +75 -1
  10. package/src/__tests__/compaction-events.test.ts +1 -0
  11. package/src/__tests__/config-managed-gemini-defaults.test.ts +2 -46
  12. package/src/__tests__/context-overflow-reducer.test.ts +264 -124
  13. package/src/__tests__/context-window-manager-overflow-rung.test.ts +351 -0
  14. package/src/__tests__/conversation-abort-tool-results.test.ts +1 -0
  15. package/src/__tests__/conversation-agent-loop-inference-profile.test.ts +11 -0
  16. package/src/__tests__/conversation-agent-loop-overflow.test.ts +90 -49
  17. package/src/__tests__/conversation-agent-loop.test.ts +113 -64
  18. package/src/__tests__/conversation-confirmation-signals.test.ts +1 -0
  19. package/src/__tests__/conversation-fork-crud.test.ts +110 -0
  20. package/src/__tests__/conversation-process-callsite.test.ts +1 -0
  21. package/src/__tests__/conversation-provider-retry-repair.test.ts +48 -48
  22. package/src/__tests__/conversation-queue.test.ts +1 -0
  23. package/src/__tests__/conversation-runtime-assembly.test.ts +119 -8
  24. package/src/__tests__/conversation-slash-queue.test.ts +1 -0
  25. package/src/__tests__/conversation-slash-unknown.test.ts +1 -0
  26. package/src/__tests__/conversation-speed-override.test.ts +1 -0
  27. package/src/__tests__/conversation-surfaces-app-control.test.ts +4 -1
  28. package/src/__tests__/conversation-tool-setup-app-refresh.test.ts +91 -142
  29. package/src/__tests__/conversation-tool-setup-skill-attribution.test.ts +116 -0
  30. package/src/__tests__/conversation-tool-setup-test-helpers.ts +98 -0
  31. package/src/__tests__/conversation-workspace-cache-state.test.ts +1 -0
  32. package/src/__tests__/conversation-workspace-injection.test.ts +1 -0
  33. package/src/__tests__/conversation-workspace-tool-tracking.test.ts +1 -0
  34. package/src/__tests__/corrected-target.test.ts +93 -0
  35. package/src/__tests__/credential-execution-feature-gates.test.ts +3 -5
  36. package/src/__tests__/credential-security-invariants.test.ts +1 -0
  37. package/src/__tests__/embedding-managed-proxy-selection.test.ts +6 -40
  38. package/src/__tests__/external-plugin-loader.test.ts +0 -1
  39. package/src/__tests__/guardian-routing-invariants.test.ts +91 -0
  40. package/src/__tests__/history-repair-hook.test.ts +2 -0
  41. package/src/__tests__/host-app-control-proxy.test.ts +45 -0
  42. package/src/__tests__/llm-catalog-parity.test.ts +4 -0
  43. package/src/__tests__/memory-retrieval-hook.test.ts +29 -15
  44. package/src/__tests__/notification-decision-strategy.test.ts +3 -3
  45. package/src/__tests__/persistence-secret-redaction.test.ts +78 -0
  46. package/src/__tests__/plugin-bootstrap.test.ts +82 -73
  47. package/src/__tests__/plugin-tool-contribution.test.ts +7 -4
  48. package/src/__tests__/plugin-types.test.ts +0 -8
  49. package/src/__tests__/provider-catalog-visibility.test.ts +1 -9
  50. package/src/__tests__/retry-thinking-adaptive-only.test.ts +245 -0
  51. package/src/__tests__/server-history-render.test.ts +39 -0
  52. package/src/__tests__/skills.test.ts +123 -0
  53. package/src/__tests__/title-generate-hook.test.ts +2 -0
  54. package/src/__tests__/tool-audit-listener.test.ts +51 -0
  55. package/src/__tests__/tool-executor-lifecycle-events.test.ts +32 -0
  56. package/src/__tests__/tool-start-timestamp.test.ts +218 -0
  57. package/src/agent/loop.ts +26 -39
  58. package/src/api/events/tool-result.ts +9 -0
  59. package/src/api/events/tool-use-start.ts +7 -0
  60. package/src/api/responses/conversation-message.ts +91 -14
  61. package/src/approvals/guardian-request-resolvers.ts +26 -0
  62. package/src/cli/commands/channel-verification-sessions.ts +6 -6
  63. package/src/cli/commands/inference-providers.ts +0 -8
  64. package/src/cli/commands/plugins.ts +2 -2
  65. package/src/cli/lib/__tests__/install-from-github.test.ts +174 -18
  66. package/src/cli/lib/__tests__/plugin-catalog-cache.test.ts +1 -1
  67. package/src/cli/lib/__tests__/plugin-details.test.ts +1 -1
  68. package/src/cli/lib/__tests__/plugin-marketplace.test.ts +1 -1
  69. package/src/cli/lib/__tests__/search-plugins.test.ts +11 -11
  70. package/src/cli/lib/install-from-github.ts +130 -19
  71. package/src/cli/lib/plugin-catalog-cache.ts +1 -1
  72. package/src/cli/lib/plugin-details.ts +4 -4
  73. package/src/cli/lib/plugin-marketplace.ts +2 -2
  74. package/src/cli/lib/search-plugins.ts +6 -6
  75. package/src/config/bundled-skills/skill-management/SKILL.md +89 -1
  76. package/src/config/env-registry.ts +12 -0
  77. package/src/config/feature-flag-registry.json +0 -80
  78. package/src/config/loader.ts +5 -22
  79. package/src/config/seed-inference-profiles.ts +1 -1
  80. package/src/config/skills.ts +101 -47
  81. package/src/context/strip-injections.ts +7 -4
  82. package/src/daemon/conversation-agent-loop-handlers.ts +102 -6
  83. package/src/daemon/conversation-agent-loop.ts +126 -270
  84. package/src/daemon/conversation-runtime-assembly.ts +44 -8
  85. package/src/daemon/conversation-tool-setup.ts +9 -1
  86. package/src/daemon/conversation.ts +13 -0
  87. package/src/daemon/external-plugins-bootstrap.ts +33 -87
  88. package/src/daemon/handlers/config-channels.ts +11 -2
  89. package/src/daemon/handlers/shared.ts +9 -1
  90. package/src/daemon/handlers/skills.ts +6 -2
  91. package/src/daemon/host-app-control-proxy.ts +72 -57
  92. package/src/daemon/message-protocol.ts +0 -7
  93. package/src/daemon/message-types/skills.ts +4 -0
  94. package/src/events/tool-audit-listener.ts +7 -1
  95. package/src/memory/__tests__/tool-invocation-test-helpers.ts +69 -0
  96. package/src/memory/conversation-crud.ts +44 -1
  97. package/src/memory/db-init.ts +4 -0
  98. package/src/memory/embedding-backend.ts +5 -22
  99. package/src/memory/memory-retrospective-startup-cleanup.ts +1 -1
  100. package/src/memory/migrations/275-tool-invocations-add-skill-id.test.ts +81 -0
  101. package/src/memory/migrations/275-tool-invocations-add-skill-id.ts +20 -0
  102. package/src/memory/migrations/276-tool-invocations-created-at-id-index.test.ts +68 -0
  103. package/src/memory/migrations/276-tool-invocations-created-at-id-index.ts +20 -0
  104. package/src/memory/migrations/index.ts +2 -0
  105. package/src/memory/schema/conversations.ts +3 -0
  106. package/src/memory/tool-execution-events-store.test.ts +162 -0
  107. package/src/memory/tool-execution-events-store.ts +73 -0
  108. package/src/memory/tool-usage-store.ts +4 -3
  109. package/src/memory/v2/__tests__/injected-block-slugs.test.ts +51 -0
  110. package/src/memory/v2/activation-store.ts +50 -1
  111. package/src/memory/v2/injected-block-slugs.ts +30 -0
  112. package/src/notifications/__tests__/copy-composer.test.ts +244 -0
  113. package/src/notifications/access-request-copy.ts +298 -0
  114. package/src/notifications/adapters/slack.ts +3 -3
  115. package/src/notifications/adapters/telegram.ts +2 -1
  116. package/src/notifications/copy-composer.ts +49 -267
  117. package/src/notifications/decision-engine.ts +16 -35
  118. package/src/notifications/home-feed-side-effect.ts +1 -6
  119. package/src/platform/client.ts +1 -3
  120. package/src/platform/feature-gate.ts +3 -12
  121. package/src/plugin-api/constants.ts +2 -0
  122. package/src/plugin-api/index.ts +37 -6
  123. package/src/plugin-api/types.ts +75 -0
  124. package/src/plugins/defaults/compaction/compact.ts +39 -1
  125. package/src/plugins/defaults/compaction/context-overflow-reducer.ts +240 -32
  126. package/src/plugins/defaults/compaction/corrected-target.ts +53 -0
  127. package/src/plugins/defaults/compaction/window-manager.ts +195 -1
  128. package/src/plugins/defaults/index.ts +24 -0
  129. package/src/plugins/defaults/memory-retrieval/hooks/post-compact.ts +76 -112
  130. package/src/plugins/defaults/memory-retrieval/hooks/{user-prompt-submit-temp.ts → user-prompt-submit.ts} +36 -67
  131. package/src/plugins/defaults/memory-retrieval/package.json +14 -0
  132. package/src/plugins/external-api.ts +1 -1
  133. package/src/plugins/types.ts +5 -51
  134. package/src/providers/inference/__tests__/base-url-route-validation.test.ts +1 -2
  135. package/src/providers/model-catalog.ts +57 -1
  136. package/src/providers/registry.ts +0 -8
  137. package/src/providers/retry.ts +35 -7
  138. package/src/runtime/routes/__tests__/acp-routes.test.ts +151 -0
  139. package/src/runtime/routes/__tests__/inference-provider-connection-routes.test.ts +0 -62
  140. package/src/runtime/routes/__tests__/plugins-routes.test.ts +4 -4
  141. package/src/runtime/routes/acp-routes.test.ts +106 -0
  142. package/src/runtime/routes/acp-routes.ts +248 -2
  143. package/src/runtime/routes/browser-tabs-routes.ts +1 -1
  144. package/src/runtime/routes/channel-verification-routes.ts +14 -5
  145. package/src/runtime/routes/chatgpt-subscription-auth-routes.ts +0 -14
  146. package/src/runtime/routes/inbound-stages/acl-enforcement.ts +33 -34
  147. package/src/runtime/routes/inference-provider-connection-routes.ts +0 -45
  148. package/src/runtime/routes/plugins-routes.ts +3 -3
  149. package/src/runtime/verification-outbound-actions.ts +147 -2
  150. package/src/runtime/verification-templates.ts +29 -3
  151. package/src/telemetry/types.ts +25 -1
  152. package/src/telemetry/usage-telemetry-reporter.test.ts +141 -7
  153. package/src/telemetry/usage-telemetry-reporter.ts +63 -7
  154. package/src/tools/executor.ts +4 -1
  155. package/src/tools/skills/load.ts +11 -6
  156. package/src/tools/terminal/safe-env.ts +1 -0
  157. package/src/tools/types.ts +10 -0
  158. package/src/__tests__/plugin-skill-contribution.test.ts +0 -355
  159. package/src/daemon/message-types/browser.ts +0 -10
  160. package/src/notifications/__tests__/emit-signal-home-feed.test.ts +0 -187
  161. package/src/plugins/plugin-skill-contributions.ts +0 -292
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Shared scaffolding for conversation-tool-setup (createToolExecutor) tests.
3
+ *
4
+ * `installConversationToolSetupMocks()` mocks the side-effect modules that
5
+ * conversation-tool-setup.ts pulls in at import time. `mock.module` is
6
+ * process-global and order-sensitive: call it BEFORE the import statement for
7
+ * `../daemon/conversation-tool-setup.js`, mirroring how the test files
8
+ * sequence statements and imports.
9
+ *
10
+ * Test-machinery isolation (assistant/AGENTS.md): this helper's only runtime
11
+ * import is `bun:test`, and the mock factories return plain stub objects.
12
+ * Production types are referenced via `import type` only — a value import
13
+ * would pull those modules' import-time side effects into this helper.
14
+ */
15
+
16
+ import { mock } from "bun:test";
17
+
18
+ import type { ToolSetupContext } from "../daemon/conversation-tool-setup.js";
19
+ import type { SurfaceData, SurfaceType } from "../daemon/message-protocol.js";
20
+
21
+ /**
22
+ * Spies installed by {@link installConversationToolSetupMocks}. Shared across
23
+ * test files in the same process — clear them in `beforeEach` when asserting
24
+ * on call counts.
25
+ */
26
+ export const refreshSurfacesForAppSpy = mock(() => {});
27
+ export const broadcastMessageSpy = mock(() => {});
28
+ export const updatePublishedAppDeploymentSpy = mock(() => Promise.resolve());
29
+
30
+ /**
31
+ * Mock the modules whose import-time / call-time side effects must not run
32
+ * during conversation-tool-setup tests.
33
+ */
34
+ export function installConversationToolSetupMocks(): void {
35
+ mock.module("../runtime/assistant-event-hub.js", () => ({
36
+ broadcastMessage: broadcastMessageSpy,
37
+ }));
38
+
39
+ // Mock conversation-surfaces so refreshSurfacesForApp is captured.
40
+ mock.module("../daemon/conversation-surfaces.js", () => ({
41
+ refreshSurfacesForApp: refreshSurfacesForAppSpy,
42
+ surfaceProxyResolver: mock(() =>
43
+ Promise.resolve({ content: "", isError: false }),
44
+ ),
45
+ }));
46
+
47
+ // Mock published-app-updater to prevent real deployment calls.
48
+ mock.module("../services/published-app-updater.js", () => ({
49
+ updatePublishedAppDeployment: updatePublishedAppDeploymentSpy,
50
+ }));
51
+
52
+ // Mock browser-screencast registration (no-op).
53
+ mock.module("../tools/browser/browser-screencast.js", () => ({
54
+ registerConversationSender: mock(() => {}),
55
+ }));
56
+
57
+ // Stub app-store functions used by other modules (e.g. app-source-watcher,
58
+ // conversation-surfaces) so tool-side-effects' hooks can run without
59
+ // touching the real app store during tests.
60
+ mock.module("../memory/app-store.js", () => ({
61
+ getApp: mock(() => null),
62
+ getAppDirPath: mock(() => "/tmp/test-apps/dummy"),
63
+ isMultifileApp: mock(() => false),
64
+ getAppsDir: mock(() => "/tmp/test-apps"),
65
+ resolveAppIdByDirName: mock(() => null),
66
+ resolveAppIdFromPath: mock(() => null),
67
+ }));
68
+ }
69
+
70
+ /** Build a minimal ToolSetupContext stub. */
71
+ export function makeToolSetupContext(
72
+ overrides: Partial<ToolSetupContext> = {},
73
+ ): ToolSetupContext {
74
+ return {
75
+ conversationId: "conv-test",
76
+ currentRequestId: "req-1",
77
+ workingDir: "/tmp/test",
78
+ abortController: null,
79
+ traceEmitter: { emit: () => {} },
80
+ sendToClient: mock(() => {}),
81
+ pendingSurfaceActions: new Map(),
82
+ lastSurfaceAction: new Map(),
83
+ surfaceState: new Map<
84
+ string,
85
+ { surfaceType: SurfaceType; data: SurfaceData; title?: string }
86
+ >(),
87
+ surfaceUndoStacks: new Map(),
88
+ accumulatedSurfaceState: new Map(),
89
+ surfaceActionRequestIds: new Set<string>(),
90
+ currentTurnSurfaces: [],
91
+ isProcessing: () => false,
92
+ enqueueMessage: () => ({ queued: false, requestId: "r" }),
93
+ getQueueDepth: () => 0,
94
+ processMessage: async () => "",
95
+ withSurface: async <T>(_id: string, fn: () => T | Promise<T>) => fn(),
96
+ ...overrides,
97
+ };
98
+ }
@@ -147,6 +147,7 @@ mock.module("../plugins/defaults/compaction/window-manager.js", () => ({
147
147
  async maybeCompact() {
148
148
  return { compacted: false };
149
149
  }
150
+ resetOverflowRecovery() {}
150
151
  },
151
152
  createContextSummaryMessage: () => ({
152
153
  role: "user",
@@ -190,6 +190,7 @@ mock.module("../plugins/defaults/compaction/window-manager.js", () => ({
190
190
  async maybeCompact() {
191
191
  return { compacted: false };
192
192
  }
193
+ resetOverflowRecovery() {}
193
194
  },
194
195
  createContextSummaryMessage: () => ({
195
196
  role: "user",
@@ -187,6 +187,7 @@ mock.module("../plugins/defaults/compaction/window-manager.js", () => ({
187
187
  async maybeCompact() {
188
188
  return { compacted: false };
189
189
  }
190
+ resetOverflowRecovery() {}
190
191
  },
191
192
  createContextSummaryMessage: () => ({
192
193
  role: "user",
@@ -0,0 +1,93 @@
1
+ import { describe, expect, test } from "bun:test";
2
+
3
+ import { computeCorrectedOverflowTarget } from "../plugins/defaults/compaction/corrected-target.js";
4
+
5
+ describe("computeCorrectedOverflowTarget", () => {
6
+ test("lowers the target proportionally when the estimator under-counted", () => {
7
+ /**
8
+ * When the provider's actual token count exceeds the estimator's count,
9
+ * the target is scaled down by the estimation-error ratio so a re-estimate
10
+ * of the reduced history lands under the provider's real ceiling.
11
+ */
12
+ // GIVEN a preflight budget and an estimator that under-counted (185k vs 242k actual)
13
+ const preflightBudget = 162_000;
14
+ const actualTokens = 242_000;
15
+ const estimatedTokens = 185_000;
16
+
17
+ // WHEN computing the corrected target
18
+ const result = computeCorrectedOverflowTarget({
19
+ preflightBudget,
20
+ actualTokens,
21
+ estimatedTokens,
22
+ });
23
+
24
+ // THEN the target is the budget divided by the error ratio
25
+ const expectedRatio = actualTokens / estimatedTokens;
26
+ expect(result.targetTokens).toBe(
27
+ Math.floor(preflightBudget / expectedRatio),
28
+ );
29
+ // AND the ratio is surfaced for logging
30
+ expect(result.estimationErrorRatio).toBeCloseTo(expectedRatio, 10);
31
+ // AND the corrected target is below the nominal budget
32
+ expect(result.targetTokens).toBeLessThan(preflightBudget);
33
+ });
34
+
35
+ test("returns the preflight budget unchanged when the estimator did not under-count", () => {
36
+ /**
37
+ * If the estimator matched or over-counted the provider, no correction is
38
+ * applied and the nominal preflight budget is the target.
39
+ */
40
+ // GIVEN an actual count at or below the estimate
41
+ const preflightBudget = 162_000;
42
+
43
+ // WHEN computing the corrected target
44
+ const result = computeCorrectedOverflowTarget({
45
+ preflightBudget,
46
+ actualTokens: 180_000,
47
+ estimatedTokens: 185_000,
48
+ });
49
+
50
+ // THEN the target is the unchanged preflight budget and no ratio is reported
51
+ expect(result.targetTokens).toBe(preflightBudget);
52
+ expect(result.estimationErrorRatio).toBeNull();
53
+ });
54
+
55
+ test("falls back to the preflight budget when the actual count is unavailable", () => {
56
+ /**
57
+ * Proxy-rewrapped or unparseable rejections yield a null actual count; the
58
+ * correction is skipped rather than guessed.
59
+ */
60
+ // GIVEN a null actual token count
61
+ const preflightBudget = 162_000;
62
+
63
+ // WHEN computing the corrected target
64
+ const result = computeCorrectedOverflowTarget({
65
+ preflightBudget,
66
+ actualTokens: null,
67
+ estimatedTokens: 185_000,
68
+ });
69
+
70
+ // THEN the nominal budget is used with no ratio
71
+ expect(result.targetTokens).toBe(preflightBudget);
72
+ expect(result.estimationErrorRatio).toBeNull();
73
+ });
74
+
75
+ test("falls back to the preflight budget when the estimate is zero", () => {
76
+ /**
77
+ * A zero estimate would make the ratio undefined; guard against it.
78
+ */
79
+ // GIVEN a zero estimate
80
+ const preflightBudget = 162_000;
81
+
82
+ // WHEN computing the corrected target
83
+ const result = computeCorrectedOverflowTarget({
84
+ preflightBudget,
85
+ actualTokens: 242_000,
86
+ estimatedTokens: 0,
87
+ });
88
+
89
+ // THEN the nominal budget is used with no ratio
90
+ expect(result.targetTokens).toBe(preflightBudget);
91
+ expect(result.estimationErrorRatio).toBeNull();
92
+ });
93
+ });
@@ -157,7 +157,7 @@ describe("CES flags respect explicit false overrides", () => {
157
157
  // ---------------------------------------------------------------------------
158
158
 
159
159
  describe("CES flags do not affect unrelated flags", () => {
160
- test("enabling all CES flags does not change declared default-enabled flags", () => {
160
+ test("enabling all CES flags does not change other declared flags", () => {
161
161
  const overrides: Record<string, boolean> = {};
162
162
  for (const key of ALL_CES_FLAG_KEYS) {
163
163
  overrides[key] = true;
@@ -165,10 +165,8 @@ describe("CES flags do not affect unrelated flags", () => {
165
165
  setOverridesForTesting(overrides);
166
166
  const config = makeConfig();
167
167
 
168
- // account-deletion defaults to true in the registry and should stay true.
169
- expect(isAssistantFeatureFlagEnabled("account-deletion", config)).toBe(
170
- true,
171
- );
168
+ // auto-analyze defaults to false and should stay false.
169
+ expect(isAssistantFeatureFlagEnabled("auto-analyze", config)).toBe(false);
172
170
  });
173
171
 
174
172
  test("enabling all CES flags does not change unrelated fail-closed flags", () => {
@@ -231,6 +231,7 @@ describe("Invariant 2: no generic plaintext secret read API", () => {
231
231
  "ipc/skill-routes/providers.ts", // host.providers.secureKeys.getProviderKey IPC route (out-of-process SkillHost companion)
232
232
  "daemon/external-plugins-bootstrap.ts", // reads credentials at plugin init (manifest.requiresCredential) via the CES-mediated getSecureKeyAsync path
233
233
  "plugins/external-api.ts", // globalThis runtime bridge that exposes getSecureKeyAsync to dynamically-imported workspace plugins (compiled-binary plugin loading)
234
+ "plugin-api/index.ts", // public @vellumai/plugin-api surface re-exports getSecureKeyAsync to workspace plugins via the boot-time shim (same exposure as the external-api bridge, routed through the typed public package)
234
235
  "inbound/platform-callback-registration.ts", // managed credential lookup for platform base URL, assistant ID, and API key
235
236
  "tts/providers/elevenlabs-provider.ts", // ElevenLabs TTS API key lookup
236
237
  "tts/providers/deepgram-provider.ts", // Deepgram TTS API key lookup
@@ -2,8 +2,7 @@
2
2
  * Tests for managed proxy Gemini embedding backend selection.
3
3
  *
4
4
  * Verifies that selectEmbeddingBackend correctly routes through the
5
- * managed proxy when the feature flag is enabled and managed proxy
6
- * prerequisites are satisfied.
5
+ * managed proxy when managed proxy prerequisites are satisfied.
7
6
  */
8
7
 
9
8
  import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
@@ -42,13 +41,9 @@ mock.module("../security/secure-keys.js", () => ({
42
41
  },
43
42
  }));
44
43
 
45
- // Feature flag mock
46
- const mockFeatureFlags: Record<string, boolean> = {};
47
-
44
+ // Feature flag mock — always returns true (flag is GA'ed)
48
45
  mock.module("../config/assistant-feature-flags.js", () => ({
49
- isAssistantFeatureFlagEnabled: (key: string, _config: unknown) => {
50
- return mockFeatureFlags[key] ?? false;
51
- },
46
+ isAssistantFeatureFlagEnabled: () => true,
52
47
  }));
53
48
 
54
49
  import type { AssistantConfig } from "../config/types.js";
@@ -75,14 +70,6 @@ function disableManagedProxy() {
75
70
  mockAssistantApiKey = null;
76
71
  }
77
72
 
78
- function enableFlag() {
79
- mockFeatureFlags["managed-gemini-embeddings-enabled"] = true;
80
- }
81
-
82
- function disableFlag() {
83
- mockFeatureFlags["managed-gemini-embeddings-enabled"] = false;
84
- }
85
-
86
73
  function makeConfig(
87
74
  overrides: {
88
75
  provider?: string;
@@ -116,7 +103,6 @@ function makeConfig(
116
103
 
117
104
  beforeEach(() => {
118
105
  disableManagedProxy();
119
- disableFlag();
120
106
  mockProviderKeys = {};
121
107
  clearEmbeddingBackendCache();
122
108
  });
@@ -126,9 +112,8 @@ afterEach(() => {
126
112
  });
127
113
 
128
114
  describe("managed proxy Gemini embedding selection", () => {
129
- test("selects managed proxy Gemini when flag enabled and proxy context available", async () => {
115
+ test("selects managed proxy Gemini when proxy context available", async () => {
130
116
  enableManagedProxy();
131
- enableFlag();
132
117
  const config = makeConfig();
133
118
 
134
119
  const { backend, reason } = await selectEmbeddingBackend(config);
@@ -141,7 +126,6 @@ describe("managed proxy Gemini embedding selection", () => {
141
126
 
142
127
  test("managed proxy backend uses default 3072 dimensions when geminiDimensions not set", async () => {
143
128
  enableManagedProxy();
144
- enableFlag();
145
129
  const config = makeConfig();
146
130
 
147
131
  const { backend } = await selectEmbeddingBackend(config);
@@ -155,7 +139,6 @@ describe("managed proxy Gemini embedding selection", () => {
155
139
 
156
140
  test("managed proxy backend uses explicit geminiDimensions when set", async () => {
157
141
  enableManagedProxy();
158
- enableFlag();
159
142
  const config = makeConfig({ geminiDimensions: 768 });
160
143
 
161
144
  const { backend } = await selectEmbeddingBackend(config);
@@ -168,7 +151,6 @@ describe("managed proxy Gemini embedding selection", () => {
168
151
 
169
152
  test("managed proxy backend uses managedBaseUrl (not direct Google API)", async () => {
170
153
  enableManagedProxy();
171
- enableFlag();
172
154
  const config = makeConfig();
173
155
 
174
156
  const { backend } = await selectEmbeddingBackend(config);
@@ -179,32 +161,19 @@ describe("managed proxy Gemini embedding selection", () => {
179
161
  expect(managedBaseUrl).toBe(`${PLATFORM_BASE}/v1/runtime-proxy/gemini`);
180
162
  });
181
163
 
182
- test("falls back to local when flag is disabled (no managed proxy)", async () => {
183
- enableManagedProxy();
184
- disableFlag();
185
- const config = makeConfig();
186
-
187
- const { backend } = await selectEmbeddingBackend(config);
188
-
189
- // With auto and no provider keys, falls through to local
190
- expect(backend).not.toBeNull();
191
- expect(backend!.provider).toBe("local");
192
- });
193
-
194
164
  test("falls back to local when managed proxy context unavailable", async () => {
195
165
  disableManagedProxy();
196
- enableFlag();
197
166
  const config = makeConfig();
198
167
 
199
168
  const { backend } = await selectEmbeddingBackend(config);
200
169
 
170
+ // With auto and no provider keys or proxy, falls through to local
201
171
  expect(backend).not.toBeNull();
202
172
  expect(backend!.provider).toBe("local");
203
173
  });
204
174
 
205
175
  test("selects managed proxy when provider is explicitly gemini", async () => {
206
176
  enableManagedProxy();
207
- enableFlag();
208
177
  const config = makeConfig({ provider: "gemini" });
209
178
 
210
179
  const { backend } = await selectEmbeddingBackend(config);
@@ -217,7 +186,6 @@ describe("managed proxy Gemini embedding selection", () => {
217
186
 
218
187
  test("does not use managed proxy when provider is explicitly local", async () => {
219
188
  enableManagedProxy();
220
- enableFlag();
221
189
  const config = makeConfig({ provider: "local" });
222
190
 
223
191
  const { backend } = await selectEmbeddingBackend(config);
@@ -228,7 +196,6 @@ describe("managed proxy Gemini embedding selection", () => {
228
196
 
229
197
  test("does not use managed proxy when provider is explicitly openai", async () => {
230
198
  enableManagedProxy();
231
- enableFlag();
232
199
  mockProviderKeys[credentialKey("openai", "api_key")] = "user-openai-key";
233
200
  const config = makeConfig({ provider: "openai" });
234
201
 
@@ -238,9 +205,8 @@ describe("managed proxy Gemini embedding selection", () => {
238
205
  expect(backend!.provider).toBe("openai");
239
206
  });
240
207
 
241
- test("direct Gemini key still works when flag is off", async () => {
208
+ test("direct Gemini key still works without managed proxy", async () => {
242
209
  disableManagedProxy();
243
- disableFlag();
244
210
  mockProviderKeys[credentialKey("gemini", "api_key")] = "user-gemini-key";
245
211
  const config = makeConfig({ provider: "gemini" });
246
212
 
@@ -533,7 +533,6 @@ describe("loadExternalPlugin — end-to-end @vellumai/simple-memory", () => {
533
533
  "..",
534
534
  "..",
535
535
  "..",
536
- "experimental",
537
536
  "plugins",
538
537
  "simple-memory",
539
538
  );
@@ -1332,6 +1332,97 @@ describe("routing invariant: callback buttons route through canonical primitive"
1332
1332
  });
1333
1333
  });
1334
1334
 
1335
+ // ===========================================================================
1336
+ // SECTION 8b: route-owned (directResolve) confirmations resolve via the
1337
+ // channel/guardian-action path too.
1338
+ //
1339
+ // The ACP spawn/steer approval gate (acp-routes.ts, ATL-822) registers
1340
+ // pending confirmations with a `directResolve` callback rather than a
1341
+ // Conversation.prompter. The tool_approval resolver must fire that callback
1342
+ // directly; otherwise a guardian approval submitted over a channel never
1343
+ // reaches the waiting route and the spawn/resume hangs until timeout.
1344
+ // ===========================================================================
1345
+
1346
+ describe("routing invariant: directResolve interactions resolve via guardian decisions", () => {
1347
+ beforeEach(() => resetTables());
1348
+
1349
+ function registerDirectResolveInteraction(
1350
+ requestId: string,
1351
+ conversationId: string,
1352
+ ): string[] {
1353
+ const decisions: string[] = [];
1354
+ pendingInteractions.register(requestId, {
1355
+ conversationId,
1356
+ kind: "confirmation",
1357
+ confirmationDetails: {
1358
+ toolName: "acp_spawn",
1359
+ input: { agent: "claude", task: "t", cwd: "/work" },
1360
+ riskLevel: "high",
1361
+ executionTarget: "host",
1362
+ allowlistOptions: [],
1363
+ scopeOptions: [],
1364
+ persistentDecisionsAllowed: false,
1365
+ },
1366
+ directResolve: (d) => decisions.push(d),
1367
+ });
1368
+ return decisions;
1369
+ }
1370
+
1371
+ test("channel approval fires directResolve('allow') with no live Conversation", async () => {
1372
+ const req = createCanonicalGuardianRequest({
1373
+ kind: "tool_approval",
1374
+ sourceType: "channel",
1375
+ conversationId: "conv-acp",
1376
+ guardianExternalUserId: "guardian-1",
1377
+ guardianPrincipalId: TEST_PRINCIPAL_ID,
1378
+ toolName: "acp_spawn",
1379
+ expiresAt: Date.now() + 60_000,
1380
+ });
1381
+ // Deliberately no _conversationMocks entry: the prompter path would have
1382
+ // failed with conversation_not_found, proving directResolve is what runs.
1383
+ const decisions = registerDirectResolveInteraction(req.id, "conv-acp");
1384
+
1385
+ const result = await routeGuardianReply(
1386
+ replyCtx({
1387
+ messageText: "",
1388
+ callbackData: `apr:${req.id}:approve_once`,
1389
+ conversationId: "conv-acp",
1390
+ }),
1391
+ );
1392
+
1393
+ expect(result.decisionApplied).toBe(true);
1394
+ expect(decisions).toEqual(["allow"]);
1395
+ expect(pendingInteractions.get(req.id)).toBeUndefined();
1396
+ expect(getCanonicalGuardianRequest(req.id)!.status).toBe("approved");
1397
+ });
1398
+
1399
+ test("channel rejection fires directResolve('deny')", async () => {
1400
+ const req = createCanonicalGuardianRequest({
1401
+ kind: "tool_approval",
1402
+ sourceType: "channel",
1403
+ conversationId: "conv-acp",
1404
+ guardianExternalUserId: "guardian-1",
1405
+ guardianPrincipalId: TEST_PRINCIPAL_ID,
1406
+ toolName: "acp_spawn",
1407
+ expiresAt: Date.now() + 60_000,
1408
+ });
1409
+ const decisions = registerDirectResolveInteraction(req.id, "conv-acp");
1410
+
1411
+ const result = await routeGuardianReply(
1412
+ replyCtx({
1413
+ messageText: "",
1414
+ callbackData: `apr:${req.id}:reject`,
1415
+ conversationId: "conv-acp",
1416
+ }),
1417
+ );
1418
+
1419
+ expect(result.decisionApplied).toBe(true);
1420
+ expect(decisions).toEqual(["deny"]);
1421
+ expect(pendingInteractions.get(req.id)).toBeUndefined();
1422
+ expect(getCanonicalGuardianRequest(req.id)!.status).toBe("denied");
1423
+ });
1424
+ });
1425
+
1335
1426
  // ===========================================================================
1336
1427
  // SECTION 9: Destination hints do not bypass principal binding for tool_approval
1337
1428
  // ===========================================================================
@@ -42,6 +42,8 @@ function makeCtx(messages: Message[]): UserPromptSubmitContext {
42
42
  conversationId: "conv-test",
43
43
  userMessageId: "msg-test",
44
44
  requestId: "req-test",
45
+ modelProfileKey: null,
46
+ isNonInteractive: false,
45
47
  prompt: "",
46
48
  originalMessages: messages,
47
49
  latestMessages: messages,
@@ -372,6 +372,49 @@ describe("HostAppControlProxy", () => {
372
372
  proxy.dispose();
373
373
  });
374
374
 
375
+ test("non-start tool with mismatched target client is rejected", async () => {
376
+ mockActorMap.set("client-A", "user-1");
377
+ mockActorMap.set("client-B", "user-1");
378
+ const proxy = new HostAppControlProxy("conv-1");
379
+ const startCtrl = new AbortController();
380
+
381
+ const pStart = proxy.request(
382
+ "app_control_start",
383
+ { tool: "start", app: "com.example.editor" },
384
+ "conv-1",
385
+ startCtrl.signal,
386
+ "user-1",
387
+ "client-A",
388
+ );
389
+ proxy.resolve(
390
+ (sentMessages[0] as Record<string, unknown>).requestId as string,
391
+ payload({ pngBase64: PNG_A }),
392
+ );
393
+ await pStart;
394
+ sentMessages.length = 0;
395
+
396
+ const result = await proxy.request(
397
+ "app_control_type",
398
+ {
399
+ tool: "type",
400
+ app: "com.example.editor",
401
+ text: "hello",
402
+ },
403
+ "conv-1",
404
+ new AbortController().signal,
405
+ "user-1",
406
+ "client-B",
407
+ );
408
+
409
+ expect(result.isError).toBe(true);
410
+ expect(result.content).toContain("client-A");
411
+ expect(result.content).toContain("client-B");
412
+ expect(result.content).toContain("app_control_start");
413
+ expect(sentMessages).toHaveLength(0);
414
+
415
+ proxy.dispose();
416
+ });
417
+
375
418
  test("non-start tool with case-different but otherwise matching app is allowed", async () => {
376
419
  const proxy = new HostAppControlProxy("conv-1");
377
420
  const startCtrl = new AbortController();
@@ -1297,6 +1340,7 @@ describe("HostAppControlProxy", () => {
1297
1340
  _setActiveAppControlSession({
1298
1341
  conversationId: "conv-1",
1299
1342
  app: "com.example.app",
1343
+ targetClientId: "client-A",
1300
1344
  });
1301
1345
 
1302
1346
  const resultPromise = proxy.request(
@@ -1332,6 +1376,7 @@ describe("HostAppControlProxy", () => {
1332
1376
  _setActiveAppControlSession({
1333
1377
  conversationId: "conv-1",
1334
1378
  app: "com.example.app",
1379
+ targetClientId: "client-A",
1335
1380
  });
1336
1381
 
1337
1382
  const resultPromise = proxy.request(
@@ -53,6 +53,7 @@ interface ClientCatalogModel {
53
53
  longContextPricingThresholdTokens?: number;
54
54
  longContextMode?: "native-model" | "provider-request-option" | "unsupported";
55
55
  supportsThinking?: boolean;
56
+ adaptiveThinkingOnly?: boolean;
56
57
  supportsCaching?: boolean;
57
58
  supportsVision?: boolean;
58
59
  supportsToolUse?: boolean;
@@ -194,6 +195,9 @@ describe("LLM catalog parity: daemon vs client", () => {
194
195
  );
195
196
  expect(clientModel.longContextMode).toBe(daemonModel.longContextMode);
196
197
  expect(clientModel.supportsThinking).toBe(daemonModel.supportsThinking);
198
+ expect(clientModel.adaptiveThinkingOnly).toBe(
199
+ daemonModel.adaptiveThinkingOnly,
200
+ );
197
201
  expect(clientModel.supportsCaching).toBe(daemonModel.supportsCaching);
198
202
  expect(clientModel.supportsVision).toBe(daemonModel.supportsVision);
199
203
  expect(clientModel.supportsToolUse).toBe(daemonModel.supportsToolUse);