@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
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* memory-v2 static block, workspace top-level context, and Slack chronological
|
|
7
7
|
* snapshot — onto the compacted history before the turn continues. This hook
|
|
8
8
|
* is the memory system's home for that transform: it receives the message
|
|
9
|
-
* history plus the resolved runtime-injection options
|
|
10
|
-
* history
|
|
11
|
-
* closure state.
|
|
9
|
+
* history plus the resolved runtime-injection options on a single context,
|
|
10
|
+
* writes the edited history back onto that context, and has no dependency on
|
|
11
|
+
* the agent loop's closure state. The injection blocks the transform captures
|
|
12
|
+
* are not needed by the re-injection caller, so only the messages propagate.
|
|
12
13
|
*
|
|
13
14
|
* It re-applies the runtime injections via {@link applyRuntimeInjections} and
|
|
14
15
|
* re-tracks the memory graph's cached nodes against the re-injected history.
|
|
@@ -22,11 +23,14 @@
|
|
|
22
23
|
* something the generic loop should carry.
|
|
23
24
|
*/
|
|
24
25
|
|
|
26
|
+
import type { PluginHookFn } from "@vellumai/plugin-api";
|
|
27
|
+
|
|
28
|
+
import { getConfig } from "../../../../config/loader.js";
|
|
29
|
+
import { findConversationOrSubagent } from "../../../../daemon/conversation-registry.js";
|
|
25
30
|
import {
|
|
26
31
|
applyRuntimeInjections,
|
|
27
32
|
type InboundActorContext,
|
|
28
|
-
|
|
29
|
-
type RuntimeInjectionResult,
|
|
33
|
+
resolveTurnModelProfileLabel,
|
|
30
34
|
} from "../../../../daemon/conversation-runtime-assembly.js";
|
|
31
35
|
import {
|
|
32
36
|
resolveTrustClass,
|
|
@@ -37,9 +41,9 @@ import type { Message } from "../../../../providers/types.js";
|
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
43
|
* Everything the post-compaction hook needs, supplied by the agent loop from
|
|
40
|
-
* its own working state.
|
|
41
|
-
*
|
|
42
|
-
*
|
|
44
|
+
* its own working state. The loop seeds a context of this shape and threads it
|
|
45
|
+
* through the `post-compact` hook chain, reading the re-injected history back
|
|
46
|
+
* off it once the chain settles.
|
|
43
47
|
*
|
|
44
48
|
* The turn-identity fields are flat here: `conversationId` is the key the
|
|
45
49
|
* re-injection resolves the live conversation through (and the only one that,
|
|
@@ -50,7 +54,11 @@ import type { Message } from "../../../../providers/types.js";
|
|
|
50
54
|
* {@link getLiveGraphMemory} rather than threaded in.
|
|
51
55
|
*/
|
|
52
56
|
export interface PostCompactContext {
|
|
53
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Compacted message history to re-inject onto. The hook writes the
|
|
59
|
+
* re-injected result back onto this field once the transform settles, and
|
|
60
|
+
* the loop reads it from there.
|
|
61
|
+
*/
|
|
54
62
|
history: Message[];
|
|
55
63
|
/**
|
|
56
64
|
* Stable ID for the current request, forwarded onto the injector turn
|
|
@@ -81,21 +89,15 @@ export interface PostCompactContext {
|
|
|
81
89
|
*/
|
|
82
90
|
isNonInteractive: boolean;
|
|
83
91
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
92
|
+
* The turn's resolved inference-profile key, or `null` when the active
|
|
93
|
+
* profile is unchanged since the last notified one. The agent loop resolves
|
|
94
|
+
* it once at turn start (notifying the model only on change — a decision that
|
|
95
|
+
* flips mid-turn once the notification is persisted, so it cannot be
|
|
96
|
+
* re-derived) and hands it here; the hook renders the `model_profile:` label
|
|
97
|
+
* from it via {@link resolveTurnModelProfileLabel}, using the call site
|
|
98
|
+
* self-resolved from the live conversation.
|
|
88
99
|
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* The `model_profile:` turn-context label, or `null` when the active
|
|
92
|
-
* inference profile is unchanged since the last notified one. The agent loop
|
|
93
|
-
* resolves it once at turn start from config and the turn's profile override,
|
|
94
|
-
* and notifies the model only on change — a decision that flips mid-turn once
|
|
95
|
-
* the notification is persisted, so it cannot be re-derived. Handed to the
|
|
96
|
-
* hook here so re-injection re-emits the loop's turn-start value.
|
|
97
|
-
*/
|
|
98
|
-
modelProfile: string | null;
|
|
100
|
+
modelProfileKey: string | null;
|
|
99
101
|
/**
|
|
100
102
|
* Inbound actor identity and trust fields for the unified `<turn_context>`
|
|
101
103
|
* block, or `null` on guardian turns (which suppress the actor section). The
|
|
@@ -107,33 +109,56 @@ export interface PostCompactContext {
|
|
|
107
109
|
actorContext: InboundActorContext | null;
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
const postCompact: PluginHookFn<PostCompactContext> = async (ctx) => {
|
|
113
|
+
const {
|
|
114
|
+
history,
|
|
115
|
+
requestId,
|
|
116
|
+
conversationId,
|
|
117
|
+
trust,
|
|
118
|
+
isNonInteractive,
|
|
119
|
+
modelProfileKey,
|
|
120
|
+
actorContext,
|
|
121
|
+
} = ctx;
|
|
122
|
+
// Render the `model_profile:` label from the turn's resolved profile key,
|
|
123
|
+
// using the call site self-resolved from the live conversation — the same
|
|
124
|
+
// derivation the first-call user-prompt-submit assembly uses. Mid-loop
|
|
125
|
+
// re-injection always runs at `"full"` volume; only the orchestrator's
|
|
126
|
+
// post-rejection convergence re-injection ever downgrades the mode. The
|
|
116
127
|
// turn-identity fields the live conversation can't supply (`requestId`,
|
|
117
|
-
// `conversationId`, `trust`); `turnIndex` and `callSite`
|
|
118
|
-
// the live conversation so the re-injection matches the
|
|
119
|
-
// assembly.
|
|
128
|
+
// `conversationId`, `trust`) are forwarded; `turnIndex` and `callSite`
|
|
129
|
+
// self-resolve from the live conversation so the re-injection matches the
|
|
130
|
+
// turn's initial assembly.
|
|
131
|
+
const config = getConfig();
|
|
132
|
+
const conversation = findConversationOrSubagent(conversationId);
|
|
133
|
+
const modelProfile = resolveTurnModelProfileLabel(
|
|
134
|
+
modelProfileKey,
|
|
135
|
+
conversation?.currentCallSite ?? "mainAgent",
|
|
136
|
+
config.llm,
|
|
137
|
+
conversationId,
|
|
138
|
+
);
|
|
120
139
|
const result = await applyRuntimeInjections(history, {
|
|
121
|
-
|
|
140
|
+
isNonInteractive,
|
|
141
|
+
modelProfile,
|
|
142
|
+
actorContext,
|
|
143
|
+
mode: "full",
|
|
122
144
|
requestId,
|
|
123
145
|
conversationId,
|
|
124
146
|
trust,
|
|
125
147
|
});
|
|
148
|
+
// Write the re-injected history back onto the threaded context; the loop
|
|
149
|
+
// reads it from there once the hook settles.
|
|
150
|
+
ctx.history = result.messages;
|
|
126
151
|
// Re-track the nodes the memory graph last injected so they survive against
|
|
127
|
-
// the re-injected history. Untrusted actors
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
// cached-node state.
|
|
152
|
+
// the re-injected history. Untrusted actors never received a memory-graph
|
|
153
|
+
// injection, so there is nothing to re-track. The actor's trust class is
|
|
154
|
+
// derived from the turn's own trust context (the same value the injector
|
|
155
|
+
// chain resolves). The live graph handle is looked up from the plugin's own
|
|
156
|
+
// registry by the turn's conversation id — the same instance the turn's
|
|
157
|
+
// retrieval mutated, so re-tracking sees the real cached-node state.
|
|
134
158
|
const isTrustedActor = resolveTrustClass(trust) === "guardian";
|
|
135
|
-
if (isTrustedActor
|
|
159
|
+
if (isTrustedActor) {
|
|
136
160
|
getLiveGraphMemory(conversationId)?.retrackCachedNodes();
|
|
137
161
|
}
|
|
138
|
-
|
|
139
|
-
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export default postCompact;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Default `user-prompt-submit
|
|
3
|
-
*
|
|
2
|
+
* Default `user-prompt-submit` hook: prepares a turn's prompt before the first
|
|
3
|
+
* provider call by running memory-graph retrieval and then applying the
|
|
4
4
|
* runtime injections that assemble the turn.
|
|
5
5
|
*
|
|
6
6
|
* **Memory graph** via {@link ConversationGraphMemory.prepareMemory} —
|
|
@@ -22,75 +22,31 @@
|
|
|
22
22
|
* post-compaction hook, which re-applies the same injections after a mid-loop
|
|
23
23
|
* compaction.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
* ahead of
|
|
27
|
-
*
|
|
28
|
-
* transform that runs between the two moments. The `-temp` suffix marks this as
|
|
29
|
-
* a transitional staging point that folds into `user-prompt-submit` once
|
|
30
|
-
* compaction is cleared from the gap between the two call sites.
|
|
25
|
+
* Registered first in the `user-prompt-submit` chain, so it heads the chain
|
|
26
|
+
* ahead of history repair and title generation: those later hooks see the
|
|
27
|
+
* fully assembled, memory-injected history.
|
|
31
28
|
*/
|
|
32
29
|
|
|
33
|
-
import type {
|
|
34
|
-
|
|
30
|
+
import type {
|
|
31
|
+
PluginHookFn,
|
|
32
|
+
UserPromptSubmitContext,
|
|
33
|
+
} from "@vellumai/plugin-api";
|
|
35
34
|
|
|
36
35
|
import { getConfig } from "../../../../config/loader.js";
|
|
37
36
|
import { findConversationOrSubagent } from "../../../../daemon/conversation-registry.js";
|
|
38
37
|
import {
|
|
39
38
|
applyRuntimeInjections,
|
|
40
39
|
resolveTurnInboundActorContext,
|
|
40
|
+
resolveTurnModelProfileLabel,
|
|
41
41
|
type RuntimeInjectionResult,
|
|
42
42
|
} from "../../../../daemon/conversation-runtime-assembly.js";
|
|
43
|
-
import type { ServerMessage } from "../../../../daemon/message-protocol.js";
|
|
44
43
|
import type { MemoryRecalled } from "../../../../daemon/message-types/memory.js";
|
|
45
44
|
import { resolveTrustClass } from "../../../../daemon/trust-context.js";
|
|
46
45
|
import { updateMessageMetadata } from "../../../../memory/conversation-crud.js";
|
|
47
46
|
import { recordMemoryRecallLog } from "../../../../memory/memory-recall-log-store.js";
|
|
48
|
-
import
|
|
47
|
+
import { broadcastMessage } from "../../../../runtime/assistant-event-hub.js";
|
|
49
48
|
import type { GraphMemoryResult } from "../../../types.js";
|
|
50
49
|
|
|
51
|
-
/**
|
|
52
|
-
* Context threaded through the `user-prompt-submit-temp` hook. The
|
|
53
|
-
* conversation-scoped retrieval state (graph handle, abort signal, trust
|
|
54
|
-
* class) is self-resolved from the live conversation by id; the readonly
|
|
55
|
-
* fields here carry the event sink and the turn-start injection snapshot,
|
|
56
|
-
* while `latestMessages` straddles input and output — the loop seeds it with
|
|
57
|
-
* the pre-injection array and the hook overwrites it with the injected result.
|
|
58
|
-
*/
|
|
59
|
-
export interface MemoryRetrievalHookContext {
|
|
60
|
-
/** Event sink used by the graph retriever and `memory_recalled` emission. */
|
|
61
|
-
readonly onEvent: (msg: ServerMessage) => void;
|
|
62
|
-
/** Conversation the turn belongs to — keys the recall-log row. */
|
|
63
|
-
readonly conversationId: string;
|
|
64
|
-
/** User message the injected memory block is persisted onto. */
|
|
65
|
-
readonly userMessageId: string;
|
|
66
|
-
/** Turn-scoped logger for non-fatal persistence warnings. */
|
|
67
|
-
readonly logger: Logger;
|
|
68
|
-
/**
|
|
69
|
-
* Working message list for the turn. Seeded by the loop with the
|
|
70
|
-
* pre-injection messages and consumed as the retrieval input; the hook
|
|
71
|
-
* overwrites it with the fully injected result (the memory-graph block, when
|
|
72
|
-
* the actor is trusted, plus the runtime injections). Read back by the loop.
|
|
73
|
-
*/
|
|
74
|
-
latestMessages: Message[];
|
|
75
|
-
/**
|
|
76
|
-
* Stable ID for the current request, forwarded onto the injector turn
|
|
77
|
-
* context. The one turn-identity field the live conversation can't recover.
|
|
78
|
-
*/
|
|
79
|
-
readonly requestId: string | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* Whether the in-flight turn has no human present to answer clarification
|
|
82
|
-
* questions. Resolved once at turn start and threaded in so injection uses
|
|
83
|
-
* the turn-start snapshot rather than live state that can flip mid-turn.
|
|
84
|
-
*/
|
|
85
|
-
readonly isNonInteractive: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* The `model_profile:` turn-context label, or `null` when the active
|
|
88
|
-
* inference profile is unchanged since the last notified one. Resolved once
|
|
89
|
-
* at turn start, so it is threaded in rather than re-derived.
|
|
90
|
-
*/
|
|
91
|
-
readonly modelProfile: string | null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
50
|
/**
|
|
95
51
|
* Persist and broadcast the retrieval's side effects: the injected block on
|
|
96
52
|
* the user message's metadata (so it survives reloads), a recall-log row, and
|
|
@@ -99,7 +55,7 @@ export interface MemoryRetrievalHookContext {
|
|
|
99
55
|
*/
|
|
100
56
|
function recordRecallSideEffects(
|
|
101
57
|
graphResult: GraphMemoryResult,
|
|
102
|
-
ctx:
|
|
58
|
+
ctx: UserPromptSubmitContext,
|
|
103
59
|
): void {
|
|
104
60
|
// Persist the injected block text in message metadata so it survives
|
|
105
61
|
// conversation reloads (eviction, restart, fork). loadFromDb re-injects
|
|
@@ -174,7 +130,7 @@ function recordRecallSideEffects(
|
|
|
174
130
|
recency: c.recencyBoost,
|
|
175
131
|
})),
|
|
176
132
|
};
|
|
177
|
-
|
|
133
|
+
broadcastMessage(memoryRecalledEvent);
|
|
178
134
|
}
|
|
179
135
|
}
|
|
180
136
|
|
|
@@ -189,7 +145,7 @@ function recordRecallSideEffects(
|
|
|
189
145
|
*/
|
|
190
146
|
function persistInjectionBlocks(
|
|
191
147
|
blocks: RuntimeInjectionResult["blocks"],
|
|
192
|
-
ctx:
|
|
148
|
+
ctx: UserPromptSubmitContext,
|
|
193
149
|
): void {
|
|
194
150
|
if (
|
|
195
151
|
!blocks.unifiedTurnContext &&
|
|
@@ -243,13 +199,14 @@ function persistInjectionBlocks(
|
|
|
243
199
|
* into `prepareMemory`.
|
|
244
200
|
*/
|
|
245
201
|
const userPromptSubmitMemoryRetrieval: PluginHookFn<
|
|
246
|
-
|
|
202
|
+
UserPromptSubmitContext
|
|
247
203
|
> = async (ctx) => {
|
|
248
204
|
// The conversation-scoped retrieval state — graph handle, abort signal, and
|
|
249
205
|
// trust class — is resolved from the live conversation by id rather than
|
|
250
206
|
// threaded in, mirroring how `applyRuntimeInjections` self-resolves its
|
|
251
207
|
// per-turn inputs.
|
|
252
208
|
const conversation = findConversationOrSubagent(ctx.conversationId);
|
|
209
|
+
const config = getConfig();
|
|
253
210
|
const abortSignal = conversation?.abortController?.signal;
|
|
254
211
|
const isTrustedActor =
|
|
255
212
|
resolveTrustClass(conversation?.trustContext) === "guardian";
|
|
@@ -259,11 +216,15 @@ const userPromptSubmitMemoryRetrieval: PluginHookFn<
|
|
|
259
216
|
);
|
|
260
217
|
|
|
261
218
|
if (conversation && isTrustedActor && abortSignal) {
|
|
219
|
+
// Retrieval progress (`memory_status`) and the `memory_recalled` summary
|
|
220
|
+
// publish to the shared `broadcastMessage` hub — the sink every turn
|
|
221
|
+
// publisher converges to — rather than a threaded event callback. This
|
|
222
|
+
// keeps any raw client-emit capability off the hook contract.
|
|
262
223
|
const graphResult = await conversation.graphMemory.prepareMemory(
|
|
263
224
|
ctx.latestMessages,
|
|
264
|
-
|
|
225
|
+
config,
|
|
265
226
|
abortSignal,
|
|
266
|
-
|
|
227
|
+
broadcastMessage,
|
|
267
228
|
);
|
|
268
229
|
|
|
269
230
|
recordRecallSideEffects(graphResult, ctx);
|
|
@@ -300,14 +261,22 @@ const userPromptSubmitMemoryRetrieval: PluginHookFn<
|
|
|
300
261
|
// input — the Slack chronological transcript, the unified `<turn_context>`
|
|
301
262
|
// block, channel/voice/transport hints, and the turn's trust/index/call-site
|
|
302
263
|
// — from the live conversation, so we hand in only the request id and
|
|
303
|
-
// conversation id plus the
|
|
304
|
-
// (`isNonInteractive
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
//
|
|
264
|
+
// conversation id plus the field resolved once at turn start
|
|
265
|
+
// (`isNonInteractive`). The `model_profile` label is rendered here from the
|
|
266
|
+
// turn's resolved profile key, using the call site self-resolved from the
|
|
267
|
+
// live conversation. The unified `<turn_context>` actor input is
|
|
268
|
+
// self-resolved from the live conversation's trust context. This first-call
|
|
269
|
+
// assembly always runs at `"full"` volume; overflow reduction only downgrades
|
|
270
|
+
// the mode on later re-injection.
|
|
271
|
+
const modelProfile = resolveTurnModelProfileLabel(
|
|
272
|
+
ctx.modelProfileKey,
|
|
273
|
+
conversation?.currentCallSite ?? "mainAgent",
|
|
274
|
+
config.llm,
|
|
275
|
+
ctx.conversationId,
|
|
276
|
+
);
|
|
308
277
|
const injection = await applyRuntimeInjections(ctx.latestMessages, {
|
|
309
278
|
isNonInteractive: ctx.isNonInteractive,
|
|
310
|
-
modelProfile
|
|
279
|
+
modelProfile,
|
|
311
280
|
actorContext,
|
|
312
281
|
mode: "full",
|
|
313
282
|
requestId: ctx.requestId,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "default-memory-retrieval",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "First-party default plugin running memory-graph retrieval and runtime injection at the front of the user-prompt-submit chain.",
|
|
5
|
+
"private": true,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20.12.0"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"@vellumai/plugin-api": "^0.8.0"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* absolute paths or workspace-local copies — the TypeScript compiler erases
|
|
42
42
|
* them and they have no module-identity effect at runtime.
|
|
43
43
|
*
|
|
44
|
-
* See `
|
|
44
|
+
* See `plugins/README.md` for the full authoring contract and
|
|
45
45
|
* `assistant/examples/plugins/echo/` for a worked example.
|
|
46
46
|
*/
|
|
47
47
|
|
package/src/plugins/types.ts
CHANGED
|
@@ -317,12 +317,11 @@ export interface Injector {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
// ─── Model-visible capability slots ──────────────────────────────────────────
|
|
320
|
-
// Concrete shapes are defined by the tool/route
|
|
321
|
-
// contributions
|
|
322
|
-
//
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
// catalog-discoverable skills today.
|
|
320
|
+
// Concrete shapes are defined by the tool/route registries. Tool
|
|
321
|
+
// contributions use the canonical `Tool` interface; route contributions use
|
|
322
|
+
// the `SkillRoute` shape from the skill-route registry. Skills ship on disk
|
|
323
|
+
// inside an installed plugin (`plugins/<name>/skills/<id>/SKILL.md`) and are
|
|
324
|
+
// discovered by the skill catalog loader, so they need no contribution slot.
|
|
326
325
|
|
|
327
326
|
/**
|
|
328
327
|
* HTTP route registration contributed by a plugin. Plugins express routes as
|
|
@@ -336,49 +335,6 @@ export interface Injector {
|
|
|
336
335
|
*/
|
|
337
336
|
export type PluginRouteRegistration = SkillRoute;
|
|
338
337
|
|
|
339
|
-
/**
|
|
340
|
-
* A skill contributed by a plugin.
|
|
341
|
-
*
|
|
342
|
-
* When a plugin declares {@link Plugin.skills}, the bootstrap registers each
|
|
343
|
-
* entry into an in-memory side catalog that {@link loadSkillCatalog} merges
|
|
344
|
-
* into its output. The entry is then discoverable by the model's `skill_load`
|
|
345
|
-
* / `skill_execute` flow under `source: "plugin"` — the same code paths used
|
|
346
|
-
* for filesystem-backed skills.
|
|
347
|
-
*
|
|
348
|
-
* The fields mirror the subset of `SkillSummary` / `SkillDefinition` that
|
|
349
|
-
* makes sense for an in-memory contribution. Inline commands and reference
|
|
350
|
-
* files are out of scope for plugin skills in this PR — add them later if a
|
|
351
|
-
* real plugin needs them.
|
|
352
|
-
*/
|
|
353
|
-
export interface PluginSkillRegistration {
|
|
354
|
-
/** Stable skill id (kebab-case). Must be unique across the catalog. */
|
|
355
|
-
id: string;
|
|
356
|
-
/**
|
|
357
|
-
* Skill "name" as surfaced to the model. Matches the SKILL.md frontmatter
|
|
358
|
-
* `name` field for filesystem skills.
|
|
359
|
-
*/
|
|
360
|
-
name: string;
|
|
361
|
-
/**
|
|
362
|
-
* Human-readable display name shown in UI lists. Defaults to `name` when
|
|
363
|
-
* omitted — matches the filesystem-skill default.
|
|
364
|
-
*/
|
|
365
|
-
displayName?: string;
|
|
366
|
-
/** One-line description shown by `skill_load` / UI. */
|
|
367
|
-
description: string;
|
|
368
|
-
/** Full skill body returned when `skill_load` fires for this skill. */
|
|
369
|
-
body: string;
|
|
370
|
-
/** Optional emoji shown beside the skill in UI surfaces. */
|
|
371
|
-
emoji?: string;
|
|
372
|
-
/** Optional assistant feature-flag key — when set and the flag is OFF, the skill is filtered out. */
|
|
373
|
-
featureFlag?: string;
|
|
374
|
-
/** Compact routing cues injected into `<available_skills>` to guide selection. */
|
|
375
|
-
activationHints?: string[];
|
|
376
|
-
/** Conditions under which this skill should NOT be loaded. */
|
|
377
|
-
avoidWhen?: string[];
|
|
378
|
-
/** IDs of child skills that this skill includes (metadata-only, not auto-activated). */
|
|
379
|
-
includes?: string[];
|
|
380
|
-
}
|
|
381
|
-
|
|
382
338
|
// ─── Plugin ──────────────────────────────────────────────────────────────────
|
|
383
339
|
|
|
384
340
|
/**
|
|
@@ -420,8 +376,6 @@ export interface Plugin {
|
|
|
420
376
|
tools?: Tool[];
|
|
421
377
|
/** HTTP route registrations served by the assistant. */
|
|
422
378
|
routes?: PluginRouteRegistration[];
|
|
423
|
-
/** Skill registrations loaded at startup. */
|
|
424
|
-
skills?: PluginSkillRegistration[];
|
|
425
379
|
}
|
|
426
380
|
|
|
427
381
|
// ─── Errors ──────────────────────────────────────────────────────────────────
|
|
@@ -37,8 +37,7 @@ mock.module("../../../memory/db-connection.js", () => ({
|
|
|
37
37
|
}));
|
|
38
38
|
|
|
39
39
|
mock.module("../../../config/assistant-feature-flags.js", () => ({
|
|
40
|
-
isAssistantFeatureFlagEnabled: (
|
|
41
|
-
flag === "openai-compatible-endpoints",
|
|
40
|
+
isAssistantFeatureFlagEnabled: () => false,
|
|
42
41
|
}));
|
|
43
42
|
|
|
44
43
|
mock.module("../../../config/loader.js", () => ({
|
|
@@ -41,6 +41,15 @@ export interface CatalogModel {
|
|
|
41
41
|
longContextPricingThresholdTokens?: number;
|
|
42
42
|
longContextMode?: LongContextMode;
|
|
43
43
|
supportsThinking?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* When true, the model always reasons with adaptive (always-on) thinking and
|
|
46
|
+
* rejects an explicit `thinking: { type: "disabled" }` request (Anthropic
|
|
47
|
+
* 400s such calls). Clients hide the enable/disable thinking toggle for these
|
|
48
|
+
* models — effort stays adjustable — and the daemon drops a disabled thinking
|
|
49
|
+
* config (and any non-1 `temperature`, which adaptive mode also rejects)
|
|
50
|
+
* before dispatching. Implies `supportsThinking`.
|
|
51
|
+
*/
|
|
52
|
+
adaptiveThinkingOnly?: boolean;
|
|
44
53
|
supportsCaching?: boolean;
|
|
45
54
|
supportsVision?: boolean;
|
|
46
55
|
supportsToolUse?: boolean;
|
|
@@ -144,6 +153,24 @@ const RAW_PROVIDER_CATALOG: ProviderCatalogEntry[] = [
|
|
|
144
153
|
linkLabel: "Open Anthropic Console",
|
|
145
154
|
},
|
|
146
155
|
models: [
|
|
156
|
+
{
|
|
157
|
+
id: "claude-fable-5",
|
|
158
|
+
displayName: "Claude Fable 5",
|
|
159
|
+
contextWindowTokens: 1000000,
|
|
160
|
+
maxOutputTokens: 128000,
|
|
161
|
+
longContextPricingThresholdTokens: 200000,
|
|
162
|
+
supportsThinking: true,
|
|
163
|
+
adaptiveThinkingOnly: true,
|
|
164
|
+
supportsCaching: true,
|
|
165
|
+
supportsVision: true,
|
|
166
|
+
supportsToolUse: true,
|
|
167
|
+
pricing: {
|
|
168
|
+
inputPer1mTokens: 10,
|
|
169
|
+
outputPer1mTokens: 50,
|
|
170
|
+
cacheWritePer1mTokens: 12.5,
|
|
171
|
+
cacheReadPer1mTokens: 1,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
147
174
|
{
|
|
148
175
|
id: "claude-opus-4-8",
|
|
149
176
|
displayName: "Claude Opus 4.8",
|
|
@@ -720,6 +747,24 @@ const RAW_PROVIDER_CATALOG: ProviderCatalogEntry[] = [
|
|
|
720
747
|
// OpenRouter proxies anthropic/* through Anthropic's Messages API, so
|
|
721
748
|
// prompt caching and cache TTL metadata pass through unchanged and
|
|
722
749
|
// billing matches Anthropic's direct rates.
|
|
750
|
+
{
|
|
751
|
+
id: "anthropic/claude-fable-5",
|
|
752
|
+
displayName: "Claude Fable 5",
|
|
753
|
+
contextWindowTokens: 1000000,
|
|
754
|
+
maxOutputTokens: 128000,
|
|
755
|
+
longContextPricingThresholdTokens: 200000,
|
|
756
|
+
supportsThinking: true,
|
|
757
|
+
adaptiveThinkingOnly: true,
|
|
758
|
+
supportsCaching: true,
|
|
759
|
+
supportsVision: true,
|
|
760
|
+
supportsToolUse: true,
|
|
761
|
+
pricing: {
|
|
762
|
+
inputPer1mTokens: 10,
|
|
763
|
+
outputPer1mTokens: 50,
|
|
764
|
+
cacheWritePer1mTokens: 12.5,
|
|
765
|
+
cacheReadPer1mTokens: 1,
|
|
766
|
+
},
|
|
767
|
+
},
|
|
723
768
|
{
|
|
724
769
|
id: "anthropic/claude-opus-4.8",
|
|
725
770
|
displayName: "Claude Opus 4.8",
|
|
@@ -1167,7 +1212,6 @@ const RAW_PROVIDER_CATALOG: ProviderCatalogEntry[] = [
|
|
|
1167
1212
|
setupHint:
|
|
1168
1213
|
"Enter the base URL of your endpoint and at least one model identifier.",
|
|
1169
1214
|
apiKeyPlaceholder: "Your provider's API key",
|
|
1170
|
-
featureFlag: "openai-compatible-endpoints",
|
|
1171
1215
|
models: [],
|
|
1172
1216
|
defaultModel: "",
|
|
1173
1217
|
},
|
|
@@ -1227,3 +1271,15 @@ export function getCatalogProviderForModel(
|
|
|
1227
1271
|
);
|
|
1228
1272
|
return matches.length === 1 ? matches[0]?.id : undefined;
|
|
1229
1273
|
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Whether the given model only supports adaptive (always-on) thinking, driven
|
|
1277
|
+
* by the `adaptiveThinkingOnly` capability in the catalog. Matches the model ID
|
|
1278
|
+
* across every provider (a model carries the same id under each provider it is
|
|
1279
|
+
* offered by, e.g. `claude-fable-5` and OpenRouter's `anthropic/claude-fable-5`).
|
|
1280
|
+
*/
|
|
1281
|
+
export function isAdaptiveThinkingOnlyModel(modelId: string): boolean {
|
|
1282
|
+
return PROVIDER_CATALOG.some((p) =>
|
|
1283
|
+
p.models.some((m) => m.id === modelId && m.adaptiveThinkingOnly === true),
|
|
1284
|
+
);
|
|
1285
|
+
}
|
|
@@ -28,7 +28,6 @@ const log = getLogger("provider-registry");
|
|
|
28
28
|
|
|
29
29
|
const providers = new Map<string, Provider>();
|
|
30
30
|
const routingSources = new Map<string, "user-key" | "managed-proxy">();
|
|
31
|
-
const OPENAI_COMPATIBLE_ENDPOINTS_FLAG = "openai-compatible-endpoints";
|
|
32
31
|
const NATIVE_WEB_SEARCH_PROVIDER_IDS = new Set(["anthropic", "openai"]);
|
|
33
32
|
|
|
34
33
|
/** Per-connection provider cache, keyed by connection name and model. */
|
|
@@ -258,13 +257,6 @@ export async function resolveProviderFromConnection(
|
|
|
258
257
|
config: ProvidersConfig,
|
|
259
258
|
opts: { model?: string } = {},
|
|
260
259
|
): Promise<Provider | null> {
|
|
261
|
-
if (
|
|
262
|
-
connection.provider === "openai-compatible" &&
|
|
263
|
-
!isProviderFeatureFlagEnabled(OPENAI_COMPATIBLE_ENDPOINTS_FLAG, config)
|
|
264
|
-
) {
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
260
|
const model = opts.model ?? resolveModel(config, connection.provider);
|
|
269
261
|
const cacheKey = getConnectionProviderCacheKey(connection, model);
|
|
270
262
|
const cached = connectionProviders.get(cacheKey);
|
package/src/providers/retry.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
sleep,
|
|
15
15
|
} from "../util/retry.js";
|
|
16
16
|
import { resolveLogitBiasPreset } from "./inference/logit-bias.js";
|
|
17
|
+
import { isAdaptiveThinkingOnlyModel } from "./model-catalog.js";
|
|
17
18
|
import {
|
|
18
19
|
isThinkingConfigDisabled,
|
|
19
20
|
normalizeThinkingConfigForWire,
|
|
@@ -324,6 +325,18 @@ function normalizeSendMessageOptions(
|
|
|
324
325
|
}
|
|
325
326
|
}
|
|
326
327
|
|
|
328
|
+
// Claude Fable always reasons with adaptive thinking and rejects an explicit
|
|
329
|
+
// `thinking: { type: "disabled" }` (Anthropic 400s the request). Drop a
|
|
330
|
+
// disabled thinking config for these models so they fall back to their
|
|
331
|
+
// always-on adaptive thinking; effort and other params are unaffected.
|
|
332
|
+
if (
|
|
333
|
+
typeof nextConfig.model === "string" &&
|
|
334
|
+
isAdaptiveThinkingOnlyModel(nextConfig.model) &&
|
|
335
|
+
isThinkingConfigDisabled(nextConfig.thinking)
|
|
336
|
+
) {
|
|
337
|
+
delete nextConfig.thinking;
|
|
338
|
+
}
|
|
339
|
+
|
|
327
340
|
// thinking is Anthropic-specific on the wire; OpenRouter reads it as a
|
|
328
341
|
// signal for its unified reasoning parameter; Gemini reads `level` from it.
|
|
329
342
|
// Strip it for other providers.
|
|
@@ -405,15 +418,30 @@ function normalizeSendMessageOptions(
|
|
|
405
418
|
// strip `temperature` upstream; non-Anthropic OpenRouter reasoning
|
|
406
419
|
// models don't have this exact constraint).
|
|
407
420
|
const isThinkingTemperatureConflict = (() => {
|
|
408
|
-
|
|
409
|
-
|
|
421
|
+
const model = typeof nextConfig.model === "string" ? nextConfig.model : "";
|
|
422
|
+
// Claude Fable always reasons in adaptive mode, so the `temperature: 1`
|
|
423
|
+
// constraint applies even when no explicit `thinking` config is present
|
|
424
|
+
// (a disabled config was already dropped above). For every other model
|
|
425
|
+
// the constraint only applies when thinking is actually enabled.
|
|
426
|
+
if (!isAdaptiveThinkingOnlyModel(model)) {
|
|
427
|
+
if (nextConfig.thinking == null) {
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
if (isThinkingConfigDisabled(nextConfig.thinking)) {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
410
434
|
const temp = nextConfig.temperature;
|
|
411
|
-
if (typeof temp !== "number")
|
|
412
|
-
|
|
413
|
-
|
|
435
|
+
if (typeof temp !== "number") {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
if (temp === 1) {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
if (providerName === "anthropic") {
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
414
444
|
if (providerName === "openrouter") {
|
|
415
|
-
const model =
|
|
416
|
-
typeof nextConfig.model === "string" ? nextConfig.model : "";
|
|
417
445
|
return model.startsWith("anthropic/");
|
|
418
446
|
}
|
|
419
447
|
return false;
|