@agentxm/workspace-state 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.
@@ -24,7 +24,9 @@
24
24
  import * as Effect from "effect/Effect";
25
25
  import * as Option from "effect/Option";
26
26
  import * as Schema from "effect/Schema";
27
- import { parse } from "jsonc-parser";
27
+ import { parse as parseJson } from "jsonc-parser";
28
+ import { parse as parseToml } from "smol-toml";
29
+ import { parse as parseYaml } from "yaml";
28
30
  import { getHome } from "../../../utils/environment.js";
29
31
  import { AGENTS } from "@agentxm/extension-model/unstable/agents/registry";
30
32
  import { CONFIGURABLE_AGENTS_BY_ID, } from "@agentxm/extension-model/unstable/agent-capabilities";
@@ -61,7 +63,18 @@ const extractServers = (decoded, serversKey) => !isRecord(decoded[serversKey])
61
63
  const decodedName = decodeExtensionNameOption(name);
62
64
  return Option.isNone(decodedName) ? [] : [{ name: decodedName.value, config }];
63
65
  });
64
- const readMcpConfig = (fs, diagnostics, filePath) => Effect.gen(function* () {
66
+ const parseMcpConfig = (raw, format) => {
67
+ if (format === "toml")
68
+ return parseToml(raw);
69
+ if (format === "yaml")
70
+ return parseYaml(raw);
71
+ const errors = [];
72
+ const value = parseJson(raw, errors, { allowTrailingComma: true });
73
+ if (errors.length > 0)
74
+ throw errors;
75
+ return value;
76
+ };
77
+ const readMcpConfig = (fs, diagnostics, filePath, format) => Effect.gen(function* () {
65
78
  const exists = yield* Effect.result(fs.exists(filePath));
66
79
  if (exists._tag === "Failure") {
67
80
  yield* diagnostics.append({
@@ -85,19 +98,13 @@ const readMcpConfig = (fs, diagnostics, filePath) => Effect.gen(function* () {
85
98
  return Option.none();
86
99
  }
87
100
  const parsed = yield* Effect.result(Effect.try({
88
- try: () => {
89
- const errors = [];
90
- const value = parse(read.success, errors, { allowTrailingComma: true });
91
- if (errors.length > 0)
92
- throw errors;
93
- return value;
94
- },
101
+ try: () => parseMcpConfig(read.success, format),
95
102
  catch: (cause) => ({ cause }),
96
103
  }));
97
104
  if (parsed._tag === "Failure") {
98
105
  yield* diagnostics.append({
99
106
  source: "scanner",
100
- message: `${SCANNER_NAME}: cannot parse JSON at ${filePath}`,
107
+ message: `${SCANNER_NAME}: cannot parse ${format.toUpperCase()} at ${filePath}`,
101
108
  path: filePath,
102
109
  code: "scanner-parse",
103
110
  });
@@ -115,11 +122,11 @@ const readMcpConfig = (fs, diagnostics, filePath) => Effect.gen(function* () {
115
122
  }
116
123
  return Option.some(decoded.success);
117
124
  });
118
- const readMcpConfigCached = (cache, fs, diagnostics, filePath) => {
125
+ const readMcpConfigCached = (cache, fs, diagnostics, filePath, format) => {
119
126
  const existing = cache.get(filePath);
120
127
  if (existing !== undefined)
121
128
  return Effect.succeed(existing);
122
- return readMcpConfig(fs, diagnostics, filePath).pipe(Effect.tap((decoded) => Effect.sync(() => {
129
+ return readMcpConfig(fs, diagnostics, filePath, format).pipe(Effect.tap((decoded) => Effect.sync(() => {
123
130
  cache.set(filePath, decoded);
124
131
  })));
125
132
  };
@@ -183,7 +190,7 @@ const scanMcpSurface = (deps, plan, cache) => Effect.gen(function* () {
183
190
  const filePathOpt = yield* resolveMcpConfigTargetPath(deps, plan.target);
184
191
  if (Option.isNone(filePathOpt))
185
192
  return [];
186
- const decoded = yield* readMcpConfigCached(cache, fs, diagnostics, filePathOpt.value);
193
+ const decoded = yield* readMcpConfigCached(cache, fs, diagnostics, filePathOpt.value, plan.target.format);
187
194
  if (Option.isNone(decoded))
188
195
  return [];
189
196
  const servers = extractServers(decoded.value, plan.serversKey);
@@ -79,7 +79,11 @@ export const makeReadModelRecordReaders = (args) => {
79
79
  lifecycle: row.installationOrigin._tag === "direct" ? "configured" : "implicit",
80
80
  enabled: row.activation === "enabled",
81
81
  installed: row.actual.length > 0,
82
- agents: observedAgents.length === 0 ? defaultAgents : observedAgents,
82
+ agents: row.key.type === "mcp-server"
83
+ ? defaultAgents
84
+ : observedAgents.length === 0
85
+ ? defaultAgents
86
+ : observedAgents,
83
87
  origins: observations.origins,
84
88
  paths: observations.paths,
85
89
  };
package/package.json CHANGED
@@ -4,19 +4,20 @@
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-model": "^0.29.2",
10
- "@agentxm/registry-protocol": "^0.29.2",
11
- "@agentxm/workspace-transactions": "^0.29.2",
7
+ "@agentxm/agent-integration": "^0.29.4",
8
+ "@agentxm/extension-content": "^0.29.4",
9
+ "@agentxm/extension-model": "^0.29.4",
10
+ "@agentxm/registry-protocol": "^0.29.4",
11
+ "@agentxm/workspace-transactions": "^0.29.4",
12
12
  "effect": "4.0.0-rc.115",
13
13
  "jsonc-parser": "^3.3.1",
14
14
  "semver": "^7.8.5",
15
+ "smol-toml": "1.6.1",
15
16
  "yaml": "^2.9.0"
16
17
  },
17
18
  "description": "AXM workspace state kernel: settings, lockfile, read model, and desired-state vocabulary for the axm CLI. Unstable and unsupported — use the axm.sh CLI.",
18
19
  "devDependencies": {
19
- "@agentxm/specification-metadata": "^0.29.2",
20
+ "@agentxm/specification-metadata": "^0.29.4",
20
21
  "@effect/platform-node": "4.0.0-rc.115",
21
22
  "@effect/vitest": "4.0.0-rc.115",
22
23
  "@fast-check/vitest": "^0.5.0",
@@ -65,5 +66,5 @@
65
66
  },
66
67
  "sideEffects": false,
67
68
  "type": "module",
68
- "version": "0.29.2"
69
+ "version": "0.29.4"
69
70
  }