@deepseek-ai/dsh-workflow-ptc 0.2.2-rc.5 → 0.2.3-alpha.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/README.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +29 -7
- package/lib/types/guest-source.d.ts +1 -1
- package/lib/types/guest-source.d.ts.map +1 -1
- package/lib/types/guest-source.js.map +1 -1
- package/lib/types/host.d.ts +2 -1
- package/lib/types/host.d.ts.map +1 -1
- package/lib/types/host.js.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/runtime.d.ts.map +1 -1
- package/lib/types/runtime.js.map +1 -1
- package/package.json +41 -40
- package/src/guest-source.ts +1 -1
- package/src/host.ts +19 -3
- package/src/index.ts +5 -2
- package/src/runtime.ts +9 -11
package/src/runtime.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import * as vm from 'node:vm'
|
|
9
9
|
import { brandString } from '@deepseek-ai/dsh-brand'
|
|
10
|
-
import
|
|
10
|
+
import { extractTextContent } from '@deepseek-ai/dsh-llm/message'
|
|
11
11
|
import type { SessionId } from '@deepseek-ai/dsh-session'
|
|
12
12
|
import { assertObjectJsonSchema, JsonSchemaError } from '@deepseek-ai/dsh-tools'
|
|
13
13
|
import type { ObjectJsonSchema } from '@deepseek-ai/dsh-tools'
|
|
@@ -34,14 +34,6 @@ const SUPPORTED_AGENT_OPTIONS = new Set(['label', 'phase', 'schema', 'provider',
|
|
|
34
34
|
/** Deferred Claude Code options we name explicitly in the rejection message. */
|
|
35
35
|
const DEFERRED_AGENT_OPTIONS = new Set(['effort', 'isolation', 'agentType'])
|
|
36
36
|
|
|
37
|
-
/** Flatten a child's final output blocks to text (the non-schema `agent()` result). */
|
|
38
|
-
function outputText(blocks: ContentBlock[]): string {
|
|
39
|
-
return blocks
|
|
40
|
-
.filter((block): block is Extract<ContentBlock, { type: 'text' }> => block.type === 'text')
|
|
41
|
-
.map(block => block.text)
|
|
42
|
-
.join('')
|
|
43
|
-
}
|
|
44
|
-
|
|
45
37
|
/** A short display label derived from the prompt when the script passes none. */
|
|
46
38
|
function defaultLabel(prompt: string): string {
|
|
47
39
|
const newline = prompt.indexOf('\n')
|
|
@@ -109,7 +101,13 @@ export class WorkflowExecution {
|
|
|
109
101
|
const value = raw === undefined ? null : this.materializeResult(raw)
|
|
110
102
|
return { value, stopReason: 'completed', agentsStarted: this.started }
|
|
111
103
|
} catch (error: unknown) {
|
|
112
|
-
return {
|
|
104
|
+
return {
|
|
105
|
+
value: null,
|
|
106
|
+
stopReason: 'error',
|
|
107
|
+
error: renderThrown(error),
|
|
108
|
+
...error instanceof WorkflowError ? { errorCode: error.code } : {},
|
|
109
|
+
agentsStarted: this.started,
|
|
110
|
+
}
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
113
|
|
|
@@ -216,7 +214,7 @@ export class WorkflowExecution {
|
|
|
216
214
|
return result.structured
|
|
217
215
|
}
|
|
218
216
|
this.observer.agentEnd({ ...info, outcome: 'completed' })
|
|
219
|
-
return
|
|
217
|
+
return extractTextContent(result.output)
|
|
220
218
|
}
|
|
221
219
|
this.observer.agentEnd({ ...info, outcome: 'failed' })
|
|
222
220
|
return null
|