@vellumai/assistant 0.8.10-dev.202606110941.6cb149d → 0.8.10-dev.202606111245.be4218b

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
@@ -22223,6 +22223,22 @@ paths:
22223
22223
  - available
22224
22224
  category:
22225
22225
  type: string
22226
+ owner:
22227
+ type: object
22228
+ properties:
22229
+ kind:
22230
+ type: string
22231
+ enum:
22232
+ - skill
22233
+ - mcp
22234
+ - plugin
22235
+ - workspace
22236
+ id:
22237
+ type: string
22238
+ required:
22239
+ - kind
22240
+ - id
22241
+ additionalProperties: false
22226
22242
  origin:
22227
22243
  type: string
22228
22244
  const: vellum
@@ -22261,6 +22277,22 @@ paths:
22261
22277
  - available
22262
22278
  category:
22263
22279
  type: string
22280
+ owner:
22281
+ type: object
22282
+ properties:
22283
+ kind:
22284
+ type: string
22285
+ enum:
22286
+ - skill
22287
+ - mcp
22288
+ - plugin
22289
+ - workspace
22290
+ id:
22291
+ type: string
22292
+ required:
22293
+ - kind
22294
+ - id
22295
+ additionalProperties: false
22264
22296
  origin:
22265
22297
  type: string
22266
22298
  const: clawhub
@@ -22319,6 +22351,22 @@ paths:
22319
22351
  - available
22320
22352
  category:
22321
22353
  type: string
22354
+ owner:
22355
+ type: object
22356
+ properties:
22357
+ kind:
22358
+ type: string
22359
+ enum:
22360
+ - skill
22361
+ - mcp
22362
+ - plugin
22363
+ - workspace
22364
+ id:
22365
+ type: string
22366
+ required:
22367
+ - kind
22368
+ - id
22369
+ additionalProperties: false
22322
22370
  origin:
22323
22371
  type: string
22324
22372
  const: skillssh
@@ -22392,6 +22440,22 @@ paths:
22392
22440
  - available
22393
22441
  category:
22394
22442
  type: string
22443
+ owner:
22444
+ type: object
22445
+ properties:
22446
+ kind:
22447
+ type: string
22448
+ enum:
22449
+ - skill
22450
+ - mcp
22451
+ - plugin
22452
+ - workspace
22453
+ id:
22454
+ type: string
22455
+ required:
22456
+ - kind
22457
+ - id
22458
+ additionalProperties: false
22395
22459
  origin:
22396
22460
  type: string
22397
22461
  const: custom
@@ -22549,6 +22613,22 @@ paths:
22549
22613
  - available
22550
22614
  category:
22551
22615
  type: string
22616
+ owner:
22617
+ type: object
22618
+ properties:
22619
+ kind:
22620
+ type: string
22621
+ enum:
22622
+ - skill
22623
+ - mcp
22624
+ - plugin
22625
+ - workspace
22626
+ id:
22627
+ type: string
22628
+ required:
22629
+ - kind
22630
+ - id
22631
+ additionalProperties: false
22552
22632
  origin:
22553
22633
  type: string
22554
22634
  const: vellum
@@ -22772,6 +22852,22 @@ paths:
22772
22852
  - available
22773
22853
  category:
22774
22854
  type: string
22855
+ owner:
22856
+ type: object
22857
+ properties:
22858
+ kind:
22859
+ type: string
22860
+ enum:
22861
+ - skill
22862
+ - mcp
22863
+ - plugin
22864
+ - workspace
22865
+ id:
22866
+ type: string
22867
+ required:
22868
+ - kind
22869
+ - id
22870
+ additionalProperties: false
22775
22871
  origin:
22776
22872
  type: string
22777
22873
  const: custom
@@ -22939,6 +23035,22 @@ paths:
22939
23035
  - available
22940
23036
  category:
22941
23037
  type: string
23038
+ owner:
23039
+ type: object
23040
+ properties:
23041
+ kind:
23042
+ type: string
23043
+ enum:
23044
+ - skill
23045
+ - mcp
23046
+ - plugin
23047
+ - workspace
23048
+ id:
23049
+ type: string
23050
+ required:
23051
+ - kind
23052
+ - id
23053
+ additionalProperties: false
22942
23054
  origin:
22943
23055
  type: string
22944
23056
  const: vellum
@@ -22977,6 +23089,22 @@ paths:
22977
23089
  - available
22978
23090
  category:
22979
23091
  type: string
