@widgetic/creator 0.4.42 → 0.4.43
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/CreatorApp.svelte +419 -34
- package/dist/components/BrandKitPanel.svelte.d.ts +1 -1
- package/dist/components/EmbeddedSketchViewportShell.svelte +49 -0
- package/dist/components/EmbeddedSketchViewportShell.svelte.d.ts +13 -0
- package/dist/components/WidgetDetails.svelte +23 -10
- package/dist/components/WidgetDetails.svelte.d.ts +4 -0
- package/dist/embeddedSketchLayout.d.ts +9 -0
- package/dist/embeddedSketchLayout.js +17 -0
- package/dist/i18n/language.d.ts +8 -7
- package/dist/i18n/messages.d.ts +1 -2
- package/dist/i18n/messages.js +2 -2
- package/dist/sketchBoardVisibility.d.ts +17 -0
- package/dist/sketchBoardVisibility.js +22 -0
- package/dist/sketchChatDraftPrefill.d.ts +25 -0
- package/dist/sketchChatDraftPrefill.js +82 -0
- package/dist/utils/codegenStatusTails.d.ts +23 -0
- package/dist/utils/codegenStatusTails.js +77 -0
- package/package.json +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status metadata tails pushed while widget codegen runs (see gateway operation.metadata).
|
|
3
|
+
*/
|
|
4
|
+
export function readGenerationStreamTail(metadata) {
|
|
5
|
+
if (!metadata)
|
|
6
|
+
return '';
|
|
7
|
+
const raw = metadata.streamTail ?? metadata.stream_tail;
|
|
8
|
+
return typeof raw === 'string' ? raw.slice(-1600) : '';
|
|
9
|
+
}
|
|
10
|
+
export function readThinkingTail(metadata) {
|
|
11
|
+
if (!metadata)
|
|
12
|
+
return '';
|
|
13
|
+
const raw = metadata.thinkingTail ?? metadata.thinking_tail;
|
|
14
|
+
return typeof raw === 'string' ? raw.slice(-2400) : '';
|
|
15
|
+
}
|
|
16
|
+
const MAX_PLAN_TASKS = 20;
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
function coerceLabel(label) {
|
|
21
|
+
if (typeof label === 'string')
|
|
22
|
+
return label;
|
|
23
|
+
if (label == null)
|
|
24
|
+
return '';
|
|
25
|
+
return String(label);
|
|
26
|
+
}
|
|
27
|
+
function parseWidgetPlan(value) {
|
|
28
|
+
if (!isRecord(value))
|
|
29
|
+
return null;
|
|
30
|
+
if (!Array.isArray(value.tasks))
|
|
31
|
+
return null;
|
|
32
|
+
const tasks = [];
|
|
33
|
+
for (const raw of value.tasks) {
|
|
34
|
+
if (!isRecord(raw))
|
|
35
|
+
continue;
|
|
36
|
+
if (typeof raw.id !== 'string' || raw.id.trim() === '')
|
|
37
|
+
continue;
|
|
38
|
+
tasks.push({
|
|
39
|
+
id: raw.id,
|
|
40
|
+
label: coerceLabel(raw.label),
|
|
41
|
+
...(typeof raw.kind === 'string' ? { kind: raw.kind } : {}),
|
|
42
|
+
status: ['pending', 'in_progress', 'done', 'failed'].includes(raw.status)
|
|
43
|
+
? raw.status
|
|
44
|
+
: 'pending',
|
|
45
|
+
});
|
|
46
|
+
if (tasks.length >= MAX_PLAN_TASKS)
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
if (tasks.length === 0)
|
|
50
|
+
return null;
|
|
51
|
+
const title = typeof value.title === 'string' ? value.title : '';
|
|
52
|
+
const completed = typeof value.completed === 'number' && Number.isFinite(value.completed)
|
|
53
|
+
? Math.max(0, Math.floor(value.completed))
|
|
54
|
+
: undefined;
|
|
55
|
+
const activeIndex = value.activeIndex === null
|
|
56
|
+
? null
|
|
57
|
+
: typeof value.activeIndex === 'number' && Number.isFinite(value.activeIndex)
|
|
58
|
+
? Math.floor(value.activeIndex)
|
|
59
|
+
: undefined;
|
|
60
|
+
return {
|
|
61
|
+
title,
|
|
62
|
+
tasks,
|
|
63
|
+
...(completed !== undefined ? { completed } : {}),
|
|
64
|
+
...(activeIndex !== undefined ? { activeIndex } : {}),
|
|
65
|
+
...(value.decisions !== undefined ? { decisions: value.decisions } : {}),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Reads `metadata.plan`. Missing key → `undefined` (leave UI as-is); `null` → hide; bad shape → `null`.
|
|
70
|
+
*/
|
|
71
|
+
export function readPlanFromMetadata(metadata) {
|
|
72
|
+
if (!metadata || !Object.prototype.hasOwnProperty.call(metadata, 'plan'))
|
|
73
|
+
return undefined;
|
|
74
|
+
if (metadata.plan === null)
|
|
75
|
+
return null;
|
|
76
|
+
return parseWidgetPlan(metadata.plan);
|
|
77
|
+
}
|