Open History to see the last commit
1import { describe, expect, it } from "@effect/vitest";
2import {
3 ANTIGRAVITY_DEFAULT_MODEL,
4 AntigravitySettings,
5 ProviderDriverKind,
6 ProviderInstanceId,
7 ProviderSetupError,
8} from "@t3tools/contracts";
9import * as Deferred from "effect/Deferred";
10import * as Effect from "effect/Effect";
11import * as Fiber from "effect/Fiber";
12import * as Layer from "effect/Layer";
13import * as Ref from "effect/Ref";
14import * as Schema from "effect/Schema";
15import * as Stream from "effect/Stream";
16import * as TestClock from "effect/testing/TestClock";
17import * as EffectAcpErrors from "effect-acp/errors";
18import type * as EffectAcpSchema from "effect-acp/schema";
19
20import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
21import { ServerSettingsService } from "../../serverSettings.ts";
22import type { AcpSessionRuntimeStartResult } from "../acp/AcpSessionRuntime.ts";
23import {
24 buildAntigravityModelsFromSession,
25 makeAntigravityProvider,
26} from "./AntigravityProvider.ts";
27
28const decodeSettings = Schema.decodeSync(AntigravitySettings);
29const instanceId = ProviderInstanceId.make("antigravity-test");
30const driver = ProviderDriverKind.make("antigravity");
31
32const initializeResult = {
33 protocolVersion: 1,
34 agentCapabilities: {
35 loadSession: true,
36 promptCapabilities: { image: true, audio: true, embeddedContext: true },
37 sessionCapabilities: { list: {}, resume: {} },
38 },
39 authMethods: [{ id: "oauth-personal", name: "Log in with Google" }],
40 agentInfo: {
41 name: "antigravity-acp",
42 title: "Google Antigravity",
43 version: "agy_acp_server_20260818_01_RC01",
44 },
45} satisfies EffectAcpSchema.InitializeResponse;
46
47const modelOptions = [
48 { value: "gemini-3.8-flash-high", name: "Gemini 3.8 Flash (High)" },
49 { value: "gemini-3.8-flash-medium", name: "Gemini 3.8 Flash (Medium)" },
50 { value: "gemini-3.8-flash-low", name: "Gemini 3.8 Flash (Low)" },
51 { value: "gemini-3.7-flash-high", name: "Gemini 3.7 Flash (High)" },
52 { value: "gemini-3.7-flash-medium", name: "Gemini 3.7 Flash (Medium)" },
53 { value: "gemini-3.7-flash-low", name: "Gemini 3.7 Flash (Low)" },
54 { value: "gemini-3.6-flash-high", name: "Gemini 3.6 Flash (High)" },
55 { value: "gemini-3.6-flash-medium", name: "Gemini 3.6 Flash (Medium)" },
56 { value: "gemini-3.6-flash-low", name: "Gemini 3.6 Flash (Low)" },
57 { value: "gemini-pro-agent", name: "Gemini 3.1 Pro (High)" },
58 { value: "gemini-3.1-pro-low", name: "Gemini 3.1 Pro (Low)" },
59];
60
61const modelConfig = {
62 id: "model",
63 name: "Model",
64 category: "model",
65 type: "select",
66 currentValue: "gemini-3.7-flash-high",
67 options: modelOptions,
68} satisfies EffectAcpSchema.SessionConfigOption;
69
70const sessionSetupResult = {
71 sessionId: "session-1",
72 models: {
73 currentModelId: "gemini-3.7-flash-high",
74 availableModels: modelOptions.map((option) => ({ modelId: option.value, name: option.name })),
75 },
76 configOptions: [
77 modelConfig,
78 {
79 id: "mode",
80 name: "Session Mode",
81 category: "mode",
82 type: "select",
83 currentValue: "default",
84 options: [
85 { value: "default", name: "Default" },
86 { value: "yolo", name: "YOLO" },
87 ],
88 },
89 ],
90} satisfies EffectAcpSchema.NewSessionResponse;
91
92const started = {
93 sessionId: "session-1",
94 initializeResult,
95 sessionSetupResult,
96 modelConfigId: "model",
97} satisfies AcpSessionRuntimeStartResult;
98
99const commands = [
100 { name: "plan", description: "Create a plan", input: { hint: "What to plan" } },
101 { name: "logout", description: "Sign out of Google" },
102] satisfies ReadonlyArray<EffectAcpSchema.AvailableCommand>;
103
104const testLayer = Layer.merge(
105 Layer.mock(BackgroundPolicy.BackgroundPolicy)({
106 shouldRunScopeWork: () => Effect.succeed(false),
107 }),
108 ServerSettingsService.layerTest(),
109);
110
111type ProbeError = EffectAcpErrors.AcpError | ProviderSetupError;
112
113const makeHarness = Effect.fn("makeAntigravityProviderHarness")(function* (
114 options: { readonly enabled?: boolean; readonly safe?: boolean } = {},
115) {
116 const initialProbe = yield* Deferred.make<EffectAcpSchema.InitializeResponse, ProbeError>();
117 const probeCalls = yield* Ref.make(0);
118 const safetyCalls = yield* Ref.make(0);
119 const probe = yield* Ref.make<Effect.Effect<EffectAcpSchema.InitializeResponse, ProbeError>>(
120 Deferred.await(initialProbe),
121 );
122 const safety = yield* Ref.make<Effect.Effect<boolean>>(Effect.succeed(options.safe ?? true));
123 const provider = yield* makeAntigravityProvider(
124 decodeSettings({ enabled: options.enabled ?? true, customModels: ["do-not-seed-me"] }),
125 {
126 stampIdentity: (snapshot) => Effect.succeed({ ...snapshot, instanceId, driver }),
127 probe: Ref.update(probeCalls, (count) => count + 1).pipe(
128 Effect.andThen(Ref.get(probe)),
129 Effect.flatten,
130 ),
131 supportsTextGeneration: Ref.update(safetyCalls, (count) => count + 1).pipe(
132 Effect.andThen(Ref.get(safety)),
133 Effect.flatten,
134 ),
135 },
136 );
137 const initialUpdate = yield* Stream.toPull(
138 provider.snapshot.streamChanges.pipe(
139 Stream.filter((snapshot) => snapshot.installed || snapshot.status === "error"),
140 ),
141 );
142 const initialize = Deferred.succeed(initialProbe, initializeResult).pipe(
143 Effect.andThen(initialUpdate),
144 Effect.asVoid,
145 );
146 return {
147 provider,
148 probe,
149 probeCalls,
150 safety,
151 safetyCalls,
152 initialProbe,
153 initialUpdate,
154 initialize,
155 };
156});
157
158describe("Antigravity model catalog", () => {
159 it("keeps the captured personal catalog's IDs, labels, order, and selected default", () => {
160 const models = buildAntigravityModelsFromSession(sessionSetupResult);
161 expect(models.map((model) => [model.slug, model.name])).toEqual(
162 modelOptions.map((option) => [option.value, option.name]),
163 );
164 expect(models.filter((model) => model.isDefault).map((model) => model.slug)).toEqual([
165 "gemini-3.7-flash-high",
166 ]);
167 expect(
168 models
169 .filter((model) => model.aliases?.includes(ANTIGRAVITY_DEFAULT_MODEL))
170 .map((model) => model.slug),
171 ).toEqual(["gemini-3.7-flash-high"]);
172 expect(models.every((model) => model.capabilities?.optionDescriptors?.length === 0)).toBe(true);
173 expect(models.every((model) => !model.isCustom)).toBe(true);
174 });
175
176 it("uses legacy session models only when model config is absent", () => {
177 const fromLegacy = buildAntigravityModelsFromSession({
178 models: sessionSetupResult.models,
179 });
180 expect(fromLegacy).toEqual(buildAntigravityModelsFromSession(sessionSetupResult));
181 expect(
182 buildAntigravityModelsFromSession({
183 ...sessionSetupResult,
184 configOptions: [{ ...modelConfig, options: [] }],
185 }),
186 ).toEqual([]);
187 });
188
189 it("flattens native option groups without combining distinct model IDs", () => {
190 const models = buildAntigravityModelsFromSession({
191 configOptions: [
192 {
193 ...modelConfig,
194 currentValue: "gemini-pro-agent",
195 options: [
196 { group: "Flash", name: "Flash", options: [modelOptions[3]!, modelOptions[4]!] },
197 { group: "Pro", name: "Pro", options: [modelOptions[9]!, modelOptions[3]!] },
198 ],
199 },
200 ],
201 });
202 expect(models.map((model) => model.slug)).toEqual([
203 "gemini-3.7-flash-high",
204 "gemini-3.7-flash-medium",
205 "gemini-pro-agent",
206 ]);
207 expect(models.find((model) => model.isDefault)?.slug).toBe("gemini-pro-agent");
208 expect(models.find((model) => model.aliases?.includes(ANTIGRAVITY_DEFAULT_MODEL))?.slug).toBe(
209 "gemini-pro-agent",
210 );
211 });
212});
213
214it.layer(testLayer)("Antigravity provider snapshots", (it) => {
215 it.effect("does not probe or run helper safety checks while disabled", () =>
216 Effect.scoped(
217 Effect.gen(function* () {
218 const harness = yield* makeHarness({ enabled: false });
219 const snapshot = yield* harness.provider.snapshot.refresh;
220 expect(snapshot).toMatchObject({
221 enabled: false,
222 installed: false,
223 status: "disabled",
224 auth: { status: "unknown" },
225 models: [],
226 setup: { canAuthenticate: true, canInstall: true },
227 showInteractionModeToggle: false,
228 supportsConversationRollback: false,
229 supportsTextGeneration: false,
230 });
231 expect(yield* Ref.get(harness.probeCalls)).toBe(0);
232 expect(yield* Ref.get(harness.safetyCalls)).toBe(0);
233 }),
234 ),
235 );
236
237 it.effect("records explicit sign-in while disabled without starting a health probe", () =>
238 Effect.scoped(
239 Effect.gen(function* () {
240 const harness = yield* makeHarness({ enabled: false });
241 const signedIn = yield* Stream.toPull(
242 harness.provider.snapshot.streamChanges.pipe(
243 Stream.filter(
244 (snapshot) =>
245 snapshot.auth.status === "authenticated" && snapshot.slashCommands.length > 0,
246 ),
247 ),
248 );
249 yield* harness.provider.onSessionStarted(started);
250 yield* harness.provider.onAvailableCommands(commands);
251 const [snapshot] = yield* signedIn;
252 expect(snapshot).toMatchObject({
253 enabled: false,
254 installed: true,
255 status: "disabled",
256 auth: { status: "authenticated", type: "oauth-personal" },
257 workspaceSnapshots: [],
258 });
259 expect(snapshot.models).toEqual(buildAntigravityModelsFromSession(sessionSetupResult));
260 expect(snapshot.slashCommands).toEqual(commands);
261 expect((yield* harness.provider.snapshot.refresh).models).toEqual(snapshot.models);
262 expect(yield* Ref.get(harness.probeCalls)).toBe(0);
263 }),
264 ),
265 );
266
267 it.effect("publishes the configured sign-in method before any account is checked", () =>
268 Effect.scoped(
269 Effect.gen(function* () {
270 const provider = yield* makeAntigravityProvider(decodeSettings({ enabled: true }), {
271 stampIdentity: (snapshot) => Effect.succeed({ ...snapshot, instanceId, driver }),
272 probe: Effect.succeed(initializeResult),
273 supportsTextGeneration: Effect.succeed(true),
274 auth: { type: "gemini-api-key", label: "Gemini API key" },
275 });
276 expect((yield* provider.snapshot.getSnapshot).auth).toEqual({
277 status: "unknown",
278 type: "gemini-api-key",
279 });
280 }),
281 ),
282 );
283
284 it.effect("treats initialize as installation proof, not account or model discovery", () =>
285 Effect.scoped(
286 Effect.gen(function* () {
287 const harness = yield* makeHarness();
288 expect(yield* harness.provider.snapshot.getSnapshot).toMatchObject({
289 installed: false,
290 status: "warning",
291 auth: { status: "unknown" },
292 models: [],
293 });
294 yield* harness.initialize;
295 const snapshot = yield* harness.provider.snapshot.getSnapshot;
296 expect(snapshot).toMatchObject({
297 installed: true,
298 status: "warning",
299 version: "agy_acp_server_20260818_01_RC01",
300 auth: { status: "unknown" },
301 models: [],
302 });
303 expect(yield* Ref.get(harness.probeCalls)).toBe(1);
304 }),
305 ),
306 );
307
308 it.effect("publishes session metadata and native commands without another health probe", () =>
309 Effect.scoped(
310 Effect.gen(function* () {
311 const harness = yield* makeHarness();
312 yield* harness.initialize;
313 const nextReady = yield* Stream.toPull(
314 harness.provider.snapshot.streamChanges.pipe(
315 Stream.filter(
316 (snapshot) =>
317 snapshot.auth.status === "authenticated" && snapshot.slashCommands.length > 0,
318 ),
319 ),
320 );
321 yield* harness.provider.onSessionStarted(started, "/workspace");
322 yield* harness.provider.onAvailableCommands(commands, "/workspace");
323 const [snapshot] = yield* nextReady;
324 expect(snapshot).toMatchObject({
325 status: "ready",
326 auth: { status: "authenticated", type: "oauth-personal" },
327 supportsTextGeneration: true,
328 });
329 expect(snapshot.models).toEqual(buildAntigravityModelsFromSession(sessionSetupResult));
330 expect(snapshot.slashCommands).toEqual(commands);
331 expect((yield* harness.provider.snapshotForCwd("/workspace")).slashCommands).toEqual(
332 commands,
333 );
334 expect(yield* Ref.get(harness.probeCalls)).toBe(1);
335 }),
336 ),
337 );
338
339 it.effect("does not retain a disposable sign-in workspace", () =>
340 Effect.scoped(
341 Effect.gen(function* () {
342 const harness = yield* makeHarness();
343 yield* harness.initialize;
344 yield* harness.provider.onSessionStarted(started);
345 yield* harness.provider.onAvailableCommands(commands);
346 const snapshot = yield* harness.provider.snapshot.getSnapshot;
347 expect(snapshot.models).toHaveLength(11);
348 expect(snapshot.slashCommands).toEqual(commands);
349 expect(snapshot.workspaceSnapshots).toEqual([]);
350 }),
351 ),
352 );
353
354 it.effect("clears all account metadata on sign-out and authentication failure", () =>
355 Effect.scoped(
356 Effect.gen(function* () {
357 const harness = yield* makeHarness();
358 yield* harness.initialize;
359 for (const clear of [harness.provider.onSignedOut, harness.provider.onAuthRequired]) {
360 yield* harness.provider.onSessionStarted(started, "/workspace");
361 yield* harness.provider.onAvailableCommands(commands, "/workspace");
362 yield* clear;
363 expect(yield* harness.provider.snapshot.getSnapshot).toMatchObject({
364 installed: true,
365 status: "warning",
366 auth: { status: "unauthenticated" },
367 models: [],
368 slashCommands: [],
369 skills: [],
370 workspaceSnapshots: [],
371 supportsTextGeneration: false,
372 });
373 yield* harness.provider.onAvailableCommands(commands, "/workspace");
374 yield* harness.provider.onConfigOptionsUpdated([modelConfig]);
375 expect((yield* harness.provider.snapshotForCwd("/workspace")).slashCommands).toEqual([]);
376 expect((yield* harness.provider.snapshot.getSnapshot).models).toEqual([]);
377 }
378 const refreshed = yield* harness.provider.snapshot.refresh;
379 expect(refreshed.auth.status).toBe("unauthenticated");
380 expect(refreshed.supportsTextGeneration).toBe(false);
381 }),
382 ),
383 );
384
385 it.effect("replaces live model choices and accepts an empty catalog", () =>
386 Effect.scoped(
387 Effect.gen(function* () {
388 const harness = yield* makeHarness();
389 yield* harness.initialize;
390 yield* harness.provider.onSessionStarted(started, "/workspace");
391 yield* harness.provider.onAvailableCommands(commands, "/workspace");
392 const before = yield* harness.provider.snapshot.getSnapshot;
393 const configOptions = [
394 {
395 ...modelConfig,
396 currentValue: "gemini-3.8-flash-high",
397 options: modelOptions.slice(0, 3),
398 },
399 ];
400 const nextSnapshot = yield* Stream.toPull(
401 harness.provider.snapshot.streamChanges.pipe(
402 Stream.filter((snapshot) => snapshot.models.length === 3),
403 ),
404 );
405 yield* harness.provider.onConfigOptionsUpdated(configOptions);
406 expect((yield* nextSnapshot)[0]).toMatchObject({
407 models: buildAntigravityModelsFromSession({ configOptions }),
408 auth: before.auth,
409 workspaceSnapshots: before.workspaceSnapshots,
410 slashCommands: commands,
411 });
412 yield* harness.provider.onConfigOptionsUpdated([]);
413 expect((yield* harness.provider.snapshot.getSnapshot).models).toEqual([]);
414 }),
415 ),
416 );
417
418 it.effect("replaces one account's catalog instead of combining accounts", () =>
419 Effect.scoped(
420 Effect.gen(function* () {
421 const harness = yield* makeHarness();
422 yield* harness.initialize;
423 yield* harness.provider.onSessionStarted(started);
424 yield* harness.provider.onSignedOut;
425 yield* harness.provider.onSessionStarted({
426 ...started,
427 sessionSetupResult: {
428 sessionId: "new-account-session",
429 configOptions: [
430 { ...modelConfig, currentValue: "gemini-pro-agent", options: [modelOptions[9]!] },
431 ],
432 },
433 });
434 expect(
435 (yield* harness.provider.snapshot.getSnapshot).models.map((model) => model.slug),
436 ).toEqual(["gemini-pro-agent"]);
437 }),
438 ),
439 );
440
441 it.effect("retains known account metadata when a local health check fails", () =>
442 Effect.scoped(
443 Effect.gen(function* () {
444 const harness = yield* makeHarness();
445 yield* harness.initialize;
446 yield* harness.provider.onSessionStarted(started, "/workspace");
447 yield* harness.provider.onAvailableCommands(commands, "/workspace");
448 yield* Ref.set(
449 harness.probe,
450 Effect.fail(EffectAcpErrors.AcpRequestError.internalError("probe failed")),
451 );
452 const snapshot = yield* harness.provider.snapshot.refresh;
453 expect(snapshot).toMatchObject({
454 installed: true,
455 status: "error",
456 auth: { status: "authenticated" },
457 });
458 expect(snapshot.models).toEqual(buildAntigravityModelsFromSession(sessionSetupResult));
459 expect(snapshot.slashCommands).toEqual(commands);
460 expect(snapshot.workspaceSnapshots?.[0]?.cwd).toBe("/workspace");
461 }),
462 ),
463 );
464
465 it.effect("allows a slow packaged runtime health check to finish", () =>
466 Effect.scoped(
467 Effect.gen(function* () {
468 const harness = yield* makeHarness();
469 yield* harness.initialize;
470 const entered = yield* Deferred.make<void>();
471 const initialized = yield* Deferred.make<EffectAcpSchema.InitializeResponse>();
472 yield* Ref.set(
473 harness.probe,
474 Deferred.succeed(entered, undefined).pipe(Effect.andThen(Deferred.await(initialized))),
475 );
476
477 const refresh = yield* harness.provider.snapshot.refresh.pipe(Effect.forkChild);
478 yield* Deferred.await(entered);
479 yield* TestClock.adjust("47 seconds");
480 yield* Deferred.succeed(initialized, initializeResult);
481 const snapshot = yield* Fiber.join(refresh);
482
483 expect(snapshot).toMatchObject({
484 installed: true,
485 status: "warning",
486 auth: { status: "unknown" },
487 });
488 }),
489 ),
490 );
491
492 it.effect("closes a stalled health probe at its deadline", () =>
493 Effect.scoped(
494 Effect.gen(function* () {
495 const harness = yield* makeHarness();
496 yield* harness.initialize;
497 const entered = yield* Deferred.make<void>();
498 const closed = yield* Deferred.make<void>();
499 yield* Ref.set(
500 harness.probe,
501 Deferred.succeed(entered, undefined).pipe(
502 Effect.andThen(Effect.never),
503 Effect.ensuring(Deferred.succeed(closed, undefined)),
504 ),
505 );
506 const refresh = yield* harness.provider.snapshot.refresh.pipe(Effect.forkChild);
507 yield* Deferred.await(entered);
508 yield* TestClock.adjust("90 seconds");
509 const snapshot = yield* Fiber.join(refresh);
510 yield* Deferred.await(closed);
511 expect(snapshot.status).toBe("error");
512 expect(snapshot.message).toContain("90 seconds");
513 }),
514 ),
515 );
516
517 it.effect("distinguishes missing executables from a failed installed executable", () =>
518 Effect.scoped(
519 Effect.gen(function* () {
520 const harness = yield* makeHarness();
521 yield* harness.initialize;
522 const failures = [
523 {
524 error: new EffectAcpErrors.AcpSpawnError({ cause: { code: "ENOENT" } }),
525 installed: false,
526 },
527 {
528 error: new EffectAcpErrors.AcpSpawnError({ cause: { code: "EACCES" } }),
529 installed: true,
530 },
531 {
532 error: new ProviderSetupError({
533 instanceId,
534 operation: "resolve",
535 detail: "Antigravity is not installed.",
536 }),
537 installed: false,
538 },
539 ];
540 for (const { error, installed } of failures) {
541 yield* harness.provider.onSessionStarted(started, "/workspace");
542 yield* harness.provider.onAvailableCommands(commands, "/workspace");
543 yield* Ref.set(harness.probe, Effect.fail(error));
544 const snapshot = yield* harness.provider.snapshot.refresh;
545 expect(snapshot).toMatchObject({
546 installed,
547 status: "error",
548 auth: { status: "authenticated" },
549 });
550 expect(snapshot.models).toHaveLength(installed ? 11 : 0);
551 expect(snapshot.slashCommands).toHaveLength(installed ? 2 : 0);
552 expect(snapshot.workspaceSnapshots).toHaveLength(installed ? 1 : 0);
553 expect(snapshot.supportsTextGeneration).toBe(installed);
554 }
555 }),
556 ),
557 );
558
559 it.effect("does not let an old health result restore a signed-out account", () =>
560 Effect.scoped(
561 Effect.gen(function* () {
562 const harness = yield* makeHarness();
563 yield* harness.initialize;
564 yield* harness.provider.onSessionStarted(started);
565 const releaseProbe = yield* Deferred.make<EffectAcpSchema.InitializeResponse>();
566 const probeEntered = yield* Deferred.make<void>();
567 yield* Ref.set(
568 harness.probe,
569 Deferred.succeed(probeEntered, undefined).pipe(
570 Effect.andThen(Deferred.await(releaseProbe)),
571 ),
572 );
573 const refresh = yield* harness.provider.snapshot.refresh.pipe(Effect.forkChild);
574 yield* Deferred.await(probeEntered);
575 yield* harness.provider.onSignedOut;
576 yield* Deferred.succeed(releaseProbe, initializeResult);
577 const snapshot = yield* Fiber.join(refresh);
578 expect(snapshot).toMatchObject({
579 auth: { status: "unauthenticated" },
580 models: [],
581 supportsTextGeneration: false,
582 });
583 }),
584 ),
585 );
586
587 it.effect("exposes helper support only when the supplied safety check allows it", () =>
588 Effect.scoped(
589 Effect.gen(function* () {
590 const harness = yield* makeHarness({ safe: false });
591 yield* harness.initialize;
592 yield* harness.provider.onSessionStarted(started);
593 expect((yield* harness.provider.snapshot.getSnapshot).supportsTextGeneration).toBe(false);
594 yield* Ref.set(harness.safety, Effect.succeed(true));
595 yield* harness.provider.snapshot.refresh;
596 expect((yield* harness.provider.snapshot.getSnapshot).supportsTextGeneration).toBe(true);
597 }),
598 ),
599 );
600
601 it.effect("keeps discovered workspace skills through session and command updates", () =>
602 Effect.scoped(
603 Effect.gen(function* () {
604 const harness = yield* makeHarness();
605 yield* harness.initialize;
606 const skills = [
607 {
608 name: "deploy",
609 description: "Ship it",
610 path: "/workspace/.agent/skills/deploy",
611 enabled: true,
612 },
613 ];
614 const discovered = yield* harness.provider.snapshotForCwd("/workspace", skills);
615 expect(discovered.skills).toEqual(skills);
616 yield* harness.provider.onSessionStarted(started, "/workspace");
617 yield* harness.provider.onAvailableCommands(commands, "/workspace");
618 const after = yield* harness.provider.snapshot.getSnapshot;
619 expect(
620 after.workspaceSnapshots?.find((entry) => entry.cwd === "/workspace")?.skills,
621 ).toEqual(skills);
622 expect((yield* harness.provider.snapshotForCwd("/workspace")).skills).toEqual(skills);
623 }),
624 ),
625 );
626
627 it.effect("bounds workspace metadata without starting sessions for workspace lookup", () =>
628 Effect.scoped(
629 Effect.gen(function* () {
630 const harness = yield* makeHarness();
631 yield* harness.initialize;
632 yield* harness.provider.onSessionStarted(started);
633 for (let index = 0; index < 35; index++) {
634 yield* harness.provider.onAvailableCommands(commands, `/workspace-${index}`);
635 }
636 const snapshot = yield* harness.provider.snapshotForCwd("/workspace-34");
637 expect(snapshot.workspaceSnapshots).toHaveLength(32);
638 expect(snapshot.workspaceSnapshots?.[0]?.cwd).toBe("/workspace-3");
639 expect(snapshot.slashCommands).toEqual(commands);
640 expect(yield* Ref.get(harness.probeCalls)).toBe(1);
641 }),
642 ),
643 );
644});