@osovv/vv-opencode 2.4.0 → 2.6.0
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 +25 -0
- package/README.md +12 -7
- package/dist/cli.js +5 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/plugin-toggle.d.ts +0 -16
- package/dist/commands/plugin-toggle.js +2 -34
- package/dist/commands/plugin-toggle.js.map +1 -1
- package/dist/commands/preset.d.ts +0 -8
- package/dist/commands/preset.js +3 -24
- package/dist/commands/preset.js.map +1 -1
- package/dist/commands/role.js +2 -30
- package/dist/commands/role.js.map +1 -1
- package/dist/commands/session.d.ts +50 -0
- package/dist/commands/session.js +354 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/lib/managed-agents.js +2 -2
- package/dist/lib/managed-agents.js.map +1 -1
- package/dist/plugins/analytics/index.js +8 -19
- package/dist/plugins/analytics/index.js.map +1 -1
- package/dist/plugins/guardian/index.js +7 -21
- package/dist/plugins/guardian/index.js.map +1 -1
- package/dist/plugins/hashline-edit/atomic-write.d.ts +49 -0
- package/dist/plugins/hashline-edit/atomic-write.js +198 -0
- package/dist/plugins/hashline-edit/atomic-write.js.map +1 -0
- package/dist/plugins/hashline-edit/index.js +60 -38
- package/dist/plugins/hashline-edit/index.js.map +1 -1
- package/dist/plugins/hashline-edit/str-replace-editor.d.ts +14 -1
- package/dist/plugins/hashline-edit/str-replace-editor.js +55 -22
- package/dist/plugins/hashline-edit/str-replace-editor.js.map +1 -1
- package/dist/plugins/hashline-edit/target-lock.d.ts +10 -0
- package/dist/plugins/hashline-edit/target-lock.js +96 -0
- package/dist/plugins/hashline-edit/target-lock.js.map +1 -0
- package/dist/plugins/model-roles/index.d.ts +3 -3
- package/dist/plugins/model-roles/index.js +8 -8
- package/dist/plugins/model-roles/index.js.map +1 -1
- package/dist/plugins/peak-hours/index.js +9 -20
- package/dist/plugins/peak-hours/index.js.map +1 -1
- package/dist/plugins/secrets-redaction/index.js +11 -24
- package/dist/plugins/secrets-redaction/index.js.map +1 -1
- package/dist/plugins/spec-guard/index.js +10 -22
- package/dist/plugins/spec-guard/index.js.map +1 -1
- package/dist/plugins/system-context-injection/guidance.d.ts +6 -0
- package/dist/plugins/system-context-injection/guidance.js +79 -0
- package/dist/plugins/system-context-injection/guidance.js.map +1 -0
- package/dist/plugins/system-context-injection/index.js +20 -121
- package/dist/plugins/system-context-injection/index.js.map +1 -1
- package/dist/plugins/tool-history-compaction/index.js +14 -25
- package/dist/plugins/tool-history-compaction/index.js.map +1 -1
- package/dist/plugins/web-tools/index.js +14 -25
- package/dist/plugins/web-tools/index.js.map +1 -1
- package/dist/plugins/workflow/index.d.ts +3 -2
- package/dist/plugins/workflow/index.js +6 -22
- package/dist/plugins/workflow/index.js.map +1 -1
- package/dist/plugins/workflow/results.d.ts +40 -40
- package/dist/runtime/auxiliary.d.ts +11 -6
- package/dist/runtime/auxiliary.js +43 -35
- package/dist/runtime/auxiliary.js.map +1 -1
- package/dist/runtime/context-inspection.d.ts +7 -6
- package/dist/runtime/context-inspection.js +37 -43
- package/dist/runtime/context-inspection.js.map +1 -1
- package/dist/runtime/context.d.ts +22 -45
- package/dist/runtime/context.js +348 -634
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/model-registry.d.ts +3 -34
- package/dist/runtime/model-registry.js +10 -190
- package/dist/runtime/model-registry.js.map +1 -1
- package/dist/runtime/session-settings.d.ts +204 -0
- package/dist/runtime/session-settings.js +445 -0
- package/dist/runtime/session-settings.js.map +1 -0
- package/dist/runtime/snapshot-config.d.ts +7 -70
- package/dist/runtime/snapshot-config.js +16 -198
- package/dist/runtime/snapshot-config.js.map +1 -1
- package/dist/runtime/types.d.ts +15 -256
- package/dist/runtime/types.js +9 -63
- package/dist/runtime/types.js.map +1 -1
- package/dist/tui/settings/plugin.d.ts +29 -0
- package/dist/tui/settings/plugin.js +134 -0
- package/dist/tui/settings/plugin.js.map +1 -0
- package/dist/tui.js +12 -12
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
- package/schemas/vvoc/v3.json +1 -1
- package/templates/agents/vv-controller.md +176 -151
- package/templates/skills/vv-execute/references/tool-contracts.md +1 -1
- package/dist/lib/rebind-request.d.ts +0 -41
- package/dist/lib/rebind-request.js +0 -134
- package/dist/lib/rebind-request.js.map +0 -1
- package/dist/runtime/snapshot-store.d.ts +0 -63
- package/dist/runtime/snapshot-store.js +0 -668
- package/dist/runtime/snapshot-store.js.map +0 -1
- package/dist/runtime/snapshots.d.ts +0 -36
- package/dist/runtime/snapshots.js +0 -508
- package/dist/runtime/snapshots.js.map +0 -1
- package/dist/tui/rebind/plugin.d.ts +0 -22
- package/dist/tui/rebind/plugin.js +0 -101
- package/dist/tui/rebind/plugin.js.map +0 -1
package/dist/runtime/types.d.ts
CHANGED
|
@@ -247,152 +247,14 @@ export interface ModelSelection {
|
|
|
247
247
|
readonly modelID: string;
|
|
248
248
|
readonly variant?: string | undefined;
|
|
249
249
|
}
|
|
250
|
-
/** Persisted model variant overlay materialized as a native model variant. */
|
|
251
|
-
export interface ModelVariantCapture {
|
|
252
|
-
/** Snapshot-qualified native variant id: `<snapshotId>.<modelID>[.<sourceVariant>]`. */
|
|
253
|
-
readonly id: string;
|
|
254
|
-
readonly providerID: string;
|
|
255
|
-
readonly modelID: string;
|
|
256
|
-
/** Source role variant (for example `thinking`) that produced this overlay. */
|
|
257
|
-
readonly sourceVariant?: string | undefined;
|
|
258
|
-
readonly settings?: Readonly<Record<string, unknown>> | undefined;
|
|
259
|
-
readonly body?: Readonly<Record<string, unknown>> | undefined;
|
|
260
|
-
readonly headers?: Readonly<Record<string, string>> | undefined;
|
|
261
|
-
}
|
|
262
250
|
/** Deep-copied, schema-validated effective vvoc configuration captured for replay. */
|
|
263
251
|
export type CapturedVvocConfig = VvocConfig;
|
|
264
|
-
/** Captured native model/provider overlay needed to replay an actual request payload. */
|
|
265
|
-
export interface CapturedModelSettings {
|
|
266
|
-
readonly providerID: string;
|
|
267
|
-
readonly modelID: string;
|
|
268
|
-
readonly variant?: string | undefined;
|
|
269
|
-
readonly settings?: Readonly<Record<string, unknown>> | undefined;
|
|
270
|
-
readonly body?: Readonly<Record<string, unknown>> | undefined;
|
|
271
|
-
readonly headers?: Readonly<Record<string, string>> | undefined;
|
|
272
|
-
}
|
|
273
|
-
/** Provenance of a captured selection: how the effective model was chosen. */
|
|
274
|
-
export type CaptureIntentMode = "explicit" | "implicit" | "staged";
|
|
275
|
-
/** Native source that produced a captured selection. */
|
|
276
|
-
export type CaptureIntentSource = "config" | "switch" | "watcher" | "preset";
|
|
277
|
-
/** Explicit/implicit/staged provenance of a captured selection, with raw role intent preserved. */
|
|
278
|
-
export interface CaptureIntent {
|
|
279
|
-
readonly mode: CaptureIntentMode;
|
|
280
|
-
readonly source: CaptureIntentSource;
|
|
281
|
-
/** Raw vv-role reference when the selection originated from a role binding. */
|
|
282
|
-
readonly roleRef?: string | undefined;
|
|
283
|
-
/** Literal selection when the user or config supplied a concrete provider/model. */
|
|
284
|
-
readonly literal?: ModelSelection | undefined;
|
|
285
|
-
}
|
|
286
252
|
/** Captured agent-to-role and resolved-model binding. */
|
|
287
253
|
export interface AgentPolicyBinding {
|
|
288
254
|
readonly agentID: string;
|
|
289
255
|
readonly role?: string | undefined;
|
|
290
256
|
readonly selection?: ModelSelection | undefined;
|
|
291
257
|
}
|
|
292
|
-
/** In-memory materialization of a credential-free durable policy binding for one session family. */
|
|
293
|
-
export interface FamilyCapture {
|
|
294
|
-
readonly schemaVersion: 1;
|
|
295
|
-
readonly snapshotId: string;
|
|
296
|
-
/** Content digest over every behavior-relevant capture field, verified on read. */
|
|
297
|
-
readonly integrity: string;
|
|
298
|
-
readonly familyId: string;
|
|
299
|
-
readonly capturedAt: number;
|
|
300
|
-
readonly location: RuntimeIdentity;
|
|
301
|
-
readonly roles: Readonly<Record<string, string>>;
|
|
302
|
-
readonly roleModels: Readonly<Record<string, ModelSelection>>;
|
|
303
|
-
readonly agents: ReadonlyArray<AgentPolicyBinding>;
|
|
304
|
-
readonly variants: ReadonlyArray<ModelVariantCapture>;
|
|
305
|
-
readonly modelSettings: ReadonlyArray<CapturedModelSettings>;
|
|
306
|
-
readonly vvoc: CapturedVvocConfig;
|
|
307
|
-
/** Raw OpenCode root/small_model/agent/command model intent preserved before normalization. */
|
|
308
|
-
readonly rawIntent?: RawOpenCodeModelIntent | undefined;
|
|
309
|
-
/** Implicit root selection from raw OpenCode root model intent, below an explicit choice. */
|
|
310
|
-
readonly rootSelection?: ModelSelection | undefined;
|
|
311
|
-
readonly modelOverride?: ModelSelection | undefined;
|
|
312
|
-
readonly intent: CaptureIntent;
|
|
313
|
-
}
|
|
314
|
-
/** Persisted pre-dispatch admission candidate. */
|
|
315
|
-
export interface StagedCandidate {
|
|
316
|
-
readonly familyId: string;
|
|
317
|
-
/** Session whose awaited switch applied this candidate, used for commit-failure rollback. */
|
|
318
|
-
readonly sessionID: string;
|
|
319
|
-
/**
|
|
320
|
-
* Expected accepted-input identity: the native messageID supplied by the
|
|
321
|
-
* prompt hook. A commit is authorized only by an inbox enqueue with this exact
|
|
322
|
-
* inboxID (or a durable log replay proving it), never by family alone.
|
|
323
|
-
*/
|
|
324
|
-
readonly inboxID?: string | undefined;
|
|
325
|
-
/**
|
|
326
|
-
* Owner token for an owned generated-work operation (for example an auxiliary
|
|
327
|
-
* child or a direct generate). Prompt candidates carry `inboxID`; owned
|
|
328
|
-
* candidates carry `operationID`; the two are never interchangeable.
|
|
329
|
-
*/
|
|
330
|
-
readonly operationID?: string | undefined;
|
|
331
|
-
/** Workload the candidate was staged for (`prompt`, `generate`, ...). */
|
|
332
|
-
readonly workload?: string | undefined;
|
|
333
|
-
readonly stagedAt: number;
|
|
334
|
-
/** Capture content revision the candidate was staged for; a newer revision supersedes it. */
|
|
335
|
-
readonly revision: string;
|
|
336
|
-
/** Fully qualified selection (including captured variant) applied by the awaited switch. */
|
|
337
|
-
readonly selection: ModelSelection;
|
|
338
|
-
/** Session model before the switch, used for conditional rollback. */
|
|
339
|
-
readonly before?: ModelSelection | undefined;
|
|
340
|
-
readonly capture: FamilyCapture;
|
|
341
|
-
}
|
|
342
|
-
/** Durable per-family capture and staged-candidate persistence contract. */
|
|
343
|
-
export interface SnapshotStore {
|
|
344
|
-
read(familyId: string): Promise<FamilyCapture | undefined>;
|
|
345
|
-
write(familyId: string, capture: FamilyCapture): Promise<void>;
|
|
346
|
-
remove(familyId: string): Promise<void>;
|
|
347
|
-
/** All staged candidates for a family, in durable file order. */
|
|
348
|
-
readCandidates(familyId: string): Promise<readonly StagedCandidate[]>;
|
|
349
|
-
/** Insert or update the candidate with the same {@link stagedCandidateKey}. */
|
|
350
|
-
writeCandidate(candidate: StagedCandidate): Promise<void>;
|
|
351
|
-
/** Remove exactly the candidate with this key; leaves other owners intact. */
|
|
352
|
-
removeCandidate(familyId: string, candidateKey: string): Promise<void>;
|
|
353
|
-
/** Remove every staged candidate for a family (used once a family is bound). */
|
|
354
|
-
removeCandidates(familyId: string): Promise<void>;
|
|
355
|
-
/** Durable marker proving a family was once bound, so a missing capture fails closed. */
|
|
356
|
-
readMarker(familyId: string): Promise<boolean>;
|
|
357
|
-
writeMarker(familyId: string): Promise<void>;
|
|
358
|
-
removeMarker(familyId: string): Promise<void>;
|
|
359
|
-
list(): Promise<readonly string[]>;
|
|
360
|
-
}
|
|
361
|
-
/** Stable identity of one staged candidate within a family. */
|
|
362
|
-
export declare function stagedCandidateIdentity(input: {
|
|
363
|
-
readonly sessionID: string;
|
|
364
|
-
readonly inboxID?: string | undefined;
|
|
365
|
-
readonly operationID?: string | undefined;
|
|
366
|
-
readonly workload?: string | undefined;
|
|
367
|
-
}): string;
|
|
368
|
-
/** Stable identity of one staged candidate within a family. */
|
|
369
|
-
export declare function stagedCandidateKey(candidate: StagedCandidate): string;
|
|
370
|
-
/**
|
|
371
|
-
* One native accepted input reconciled from the live stream or the durable
|
|
372
|
-
* session log, with the native ordering signals used to pick the first accepted
|
|
373
|
-
* workload of a family.
|
|
374
|
-
*/
|
|
375
|
-
export interface AcceptedInput {
|
|
376
|
-
readonly sessionID: string;
|
|
377
|
-
readonly inboxID: string;
|
|
378
|
-
readonly itemType: string;
|
|
379
|
-
/** Native event creation time in epoch milliseconds. */
|
|
380
|
-
readonly created: number;
|
|
381
|
-
/** Native per-aggregate durable sequence, when supplied. */
|
|
382
|
-
readonly seq?: number | undefined;
|
|
383
|
-
/** Whether this entry came from a verified live event or the durable log replay. */
|
|
384
|
-
readonly source: "live" | "log";
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Accepted-input reconciliation for one session. `complete` is true only when
|
|
388
|
-
* the durable log replay reached a verified matching synced watermark; an
|
|
389
|
-
* incomplete result may still carry verified live events but must not be used to
|
|
390
|
-
* order multiple candidates.
|
|
391
|
-
*/
|
|
392
|
-
export interface AcceptedInputReconciliation {
|
|
393
|
-
readonly inputs: readonly AcceptedInput[];
|
|
394
|
-
readonly complete: boolean;
|
|
395
|
-
}
|
|
396
258
|
/** Structural native session view used for host-verified lineage and provenance. */
|
|
397
259
|
export interface NativeSessionView {
|
|
398
260
|
readonly id: string;
|
|
@@ -412,9 +274,9 @@ export interface NativeSessionView {
|
|
|
412
274
|
readonly hasActivity?: boolean | undefined;
|
|
413
275
|
}
|
|
414
276
|
/**
|
|
415
|
-
* Structural native model transform editor used for
|
|
416
|
-
* native `ModelEditor` callback parameter satisfies it exactly, so plugin
|
|
417
|
-
* passes the native editor without a cast.
|
|
277
|
+
* Structural native model transform editor used for default-model overrides.
|
|
278
|
+
* The native `ModelEditor` callback parameter satisfies it exactly, so plugin
|
|
279
|
+
* code passes the native editor without a cast.
|
|
418
280
|
*/
|
|
419
281
|
export interface ModelEditorLike {
|
|
420
282
|
list(providerID?: string): readonly DeepMutable<Model.Info>[];
|
|
@@ -430,42 +292,24 @@ export interface ModelEditorLike {
|
|
|
430
292
|
};
|
|
431
293
|
}
|
|
432
294
|
/**
|
|
433
|
-
* Structural native agent transform editor used for
|
|
434
|
-
*
|
|
295
|
+
* Structural native agent transform editor used for role-policy application.
|
|
296
|
+
* The native `AgentEditor` callback parameter satisfies it exactly.
|
|
435
297
|
*/
|
|
436
298
|
export interface AgentEditorLike {
|
|
437
299
|
list(): readonly DeepMutable<Agent.Info>[];
|
|
438
300
|
get(id: string): DeepMutable<Agent.Info> | undefined;
|
|
439
301
|
update(id: string, update: (agent: DeepMutable<Agent.Info>) => void): void;
|
|
440
302
|
}
|
|
441
|
-
/**
|
|
442
|
-
export interface VariantRegistration {
|
|
443
|
-
readonly providerID: string;
|
|
444
|
-
readonly modelID: string;
|
|
445
|
-
readonly variant: ModelVariantCapture;
|
|
446
|
-
}
|
|
447
|
-
/** Result of one family bind-on-first-work attempt. */
|
|
448
|
-
export interface AdmissionOutcome {
|
|
449
|
-
readonly status: "bound" | "reused" | "rejected";
|
|
450
|
-
readonly familyId: string;
|
|
451
|
-
readonly snapshotId?: string | undefined;
|
|
452
|
-
readonly selection?: ModelSelection | undefined;
|
|
453
|
-
/** Retained as an outcome shape compatibility field; binding does not roll back. */
|
|
454
|
-
readonly rollback?: "none" | undefined;
|
|
455
|
-
readonly error?: string | undefined;
|
|
456
|
-
}
|
|
457
|
-
/** Structural effective vvoc policy input to the snapshot service. */
|
|
303
|
+
/** Structural effective vvoc policy input consumed by the runtime. */
|
|
458
304
|
export interface EffectiveRuntimeConfig {
|
|
459
305
|
readonly roles: Readonly<Record<string, string>>;
|
|
460
306
|
/** Agent-to-role bindings managed by vvoc for built-in and bundled agents. */
|
|
461
307
|
readonly agentRoles: Readonly<Record<string, string>>;
|
|
462
|
-
/** Full effective vvoc document
|
|
308
|
+
/** Full effective vvoc document available to consumers. */
|
|
463
309
|
readonly vvoc: CapturedVvocConfig;
|
|
464
310
|
/** Native agent bindings (including custom agents) observed from the host editor. */
|
|
465
311
|
readonly agentBindings?: ReadonlyArray<AgentPolicyBinding> | undefined;
|
|
466
|
-
/**
|
|
467
|
-
readonly modelSettings?: ReadonlyArray<CapturedModelSettings> | undefined;
|
|
468
|
-
/** Current host default model, used for initial-selection provenance. */
|
|
312
|
+
/** Current host default model. */
|
|
469
313
|
readonly nativeDefault?: ModelSelection | undefined;
|
|
470
314
|
/** Raw OpenCode model intent preserved before native normalization. */
|
|
471
315
|
readonly rawIntent?: RawOpenCodeModelIntent | undefined;
|
|
@@ -473,76 +317,6 @@ export interface EffectiveRuntimeConfig {
|
|
|
473
317
|
readonly rootDefault?: ModelSelection | undefined;
|
|
474
318
|
readonly sourcePath?: string | undefined;
|
|
475
319
|
}
|
|
476
|
-
/** Per-workload bind-on-first-work request. */
|
|
477
|
-
export interface SnapshotAdmissionRequest {
|
|
478
|
-
readonly sessionID: string;
|
|
479
|
-
readonly directory: string;
|
|
480
|
-
/** Runtime identity of the host location owning this workload. */
|
|
481
|
-
readonly location: RuntimeIdentity;
|
|
482
|
-
/** User's explicit native selection, preserved over any implicit default. */
|
|
483
|
-
readonly explicit?: ModelSelection | undefined;
|
|
484
|
-
/**
|
|
485
|
-
* Base selection to bind when no explicit user choice exists. Used by callers
|
|
486
|
-
* that must bind the session's current model without marking it user-explicit
|
|
487
|
-
* (for example when role overriding is disabled). Falls back to the capture's
|
|
488
|
-
* primary role selection.
|
|
489
|
-
*/
|
|
490
|
-
readonly selectionOverride?: ModelSelection | undefined;
|
|
491
|
-
readonly intent?: CaptureIntent | undefined;
|
|
492
|
-
/** When false, bind policy without forcing a native model switch. */
|
|
493
|
-
readonly force?: boolean | undefined;
|
|
494
|
-
/**
|
|
495
|
-
* One immutable admission config assembled by the caller from a single coherent
|
|
496
|
-
* read (fresh vvoc + raw intent + provenance-aware native agent inputs +
|
|
497
|
-
* bindings + overlays). When present the service derives the first-work target
|
|
498
|
-
* and durable projection from this exact value instead of re-reading config,
|
|
499
|
-
* so a concurrent vvoc change cannot make them disagree.
|
|
500
|
-
*/
|
|
501
|
-
readonly admissionConfig?: EffectiveRuntimeConfig | undefined;
|
|
502
|
-
}
|
|
503
|
-
/** Compatibility input for plugins that call the retired acceptance layer. */
|
|
504
|
-
export interface SnapshotAcceptRequest {
|
|
505
|
-
readonly sessionID: string;
|
|
506
|
-
}
|
|
507
|
-
/** Documented family-binding/config/model/auxiliary service consumed by later plugins. */
|
|
508
|
-
export interface SnapshotService {
|
|
509
|
-
/** Host-verified family root session id for a session. */
|
|
510
|
-
familyOf(sessionID: string): Promise<string>;
|
|
511
|
-
/** Materialized policy bound to a session's family, or undefined when unbound. */
|
|
512
|
-
policy(sessionID: string): Promise<FamilyCapture | undefined>;
|
|
513
|
-
/** Materialized bound configuration with live credentials and overlays reattached. */
|
|
514
|
-
configFor(sessionID: string): Promise<FamilyCapture | undefined>;
|
|
515
|
-
/** All bound-family materializations known to this service. */
|
|
516
|
-
captures(): Promise<readonly FamilyCapture[]>;
|
|
517
|
-
/** Snapshot-qualified variants derived from every bound materialization, optionally one family. */
|
|
518
|
-
variants(familyId?: string): Promise<readonly VariantRegistration[]>;
|
|
519
|
-
/** Compatibility no-op for plugins that still ask the retired admission layer to accept work. */
|
|
520
|
-
accept(input: SnapshotAcceptRequest): Promise<AdmissionOutcome>;
|
|
521
|
-
/**
|
|
522
|
-
* Compatibility-named bind-on-first-work gateway. It serializes one family,
|
|
523
|
-
* writes a credential-free content-addressed binding, materializes live overlays,
|
|
524
|
-
* and switches only when requested.
|
|
525
|
-
*/
|
|
526
|
-
admitOwned(request: SnapshotAdmissionRequest, materialize?: (capture: FamilyCapture, selection: ModelSelection) => Promise<void>): Promise<AdmissionOutcome>;
|
|
527
|
-
/** Replace matching family bindings with the current project revision. */
|
|
528
|
-
rebind(input: {
|
|
529
|
-
readonly directory: string;
|
|
530
|
-
readonly location: RuntimeIdentity;
|
|
531
|
-
readonly familyId?: string | undefined;
|
|
532
|
-
}): Promise<readonly string[]>;
|
|
533
|
-
/** Remove one root-family pointer and garbage-collect unreferenced snapshots. */
|
|
534
|
-
removeFamily(familyId: string): Promise<void>;
|
|
535
|
-
/** Snapshot-bound auxiliary generation for title and Guardian work. */
|
|
536
|
-
readonly auxiliary: AuxiliaryService;
|
|
537
|
-
/** Release service-owned state; never stops the host. */
|
|
538
|
-
dispose(): void;
|
|
539
|
-
}
|
|
540
|
-
/** Per-acquisition release handle for a shared snapshot service. */
|
|
541
|
-
export interface SnapshotLease {
|
|
542
|
-
readonly snapshots: SnapshotService;
|
|
543
|
-
/** Idempotent for this lease; disposes the service only when the last lease releases. */
|
|
544
|
-
release(): Promise<void>;
|
|
545
|
-
}
|
|
546
320
|
/**
|
|
547
321
|
* Structural native auxiliary-session/generate boundary. Production creates a
|
|
548
322
|
* real parented native child through the authenticated full client's
|
|
@@ -559,11 +333,11 @@ export interface AuxiliarySessionApi {
|
|
|
559
333
|
readonly title: string;
|
|
560
334
|
/** Workload kind recorded in host-owned metadata for restart recovery. */
|
|
561
335
|
readonly kind: "title" | "compaction" | "generate";
|
|
562
|
-
/**
|
|
336
|
+
/** Family role whose selection the child is bound to, when known. */
|
|
563
337
|
readonly role?: string | undefined;
|
|
564
|
-
/**
|
|
338
|
+
/** Resolved family selection applied to the child. */
|
|
565
339
|
readonly model: ModelSelection;
|
|
566
|
-
/** Optional
|
|
340
|
+
/** Optional family agent id to bind. */
|
|
567
341
|
readonly agent?: string | undefined;
|
|
568
342
|
}): Promise<{
|
|
569
343
|
readonly sessionID: string;
|
|
@@ -638,7 +412,7 @@ export interface AuxiliaryMessageContent {
|
|
|
638
412
|
readonly role: string;
|
|
639
413
|
readonly text: string;
|
|
640
414
|
}
|
|
641
|
-
/**
|
|
415
|
+
/** Family-settings-bound auxiliary generation consumed by title and Guardian. */
|
|
642
416
|
export interface AuxiliaryService {
|
|
643
417
|
/** Resolve a title through a bound child; a set event.result always wins. */
|
|
644
418
|
title(event: {
|
|
@@ -646,35 +420,20 @@ export interface AuxiliaryService {
|
|
|
646
420
|
result?: string | undefined;
|
|
647
421
|
/** Native title messages retained as generation input, never dropped. */
|
|
648
422
|
readonly messages?: ReadonlyArray<AuxiliaryMessageContent> | undefined;
|
|
649
|
-
/**
|
|
423
|
+
/** Family role to use (title/small_model), never an implicit primary fallback. */
|
|
650
424
|
readonly role?: string | undefined;
|
|
651
425
|
}): Promise<string | undefined>;
|
|
652
|
-
/** Run
|
|
426
|
+
/** Run settings-bound auxiliary generation for the given request kind and role. */
|
|
653
427
|
generate(input: {
|
|
654
428
|
readonly sessionID: string;
|
|
655
429
|
readonly kind: "title" | "compaction" | "generate";
|
|
656
430
|
readonly prompt: string;
|
|
657
|
-
/**
|
|
431
|
+
/** Family role to use (for example Guardian's fast role); defaults to primary. */
|
|
658
432
|
readonly role?: string | undefined;
|
|
659
433
|
}): Promise<{
|
|
660
434
|
readonly text: string;
|
|
661
435
|
} | undefined>;
|
|
662
436
|
}
|
|
663
|
-
/** Durable capture state was corrupt or unreadable, so work must fail closed. */
|
|
664
|
-
export declare class SnapshotStoreError extends Error {
|
|
665
|
-
readonly code = "SNAPSHOT_STORE_INVALID";
|
|
666
|
-
constructor(message: string, options?: ErrorOptions);
|
|
667
|
-
}
|
|
668
|
-
/** An awaited admission failed and no policy was published. */
|
|
669
|
-
export declare class SnapshotAdmissionError extends Error {
|
|
670
|
-
readonly code = "SNAPSHOT_ADMISSION_FAILED";
|
|
671
|
-
constructor(message: string, options?: ErrorOptions);
|
|
672
|
-
}
|
|
673
|
-
/** A dispatch was refused because no family policy was bound. */
|
|
674
|
-
export declare class SnapshotUnboundError extends Error {
|
|
675
|
-
readonly code = "SNAPSHOT_UNBOUND";
|
|
676
|
-
constructor(message?: string);
|
|
677
|
-
}
|
|
678
437
|
/** Build the stable identity from a runtime location. */
|
|
679
438
|
export declare function runtimeIdentity(location: RuntimeLocation): RuntimeIdentity;
|
|
680
439
|
/** Render a deterministic location identity string for diagnostics. */
|
package/dist/runtime/types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// FILE: src/runtime/types.ts
|
|
2
2
|
// VERSION: 1.0.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
|
-
// PURPOSE: Define the shared native runtime vocabulary: the supported host window and service-compatibility predicate, structural plugin-context seams, resource-permission contracts, and
|
|
5
|
-
// SCOPE: Type-only native contracts plus pure location/identity/key helpers and error constructors.
|
|
4
|
+
// PURPOSE: Define the shared native runtime vocabulary: the supported host window and service-compatibility predicate, structural plugin-context seams, resource-permission contracts, and the session/auxiliary/agent-binding contracts consumed by native plugins.
|
|
5
|
+
// SCOPE: Type-only native contracts plus pure location/identity/key helpers and error constructors. No service discovery, authentication, RPC registration, permission flow, settings persistence, filesystem, or network I/O.
|
|
6
6
|
// DEPENDS: [@opencode/plugin, @opencode/client, @opencode/schema/agent, @opencode/schema/location, @opencode/schema/permission, @opencode/schema/rpc, @opencode/schema/session, src/lib/host-compat.ts]
|
|
7
7
|
// LINKS: [M-NATIVE-RUNTIME, V-M-NATIVE-RUNTIME]
|
|
8
8
|
// ROLE: TYPES
|
|
@@ -39,49 +39,27 @@
|
|
|
39
39
|
// PERMISSION_REPLIED_EVENT - Native event type carrying a terminal permission reply.
|
|
40
40
|
// SERVER_CONNECTED_EVENT - Native event proving the live event transport finished its handshake.
|
|
41
41
|
// ModelSelection - Concrete native provider/model/variant selection.
|
|
42
|
-
//
|
|
43
|
-
// CapturedVvocConfig - Config-shaped vvoc policy value used by a materialized family capture.
|
|
44
|
-
// CapturedModelSettings - Live native model/provider overlay re-derived for a materialized capture.
|
|
45
|
-
// CaptureIntent - Selection provenance, including legacy-store decoding values.
|
|
46
|
-
// CaptureIntentMode - Legacy selection-intent mode union retained for store decoding.
|
|
47
|
-
// CaptureIntentSource - Legacy selection-intent source union retained for store decoding.
|
|
42
|
+
// CapturedVvocConfig - Config-shaped vvoc policy value used by a resolved family view.
|
|
48
43
|
// PermissionCreateInput - Minimal input accepted by the native permission create call.
|
|
49
44
|
// AgentPolicyBinding - Captured agent-to-role and resolved-model binding.
|
|
50
|
-
// FamilyCapture - In-memory materialization of a durable credential-free family binding.
|
|
51
|
-
// StagedCandidate - Legacy storage-only candidate type retained for the unused legacy file-store implementation.
|
|
52
|
-
// SnapshotStore - Legacy storage-only interface retained for the unused legacy file-store implementation.
|
|
53
|
-
// AcceptedInput - Legacy accepted-input record retained for store decoding.
|
|
54
|
-
// AcceptedInputReconciliation - Legacy accepted-input reconciliation record retained for store decoding.
|
|
55
|
-
// stagedCandidateIdentity - Legacy candidate identity helper retained for store decoding.
|
|
56
|
-
// stagedCandidateKey - Legacy candidate key helper retained for store decoding.
|
|
57
|
-
// SnapshotAcceptRequest - Compatibility input for plugins that still invoke retired acceptance.
|
|
58
45
|
// NativeSessionView - Structural native session view used for host-verified lineage.
|
|
59
|
-
// ModelEditorLike - Structural native model transform editor used for
|
|
60
|
-
// AgentEditorLike - Structural native agent transform editor used for
|
|
61
|
-
//
|
|
62
|
-
// AdmissionOutcome - Result of one awaited family admission attempt.
|
|
63
|
-
// EffectiveRuntimeConfig - Structural effective vvoc policy input to the snapshot service.
|
|
64
|
-
// SnapshotAdmissionRequest - Per-workload bind-on-first-work request.
|
|
65
|
-
// SnapshotService - Family-binding/config/model/auxiliary service consumed by later plugins.
|
|
66
|
-
// SnapshotLease - Per-acquisition release handle for a shared snapshot service.
|
|
46
|
+
// ModelEditorLike - Structural native model transform editor used for default-model overrides.
|
|
47
|
+
// AgentEditorLike - Structural native agent transform editor used for role-policy application.
|
|
48
|
+
// EffectiveRuntimeConfig - Structural effective vvoc policy input consumed by the runtime.
|
|
67
49
|
// AuxiliaryMessageContent - Text carried by a native title request as generation input.
|
|
68
50
|
// AuxiliarySessionApi - Structural native child-session/generate boundary for auxiliary work.
|
|
69
51
|
// AuxiliaryWorkloadMetadata - Host-owned auxiliary workload metadata recorded on a child session.
|
|
70
52
|
// decodeAuxiliaryMetadata - Decode the auxiliary workload metadata from native session metadata.
|
|
71
53
|
// NativeSessionImportPayload - Typed payload forwarded to the native import route for a parented auxiliary child.
|
|
72
54
|
// decodeImportedSessionID - Decode the id of an imported native session from the unchecked client result.
|
|
73
|
-
// AuxiliaryService -
|
|
74
|
-
// SnapshotStoreError - Durable capture state was corrupt or unreadable, so work must fail closed.
|
|
75
|
-
// SnapshotAdmissionError - An awaited admission failed and no policy was published.
|
|
76
|
-
// SnapshotUnboundError - A dispatch was refused because no family policy was bound.
|
|
55
|
+
// AuxiliaryService - Family-settings-bound auxiliary generation consumed by title and Guardian.
|
|
77
56
|
// runtimeIdentity - Build the stable identity from a runtime location.
|
|
78
57
|
// runtimeKey - Render a deterministic location identity string for diagnostics.
|
|
79
58
|
// END_MODULE_MAP
|
|
80
59
|
//
|
|
81
60
|
// START_CHANGE_SUMMARY
|
|
82
|
-
// LAST_CHANGE: [C-
|
|
83
|
-
// PREVIOUS: [C-
|
|
84
|
-
// PREVIOUS: [C-OPENCODE-V2-NATIVE T-009 - Added the immutable caller-supplied admission config to SnapshotAdmissionRequest and the native app coordination identity to RuntimeContext.]
|
|
61
|
+
// LAST_CHANGE: [C-SESSION-OWNED-SETTINGS T-002 - Removed the snapshot vocabulary (family capture, staged candidates, admission/guard/store contracts and error classes) and slimmed EffectiveRuntimeConfig; session-owned settings types live in session-settings.ts.]
|
|
62
|
+
// PREVIOUS: [C-HOST-COMPAT-WINDOW T-002 - Replaced the exact SUPPORTED_SERVICE_VERSION string with the host-compat window predicate: discovery now accepts any stable host inside the supported major-bounded window, and DeepMutable is owned locally because the host package no longer ships @opencode/plugin/promise/types.]
|
|
85
63
|
// END_CHANGE_SUMMARY
|
|
86
64
|
import { isSupportedOpenCodeVersion, SUPPORTED_OPENCODE_VERSION_RANGE, } from "../lib/host-compat.js";
|
|
87
65
|
/** Human-readable native host window this runtime accepts. */
|
|
@@ -118,14 +96,6 @@ export class RuntimeDisposedError extends Error {
|
|
|
118
96
|
this.name = "RuntimeDisposedError";
|
|
119
97
|
}
|
|
120
98
|
}
|
|
121
|
-
/** Stable identity of one staged candidate within a family. */
|
|
122
|
-
export function stagedCandidateIdentity(input) {
|
|
123
|
-
return [input.sessionID, input.inboxID ?? "", input.operationID ?? "", input.workload ?? ""].join("\u0000");
|
|
124
|
-
}
|
|
125
|
-
/** Stable identity of one staged candidate within a family. */
|
|
126
|
-
export function stagedCandidateKey(candidate) {
|
|
127
|
-
return stagedCandidateIdentity(candidate);
|
|
128
|
-
}
|
|
129
99
|
/** Decode the auxiliary workload metadata embedded in native session metadata. */
|
|
130
100
|
export function decodeAuxiliaryMetadata(metadata) {
|
|
131
101
|
if (metadata === undefined)
|
|
@@ -149,30 +119,6 @@ export function decodeImportedSessionID(value) {
|
|
|
149
119
|
const id = value.id;
|
|
150
120
|
return typeof id === "string" && id.length > 0 ? id : undefined;
|
|
151
121
|
}
|
|
152
|
-
/** Durable capture state was corrupt or unreadable, so work must fail closed. */
|
|
153
|
-
export class SnapshotStoreError extends Error {
|
|
154
|
-
code = "SNAPSHOT_STORE_INVALID";
|
|
155
|
-
constructor(message, options) {
|
|
156
|
-
super(message, options);
|
|
157
|
-
this.name = "SnapshotStoreError";
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
/** An awaited admission failed and no policy was published. */
|
|
161
|
-
export class SnapshotAdmissionError extends Error {
|
|
162
|
-
code = "SNAPSHOT_ADMISSION_FAILED";
|
|
163
|
-
constructor(message, options) {
|
|
164
|
-
super(message, options);
|
|
165
|
-
this.name = "SnapshotAdmissionError";
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/** A dispatch was refused because no family policy was bound. */
|
|
169
|
-
export class SnapshotUnboundError extends Error {
|
|
170
|
-
code = "SNAPSHOT_UNBOUND";
|
|
171
|
-
constructor(message = "No family snapshot is bound for this workload.") {
|
|
172
|
-
super(message);
|
|
173
|
-
this.name = "SnapshotUnboundError";
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
122
|
// END_BLOCK_SNAPSHOT_VOCABULARY
|
|
177
123
|
// START_BLOCK_IDENTITY_HELPERS
|
|
178
124
|
/** Build the stable identity from a runtime location. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,iBAAiB;AACjB,wBAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,iBAAiB;AACjB,wBAAwB;AACxB,uQAAuQ;AACvQ,iOAAiO;AACjO,0MAA0M;AAC1M,kDAAkD;AAClD,gBAAgB;AAChB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,+FAA+F;AAC/F,sFAAsF;AACtF,uFAAuF;AACvF,qGAAqG;AACrG,4FAA4F;AAC5F,wEAAwE;AACxE,6FAA6F;AAC7F,kGAAkG;AAClG,oGAAoG;AACpG,6EAA6E;AAC7E,kFAAkF;AAClF,qDAAqD;AACrD,qEAAqE;AACrE,sFAAsF;AACtF,2FAA2F;AAC3F,6EAA6E;AAC7E,qGAAqG;AACrG,gGAAgG;AAChG,sEAAsE;AACtE,8GAA8G;AAC9G,0FAA0F;AAC1F,sFAAsF;AACtF,mFAAmF;AACnF,yFAAyF;AACzF,8FAA8F;AAC9F,kFAAkF;AAClF,uFAAuF;AACvF,mGAAmG;AACnG,uEAAuE;AACvE,yFAAyF;AACzF,yFAAyF;AACzF,4EAA4E;AAC5E,uFAAuF;AACvF,iGAAiG;AACjG,iGAAiG;AACjG,6FAA6F;AAC7F,0FAA0F;AAC1F,gGAAgG;AAChG,oGAAoG;AACpG,mGAAmG;AACnG,oHAAoH;AACpH,4GAA4G;AAC5G,kGAAkG;AAClG,yEAAyE;AACzE,kFAAkF;AAClF,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,yQAAyQ;AACzQ,mUAAmU;AACnU,qBAAqB;AAWrB,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,uBAAuB,CAAC;AAQ/B,8DAA8D;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AAExE,uGAAuG;AACvG,MAAM,UA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,SAAS;QAClB,QAAQ,CAAC,SAAS;KACnB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACnB,CAAC;AACD,6BAA6B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Plugin } from "@opencode/plugin/tui";
|
|
2
|
+
import type { FamilySettings, SessionSettingsClient } from "../../runtime/session-settings.js";
|
|
3
|
+
/** Stable native keymap command id behind the /vv-settings slash command. */
|
|
4
|
+
export declare const SETTINGS_COMMAND_ID = "vvoc.settings.set";
|
|
5
|
+
/** Injectable apply/read seams for focused tests. */
|
|
6
|
+
export type SettingsTuiDependencies = {
|
|
7
|
+
readonly apply: (input: {
|
|
8
|
+
readonly sessionID: string;
|
|
9
|
+
readonly actionText: string;
|
|
10
|
+
}) => Promise<{
|
|
11
|
+
readonly rootID: string;
|
|
12
|
+
readonly settings: FamilySettings;
|
|
13
|
+
}>;
|
|
14
|
+
readonly describe: (sessionID: string) => Promise<string | undefined>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Register /vv-settings on the native keymap layer, mirroring the /context
|
|
18
|
+
* registration: the layer must be created inside a mounted slot render, so the
|
|
19
|
+
* command claims the always-present `app` slot. With no argument the command
|
|
20
|
+
* shows the current family settings; with the shared text action syntax
|
|
21
|
+
* (`preset <name>`, `profile <name>`, `role <id> <model>`, `role unset <id>`,
|
|
22
|
+
* `plugin <name> on|off`, `pull-defaults`) it applies exactly one change to the
|
|
23
|
+
* active session's family root through a lineage-rooted metadata
|
|
24
|
+
* read-modify-write. The command displays bounded summaries only and never
|
|
25
|
+
* shows credential values.
|
|
26
|
+
*/
|
|
27
|
+
export declare function registerSettingsTuiCommand(ctx: Plugin.Context & {
|
|
28
|
+
readonly client: SessionSettingsClient;
|
|
29
|
+
}, dependencies?: SettingsTuiDependencies): () => void;
|