vibe64 0.1.21 → 0.1.22
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/dist/assets/ProjectTypeGate-B3NHteXC.js +1 -0
- package/dist/assets/ProjectTypeGate-fJcYj6sR.css +1 -0
- package/dist/assets/{SetupReadinessGate-DkkorR2Y.js → SetupReadinessGate-2twHjoYZ.js} +1 -1
- package/dist/assets/{ShellLayout-BcKS2HG9.js → ShellLayout-BjAbXfzf.js} +1 -1
- package/dist/assets/{VTabs-BJ8MKoig.js → VTabs-BLGGdbms.js} +1 -1
- package/dist/assets/{error-CwT53qTu.js → error-DvUPciuh.js} +1 -1
- package/dist/assets/history-DfM4ewyV.js +1 -0
- package/dist/assets/home-sh4v0vz7.js +1 -0
- package/dist/assets/index-C4JbNnml.css +1 -0
- package/dist/assets/{index-BJxDQvyK.js → index-CdFWokfE.js} +1 -1
- package/dist/assets/index-D4oqjV9n.js +132 -0
- package/dist/assets/{index-CY-wDjNv.js → index-DqoYKexs.js} +15 -15
- package/dist/assets/{placement-7FCYadh2.js → placement-QfRaYTFY.js} +1 -1
- package/dist/assets/{setup-BzzdD38G.js → setup-B-WOti3H.js} +2 -2
- package/dist/assets/{streamEvents-Ba9kHw-1.js → streamEvents-CIqegoLa.js} +1 -1
- package/dist/assets/{studioGateApi-hkZdLr1Y.js → studioGateApi-CFtez6lH.js} +1 -1
- package/dist/assets/{target-scripts-8hczu84t.js → target-scripts-CI-nAISO.js} +1 -1
- package/dist/assets/useStudioTerminal-I8tuBymw.js +1 -0
- package/dist/assets/vibe64SessionPanelModel-DLdexNxC.js +1 -0
- package/dist/index.html +1 -1
- package/node_modules/@local/setup-doctor-core/src/server/doctorToolchain.js +4 -0
- package/node_modules/@local/studio-terminal-core/src/server/gitGithubTransport.js +33 -0
- package/node_modules/@local/studio-terminal-core/src/server/index.js +1 -0
- package/node_modules/@local/studio-terminal-core/src/server/terminalSessions.js +51 -1
- package/node_modules/@local/vibe64-adapters/src/server/adapter.js +4 -0
- package/node_modules/@local/vibe64-adapters/src/server/adapters/laravel/adapter.js +5 -0
- package/node_modules/@local/vibe64-adapters/src/server/adapters/laravel/databaseRuntime.js +50 -0
- package/node_modules/@local/vibe64-adapters/src/server/configStore.js +22 -1
- package/node_modules/@local/vibe64-adapters/src/server/systemPrompts/agent_conversation.txt +0 -2
- package/node_modules/@local/vibe64-adapters/src/server/systemPrompts/draft_issue.txt +18 -0
- package/node_modules/@local/vibe64-adapters/src/server/systemPrompts/make_plan.txt +14 -2
- package/node_modules/@local/vibe64-adapters/src/server/systemPrompts/prepare_for_merge.txt +2 -0
- package/node_modules/@local/vibe64-adapters/src/server/systemPrompts/resolve_pull_request.txt +1 -0
- package/node_modules/@local/vibe64-adapters/src/server/systemPrompts/run_deep_ui_check.txt +7 -3
- package/node_modules/@local/vibe64-adapters/src/server/workflowCommandTerminal/commitPush.js +4 -22
- package/node_modules/@local/vibe64-adapters/src/server/workflowCommandTerminal/factMetadata.js +21 -20
- package/node_modules/@local/vibe64-adapters/src/server/workflowCommandTerminal/issuePr.js +27 -4
- package/node_modules/@local/vibe64-adapters/src/server/workflowCommandTerminal/mergeSync.js +65 -8
- package/node_modules/@local/vibe64-adapters/src/server/workflowCommandTerminal/worktreeDependencies.js +12 -25
- package/node_modules/@local/vibe64-adapters/src/server/workflowSessionActions.js +77 -20
- package/node_modules/@local/vibe64-core/src/server/terminalWebSocketRoutes.js +14 -5
- package/node_modules/@local/vibe64-project/src/server/actions.js +21 -0
- package/node_modules/@local/vibe64-project/src/server/registerRoutes.js +6 -0
- package/node_modules/@local/vibe64-project/src/server/service.js +125 -8
- package/node_modules/@local/vibe64-runtime/src/server/coreProjectTools.js +135 -0
- package/node_modules/@local/vibe64-runtime/src/server/index.js +4 -0
- package/node_modules/@local/vibe64-runtime/src/server/projectToolRegistry.js +434 -0
- package/node_modules/@local/vibe64-runtime/src/server/runtime.js +40 -16
- package/node_modules/@local/vibe64-runtime/src/server/sessionWorktreeState.js +25 -0
- package/node_modules/@local/vibe64-runtime/src/server/terminalFailureFixRequest.js +112 -0
- package/node_modules/@local/vibe64-runtime/src/server/workflowArtifacts.js +2 -2
- package/node_modules/@local/vibe64-runtime/src/server/workflowDefinitionBuilders.js +1 -0
- package/node_modules/@local/vibe64-runtime/src/server/workflowDefinitionComposers.js +192 -0
- package/node_modules/@local/vibe64-runtime/src/server/workflowMachine.js +5 -0
- package/node_modules/@local/vibe64-runtime/src/server/workflowModules/coreCoding.js +1309 -419
- package/node_modules/@local/vibe64-runtime/src/server/workflowModules/coreLifecycle.js +540 -358
- package/node_modules/@local/vibe64-runtime/src/server/workflowModules/coreMaintenance.js +5 -26
- package/node_modules/@local/vibe64-runtime/src/server/workflowPresentation.js +153 -26
- package/node_modules/@local/vibe64-runtime/src/server/workflowStepMachineHelpers.js +63 -10
- package/node_modules/@local/vibe64-runtime/src/server/workflowStepMachines.js +63 -2
- package/node_modules/@local/vibe64-sessions/src/server/inputSchemas.js +5 -0
- package/node_modules/@local/vibe64-sessions/src/server/service.js +8 -9
- package/node_modules/@local/vibe64-terminals/src/server/actions.js +65 -0
- package/node_modules/@local/vibe64-terminals/src/server/codexTerminal.js +608 -23
- package/node_modules/@local/vibe64-terminals/src/server/commandTerminal.js +261 -4
- package/node_modules/@local/vibe64-terminals/src/server/fixCodexJobs.js +420 -0
- package/node_modules/@local/vibe64-terminals/src/server/inputSchemas.js +240 -0
- package/node_modules/@local/vibe64-terminals/src/server/launchTargetTerminal.js +2 -0
- package/node_modules/@local/vibe64-terminals/src/server/registerRoutes.js +226 -0
- package/node_modules/@local/vibe64-terminals/src/server/service.js +140 -1
- package/node_modules/@local/vibe64-terminals/src/server/targetToolchainTerminal.js +1 -1
- package/node_modules/@local/vibe64-terminals/src/server/terminalShared.js +34 -0
- package/node_modules/node-pty/build/Makefile +369 -0
- package/node_modules/node-pty/build/Release/pty.node +0 -0
- package/node_modules/node-pty/build/binding.Makefile +6 -0
- package/node_modules/node-pty/build/config.gypi +440 -0
- package/node_modules/node-pty/build/pty.target.mk +166 -0
- package/node_modules/node-pty/node-addon-api/node_addon_api.Makefile +6 -0
- package/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +104 -0
- package/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +108 -0
- package/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +104 -0
- package/node_modules/which/CHANGELOG.md +166 -0
- package/package.json +2 -2
- package/packages/setup-doctor-core/src/server/doctorToolchain.js +4 -0
- package/packages/studio-terminal-core/src/server/gitGithubTransport.js +33 -0
- package/packages/studio-terminal-core/src/server/index.js +1 -0
- package/packages/studio-terminal-core/src/server/terminalSessions.js +51 -1
- package/packages/vibe64-adapters/src/server/adapter.js +4 -0
- package/packages/vibe64-adapters/src/server/adapters/laravel/adapter.js +5 -0
- package/packages/vibe64-adapters/src/server/adapters/laravel/databaseRuntime.js +50 -0
- package/packages/vibe64-adapters/src/server/configStore.js +22 -1
- package/packages/vibe64-adapters/src/server/systemPrompts/agent_conversation.txt +0 -2
- package/packages/vibe64-adapters/src/server/systemPrompts/draft_issue.txt +18 -0
- package/packages/vibe64-adapters/src/server/systemPrompts/make_plan.txt +14 -2
- package/packages/vibe64-adapters/src/server/systemPrompts/prepare_for_merge.txt +2 -0
- package/packages/vibe64-adapters/src/server/systemPrompts/resolve_pull_request.txt +1 -0
- package/packages/vibe64-adapters/src/server/systemPrompts/run_deep_ui_check.txt +7 -3
- package/packages/vibe64-adapters/src/server/workflowCommandTerminal/commitPush.js +4 -22
- package/packages/vibe64-adapters/src/server/workflowCommandTerminal/factMetadata.js +21 -20
- package/packages/vibe64-adapters/src/server/workflowCommandTerminal/issuePr.js +27 -4
- package/packages/vibe64-adapters/src/server/workflowCommandTerminal/mergeSync.js +65 -8
- package/packages/vibe64-adapters/src/server/workflowCommandTerminal/worktreeDependencies.js +12 -25
- package/packages/vibe64-adapters/src/server/workflowSessionActions.js +77 -20
- package/packages/vibe64-core/src/server/terminalWebSocketRoutes.js +14 -5
- package/packages/vibe64-project/src/server/actions.js +21 -0
- package/packages/vibe64-project/src/server/registerRoutes.js +6 -0
- package/packages/vibe64-project/src/server/service.js +125 -8
- package/packages/vibe64-runtime/src/server/coreProjectTools.js +135 -0
- package/packages/vibe64-runtime/src/server/index.js +4 -0
- package/packages/vibe64-runtime/src/server/projectToolRegistry.js +434 -0
- package/packages/vibe64-runtime/src/server/runtime.js +40 -16
- package/packages/vibe64-runtime/src/server/sessionWorktreeState.js +25 -0
- package/packages/vibe64-runtime/src/server/terminalFailureFixRequest.js +112 -0
- package/packages/vibe64-runtime/src/server/workflowArtifacts.js +2 -2
- package/packages/vibe64-runtime/src/server/workflowDefinitionBuilders.js +1 -0
- package/packages/vibe64-runtime/src/server/workflowDefinitionComposers.js +192 -0
- package/packages/vibe64-runtime/src/server/workflowMachine.js +5 -0
- package/packages/vibe64-runtime/src/server/workflowModules/coreCoding.js +1309 -419
- package/packages/vibe64-runtime/src/server/workflowModules/coreLifecycle.js +540 -358
- package/packages/vibe64-runtime/src/server/workflowModules/coreMaintenance.js +5 -26
- package/packages/vibe64-runtime/src/server/workflowPresentation.js +153 -26
- package/packages/vibe64-runtime/src/server/workflowStepMachineHelpers.js +63 -10
- package/packages/vibe64-runtime/src/server/workflowStepMachines.js +63 -2
- package/packages/vibe64-sessions/src/server/inputSchemas.js +5 -0
- package/packages/vibe64-sessions/src/server/service.js +8 -9
- package/packages/vibe64-terminals/src/server/actions.js +65 -0
- package/packages/vibe64-terminals/src/server/codexTerminal.js +608 -23
- package/packages/vibe64-terminals/src/server/commandTerminal.js +261 -4
- package/packages/vibe64-terminals/src/server/fixCodexJobs.js +420 -0
- package/packages/vibe64-terminals/src/server/inputSchemas.js +240 -0
- package/packages/vibe64-terminals/src/server/launchTargetTerminal.js +2 -0
- package/packages/vibe64-terminals/src/server/registerRoutes.js +226 -0
- package/packages/vibe64-terminals/src/server/service.js +140 -1
- package/packages/vibe64-terminals/src/server/targetToolchainTerminal.js +1 -1
- package/packages/vibe64-terminals/src/server/terminalShared.js +34 -0
- package/dist/assets/ProjectTypeGate-DStq4W4X.js +0 -1
- package/dist/assets/ProjectTypeGate-Dh2ycSoM.css +0 -1
- package/dist/assets/history-HQ_XliX2.js +0 -1
- package/dist/assets/home-B89EbUmA.js +0 -1
- package/dist/assets/index-16P0GeGq.js +0 -134
- package/dist/assets/index-eMhOXhf_.css +0 -1
- package/dist/assets/useStudioTerminal-D9TNb50w.js +0 -1
- package/dist/assets/vibe64SessionPanelModel-DvY_IbW3.js +0 -1
|
@@ -43,6 +43,7 @@ function optionalContextLine(label, value) {
|
|
|
43
43
|
function terminalFailureFixPrompt({
|
|
44
44
|
actionId = "",
|
|
45
45
|
actionLabel = "",
|
|
46
|
+
attemptedCommand = "",
|
|
46
47
|
closeError = "",
|
|
47
48
|
commandPreview = "",
|
|
48
49
|
currentStep = "",
|
|
@@ -79,6 +80,7 @@ function terminalFailureFixPrompt({
|
|
|
79
80
|
optionalContextLine("Status", terminalStatus),
|
|
80
81
|
optionalContextLine("Exit code", exitCode),
|
|
81
82
|
optionalContextLine("Error", closeError),
|
|
83
|
+
optionalContextLine("Attempted command", attemptedCommand),
|
|
82
84
|
optionalContextLine("Command", commandPreview)
|
|
83
85
|
].filter(Boolean).join("\n");
|
|
84
86
|
|
|
@@ -125,6 +127,114 @@ function terminalFailureFixRequest(input = {}) {
|
|
|
125
127
|
};
|
|
126
128
|
}
|
|
127
129
|
|
|
130
|
+
function projectToolDeployRepairInstructions(toolId = "") {
|
|
131
|
+
if (!["push_to_production", "push_to_staging"].includes(normalizeText(toolId))) {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
return [
|
|
135
|
+
"This deploy tool runs a command saved in Vibe64 project configuration.",
|
|
136
|
+
"Treat the exact Attempted command as authoritative. Do not replace or rewrite the saved deploy command just because it exited non-zero.",
|
|
137
|
+
"Only change repository files when the attempted command failed because of a clear repository-owned defect.",
|
|
138
|
+
"If the attempted command itself is a placeholder, intentionally failing command, missing external credentials, remote access issue, or otherwise needs user intent, report `blocked` through the callback instead of editing config/code."
|
|
139
|
+
];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function sessionTerminalFailureFixPrompt(input = {}) {
|
|
143
|
+
const outputTail = terminalFailureOutputTail(input.output);
|
|
144
|
+
const subject = describeTerminalFailureSubject({
|
|
145
|
+
actionId: input.actionId,
|
|
146
|
+
actionLabel: input.actionLabel,
|
|
147
|
+
launchTargetId: input.launchTargetId,
|
|
148
|
+
launchTargetLabel: input.launchTargetLabel,
|
|
149
|
+
shellTarget: input.shellTarget,
|
|
150
|
+
terminalKind: input.terminalKind
|
|
151
|
+
});
|
|
152
|
+
const contextLines = [
|
|
153
|
+
optionalContextLine("Scope", "session"),
|
|
154
|
+
optionalContextLine("Session", input.sessionId),
|
|
155
|
+
optionalContextLine("Current step", input.currentStep),
|
|
156
|
+
optionalContextLine("Step status", input.stepStatus),
|
|
157
|
+
optionalContextLine("Target root", input.targetRoot),
|
|
158
|
+
optionalContextLine("Worktree", input.worktreePath),
|
|
159
|
+
optionalContextLine("Terminal kind", input.terminalKind),
|
|
160
|
+
optionalContextLine("Terminal session", input.terminalSessionId),
|
|
161
|
+
optionalContextLine("Subject", subject),
|
|
162
|
+
optionalContextLine("Action id", input.actionId),
|
|
163
|
+
optionalContextLine("Launch target id", input.launchTargetId),
|
|
164
|
+
optionalContextLine("Shell target", input.shellTarget),
|
|
165
|
+
optionalContextLine("Status", input.terminalStatus),
|
|
166
|
+
optionalContextLine("Exit code", input.exitCode),
|
|
167
|
+
optionalContextLine("Error", input.closeError),
|
|
168
|
+
optionalContextLine("Attempted command", input.attemptedCommand),
|
|
169
|
+
optionalContextLine("Command", input.commandPreview)
|
|
170
|
+
].filter(Boolean).join("\n");
|
|
171
|
+
|
|
172
|
+
return [
|
|
173
|
+
"A Vibe64 session terminal failed. Diagnose the failure from the repository and terminal output, then attempt to fix the underlying cause in the session worktree.",
|
|
174
|
+
"This is an ephemeral repair job, not a chat. Do not use the session Codex terminal or global Codex terminal for this repair.",
|
|
175
|
+
"Leave any code/config changes in the session worktree. When the repair is complete or blocked, report through the Fix Codex callback helper.",
|
|
176
|
+
"Before editing, inspect the session diff against its base branch. Only repair failures that are plausibly caused by this session's requested work or existing session diff.",
|
|
177
|
+
"If the failed command exposes an unrelated baseline repository failure, missing external dependency, broken local service, or broad issue outside the session diff, do not repair unrelated files. Report `blocked` through the callback with the retry blocker and the exact command that failed.",
|
|
178
|
+
"",
|
|
179
|
+
"Terminal context:",
|
|
180
|
+
contextLines || "- No terminal metadata was available.",
|
|
181
|
+
"",
|
|
182
|
+
"User note:",
|
|
183
|
+
normalizeText(input.userMessage) || "(No extra note was provided.)",
|
|
184
|
+
"",
|
|
185
|
+
`Last ${DEFAULT_TERMINAL_FAILURE_TAIL_LINES} terminal lines:`,
|
|
186
|
+
"~~~text",
|
|
187
|
+
outputTail || "(No terminal output was captured.)",
|
|
188
|
+
"~~~"
|
|
189
|
+
].join("\n");
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function projectToolFailureFixPrompt(input = {}, {
|
|
193
|
+
reportInstructions = ""
|
|
194
|
+
} = {}) {
|
|
195
|
+
const toolId = input.toolId || input.actionId;
|
|
196
|
+
const outputTail = terminalFailureOutputTail(input.output);
|
|
197
|
+
const subject = describeTerminalFailureSubject({
|
|
198
|
+
actionId: toolId,
|
|
199
|
+
actionLabel: input.toolLabel || input.actionLabel,
|
|
200
|
+
terminalKind: "project_tool"
|
|
201
|
+
});
|
|
202
|
+
const contextLines = [
|
|
203
|
+
optionalContextLine("Scope", "project"),
|
|
204
|
+
optionalContextLine("Target root", input.targetRoot),
|
|
205
|
+
optionalContextLine("Tool id", input.toolId || input.actionId),
|
|
206
|
+
optionalContextLine("Tool label", input.toolLabel || input.actionLabel),
|
|
207
|
+
optionalContextLine("Subject", subject),
|
|
208
|
+
optionalContextLine("Terminal session", input.terminalSessionId),
|
|
209
|
+
optionalContextLine("Status", input.terminalStatus),
|
|
210
|
+
optionalContextLine("Exit code", input.exitCode),
|
|
211
|
+
optionalContextLine("Error", input.closeError),
|
|
212
|
+
optionalContextLine("Attempted command", input.attemptedCommand),
|
|
213
|
+
optionalContextLine("Command", input.commandPreview)
|
|
214
|
+
].filter(Boolean).join("\n");
|
|
215
|
+
|
|
216
|
+
return [
|
|
217
|
+
"A project-level Vibe64 tool failed. Diagnose the failure from the repository and terminal output, then attempt to fix the underlying cause in the main project checkout.",
|
|
218
|
+
"This is an ephemeral repair job, not a chat. Do not use or modify Vibe64 session state unless the failure itself requires a repository code/config change.",
|
|
219
|
+
"The Terminal context includes the exact Attempted command. Start from that command, not from the tool label alone.",
|
|
220
|
+
"If the exact Attempted command is itself invalid, intentionally failing, or depends on missing external/user configuration, do not guess a replacement command. Report `blocked` with the command and the reason.",
|
|
221
|
+
...projectToolDeployRepairInstructions(toolId),
|
|
222
|
+
"",
|
|
223
|
+
reportInstructions,
|
|
224
|
+
"",
|
|
225
|
+
"Terminal context:",
|
|
226
|
+
contextLines || "- No terminal metadata was available.",
|
|
227
|
+
"",
|
|
228
|
+
"User note:",
|
|
229
|
+
normalizeText(input.userMessage) || "(No extra note was provided.)",
|
|
230
|
+
"",
|
|
231
|
+
`Last ${DEFAULT_TERMINAL_FAILURE_TAIL_LINES} terminal lines:`,
|
|
232
|
+
"~~~text",
|
|
233
|
+
outputTail || "(No terminal output was captured.)",
|
|
234
|
+
"~~~"
|
|
235
|
+
].filter((line) => line !== "").join("\n");
|
|
236
|
+
}
|
|
237
|
+
|
|
128
238
|
function terminalFailureFixRequestForSession(session = {}, input = {}) {
|
|
129
239
|
return terminalFailureFixRequest({
|
|
130
240
|
...input,
|
|
@@ -136,6 +246,8 @@ function terminalFailureFixRequestForSession(session = {}, input = {}) {
|
|
|
136
246
|
|
|
137
247
|
export {
|
|
138
248
|
DEFAULT_TERMINAL_FAILURE_TAIL_LINES,
|
|
249
|
+
projectToolFailureFixPrompt,
|
|
250
|
+
sessionTerminalFailureFixPrompt,
|
|
139
251
|
terminalFailureFixPrompt,
|
|
140
252
|
terminalFailureFixRequest,
|
|
141
253
|
terminalFailureFixRequestForSession,
|
|
@@ -2,8 +2,8 @@ const HUMAN_INPUT_RESPONSE_ARTIFACT = "response.md";
|
|
|
2
2
|
const ISSUE_BODY_ARTIFACT = "issue.md";
|
|
3
3
|
const ISSUE_TITLE_ARTIFACT = "issue_title";
|
|
4
4
|
const ISSUE_WORD_ARTIFACT = "issue_word";
|
|
5
|
-
const PULL_REQUEST_BODY_DRAFT_ARTIFACT = "tmp/
|
|
6
|
-
const PULL_REQUEST_TITLE_DRAFT_ARTIFACT = "tmp/
|
|
5
|
+
const PULL_REQUEST_BODY_DRAFT_ARTIFACT = "tmp/create_and_merge_pull_request.body.md";
|
|
6
|
+
const PULL_REQUEST_TITLE_DRAFT_ARTIFACT = "tmp/create_and_merge_pull_request.title.txt";
|
|
7
7
|
const REPORT_ARTIFACT = "report.md";
|
|
8
8
|
|
|
9
9
|
export {
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
vibe64Error,
|
|
3
|
+
isPlainObject,
|
|
4
|
+
normalizeText,
|
|
5
|
+
plainClone
|
|
6
|
+
} from "@local/vibe64-core/server/core";
|
|
7
|
+
import { deepFreeze } from "@local/vibe64-core/server/deepFreeze";
|
|
8
|
+
|
|
9
|
+
const WORKFLOW_DEFINITION_PART_KIND = "workflow_definition_part";
|
|
10
|
+
|
|
11
|
+
function cloneStepEntry(entry) {
|
|
12
|
+
return typeof entry === "string" ? normalizeText(entry) : plainClone(entry);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function emptyExpansion() {
|
|
16
|
+
return {
|
|
17
|
+
intentHandlers: {},
|
|
18
|
+
steps: []
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function normalizeIntentHandlers(intentHandlers = {}, context = "") {
|
|
23
|
+
if (intentHandlers === undefined || intentHandlers === null) {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
if (!isPlainObject(intentHandlers)) {
|
|
27
|
+
throw vibe64Error(
|
|
28
|
+
`Vibe64 workflow ${context} intentHandlers must be an object.`,
|
|
29
|
+
"vibe64_workflow_definition_part_invalid"
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const normalizedHandlers = {};
|
|
34
|
+
for (const [rawStepId, stepHandlers] of Object.entries(intentHandlers)) {
|
|
35
|
+
const stepId = normalizeText(rawStepId);
|
|
36
|
+
if (!stepId) {
|
|
37
|
+
throw vibe64Error(
|
|
38
|
+
`Vibe64 workflow ${context} intentHandlers contains an empty step id.`,
|
|
39
|
+
"vibe64_workflow_definition_part_invalid"
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
if (!isPlainObject(stepHandlers)) {
|
|
43
|
+
throw vibe64Error(
|
|
44
|
+
`Vibe64 workflow ${context} intentHandlers.${stepId} must be an object.`,
|
|
45
|
+
"vibe64_workflow_definition_part_invalid"
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
normalizedHandlers[stepId] = {};
|
|
50
|
+
for (const [rawIntentId, handler] of Object.entries(stepHandlers)) {
|
|
51
|
+
const intentId = normalizeText(rawIntentId);
|
|
52
|
+
if (!intentId || typeof handler !== "function") {
|
|
53
|
+
throw vibe64Error(
|
|
54
|
+
`Vibe64 workflow ${context} intentHandlers.${stepId}.${intentId || "(empty)"} must be a function.`,
|
|
55
|
+
"vibe64_workflow_definition_part_invalid"
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
normalizedHandlers[stepId][intentId] = handler;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return normalizedHandlers;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function mergeWorkflowIntentHandlers(handlerSets = [], context = "") {
|
|
65
|
+
const merged = {};
|
|
66
|
+
for (const handlerSet of handlerSets) {
|
|
67
|
+
const sourceHandlers = normalizeIntentHandlers(handlerSet, context);
|
|
68
|
+
for (const [stepId, stepHandlers] of Object.entries(sourceHandlers)) {
|
|
69
|
+
merged[stepId] = merged[stepId] || {};
|
|
70
|
+
for (const [intentId, handler] of Object.entries(stepHandlers)) {
|
|
71
|
+
if (Object.hasOwn(merged[stepId], intentId)) {
|
|
72
|
+
throw vibe64Error(
|
|
73
|
+
`Vibe64 workflow ${context} has duplicate intent handler: ${stepId}.${intentId}.`,
|
|
74
|
+
"vibe64_workflow_duplicate_intent_handler"
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
merged[stepId][intentId] = handler;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return merged;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function isWorkflowDefinitionPart(part = {}) {
|
|
85
|
+
return isPlainObject(part) && part.kind === WORKFLOW_DEFINITION_PART_KIND;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function expandWorkflowPart(part, context = "") {
|
|
89
|
+
if (!part) {
|
|
90
|
+
return emptyExpansion();
|
|
91
|
+
}
|
|
92
|
+
if (Array.isArray(part)) {
|
|
93
|
+
return expandWorkflowParts(part, context);
|
|
94
|
+
}
|
|
95
|
+
if (isWorkflowDefinitionPart(part)) {
|
|
96
|
+
return {
|
|
97
|
+
intentHandlers: normalizeIntentHandlers(part.intentHandlers, `${context} ${part.id}`.trim()),
|
|
98
|
+
steps: (Array.isArray(part.steps) ? part.steps : []).map(cloneStepEntry)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (typeof part === "string" || isPlainObject(part)) {
|
|
102
|
+
return {
|
|
103
|
+
intentHandlers: {},
|
|
104
|
+
steps: [cloneStepEntry(part)]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
throw vibe64Error(
|
|
108
|
+
`Vibe64 workflow ${context} contains an invalid workflow definition part.`,
|
|
109
|
+
"vibe64_workflow_definition_part_invalid"
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function expandWorkflowParts(parts = [], context = "") {
|
|
114
|
+
const expansion = emptyExpansion();
|
|
115
|
+
for (const part of Array.isArray(parts) ? parts : [parts]) {
|
|
116
|
+
const partExpansion = expandWorkflowPart(part, context);
|
|
117
|
+
expansion.steps.push(...partExpansion.steps);
|
|
118
|
+
expansion.intentHandlers = mergeWorkflowIntentHandlers([
|
|
119
|
+
expansion.intentHandlers,
|
|
120
|
+
partExpansion.intentHandlers
|
|
121
|
+
], context);
|
|
122
|
+
}
|
|
123
|
+
return expansion;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function workflowGroup({
|
|
127
|
+
id = "",
|
|
128
|
+
intentHandlers = {},
|
|
129
|
+
steps = []
|
|
130
|
+
} = {}) {
|
|
131
|
+
const groupId = normalizeText(id);
|
|
132
|
+
if (!groupId) {
|
|
133
|
+
throw vibe64Error(
|
|
134
|
+
"Vibe64 workflow groups require an id.",
|
|
135
|
+
"vibe64_workflow_definition_part_invalid"
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const expansion = expandWorkflowParts(steps, `group ${groupId}`);
|
|
140
|
+
return deepFreeze({
|
|
141
|
+
id: groupId,
|
|
142
|
+
intentHandlers: mergeWorkflowIntentHandlers([
|
|
143
|
+
expansion.intentHandlers,
|
|
144
|
+
intentHandlers
|
|
145
|
+
], `group ${groupId}`),
|
|
146
|
+
kind: WORKFLOW_DEFINITION_PART_KIND,
|
|
147
|
+
steps: expansion.steps
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function workflowWhen(condition, part) {
|
|
152
|
+
return condition ? part : null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function defineWorkflow(definition = {}) {
|
|
156
|
+
const definitionObject = isPlainObject(definition) ? definition : {};
|
|
157
|
+
const workflowId = normalizeText(definitionObject.id);
|
|
158
|
+
if (!workflowId) {
|
|
159
|
+
throw vibe64Error(
|
|
160
|
+
"Vibe64 workflow definitions require an id.",
|
|
161
|
+
"vibe64_workflow_definition_invalid"
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
if (Object.hasOwn(definitionObject, "steps") && Object.hasOwn(definitionObject, "parts")) {
|
|
165
|
+
throw vibe64Error(
|
|
166
|
+
`Vibe64 workflow ${workflowId} cannot define both steps and parts.`,
|
|
167
|
+
"vibe64_workflow_definition_invalid"
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const expansion = expandWorkflowParts(
|
|
172
|
+
Object.hasOwn(definitionObject, "parts") ? definitionObject.parts : definitionObject.steps,
|
|
173
|
+
`workflow ${workflowId}`
|
|
174
|
+
);
|
|
175
|
+
const workflow = {
|
|
176
|
+
...definitionObject,
|
|
177
|
+
id: workflowId,
|
|
178
|
+
intentHandlers: mergeWorkflowIntentHandlers([
|
|
179
|
+
expansion.intentHandlers,
|
|
180
|
+
definitionObject.intentHandlers
|
|
181
|
+
], `workflow ${workflowId}`),
|
|
182
|
+
steps: expansion.steps
|
|
183
|
+
};
|
|
184
|
+
delete workflow.parts;
|
|
185
|
+
return deepFreeze(workflow);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
defineWorkflow,
|
|
190
|
+
workflowGroup,
|
|
191
|
+
workflowWhen
|
|
192
|
+
};
|
|
@@ -255,6 +255,7 @@ function normalizeAction(action = {}, stepId = "") {
|
|
|
255
255
|
const type = normalizeText(action.type || "command");
|
|
256
256
|
return {
|
|
257
257
|
adapterCapability: normalizeText(action.adapterCapability),
|
|
258
|
+
auditMessage: normalizeText(action.auditMessage),
|
|
258
259
|
advanceOnSuccess: action.advanceOnSuccess === true,
|
|
259
260
|
disabledReason: normalizeText(action.disabledReason),
|
|
260
261
|
disabledWhenReason: normalizeText(action.disabledWhenReason || action.disabledReason),
|
|
@@ -268,6 +269,7 @@ function normalizeAction(action = {}, stepId = "") {
|
|
|
268
269
|
label: normalizeText(action.label || id),
|
|
269
270
|
promptId: type === "prompt" ? normalizeText(action.promptId || id) : "",
|
|
270
271
|
recordsConversationTurn: action.recordsConversationTurn === true,
|
|
272
|
+
saveCurrentStepInputBeforeRun: action.saveCurrentStepInputBeforeRun === true,
|
|
271
273
|
type,
|
|
272
274
|
visible: action.visible !== false
|
|
273
275
|
};
|
|
@@ -551,6 +553,9 @@ function publicActionDefinition(action) {
|
|
|
551
553
|
if (action.recordsConversationTurn) {
|
|
552
554
|
definition.recordsConversationTurn = true;
|
|
553
555
|
}
|
|
556
|
+
if (action.saveCurrentStepInputBeforeRun) {
|
|
557
|
+
definition.saveCurrentStepInputBeforeRun = true;
|
|
558
|
+
}
|
|
554
559
|
if (action.inputFields.length > 0) {
|
|
555
560
|
definition.inputFields = action.inputFields.map((field) => ({
|
|
556
561
|
...field
|