dsh-plugin-prompt-tool 2.0.0 → 2.0.1
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/client.js +848 -217
- package/lib/client.js.map +1 -1
- package/package.json +1 -1
- package/engine/trigger-editor-meta.mjs +0 -29
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/** 声明编辑目录:类别、支持面和执行点来自实际编译器,示例仅提供可编辑的起点。 */
|
|
2
|
-
import { ACTION_KINDS, actionExecutionPoint, actionSupportsWhen } from './actions.mjs'
|
|
3
|
-
import { COMPOSITE_OPERATORS, PREDICATE_FACTORIES, compileDeclaration, compileWhen } from './trigger-spec.mjs'
|
|
4
|
-
import { WATERFALL_POSITIONS } from './trigger.mjs'
|
|
5
|
-
|
|
6
|
-
import { PREDICATE_EXAMPLES } from './conditions/examples.mjs'
|
|
7
|
-
import { ACTION_EXAMPLES } from './actions/examples.mjs'
|
|
8
|
-
|
|
9
|
-
/** 每次返回独立的纯数据;调用方编辑草稿不会污染后续请求或引擎目录。 */
|
|
10
|
-
export function getTriggerEditorMeta() {
|
|
11
|
-
const predicates = Object.keys(PREDICATE_FACTORIES).map((kind) => {
|
|
12
|
-
if (!Object.hasOwn(PREDICATE_EXAMPLES, kind)) throw new TypeError(`trigger-editor-meta: missing ${kind} predicate example`)
|
|
13
|
-
return { kind, example: { [kind]: structuredClone(PREDICATE_EXAMPLES[kind]) } }
|
|
14
|
-
})
|
|
15
|
-
for (const kind of COMPOSITE_OPERATORS) {
|
|
16
|
-
const child = { phase: { promoted: false } }
|
|
17
|
-
predicates.push({ kind, example: { [kind]: kind === 'not' ? child : [child] } })
|
|
18
|
-
}
|
|
19
|
-
for (const { example } of predicates) compileWhen(example)
|
|
20
|
-
|
|
21
|
-
const actions = Object.keys(ACTION_KINDS).map((kind) => {
|
|
22
|
-
if (!Object.hasOwn(ACTION_EXAMPLES, kind)) throw new TypeError(`trigger-editor-meta: missing ${kind} action example`)
|
|
23
|
-
const example = { kind, ...structuredClone(ACTION_EXAMPLES[kind]) }
|
|
24
|
-
const { channel, phase } = actionExecutionPoint(example)
|
|
25
|
-
compileDeclaration({ id: kind, channel, phase, do: example })
|
|
26
|
-
return { kind, example, channel, phase, supportsWhen: actionSupportsWhen(kind) }
|
|
27
|
-
})
|
|
28
|
-
return { predicates, actions, composites: [...COMPOSITE_OPERATORS], waterfallPositions: [...WATERFALL_POSITIONS] }
|
|
29
|
-
}
|