@windypro-rourou/dsh-eda 0.1.6 → 0.1.7
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/lib/index.js +17 -9
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1824,7 +1824,9 @@ function edaTaskTool(backend) {
|
|
|
1824
1824
|
action: '提交后台任务', result: r.ok ? `taskId=${r.taskId}` : '', error: r.ok ? '' : r.error,
|
|
1825
1825
|
durationMs: Date.now() - t0,
|
|
1826
1826
|
})
|
|
1827
|
-
return r.ok
|
|
1827
|
+
return r.ok
|
|
1828
|
+
? { ok: true, taskId: r.taskId, statusUrl: r.statusUrl ?? `/tasks/${r.taskId}` }
|
|
1829
|
+
: { ok: false, error: r.error }
|
|
1828
1830
|
}
|
|
1829
1831
|
|
|
1830
1832
|
if (action === 'get') {
|
|
@@ -1836,24 +1838,30 @@ function edaTaskTool(backend) {
|
|
|
1836
1838
|
const events = Array.isArray(t.events)
|
|
1837
1839
|
? t.events.slice(-20).map((e) => (typeof e === 'string' ? e : JSON.stringify(e)))
|
|
1838
1840
|
: []
|
|
1839
|
-
|
|
1841
|
+
// DSH 的 value 快照要求 lossless JSON:绝不能带 undefined 属性(逐一条件赋值)。
|
|
1842
|
+
const out = {
|
|
1840
1843
|
ok: true,
|
|
1841
1844
|
taskId: String(t.id ?? taskId),
|
|
1842
1845
|
status: typeof t.status === 'string' ? t.status : '',
|
|
1843
1846
|
phase: typeof t.phase === 'string' ? t.phase : '',
|
|
1844
|
-
elapsedMs: Number.isFinite(t.elapsedMs) ? Math.round(t.elapsedMs) : undefined,
|
|
1845
|
-
outcome: typeof t.result?.outcome === 'string' ? t.result.outcome : undefined,
|
|
1846
|
-
result: t.result !== undefined ? JSON.stringify(t.result).slice(0, 4000) : undefined,
|
|
1847
|
-
errorText: t.errorDetails ? JSON.stringify(t.errorDetails).slice(0, 2000) : undefined,
|
|
1848
1847
|
events,
|
|
1849
1848
|
}
|
|
1849
|
+
if (Number.isFinite(t.elapsedMs)) out.elapsedMs = Math.round(t.elapsedMs)
|
|
1850
|
+
if (typeof t.result?.outcome === 'string') out.outcome = t.result.outcome
|
|
1851
|
+
if (t.result !== undefined) { try { out.result = JSON.stringify(t.result).slice(0, 4000) } catch (e) {} }
|
|
1852
|
+
if (t.errorDetails) { try { out.errorText = JSON.stringify(t.errorDetails).slice(0, 2000) } catch (e) {} }
|
|
1853
|
+
return out
|
|
1850
1854
|
}
|
|
1851
1855
|
|
|
1852
1856
|
const r = await backend.listTasks()
|
|
1853
1857
|
if (!r.ok) return { ok: false, error: r.error }
|
|
1854
|
-
return { ok: true, tasks: r.tasks.map((t) =>
|
|
1855
|
-
id: t.id, status: t.status
|
|
1856
|
-
|
|
1858
|
+
return { ok: true, tasks: r.tasks.map((t) => {
|
|
1859
|
+
const row = { id: String(t.id ?? ''), status: typeof t.status === 'string' ? t.status : '' }
|
|
1860
|
+
if (typeof t.phase === 'string') row.phase = t.phase
|
|
1861
|
+
if (Number.isFinite(t.elapsedMs)) row.elapsedMs = Math.round(t.elapsedMs)
|
|
1862
|
+
if (typeof t.outcome === 'string') row.outcome = t.outcome
|
|
1863
|
+
return row
|
|
1864
|
+
}) }
|
|
1857
1865
|
},
|
|
1858
1866
|
})
|
|
1859
1867
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windypro-rourou/dsh-eda",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "dsh-lichuang-eda (JCL-EDA): 嘉立创 EDA 助手 DSH 插件 —— 官方 eda.* API 云端实时生成(原理图/PCB)+ 离线标准版 JSON 兜底 + 面板记录式时间线(撤回/清空/紧急保存)。开箱即用:npm i 后 cordis.patch.yml insert 一行即挂载。",
|
|
6
6
|
"packageManager": "pnpm@11.22.0",
|