@agentxm/extension-lifecycle 0.29.2 → 0.29.4

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.
@@ -188,9 +188,17 @@ export const prepareSetActivation = (request) => Effect.gen(function* () {
188
188
  if (entry === undefined) {
189
189
  return unchanged(request, request.name, `MCP server "${request.name}" is not configured`);
190
190
  }
191
- if (entry.enabled === request.enabled) {
191
+ if (!request.enabled && entry.enabled === request.enabled) {
192
192
  return unchanged(request, request.name, `MCP server "${request.name}" is already ${verb}`);
193
193
  }
194
+ const managers = yield* ExtensionManagers;
195
+ const agentOutcomes = request.enabled
196
+ ? yield* managers["mcp-server"].configuredAgentOutcomesForEntry({
197
+ name: request.name,
198
+ entry,
199
+ state: "projected",
200
+ })
201
+ : [];
194
202
  return {
195
203
  _tag: "SetActivation",
196
204
  type: "mcp-server",
@@ -202,7 +210,7 @@ export const prepareSetActivation = (request) => Effect.gen(function* () {
202
210
  instructions: Option.none(),
203
211
  blocked: Option.none(),
204
212
  warning: Option.none(),
205
- agentOutcomes: [],
213
+ agentOutcomes,
206
214
  };
207
215
  }
208
216
  case "rule": {
@@ -424,7 +432,7 @@ const dematerializeMember = (node) => Effect.gen(function* () {
424
432
  workspaceRoot: ws.baseDir,
425
433
  scope: ws.scope,
426
434
  serverName: node.name,
427
- disableOnly: true,
435
+ disableOnly: false,
428
436
  })
429
437
  .pipe(Effect.flatMap((outcome) => outcome._tag === "disabled" ||
430
438
  outcome._tag === "nothing-runnable" ||
@@ -617,7 +625,12 @@ const executorStep = (candidate, kind) => {
617
625
  : candidate.enabled
618
626
  ? enableMcpServer({ name: "enable-mcp-server", args: { serverName: candidate.name } })
619
627
  : disableMcpServer({ name: "disable-mcp-server", args: { serverName: candidate.name } });
620
- return { label: candidate.name, readiness: "ready", run };
628
+ return {
629
+ label: candidate.name,
630
+ readiness: "ready",
631
+ ...(candidate.agentOutcomes.length === 0 ? {} : { agentOutcomes: candidate.agentOutcomes }),
632
+ run,
633
+ };
621
634
  };
622
635
  /**
623
636
  * The step for a type whose transition this use case composes itself: the
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Hook-backed implementation of the workspace-state
2
+ * Extension-manager-backed implementation of the workspace-state
3
3
  * `ConfiguredAgentOutcomesProvider` port.
4
4
  *
5
- * The plan pipeline consumes the port; the hook manager owns the effective
5
+ * The plan pipeline consumes the port; extension managers own the effective
6
6
  * per-agent outcome facts. Only the composition root sees both, so the
7
7
  * application wires this layer over the manager, supplying its own failure
8
8
  * serialization so plan resolutions embed byte-identical step failures on
@@ -17,6 +17,6 @@ import * as HttpClient from "effect/unstable/http/HttpClient";
17
17
  import { NativeWriteAuthority } from "@agentxm/agent-integration";
18
18
  import { ConfiguredAgentOutcomesProvider } from "@agentxm/workspace-state";
19
19
  import { StepFailureConversion } from "../step-failure-conversion.js";
20
- import { HookManager } from "@agentxm/extension-materialization";
21
- export declare const HookConfiguredAgentOutcomesProviderLive: Layer.Layer<ConfiguredAgentOutcomesProvider, never, StepFailureConversion | FileSystem.FileSystem | Path.Path | NativeWriteAuthority | HttpClient.HttpClient | HookManager>;
20
+ import { HookManager, McpServerManager } from "@agentxm/extension-materialization";
21
+ export declare const ConfiguredAgentOutcomesProviderLive: Layer.Layer<ConfiguredAgentOutcomesProvider, never, StepFailureConversion | FileSystem.FileSystem | Path.Path | NativeWriteAuthority | HttpClient.HttpClient | HookManager | McpServerManager>;
22
22
  //# sourceMappingURL=configured-agent-outcomes-provider.d.ts.map
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Hook-backed implementation of the workspace-state
2
+ * Extension-manager-backed implementation of the workspace-state
3
3
  * `ConfiguredAgentOutcomesProvider` port.
4
4
  *
5
- * The plan pipeline consumes the port; the hook manager owns the effective
5
+ * The plan pipeline consumes the port; extension managers own the effective
6
6
  * per-agent outcome facts. Only the composition root sees both, so the
7
7
  * application wires this layer over the manager, supplying its own failure
8
8
  * serialization so plan resolutions embed byte-identical step failures on
@@ -18,28 +18,34 @@ import * as HttpClient from "effect/unstable/http/HttpClient";
18
18
  import { NativeWriteAuthority } from "@agentxm/agent-integration";
19
19
  import { ConfiguredAgentOutcomesProvider, ConfiguredAgentOutcomesUnavailable, } from "@agentxm/workspace-state";
20
20
  import { StepFailureConversion } from "../step-failure-conversion.js";
21
- import { HookManager } from "@agentxm/extension-materialization";
22
- export const HookConfiguredAgentOutcomesProviderLive = Layer.effect(ConfiguredAgentOutcomesProvider, Effect.gen(function* () {
21
+ import { HookManager, McpServerManager } from "@agentxm/extension-materialization";
22
+ export const ConfiguredAgentOutcomesProviderLive = Layer.effect(ConfiguredAgentOutcomesProvider, Effect.gen(function* () {
23
23
  const adapter = yield* StepFailureConversion;
24
24
  const hookManager = yield* HookManager;
25
+ const mcpServerManager = yield* McpServerManager;
25
26
  // The provider's members answer with no requirements of their own, so this
26
27
  // layer is the boundary that composes what the manager needs.
27
28
  const managerLayer = Layer.mergeAll(Layer.succeed(FileSystem.FileSystem, yield* FileSystem.FileSystem), Layer.succeed(Path.Path, yield* Path.Path), Layer.succeed(HttpClient.HttpClient, yield* HttpClient.HttpClient), Layer.succeed(NativeWriteAuthority, yield* NativeWriteAuthority));
28
- const configuredAgentOutcomes = hookManager.configuredAgentOutcomes;
29
- if (configuredAgentOutcomes === undefined) {
30
- return { byExtensionType: {} };
31
- }
29
+ const mapFailure = (failure) => {
30
+ const step = adapter.toStepFailure(failure);
31
+ return new ConfiguredAgentOutcomesUnavailable({
32
+ category: step.category,
33
+ detail: step.detail,
34
+ ...(step.suggestions === undefined ? {} : { suggestions: step.suggestions }),
35
+ ...(step.cause === undefined ? {} : { cause: step.cause }),
36
+ });
37
+ };
38
+ const configuredHookOutcomes = hookManager.configuredAgentOutcomes;
32
39
  return {
33
40
  byExtensionType: {
34
- hook: (state) => configuredAgentOutcomes(state).pipe(Effect.provide(managerLayer), Effect.mapError((failure) => {
35
- const step = adapter.toStepFailure(failure);
36
- return new ConfiguredAgentOutcomesUnavailable({
37
- category: step.category,
38
- detail: step.detail,
39
- ...(step.suggestions === undefined ? {} : { suggestions: step.suggestions }),
40
- ...(step.cause === undefined ? {} : { cause: step.cause }),
41
- });
42
- })),
41
+ ...(configuredHookOutcomes === undefined
42
+ ? {}
43
+ : {
44
+ hook: (state) => configuredHookOutcomes(state).pipe(Effect.provide(managerLayer), Effect.mapError(mapFailure)),
45
+ }),
46
+ "mcp-server": (state) => mcpServerManager
47
+ .configuredAgentOutcomes(state)
48
+ .pipe(Effect.provide(managerLayer), Effect.mapError(mapFailure)),
43
49
  },
44
50
  };
45
51
  }));
@@ -7,5 +7,5 @@
7
7
  * @experimental All exports from this module are unstable and may change without notice.
8
8
  * @packageDocumentation
9
9
  */
10
- export { HookConfiguredAgentOutcomesProviderLive } from "./hooks/configured-agent-outcomes-provider.js";
10
+ export { ConfiguredAgentOutcomesProviderLive } from "./hooks/configured-agent-outcomes-provider.js";
11
11
  //# sourceMappingURL=live.d.ts.map
package/dist/src/live.js CHANGED
@@ -7,5 +7,5 @@
7
7
  * @experimental All exports from this module are unstable and may change without notice.
8
8
  * @packageDocumentation
9
9
  */
10
- export { HookConfiguredAgentOutcomesProviderLive } from "./hooks/configured-agent-outcomes-provider.js";
10
+ export { ConfiguredAgentOutcomesProviderLive } from "./hooks/configured-agent-outcomes-provider.js";
11
11
  //# sourceMappingURL=live.js.map
@@ -35,7 +35,7 @@ export const disableMcpServer = (op) => Effect.gen(function* () {
35
35
  workspaceRoot: ws.baseDir,
36
36
  scope: ws.scope,
37
37
  serverName: op.args.serverName,
38
- disableOnly: true,
38
+ disableOnly: false,
39
39
  }), { concurrency: "unbounded" });
40
40
  yield* requireSuccessfulMcpSync(op.args.serverName, agents.map((agent, index) => ({
41
41
  agentId: agent.id,
@@ -7,8 +7,8 @@ import * as FileSystem from "effect/FileSystem";
7
7
  import * as Path from "effect/Path";
8
8
  import * as Effect from "effect/Effect";
9
9
  import * as Option from "effect/Option";
10
- import { CodingAgentRepository, applyProjectionPlansWithResults, planSingletonProjection, } from "@agentxm/workspace-projection";
11
- import { NativeWriteAuthority, syncInlineMcpServerToAgents } from "@agentxm/agent-integration";
10
+ import { CodingAgentRepository } from "@agentxm/workspace-projection";
11
+ import { NativeWriteAuthority, syncInlineMcpServerToAgents, syncManifestMcpServerToAgents, } from "@agentxm/agent-integration";
12
12
  import { normalizeHandle, parseExtensionFqnParts, } from "@agentxm/extension-model/unstable/extensions";
13
13
  import { appendWarningsToMessage } from "@agentxm/workspace-operations";
14
14
  import { WorkspaceMutations } from "@agentxm/workspace-state";
@@ -117,37 +117,22 @@ export const enableMcpServer = (op) => Effect.gen(function* () {
117
117
  const owner = trustedIdentity?.type === "mcp-server" ? trustedIdentity.owner : normalizeHandle("@local");
118
118
  const resolvedVersion = accepted?.type === "registry" ? accepted.resolvedVersion : "0.0.0";
119
119
  const agents = yield* agentRepo.getConfiguredAgents();
120
+ const agentIds = agents.map(({ id }) => id);
120
121
  const outcomes = yield* runWorkspaceTransaction({
121
122
  transition: Effect.gen(function* () {
122
- const synced = yield* applyProjectionPlansWithResults(agents.map((agent) => planSingletonProjection({
123
- unitId: "mcp-server:native-config-entry",
124
- targetFile: "mcp:configured-agents",
125
- contributor: op.args,
126
- adapter: {
127
- observe: () => Effect.succeed({
128
- unitId: "mcp-server:native-config-entry",
129
- path: `${agent.id}:${op.args.serverName}`,
130
- present: false,
131
- current: false,
132
- expectedContributors: [op.args.serverName],
133
- observedContributors: [],
134
- }),
135
- apply: () => Effect.gen(function* () {
136
- return yield* agent.addMcpServer({
137
- workspaceRoot: ws.baseDir,
138
- scope: ws.scope,
139
- serverName: op.args.serverName,
140
- canonicalPath,
141
- owner,
142
- resolvedVersion,
143
- enabled: true,
144
- configValues: entry.env,
145
- });
146
- }),
147
- },
148
- })));
149
- yield* requireSuccessfulMcpSync(op.args.serverName, agents.map((agent, index) => ({
150
- agentId: agent.id,
123
+ const synced = yield* syncManifestMcpServerToAgents({
124
+ agentIds,
125
+ workspaceRoot: ws.baseDir,
126
+ scope: ws.scope,
127
+ serverName: op.args.serverName,
128
+ canonicalPath,
129
+ owner,
130
+ resolvedVersion,
131
+ enabled: true,
132
+ configValues: entry.env,
133
+ });
134
+ yield* requireSuccessfulMcpSync(op.args.serverName, agentIds.map((agentId, index) => ({
135
+ agentId,
151
136
  outcome: synced[index] ?? {
152
137
  _tag: "failed",
153
138
  reason: "Agent sync returned no outcome",
@@ -161,17 +146,17 @@ export const enableMcpServer = (op) => Effect.gen(function* () {
161
146
  }).pipe(Effect.provideService(FileSystem.FileSystem, fs), Effect.provideService(Path.Path, path)),
162
147
  validate: () => Effect.void,
163
148
  });
164
- const warnings = mcpSyncWarnings(op.args.serverName, agents.map((agent, index) => ({
165
- agentId: agent.id,
149
+ const warnings = mcpSyncWarnings(op.args.serverName, agentIds.map((agentId, index) => ({
150
+ agentId,
166
151
  outcome: outcomes[index] ?? {
167
152
  _tag: "failed",
168
153
  reason: "Agent sync returned no outcome",
169
154
  },
170
155
  })));
171
- const agentOutcomes = agents.flatMap((agent, index) => {
156
+ const agentOutcomes = agentIds.flatMap((agentId, index) => {
172
157
  const outcome = outcomes[index];
173
158
  return outcome !== undefined && "targets" in outcome
174
- ? [{ agentId: agent.id, targets: outcome.targets }]
159
+ ? [{ agentId, targets: outcome.targets }]
175
160
  : [];
176
161
  });
177
162
  return {
package/package.json CHANGED
@@ -4,19 +4,19 @@
4
4
  "url": "https://github.com/agentxm/axm/issues"
5
5
  },
6
6
  "dependencies": {
7
- "@agentxm/agent-integration": "^0.29.2",
8
- "@agentxm/extension-content": "^0.29.2",
9
- "@agentxm/extension-materialization": "^0.29.2",
10
- "@agentxm/extension-model": "^0.29.2",
11
- "@agentxm/extension-resolution": "^0.29.2",
12
- "@agentxm/extension-sources": "^0.29.2",
13
- "@agentxm/registry-auth": "^0.29.2",
14
- "@agentxm/registry-client": "^0.29.2",
15
- "@agentxm/registry-protocol": "^0.29.2",
16
- "@agentxm/workspace-operations": "^0.29.2",
17
- "@agentxm/workspace-projection": "^0.29.2",
18
- "@agentxm/workspace-state": "^0.29.2",
19
- "@agentxm/workspace-transactions": "^0.29.2",
7
+ "@agentxm/agent-integration": "^0.29.4",
8
+ "@agentxm/extension-content": "^0.29.4",
9
+ "@agentxm/extension-materialization": "^0.29.4",
10
+ "@agentxm/extension-model": "^0.29.4",
11
+ "@agentxm/extension-resolution": "^0.29.4",
12
+ "@agentxm/extension-sources": "^0.29.4",
13
+ "@agentxm/registry-auth": "^0.29.4",
14
+ "@agentxm/registry-client": "^0.29.4",
15
+ "@agentxm/registry-protocol": "^0.29.4",
16
+ "@agentxm/workspace-operations": "^0.29.4",
17
+ "@agentxm/workspace-projection": "^0.29.4",
18
+ "@agentxm/workspace-state": "^0.29.4",
19
+ "@agentxm/workspace-transactions": "^0.29.4",
20
20
  "@napi-rs/keyring": "^1.3.0",
21
21
  "effect": "4.0.0-rc.115",
22
22
  "fflate": "^0.8.3"
@@ -72,5 +72,5 @@
72
72
  },
73
73
  "sideEffects": false,
74
74
  "type": "module",
75
- "version": "0.29.2"
75
+ "version": "0.29.4"
76
76
  }