@design.estate/dees-catalog 4.1.0 → 4.2.0
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.
- package/dist_bundle/bundle.js +1438 -1298
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-tool-card/dees-harness-tool-card.d.ts +5 -3
- package/dist_ts_web/elements/00group-harness/dees-harness-tool-card/dees-harness-tool-card.js +43 -129
- package/dist_ts_web/elements/00group-harness/dees-harness-tool-card/dees-harness-tool-fullscreen.d.ts +26 -0
- package/dist_ts_web/elements/00group-harness/dees-harness-tool-card/dees-harness-tool-fullscreen.js +211 -0
- package/dist_ts_web/elements/00group-harness/dees-harness-tool-card/renderers.d.ts +15 -0
- package/dist_ts_web/elements/00group-harness/dees-harness-tool-card/renderers.js +85 -1
- package/dist_ts_web/elements/00group-harness/toolregistry.js +13 -2
- package/package.json +1 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-harness/dees-harness-tool-card/dees-harness-tool-card.ts +33 -121
- package/ts_web/elements/00group-harness/dees-harness-tool-card/dees-harness-tool-fullscreen.ts +168 -0
- package/ts_web/elements/00group-harness/dees-harness-tool-card/renderers.ts +86 -0
- package/ts_web/elements/00group-harness/toolregistry.ts +10 -1
|
@@ -29,6 +29,71 @@ const filePathOf = (call: IHarnessToolCall): string => {
|
|
|
29
29
|
return String(input.path ?? input.filePath ?? input.file ?? '');
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
interface IApplyPatchFile {
|
|
33
|
+
op: 'add' | 'update' | 'delete';
|
|
34
|
+
path: string;
|
|
35
|
+
before: string;
|
|
36
|
+
after: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Parses the apply_patch envelope (`*** Begin Patch` / `*** Add|Update|Delete
|
|
41
|
+
* File: path` / `+`/`-`/context lines) that patch-oriented models emit,
|
|
42
|
+
* reconstructing before/after content per file so updates render as diffs.
|
|
43
|
+
*/
|
|
44
|
+
export const parseApplyPatch = (patchText: string): IApplyPatchFile[] => {
|
|
45
|
+
const files: IApplyPatchFile[] = [];
|
|
46
|
+
let current: { op: IApplyPatchFile['op']; path: string; before: string[]; after: string[] } | null = null;
|
|
47
|
+
const flush = (): void => {
|
|
48
|
+
if (!current) return;
|
|
49
|
+
files.push({
|
|
50
|
+
op: current.op,
|
|
51
|
+
path: current.path,
|
|
52
|
+
before: current.before.join('\n'),
|
|
53
|
+
after: current.after.join('\n'),
|
|
54
|
+
});
|
|
55
|
+
current = null;
|
|
56
|
+
};
|
|
57
|
+
for (const line of patchText.split('\n')) {
|
|
58
|
+
const header = line.match(/^\*\*\* (Add|Update|Delete) File: (.+)$/);
|
|
59
|
+
if (header) {
|
|
60
|
+
flush();
|
|
61
|
+
current = {
|
|
62
|
+
op: header[1].toLowerCase() as IApplyPatchFile['op'],
|
|
63
|
+
path: header[2].trim(),
|
|
64
|
+
before: [],
|
|
65
|
+
after: [],
|
|
66
|
+
};
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (/^\*\*\* (Begin|End) Patch/.test(line) || /^\*\*\* Move to: /.test(line)) {
|
|
70
|
+
if (/End Patch/.test(line)) flush();
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (!current) continue;
|
|
74
|
+
if (line.startsWith('@@')) continue;
|
|
75
|
+
if (line.startsWith('+')) {
|
|
76
|
+
current.after.push(line.slice(1));
|
|
77
|
+
} else if (line.startsWith('-')) {
|
|
78
|
+
current.before.push(line.slice(1));
|
|
79
|
+
} else {
|
|
80
|
+
const text = line.startsWith(' ') ? line.slice(1) : line;
|
|
81
|
+
current.before.push(text);
|
|
82
|
+
current.after.push(text);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
flush();
|
|
86
|
+
return files;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/** First file path named in an apply_patch envelope, for subtitles. */
|
|
90
|
+
export const applyPatchFirstPath = (call: IHarnessToolCall): string => {
|
|
91
|
+
const patchText = inputRecord(call).patchText;
|
|
92
|
+
if (typeof patchText !== 'string') return '';
|
|
93
|
+
const match = patchText.match(/^\*\*\* (?:Add|Update|Delete) File: (.+)$/m);
|
|
94
|
+
return match ? match[1].trim() : '';
|
|
95
|
+
};
|
|
96
|
+
|
|
32
97
|
const renderTerminal = (call: IHarnessToolCall, helpers: IHarnessToolRenderHelpers): TemplateResult => {
|
|
33
98
|
const input = inputRecord(call);
|
|
34
99
|
const command = String(input.command ?? '');
|
|
@@ -63,6 +128,27 @@ const renderFileRead = (call: IHarnessToolCall, helpers: IHarnessToolRenderHelpe
|
|
|
63
128
|
|
|
64
129
|
const renderFileWrite = (call: IHarnessToolCall, helpers: IHarnessToolRenderHelpers): TemplateResult => {
|
|
65
130
|
const input = inputRecord(call);
|
|
131
|
+
// Patch-envelope tools (apply_patch) carry everything in patchText.
|
|
132
|
+
if (typeof input.patchText === 'string' && input.patchText.includes('*** ')) {
|
|
133
|
+
const files = parseApplyPatch(input.patchText);
|
|
134
|
+
if (files.length > 0) {
|
|
135
|
+
return html`${files.map((file) => {
|
|
136
|
+
const patchFilename = file.path.split('/').pop() || undefined;
|
|
137
|
+
const patchLanguage = harnessLanguageForPath(file.path);
|
|
138
|
+
if (file.op === 'update') {
|
|
139
|
+
return helpers.diffBlock(file.before, file.after, {
|
|
140
|
+
language: patchLanguage,
|
|
141
|
+
filename: patchFilename,
|
|
142
|
+
view: 'split',
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (file.op === 'add') {
|
|
146
|
+
return helpers.codeBlock(file.after, patchLanguage, patchFilename);
|
|
147
|
+
}
|
|
148
|
+
return helpers.keyValues([['deleted', file.path]]);
|
|
149
|
+
})}`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
66
152
|
const path = filePathOf(call);
|
|
67
153
|
// Covers both conventions: whole-file writes (content/newContent) and
|
|
68
154
|
// string-replacement edits à la OpenCode/Claude (oldString/newString).
|
|
@@ -100,7 +100,16 @@ const defaultDescriptors: IHarnessToolDescriptor[] = [
|
|
|
100
100
|
names: ['write_file', 'write', 'edit', 'edit_file', 'apply_patch', 'patch'],
|
|
101
101
|
label: 'Write',
|
|
102
102
|
icon: 'lucide:FilePen',
|
|
103
|
-
subtitle: (call) =>
|
|
103
|
+
subtitle: (call) => {
|
|
104
|
+
const path = filePathOf(call);
|
|
105
|
+
if (path) return path;
|
|
106
|
+
const patchText = harnessIsRecord(call.input) ? call.input.patchText : undefined;
|
|
107
|
+
if (typeof patchText === 'string') {
|
|
108
|
+
const match = patchText.match(/^\*\*\* (?:Add|Update|Delete) File: (.+)$/m);
|
|
109
|
+
if (match) return match[1].trim();
|
|
110
|
+
}
|
|
111
|
+
return harnessSummaryLine(call.input);
|
|
112
|
+
},
|
|
104
113
|
},
|
|
105
114
|
{
|
|
106
115
|
kind: 'file-delete',
|