@osovv/vv-opencode 2.0.0 → 2.1.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 +51 -0
- package/README.md +87 -85
- 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 -22
- package/dist/plugins/peak-hours/index.js +210 -178
- 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 +19 -15
- 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 -161
- 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 -95
- package/dist/plugins/peak-hours/v2.js.map +0 -1
- package/dist/plugins/secrets-redaction/v2.d.ts +0 -14
- package/dist/plugins/secrets-redaction/v2.js +0 -100
- 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 -58
- package/dist/plugins/workflow/v2.js +0 -181
- package/dist/plugins/workflow/v2.js.map +0 -1
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type
|
|
1
|
+
import { Plugin } from "@opencode/plugin";
|
|
2
|
+
import { type NativeSnapshotContext, type NativeSnapshotRuntime } from "../../runtime/context.js";
|
|
3
|
+
import { type ActivePeak, type PeakHoursClock } from "../../lib/peak-hours.js";
|
|
3
4
|
export type SessionGraceInfo = {
|
|
4
5
|
createdMs?: number;
|
|
5
6
|
parentID?: string;
|
|
6
7
|
};
|
|
7
|
-
export
|
|
8
|
+
export interface PeakHoursPluginDependencies {
|
|
8
9
|
now: PeakHoursClock;
|
|
9
|
-
loadEntry: () => Promise<{
|
|
10
|
-
entry: PeakHoursEntryConfig;
|
|
11
|
-
warnings: string[];
|
|
12
|
-
}>;
|
|
13
10
|
session: (sessionID: string) => Promise<SessionGraceInfo | undefined>;
|
|
11
|
+
/** Native registry agent mode, used to exempt custom subagent agents. */
|
|
12
|
+
agentMode: (agent: string) => Promise<"subagent" | "primary" | "all" | undefined>;
|
|
14
13
|
connectedProviders: () => Promise<string[]>;
|
|
15
|
-
log: (level: "info" | "warn", message: string, extra?: Record<string, unknown>) =>
|
|
16
|
-
}
|
|
14
|
+
log: (level: "info" | "warn", message: string, extra?: Record<string, unknown>) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface PeakHoursPluginOptions extends Partial<PeakHoursPluginDependencies> {
|
|
17
|
+
/** Test-only injectable runtime acquisition. Default acquires the real shared runtime. */
|
|
18
|
+
acquireRuntime?: (ctx: NativeSnapshotContext) => Promise<NativeSnapshotRuntime>;
|
|
19
|
+
}
|
|
17
20
|
export declare function buildHardBlockMessage(providerID: string, peak: ActivePeak, suggestions: readonly string[]): string;
|
|
18
21
|
/**
|
|
19
|
-
* Builds the peak-hours
|
|
22
|
+
* Builds the native peak-hours plugin.
|
|
20
23
|
*
|
|
21
|
-
* Soft mode is pass-through: the
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* Schedule and lookup failures degrade to soft or no-op and never block.
|
|
24
|
+
* Soft mode is pass-through: the plugin never mutates the system parts or
|
|
25
|
+
* messages, and peak cost state stays visible only through the TUI banner. The
|
|
26
|
+
* `model.request` hook enforces the hard block by throwing before the provider
|
|
27
|
+
* request is dispatched. Internal kinds (title/compaction/generate), internal
|
|
28
|
+
* agents, subagent-like agents, sessions with a parentID, and sessions created
|
|
29
|
+
* before the active window start are never hard-blocked. Unknown family policy,
|
|
30
|
+
* schedule, or session lookup failures degrade to soft or no-op and never block.
|
|
29
31
|
*/
|
|
30
|
-
export declare function createPeakHoursPlugin(
|
|
31
|
-
export declare const PeakHoursPlugin: Plugin;
|
|
32
|
-
|
|
33
|
-
export default _default;
|
|
32
|
+
export declare function createPeakHoursPlugin(options?: PeakHoursPluginOptions): Plugin.Plugin;
|
|
33
|
+
export declare const PeakHoursPlugin: Plugin.Plugin;
|
|
34
|
+
export default PeakHoursPlugin;
|
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
// FILE: src/plugins/peak-hours/index.ts
|
|
2
|
-
// VERSION:
|
|
2
|
+
// VERSION: 2.0.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
|
-
// PURPOSE:
|
|
5
|
-
// SCOPE:
|
|
6
|
-
// DEPENDS: [@opencode
|
|
7
|
-
// LINKS: [M-PLUGIN-PEAK-HOURS, M-PEAK-HOURS-SCHEDULES, M-PLUGIN-
|
|
4
|
+
// PURPOSE: Hard-block native primary model requests whose provider is in configured peak hours before any provider call, with dynamic off-peak provider suggestions and session-age plus subagent grace; soft mode never mutates the request.
|
|
5
|
+
// SCOPE: Native Plugin.define entry, native session model.request hook after prompt admission, per-bound-family policy resolution from the immutable captured config (never a startup-global toggle), internal-kind and subagent-like agent exemptions read fresh from the native registry, persisted-session grace through the native client, authenticated native provider registry enumeration, hard blocking by throwing before dispatch, soft pass-through with no prompt mutation, and fail-open degradation. No raw unauthenticated provider HTTP fallback, no V1 chat.params facade, and no cross-request agent-mode cache.
|
|
6
|
+
// DEPENDS: [@opencode/plugin, src/lib/managed-agents.ts, src/runtime/context.ts, src/runtime/types.ts, src/lib/peak-hours.ts]
|
|
7
|
+
// LINKS: [M-PLUGIN-PEAK-HOURS, M-PEAK-HOURS-SCHEDULES, M-NATIVE-RUNTIME, V-M-PLUGIN-PEAK-HOURS]
|
|
8
8
|
// ROLE: RUNTIME
|
|
9
9
|
// MAP_MODE: EXPORTS
|
|
10
10
|
// END_MODULE_CONTRACT
|
|
11
11
|
//
|
|
12
12
|
// START_MODULE_MAP
|
|
13
|
-
// PeakHoursPluginDependencies - Injectable clock, entry, session, provider, and logging dependencies for focused tests.
|
|
14
13
|
// SessionGraceInfo - Persisted session fields used for grace decisions.
|
|
14
|
+
// PeakHoursPluginDependencies - Injectable clock, policy, session, agent-mode, provider, and logging dependencies for focused tests.
|
|
15
15
|
// buildHardBlockMessage - Composes the blocking error text with window end, wait, and suggestions.
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
16
|
+
// PeakHoursPluginOptions - Injectable runtime acquisition plus dependency overrides.
|
|
17
|
+
// createPeakHoursPlugin - Builds the native peak-hours plugin with injectable dependencies.
|
|
18
|
+
// PeakHoursPlugin - Default production native peak-hours plugin.
|
|
19
|
+
// default - Default export alias of PeakHoursPlugin.
|
|
19
20
|
// END_MODULE_MAP
|
|
20
21
|
//
|
|
21
22
|
// START_CHANGE_SUMMARY
|
|
22
|
-
// LAST_CHANGE: [C-OPENCODE-V2-
|
|
23
|
+
// LAST_CHANGE: [C-OPENCODE-V2-NATIVE T-006 attempt 2 - Native agent mode is read fresh per query (no poisoning cache); added default session/provider adapter coverage and the loopback real-host smoke.]
|
|
23
24
|
// END_CHANGE_SUMMARY
|
|
24
|
-
import {
|
|
25
|
+
import { Plugin } from "@opencode/plugin";
|
|
25
26
|
import { MANAGED_SUBAGENT_NAMES } from "../../lib/managed-agents.js";
|
|
26
27
|
import { isVvocPluginEnabled } from "../../lib/plugin-toggle-config.js";
|
|
28
|
+
import { acquireNativeSnapshotRuntime, } from "../../runtime/context.js";
|
|
27
29
|
import { findActivePeak, formatPeakEndTime, formatWaitMinutes, normalizeProviderId, parsePeakHoursEntry, suggestOffPeakProviders, } from "../../lib/peak-hours.js";
|
|
28
30
|
// OpenCode internal agents that must never be gated; blocking them breaks
|
|
29
31
|
// session machinery itself.
|
|
30
32
|
const INTERNAL_AGENTS = ["compaction", "title", "summary"];
|
|
31
33
|
const BUILT_IN_SUBAGENTS = ["general"];
|
|
32
34
|
const PLUGIN_MANAGED_SUBAGENTS = ["guardian"];
|
|
35
|
+
/**
|
|
36
|
+
* The native request kind distinguishes the agent loop from auxiliary work.
|
|
37
|
+
* Only the primary loop is a user-costly provider request; compaction, title and
|
|
38
|
+
* generate are session machinery that must never be interrupted by peak gating.
|
|
39
|
+
*/
|
|
40
|
+
const HARD_GATED_KIND = "primary";
|
|
33
41
|
const PEAK_HOURS_SERVICE = "peak-hours";
|
|
34
|
-
const PROVIDER_CACHE_TTL_MS = 10 * 60 * 1_000;
|
|
35
|
-
const PROVIDER_FETCH_TIMEOUT_MS = 5_000;
|
|
36
42
|
const MAX_LOG_TEXT_CHARS = 500;
|
|
37
43
|
// START_BLOCK_AGENT_EXEMPTIONS
|
|
38
44
|
function createKnownSubagentSet() {
|
|
@@ -42,18 +48,22 @@ function createKnownSubagentSet() {
|
|
|
42
48
|
...MANAGED_SUBAGENT_NAMES,
|
|
43
49
|
]);
|
|
44
50
|
}
|
|
45
|
-
function syncConfiguredSubagents(configAgentNames, knownSubagents) {
|
|
46
|
-
for (const [name, definition] of Object.entries(configAgentNames)) {
|
|
47
|
-
if (definition &&
|
|
48
|
-
typeof definition === "object" &&
|
|
49
|
-
definition.mode === "subagent") {
|
|
50
|
-
knownSubagents.add(name);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
51
|
function isInternalAgent(agentName) {
|
|
55
52
|
return !!agentName && INTERNAL_AGENTS.includes(agentName);
|
|
56
53
|
}
|
|
54
|
+
/** True when the agent is a subagent by known name or native registry mode. */
|
|
55
|
+
async function isSubagentLike(agent, knownSubagents, agentMode) {
|
|
56
|
+
if (!agent)
|
|
57
|
+
return false;
|
|
58
|
+
if (knownSubagents.has(agent))
|
|
59
|
+
return true;
|
|
60
|
+
try {
|
|
61
|
+
return (await agentMode(agent)) === "subagent";
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
57
67
|
// END_BLOCK_AGENT_EXEMPTIONS
|
|
58
68
|
// START_CONTRACT: buildHardBlockMessage
|
|
59
69
|
// PURPOSE: Compose the hard-mode blocking error text with window end, wait time, and suggestions.
|
|
@@ -81,17 +91,19 @@ export function buildHardBlockMessage(providerID, peak, suggestions) {
|
|
|
81
91
|
function truncateLogText(value) {
|
|
82
92
|
return value.length > MAX_LOG_TEXT_CHARS ? `${value.slice(0, MAX_LOG_TEXT_CHARS)}...` : value;
|
|
83
93
|
}
|
|
84
|
-
|
|
94
|
+
function createConsoleLog() {
|
|
95
|
+
return (level, message, extra) => {
|
|
96
|
+
const suffix = extra === undefined ? "" : ` ${JSON.stringify(extra)}`;
|
|
97
|
+
console.error(`[${PEAK_HOURS_SERVICE}][${level}] ${truncateLogText(`${message}${suffix}`)}`);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
async function lookupSessionGrace(ctx, sessionID) {
|
|
85
101
|
try {
|
|
86
|
-
const
|
|
87
|
-
path: { id: sessionID },
|
|
88
|
-
query: directory ? { directory } : undefined,
|
|
89
|
-
}));
|
|
90
|
-
if (response.error || response.data === undefined)
|
|
91
|
-
return undefined;
|
|
92
|
-
const session = response.data;
|
|
102
|
+
const session = (await ctx.session.get({ sessionID }));
|
|
93
103
|
return {
|
|
94
|
-
createdMs: typeof session.time?.created === "number"
|
|
104
|
+
createdMs: typeof session.time?.created === "number" && Number.isFinite(session.time.created)
|
|
105
|
+
? session.time.created
|
|
106
|
+
: undefined,
|
|
95
107
|
parentID: typeof session.parentID === "string" ? session.parentID : undefined,
|
|
96
108
|
};
|
|
97
109
|
}
|
|
@@ -99,188 +111,208 @@ async function lookupSessionGrace(client, directory, sessionID) {
|
|
|
99
111
|
return undefined;
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const configClient = client.config;
|
|
105
|
-
if (typeof configClient?.providers === "function") {
|
|
106
|
-
try {
|
|
107
|
-
const response = await configClient.providers(directory ? { query: { directory } } : undefined);
|
|
108
|
-
const providers = response.data?.providers ?? [];
|
|
109
|
-
return providers
|
|
110
|
-
.map((provider) => provider.id)
|
|
111
|
-
.filter((id) => typeof id === "string");
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
// Fall through to the raw HTTP fallback.
|
|
115
|
-
}
|
|
116
|
-
}
|
|
114
|
+
/** Enumerate providers from the authenticated native registry (never a raw HTTP fallback). */
|
|
115
|
+
async function listConnectedProviders(ctx) {
|
|
117
116
|
try {
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
const response = await fetch(url, {
|
|
123
|
-
signal: AbortSignal.timeout(PROVIDER_FETCH_TIMEOUT_MS),
|
|
124
|
-
});
|
|
125
|
-
if (!response.ok)
|
|
117
|
+
const result = (await ctx.provider.list());
|
|
118
|
+
const data = Array.isArray(result) ? result : result?.data;
|
|
119
|
+
if (!Array.isArray(data))
|
|
126
120
|
return [];
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
return data
|
|
122
|
+
.map((provider) => typeof provider === "object" && provider !== null
|
|
123
|
+
? provider.id
|
|
124
|
+
: undefined)
|
|
131
125
|
.filter((id) => typeof id === "string");
|
|
132
126
|
}
|
|
133
127
|
catch {
|
|
134
128
|
return [];
|
|
135
129
|
}
|
|
136
130
|
}
|
|
131
|
+
// END_BLOCK_DEFAULT_DEPENDENCIES
|
|
132
|
+
// START_BLOCK_POLICY
|
|
133
|
+
async function resolveEntry(runtime, sessionID) {
|
|
134
|
+
const read = async () => {
|
|
135
|
+
try {
|
|
136
|
+
return await runtime.snapshots.configFor(sessionID);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
let capture = await read();
|
|
143
|
+
if (capture === undefined) {
|
|
144
|
+
try {
|
|
145
|
+
await runtime.snapshots.accept({ sessionID });
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// fall through to the second read; absence is unknown policy below
|
|
149
|
+
}
|
|
150
|
+
capture = await read();
|
|
151
|
+
}
|
|
152
|
+
if (capture === undefined)
|
|
153
|
+
return undefined;
|
|
154
|
+
if (!isVvocPluginEnabled(capture.vvoc, "peak-hours"))
|
|
155
|
+
return undefined;
|
|
156
|
+
return parsePeakHoursEntry(capture.vvoc.plugins?.["peak-hours"]);
|
|
157
|
+
}
|
|
137
158
|
/**
|
|
138
|
-
* Builds the peak-hours
|
|
159
|
+
* Builds the native peak-hours plugin.
|
|
139
160
|
*
|
|
140
|
-
* Soft mode is pass-through: the
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* Schedule and lookup failures degrade to soft or no-op and never block.
|
|
161
|
+
* Soft mode is pass-through: the plugin never mutates the system parts or
|
|
162
|
+
* messages, and peak cost state stays visible only through the TUI banner. The
|
|
163
|
+
* `model.request` hook enforces the hard block by throwing before the provider
|
|
164
|
+
* request is dispatched. Internal kinds (title/compaction/generate), internal
|
|
165
|
+
* agents, subagent-like agents, sessions with a parentID, and sessions created
|
|
166
|
+
* before the active window start are never hard-blocked. Unknown family policy,
|
|
167
|
+
* schedule, or session lookup failures degrade to soft or no-op and never block.
|
|
148
168
|
*/
|
|
149
|
-
export function createPeakHoursPlugin(
|
|
150
|
-
return
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return providerCache.ids;
|
|
166
|
-
}
|
|
167
|
-
const ids = await listConnectedProviders(client, serverUrl, directory);
|
|
168
|
-
providerCache.at = ids.length > 0 ? Date.now() : 0;
|
|
169
|
-
providerCache.ids = ids;
|
|
170
|
-
return ids;
|
|
171
|
-
},
|
|
172
|
-
log: async (level, message, extra) => {
|
|
169
|
+
export function createPeakHoursPlugin(options = {}) {
|
|
170
|
+
return Plugin.define({
|
|
171
|
+
id: "vvoc.peak-hours",
|
|
172
|
+
setup: async (ctx) => {
|
|
173
|
+
const acquire = options.acquireRuntime ?? ((c) => acquireNativeSnapshotRuntime(c));
|
|
174
|
+
const runtime = await acquire(ctx);
|
|
175
|
+
const knownSubagents = createKnownSubagentSet();
|
|
176
|
+
const entryCache = new Map();
|
|
177
|
+
const alerted = new Set();
|
|
178
|
+
/**
|
|
179
|
+
* Read one agent's native registry mode. The read is intentionally fresh on
|
|
180
|
+
* every query so a transient registry failure never poisons later requests
|
|
181
|
+
* and a changed mode or newly configured subagent takes effect without a
|
|
182
|
+
* restart. Returns undefined when the agent is unknown or unavailable.
|
|
183
|
+
*/
|
|
184
|
+
const defaultAgentMode = async (agent) => {
|
|
173
185
|
try {
|
|
174
|
-
await
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
186
|
+
const result = (await ctx.agent.list());
|
|
187
|
+
const data = Array.isArray(result)
|
|
188
|
+
? result
|
|
189
|
+
: (result?.data ?? undefined);
|
|
190
|
+
if (!Array.isArray(data))
|
|
191
|
+
return undefined;
|
|
192
|
+
for (const item of data) {
|
|
193
|
+
if (typeof item !== "object" || item === null)
|
|
194
|
+
continue;
|
|
195
|
+
const record = item;
|
|
196
|
+
if (String(record.id) !== agent)
|
|
197
|
+
continue;
|
|
198
|
+
if (record.mode === "subagent" || record.mode === "primary" || record.mode === "all") {
|
|
199
|
+
return record.mode;
|
|
200
|
+
}
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
return undefined;
|
|
183
204
|
}
|
|
184
205
|
catch {
|
|
185
|
-
|
|
206
|
+
return undefined;
|
|
186
207
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
208
|
+
};
|
|
209
|
+
const deps = {
|
|
210
|
+
now: options.now ?? (() => new Date()),
|
|
211
|
+
session: options.session ?? ((sessionID) => lookupSessionGrace(ctx, sessionID)),
|
|
212
|
+
agentMode: options.agentMode ?? defaultAgentMode,
|
|
213
|
+
connectedProviders: options.connectedProviders ?? (() => listConnectedProviders(ctx)),
|
|
214
|
+
log: options.log ?? createConsoleLog(),
|
|
215
|
+
};
|
|
216
|
+
const entryFor = async (sessionID) => {
|
|
217
|
+
if (entryCache.has(sessionID))
|
|
218
|
+
return entryCache.get(sessionID);
|
|
219
|
+
const resolved = await resolveEntry(runtime, sessionID);
|
|
220
|
+
if (resolved === undefined)
|
|
221
|
+
return undefined;
|
|
222
|
+
entryCache.set(sessionID, resolved);
|
|
223
|
+
if (!alerted.has(sessionID)) {
|
|
224
|
+
alerted.add(sessionID);
|
|
225
|
+
deps.log("info", "peak-hours policy bound", {
|
|
226
|
+
mode: resolved.entry.mode,
|
|
227
|
+
graceActiveSessions: resolved.entry.graceActiveSessions,
|
|
228
|
+
scheduledProviders: Object.keys(resolved.entry.schedules),
|
|
229
|
+
warningCount: resolved.warnings.length,
|
|
230
|
+
});
|
|
231
|
+
for (const warning of resolved.warnings) {
|
|
232
|
+
deps.log("warn", `peak-hours config warning: ${warning}`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return resolved;
|
|
236
|
+
};
|
|
237
|
+
// Resolves the effective peak decision for one request: peak hit plus the
|
|
238
|
+
// mode after provider overrides, kind/agent exemptions, and persisted-session
|
|
239
|
+
// grace. Returns undefined when the provider is not in peak, the request is
|
|
240
|
+
// not the primary loop, or the agent is internal OpenCode infrastructure.
|
|
241
|
+
const resolvePeakDecision = async (input) => {
|
|
242
|
+
if (input.kind !== HARD_GATED_KIND)
|
|
243
|
+
return undefined;
|
|
244
|
+
if (isInternalAgent(input.agent))
|
|
245
|
+
return undefined;
|
|
246
|
+
const resolved = await entryFor(input.sessionID);
|
|
247
|
+
if (resolved === undefined || !resolved.entry.enabled)
|
|
248
|
+
return undefined;
|
|
249
|
+
const entry = resolved.entry;
|
|
250
|
+
const now = deps.now();
|
|
251
|
+
const peak = findActivePeak(now, entry.schedules, input.providerID);
|
|
252
|
+
if (!peak)
|
|
253
|
+
return undefined;
|
|
254
|
+
const override = entry.schedules[peak.providerKey]?.mode;
|
|
255
|
+
let mode = override ?? entry.mode;
|
|
256
|
+
// Subagent-like agents are continuation of already-admitted work.
|
|
257
|
+
if (await isSubagentLike(input.agent, knownSubagents, deps.agentMode)) {
|
|
215
258
|
mode = "soft";
|
|
216
259
|
}
|
|
217
|
-
|
|
218
|
-
|
|
260
|
+
if (mode === "hard") {
|
|
261
|
+
const session = await deps.session(input.sessionID);
|
|
262
|
+
if (!session) {
|
|
263
|
+
// Fail-open: unknown session state never blocks.
|
|
219
264
|
mode = "soft";
|
|
220
265
|
}
|
|
221
|
-
|
|
222
|
-
session.
|
|
223
|
-
|
|
224
|
-
|
|
266
|
+
else {
|
|
267
|
+
if (session.parentID) {
|
|
268
|
+
mode = "soft";
|
|
269
|
+
}
|
|
270
|
+
if (entry.graceActiveSessions &&
|
|
271
|
+
session.createdMs !== undefined &&
|
|
272
|
+
session.createdMs < peak.startedAt.getTime()) {
|
|
273
|
+
mode = "soft";
|
|
274
|
+
}
|
|
225
275
|
}
|
|
226
276
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
graceActiveSessions: entry.graceActiveSessions,
|
|
233
|
-
scheduledProviders: Object.keys(entry.schedules),
|
|
234
|
-
warningCount: warnings.length,
|
|
235
|
-
});
|
|
236
|
-
for (const warning of warnings) {
|
|
237
|
-
await deps.log("warn", `peak-hours config warning: ${warning}`);
|
|
238
|
-
}
|
|
239
|
-
return {
|
|
240
|
-
config: async (config) => {
|
|
241
|
-
syncConfiguredSubagents((config.agent ?? {}), knownSubagents);
|
|
242
|
-
},
|
|
243
|
-
"chat.params": async (input) => {
|
|
244
|
-
const providerID = input.model?.providerID;
|
|
245
|
-
if (!providerID)
|
|
277
|
+
return { peak, mode, schedules: entry.schedules };
|
|
278
|
+
};
|
|
279
|
+
const registration = await ctx.session.hook("model.request", async (event) => {
|
|
280
|
+
const providerID = event.model?.providerID;
|
|
281
|
+
if (providerID === undefined)
|
|
246
282
|
return;
|
|
247
283
|
const decision = await resolvePeakDecision({
|
|
248
|
-
agent:
|
|
249
|
-
providerID,
|
|
250
|
-
sessionID:
|
|
284
|
+
agent: event.agent === undefined ? undefined : String(event.agent),
|
|
285
|
+
providerID: String(providerID),
|
|
286
|
+
sessionID: String(event.sessionID),
|
|
287
|
+
kind: String(event.kind),
|
|
251
288
|
});
|
|
252
289
|
if (!decision || decision.mode !== "hard")
|
|
253
290
|
return;
|
|
254
291
|
const now = deps.now();
|
|
255
292
|
const connected = await deps.connectedProviders();
|
|
256
|
-
const suggestions = suggestOffPeakProviders(now,
|
|
257
|
-
const message = buildHardBlockMessage(providerID, decision.peak, suggestions);
|
|
258
|
-
|
|
259
|
-
providerID,
|
|
293
|
+
const suggestions = suggestOffPeakProviders(now, decision.schedules, connected).filter((candidate) => normalizeProviderId(candidate) !== normalizeProviderId(String(providerID)));
|
|
294
|
+
const message = buildHardBlockMessage(String(providerID), decision.peak, suggestions);
|
|
295
|
+
deps.log("info", "peak-hours hard block applied", {
|
|
296
|
+
providerID: String(providerID),
|
|
260
297
|
providerKey: decision.peak.providerKey,
|
|
261
298
|
until: formatPeakEndTime(decision.peak.endsAt),
|
|
262
299
|
waitMinutes: decision.peak.minutesRemaining,
|
|
263
300
|
suggestions,
|
|
264
|
-
sessionID:
|
|
301
|
+
sessionID: String(event.sessionID),
|
|
265
302
|
});
|
|
266
|
-
// Throwing here fails the
|
|
267
|
-
// persisted, so OpenCode renders the block as a
|
|
268
|
-
//
|
|
303
|
+
// Throwing here fails the model request before any provider call, after the
|
|
304
|
+
// user message was already persisted, so OpenCode renders the block as a
|
|
305
|
+
// standard error instead of dropping the message.
|
|
269
306
|
throw new Error(message);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
307
|
+
});
|
|
308
|
+
return async () => {
|
|
309
|
+
await registration.dispose();
|
|
310
|
+
await runtime.release();
|
|
311
|
+
};
|
|
312
|
+
},
|
|
313
|
+
});
|
|
273
314
|
}
|
|
274
315
|
export const PeakHoursPlugin = createPeakHoursPlugin();
|
|
316
|
+
export default PeakHoursPlugin;
|
|
275
317
|
// END_BLOCK_PLUGIN_ENTRY
|
|
276
|
-
// START_BLOCK_DUAL_SUBPATH_ENTRY
|
|
277
|
-
import { defineDualPlugin } from "../v2-runtime/index.js";
|
|
278
|
-
import { createV2Adapter } from "../v2-runtime/setup.js";
|
|
279
|
-
import { setupPeakHoursV2 } from "./v2.js";
|
|
280
|
-
export default defineDualPlugin({
|
|
281
|
-
id: "vvoc.peak-hours",
|
|
282
|
-
v1: PeakHoursPlugin,
|
|
283
|
-
v2: (ctx) => setupPeakHoursV2(createV2Adapter(ctx)),
|
|
284
|
-
});
|
|
285
|
-
// END_BLOCK_DUAL_SUBPATH_ENTRY
|
|
286
318
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/peak-hours/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,iBAAiB;AACjB,wBAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/peak-hours/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,iBAAiB;AACjB,wBAAwB;AACxB,gPAAgP;AAChP,smBAAsmB;AACtmB,gIAAgI;AAChI,kGAAkG;AAClG,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,0EAA0E;AAC1E,uIAAuI;AACvI,qGAAqG;AACrG,uFAAuF;AACvF,8FAA8F;AAC9F,mEAAmE;AACnE,uDAAuD;AACvD,iBAAiB;AACjB,EAAE;AACF,uBAAuB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