@akira-tl/forgerelay 0.8.6 → 0.8.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/db/migrations.js +9 -0
  3. package/dist/db/schema.js +1 -0
  4. package/dist/mcp/server-instructions.js +2 -2
  5. package/dist/server.js +79 -42
  6. package/dist/ui/.vite/manifest.json +28 -27
  7. package/dist/ui/activity-panel-app.html +3 -3
  8. package/dist/ui/assets/{activity-panel-app-CUAN6zyW.js → activity-panel-app-7AckaxIR.js} +2 -2
  9. package/dist/ui/assets/{heavy-payload-CgzrutLm.js → heavy-payload-Bol1_mcs.js} +2 -2
  10. package/dist/ui/assets/{review-payload-BrLbezbq.js → review-payload-BqJp0c5e.js} +1 -1
  11. package/dist/ui/assets/{scrollbar-CbhpdW05.js → scrollbar-CvE-I-jG.js} +1 -1
  12. package/dist/ui/assets/{workspace-app-CxwJuZyS.js → workspace-app-BLW7p6IZ.js} +4 -1
  13. package/dist/ui/assets/workspace-app-BjNqR0en.js +1 -0
  14. package/dist/ui/assets/workspace-app-CmaYU4DW.js +3 -0
  15. package/dist/ui/assets/workspace-app-D2bJ5fjt.css +1 -0
  16. package/dist/ui/assets/workspace-lifecycle-app-BVbI2Ilf.js +1 -0
  17. package/dist/ui/workspace-app.html +4 -4
  18. package/dist/ui/workspace-lifecycle-app.html +4 -4
  19. package/dist/workspace-store.js +29 -1
  20. package/dist/workspaces.js +64 -19
  21. package/docs/chatgpt-coding-workflow.md +12 -10
  22. package/docs/configuration.md +14 -10
  23. package/docs/roadmap.md +5 -1
  24. package/package.json +2 -2
  25. package/dist/ui/assets/workspace-app-Bhj96tsR.js +0 -1
  26. package/dist/ui/assets/workspace-app-D6UR0AFl.js +0 -5
  27. package/dist/ui/assets/workspace-app-ldjBmCJR.css +0 -1
  28. package/dist/ui/assets/workspace-lifecycle-app-Cqfhx9pV.js +0 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ All notable ForgeRelay changes are documented here.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.8.8] - 2026-09-02
8
+
9
+ ### Fixed
10
+
11
+ - Restored the full lightweight Workspace overview across fresh MCP connections and brought rich Read/Edit/Write Activity details back behind lazy per-Activity loading, without reintroducing heavy default polling payloads.
12
+
13
+ ## [0.8.7] - 2026-09-02
14
+
15
+ ### Changed
16
+
17
+ - `open_workspace(context="auto")` now tracks bootstrap delivery per component and returns only changed or removed AGENTS/nested-instruction, Skill/diagnostic, Capability-guide, and Subagent-profile domains after the first full delivery; `full`, `none`, Composite member, Relay, and legacy whole-fingerprint delivery behavior remain compatible.
18
+ - Bash guidance now requires long `yieldTimeMs` waits for long-running or wait-only process operations, explicitly noting that completion returns immediately before the feedback window expires so Agents do not short-poll every few seconds.
19
+
7
20
  ## [0.8.6] - 2026-09-02
8
21
 
9
22
  ### Added
@@ -79,6 +79,11 @@ const migrations = [
79
79
  name: "workspace-session-aliases",
80
80
  up: migrateWorkspaceSessionAliases,
81
81
  },
82
+ {
83
+ version: 17,
84
+ name: "workspace-context-components",
85
+ up: migrateWorkspaceContextComponents,
86
+ },
82
87
  ];
83
88
  export function migrateDatabase(sqlite) {
84
89
  const migrate = sqlite.transaction(() => {
@@ -387,6 +392,10 @@ function migrateWorkspaceSessionAliases(sqlite) {
387
392
  on workspace_session_aliases(workspace_session_id);
388
393
  `);
389
394
  }
395
+ function migrateWorkspaceContextComponents(sqlite) {
396
+ migrateWorkspaceContextDeliveries(sqlite);
397
+ addColumnIfMissing(sqlite, "workspace_context_deliveries", "component_fingerprints_json", "text");
398
+ }
390
399
  function migrateActivityHostTurnWorkspace(sqlite) {
391
400
  migrateActivityHostTurns(sqlite);
392
401
  addColumnIfMissing(sqlite, "activity_host_turns", "workspace_id", "text");
package/dist/db/schema.js CHANGED
@@ -53,6 +53,7 @@ export const workspaceContextDeliveries = sqliteTable("workspace_context_deliver
53
53
  conversationScopeId: text("conversation_scope_id").notNull(),
54
54
  targetKey: text("target_key").notNull(),
55
55
  contextFingerprint: text("context_fingerprint").notNull(),
56
+ componentFingerprintsJson: text("component_fingerprints_json"),
56
57
  deliveredAt: text("delivered_at").notNull(),
57
58
  }, (table) => [
58
59
  primaryKey({ columns: [table.conversationScopeId, table.targetKey] }),
@@ -30,7 +30,7 @@ export function buildToolDescriptions(config) {
30
30
  rename: `Rename or move one file or directory inside an open workspace or the OS temp directory without overwriting an existing destination. Source and destination must both remain inside the permitted file roots. Call ${toolNames.openWorkspace} first and pass workspaceId.`,
31
31
  delete: `Delete one path or multiple paths inside an open workspace or the OS temp directory. Use path for one target or paths for multiple targets; a bulk Delete preflights all targets before deleting anything. Non-empty directories require recursive=true. An allowed root itself cannot be deleted. Call ${toolNames.openWorkspace} first and pass workspaceId.`,
32
32
  applyPatch: `Apply one Codex-style patch inside an open workspace or the OS temp directory. Supports adding, overwriting, updating, deleting, and moving files. Workspace paths must remain relative; absolute paths are accepted only inside the OS temp directory. Call ${toolNames.openWorkspace} first and pass workspaceId.`,
33
- shell: `Run or manage a shell process inside an open workspace.${shellSurface} Commands execute with the local user's authority; workspace containment does not make shell execution a sandbox. For action=run, yieldTimeMs is only the feedback wait (default 10000ms; 0 returns a processId immediately) and optional timeoutMs is the independent total execution limit. action=process polls/waits for incremental output, writes input, resizes a PTY, or interrupts by processId. Keep explicit waits below the Host request deadline; use 60000ms only when supported. Completed background results may be attached to a later result for the same workspaceId. Call ${toolNames.openWorkspace} first and pass workspaceId. Expose this capability only behind strong authentication.`,
33
+ shell: `Run or manage a shell process inside an open workspace.${shellSurface} Commands run with the local user's authority; workspace containment does not make shell execution a sandbox. For action=run, yieldTimeMs is the feedback wait (default 10000ms; 0 returns processId) and timeoutMs is the independent execution limit. action=process waits/interacts with processId. For long-running commands or wait-only process calls, set a long yieldTimeMs near the Host deadline (60000ms when supported), not short polling. This wait is a maximum: if the process finishes sooner, the call returns immediately. If still running, reuse processId with another long wait; use short waits only for interaction. Background completions can arrive later. Call ${toolNames.openWorkspace} first with workspaceId. Expose only behind strong authentication.`,
34
34
  shellCommand: "Shell command to run with the local user's authority.",
35
35
  };
36
36
  }
@@ -61,7 +61,7 @@ function defaultWorkflowInstructions(config) {
61
61
  return `Use ${toolNames.read} for direct file reads, ${toolNames.rename} and ${toolNames.delete} for direct path moves or removals, apply_patch for content modifications, exec_command for inspection, tests, builds, and other commands, and ${toolNames.writeStdin} to poll or interact with running processes.`;
62
62
  }
63
63
  const inspection = `Use ${toolNames.shell} with command-line tools such as grep, rg, find, ls, and tree for search and directory inspection.`;
64
- return joinInstructions(inspection, `Prefer ${toolNames.edit} for targeted content modifications, ${toolNames.write} only for new files or complete rewrites, ${toolNames.rename} for path moves, ${toolNames.delete} for removals, and ${toolNames.shell} for tests, builds, Git/package scripts, generators, formatters, and shell-suited commands. If ${toolNames.shell} returns a running processId, use action=\"process\" to poll/wait/interact/resize/interrupt it. When only waiting, set yieldTimeMs instead of short polling; reuse processId if still running. Otherwise keep working and consume its later completion notice.`);
64
+ return joinInstructions(inspection, `Prefer ${toolNames.edit} for targeted content modifications, ${toolNames.write} only for new files or complete rewrites, ${toolNames.rename} for path moves, ${toolNames.delete} for removals, and ${toolNames.shell} for tests, builds, Git/package scripts, generators, formatters, and shell-suited commands. For long ${toolNames.shell} commands or wait-only calls, set yieldTimeMs near Host deadline (60000ms when supported); do not poll every few seconds. Completion returns immediately if sooner; if still running, reuse processId with a long wait. Short waits are only for interaction.`);
65
65
  }
66
66
  function joinInstructions(...parts) {
67
67
  return parts
package/dist/server.js CHANGED
@@ -56,7 +56,7 @@ import { createWorkspaceStore } from "./workspace-store.js";
56
56
  import { WorkspaceTaskReminderTracker } from "./workspace-task-reminders.js";
57
57
  import { WorkspaceTaskStore } from "./workspace-tasks.js";
58
58
  import { compactWorkspacePresentation } from "./workspace-presentation.js";
59
- import { formatAgentsPath, WorkspaceRegistry } from "./workspaces.js";
59
+ import { formatAgentsPath, WorkspaceRegistry, } from "./workspaces.js";
60
60
  import { formatAvailableSubagentProfile, summarizeSubagentProfile } from "./subagents/profiles.js";
61
61
  import { formatSubagentProviderAvailabilitySummary, formatUnavailableSubagentProvider, getSubagentProviderAvailabilitySnapshot, } from "./subagents/providers/availability.js";
62
62
  import { capabilityActivityAuditRequest, capabilityActivityAuditResult } from "./subagents/sessions/mcp/audit.js";
@@ -1566,6 +1566,7 @@ export function createMcpServer(config, workspaces, reviewCheckpoints, processSe
1566
1566
  providerUnavailableReason: availability?.reason,
1567
1567
  };
1568
1568
  });
