Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.2 KB
Raw Blame
/** File modifications: +/− badge in the row, Pierre-rendered diffs in the body. */

import type { ToolDetail } from '@service-agent-fold/generated/types';
import { createMemo, Show } from 'solid-js';
import { countDiffChanges } from '../../state/session-summary';
import { DiffChanges, PierreDiff, ToolCard } from '../../ui';
import { pathsSubtitle, type ToolCallCommon } from './shared';

export function EditToolCall(props: {
  detail: Extract<ToolDetail, { kind: 'edit' }>;
  common: ToolCallCommon;
}) {
  const changes = createMemo(() => countDiffChanges(props.detail.diffs));
  const hasChanges = () => changes().additions + changes().deletions > 0;

  return (
    <ToolCard
      title={props.common.label}
      subtitle={pathsSubtitle(props.detail.diffs.map((diff) => diff.path))}
      trailing={
        props.common.trailing ??
        (props.common.status === 'completed' && hasChanges() ? (
          <DiffChanges {...changes()} />
        ) : undefined)
      }
      status={props.common.status}
      muted={props.common.muted}
      hasContent={props.detail.diffs.length > 0}
    >
      <Show when={props.detail.diffs.length > 0}>
        <PierreDiff diffs={props.detail.diffs} />
      </Show>
    </ToolCard>
  );
}