dsh-py-codeact 0.3.2 → 0.3.3
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 +6 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* So this is NOT a `CodeRuntime` backend — it could not conform. It is an ordinary tool plugin that owns its own kernel: one IPython process per conversation tree with a shell per agent, globals surviving between calls, the model's action space being Python code and its observation that cell's output.
|
|
7
7
|
*
|
|
8
|
-
* It
|
|
8
|
+
* It emits the session format's PTC dispatch events, so bridged tool calls render as SUBTOOL rows in the existing trajectory UI with no client change.
|
|
9
9
|
*
|
|
10
10
|
* @module dsh-py-codeact
|
|
11
11
|
*/
|
|
@@ -660,7 +660,9 @@ export function apply(ctx, config = {}) {
|
|
|
660
660
|
console.warn(`[dsh-py-codeact] no agent on execution ${exec.callId}: sub-calls will run but not appear as SUBTOOL rows`)
|
|
661
661
|
}
|
|
662
662
|
const trace = { rootCallId: exec.rootCallId, parentCallId: exec.callId, subCallId, name, arguments: args }
|
|
663
|
-
|
|
663
|
+
// V3 rejects the old Code Mode tags even though their payload is unchanged. Older hosts in our peer range still require them.
|
|
664
|
+
const dispatchEvent = session?.header?.version >= 3 ? 'tool/ptc-dispatch' : 'tool/code-dispatch'
|
|
665
|
+
session?.append(`${dispatchEvent}-start`, trace)
|
|
664
666
|
|
|
665
667
|
// Every outcome has to emit the terminal event, throws included: if `ctx.tools.execute` rejects rather than returning `{isError:true}` (an abort, a policy wrapper throwing), the Python side is still answered, but the SUBTOOL row would sit in the trajectory as "running" forever.
|
|
666
668
|
try {
|
|
@@ -674,7 +676,7 @@ export function apply(ctx, config = {}) {
|
|
|
674
676
|
signal: exec.signal,
|
|
675
677
|
})
|
|
676
678
|
|
|
677
|
-
session?.append(
|
|
679
|
+
session?.append(dispatchEvent, { ...trace, isError: outcome.isError, content: outcome.content })
|
|
678
680
|
// Pixels cannot travel through the bridge: `value` is JSON, so a `read_image` result reaches the cell as width/height/attachmentId and NOTHING to look at. Re-attach the blocks the way Code Mode does, and the image lands in the conversation right after this cell — the model sees it on its next step. Without this the model believes the call succeeded, gets metadata, and cannot tell why it still cannot see anything.
|
|
679
681
|
if (!outcome.isError && contentHasImage(outcome.content ?? [])) {
|
|
680
682
|
exec.deferContext(createUserMessage({ content: outcome.content, source: { kind: 'plugin', plugin: 'dsh-py-codeact' } }))
|
|
@@ -684,7 +686,7 @@ export function apply(ctx, config = {}) {
|
|
|
684
686
|
// falling back to the wrapper there would hand the cell the one shape it was promised not to see.
|
|
685
687
|
return toolCallReply(outcome, entry.envelopes.get(from)?.has(name))
|
|
686
688
|
} catch (error) {
|
|
687
|
-
session?.append(
|
|
689
|
+
session?.append(dispatchEvent, { ...trace, isError: true, content: [{ type: 'text', text: String(error?.message ?? error) }] })
|
|
688
690
|
throw error
|
|
689
691
|
}
|
|
690
692
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-py-codeact",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "CodeAct agent loop for the DeepSeek Harness: a persistent IPython session as the model's action space, with harness tools bridged in as a virtual `__dsh__.tools` module.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|