@tutti-os/agent-gui 0.0.65 → 0.0.66

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 (69) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +1 -1
  3. package/dist/agent-conversation/index.d.ts +2 -2
  4. package/dist/agent-conversation/index.js +5 -5
  5. package/dist/agent-message-center/index.js +7 -7
  6. package/dist/{agentGuiNodeTypes-CCjzXdTe.d.ts → agentGuiNodeTypes-B9Aq3UEU.d.ts} +3 -1
  7. package/dist/app/renderer/agentactivity.css +43 -0
  8. package/dist/{chunk-UWBX3DZK.js → chunk-6ULTMCKP.js} +2 -2
  9. package/dist/{chunk-HKKC2U6J.js → chunk-CTJQTUQ3.js} +5 -5
  10. package/dist/{chunk-HKKC2U6J.js.map → chunk-CTJQTUQ3.js.map} +1 -1
  11. package/dist/{chunk-R7PSPKBD.js → chunk-DXVMRZHH.js} +2 -6
  12. package/dist/chunk-DXVMRZHH.js.map +1 -0
  13. package/dist/{chunk-W3Q7B3DV.js → chunk-HNODQVG2.js} +2 -2
  14. package/dist/{chunk-N7BGNAA2.js → chunk-JTFWT6DK.js} +6 -8
  15. package/dist/chunk-JTFWT6DK.js.map +1 -0
  16. package/dist/{chunk-XLBJHHDX.js → chunk-KRJF7WLJ.js} +11 -1
  17. package/dist/chunk-KRJF7WLJ.js.map +1 -0
  18. package/dist/{chunk-TG3ZXLPM.js → chunk-MYD37I32.js} +27 -3
  19. package/dist/chunk-MYD37I32.js.map +1 -0
  20. package/dist/{chunk-XZPAU7FC.js → chunk-NOTZW5WH.js} +2 -2
  21. package/dist/{chunk-IDTB6OID.js → chunk-T3KGZV35.js} +49 -11
  22. package/dist/chunk-T3KGZV35.js.map +1 -0
  23. package/dist/{chunk-6OYLLPPN.js → chunk-UBBHWDMP.js} +12 -8
  24. package/dist/{chunk-6OYLLPPN.js.map → chunk-UBBHWDMP.js.map} +1 -1
  25. package/dist/{chunk-EIPQGFAE.js → chunk-VBTPXEFH.js} +2 -2
  26. package/dist/{chunk-QULZNKPA.js → chunk-Z26P2QNT.js} +2 -2
  27. package/dist/context-mention-palette/index.js +6 -6
  28. package/dist/i18n/index.d.ts +10 -0
  29. package/dist/i18n/index.js +2 -2
  30. package/dist/index.d.ts +20 -5
  31. package/dist/index.js +283 -523
  32. package/dist/index.js.map +1 -1
  33. package/dist/queued-prompt-runtime.d.ts +22 -3
  34. package/dist/queued-prompt-runtime.js +1 -1
  35. package/dist/{types-BAPEle8b.d.ts → types-Bxn8bLEp.d.ts} +14 -1
  36. package/dist/workbench/contribution.d.ts +1 -1
  37. package/dist/workbench/index.d.ts +1 -1
  38. package/dist/workbench/index.js +3 -3
  39. package/dist/workbench/launch.d.ts +1 -1
  40. package/dist/workbench/providerCatalog.d.ts +1 -1
  41. package/dist/workbench/sessionTitle.d.ts +1 -1
  42. package/dist/workbench/sessionTitle.js +3 -3
  43. package/dist/workbench/state.d.ts +1 -1
  44. package/dist/workbench/types.d.ts +1 -1
  45. package/dist/workspace-agent-generated-files.js +3 -3
  46. package/package.json +12 -12
  47. package/dist/app/renderer/assets/icons/@-lined-14px.svg +0 -3
  48. package/dist/app/renderer/assets/icons/agents/manage-agent-claude-code.png +0 -0
  49. package/dist/app/renderer/assets/icons/agents/manage-agent-codex.png +0 -0
  50. package/dist/app/renderer/assets/icons/agents/manage-agent-gemini.png +0 -0
  51. package/dist/app/renderer/assets/icons/agents/manage-agent-hermes.png +0 -0
  52. package/dist/app/renderer/assets/icons/agents/manage-agent-openclaw.png +0 -0
  53. package/dist/app/renderer/assets/icons/agents/tutti-doc-rounded.png +0 -0
  54. package/dist/app/renderer/assets/icons/agents/workspace-dock-agent-claude-code.png +0 -0
  55. package/dist/app/renderer/assets/icons/agents/workspace-dock-agent-codex.png +0 -0
  56. package/dist/app/renderer/assets/icons/agents/workspace-dock-agent-gemini.png +0 -0
  57. package/dist/app/renderer/assets/icons/agents/workspace-dock-agent-nexight.png +0 -0
  58. package/dist/app/renderer/assets/icons/agents/workspace-dock-agent-openclaw.png +0 -0
  59. package/dist/app/renderer/assets/icons/arrow-left-filled.svg +0 -1
  60. package/dist/chunk-IDTB6OID.js.map +0 -1
  61. package/dist/chunk-N7BGNAA2.js.map +0 -1
  62. package/dist/chunk-R7PSPKBD.js.map +0 -1
  63. package/dist/chunk-TG3ZXLPM.js.map +0 -1
  64. package/dist/chunk-XLBJHHDX.js.map +0 -1
  65. /package/dist/{chunk-UWBX3DZK.js.map → chunk-6ULTMCKP.js.map} +0 -0
  66. /package/dist/{chunk-W3Q7B3DV.js.map → chunk-HNODQVG2.js.map} +0 -0
  67. /package/dist/{chunk-XZPAU7FC.js.map → chunk-NOTZW5WH.js.map} +0 -0
  68. /package/dist/{chunk-EIPQGFAE.js.map → chunk-VBTPXEFH.js.map} +0 -0
  69. /package/dist/{chunk-QULZNKPA.js.map → chunk-Z26P2QNT.js.map} +0 -0
