@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,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { InstalledCommandProducer } from '@lesliechan721/aw-plugin-core/manifest';
|
|
2
|
+
import type { PreparedManagedCommandPackage } from '../utils/managed-command-materialization.js';
|
|
3
|
+
import { type ClaudePermissions } from '../generators/permissions.js';
|
|
2
4
|
import type { CommandReporter, DebugLogger } from '../output/model.js';
|
|
3
5
|
import type { CatalogResolution, CommandProducerResult, PlatformName, PluginMeta, Scope } from '../types.js';
|
|
4
6
|
import { type CodexNativeObservationSession, type CodexNativePluginObservation } from '../utils/codex-native-observation.js';
|
|
@@ -16,6 +18,7 @@ export declare function disposePreparedPlatformRebuildSession(results: Map<strin
|
|
|
16
18
|
export interface RebuildIntegration {
|
|
17
19
|
resolvePlatformTargets(inputs: readonly Parameters<RebuildIntegration['buildTarget']>[0][]): Promise<void>;
|
|
18
20
|
sealMarketplaceGenerations(targets: readonly DesiredTarget[]): Promise<void>;
|
|
21
|
+
pendingOpenCodeProjectNotices(interrupted: boolean): import('../platforms/contracts.js').Diagnostic[];
|
|
19
22
|
driver: RebuildTargetDriver;
|
|
20
23
|
setNativeMarketplaceEligibleTargets(targets: readonly DesiredTarget[]): void;
|
|
21
24
|
prepareNativeMarketplaceGroup(target: DesiredTarget): Promise<void>;
|
|
@@ -33,6 +36,7 @@ export interface RebuildIntegration {
|
|
|
33
36
|
cwd: string;
|
|
34
37
|
command: 'install' | 'sync' | 'reinstall' | 'cleanup' | 'uninstall';
|
|
35
38
|
catalog: CatalogResolution;
|
|
39
|
+
commandRecord?: InstalledCommandProducer | null;
|
|
36
40
|
readOnlyInspectionPlan?: boolean;
|
|
37
41
|
/** Fresh read window for peers undergoing the same placement check or plan verification. */
|
|
38
42
|
observationBatch?: import('../platforms/inspection-query.js').NativeObservationBatch;
|
|
@@ -54,11 +58,16 @@ export declare class CodexActivationPostcheckError extends Error {
|
|
|
54
58
|
constructor(codexPluginIds: string | readonly string[], detail: string);
|
|
55
59
|
}
|
|
56
60
|
export interface RebuildExecutionContext {
|
|
61
|
+
removeHostPermissions?: (locator: import('../platforms/permission-ownership.js').PermissionLocator) => Promise<void>;
|
|
62
|
+
invocationCwd?: string;
|
|
57
63
|
recoveryCandidates?: readonly import('../platforms/contracts.js').RecoveryCandidate[];
|
|
58
64
|
sharedReferenceView?: import('../utils/native-demand.js').NativeSharedReferenceView;
|
|
59
65
|
platformRebuildSession?: PlatformRebuildSession;
|
|
60
66
|
/** Concurrent native groups share a session across scopes of the same platform. */
|
|
61
67
|
batchInstallPlatform?: PlatformName;
|
|
68
|
+
configApply?: boolean;
|
|
69
|
+
retainCommandPackages?: boolean;
|
|
70
|
+
commandPackagePlatforms?: ReadonlyMap<string, readonly PlatformName[]>;
|
|
62
71
|
packagePreparationCache?: Map<string, Promise<PreparedManagedCommandPackage>>;
|
|
63
72
|
interruption?: import('./public-interruption.js').PublicCommandInterruption;
|
|
64
73
|
/** Validated renderer process output shared only by preparations of this operation. */
|
|
@@ -86,7 +95,6 @@ export interface RebuildExecutionContext {
|
|
|
86
95
|
scope: Scope;
|
|
87
96
|
}[];
|
|
88
97
|
commandResults?: CommandProducerResult[];
|
|
89
|
-
managedCommandCandidates?: Map<string, ManagedCommandCandidate[]>;
|
|
90
98
|
}
|
|
91
99
|
export declare function executeCodexReconcileActivations(options: {
|
|
92
100
|
plans: readonly CodexReconcilePlan[];
|
|
@@ -180,7 +188,7 @@ export declare function inspectNativeMarketplaceRegistrations(options: {
|
|
|
180
188
|
cwd: string;
|
|
181
189
|
env: NodeJS.ProcessEnv;
|
|
182
190
|
}): Promise<Record<'codex' | 'claude', 'absent' | 'canonical' | 'foreign'>>;
|
|
183
|
-
export declare function applyPlannedOperationAction(action: OperationAction): Promise<
|
|
191
|
+
export declare function applyPlannedOperationAction(action: OperationAction): Promise<ClaudePermissions>;
|
|
184
192
|
export declare function isNativeActivationOnlyTarget(context: Pick<RebuildExecutionContext, 'nativeActivationOnlyTargets'>, identity: Pick<RebuildTargetIdentity, 'pluginId' | 'platform' | 'scope'>): boolean;
|
|
185
193
|
export declare function createRebuildIntegration(options: {
|
|
186
194
|
context: RebuildExecutionContext;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { captureNativeToolChanges } from '../utils/native-tool-review.js';
|
|
4
3
|
import { catalogFileMode } from '@lesliechan721/aw-plugin-core';
|
|
5
|
-
import { getCommandPackageId } from '@lesliechan721/aw-plugin-core/manifest';
|
|
6
4
|
import fs from 'fs-extra';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { assertManagedCommandBindingIdentities, listManagedCommands, managedCommandDiagnostic, ManagedCommandError, revokeManagedCommandBindings, syncManagedCommandPackage } from '../utils/managed-command-store.js';
|
|
5
|
+
import { ManagedCommandError } from '../utils/managed-command-store.js';
|
|
6
|
+
import { prepareLifecycleCommandPackage, publishLifecycleCommandPackages, retainedManagedCommandPackageResult } from './lifecycle-command-package.js';
|
|
10
7
|
import { readClaudeSettings, writeClaudeSettings } from '../adapters/helpers.js';
|
|
11
8
|
import { buildGeneratedName } from '../generators/shared.js';
|
|
12
9
|
import { readCatalogSourcesConfigSnapshot } from '../utils/catalog-sources.js';
|
|
@@ -25,10 +22,10 @@ import { runPreApplyScript } from '../utils/plugin-scripts.js';
|
|
|
25
22
|
import { assertCanonicalProjectManagedRoots } from '../utils/project-boundary.js';
|
|
26
23
|
import { attachSafeOperationError, readSafeOperationError } from '../utils/safe-operation-diagnostic.js';
|
|
27
24
|
import { createProjectLocationKey, resolveRequiredCanonicalRepoRoot, resolveClaudeProjectKey, resolveCodexProjectKey } from '../utils/state-paths.js';
|
|
25
|
+
import { hasPermissionOwner, updateHostPermissions } from '../platforms/permission-ownership.js';
|
|
28
26
|
import { platformOwnership, PlatformRebuildSession } from './rebuild-platform-integration.js';
|
|
29
27
|
const MARKETPLACE_NAME = 'aw';
|
|
30
28
|
const LEGACY_MCP_OWNER_ENV = 'AW_AGENT_WORKFLOWS_OWNER';
|
|
31
|
-
const commandPackagePreparationCaches = new WeakMap();
|
|
32
29
|
const platformRebuildSessions = new WeakMap();
|
|
33
30
|
const commandPackageCandidates = new WeakMap();
|
|
34
31
|
export function finalizePreparedPlatformRebuildSession(results) {
|
|
@@ -56,65 +53,6 @@ export async function disposePreparedPlatformRebuildSession(results) {
|
|
|
56
53
|
}));
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
async function commandPackageActions(options) {
|
|
60
|
-
const actions = [];
|
|
61
|
-
const candidates = [];
|
|
62
|
-
const packageCache = options.context.packagePreparationCache ??= new Map();
|
|
63
|
-
let cache = commandPackagePreparationCaches.get(options.context);
|
|
64
|
-
if (!cache) {
|
|
65
|
-
cache = new Map();
|
|
66
|
-
commandPackagePreparationCaches.set(options.context, cache);
|
|
67
|
-
}
|
|
68
|
-
for (const declaration of options.plugin.manifest.managedCommands?.packages ?? []) {
|
|
69
|
-
if (!declaration.platforms.includes(options.platform) || options.scope === 'user' && declaration.scope === 'project')
|
|
70
|
-
continue;
|
|
71
|
-
const producer = await managedCommandProducerIdentity({ ...options, scope: declaration.scope,
|
|
72
|
-
producer: { kind: 'package', packageKey: declaration.key } });
|
|
73
|
-
const key = getCommandPackageId(producer);
|
|
74
|
-
let preparation = cache.get(key);
|
|
75
|
-
if (!preparation) {
|
|
76
|
-
preparation = (async () => {
|
|
77
|
-
let candidate = packageCache.get(key);
|
|
78
|
-
if (!candidate) {
|
|
79
|
-
candidate = prepareManagedCommandPackage({ ...options, referencePlugins: options.context.referencePlugins,
|
|
80
|
-
packageKey: declaration.key, scope: declaration.scope, signal: options.context.signal,
|
|
81
|
-
scriptTimeoutMs: options.context.scriptTimeoutMs });
|
|
82
|
-
packageCache.set(key, candidate);
|
|
83
|
-
}
|
|
84
|
-
const prepared = await candidate;
|
|
85
|
-
const files = [];
|
|
86
|
-
async function visit(directory, prefix) {
|
|
87
|
-
for (const entry of await fs.readdir(directory, { withFileTypes: true })) {
|
|
88
|
-
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
89
|
-
const absolute = path.join(directory, entry.name);
|
|
90
|
-
if (entry.isDirectory()) {
|
|
91
|
-
await visit(absolute, relativePath);
|
|
92
|
-
}
|
|
93
|
-
else if (entry.isFile()) {
|
|
94
|
-
const content = await fs.readFile(absolute);
|
|
95
|
-
files.push({ relativePath, contentBase64: content.toString('base64'),
|
|
96
|
-
contentDigest: `sha256:${crypto.createHash('sha256').update(content).digest('hex')}`,
|
|
97
|
-
mode: (await fs.stat(absolute)).mode & 0o777 });
|
|
98
|
-
}
|
|
99
|
-
else
|
|
100
|
-
throw new ManagedCommandError('commandResourceInvalid', 'The prepared package contains an unsafe resource.');
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
await visit(prepared.resourceRoot, '');
|
|
104
|
-
files.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
|
|
105
|
-
return { action: { kind: 'syncManagedCommandPackage', pluginId: pluginActionId(options.plugin),
|
|
106
|
-
scope: declaration.scope, producer: prepared.producer, sets: prepared.sets, nativeTools: prepared.nativeTools,
|
|
107
|
-
files, contentDigest: `sha256:${crypto.createHash('sha256').update(JSON.stringify(files)).digest('hex')}` },
|
|
108
|
-
candidate: { producer: prepared.producer, sets: prepared.sets, nativeTools: prepared.nativeTools } };
|
|
109
|
-
})();
|
|
110
|
-
cache.set(key, preparation);
|
|
111
|
-
}
|
|
112
|
-
const prepared = await preparation;
|
|
113
|
-
actions.push(prepared.action);
|
|
114
|
-
candidates.push(prepared.candidate);
|
|
115
|
-
}
|
|
116
|
-
return { actions, candidates };
|
|
117
|
-
}
|
|
118
56
|
export class CodexActivationPostcheckError extends Error {
|
|
119
57
|
code = 'codexActivationPostcheckFailed';
|
|
120
58
|
codexPluginIds;
|
|
@@ -1027,77 +965,17 @@ export async function applyPlannedOperationAction(action) {
|
|
|
1027
965
|
throw new Error('platformContributionUnsupported: expected a Claude permissions contribution.');
|
|
1028
966
|
}
|
|
1029
967
|
const settings = await readClaudeSettings(action.locator.settingsPath);
|
|
968
|
+
const before = settings.permissions;
|
|
1030
969
|
rebuildClaudePermissions(settings, action.locator.ownerKey, action.mutation.permissions);
|
|
1031
970
|
await writeClaudeSettings(action.locator.settingsPath, settings);
|
|
971
|
+
return {
|
|
972
|
+
allow: (settings.permissions?.allow ?? []).filter((rule) => !before?.allow?.includes(rule)),
|
|
973
|
+
ask: (settings.permissions?.ask ?? []).filter((rule) => !before?.ask?.includes(rule)),
|
|
974
|
+
deny: (settings.permissions?.deny ?? []).filter((rule) => !before?.deny?.includes(rule)),
|
|
975
|
+
};
|
|
1032
976
|
}
|
|
1033
977
|
function createNativeDriver(options) {
|
|
1034
978
|
const runner = options.context.nativeCliRunner;
|
|
1035
|
-
const revokeAtRoot = async (root, recursive = false, platform) => {
|
|
1036
|
-
const listed = await listManagedCommands(options.context.env);
|
|
1037
|
-
const producers = new Map();
|
|
1038
|
-
for (const command of listed.commands) {
|
|
1039
|
-
if (command.owner.kind !== 'plugin' || !command.resourceRoot)
|
|
1040
|
-
continue;
|
|
1041
|
-
if (platform && command.owner.producer.platform !== platform)
|
|
1042
|
-
continue;
|
|
1043
|
-
const relative = path.relative(path.resolve(root), path.resolve(command.resourceRoot));
|
|
1044
|
-
if (relative !== '' && (!recursive || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)))
|
|
1045
|
-
continue;
|
|
1046
|
-
producers.set(getCommandPackageId(command.owner.producer), command.owner.producer);
|
|
1047
|
-
}
|
|
1048
|
-
for (const producer of producers.values()) {
|
|
1049
|
-
const removedCommandIds = await revokeManagedCommandBindings(producer, options.context.env);
|
|
1050
|
-
options.context.commandResults ??= [];
|
|
1051
|
-
options.context.commandResults.push({ producer, state: 'completed', commandIds: [], removedCommandIds, errors: [], recoveryActions: [] });
|
|
1052
|
-
}
|
|
1053
|
-
};
|
|
1054
|
-
const publishPackages = async (target) => {
|
|
1055
|
-
const cache = options.context.managedCommandProducerCache ??= new Map();
|
|
1056
|
-
for (const action of target.operationActions ?? []) {
|
|
1057
|
-
if (action.kind !== 'syncManagedCommandPackage')
|
|
1058
|
-
continue;
|
|
1059
|
-
const key = getCommandPackageId(action.producer);
|
|
1060
|
-
let publication = cache.get(key);
|
|
1061
|
-
if (!publication) {
|
|
1062
|
-
publication = (async () => {
|
|
1063
|
-
await options.context.reporter.event({ type: 'managed-command:producer', source: { plugin: action.producer.pluginName, scope: action.producer.scope }, data: { packageKey: action.producer.key, phase: 'start' } });
|
|
1064
|
-
const temporary = await fs.mkdtemp(path.join(os.tmpdir(), 'aw-command-publish-'));
|
|
1065
|
-
try {
|
|
1066
|
-
const digest = `sha256:${crypto.createHash('sha256').update(JSON.stringify(action.files)).digest('hex')}`;
|
|
1067
|
-
if (digest !== action.contentDigest)
|
|
1068
|
-
throw new ManagedCommandError('commandResourceInvalid', 'The prepared command package digest changed.');
|
|
1069
|
-
const resourceRoot = path.join(temporary, 'resource');
|
|
1070
|
-
await fs.ensureDir(resourceRoot);
|
|
1071
|
-
for (const file of action.files) {
|
|
1072
|
-
const content = Buffer.from(file.contentBase64, 'base64');
|
|
1073
|
-
if (`sha256:${crypto.createHash('sha256').update(content).digest('hex')}` !== file.contentDigest)
|
|
1074
|
-
throw new ManagedCommandError('commandResourceInvalid', 'The prepared command package file digest changed.');
|
|
1075
|
-
const destination = path.join(resourceRoot, ...file.relativePath.split('/'));
|
|
1076
|
-
await fs.outputFile(destination, content);
|
|
1077
|
-
await fs.chmod(destination, file.mode);
|
|
1078
|
-
}
|
|
1079
|
-
const result = await syncManagedCommandPackage({ producer: action.producer, sourceDirectory: resourceRoot, sets: action.sets, nativeTools: action.nativeTools, env: options.context.env });
|
|
1080
|
-
await options.context.reporter.event({ type: 'managed-command:producer', source: { plugin: action.producer.pluginName, scope: action.producer.scope }, data: { packageKey: action.producer.key, phase: 'success' } });
|
|
1081
|
-
return { producer: action.producer, state: 'completed', commandIds: result.commandIds, removedCommandIds: result.removedCommandIds, errors: [], recoveryActions: [] };
|
|
1082
|
-
}
|
|
1083
|
-
catch (error) {
|
|
1084
|
-
await options.context.reporter.event({ type: 'managed-command:producer', source: { plugin: action.producer.pluginName, scope: action.producer.scope }, data: { packageKey: action.producer.key, phase: 'failure' } });
|
|
1085
|
-
return { producer: action.producer, state: 'failed', commandIds: [], removedCommandIds: [], errors: [managedCommandDiagnostic(error)], recoveryActions: [`aw command package sync ${action.producer.sourceId}/${action.producer.pluginName} ${action.producer.key} --scope ${action.producer.scope} --yes`] };
|
|
1086
|
-
}
|
|
1087
|
-
finally {
|
|
1088
|
-
await fs.remove(temporary);
|
|
1089
|
-
}
|
|
1090
|
-
})();
|
|
1091
|
-
cache.set(key, publication);
|
|
1092
|
-
}
|
|
1093
|
-
const result = await publication;
|
|
1094
|
-
options.context.commandResults ??= [];
|
|
1095
|
-
if (!options.context.commandResults.some((entry) => getCommandPackageId(entry.producer) === key))
|
|
1096
|
-
options.context.commandResults.push(result);
|
|
1097
|
-
if (result.state !== 'completed')
|
|
1098
|
-
throw new Error('commandPackagePublishFailed: sync the command package and retry the plugin operation.');
|
|
1099
|
-
}
|
|
1100
|
-
};
|
|
1101
979
|
const currentCodexManager = () => options.context.codexManager;
|
|
1102
980
|
const codexNativeStates = new Map();
|
|
1103
981
|
const pendingCodexNativeStates = new Map();
|
|
@@ -1264,6 +1142,8 @@ function createNativeDriver(options) {
|
|
|
1264
1142
|
inspectShared: async (component) => {
|
|
1265
1143
|
const locator = component.locator;
|
|
1266
1144
|
switch (locator.kind) {
|
|
1145
|
+
case 'host-permissions':
|
|
1146
|
+
return await hasPermissionOwner(options.context.env, locator) ? 'present' : 'absent';
|
|
1267
1147
|
case 'cursor-workspace-hook':
|
|
1268
1148
|
return platformOwnership.inspectShared(component);
|
|
1269
1149
|
case 'claude-permissions':
|
|
@@ -1316,6 +1196,11 @@ function createNativeDriver(options) {
|
|
|
1316
1196
|
removeShared: async (component) => {
|
|
1317
1197
|
const locator = component.locator;
|
|
1318
1198
|
switch (locator.kind) {
|
|
1199
|
+
case 'host-permissions':
|
|
1200
|
+
if (options.context.removeHostPermissions)
|
|
1201
|
+
return options.context.removeHostPermissions(locator);
|
|
1202
|
+
await updateHostPermissions({ env: options.context.env, cwd: locator.projectRoot ?? locator.hostConfigRoot, invocationCwd: options.context.invocationCwd }, locator);
|
|
1203
|
+
return;
|
|
1319
1204
|
case 'cursor-workspace-hook':
|
|
1320
1205
|
return platformOwnership.removeShared(component);
|
|
1321
1206
|
case 'claude-permissions': {
|
|
@@ -1439,10 +1324,6 @@ function createNativeDriver(options) {
|
|
|
1439
1324
|
};
|
|
1440
1325
|
return {
|
|
1441
1326
|
ownership,
|
|
1442
|
-
beforeCleanupMutation: async (component) => {
|
|
1443
|
-
if (component.kind === 'skill-directory')
|
|
1444
|
-
await revokeAtRoot(component.path);
|
|
1445
|
-
},
|
|
1446
1327
|
setNativeMarketplaceEligibleTargets: (eligibleTargets) => {
|
|
1447
1328
|
nativeMarketplaceEligibleTargets = new Set(eligibleTargets);
|
|
1448
1329
|
},
|
|
@@ -1523,10 +1404,6 @@ function createNativeDriver(options) {
|
|
|
1523
1404
|
? 'both'
|
|
1524
1405
|
: 'user'))));
|
|
1525
1406
|
},
|
|
1526
|
-
preflightMutation: async (target) => {
|
|
1527
|
-
await assertManagedCommandBindingIdentities({ producers: (target.operationActions ?? []).flatMap((action) => action.kind === 'syncManagedCommandPackage' ? [{ producer: action.producer, sets: action.sets, nativeTools: action.nativeTools }] : []),
|
|
1528
|
-
env: options.context.env });
|
|
1529
|
-
},
|
|
1530
1407
|
preflightMaterialize: async (target) => {
|
|
1531
1408
|
if (target.identity.sourceId && options.context.expectedCatalogConfigDigest) {
|
|
1532
1409
|
const current = await readCatalogSourcesConfigSnapshot(options.context.env);
|
|
@@ -1544,7 +1421,7 @@ function createNativeDriver(options) {
|
|
|
1544
1421
|
if (action.kind !== 'retainManagedCommandPackage')
|
|
1545
1422
|
continue;
|
|
1546
1423
|
options.context.commandResults ??= [];
|
|
1547
|
-
if (!options.context.commandResults.some((result) =>
|
|
1424
|
+
if (!options.context.commandResults.some((result) => result.packageId === action.packageId))
|
|
1548
1425
|
options.context.commandResults.push(retainedManagedCommandPackageResult(action));
|
|
1549
1426
|
}
|
|
1550
1427
|
},
|
|
@@ -1637,10 +1514,8 @@ function createNativeDriver(options) {
|
|
|
1637
1514
|
throw new Error('codexNativeObservationUnavailable: native group precheck is missing.');
|
|
1638
1515
|
}
|
|
1639
1516
|
const removalRequired = before === 'present';
|
|
1640
|
-
if (!removalRequired)
|
|
1641
|
-
await revokeAtRoot(path.join(target.identity.marketplaceRoot ?? resolveAwHome(options.context.env), 'plugins', target.identity.pluginName), true, 'codex');
|
|
1517
|
+
if (!removalRequired)
|
|
1642
1518
|
return;
|
|
1643
|
-
}
|
|
1644
1519
|
try {
|
|
1645
1520
|
codexMutationMarketplaces.add(marketplaceName);
|
|
1646
1521
|
await runObservedCodexMutation({
|
|
@@ -1677,8 +1552,6 @@ function createNativeDriver(options) {
|
|
|
1677
1552
|
? `codexNativeRemoveIncomplete: ${CODEX_REMOVE_RECOVERY}`
|
|
1678
1553
|
: `codexNativeInstallIncomplete: ${component.pluginId} is absent from Codex plugin list.`);
|
|
1679
1554
|
}
|
|
1680
|
-
if (expected === 'absent')
|
|
1681
|
-
await revokeAtRoot(path.join(target.identity.marketplaceRoot ?? resolveAwHome(options.context.env), 'plugins', target.identity.pluginName), true, 'codex');
|
|
1682
1555
|
};
|
|
1683
1556
|
if (options.operationScopedNativePhases) {
|
|
1684
1557
|
deferredPostchecks.push({ target, postcheck });
|
|
@@ -1713,7 +1586,7 @@ function createNativeDriver(options) {
|
|
|
1713
1586
|
}
|
|
1714
1587
|
}
|
|
1715
1588
|
},
|
|
1716
|
-
applyManagedCommands:
|
|
1589
|
+
applyManagedCommands: (target) => publishLifecycleCommandPackages(target, options.context),
|
|
1717
1590
|
writeNative: async () => { throw new Error('platformDeploymentRequired: native writes require a frozen platform deployment.'); },
|
|
1718
1591
|
writeArtifacts: async (target) => {
|
|
1719
1592
|
if (target.artifacts.length > 0)
|
|
@@ -1790,39 +1663,49 @@ export function createRebuildIntegration(options) {
|
|
|
1790
1663
|
options.context.platformRebuildSession = platformSession;
|
|
1791
1664
|
platformSession.updateContext(options.context);
|
|
1792
1665
|
platformSession.setOwnershipExecutor(driver.ownership);
|
|
1666
|
+
const targetPlatforms = new Map();
|
|
1793
1667
|
return {
|
|
1794
|
-
resolvePlatformTargets: (inputs) =>
|
|
1668
|
+
resolvePlatformTargets: async (inputs) => {
|
|
1669
|
+
await platformSession.resolveAll(inputs);
|
|
1670
|
+
for (const input of inputs) {
|
|
1671
|
+
const id = input.pluginId ?? pluginActionId(input.plugin);
|
|
1672
|
+
const platforms = targetPlatforms.get(id) ?? [];
|
|
1673
|
+
if (!platforms.includes(input.platform))
|
|
1674
|
+
platforms.push(input.platform);
|
|
1675
|
+
targetPlatforms.set(id, platforms);
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1795
1678
|
sealMarketplaceGenerations: (eligible) => platformSession.sealMarketplaceGenerations(eligible),
|
|
1679
|
+
pendingOpenCodeProjectNotices: (interrupted) => platformSession.pendingOpenCodeProjectNotices(interrupted),
|
|
1796
1680
|
driver,
|
|
1797
1681
|
setNativeMarketplaceEligibleTargets: driver.setNativeMarketplaceEligibleTargets,
|
|
1798
1682
|
prepareNativeMarketplaceGroup: driver.prepareNativeMarketplaceGroup,
|
|
1799
1683
|
postcheckCodexProvider: driver.postcheckCodexProvider,
|
|
1800
1684
|
captureCodexPostMutationSnapshots: driver.captureCodexPostMutationSnapshots,
|
|
1801
1685
|
buildTarget: async (input) => {
|
|
1802
|
-
const
|
|
1686
|
+
const removed = input.command === 'cleanup' || input.command === 'uninstall';
|
|
1687
|
+
const id = input.pluginId ?? pluginActionId(input.plugin);
|
|
1688
|
+
const platforms = options.context.commandPackagePlatforms?.get(id) ?? targetPlatforms.get(id) ?? [input.platform];
|
|
1689
|
+
let commands;
|
|
1803
1690
|
if (!input.readOnlyInspectionPlan) {
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1691
|
+
try {
|
|
1692
|
+
commands = await prepareLifecycleCommandPackage({ ...input, removing: removed, platforms, context: options.context });
|
|
1693
|
+
}
|
|
1694
|
+
catch (error) {
|
|
1695
|
+
if (error instanceof ManagedCommandError)
|
|
1696
|
+
throw new Error(`${error.code}: ${error.message}`, { cause: error });
|
|
1697
|
+
throw error;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
const target = await platformSession.buildTarget({ ...input, commandRecord: commands?.record });
|
|
1701
|
+
if (commands) {
|
|
1702
|
+
const operationActions = commands.actions;
|
|
1816
1703
|
const preApply = input.plugin.manifest.scripts?.preApply;
|
|
1817
1704
|
if (preApply && !removed && !isNativeActivationOnlyTarget(options.context, target.identity))
|
|
1818
1705
|
operationActions.push({ kind: 'runPreApply',
|
|
1819
1706
|
pluginId: input.pluginId ?? pluginActionId(input.plugin), platform: input.platform, scope: input.scope,
|
|
1820
1707
|
script: preApply.path, scriptDigest: `sha256:${crypto.createHash('sha256')
|
|
1821
1708
|
.update(await fs.readFile(path.resolve(input.plugin.rootDir, preApply.path.replace(/^\.\//u, '')))).digest('hex')}` });
|
|
1822
|
-
const nativeToolChanges = await captureNativeToolChanges({ actions: operationActions,
|
|
1823
|
-
producers: commands.candidates.map((candidate) => candidate.producer), removed, env: options.context.env });
|
|
1824
|
-
if (nativeToolChanges.length)
|
|
1825
|
-
operationActions[0].nativeToolChanges = nativeToolChanges;
|
|
1826
1709
|
target.operationActions = operationActions;
|
|
1827
1710
|
}
|
|
1828
1711
|
targets.push(target);
|