opencode-muse 0.2.0 → 0.2.1

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/README.md CHANGED
@@ -16,7 +16,7 @@ Add the published package to your project-level `opencode.jsonc` (or
16
16
  ```jsonc
17
17
  {
18
18
  "$schema": "https://opencode.ai/config.json",
19
- "plugins": ["opencode-muse@0.2.0"],
19
+ "plugins": ["opencode-muse@0.2.1"],
20
20
  }
21
21
  ```
22
22
 
@@ -7,7 +7,11 @@ export type MuseProviderContext = Pick<Plugin.Context, "provider" | "session" |
7
7
  export interface ProviderPluginDependencies {
8
8
  fetchCatalog?: (directory: string) => Promise<MuseCatalogSnapshot>;
9
9
  createSessionManager?: () => MuseSessionManager;
10
+ /** Bounds how long setup waits for the live catalog before falling back. Defaults to 15s. */
11
+ setupRefreshTimeoutMs?: number;
10
12
  }
13
+ /** Upper bound on delaying provider readiness for live catalog discovery. */
14
+ export declare const SETUP_REFRESH_TIMEOUT_MS = 15000;
11
15
  export interface MuseProviderRuntime {
12
16
  catalog: CatalogCache;
13
17
  refreshTask: Promise<boolean>;
package/dist/provider.js CHANGED
@@ -9,6 +9,8 @@ import { MuseBridgeError } from "./errors.js";
9
9
  import { makeCompactionDigest, makeLocalTitle } from "./model/meta.js";
10
10
  import { fingerprintCompactionOutput } from "./session/fingerprint.js";
11
11
  import { extractAllowedAgentContext } from "./model/agent-context.js";
12
+ /** Upper bound on delaying provider readiness for live catalog discovery. */
13
+ export const SETUP_REFRESH_TIMEOUT_MS = 15_000;
12
14
  function providerInfo(moduleUrl) {
13
15
  return {
14
16
  id: MUSE_PROVIDER_ID,
@@ -93,6 +95,23 @@ export async function createProviderPlugin(ctx, moduleUrl, dependencies = {}) {
93
95
  await ctx.provider.reload();
94
96
  });
95
97
  });
98
+ // Wait for live discovery (bounded) so consumers never see the pre-refresh
99
+ // fallback. On timeout or failure the disabled placeholder stays in place
100
+ // and a late refresh still replaces it via provider.reload().
101
+ const refreshTimeoutMs = dependencies.setupRefreshTimeoutMs ?? SETUP_REFRESH_TIMEOUT_MS;
102
+ let refreshTimer;
103
+ try {
104
+ await Promise.race([
105
+ refreshTask.then(() => true, () => false),
106
+ new Promise((resolve) => {
107
+ refreshTimer = setTimeout(() => resolve(false), refreshTimeoutMs);
108
+ }),
109
+ ]);
110
+ }
111
+ finally {
112
+ if (refreshTimer !== undefined)
113
+ clearTimeout(refreshTimer);
114
+ }
96
115
  return {
97
116
  catalog,
98
117
  refreshTask,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-muse",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "OpenCode plugin backed by the official Muse Code CLI and MSP",
5
5
  "license": "MIT",
6
6
  "type": "module",