@@ -247,7 +247,8 @@ function createAgentQueuedPromptRuntime() {
247
247
  failedPromptId: queue.failedPromptId === promptId ? null : queue.failedPromptId,
248
248
  prompts: Object.freeze(prompts),
249
249
  retryBlock: queue.retryBlock?.queuedPromptId === promptId ? null : queue.retryBlock,
250
- sendNextPromptId: promptId
250
+ sendNextPromptId: promptId,
251
+ suspendReason: null
251
252
  };
252
253
  });
253
254
  },
@@ -326,6 +327,28 @@ function createAgentQueuedPromptRuntime() {
326
327
  retryBlock: input.retryBlock
327
328
  });
328
329
  },
330
+ suspendQueue(input) {
331
+ updateQueue(input.workspaceId, input.agentSessionId, (queue) => ({
332
+ ...queue,
333
+ suspendReason: input.reason
334
+ }));
335
+ logAgentQueuedPromptRuntime("suspend", {
336
+ workspaceId: input.workspaceId,
337
+ agentSessionId: input.agentSessionId,
338
+ reason: input.reason
339
+ });
340
+ },
341
+ resumeQueue(input) {
342
+ updateQueue(
343
+ input.workspaceId,
344
+ input.agentSessionId,
345
+ (queue) => queue.suspendReason === null ? queue : { ...queue, suspendReason: null }
346
+ );
347
+ logAgentQueuedPromptRuntime("resume", {
348
+ workspaceId: input.workspaceId,
349
+ agentSessionId: input.agentSessionId
350
+ });
351
+ },
329
352
  subscribe(listener) {
330
353
  listeners.add(listener);
331
354
  return () => {
@@ -345,7 +368,8 @@ function emptyQueueSnapshot(input) {
345
368
  failedPromptId: null,
346
369
  prompts: Object.freeze([]),
347
370
  retryBlock: null,
348
- sendNextPromptId: null
371
+ sendNextPromptId: null,
372
+ suspendReason: null
349
373
  });
350
374
  }
