huaweicloud-devkit 2.0.0-next.4 → 2.0.0-next.6
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/README.md +1 -1
- package/integrations/opencode/commands/huaweicloud-doctor.md +1 -1
- package/integrations/opencode/hooks/safety-gate.js +235 -0
- package/package.json +1 -1
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +3 -16
- package/plugins/huaweicloud-core/dist/agents/opencode-config.js +29 -4
- package/plugins/huaweicloud-core/dist/agents/opencode.js +55 -14
- package/plugins/huaweicloud-core/dist/approval-gate.js +23 -5
- package/plugins/huaweicloud-core/dist/doctor-payload.js +29 -0
- package/plugins/huaweicloud-core/dist/explain-error.js +9 -1
- package/plugins/huaweicloud-core/dist/hcloud-plan.js +6 -1
- package/plugins/huaweicloud-core/dist/lib/hdkit/hdkitservice-api.js +18 -9
- package/plugins/huaweicloud-core/dist/lib/opencode-permission-seam.js +51 -20
- package/plugins/huaweicloud-core/dist/mcp-server.js +520 -290
- package/plugins/huaweicloud-core/dist/mcp-server.js.map +4 -4
- package/plugins/huaweicloud-core/dist/packs/auth/tools.js +5 -1
- package/plugins/huaweicloud-core/dist/packs/registry.js +1 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/expose-task.js +71 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-account.js +25 -1
- package/plugins/huaweicloud-core/dist/packs/sandbox/handlers-tunnel.js +28 -3
- package/plugins/huaweicloud-core/dist/packs/sandbox/schemas.js +14 -0
- package/plugins/huaweicloud-core/dist/packs/sandbox/tools.js +11 -3
- package/plugins/huaweicloud-core/dist/payload-placement.js +8 -0
- package/plugins/huaweicloud-core/dist/risk-rule-engine.js +20 -4
- package/plugins/huaweicloud-core/dist/safety/classify-hcloud.js +6 -6
- package/plugins/huaweicloud-core/dist/safety/classify-text.js +10 -0
- package/plugins/huaweicloud-core/dist/safety/policy.js +12 -0
- package/plugins/huaweicloud-core/dist/safety/protected-payload.js +93 -0
- package/plugins/huaweicloud-core/dist/safety/redact.js +21 -3
- package/plugins/huaweicloud-core/dist/safety/risk-merge.js +24 -4
- package/plugins/huaweicloud-core/dist/safety-integrity.js +122 -0
- package/plugins/huaweicloud-core/dist/sandbox/devbridge-cleanup.js +1 -1
- package/plugins/huaweicloud-core/dist/setup-cli.js +8 -1
- package/plugins/huaweicloud-core/dist/tool-definitions.js +4 -0
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.mjs +44 -1
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +75 -2
- package/plugins/huaweicloud-core/openclaw.plugin.json +2 -2
- package/plugins/huaweicloud-core/safety/policy.json +5 -0
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +1 -1
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +42 -39
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/references/approvals.md +1 -1
- package/plugins/huaweicloud-core/src/agents/opencode-config.ts +33 -3
- package/plugins/huaweicloud-core/src/agents/opencode.ts +66 -15
- package/plugins/huaweicloud-core/src/approval-gate.ts +29 -4
- package/plugins/huaweicloud-core/src/doctor-payload.ts +40 -2
- package/plugins/huaweicloud-core/src/explain-error.ts +9 -1
- package/plugins/huaweicloud-core/src/hcloud-plan.ts +6 -1
- package/plugins/huaweicloud-core/src/lib/hdkit/hdkitservice-api.ts +32 -1
- package/plugins/huaweicloud-core/src/lib/opencode-permission-seam.ts +60 -19
- package/plugins/huaweicloud-core/src/packs/auth/tools.ts +7 -1
- package/plugins/huaweicloud-core/src/packs/registry.ts +1 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/expose-task.ts +105 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-account.ts +28 -1
- package/plugins/huaweicloud-core/src/packs/sandbox/handlers-tunnel.ts +41 -15
- package/plugins/huaweicloud-core/src/packs/sandbox/schemas.ts +20 -0
- package/plugins/huaweicloud-core/src/packs/sandbox/tools.ts +12 -2
- package/plugins/huaweicloud-core/src/payload-placement.ts +8 -0
- package/plugins/huaweicloud-core/src/risk-rule-engine.ts +20 -7
- package/plugins/huaweicloud-core/src/safety/classify-hcloud.ts +28 -16
- package/plugins/huaweicloud-core/src/safety/classify-text.ts +10 -0
- package/plugins/huaweicloud-core/src/safety/policy.ts +13 -0
- package/plugins/huaweicloud-core/src/safety/protected-payload.ts +97 -0
- package/plugins/huaweicloud-core/src/safety/redact.ts +24 -6
- package/plugins/huaweicloud-core/src/safety/risk-merge.ts +26 -5
- package/plugins/huaweicloud-core/src/safety-integrity.ts +132 -0
- package/plugins/huaweicloud-core/src/sandbox/devbridge-cleanup.ts +7 -5
- package/plugins/huaweicloud-core/src/setup-cli.ts +8 -0
- package/plugins/huaweicloud-core/src/tool-definitions.ts +4 -0
package/README.md
CHANGED
|
@@ -404,7 +404,7 @@ Debug logs are written to the plugin's `telemetry/telemetry-debug.log` file.
|
|
|
404
404
|
- **Sandbox (DevStation)** — temporary cloud runtime for web app deployment with instant public URL preview
|
|
405
405
|
- **Capability packs (56 MCP tools)** — the devkit ships ten packs (core 12 tools; huaweicloud-cli carries the 20 service skills plus the 7 KooCLI execution tools; sandbox, auth, obs, voucher, update, discovery, secrets, huaweicloud-open-mcp for the rest). The huaweicloud-open-mcp pack proxies Huawei Cloud's full OpenAPI catalog through the local huaweicloud-open-mcp gateway with one generic call tool (`huaweicloud_gateway_call`: search_apis → list_apis → get_api discovery, execute_api with gateway-engine-gated consent; install the gateway with pip or uv, or just have `uvx` on PATH — no persistent install needed). Discover packs with `huaweicloud_list_packs` → `huaweicloud_pack_info`, browse the effective skill catalog with `huaweicloud_list_skills` (every enabled pack's skills with name, description, version, and reference filenames in one call, plus `skillRoot` — the tree's absolute location; which skills are ENABLED is pack-gated and can change at runtime, so a `huawei-*` service skill absent from the catalog belongs to a trimmed pack — the six `huaweicloud-*` meta-skills never appear in it and are always available), read the skill files directly under `skillRoot` on a same-machine install (the stdio server instructions state the location at initialize, so no catalog call is needed just to start reading; the taught policy is action-first — attempt the direct read, the attempt itself is the reachability check), and fall back to `huaweicloud_retrieve_skill` only when the attempted read fails or is denied — the taught reaction is falling back (the loader needs no file access), never repeatedly requesting. (the gated, telemetry-bearing, portable fallback, whose stdio payload also carries `skillRoot`; the six core meta-skills are additionally installed as native skill copies on directory-loading agents for system-prompt visibility). Trim the surface with `DEVKIT_PACKS` (comma-separated pack ids, e.g. `DEVKIT_PACKS=core,sandbox`); unset means all packs, unknown ids fail fast at startup, and core (pack meta, safety and discovery surface) is always included — trimming huaweicloud-cli removes the CLI execution face and its approval tools together. In a live stdio agent session, `huaweicloud_packs_configure` enables or disables packs on the spot (session-scoped; the refreshed tool list is pushed to the agent, and restarting the session restores the operator posture; the stateless remote surface does not carry it). Manage the surface persistently after install with `npx huaweicloud-devkit packs status | enable <ids> | disable <ids> | all [--target <agent>]`: the command rewrites `DEVKIT_PACKS` inside every installed agent's MCP config (the install-time `--packs` flag never overwrites an existing value), and the change takes effect on the agent's next session restart.
|
|
406
406
|
|
|
407
|
-
Harness permission notes (skill-tree reads outside the workspace): the taught reaction above is universal — when a direct read fails or is denied, fall back to `huaweicloud_retrieve_skill`, never repeatedly request. The OpenCode installer writes a persistent permission seam (external_directory allow + edit deny over the tree globs); on other harnesses the operator can pre-allow the tree in the harness's own config if prompts bother them. Honest semantics for the seam: the allow covers every path-taking tool including bash (an allowed external directory inherits workspace defaults), so shell-mediated writes to the tree stop asking too — the edit deny governs only the edit tools; the tree is regenerated on every install/update, and the devkit's PreToolUse hook still denies hcloud writes. On opencode at or above 1.19.0 the installer additionally writes the ASK approval posture as a pair — one exact `allow` entry per roster tool on the `huaweicloud-devkit_<tool>` action (a top-level `permissions` array entry on 2.0+, a `permission`-object key on 1.19–1.x; the two generations name the rule identically) plus `DEVKIT_APPROVAL_MODE=ask` in the mcp entry's environment. Ask mode means the server-run gate: the confirmation is raised inside the tool call, and the client `allow` rule only yields the client's own redundant popup to it. On opencode 2.x the gate raises an elicitation form, so the form is the single confirmation; on 1.19–1.x the client cannot render forms, so the yield hands the confirmation to the chat round-trip — the envelope answered in chat and retried with `approvedByUser: true`, which the consent ledger records as posture trust (the user's word as the agent reports it, no mechanical proof a human answered). No terminal approve trip, no token UUID; below the floor neither half is written, and an install or update still removes the legacy ask rules. The allow rules are written only when the server half is present or established this run; a user-set `DEVKIT_APPROVAL_MODE` value wins, no client rules are kept, and rules a past install wrote are removed value-exact so the user's mechanical posture stays clean. A client `allow` rule can no longer fail anything open, while a `deny` rule still blocks the call in the client — which is why `npx huaweicloud-devkit doctor` fails one, fails a leftover devkit-written ask rule (the migration missed it), and warns when allow rules are present without the server env or the client half is unverifiable. Ownership follows the skills-tree seam's doctrine — add-only-if-absent per rule and value-exact removal — including its accepted edge: a user-authored rule of the identical shape that predates the install is removed together with the devkit's own. Residual from pre-yield installs: a saved "Always allow" row in OpenCode's permission store is a stale grant — the gate never consults it, and the yield rules mean the popup no longer appears to recreate it. `npx huaweicloud-devkit doctor` reports it as a `[WARN]` naming the row and the store; clean it up with `opencode api GET /api/permission/saved` (list) and `opencode api DELETE /api/permission/saved/<id>` (remove). See the huaweicloud-safety skill's approvals reference.
|
|
407
|
+
Harness permission notes (skill-tree reads outside the workspace): the taught reaction above is universal — when a direct read fails or is denied, fall back to `huaweicloud_retrieve_skill`, never repeatedly request. The OpenCode installer writes a persistent permission seam (external_directory allow + edit deny over the tree globs, plus an edit-only deny over the plugin payload root so the edit tools cannot rewrite the deployed classifier the in-process gate imports); on other harnesses the operator can pre-allow the tree in the harness's own config if prompts bother them. Honest semantics for the seam: the allow covers every path-taking tool including bash (an allowed external directory inherits workspace defaults), so shell-mediated writes to the tree stop asking too — the edit deny governs only the edit tools; the tree is regenerated on every install/update, and the devkit's PreToolUse hook still denies hcloud writes. On opencode at or above 1.19.0 the installer additionally writes the ASK approval posture as a pair — one exact `allow` entry per roster tool on the `huaweicloud-devkit_<tool>` action (a top-level `permissions` array entry on 2.0+, a `permission`-object key on 1.19–1.x; the two generations name the rule identically) plus `DEVKIT_APPROVAL_MODE=ask` in the mcp entry's environment. Ask mode means the server-run gate: the confirmation is raised inside the tool call, and the client `allow` rule only yields the client's own redundant popup to it. On opencode 2.x the gate raises an elicitation form, so the form is the single confirmation; on 1.19–1.x the client cannot render forms, so the yield hands the confirmation to the chat round-trip — the envelope answered in chat and retried with `approvedByUser: true`, which the consent ledger records as posture trust (the user's word as the agent reports it, no mechanical proof a human answered). No terminal approve trip, no token UUID; below the floor neither half is written, and an install or update still removes the legacy ask rules. The allow rules are written only when the server half is present or established this run; a user-set `DEVKIT_APPROVAL_MODE` value wins, no client rules are kept, and rules a past install wrote are removed value-exact so the user's mechanical posture stays clean. A client `allow` rule can no longer fail anything open, while a `deny` rule still blocks the call in the client — which is why `npx huaweicloud-devkit doctor` fails one, fails a leftover devkit-written ask rule (the migration missed it), and warns when allow rules are present without the server env or the client half is unverifiable. Ownership follows the skills-tree seam's doctrine — add-only-if-absent per rule and value-exact removal — including its accepted edge: a user-authored rule of the identical shape that predates the install is removed together with the devkit's own. Residual from pre-yield installs: a saved "Always allow" row in OpenCode's permission store is a stale grant — the gate never consults it, and the yield rules mean the popup no longer appears to recreate it. `npx huaweicloud-devkit doctor` reports it as a `[WARN]` naming the row and the store; clean it up with `opencode api GET /api/permission/saved` (list) and `opencode api DELETE /api/permission/saved/<id>` (remove). See the huaweicloud-safety skill's approvals reference.
|
|
408
408
|
|
|
409
409
|
Harness tool-routing note (Codex with a custom OpenAI-compatible provider): codex presents MCP tools as namespace-type tools and dispatches only through the `namespace` field on function_call items, with no flat-name fallback. A provider that drops that field (request history and/or generated calls) turns every regenerated call namespace-less, so codex answers `unsupported call: <huaweicloud tool>` without the call ever reaching the devkit — measured 2026-11-13 on codex 0.167.2 with an OpenAI-compatible gateway (a live session: 690 of 692 huaweicloud calls failed this way, only the fresh-history first call dispatched; reproduced with a two-call `codex exec` against the same provider). Nothing devkit-side can observe or fix these calls. Do not retry — the identical call cannot succeed. Remediation is gateway-side: round-trip the `namespace` field on function_call items in both directions (or use a provider that preserves it). Measured non-fix: codex's `non_prefixed_mcp_tool_names` feature only renames the namespace; regenerated calls still arrive namespace-less. The huaweicloud-troubleshooting skill and the server's initialize instructions teach the signature so agents stop retrying and report it instead.
|
|
410
410
|
|
|
@@ -10,6 +10,6 @@ Use HuaweiCloud DevKit tools to perform a comprehensive readiness check:
|
|
|
10
10
|
4. Verify MCP server is reachable by calling any read-only tool.
|
|
11
11
|
5. Summarize: installed (OK) vs missing (action needed).
|
|
12
12
|
6. Do not print AK/SK, tokens, passwords, credential files, or raw profile secrets.
|
|
13
|
-
7. If direct skill reads prompt for approval, delegate to `npx huaweicloud-devkit doctor` — it verifies the skills-tree permission seam (the installer writes an `external_directory` allow paired with an `edit` deny; honest semantics: the allow covers every path-taking tool including bash — shell-mediated writes to the tree stop asking — while the edit deny governs only the edit tools) and prints remediation when rules are missing or user-owned.
|
|
13
|
+
7. If direct skill reads prompt for approval, delegate to `npx huaweicloud-devkit doctor` — it verifies the skills-tree permission seam (the installer writes an `external_directory` allow paired with an `edit` deny over the skills-tree globs, plus an edit-only `deny` over the plugin payload root `huaweicloud-plugins/**` so the edit tools cannot rewrite the deployed classifier; honest semantics: the allow covers every path-taking tool including bash — shell-mediated writes to the tree stop asking — while the edit deny governs only the edit tools) and prints remediation when rules are missing or user-owned.
|
|
14
14
|
|
|
15
15
|
If MCP tools are unavailable (fresh install), run `npx huaweicloud-devkit doctor` in terminal.
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
// The OpenCode >= 2.0 shell-face safety gate (architecture B, in-process):
|
|
2
|
+
// registers permission.hook("evaluate") and denies shell commands the
|
|
3
|
+
// devkit's text classifier refuses — credential-file reads, env dumps,
|
|
4
|
+
// unapproved hcloud writes, destructive rows. MCP tool actions are named
|
|
5
|
+
// "huaweicloud-devkit_<tool>" and never match the shell check: that face is
|
|
6
|
+
// the server approval gate's own surface (formal verification: safe in
|
|
7
|
+
// every posture), so the adapter stays zero-intervention there.
|
|
8
|
+
//
|
|
9
|
+
// Same deployment seam as skill-tracker.js (this directory, one bare file
|
|
10
|
+
// per plugin): the installer copies this file beside it, and the classifier
|
|
11
|
+
// is the deployed payload's compiled module — the same dist/safety-policy.js
|
|
12
|
+
// every other face reads, never a second implementation.
|
|
13
|
+
|
|
14
|
+
const DENY_PREFIX = 'Huawei Cloud safety hook blocked this action: ';
|
|
15
|
+
|
|
16
|
+
const POLICY_LOAD_FAILED_REASON =
|
|
17
|
+
'the safety policy failed to load; commands are denied fail-closed. Reinstall the huaweicloud-devkit plugin.';
|
|
18
|
+
|
|
19
|
+
const CLASSIFY_FAILED_REASON =
|
|
20
|
+
'the safety classifier failed to run (corrupt safety rules?); commands are denied fail-closed. Reinstall the huaweicloud-devkit plugin.';
|
|
21
|
+
|
|
22
|
+
// The load-time behavior self-check (the integrity unit's layer 2): a
|
|
23
|
+
// module that imports fine is not yet a classifier — a stale replacement,
|
|
24
|
+
// a truncated overwrite, or a bad upgrade can hand the gate an object that
|
|
25
|
+
// is shaped right and decides wrong (allowing the canonical write). Before
|
|
26
|
+
// the module is trusted, three canaries run ONCE at load: the export
|
|
27
|
+
// shape, a typical write vector (must deny), and a typical benign read
|
|
28
|
+
// (must allow). Any failure pins the module untrusted — every later event
|
|
29
|
+
// denies with this reason instead of running a module that cannot be
|
|
30
|
+
// trusted to deny. This layer catches NON-adversarial corruption; an
|
|
31
|
+
// adversary who can write the module can also write one that passes the
|
|
32
|
+
// canaries — that crafted-module residual is documented in the approvals
|
|
33
|
+
// reference and owned by the doctor drift check (layer 3).
|
|
34
|
+
const SELF_CHECK_FAILED_REASON =
|
|
35
|
+
'the deployed safety policy failed its load-time self-check (shape or behavior canary); commands are denied fail-closed. Reinstall the huaweicloud-devkit plugin.';
|
|
36
|
+
|
|
37
|
+
// Fixed canonical canary inputs (never derived from event data): the write
|
|
38
|
+
// vector and benign read the test batteries already use, so a regression
|
|
39
|
+
// that breaks the classifier's core verdicts disarms nothing — the gate
|
|
40
|
+
// fails closed at load instead.
|
|
41
|
+
const CANARY_WRITE_VECTOR = 'hcloud ECS DeleteServers --server.id=x';
|
|
42
|
+
const CANARY_BENIGN_READ = 'ls /tmp';
|
|
43
|
+
|
|
44
|
+
// Resolved relative to this file: the payload root convention skill-tracker
|
|
45
|
+
// uses (plugins/ and huaweicloud-plugins/ are siblings under the opencode
|
|
46
|
+
// config root). A deployed payload always carries dist/ (copyServerPayload
|
|
47
|
+
// ships it), so an import failure means a broken install — denied
|
|
48
|
+
// fail-closed below, never silently un-gated. No src fallback: unlike a raw
|
|
49
|
+
// checkout, a deployed payload is never unbuilt.
|
|
50
|
+
const POLICY_URL = new URL('../huaweicloud-plugins/dist/safety-policy.js', import.meta.url);
|
|
51
|
+
|
|
52
|
+
// The host has NO evaluate timeout (G1-M3: a full 30s wait, measured), so
|
|
53
|
+
// anything unbounded inside the handler is a hang vector. The one policy
|
|
54
|
+
// import races a 3s fail-closed bound: a module that never settles
|
|
55
|
+
// (interrogate round: a rewritten policy with a top-level forever-pending
|
|
56
|
+
// promise) denies instead of hanging the tool call. Any failed or lost
|
|
57
|
+
// race clears the cache so a later call retries — a mid-session reinstall
|
|
58
|
+
// heals without a host restart, and a late-settling import re-races
|
|
59
|
+
// cheaply (the ESM registry caches the evaluation).
|
|
60
|
+
const IMPORT_RACE_MS = 3000;
|
|
61
|
+
|
|
62
|
+
// The classification walk is synchronous per segment, but its cost grows
|
|
63
|
+
// quadratically with ';'-dense text (interrogate round: 96KB of flood took
|
|
64
|
+
// 213s at an allow verdict — the 256KiB cap inside the classifier protects
|
|
65
|
+
// nothing at this seam, and the old comment's "cannot hang a tool call"
|
|
66
|
+
// claim was measured false). Each segment is therefore capped at 8192
|
|
67
|
+
// bytes BEFORE classification: the quadratic worst case lands in the
|
|
68
|
+
// 1.5-2s order of a real tool call, real commands sit far below the cap,
|
|
69
|
+
// and the sanctioned path for oversized parameters is --cli-jsonInput,
|
|
70
|
+
// which the deny reason names.
|
|
71
|
+
const SEGMENT_BYTE_CAP = 8192;
|
|
72
|
+
|
|
73
|
+
let classifyTextCommand;
|
|
74
|
+
let policyLoading = null;
|
|
75
|
+
// Set when a policy import SUCCEEDED but the self-check refused the
|
|
76
|
+
// module; sticky for the process lifetime (the ESM registry caches the
|
|
77
|
+
// module — a retry would re-import the same broken evaluation).
|
|
78
|
+
let selfCheckFailed = false;
|
|
79
|
+
|
|
80
|
+
// The layer-2 self-check: null when the module is trusted, otherwise the
|
|
81
|
+
// module must not be used. A throw inside a canary classification counts as
|
|
82
|
+
// a failure (a module that crashes on the canonical vectors cannot be
|
|
83
|
+
// trusted to deny).
|
|
84
|
+
function selfCheckReasonOf(module) {
|
|
85
|
+
if (typeof module.classifyTextCommand !== 'function') {
|
|
86
|
+
return 'the deployed policy does not export a classifyTextCommand function';
|
|
87
|
+
}
|
|
88
|
+
let writeVerdict;
|
|
89
|
+
let readVerdict;
|
|
90
|
+
try {
|
|
91
|
+
writeVerdict = module.classifyTextCommand(CANARY_WRITE_VECTOR);
|
|
92
|
+
readVerdict = module.classifyTextCommand(CANARY_BENIGN_READ);
|
|
93
|
+
} catch {
|
|
94
|
+
return 'the deployed policy threw during the canary classifications';
|
|
95
|
+
}
|
|
96
|
+
if (writeVerdict?.decision !== 'deny') return 'the deployed policy allowed the canonical write canary';
|
|
97
|
+
if (readVerdict?.decision !== 'allow') return 'the deployed policy denied the canonical benign read canary';
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function loadPolicy() {
|
|
102
|
+
if (!policyLoading) {
|
|
103
|
+
let cancelBound;
|
|
104
|
+
const bound = new Promise((_, reject) => {
|
|
105
|
+
cancelBound = setTimeout(
|
|
106
|
+
() => reject(new Error('the policy import did not settle within the 3s race bound')),
|
|
107
|
+
IMPORT_RACE_MS,
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
policyLoading = Promise.race([import(POLICY_URL), bound]).then(
|
|
111
|
+
(module) => {
|
|
112
|
+
clearTimeout(cancelBound);
|
|
113
|
+
const selfCheckReason = selfCheckReasonOf(module);
|
|
114
|
+
if (selfCheckReason !== null) {
|
|
115
|
+
selfCheckFailed = true;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
classifyTextCommand = module.classifyTextCommand;
|
|
119
|
+
},
|
|
120
|
+
(error) => {
|
|
121
|
+
clearTimeout(cancelBound);
|
|
122
|
+
policyLoading = null;
|
|
123
|
+
throw error;
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
return policyLoading;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// The clean deny path (G1-M1/M2): effect = "deny" + message is the
|
|
131
|
+
// host-documented refusal channel — the message becomes the model-visible
|
|
132
|
+
// rejection reason. Never rethrow: a thrown hook also denies (G1-M2
|
|
133
|
+
// measured), but the clean path keeps the cause readable.
|
|
134
|
+
function deny(event, reason) {
|
|
135
|
+
event.effect = 'deny';
|
|
136
|
+
event.message = DENY_PREFIX + reason;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// One classification input: null when it passes, the deny reason when it
|
|
140
|
+
// refuses. The shared body of the per-segment loop and the pipe-feed
|
|
141
|
+
// reassembly below — cap, classify, and classify-time failure in one place,
|
|
142
|
+
// so the two paths cannot drift apart.
|
|
143
|
+
function denyReasonOf(text) {
|
|
144
|
+
const bytes = Buffer.byteLength(text, 'utf8');
|
|
145
|
+
if (bytes > SEGMENT_BYTE_CAP) {
|
|
146
|
+
return `the command text is too large for synchronous in-hook classification (${bytes} bytes > ${SEGMENT_BYTE_CAP}); split the command or pass complex parameters via --cli-jsonInput`;
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
const verdict = classifyTextCommand(text);
|
|
150
|
+
return verdict.decision === 'deny' ? verdict.reason : null;
|
|
151
|
+
} catch {
|
|
152
|
+
// Classify-time failure is the .mjs twin's contract: a corrupt rules
|
|
153
|
+
// file must deny, not crash verdict-less.
|
|
154
|
+
return CLASSIFY_FAILED_REASON;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// The host scanner splits compound commands into per-segment resources
|
|
159
|
+
// (`ls /tmp && hcloud …` arrives as ['ls /tmp', 'hcloud …']) and the host's
|
|
160
|
+
// own rule engine denies the operation when ANY segment denies — so the
|
|
161
|
+
// adapter classifies each segment independently and the first deny wins
|
|
162
|
+
// with its reason (interrogate round: the previous join(' ') erased the
|
|
163
|
+
// separators and the write segment rode through as one allow, live-proven
|
|
164
|
+
// — the faithful port of the host's per-resource semantics).
|
|
165
|
+
async function onEvaluate(event) {
|
|
166
|
+
try {
|
|
167
|
+
if (event.action !== 'shell') return;
|
|
168
|
+
const resources = Array.isArray(event.resources) ? event.resources : [];
|
|
169
|
+
const segments = [];
|
|
170
|
+
for (const entry of resources) {
|
|
171
|
+
const text = String(entry);
|
|
172
|
+
if (text.trim() !== '') segments.push(text);
|
|
173
|
+
}
|
|
174
|
+
if (segments.length === 0) return;
|
|
175
|
+
if (selfCheckFailed) {
|
|
176
|
+
deny(event, SELF_CHECK_FAILED_REASON);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
try {
|
|
180
|
+
if (!classifyTextCommand) await loadPolicy();
|
|
181
|
+
} catch {
|
|
182
|
+
deny(event, POLICY_LOAD_FAILED_REASON);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
// The just-awaited load may have completed with a module the self-check
|
|
186
|
+
// refused — the sticky flag carries that verdict to every later event.
|
|
187
|
+
if (selfCheckFailed) {
|
|
188
|
+
deny(event, SELF_CHECK_FAILED_REASON);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
for (const text of segments) {
|
|
192
|
+
const reason = denyReasonOf(text);
|
|
193
|
+
if (reason !== null) {
|
|
194
|
+
deny(event, reason);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// The pipe-feed reassembly (F6, the compound bypass's same-family
|
|
199
|
+
// residual): a pipe is the ONE cross-segment data flow — xargs splices
|
|
200
|
+
// its stdin into the next command's argv — and the classifier's
|
|
201
|
+
// pipe/xargs unwrap fires only on the joined text, so a split event
|
|
202
|
+
// that passed per segment is re-examined as one pipeline. ';'/'&&'
|
|
203
|
+
// semantics stay owned by the per-segment loop above (each segment is
|
|
204
|
+
// an independent command); the reassembly is conservative there, and
|
|
205
|
+
// the benign-pipe table (echo-prose through pipes) proved it costs no
|
|
206
|
+
// false positives. The reassembled text is itself a classification
|
|
207
|
+
// input, so it rides the same 8KiB bound.
|
|
208
|
+
if (segments.length >= 2) {
|
|
209
|
+
const reason = denyReasonOf(segments.join(' | '));
|
|
210
|
+
if (reason !== null) deny(event, reason);
|
|
211
|
+
}
|
|
212
|
+
} catch {
|
|
213
|
+
// The belt over the whole body — never rethrow (G1-M2's rethrow deny is
|
|
214
|
+
// the last line, this keeps the message clean instead).
|
|
215
|
+
deny(event, CLASSIFY_FAILED_REASON);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// The export is the plain { id, setup } object the V2 plugin loader's
|
|
220
|
+
// documented contract accepts ("one default export containing a unique
|
|
221
|
+
// plugin id and a setup function") — the shape herdr's auto-discovered
|
|
222
|
+
// agent-state plugin runs as on a real host, and what skill-tracker's
|
|
223
|
+
// identity-define fallback reduces to where @opencode/plugin is not
|
|
224
|
+
// resolvable. No Plugin.define resolution dance here: it would clone
|
|
225
|
+
// skill-tracker's createRequire block (the zero-new-duplication gate), and
|
|
226
|
+
// the two plugins must stay independently loadable anyway.
|
|
227
|
+
export default {
|
|
228
|
+
id: 'huaweicloud-safety-gate',
|
|
229
|
+
async setup(ctx) {
|
|
230
|
+
await ctx.permission.hook('evaluate', onEvaluate);
|
|
231
|
+
// A V2 host may invoke the setup return value unguarded, and
|
|
232
|
+
// undefined is not callable — the skill-tracker precedent.
|
|
233
|
+
return () => {};
|
|
234
|
+
},
|
|
235
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
3
|
"mcpName": "io.github.huaweicloud/huaweicloud-devkit",
|
|
4
|
-
"version": "2.0.0-next.
|
|
4
|
+
"version": "2.0.0-next.6",
|
|
5
5
|
"kooCliVersion": "7.3.12",
|
|
6
6
|
"description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
|
|
7
7
|
"type": "module",
|
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
"longDescription": "HuaweiCloud DevKit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
|
|
6
6
|
"developerName": "HuaweiCloud Mate",
|
|
7
7
|
"category": "Cloud",
|
|
8
|
-
"capabilities": [
|
|
9
|
-
"Read",
|
|
10
|
-
"Interactive"
|
|
11
|
-
],
|
|
8
|
+
"capabilities": ["Read", "Interactive"],
|
|
12
9
|
"websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
13
10
|
"brandColor": "#C7000B",
|
|
14
11
|
"defaultPrompt": [
|
|
@@ -19,7 +16,7 @@
|
|
|
19
16
|
},
|
|
20
17
|
"mcpServers": "./.mcp.json",
|
|
21
18
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
|
-
"version": "2.0.0-next.
|
|
19
|
+
"version": "2.0.0-next.6",
|
|
23
20
|
"author": {
|
|
24
21
|
"name": "HuaweiCloud Mate",
|
|
25
22
|
"url": "https://github.com/huaweicloud"
|
|
@@ -29,15 +26,5 @@
|
|
|
29
26
|
"homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
30
27
|
"repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
31
28
|
"license": "Apache-2.0",
|
|
32
|
-
"keywords": [
|
|
33
|
-
"huaweicloud",
|
|
34
|
-
"huawei-cloud",
|
|
35
|
-
"koocli",
|
|
36
|
-
"hcloud",
|
|
37
|
-
"agent",
|
|
38
|
-
"mcp",
|
|
39
|
-
"api",
|
|
40
|
-
"sdk",
|
|
41
|
-
"skills"
|
|
42
|
-
]
|
|
29
|
+
"keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
|
|
43
30
|
}
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
"interface": {
|
|
3
3
|
"shortDescription": "HuaweiCloud DevKit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
|
|
4
4
|
"developerName": "HuaweiCloud Mate",
|
|
5
|
-
"capabilities": [
|
|
6
|
-
"Read",
|
|
7
|
-
"Interactive"
|
|
8
|
-
],
|
|
5
|
+
"capabilities": ["Read", "Interactive"],
|
|
9
6
|
"brandColor": "#C7000B",
|
|
10
7
|
"composerIcon": "./assets/icon.png",
|
|
11
8
|
"logo": "./assets/logo.png",
|
|
@@ -22,7 +19,7 @@
|
|
|
22
19
|
},
|
|
23
20
|
"mcpServers": "./.mcp.json",
|
|
24
21
|
"description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
|
|
25
|
-
"version": "2.0.0-next.
|
|
22
|
+
"version": "2.0.0-next.6",
|
|
26
23
|
"author": {
|
|
27
24
|
"name": "HuaweiCloud Mate",
|
|
28
25
|
"url": "https://github.com/huaweicloud"
|
|
@@ -31,15 +28,5 @@
|
|
|
31
28
|
"homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
32
29
|
"repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
33
30
|
"license": "Apache-2.0",
|
|
34
|
-
"keywords": [
|
|
35
|
-
"huaweicloud",
|
|
36
|
-
"huawei-cloud",
|
|
37
|
-
"koocli",
|
|
38
|
-
"hcloud",
|
|
39
|
-
"agent",
|
|
40
|
-
"mcp",
|
|
41
|
-
"api",
|
|
42
|
-
"sdk",
|
|
43
|
-
"skills"
|
|
44
|
-
]
|
|
31
|
+
"keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
|
|
45
32
|
}
|
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
"longDescription": "HuaweiCloud DevKit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
|
|
6
6
|
"developerName": "HuaweiCloud Mate",
|
|
7
7
|
"category": "Cloud",
|
|
8
|
-
"capabilities": [
|
|
9
|
-
"Read",
|
|
10
|
-
"Interactive"
|
|
11
|
-
],
|
|
8
|
+
"capabilities": ["Read", "Interactive"],
|
|
12
9
|
"websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
13
10
|
"brandColor": "#C7000B",
|
|
14
11
|
"defaultPrompt": [
|
|
@@ -19,7 +16,7 @@
|
|
|
19
16
|
},
|
|
20
17
|
"mcpServers": "./.mcp.json",
|
|
21
18
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
|
-
"version": "2.0.0-next.
|
|
19
|
+
"version": "2.0.0-next.6",
|
|
23
20
|
"author": {
|
|
24
21
|
"name": "HuaweiCloud Mate",
|
|
25
22
|
"url": "https://github.com/huaweicloud"
|
|
@@ -29,15 +26,5 @@
|
|
|
29
26
|
"homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
30
27
|
"repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
31
28
|
"license": "Apache-2.0",
|
|
32
|
-
"keywords": [
|
|
33
|
-
"huaweicloud",
|
|
34
|
-
"huawei-cloud",
|
|
35
|
-
"koocli",
|
|
36
|
-
"hcloud",
|
|
37
|
-
"agent",
|
|
38
|
-
"mcp",
|
|
39
|
-
"api",
|
|
40
|
-
"sdk",
|
|
41
|
-
"skills"
|
|
42
|
-
]
|
|
29
|
+
"keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
|
|
43
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.6",
|
|
4
4
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HuaweiCloud Mate",
|
|
@@ -9,17 +9,7 @@
|
|
|
9
9
|
"homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
10
10
|
"repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"huaweicloud",
|
|
14
|
-
"huawei-cloud",
|
|
15
|
-
"koocli",
|
|
16
|
-
"hcloud",
|
|
17
|
-
"agent",
|
|
18
|
-
"mcp",
|
|
19
|
-
"api",
|
|
20
|
-
"sdk",
|
|
21
|
-
"skills"
|
|
22
|
-
],
|
|
12
|
+
"keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"],
|
|
23
13
|
"mcpServers": "./.mcp.json",
|
|
24
14
|
"interface": {
|
|
25
15
|
"displayName": "HuaweiCloud DevKit",
|
|
@@ -27,10 +17,7 @@
|
|
|
27
17
|
"longDescription": "HuaweiCloud DevKit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
|
|
28
18
|
"developerName": "HuaweiCloud Mate",
|
|
29
19
|
"category": "Cloud",
|
|
30
|
-
"capabilities": [
|
|
31
|
-
"Read",
|
|
32
|
-
"Interactive"
|
|
33
|
-
],
|
|
20
|
+
"capabilities": ["Read", "Interactive"],
|
|
34
21
|
"websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
35
22
|
"brandColor": "#C7000B",
|
|
36
23
|
"defaultPrompt": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.6",
|
|
4
4
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HuaweiCloud Mate",
|
|
@@ -9,17 +9,7 @@
|
|
|
9
9
|
"homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
10
10
|
"repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"huaweicloud",
|
|
14
|
-
"huawei-cloud",
|
|
15
|
-
"koocli",
|
|
16
|
-
"hcloud",
|
|
17
|
-
"agent",
|
|
18
|
-
"mcp",
|
|
19
|
-
"api",
|
|
20
|
-
"sdk",
|
|
21
|
-
"skills"
|
|
22
|
-
],
|
|
12
|
+
"keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"],
|
|
23
13
|
"mcpServers": "./.mcp.json",
|
|
24
14
|
"interface": {
|
|
25
15
|
"displayName": "HuaweiCloud DevKit",
|
|
@@ -27,10 +17,7 @@
|
|
|
27
17
|
"longDescription": "HuaweiCloud DevKit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
|
|
28
18
|
"developerName": "HuaweiCloud Mate",
|
|
29
19
|
"category": "Cloud",
|
|
30
|
-
"capabilities": [
|
|
31
|
-
"Read",
|
|
32
|
-
"Interactive"
|
|
33
|
-
],
|
|
20
|
+
"capabilities": ["Read", "Interactive"],
|
|
34
21
|
"websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
35
22
|
"brandColor": "#C7000B",
|
|
36
23
|
"defaultPrompt": [
|
|
@@ -14,7 +14,7 @@ import { applyPacksToEntry } from "../packs-policy.js";
|
|
|
14
14
|
import { mergeCommandStyle, extractUserDelta, applyUserDelta } from "../mcp-config-merge.js";
|
|
15
15
|
import { saveAgentDelta, takeAgentDelta } from "../mcp-config-backup.js";
|
|
16
16
|
import { readJsonRecord, writeMcpSettingsFile } from "../mcp-config-io.js";
|
|
17
|
-
import { applySkillTreePermissionSeam, opencodeSeamVersionSupported, removeSkillTreePermissionSeam, skillTreePermissionGlobs, } from "../lib/opencode-permission-seam.js";
|
|
17
|
+
import { applySkillTreePermissionSeam, opencodeSeamVersionSupported, payloadEditDenyGlobs, removeSkillTreePermissionSeam, skillTreePermissionGlobs, } from "../lib/opencode-permission-seam.js";
|
|
18
18
|
import { applyAllowPermissionRules, applyAllowPermissionRulesV1, askRuleShapeFor, removeAllowPermissionRules, removeAllowPermissionRulesV1, removeAskPermissionRules, removeAskPermissionRulesV1, } from "../lib/opencode-ask-rule.js";
|
|
19
19
|
import { asRecord } from "../lib/as-record.js";
|
|
20
20
|
import { devkitOwnedSkillNames, tryCoreSkillNames } from "../install-payload.js";
|
|
@@ -108,6 +108,30 @@ export function openCodeAskGate() {
|
|
|
108
108
|
return shape;
|
|
109
109
|
return forced === 'on' ? 'v2-array' : 'off';
|
|
110
110
|
}
|
|
111
|
+
// The safety gate's floor check: permission.hook("evaluate") is a V2
|
|
112
|
+
// surface (G1 measured the event shape, the "shell" action naming, and the
|
|
113
|
+
// deny semantics on 2.2.7; V1 named the action "bash" and had no evaluate
|
|
114
|
+
// hook), so the floor is the 2.0 major. Unparsable or absent stays
|
|
115
|
+
// unsupported — the caller's polarity is skip, never a guess.
|
|
116
|
+
export function opencodeSafetyGateVersionSupported(version) {
|
|
117
|
+
if (version === null)
|
|
118
|
+
return false;
|
|
119
|
+
const match = /^v?(\d+)\.(\d+)\.(\d+)/.exec(version.trim());
|
|
120
|
+
return match !== null && Number(match[1]) >= 2;
|
|
121
|
+
}
|
|
122
|
+
// The safety gate's version gate, same doctrine as the seam's:
|
|
123
|
+
// HUAWEICLOUD_OPENCODE_SAFETY_GATE=on|off is the deterministic override for
|
|
124
|
+
// the installer test suite (e2e strips it — the runner's install relies on
|
|
125
|
+
// the natural probe); unset runs the probe against the 2.0 floor. A
|
|
126
|
+
// below-floor, absent, or unparsable opencode gets no adapter file and a
|
|
127
|
+
// doctor SKIP, never a FAIL — 1.x has no evaluate hook to register on, and a
|
|
128
|
+
// later update heals the skip by deploying the file.
|
|
129
|
+
export function openCodeSafetyGate() {
|
|
130
|
+
const forced = process.env.HUAWEICLOUD_OPENCODE_SAFETY_GATE;
|
|
131
|
+
if (forced === 'on' || forced === 'off')
|
|
132
|
+
return forced;
|
|
133
|
+
return opencodeSafetyGateVersionSupported(probeOpencodeVersion()) ? 'on' : 'off';
|
|
134
|
+
}
|
|
111
135
|
function applyApprovalModeToEntry(entry) {
|
|
112
136
|
const env = asRecord(entry.environment);
|
|
113
137
|
const current = env.DEVKIT_APPROVAL_MODE;
|
|
@@ -151,7 +175,7 @@ export function updateOpenCodeConfig(pluginDir) {
|
|
|
151
175
|
// lib/opencode-permission-seam.ts), so the single write below carries it.
|
|
152
176
|
let permChanged = false;
|
|
153
177
|
if (openCodeSeamGate() === 'on') {
|
|
154
|
-
const seam = applySkillTreePermissionSeam(config, openCodeSeamGlobs(pluginDir));
|
|
178
|
+
const seam = applySkillTreePermissionSeam(config, openCodeSeamGlobs(pluginDir), payloadEditDenyGlobs(pluginDir));
|
|
155
179
|
permChanged = seam.changed;
|
|
156
180
|
for (const section of seam.skipped) {
|
|
157
181
|
console.log(` \x1b[33m[WARN]\x1b[0m opencode permission${section === 'permission' ? '' : `.${section}`} is not object-shaped — keeping the user's value; add the skills-tree rules manually (see README, Harness permission notes).`);
|
|
@@ -289,8 +313,9 @@ export function removeOpenCodeConfig() {
|
|
|
289
313
|
// hand. Globs derive from the stable XDG paths (the plugin dir may
|
|
290
314
|
// already be gone) and the running package's own manifest;
|
|
291
315
|
// value-exact deletion keeps user-modified rules (the ownership contract
|
|
292
|
-
// lives in lib/opencode-permission-seam.ts).
|
|
293
|
-
|
|
316
|
+
// lives in lib/opencode-permission-seam.ts). The edit-only payload
|
|
317
|
+
// class is removed under the same value-exact rule.
|
|
318
|
+
const permCleaned = removeSkillTreePermissionSeam(config, openCodeSeamGlobs(opencodePluginsDir()), payloadEditDenyGlobs(opencodePluginsDir()));
|
|
294
319
|
// The client-rule cleanup also runs unconditionally of the version gate: an
|
|
295
320
|
// uninstall must remove what any past install wrote — the opencode that
|
|
296
321
|
// gated the write may since have been upgraded, downgraded, or removed from
|