@copylee/dsh-computer-use 0.7.1 → 0.7.2
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 +21 -11
- package/lib/types/effort.d.ts +11 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2164,22 +2164,32 @@ function resolveConfig(raw) {
|
|
|
2164
2164
|
* is "look at the screenshot, pick the next click". Deliberating over that
|
|
2165
2165
|
* costs seconds per step and is what makes the motion feel halting, so those
|
|
2166
2166
|
* requests can run at the model's lowest reasoning effort. Requests that are
|
|
2167
|
-
* not
|
|
2168
|
-
*
|
|
2167
|
+
* not part of operating (planning from the user's message, turns that never
|
|
2168
|
+
* touch the computer) keep the session's own setting.
|
|
2169
2169
|
*/
|
|
2170
2170
|
/**
|
|
2171
|
-
*
|
|
2172
|
-
*
|
|
2171
|
+
* Has this turn started operating the computer: is there a result of one of
|
|
2172
|
+
* this plugin's tools since the user's last message?
|
|
2173
|
+
*
|
|
2174
|
+
* It has to hold for the rest of the turn, not only right after such a result:
|
|
2175
|
+
* the replies written at the lowered effort carry no reasoning, and a provider
|
|
2176
|
+
* in thinking mode refuses a turn whose earlier tool-calling replies lack it
|
|
2177
|
+
* (DeepSeek: "content[].thinking ... must be passed back"). So once a turn has
|
|
2178
|
+
* a reply written without thinking, every later request of that turn goes
|
|
2179
|
+
* without it too.
|
|
2173
2180
|
*/
|
|
2174
2181
|
function isOperating(messages, ownTools) {
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2182
|
+
let start = messages.length;
|
|
2183
|
+
while (start > 0 && messages[start - 1]?.role !== "user") start--;
|
|
2184
|
+
const names = /* @__PURE__ */ new Map();
|
|
2185
|
+
for (let index = start; index < messages.length; index++) {
|
|
2178
2186
|
const message = messages[index];
|
|
2179
|
-
if (message
|
|
2180
|
-
|
|
2181
|
-
if (
|
|
2182
|
-
|
|
2187
|
+
if (message?.role === "assistant" && Array.isArray(message.content)) {
|
|
2188
|
+
for (const part of message.content) if (part.type === "tool-call" && typeof part.id === "string" && typeof part.name === "string") names.set(part.id, part.name);
|
|
2189
|
+
} else if (message?.role === "tool" && typeof message.toolCallId === "string") {
|
|
2190
|
+
const name = names.get(message.toolCallId);
|
|
2191
|
+
if (name !== void 0 && ownTools.has(name)) return true;
|
|
2192
|
+
}
|
|
2183
2193
|
}
|
|
2184
2194
|
return false;
|
|
2185
2195
|
}
|
package/lib/types/effort.d.ts
CHANGED
|
@@ -3,12 +3,19 @@
|
|
|
3
3
|
* is "look at the screenshot, pick the next click". Deliberating over that
|
|
4
4
|
* costs seconds per step and is what makes the motion feel halting, so those
|
|
5
5
|
* requests can run at the model's lowest reasoning effort. Requests that are
|
|
6
|
-
* not
|
|
7
|
-
*
|
|
6
|
+
* not part of operating (planning from the user's message, turns that never
|
|
7
|
+
* touch the computer) keep the session's own setting.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Has this turn started operating the computer: is there a result of one of
|
|
11
|
+
* this plugin's tools since the user's last message?
|
|
12
|
+
*
|
|
13
|
+
* It has to hold for the rest of the turn, not only right after such a result:
|
|
14
|
+
* the replies written at the lowered effort carry no reasoning, and a provider
|
|
15
|
+
* in thinking mode refuses a turn whose earlier tool-calling replies lack it
|
|
16
|
+
* (DeepSeek: "content[].thinking ... must be passed back"). So once a turn has
|
|
17
|
+
* a reply written without thinking, every later request of that turn goes
|
|
18
|
+
* without it too.
|
|
12
19
|
*/
|
|
13
20
|
export declare function isOperating(messages: readonly unknown[], ownTools: ReadonlySet<string>): boolean;
|
|
14
21
|
/** The lowest reasoning effort a model offers, or undefined when it offers none we recognise. */
|
package/package.json
CHANGED