351
375
  function getEmptyQueueSnapshot(cache, input) {
@@ -397,4 +421,4 @@ export {
397
421
  EMPTY_AGENT_QUEUED_PROMPT_SNAPSHOT,
398
422
  createAgentQueuedPromptRuntime
399
423
  };
400
- //# sourceMappingURL=chunk-TG3ZXLPM.js.map
424
+ //# sourceMappingURL=chunk-MYD37I32.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../agentQueuedPromptRuntimeCore.ts"],"sourcesContent":["import type { AgentGUIQueuedPromptVM } from \"./agent-gui/agentGuiNode/model/agentGuiNodeTypes\";\nimport type { AgentPromptContentBlock } from \"./shared/contracts/dto\";\n\nexport interface AgentQueuedPromptRetryBlock {\n queuedPromptId: string;\n sessionStateUpdatedAtUnixMs: number | null;\n conversationUpdatedAtUnixMs: number | null;\n}\n\nexport interface AgentQueuedPromptClaim {\n agentSessionId: string;\n claimId: string;\n ownerId: string;\n promptId: string;\n leasedUntilUnixMs: number;\n workspaceId: string;\n}\n\nexport type AgentQueuedPromptSuspendReason = \"user_stop\";\n\nexport interface AgentQueuedPromptQueueSnapshot {\n agentSessionId: string;\n claim: AgentQueuedPromptClaim | null;\n failedPromptId: string | null;\n prompts: readonly AgentGUIQueuedPromptVM[];\n retryBlock: AgentQueuedPromptRetryBlock | null;\n sendNextPromptId: string | null;\n /**\n * User intent gate: while set, the drainer must not auto-dispatch this\n * queue even when the session is available. Set when the user stops the\n * session; cleared by an explicit user send (composer submit resumes, and\n * promotePrompt clears it as part of \"send now\").\n */\n suspendReason: AgentQueuedPromptSuspendReason | null;\n workspaceId: string;\n}\n\nexport interface AgentQueuedPromptSnapshot {\n queuesByKey: Readonly<Record<string, AgentQueuedPromptQueueSnapshot>>;\n version: number;\n}\n\nexport interface AgentQueuedPromptClaimResult {\n claim: AgentQueuedPromptClaim;\n prompt: AgentGUIQueuedPromptVM;\n}\n\nexport interface AgentQueuedPromptRuntime {\n claimNextToDrain(input: {\n agentSessionId: string;\n leaseMs?: number;\n ownerId: string;\n workspaceId: string;\n }): AgentQueuedPromptClaimResult | null;\n cleanupSession(input: { agentSessionId: string; workspaceId: string }): void;\n completeClaim(input: {\n agentSessionId: string;\n claimId: string;\n ownerId: string;\n workspaceId: string;\n }): boolean;\n enqueue(input: {\n prompt: AgentGUIQueuedPromptVM;\n agentSessionId: string;\n workspaceId: string;\n }): void;\n getSessionSnapshot(input: {\n agentSessionId: string;\n workspaceId: string;\n }): AgentQueuedPromptQueueSnapshot;\n getSnapshot(): AgentQueuedPromptSnapshot;\n markPromptFailed(input: {\n agentSessionId: string;\n promptId: string;\n workspaceId: string;\n }): void;\n promotePrompt(input: {\n agentSessionId: string;\n promptId: string;\n workspaceId: string;\n }): void;\n releaseClaim(input: {\n agentSessionId: string;\n claimId: string;\n ownerId: string;\n workspaceId: string;\n }): boolean;\n /** @deprecated Queue drain owners should release exact claims by claim id. */\n releaseOwner(ownerId: string): void;\n removePrompt(input: {\n agentSessionId: string;\n promptId: string;\n workspaceId: string;\n }): AgentGUIQueuedPromptVM | null;\n setRetryBlock(input: {\n agentSessionId: string;\n retryBlock: AgentQueuedPromptRetryBlock | null;\n workspaceId: string;\n }): void;\n /** Hold the queue after a user stop; a no-op when the queue is empty. */\n suspendQueue(input: {\n agentSessionId: string;\n reason: AgentQueuedPromptSuspendReason;\n workspaceId: string;\n }): void;\n /** Lift a user-stop hold (explicit user send). */\n resumeQueue(input: { agentSessionId: string; workspaceId: string }): void;\n subscribe(listener: () => void): () => void;\n}\n\nconst DEFAULT_CLAIM_LEASE_MS = 30_000;\n\nexport const EMPTY_AGENT_QUEUED_PROMPT_SNAPSHOT: AgentQueuedPromptSnapshot =\n Object.freeze({\n queuesByKey: Object.freeze({}),\n version: 0\n });\n\nfunction logAgentQueuedPromptRuntime(\n event: string,\n details: Record<string, unknown>\n): void {\n void event;\n void details;\n}\n\nexport function createAgentQueuedPromptRuntime(): AgentQueuedPromptRuntime {\n let snapshot = EMPTY_AGENT_QUEUED_PROMPT_SNAPSHOT;\n const emptyQueuesByKey = new Map<string, AgentQueuedPromptQueueSnapshot>();\n const expiredClaimsByKey = new Map<string, AgentQueuedPromptClaim>();\n const listeners = new Set<() => void>();\n let claimExpiryTimer: ReturnType<typeof setTimeout> | null = null;\n\n const notify = (): void => {\n for (const listener of [...listeners]) {\n listener();\n }\n };\n\n const updateQueue = (\n workspaceId: string,\n agentSessionId: string,\n updater: (\n queue: AgentQueuedPromptQueueSnapshot\n ) => AgentQueuedPromptQueueSnapshot | null,\n options?: { releaseExpiredClaim?: boolean }\n ): void => {\n const key = queueKey(workspaceId, agentSessionId);\n const current =\n snapshot.queuesByKey[key] ??\n getEmptyQueueSnapshot(emptyQueuesByKey, { workspaceId, agentSessionId });\n const queueForUpdate =\n options?.releaseExpiredClaim === false\n ? current\n : withExpiredClaimReleased(current);\n if (queueForUpdate !== current && current.claim) {\n expiredClaimsByKey.set(key, current.claim);\n }\n const nextQueue = updater(queueForUpdate);\n if (nextQueue === current) {\n return;\n }\n const nextQueuesByKey: Record<string, AgentQueuedPromptQueueSnapshot> = {\n ...snapshot.queuesByKey\n };\n if (nextQueue === null || isEmptyQueue(nextQueue)) {\n delete nextQueuesByKey[key];\n } else {\n nextQueuesByKey[key] = freezeQueue(nextQueue);\n }\n clearExpiredClaimIfReplaced(expiredClaimsByKey, key, nextQueue);\n snapshot = Object.freeze({\n queuesByKey: Object.freeze(nextQueuesByKey),\n version: snapshot.version + 1\n });\n scheduleClaimExpiryWakeup();\n notify();\n };\n\n const releaseExpiredClaims = (): void => {\n claimExpiryTimer = null;\n let changed = false;\n const nextQueuesByKey: Record<string, AgentQueuedPromptQueueSnapshot> = {\n ...snapshot.queuesByKey\n };\n for (const [key, queue] of Object.entries(snapshot.queuesByKey)) {\n const nextQueue = withExpiredClaimReleased(queue);\n if (nextQueue === queue) {\n continue;\n }\n changed = true;\n if (queue.claim) {\n expiredClaimsByKey.set(key, queue.claim);\n }\n if (isEmptyQueue(nextQueue)) {\n delete nextQueuesByKey[key];\n } else {\n nextQueuesByKey[key] = nextQueue;\n }\n }\n if (changed) {\n snapshot = Object.freeze({\n queuesByKey: Object.freeze(nextQueuesByKey),\n version: snapshot.version + 1\n });\n notify();\n }\n scheduleClaimExpiryWakeup();\n };\n\n const scheduleClaimExpiryWakeup = (): void => {\n if (claimExpiryTimer) {\n clearTimeout(claimExpiryTimer);\n claimExpiryTimer = null;\n }\n let nextExpiryUnixMs: number | null = null;\n for (const queue of Object.values(snapshot.queuesByKey)) {\n if (!queue.claim) {\n continue;\n }\n nextExpiryUnixMs =\n nextExpiryUnixMs === null\n ? queue.claim.leasedUntilUnixMs\n : Math.min(nextExpiryUnixMs, queue.claim.leasedUntilUnixMs);\n }\n if (nextExpiryUnixMs === null) {\n return;\n }\n claimExpiryTimer = setTimeout(\n releaseExpiredClaims,\n Math.max(1, nextExpiryUnixMs - Date.now() + 1)\n );\n (claimExpiryTimer as { unref?: () => void }).unref?.();\n };\n\n return {\n claimNextToDrain(input) {\n const workspaceId = input.workspaceId.trim();\n const agentSessionId = input.agentSessionId.trim();\n const ownerId = input.ownerId.trim();\n if (!workspaceId || !agentSessionId || !ownerId) {\n return null;\n }\n const current = withExpiredClaimReleased(\n snapshot.queuesByKey[queueKey(workspaceId, agentSessionId)] ??\n getEmptyQueueSnapshot(emptyQueuesByKey, {\n workspaceId,\n agentSessionId\n })\n );\n if (current.claim || current.prompts.length === 0) {\n return null;\n }\n const prompt = current.prompts[0]!;\n const claim: AgentQueuedPromptClaim = Object.freeze({\n workspaceId,\n agentSessionId,\n ownerId,\n promptId: prompt.id,\n claimId: `claim-${Date.now()}-${Math.random().toString(36).slice(2)}`,\n leasedUntilUnixMs:\n Date.now() + Math.max(1, input.leaseMs ?? DEFAULT_CLAIM_LEASE_MS)\n });\n updateQueue(workspaceId, agentSessionId, (queue) => ({\n ...queue,\n claim\n }));\n expiredClaimsByKey.delete(queueKey(workspaceId, agentSessionId));\n logAgentQueuedPromptRuntime(\"claim\", {\n workspaceId,\n agentSessionId,\n ownerId,\n promptId: prompt.id,\n claimId: claim.claimId,\n queueLength: current.prompts.length\n });\n return { claim, prompt };\n },\n cleanupSession(input) {\n const workspaceId = input.workspaceId.trim();\n const agentSessionId = input.agentSessionId.trim();\n if (!workspaceId || !agentSessionId) {\n return;\n }\n updateQueue(workspaceId, agentSessionId, () => null);\n expiredClaimsByKey.delete(queueKey(workspaceId, agentSessionId));\n },\n completeClaim(input) {\n let completed = false;\n const key = queueKey(input.workspaceId, input.agentSessionId);\n updateQueue(\n input.workspaceId,\n input.agentSessionId,\n (queue) => {\n const matchingClaim = claimMatches(queue.claim, input)\n ? queue.claim\n : queue.claim === null &&\n claimMatches(expiredClaimsByKey.get(key) ?? null, input)\n ? expiredClaimsByKey.get(key)!\n : null;\n if (!matchingClaim) {\n return queue;\n }\n completed = true;\n const promptId = matchingClaim.promptId;\n expiredClaimsByKey.delete(key);\n logAgentQueuedPromptRuntime(\"complete-claim\", {\n workspaceId: input.workspaceId,\n agentSessionId: input.agentSessionId,\n ownerId: input.ownerId,\n promptId,\n claimId: input.claimId\n });\n return {\n ...queue,\n claim: null,\n failedPromptId:\n queue.failedPromptId === promptId ? null : queue.failedPromptId,\n prompts: Object.freeze(\n queue.prompts.filter((prompt) => prompt.id !== promptId)\n ),\n retryBlock:\n queue.retryBlock?.queuedPromptId === promptId\n ? null\n : queue.retryBlock,\n sendNextPromptId:\n queue.sendNextPromptId === promptId\n ? null\n : queue.sendNextPromptId\n };\n },\n { releaseExpiredClaim: false }\n );\n return completed;\n },\n enqueue(input) {\n updateQueue(input.workspaceId, input.agentSessionId, (queue) => ({\n ...queue,\n prompts: Object.freeze([...queue.prompts, freezePrompt(input.prompt)])\n }));\n logAgentQueuedPromptRuntime(\"enqueue\", {\n workspaceId: input.workspaceId,\n agentSessionId: input.agentSessionId,\n promptId: input.prompt.id\n });\n },\n getSessionSnapshot(input) {\n const workspaceId = input.workspaceId.trim();\n const agentSessionId = input.agentSessionId.trim();\n const key = queueKey(workspaceId, agentSessionId);\n const current =\n snapshot.queuesByKey[key] ??\n getEmptyQueueSnapshot(emptyQueuesByKey, {\n workspaceId,\n agentSessionId\n });\n const next = withExpiredClaimReleased(current);\n if (next !== current) {\n updateQueue(workspaceId, agentSessionId, () => next);\n }\n return snapshot.queuesByKey[key] ?? next;\n },\n getSnapshot() {\n return snapshot;\n },\n markPromptFailed(input) {\n updateQueue(input.workspaceId, input.agentSessionId, (queue) => ({\n ...queue,\n failedPromptId: input.promptId.trim() || queue.failedPromptId\n }));\n logAgentQueuedPromptRuntime(\"mark-failed\", {\n workspaceId: input.workspaceId,\n agentSessionId: input.agentSessionId,\n promptId: input.promptId\n });\n },\n promotePrompt(input) {\n const promptId = input.promptId.trim();\n if (!promptId) {\n return;\n }\n updateQueue(input.workspaceId, input.agentSessionId, (queue) => {\n const index = queue.prompts.findIndex(\n (prompt) => prompt.id === promptId\n );\n if (index < 0) {\n return queue;\n }\n if (queue.claim?.promptId === promptId) {\n return queue;\n }\n const prompts = [...queue.prompts];\n if (index > 0) {\n const [selected] = prompts.splice(index, 1);\n prompts.unshift(selected!);\n }\n return {\n ...queue,\n failedPromptId:\n queue.failedPromptId === promptId ? null : queue.failedPromptId,\n prompts: Object.freeze(prompts),\n retryBlock:\n queue.retryBlock?.queuedPromptId === promptId\n ? null\n : queue.retryBlock,\n sendNextPromptId: promptId,\n suspendReason: null\n };\n });\n },\n releaseClaim(input) {\n let released = false;\n updateQueue(input.workspaceId, input.agentSessionId, (queue) => {\n if (!claimMatches(queue.claim, input)) {\n return queue;\n }\n released = true;\n logAgentQueuedPromptRuntime(\"release-claim\", {\n workspaceId: input.workspaceId,\n agentSessionId: input.agentSessionId,\n ownerId: input.ownerId,\n claimId: input.claimId,\n promptId: queue.claim.promptId\n });\n return { ...queue, claim: null };\n });\n return released;\n },\n releaseOwner(ownerId) {\n const normalizedOwnerId = ownerId.trim();\n if (!normalizedOwnerId) {\n return;\n }\n for (const queue of Object.values(snapshot.queuesByKey)) {\n if (queue.claim?.ownerId === normalizedOwnerId) {\n updateQueue(queue.workspaceId, queue.agentSessionId, (current) => ({\n ...current,\n claim:\n current.claim?.ownerId === normalizedOwnerId\n ? null\n : current.claim\n }));\n }\n }\n },\n removePrompt(input) {\n const promptId = input.promptId.trim();\n if (!promptId) {\n return null;\n }\n let removed: AgentGUIQueuedPromptVM | null = null;\n updateQueue(input.workspaceId, input.agentSessionId, (queue) => {\n removed =\n queue.prompts.find((prompt) => prompt.id === promptId) ?? null;\n if (!removed) {\n return queue;\n }\n if (queue.claim?.promptId === promptId) {\n removed = null;\n return queue;\n }\n const key = queueKey(input.workspaceId, input.agentSessionId);\n if (expiredClaimsByKey.get(key)?.promptId === promptId) {\n expiredClaimsByKey.delete(key);\n }\n return {\n ...queue,\n claim: queue.claim?.promptId === promptId ? null : queue.claim,\n failedPromptId:\n queue.failedPromptId === promptId ? null : queue.failedPromptId,\n prompts: Object.freeze(\n queue.prompts.filter((prompt) => prompt.id !== promptId)\n ),\n retryBlock:\n queue.retryBlock?.queuedPromptId === promptId\n ? null\n : queue.retryBlock,\n sendNextPromptId:\n queue.sendNextPromptId === promptId ? null : queue.sendNextPromptId\n };\n });\n return removed;\n },\n setRetryBlock(input) {\n updateQueue(input.workspaceId, input.agentSessionId, (queue) => ({\n ...queue,\n retryBlock: input.retryBlock\n ? Object.freeze({ ...input.retryBlock })\n : null\n }));\n logAgentQueuedPromptRuntime(\"set-retry-block\", {\n workspaceId: input.workspaceId,\n agentSessionId: input.agentSessionId,\n retryBlock: input.retryBlock\n });\n },\n suspendQueue(input) {\n updateQueue(input.workspaceId, input.agentSessionId, (queue) => ({\n ...queue,\n suspendReason: input.reason\n }));\n logAgentQueuedPromptRuntime(\"suspend\", {\n workspaceId: input.workspaceId,\n agentSessionId: input.agentSessionId,\n reason: input.reason\n });\n },\n resumeQueue(input) {\n updateQueue(input.workspaceId, input.agentSessionId, (queue) =>\n queue.suspendReason === null ? queue : { ...queue, suspendReason: null }\n );\n logAgentQueuedPromptRuntime(\"resume\", {\n workspaceId: input.workspaceId,\n agentSessionId: input.agentSessionId\n });\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n }\n };\n}\n\nfunction queueKey(workspaceId: string, agentSessionId: string): string {\n return `${workspaceId.trim()}\\0${agentSessionId.trim()}`;\n}\n\nfunction emptyQueueSnapshot(input: {\n workspaceId: string;\n agentSessionId: string;\n}): AgentQueuedPromptQueueSnapshot {\n return freezeQueue({\n workspaceId: input.workspaceId,\n agentSessionId: input.agentSessionId,\n claim: null,\n failedPromptId: null,\n prompts: Object.freeze([]),\n retryBlock: null,\n sendNextPromptId: null,\n suspendReason: null\n });\n}\n\nfunction getEmptyQueueSnapshot(\n cache: Map<string, AgentQueuedPromptQueueSnapshot>,\n input: {\n workspaceId: string;\n agentSessionId: string;\n }\n): AgentQueuedPromptQueueSnapshot {\n const key = queueKey(input.workspaceId, input.agentSessionId);\n const existing = cache.get(key);\n if (existing) {\n return existing;\n }\n const next = emptyQueueSnapshot(input);\n cache.set(key, next);\n return next;\n}\n\nfunction freezePrompt(prompt: AgentGUIQueuedPromptVM): AgentGUIQueuedPromptVM {\n return Object.freeze({\n ...prompt,\n content: Object.freeze([\n ...prompt.content\n ]) as unknown as AgentPromptContentBlock[]\n });\n}\n\nfunction freezeQueue(\n queue: AgentQueuedPromptQueueSnapshot\n): AgentQueuedPromptQueueSnapshot {\n return Object.freeze({\n ...queue,\n claim: queue.claim ? Object.freeze({ ...queue.claim }) : null,\n prompts: Object.freeze(queue.prompts.map(freezePrompt)),\n retryBlock: queue.retryBlock ? Object.freeze({ ...queue.retryBlock }) : null\n });\n}\n\nfunction withExpiredClaimReleased(\n queue: AgentQueuedPromptQueueSnapshot\n): AgentQueuedPromptQueueSnapshot {\n if (!queue.claim || queue.claim.leasedUntilUnixMs > Date.now()) {\n return queue;\n }\n return freezeQueue({ ...queue, claim: null });\n}\n\nfunction isEmptyQueue(queue: AgentQueuedPromptQueueSnapshot): boolean {\n return (\n queue.prompts.length === 0 &&\n queue.claim === null &&\n queue.failedPromptId === null &&\n queue.retryBlock === null &&\n queue.sendNextPromptId === null\n );\n}\n\nfunction claimMatches(\n claim: AgentQueuedPromptClaim | null,\n input: {\n agentSessionId: string;\n claimId: string;\n ownerId: string;\n workspaceId: string;\n }\n): claim is AgentQueuedPromptClaim {\n return (\n claim !== null &&\n claim.workspaceId === input.workspaceId.trim() &&\n claim.agentSessionId === input.agentSessionId.trim() &&\n claim.ownerId === input.ownerId.trim() &&\n claim.claimId === input.claimId.trim()\n );\n}\n\nfunction clearExpiredClaimIfReplaced(\n expiredClaimsByKey: Map<string, AgentQueuedPromptClaim>,\n key: string,\n queue: AgentQueuedPromptQueueSnapshot | null\n): void {\n const expiredClaim = expiredClaimsByKey.get(key);\n if (\n expiredClaim &&\n (queue === null ||\n queue.claim !== null ||\n !queue.prompts.some((prompt) => prompt.id === expiredClaim.promptId))\n ) {\n expiredClaimsByKey.delete(key);\n }\n}\n"],"mappings":";AA8GA,IAAM,yBAAyB;AAExB,IAAM,qCACX,OAAO,OAAO;AAAA,EACZ,aAAa,OAAO,OAAO,CAAC,CAAC;AAAA,EAC7B,SAAS;AACX,CAAC;AAEH,SAAS,4BACP,OACA,SACM;AACN,OAAK;AACL,OAAK;AACP;AAEO,SAAS,iCAA2D;AACzE,MAAI,WAAW;AACf,QAAM,mBAAmB,oBAAI,IAA4C;AACzE,QAAM,qBAAqB,oBAAI,IAAoC;AACnE,QAAM,YAAY,oBAAI,IAAgB;AACtC,MAAI,mBAAyD;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C9D,WAAO;AAAA,EACT;AACA,SAAO,YAAY,EAAE,GAAG,OAAO,OAAO,KAAK,CAAC;AAC9C;AAEA,SAAS,aAAa,OAAgD;AACpE,SACE,MAAM,QAAQ,WAAW,KACzB,MAAM,UAAU,QAChB,MAAM,mBAAmB,QACzB,MAAM,eAAe,QACrB,MAAM,qBAAqB;AAE/B;AAEA,SAAS,aACP,OACA,OAMiC;AACjC,SACE,UAAU,QACV,MAAM,gBAAgB,MAAM,YAAY,KAAK,KAC7C,MAAM,mBAAmB,MAAM,eAAe,KAAK,KACnD,MAAM,YAAY,MAAM,QAAQ,KAAK,KACrC,MAAM,YAAY,MAAM,QAAQ,KAAK;AAEzC;AAEA,SAAS,4BACP,oBACA,KACA,OACM;AACN,QAAM,eAAe,mBAAmB,IAAI,GAAG;AAC/C,MACE,iBACC,UAAU,QACT,MAAM,UAAU,QAChB,CAAC,MAAM,QAAQ,KAAK,CAAC,WAAW,OAAO,OAAO,aAAa,QAAQ,IACrE;AACA,uBAAmB,OAAO,GAAG;AAAA,EAC/B;AACF;","names":[]}
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  translate,
11
11
  useTranslation
12
- } from "./chunk-UWBX3DZK.js";
12
+ } from "./chunk-6ULTMCKP.js";
13
13
 