23092
+ owner:
23093
+ type: object
23094
+ properties:
23095
+ kind:
23096
+ type: string
23097
+ enum:
23098
+ - skill
23099
+ - mcp
23100
+ - plugin
23101
+ - workspace
23102
+ id:
23103
+ type: string
23104
+ required:
23105
+ - kind
23106
+ - id
23107
+ additionalProperties: false
22980
23108
  origin:
22981
23109
  type: string
22982
23110
  const: clawhub
@@ -23035,6 +23163,22 @@ paths:
23035
23163
  - available
23036
23164
  category:
23037
23165
  type: string
23166
+ owner:
23167
+ type: object
23168
+ properties:
23169
+ kind:
23170
+ type: string
23171
+ enum:
23172
+ - skill
23173
+ - mcp
23174
+ - plugin
23175
+ - workspace
23176
+ id:
23177
+ type: string
23178
+ required:
23179
+ - kind
23180
+ - id
23181
+ additionalProperties: false
23038
23182
  origin:
23039
23183
  type: string
23040
23184
  const: skillssh
@@ -23108,6 +23252,22 @@ paths:
23108
23252
  - available
23109
23253
  category:
23110
23254
  type: string
23255
+ owner:
23256
+ type: object
23257
+ properties:
23258
+ kind:
23259
+ type: string
23260
+ enum:
23261
+ - skill
23262
+ - mcp
23263
+ - plugin
23264
+ - workspace
23265
+ id:
23266
+ type: string
23267
+ required:
23268
+ - kind
23269
+ - id
23270
+ additionalProperties: false
23111
23271
  origin:
23112
23272
  type: string
23113
23273
  const: custom
@@ -23456,6 +23616,22 @@ paths:
23456
23616
  - available
23457
23617
  category:
23458
23618
  type: string
23619
+ owner:
23620
+ type: object
23621
+ properties:
23622
+ kind:
23623
+ type: string
23624
+ enum:
23625
+ - skill
23626
+ - mcp
23627
+ - plugin
23628
+ - workspace
23629
+ id:
23630
+ type: string
23631
+ required:
23632
+ - kind
23633
+ - id
23634
+ additionalProperties: false
23459
23635
  origin:
23460
23636
  type: string
23461
23637
  const: vellum
@@ -23494,6 +23670,22 @@ paths:
23494
23670
  - available
23495
23671
  category:
23496
23672
  type: string
23673
+ owner:
23674
+ type: object
23675
+ properties:
23676
+ kind:
23677
+ type: string
23678
+ enum:
23679
+ - skill
23680
+ - mcp
23681
+ - plugin
23682
+ - workspace
23683
+ id:
23684
+ type: string
23685
+ required:
23686
+ - kind
23687
+ - id
23688
+ additionalProperties: false
23497
23689
  origin:
23498
23690
  type: string
23499
23691
  const: clawhub
@@ -23552,6 +23744,22 @@ paths:
23552
23744
  - available
23553
23745
  category:
23554
23746
  type: string
23747
+ owner:
23748
+ type: object
23749
+ properties:
23750
+ kind:
23751
+ type: string
23752
+ enum:
23753
+ - skill
23754
+ - mcp
23755
+ - plugin
23756
+ - workspace
23757
+ id:
23758
+ type: string
23759
+ required:
23760
+ - kind
23761
+ - id
23762
+ additionalProperties: false
23555
23763
  origin:
23556
23764
  type: string
23557
23765
  const: skillssh
@@ -23625,6 +23833,22 @@ paths:
23625
23833
  - available
23626
23834
  category:
23627
23835
  type: string
23836
+ owner:
23837
+ type: object
23838
+ properties:
23839
+ kind:
23840
+ type: string
23841
+ enum:
23842
+ - skill
23843
+ - mcp
23844
+ - plugin
23845
+ - workspace
23846
+ id:
23847
+ type: string
23848
+ required:
23849
+ - kind
23850
+ - id
23851
+ additionalProperties: false
23628
23852
  origin:
23629
23853
  type: string
23630
23854
  const: custom
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/assistant",
3
- "version": "0.8.10-dev.202606110941.6cb149d",
3
+ "version": "0.8.10-dev.202606111245.be4218b",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,7 +13,7 @@
13
13
  * Sites not exercised here (`aborted_via_error`) require deeper provider
14
14
  * fakery and are best covered by integration tests.
15
15
  */
16
- import { afterEach, describe, expect, test } from "bun:test";
16
+ import { afterEach, beforeEach, describe, expect, test } from "bun:test";
17
17
 
18
18
  import type { PostCompactContext } from "@vellumai/plugin-api";
19
19
 
