@oqtopus-team/pi-qdash 0.1.10-beta.11 → 0.1.10-beta.13

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.
@@ -28,3 +28,26 @@ export function toTextToolResult(text: string, data: unknown, details: Record<st
28
28
  details: { ...details, data: safeData },
29
29
  };
30
30
  }
31
+
32
+ /**
33
+ * Result of a tool that fetched a figure: the text summary plus, for an image,
34
+ * the image itself as model-visible content. Without the image block a
35
+ * vision model only reads that a figure exists; with it, it can judge the
36
+ * curve. Non-image figures (JSON) keep a text-only result.
37
+ */
38
+ export function toFigureToolResult(
39
+ text: string,
40
+ figure: { base64?: string; mediaType: string },
41
+ data: unknown,
42
+ details: Record<string, unknown> = {},
43
+ ) {
44
+ const result = toTextToolResult(text, data, details);
45
+ if (!figure.base64 || !figure.mediaType.startsWith("image/")) return result;
46
+ return {
47
+ ...result,
48
+ content: [
49
+ ...result.content,
50
+ { type: "image" as const, data: figure.base64, mimeType: figure.mediaType },
51
+ ],
52
+ };
53
+ }
@@ -21,7 +21,7 @@ import { forumDetailComponent, forumDetailLines, forumListLines, forumPostTitle,
21
21
  import { investigationContextSummary, validateInvestigationContext, type TimeseriesInvestigationContext } from "./lib/investigation-context.js";
22
22
  import { qdashObjectLinks, qdashWebBaseUrl, qdashWebUrl, safeConfig, withQDashLinks } from "./lib/links.js";
23
23
  import { arrayFromPayload, compactItems, firstNumber, firstString, formatItem, payloadTotal, statusIcon } from "./lib/payload.js";
24
- import { toTextToolResult, toToolResult } from "./lib/results.js";
24
+ import { toFigureToolResult, toTextToolResult, toToolResult } from "./lib/results.js";
25
25
  import { ansi, boxLinesToWidth, boxed, formatNumber, textComponent } from "./lib/render.js";
26
26
  import { plotSeriesLines, timeseriesPlotComponent, timeseriesPoints } from "./lib/timeseries-plot.js";
27
27
  import { installQDashWriteGate } from "./lib/write-gate.js";
@@ -2543,7 +2543,7 @@ export default function qdashExtension(pi: ExtensionAPI) {
2543
2543
  const details: FigureDetails = { tool: "qdash_recent_calibration_figure", taskId, path: file.path ?? "", mediaType, sizeBytes: bytes.byteLength, figurePaths: file.figurePaths ?? [], jsonFigurePaths: file.jsonFigurePaths ?? [] };
2544
2544
  if (mediaType.startsWith("image/")) details.base64 = bytes.toString("base64");
2545
2545
  else details.text = bytes.toString("utf8");
2546
- return toTextToolResult(figureResultText(details), { task, selectedPath: details.path }, details);
2546
+ return toFigureToolResult(figureResultText(details), details, { task, selectedPath: details.path }, details);
2547
2547
  },
2548
2548
  renderResult(result, _options, theme) {
2549
2549
  return figureComponent(result.details as unknown as FigureDetails, theme);
@@ -2563,7 +2563,7 @@ export default function qdashExtension(pi: ExtensionAPI) {
2563
2563
  async execute(_toolCallId, params: { profile?: string; configPath?: string; useEnv?: boolean; path: string }) {
2564
2564
  const client = await makeClient(params);
2565
2565
  const details = await fetchFigureDetails(client, params.path);
2566
- return toTextToolResult(figureResultText(details), { path: params.path }, details);
2566
+ return toFigureToolResult(figureResultText(details), details, { path: params.path }, details);
2567
2567
  },
2568
2568
  renderResult(result, _options, theme) {
2569
2569
  return figureComponent(result.details as unknown as FigureDetails, theme);
@@ -2600,7 +2600,7 @@ export default function qdashExtension(pi: ExtensionAPI) {
2600
2600
  };
2601
2601
  if (mediaType.startsWith("image/")) details.base64 = bytes.toString("base64");
2602
2602
  else details.text = bytes.toString("utf8");
2603
- return toTextToolResult(figureResultText(details), { taskId: params.taskId, figurePaths: details.figurePaths, jsonFigurePaths: details.jsonFigurePaths, selectedPath: details.path }, details);
2603
+ return toFigureToolResult(figureResultText(details), details, { taskId: params.taskId, figurePaths: details.figurePaths, jsonFigurePaths: details.jsonFigurePaths, selectedPath: details.path }, details);
2604
2604
  } catch (error) {
2605
2605
  return toTextToolResult(boxed("QDash Task Figures", [
2606
2606
  `task ${params.taskId}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oqtopus-team/pi-qdash",
3
- "version": "0.1.10-beta.11",
3
+ "version": "0.1.10-beta.13",
4
4
  "description": "Pi extension for querying QDash via @oqtopus-team/qdash-client",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "@oqtopus-team/qdash-client": "1.9.21-beta.168"
30
+ "@oqtopus-team/qdash-client": "1.9.21-beta.171"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@earendil-works/pi-coding-agent": "*",
@@ -58,7 +58,7 @@ Workflow:
58
58
  2. Turn the request into steps. Start from the catalog defaults and the flow templates (`qdash_query` with `flow_templates`, then `flow_template` for one template's task list): `OneQubitCheck` and `OneQubitFineTune` carry the standard one-qubit sequences, `TwoQubitCalibration` the two-qubit chain. Use `CustomOneQubit` / `CustomTwoQubit` only where the user wants a different task list, and keep the task order the templates use.
59
59
  3. `qdash_plan_pipeline` — validate. A result with problems is not an error: each problem carries a path into the spec (`steps[2].tasks[0]`, `targets.qids[1]`); fix it and plan again until it is valid.
60
60
  4. Show the user the resolved steps and task counts from the plan, then `qdash_run_pipeline` with the same `chipId` and `spec`. The execution is confirmation-gated.
61
- 5. `qdash_wait_execution` with the returned `execution_id`, then summarize which targets passed and which failed, and read `qdash_get_task_knowledge` for any task whose result needs interpretation.
61
+ 5. `qdash_wait_execution` with the returned `execution_id`. It returns when the whole run has finished, not just its first step. Then summarize which targets passed and which failed, fetch the figures of failed tasks with `qdash_get_task_figures` so the user sees them, and read `qdash_get_task_knowledge` for any task whose result needs interpretation.
62
62
 
63
63
  Rules:
64
64