@vellumai/assistant 0.8.10-dev.202606101122.0de2aff → 0.8.10-dev.202606101324.2fc90b3

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/openapi.yaml CHANGED
@@ -24691,9 +24691,12 @@ paths:
24691
24691
  operationId: tools_get
24692
24692
  summary: List registered tools with metadata and schemas
24693
24693
  description:
24694
- "Return every registered tool. `tools` carries per-tool metadata (description, author-asserted risk level,
24695
- category, and contributing source: core, skill, plugin, or MCP server). `names`/`schemas` additionally cover
24696
- skill tools whose manifests are present but not yet loaded, for the permission-simulator catalog."
24694
+ "Return registered tools. Without `conversationId`, returns every tool in the global registry; `tools`
24695
+ carries per-tool metadata (description, author-asserted risk level, category, and contributing source: core,
24696
+ skill, plugin, or MCP server) and `names`/`schemas` additionally cover skill tools whose manifests are present
24697
+ but not yet loaded, for the permission-simulator catalog. With `conversationId`, scopes the result to the tools
24698
+ available to that conversation as of its most recent turn (including skill/MCP tools registered over its
24699
+ lifecycle); 404 if no such conversation is active."
24697
24700
  tags:
24698
24701
  - tools
24699
24702
  responses:
@@ -24747,6 +24750,13 @@ paths:
24747
24750
  - schemas
24748
24751
  - tools
24749
24752
  additionalProperties: false
24753
+ parameters:
24754
+ - name: conversationId
24755
+ in: query
24756
+ required: false
24757
+ schema:
24758
+ type: string
24759
+ description: When set, scope the tool inventory to this conversation's most recent turn instead of the global registry.
24750
24760
  /v1/tools/simulate-permission:
24751
24761
  post:
24752
24762
  operationId: tools_simulatepermission_post
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.8.10-dev.202606101122.0de2aff",
3
+ "version": "0.8.10-dev.202606101324.2fc90b3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -365,7 +365,7 @@ describe("AgentLoop exit-reason instrumentation", () => {
365
365
  });
366
366
 
367
367
  const onCheckpoint = (_info: CheckpointInfo): CheckpointDecision =>
368
- "budget";
368
+ "handoff";
369
369
 
370
370
  const events: AgentEvent[] = [];