@@ -31,7 +31,10 @@ import {
31
31
  disposeContextWindowManager,
32
32
  getContextWindowManager,
33
33
  } from "../plugins/defaults/compaction/manager-store.js";
34
- import { registerPlugin } from "../plugins/registry.js";
34
+ import {
35
+ registerPlugin,
36
+ resetPluginRegistryForTests,
37
+ } from "../plugins/registry.js";
35
38
  import type {
36
39
  Message,
37
40
  Provider,
@@ -49,7 +52,7 @@ import type {
49
52
  let postCompactImpl:
50
53
  | ((input: PostCompactContext) => Promise<Message[]>)
51
54
  | null = null;
52
- registerPlugin({
55
+ const testPostCompactPlugin = {
53
56
  manifest: { name: "test-post-compact", version: "0.0.0" },
54
57
  hooks: {
55
58
  [HOOKS.POST_COMPACT]: async (input: PostCompactContext): Promise<void> => {
@@ -58,7 +61,7 @@ registerPlugin({
58
61
  : input.history;
59
62
  },
60
63
  },
61
- });
64
+ };
62
65
 
63
66
  // ---------------------------------------------------------------------------
64
67
  // Helpers (mirrored from agent-loop.test.ts so this file is self-contained)
@@ -169,6 +172,14 @@ function countExitEvents(events: AgentEvent[]): number {
169
172
  // ---------------------------------------------------------------------------
170
173
 
171
174
  describe("AgentLoop exit-reason instrumentation", () => {
175
+ // Reset the plugin registry to a known state so ambient registrations from
176
+ // other test files (e.g. the default plugins) cannot leak into the
177
+ // post-compact hook chain these tests drive.
178
+ beforeEach(() => {
179
+ resetPluginRegistryForTests();
180
+ registerPlugin(testPostCompactPlugin);
181
+ });
182
+
172
183
  afterEach(() => {
173
184
  disposeContextWindowManager("test-conversation");
174
185
  });
@@ -227,6 +238,41 @@ describe("AgentLoop exit-reason instrumentation", () => {
227
238
  expect(events[events.length - 1].type).toBe("agent_loop_exit");
228
239
  });
229
240
 
241
+ test("emits agent_loop_exit even when a stop hook throws", async () => {
242
+ // A third-party teardown hook that rejects must not suppress the terminal
243
+ // exit: the loop isolates the stop chain, logs the failure, and still emits
244
+ // `agent_loop_exit` exactly once with the real reason.
245
+ registerPlugin({
246
+ manifest: { name: "throwing-stop", version: "0.0.0" },
247
+ hooks: {
248
+ [HOOKS.STOP]: async (): Promise<void> => {
249
+ throw new Error("teardown boom");
250
+ },
251
+ },
252
+ });
253
+
254
+ const { provider } = createMockProvider([textResponse("Hi there!")]);
255
+ const loop = new AgentLoop({
256
+ provider: provider,
257
+ systemPrompt: "system prompt",
258
+ conversationId: "test-conversation",
259
+ });
260
+
261
+ const events: AgentEvent[] = [];
262
+ await loop.run({
263
+ requestId: "test-request",
264
+ messages: [userMessage],
265
+ onEvent: (e) => {
266
+ events.push(e);
267
+ },
268
+ trust: { sourceChannel: "vellum", trustClass: "unknown" },
269
+ });
270
+
271
+ expect(countExitEvents(events)).toBe(1);
272
+ expect(lastExitEvent(events)?.reason).toBe("no_tool_calls");
273
+ expect(events[events.length - 1].type).toBe("agent_loop_exit");
274
+ });
275
+
230
276
  test("emits continuation surface event and exits on max_tokens", async () => {
231
277
  const { provider } = createMockProvider([
232
278
  maxTokensResponse("Partial answer"),
@@ -6,6 +6,7 @@ import type {
6
6
  CheckpointInfo,
7
7
  } from "../agent/loop.js";
8
8
  import { AgentLoop } from "../agent/loop.js";
9
+ import type { StopContext } from "../plugin-api/types.js";
9
10
  import { REFUSAL_FALLBACK_TEXT } from "../plugins/defaults/empty-response/hooks/post-model-call.js";
10
11
  import { resetPluginRegistryAndRegisterDefaults } from "../plugins/defaults/index.js";
11
12
  import { registerPlugin } from "../plugins/registry.js";
@@ -544,11 +545,12 @@ describe("AgentLoop", () => {
544
545
  });
545
546
  });
546
547
 
547
- test("a stop-hook throw on a successful stop surfaces through the error path without re-entering the stop chain", async () => {
548
- // The error-stop recovery is confined to genuine provider rejections. A
549
- // throw from the success-path stop chain must not re-enter that chain (the
550
- // same hook would throw again and escape the loop, bypassing the generic
551
- // error handling) — it must fall through to the standard error path.
548
+ test("isolates a throwing stop hook on a successful stop and still emits the terminal exit", async () => {
549
+ // The `stop` chain is the loop's terminal teardown: a throwing teardown
550
+ // hook (e.g. a third-party plugin) is logged and contained, never escalated
551
+ // into a turn error. The turn's real outcome stands — a successful no-tool
552
+ // stop — and the terminal `agent_loop_exit` still fires so the run stays
553
+ // observable.
552
554
 
553
555
  // GIVEN a registered stop hook that always throws, and a provider that
554
556
  // returns a successful no-tool response (a successful stop)
@@ -581,11 +583,68 @@ describe("AgentLoop", () => {
581
583
  rejected = true;
582
584
  });
583
585
 
584
- // THEN the loop handled the throw via the error path (it did not reject),
585
- // surfaced exactly one error, and did not re-issue the call
586
+ // THEN the loop did not reject, did not re-issue the call, surfaced no
587
+ // error event, and still emitted the terminal exit with the real reason
586
588
  expect(rejected).toBe(false);
587
589
  expect(calls).toHaveLength(1);
588
- expect(events.filter((e) => e.type === "error")).toHaveLength(1);
590
+ expect(events.filter((e) => e.type === "error")).toHaveLength(0);
591
+ const exitEvents = events.filter((e) => e.type === "agent_loop_exit");
592
+ expect(exitEvents).toHaveLength(1);
593
+ expect(exitEvents[0]).toMatchObject({ reason: "no_tool_calls" });
594
+ });
595
+
596
+ test("fires the stop teardown chain on a checkpoint handoff without emitting agent_loop_exit", async () => {
597
+ // A handoff pauses this run so the orchestrator can drain a queued message,
598
+ // then re-enters with a fresh run. It still ends *this* turn, so the
599
+ // terminal `stop` chain must fire — that is what runs per-turn teardown
600
+ // (e.g. clearing the recovery bounds the post-model-call hooks set) before
601
+ // the queued message is processed. But `agent_loop_exit` must NOT be
602
+ // emitted, because the handoff is a control transfer, not a terminal exit.
603
+
604
+ // GIVEN a stop hook recording every exit reason it observes, and a provider
605
+ // whose first reply requests a tool so the loop reaches a checkpoint
606
+ const stopReasons: string[] = [];
607
+ registerPlugin({
608
+ manifest: { name: "recording-stop", version: "0.0.1" },
609
+ hooks: {
610
+ stop: async (ctx: StopContext) => {
611
+ stopReasons.push(ctx.exitReason);
612
+ },
613
+ },
614
+ });
615
+ const { provider } = createMockProvider([
616
+ toolUseResponse("t1", "read_file", { path: "/a.txt" }),
617
+ textResponse("never reached"),
618
+ ]);
619
+ const toolExecutor = async () => ({ content: "ok", isError: false });
620
+ const loop = new AgentLoop({
621
+ provider,
622
+ systemPrompt: "system",
623
+ conversationId: "test-conversation",
624
+ tools: dummyTools,
625
+ toolExecutor,
626
+ });
627
+ const events: AgentEvent[] = [];
628
+
629
+ // AND a checkpoint callback that hands off at the first opportunity
630
+ const onCheckpoint = (_info: CheckpointInfo): CheckpointDecision =>
631
+ "handoff";
632
+
633
+ // WHEN the loop runs and yields control at the checkpoint
634
+ const { exitReason } = await loop.run({
635
+ requestId: "test-request",
636
+ messages: [userMessage],
637
+ onEvent: collectEvents(events),
638
+ trust: { sourceChannel: "vellum", trustClass: "unknown" },
639
+ onCheckpoint,
640
+ });
641
+
642
+ // THEN the terminal stop chain fired exactly once with the handoff reason
643
+ // (teardown ran), the run reported the handoff, and no agent_loop_exit was
644
+ // emitted
645
+ expect(stopReasons).toEqual(["checkpoint_handoff"]);
646
+ expect(exitReason).toBe("handoff");
647
+ expect(events.filter((e) => e.type === "agent_loop_exit")).toHaveLength(0);
589
648
  });
590
649
 
591
650
  // 6. Abort signal — verify the loop respects AbortSignal