@osovv/vv-opencode 2.0.1 → 2.1.1
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 +51 -0
- package/README.md +88 -87
- package/dist/commands/completion.js +0 -1
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/doctor.js +6 -9
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +2 -1
- package/dist/commands/init.js +7 -12
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts +4 -0
- package/dist/commands/install.js +40 -37
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/launch.d.ts +2 -1
- package/dist/commands/launch.js +18 -14
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/patch-provider.d.ts +225 -307
- package/dist/commands/patch-provider.js +92 -296
- package/dist/commands/patch-provider.js.map +1 -1
- package/dist/commands/status.js +7 -10
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.d.ts +4 -0
- package/dist/commands/sync.js +38 -35
- package/dist/commands/sync.js.map +1 -1
- package/dist/index.d.ts +25 -5
- package/dist/index.js +73 -34
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-tool-catalog.d.ts +1 -1
- package/dist/lib/agent-tool-catalog.js +3 -6
- package/dist/lib/agent-tool-catalog.js.map +1 -1
- package/dist/lib/agent-tool-contract.d.ts +22 -13
- package/dist/lib/agent-tool-contract.js +20 -20
- package/dist/lib/agent-tool-contract.js.map +1 -1
- package/dist/lib/analytics/types.d.ts +7 -1
- package/dist/lib/analytics/types.js +2 -2
- package/dist/lib/analytics/types.js.map +1 -1
- package/dist/lib/config-layers.d.ts +28 -6
- package/dist/lib/config-layers.js +268 -73
- package/dist/lib/config-layers.js.map +1 -1
- package/dist/lib/managed-agents.d.ts +24 -2
- package/dist/lib/managed-agents.js +45 -15
- package/dist/lib/managed-agents.js.map +1 -1
- package/dist/lib/model-roles.d.ts +5 -0
- package/dist/lib/model-roles.js +22 -1
- package/dist/lib/model-roles.js.map +1 -1
- package/dist/lib/opencode/agent-registrations.d.ts +4 -4
- package/dist/lib/opencode/agent-registrations.js +386 -197
- package/dist/lib/opencode/agent-registrations.js.map +1 -1
- package/dist/lib/opencode/inspection.d.ts +13 -13
- package/dist/lib/opencode/inspection.js +69 -106
- package/dist/lib/opencode/inspection.js.map +1 -1
- package/dist/lib/opencode/model-overrides.d.ts +2 -2
- package/dist/lib/opencode/model-overrides.js +192 -47
- package/dist/lib/opencode/model-overrides.js.map +1 -1
- package/dist/lib/opencode/paths.d.ts +6 -2
- package/dist/lib/opencode/paths.js +12 -11
- package/dist/lib/opencode/paths.js.map +1 -1
- package/dist/lib/opencode/plugin-registration.d.ts +10 -11
- package/dist/lib/opencode/plugin-registration.js +76 -138
- package/dist/lib/opencode/plugin-registration.js.map +1 -1
- package/dist/lib/opencode/shared-utils.d.ts +47 -3
- package/dist/lib/opencode/shared-utils.js +346 -15
- package/dist/lib/opencode/shared-utils.js.map +1 -1
- package/dist/lib/opencode.d.ts +5 -6
- package/dist/lib/opencode.js +10 -10
- package/dist/lib/opencode.js.map +1 -1
- package/dist/lib/vvoc-config.js +4 -4
- package/dist/lib/vvoc-config.js.map +1 -1
- package/dist/lib/vvoc-paths.d.ts +7 -0
- package/dist/lib/vvoc-paths.js +15 -1
- package/dist/lib/vvoc-paths.js.map +1 -1
- package/dist/lib/vvoc-preset-registry.d.ts +38 -50
- package/dist/lib/vvoc-preset-registry.js +38 -48
- package/dist/lib/vvoc-preset-registry.js.map +1 -1
- package/dist/plugins/analytics/index.d.ts +20 -14
- package/dist/plugins/analytics/index.js +281 -133
- package/dist/plugins/analytics/index.js.map +1 -1
- package/dist/plugins/guardian/index.d.ts +63 -42
- package/dist/plugins/guardian/index.js +217 -759
- package/dist/plugins/guardian/index.js.map +1 -1
- package/dist/plugins/hashline-edit/index.d.ts +145 -31
- package/dist/plugins/hashline-edit/index.js +679 -244
- package/dist/plugins/hashline-edit/index.js.map +1 -1
- package/dist/plugins/hashline-edit/schemas.d.ts +1 -1
- package/dist/plugins/hashline-edit/schemas.js +3 -3
- package/dist/plugins/hashline-edit/schemas.js.map +1 -1
- package/dist/plugins/model-roles/index.d.ts +18 -4
- package/dist/plugins/model-roles/index.js +44 -181
- package/dist/plugins/model-roles/index.js.map +1 -1
- package/dist/plugins/peak-hours/index.d.ts +23 -23
- package/dist/plugins/peak-hours/index.js +211 -180
- package/dist/plugins/peak-hours/index.js.map +1 -1
- package/dist/plugins/secrets-redaction/deep.js +35 -51
- package/dist/plugins/secrets-redaction/deep.js.map +1 -1
- package/dist/plugins/secrets-redaction/index.d.ts +96 -8
- package/dist/plugins/secrets-redaction/index.js +290 -102
- package/dist/plugins/secrets-redaction/index.js.map +1 -1
- package/dist/plugins/secrets-redaction/session.d.ts +9 -0
- package/dist/plugins/secrets-redaction/session.js +21 -4
- package/dist/plugins/secrets-redaction/session.js.map +1 -1
- package/dist/plugins/secrets-redaction/stream.d.ts +92 -0
- package/dist/plugins/secrets-redaction/stream.js +772 -0
- package/dist/plugins/secrets-redaction/stream.js.map +1 -0
- package/dist/plugins/spec-guard/index.d.ts +49 -18
- package/dist/plugins/spec-guard/index.js +231 -129
- package/dist/plugins/spec-guard/index.js.map +1 -1
- package/dist/plugins/system-context-injection/index.d.ts +10 -4
- package/dist/plugins/system-context-injection/index.js +271 -78
- package/dist/plugins/system-context-injection/index.js.map +1 -1
- package/dist/plugins/tool-history-compaction/index.d.ts +26 -4
- package/dist/plugins/tool-history-compaction/index.js +170 -32
- package/dist/plugins/tool-history-compaction/index.js.map +1 -1
- package/dist/plugins/tool-history-compaction/transform.d.ts +47 -16
- package/dist/plugins/tool-history-compaction/transform.js +173 -55
- package/dist/plugins/tool-history-compaction/transform.js.map +1 -1
- package/dist/plugins/web-tools/fetch-service.d.ts +51 -13
- package/dist/plugins/web-tools/fetch-service.js +106 -75
- package/dist/plugins/web-tools/fetch-service.js.map +1 -1
- package/dist/plugins/web-tools/index.d.ts +58 -16
- package/dist/plugins/web-tools/index.js +202 -91
- package/dist/plugins/web-tools/index.js.map +1 -1
- package/dist/plugins/web-tools/media-loader.d.ts +3 -3
- package/dist/plugins/web-tools/media-loader.js +3 -3
- package/dist/plugins/web-tools/media-loader.js.map +1 -1
- package/dist/plugins/web-tools/providers/native-fetch.d.ts +2 -2
- package/dist/plugins/web-tools/providers/native-fetch.js +1 -1
- package/dist/plugins/web-tools/providers/native-fetch.js.map +1 -1
- package/dist/plugins/web-tools/providers/spider.d.ts +2 -2
- package/dist/plugins/web-tools/providers/spider.js +1 -1
- package/dist/plugins/web-tools/providers/spider.js.map +1 -1
- package/dist/plugins/web-tools/providers/zai.d.ts +2 -2
- package/dist/plugins/web-tools/providers/zai.js +1 -1
- package/dist/plugins/web-tools/providers/zai.js.map +1 -1
- package/dist/plugins/web-tools/schemas.d.ts +1 -1
- package/dist/plugins/web-tools/schemas.js +3 -3
- package/dist/plugins/web-tools/schemas.js.map +1 -1
- package/dist/plugins/web-tools/search-service.d.ts +81 -12
- package/dist/plugins/web-tools/search-service.js +104 -57
- package/dist/plugins/web-tools/search-service.js.map +1 -1
- package/dist/plugins/workflow/authorization.d.ts +44 -10
- package/dist/plugins/workflow/authorization.js +113 -73
- package/dist/plugins/workflow/authorization.js.map +1 -1
- package/dist/plugins/workflow/cancellation.d.ts +86 -0
- package/dist/plugins/workflow/cancellation.js +202 -0
- package/dist/plugins/workflow/cancellation.js.map +1 -0
- package/dist/plugins/workflow/checkpoints.d.ts +7 -1
- package/dist/plugins/workflow/checkpoints.js +141 -21
- package/dist/plugins/workflow/checkpoints.js.map +1 -1
- package/dist/plugins/workflow/delegated.d.ts +14 -0
- package/dist/plugins/workflow/delegated.js +6 -5
- package/dist/plugins/workflow/delegated.js.map +1 -1
- package/dist/plugins/workflow/host.d.ts +81 -0
- package/dist/plugins/workflow/host.js +189 -0
- package/dist/plugins/workflow/host.js.map +1 -0
- package/dist/plugins/workflow/index.d.ts +69 -4
- package/dist/plugins/workflow/index.js +1391 -1026
- package/dist/plugins/workflow/index.js.map +1 -1
- package/dist/plugins/workflow/recovery.d.ts +3 -5
- package/dist/plugins/workflow/recovery.js +18 -33
- package/dist/plugins/workflow/recovery.js.map +1 -1
- package/dist/plugins/workflow/repair.d.ts +31 -5
- package/dist/plugins/workflow/repair.js +116 -48
- package/dist/plugins/workflow/repair.js.map +1 -1
- package/dist/plugins/workflow/results.d.ts +31 -31
- package/dist/plugins/workflow/results.js +4 -4
- package/dist/plugins/workflow/results.js.map +1 -1
- package/dist/plugins/workflow/schemas.d.ts +3 -3
- package/dist/plugins/workflow/schemas.js +5 -5
- package/dist/plugins/workflow/schemas.js.map +1 -1
- package/dist/plugins/workflow/system-instruction.md +4 -0
- package/dist/plugins/workflow/tooling.d.ts +6 -0
- package/dist/plugins/workflow/tooling.js +3 -1
- package/dist/plugins/workflow/tooling.js.map +1 -1
- package/dist/runtime/auxiliary.d.ts +13 -0
- package/dist/runtime/auxiliary.js +108 -0
- package/dist/runtime/auxiliary.js.map +1 -0
- package/dist/runtime/client.d.ts +88 -0
- package/dist/runtime/client.js +174 -0
- package/dist/runtime/client.js.map +1 -0
- package/dist/runtime/context-inspection-contract.d.ts +397 -0
- package/dist/runtime/context-inspection-contract.js +622 -0
- package/dist/runtime/context-inspection-contract.js.map +1 -0
- package/dist/runtime/context-inspection.d.ts +52 -0
- package/dist/runtime/context-inspection.js +324 -0
- package/dist/runtime/context-inspection.js.map +1 -0
- package/dist/runtime/context.d.ts +192 -0
- package/dist/runtime/context.js +1246 -0
- package/dist/runtime/context.js.map +1 -0
- package/dist/runtime/coordination.d.ts +40 -0
- package/dist/runtime/coordination.js +87 -0
- package/dist/runtime/coordination.js.map +1 -0
- package/dist/runtime/model-registry.d.ts +34 -0
- package/dist/runtime/model-registry.js +227 -0
- package/dist/runtime/model-registry.js.map +1 -0
- package/dist/runtime/permissions.d.ts +20 -0
- package/dist/runtime/permissions.js +250 -0
- package/dist/runtime/permissions.js.map +1 -0
- package/dist/runtime/snapshot-config.d.ts +80 -0
- package/dist/runtime/snapshot-config.js +268 -0
- package/dist/runtime/snapshot-config.js.map +1 -0
- package/dist/runtime/snapshot-store.d.ts +25 -0
- package/dist/runtime/snapshot-store.js +519 -0
- package/dist/runtime/snapshot-store.js.map +1 -0
- package/dist/runtime/snapshots.d.ts +59 -0
- package/dist/runtime/snapshots.js +721 -0
- package/dist/runtime/snapshots.js.map +1 -0
- package/dist/runtime/types.d.ts +713 -0
- package/dist/runtime/types.js +190 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/tui/analytics/indicator.d.ts +25 -26
- package/dist/tui/analytics/indicator.js +66 -74
- package/dist/tui/analytics/indicator.js.map +1 -1
- package/dist/tui/branding/footer.d.ts +7 -12
- package/dist/tui/branding/footer.js +16 -24
- package/dist/tui/branding/footer.js.map +1 -1
- package/dist/tui/context/analyze.d.ts +20 -9
- package/dist/tui/context/analyze.js +295 -257
- package/dist/tui/context/analyze.js.map +1 -1
- package/dist/tui/context/collect.d.ts +29 -3
- package/dist/tui/context/collect.js +450 -66
- package/dist/tui/context/collect.js.map +1 -1
- package/dist/tui/context/plugin.d.ts +21 -7
- package/dist/tui/context/plugin.js +65 -70
- package/dist/tui/context/plugin.js.map +1 -1
- package/dist/tui/context/types.d.ts +174 -43
- package/dist/tui/context/types.js +25 -19
- package/dist/tui/context/types.js.map +1 -1
- package/dist/tui/context/view.d.ts +33 -7
- package/dist/tui/context/view.js +136 -81
- package/dist/tui/context/view.js.map +1 -1
- package/dist/tui/peak-hours/banner.d.ts +13 -11
- package/dist/tui/peak-hours/banner.js +48 -80
- package/dist/tui/peak-hours/banner.js.map +1 -1
- package/dist/tui/policy.d.ts +69 -0
- package/dist/tui/policy.js +169 -0
- package/dist/tui/policy.js.map +1 -0
- package/dist/tui.d.ts +3 -8
- package/dist/tui.js +72 -68
- package/dist/tui.js.map +1 -1
- package/package.json +18 -14
- package/schemas/vvoc/v3.json +1 -1
- package/server.js +3 -5
- package/templates/agents/enhancer.md +10 -5
- package/templates/agents/guardian.md +10 -4
- package/templates/agents/investigator.md +4 -2
- package/templates/agents/vv-code-reviewer.md +4 -2
- package/templates/agents/vv-spec-reviewer.md +4 -2
- package/templates/skills/vv-execute/references/tool-contracts.md +1 -1
- package/tui.js +3 -5
- package/dist/plugins/analytics/v2.d.ts +0 -21
- package/dist/plugins/analytics/v2.js +0 -133
- package/dist/plugins/analytics/v2.js.map +0 -1
- package/dist/plugins/guardian/v2.d.ts +0 -13
- package/dist/plugins/guardian/v2.js +0 -204
- package/dist/plugins/guardian/v2.js.map +0 -1
- package/dist/plugins/hashline-edit/v2.d.ts +0 -12
- package/dist/plugins/hashline-edit/v2.js +0 -145
- package/dist/plugins/hashline-edit/v2.js.map +0 -1
- package/dist/plugins/model-roles/v2.d.ts +0 -24
- package/dist/plugins/model-roles/v2.js +0 -274
- package/dist/plugins/model-roles/v2.js.map +0 -1
- package/dist/plugins/peak-hours/v2.d.ts +0 -12
- package/dist/plugins/peak-hours/v2.js +0 -99
- package/dist/plugins/peak-hours/v2.js.map +0 -1
- package/dist/plugins/secrets-redaction/v2.d.ts +0 -19
- package/dist/plugins/secrets-redaction/v2.js +0 -138
- package/dist/plugins/secrets-redaction/v2.js.map +0 -1
- package/dist/plugins/spec-guard/v2.d.ts +0 -12
- package/dist/plugins/spec-guard/v2.js +0 -139
- package/dist/plugins/spec-guard/v2.js.map +0 -1
- package/dist/plugins/system-context-injection/agent-contexts.d.ts +0 -5
- package/dist/plugins/system-context-injection/agent-contexts.js +0 -164
- package/dist/plugins/system-context-injection/agent-contexts.js.map +0 -1
- package/dist/plugins/system-context-injection/v2.d.ts +0 -13
- package/dist/plugins/system-context-injection/v2.js +0 -60
- package/dist/plugins/system-context-injection/v2.js.map +0 -1
- package/dist/plugins/tool-history-compaction/v2.d.ts +0 -11
- package/dist/plugins/tool-history-compaction/v2.js +0 -56
- package/dist/plugins/tool-history-compaction/v2.js.map +0 -1
- package/dist/plugins/v2-runtime/config-watcher.d.ts +0 -26
- package/dist/plugins/v2-runtime/config-watcher.js +0 -111
- package/dist/plugins/v2-runtime/config-watcher.js.map +0 -1
- package/dist/plugins/v2-runtime/index.d.ts +0 -50
- package/dist/plugins/v2-runtime/index.js +0 -114
- package/dist/plugins/v2-runtime/index.js.map +0 -1
- package/dist/plugins/v2-runtime/location-config.d.ts +0 -51
- package/dist/plugins/v2-runtime/location-config.js +0 -91
- package/dist/plugins/v2-runtime/location-config.js.map +0 -1
- package/dist/plugins/v2-runtime/setup.d.ts +0 -48
- package/dist/plugins/v2-runtime/setup.js +0 -174
- package/dist/plugins/v2-runtime/setup.js.map +0 -1
- package/dist/plugins/web-tools/v2.d.ts +0 -11
- package/dist/plugins/web-tools/v2.js +0 -99
- package/dist/plugins/web-tools/v2.js.map +0 -1
- package/dist/plugins/workflow/v2.d.ts +0 -76
- package/dist/plugins/workflow/v2.js +0 -283
- package/dist/plugins/workflow/v2.js.map +0 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Plugin } from "@opencode/plugin";
|
|
2
|
+
import { type NativeSnapshotContext, type NativeSnapshotRuntime } from "../../runtime/context.js";
|
|
3
|
+
export interface SystemContextInjectionPluginOptions {
|
|
4
|
+
/** Test-only injectable runtime acquisition. Default acquires the real shared runtime. */
|
|
5
|
+
acquireRuntime?: (ctx: NativeSnapshotContext) => Promise<NativeSnapshotRuntime>;
|
|
6
|
+
}
|
|
7
|
+
/** Native plugin factory; the default export acquires the real shared runtime. */
|
|
8
|
+
export declare function createSystemContextInjectionPlugin(options?: SystemContextInjectionPluginOptions): Plugin.Plugin;
|
|
9
|
+
export declare const SystemContextInjectionPlugin: Plugin.Plugin;
|
|
10
|
+
export default SystemContextInjectionPlugin;
|
|
@@ -1,103 +1,296 @@
|
|
|
1
1
|
// FILE: src/plugins/system-context-injection/index.ts
|
|
2
|
-
// VERSION:
|
|
2
|
+
// VERSION: 2.1.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
|
-
// PURPOSE: Inject universal primary guidance, including correctness obligations and evidence discipline for behavior changes, and one
|
|
5
|
-
// SCOPE: Universal instructions with correctness obligations, material-assumption discipline, settled-conclusion reopen triggers, false-premise handling, and pressure-versus-evidence distinction; vv-controller policy selection; explore-
|
|
6
|
-
// DEPENDS: [@opencode
|
|
7
|
-
// LINKS: [M-PLUGIN-SYSTEM-CONTEXT-INJECTION, M-ORCHESTRATION-PROFILES, M-CLI-MANAGED-AGENTS]
|
|
4
|
+
// PURPOSE: Inject universal primary guidance, including correctness obligations and evidence discipline for behavior changes, and one bound-family-resolved concrete orchestration policy into vv-controller without polluting subagent prompts, through the native session context hook.
|
|
5
|
+
// SCOPE: Universal instructions with correctness obligations, material-assumption discipline, settled-conclusion reopen triggers, false-premise handling, and pressure-versus-evidence distinction; vv-controller policy selection from the immutable captured family config; the explore-subagent guidance exception even though native registry mode is subagent; built-in, managed and native-registry subagent exclusion for every other agent; internal title/summary/compaction exclusion; per-request agent-mode reads that never poison on transient failure; idempotent injection into native system parts; lifecycle cleanup. Skill-path registration is NOT delivered here: the old runtime config.skills.paths registration has no native plugin config-transform surface, and the native document `skills: string[]` install/sync writes are owned by T007.
|
|
6
|
+
// DEPENDS: [@opencode/plugin, src/lib/managed-agents.ts, src/lib/orchestration.ts, src/runtime/context.ts, src/runtime/types.ts]
|
|
7
|
+
// LINKS: [M-PLUGIN-SYSTEM-CONTEXT-INJECTION, M-ORCHESTRATION-PROFILES, M-CLI-MANAGED-AGENTS, M-NATIVE-RUNTIME, V-M-PLUGIN-SYSTEM-CONTEXT-INJECTION]
|
|
8
8
|
// ROLE: RUNTIME
|
|
9
9
|
// MAP_MODE: EXPORTS
|
|
10
10
|
// END_MODULE_CONTRACT
|
|
11
11
|
//
|
|
12
12
|
// START_MODULE_MAP
|
|
13
|
-
//
|
|
14
|
-
//
|
|
13
|
+
// SystemContextInjectionPluginOptions - Optional injectable runtime acquisition and diagnostic sink for tests.
|
|
14
|
+
// createSystemContextInjectionPlugin - Native plugin factory; the default export acquires the real shared runtime.
|
|
15
|
+
// SystemContextInjectionPlugin - Default production native system-context-injection plugin object.
|
|
16
|
+
// default - Default export alias of SystemContextInjectionPlugin.
|
|
15
17
|
// END_MODULE_MAP
|
|
16
18
|
//
|
|
17
19
|
// START_CHANGE_SUMMARY
|
|
18
|
-
// LAST_CHANGE: [C-OPENCODE-V2-
|
|
20
|
+
// LAST_CHANGE: [C-OPENCODE-V2-NATIVE T-006 attempt 2 - Explore receives its role guidance despite native subagent mode; every other subagent is excluded; agent mode is read fresh per query; skill-path delivery is explicitly handed to T007.]
|
|
19
21
|
// END_CHANGE_SUMMARY
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
+
import { SystemPart } from "@opencode/ai";
|
|
23
|
+
import { Plugin } from "@opencode/plugin";
|
|
24
|
+
import { MANAGED_SUBAGENT_NAMES } from "../../lib/managed-agents.js";
|
|
25
|
+
import { resolveOrchestrationPolicy, } from "../../lib/orchestration.js";
|
|
22
26
|
import { isVvocPluginEnabled } from "../../lib/plugin-toggle-config.js";
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
import { acquireNativeSnapshotRuntime, } from "../../runtime/context.js";
|
|
28
|
+
const BUILT_IN_SUBAGENTS = ["general"];
|
|
29
|
+
const PLUGIN_MANAGED_SUBAGENTS = ["guardian"];
|
|
30
|
+
const INTERNAL_PRIMARY_AGENTS = ["compaction", "title", "summary"];
|
|
31
|
+
const SELF_SUFFICIENT_PRIMARY_AGENTS = [];
|
|
32
|
+
const EXPLORE_SUBAGENT = "explore";
|
|
33
|
+
const VV_CONTROLLER_AGENT = "vv-controller";
|
|
34
|
+
const UNIVERSAL_PRIMARY_SYSTEM_CONTEXTS = [
|
|
35
|
+
[
|
|
36
|
+
"<semantic_continuity>",
|
|
37
|
+
"Reuse stable domain terms from the user request and the repository.",
|
|
38
|
+
"When the repository already has a canonical name for a concept, keep that name.",
|
|
39
|
+
"If the user's wording conflicts with repository terminology, map it once and continue with the repository's canonical term.",
|
|
40
|
+
"Keep stable domain terms across planning, implementation, review, and reporting.",
|
|
41
|
+
"</semantic_continuity>",
|
|
42
|
+
].join("\n"),
|
|
43
|
+
[
|
|
44
|
+
"<assumption_discipline>",
|
|
45
|
+
"Do not make silent material assumptions.",
|
|
46
|
+
"A material assumption is one that affects behavior, scope, API shape, schema, UX, data meaning, or verification.",
|
|
47
|
+
"If a material assumption is necessary, state it explicitly and carry its effect into the result report.",
|
|
48
|
+
"If a material assumption later becomes false, stop and reroute.",
|
|
49
|
+
"Resolve repository-answerable technical questions from the established code, contracts, and tests yourself; only a genuine business-semantics fork needs a user decision.",
|
|
50
|
+
"When a request assumes something that does not exist (a library, file, or behavior), surface the false premise and investigate the actual mechanism; continue only if the original goal stays unambiguous and within the approved scope, and never silently substitute a different goal or add an unnecessary dependency to make the premise true.",
|
|
51
|
+
"Report honest residual uncertainty: an unverified material condition is named as unverified, never presented as a passed check.",
|
|
52
|
+
"</assumption_discipline>",
|
|
53
|
+
].join("\n"),
|
|
54
|
+
[
|
|
55
|
+
"<execution_source_and_authority>",
|
|
56
|
+
"Execution ownership, requirement source, and authority are distinct: a native spec/plan package, a provided plan, and the current conversation are all valid sources, and none of them by itself implies a different ownership model.",
|
|
57
|
+
"Required reviews are exactly those declared by the selected source, explicitly requested by the user, or explicitly registered by the controller; do not invent a universal final-review pair.",
|
|
58
|
+
"When the user explicitly authorizes autonomous completion, record it as a bounded advance authority with a finite shared reserve. Use it only after ordinary allowances are exhausted, disclose material decisions without turning each into a blocking question, and still respect reserved stops, host permissions, and destructive, publication, or credential operations.",
|
|
59
|
+
"Report completion honestly as controller-accepted when no independent review was assigned, and as independently reviewed only when every registered obligation actually passed for the current result.",
|
|
60
|
+
"</execution_source_and_authority>",
|
|
61
|
+
].join("\n"),
|
|
62
|
+
[
|
|
63
|
+
"<correctness_obligations>",
|
|
64
|
+
"For behavior changes, run a compact correctness cycle before reporting done: state the target effect, derive the material properties that must be preserved from the request and established contracts, identify the directly affected consumers, challenge at least one material assumption with a diagnostic counterexample, choose verification proportionate to the risk, report the observed result, and name the remaining uncertainty.",
|
|
65
|
+
"Separate write scope (what you may edit), impact scope (behavior that could change), and verification scope (what you actually check). Investigating directly affected consumers to understand impact is required; broadening writes beyond the approved scope is not — request a scope decision instead.",
|
|
66
|
+
"Choose verification at the level where the risk arises. Derive test expectations from the contract and the request, not from the implementation's current output, and ground mocks in the dependency's established contract rather than in whatever makes the change pass.",
|
|
67
|
+
"Report honestly what was inspected, what was reasoned about, and what was executed as a check. The absence of a discovered defect is not proof of correctness: a substantive completion claim needs observed evidence, and an unverified material condition is reported as remaining uncertainty, never presented as a passed check.",
|
|
68
|
+
"Once required checks substantiate the material claims for the current files and inputs, move forward; recheck for changed inputs, uncovered material properties, conflicting evidence, or a mandatory gate, not for reassurance alone.",
|
|
69
|
+
"Interpret test results as evidence against the request and established contracts, not as the authoritative specification: a failing test that contradicts the agreed contract is a discrepancy to surface, not an automatic reason to rewrite code or tests.",
|
|
70
|
+
"Unrelated informational or trivial documentation work needs none of this ceremony.",
|
|
71
|
+
"</correctness_obligations>",
|
|
72
|
+
].join("\n"),
|
|
73
|
+
[
|
|
74
|
+
"<working_state>",
|
|
75
|
+
"For non-trivial work, stabilize a compact working state before acting: goal, current route, constraints, non-goals when relevant, assumptions, verification target, current unknown, and reroute if.",
|
|
76
|
+
"Check that state against the original request before and while acting; a constraint dropped early wastes the downstream chain.",
|
|
77
|
+
"Keep it compact and revise it when evidence changes.",
|
|
78
|
+
"Surface it explicitly when blocked, rerouting, or handing off to the user.",
|
|
79
|
+
"</working_state>",
|
|
80
|
+
].join("\n"),
|
|
81
|
+
[
|
|
82
|
+
"<editing_workflow>",
|
|
83
|
+
"When editing files, prefer the `edit` tool over shell-based rewrites when it is available.",
|
|
84
|
+
"Read the file first, then use exact `line#hash#anchor` refs from the latest `read` output when present.",
|
|
85
|
+
"Reserve `bash` for tests, builds, git, and other non-file-edit commands.",
|
|
86
|
+
"</editing_workflow>",
|
|
87
|
+
].join("\n"),
|
|
88
|
+
[
|
|
89
|
+
"<reroute_on_evidence>",
|
|
90
|
+
"When new evidence invalidates the current route, stop and reroute.",
|
|
91
|
+
"Reroute when root cause or expected behavior remains unclear, scope crosses an unexpected boundary, or requirement ambiguity blocks safe progress.",
|
|
92
|
+
"When rerouting, state the current route, the trigger, the next route, and why the previous route is no longer safe.",
|
|
93
|
+
"A retry must carry a named diagnosis of the prior failure; a blank retry is the same attempt again.",
|
|
94
|
+
"A reopen or reroute trigger is concrete — contradictory evidence, a specific error or counterexample, changed requirements, or changed relevant inputs. Vague doubt or unsupported pressure is not itself a trigger: retain a supported conclusion with a brief justification and ask for a specific discrepancy only when needed, while an explicit user change in requirements follows the existing scope and approval process rather than a factual debate.",
|
|
95
|
+
"An unchecked claim is not settled: run the required checks before treating a conclusion as final.",
|
|
96
|
+
"</reroute_on_evidence>",
|
|
97
|
+
].join("\n"),
|
|
98
|
+
[
|
|
99
|
+
"<anti_drift_budget>",
|
|
100
|
+
"When repeated attempts do not converge, stop and summarize.",
|
|
101
|
+
"Drift signals include repeated file reading without a stable path, repeated speculative fixes without stronger evidence, 2 major strategy changes for the same task, 2 review rounds without convergence, or requirement interpretation changing repeatedly during execution.",
|
|
102
|
+
"When drift signals accumulate, report what was learned, what remains unknown, and which route is now safest.",
|
|
103
|
+
"</anti_drift_budget>",
|
|
104
|
+
].join("\n"),
|
|
105
|
+
[
|
|
106
|
+
"<project_overlays>",
|
|
107
|
+
"If the task context or repository provides project-specific vocabulary, preferred patterns, boundaries, verification commands, architecture notes, or examples, treat them as project-owned overlays.",
|
|
108
|
+
"Prefer those overlays over generic vvoc defaults when they do not conflict with the user's request.",
|
|
109
|
+
"Use only overlays provided in the task context or repository.",
|
|
110
|
+
"</project_overlays>",
|
|
111
|
+
].join("\n"),
|
|
112
|
+
[
|
|
113
|
+
"<repository_memory>",
|
|
114
|
+
"If `.vvoc/lessons/index.xml` or `.vvoc/runbooks/index.xml` exists, inspect relevant index entries before debugging, fixing, changing behavior, operating on, architecting, or investigating repository-specific issues.",
|
|
115
|
+
"Load only entry files whose slug, summary, or applicability signal appears relevant to the current task.",
|
|
116
|
+
"Treat `.vvoc/lessons` and `.vvoc/runbooks` as advisory agent-facing repository memory, not as stronger authority than explicit user instructions, code, tests, or repository-owned instructions.",
|
|
117
|
+
"After a long development, debugging, bugfix, ops, or investigation session with reusable findings, consider using the vv-reflect skill to propose durable lessons or runbooks.",
|
|
118
|
+
"</repository_memory>",
|
|
119
|
+
].join("\n"),
|
|
120
|
+
[
|
|
121
|
+
"<delivery_discipline>",
|
|
122
|
+
"Keep internal and scratch reasoning compact; anything user- or tool-facing must be clean, complete language with no half-compressed notation or stray markers.",
|
|
123
|
+
"</delivery_discipline>",
|
|
124
|
+
].join("\n"),
|
|
125
|
+
];
|
|
126
|
+
const EXPLORE_SYSTEM_CONTEXTS = [
|
|
127
|
+
[
|
|
128
|
+
"<explore_role>",
|
|
129
|
+
"You are a repository search-and-discovery worker.",
|
|
130
|
+
"Behave like grep/glob/fuzzy-search over the repo: locate relevant files, symbols, call sites, config entries, tests, and line ranges.",
|
|
131
|
+
"Do not act like a file-dumping reader and never act like an editor.",
|
|
132
|
+
"Do not return exact file contents, large pasted excerpts, or rewrite proposals unless the parent explicitly asks for them.",
|
|
133
|
+
"Default output: a short summary plus a compact, prioritized list of relevant paths with why they matter and line references or anchors when useful.",
|
|
134
|
+
"Use short quoted snippets only when needed to disambiguate a match or prove a finding.",
|
|
135
|
+
"If full contents seem necessary, return the path and the most relevant line ranges or anchors so the parent session can read the file directly.",
|
|
136
|
+
"Keep results capped and focused. Prefer the smallest useful set of references over broad dumps.",
|
|
137
|
+
"</explore_role>",
|
|
138
|
+
].join("\n"),
|
|
139
|
+
];
|
|
140
|
+
// START_BLOCK_AGENT_FILTERS
|
|
141
|
+
function createKnownSubagentSet() {
|
|
142
|
+
return new Set([...BUILT_IN_SUBAGENTS, ...PLUGIN_MANAGED_SUBAGENTS, ...MANAGED_SUBAGENT_NAMES]);
|
|
143
|
+
}
|
|
144
|
+
function isInternalPrimaryAgent(agentName) {
|
|
145
|
+
return INTERNAL_PRIMARY_AGENTS.includes(agentName);
|
|
146
|
+
}
|
|
147
|
+
async function shouldInjectForAgent(agentName, knownSubagents, agentMode) {
|
|
148
|
+
if (!agentName)
|
|
149
|
+
return false;
|
|
150
|
+
// The built-in explore worker is a native subagent but intentionally receives
|
|
151
|
+
// its own role guidance; it is the one subagent that is not excluded here.
|
|
152
|
+
if (agentName === EXPLORE_SUBAGENT)
|
|
153
|
+
return true;
|
|
154
|
+
if (knownSubagents.has(agentName))
|
|
155
|
+
return false;
|
|
156
|
+
if (isInternalPrimaryAgent(agentName))
|
|
157
|
+
return false;
|
|
158
|
+
if (SELF_SUFFICIENT_PRIMARY_AGENTS.includes(agentName)) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
// A custom agent registered as a native subagent is excluded by its real mode,
|
|
162
|
+
// not by name alone.
|
|
163
|
+
try {
|
|
164
|
+
if ((await agentMode(agentName)) === "subagent")
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
// A registry lookup failure leaves the name-based decision in force.
|
|
169
|
+
}
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
/** Returns universal primary guidance and, only for vv-controller, one concrete policy. */
|
|
173
|
+
function getSystemContextsForAgent(agentName, policy) {
|
|
174
|
+
if (agentName === EXPLORE_SUBAGENT) {
|
|
175
|
+
return EXPLORE_SYSTEM_CONTEXTS;
|
|
176
|
+
}
|
|
177
|
+
if (agentName === VV_CONTROLLER_AGENT) {
|
|
178
|
+
return [...UNIVERSAL_PRIMARY_SYSTEM_CONTEXTS, policy.controllerSystemContext];
|
|
31
179
|
}
|
|
180
|
+
return UNIVERSAL_PRIMARY_SYSTEM_CONTEXTS;
|
|
32
181
|
}
|
|
182
|
+
// END_BLOCK_AGENT_FILTERS
|
|
33
183
|
// START_BLOCK_SYSTEM_CONTEXT_FORMATTING
|
|
34
|
-
|
|
35
|
-
|
|
184
|
+
/** Native system part text already carrying the context, if any. */
|
|
185
|
+
function hasInjectedContext(parts, context) {
|
|
186
|
+
return parts.some((part) => typeof part.text === "string" && part.text.includes(context));
|
|
36
187
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
188
|
+
/**
|
|
189
|
+
* Append each context to the native system parts exactly once. Existing parts
|
|
190
|
+
* and their order are preserved; only the provider-context copy the model is
|
|
191
|
+
* about to receive is changed, never the stored user prompt.
|
|
192
|
+
*/
|
|
193
|
+
function appendSystemContexts(system, contexts) {
|
|
42
194
|
for (const context of contexts) {
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
195
|
+
if (hasInjectedContext(system, context))
|
|
196
|
+
continue;
|
|
197
|
+
system.push(SystemPart.make(context));
|
|
46
198
|
}
|
|
47
|
-
return parts.join("\n\n");
|
|
48
199
|
}
|
|
49
200
|
// END_BLOCK_SYSTEM_CONTEXT_FORMATTING
|
|
50
|
-
//
|
|
201
|
+
// START_BLOCK_POLICY
|
|
202
|
+
async function resolveCapturedConfig(runtime, sessionID) {
|
|
203
|
+
const read = async () => {
|
|
204
|
+
try {
|
|
205
|
+
return await runtime.snapshots.configFor(sessionID);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
let capture = await read();
|
|
212
|
+
if (capture === undefined) {
|
|
213
|
+
try {
|
|
214
|
+
await runtime.snapshots.accept({ sessionID });
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
// fall through to the second read; absence is unknown policy below
|
|
218
|
+
}
|
|
219
|
+
capture = await read();
|
|
220
|
+
}
|
|
221
|
+
if (capture === undefined)
|
|
222
|
+
return undefined;
|
|
223
|
+
if (!isVvocPluginEnabled(capture.vvoc, "system-context-injection"))
|
|
224
|
+
return undefined;
|
|
225
|
+
return capture.vvoc;
|
|
226
|
+
}
|
|
227
|
+
// END_BLOCK_POLICY
|
|
51
228
|
// START_BLOCK_PLUGIN_ENTRY
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
229
|
+
/** Native plugin factory; the default export acquires the real shared runtime. */
|
|
230
|
+
export function createSystemContextInjectionPlugin(options = {}) {
|
|
231
|
+
return Plugin.define({
|
|
232
|
+
id: "vvoc.system-context-injection",
|
|
233
|
+
setup: async (ctx) => {
|
|
234
|
+
const acquire = options.acquireRuntime ?? ((c) => acquireNativeSnapshotRuntime(c));
|
|
235
|
+
const runtime = await acquire(ctx);
|
|
236
|
+
const knownSubagents = createKnownSubagentSet();
|
|
237
|
+
/**
|
|
238
|
+
* Read one agent's native registry mode. The read is intentionally fresh on
|
|
239
|
+
* every query: a transient registry failure must not poison later requests,
|
|
240
|
+
* and a newly configured subagent or a changed mode must take effect without
|
|
241
|
+
* a process restart. Returns undefined when the agent is unknown or the
|
|
242
|
+
* registry is unavailable.
|
|
243
|
+
*/
|
|
244
|
+
const agentMode = async (agent) => {
|
|
245
|
+
try {
|
|
246
|
+
const result = (await ctx.agent.list());
|
|
247
|
+
const data = Array.isArray(result)
|
|
248
|
+
? result
|
|
249
|
+
: (result?.data ?? undefined);
|
|
250
|
+
if (!Array.isArray(data))
|
|
251
|
+
return undefined;
|
|
252
|
+
for (const item of data) {
|
|
253
|
+
if (typeof item !== "object" || item === null)
|
|
254
|
+
continue;
|
|
255
|
+
const record = item;
|
|
256
|
+
if (String(record.id) !== agent)
|
|
257
|
+
continue;
|
|
258
|
+
if (record.mode === "subagent" || record.mode === "primary" || record.mode === "all") {
|
|
259
|
+
return record.mode;
|
|
260
|
+
}
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
return undefined;
|
|
72
264
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
265
|
+
catch {
|
|
266
|
+
return undefined;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const registration = await ctx.session.hook("context", async (event) => {
|
|
270
|
+
try {
|
|
271
|
+
if (!Array.isArray(event.system))
|
|
272
|
+
return;
|
|
273
|
+
const agentName = event.agent === undefined ? undefined : String(event.agent);
|
|
274
|
+
if (!(await shouldInjectForAgent(agentName, knownSubagents, agentMode)))
|
|
275
|
+
return;
|
|
276
|
+
const config = await resolveCapturedConfig(runtime, String(event.sessionID));
|
|
277
|
+
if (config === undefined)
|
|
278
|
+
return;
|
|
279
|
+
const policy = resolveOrchestrationPolicy(config);
|
|
280
|
+
appendSystemContexts(event.system, getSystemContextsForAgent(agentName, policy));
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
// Guidance injection must never fail a model request.
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
return async () => {
|
|
287
|
+
await registration.dispose();
|
|
288
|
+
await runtime.release();
|
|
289
|
+
};
|
|
89
290
|
},
|
|
90
|
-
};
|
|
91
|
-
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
export const SystemContextInjectionPlugin = createSystemContextInjectionPlugin();
|
|
294
|
+
export default SystemContextInjectionPlugin;
|
|
92
295
|
// END_BLOCK_PLUGIN_ENTRY
|
|
93
|
-
// START_BLOCK_DUAL_SUBPATH_ENTRY
|
|
94
|
-
import { defineDualPlugin } from "../v2-runtime/index.js";
|
|
95
|
-
import { createV2Adapter } from "../v2-runtime/setup.js";
|
|
96
|
-
import { setupSystemContextInjectionV2 } from "./v2.js";
|
|
97
|
-
export default defineDualPlugin({
|
|
98
|
-
id: "vvoc.system-context-injection",
|
|
99
|
-
v1: SystemContextInjectionPlugin,
|
|
100
|
-
v2: (ctx) => setupSystemContextInjectionV2(createV2Adapter(ctx)),
|
|
101
|
-
});
|
|
102
|
-
// END_BLOCK_DUAL_SUBPATH_ENTRY
|
|
103
296
|
//# sourceMappingURL=index.js.map
|
|
@@ -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,
|
|
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,mPAAmP;AACnP,qBAAqB;AAErB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,0BAA0B,GAE3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACL,4BAA4B,GAG7B,MAAM,0BAA0B,CAAC;AA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,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;wBAAE,OAAO;oBACzC,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBAC9E,IAAI,CAAC,CAAC,MAAM,oBAAoB,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;wBAAE,OAAO;oBAChF,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;oBAC7E,IAAI,MAAM,KAAK,SAAS;wBAAE,OAAO;oBACjC,MAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;oBAClD,oBAAoB,CAClB,KAAK,CAAC,MAA+C,EACrD,yBAAyB,CAAC,SAAS,EAAE,MAAM,CAAC,CAC7C,CAAC;gBACJ,CAAC;gBAAC,MAAM,CAAC;oBACP,sDAAsD;gBACxD,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,OAAO,KAAK,IAAI,EAAE;gBAChB,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC7B,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1B,CAAC,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAkB,kCAAkC,EAAE,CAAC;AAChG,eAAe,4BAA4B,CAAC;AAC5C,yBAAyB"}
|
|
@@ -1,4 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Plugin } from "@opencode/plugin";
|
|
2
|
+
import { type NativeSnapshotContext, type NativeSnapshotRuntime } from "../../runtime/context.js";
|
|
3
|
+
import { type ResolvedToolHistoryCompactionEntry } from "./config.js";
|
|
4
|
+
/** Resolved per-family compaction policy. */
|
|
5
|
+
export type ToolHistoryCompactionPolicy = {
|
|
6
|
+
readonly enabled: false;
|
|
7
|
+
} | {
|
|
8
|
+
readonly enabled: true;
|
|
9
|
+
readonly config: ResolvedToolHistoryCompactionEntry["config"];
|
|
10
|
+
};
|
|
11
|
+
/** Bounded credential-safe diagnostic event. */
|
|
12
|
+
export interface ToolHistoryCompactionDiagnostic {
|
|
13
|
+
readonly level: "warn" | "info";
|
|
14
|
+
readonly message: string;
|
|
15
|
+
readonly extra?: Readonly<Record<string, unknown>>;
|
|
16
|
+
}
|
|
17
|
+
export interface ToolHistoryCompactionPluginOptions {
|
|
18
|
+
/** Test-only injectable runtime acquisition. Default acquires the real shared runtime. */
|
|
19
|
+
acquireRuntime?: (ctx: NativeSnapshotContext) => Promise<NativeSnapshotRuntime>;
|
|
20
|
+
/** Test-only diagnostic sink override; defaults to the console sink. */
|
|
21
|
+
log?: (event: ToolHistoryCompactionDiagnostic) => void;
|
|
22
|
+
}
|
|
23
|
+
/** Native plugin factory; the default export acquires the real shared runtime. */
|
|
24
|
+
export declare function createToolHistoryCompactionPlugin(options?: ToolHistoryCompactionPluginOptions): Plugin.Plugin;
|
|
25
|
+
export declare const ToolHistoryCompactionPlugin: Plugin.Plugin;
|
|
26
|
+
export default ToolHistoryCompactionPlugin;
|