371
371
  await loop.run({
@@ -380,42 +380,9 @@ describe("AgentLoop exit-reason instrumentation", () => {
380
380
  expect(countExitEvents(events)).toBe(0);
381
381
  });
382
382
 
383
- test("yields with 'budget' when the in-loop budget gate trips", async () => {
384
- // GIVEN a provider that calls a tool (reaching a checkpoint) before it
385
- // would continue with a text response.
386
- const { provider } = createMockProvider([
387
- toolUseResponse("t1", "read_file", { path: "/a.txt" }),
388
- textResponse("never reached"),
389
- ]);
390
- const toolExecutor = async () => ({ content: "ok", isError: false });
391
- const loop = new AgentLoop({
392
- provider: provider,
393
- systemPrompt: "system",
394
- conversationId: "test-conversation",
395
- tools: dummyTools,
396
- toolExecutor: toolExecutor,
397
- });
398
-
399
- // AND an effective context window so small that any real token estimate
400
- // of the running history exceeds the mid-loop threshold.
401
- // WHEN the loop checkpoints after the tool results land
402
- const result = await loop.run({
403
- messages: [userMessage],
404
- onEvent: () => {},
405
- trust: { sourceChannel: "vellum", trustClass: "unknown" },
406
- resolveContextWindow: () => ({
407
- maxInputTokens: 10,
408
- overflowRecovery: { enabled: true, safetyMarginRatio: 0 },
409
- }),
410
- });
411
-
412
- // THEN it yields for budget before issuing the next provider call.
413
- expect(result.exitReason).toBe("budget");
414
- });
415
-
416
- test("does not yield for budget when overflow recovery is disabled", async () => {
417
- // GIVEN the same tiny context window but overflow recovery disabled — the
418
- // agent-wake configuration, which must never yield for budget.
383
+ test("runs to a clean exit when overflow recovery is disabled", async () => {
384
+ // GIVEN a tiny context window but overflow recovery disabled — the
385
+ // agent-wake configuration, which must never compact mid-loop.
419
386
  const { provider } = createMockProvider([
420
387
  toolUseResponse("t1", "read_file", { path: "/a.txt" }),
421
388
  textResponse("done"),
@@ -440,8 +407,8 @@ describe("AgentLoop exit-reason instrumentation", () => {
440
407
  }),
441
408
  });
442
409
 
443
- // THEN it never yields for budget.
444
- expect(result.exitReason).not.toBe("budget");
410
+ // THEN it reaches a clean exit without pausing the loop.
411
+ expect(result.exitReason).toBeNull();
445
412
  });
446
413
 
447
414
  test("compacts in place and continues when the budget gate trips with a compaction hook", async () => {
@@ -485,52 +452,13 @@ describe("AgentLoop exit-reason instrumentation", () => {
485
452
  });
486
453
 
487
454
  // THEN the loop runs the compaction ceremony in place and continues to a
488
- // clean exit instead of yielding for budget. The durable commit is
489
- // signalled via a `compaction_completed` event rather than an injected hook.
455
+ // clean exit. The durable commit is signalled via a `compaction_completed`
456
+ // event rather than an injected hook.
490
457
  expect(events.some((event) => event.type === "compaction_completed")).toBe(
491
458
  true,
492
459
  );
493
460
  expect(reinjected).toBe(true);
494
- expect(result.exitReason).not.toBe("budget");
495
- });
496
-
497
- test("yields 'budget' when inline compaction reports exhausted", async () => {
498
- const { provider } = createMockProvider([
499
- toolUseResponse("t1", "read_file", { path: "/a.txt" }),
500
- textResponse("never reached"),
501
- ]);
502
- const toolExecutor = async () => ({ content: "ok", isError: false });
503
- const loop = new AgentLoop({
504
- provider: provider,
505
- systemPrompt: "system",
506
- conversationId: "test-conversation",
507
- tools: dummyTools,
508
- toolExecutor: toolExecutor,
509
- });
510
-
511
- postCompactImpl = async () => {
512
- throw new Error(
513
- "post-compaction re-injection must not run when exhausted",
514
- );
515
- };
516
-
517
- // WHEN compaction exhausts its retry budget
518
- const result = await loop.run({
519
- messages: [userMessage],
520
- onEvent: () => {},
521
- resolveContextWindow: () => ({
522
- maxInputTokens: 10,
523
- overflowRecovery: { enabled: true, safetyMarginRatio: 0 },
524
- }),
525
- compactInPlace: true,
526
- ...fakeCompaction("test-conversation", {
527
- compacted: false,
528
- exhausted: true,
529
- }),
530
- });
531
-
532
- // THEN the loop yields for budget so the orchestrator can escalate.
533
- expect(result.exitReason).toBe("budget");
461
+ expect(result.exitReason).toBeNull();
534
462
  });
535
463
 
536
464
  test("emits 'error' when provider throws an unhandled error", async () => {
@@ -313,85 +313,34 @@ describe("AgentLoop", () => {
313
313
  });
314
314
 
315
315
  // 5b. Reactive context-overflow recovery
316
- test("recovers from a context-overflow rejection by re-running the call", async () => {
316
+ //
317
+ // When recovery is enabled the loop calibrates the estimator from the
318
+ // rejection, loops back, and the budget gate forwards the overflow signal
319
+ // into the compaction plugin's reduction ladder. That manager-owned path —
320
+ // single-rung recovery, multi-rung escalation, and the terminal
321
+ // `context_too_large` / `budget_yield_unrecovered` exit on exhaustion — is
322
+ // exercised end-to-end against a manager harness in
323
+ // `conversation-agent-loop-overflow.test.ts`. Loop-level coverage against a
324
+ // manager-store stub lands with the suite migration.
325
+ test.todo(
326
+ "drives the reduction ladder on a context-overflow rejection",
327
+ () => {},
328
+ );
329
+
330
+ test("surfaces a context-overflow error when recovery is unavailable", async () => {
317
331
  /**
318
- * The provider rejects the first call with `context_too_large`; the loop
319
- * should calibrate the estimator from the error and re-run instead of
320
- * surfacing an error, succeeding on the retry.
332
+ * Overflow recovery is gated on the budget gate being active. When it is
333
+ * disabled (e.g. agent wakes pass `overflowRecovery.enabled = false`, or no
334
+ * context window resolves) there is no ladder to drive, so a context
335
+ * overflow surfaces as an error on the first call rather than looping.
321
336
  */
322
337
 
323
- // GIVEN a provider that rejects the first call as too large, then succeeds
338
+ // GIVEN a provider that rejects every call as too large and a loop with no
339
+ // overflow-recovery budget gate
324
340
  const { provider, calls } = createMockProvider([
325
341
  new ContextOverflowError("prompt is too long", "mock", {
326
342
  actualTokens: 250_000,
327
343
  }),
328
- textResponse("recovered"),
329
- ]);
330
- const loop = new AgentLoop({
331
- provider,
332
- systemPrompt: "system",
333
- conversationId: "test-conversation",
334
- });
335
- const events: AgentEvent[] = [];
336
-
337
- // WHEN the loop runs
338
- const { history } = await loop.run({
339
- messages: [userMessage],
340
- onEvent: collectEvents(events),
341
- trust: { sourceChannel: "vellum", trustClass: "unknown" },
342
- });
343
-
344
- // THEN the call was retried and the recovery response landed in history
345
- expect(calls).toHaveLength(2);
346
- expect(history).toHaveLength(2);
347
- expect(history[1].content).toEqual([{ type: "text", text: "recovered" }]);
348
-
349
- // AND no error event was emitted — the overflow was handled in-loop
350
- expect(events.filter((e) => e.type === "error")).toHaveLength(0);
351
- });
352
-
353
- test("surfaces the overflow error after exhausting reactive retries", async () => {
354
- /**
355
- * When every re-run still overflows, the loop must stop retrying after a
356
- * bounded number of attempts and surface the error rather than looping
357
- * forever.
358
- */
359
-
360
- // GIVEN a provider that rejects every call as too large
361
- const { provider, calls } = createMockProvider([
362
- new ContextOverflowError("prompt is too long", "mock", {
363
- actualTokens: 250_000,
364
- }),
365
- ]);
366
- const loop = new AgentLoop({
367
- provider,
368
- systemPrompt: "system",
369
- conversationId: "test-conversation",
370
- });
371
- const events: AgentEvent[] = [];
372
-
373
- // WHEN the loop runs
374
- await loop.run({
375
- messages: [userMessage],
376
- onEvent: collectEvents(events),
377
- trust: { sourceChannel: "vellum", trustClass: "unknown" },
378
- });
379
-
380
- // THEN it tried the initial call plus the bounded retries, then gave up
381
- expect(calls).toHaveLength(3);
382
- expect(events.filter((e) => e.type === "error")).toHaveLength(1);
383
- });
384
-
385
- test("does not retry an overflow with no recoverable token count", async () => {
386
- /**
387
- * Without a parseable actual-token count there is nothing to calibrate
388
- * against, so the loop surfaces the error immediately instead of
389
- * re-running blindly.
390
- */
391
-
392
- // GIVEN an overflow error carrying neither a typed count nor a parseable one
393
- const { provider, calls } = createMockProvider([
394
- new ContextOverflowError("context window exceeded", "mock"),
395
344
  ]);
396
345
  const loop = new AgentLoop({
397
346
  provider,
@@ -1137,7 +1086,7 @@ describe("AgentLoop", () => {
1137
1086
  toolExecutor: toolExecutor,
1138
1087
  });
1139
1088
 
1140
- const onCheckpoint = (): CheckpointDecision => "budget";
1089
+ const onCheckpoint = (): CheckpointDecision => "handoff";
1141
1090
 
1142
1091
  const { history } = await loop.run({
1143
1092
  messages: [userMessage],
@@ -1336,7 +1285,7 @@ describe("AgentLoop", () => {
1336
1285
  const onCheckpoint = (checkpoint: CheckpointInfo): CheckpointDecision => {
1337
1286
  checkpoints.push(checkpoint);
1338
1287
  // Yield on turn 3 (0-indexed)
1339
- return checkpoint.turnIndex === 3 ? "budget" : "continue";
1288
+ return checkpoint.turnIndex === 3 ? "handoff" : "continue";
1340
1289
  };
1341
1290
 
1342
1291
  const events: AgentEvent[] = [];
@@ -1409,7 +1358,7 @@ describe("AgentLoop", () => {
1409
1358
 
1410
1359
  const onCheckpoint = (checkpoint: CheckpointInfo): CheckpointDecision => {
1411
1360
  // Yield on the second turn (turnIndex 1)
1412
- return checkpoint.turnIndex === 1 ? "budget" : "continue";
1361
+ return checkpoint.turnIndex === 1 ? "handoff" : "continue";
1413
1362
  };
1414
1363
 
1415
1364
  const { history } = await loop.run({
@@ -123,7 +123,7 @@ mock.module(
123
123
  }),
124
124
  );
125
125
 
126
- mock.module("../daemon/context-overflow-policy.js", () => ({
126
+ mock.module("../plugins/defaults/compaction/overflow-policy.js", () => ({
127
127
  resolveOverflowAction: () => "fail_gracefully",
128
128
  }));
129
129