@workflow-code/cli 0.2.4-20261011002.codex-cli-web → 0.2.4-20261011004.codex-cli-web
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/index.js +1 -1
- package/dist/web/worker.mjs +17 -6
- package/dist/web/workflow-ui.js +3 -0
- package/dist/web/workflow-workspace.css +2379 -0
- package/dist/web/workflow-workspace.js +8692 -0
- package/dist/{web-6FYGFQH2.js → web-O6FZ5URK.js} +961 -171
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
24
24
|
const prepared = prepareCliInvocation(argv);
|
|
25
25
|
argv = prepared.argv;
|
|
26
26
|
if (argv[0] === "web") {
|
|
27
|
-
const webCli = await import("./web-
|
|
27
|
+
const webCli = await import("./web-O6FZ5URK.js");
|
|
28
28
|
return webCli.main(argv.slice(1));
|
|
29
29
|
}
|
|
30
30
|
if (argv[0] === "workspace") {
|
package/dist/web/worker.mjs
CHANGED
|
@@ -43,10 +43,15 @@ async function requiresSystemAi(directory) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
|
-
|
|
46
|
+
// Pipe requests can arrive in several chunks, including inside a UTF-8 sequence.
|
|
47
|
+
const chunks = [];
|
|
48
|
+
for await (const chunk of process.stdin) { chunks.push(chunk); }
|
|
49
|
+
const request = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
47
50
|
const projectDir = path.resolve(request.project?.folderPath ?? request.paths?.[0]);
|
|
51
|
+
const runtimeProjectDir = path.resolve(request.runtimeProjectDir ?? projectDir);
|
|
48
52
|
let coreUrl;
|
|
49
|
-
|
|
53
|
+
// An assistant's executor is separate from the project that owns its runtime.
|
|
54
|
+
try { coreUrl = resolve('workflow-code', pathToFileURL(path.join(runtimeProjectDir, 'package.json')).href); }
|
|
50
55
|
catch { throw new Error('Install workflow-code in the project before starting workflow-code web.'); }
|
|
51
56
|
const corePath = fileURLToPath(coreUrl);
|
|
52
57
|
let manifestDir = path.dirname(corePath);
|
|
@@ -76,7 +81,7 @@ try {
|
|
|
76
81
|
try {
|
|
77
82
|
const pkg = JSON.parse(readFileSync(path.join(folderPath, 'package.json'), 'utf8'));
|
|
78
83
|
const structure = inspectLocalWorkflowStructure({ workflowDir: folderPath });
|
|
79
|
-
const parameters = (entry) => ({ fields: entry.params ?? [], paramLayout: entry.paramLayout, paramResolver: entry.paramResolver, tools: entry.tools });
|
|
84
|
+
const parameters = (entry) => ({ fields: entry.params ?? [], paramLayout: entry.paramLayout, paramResolver: entry.paramResolver, tools: entry.tools, tokenUsage: entry.tokenUsage });
|
|
80
85
|
projects.push({
|
|
81
86
|
id: pkg.id,
|
|
82
87
|
runtime: { coreVersion: coreManifest.version, corePath },
|
|
@@ -84,7 +89,10 @@ try {
|
|
|
84
89
|
name: pkg.workflowCode?.projectInfo?.localizedNames?.['zh-CN'] ?? pkg.name ?? path.basename(folderPath),
|
|
85
90
|
projectType: structure.projectType,
|
|
86
91
|
...parameters(structure),
|
|
87
|
-
entrypoints: (structure.entrypoints ?? []).map((entry) => ({ id: entry.id, title: entry.title, ...parameters(entry) })),
|
|
92
|
+
entrypoints: (structure.entrypoints ?? []).map((entry) => ({ id: entry.id, title: entry.title, group: entry.group, description: entry.description, execution: entry.execution, ...parameters(entry) })),
|
|
93
|
+
definitions: structure.definitions,
|
|
94
|
+
execution: structure.execution,
|
|
95
|
+
diagnostics: structure.diagnostics,
|
|
88
96
|
defaultEntrypoint: structure.defaultEntrypoint,
|
|
89
97
|
artifactEntry: structure.kanban ? createKanbanArtifactEntryPath(structure.kanban) : undefined,
|
|
90
98
|
conversation: structure.conversation,
|
|
@@ -94,7 +102,7 @@ try {
|
|
|
94
102
|
}
|
|
95
103
|
send('result', { projects, errors });
|
|
96
104
|
} else if (request.project?.folderPath) {
|
|
97
|
-
const projectKey = createHash('sha256').update(request.project.assistant ? `assistant:${request.project.assistant.workdir}` : request.project.folderPath).digest('hex').slice(0, 24);
|
|
105
|
+
const projectKey = createHash('sha256').update(request.project.assistant ? `assistant:${request.project.id}:${request.project.assistant.workdir}` : request.project.folderPath).digest('hex').slice(0, 24);
|
|
98
106
|
const dataDir = path.join(request.storageDir, projectKey);
|
|
99
107
|
if (request.project.assistant) {
|
|
100
108
|
const assistant = request.project.assistant;
|
|
@@ -160,7 +168,10 @@ try {
|
|
|
160
168
|
onRuntimeEvent: (event) => send('event', event),
|
|
161
169
|
});
|
|
162
170
|
const data = report.result?.data;
|
|
163
|
-
const
|
|
171
|
+
const outputItems = data?.output?.items ?? data?.items ?? report.outputs?.flatMap((entry) => entry.output?.items ?? []) ?? [];
|
|
172
|
+
const items = request.project.projectType === 'workflow'
|
|
173
|
+
? [...new Map(outputItems.map((item, index) => [item.id ?? `item-${index}`, item])).values()]
|
|
174
|
+
: outputItems;
|
|
164
175
|
send('result', { ...report, output: { items }, files: createdFiles });
|
|
165
176
|
} else if (request.method === 'upload') {
|
|
166
177
|
if (!Array.isArray(request.files) || request.files.length > 32) { throw new Error('Too many attachments.'); }
|
package/dist/web/workflow-ui.js
CHANGED
|
@@ -4348,6 +4348,9 @@ ${state.user?.avatarUrl ?? ""}`;
|
|
|
4348
4348
|
const picker = document.createElement("input");
|
|
4349
4349
|
picker.type = "file";
|
|
4350
4350
|
picker.multiple = true;
|
|
4351
|
+
if (Array.isArray(message.accept)) {
|
|
4352
|
+
picker.accept = message.accept.join(",");
|
|
4353
|
+
}
|
|
4351
4354
|
picker.addEventListener("change", async () => {
|
|
4352
4355
|
try {
|
|
4353
4356
|
const files = await Promise.all(Array.from(picker.files ?? []).map((file) => new Promise((resolve, reject) => {
|