@workflow-code/cli 0.2.4-20261011001.codex-cli-web → 0.2.4-20261011003.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 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-TJ2SME4G.js");
27
+ const webCli = await import("./web-O6FZ5URK.js");
28
28
  return webCli.main(argv.slice(1));
29
29
  }
30
30
  if (argv[0] === "workspace") {
@@ -45,8 +45,10 @@ async function requiresSystemAi(directory) {
45
45
  try {
46
46
  const request = JSON.parse(readFileSync(0, 'utf8'));
47
47
  const projectDir = path.resolve(request.project?.folderPath ?? request.paths?.[0]);
48
+ const runtimeProjectDir = path.resolve(request.runtimeProjectDir ?? projectDir);
48
49
  let coreUrl;
49
- try { coreUrl = resolve('workflow-code', pathToFileURL(path.join(projectDir, 'package.json')).href); }
50
+ // An assistant's executor is separate from the project that owns its runtime.
51
+ try { coreUrl = resolve('workflow-code', pathToFileURL(path.join(runtimeProjectDir, 'package.json')).href); }
50
52
  catch { throw new Error('Install workflow-code in the project before starting workflow-code web.'); }
51
53
  const corePath = fileURLToPath(coreUrl);
52
54
  let manifestDir = path.dirname(corePath);
@@ -76,7 +78,7 @@ try {
76
78
  try {
77
79
  const pkg = JSON.parse(readFileSync(path.join(folderPath, 'package.json'), 'utf8'));
78
80
  const structure = inspectLocalWorkflowStructure({ workflowDir: folderPath });
79
- const parameters = (entry) => ({ fields: entry.params ?? [], paramLayout: entry.paramLayout, paramResolver: entry.paramResolver, tools: entry.tools });
81
+ const parameters = (entry) => ({ fields: entry.params ?? [], paramLayout: entry.paramLayout, paramResolver: entry.paramResolver, tools: entry.tools, tokenUsage: entry.tokenUsage });
80
82
  projects.push({
81
83
  id: pkg.id,
82
84
  runtime: { coreVersion: coreManifest.version, corePath },
@@ -84,7 +86,10 @@ try {
84
86
  name: pkg.workflowCode?.projectInfo?.localizedNames?.['zh-CN'] ?? pkg.name ?? path.basename(folderPath),
85
87
  projectType: structure.projectType,
86
88
  ...parameters(structure),
87
- entrypoints: (structure.entrypoints ?? []).map((entry) => ({ id: entry.id, title: entry.title, ...parameters(entry) })),
89
+ entrypoints: (structure.entrypoints ?? []).map((entry) => ({ id: entry.id, title: entry.title, group: entry.group, description: entry.description, execution: entry.execution, ...parameters(entry) })),
90
+ definitions: structure.definitions,
91
+ execution: structure.execution,
92
+ diagnostics: structure.diagnostics,
88
93
  defaultEntrypoint: structure.defaultEntrypoint,
89
94
  artifactEntry: structure.kanban ? createKanbanArtifactEntryPath(structure.kanban) : undefined,
90
95
  conversation: structure.conversation,
@@ -94,7 +99,7 @@ try {
94
99
  }
95
100
  send('result', { projects, errors });
96
101
  } 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);
102
+ 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
103
  const dataDir = path.join(request.storageDir, projectKey);
99
104
  if (request.project.assistant) {
100
105
  const assistant = request.project.assistant;
@@ -160,7 +165,10 @@ try {
160
165
  onRuntimeEvent: (event) => send('event', event),
161
166
  });
162
167
  const data = report.result?.data;
163
- const items = data?.output?.items ?? data?.items ?? report.outputs?.flatMap((entry) => entry.output?.items ?? []) ?? [];
168
+ const outputItems = data?.output?.items ?? data?.items ?? report.outputs?.flatMap((entry) => entry.output?.items ?? []) ?? [];
169
+ const items = request.project.projectType === 'workflow'
170
+ ? [...new Map(outputItems.map((item, index) => [item.id ?? `item-${index}`, item])).values()]
171
+ : outputItems;
164
172
  send('result', { ...report, output: { items }, files: createdFiles });
165
173
  } else if (request.method === 'upload') {
166
174
  if (!Array.isArray(request.files) || request.files.length > 32) { throw new Error('Too many attachments.'); }
@@ -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) => {