1569
+ const bootstrapComponents = new Set(opened.bootstrapContextComponents);
1569
1570
  return {
1570
1571
  member: memberName,
1571
1572
  workspaceId: compositeWorkspaceId,
@@ -1575,16 +1576,13 @@ export function createMcpServer(config, workspaces, reviewCheckpoints, processSe
1575
1576
  capabilityFingerprint,
1576
1577
  capabilityCatalog,
1577
1578
  includeBootstrapContext: opened.includeBootstrapContext,
1578
- ...(opened.includeBootstrapContext
1579
- ? {
1580
- capabilityGuides,
1581
- agentsFiles,
1582
- availableAgentsFiles,
1583
- skills,
1584
- agentProviders,
1585
- agents,
1586
- skillDiagnostics: redactSkillDiagnosticPaths(workspace.skillDiagnostics),
1587
- }
1579
+ ...(bootstrapComponents.has("capabilityGuides") ? { capabilityGuides } : {}),
1580
+ ...(bootstrapComponents.has("agentsFiles") ? { agentsFiles } : {}),
1581
+ ...(bootstrapComponents.has("availableAgentsFiles") ? { availableAgentsFiles } : {}),
1582
+ ...(bootstrapComponents.has("skills") ? { skills } : {}),
1583
+ ...(bootstrapComponents.has("agentProfiles") ? { agentProviders, agents } : {}),
1584
+ ...(bootstrapComponents.has("skillDiagnostics")
1585
+ ? { skillDiagnostics: redactSkillDiagnosticPaths(workspace.skillDiagnostics) }
1588
1586
  : {}),
1589
1587
  instruction: opened.includeBootstrapContext
1590
1588
  ? `Bootstrap context for Composite member ${memberName}. Keep using Composite workspaceId ${compositeWorkspaceId} and pass member=${memberName} for work operations.`
@@ -2107,23 +2105,56 @@ export function createMcpServer(config, workspaces, reviewCheckpoints, processSe
2107
2105
  instructions: buildServerInstructions(config),
2108
2106
  });
2109
2107
  const workspacePanelStates = new Map();
2108
+ const liveWorkspacePanelState = (workspace) => {
2109
+ const loadedInstructionPathSet = new Set(workspace.loadedInstructionPaths);
2110
+ const loadedInstructionPaths = [...loadedInstructionPathSet]
2111
+ .map((path) => formatAgentsPath(path, workspace.root));
2112
+ const availableInstructionPaths = [...new Set([...workspace.knownInstructionPathsByDir.values()].flat())]
2113
+ .filter((path) => !loadedInstructionPathSet.has(path))
2114
+ .map((path) => formatAgentsPath(path, workspace.root));
2115
+ const agentProviders = config.subagents ? subagentProviders : [];
2116
+ const agents = workspace.agentProfiles.map((profile) => {
2117
+ const summary = summarizeSubagentProfile(profile);
2118
+ const availability = agentProviders.find((provider) => provider.name === summary.provider);
2119
+ return {
2120
+ ...summary,
2121
+ providerAvailable: availability?.available,
2122
+ providerUnavailableReason: availability?.reason,
2123
+ };
2124
+ });
2125
+ const skills = workspace.skills
2126
+ .filter((skill) => !skill.disableModelInvocation)
2127
+ .map((skill) => ({ name: skill.name, description: skill.description }));
2128
+ return compactWorkspacePresentation({
2129
+ workspaceId: workspace.id,
2130
+ root: workspace.root,
2131
+ path: workspace.root,
2132
+ mode: workspace.mode,
2133
+ sourceRoot: workspace.sourceRoot,
2134
+ worktree: workspace.worktree,
2135
+ agentsFiles: loadedInstructionPaths.map((path) => ({ path })),
2136
+ availableAgentsFiles: availableInstructionPaths.map((path) => ({ path })),
2137
+ skills,
2138
+ agentProviders,
2139
+ agents,
2140
+ summary: {
2141
+ mode: workspace.mode,
2142
+ agentsFiles: loadedInstructionPaths.length,
2143
+ availableAgentsFiles: availableInstructionPaths.length,
2144
+ skills: skills.length,
2145
+ agentProviders: agentProviders.length,
2146
+ agents: agents.length,
2147
+ },
2148
+ });
2149
+ };
2110
2150
  const workspacePanelState = (workspaceId) => {
2111
2151
  const remembered = workspacePanelStates.get(workspaceId);
2112
2152
  if (remoteWorkspaces.has(workspaceId) || compositeWorkspaces.has(workspaceId)) {
2113
2153
  return remembered;
2114
2154
  }
2115
2155
  try {
2116
- const workspace = workspaces.getWorkspace(workspaceId);
2117
- if (remembered)
2118
- return remembered;
2119
- return compactWorkspacePresentation({
2120
- workspaceId: workspace.id,
2121
- root: workspace.root,
2122
- path: workspace.root,
2123
- mode: workspace.mode,
2124
- sourceRoot: workspace.sourceRoot,
2125
- summary: { mode: workspace.mode },
2126
- });
2156
+ const live = liveWorkspacePanelState(workspaces.getWorkspace(workspaceId));
2157
+ return remembered ? { ...live, ...remembered } : live;
2127
2158
  }
2128
2159
  catch {
2129
2160
  return undefined;
@@ -2888,7 +2919,7 @@ export function createMcpServer(config, workspaces, reviewCheckpoints, processSe
2888
2919
  rememberWorkspacePanelState(opened.workspaceId, response);
2889
2920
  return response;
2890
2921
  }
2891
- const { workspace, agentsFiles, availableAgentsFiles, hookReports, workspaceReused, includeBootstrapContext, contextFingerprint, } = await workspaces.openWorkspace({ path, workspaceId, mode, baseRef, newWorktree, newWorkspace, context }, {
2922
+ const { workspace, agentsFiles, availableAgentsFiles, hookReports, workspaceReused, includeBootstrapContext, bootstrapContextComponents, contextFingerprint, } = await workspaces.openWorkspace({ path, workspaceId, mode, baseRef, newWorktree, newWorkspace, context }, {
2892
2923
  conversationScopeId,
2893
2924
  protectedWorkspaceIds,
2894
2925
  });
@@ -2934,15 +2965,18 @@ export function createMcpServer(config, workspaces, reviewCheckpoints, processSe
2934
2965
  const cardAvailableAgentsFiles = availableAgentsFiles.map((file) => ({
2935
2966
  path: formatAgentsPath(file.path, workspace.root),
2936
2967
  }));
2937
- const visibleSkills = includeBootstrapContext ? cardSkills : [];
2938
- const visibleSkillDiagnostics = includeBootstrapContext
2968
+ const bootstrapComponents = new Set(bootstrapContextComponents);
2969
+ const visibleSkills = bootstrapComponents.has("skills") ? cardSkills : [];
2970
+ const visibleSkillDiagnostics = bootstrapComponents.has("skillDiagnostics")
2939
2971
  ? redactSkillDiagnosticPaths(workspace.skillDiagnostics)
2940
2972
  : [];
2941
- const visibleCapabilityGuides = includeBootstrapContext ? capabilityGuides : [];
2942
- const visibleAgentProviders = includeBootstrapContext ? cardAgentProviders : [];
2943
- const visibleAgents = includeBootstrapContext ? cardAgents : [];
2944
- const loadedAgentsFiles = includeBootstrapContext ? cardAgentsFiles : [];
2945
- const availableAgentsFileOutputs = includeBootstrapContext ? cardAvailableAgentsFiles : [];
2973
+ const visibleCapabilityGuides = bootstrapComponents.has("capabilityGuides") ? capabilityGuides : [];
2974
+ const visibleAgentProviders = bootstrapComponents.has("agentProfiles") ? cardAgentProviders : [];
2975
+ const visibleAgents = bootstrapComponents.has("agentProfiles") ? cardAgents : [];
2976
+ const loadedAgentsFiles = bootstrapComponents.has("agentsFiles") ? cardAgentsFiles : [];
2977
+ const availableAgentsFileOutputs = bootstrapComponents.has("availableAgentsFiles")
2978
+ ? cardAvailableAgentsFiles
2979
+ : [];
2946
2980
  const workspaceContextInstruction = "For later open_workspace calls, context=\"auto\" avoids repeating unchanged bootstrap context; use context=\"none\" when only the workspace handle/metadata is needed, or context=\"full\" to force a refresh.";
2947
2981
  const workspaceManagementInstruction = "Use open_workspace(action=\"list\") for lightweight Workspace inventory. Use action=\"inspect\" with one known workspaceId for bounded read-only metadata without opening/resuming it. Explicitly open a Workspace before executing or mutating against it, and ask the user before close_workspace cleanup.";
2948
2982
  const cardInstruction = config.skillsEnabled
@@ -2953,7 +2987,7 @@ export function createMcpServer(config, workspaces, reviewCheckpoints, processSe
2953
2987
  ? [
2954
2988
  `Workspace already exists as ${workspace.id} for this directory.`,
2955
2989
  "Reuse this workspaceId for subsequent tool calls.",
2956
- "The complete project context is included because it has not yet been provided in this conversation or host context.",
2990
+ `Project bootstrap context components included in this response: ${bootstrapContextComponents.join(", ")}. Components not listed are unchanged and are not repeated.`,
2957
2991
  workspaceContextInstruction,
2958
2992
  workspaceManagementInstruction,
2959
2993
  ].join("\n\n")
@@ -3072,16 +3106,19 @@ export function createMcpServer(config, workspaces, reviewCheckpoints, processSe
3072
3106
  capabilityFingerprint,
3073
3107
  contextFingerprint,
3074
3108
  capabilityCatalog,
3075
- ...(includeBootstrapContext
3076
- ? {
3077
- capabilityGuides: visibleCapabilityGuides,
3078
- agentsFiles: loadedAgentsFiles,
3079
- availableAgentsFiles: availableAgentsFileOutputs,
3080
- skills: visibleSkills,
3081
- agentProviders: visibleAgentProviders,
3082
- agents: visibleAgents,
3083
- skillDiagnostics: visibleSkillDiagnostics,
3084
- }
3109
+ ...(bootstrapComponents.has("capabilityGuides")
3110
+ ? { capabilityGuides: visibleCapabilityGuides }
3111
+ : {}),
3112
+ ...(bootstrapComponents.has("agentsFiles") ? { agentsFiles: loadedAgentsFiles } : {}),
3113
+ ...(bootstrapComponents.has("availableAgentsFiles")
3114
+ ? { availableAgentsFiles: availableAgentsFileOutputs }
3115
+ : {}),
3116
+ ...(bootstrapComponents.has("skills") ? { skills: visibleSkills } : {}),
3117
+ ...(bootstrapComponents.has("agentProfiles")
3118
+ ? { agentProviders: visibleAgentProviders, agents: visibleAgents }
3119
+ : {}),
3120
+ ...(bootstrapComponents.has("skillDiagnostics")
3121
+ ? { skillDiagnostics: visibleSkillDiagnostics }
3085
3122
  : {}),
3086
3123
  instruction,
3087
3124
  },
@@ -4097,7 +4134,7 @@ export function createMcpServer(config, workspaces, reviewCheckpoints, processSe
4097
4134
  .min(0)
4098
4135
  .max(300_000)
4099
4136
  .optional()
4100
- .describe("Feedback window before returning. For action=run, use 0 for immediate background handoff; otherwise defaults to 10000ms. For action=process, polling defaults to 5000ms and interaction to 250ms."),
4137
+ .describe("Maximum feedback wait, not a minimum delay: if the process finishes sooner, the call returns immediately. For long-running commands or wait-only action=process calls, set a long window near the Host request deadline (60000ms when supported) instead of repeated short polling. For action=run, use 0 for immediate background handoff; otherwise defaults to 10000ms. For action=process, wait-only calls default to 5000ms and interaction to 250ms."),
4101
4138
  timeoutMs: z
4102
4139
  .number()
4103
4140
  .int()
@@ -2123,12 +2123,12 @@
2123
2123
  "_chunk-EyZ2wyi3.js"
2124
2124
  ]
2125
2125
  },
2126
- "_scrollbar-CbhpdW05.js": {
2127
- "file": "assets/scrollbar-CbhpdW05.js",
2126
+ "_scrollbar-CvE-I-jG.js": {
2127
+ "file": "assets/scrollbar-CvE-I-jG.js",
2128
2128
  "name": "scrollbar",
2129
2129
  "imports": [
2130
2130
  "_chunk-EyZ2wyi3.js",
2131
- "_workspace-app-CxwJuZyS.js"
2131
+ "_workspace-app-BLW7p6IZ.js"
2132
2132
  ],
2133
2133
  "dynamicImports": [
2134
2134
  "../../node_modules/@shikijs/langs/dist/abap.mjs",
@@ -2474,33 +2474,34 @@
2474
2474
  "_chunk-EyZ2wyi3.js"
2475
2475
  ]
2476
2476
  },
2477
- "_workspace-app-CxwJuZyS.js": {
2478
- "file": "assets/workspace-app-CxwJuZyS.js",
2477
+ "_workspace-app-BLW7p6IZ.js": {
2478
+ "file": "assets/workspace-app-BLW7p6IZ.js",
2479
2479
  "name": "workspace-app",
2480
2480
  "imports": [
2481
2481
  "_chunk-EyZ2wyi3.js"
2482
2482
  ],
2483
2483
  "dynamicImports": [
2484
- "_workspace-app-CxwJuZyS.js"
2484
+ "_workspace-app-BLW7p6IZ.js",
2485
+ "heavy-payload.tsx"
2485
2486
  ],
2486
2487
  "css": [
2487
- "assets/workspace-app-ldjBmCJR.css"
2488
+ "assets/workspace-app-D2bJ5fjt.css"
2488
2489
  ]
2489
2490
  },
2490
- "_workspace-app-D6UR0AFl.js": {
2491
- "file": "assets/workspace-app-D6UR0AFl.js",
2491
+ "_workspace-app-CmaYU4DW.js": {
2492
+ "file": "assets/workspace-app-CmaYU4DW.js",
2492
2493
  "name": "workspace-app",
2493
2494
  "imports": [
2494
- "_workspace-app-CxwJuZyS.js"
2495
+ "_workspace-app-BLW7p6IZ.js"
2495
2496
  ],
2496
2497
  "dynamicImports": [
2497
2498
  "heavy-payload.tsx",
2498
2499
  "review-payload.tsx"
2499
2500
  ]
2500
2501
  },
2501
- "_workspace-app-ldjBmCJR.css": {
2502
- "file": "assets/workspace-app-ldjBmCJR.css",
2503
- "src": "_workspace-app-ldjBmCJR.css"
2502
+ "_workspace-app-D2bJ5fjt.css": {
2503
+ "file": "assets/workspace-app-D2bJ5fjt.css",
2504
+ "src": "_workspace-app-D2bJ5fjt.css"
2504
2505
  },
2505
2506
  "_xml-JnmX6vyS.js": {
2506
2507
  "file": "assets/xml-JnmX6vyS.js",
@@ -2518,52 +2519,52 @@
2518
2519
  ]
2519
2520
  },
2520
2521
  "activity-panel-app.html": {
2521
- "file": "assets/activity-panel-app-CUAN6zyW.js",
2522
+ "file": "assets/activity-panel-app-7AckaxIR.js",
2522
2523
  "name": "activity-panel-app",
2523
2524
  "src": "activity-panel-app.html",
2524
2525
  "isEntry": true,
2525
2526
  "imports": [
2526
- "_workspace-app-CxwJuZyS.js"
2527
+ "_workspace-app-BLW7p6IZ.js"
2527
2528
  ]
2528
2529
  },
2529
2530
  "heavy-payload.tsx": {
2530
- "file": "assets/heavy-payload-CgzrutLm.js",
2531
+ "file": "assets/heavy-payload-Bol1_mcs.js",
2531
2532
  "name": "heavy-payload",
2532
2533
  "src": "heavy-payload.tsx",
2533
2534
  "isDynamicEntry": true,
2534
2535
  "imports": [
2535
- "_scrollbar-CbhpdW05.js",
2536
- "_workspace-app-D6UR0AFl.js"
2536
+ "_workspace-app-BLW7p6IZ.js",
2537
+ "_scrollbar-CvE-I-jG.js"
2537
2538
  ]
2538
2539
  },
2539
2540
  "review-payload.tsx": {
2540
- "file": "assets/review-payload-BrLbezbq.js",
2541
+ "file": "assets/review-payload-BqJp0c5e.js",
2541
2542
  "name": "review-payload",
2542
2543
  "src": "review-payload.tsx",
2543
2544
  "isDynamicEntry": true,
2544
2545
  "imports": [
2545
- "_scrollbar-CbhpdW05.js",
2546
- "_workspace-app-D6UR0AFl.js"
2546
+ "_scrollbar-CvE-I-jG.js",
2547
+ "_workspace-app-CmaYU4DW.js"
2547
2548
  ]
2548
2549
  },
2549
2550
  "workspace-app.html": {
2550
- "file": "assets/workspace-app-Bhj96tsR.js",
2551
+ "file": "assets/workspace-app-BjNqR0en.js",
2551
2552
  "name": "workspace-app",
2552
2553
  "src": "workspace-app.html",
2553
2554
  "isEntry": true,
2554
2555
  "imports": [
2555
- "_workspace-app-CxwJuZyS.js",
2556
- "_workspace-app-D6UR0AFl.js"
2556
+ "_workspace-app-BLW7p6IZ.js",
2557
+ "_workspace-app-CmaYU4DW.js"
2557
2558
  ]
2558
2559
  },
2559
2560
  "workspace-lifecycle-app.html": {
2560
- "file": "assets/workspace-lifecycle-app-Cqfhx9pV.js",
2561
+ "file": "assets/workspace-lifecycle-app-BVbI2Ilf.js",
2561
2562
  "name": "workspace-lifecycle-app",
2562
2563
  "src": "workspace-lifecycle-app.html",
2563
2564
  "isEntry": true,
2564
2565
  "imports": [
2565
- "_workspace-app-CxwJuZyS.js",
2566
- "_workspace-app-D6UR0AFl.js"
2566
+ "_workspace-app-BLW7p6IZ.js",
2567
+ "_workspace-app-CmaYU4DW.js"
2567
2568
  ]
2568
2569
  }
2569
2570
  }
@@ -4,10 +4,10 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>ForgeRelay Panel</title>
7
- <script type="module" crossorigin src="./assets/activity-panel-app-CUAN6zyW.js"></script>
7
+ <script type="module" crossorigin src="./assets/activity-panel-app-7AckaxIR.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="./assets/chunk-EyZ2wyi3.js">
9
- <link rel="modulepreload" crossorigin href="./assets/workspace-app-CxwJuZyS.js">
10
- <link rel="stylesheet" crossorigin href="./assets/workspace-app-ldjBmCJR.css">
9
+ <link rel="modulepreload" crossorigin href="./assets/workspace-app-BLW7p6IZ.js">
10
+ <link rel="stylesheet" crossorigin href="./assets/workspace-app-D2bJ5fjt.css">
11
11
  </head>
12
12
  <body>
13
13
  <main id="app" class="shell">
@@ -1,2 +1,2 @@
1
- import{a as e,c as t,i as n,l as r,o as i,s as a,t as o,u as s}from"./workspace-app-CxwJuZyS.js";function c(e){let t=m(e._meta),n=m(e.structuredContent),r=m(t?.[`forgerelay/activityPanelWorkspace`])??m(n?.[`forgerelay/activityPanelWorkspace`]);if(r&&!(typeof r.workspaceId!=`string`||r.workspaceId.length===0)&&!(typeof r.root!=`string`||r.root.length===0)&&!(r.mode!==void 0&&r.mode!==`checkout`&&r.mode!==`worktree`))return r}var l=class{root;card=null;openInstructionKey=null;showAvailableInstructions=!1;constructor(e){this.root=e}get active(){return this.card!==null}get workspaceId(){return this.card?.workspaceId}accept(e){let t=c(e);return t?(this.card?.workspaceId!==t.workspaceId&&(this.openInstructionKey=null,this.showAvailableInstructions=!1),this.card=t,!0):!1}clear(){this.card=null,this.openInstructionKey=null,this.showAvailableInstructions=!1,this.root.replaceChildren()}render(){return this.card?(this.root.replaceChildren(this.renderPanel(this.card)),!0):!1}renderPanel(t){let n=h(`section`,`workspace-panel`),r=h(`div`,`workspace-panel-header`),a=h(`span`,`workspace-panel-icon`);a.setAttribute(`aria-hidden`,`true`),a.append(e(i.folderOpen,`workspace-panel-icon-svg`));let o=h(`span`,`workspace-panel-title-group`),s=h(`span`,`workspace-panel-title`,`Workspace`),c=h(`span`,`workspace-panel-subtitle`,p(t.root));c.title=t.root,o.append(s,c);let l=h(`span`,`workspace-panel-mode`,t.mode??`workspace`);r.append(a,o,l);let d=h(`div`,`workspace-details`),f=h(`div`,`workspace-rows`);return u(f,`Root`,t.root,i.folderOpen,!0),u(f,`Mode`,t.mode??`workspace`,i.folderTree),t.worktree&&this.appendWorktreeRows(f,t),t.sourceRoot&&t.sourceRoot!==t.root&&u(f,`Source checkout`,t.sourceRoot,i.sourceCheckout,!0),this.appendInstructions(f,t.agentsFiles??[],t.availableAgentsFiles??[]),this.appendSkills(f,t.skills??[]),this.appendAgents(f,t),d.append(f),n.append(r,d),n}appendWorktreeRows(t,n){let r=n.worktree;if(!r)return;let a=[r.baseRef,r.baseSha?.slice(0,8)].filter(e=>!!e);if(a.length>0){let n=h(`span`,`workspace-base-value`),o=h(`span`,`workspace-value`,a.join(` · `));if(o.title=a.join(` · `),n.append(o),r.dirtySource){let t=h(`span`,`workspace-base-warning`);t.title=`The source checkout had uncommitted changes when this worktree was created.`,t.setAttribute(`role`,`img`),t.setAttribute(`aria-label`,`Source checkout changes are not included in this worktree`),t.append(e(i.warning,`workspace-base-warning-svg`)),n.append(t)}d(t,`Base`,n,i.base)}r.branch&&u(t,`Worktree branch`,r.branch,i.gitBranch),r.targetBranch&&u(t,`Merge target`,r.targetBranch,i.gitBranch)}appendInstructions(e,t,n){let r=t.map((e,t)=>({key:`loaded:${t}`,path:e.path,label:e.path??`Loaded instructions`,content:e.content,status:`loaded`})),a=new Set(r.map(e=>e.path).filter(Boolean)),o=n.flatMap((e,t)=>e.path&&a.has(e.path)?[]:[{key:`available:${t}`,path:e.path,label:e.path??`Nested instructions`,status:`available`}]);if(r.length===0&&o.length===0)return;let s=this.showAvailableInstructions?[...r,...o]:r,c=h(`span`,`workspace-instruction-list`);for(let e of s)c.append(this.renderInstruction(e,c));if(o.length>0){let e=h(`button`,`workspace-instructions-toggle`,this.showAvailableInstructions?`Show less`:`View all`);e.type=`button`,e.setAttribute(`aria-expanded`,String(this.showAvailableInstructions)),e.addEventListener(`click`,()=>{this.showAvailableInstructions=!this.showAvailableInstructions,this.showAvailableInstructions||(this.openInstructionKey=null),this.render()}),c.append(e)}let l=h(`div`,`workspace-instructions-content`);l.append(c),d(e,`Instructions`,l,i.instructions,`workspace-instructions-row`)}renderInstruction(t,n){let r=h(`span`,`workspace-instruction-item`);r.dataset.instructionKey=t.key;let a=t.status===`loaded`&&t.content!==void 0,o=h(a?`button`:`span`,`workspace-instruction-header${a?` interactive`:``}`);o instanceof HTMLButtonElement&&(o.type=`button`,o.setAttribute(`aria-expanded`,String(this.openInstructionKey===t.key)));let s=h(`span`,`workspace-instruction-status ${t.status}`);s.setAttribute(`role`,`img`),s.setAttribute(`aria-label`,t.status===`loaded`?`Loaded into the current workspace context`:`Available for a nested directory`),s.append(e(t.status===`loaded`?i.instructionLoaded:i.instructionAvailable,`workspace-instruction-status-svg`));let c=h(`span`,`workspace-instruction-text`),l=p(t.label);if(c.append(h(`span`,`workspace-instruction-name`,l)),t.path&&t.path!==l){let e=h(`span`,`workspace-instruction-path`,t.path);e.title=t.path,c.append(e)}if(o.append(s,c),!a)return r.append(o),r;let u=h(`span`,`workspace-instruction-chevron`);u.setAttribute(`aria-hidden`,`true`),u.append(e(i.chevronDown,`workspace-instruction-chevron-svg`)),o.append(u);let d=h(`pre`,`workspace-instruction-preview`,t.content);return o.addEventListener(`click`,()=>{this.openInstructionKey=this.openInstructionKey===t.key?null:t.key;for(let e of n.querySelectorAll(`.workspace-instruction-item`)){let t=e.querySelector(`.workspace-instruction-header.interactive`),n=e.querySelector(`.workspace-instruction-preview`),r=e.dataset.instructionKey===this.openInstructionKey;e.classList.toggle(`expanded`,r),t?.setAttribute(`aria-expanded`,String(r)),n&&(n.hidden=!r)}}),r.append(o,d),(()=>{let e=this.openInstructionKey===t.key;r.classList.toggle(`expanded`,e),o.setAttribute(`aria-expanded`,String(e)),d.hidden=!e})(),r}appendSkills(e,t){if(t.length===0)return;let n=f(t.map(e=>({label:e.name??`Unnamed skill`,title:e.description||void 0})));n.classList.add(`workspace-skills-list`),d(e,`Skills`,n,i.skills,`workspace-skills-row`)}appendAgents(e,t){let r=t.agentProviders??[],a=(t.agents??[]).map(e=>{let t=e.provider?.trim(),r=e.providerAvailable===!1;return{label:e.name??`Unnamed agent`,logo:t?n(t):void 0,profile:!0,tone:r?`muted`:void 0,title:[e.description,t?`Provider: ${t}`:void 0,e.model?`Model: ${e.model}`:void 0,e.thinking?`Thinking: ${e.thinking}`:void 0,r?e.providerUnavailableReason??`Provider unavailable`:void 0].filter(Boolean).join(`
2
- `)||void 0}}),o=r.map(e=>{let t=e.name?.trim()||`Unknown provider`,r=n(t);return{label:t,logo:r,bareLogo:!!r,ariaLabel:t,tone:e.available===!1?`muted`:void 0,title:e.available===!1?e.reason??`Provider unavailable`:t}});if(a.length>0){let t=f([...a,...o]);t.classList.add(`workspace-agents-list`),d(e,`Agents`,t,i.agents,`workspace-agents-row`)}else o.length>0&&d(e,`Providers`,f(o),i.providers)}};function u(e,t,n,r,i=!1){let a=h(`span`,`workspace-value${i?` mono`:``}`,n);a.title=n,d(e,t,a,r)}function d(t,n,r,i,a){let o=h(`div`,[`workspace-row`,a].filter(Boolean).join(` `)),s=h(`span`,`workspace-row-icon`);s.setAttribute(`aria-hidden`,`true`),s.append(e(i,`workspace-row-icon-svg`)),o.append(s,h(`span`,`workspace-key`,n),r),t.append(o)}function f(e){let t=h(`span`,`workspace-chip-list`);for(let n of e){let e=!!(n.bareLogo&&n.logo),r=h(`span`,[e?`workspace-provider-logo`:n.profile?`workspace-agent-profile`:`workspace-chip`,n.tone].filter(Boolean).join(` `));if(n.title&&(r.title=n.title),e&&(r.setAttribute(`role`,`img`),r.setAttribute(`aria-label`,n.ariaLabel??n.label)),n.logo){let t=document.createElement(`img`);t.className=e?`workspace-provider-logo-image`:n.profile?`workspace-agent-profile-logo`:`workspace-chip-logo`,t.src=n.logo,t.alt=``,t.setAttribute(`aria-hidden`,`true`),r.append(t)}e||r.append(h(`span`,`workspace-chip-label`,n.label)),t.append(r)}return t}function p(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).at(-1)??e}function m(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function h(e,t,n){let r=document.createElement(e);return r.className=t,n!==void 0&&(r.textContent=n),r}document.documentElement.dataset.forgerelayApp=`panel`;var g=document.querySelector(`#app`);if(!g)throw Error(`Missing #app root element.`);var _=g,v=I(`section`,`forgerelay-panel`),y=I(`div`,`workspace-panel-slot`),b=I(`div`,`activity-panel-slot`);v.append(y,b),_.replaceChildren(v);var x=new l(y),S=new o(b,{embedded:!0}),C=null,w,T=!1,E=null,D,O=!1,k;A();async function A(){P(),C=new r({name:`forgerelay-panel`,version:`0.1.0`},{}),C.ontoolinput=e=>{let t=e.arguments?.workspaceId;typeof t==`string`&&t.length>0&&(D=t,T&&!S.active&&M()),P()},C.ontoolresult=e=>{j(e)},C.onhostcontextchanged=e=>{w={...w,...e},N()},C.onteardown=async()=>(T=!1,S.detach(),x.clear(),{});try{await C.connect();let e=C.getHostContext();e&&(w=e),N(),T=!0,S.attach(C),D&&!S.active&&M()}catch(e){E=e instanceof Error?e.message:String(e)}P()}function j(e){x.accept(e)&&(D=x.workspaceId),S.accept(e),P()}async function M(){let e=D;if(!(!C||!T||!e||S.active||O||k===e)&&C.getHostCapabilities()?.serverTools){k=e,O=!0,P();try{let t=await C.callServerTool({name:`activity_snapshot`,arguments:{workspaceId:e}});t.isError||j(t)}finally{O=!1,P()}}}function N(){w?.theme&&s(w.theme),w?.styles?.variables&&t(w.styles.variables),w?.styles?.css?.fonts&&a(w.styles.css.fonts);let e=w?.safeAreaInsets;e&&(document.body.style.padding=`${e.top}px ${e.right}px ${e.bottom}px ${e.left}px`)}function P(){x.render()||F(),S.render()||b.replaceChildren()}function F(){let e=I(`section`,`workspace-panel pending`),t=I(`div`,`workspace-panel-header`),n=I(`span`,`workspace-panel-title-group`);n.append(I(`span`,`workspace-panel-title`,`Workspace`),I(`span`,`workspace-panel-subtitle`,E||(D?O?`Loading workspace…`:D:T?`Waiting for workspace…`:`Connecting to host…`))),t.append(n),e.append(t),y.replaceChildren(e)}function I(e,t,n){let r=document.createElement(e);return r.className=t,n!==void 0&&(r.textContent=n),r}
1
+ import{S as e,a as t,b as n,i as r,o as i,t as a,x as o,y as s}from"./workspace-app-BLW7p6IZ.js";function c(e){let t=m(e._meta),n=m(e.structuredContent),r=m(t?.[`forgerelay/activityPanelWorkspace`])??m(n?.[`forgerelay/activityPanelWorkspace`]);if(r&&!(typeof r.workspaceId!=`string`||r.workspaceId.length===0)&&!(typeof r.root!=`string`||r.root.length===0)&&!(r.mode!==void 0&&r.mode!==`checkout`&&r.mode!==`worktree`))return r}var l=class{root;card=null;openInstructionKey=null;showAvailableInstructions=!1;constructor(e){this.root=e}get active(){return this.card!==null}get workspaceId(){return this.card?.workspaceId}accept(e){let t=c(e);return t?(this.card?.workspaceId!==t.workspaceId&&(this.openInstructionKey=null,this.showAvailableInstructions=!1),this.card=t,!0):!1}clear(){this.card=null,this.openInstructionKey=null,this.showAvailableInstructions=!1,this.root.replaceChildren()}render(){return this.card?(this.root.replaceChildren(this.renderPanel(this.card)),!0):!1}renderPanel(e){let n=h(`section`,`workspace-panel`),r=h(`div`,`workspace-panel-header`),a=h(`span`,`workspace-panel-icon`);a.setAttribute(`aria-hidden`,`true`),a.append(t(i.folderOpen,`workspace-panel-icon-svg`));let o=h(`span`,`workspace-panel-title-group`),s=h(`span`,`workspace-panel-title`,`Workspace`),c=h(`span`,`workspace-panel-subtitle`,p(e.root));c.title=e.root,o.append(s,c);let l=h(`span`,`workspace-panel-mode`,e.mode??`workspace`);r.append(a,o,l);let d=h(`div`,`workspace-details`),f=h(`div`,`workspace-rows`);return u(f,`Root`,e.root,i.folderOpen,!0),u(f,`Mode`,e.mode??`workspace`,i.folderTree),e.worktree&&this.appendWorktreeRows(f,e),e.sourceRoot&&e.sourceRoot!==e.root&&u(f,`Source checkout`,e.sourceRoot,i.sourceCheckout,!0),this.appendInstructions(f,e.agentsFiles??[],e.availableAgentsFiles??[]),this.appendSkills(f,e.skills??[]),this.appendAgents(f,e),d.append(f),n.append(r,d),n}appendWorktreeRows(e,n){let r=n.worktree;if(!r)return;let a=[r.baseRef,r.baseSha?.slice(0,8)].filter(e=>!!e);if(a.length>0){let n=h(`span`,`workspace-base-value`),o=h(`span`,`workspace-value`,a.join(` · `));if(o.title=a.join(` · `),n.append(o),r.dirtySource){let e=h(`span`,`workspace-base-warning`);e.title=`The source checkout had uncommitted changes when this worktree was created.`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`Source checkout changes are not included in this worktree`),e.append(t(i.warning,`workspace-base-warning-svg`)),n.append(e)}d(e,`Base`,n,i.base)}r.branch&&u(e,`Worktree branch`,r.branch,i.gitBranch),r.targetBranch&&u(e,`Merge target`,r.targetBranch,i.gitBranch)}appendInstructions(e,t,n){let r=t.map((e,t)=>({key:`loaded:${t}`,path:e.path,label:e.path??`Loaded instructions`,content:e.content,status:`loaded`})),a=new Set(r.map(e=>e.path).filter(Boolean)),o=n.flatMap((e,t)=>e.path&&a.has(e.path)?[]:[{key:`available:${t}`,path:e.path,label:e.path??`Nested instructions`,status:`available`}]);if(r.length===0&&o.length===0)return;let s=this.showAvailableInstructions?[...r,...o]:r,c=h(`span`,`workspace-instruction-list`);for(let e of s)c.append(this.renderInstruction(e,c));if(o.length>0){let e=h(`button`,`workspace-instructions-toggle`,this.showAvailableInstructions?`Show less`:`View all`);e.type=`button`,e.setAttribute(`aria-expanded`,String(this.showAvailableInstructions)),e.addEventListener(`click`,()=>{this.showAvailableInstructions=!this.showAvailableInstructions,this.showAvailableInstructions||(this.openInstructionKey=null),this.render()}),c.append(e)}let l=h(`div`,`workspace-instructions-content`);l.append(c),d(e,`Instructions`,l,i.instructions,`workspace-instructions-row`)}renderInstruction(e,n){let r=h(`span`,`workspace-instruction-item`);r.dataset.instructionKey=e.key;let a=e.status===`loaded`&&e.content!==void 0,o=h(a?`button`:`span`,`workspace-instruction-header${a?` interactive`:``}`);o instanceof HTMLButtonElement&&(o.type=`button`,o.setAttribute(`aria-expanded`,String(this.openInstructionKey===e.key)));let s=h(`span`,`workspace-instruction-status ${e.status}`);s.setAttribute(`role`,`img`),s.setAttribute(`aria-label`,e.status===`loaded`?`Loaded into the current workspace context`:`Available for a nested directory`),s.append(t(e.status===`loaded`?i.instructionLoaded:i.instructionAvailable,`workspace-instruction-status-svg`));let c=h(`span`,`workspace-instruction-text`),l=p(e.label);if(c.append(h(`span`,`workspace-instruction-name`,l)),e.path&&e.path!==l){let t=h(`span`,`workspace-instruction-path`,e.path);t.title=e.path,c.append(t)}if(o.append(s,c),!a)return r.append(o),r;let u=h(`span`,`workspace-instruction-chevron`);u.setAttribute(`aria-hidden`,`true`),u.append(t(i.chevronDown,`workspace-instruction-chevron-svg`)),o.append(u);let d=h(`pre`,`workspace-instruction-preview`,e.content);return o.addEventListener(`click`,()=>{this.openInstructionKey=this.openInstructionKey===e.key?null:e.key;for(let e of n.querySelectorAll(`.workspace-instruction-item`)){let t=e.querySelector(`.workspace-instruction-header.interactive`),n=e.querySelector(`.workspace-instruction-preview`),r=e.dataset.instructionKey===this.openInstructionKey;e.classList.toggle(`expanded`,r),t?.setAttribute(`aria-expanded`,String(r)),n&&(n.hidden=!r)}}),r.append(o,d),(()=>{let t=this.openInstructionKey===e.key;r.classList.toggle(`expanded`,t),o.setAttribute(`aria-expanded`,String(t)),d.hidden=!t})(),r}appendSkills(e,t){if(t.length===0)return;let n=f(t.map(e=>({label:e.name??`Unnamed skill`,title:e.description||void 0})));n.classList.add(`workspace-skills-list`),d(e,`Skills`,n,i.skills,`workspace-skills-row`)}appendAgents(e,t){let n=t.agentProviders??[],a=(t.agents??[]).map(e=>{let t=e.provider?.trim(),n=e.providerAvailable===!1;return{label:e.name??`Unnamed agent`,logo:t?r(t):void 0,profile:!0,tone:n?`muted`:void 0,title:[e.description,t?`Provider: ${t}`:void 0,e.model?`Model: ${e.model}`:void 0,e.thinking?`Thinking: ${e.thinking}`:void 0,n?e.providerUnavailableReason??`Provider unavailable`:void 0].filter(Boolean).join(`
2
+ `)||void 0}}),o=n.map(e=>{let t=e.name?.trim()||`Unknown provider`,n=r(t);return{label:t,logo:n,bareLogo:!!n,ariaLabel:t,tone:e.available===!1?`muted`:void 0,title:e.available===!1?e.reason??`Provider unavailable`:t}});if(a.length>0){let t=f([...a,...o]);t.classList.add(`workspace-agents-list`),d(e,`Agents`,t,i.agents,`workspace-agents-row`)}else o.length>0&&d(e,`Providers`,f(o),i.providers)}};function u(e,t,n,r,i=!1){let a=h(`span`,`workspace-value${i?` mono`:``}`,n);a.title=n,d(e,t,a,r)}function d(e,n,r,i,a){let o=h(`div`,[`workspace-row`,a].filter(Boolean).join(` `)),s=h(`span`,`workspace-row-icon`);s.setAttribute(`aria-hidden`,`true`),s.append(t(i,`workspace-row-icon-svg`)),o.append(s,h(`span`,`workspace-key`,n),r),e.append(o)}function f(e){let t=h(`span`,`workspace-chip-list`);for(let n of e){let e=!!(n.bareLogo&&n.logo),r=h(`span`,[e?`workspace-provider-logo`:n.profile?`workspace-agent-profile`:`workspace-chip`,n.tone].filter(Boolean).join(` `));if(n.title&&(r.title=n.title),e&&(r.setAttribute(`role`,`img`),r.setAttribute(`aria-label`,n.ariaLabel??n.label)),n.logo){let t=document.createElement(`img`);t.className=e?`workspace-provider-logo-image`:n.profile?`workspace-agent-profile-logo`:`workspace-chip-logo`,t.src=n.logo,t.alt=``,t.setAttribute(`aria-hidden`,`true`),r.append(t)}e||r.append(h(`span`,`workspace-chip-label`,n.label)),t.append(r)}return t}function p(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).at(-1)??e}function m(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function h(e,t,n){let r=document.createElement(e);return r.className=t,n!==void 0&&(r.textContent=n),r}document.documentElement.dataset.forgerelayApp=`panel`;var g=document.querySelector(`#app`);if(!g)throw Error(`Missing #app root element.`);var _=g,v=I(`section`,`forgerelay-panel`),y=I(`div`,`workspace-panel-slot`),b=I(`div`,`activity-panel-slot`);v.append(y,b),_.replaceChildren(v);var x=new l(y),S=new a(b,{embedded:!0}),C=null,w,T=!1,E=null,D,O=!1,k;A();async function A(){P(),C=new o({name:`forgerelay-panel`,version:`0.1.0`},{}),C.ontoolinput=e=>{let t=e.arguments?.workspaceId;typeof t==`string`&&t.length>0&&(D=t,T&&!S.active&&M()),P()},C.ontoolresult=e=>{j(e)},C.onhostcontextchanged=e=>{w={...w,...e},N()},C.onteardown=async()=>(T=!1,S.detach(),x.clear(),{});try{await C.connect();let e=C.getHostContext();e&&(w=e),N(),T=!0,S.attach(C),D&&!S.active&&M()}catch(e){E=e instanceof Error?e.message:String(e)}P()}function j(e){x.accept(e)&&(D=x.workspaceId),S.accept(e),P()}async function M(){let e=D;if(!(!C||!T||!e||S.active||O||k===e)&&C.getHostCapabilities()?.serverTools){k=e,O=!0,P();try{let t=await C.callServerTool({name:`activity_snapshot`,arguments:{workspaceId:e}});t.isError||j(t)}finally{O=!1,P()}}}function N(){w?.theme&&e(w.theme),w?.styles?.variables&&n(w.styles.variables),w?.styles?.css?.fonts&&s(w.styles.css.fonts);let t=w?.safeAreaInsets;t&&(document.body.style.padding=`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`)}function P(){x.render()||F(),S.render()||b.replaceChildren()}function F(){let e=I(`section`,`workspace-panel pending`),t=I(`div`,`workspace-panel-header`),n=I(`span`,`workspace-panel-title-group`);n.append(I(`span`,`workspace-panel-title`,`Workspace`),I(`span`,`workspace-panel-subtitle`,E||(D?O?`Loading workspace…`:D:T?`Waiting for workspace…`:`Connecting to host…`))),t.append(n),e.append(t),y.replaceChildren(e)}function I(e,t,n){let r=document.createElement(e);return r.className=t,n!==void 0&&(r.textContent=n),r}
@@ -1,4 +1,4 @@
1
- import{a as e,c as t,i as n,o as r,s as i}from"./workspace-app-D6UR0AFl.js";import{S as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,l as h,m as g,n as _,o as v,p as y,r as b,s as x,t as S,u as C,v as w,x as T,y as E}from"./scrollbar-CbhpdW05.js";var D=new Set,O=null;function k(e){D.add(e),O??=requestAnimationFrame(A)}function A(e){let t=new Set(D);D.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}O=D.size>0?requestAnimationFrame(A):null}var j=class e{options;tokensStable=[];tokensUnstable=[];lastUnstableCodeChunk=``;lastStableGrammarState;constructor(e){this.options=e}async enqueue(e){let t=(this.lastUnstableCodeChunk+e).split(`
1
+ import{_ as e,d as t,g as n,s as r,v as i}from"./workspace-app-BLW7p6IZ.js";import{S as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,l as h,m as g,n as _,o as v,p as y,r as b,s as x,t as S,u as C,v as w,x as T,y as E}from"./scrollbar-CvE-I-jG.js";var D=new Set,O=null;function k(e){D.add(e),O??=requestAnimationFrame(A)}function A(e){let t=new Set(D);D.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}O=D.size>0?requestAnimationFrame(A):null}var j=class e{options;tokensStable=[];tokensUnstable=[];lastUnstableCodeChunk=``;lastStableGrammarState;constructor(e){this.options=e}async enqueue(e){let t=(this.lastUnstableCodeChunk+e).split(`
2
2
  `),n=[],r=[],i=this.tokensUnstable.length;return t.forEach((e,i)=>{let a=i===t.length-1,o=this.options.highlighter.codeToTokens(e,{...this.options,grammarState:this.lastStableGrammarState}),s=o.tokens[0];a||s.push({content:`
3
3
  `,offset:0}),a?(r=s,this.lastUnstableCodeChunk=e):(this.lastStableGrammarState=o.grammarState,n.push(...s))}),this.tokensStable.push(...n),this.tokensUnstable=r,{recall:i,stable:n,unstable:r}}close(){let e=this.tokensUnstable;return this.tokensUnstable=[],this.lastUnstableCodeChunk=``,this.lastStableGrammarState=void 0,{stable:e}}clear(){this.tokensStable=[],this.tokensUnstable=[],this.lastUnstableCodeChunk=``,this.lastStableGrammarState=void 0}clone(){let t=new e(this.options);return t.lastUnstableCodeChunk=this.lastUnstableCodeChunk,t.tokensUnstable=this.tokensUnstable,t.tokensStable=this.tokensStable,t.lastStableGrammarState=this.lastStableGrammarState,t}},M=class extends TransformStream{tokenizer;options;constructor(e){let t=new j(e),{allowRecalls:n=!1}=e;super({async transform(e,r){let{stable:i,unstable:a,recall:o}=await t.enqueue(e);n&&o>0&&r.enqueue({recall:o});for(let e of i)r.enqueue(e);if(n)for(let e of a)r.enqueue(e)},async flush(e){let{stable:r}=t.close();if(!n)for(let t of r)e.enqueue(t)}}),this.tokenizer=t,this.options=e}};function N(e){let t=document.createElement(`span`);return t.style=w(e.htmlStyle??o(e)),t.textContent=e.content,t}var P=-1,F=class{__id=`file-stream:${++P}`;highlighter;stream;abortController;fileContainer;pre;code;gutterElement;contentElement;themeCSSStyle;appliedThemeCSS;currentRowCount=0;constructor(e={theme:E}){this.options=e,this.currentLineIndex=this.options.startingLineIndex??1}cleanUp(){this.abortController?.abort(),this.abortController=void 0}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.options={...this.options,themeType:e},!(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)&&this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType))}async initializeHighlighter(){return this.highlighter=await f(g(this.options.lang,this.options)),this.highlighter}queuedSetupArgs;async setup(e,t){let n=this.queuedSetupArgs!=null;if(this.queuedSetupArgs=[e,t],n)return;this.highlighter??=await this.initializeHighlighter();let[r,i]=this.queuedSetupArgs;this.queuedSetupArgs=void 0;let a=r;this.setupStream(a,i,this.highlighter)}setupStream(e,t,n){let{disableLineNumbers:r=!1,overflow:i=`scroll`,theme:a=E,themeType:o=`system`}=this.options,s=this.getOrCreateFileContainer();s.parentElement??t.appendChild(s),this.pre??=document.createElement(`pre`),this.pre.parentElement??s.shadowRoot?.appendChild(this.pre);let c=typeof a==`string`?n.getTheme(a).type:void 0,u=d({theme:a,highlighter:n});this.applyThemeState(s,u,o,c);let f=l(this.pre,{type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:r,overflow:i,split:!1,totalLines:0});f.textContent=``,this.pre=f,this.code=h({code:this.code,pre:f}),this.gutterElement=void 0,this.contentElement=void 0,this.currentRowCount=0,this.currentLineElement=void 0,this.currentLineIndex=this.options.startingLineIndex??1,this.abortController?.abort(),this.abortController=new AbortController;let{onStreamStart:p,onStreamClose:m,onStreamAbort:g}=this.options;this.stream?.cancel().catch(()=>{}),this.stream=e,this.stream.pipeThrough(typeof a==`string`?new M({...this.options,theme:a,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:y(`token`)}):new M({...this.options,themes:a,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:y(`token`)})).pipeTo(new WritableStream({start(e){p?.(e)},close(){m?.()},abort(e){g?.(e)},write:this.handleWrite}),{signal:this.abortController.signal}).catch(e=>{e.name!==`AbortError`&&console.error(`FileStream pipe error:`,e)})}queuedTokens=[];handleWrite=e=>{`recall`in e&&this.queuedTokens.length>=e.recall?this.queuedTokens.length=this.queuedTokens.length-e.recall:this.queuedTokens.push(e),k(this.render),this.options.onStreamWrite?.(e)};currentLineIndex;currentLineElement;render=()=>{this.options.onPreRender?.(this);let{gutter:e,content:t}=this.getOrCreateStreamColumns(),n=document.createDocumentFragment(),r=document.createDocumentFragment();for(let e of this.queuedTokens)if(`recall`in e){if(this.currentLineElement==null)throw Error(`FileStream.render: no current line element, shouldnt be possible to get here`);if(e.recall>this.currentLineElement.childNodes.length)throw Error(`FileStream.render: Token recall exceed the current line, there's probably a bug...`);for(let t=0;t<e.recall;t++)this.currentLineElement.lastChild?.remove()}else{let t=N(e);if(this.currentLineElement==null){let{gutterLine:e,contentLine:t}=this.createLine();n.appendChild(e),r.appendChild(t)}if(this.currentLineElement?.appendChild(t),e.content===`
4
- `){this.currentLineIndex++;let{gutterLine:e,contentLine:t}=this.createLine();n.appendChild(e),r.appendChild(t)}}n.childNodes.length>0&&e.appendChild(n),r.childNodes.length>0&&t.appendChild(r),this.queuedTokens.length=0,this.options.onPostRender?.(this)};getOrCreateStreamColumns(){if(this.code==null)throw Error(`FileStream: expected code element to exist`);if(this.gutterElement!=null&&this.contentElement!=null)return{gutter:this.gutterElement,content:this.contentElement};let e=document.createElement(`div`);e.dataset.gutter=``;let t=document.createElement(`div`);return t.dataset.content=``,this.code.appendChild(e),this.code.appendChild(t),this.gutterElement=e,this.contentElement=t,{gutter:e,content:t}}updateRowSpan(){this.gutterElement!=null&&(this.gutterElement.style.gridRow=`span ${this.currentRowCount}`),this.contentElement!=null&&(this.contentElement.style.gridRow=`span ${this.currentRowCount}`)}createLine(){let e=this.currentLineIndex,t=`${e-1}`,n=document.createElement(`div`);n.dataset.columnNumber=`${e}`,n.dataset.lineType=`context`,n.dataset.lineIndex=t;let r=document.createElement(`span`);r.dataset.lineNumberContent=``,r.textContent=`${e}`,n.appendChild(r);let i=document.createElement(`div`);return i.dataset.line=`${e}`,i.dataset.lineType=`context`,i.dataset.lineIndex=t,this.currentRowCount+=1,this.updateRowSpan(),this.currentLineElement=i,{gutterLine:n,contentLine:i}}getOrCreateFileContainer(e){return e!=null&&e===this.fileContainer||e==null&&this.fileContainer!=null?this.fileContainer:(this.fileContainer!=null&&e!=null&&e!==this.fileContainer&&(this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0),this.fileContainer=e??document.createElement(`diffs-container`),this.fileContainer)}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??E,s=typeof o==`string`?o:{...o},c=u(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}this.themeCSSStyle=x({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:C(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}};function I(e){let t=v(e);if(t.length!==1)throw console.error(t),Error(`PatchDiff: Provided patch must include only 1 patch, with 1 diff`);let{files:n}=t[0];if(n.length!==1)throw console.error(n),Error(`FileDiff: Provided patch must contain exactly 1 file diff`);return n[0]}var L=a(),R=s();function z({patch:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderMetadata:f,renderGutterUtility:p,disableWorkerPool:h=!1}){let g=B(e),{ref:v,getHoveredLine:y}=_({fileDiff:g,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:p!=null,hasCustomHeader:u!=null,disableWorkerPool:h});return(0,R.jsx)(c,{ref:v,className:a,style:o,children:b(m({fileDiff:g,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderMetadata:f,renderAnnotation:l,lineAnnotations:r,renderGutterUtility:p,getHoveredLine:y}),s)})}function B(e){return(0,L.useMemo)(()=>I(e),[e])}var V=T();function H(e,t){let n=(0,V.createRoot)(e);return n.render((0,R.jsx)(U,{...t})),{update(e){n.render((0,R.jsx)(U,{...e}))},unmount(){n.unmount()}}}function U({card:a,hostContext:o,errorMessage:s=null}){let c=o?.theme===`light`?`light`:`dark`;if(s)return(0,R.jsx)(K,{message:s,tone:`error`});if(n(a.tool)||r(a.tool)){let e=a.payload?.patch||a.payload?.diff;return e?(0,R.jsx)(G,{patch:e,themeType:c}):(0,R.jsx)(K,{message:`Diff payload is not available.`})}let l=i(a.payload);return l?e(a.tool)?(0,R.jsx)(W,{path:a.path??`file`,text:l,startLine:t(a.summary,`offset`)??1,themeType:c}):(0,R.jsx)(`pre`,{className:`text-payload pretty-scrollbar ${a.tool}`,children:l}):(0,R.jsx)(K,{message:`No details available.`})}function W({path:e,text:t,startLine:n,themeType:r}){let i=(0,L.useRef)(null),a=(0,L.useMemo)(()=>({theme:{light:`pierre-light`,dark:`pierre-dark`},themeType:r,overflow:`scroll`,unsafeCSS:S}),[r]);return(0,L.useEffect)(()=>{let r=i.current;if(!r)return;let o=new F({...a,lang:p(e),startingLineIndex:n}),s=new ReadableStream({start(e){e.enqueue(t),e.close()}}),c=!1;return o.setup(s,r).then(()=>{c&&(o.cleanUp(),r.replaceChildren())}),()=>{c=!0,o.cleanUp(),r.replaceChildren()}},[a,e,n,t]),(0,R.jsx)(`div`,{ref:i,className:`pierre-file pretty-scrollbar`})}function G({patch:e,themeType:t}){return(0,R.jsx)(z,{patch:e,options:{theme:{light:`pierre-light`,dark:`pierre-dark`},themeType:t,diffStyle:`unified`,diffIndicators:`bars`,hunkSeparators:`line-info`,lineDiffType:`word-alt`,overflow:`scroll`,unsafeCSS:S,collapsedContextThreshold:4,expansionLineCount:20,stickyHeader:!0,disableFileHeader:!0},className:`pierre-diff pretty-scrollbar`})}function K({message:e,tone:t=`muted`}){return(0,R.jsx)(`div`,{className:`status ${t}`,children:e})}export{H as mountHeavyPayload};
4
+ `){this.currentLineIndex++;let{gutterLine:e,contentLine:t}=this.createLine();n.appendChild(e),r.appendChild(t)}}n.childNodes.length>0&&e.appendChild(n),r.childNodes.length>0&&t.appendChild(r),this.queuedTokens.length=0,this.options.onPostRender?.(this)};getOrCreateStreamColumns(){if(this.code==null)throw Error(`FileStream: expected code element to exist`);if(this.gutterElement!=null&&this.contentElement!=null)return{gutter:this.gutterElement,content:this.contentElement};let e=document.createElement(`div`);e.dataset.gutter=``;let t=document.createElement(`div`);return t.dataset.content=``,this.code.appendChild(e),this.code.appendChild(t),this.gutterElement=e,this.contentElement=t,{gutter:e,content:t}}updateRowSpan(){this.gutterElement!=null&&(this.gutterElement.style.gridRow=`span ${this.currentRowCount}`),this.contentElement!=null&&(this.contentElement.style.gridRow=`span ${this.currentRowCount}`)}createLine(){let e=this.currentLineIndex,t=`${e-1}`,n=document.createElement(`div`);n.dataset.columnNumber=`${e}`,n.dataset.lineType=`context`,n.dataset.lineIndex=t;let r=document.createElement(`span`);r.dataset.lineNumberContent=``,r.textContent=`${e}`,n.appendChild(r);let i=document.createElement(`div`);return i.dataset.line=`${e}`,i.dataset.lineType=`context`,i.dataset.lineIndex=t,this.currentRowCount+=1,this.updateRowSpan(),this.currentLineElement=i,{gutterLine:n,contentLine:i}}getOrCreateFileContainer(e){return e!=null&&e===this.fileContainer||e==null&&this.fileContainer!=null?this.fileContainer:(this.fileContainer!=null&&e!=null&&e!==this.fileContainer&&(this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0),this.fileContainer=e??document.createElement(`diffs-container`),this.fileContainer)}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??E,s=typeof o==`string`?o:{...o},c=u(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}this.themeCSSStyle=x({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:C(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}};function I(e){let t=v(e);if(t.length!==1)throw console.error(t),Error(`PatchDiff: Provided patch must include only 1 patch, with 1 diff`);let{files:n}=t[0];if(n.length!==1)throw console.error(n),Error(`FileDiff: Provided patch must contain exactly 1 file diff`);return n[0]}var L=a(),R=s();function z({patch:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderMetadata:f,renderGutterUtility:p,disableWorkerPool:h=!1}){let g=B(e),{ref:v,getHoveredLine:y}=_({fileDiff:g,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:p!=null,hasCustomHeader:u!=null,disableWorkerPool:h});return(0,R.jsx)(c,{ref:v,className:a,style:o,children:b(m({fileDiff:g,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderMetadata:f,renderAnnotation:l,lineAnnotations:r,renderGutterUtility:p,getHoveredLine:y}),s)})}function B(e){return(0,L.useMemo)(()=>I(e),[e])}var V=T();function H(e,t){let n=(0,V.createRoot)(e);return n.render((0,R.jsx)(U,{...t})),{update(e){n.render((0,R.jsx)(U,{...e}))},unmount(){n.unmount()}}}function U({card:a,hostContext:o,errorMessage:s=null}){let c=o?.theme===`light`?`light`:`dark`;if(s)return(0,R.jsx)(K,{message:s,tone:`error`});if(r(a.tool)||n(a.tool)){let e=a.payload?.patch||a.payload?.diff;return e?(0,R.jsx)(G,{patch:e,themeType:c}):(0,R.jsx)(K,{message:`Diff payload is not available.`})}let l=e(a.payload);return l?t(a.tool)?(0,R.jsx)(W,{path:a.path??`file`,text:l,startLine:i(a.summary,`offset`)??1,themeType:c}):(0,R.jsx)(`pre`,{className:`text-payload pretty-scrollbar ${a.tool}`,children:l}):(0,R.jsx)(K,{message:`No details available.`})}function W({path:e,text:t,startLine:n,themeType:r}){let i=(0,L.useRef)(null),a=(0,L.useMemo)(()=>({theme:{light:`pierre-light`,dark:`pierre-dark`},themeType:r,overflow:`scroll`,unsafeCSS:S}),[r]);return(0,L.useEffect)(()=>{let r=i.current;if(!r)return;let o=new F({...a,lang:p(e),startingLineIndex:n}),s=new ReadableStream({start(e){e.enqueue(t),e.close()}}),c=!1;return o.setup(s,r).then(()=>{c&&(o.cleanUp(),r.replaceChildren())}),()=>{c=!0,o.cleanUp(),r.replaceChildren()}},[a,e,n,t]),(0,R.jsx)(`div`,{ref:i,className:`pierre-file pretty-scrollbar`})}function G({patch:e,themeType:t}){return(0,R.jsx)(z,{patch:e,options:{theme:{light:`pierre-light`,dark:`pierre-dark`},themeType:t,diffStyle:`unified`,diffIndicators:`bars`,hunkSeparators:`line-info`,lineDiffType:`word-alt`,overflow:`scroll`,unsafeCSS:S,collapsedContextThreshold:4,expansionLineCount:20,stickyHeader:!0,disableFileHeader:!0},className:`pierre-diff pretty-scrollbar`})}function K({message:e,tone:t=`muted`}){return(0,R.jsx)(`div`,{className:`status ${t}`,children:e})}export{H as mountHeavyPayload};
@@ -1 +1 @@
1
- import{n as e,r as t,t as n}from"./workspace-app-D6UR0AFl.js";import{S as r,a as i,b as a,i as o,n as s,o as c,r as l,t as u,x as d}from"./scrollbar-CbhpdW05.js";var f=i();function p({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:c,style:u,prerenderedHTML:d,renderAnnotation:p,renderCustomHeader:m,renderHeaderPrefix:h,renderHeaderMetadata:g,renderGutterUtility:_,disableWorkerPool:v=!1}){let{ref:y,getHoveredLine:b}=s({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:d,hasGutterRenderUtility:_!=null,hasCustomHeader:m!=null,disableWorkerPool:v});return(0,f.jsx)(a,{ref:y,className:c,style:u,children:l(o({fileDiff:e,renderCustomHeader:m,renderHeaderPrefix:h,renderHeaderMetadata:g,renderAnnotation:p,renderGutterUtility:_,lineAnnotations:r,getHoveredLine:b}),d)})}var m=r(),h=d();function g(e,t){let n=(0,h.createRoot)(e);return n.render((0,f.jsx)(_,{...t})),{update(e){n.render((0,f.jsx)(_,{...e}))},unmount(){n.unmount()}}}function _({card:r,hostContext:i,errorMessage:a=null,visibleFileCount:o}){let s=r.payload?.patch,c=i?.theme===`light`?`light`:`dark`,l=(0,m.useMemo)(()=>y(s),[s]),u=typeof o==`number`?l.slice(0,o):l,[d,h]=(0,m.useState)(()=>new Set);if(a)return(0,f.jsx)(S,{message:a,tone:`error`});if(!s)return(0,f.jsx)(S,{message:`Diff payload is not available.`});if(l.length===0)return(0,f.jsx)(S,{message:`No diff hunks to review.`});let g=x(c);return l.length===1?(0,f.jsx)(`div`,{className:`review-single-file`,children:(0,f.jsx)(p,{fileDiff:l[0],options:g,className:`pierre-diff pretty-scrollbar`})}):(0,f.jsx)(`div`,{className:`review-diff pretty-scrollbar`,children:(0,f.jsx)(`div`,{className:`review-diff-files`,children:u.map((i,a)=>{let o=i.cacheKey??`${i.prevName??``}->${i.name}-${a}`,s=b(i),c=d.has(o),l=e(r.files??[],{path:i.name,previousPath:i.prevName,type:i.type},a),u=t(r.files??[],{path:i.name,previousPath:i.prevName},a);return(0,f.jsxs)(`div`,{className:`review-diff-file`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`review-diff-file-header`,"aria-expanded":c,onClick:()=>{let e=new Set(d);e.has(o)?e.delete(o):e.add(o),h(e)},children:[(0,f.jsx)(`span`,{className:`review-file-kind ${l}`,role:`img`,title:n(l),"aria-label":n(l),children:v(l)}),u?.previous?(0,f.jsxs)(`span`,{className:`review-diff-file-name renamed`,title:u.title,children:[(0,f.jsx)(`span`,{className:`review-diff-file-path previous`,children:u.previous}),(0,f.jsx)(`span`,{className:`review-diff-file-arrow`,children:`→`}),(0,f.jsx)(`span`,{className:`review-diff-file-path current`,children:u.current})]}):(0,f.jsx)(`span`,{className:`review-diff-file-name`,title:u?.title??i.name,children:u?.current??i.name}),(0,f.jsxs)(`span`,{className:`review-diff-file-stats`,children:[(0,f.jsxs)(`span`,{className:`add`,children:[`+`,s.additions]}),(0,f.jsxs)(`span`,{className:`remove`,children:[`-`,s.removals]})]})]}),c?(0,f.jsx)(p,{fileDiff:i,options:g,className:`pierre-diff pretty-scrollbar`}):null]},o)})})})}function v(e){switch(e){case`added`:return`A`;case`edited`:return`M`;case`deleted`:return`D`;case`renamed`:case`renamed-edited`:return`R`;case`unknown`:return`•`}}function y(e){return e?c(e,`review`,!0).flatMap(e=>e.files):[]}function b(e){return e.hunks.reduce((e,t)=>({additions:e.additions+t.additionLines,removals:e.removals+t.deletionLines}),{additions:0,removals:0})}function x(e){return{theme:{light:`pierre-light`,dark:`pierre-dark`},themeType:e,diffStyle:`unified`,diffIndicators:`bars`,hunkSeparators:`line-info`,lineDiffType:`word-alt`,overflow:`scroll`,unsafeCSS:u,collapsedContextThreshold:4,expansionLineCount:20,stickyHeader:!1,disableFileHeader:!0}}function S({message:e,tone:t=`muted`}){return(0,f.jsx)(`div`,{className:`status ${t}`,children:e})}export{g as mountReviewPayload};
1
+ import{n as e,r as t,t as n}from"./workspace-app-CmaYU4DW.js";import{S as r,a as i,b as a,i as o,n as s,o as c,r as l,t as u,x as d}from"./scrollbar-CvE-I-jG.js";var f=i();function p({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:c,style:u,prerenderedHTML:d,renderAnnotation:p,renderCustomHeader:m,renderHeaderPrefix:h,renderHeaderMetadata:g,renderGutterUtility:_,disableWorkerPool:v=!1}){let{ref:y,getHoveredLine:b}=s({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:d,hasGutterRenderUtility:_!=null,hasCustomHeader:m!=null,disableWorkerPool:v});return(0,f.jsx)(a,{ref:y,className:c,style:u,children:l(o({fileDiff:e,renderCustomHeader:m,renderHeaderPrefix:h,renderHeaderMetadata:g,renderAnnotation:p,renderGutterUtility:_,lineAnnotations:r,getHoveredLine:b}),d)})}var m=r(),h=d();function g(e,t){let n=(0,h.createRoot)(e);return n.render((0,f.jsx)(_,{...t})),{update(e){n.render((0,f.jsx)(_,{...e}))},unmount(){n.unmount()}}}function _({card:r,hostContext:i,errorMessage:a=null,visibleFileCount:o}){let s=r.payload?.patch,c=i?.theme===`light`?`light`:`dark`,l=(0,m.useMemo)(()=>y(s),[s]),u=typeof o==`number`?l.slice(0,o):l,[d,h]=(0,m.useState)(()=>new Set);if(a)return(0,f.jsx)(S,{message:a,tone:`error`});if(!s)return(0,f.jsx)(S,{message:`Diff payload is not available.`});if(l.length===0)return(0,f.jsx)(S,{message:`No diff hunks to review.`});let g=x(c);return l.length===1?(0,f.jsx)(`div`,{className:`review-single-file`,children:(0,f.jsx)(p,{fileDiff:l[0],options:g,className:`pierre-diff pretty-scrollbar`})}):(0,f.jsx)(`div`,{className:`review-diff pretty-scrollbar`,children:(0,f.jsx)(`div`,{className:`review-diff-files`,children:u.map((i,a)=>{let o=i.cacheKey??`${i.prevName??``}->${i.name}-${a}`,s=b(i),c=d.has(o),l=e(r.files??[],{path:i.name,previousPath:i.prevName,type:i.type},a),u=t(r.files??[],{path:i.name,previousPath:i.prevName},a);return(0,f.jsxs)(`div`,{className:`review-diff-file`,children:[(0,f.jsxs)(`button`,{type:`button`,className:`review-diff-file-header`,"aria-expanded":c,onClick:()=>{let e=new Set(d);e.has(o)?e.delete(o):e.add(o),h(e)},children:[(0,f.jsx)(`span`,{className:`review-file-kind ${l}`,role:`img`,title:n(l),"aria-label":n(l),children:v(l)}),u?.previous?(0,f.jsxs)(`span`,{className:`review-diff-file-name renamed`,title:u.title,children:[(0,f.jsx)(`span`,{className:`review-diff-file-path previous`,children:u.previous}),(0,f.jsx)(`span`,{className:`review-diff-file-arrow`,children:`→`}),(0,f.jsx)(`span`,{className:`review-diff-file-path current`,children:u.current})]}):(0,f.jsx)(`span`,{className:`review-diff-file-name`,title:u?.title??i.name,children:u?.current??i.name}),(0,f.jsxs)(`span`,{className:`review-diff-file-stats`,children:[(0,f.jsxs)(`span`,{className:`add`,children:[`+`,s.additions]}),(0,f.jsxs)(`span`,{className:`remove`,children:[`-`,s.removals]})]})]}),c?(0,f.jsx)(p,{fileDiff:i,options:g,className:`pierre-diff pretty-scrollbar`}):null]},o)})})})}function v(e){switch(e){case`added`:return`A`;case`edited`:return`M`;case`deleted`:return`D`;case`renamed`:case`renamed-edited`:return`R`;case`unknown`:return`•`}}function y(e){return e?c(e,`review`,!0).flatMap(e=>e.files):[]}function b(e){return e.hunks.reduce((e,t)=>({additions:e.additions+t.additionLines,removals:e.removals+t.deletionLines}),{additions:0,removals:0})}function x(e){return{theme:{light:`pierre-light`,dark:`pierre-dark`},themeType:e,diffStyle:`unified`,diffIndicators:`bars`,hunkSeparators:`line-info`,lineDiffType:`word-alt`,overflow:`scroll`,unsafeCSS:u,collapsedContextThreshold:4,expansionLineCount:20,stickyHeader:!1,disableFileHeader:!0}}function S({message:e,tone:t=`muted`}){return(0,f.jsx)(`div`,{className:`status ${t}`,children:e})}export{g as mountReviewPayload};