@osovv/vv-opencode 2.0.1 → 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 +42 -0
- package/README.md +87 -86
- 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 +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 -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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// VERSION: 1.0.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
4
|
// PURPOSE: Deep traversal helpers for restoring/redacting placeholders in nested objects and arrays.
|
|
5
|
-
// SCOPE:
|
|
5
|
+
// SCOPE: copy-on-write object/array traversal that never writes into the provided value, cycle-safe with a WeakMap from original to owned copy
|
|
6
6
|
// DEPENDS: session, restore, engine
|
|
7
7
|
// LINKS: [M-PLUGIN-SECRETS-REDACTION]
|
|
8
8
|
// ROLE: RUNTIME
|
|
@@ -10,73 +10,57 @@
|
|
|
10
10
|
// END_MODULE_CONTRACT
|
|
11
11
|
//
|
|
12
12
|
// START_MODULE_MAP
|
|
13
|
-
// restoreDeep - restores placeholders
|
|
14
|
-
// redactDeep - redacts secrets
|
|
13
|
+
// restoreDeep - restores placeholders into owned copies of nested objects/arrays
|
|
14
|
+
// redactDeep - redacts secrets into owned copies of nested objects/arrays
|
|
15
15
|
// END_MODULE_MAP
|
|
16
16
|
//
|
|
17
17
|
// START_CHANGE_SUMMARY
|
|
18
|
-
// LAST_CHANGE: [
|
|
18
|
+
// LAST_CHANGE: [C-OPENCODE-V2-NATIVE T-009-SECRETS - restoreDeep/redactDeep rebuild arrays and objects into owned copies instead of assigning entries in place, so a host-frozen nested tool input can no longer trigger "Attempted to assign to readonly property"; a WeakMap records original -> copy to keep cycle and shared-reference safety. String-leaf results are unchanged.]
|
|
19
19
|
// END_CHANGE_SUMMARY
|
|
20
20
|
import { redactText } from "./engine.js";
|
|
21
21
|
import { restoreText } from "./restore.js";
|
|
22
|
-
|
|
22
|
+
// START_BLOCK_DEEP_COPY
|
|
23
|
+
/**
|
|
24
|
+
* Copy-on-write deep traversal shared by restore and redact. Arrays and objects
|
|
25
|
+
* are rebuilt into owned copies, so the host-provided value — which the native
|
|
26
|
+
* host may freeze — is never written to. A WeakMap records original -> copy so a
|
|
27
|
+
* cyclic or shared reference resolves to one consistent copy instead of
|
|
28
|
+
* recursing forever. String leaves go through `transform`; other primitives are
|
|
29
|
+
* returned unchanged.
|
|
30
|
+
*/
|
|
31
|
+
function deepCopyWithText(value, transform, seen) {
|
|
23
32
|
if (value === null || value === undefined)
|
|
24
33
|
return value;
|
|
25
34
|
if (typeof value === "string")
|
|
26
|
-
return
|
|
27
|
-
if (typeof value === "number" || typeof value === "boolean")
|
|
35
|
+
return transform(value);
|
|
36
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
28
37
|
return value;
|
|
29
|
-
|
|
38
|
+
}
|
|
39
|
+
if (typeof value !== "object")
|
|
30
40
|
return value;
|
|
41
|
+
if (seen.has(value))
|
|
42
|
+
return seen.get(value);
|
|
31
43
|
if (Array.isArray(value)) {
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
const copy = [];
|
|
45
|
+
seen.set(value, copy);
|
|
46
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
47
|
+
copy.push(deepCopyWithText(value[index], transform, seen));
|
|
34
48
|
}
|
|
35
|
-
return
|
|
49
|
+
return copy;
|
|
36
50
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
const source = value;
|
|
52
|
+
const copy = {};
|
|
53
|
+
seen.set(value, copy);
|
|
54
|
+
for (const key of Object.keys(source)) {
|
|
55
|
+
copy[key] = deepCopyWithText(source[key], transform, seen);
|
|
40
56
|
}
|
|
41
|
-
return
|
|
57
|
+
return copy;
|
|
42
58
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
seen.add(obj);
|
|
47
|
-
for (const key of Object.keys(obj)) {
|
|
48
|
-
obj[key] = restoreDeep(obj[key], session);
|
|
49
|
-
}
|
|
50
|
-
return obj;
|
|
59
|
+
// END_BLOCK_DEEP_COPY
|
|
60
|
+
export function restoreDeep(value, session) {
|
|
61
|
+
return deepCopyWithText(value, (text) => restoreText(text, session), new WeakMap());
|
|
51
62
|
}
|
|
52
63
|
export function redactDeep(value, patternSet, session) {
|
|
53
|
-
|
|
54
|
-
return value;
|
|
55
|
-
if (typeof value === "string")
|
|
56
|
-
return redactText(value, patternSet, session).text;
|
|
57
|
-
if (typeof value === "number" || typeof value === "boolean")
|
|
58
|
-
return value;
|
|
59
|
-
if (typeof value === "bigint")
|
|
60
|
-
return value;
|
|
61
|
-
if (Array.isArray(value)) {
|
|
62
|
-
for (let i = 0; i < value.length; i++) {
|
|
63
|
-
value[i] = redactDeep(value[i], patternSet, session);
|
|
64
|
-
}
|
|
65
|
-
return value;
|
|
66
|
-
}
|
|
67
|
-
if (typeof value === "object") {
|
|
68
|
-
const seen = new WeakSet();
|
|
69
|
-
return redactDeepObject(value, patternSet, session, seen);
|
|
70
|
-
}
|
|
71
|
-
return value;
|
|
72
|
-
}
|
|
73
|
-
function redactDeepObject(obj, patternSet, session, seen) {
|
|
74
|
-
if (seen.has(obj))
|
|
75
|
-
return obj;
|
|
76
|
-
seen.add(obj);
|
|
77
|
-
for (const key of Object.keys(obj)) {
|
|
78
|
-
obj[key] = redactDeep(obj[key], patternSet, session);
|
|
79
|
-
}
|
|
80
|
-
return obj;
|
|
64
|
+
return deepCopyWithText(value, (text) => redactText(text, patternSet, session).text, new WeakMap());
|
|
81
65
|
}
|
|
82
66
|
//# sourceMappingURL=deep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep.js","sourceRoot":"","sources":["../../../src/plugins/secrets-redaction/deep.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,iBAAiB;AACjB,wBAAwB;AACxB,uGAAuG;AACvG,
|
|
1
|
+
{"version":3,"file":"deep.js","sourceRoot":"","sources":["../../../src/plugins/secrets-redaction/deep.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,iBAAiB;AACjB,wBAAwB;AACxB,uGAAuG;AACvG,iJAAiJ;AACjJ,sCAAsC;AACtC,wCAAwC;AACxC,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,mFAAmF;AACnF,4EAA4E;AAC5E,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,yXAAyX;AACzX,qBAAqB;AAIrB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,wBAAwB;AACxB;;;;;;;GAOG;AACH,SAAS,gBAAgB,CACvB,KAAc,EACd,SAAmC,EACnC,IAA8B;IAE9B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACzF,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,GAAc,EAAE,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACtB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YACrD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AACD,sBAAsB;AAEtB,MAAM,UAAU,WAAW,CAAC,KAAc,EAAE,OAA2B;IACrE,OAAO,gBAAgB,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,KAAc,EACd,UAAsB,EACtB,OAA2B;IAE3B,OAAO,gBAAgB,CACrB,KAAK,EACL,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,EACpD,IAAI,OAAO,EAAE,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,97 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type
|
|
4
|
-
import type { Part } from "@opencode-ai/sdk/client";
|
|
1
|
+
import { Plugin } from "@opencode/plugin";
|
|
2
|
+
import { type NativeSnapshotContext, type NativeSnapshotRuntime } from "../../runtime/context.js";
|
|
3
|
+
import { type SecretsRedactionConfig } from "./config.js";
|
|
5
4
|
export declare const PLACEHOLDER_PREFIX = "__VVOC_SECRET_";
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
/** Family-scoped policy key plus normalized secrets config. */
|
|
6
|
+
export interface SecretsPolicyResolution {
|
|
7
|
+
readonly key: string;
|
|
8
|
+
readonly config: SecretsRedactionConfig;
|
|
9
|
+
}
|
|
10
|
+
/** A family whose captured policy disables secrets-redaction: the only legitimate no-redaction path. */
|
|
11
|
+
export type SecretsPolicyDecision = SecretsPolicyResolution | "disabled" | undefined;
|
|
12
|
+
/** No trustworthy family policy exists, so provider-bound work is blocked. */
|
|
13
|
+
export declare class SecretsPolicyUnboundError extends Error {
|
|
14
|
+
readonly code = "SECRETS_POLICY_UNBOUND";
|
|
15
|
+
constructor(sessionID: string);
|
|
16
|
+
}
|
|
17
|
+
interface NativeSystemPart {
|
|
18
|
+
type?: string;
|
|
19
|
+
text?: string;
|
|
20
|
+
metadata?: unknown;
|
|
21
|
+
}
|
|
22
|
+
interface NativeContentPart {
|
|
23
|
+
type?: string;
|
|
24
|
+
text?: string;
|
|
25
|
+
thinking?: string;
|
|
26
|
+
input?: unknown;
|
|
27
|
+
result?: {
|
|
28
|
+
type?: string;
|
|
29
|
+
value?: unknown;
|
|
30
|
+
};
|
|
31
|
+
metadata?: unknown;
|
|
32
|
+
}
|
|
33
|
+
interface NativeMessage {
|
|
34
|
+
role?: string;
|
|
35
|
+
content?: NativeContentPart[];
|
|
36
|
+
}
|
|
37
|
+
export interface SecretsContextEvent {
|
|
38
|
+
sessionID: string;
|
|
39
|
+
system?: NativeSystemPart[] | undefined;
|
|
40
|
+
messages?: NativeMessage[] | undefined;
|
|
41
|
+
}
|
|
42
|
+
export interface SecretsToolBeforeEvent {
|
|
43
|
+
readonly sessionID: string;
|
|
44
|
+
readonly tool: string;
|
|
45
|
+
input: unknown;
|
|
46
|
+
}
|
|
47
|
+
export interface SecretsHttpResponseEvent {
|
|
48
|
+
readonly sessionID: string;
|
|
49
|
+
response: Response;
|
|
50
|
+
}
|
|
51
|
+
export interface SecretsWsReceiveEvent {
|
|
52
|
+
readonly sessionID: string;
|
|
53
|
+
frame: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Native `experimental.ws.handshake` event: the request boundary a WebSocket-backed
|
|
57
|
+
* model call crosses once, before the session socket is selected or reused.
|
|
58
|
+
*/
|
|
59
|
+
export interface SecretsWsHandshakeEvent {
|
|
60
|
+
readonly sessionID: string;
|
|
61
|
+
}
|
|
62
|
+
/** Native hook handlers for context/generate/compaction/title/tool/http/ws. */
|
|
63
|
+
export interface SecretsRedactionHandlers {
|
|
64
|
+
context(event: SecretsContextEvent): Promise<void>;
|
|
65
|
+
generate(event: SecretsContextEvent): Promise<void>;
|
|
66
|
+
compaction(event: SecretsContextEvent): Promise<void>;
|
|
67
|
+
title(event: SecretsContextEvent): Promise<void>;
|
|
68
|
+
httpResponse(event: SecretsHttpResponseEvent): Promise<void>;
|
|
69
|
+
wsHandshake(event: SecretsWsHandshakeEvent): Promise<void>;
|
|
70
|
+
wsReceive(event: SecretsWsReceiveEvent): Promise<void>;
|
|
71
|
+
toolBefore(event: SecretsToolBeforeEvent): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
/** Handlers plus cleanup-owning dispose. */
|
|
74
|
+
export interface SecretsRedactionRegistration {
|
|
75
|
+
readonly handlers: SecretsRedactionHandlers;
|
|
76
|
+
dispose(): void;
|
|
77
|
+
}
|
|
78
|
+
/** Injectable strict policy resolver and diagnostic sink. */
|
|
79
|
+
export interface SecretsRedactionDependencies {
|
|
80
|
+
configFor(sessionID: string): Promise<SecretsPolicyDecision>;
|
|
81
|
+
log(event: {
|
|
82
|
+
readonly level: "info" | "warn" | "debug";
|
|
83
|
+
readonly message: string;
|
|
84
|
+
}): void;
|
|
85
|
+
}
|
|
86
|
+
/** Build per-family state plus native hook handlers with injectable dependencies. */
|
|
87
|
+
export declare function createSecretsRedactionRegistration(deps: SecretsRedactionDependencies): SecretsRedactionRegistration;
|
|
88
|
+
export interface SecretsRedactionPluginOptions {
|
|
89
|
+
/** Test-only injectable runtime acquisition. Default acquires the real shared runtime. */
|
|
90
|
+
acquireRuntime?: (ctx: NativeSnapshotContext) => Promise<NativeSnapshotRuntime>;
|
|
91
|
+
/** Test-only diagnostic sink override. */
|
|
92
|
+
log?: SecretsRedactionDependencies["log"];
|
|
93
|
+
}
|
|
94
|
+
/** Native secrets-redaction plugin factory; the default export uses the real shared runtime. */
|
|
95
|
+
export declare function createSecretsRedactionPlugin(options?: SecretsRedactionPluginOptions): Plugin.Plugin;
|
|
96
|
+
export declare const SecretsRedactionPlugin: Plugin.Plugin;
|
|
97
|
+
export default SecretsRedactionPlugin;
|