@oqtopus-team/pi-qdash 0.1.10-beta.12 → 0.1.10-beta.14

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.
@@ -17,16 +17,28 @@ export function qdashWebUrl(client: QDashClient, path: string): string {
17
17
  return `${qdashWebBaseUrl(client)}${path.startsWith("/") ? path : `/${path}`}`;
18
18
  }
19
19
 
20
+ /** Path of an execution page: under its chip when known, else the id-only route that redirects. */
21
+ export function executionPagePath(executionId: string, chipId?: string | null): string {
22
+ return chipId
23
+ ? `/execution/${encodeURIComponent(chipId)}/${encodeURIComponent(executionId)}`
24
+ : `/executions/${encodeURIComponent(executionId)}`;
25
+ }
26
+
27
+ export function forumPostPagePath(postId: string): string {
28
+ return `/forum/${encodeURIComponent(postId)}`;
29
+ }
30
+
20
31
  export function qdashObjectLinks(client: QDashClient, object: Record<string, unknown>): Record<string, string> {
21
32
  const links: Record<string, string> = {};
22
33
  const taskId = firstString(object, ["task_id", "taskId"]);
23
34
  const executionId = firstString(object, ["execution_id", "executionId"]);
35
+ const chipId = firstString(object, ["chip_id", "chipId"]);
24
36
  const postId = firstString(object, ["post_id", "forum_post_id", "id"]);
25
37
  const issueId = firstString(object, ["issue_id"]);
26
38
  const sessionId = firstString(object, ["session_id", "sessionId"]);
27
39
  if (taskId) links.task_result = qdashWebUrl(client, `/task-results/${encodeURIComponent(taskId)}`);
28
- if (executionId) links.execution = qdashWebUrl(client, `/executions/${encodeURIComponent(executionId)}`);
29
- if (postId) links.forum_post = qdashWebUrl(client, `/forum/posts/${encodeURIComponent(postId)}`);
40
+ if (executionId) links.execution = qdashWebUrl(client, executionPagePath(executionId, chipId));
41
+ if (postId) links.forum_post = qdashWebUrl(client, forumPostPagePath(postId));
30
42
  if (issueId) links.issue = qdashWebUrl(client, `/issues/${encodeURIComponent(issueId)}`);
31
43
  if (sessionId) links.agent_session = qdashWebUrl(client, `/agent-sessions/${encodeURIComponent(sessionId)}`);
32
44
  return links;
@@ -19,7 +19,7 @@ import { fetchFigureDetails, figureComponent, figureResultText, mediaTypeForPath
19
19
  import { forumImageReplyContent, forumImageReplyPreview, loadLocalForumImages, type LocalForumImage } from "./lib/forum-images.js";
20
20
  import { forumDetailComponent, forumDetailLines, forumListLines, forumPostTitle, forumPostsFromPayload } from "./lib/forum-render.js";
21
21
  import { investigationContextSummary, validateInvestigationContext, type TimeseriesInvestigationContext } from "./lib/investigation-context.js";
22
- import { qdashObjectLinks, qdashWebBaseUrl, qdashWebUrl, safeConfig, withQDashLinks } from "./lib/links.js";
22
+ import { executionPagePath, forumPostPagePath, qdashObjectLinks, qdashWebBaseUrl, qdashWebUrl, safeConfig, withQDashLinks } from "./lib/links.js";
23
23
  import { arrayFromPayload, compactItems, firstNumber, firstString, formatItem, payloadTotal, statusIcon } from "./lib/payload.js";
24
24
  import { toFigureToolResult, toTextToolResult, toToolResult } from "./lib/results.js";
25
25
  import { ansi, boxLinesToWidth, boxed, formatNumber, textComponent } from "./lib/render.js";
@@ -1419,7 +1419,7 @@ async function buildForumEvidenceReply(client: QDashClient, params: ForumEvidenc
1419
1419
  const targetId = firstString(parent, ["target_id", "targetId"]) ?? couplingId ?? qid;
1420
1420
  const title = params.title ?? `${new Date().toISOString().slice(0, 10)} 追加観測: ${target} ${taskName}`;
1421
1421
  const taskUrl = qdashWebUrl(client, `/task-results/${encodeURIComponent(params.taskId)}`);
1422
- const executionUrl = executionId ? qdashWebUrl(client, `/executions/${encodeURIComponent(executionId)}`) : undefined;
1422
+ const executionUrl = executionId ? qdashWebUrl(client, executionPagePath(executionId, chipId)) : undefined;
1423
1423
  const figures = params.includeFigures === false ? [] : taskFigurePaths(task, params.maxFigures ?? 2);
1424
1424
  const figureMarkdown = figures.map((path) => `![${filenameFromFigurePath(path)}](${figureApiUrl(path)})`).join("\n\n");
1425
1425
  const history = params.includeHistory === false ? [] : arrayFromPayload(await client.listTaskResults({
@@ -2238,7 +2238,7 @@ export default function qdashExtension(pi: ExtensionAPI) {
2238
2238
  async execute(_toolCallId, params: { profile?: string; configPath?: string; useEnv?: boolean; postId: string; color?: boolean }) {
2239
2239
  const client = await makeClient(params);
2240
2240
  const data = await client.getForumPost(params.postId);
2241
- const url = qdashWebUrl(client, `/forum/posts/${encodeURIComponent(params.postId)}`);
2241
+ const url = qdashWebUrl(client, forumPostPagePath(params.postId));
2242
2242
  return toTextToolResult(`${forumDetailLines(data, "QDash Forum Post", params.color).join("\n")}\nurl ${url}`, withQDashLinks(client, data), { tool: "qdash_get_forum_post", url });
2243
2243
  },
2244
2244
  renderResult(result, _options, theme) {
@@ -2257,7 +2257,7 @@ export default function qdashExtension(pi: ExtensionAPI) {
2257
2257
  async execute(_toolCallId, params: { profile?: string; configPath?: string; useEnv?: boolean; postId: string; color?: boolean }) {
2258
2258
  const client = await makeClient(params);
2259
2259
  const data = await client.getForumPostReplies(params.postId);
2260
- const url = qdashWebUrl(client, `/forum/posts/${encodeURIComponent(params.postId)}`);
2260
+ const url = qdashWebUrl(client, forumPostPagePath(params.postId));
2261
2261
  return toTextToolResult(`${forumListLines(data, "QDash Forum Replies", params.color).join("\n")}\nurl ${url}`, data, { tool: "qdash_list_forum_replies", url });
2262
2262
  },
2263
2263
  renderResult(result, _options, theme) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oqtopus-team/pi-qdash",
3
- "version": "0.1.10-beta.12",
3
+ "version": "0.1.10-beta.14",
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