@noelclaw/mcp 1.2.0 → 1.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.
@@ -164,30 +164,31 @@ async function handleMirosharkTool(name, args) {
164
164
  }
165
165
  const simId = a.simulation_id.trim();
166
166
  try {
167
- // Check if agents are still being prepared
168
- const prepStatus = await miroJson("/miroshark/api/simulation/prepare/status", "POST", { simulation_id: simId }).catch(() => null);
169
- const prepState = (prepStatus?.status ?? "").toLowerCase();
170
- if (prepState === "processing" || prepState === "pending") {
171
- const pct = prepStatus?.progress ?? 0;
172
- const msg = prepStatus?.message ?? "preparing agents...";
173
- return {
174
- content: [{
175
- type: "text",
176
- text: [
177
- `**MiroShark \`${simId}\`** — preparing agents`,
178
- `Progress: ${pct}%`,
179
- `${msg}`,
180
- ``,
181
- `Poll again in a few seconds.`,
182
- ].join("\n"),
183
- }],
184
- };
185
- }
186
- // Agents ready (or prepare already done) — check run status
167
+ // Check run status first
187
168
  const runStatus = await miroJson(`/miroshark/api/simulation/${simId}/run-status`, "GET").catch(() => ({ runner_status: "idle" }));
188
169
  const runnerStatus = (runStatus?.runner_status ?? "idle").toLowerCase();
189
- // Auto-start the simulation when agents are ready but not yet running
190
- if (runnerStatus === "idle" && (prepState === "ready" || prepState === "completed" || prepStatus?.already_prepared)) {
170
+ // If not yet running, check whether agents are prepared by probing /config
171
+ // (config only exists after /prepare completes)
172
+ if (runnerStatus === "idle") {
173
+ const config = await miroJson(`/miroshark/api/simulation/${simId}/config`, "GET").catch(() => null);
174
+ if (!config) {
175
+ // Preparation still in progress — check profiles for real-time progress
176
+ const profiles = await miroJson(`/miroshark/api/simulation/${simId}/profiles/realtime`, "GET").catch(() => null);
177
+ const total = profiles?.total_expected ?? "?";
178
+ const ready = profiles?.profiles_ready ?? 0;
179
+ return {
180
+ content: [{
181
+ type: "text",
182
+ text: [
183
+ `**MiroShark \`${simId}\`** — preparing agents`,
184
+ total !== "?" ? `Profiles: ${ready} / ${total} ready` : `Profiles generating...`,
185
+ ``,
186
+ `Poll again in ~10 seconds.`,
187
+ ].join("\n"),
188
+ }],
189
+ };
190
+ }
191
+ // Config exists → agents prepared → auto-start
191
192
  await miroJson("/miroshark/api/simulation/start", "POST", {
192
193
  simulation_id: simId,
193
194
  platform: "parallel",
@@ -251,7 +252,6 @@ async function handleMirosharkTool(name, args) {
251
252
  type: "text",
252
253
  text: [
253
254
  `**MiroShark \`${simId}\`** — status: ${runnerStatus || "unknown"}`,
254
- prepState ? `Prepare state: ${prepState}` : "",
255
255
  ``,
256
256
  `If agents are still preparing, poll again shortly.`,
257
257
  ].filter(Boolean).join("\n"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noelclaw/mcp",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Noelclaw as an MCP skill — persistent memory, multi-agent coordination, scenario simulation, DeFi execution, and Sentinel-gated playbooks.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {