@ch4acko3/dsh-turn-fold 0.6.3 → 0.6.5
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/package.json +5 -7
- package/patch.cjs +30 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ch4acko3/dsh-turn-fold",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Codex-style turn folding for the DSH WebUI conversation, implemented as a dsh-harmony provider.",
|
|
5
5
|
"main": "./index.mjs",
|
|
6
6
|
"engines": {
|
|
@@ -49,16 +49,15 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
|
-
"
|
|
53
|
-
"check": "node test/run.cjs"
|
|
52
|
+
"check": "node --check index.cjs && node --check patch.cjs && node --check inline-source.cjs && node --check settings.cjs && node --check locales.cjs"
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
56
55
|
"@deepseek-ai/schemastery": "^3.18.4"
|
|
57
56
|
},
|
|
58
57
|
"peerDependencies": {
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-chat": ">=0.1.2-alpha.5 <0.1.3-0 || >=0.1.3-0 <0.1.4-0 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-0 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.1.8-0 || 0.2.0-rc.2",
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-conversation": ">=0.1.0-rc.8 <=0.1.1-rc.2 || >=0.1.2-alpha.5 <0.1.3-0 || >=0.1.3-0 <0.1.4-0 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-0 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.1.8-0 || 0.2.0-rc.2",
|
|
61
|
-
"@deepseek-ai/dsh-settings": ">=0.1.0-rc.8 <=0.1.1-rc.2 || >=0.1.2-alpha.5 <0.1.3-0 || >=0.1.3-0 <0.1.4-0 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-0 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.1.8-0 || 0.2.0-rc.2",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-chat": ">=0.1.2-alpha.5 <0.1.3-0 || >=0.1.3-0 <0.1.4-0 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-0 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.1.8-0 || 0.2.0-rc.2 || >=0.2.1-alpha.2 <0.3.0-0",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-conversation": ">=0.1.0-rc.8 <=0.1.1-rc.2 || >=0.1.2-alpha.5 <0.1.3-0 || >=0.1.3-0 <0.1.4-0 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-0 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.1.8-0 || 0.2.0-rc.2 || >=0.2.1-alpha.2 <0.3.0-0",
|
|
60
|
+
"@deepseek-ai/dsh-settings": ">=0.1.0-rc.8 <=0.1.1-rc.2 || >=0.1.2-alpha.5 <0.1.3-0 || >=0.1.3-0 <0.1.4-0 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-0 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.1.8-0 || 0.2.0-rc.2 || >=0.2.1-alpha.2 <0.3.0-0",
|
|
62
61
|
"dsh-harmony": "^0.8.11"
|
|
63
62
|
},
|
|
64
63
|
"peerDependenciesMeta": {
|
|
@@ -82,7 +81,6 @@
|
|
|
82
81
|
"@phenomnomnominal/tsquery": "^6.2.0",
|
|
83
82
|
"dsh-harmony": "^0.8.11",
|
|
84
83
|
"react": "18.3.1",
|
|
85
|
-
"react-test-renderer": "18.3.1",
|
|
86
84
|
"semver": "^7.8.5",
|
|
87
85
|
"typescript": "^6.0.3"
|
|
88
86
|
}
|
package/patch.cjs
CHANGED
|
@@ -52,6 +52,16 @@ function runtimeSource(version) {
|
|
|
52
52
|
if (modern) source = source
|
|
53
53
|
.replaceAll('IconApiOutline14', 'IconApiOutlineRegular')
|
|
54
54
|
.replaceAll('IconChevronDownOutline14', 'IconChevronDownOutlineRegular')
|
|
55
|
+
if (minor >= 2 || major > 0) source = `function __ch4acko3DshTurnFoldReasoningRow(props) {
|
|
56
|
+
return react_jsx_runtime.jsx(ReasoningRow, {
|
|
57
|
+
...props,
|
|
58
|
+
useDisclosure,
|
|
59
|
+
usePresentation: (select) => select({ settledReasoningPreview: false }),
|
|
60
|
+
renderSlot: (_name, content) => react_jsx_runtime.jsx(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
|
|
61
|
+
text: content.text, streaming: content.running, labels: markdownLabels(props.t), variant: "compact"
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}\n` + source.replaceAll('react_jsx_runtime.jsx(ReasoningRow,', 'react_jsx_runtime.jsx(__ch4acko3DshTurnFoldReasoningRow,')
|
|
55
65
|
return source
|
|
56
66
|
}
|
|
57
67
|
|
|
@@ -137,9 +147,29 @@ function dsh012Patches(version) {
|
|
|
137
147
|
}
|
|
138
148
|
|
|
139
149
|
function createPatches(version) {
|
|
150
|
+
if (/^0\.2\.[1-9]\d*(?:-|$)/.test(version)) return dsh021Patches(version)
|
|
140
151
|
return usesUiChat(version) ? dsh012Patches(version) : legacyPatches()
|
|
141
152
|
}
|
|
142
153
|
|
|
154
|
+
function dsh021Patches(version) {
|
|
155
|
+
return commonPatches(target('@deepseek-ai/dsh-client-ui-chat', '>=0.2.1-alpha.2 <0.3.0-0'), {
|
|
156
|
+
select: 'FunctionExpression[name.name="ChatFlow"]',
|
|
157
|
+
apply({ node, sourceFile, edit, query }) {
|
|
158
|
+
const rows = query('CallExpression[expression.name.name="map"][expression.expression.name="entries"]', node)
|
|
159
|
+
const flow = query('CallExpression').filter(call => call.expression.getText(sourceFile) === 'renderSlot' && call.arguments[0]?.getText(sourceFile) === '"conversation.chat.flow"')
|
|
160
|
+
if (rows.length !== 1 || flow.length !== 1) throw new Error('@ch4acko3/dsh-turn-fold: expected one ChatFlow render loop and slot')
|
|
161
|
+
const parameters = node.parameters[0].name
|
|
162
|
+
edit.prependLeft(parameters.getStart(sourceFile) + 1, 'sessionId, ')
|
|
163
|
+
edit.prependLeft(flow[0].arguments[1].getStart(sourceFile) + 1, 'sessionId, ')
|
|
164
|
+
edit.prependLeft(node.body.getStart(sourceFile) + 1, '\nconst order = useChat((snapshot) => snapshot.order);\nconst timeline = useChat((snapshot) => snapshot.timeline);\n')
|
|
165
|
+
const pending = query('CallExpression', node).find(call => call.expression.getText(sourceFile) === 'rows.splice')
|
|
166
|
+
if (!pending) throw new Error('@ch4acko3/dsh-turn-fold: pending input insertion is missing')
|
|
167
|
+
edit.overwrite(pending.arguments[0].getStart(sourceFile), pending.arguments[0].getEnd(), 'rows.length')
|
|
168
|
+
edit.overwrite(rows[0].getStart(sourceFile), rows[0].getEnd(), `__ch4acko3DshTurnFoldRender({ order: order.filter((key) => nodeStore.get(key)?.kind !== "turn-process"), nodeStore, timeline, sessionId, renderNode: (nodeKey) => (0, react.createElement)(ChatNodeSeat, { ...seatProps, usePresentation: (select) => usePresentation((policy) => select({ ...policy, foldCompletedTurns: false })), nodeKey, key: nodeKey }), t })`)
|
|
169
|
+
},
|
|
170
|
+
}, runtimeSource(version))
|
|
171
|
+
}
|
|
172
|
+
|
|
143
173
|
const patches = createPatches(activeDshVersion())
|
|
144
174
|
Object.defineProperties(patches, {
|
|
145
175
|
createPatches: { value: createPatches },
|