@osovv/vv-opencode 2.1.4 → 2.1.5
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/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/dist/commands/plugin-toggle.d.ts +16 -0
- package/dist/commands/plugin-toggle.js +33 -1
- package/dist/commands/plugin-toggle.js.map +1 -1
- package/dist/commands/preset.d.ts +8 -0
- package/dist/commands/preset.js +22 -1
- package/dist/commands/preset.js.map +1 -1
- package/dist/commands/role.js +29 -1
- package/dist/commands/role.js.map +1 -1
- package/dist/lib/rebind-request.d.ts +41 -0
- package/dist/lib/rebind-request.js +134 -0
- package/dist/lib/rebind-request.js.map +1 -0
- package/dist/plugins/system-context-injection/index.js +49 -9
- package/dist/plugins/system-context-injection/index.js.map +1 -1
- package/dist/runtime/context.d.ts +9 -11
- package/dist/runtime/context.js +97 -188
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/snapshot-config.d.ts +26 -0
- package/dist/runtime/snapshot-config.js +76 -2
- package/dist/runtime/snapshot-config.js.map +1 -1
- package/dist/runtime/snapshot-store.d.ts +38 -0
- package/dist/runtime/snapshot-store.js +150 -1
- package/dist/runtime/snapshot-store.js.map +1 -1
- package/dist/runtime/snapshots.d.ts +14 -37
- package/dist/runtime/snapshots.js +349 -562
- package/dist/runtime/snapshots.js.map +1 -1
- package/dist/runtime/types.d.ts +30 -71
- package/dist/runtime/types.js +20 -21
- package/dist/runtime/types.js.map +1 -1
- package/dist/tui/rebind/plugin.d.ts +22 -0
- package/dist/tui/rebind/plugin.js +101 -0
- package/dist/tui/rebind/plugin.js.map +1 -0
- package/dist/tui.js +7 -6
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
- package/schemas/vvoc/v3.json +1 -1
- package/templates/skills/vv-execute/references/tool-contracts.md +1 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// END_MODULE_MAP
|
|
18
18
|
//
|
|
19
19
|
// START_CHANGE_SUMMARY
|
|
20
|
-
// LAST_CHANGE: [C-
|
|
20
|
+
// LAST_CHANGE: [C-SNAPSHOT-ANCHORING-REDESIGN T-007 - Static primary guidance stays in the system prefix while the variable orchestration policy is injected at the tail of the last user message only, so a profile change does not invalidate the cached prefix and tool/assistant messages keep their provider payload shape.]
|
|
21
21
|
// END_CHANGE_SUMMARY
|
|
22
22
|
import { SystemPart } from "@opencode/ai";
|
|
23
23
|
import { Plugin } from "@opencode/plugin";
|
|
@@ -169,16 +169,23 @@ async function shouldInjectForAgent(agentName, knownSubagents, agentMode) {
|
|
|
169
169
|
}
|
|
170
170
|
return true;
|
|
171
171
|
}
|
|
172
|
-
/** Returns
|
|
173
|
-
function getSystemContextsForAgent(agentName
|
|
172
|
+
/** Returns the stable guidance injected into the system prefix for one agent. */
|
|
173
|
+
function getSystemContextsForAgent(agentName) {
|
|
174
174
|
if (agentName === EXPLORE_SUBAGENT) {
|
|
175
175
|
return EXPLORE_SYSTEM_CONTEXTS;
|
|
176
176
|
}
|
|
177
|
-
if (agentName === VV_CONTROLLER_AGENT) {
|
|
178
|
-
return [...UNIVERSAL_PRIMARY_SYSTEM_CONTEXTS, policy.controllerSystemContext];
|
|
179
|
-
}
|
|
180
177
|
return UNIVERSAL_PRIMARY_SYSTEM_CONTEXTS;
|
|
181
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Returns the variable orchestration policy for one agent, or undefined when the
|
|
181
|
+
* agent gets none. It is injected at the request tail, never into the system
|
|
182
|
+
* prefix, so changing the profile does not invalidate the cached prefix.
|
|
183
|
+
*/
|
|
184
|
+
function getTailPolicyForAgent(agentName, policy) {
|
|
185
|
+
if (agentName !== VV_CONTROLLER_AGENT)
|
|
186
|
+
return undefined;
|
|
187
|
+
return policy.controllerSystemContext;
|
|
188
|
+
}
|
|
182
189
|
// END_BLOCK_AGENT_FILTERS
|
|
183
190
|
// START_BLOCK_SYSTEM_CONTEXT_FORMATTING
|
|
184
191
|
/** Native system part text already carrying the context, if any. */
|
|
@@ -197,6 +204,35 @@ function appendSystemContexts(system, contexts) {
|
|
|
197
204
|
system.push(SystemPart.make(context));
|
|
198
205
|
}
|
|
199
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Append the variable orchestration policy to the tail of the request exactly
|
|
209
|
+
* once, but only when the last message is a user turn. The part is transient:
|
|
210
|
+
* it changes only the provider copy, so it never lands in stored history, and
|
|
211
|
+
* keeping it out of the system prefix means a profile change does not
|
|
212
|
+
* invalidate the cached prefix. Injecting into a tool or assistant message
|
|
213
|
+
* would corrupt the provider payload shape, and mid-turn continuation requests
|
|
214
|
+
* keep the guidance already delivered at the turn's user message.
|
|
215
|
+
*/
|
|
216
|
+
function appendTailContext(messages, context) {
|
|
217
|
+
if (messages.length === 0)
|
|
218
|
+
return;
|
|
219
|
+
const last = messages[messages.length - 1];
|
|
220
|
+
if (last === null || typeof last !== "object")
|
|
221
|
+
return;
|
|
222
|
+
if (String(last.role ?? "") !== "user")
|
|
223
|
+
return;
|
|
224
|
+
const content = last.content;
|
|
225
|
+
if (!Array.isArray(content))
|
|
226
|
+
return;
|
|
227
|
+
for (const part of content) {
|
|
228
|
+
if (part === null || typeof part !== "object")
|
|
229
|
+
continue;
|
|
230
|
+
const text = part.text;
|
|
231
|
+
if (typeof text === "string" && text.includes(context))
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
content.push({ type: "text", text: context });
|
|
235
|
+
}
|
|
200
236
|
// END_BLOCK_SYSTEM_CONTEXT_FORMATTING
|
|
201
237
|
// START_BLOCK_POLICY
|
|
202
238
|
async function resolveCapturedConfig(runtime, sessionID) {
|
|
@@ -268,8 +304,6 @@ export function createSystemContextInjectionPlugin(options = {}) {
|
|
|
268
304
|
};
|
|
269
305
|
const registration = await ctx.session.hook("context", async (event) => {
|
|
270
306
|
try {
|
|
271
|
-
if (!Array.isArray(event.system))
|
|
272
|
-
return;
|
|
273
307
|
const agentName = event.agent === undefined ? undefined : String(event.agent);
|
|
274
308
|
if (!(await shouldInjectForAgent(agentName, knownSubagents, agentMode)))
|
|
275
309
|
return;
|
|
@@ -277,7 +311,13 @@ export function createSystemContextInjectionPlugin(options = {}) {
|
|
|
277
311
|
if (config === undefined)
|
|
278
312
|
return;
|
|
279
313
|
const policy = resolveOrchestrationPolicy(config);
|
|
280
|
-
|
|
314
|
+
if (Array.isArray(event.system)) {
|
|
315
|
+
appendSystemContexts(event.system, getSystemContextsForAgent(agentName));
|
|
316
|
+
}
|
|
317
|
+
const tail = getTailPolicyForAgent(agentName, policy);
|
|
318
|
+
if (tail !== undefined && Array.isArray(event.messages)) {
|
|
319
|
+
appendTailContext(event.messages, tail);
|
|
320
|
+
}
|
|
281
321
|
}
|
|
282
322
|
catch {
|
|
283
323
|
// Guidance injection must never fail a model request.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/system-context-injection/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,iBAAiB;AACjB,wBAAwB;AACxB,4RAA4R;AAC5R,20BAA20B;AAC30B,mIAAmI;AACnI,sJAAsJ;AACtJ,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,iHAAiH;AACjH,qHAAqH;AACrH,qGAAqG;AACrG,oEAAoE;AACpE,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/system-context-injection/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,iBAAiB;AACjB,wBAAwB;AACxB,4RAA4R;AAC5R,20BAA20B;AAC30B,mIAAmI;AACnI,sJAAsJ;AACtJ,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,iHAAiH;AACjH,qHAAqH;AACrH,qGAAqG;AACrG,oEAAoE;AACpE,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,oUAA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
|
1
1
|
import type { OpenCodeClient } from "@opencode/client";
|
|
2
|
+
import { FileBindingStore } from "./snapshot-store.js";
|
|
2
3
|
import { type SnapshotServiceDeps } from "./snapshots.js";
|
|
3
|
-
import { type AdmissionOutcome, type AgentEditorLike, type AgentPolicyBinding, type AuxiliaryService, type EffectiveRuntimeConfig, type ModelEditorLike, type NativeRuntime, type PermissionService, type RuntimeClient, type RuntimeContext, type RuntimeDeps, type RuntimeEvent, type RuntimeLease, type SnapshotAdmissionRequest, type SnapshotLease, type SnapshotService
|
|
4
|
+
import { type AdmissionOutcome, type AgentEditorLike, type AgentPolicyBinding, type AuxiliaryService, type EffectiveRuntimeConfig, type ModelEditorLike, type NativeRuntime, type PermissionService, type RuntimeClient, type RuntimeContext, type RuntimeDeps, type RuntimeEvent, type RuntimeLease, type SnapshotAdmissionRequest, type SnapshotLease, type SnapshotService } from "./types.js";
|
|
4
5
|
/** Return a per-acquisition release lease for the runtime shared by one exact plugin context. */
|
|
5
6
|
export declare function acquireRuntime<Context extends RuntimeContext>(context: Context): RuntimeLease<Context, OpenCodeClient>;
|
|
6
7
|
export declare function acquireRuntime<Context extends RuntimeContext, Client extends RuntimeClient>(context: Context, deps: RuntimeDeps<Client>): RuntimeLease<Context, Client>;
|
|
@@ -143,23 +144,20 @@ export interface NativeForkClient extends RuntimeClient {
|
|
|
143
144
|
/** Optional injectable native boundaries for the shared snapshot runtime (tests only). */
|
|
144
145
|
export interface NativeSnapshotRuntimeOptions<Client extends NativeForkClient = OpenCodeClient> {
|
|
145
146
|
readonly runtimeDeps?: RuntimeDeps<Client> | undefined;
|
|
146
|
-
readonly store?:
|
|
147
|
+
readonly store?: FileBindingStore | undefined;
|
|
147
148
|
readonly now?: (() => number) | undefined;
|
|
148
149
|
}
|
|
149
150
|
/** Documented shared native runtime consumed by every later plugin. */
|
|
150
151
|
export interface NativeSnapshotRuntime<Client extends NativeForkClient = OpenCodeClient> {
|
|
151
152
|
/** Native runtime with lazy authenticated full client and resource permissions. */
|
|
152
153
|
readonly runtime: NativeRuntime<NativeSnapshotContext, Client>;
|
|
153
|
-
/**
|
|
154
|
+
/** Family-binding/config/model/auxiliary service. */
|
|
154
155
|
readonly snapshots: SnapshotService;
|
|
155
156
|
/**
|
|
156
|
-
* Supported
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* arbitrary acceptance" shortcut, and unbound raw external generate remains
|
|
161
|
-
* fail-closed. Later consumers (for example Guardian's auxiliary inference and
|
|
162
|
-
* T-003) should call this rather than relying on a late generate hook.
|
|
157
|
+
* Supported bind-on-first-work gateway for owned direct generate/synthetic work.
|
|
158
|
+
* It persists the credential-free family revision, materializes the qualified
|
|
159
|
+
* live overlay, and switches before native model resolution. Unbound raw
|
|
160
|
+
* external generate remains fail-closed.
|
|
163
161
|
*/
|
|
164
162
|
admitWorkload(request: SnapshotAdmissionRequest): Promise<AdmissionOutcome>;
|
|
165
163
|
/** Snapshot-bound auxiliary generation. */
|
|
@@ -172,7 +170,7 @@ export interface NativeSnapshotRuntime<Client extends NativeForkClient = OpenCod
|
|
|
172
170
|
effectiveConfig(): EffectiveRuntimeConfig;
|
|
173
171
|
/** Enable or disable role overriding (agent models and default model) without disabling capture/guard. */
|
|
174
172
|
setRoleOverride(enabled: boolean): Promise<void>;
|
|
175
|
-
/** Reload
|
|
173
|
+
/** Reload rehydrated family bindings, variant registrations and native transforms. */
|
|
176
174
|
refresh(): Promise<void>;
|
|
177
175
|
/** Last config-watcher failure, surfaced instead of being silently swallowed. */
|
|
178
176
|
lastConfigError(): string | undefined;
|