@apicircle/mcp-server 1.0.6 → 1.0.8

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/index.d.cts CHANGED
@@ -173,16 +173,29 @@ declare class FileBackedWorkspaceProvider implements WorkspaceProvider {
173
173
 
174
174
  declare class MultiWorkspaceProvider implements Workspaces {
175
175
  private readonly registryRoot;
176
- private active;
176
+ /** Last-known active workspace id. Refreshed every time the lazy
177
+ * provider resolves; reflects what the most recent operation saw on
178
+ * disk, not a stale boot-time snapshot. */
177
179
  private activeWorkspaceId;
180
+ /** The lazy provider tool handlers consume as `ctx.workspace`. Holds a
181
+ * reference back to this instance so each call updates
182
+ * `activeWorkspaceId` for `activeId()` callers + diagnostic logs. */
183
+ private readonly lazyProvider;
178
184
  constructor(registryRoot: string);
179
185
  /**
180
- * Hydrate the active provider from disk. Must be called once before the
181
- * MCP host boots so `ctx.workspace.read()` doesn't race the first
182
- * registry-load. Returns the registry the boot can log.
186
+ * Read the registry from disk so the host can log a boot banner. Does
187
+ * NOT cache a per-id provider — each `activeProvider()` call re-reads
188
+ * the registry, so a workspace switch in the desktop is picked up by
189
+ * the next tool call without restarting the MCP server.
183
190
  */
184
191
  init(): Promise<WorkspaceRegistry>;
185
- /** The provider tool handlers see as `ctx.workspace`. */
192
+ /**
193
+ * The provider tool handlers see as `ctx.workspace`. Returns a lazy
194
+ * provider whose `read` / `apply` / `write` calls re-read
195
+ * `registry.json` so the right active workspace is always targeted
196
+ * even if the desktop switched workspaces since this MCP process
197
+ * started.
198
+ */
186
199
  activeProvider(): WorkspaceProvider;
187
200
  list(): Promise<WorkspaceSummary[]>;
188
201
  for(workspaceId: string): WorkspaceProvider;
@@ -190,7 +203,8 @@ declare class MultiWorkspaceProvider implements Workspaces {
190
203
  setActive(workspaceId: string): Promise<void>;
191
204
  /**
192
205
  * Idempotent registry write — used by tests / tools that need to
193
- * persist registry updates that didn't go through `setActive`.
206
+ * persist registry updates that didn't go through `setActive`. The
207
+ * lazy active provider picks the new id up on its next operation.
194
208
  */
195
209
  writeRegistry(registry: WorkspaceRegistry): Promise<void>;
196
210
  }
package/dist/index.d.ts CHANGED
@@ -173,16 +173,29 @@ declare class FileBackedWorkspaceProvider implements WorkspaceProvider {
173
173
 
174
174
  declare class MultiWorkspaceProvider implements Workspaces {
175
175
  private readonly registryRoot;
176
- private active;
176
+ /** Last-known active workspace id. Refreshed every time the lazy
177
+ * provider resolves; reflects what the most recent operation saw on
178
+ * disk, not a stale boot-time snapshot. */
177
179
  private activeWorkspaceId;
180
+ /** The lazy provider tool handlers consume as `ctx.workspace`. Holds a
181
+ * reference back to this instance so each call updates
182
+ * `activeWorkspaceId` for `activeId()` callers + diagnostic logs. */
183
+ private readonly lazyProvider;
178
184
  constructor(registryRoot: string);
179
185
  /**
180
- * Hydrate the active provider from disk. Must be called once before the
181
- * MCP host boots so `ctx.workspace.read()` doesn't race the first
182
- * registry-load. Returns the registry the boot can log.
186
+ * Read the registry from disk so the host can log a boot banner. Does
187
+ * NOT cache a per-id provider — each `activeProvider()` call re-reads
188
+ * the registry, so a workspace switch in the desktop is picked up by
189
+ * the next tool call without restarting the MCP server.
183
190
  */
184
191
  init(): Promise<WorkspaceRegistry>;
185
- /** The provider tool handlers see as `ctx.workspace`. */
192
+ /**
193
+ * The provider tool handlers see as `ctx.workspace`. Returns a lazy
194
+ * provider whose `read` / `apply` / `write` calls re-read
195
+ * `registry.json` so the right active workspace is always targeted
196
+ * even if the desktop switched workspaces since this MCP process
197
+ * started.
198
+ */
186
199
  activeProvider(): WorkspaceProvider;
187
200
  list(): Promise<WorkspaceSummary[]>;
188
201
  for(workspaceId: string): WorkspaceProvider;
@@ -190,7 +203,8 @@ declare class MultiWorkspaceProvider implements Workspaces {
190
203
  setActive(workspaceId: string): Promise<void>;
191
204
  /**
192
205
  * Idempotent registry write — used by tests / tools that need to
193
- * persist registry updates that didn't go through `setActive`.
206
+ * persist registry updates that didn't go through `setActive`. The
207
+ * lazy active provider picks the new id up on its next operation.
194
208
  */
195
209
  writeRegistry(registry: WorkspaceRegistry): Promise<void>;
196
210
  }