@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/plugins/tool-history-compaction/transform.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,iBAAiB;AACjB,wBAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/plugins/tool-history-compaction/transform.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,iBAAiB;AACjB,wBAAwB;AACxB,2ZAA2Z;AAC3Z,ybAAyb;AACzb,kRAAkR;AAClR,kFAAkF;AAClF,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,qGAAqG;AACrG,0GAA0G;AAC1G,mGAAmG;AACnG,yJAAyJ;AACzJ,2FAA2F;AAC3F,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,oRAAoR;AACpR,qBAAqB;AAIrB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB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,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;oBAC3C,IAAI,MAAM;wBAAE,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;gBACxC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAC/C,IAAI,UAAU,EAAE,CAAC;oBACf,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;wBAC5B,MAAM,SAAS,GAAG,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;wBACxD,IAAI,SAAS,EAAE,CAAC;4BACd,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;4BAC3D,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;wBACnE,CAAC;6BAAM,CAAC;4BACN,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC;wBAChC,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC;oBAChC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;gBACpD,qEAAqE;gBACrE,8DAA8D;gBAC9D,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AACD,oBAAoB"}
|
|
@@ -1,17 +1,55 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ToolContext as NativeToolContext } from "@opencode/plugin/promise/tool";
|
|
2
3
|
import type { ResolvedWebFetchConfig } from "./config.js";
|
|
4
|
+
import { type WebPermissionGuard, type WebToolsRuntime } from "./search-service.js";
|
|
5
|
+
import { webFetchContract } from "./schemas.js";
|
|
3
6
|
export { WEB_FETCH_DEFAULT_TIMEOUT_SECONDS, WEB_FETCH_MAX_TIMEOUT_SECONDS } from "./schemas.js";
|
|
7
|
+
type NativeToolContent = {
|
|
8
|
+
readonly type: "text";
|
|
9
|
+
readonly text: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly type: "file";
|
|
12
|
+
readonly uri: string;
|
|
13
|
+
readonly mime: string;
|
|
14
|
+
readonly name?: string;
|
|
15
|
+
};
|
|
16
|
+
export interface MappedResult {
|
|
17
|
+
readonly output: string;
|
|
18
|
+
readonly content: string | ReadonlyArray<NativeToolContent>;
|
|
19
|
+
readonly metadata: Record<string, unknown>;
|
|
20
|
+
}
|
|
4
21
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* bounded field diagnostic before any permission request, credential lookup, or
|
|
9
|
-
* dispatch; the documented format/timeout defaults are re-applied here
|
|
10
|
-
* forwards unparsed raw arguments.
|
|
11
|
-
*
|
|
12
|
-
* with a short Markdown summary in the same ToolResult and reports metadata
|
|
13
|
-
* { provider, format, credentialSource?, status?, durationMs? }.
|
|
14
|
-
* Native fetch requires no credential; Spider and Z.AI validate credentials at execution time
|
|
15
|
-
* with actionable messages naming the environment variable and web.fetch.apiKey.
|
|
22
|
+
* Execute one web_fetch against an already-resolved config. Validates raw
|
|
23
|
+
* host-forwarded arguments through the shared strict contract first, so unknown
|
|
24
|
+
* keys, invalid provided values, and unsupported or malformed URLs reject with a
|
|
25
|
+
* bounded field diagnostic before any permission request, credential lookup, or
|
|
26
|
+
* provider dispatch; the documented format/timeout defaults are re-applied here
|
|
27
|
+
* because the host forwards unparsed raw arguments. The awaited permission is
|
|
28
|
+
* resource-specific (url pattern) and runs before any network effect.
|
|
16
29
|
*/
|
|
17
|
-
export declare function
|
|
30
|
+
export declare function executeWebFetch(resolved: ResolvedWebFetchConfig, permission: WebPermissionGuard, args: unknown, context: NativeToolContext): Promise<MappedResult>;
|
|
31
|
+
/** Create a web_fetch tool pre-bound to one resolved config (direct/deterministic tests and callers). */
|
|
32
|
+
export declare function createWebFetchToolForConfig(resolved: ResolvedWebFetchConfig, permission: WebPermissionGuard): {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
input: typeof webFetchContract.runtimeSchema;
|
|
36
|
+
output: z.ZodString;
|
|
37
|
+
options: {
|
|
38
|
+
codemode: false;
|
|
39
|
+
};
|
|
40
|
+
execute: (args: unknown, context: NativeToolContext) => Promise<MappedResult>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Create the native web_fetch tool bound to a per-session policy resolver.
|
|
44
|
+
* A disabled or unknown family policy refuses the owned provider-bound path.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createWebFetchTool(runtime: WebToolsRuntime): {
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
input: typeof webFetchContract.runtimeSchema;
|
|
50
|
+
output: z.ZodString;
|
|
51
|
+
options: {
|
|
52
|
+
codemode: false;
|
|
53
|
+
};
|
|
54
|
+
execute: (args: unknown, context: NativeToolContext) => Promise<MappedResult>;
|
|
55
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// FILE: src/plugins/web-tools/fetch-service.ts
|
|
2
|
-
// VERSION: 1.0
|
|
2
|
+
// VERSION: 2.1.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
|
-
// PURPOSE: Build the provider-neutral web_fetch tool: strict contract validation with explicit execute-time defaults, URL scheme/shape rejection, permission
|
|
5
|
-
// SCOPE:
|
|
6
|
-
// DEPENDS: [@opencode
|
|
7
|
-
// LINKS: M-WEB-FETCH-SERVICE, M-WEB-NATIVE-FETCH, M-WEB-SPIDER, M-WEB-ZAI, M-WEB-MEDIA-LOADER, M-WEB-EXA, M-PLUGIN-WEB-TOOLS, M-AGENT-TOOL-CONTRACT, V-M-WEB-FETCH-SERVICE, DF-WEB-FETCH
|
|
4
|
+
// PURPOSE: Build the provider-neutral native web_fetch tool: strict contract validation with explicit execute-time defaults, URL scheme/shape rejection, per-family captured policy/config resolution, awaited resource permission before any network effect, provider dispatch, and structured text or native file-content results.
|
|
5
|
+
// SCOPE: Native Tool.Info factory plus provider result mapping. Validates raw host-forwarded arguments through the shared web_fetch contract before any permission request, credential lookup, or provider dispatch; awaits a resource-specific permission; delegates retrieval and conversion to the native, Spider, and direct Z.AI adapters. Media attachments map to native Tool file content covering data-URI binary payloads. No V1 ToolDefinition/context.ask, no startup-global toggle.
|
|
6
|
+
// DEPENDS: [@opencode/plugin/promise/tool, zod, src/lib/agent-tool-contract.ts, src/plugins/web-tools/config.ts, src/plugins/web-tools/schemas.ts, src/plugins/web-tools/search-service.ts (WebPermissionGuard/WebToolsRuntime), src/plugins/web-tools/providers/native-fetch.ts, src/plugins/web-tools/providers/spider.ts, src/plugins/web-tools/providers/zai.ts, src/plugins/web-tools/providers/exa.ts]
|
|
7
|
+
// LINKS: [M-WEB-FETCH-SERVICE, M-WEB-NATIVE-FETCH, M-WEB-SPIDER, M-WEB-ZAI, M-WEB-MEDIA-LOADER, M-WEB-EXA, M-PLUGIN-WEB-TOOLS, M-AGENT-TOOL-CONTRACT, V-M-WEB-FETCH-SERVICE, DF-WEB-FETCH]
|
|
8
8
|
// ROLE: RUNTIME
|
|
9
9
|
// MAP_MODE: EXPORTS
|
|
10
10
|
// END_MODULE_CONTRACT
|
|
@@ -12,37 +12,49 @@
|
|
|
12
12
|
// START_MODULE_MAP
|
|
13
13
|
// WEB_FETCH_DEFAULT_TIMEOUT_SECONDS - Default per-call timeout in seconds (re-exported from schemas).
|
|
14
14
|
// WEB_FETCH_MAX_TIMEOUT_SECONDS - Maximum model-configurable timeout in seconds (re-exported from schemas).
|
|
15
|
-
//
|
|
15
|
+
// executeWebFetch - Execute one validated fetch against a resolved config and permission guard.
|
|
16
|
+
// createWebFetchToolForConfig - Create a web_fetch tool pre-bound to one resolved config (tests/direct).
|
|
17
|
+
// createWebFetchTool - Create the native web_fetch tool bound to a per-session policy resolver.
|
|
18
|
+
// MappedResult - Native Tool.Result shape emitted by web_fetch.
|
|
16
19
|
// END_MODULE_MAP
|
|
17
20
|
//
|
|
18
21
|
// START_CHANGE_SUMMARY
|
|
19
|
-
// LAST_CHANGE: [C-
|
|
22
|
+
// LAST_CHANGE: [C-OPENCODE-V2-NATIVE T-005 attempt 2 - Split per-provider execution from a per-session policy resolver so a startup-global toggle can no longer hijack a disabled captured family or block a later enabled one.]
|
|
20
23
|
// END_CHANGE_SUMMARY
|
|
21
|
-
import {
|
|
24
|
+
import { z } from "zod";
|
|
22
25
|
import { ContractInputError } from "../../lib/agent-tool-contract.js";
|
|
23
26
|
import { WebProviderError } from "./providers/exa.js";
|
|
24
27
|
import { fetchNative } from "./providers/native-fetch.js";
|
|
25
28
|
import { scrapeSpider } from "./providers/spider.js";
|
|
26
29
|
import { fetchZai } from "./providers/zai.js";
|
|
27
|
-
import {
|
|
30
|
+
import { WebToolsPolicyError, } from "./search-service.js";
|
|
31
|
+
import { WEB_FETCH_TOOL_ID, validateWebFetchToolInput, webFetchContract, } from "./schemas.js";
|
|
28
32
|
export { WEB_FETCH_DEFAULT_TIMEOUT_SECONDS, WEB_FETCH_MAX_TIMEOUT_SECONDS } from "./schemas.js";
|
|
29
33
|
// START_BLOCK_RESULT_MAPPING
|
|
30
34
|
function mediaSummary(attachment) {
|
|
31
35
|
const name = attachment.filename ? `\`${attachment.filename}\`` : "the requested resource";
|
|
32
36
|
return `Fetched ${name} as a ${attachment.mime} attachment.`;
|
|
33
37
|
}
|
|
38
|
+
/** Map a host-neutral attachment to a native Tool file-content frame (data-URI payload preserved). */
|
|
39
|
+
function fileContent(attachment) {
|
|
40
|
+
return {
|
|
41
|
+
type: "file",
|
|
42
|
+
uri: attachment.url,
|
|
43
|
+
mime: attachment.mime,
|
|
44
|
+
...(attachment.filename === undefined ? {} : { name: attachment.filename }),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
34
47
|
function nativeResult(url, format, outcome) {
|
|
35
48
|
if (outcome.kind === "media") {
|
|
36
49
|
return {
|
|
37
|
-
title: `web_fetch: ${url}`,
|
|
38
50
|
output: mediaSummary(outcome.attachment),
|
|
39
|
-
|
|
51
|
+
content: [fileContent(outcome.attachment)],
|
|
40
52
|
metadata: { provider: "native", format, status: outcome.status },
|
|
41
53
|
};
|
|
42
54
|
}
|
|
43
55
|
return {
|
|
44
|
-
title: `web_fetch: ${url}`,
|
|
45
56
|
output: outcome.content,
|
|
57
|
+
content: outcome.content,
|
|
46
58
|
metadata: { provider: "native", format, status: outcome.status },
|
|
47
59
|
};
|
|
48
60
|
}
|
|
@@ -55,13 +67,12 @@ function spiderResult(url, format, credentialSource, outcome) {
|
|
|
55
67
|
};
|
|
56
68
|
if (outcome.kind === "media") {
|
|
57
69
|
return {
|
|
58
|
-
title: `web_fetch: ${url}`,
|
|
59
70
|
output: mediaSummary(outcome.attachment),
|
|
60
|
-
|
|
71
|
+
content: [fileContent(outcome.attachment)],
|
|
61
72
|
metadata,
|
|
62
73
|
};
|
|
63
74
|
}
|
|
64
|
-
return {
|
|
75
|
+
return { output: outcome.content, content: outcome.content, metadata };
|
|
65
76
|
}
|
|
66
77
|
function zaiResult(url, format, region, credentialSource, outcome) {
|
|
67
78
|
const metadata = {
|
|
@@ -73,80 +84,100 @@ function zaiResult(url, format, region, credentialSource, outcome) {
|
|
|
73
84
|
};
|
|
74
85
|
if (outcome.kind === "media") {
|
|
75
86
|
return {
|
|
76
|
-
title: `web_fetch: ${url}`,
|
|
77
87
|
output: mediaSummary(outcome.attachment),
|
|
78
|
-
|
|
88
|
+
content: [fileContent(outcome.attachment)],
|
|
79
89
|
metadata,
|
|
80
90
|
};
|
|
81
91
|
}
|
|
82
|
-
return {
|
|
92
|
+
return { output: outcome.content, content: outcome.content, metadata };
|
|
83
93
|
}
|
|
84
94
|
// END_BLOCK_RESULT_MAPPING
|
|
85
95
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* bounded field diagnostic before any permission request, credential lookup, or
|
|
90
|
-
* dispatch; the documented format/timeout defaults are re-applied here
|
|
91
|
-
* forwards unparsed raw arguments.
|
|
92
|
-
*
|
|
93
|
-
* with a short Markdown summary in the same ToolResult and reports metadata
|
|
94
|
-
* { provider, format, credentialSource?, status?, durationMs? }.
|
|
95
|
-
* Native fetch requires no credential; Spider and Z.AI validate credentials at execution time
|
|
96
|
-
* with actionable messages naming the environment variable and web.fetch.apiKey.
|
|
96
|
+
* Execute one web_fetch against an already-resolved config. Validates raw
|
|
97
|
+
* host-forwarded arguments through the shared strict contract first, so unknown
|
|
98
|
+
* keys, invalid provided values, and unsupported or malformed URLs reject with a
|
|
99
|
+
* bounded field diagnostic before any permission request, credential lookup, or
|
|
100
|
+
* provider dispatch; the documented format/timeout defaults are re-applied here
|
|
101
|
+
* because the host forwards unparsed raw arguments. The awaited permission is
|
|
102
|
+
* resource-specific (url pattern) and runs before any network effect.
|
|
97
103
|
*/
|
|
98
|
-
export function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return nativeResult(url, format, outcome);
|
|
123
|
-
}
|
|
124
|
-
if (!resolved.credential) {
|
|
125
|
-
throw new WebProviderError(resolved.provider, "MISSING_CREDENTIAL", `missing credential for ${resolved.provider}: set ${resolved.envVar ?? "SPIDER_API_KEY"} or ${resolved.configField ?? "web.fetch.apiKey"}`);
|
|
126
|
-
}
|
|
127
|
-
if (resolved.provider === "zai") {
|
|
128
|
-
if (!resolved.region) {
|
|
129
|
-
throw new Error("web.fetch.region is required when provider is zai");
|
|
130
|
-
}
|
|
131
|
-
const outcome = await fetchZai({
|
|
132
|
-
url,
|
|
133
|
-
format,
|
|
134
|
-
region: resolved.region,
|
|
135
|
-
credential: resolved.credential,
|
|
136
|
-
abort: context.abort,
|
|
137
|
-
timeoutMs,
|
|
138
|
-
});
|
|
139
|
-
return zaiResult(url, format, resolved.region, resolved.credential.source, outcome);
|
|
104
|
+
export async function executeWebFetch(resolved, permission, args, context) {
|
|
105
|
+
const validation = validateWebFetchToolInput(args);
|
|
106
|
+
if (!validation.ok) {
|
|
107
|
+
throw new ContractInputError(WEB_FETCH_TOOL_ID, validation.issues);
|
|
108
|
+
}
|
|
109
|
+
const { url, format, timeout: timeoutSeconds } = validation.data;
|
|
110
|
+
return permission.guard({
|
|
111
|
+
sessionID: context.sessionID,
|
|
112
|
+
action: "web_fetch",
|
|
113
|
+
resources: [url],
|
|
114
|
+
metadata: { provider: resolved.provider, format },
|
|
115
|
+
...(context.agent === undefined ? {} : { agent: context.agent }),
|
|
116
|
+
}, async () => {
|
|
117
|
+
const timeoutMs = timeoutSeconds * 1000;
|
|
118
|
+
if (resolved.provider === "native") {
|
|
119
|
+
const outcome = await fetchNative({ url, format, abort: context.signal, timeoutMs });
|
|
120
|
+
return nativeResult(url, format, outcome);
|
|
121
|
+
}
|
|
122
|
+
if (!resolved.credential) {
|
|
123
|
+
throw new WebProviderError(resolved.provider, "MISSING_CREDENTIAL", `missing credential for ${resolved.provider}: set ${resolved.envVar ?? "SPIDER_API_KEY"} or ${resolved.configField ?? "web.fetch.apiKey"}`);
|
|
124
|
+
}
|
|
125
|
+
if (resolved.provider === "zai") {
|
|
126
|
+
if (!resolved.region) {
|
|
127
|
+
throw new Error("web.fetch.region is required when provider is zai");
|
|
140
128
|
}
|
|
141
|
-
const outcome = await
|
|
129
|
+
const outcome = await fetchZai({
|
|
142
130
|
url,
|
|
143
131
|
format,
|
|
132
|
+
region: resolved.region,
|
|
144
133
|
credential: resolved.credential,
|
|
145
|
-
abort: context.
|
|
134
|
+
abort: context.signal,
|
|
146
135
|
timeoutMs,
|
|
147
136
|
});
|
|
148
|
-
return
|
|
137
|
+
return zaiResult(url, format, resolved.region, resolved.credential.source, outcome);
|
|
138
|
+
}
|
|
139
|
+
const outcome = await scrapeSpider({
|
|
140
|
+
url,
|
|
141
|
+
format,
|
|
142
|
+
credential: resolved.credential,
|
|
143
|
+
abort: context.signal,
|
|
144
|
+
timeoutMs,
|
|
145
|
+
});
|
|
146
|
+
return spiderResult(url, format, resolved.credential.source, outcome);
|
|
147
|
+
}, { signal: context.signal });
|
|
148
|
+
}
|
|
149
|
+
/** Create a web_fetch tool pre-bound to one resolved config (direct/deterministic tests and callers). */
|
|
150
|
+
export function createWebFetchToolForConfig(resolved, permission) {
|
|
151
|
+
return {
|
|
152
|
+
name: WEB_FETCH_TOOL_ID,
|
|
153
|
+
description: webFetchContract.description,
|
|
154
|
+
input: webFetchContract.runtimeSchema,
|
|
155
|
+
output: z.string(),
|
|
156
|
+
options: { codemode: false },
|
|
157
|
+
execute: (args, context) => executeWebFetch(resolved, permission, args, context),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Create the native web_fetch tool bound to a per-session policy resolver.
|
|
162
|
+
* A disabled or unknown family policy refuses the owned provider-bound path.
|
|
163
|
+
*/
|
|
164
|
+
export function createWebFetchTool(runtime) {
|
|
165
|
+
return {
|
|
166
|
+
name: WEB_FETCH_TOOL_ID,
|
|
167
|
+
description: webFetchContract.description,
|
|
168
|
+
input: webFetchContract.runtimeSchema,
|
|
169
|
+
output: z.string(),
|
|
170
|
+
options: { codemode: false },
|
|
171
|
+
async execute(args, context) {
|
|
172
|
+
const decision = await runtime.resolve(context.sessionID);
|
|
173
|
+
if (decision === "disabled") {
|
|
174
|
+
throw new WebToolsPolicyError("web tools are disabled by the captured policy bound to this session.");
|
|
175
|
+
}
|
|
176
|
+
if (decision === undefined) {
|
|
177
|
+
throw new WebToolsPolicyError("no trustworthy web-tools policy is bound to this session; refusing the provider-bound web path.");
|
|
178
|
+
}
|
|
179
|
+
return executeWebFetch(decision.resolved.fetch, decision.permission, args, context);
|
|
149
180
|
},
|
|
150
|
-
}
|
|
181
|
+
};
|
|
151
182
|
}
|
|
152
183
|
//# sourceMappingURL=fetch-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-service.js","sourceRoot":"","sources":["../../../src/plugins/web-tools/fetch-service.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,iBAAiB;AACjB,wBAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"fetch-service.js","sourceRoot":"","sources":["../../../src/plugins/web-tools/fetch-service.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,iBAAiB;AACjB,wBAAwB;AACxB,uUAAuU;AACvU,meAAme;AACne,+YAA+Y;AAC/Y,6LAA6L;AAC7L,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,wGAAwG;AACxG,8GAA8G;AAC9G,kGAAkG;AAClG,2GAA2G;AAC3G,kGAAkG;AAClG,kEAAkE;AAClE,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,mOAAmO;AACnO,qBAAqB;AAErB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAA4B,MAAM,kCAAkC,CAAC;AAEhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAA2B,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,YAAY,EAAsB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAyB,MAAM,oBAAoB,CAAC;AACrE,OAAO,EACL,mBAAmB,GAGpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,GAEjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iCAAiC,EAA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AGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAwB;IAQzD,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,gBAAgB,CAAC,WAAW;QACzC,KAAK,EAAE,gBAAgB,CAAC,aAAa;QACrC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;QAC5B,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO;YACzB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC1D,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;gBAC5B,MAAM,IAAI,mBAAmB,CAC3B,sEAAsE,CACvE,CAAC;YACJ,CAAC;YACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,IAAI,mBAAmB,CAC3B,iGAAiG,CAClG,CAAC;YACJ,CAAC;YACD,OAAO,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACtF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,20 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Plugin } from "@opencode/plugin";
|
|
2
|
+
import type { ToolEditor } from "@opencode/plugin/promise/tool";
|
|
3
|
+
import { type NativeSnapshotContext, type NativeSnapshotRuntime } from "../../runtime/context.js";
|
|
4
|
+
import { type WebToolsPolicyDecision, type WebToolsRuntime } from "./search-service.js";
|
|
5
|
+
/** Genuine native builtin web tool names (confirmed in pinned core/src/tool/plugin). */
|
|
6
|
+
export declare const NATIVE_WEB_TOOL_IDS: readonly ["websearch", "webfetch"];
|
|
7
|
+
/** Owned tool names replacing the builtins when the captured policy enables web-tools. */
|
|
8
|
+
export declare const OWNED_WEB_TOOL_IDS: readonly ["web_search", "web_fetch"];
|
|
9
|
+
/** Bounded credential-safe diagnostic event. */
|
|
10
|
+
export interface WebToolsDiagnostic {
|
|
11
|
+
readonly level: "info" | "warn" | "debug";
|
|
12
|
+
readonly message: string;
|
|
13
|
+
readonly extra?: Readonly<Record<string, unknown>>;
|
|
14
|
+
}
|
|
15
|
+
/** A captured native tool definition (`description` + JSON `input` schema) safe to republish. */
|
|
16
|
+
export interface NativeToolDefinition {
|
|
17
|
+
readonly description: string;
|
|
18
|
+
readonly input: unknown;
|
|
19
|
+
}
|
|
20
|
+
/** Per-session policy resolver plus native-builtin capture shared by hooks and tools. */
|
|
21
|
+
export interface WebToolsSessionDependencies {
|
|
22
|
+
resolve(sessionID: string): Promise<WebToolsPolicyDecision>;
|
|
23
|
+
log(event: WebToolsDiagnostic): void;
|
|
24
|
+
}
|
|
25
|
+
/** Registration inputs; policy is resolved per session at execution time. */
|
|
26
|
+
export interface WebToolsRegistrationDependencies {
|
|
27
|
+
readonly runtime: WebToolsRuntime;
|
|
28
|
+
}
|
|
4
29
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
30
|
+
* Register exactly the two owned native tools. Registration is stable and
|
|
31
|
+
* independent of startup configuration so a disabled capture can never remove
|
|
32
|
+
* a tool another family still uses.
|
|
8
33
|
*/
|
|
9
|
-
export declare function
|
|
34
|
+
export declare function registerWebTools(editor: ToolEditor, deps: WebToolsRegistrationDependencies): void;
|
|
10
35
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
36
|
+
* Select the web tools visible to one session. An enabled captured policy
|
|
37
|
+
* publishes the owned contract and removes the native builtins; an explicit
|
|
38
|
+
* disabled capture removes the owned tools and republishes the genuine native
|
|
39
|
+
* builtin definitions if another hook removed them; an unknown policy exposes
|
|
40
|
+
* neither, so a missing policy is never treated as a disable and never blocks
|
|
41
|
+
* another family.
|
|
17
42
|
*/
|
|
18
|
-
export declare
|
|
19
|
-
|
|
20
|
-
|
|
43
|
+
export declare function applyWebToolVisibility(decision: WebToolsPolicyDecision, tools: Record<string, unknown>, nativeDefinitions: Map<string, NativeToolDefinition>): void;
|
|
44
|
+
/**
|
|
45
|
+
* Build a credential-safe diagnostic sink. The pinned native plugin App is only
|
|
46
|
+
* `{name, version, channel}` and exposes no logger, so web-tools writes bounded
|
|
47
|
+
* lines through console instead of a fabricated host API; credential values are
|
|
48
|
+
* never included and every line is length-bounded.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createWebToolsLog(options?: {
|
|
51
|
+
readonly write?: (line: string) => void;
|
|
52
|
+
}): (event: WebToolsDiagnostic) => void;
|
|
53
|
+
export interface WebToolsPluginOptions {
|
|
54
|
+
/** Test-only injectable runtime acquisition. Default acquires the real shared runtime. */
|
|
55
|
+
acquireRuntime?: (ctx: NativeSnapshotContext) => Promise<NativeSnapshotRuntime>;
|
|
56
|
+
/** Test-only diagnostic sink override; defaults to the console sink. */
|
|
57
|
+
log?: (event: WebToolsDiagnostic) => void;
|
|
58
|
+
}
|
|
59
|
+
/** Native web-tools plugin factory; the default export uses the real shared runtime. */
|
|
60
|
+
export declare function createWebToolsPlugin(options?: WebToolsPluginOptions): Plugin.Plugin;
|
|
61
|
+
export declare const WebToolsPlugin: Plugin.Plugin;
|
|
62
|
+
export default WebToolsPlugin;
|