@agentxm/extension-lifecycle 0.28.7 → 0.28.9

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.
@@ -13,6 +13,7 @@ export { ReleaseAgePosture, type ReleaseAgePostureValue } from "./release-age-po
13
13
  export { LifecycleFailureAdapter, withAdaptedStepFailures, type LifecycleFailureAdapterService, } from "./failure-adapter.js";
14
14
  export { makeConfiguredReleaseAgeEvaluation, resolveConfiguredHook, resolveConfiguredKnowledge, resolveConfiguredMcpServer, resolveConfiguredPack, resolveConfiguredRegistryEntry, resolveConfiguredRule, resolveConfiguredSkill, resolveConfiguredSubagent, } from "./configured-entry-resolution.js";
15
15
  export { CONFIGURED_ENTRY_RESOLUTION_TIMEOUT, withConfiguredEntryResolutionTimeout, } from "./resolution-timeout.js";
16
+ export { PUBLISHER_CHANGE_CONDITION_ID, classifyPublisherBindingTransition, publisherChangeRiskCondition, publisherTransitionWarning, registryBindingProposal, withPublisherTrust, withPublisherTrustConditions, type PublisherBindingTransition, } from "./publisher-binding.js";
16
17
  export { buildInstallCommandPlan, runInstallCommandWorkflow, type InstallExtensionCommandWorkflowActions, } from "./workflows/install-command/workflow.js";
17
18
  export { runUninstallCommandWorkflow, type UninstallExtensionCommandWorkflowActions, type UninstallWorkflowFlags, } from "./workflows/uninstall-command/workflow.js";
18
19
  export { materializeRegistryPackage, materializeRegistryPackageWithTreeIntegrity, type MaterializeRegistryPackageArgs, type RegistryPackageMaterializationMessages, } from "./registry-materialization.js";
package/dist/src/index.js CHANGED
@@ -13,6 +13,7 @@ export { ReleaseAgePosture } from "./release-age-posture.js";
13
13
  export { LifecycleFailureAdapter, withAdaptedStepFailures, } from "./failure-adapter.js";
14
14
  export { makeConfiguredReleaseAgeEvaluation, resolveConfiguredHook, resolveConfiguredKnowledge, resolveConfiguredMcpServer, resolveConfiguredPack, resolveConfiguredRegistryEntry, resolveConfiguredRule, resolveConfiguredSkill, resolveConfiguredSubagent, } from "./configured-entry-resolution.js";
15
15
  export { CONFIGURED_ENTRY_RESOLUTION_TIMEOUT, withConfiguredEntryResolutionTimeout, } from "./resolution-timeout.js";
16
+ export { PUBLISHER_CHANGE_CONDITION_ID, classifyPublisherBindingTransition, publisherChangeRiskCondition, publisherTransitionWarning, registryBindingProposal, withPublisherTrust, withPublisherTrustConditions, } from "./publisher-binding.js";
16
17
  export { buildInstallCommandPlan, runInstallCommandWorkflow, } from "./workflows/install-command/workflow.js";
17
18
  export { runUninstallCommandWorkflow, } from "./workflows/uninstall-command/workflow.js";
