@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
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// FILE: src/runtime/types.ts
|
|
2
|
+
// VERSION: 1.0.0
|
|
3
|
+
// START_MODULE_CONTRACT
|
|
4
|
+
// PURPOSE: Define the shared native runtime vocabulary: the exact supported host version, the structural plugin-context seam, lazy full-client/dependency interfaces, resource-permission request/decision types, and the durable family-snapshot/model-capture/admission/auxiliary contracts consumed by later 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, snapshot persistence, filesystem, or network I/O.
|
|
6
|
+
// DEPENDS: [@opencode/plugin, @opencode/client, @opencode/schema/agent, @opencode/schema/location, @opencode/schema/permission, @opencode/schema/rpc, @opencode/schema/session]
|
|
7
|
+
// LINKS: [M-NATIVE-RUNTIME, V-M-NATIVE-RUNTIME]
|
|
8
|
+
// ROLE: TYPES
|
|
9
|
+
// MAP_MODE: EXPORTS
|
|
10
|
+
// END_MODULE_CONTRACT
|
|
11
|
+
//
|
|
12
|
+
// START_MODULE_MAP
|
|
13
|
+
// SUPPORTED_SERVICE_VERSION - Exact native OpenCode service version this runtime is compatible with.
|
|
14
|
+
// RuntimeLocation - Structural subset of Location.Info the runtime needs for identity and routing.
|
|
15
|
+
// RuntimeIdentity - Stable per-location identity used to share one runtime inside a host.
|
|
16
|
+
// RuntimeRpcRegistration - Releasable native RPC registration handle.
|
|
17
|
+
// RuntimeRpcRegistrar - Narrow structural view of the native plugin context RPC registrar.
|
|
18
|
+
// RuntimeContext - Narrow structural view of a native Plugin.Context used to acquire a runtime.
|
|
19
|
+
// RuntimeRpcCallOptions - Location and cancellation options for an authenticated client RPC call.
|
|
20
|
+
// RuntimeRpcMethods - Method map projected from a portable RPC definition.
|
|
21
|
+
// RuntimeRpcClient - Callable projection of an authenticated native client RPC.
|
|
22
|
+
// RuntimeEvent - Structural native event envelope.
|
|
23
|
+
// RuntimeEventApi - Structural native live-event subscription API.
|
|
24
|
+
// RuntimePermissionApi - Structural native session permission create/get/reply API.
|
|
25
|
+
// RuntimeClient - Structural subset of the native client used by the runtime foundation.
|
|
26
|
+
// RuntimeEndpoint - Native local-service endpoint handed to a full client.
|
|
27
|
+
// RuntimeDeps - Injectable native boundary: discovery, auth headers, and full-client construction.
|
|
28
|
+
// ResourcePermissionRequest - Resource-specific permission request passed to the native host.
|
|
29
|
+
// PermissionDecision - Terminal permission decision: allow or deny.
|
|
30
|
+
// PermissionRequestOptions - Cancellation and bounded-readiness options for an awaited permission decision.
|
|
31
|
+
// PermissionService - Awaited resource permission service consumed before side effects.
|
|
32
|
+
// NativeRuntime - Shared lifecycle-managed native runtime exposed to later plugins.
|
|
33
|
+
// RuntimeLease - Per-acquisition idempotent release handle for a shared runtime.
|
|
34
|
+
// RuntimeUnavailableError - No compatible already-running service could be discovered.
|
|
35
|
+
// RuntimeChallengeError - The discovered service did not prove the loading plugin instance.
|
|
36
|
+
// RuntimeDisposedError - The runtime was released and can no longer serve work.
|
|
37
|
+
// PERMISSION_REPLIED_EVENT - Native event type carrying a terminal permission reply.
|
|
38
|
+
// SERVER_CONNECTED_EVENT - Native event proving the live event transport finished its handshake.
|
|
39
|
+
// ModelSelection - Concrete native provider/model/variant selection.
|
|
40
|
+
// ModelVariantCapture - Persisted model variant overlay materialized as a native variant.
|
|
41
|
+
// CapturedVvocConfig - Opaque deep-copied effective vvoc configuration captured for replay.
|
|
42
|
+
// CapturedModelSettings - Captured native model/provider overlay needed to replay a request payload.
|
|
43
|
+
// CaptureIntent - Explicit/implicit/staged provenance of a captured selection.
|
|
44
|
+
// CaptureIntentMode - Capture selection provenance mode.
|
|
45
|
+
// CaptureIntentSource - Native source that produced a captured selection.
|
|
46
|
+
// PermissionCreateInput - Minimal input accepted by the native permission create call.
|
|
47
|
+
// AgentPolicyBinding - Captured agent-to-role and resolved-model binding.
|
|
48
|
+
// FamilyCapture - Durable immutable policy/model capture bound to one session family.
|
|
49
|
+
// StagedCandidate - Persisted pre-dispatch admission candidate.
|
|
50
|
+
// SnapshotAcceptRequest - Correlated acceptance input for committing a staged candidate.
|
|
51
|
+
// SnapshotOwnedAdmissionRequest - Owned generated-work admission request carrying a runtime-minted operation token.
|
|
52
|
+
// SnapshotStore - Durable per-family capture and staged-candidate persistence contract.
|
|
53
|
+
// stagedCandidateKey - Stable identity of one staged candidate within a family.
|
|
54
|
+
// stagedCandidateIdentity - Stable candidate identity from its raw owner fields.
|
|
55
|
+
// AcceptedInput - One native accepted input with ordering signals for first-accepted selection.
|
|
56
|
+
// AcceptedInputReconciliation - Accepted inputs for a session plus whether the durable replay was complete.
|
|
57
|
+
// NativeSessionView - Structural native session view used for host-verified lineage.
|
|
58
|
+
// ModelEditorLike - Structural native model transform editor used for variant materialization.
|
|
59
|
+
// AgentEditorLike - Structural native agent transform editor used for snapshot-bound role selection.
|
|
60
|
+
// VariantRegistration - Snapshot-qualified variant to publish on one real provider/model.
|
|
61
|
+
// AdmissionOutcome - Result of one awaited family admission attempt.
|
|
62
|
+
// EffectiveRuntimeConfig - Structural effective vvoc policy input to the snapshot service.
|
|
63
|
+
// SnapshotAdmissionRequest - Per-workload admission request.
|
|
64
|
+
// SnapshotService - Documented snapshot/config/model/auxiliary service consumed by later plugins.
|
|
65
|
+
// SnapshotLease - Per-acquisition release handle for a shared snapshot service.
|
|
66
|
+
// AuxiliaryMessageContent - Text carried by a native title request as generation input.
|
|
67
|
+
// AuxiliarySessionApi - Structural native child-session/generate boundary for auxiliary work.
|
|
68
|
+
// AuxiliaryWorkloadMetadata - Host-owned auxiliary workload metadata recorded on a child session.
|
|
69
|
+
// decodeAuxiliaryMetadata - Decode the auxiliary workload metadata from native session metadata.
|
|
70
|
+
// NativeSessionImportPayload - Typed payload forwarded to the native import route for a parented auxiliary child.
|
|
71
|
+
// decodeImportedSessionID - Decode the id of an imported native session from the unchecked client result.
|
|
72
|
+
// AuxiliaryService - Snapshot-bound auxiliary generation consumed by title and Guardian.
|
|
73
|
+
// SnapshotStoreError - Durable capture state was corrupt or unreadable, so work must fail closed.
|
|
74
|
+
// SnapshotAdmissionError - An awaited admission failed and no policy was published.
|
|
75
|
+
// SnapshotUnboundError - A dispatch was refused because no family policy was bound.
|
|
76
|
+
// runtimeIdentity - Build the stable identity from a runtime location.
|
|
77
|
+
// runtimeKey - Render a deterministic location identity string for diagnostics.
|
|
78
|
+
// END_MODULE_MAP
|
|
79
|
+
//
|
|
80
|
+
// START_CHANGE_SUMMARY
|
|
81
|
+
// LAST_CHANGE: [C-OPENCODE-V2-NATIVE T-009 - Added the immutable caller-supplied admission config to SnapshotAdmissionRequest and the native app coordination identity to RuntimeContext.]
|
|
82
|
+
// PREVIOUS: [C-OPENCODE-V2-NATIVE T-002 attempt 7 - Added the per-input candidate store contract, accepted-input ordering/source vocabulary, owned-operation identity, and the imported parented auxiliary session seam.]
|
|
83
|
+
// END_CHANGE_SUMMARY
|
|
84
|
+
/** Exact native host version this runtime authenticates against; the pinned host is 2.0.18. */
|
|
85
|
+
export const SUPPORTED_SERVICE_VERSION = "2.0.18";
|
|
86
|
+
/** Native event type carrying a terminal permission reply. */
|
|
87
|
+
export const PERMISSION_REPLIED_EVENT = "permission.replied";
|
|
88
|
+
/** Native event proving the live event transport finished its handshake. */
|
|
89
|
+
export const SERVER_CONNECTED_EVENT = "server.connected";
|
|
90
|
+
/** No compatible already-running service could be discovered. */
|
|
91
|
+
export class RuntimeUnavailableError extends Error {
|
|
92
|
+
code = "RUNTIME_UNAVAILABLE";
|
|
93
|
+
constructor() {
|
|
94
|
+
super(`No compatible OpenCode ${SUPPORTED_SERVICE_VERSION} service is registered for this plugin instance.`);
|
|
95
|
+
this.name = "RuntimeUnavailableError";
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** The discovered service did not prove the loading plugin instance and location. */
|
|
99
|
+
export class RuntimeChallengeError extends Error {
|
|
100
|
+
code = "RUNTIME_CHALLENGE_FAILED";
|
|
101
|
+
constructor(reason, options) {
|
|
102
|
+
super(`Native runtime challenge failed: ${reason}. The discovered service is not this loading plugin instance.`, options);
|
|
103
|
+
this.name = "RuntimeChallengeError";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** The runtime was released and can no longer serve work. */
|
|
107
|
+
export class RuntimeDisposedError extends Error {
|
|
108
|
+
code = "RUNTIME_DISPOSED";
|
|
109
|
+
constructor() {
|
|
110
|
+
super("The native runtime has been released.");
|
|
111
|
+
this.name = "RuntimeDisposedError";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/** Stable identity of one staged candidate within a family. */
|
|
115
|
+
export function stagedCandidateIdentity(input) {
|
|
116
|
+
return [input.sessionID, input.inboxID ?? "", input.operationID ?? "", input.workload ?? ""].join("\u0000");
|
|
117
|
+
}
|
|
118
|
+
/** Stable identity of one staged candidate within a family. */
|
|
119
|
+
export function stagedCandidateKey(candidate) {
|
|
120
|
+
return stagedCandidateIdentity(candidate);
|
|
121
|
+
}
|
|
122
|
+
/** Decode the auxiliary workload metadata embedded in native session metadata. */
|
|
123
|
+
export function decodeAuxiliaryMetadata(metadata) {
|
|
124
|
+
if (metadata === undefined)
|
|
125
|
+
return undefined;
|
|
126
|
+
const raw = metadata["vvocAuxiliary"];
|
|
127
|
+
if (typeof raw !== "object" || raw === null)
|
|
128
|
+
return undefined;
|
|
129
|
+
const record = raw;
|
|
130
|
+
const kind = record.kind;
|
|
131
|
+
if (kind !== "title" && kind !== "compaction" && kind !== "generate")
|
|
132
|
+
return undefined;
|
|
133
|
+
const role = record.role;
|
|
134
|
+
if (role !== undefined && typeof role !== "string")
|
|
135
|
+
return undefined;
|
|
136
|
+
return { kind, ...(role === undefined ? {} : { role }) };
|
|
137
|
+
}
|
|
138
|
+
/** Decode the id of an imported native session from the unchecked client result. */
|
|
139
|
+
export function decodeImportedSessionID(value) {
|
|
140
|
+
if (typeof value !== "object" || value === null)
|
|
141
|
+
return undefined;
|
|
142
|
+
const id = value.id;
|
|
143
|
+
return typeof id === "string" && id.length > 0 ? id : undefined;
|
|
144
|
+
}
|
|
145
|
+
/** Durable capture state was corrupt or unreadable, so work must fail closed. */
|
|
146
|
+
export class SnapshotStoreError extends Error {
|
|
147
|
+
code = "SNAPSHOT_STORE_INVALID";
|
|
148
|
+
constructor(message, options) {
|
|
149
|
+
super(message, options);
|
|
150
|
+
this.name = "SnapshotStoreError";
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** An awaited admission failed and no policy was published. */
|
|
154
|
+
export class SnapshotAdmissionError extends Error {
|
|
155
|
+
code = "SNAPSHOT_ADMISSION_FAILED";
|
|
156
|
+
constructor(message, options) {
|
|
157
|
+
super(message, options);
|
|
158
|
+
this.name = "SnapshotAdmissionError";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/** A dispatch was refused because no family policy was bound. */
|
|
162
|
+
export class SnapshotUnboundError extends Error {
|
|
163
|
+
code = "SNAPSHOT_UNBOUND";
|
|
164
|
+
constructor(message = "No family snapshot is bound for this workload.") {
|
|
165
|
+
super(message);
|
|
166
|
+
this.name = "SnapshotUnboundError";
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// END_BLOCK_SNAPSHOT_VOCABULARY
|
|
170
|
+
// START_BLOCK_IDENTITY_HELPERS
|
|
171
|
+
/** Build the stable identity from a runtime location. */
|
|
172
|
+
export function runtimeIdentity(location) {
|
|
173
|
+
return {
|
|
174
|
+
directory: location.directory,
|
|
175
|
+
...(location.workspaceID === undefined ? {} : { workspaceID: location.workspaceID }),
|
|
176
|
+
projectID: location.project.id,
|
|
177
|
+
canonical: location.project.canonical,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/** Render a deterministic location identity string for diagnostics. */
|
|
181
|
+
export function runtimeKey(identity) {
|
|
182
|
+
return [
|
|
183
|
+
identity.directory,
|
|
184
|
+
identity.workspaceID ?? "",
|
|
185
|
+
identity.projectID,
|
|
186
|
+
identity.canonical,
|
|
187
|
+
].join("\u0000");
|
|
188
|
+
}
|
|
189
|
+
// END_BLOCK_IDENTITY_HELPERS
|
|
190
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,iBAAiB;AACjB,wBAAwB;AACxB,kUAAkU;AAClU,iOAAiO;AACjO,kLAAkL;AAClL,kDAAkD;AAClD,gBAAgB;AAChB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,uGAAuG;AACvG,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,kF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;AACzD,MAAM,UAAU,eAAe,CAAC,QAAyB;IACvD,OAAO;QACL,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,GAAG,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC;QACpF,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC9B,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS;KACtC,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,UAAU,CAAC,QAAyB;IAClD,OAAO;QACL,QAAQ,CAAC,SAAS;QAClB,QAAQ,CAAC,WAAW,IAAI,EAAE;QAC1B,QAAQ,CAAC,SAAS;QAClB,QAAQ,CAAC,SAAS;KACnB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACnB,CAAC;AACD,6BAA6B"}
|
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
import type { JSX } from "@opentui/solid";
|
|
2
2
|
import type { RGBA } from "@opentui/core";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
cache?: {
|
|
12
|
-
read?: unknown;
|
|
13
|
-
write?: unknown;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
3
|
+
import type { Plugin } from "@opencode/plugin/tui";
|
|
4
|
+
import type { ContextPolicySnapshot } from "../policy.js";
|
|
5
|
+
export type IndicatorTokens = {
|
|
6
|
+
steps: number;
|
|
7
|
+
eligibleSteps: number;
|
|
8
|
+
cacheRead: number;
|
|
9
|
+
cacheWrite: number;
|
|
10
|
+
input: number;
|
|
16
11
|
};
|
|
17
12
|
export type IndicatorLabel = {
|
|
18
13
|
text: string;
|
|
19
14
|
tone: "muted" | "red" | "yellow" | "green";
|
|
20
15
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
/** Structural native usage payload accepted by the accumulator. */
|
|
17
|
+
export type IndicatorUsageLike = {
|
|
18
|
+
input?: unknown;
|
|
19
|
+
cache?: {
|
|
20
|
+
read?: unknown;
|
|
21
|
+
write?: unknown;
|
|
22
|
+
} | undefined;
|
|
23
|
+
};
|
|
24
|
+
export type AnalyticsIndicatorDependencies = {
|
|
25
|
+
isEnabled: () => boolean;
|
|
24
26
|
renderLabel: (label: IndicatorLabel, color: RGBA) => JSX.Element;
|
|
25
27
|
};
|
|
26
|
-
|
|
27
|
-
/** Rolling per-session sums fed by step-finish parts. Same eligibility rule as metrics. */
|
|
28
|
+
/** Rolling per-session sums fed by native usage events. */
|
|
28
29
|
export declare function createIndicatorAccumulator(): {
|
|
29
|
-
|
|
30
|
+
applyUsage(usage: IndicatorUsageLike): void;
|
|
30
31
|
get(): IndicatorTokens;
|
|
31
32
|
};
|
|
32
33
|
/** Label and tone for the current state; muted "cache n/a" until the first eligible step. */
|
|
33
34
|
export declare function indicatorLabel(state: IndicatorTokens): IndicatorLabel;
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* via api.lifecycle.onDispose. Slot registration failures disable the visual
|
|
40
|
-
* element silently for the session.
|
|
36
|
+
* Register the live indicator for the active session in the native
|
|
37
|
+
* `prompt.footer.status` slot (the native placement for the old
|
|
38
|
+
* `session_prompt_right` slot). Disabled policy: no subscription and no slot.
|
|
39
|
+
* Returns a disposer that unsubscribes and removes the claim.
|
|
41
40
|
*/
|
|
42
|
-
export declare function registerAnalyticsIndicator(
|
|
41
|
+
export declare function registerAnalyticsIndicator(ctx: Plugin.Context, policy: () => ContextPolicySnapshot | undefined, options: Readonly<Record<string, unknown>> | undefined, dependencies?: Partial<AnalyticsIndicatorDependencies>): () => void;
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@opentui/solid/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export const DEFAULT_DEPENDENCIES = {
|
|
5
|
-
enabled: async (api) => {
|
|
6
|
-
const vvoc = await loadVvocConfigForRead({
|
|
7
|
-
scope: "effective",
|
|
8
|
-
allowDefault: true,
|
|
9
|
-
cwd: api.state.path.directory,
|
|
10
|
-
});
|
|
11
|
-
return isVvocPluginEnabled(vvoc.config, "analytics");
|
|
12
|
-
},
|
|
13
|
-
renderLabel: (label, color) => (_jsx("text", { children: _jsx("span", { style: { fg: color }, children: label.text }) })),
|
|
14
|
-
};
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "@opentui/solid/jsx-runtime";
|
|
2
|
+
import { createSignal } from "solid-js";
|
|
3
|
+
import { policyAnalyticsEnabled } from "../policy.js";
|
|
15
4
|
// START_BLOCK_INDICATOR_ACCUMULATOR
|
|
16
|
-
/** Rolling per-session sums fed by
|
|
5
|
+
/** Rolling per-session sums fed by native usage events. */
|
|
17
6
|
export function createIndicatorAccumulator() {
|
|
18
7
|
let state = {
|
|
19
8
|
steps: 0,
|
|
@@ -23,18 +12,15 @@ export function createIndicatorAccumulator() {
|
|
|
23
12
|
input: 0,
|
|
24
13
|
};
|
|
25
14
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const tokens = (part.tokens ?? {});
|
|
30
|
-
const cacheRead = toCount(tokens.cache?.read);
|
|
31
|
-
const cacheWrite = toCount(tokens.cache?.write);
|
|
15
|
+
applyUsage(usage) {
|
|
16
|
+
const cacheRead = toCount(usage.cache?.read);
|
|
17
|
+
const cacheWrite = toCount(usage.cache?.write);
|
|
32
18
|
state = {
|
|
33
19
|
steps: state.steps + 1,
|
|
34
20
|
eligibleSteps: state.eligibleSteps + (cacheRead + cacheWrite > 0 ? 1 : 0),
|
|
35
21
|
cacheRead: state.cacheRead + cacheRead,
|
|
36
22
|
cacheWrite: state.cacheWrite + cacheWrite,
|
|
37
|
-
input: state.input + toCount(
|
|
23
|
+
input: state.input + toCount(usage.input),
|
|
38
24
|
};
|
|
39
25
|
},
|
|
40
26
|
get: () => state,
|
|
@@ -55,68 +41,74 @@ function toCount(value) {
|
|
|
55
41
|
// END_BLOCK_INDICATOR_ACCUMULATOR
|
|
56
42
|
// START_BLOCK_REGISTER_INDICATOR
|
|
57
43
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* via api.lifecycle.onDispose. Slot registration failures disable the visual
|
|
63
|
-
* element silently for the session.
|
|
44
|
+
* Register the live indicator for the active session in the native
|
|
45
|
+
* `prompt.footer.status` slot (the native placement for the old
|
|
46
|
+
* `session_prompt_right` slot). Disabled policy: no subscription and no slot.
|
|
47
|
+
* Returns a disposer that unsubscribes and removes the claim.
|
|
64
48
|
*/
|
|
65
|
-
export
|
|
49
|
+
export function registerAnalyticsIndicator(ctx, policy, options, dependencies) {
|
|
66
50
|
if (options?.enabled === false)
|
|
67
|
-
return;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
51
|
+
return () => undefined;
|
|
52
|
+
const deps = {
|
|
53
|
+
isEnabled: () => policyAnalyticsEnabled(policy()),
|
|
54
|
+
renderLabel: (label, color) => (_jsx("text", { children: _jsx("span", { style: { fg: color }, children: label.text }) })),
|
|
55
|
+
...dependencies,
|
|
56
|
+
};
|
|
57
|
+
// The slot is claimed even while the policy is still loading, so the
|
|
58
|
+
// indicator appears as soon as an allowlisted policy enables analytics
|
|
59
|
+
// without needing a plugin reload. Rendering stays policy-gated below.
|
|
60
|
+
const accumulators = new Map();
|
|
61
|
+
const [tokensBySession, setTokensBySession] = createSignal({});
|
|
62
|
+
const unsubscribe = ctx.data.on("session.usage.updated", (event) => {
|
|
63
|
+
const sessionID = event.data.sessionID;
|
|
64
|
+
let accumulator = accumulators.get(sessionID);
|
|
65
|
+
if (accumulator === undefined) {
|
|
66
|
+
accumulator = createIndicatorAccumulator();
|
|
67
|
+
accumulators.set(sessionID, accumulator);
|
|
75
68
|
}
|
|
69
|
+
accumulator.applyUsage({
|
|
70
|
+
input: event.data.tokens.input,
|
|
71
|
+
cache: { read: event.data.tokens.cache.read, write: event.data.tokens.cache.write },
|
|
72
|
+
});
|
|
73
|
+
setTokensBySession((prev) => ({ ...prev, [sessionID]: accumulator.get() }));
|
|
76
74
|
});
|
|
77
|
-
|
|
75
|
+
let unregister;
|
|
78
76
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
unregister = ctx.ui.slot({
|
|
78
|
+
append: "prompt.footer.status",
|
|
79
|
+
render: (input) => {
|
|
80
|
+
if (!deps.isEnabled())
|
|
81
|
+
return _jsx(_Fragment, {});
|
|
82
|
+
const sessionID = input.sessionID;
|
|
83
|
+
if (sessionID === undefined)
|
|
84
|
+
return _jsx(_Fragment, {});
|
|
85
|
+
const tokens = tokensBySession()[sessionID];
|
|
86
|
+
if (tokens === undefined)
|
|
87
|
+
return _jsx(_Fragment, {});
|
|
88
|
+
const label = indicatorLabel(tokens);
|
|
89
|
+
if (label.tone === "muted")
|
|
90
|
+
return _jsx(_Fragment, {});
|
|
91
|
+
return deps.renderLabel(label, toneColor(ctx, label.tone));
|
|
93
92
|
},
|
|
94
|
-
};
|
|
95
|
-
api.slots.register(plugin);
|
|
93
|
+
});
|
|
96
94
|
}
|
|
97
95
|
catch {
|
|
98
96
|
// Fail-soft: no indicator for this session.
|
|
99
97
|
}
|
|
98
|
+
return () => {
|
|
99
|
+
unsubscribe();
|
|
100
|
+
unregister?.();
|
|
101
|
+
};
|
|
100
102
|
}
|
|
101
|
-
/**
|
|
102
|
-
function
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
function toneColor(api, tone) {
|
|
112
|
-
const theme = api.theme.current;
|
|
113
|
-
const rgba = tone === "green"
|
|
114
|
-
? theme.success
|
|
115
|
-
: tone === "yellow"
|
|
116
|
-
? theme.warning
|
|
117
|
-
: tone === "red"
|
|
118
|
-
? theme.error
|
|
119
|
-
: theme.textMuted;
|
|
120
|
-
return rgba;
|
|
103
|
+
/** Maps an indicator tone to a native theme feedback color. */
|
|
104
|
+
function toneColor(ctx, tone) {
|
|
105
|
+
const feedback = ctx.theme.text.feedback;
|
|
106
|
+
if (tone === "green")
|
|
107
|
+
return feedback.success.base;
|
|
108
|
+
if (tone === "yellow")
|
|
109
|
+
return feedback.warning.base;
|
|
110
|
+
if (tone === "red")
|
|
111
|
+
return feedback.error.base;
|
|
112
|
+
return ctx.theme.text.muted;
|
|
121
113
|
}
|
|
122
114
|
//# sourceMappingURL=indicator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indicator.js","sourceRoot":"","sources":["../../../src/tui/analytics/indicator.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"indicator.js","sourceRoot":"","sources":["../../../src/tui/analytics/indicator.tsx"],"names":[],"mappings":";AA4BA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AA0BtD,oCAAoC;AACpC,2DAA2D;AAC3D,MAAM,UAAU,0BAA0B;IAIxC,IAAI,KAAK,GAAoB;QAC3B,KAAK,EAAE,CAAC;QACR,aAAa,EAAE,CAAC;QAChB,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,CAAC;QACb,KAAK,EAAE,CAAC;KACT,CAAC;IACF,OAAO;QACL,UAAU,CAAC,KAAK;YACd,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,I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ACV,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,EAAE,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,SAAS,SAAS,CAAC,GAAmB,EAAE,IAA4B;IAClE,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;IACzC,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;IACnD,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;IACpD,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;IAC/C,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAC9B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JSX } from "@opentui/solid";
|
|
2
2
|
import type { RGBA } from "@opentui/core";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Plugin } from "@opencode/plugin/tui";
|
|
4
4
|
export type BrandingVersionInfo = {
|
|
5
5
|
opencodeVersion: string;
|
|
6
6
|
vvocLabel: string;
|
|
@@ -11,20 +11,15 @@ export type BrandingColors = {
|
|
|
11
11
|
text: RGBA;
|
|
12
12
|
};
|
|
13
13
|
export type BrandingDependencies = {
|
|
14
|
-
/** Renders the combined version line; defaults to the native-looking
|
|
14
|
+
/** Renders the combined version line; defaults to the native-looking footer line extended with the vvoc label. */
|
|
15
15
|
renderLabel: (info: BrandingVersionInfo, colors: BrandingColors) => JSX.Element;
|
|
16
16
|
};
|
|
17
|
-
/** The vvoc label text, e.g. "vvoc v1.
|
|
17
|
+
/** The vvoc label text, e.g. "vvoc v1.7.0". */
|
|
18
18
|
export declare function brandingFooterLabel(): string;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* plugin (lowest order) is displayed. OpenCode's internal footer registers
|
|
24
|
-
* with order 100; this plugin uses order 50 so it deterministically wins the
|
|
25
|
-
* slot and renders the stock-looking footer line extended with the vvoc
|
|
26
|
-
* version ("• OpenCode <oc> · vvoc v<x>"). Always on (independent of analytics
|
|
27
|
-
* config); returns silently when the slot API is unavailable or registration
|
|
20
|
+
* Claim the native `sidebar.footer` slot and render the stock-looking footer
|
|
21
|
+
* line extended with the vvoc version. Always on (independent of analytics
|
|
22
|
+
* config); returns a no-op when the slot API is unavailable or registration
|
|
28
23
|
* fails.
|
|
29
24
|
*/
|
|
30
|
-
export declare function registerBrandingFooter(
|
|
25
|
+
export declare function registerBrandingFooter(ctx: Plugin.Context, dependencies?: BrandingDependencies): () => void;
|
|
@@ -3,42 +3,34 @@ import { getPackageVersionSync } from "../../lib/package.js";
|
|
|
3
3
|
const DEFAULT_DEPENDENCIES = {
|
|
4
4
|
renderLabel: (info, colors) => (_jsxs("text", { fg: colors.muted, children: [_jsx("span", { style: { fg: colors.success }, children: "\u2022" }), " ", _jsx("b", { children: "Open" }), _jsx("span", { style: { fg: colors.text }, children: _jsx("b", { children: "Code" }) }), " ", _jsx("span", { children: info.opencodeVersion }), _jsxs("span", { children: [" \u00B7 ", info.vvocLabel] })] })),
|
|
5
5
|
};
|
|
6
|
-
/** The vvoc label text, e.g. "vvoc v1.
|
|
6
|
+
/** The vvoc label text, e.g. "vvoc v1.7.0". */
|
|
7
7
|
export function brandingFooterLabel() {
|
|
8
8
|
return `vvoc v${getPackageVersionSync()}`;
|
|
9
9
|
}
|
|
10
10
|
// START_BLOCK_REGISTER_BRANDING_FOOTER
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* plugin (lowest order) is displayed. OpenCode's internal footer registers
|
|
16
|
-
* with order 100; this plugin uses order 50 so it deterministically wins the
|
|
17
|
-
* slot and renders the stock-looking footer line extended with the vvoc
|
|
18
|
-
* version ("• OpenCode <oc> · vvoc v<x>"). Always on (independent of analytics
|
|
19
|
-
* config); returns silently when the slot API is unavailable or registration
|
|
12
|
+
* Claim the native `sidebar.footer` slot and render the stock-looking footer
|
|
13
|
+
* line extended with the vvoc version. Always on (independent of analytics
|
|
14
|
+
* config); returns a no-op when the slot API is unavailable or registration
|
|
20
15
|
* fails.
|
|
21
16
|
*/
|
|
22
|
-
export function registerBrandingFooter(
|
|
23
|
-
if (typeof api.slots?.register !== "function")
|
|
24
|
-
return;
|
|
17
|
+
export function registerBrandingFooter(ctx, dependencies = DEFAULT_DEPENDENCIES) {
|
|
25
18
|
try {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
19
|
+
return ctx.ui.slot({
|
|
20
|
+
replace: "sidebar.footer",
|
|
21
|
+
render: () => {
|
|
22
|
+
const theme = ctx.theme;
|
|
23
|
+
return dependencies.renderLabel({ opencodeVersion: ctx.app.version, vvocLabel: brandingFooterLabel() }, {
|
|
24
|
+
muted: theme.text.muted,
|
|
25
|
+
success: theme.text.feedback.success.base,
|
|
26
|
+
text: theme.text.base,
|
|
27
|
+
});
|
|
36
28
|
},
|
|
37
|
-
};
|
|
38
|
-
api.slots.register(plugin);
|
|
29
|
+
});
|
|
39
30
|
}
|
|
40
31
|
catch {
|
|
41
32
|
// Fail-soft: no combined footer for this session.
|
|
33
|
+
return () => undefined;
|
|
42
34
|
}
|
|
43
35
|
}
|
|
44
36
|
//# sourceMappingURL=footer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../src/tui/branding/footer.tsx"],"names":[],"mappings":";AA0BA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAkB7D,MAAM,oBAAoB,GAAyB;IACjD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAC7B,gB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CAAC;gBACxB,OAAO,YAAY,CAAC,WAAW,CAC7B,EAAE,eAAe,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAAE,EACtE;oBACE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK;oBACvB,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI;oBACzC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;iBACtB,CACF,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,kDAAkD;QAClD,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ContextAnalysis, ContextAnalysisInput, ContextMcpServer, ContextTokenMetric, ContextToolSource, ContextToolUsage } from "./types.js";
|
|
3
|
-
export type ContextToolClassification = {
|
|
4
|
-
source: ContextToolSource;
|
|
5
|
-
ambiguousServers?: string[];
|
|
6
|
-
};
|
|
1
|
+
import type { ContextAnalysis, ContextAnalysisInput, ContextMessage, ContextModelRef, ContextTokenMetric, ContextToolSource, ContextToolUsage } from "./types.js";
|
|
7
2
|
export declare function analyzeContext(input: ContextAnalysisInput): ContextAnalysis;
|
|
8
|
-
export declare function selectActiveMessages(messages: readonly Message[]): readonly Message[];
|
|
9
3
|
export declare function createTokenMetric(estimatedTokens: number, contextLimit: number | undefined): ContextTokenMetric;
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Classify known native built-in and vvoc tools; every other tool is left
|
|
6
|
+
* explicitly unattributed. The registered namespace is a hint only and is never
|
|
7
|
+
* treated as authoritative MCP server provenance.
|
|
8
|
+
*/
|
|
9
|
+
export declare function classifyToolSource(tool: {
|
|
10
|
+
effectiveID: string;
|
|
11
|
+
name: string;
|
|
12
|
+
namespace?: string;
|
|
13
|
+
}): ContextToolSource;
|
|
12
14
|
export declare function compareToolUsage(left: ContextToolUsage, right: ContextToolUsage): number;
|
|
15
|
+
/** Latest completed compaction message with its active-context index. */
|
|
16
|
+
export declare function findCompactionCutoff(messages: readonly ContextMessage[]): {
|
|
17
|
+
readonly message: Extract<ContextMessage, {
|
|
18
|
+
kind: "compaction";
|
|
19
|
+
}>;
|
|
20
|
+
readonly index: number;
|
|
21
|
+
} | undefined;
|
|
22
|
+
/** True when two provider/model/variant references refer to the same real selection. */
|
|
23
|
+
export declare function sameModelRef(left: ContextModelRef, right: ContextModelRef): boolean;
|