@lesliechan721/aw 0.1.0-beta.85 → 0.1.0-beta.86
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/dist/authoring/assets/command-runtime-config.d.mts +9 -0
- package/dist/authoring/assets/command-runtime-config.mjs +106 -0
- package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
- package/dist/authoring/scripts/validate-plugin.mjs +17 -22
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.d.ts +4 -0
- package/dist/scripts/aw-skill-eval-materializer.js +27 -0
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/bundle-plugins.js +1 -1
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/test-plugin-scripts.js +13 -2
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +2 -2
- package/dist/src/commands/catalog-source.d.ts +2 -1
- package/dist/src/commands/catalog-source.js +8 -7
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/deployment-confirmation.d.ts +8 -1
- package/dist/src/commands/deployment-confirmation.js +79 -11
- package/dist/src/commands/deployment-confirmation.js.map +1 -1
- package/dist/src/commands/lifecycle-command-package.d.ts +44 -0
- package/dist/src/commands/lifecycle-command-package.js +195 -0
- package/dist/src/commands/lifecycle-command-package.js.map +1 -0
- package/dist/src/commands/managed-commands.d.ts +6 -0
- package/dist/src/commands/managed-commands.js +203 -152
- package/dist/src/commands/managed-commands.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +22 -21
- package/dist/src/commands/operation-plan.js +2 -5
- package/dist/src/commands/operation-plan.js.map +1 -1
- package/dist/src/commands/permission-batch.d.ts +5 -0
- package/dist/src/commands/permission-batch.js +80 -0
- package/dist/src/commands/permission-batch.js.map +1 -0
- package/dist/src/commands/plugin-capabilities.js +17 -13
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.d.ts +8 -2
- package/dist/src/commands/public-config-confirmation.js +22 -5
- package/dist/src/commands/public-config-confirmation.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.d.ts +4 -4
- package/dist/src/commands/public-lifecycle-result.js +55 -14
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/commands/public-lifecycle.js +49 -8
- package/dist/src/commands/public-lifecycle.js.map +1 -1
- package/dist/src/commands/rebuild-command.d.ts +4 -0
- package/dist/src/commands/rebuild-command.js +131 -45
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +11 -3
- package/dist/src/commands/rebuild-integration.js +47 -164
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +2 -1
- package/dist/src/commands/rebuild-operations.js +2 -0
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +5 -3
- package/dist/src/commands/rebuild-platform-integration.js +166 -135
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
- package/dist/src/commands/skill-eval.js +10 -1
- package/dist/src/commands/skill-eval.js.map +1 -1
- package/dist/src/generators/local-plugin.js +14 -15
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +14 -6
- package/dist/src/generators/permissions.js +59 -61
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.js +77 -40
- package/dist/src/index.js.map +1 -1
- package/dist/src/output/command-receipt.js +7 -8
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/component-delivery.d.ts +7 -0
- package/dist/src/output/component-delivery.js +59 -3
- package/dist/src/output/component-delivery.js.map +1 -1
- package/dist/src/output/public-result.d.ts +15 -0
- package/dist/src/output/public-result.js +75 -12
- package/dist/src/output/public-result.js.map +1 -1
- package/dist/src/output/rebuild-progress.js +7 -4
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/output/receipt-projection.js +39 -27
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
- package/dist/src/platforms/antigravity-permissions.js +388 -0
- package/dist/src/platforms/antigravity-permissions.js.map +1 -0
- package/dist/src/platforms/contracts.d.ts +10 -1
- package/dist/src/platforms/discovery.d.ts +2 -0
- package/dist/src/platforms/discovery.js.map +1 -1
- package/dist/src/platforms/grok-permission-config.d.ts +22 -0
- package/dist/src/platforms/grok-permission-config.js +184 -0
- package/dist/src/platforms/grok-permission-config.js.map +1 -0
- package/dist/src/platforms/grok-permission-document.d.ts +4 -0
- package/dist/src/platforms/grok-permission-document.js +145 -0
- package/dist/src/platforms/grok-permission-document.js.map +1 -0
- package/dist/src/platforms/grok-permissions.d.ts +17 -0
- package/dist/src/platforms/grok-permissions.js +311 -0
- package/dist/src/platforms/grok-permissions.js.map +1 -0
- package/dist/src/platforms/host-permission-policy.d.ts +38 -0
- package/dist/src/platforms/host-permission-policy.js +86 -0
- package/dist/src/platforms/host-permission-policy.js.map +1 -0
- package/dist/src/platforms/inspection-grok.js +47 -5
- package/dist/src/platforms/inspection-grok.js.map +1 -1
- package/dist/src/platforms/layout.d.ts +7 -0
- package/dist/src/platforms/layout.js +46 -5
- package/dist/src/platforms/layout.js.map +1 -1
- package/dist/src/platforms/lifecycle.js +39 -17
- package/dist/src/platforms/lifecycle.js.map +1 -1
- package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
- package/dist/src/platforms/opencode-permission-config.js +253 -0
- package/dist/src/platforms/opencode-permission-config.js.map +1 -0
- package/dist/src/platforms/opencode-permissions.d.ts +39 -0
- package/dist/src/platforms/opencode-permissions.js +212 -0
- package/dist/src/platforms/opencode-permissions.js.map +1 -0
- package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
- package/dist/src/platforms/opencode-related-permissions.js +177 -0
- package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
- package/dist/src/platforms/permission-ownership.d.ts +89 -0
- package/dist/src/platforms/permission-ownership.js +543 -0
- package/dist/src/platforms/permission-ownership.js.map +1 -0
- package/dist/src/platforms/permission-sidecar.d.ts +70 -0
- package/dist/src/platforms/permission-sidecar.js +215 -0
- package/dist/src/platforms/permission-sidecar.js.map +1 -0
- package/dist/src/platforms/projection.js +58 -8
- package/dist/src/platforms/projection.js.map +1 -1
- package/dist/src/recovery/coordinator.d.ts +2 -0
- package/dist/src/recovery/coordinator.js +24 -27
- package/dist/src/recovery/coordinator.js.map +1 -1
- package/dist/src/recovery/joint-coordinator.js +103 -47
- package/dist/src/recovery/joint-coordinator.js.map +1 -1
- package/dist/src/recovery/joint-demand.js +1 -1
- package/dist/src/recovery/joint-demand.js.map +1 -1
- package/dist/src/recovery/joint-install-execution.js +2 -1
- package/dist/src/recovery/joint-install-execution.js.map +1 -1
- package/dist/src/recovery/retirement.js +11 -17
- package/dist/src/recovery/retirement.js.map +1 -1
- package/dist/src/recovery/status.js +32 -2
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/review/eval-source-input.d.ts +1 -0
- package/dist/src/review/eval-source-input.js +7 -1
- package/dist/src/review/eval-source-input.js.map +1 -1
- package/dist/src/review/review-selection.js +12 -5
- package/dist/src/review/review-selection.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +1 -1
- package/dist/src/review/skill-materialization.js +3 -7
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +37 -30
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +71 -6
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +4 -1
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/deployment-view.d.ts +1 -1
- package/dist/src/tui/deployment-view.js +16 -3
- package/dist/src/tui/deployment-view.js.map +1 -1
- package/dist/src/tui/diagnostic-projection.js +11 -6
- package/dist/src/tui/diagnostic-projection.js.map +1 -1
- package/dist/src/tui/entity-cards.js +1 -1
- package/dist/src/tui/entity-cards.js.map +1 -1
- package/dist/src/tui/operation-review-planner.js +130 -70
- package/dist/src/tui/operation-review-planner.js.map +1 -1
- package/dist/src/types.d.ts +8 -20
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +3 -36
- package/dist/src/utils/artifact-plan.js +11 -77
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +0 -59
- package/dist/src/utils/artifact-renderer.js +2 -49
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +3 -26
- package/dist/src/utils/artifact-request.js +13 -36
- package/dist/src/utils/artifact-request.js.map +1 -1
- package/dist/src/utils/artifact-sources.d.ts +0 -8
- package/dist/src/utils/artifact-sources.js +0 -8
- package/dist/src/utils/artifact-sources.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +2 -7
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-source-references.js +10 -0
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +6 -11
- package/dist/src/utils/component-command-preparation.js +109 -228
- package/dist/src/utils/component-command-preparation.js.map +1 -1
- package/dist/src/utils/managed-command-cli-review.d.ts +43 -0
- package/dist/src/utils/managed-command-cli-review.js +389 -0
- package/dist/src/utils/managed-command-cli-review.js.map +1 -0
- package/dist/src/utils/managed-command-closure.d.ts +14 -3
- package/dist/src/utils/managed-command-closure.js +144 -23
- package/dist/src/utils/managed-command-closure.js.map +1 -1
- package/dist/src/utils/managed-command-errors.d.ts +5 -0
- package/dist/src/utils/managed-command-errors.js +10 -0
- package/dist/src/utils/managed-command-errors.js.map +1 -0
- package/dist/src/utils/managed-command-materialization.d.ts +77 -113
- package/dist/src/utils/managed-command-materialization.js +324 -323
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/managed-command-preparation.d.ts +28 -65
- package/dist/src/utils/managed-command-preparation.js +33 -140
- package/dist/src/utils/managed-command-preparation.js.map +1 -1
- package/dist/src/utils/managed-command-review.d.ts +11 -4
- package/dist/src/utils/managed-command-review.js +33 -21
- package/dist/src/utils/managed-command-review.js.map +1 -1
- package/dist/src/utils/managed-command-runtime.d.ts +1 -0
- package/dist/src/utils/managed-command-runtime.js +6 -3
- package/dist/src/utils/managed-command-runtime.js.map +1 -1
- package/dist/src/utils/managed-command-snapshots.d.ts +17 -0
- package/dist/src/utils/managed-command-snapshots.js +84 -0
- package/dist/src/utils/managed-command-snapshots.js.map +1 -0
- package/dist/src/utils/managed-command-store.d.ts +65 -78
- package/dist/src/utils/managed-command-store.js +446 -383
- package/dist/src/utils/managed-command-store.js.map +1 -1
- package/dist/src/utils/multi-source-catalog.d.ts +2 -0
- package/dist/src/utils/multi-source-catalog.js +3 -1
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-tool-context.d.ts +6 -3
- package/dist/src/utils/native-tool-context.js +3 -1
- package/dist/src/utils/native-tool-context.js.map +1 -1
- package/dist/src/utils/native-tool-review.d.ts +2 -12
- package/dist/src/utils/native-tool-review.js +6 -108
- package/dist/src/utils/native-tool-review.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +7 -0
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +2 -1
- package/dist/src/utils/platform-empty-state.js +13 -12
- package/dist/src/utils/platform-empty-state.js.map +1 -1
- package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
- package/dist/src/utils/plugin-config-command-apply.js +134 -0
- package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
- package/dist/src/utils/plugin-config-impact.d.ts +19 -9
- package/dist/src/utils/plugin-config-impact.js +56 -37
- package/dist/src/utils/plugin-config-impact.js.map +1 -1
- package/dist/src/utils/plugin-config-write.d.ts +19 -19
- package/dist/src/utils/plugin-config-write.js +194 -772
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/rendered-contract.js +12 -6
- package/dist/src/utils/rendered-contract.js.map +1 -1
- package/package.json +4 -3
- package/dist/src/platforms/managed-command-placement.d.ts +0 -8
- package/dist/src/platforms/managed-command-placement.js +0 -79
- package/dist/src/platforms/managed-command-placement.js.map +0 -1
- package/dist/src/utils/managed-command-evidence.d.ts +0 -7
- package/dist/src/utils/managed-command-evidence.js +0 -10
- package/dist/src/utils/managed-command-evidence.js.map +0 -1
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
import { additionalPermissionEffects, configApplyDeploymentUnavailable, deploymentAdditionalPermissionImpacts, relatedProjectPermissionEffects } from '../commands/deployment-confirmation.js';
|
|
3
|
+
import { HOST_PERMISSION_ADDITIONAL_IMPACT } from '../output/component-delivery.js';
|
|
2
4
|
import { describeNativeToolClosure } from '../utils/native-tool-review.js';
|
|
3
5
|
import { requestedIntentAction } from '../output/command-receipt.js';
|
|
4
6
|
import { operationPlanNativeToolChanges } from '../commands/operation-plan.js';
|
|
5
7
|
import { catalogSourceAutoCheckOnlyValue } from './catalog-sources/review.js';
|
|
6
8
|
import { parseScriptTimeoutMs, SCRIPT_TIMEOUT_DEFAULT_MS, } from '../commands/options.js';
|
|
7
9
|
import { agentLabel, platformLabel, scopeLabel } from './glossary.js';
|
|
8
|
-
import { canonicalizeIdentityValue
|
|
9
|
-
import {
|
|
10
|
+
import { canonicalizeIdentityValue } from '@lesliechan721/aw-plugin-core/manifest';
|
|
11
|
+
import { reviewedInactivePermissions } from '../utils/managed-command-review.js';
|
|
12
|
+
import { describeManagedCommandRouteReview, describeManagedCommandRuntimeConfigChanges } from '../utils/managed-command-cli-review.js';
|
|
10
13
|
import { sanitizeDiagnosticText } from './diagnostics.js';
|
|
11
14
|
import { deploymentExclusionLines, deploymentPlanLines } from './deployment-view.js';
|
|
12
15
|
function codexManagerEvidence(preview) {
|
|
@@ -32,24 +35,21 @@ function configCommandPackageChanges(evidence, apply) {
|
|
|
32
35
|
kind: target.declared && apply ? 'change' : 'warning',
|
|
33
36
|
group: 'configImpact',
|
|
34
37
|
pluginId: `${target.producer.sourceId}/${target.producer.pluginName}`,
|
|
35
|
-
title: `${target.declared ? apply ? '刷新' : '需同步' : '保留残留'}命令包 ${target.
|
|
36
|
-
description:
|
|
37
|
-
?
|
|
38
|
-
:
|
|
38
|
+
title: `${target.declared ? apply ? '刷新' : '需同步' : '保留残留'}命令包 ${target.producer.sourceId}/${target.producer.pluginName}`,
|
|
39
|
+
description: target.declared
|
|
40
|
+
? `所有项目共用${target.runtimeConfigPlatforms.length ? ` · 已应用快照 ${target.runtimeConfigPlatforms.map(agentLabel).join('、')}` : ''}`
|
|
41
|
+
: `声明已删除 · aw command package remove ${target.packageId}`,
|
|
39
42
|
}));
|
|
40
43
|
}
|
|
44
|
+
function planAdditionalPermissionImpacts(actions, deploymentPlans) {
|
|
45
|
+
return [
|
|
46
|
+
...deploymentPlans.flatMap(deploymentAdditionalPermissionImpacts),
|
|
47
|
+
...actions.flatMap((action) => action.kind === 'removeOwnedArtifact' ? action.permissionRemoval?.batch?.additionalImpacts ?? [] : []),
|
|
48
|
+
];
|
|
49
|
+
}
|
|
41
50
|
export function managedCommandPlanChanges(actions, nativeToolChanges = [], deploymentPlans = []) {
|
|
42
51
|
const changes = [];
|
|
43
|
-
const producers = new Map();
|
|
44
52
|
const permissions = new Map();
|
|
45
|
-
const retained = new Set();
|
|
46
|
-
const addProducer = (record) => {
|
|
47
|
-
const key = getCommandPackageId(record.producer);
|
|
48
|
-
const previous = producers.get(key);
|
|
49
|
-
if (previous && canonicalizeIdentityValue(previous) !== canonicalizeIdentityValue(record))
|
|
50
|
-
throw plannerError('commandReviewConflict', '同一命令生产者有不同的冻结命令。');
|
|
51
|
-
producers.set(key, record);
|
|
52
|
-
};
|
|
53
53
|
const addPermission = (permission) => {
|
|
54
54
|
const key = `${permission.kind}\0${permission.pluginId}\0${permission.path}`;
|
|
55
55
|
const previous = permissions.get(key);
|
|
@@ -57,18 +57,47 @@ export function managedCommandPlanChanges(actions, nativeToolChanges = [], deplo
|
|
|
57
57
|
throw plannerError('commandReviewConflict', '同一权限位置有不同的冻结规则。');
|
|
58
58
|
permissions.set(key, permission);
|
|
59
59
|
};
|
|
60
|
+
const related = [
|
|
61
|
+
...deploymentPlans.flatMap((plan) => relatedProjectPermissionEffects(plan.evidence.permissionBatch)),
|
|
62
|
+
...actions.flatMap((action) => action.kind === 'removeOwnedArtifact' ? relatedProjectPermissionEffects(action.permissionRemoval?.batch) : []),
|
|
63
|
+
];
|
|
64
|
+
for (const description of new Set(related.map(({ message }) => message))) {
|
|
65
|
+
changes.push({ kind: 'change', group: 'runtime', title: '更新关联项目的 OpenCode 权限', description });
|
|
66
|
+
}
|
|
67
|
+
const restorations = [
|
|
68
|
+
...deploymentPlans.flatMap((plan) => plan.evidence.permissionBatch?.restorations ?? []),
|
|
69
|
+
...actions.flatMap((action) => action.kind === 'removeOwnedArtifact' ? action.permissionRemoval?.batch?.restorations ?? [] : []),
|
|
70
|
+
];
|
|
71
|
+
for (const notice of restorations)
|
|
72
|
+
changes.push({ kind: 'change', group: 'runtime', pluginId: notice.subject?.pluginId,
|
|
73
|
+
title: `恢复 ${agentLabel(notice.subject?.target ?? '')} 权限`, description: notice.message });
|
|
74
|
+
for (const { subject, message } of additionalPermissionEffects(planAdditionalPermissionImpacts(actions, deploymentPlans))) {
|
|
75
|
+
changes.push({ kind: 'warning', group: 'runtime', pluginId: subject?.pluginId,
|
|
76
|
+
title: `${agentLabel(subject?.target ?? '')} 权限的额外影响`, description: message });
|
|
77
|
+
}
|
|
60
78
|
for (const plan of deploymentPlans) {
|
|
61
79
|
const evidence = plan.evidence.managedCommandReview;
|
|
62
|
-
if (!evidence
|
|
80
|
+
if (!evidence)
|
|
63
81
|
continue;
|
|
82
|
+
if (plan.binding.platform === 'antigravity' || plan.binding.platform === 'grok' || plan.binding.platform === 'opencode' && plan.effects.some((effect) => effect.kind === 'write-supplement')) {
|
|
83
|
+
for (const notice of plan.projections.flatMap((projection) => projection.diagnostics)) {
|
|
84
|
+
if (notice.code === 'invocationPolicyNotApplied')
|
|
85
|
+
changes.push({ kind: 'warning', group: 'runtime',
|
|
86
|
+
pluginId: notice.subject?.pluginId ?? plan.binding.plugin.pluginId,
|
|
87
|
+
title: `${agentLabel(plan.binding.platform)} · ${(notice.detail?.skippedPermissionActions ?? []).join(', ')}`,
|
|
88
|
+
description: notice.message });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
64
91
|
const publishes = plan.effects.some((effect) => effect.kind === 'publish-package' && effect.destination === plan.evidence.layout.packageRoot);
|
|
65
|
-
if (publishes)
|
|
66
|
-
for (const record of evidence.producers)
|
|
67
|
-
addProducer(record);
|
|
68
92
|
for (const permission of evidence.permissions) {
|
|
69
93
|
if (publishes || plan.effects.some((effect) => effect.kind === 'write-supplement' && effect.destination === permission.path))
|
|
70
94
|
addPermission(permission);
|
|
71
95
|
}
|
|
96
|
+
for (const permission of reviewedInactivePermissions(plan.binding, evidence)) {
|
|
97
|
+
const { pluginId } = plan.binding.plugin;
|
|
98
|
+
changes.push({ kind: 'keep', group: 'runtime', pluginId, title: `保留 ${permission.action} 规则`,
|
|
99
|
+
description: `aw command run ${pluginId} --${permission.argsPrefix.length ? ` ${permission.argsPrefix.join(' ')}` : ''} · 当前无可达处理程序 · ${agentLabel(plan.binding.platform)} · ${scopeLabel(plan.binding.scope.kind)}` });
|
|
100
|
+
}
|
|
72
101
|
}
|
|
73
102
|
for (const change of operationPlanNativeToolChanges({ actions: [...actions], nativeToolChanges })) {
|
|
74
103
|
const pluginId = `${change.producer.sourceId}/${change.producer.pluginName}`;
|
|
@@ -77,35 +106,35 @@ export function managedCommandPlanChanges(actions, nativeToolChanges = [], deplo
|
|
|
77
106
|
continue;
|
|
78
107
|
for (const description of describeNativeToolClosure(closure))
|
|
79
108
|
changes.push({ kind, group: 'runtime', pluginId,
|
|
80
|
-
title: `${kind === 'remove' ? '撤销' : '使用'}原生工具 · ${pluginId}
|
|
109
|
+
title: `${kind === 'remove' ? '撤销' : '使用'}原生工具 · ${pluginId}`, description });
|
|
81
110
|
}
|
|
82
111
|
}
|
|
83
112
|
for (const action of actions) {
|
|
84
113
|
if (action.kind === 'retainManagedCommandPackage') {
|
|
85
|
-
if (retained.has(action.packageId))
|
|
86
|
-
continue;
|
|
87
|
-
retained.add(action.packageId);
|
|
88
114
|
changes.push({ kind: 'keep', group: 'preserved', pluginId: action.pluginId,
|
|
89
|
-
title: `保留命令包 ${action.
|
|
90
|
-
description:
|
|
115
|
+
title: `保留命令包 ${action.selector}`,
|
|
116
|
+
description: [action.packageId, '所有项目共用', action.availability, ...action.recoveryActions].join(' · ') });
|
|
91
117
|
}
|
|
92
|
-
else if (action.kind === 'syncManagedCommandPackage') {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const record = normalizeInstalledCommandProducer(JSON.parse(Buffer.from(file.contentBase64, 'base64').toString('utf8')));
|
|
100
|
-
addProducer(record);
|
|
118
|
+
else if (action.kind === 'syncManagedCommandPackage' || action.kind === 'removeManagedCommandPackage') {
|
|
119
|
+
const removes = action.kind === 'removeManagedCommandPackage';
|
|
120
|
+
changes.push({ kind: removes ? 'remove' : 'change', group: 'runtime', pluginId: action.pluginId,
|
|
121
|
+
title: `${removes ? '撤销' : '刷新'}命令包 ${action.pluginId}`,
|
|
122
|
+
description: removes ? '共享命令入口将失效,影响所有使用该命令包的项目。' : '命令包更新会影响所有引用者。' });
|
|
123
|
+
for (const description of describeManagedCommandRouteReview(action.routeReview)) {
|
|
124
|
+
changes.push({ kind: 'change', group: 'runtime', pluginId: action.pluginId, title: '命令路由与审批', description });
|
|
101
125
|
}
|
|
102
|
-
if (action.kind === '
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
addPermission({ kind: 'codex-rules', pluginId: action.pluginId, path: action.path, content: rules });
|
|
126
|
+
if (action.kind === 'syncManagedCommandPackage') {
|
|
127
|
+
for (const description of describeManagedCommandRuntimeConfigChanges(action.runtimeConfigChanges)) {
|
|
128
|
+
changes.push({ kind: 'change', group: 'runtime', pluginId: action.pluginId, title: '命令运行配置', description });
|
|
129
|
+
}
|
|
107
130
|
}
|
|
108
131
|
}
|
|
132
|
+
else if (action.kind === 'writeOwnedArtifact' && action.platform === 'codex'
|
|
133
|
+
&& action.artifactKind === 'owned-text-file' && path.extname(action.path) === '.rules') {
|
|
134
|
+
const rules = action.sourceContent ?? action.content;
|
|
135
|
+
if (rules)
|
|
136
|
+
addPermission({ kind: 'codex-rules', pluginId: action.pluginId, path: action.path, content: rules });
|
|
137
|
+
}
|
|
109
138
|
else if (action.kind === 'updateSharedConfig' && action.mutation.kind === 'claude-permissions' && action.locator.kind === 'claude-permissions') {
|
|
110
139
|
addPermission({ kind: 'claude-permissions', pluginId: action.pluginId, path: action.locator.settingsPath,
|
|
111
140
|
permissions: action.mutation.permissions });
|
|
@@ -116,6 +145,12 @@ export function managedCommandPlanChanges(actions, nativeToolChanges = [], deplo
|
|
|
116
145
|
changes.push({ kind: 'change', group: 'runtime', pluginId: permission.pluginId,
|
|
117
146
|
title: `Codex 权限规则 ${path.basename(permission.path)}`, description: permission.content.trim() });
|
|
118
147
|
}
|
|
148
|
+
else if (permission.kind !== 'claude-permissions') {
|
|
149
|
+
for (const rule of permission.permissions) {
|
|
150
|
+
changes.push({ kind: 'change', group: 'runtime', pluginId: permission.pluginId,
|
|
151
|
+
title: `${agentLabel(permission.kind.split('-')[0])} · ${rule.effect}`, description: `${rule.action} ${rule.resource} · ${permission.path}` });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
119
154
|
else
|
|
120
155
|
for (const kind of ['allow', 'ask', 'deny', 'excludedCommands']) {
|
|
121
156
|
const rules = permission.permissions[kind];
|
|
@@ -125,38 +160,25 @@ export function managedCommandPlanChanges(actions, nativeToolChanges = [], deplo
|
|
|
125
160
|
title: kind === 'excludedCommands' ? 'Claude sandbox.excludedCommands' : `Claude permissions.${kind}`, description: rules.join(';') });
|
|
126
161
|
}
|
|
127
162
|
}
|
|
128
|
-
|
|
129
|
-
const pluginId = `${producer.sourceId}/${producer.pluginName}`;
|
|
130
|
-
changes.push({ kind: 'change', group: 'runtime', pluginId,
|
|
131
|
-
title: `命令${producer.kind === 'package' ? '包' : '生产者'} ${producer.key}`,
|
|
132
|
-
description: `${pluginId} · ${scopeLabel(producer.scope)}${producer.platform ? ` · ${platformLabel(producer.platform)}`
|
|
133
|
-
: ' · 平台共用同一份生效配置'}${producer.scope === 'user' ? ' · 更新会影响全部引用者' : ''}` });
|
|
134
|
-
for (const set of sets) {
|
|
135
|
-
if (set.entries.length === 0)
|
|
136
|
-
changes.push({ kind: 'change', group: 'runtime', pluginId,
|
|
137
|
-
title: `命令集合 ${set.set}`, description: set.state === 'disabled' ? '已禁用;本集合命令失效' : '空集合;本集合没有可用命令' });
|
|
138
|
-
for (const entry of set.entries)
|
|
139
|
-
changes.push({ kind: 'change', group: 'runtime', pluginId,
|
|
140
|
-
title: `${set.set}/${entry.key}/${entry.variant}`,
|
|
141
|
-
description: `${entry.runner} · ${entry.entry} · 固定参数 ${JSON.stringify(entry.args)} · cwd=${entry.cwd}` });
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return changes;
|
|
163
|
+
return [...new Map(changes.map((change) => [JSON.stringify(change), change])).values()];
|
|
145
164
|
}
|
|
146
165
|
/** Config and scoped recovery consume the same prepared plans, including both joint scopes. */
|
|
147
166
|
export function managedCommandRecoveryPlanChanges(plan) {
|
|
148
167
|
const plans = new Map();
|
|
168
|
+
const actions = [];
|
|
149
169
|
const visit = (current) => {
|
|
170
|
+
actions.push(...current.portableCommandWithdrawals ?? []);
|
|
150
171
|
for (const group of current.nativeGroups) {
|
|
151
172
|
const prepared = group.preview.operationPlan;
|
|
152
173
|
if (prepared)
|
|
153
|
-
plans.set(prepared.planFingerprint, prepared
|
|
174
|
+
plans.set(prepared.planFingerprint, { ...prepared,
|
|
175
|
+
deploymentPlans: prepared.deploymentPlans?.filter((deployment) => !configApplyDeploymentUnavailable(current, deployment)) });
|
|
154
176
|
}
|
|
155
177
|
for (const child of current.joint?.children ?? [])
|
|
156
178
|
visit(child);
|
|
157
179
|
};
|
|
158
180
|
visit(plan);
|
|
159
|
-
return managedCommandPlanChanges([...plans.values()].flatMap((prepared) => prepared.actions), [...plans.values()].flatMap((prepared) => prepared.nativeToolChanges ?? []), [...plans.values()].flatMap((prepared) => prepared.deploymentPlans ?? []));
|
|
181
|
+
return managedCommandPlanChanges([...actions, ...[...plans.values()].flatMap((prepared) => prepared.actions)], [...plans.values()].flatMap((prepared) => prepared.nativeToolChanges ?? []), [...plans.values()].flatMap((prepared) => prepared.deploymentPlans ?? []));
|
|
160
182
|
}
|
|
161
183
|
function scriptTimeoutChanges(intent) {
|
|
162
184
|
let configuredTimeoutMs;
|
|
@@ -268,6 +290,13 @@ function offlineCleanupPreservedChanges(evidence) {
|
|
|
268
290
|
},
|
|
269
291
|
];
|
|
270
292
|
}
|
|
293
|
+
function sourceCommandRebindingChange(sourceId) {
|
|
294
|
+
return {
|
|
295
|
+
kind: 'warning',
|
|
296
|
+
title: '同名插件会沿用已有命令审批',
|
|
297
|
+
description: `安装新来源的同名插件后,已有的 aw command run ${sourceId}/<插件> -- 审批可能放行新代码。本次检查限于当前用户与项目,其他项目也可能保留匹配规则。`,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
271
300
|
function sourceMutationReviewChanges(mutation) {
|
|
272
301
|
if (mutation.action === 'add') {
|
|
273
302
|
const source = mutation.source;
|
|
@@ -754,6 +783,8 @@ function reviewChanges(intent, evidence, dependencyOverview) {
|
|
|
754
783
|
changes.push({ kind: 'keep', title: '同名插件选择保持不变' }, { kind: 'keep', title: '现有安装和设置不会迁移' });
|
|
755
784
|
if (intent.action === 'remove')
|
|
756
785
|
changes.push({ kind: 'keep', title: '保留其他来源' });
|
|
786
|
+
if (evidence?.sourceWrite?.identityChanged)
|
|
787
|
+
changes.push(sourceCommandRebindingChange(intent.sourceId));
|
|
757
788
|
const impact = evidence?.sourceWrite?.impact;
|
|
758
789
|
if (impact) {
|
|
759
790
|
for (const category of ['installation', 'config', 'lifecycle', 'marketplace']) {
|
|
@@ -804,6 +835,7 @@ function reviewChanges(intent, evidence, dependencyOverview) {
|
|
|
804
835
|
description: '旧版本无法安全比较;确认后只切换到本次已检查的版本。',
|
|
805
836
|
}] : []),
|
|
806
837
|
...(generation.sourceMutation ? sourceMutationReviewChanges(generation.sourceMutation) : []),
|
|
838
|
+
...(generation.impactMode === 'identityChange' ? [sourceCommandRebindingChange(intent.sourceId)] : []),
|
|
807
839
|
...(generation.explicitSourceChange && generation.candidateRelation === 'rollbackDetected' ? [{
|
|
808
840
|
kind: 'warning',
|
|
809
841
|
title: '来源切换将降低插件目录版本',
|
|
@@ -899,7 +931,7 @@ function reviewChanges(intent, evidence, dependencyOverview) {
|
|
|
899
931
|
...(evidence?.config?.sharedNativeRenderUnits ?? []).filter((shared) => evidence?.config?.affectedTargets
|
|
900
932
|
.some((target) => sharedUnitMatchesTarget(shared, target, intent.pluginId))).map((shared) => ({
|
|
901
933
|
kind: 'change', group: 'configImpact', title: `重新生成 ${shared.pluginName} · ${platformLabel(shared.platform)} 共享组件集合`,
|
|
902
|
-
description:
|
|
934
|
+
description: `配置来源为用户配置,影响所有启用项目。${shared.dynamicComponents ? '动态组件名称和数量需在准备后确认。' : ''}`,
|
|
903
935
|
})),
|
|
904
936
|
...(evidence?.config?.affectedTargets.map((target) => ({
|
|
905
937
|
kind: 'change',
|
|
@@ -961,6 +993,7 @@ function reviewChanges(intent, evidence, dependencyOverview) {
|
|
|
961
993
|
}] : []),
|
|
962
994
|
...sharedNativeImpact,
|
|
963
995
|
...configCommandPackageChanges(evidence, intent.apply),
|
|
996
|
+
...(evidence?.config?.commandReviewChanges ?? []),
|
|
964
997
|
...(evidence?.config?.impactState === 'unknown' || noEffectiveChange || sharedNativeTargets.length > 0
|
|
965
998
|
? []
|
|
966
999
|
: intent.apply && (evidence?.config?.affectedTargets.length ?? 0) > 0
|
|
@@ -973,13 +1006,15 @@ function reviewChanges(intent, evidence, dependencyOverview) {
|
|
|
973
1006
|
}))
|
|
974
1007
|
: (evidence?.config?.commandPackages?.length ?? 0) > 0 ? []
|
|
975
1008
|
: [{ kind: 'keep', group: 'configImpact', title: '当前没有可见安装;只保存设置' }]),
|
|
976
|
-
{
|
|
1009
|
+
...(evidence?.config?.hostPermissionEffects?.some(({ code }) => code === 'changeRelatedProjectPermissions') ? [] :
|
|
1010
|
+
[{ kind: 'keep', group: 'preserved', title: '其他项目不会被自动扫描' }]),
|
|
977
1011
|
];
|
|
978
1012
|
}
|
|
979
1013
|
const updateKeys = Object.keys(intent.updates ?? {});
|
|
980
1014
|
return [
|
|
981
1015
|
...scriptTimeoutChanges(intent),
|
|
982
1016
|
...preApplyScopeChanges(evidence?.config?.preApplyAuthorization ?? []),
|
|
1017
|
+
...(evidence?.config?.commandReviewChanges ?? []),
|
|
983
1018
|
...updateKeys.map((key) => ({
|
|
984
1019
|
kind: 'change',
|
|
985
1020
|
title: key,
|
|
@@ -1311,7 +1346,18 @@ export function buildOperationReviewProjection(options) {
|
|
|
1311
1346
|
&& intent.apply
|
|
1312
1347
|
&& (evidence.configBatch?.groups.some((group) => group.config.sharedNativeRenderUnits?.some((shared) => group.config.affectedTargets
|
|
1313
1348
|
.some((target) => sharedUnitMatchesTarget(shared, target, intent.pluginId)))) ?? false));
|
|
1314
|
-
const
|
|
1349
|
+
const configPermissionEffects = [
|
|
1350
|
+
...(evidence.config?.hostPermissionEffects ?? []),
|
|
1351
|
+
...(evidence.configBatch?.groups.flatMap(({ config }) => config.hostPermissionEffects ?? []) ?? []),
|
|
1352
|
+
];
|
|
1353
|
+
const relatedProjectConfigApply = configPermissionEffects.some(({ code }) => code === 'changeRelatedProjectPermissions');
|
|
1354
|
+
const permissionImpacts = [
|
|
1355
|
+
...configPermissionEffects.filter(({ code }) => code === HOST_PERMISSION_ADDITIONAL_IMPACT),
|
|
1356
|
+
...[evidence.operationPlan, ...batchEvidence?.groups.map(({ preview }) => preview.operationPlan) ?? [],
|
|
1357
|
+
...taskEvidence?.taskPlan.sources.map(({ preview }) => preview.operationPlan) ?? []]
|
|
1358
|
+
.flatMap((plan) => plan ? planAdditionalPermissionImpacts(plan.actions ?? [], plan.deploymentPlans ?? []) : []),
|
|
1359
|
+
];
|
|
1360
|
+
const requiresConfirmation = sharedNativeConfigApply || relatedProjectConfigApply || permissionImpacts.length > 0
|
|
1315
1361
|
|| intent.kind === 'catalogStorePrune'
|
|
1316
1362
|
|| Boolean(batchEvidence?.groups.some((group) => (group.preview.codexReconcilePlans ?? []).some((plan) => plan.review.requiresConfirmation)))
|
|
1317
1363
|
|| Boolean(taskEvidence?.taskPlan.sources.some((source) => (source.preview.codexReconcilePlans ?? []).some((plan) => plan.review.requiresConfirmation)))
|
|
@@ -1342,13 +1388,22 @@ export function buildOperationReviewProjection(options) {
|
|
|
1342
1388
|
const agents = intent.platform === 'both' ? ['codex', 'claude'] : [intent.platform];
|
|
1343
1389
|
const targets = intent.action === 'cleanup' ? agents.map((agent) => ` --target ${agent}`)
|
|
1344
1390
|
: [sync ? agents.map((agent) => ` --target ${agent}`).join('') : ''];
|
|
1391
|
+
const changesCommandPackage = evidence.operationPlan?.actions.some((action) => action.kind === 'removeManagedCommandPackage'
|
|
1392
|
+
|| action.kind === 'syncManagedCommandPackage' && (action.routeReview.routeChanges.length > 0 || action.runtimeConfigChanges.length > 0));
|
|
1345
1393
|
equivalentCommand = targets.map((target) => `aw plugin ${action} ${intent.pluginId} --${sync ? 'context' : 'scope'} ${intent.scope}${target}`
|
|
1346
1394
|
+ (intent.action === 'cleanup' ? ' --only outputs' : '')
|
|
1347
1395
|
+ (intent.action === 'reinstall' ? ' --rebuild' : '')
|
|
1348
1396
|
+ (intent.action === 'refreshAndSync' ? ' --refresh' : '')
|
|
1349
1397
|
+ (scriptTimeoutChanges(intent).length > 0 ? ` --script-timeout ${parseScriptTimeoutMs(intent.scriptTimeoutMs ?? SCRIPT_TIMEOUT_DEFAULT_MS)}` : '')
|
|
1350
1398
|
+ (intent.action === 'cleanup' && intent.force === true ? ' --force' : '')
|
|
1351
|
-
+ (requiresConfirmation || hasPreApply || intent.action === 'cleanup' || intent.action === 'uninstall' ? ' --yes' : '')).join(' && ');
|
|
1399
|
+
+ (requiresConfirmation || hasPreApply || changesCommandPackage || intent.action === 'cleanup' || intent.action === 'uninstall' ? ' --yes' : '')).join(' && ');
|
|
1400
|
+
}
|
|
1401
|
+
else if (intent.kind === 'configSave' && intent.retryApply) {
|
|
1402
|
+
equivalentCommand = `aw plugin config apply ${intent.pluginId} --context ${intent.context ?? 'user'}`
|
|
1403
|
+
+ (intent.platform ? ` --platform ${intent.platform}` : '')
|
|
1404
|
+
+ (intent.targets ?? []).map((target) => ` --target ${target}`).join('')
|
|
1405
|
+
+ (intent.scriptTimeoutMs === undefined ? '' : ` --script-timeout ${parseScriptTimeoutMs(intent.scriptTimeoutMs)}`)
|
|
1406
|
+
+ (requiresConfirmation || hasPreApply || evidence.config?.commandReviewChanges?.length ? ' --yes' : '');
|
|
1352
1407
|
}
|
|
1353
1408
|
return {
|
|
1354
1409
|
title: labels.title,
|
|
@@ -1380,16 +1435,21 @@ export function buildOperationReviewProjection(options) {
|
|
|
1380
1435
|
...(evidence.sourceWrite?.impact?.affectedReferences ?? []).flatMap((reference) => reference.pluginId ? [reference.pluginId] : []),
|
|
1381
1436
|
...(evidence.catalogGeneration?.impact?.affectedReferences ?? []).flatMap((reference) => reference.pluginId ? [reference.pluginId] : []),
|
|
1382
1437
|
...(evidence.catalogGeneration?.primaryImpact?.affectedReferences ?? []).flatMap((reference) => reference.pluginId ? [reference.pluginId] : []),
|
|
1383
|
-
...(sharedNativeConfigApply && 'pluginId' in intent ? [intent.pluginId] : []),
|
|
1438
|
+
...((sharedNativeConfigApply || relatedProjectConfigApply) && 'pluginId' in intent ? [intent.pluginId] : []),
|
|
1439
|
+
...permissionImpacts.flatMap(({ subject }) => subject?.pluginId ? [subject.pluginId] : []),
|
|
1384
1440
|
])],
|
|
1385
1441
|
...(warning ? { warning }
|
|
1386
|
-
:
|
|
1387
|
-
? { warning: '
|
|
1388
|
-
:
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1442
|
+
: relatedProjectConfigApply
|
|
1443
|
+
? { warning: '应用设置会更新 Review 中列出的 OpenCode 项目权限。' }
|
|
1444
|
+
: permissionImpacts.length
|
|
1445
|
+
? { warning: '本次权限变更可能影响 Review 中列出的其他命令。' }
|
|
1446
|
+
: sharedNativeConfigApply
|
|
1447
|
+
? { warning: '更新被共用的原生 Skill 会影响所有启用项目。' }
|
|
1448
|
+
: requiresConfirmation && (evidence.sourceWrite
|
|
1449
|
+
|| evidence.catalogGeneration?.impact
|
|
1450
|
+
|| evidence.catalogGeneration?.primaryImpact)
|
|
1451
|
+
? { warning: '确认来源影响后才会继续。未知影响不会按零处理。' }
|
|
1452
|
+
: {}),
|
|
1393
1453
|
},
|
|
1394
1454
|
};
|
|
1395
1455
|
}
|