14
14
  // agent-gui/agentGuiNode/agentRichText/agentFileMentionExtension.ts
15
15
  import { mergeAttributes, Node } from "@tiptap/core";
@@ -1437,4 +1437,4 @@ export {
1437
1437
  mentionItemToAttrs,
1438
1438
  attrsToMentionItem
1439
1439
  };
1440
- //# sourceMappingURL=chunk-XZPAU7FC.js.map
1440
+ //# sourceMappingURL=chunk-NOTZW5WH.js.map
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  translate,
9
9
  useTranslation
10
- } from "./chunk-UWBX3DZK.js";
10
+ } from "./chunk-6ULTMCKP.js";
11
11
  import {
12
12
  resolveAgentWorkspaceFileVisualKind
13
13
  } from "./chunk-PJP5BUU6.js";
@@ -260,8 +260,10 @@ import {
260
260
  useContext as useContext2,
261
261
  memo,
262
262
  useMemo,
263
+ useRef as useRef3,
263
264
  useState as useState4
264
265
  } from "react";
266
+ import { Check, Copy } from "lucide-react";
265
267
 
266
268
  // app/renderer/components/ZoomableImage.tsx
267
269
  import {
@@ -291,8 +293,6 @@ import {
291
293
  useRef,
292
294
  useState
293
295
  } from "react";
294
-
295
- // app/renderer/components/ui/context-menu.tsx
296
296
  import {
297
297
  ContextMenu,
298
298
  ContextMenuContent,
@@ -1957,7 +1957,8 @@ function AgentMessageMarkdown({
1957
1957
  p: (props) => /* @__PURE__ */ jsx4(MarkdownParagraph, { ...props, inline }),
1958
1958
  ul: MarkdownUnorderedList,
1959
1959
  ol: MarkdownOrderedList,
1960
- li: MarkdownListItem
1960
+ li: MarkdownListItem,
1961
+ pre: MarkdownPre
1961
1962
  }),
1962
1963
  [
1963
1964
  effectiveAgentTargets,
@@ -3188,6 +3189,43 @@ function textFromReactNode(node) {
3188
3189
  }
3189
3190
  return "";
3190
3191
  }
3192
+ function MarkdownPre({
3193
+ children,
3194
+ ...props
3195
+ }) {
3196
+ "use memo";
3197
+ const preRef = useRef3(null);
3198
+ const [copied, setCopied] = useState4(false);
3199
+ const copyResetRef = useRef3(null);
3200
+ const handleCopy = useCallback3(() => {
3201
+ const text = preRef.current?.textContent?.trim();
3202
+ if (!text) {
3203
+ return;
3204
+ }
3205
+ void navigator.clipboard?.writeText(text).then(() => {
3206
+ setCopied(true);
3207
+ if (copyResetRef.current) {
3208
+ clearTimeout(copyResetRef.current);
3209
+ }
3210
+ copyResetRef.current = setTimeout(() => setCopied(false), 1500);
3211
+ });
3212
+ }, []);
3213
+ return /* @__PURE__ */ jsxs3("div", { className: "group relative", children: [
3214
+ /* @__PURE__ */ jsx4(
3215
+ "button",
3216
+ {
3217
+ type: "button",
3218
+ "data-testid": "markdown-code-copy",
3219
+ className: "absolute right-1.5 top-1.5 z-10 inline-flex size-5 items-center justify-center rounded-[4px] text-[var(--text-tertiary)] opacity-0 transition-opacity hover:bg-[var(--transparency-hover)] hover:text-[var(--text-secondary)] group-hover:opacity-100",
3220
+ "aria-label": translate("agentHost.agentGui.copyCode"),
3221
+ title: translate("agentHost.agentGui.copyCode"),
3222
+ onClick: handleCopy,
3223
+ children: copied ? /* @__PURE__ */ jsx4(Check, { size: 13, strokeWidth: 2, "aria-hidden": "true" }) : /* @__PURE__ */ jsx4(Copy, { size: 13, strokeWidth: 2, "aria-hidden": "true" })
3224
+ }
3225
+ ),
3226
+ /* @__PURE__ */ jsx4("pre", { ...props, ref: preRef, children })
3227
+ ] });
3228
+ }
3191
3229
 
3192
3230
  // agent-gui/agentGuiNode/AgentGUIConversation.styles.ts
3193
3231
  var styles = {
@@ -3229,7 +3267,7 @@ import {
3229
3267
  forwardRef,
3230
3268
  useCallback as useCallback4,
3231
3269
  useEffect as useEffect4,
3232
- useRef as useRef3,
3270
+ useRef as useRef4,
3233
3271
  useState as useState5
3234
3272
  } from "react";
3235
3273
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
@@ -3243,8 +3281,8 @@ function CustomScrollbar({
3243
3281
  syncKey
3244
3282
  }) {
3245
3283
  "use memo";
3246
- const trackRef = useRef3(null);
3247
- const dragStateRef = useRef3(null);
3284
+ const trackRef = useRef4(null);
3285
+ const dragStateRef = useRef4(null);
3248
3286
  const [scrollbarState, setScrollbarState] = useState5({
3249
3287
  scrollable: false,
3250
3288
  thumbHeight: 0,
@@ -3431,7 +3469,7 @@ var CustomScrollArea = forwardRef(function CustomScrollArea2({
3431
3469
  ...viewportProps
3432
3470
  }, forwardedRef) {
3433
3471
  "use memo";
3434
- const viewportRef = useRef3(null);
3472
+ const viewportRef = useRef4(null);
3435
3473
  const getViewport = useCallback4(() => viewportRef.current, []);
3436
3474
  return /* @__PURE__ */ jsxs4(
3437
3475
  "div",
@@ -3488,7 +3526,7 @@ import {
3488
3526
  useCallback as useCallback5,
3489
3527
  useEffect as useEffect5,
3490
3528
  useImperativeHandle,
3491
- useRef as useRef4
3529
+ useRef as useRef5
3492
3530
  } from "react";
3493
3531
  import {
3494
3532
  motion,
@@ -3539,7 +3577,7 @@ var MessageSquareMoreIcon = forwardRef2(
3539
3577
  }, ref) => {
3540
3578
  const controls = useAnimation();
3541
3579
  const reduceMotion = useReducedMotion();
3542
- const isControlledRef = useRef4(false);
3580
+ const isControlledRef = useRef5(false);
3543
3581
  const startAnimation = useCallback5(() => {
3544
3582
  if (reduceMotion) {
3545
3583
  return;
@@ -3659,4 +3697,4 @@ export {
3659
3697
  CustomScrollArea,
3660
3698
  MessageSquareMoreIcon
3661
3699
  };
3662
- //# sourceMappingURL=chunk-IDTB6OID.js.map
3700
+ //# sourceMappingURL=chunk-T3KGZV35.js.map