18
19
  export { materializeRegistryPackage, materializeRegistryPackageWithTreeIntegrity, } from "./registry-materialization.js";
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Publisher binding trust classification.
3
+ *
4
+ * A Registry resolution binds a publisher identity. When an operation
5
+ * proposes to replace an already accepted binding for the same configured
6
+ * extension with a different one, that transition is a trust decision a
7
+ * person makes at a prompt: no flag and no unattended mode can approve it.
8
+ * Every route that can replace an accepted binding — root and type update
9
+ * forms, reinstall and re-resolution, and pack closures — classifies the
10
+ * transition from the structured accepted and proposed identities here, so
11
+ * the same rule holds everywhere the transition can occur.
12
+ *
13
+ * A first acceptance is not a change, and an integrity mismatch while
14
+ * reacquiring the same accepted identity remains a hard failure elsewhere.
15
+ *
16
+ * @experimental This API is unstable and may change without notice.
17
+ */
18
+ import * as Effect from "effect/Effect";
19
+ import type * as FileSystem from "effect/FileSystem";
20
+ import * as Option from "effect/Option";
21
+ import type * as Path from "effect/Path";
22
+ import type { ExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/extension-ref";
23
+ import type { ExtensionType } from "@agentxm/extension-model/unstable/extensions";
24
+ import type { Plan, PlanRiskCondition, RegistryBindingProposal } from "@agentxm/workspace-operations";
25
+ import { WorkspaceMutations } from "@agentxm/workspace-state";
26
+ export interface PublisherBindingTransition {
27
+ readonly extensionType: ExtensionType;
28
+ /** The configured (local) name whose accepted resolution changes publisher. */
29
+ readonly target: string;
30
+ readonly owner: string;
31
+ readonly packageName: string;
32
+ /** The accepted publisher binding being replaced. */
33
+ readonly accepted: string;
34
+ /** The publisher binding the operation proposes to accept. */
35
+ readonly proposed: string;
36
+ }
37
+ export declare const PUBLISHER_CHANGE_CONDITION_ID = "publisher-ownership-change";
38
+ /** The structured proposal an extension ref makes, when it is a Registry ref. */
39
+ export declare const registryBindingProposal: (ref: ExtensionRef) => RegistryBindingProposal | undefined;
40
+ /**
41
+ * Classify one proposed acceptance against the accepted resolution for the
42
+ * same configured target. Only a Registry binding replacing a different
43
+ * Registry binding is a publisher change.
44
+ */
45
+ export declare const classifyPublisherBindingTransition: (args: {
46
+ readonly accepted: Option.Option<ExtensionRef>;
47
+ readonly proposed: RegistryBindingProposal;
48
+ }) => Option.Option<PublisherBindingTransition>;
49
+ /** The warning a step carries when its acceptance changes publisher. */
50
+ export declare const publisherTransitionWarning: (transition: PublisherBindingTransition) => string;
51
+ /**
52
+ * The interactive-only condition a plan carries when any of its steps
53
+ * replaces an accepted publisher binding.
54
+ */
55
+ export declare const publisherChangeRiskCondition: (transitions: ReadonlyArray<PublisherBindingTransition>) => PlanRiskCondition | undefined;
56
+ /** Append the publisher-change condition for the given transitions, if any. */
57
+ export declare const withPublisherTrustConditions: <R, O>(plan: Plan<R, O>, transitions: ReadonlyArray<PublisherBindingTransition>) => Plan<R, O>;
58
+ /**
59
+ * Classify every proposed Registry acceptance in a plan against the accepted
60
+ * resolutions of the workspace, marking each changing step and attaching the
61
+ * interactive-only condition. When an accepted resolution cannot be read the
62
+ * plan blocks rather than proceeding without the comparison.
63
+ */
64
+ export declare const withPublisherTrust: <R, O>(plan: Plan<R, O>) => Effect.Effect<Plan<R, O>, never, WorkspaceMutations | FileSystem.FileSystem | Path.Path>;
65
+ //# sourceMappingURL=publisher-binding.d.ts.map
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Publisher binding trust classification.
3
+ *
4
+ * A Registry resolution binds a publisher identity. When an operation
5
+ * proposes to replace an already accepted binding for the same configured
6
+ * extension with a different one, that transition is a trust decision a
7
+ * person makes at a prompt: no flag and no unattended mode can approve it.
8
+ * Every route that can replace an accepted binding — root and type update
9
+ * forms, reinstall and re-resolution, and pack closures — classifies the
10
+ * transition from the structured accepted and proposed identities here, so
11
+ * the same rule holds everywhere the transition can occur.
12
+ *
13
+ * A first acceptance is not a change, and an integrity mismatch while
14
+ * reacquiring the same accepted identity remains a hard failure elsewhere.
15
+ *
16
+ * @experimental This API is unstable and may change without notice.
17
+ */
18
+ import * as Effect from "effect/Effect";
19
+ import * as Option from "effect/Option";
20
+ import { toExtensionTypePlural } from "@agentxm/extension-model/unstable/extensions/common";
21
+ import { acceptedResolutionRef, WorkspaceMutations } from "@agentxm/workspace-state";
22
+ import { targetFromRef } from "@agentxm/extension-workspace";
23
+ export const PUBLISHER_CHANGE_CONDITION_ID = "publisher-ownership-change";
24
+ const ACCEPTED_RESOLUTION_UNREADABLE_ID = "accepted-resolution-unreadable";
25
+ /** The structured proposal an extension ref makes, when it is a Registry ref. */
26
+ export const registryBindingProposal = (ref) => ref.refType === "registry"
27
+ ? {
28
+ extensionType: ref.type,
29
+ target: targetFromRef(ref).name,
30
+ owner: ref.owner,
31
+ packageName: ref.name,
32
+ version: ref.version,
33
+ publisherBindingId: ref.publisherBindingId,
34
+ }
35
+ : undefined;
36
+ /**
37
+ * Classify one proposed acceptance against the accepted resolution for the
38
+ * same configured target. Only a Registry binding replacing a different
39
+ * Registry binding is a publisher change.
40
+ */
41
+ export const classifyPublisherBindingTransition = (args) => Option.flatMap(args.accepted, (accepted) => accepted.refType === "registry" &&
42
+ accepted.type === args.proposed.extensionType &&
43
+ accepted.publisherBindingId !== args.proposed.publisherBindingId
44
+ ? Option.some({
45
+ extensionType: args.proposed.extensionType,
46
+ target: args.proposed.target,
47
+ owner: args.proposed.owner,
48
+ packageName: args.proposed.packageName,
49
+ accepted: accepted.publisherBindingId,
50
+ proposed: args.proposed.publisherBindingId,
51
+ })
52
+ : Option.none());
53
+ const describeTransition = (transition) => `${transition.owner}/${toExtensionTypePlural(transition.extensionType)}/${transition.packageName}`;
54
+ /** The warning a step carries when its acceptance changes publisher. */
55
+ export const publisherTransitionWarning = (transition) => `Publisher identity changed (${transition.accepted} → ${transition.proposed}); confirm only if you trust the current publisher`;
56
+ /**
57
+ * The interactive-only condition a plan carries when any of its steps
58
+ * replaces an accepted publisher binding.
59
+ */
60
+ export const publisherChangeRiskCondition = (transitions) => transitions.length === 0
61
+ ? undefined
62
+ : {
63
+ level: "confirmable",
64
+ consent: "interactive-only",
65
+ id: PUBLISHER_CHANGE_CONDITION_ID,
66
+ detail: `Publisher identity changed for ${transitions
67
+ .map(describeTransition)
68
+ .join(", ")}; confirm only if you trust the current publisher.`,
69
+ };
70
+ /** Append the publisher-change condition for the given transitions, if any. */
71
+ export const withPublisherTrustConditions = (plan, transitions) => {
72
+ const condition = publisherChangeRiskCondition(transitions);
73
+ return condition === undefined
74
+ ? plan
75
+ : { ...plan, riskConditions: [...(plan.riskConditions ?? []), condition] };
76
+ };
77
+ const stepWithTransitionWarning = (step, transition) => {
78
+ const warning = publisherTransitionWarning(transition);
79
+ switch (step.readiness) {
80
+ case "ready": {
81
+ const { message: _message, ...rest } = step;
82
+ return { ...rest, readiness: "warn", warnMessage: warning };
83
+ }
84
+ case "warn":
85
+ return { ...step, warnMessage: `${step.warnMessage}; ${warning}` };
86
+ case "error":
87
+ return step;
88
+ }
89
+ };
90
+ /**
91
+ * Classify every proposed Registry acceptance in a plan against the accepted
92
+ * resolutions of the workspace, marking each changing step and attaching the
93
+ * interactive-only condition. When an accepted resolution cannot be read the
94
+ * plan blocks rather than proceeding without the comparison.
95
+ */
96
+ export const withPublisherTrust = (plan) => Effect.gen(function* () {
97
+ const workspace = yield* WorkspaceMutations;
98
+ const proposals = plan.jobs.flatMap((job) => job.steps.flatMap((step) => (step.registryBinding === undefined ? [] : [step])));
99
+ if (proposals.length === 0)
100
+ return plan;
101
+ const unreadable = [];
102
+ const transitionsByKey = new Map();
103
+ for (const step of proposals) {
104
+ const proposed = step.registryBinding;
105
+ if (proposed === undefined)
106
+ continue;
107
+ const accepted = yield* acceptedResolutionRef({
108
+ workspace,
109
+ type: proposed.extensionType,
110
+ name: proposed.target,
111
+ }).pipe(Effect.option);
112
+ if (Option.isNone(accepted)) {
113
+ unreadable.push(`${proposed.extensionType}:${proposed.target}`);
114
+ continue;
115
+ }
116
+ const transition = classifyPublisherBindingTransition({
117
+ accepted: accepted.value,
118
+ proposed,
119
+ });
120
+ if (Option.isSome(transition)) {
121
+ transitionsByKey.set(`${proposed.extensionType}:${proposed.target}`, transition.value);
122
+ }
123
+ }
124
+ const transitions = [...transitionsByKey.values()];
125
+ const marked = {
126
+ ...plan,
127
+ jobs: plan.jobs.map((job) => ({
128
+ ...job,
129
+ steps: job.steps.map((step) => {
130
+ const binding = step.registryBinding;
131
+ const transition = binding === undefined
132
+ ? undefined
133
+ : transitionsByKey.get(`${binding.extensionType}:${binding.target}`);
134
+ return transition === undefined ? step : stepWithTransitionWarning(step, transition);
135
+ }),
136
+ })),
137
+ };
138
+ const blocked = unreadable.length === 0
139
+ ? undefined
140
+ : {
141
+ level: "blocked",
142
+ id: ACCEPTED_RESOLUTION_UNREADABLE_ID,
143
+ detail: `The accepted resolution for ${unreadable.join(", ")} could not be read, so the proposed publisher binding cannot be checked.`,
144
+ errorCode: "conflict",
145
+ };
146
+ const withTrust = withPublisherTrustConditions(marked, transitions);
147
+ return blocked === undefined
148
+ ? withTrust
149
+ : { ...withTrust, riskConditions: [...(withTrust.riskConditions ?? []), blocked] };
150
+ });
151
+ //# sourceMappingURL=publisher-binding.js.map
@@ -55,7 +55,13 @@ export const enableSkill = (op) => Effect.gen(function* () {
55
55
  }
56
56
  const sanitizedName = sanitizeName(op.args.skillName);
57
57
  const materializationAgents = yield* DefaultCodingAgentRepository.getMaterializationAgents().pipe(Effect.provideService(WorkspaceMutations, ws));
58
- const skillSrcPath = canonical.value.observation.path;
58
+ const accepted = canonical.value.accepted;
59
+ const portable = accepted !== undefined &&
60
+ "packageFormat" in accepted &&
61
+ accepted.packageFormat === "agent-skill";
62
+ const skillSrcPath = portable
63
+ ? canonical.value.observation.path
64
+ : path.join(canonical.value.observation.path, "src");
59
65
  const installableTargets = yield* ws.runTransaction({
60
66
  transition: Effect.gen(function* () {
61
67
  const resolvedTargets = yield* Effect.forEach(materializationAgents, (agent) => agent.resolveEffectiveSkillsDir({ workspaceRoot: base }).pipe(Effect.provide(fsPathLayer), Effect.map((outcome) => ({ agent, outcome }))), { concurrency: "unbounded" });
@@ -41,7 +41,7 @@ export interface InstallExtensionCommandWorkflowActions<Args, Parsed, Req, Ref,
41
41
  export declare const buildInstallCommandPlan: <Args, Parsed, Req, Ref, Intent, ParseError, ResolveError, TransformError = never, TransformRequirements = never>(args: Args, actions: InstallExtensionCommandWorkflowActions<Args, Parsed, Req, Ref, Intent, ParseError, ResolveError>, options?: {
42
42
  readonly transformIntent?: (intent: Intent) => Intent;
43
43
  readonly transformPlan?: (plan: Plan) => Effect.Effect<Plan, TransformError, TransformRequirements>;
44
- }) => Effect.Effect<Plan<never, never>, ParseError | ResolveError | TransformError, Scope.Scope | TransformRequirements>;
44
+ }) => Effect.Effect<Plan<never, never>, ParseError | ResolveError | TransformError, import("@agentxm/workspace-state").WorkspaceMutations | import("effect/FileSystem").FileSystem | import("effect/Path").Path | Scope.Scope | TransformRequirements>;
45
45
  /**
46
46
  * Run the canonical install command workflow.
47
47
  *
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import * as Effect from "effect/Effect";
10
10
  import { observeUnit, previewOrApplyPlan, publishPhaseStarted, } from "@agentxm/workspace-operations";
11
+ import { withPublisherTrust } from "../../publisher-binding.js";
11
12
  // -----------------------------------------------------------------------------
12
13
  // Install Command Workflow
13
14
  // -----------------------------------------------------------------------------
@@ -26,7 +27,11 @@ export const buildInstallCommandPlan = (args, actions, options) => Effect.gen(fu
26
27
  const finalizedIntent = yield* actions.finalizeIntent(parsed, refs);
27
28
  const intent = options?.transformIntent?.(finalizedIntent) ?? finalizedIntent;
28
29
  const plan = yield* actions.buildPlan(intent);
29
- return options?.transformPlan === undefined ? plan : yield* options.transformPlan(plan);
30
+ const transformed = options?.transformPlan === undefined ? plan : yield* options.transformPlan(plan);
31
+ // Every acceptance the plan proposes is classified against the accepted
32
+ // resolution here, so root, type, reinstall, and closure routes share one
33
+ // publisher-trust rule.
34
+ return yield* withPublisherTrust(transformed);
30
35
  });
31
36
  /**
32
37
  * Run the canonical install command workflow.
package/package.json CHANGED
@@ -1,64 +1,65 @@
1
1
  {
2
- "name": "@agentxm/extension-lifecycle",
3
- "version": "0.28.7",
4
- "description": "AXM extension-lifecycle feature: install, update, uninstall, enable, and disable policy across root and type-specific command forms for the axm CLI. Unstable and unsupported — use the axm.sh CLI.",
5
- "type": "module",
6
- "license": "FSL-1.1-MIT",
7
- "homepage": "https://axm.sh",
2
+ "author": "AgentXM <hello@agentxm.ai> (https://agentxm.ai)",
8
3
  "bugs": {
9
4
  "url": "https://github.com/agentxm/axm/issues"
10
5
  },
11
- "author": "AgentXM <hello@agentxm.ai> (https://agentxm.ai)",
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/agentxm/axm.git",
15
- "directory": "packages/extension-lifecycle"
6
+ "dependencies": {
7
+ "@agentxm/extension-model": "^0.28.9",
8
+ "@agentxm/extension-sources": "^0.28.9",
9
+ "@agentxm/extension-workspace": "^0.28.9",
10
+ "@agentxm/registry-client": "^0.28.9",
11
+ "@agentxm/registry-protocol": "^0.28.9",
12
+ "@agentxm/workspace-operations": "^0.28.9",
13
+ "@agentxm/workspace-state": "^0.28.9",
14
+ "@napi-rs/keyring": "^1.3.0",
15
+ "effect": "4.0.0-rc.112",
16
+ "semver": "^7.8.5"
17
+ },
18
+ "description": "AXM extension-lifecycle feature: install, update, uninstall, enable, and disable policy across root and type-specific command forms for the axm CLI. Unstable and unsupported — use the axm.sh CLI.",
19
+ "devDependencies": {
20
+ "@effect/platform-node": "4.0.0-rc.112",
21
+ "@effect/vitest": "4.0.0-rc.112",
22
+ "@types/bun": "^1.3.14",
23
+ "@types/semver": "^7.7.1",
24
+ "@typescript/native": "npm:typescript@^7.0.2",
25
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
26
+ "vitest": "^4.1.10",
27
+ "yaml": "^2.9.0"
28
+ },
29
+ "engines": {
30
+ "node": ">=22.19.0"
16
31
  },
17
- "sideEffects": false,
18
32
  "exports": {
19
33
  ".": {
20
- "types": "./dist/src/index.d.ts",
21
34
  "axm-source": "./src/index.ts",
22
- "default": "./dist/src/index.js"
35
+ "default": "./dist/src/index.js",
36
+ "types": "./dist/src/index.d.ts"
23
37
  },
24
38
  "./live": {
25
- "types": "./dist/src/live.d.ts",
26
39
  "axm-source": "./src/live.ts",
27
- "default": "./dist/src/live.js"
40
+ "default": "./dist/src/live.js",
41
+ "types": "./dist/src/live.d.ts"
28
42
  }
29
43
  },
30
44
  "files": [
31
45
  "dist/src/",
32
46
  "!**/*.map"
33
47
  ],
34
- "publishConfig": {
35
- "access": "public"
36
- },
37
- "engines": {
38
- "node": ">=22.19.0"
39
- },
48
+ "homepage": "https://axm.sh",
49
+ "license": "FSL-1.1-MIT",
50
+ "name": "@agentxm/extension-lifecycle",
40
51
  "nx": {
41
52
  "includedScripts": []
42
53
  },
43
- "dependencies": {
44
- "effect": "4.0.0-rc.112",
45
- "semver": "^7.8.5",
46
- "@agentxm/extension-model": "^0.28.7",
47
- "@agentxm/extension-workspace": "^0.28.7",
48
- "@agentxm/registry-protocol": "^0.28.7",
49
- "@agentxm/registry-client": "^0.28.7",
50
- "@agentxm/workspace-state": "^0.28.7",
51
- "@agentxm/workspace-operations": "^0.28.7",
52
- "@agentxm/extension-sources": "^0.28.7"
54
+ "publishConfig": {
55
+ "access": "public"
53
56
  },
54
- "devDependencies": {
55
- "@effect/platform-node": "4.0.0-rc.112",
56
- "@effect/vitest": "4.0.0-rc.112",
57
- "@types/bun": "^1.3.14",
58
- "@types/semver": "^7.5.8",
59
- "@typescript/native": "npm:typescript@^7.0.2",
60
- "typescript": "npm:@typescript/typescript6@^6.0.2",
61
- "vitest": "^4.1.10",
62
- "yaml": "^2.9.0"
63
- }
64
- }
57
+ "repository": {
58
+ "directory": "packages/extension-lifecycle",
59
+ "type": "git",
60
+ "url": "https://github.com/agentxm/axm.git"
61
+ },
62
+ "sideEffects": false,
63
+ "type": "module",
64
+ "version": "0.28.9"
65
+ }