@vellumai/assistant 0.8.9 → 0.8.10-dev.202606092238.d04fd59
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/AGENTS.md +1 -1
- package/examples/plugins/echo/README.md +3 -3
- package/node_modules/@vellumai/skill-host-contracts/src/tool-types.ts +2 -0
- package/openapi.yaml +38 -12
- package/package.json +1 -1
- package/scripts/sync-llm-catalog.ts +2 -0
- package/src/__tests__/agent-loop-exit-reason.test.ts +19 -14
- package/src/__tests__/build-persisted-content.test.ts +75 -1
- package/src/__tests__/config-managed-gemini-defaults.test.ts +2 -46
- package/src/__tests__/context-overflow-reducer.test.ts +264 -124
- package/src/__tests__/context-window-manager-overflow-rung.test.ts +289 -0
- package/src/__tests__/conversation-agent-loop-overflow.test.ts +22 -22
- package/src/__tests__/conversation-agent-loop.test.ts +45 -37
- package/src/__tests__/conversation-fork-crud.test.ts +110 -0
- package/src/__tests__/conversation-provider-retry-repair.test.ts +16 -20
- package/src/__tests__/conversation-runtime-assembly.test.ts +118 -5
- package/src/__tests__/conversation-surfaces-app-control.test.ts +4 -1
- package/src/__tests__/conversation-tool-setup-app-refresh.test.ts +91 -142
- package/src/__tests__/conversation-tool-setup-skill-attribution.test.ts +116 -0
- package/src/__tests__/conversation-tool-setup-test-helpers.ts +98 -0
- package/src/__tests__/corrected-target.test.ts +93 -0
- package/src/__tests__/credential-execution-feature-gates.test.ts +3 -5
- package/src/__tests__/credential-security-invariants.test.ts +1 -0
- package/src/__tests__/embedding-managed-proxy-selection.test.ts +6 -40
- package/src/__tests__/external-plugin-loader.test.ts +0 -1
- package/src/__tests__/guardian-routing-invariants.test.ts +91 -0
- package/src/__tests__/history-repair-hook.test.ts +2 -0
- package/src/__tests__/host-app-control-proxy.test.ts +45 -0
- package/src/__tests__/llm-catalog-parity.test.ts +4 -0
- package/src/__tests__/memory-retrieval-hook.test.ts +29 -15
- package/src/__tests__/notification-decision-strategy.test.ts +3 -3
- package/src/__tests__/persistence-secret-redaction.test.ts +78 -0
- package/src/__tests__/plugin-bootstrap.test.ts +82 -73
- package/src/__tests__/plugin-tool-contribution.test.ts +7 -4
- package/src/__tests__/plugin-types.test.ts +0 -8
- package/src/__tests__/provider-catalog-visibility.test.ts +1 -9
- package/src/__tests__/retry-thinking-adaptive-only.test.ts +245 -0
- package/src/__tests__/server-history-render.test.ts +39 -0
- package/src/__tests__/skills.test.ts +123 -0
- package/src/__tests__/title-generate-hook.test.ts +2 -0
- package/src/__tests__/tool-audit-listener.test.ts +51 -0
- package/src/__tests__/tool-executor-lifecycle-events.test.ts +32 -0
- package/src/__tests__/tool-start-timestamp.test.ts +218 -0
- package/src/agent/loop.ts +26 -23
- package/src/api/events/tool-result.ts +9 -0
- package/src/api/events/tool-use-start.ts +7 -0
- package/src/api/responses/conversation-message.ts +91 -14
- package/src/approvals/guardian-request-resolvers.ts +26 -0
- package/src/cli/commands/channel-verification-sessions.ts +6 -6
- package/src/cli/commands/inference-providers.ts +0 -8
- package/src/cli/commands/plugins.ts +2 -2
- package/src/cli/lib/__tests__/install-from-github.test.ts +174 -18
- package/src/cli/lib/__tests__/plugin-catalog-cache.test.ts +1 -1
- package/src/cli/lib/__tests__/plugin-details.test.ts +1 -1
- package/src/cli/lib/__tests__/plugin-marketplace.test.ts +1 -1
- package/src/cli/lib/__tests__/search-plugins.test.ts +11 -11
- package/src/cli/lib/install-from-github.ts +130 -19
- package/src/cli/lib/plugin-catalog-cache.ts +1 -1
- package/src/cli/lib/plugin-details.ts +4 -4
- package/src/cli/lib/plugin-marketplace.ts +2 -2
- package/src/cli/lib/search-plugins.ts +6 -6
- package/src/config/bundled-skills/skill-management/SKILL.md +89 -1
- package/src/config/env-registry.ts +12 -0
- package/src/config/feature-flag-registry.json +0 -80
- package/src/config/loader.ts +5 -22
- package/src/config/seed-inference-profiles.ts +1 -1
- package/src/config/skills.ts +101 -47
- package/src/context/strip-injections.ts +7 -4
- package/src/daemon/conversation-agent-loop-handlers.ts +102 -6
- package/src/daemon/conversation-agent-loop.ts +134 -232
- package/src/daemon/conversation-runtime-assembly.ts +44 -8
- package/src/daemon/conversation-tool-setup.ts +9 -1
- package/src/daemon/external-plugins-bootstrap.ts +33 -87
- package/src/daemon/handlers/config-channels.ts +11 -2
- package/src/daemon/handlers/shared.ts +9 -1
- package/src/daemon/handlers/skills.ts +6 -2
- package/src/daemon/host-app-control-proxy.ts +72 -57
- package/src/daemon/message-protocol.ts +0 -7
- package/src/daemon/message-types/skills.ts +4 -0
- package/src/events/tool-audit-listener.ts +7 -1
- package/src/memory/__tests__/tool-invocation-test-helpers.ts +69 -0
- package/src/memory/conversation-crud.ts +44 -1
- package/src/memory/db-init.ts +4 -0
- package/src/memory/embedding-backend.ts +5 -22
- package/src/memory/memory-retrospective-startup-cleanup.ts +1 -1
- package/src/memory/migrations/275-tool-invocations-add-skill-id.test.ts +81 -0
- package/src/memory/migrations/275-tool-invocations-add-skill-id.ts +20 -0
- package/src/memory/migrations/276-tool-invocations-created-at-id-index.test.ts +68 -0
- package/src/memory/migrations/276-tool-invocations-created-at-id-index.ts +20 -0
- package/src/memory/migrations/index.ts +2 -0
- package/src/memory/schema/conversations.ts +3 -0
- package/src/memory/tool-execution-events-store.test.ts +162 -0
- package/src/memory/tool-execution-events-store.ts +73 -0
- package/src/memory/tool-usage-store.ts +4 -3
- package/src/memory/v2/__tests__/injected-block-slugs.test.ts +51 -0
- package/src/memory/v2/activation-store.ts +50 -1
- package/src/memory/v2/injected-block-slugs.ts +30 -0
- package/src/notifications/__tests__/copy-composer.test.ts +244 -0
- package/src/notifications/access-request-copy.ts +298 -0
- package/src/notifications/adapters/slack.ts +3 -3
- package/src/notifications/adapters/telegram.ts +2 -1
- package/src/notifications/copy-composer.ts +49 -267
- package/src/notifications/decision-engine.ts +16 -35
- package/src/notifications/home-feed-side-effect.ts +1 -6
- package/src/platform/client.ts +1 -3
- package/src/platform/feature-gate.ts +3 -12
- package/src/plugin-api/constants.ts +2 -0
- package/src/plugin-api/index.ts +34 -6
- package/src/plugin-api/types.ts +19 -0
- package/src/plugins/defaults/compaction/compact.ts +39 -1
- package/src/plugins/defaults/compaction/context-overflow-reducer.ts +240 -32
- package/src/plugins/defaults/compaction/corrected-target.ts +53 -0
- package/src/plugins/defaults/compaction/window-manager.ts +136 -0
- package/src/plugins/defaults/index.ts +24 -0
- package/src/plugins/defaults/memory-retrieval/hooks/post-compact.ts +68 -43
- package/src/plugins/defaults/memory-retrieval/hooks/{user-prompt-submit-temp.ts → user-prompt-submit.ts} +36 -67
- package/src/plugins/defaults/memory-retrieval/package.json +14 -0
- package/src/plugins/external-api.ts +1 -1
- package/src/plugins/types.ts +5 -51
- package/src/providers/inference/__tests__/base-url-route-validation.test.ts +1 -2
- package/src/providers/model-catalog.ts +57 -1
- package/src/providers/registry.ts +0 -8
- package/src/providers/retry.ts +35 -7
- package/src/runtime/routes/__tests__/acp-routes.test.ts +151 -0
- package/src/runtime/routes/__tests__/inference-provider-connection-routes.test.ts +0 -62
- package/src/runtime/routes/__tests__/plugins-routes.test.ts +4 -4
- package/src/runtime/routes/acp-routes.test.ts +106 -0
- package/src/runtime/routes/acp-routes.ts +248 -2
- package/src/runtime/routes/browser-tabs-routes.ts +1 -1
- package/src/runtime/routes/channel-verification-routes.ts +14 -5
- package/src/runtime/routes/chatgpt-subscription-auth-routes.ts +0 -14
- package/src/runtime/routes/inbound-stages/acl-enforcement.ts +33 -34
- package/src/runtime/routes/inference-provider-connection-routes.ts +0 -45
- package/src/runtime/routes/plugins-routes.ts +3 -3
- package/src/runtime/verification-outbound-actions.ts +147 -2
- package/src/runtime/verification-templates.ts +29 -3
- package/src/telemetry/types.ts +25 -1
- package/src/telemetry/usage-telemetry-reporter.test.ts +141 -7
- package/src/telemetry/usage-telemetry-reporter.ts +63 -7
- package/src/tools/executor.ts +4 -1
- package/src/tools/skills/load.ts +11 -6
- package/src/tools/terminal/safe-env.ts +1 -0
- package/src/tools/types.ts +10 -0
- package/src/__tests__/plugin-skill-contribution.test.ts +0 -355
- package/src/daemon/message-types/browser.ts +0 -10
- package/src/notifications/__tests__/emit-signal-home-feed.test.ts +0 -187
- package/src/plugins/plugin-skill-contributions.ts +0 -292
|
@@ -56,6 +56,12 @@ export function stripUserTextBlocksByPrefix(
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/** `<NOW.md>` scratchpad prefixes (current tag, pre-line-limit variant, legacy `<now_scratchpad>`) — shared with `stripNowScratchpad` so the two strip paths can't drift. */
|
|
60
|
+
export const NOW_SCRATCHPAD_STRIP_PREFIXES: InjectionMatcher[] = [
|
|
61
|
+
"<NOW.md Always keep this up to date",
|
|
62
|
+
"<now_scratchpad>",
|
|
63
|
+
];
|
|
64
|
+
|
|
59
65
|
/** Matchers stripped by the pipeline (order doesn't matter — single pass). */
|
|
60
66
|
const RUNTIME_INJECTION_PREFIXES: InjectionMatcher[] = [
|
|
61
67
|
"<channel_capabilities>",
|
|
@@ -100,10 +106,7 @@ const RUNTIME_INJECTION_PREFIXES: InjectionMatcher[] = [
|
|
|
100
106
|
"<active_workspace>",
|
|
101
107
|
"<active_dynamic_page>",
|
|
102
108
|
"<non_interactive_context>",
|
|
103
|
-
|
|
104
|
-
// variant that may linger in in-flight histories during a rolling deploy.
|
|
105
|
-
"<NOW.md Always keep this up to date",
|
|
106
|
-
"<now_scratchpad>", // backward-compat: strip legacy blocks from pre-rename history
|
|
109
|
+
...NOW_SCRATCHPAD_STRIP_PREFIXES,
|
|
107
110
|
"<knowledge_base>",
|
|
108
111
|
"<pkb>", // backward-compat: strip legacy tag from pre-rename history
|
|
109
112
|
"<system_reminder>",
|
|
@@ -282,6 +282,15 @@ export interface EventHandlerState {
|
|
|
282
282
|
* debounce so a mid-turn snapshot reflects what the user is watching live.
|
|
283
283
|
*/
|
|
284
284
|
currentMessageContent: ContentBlock[];
|
|
285
|
+
/**
|
|
286
|
+
* Per-thinking-block timing for the in-flight LLM call, in stream order:
|
|
287
|
+
* entry `i` is the `i`-th thinking block mirrored into `currentMessageContent`.
|
|
288
|
+
* `startedAt` is stamped when a thinking block opens; `completedAt` is the
|
|
289
|
+
* last reasoning delta fused into it. Used to stamp `_startedAt`/`_completedAt`
|
|
290
|
+
* onto the authoritative thinking blocks at `message_complete`, mirroring how
|
|
291
|
+
* tool calls persist timing. Reset alongside `currentMessageContent`.
|
|
292
|
+
*/
|
|
293
|
+
currentThinkingTimestamps: { startedAt: number; completedAt: number }[];
|
|
285
294
|
/**
|
|
286
295
|
* `seq` of the most recent streamed content delta mirrored into
|
|
287
296
|
* `currentMessageContent`. Recorded as the conversation's persisted `seq`
|
|
@@ -371,6 +380,7 @@ export function createEventHandlerState(): EventHandlerState {
|
|
|
371
380
|
pendingPartialFlushTimer: undefined,
|
|
372
381
|
pendingPartialFlushPromise: undefined,
|
|
373
382
|
currentMessageContent: [],
|
|
383
|
+
currentThinkingTimestamps: [],
|
|
374
384
|
lastPersistedContentSeq: undefined,
|
|
375
385
|
};
|
|
376
386
|
}
|
|
@@ -420,6 +430,37 @@ export function buildPersistedAssistantContent(
|
|
|
420
430
|
});
|
|
421
431
|
}
|
|
422
432
|
|
|
433
|
+
/**
|
|
434
|
+
* Stamp `_startedAt`/`_completedAt` onto the content's thinking blocks from the
|
|
435
|
+
* per-block timing captured while streaming, matched by position: the `i`-th
|
|
436
|
+
* thinking block in `content` takes `timings[i]`. The `_`-prefixed fields are
|
|
437
|
+
* vellum-internal metadata (never sent to providers), mirroring how tool calls
|
|
438
|
+
* persist timing; `renderHistoryContent` reads them back onto the wire schema's
|
|
439
|
+
* `startedAt`/`completedAt`.
|
|
440
|
+
*
|
|
441
|
+
* Timing is only captured when reasoning is streamed (`streamThinking`), so a
|
|
442
|
+
* turn with thinking disabled — or any block without a matching entry — is left
|
|
443
|
+
* unstamped and the UI hides its duration, exactly as a tool call with no
|
|
444
|
+
* timing does.
|
|
445
|
+
*/
|
|
446
|
+
export function stampThinkingTiming(
|
|
447
|
+
content: ContentBlock[],
|
|
448
|
+
timings: ReadonlyArray<{ startedAt: number; completedAt: number }>,
|
|
449
|
+
): ContentBlock[] {
|
|
450
|
+
if (timings.length === 0) return content;
|
|
451
|
+
let thinkingIdx = 0;
|
|
452
|
+
return content.map((block) => {
|
|
453
|
+
if (block.type !== "thinking") return block;
|
|
454
|
+
const timing = timings[thinkingIdx++];
|
|
455
|
+
if (!timing) return block;
|
|
456
|
+
return {
|
|
457
|
+
...block,
|
|
458
|
+
_startedAt: timing.startedAt,
|
|
459
|
+
_completedAt: timing.completedAt,
|
|
460
|
+
} as ContentBlock;
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
|
|
423
464
|
/** Append a streamed text chunk to `state.currentMessageContent`, fusing into tail text block. */
|
|
424
465
|
function appendTextToCurrentMessage(
|
|
425
466
|
state: EventHandlerState,
|
|
@@ -446,15 +487,19 @@ function appendThinkingToCurrentMessage(
|
|
|
446
487
|
thinking: string,
|
|
447
488
|
): void {
|
|
448
489
|
if (thinking.length === 0) return;
|
|
490
|
+
const now = Date.now();
|
|
449
491
|
const tail = state.currentMessageContent.at(-1);
|
|
450
492
|
if (tail && tail.type === "thinking") {
|
|
451
493
|
tail.thinking = tail.thinking + thinking;
|
|
494
|
+
const timing = state.currentThinkingTimestamps.at(-1);
|
|
495
|
+
if (timing) timing.completedAt = now;
|
|
452
496
|
} else {
|
|
453
497
|
state.currentMessageContent.push({
|
|
454
498
|
type: "thinking",
|
|
455
499
|
thinking,
|
|
456
500
|
signature: "",
|
|
457
501
|
});
|
|
502
|
+
state.currentThinkingTimestamps.push({ startedAt: now, completedAt: now });
|
|
458
503
|
}
|
|
459
504
|
}
|
|
460
505
|
|
|
@@ -465,6 +510,7 @@ function resetPartialPersistAccumulator(state: EventHandlerState): void {
|
|
|
465
510
|
state.pendingPartialFlushTimer = undefined;
|
|
466
511
|
}
|
|
467
512
|
state.currentMessageContent = [];
|
|
513
|
+
state.currentThinkingTimestamps = [];
|
|
468
514
|
state.lastPersistedContentSeq = undefined;
|
|
469
515
|
state.pendingPartialFlushPromise = undefined;
|
|
470
516
|
}
|
|
@@ -852,9 +898,14 @@ export function handleToolUse(
|
|
|
852
898
|
if (event.name === "app_create" || event.name === "app_refresh") {
|
|
853
899
|
state.appBuildToolUsedThisRun = true;
|
|
854
900
|
}
|
|
855
|
-
|
|
901
|
+
const startedAt = Date.now();
|
|
902
|
+
state.toolCallTimestamps.set(event.id, { startedAt });
|
|
856
903
|
state.currentToolUseId = event.id;
|
|
857
904
|
state.currentTurnToolUseIds.push(event.id);
|
|
905
|
+
// Stamp the start time onto the already-durable tool_use block so a snapshot
|
|
906
|
+
// fetched mid-tool (refresh / reconnect) carries it and clients can render a
|
|
907
|
+
// running timer without having seen the live `tool_use_start` event.
|
|
908
|
+
recordToolStartOnPersistedMessage(state, event.id, startedAt);
|
|
858
909
|
const statusText = computeToolUseStatusText(event.name, event.input);
|
|
859
910
|
deps.ctx.emitActivityState("tool_running", "tool_use_start", {
|
|
860
911
|
requestId: deps.reqId,
|
|
@@ -867,6 +918,7 @@ export function handleToolUse(
|
|
|
867
918
|
conversationId: deps.ctx.conversationId,
|
|
868
919
|
toolUseId: event.id,
|
|
869
920
|
messageId: state.lastAssistantMessageId,
|
|
921
|
+
startedAt,
|
|
870
922
|
});
|
|
871
923
|
// `message_complete` always precedes tool events (see handleMessageComplete),
|
|
872
924
|
// so this tool_use block is already durable in the assistant row. The
|
|
@@ -1248,8 +1300,9 @@ export async function handleToolResult(
|
|
|
1248
1300
|
});
|
|
1249
1301
|
|
|
1250
1302
|
// Record tool completion timestamp
|
|
1303
|
+
const completedAt = Date.now();
|
|
1251
1304
|
const ts = state.toolCallTimestamps.get(event.toolUseId);
|
|
1252
|
-
if (ts) ts.completedAt =
|
|
1305
|
+
if (ts) ts.completedAt = completedAt;
|
|
1253
1306
|
state.currentToolUseId = undefined;
|
|
1254
1307
|
|
|
1255
1308
|
// Capture risk metadata when present. autoApproved is true when the tool
|
|
@@ -1368,6 +1421,7 @@ export async function handleToolResult(
|
|
|
1368
1421
|
approvalReason: event.approvalReason,
|
|
1369
1422
|
riskThreshold: event.riskThreshold,
|
|
1370
1423
|
activityMetadata: event.activityMetadata,
|
|
1424
|
+
completedAt,
|
|
1371
1425
|
});
|
|
1372
1426
|
|
|
1373
1427
|
// Capture the seq synchronously (before the persist await) so it reflects the
|
|
@@ -1385,6 +1439,44 @@ export async function handleToolResult(
|
|
|
1385
1439
|
}
|
|
1386
1440
|
}
|
|
1387
1441
|
|
|
1442
|
+
/**
|
|
1443
|
+
* Stamp `_startedAt` onto the in-flight tool_use block in the persisted
|
|
1444
|
+
* assistant message the moment the tool begins. The block is already durable
|
|
1445
|
+
* (message_complete precedes tool events), so without this a `/messages`
|
|
1446
|
+
* snapshot fetched mid-tool would carry no start time and clients could not
|
|
1447
|
+
* render a running elapsed-time counter until the whole turn finished. The
|
|
1448
|
+
* full timing + risk annotation still happens in
|
|
1449
|
+
* `annotatePersistedAssistantMessage` once every tool in the turn completes.
|
|
1450
|
+
*/
|
|
1451
|
+
function recordToolStartOnPersistedMessage(
|
|
1452
|
+
state: EventHandlerState,
|
|
1453
|
+
toolUseId: string,
|
|
1454
|
+
startedAt: number,
|
|
1455
|
+
): void {
|
|
1456
|
+
const messageId = state.lastAssistantMessageId;
|
|
1457
|
+
if (!messageId) return;
|
|
1458
|
+
|
|
1459
|
+
const row = getMessageById(messageId);
|
|
1460
|
+
if (!row) return;
|
|
1461
|
+
|
|
1462
|
+
let content: ContentBlock[];
|
|
1463
|
+
try {
|
|
1464
|
+
content = JSON.parse(row.content) as ContentBlock[];
|
|
1465
|
+
} catch {
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
for (const block of content) {
|
|
1470
|
+
if (block.type !== "tool_use") continue;
|
|
1471
|
+
const rec = block as unknown as Record<string, unknown>;
|
|
1472
|
+
if (rec.id !== toolUseId) continue;
|
|
1473
|
+
if (rec._startedAt === startedAt) return;
|
|
1474
|
+
rec._startedAt = startedAt;
|
|
1475
|
+
updateMessageContent(messageId, JSON.stringify(content));
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1388
1480
|
/**
|
|
1389
1481
|
* After all tools for the current turn complete, fetch the persisted assistant
|
|
1390
1482
|
* message, annotate its tool_use blocks with timing and confirmation metadata,
|
|
@@ -1730,10 +1822,13 @@ export async function handleMessageComplete(
|
|
|
1730
1822
|
// redacted) via the shared helper. The partial-persist flush uses
|
|
1731
1823
|
// the same helper with `surfaces=[]` so a mid-turn snapshot lands in
|
|
1732
1824
|
// the same shape as the finalize.
|
|
1733
|
-
const contentForPersistence =
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1825
|
+
const contentForPersistence = stampThinkingTiming(
|
|
1826
|
+
buildPersistedAssistantContent(
|
|
1827
|
+
event.message.content as ContentBlock[],
|
|
1828
|
+
deps.ctx.currentTurnSurfaces,
|
|
1829
|
+
state.toolActivityMetadata,
|
|
1830
|
+
),
|
|
1831
|
+
state.currentThinkingTimestamps,
|
|
1737
1832
|
);
|
|
1738
1833
|
|
|
1739
1834
|
// The row was reserved at `llm_call_started` (with channel metadata
|
|
@@ -1766,6 +1861,7 @@ export async function handleMessageComplete(
|
|
|
1766
1861
|
// Reset the partial-persist mirror so subsequent calls in this turn
|
|
1767
1862
|
// start with an empty running view.
|
|
1768
1863
|
state.currentMessageContent = [];
|
|
1864
|
+
state.currentThinkingTimestamps = [];
|
|
1769
1865
|
state.lastPersistedContentSeq = undefined;
|
|
1770
1866
|
|
|
1771
1867
|
// ── Indexing + attention projection ──
|