letagents 0.12.22 → 0.12.24

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.
@@ -0,0 +1,9 @@
1
+ export type MarkdownTool = 'bold' | 'italic' | 'strike' | 'heading' | 'bullet' | 'number' | 'check' | 'quote' | 'code' | 'link';
2
+ export interface TaskContentPatch {
3
+ title?: string;
4
+ description?: string;
5
+ expected_content: { title?: string; description?: string };
6
+ }
7
+ export function taskContentPatch(original: { title: string; description: string }, draft: { title: string; description: string }): TaskContentPatch;
8
+ export const markdownTools: ReadonlyArray<{ id: MarkdownTool; label: string; symbol: string }>;
9
+ export function applyMarkdownTool(value: string, start: number, end: number, tool: MarkdownTool): { value: string; start: number; end: number };
@@ -0,0 +1,53 @@
1
+ export const markdownTools = [
2
+ { id: 'bold', label: 'Bold', symbol: 'B' },
3
+ { id: 'italic', label: 'Italic', symbol: 'I' },
4
+ { id: 'strike', label: 'Strikethrough', symbol: 'S' },
5
+ { id: 'heading', label: 'Heading', symbol: 'H2' },
6
+ { id: 'bullet', label: 'Bullet list', symbol: 'List' },
7
+ { id: 'number', label: 'Numbered list', symbol: '1.' },
8
+ { id: 'check', label: 'Checklist', symbol: '[ ]' },
9
+ { id: 'quote', label: 'Quote', symbol: 'Quote' },
10
+ { id: 'code', label: 'Code block', symbol: '</>' },
11
+ { id: 'link', label: 'Link', symbol: 'Link' },
12
+ ];
13
+
14
+ export function taskContentPatch(original, draft) {
15
+ const patch = { expected_content: {} };
16
+ for (const field of ['title', 'description']) {
17
+ if (draft[field] !== original[field]) {
18
+ patch[field] = draft[field];
19
+ patch.expected_content[field] = original[field];
20
+ }
21
+ }
22
+ return patch;
23
+ }
24
+
25
+ export function applyMarkdownTool(value, start, end, tool) {
26
+ const selected = value.slice(start, end);
27
+ const wrappers = { bold: ['**', '**'], italic: ['_', '_'], strike: ['~~', '~~'], link: ['[', '](https://)'] };
28
+ const wrapper = wrappers[tool];
29
+ if (wrapper) {
30
+ const text = selected || 'text';
31
+ return {
32
+ value: value.slice(0, start) + wrapper[0] + text + wrapper[1] + value.slice(end),
33
+ start: start + wrapper[0].length,
34
+ end: start + wrapper[0].length + text.length,
35
+ };
36
+ }
37
+ if (tool === 'code') {
38
+ const before = start > 0 && value[start - 1] !== '\n' ? '\n' : '';
39
+ const after = end < value.length && value[end] !== '\n' ? '\n' : '';
40
+ const text = selected || 'code';
41
+ const prefix = before + '```\n';
42
+ return { value: value.slice(0, start) + prefix + text + '\n```' + after + value.slice(end), start: start + prefix.length, end: start + prefix.length + text.length };
43
+ }
44
+ const prefixes = { heading: '## ', bullet: '- ', number: '1. ', check: '- [ ] ', quote: '> ' };
45
+ if (!(tool in prefixes)) return { value, start, end };
46
+ const lineStart = start === 0 ? 0 : value.lastIndexOf('\n', start - 1) + 1;
47
+ const selectionEnd = end > start && value[end - 1] === '\n' ? end - 1 : end;
48
+ const nextNewline = value.indexOf('\n', selectionEnd);
49
+ const lineEnd = nextNewline === -1 ? value.length : nextNewline;
50
+ const lines = value.slice(lineStart, lineEnd).split('\n');
51
+ const next = lines.map((line, index) => (tool === 'number' ? (index + 1) + '. ' : prefixes[tool]) + (line || 'text')).join('\n');
52
+ return { value: value.slice(0, lineStart) + next + value.slice(lineEnd), start: lineStart, end: lineStart + next.length };
53
+ }
@@ -0,0 +1,32 @@
1
+ .task-markdown { display: grid; gap: 8px; min-width: 0; }
2
+ .task-markdown > label { color: var(--text-secondary); font-size: 12px; font-weight: 550; }
3
+ .task-markdown-surface { border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; background: var(--bg-subtle); }
4
+ .task-markdown-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); }
5
+ .task-markdown-toolbar .task-markdown-tool { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 12px; cursor: pointer; }
6
+ .task-markdown-tool[data-tool=bold] { font-weight: 750; }
7
+ .task-markdown-tool[data-tool=italic] { font-style: italic; }
8
+ .task-markdown-tool[data-tool=strike] { text-decoration: line-through; }
9
+ .task-markdown-tool:disabled { opacity: 0.4; cursor: default; }
10
+ .task-markdown-tabs { display: flex; gap: 4px; margin-left: auto; }
11
+ .task-markdown-tabs button { min-height: 32px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 12px; cursor: pointer; }
12
+ .task-markdown-tabs button[aria-pressed=true] { background: var(--accent-dim); color: var(--text); }
13
+ .task-markdown textarea { display: block; width: 100%; min-height: 240px; max-height: 50vh; padding: 14px; border: 0; border-radius: 0; background: transparent; color: var(--text); font-family: var(--font-mono, monospace); font-size: 13px; line-height: 1.7; resize: vertical; }
14
+ .task-markdown textarea:focus { outline: 0; }
15
+ .task-markdown-surface:focus-within { border-color: var(--blue); }
16
+ .task-markdown-surface > .task-markdown-preview { min-height: 240px; max-height: 50vh; overflow: auto; padding: 14px; }
17
+ .task-markdown-preview { min-width: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
18
+ .task-markdown-preview :is(h1,h2,h3,h4,h5,h6) { margin: 20px 0 10px; color: var(--text); font-size: 16px; font-weight: 600; letter-spacing: 0; line-height: 1.5; }
19
+ .task-markdown-preview > :first-child { margin-top: 0; }
20
+ .task-markdown-preview > :last-child { margin-bottom: 0; }
21
+ .task-markdown-preview p { margin: 0 0 12px; white-space: normal; }
22
+ .task-markdown-preview :is(ul,ol) { margin: 12px 0; padding-left: 24px; }
23
+ .task-markdown-preview a { color: var(--blue); }
24
+ .task-markdown-preview code { font-family: var(--font-mono, monospace); padding: 2px 4px; border-radius: 3px; background: var(--accent-dim); font-size: 12px; }
25
+ .task-markdown-preview pre { max-width: 100%; margin: 12px 0; padding: 12px; overflow: auto; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 6px; }
26
+ .task-markdown-preview pre code { padding: 0; background: transparent; }
27
+ .task-markdown-preview blockquote { margin: 12px 0; padding-left: 14px; border-left: 2px solid var(--border-strong); }
28
+ .task-markdown-preview .markdown-task-checkbox { margin-right: 8px; accent-color: var(--blue); }
29
+ .task-markdown-preview li:has(> .markdown-task-checkbox) { list-style: none; }
30
+ .task-markdown :is(button, [tabindex]):focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
31
+ @media (hover: hover) and (pointer: fine) { .task-markdown-toolbar button:hover:not(:disabled) { background: var(--accent-hover); color: var(--text); } }
32
+ @media (max-width: 640px), (pointer: coarse) { .task-markdown-toolbar .task-markdown-tool { flex-basis: 40px; width: 40px; height: 40px; min-height: 40px; } .task-markdown-tabs button { min-height: 40px; } }
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <svg
3
+ viewBox="0 0 24 24"
4
+ fill="none"
5
+ stroke="currentColor"
6
+ stroke-width="1.6"
7
+ stroke-linecap="round"
8
+ stroke-linejoin="round"
9
+ aria-hidden="true"
10
+ >
11
+ <path :d="paths[name]" />
12
+ </svg>
13
+ </template>
14
+ <script setup lang="ts">
15
+ defineProps<{ name: keyof typeof paths }>();
16
+ const paths = {
17
+ chat: "M21 11.5a8.5 8.5 0 0 1-8.5 8.5H4l-2 2v-10A9 9 0 0 1 11 3h1.5a8.5 8.5 0 0 1 8.5 8.5ZM7 9h10M7 14h6",
18
+ plus: "M12 5v14M5 12h14",
19
+ search: "m21 21-5-5M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0",
20
+ back: "m14 6-6 6 6 6",
21
+ close: "m6 6 12 12M6 18 18 6",
22
+ send: "m5 12 7-7 7 7M12 5v15",
23
+ users:
24
+ "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M16 3a4 4 0 0 1 0 8M22 21v-2a4 4 0 0 0-3-3.87M13 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0",
25
+ more: "M5 12h.01M12 12h.01M19 12h.01",
26
+ check: "m5 12 4 4L19 6",
27
+ };
28
+ </script>