@workflow-code/cli 0.2.4-20261012007.codex-studio-integration → 0.2.4-20261013002.codex-studio-integration

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-ROA37F4H.js");
27
+ const webCli = await import("./web-JXC3WIJK.js");
28
28
  return webCli.main(argv.slice(1));
29
29
  }
30
30
  if (argv[0] === "workspace") {
@@ -80,6 +80,22 @@ function isWorkflowProjectDataStorageLocationAllowed(projectInfo, location) {
80
80
  const mode = projectInfo.dataStorage?.mode;
81
81
  return mode === "both" || mode === location;
82
82
  }
83
+ function resolveWorkflowProjectName(defaultName, projectInfo, locale) {
84
+ const fallback = defaultName.trim();
85
+ const localizedNames = projectInfo.localizedNames;
86
+ const normalizedLocale = locale?.trim().toLowerCase() ?? "";
87
+ const exact = Object.entries(localizedNames).find(([key]) => key.toLowerCase() === normalizedLocale)?.[1];
88
+ if (exact) return exact;
89
+ if (normalizedLocale.startsWith("zh")) {
90
+ const chinese = Object.entries(localizedNames).find(([key]) => key.toLowerCase() === "zh-cn")?.[1];
91
+ if (chinese) return chinese;
92
+ }
93
+ if (normalizedLocale.startsWith("en")) {
94
+ const english = Object.entries(localizedNames).find(([key]) => key.toLowerCase() === "en")?.[1];
95
+ if (english) return english;
96
+ }
97
+ return fallback;
98
+ }
83
99
  function normalizeLocalizedNames(value) {
84
100
  if (value === void 0) return {};
85
101
  if (!isRecord(value)) {
@@ -518,7 +534,6 @@ function isRecord2(value) {
518
534
  }
519
535
 
520
536
  // src/web/kanban-data.ts
521
- var readKanbanProjectInfo = readWorkflowProjectInfo;
522
537
  var webProjectDataDirectory = (storageDir, projectDir) => path.join(storageDir, createHash("sha256").update(projectDir).digest("hex").slice(0, 24));
523
538
  async function localKanbanRelatedProjects(project) {
524
539
  const info = readWorkflowProjectInfo(JSON.parse(await readFile(path.join(project.folderPath, "package.json"), "utf8")));
@@ -607,7 +622,8 @@ async function runKanbanDataCall(core, project, storageDir, value) {
607
622
  }
608
623
  export {
609
624
  localKanbanRelatedProjects,
610
- readKanbanProjectInfo,
625
+ readWorkflowProjectInfo,
626
+ resolveWorkflowProjectName,
611
627
  runKanbanDataCall,
612
628
  webProjectDataDirectory
613
629
  };
@@ -360,7 +360,7 @@ h1 {
360
360
  animation: spin 1.2s linear infinite;
361
361
  }
362
362
  .parameter-error {
363
- flex: 1;
363
+ flex: 1 1 220px;
364
364
  min-width: 0;
365
365
  font-size: 13px;
366
366
  line-height: 1.6;
@@ -360,7 +360,7 @@ h1 {
360
360
  animation: spin 1.2s linear infinite;
361
361
  }
362
362
  .parameter-error {
363
- flex: 1;
363
+ flex: 1 1 220px;
364
364
  min-width: 0;
365
365
  font-size: 13px;
366
366
  line-height: 1.6;
@@ -16332,6 +16332,7 @@ ${state.user?.avatarUrl ?? ""}`;
16332
16332
  var pendingBridge = 0;
16333
16333
  var epoch = 0;
16334
16334
  var authRevision;
16335
+ var resourceRevision;
16335
16336
  var pending = /* @__PURE__ */ new Map();
16336
16337
  function request(message) {
16337
16338
  if (!connected) {
@@ -16489,13 +16490,15 @@ ${state.user?.avatarUrl ?? ""}`;
16489
16490
  }
16490
16491
  }
16491
16492
  if (message.type === "state") {
16492
- if (authRevision !== void 0 && authRevision !== message.authenticationRevision) {
16493
+ if (authRevision !== void 0 && authRevision !== message.authenticationRevision || resourceRevision !== void 0 && resourceRevision !== message.resourceRevision) {
16494
+ clearTimeout(readyTimer);
16493
16495
  data = void 0;
16494
16496
  frame = void 0;
16495
16497
  content.replaceChildren();
16496
16498
  void load();
16497
16499
  }
16498
16500
  authRevision = message.authenticationRevision;
16501
+ resourceRevision = message.resourceRevision;
16499
16502
  }
16500
16503
  });
16501
16504
  new MutationObserver(inject).observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme"] });
@@ -76,7 +76,7 @@ try {
76
76
  } = await import(coreUrl);
77
77
  const core = await import(coreUrl);
78
78
  const language = /^zh/i.test(process.env[core.WORKFLOW_RUNTIME_LOCALE_ENV] ?? process.env.WORKFLOW_CODE_LOCALE ?? 'en') ? 'zh-CN' : 'en';
79
- const { readKanbanProjectInfo, runKanbanDataCall } = await import(new URL(import.meta.url.includes('/src/web/') ? './kanban-data.ts' : './kanban-data.mjs', import.meta.url));
79
+ const { readWorkflowProjectInfo, resolveWorkflowProjectName, runKanbanDataCall } = await import(new URL(import.meta.url.includes('/src/web/') ? './kanban-data.ts' : './kanban-data.mjs', import.meta.url));
80
80
  if (request.method === 'inspect') {
81
81
  const projects = [];
82
82
  const errors = [];
@@ -84,12 +84,13 @@ try {
84
84
  try {
85
85
  const pkg = JSON.parse(readFileSync(path.join(folderPath, 'package.json'), 'utf8'));
86
86
  const structure = inspectLocalWorkflowStructure({ workflowDir: folderPath });
87
+ const projectInfo = readWorkflowProjectInfo(pkg);
87
88
  const parameters = (entry) => ({ fields: entry.params ?? [], paramLayout: entry.paramLayout, paramResolver: entry.paramResolver, tools: entry.tools, tokenUsage: entry.tokenUsage });
88
89
  projects.push({
89
90
  id: pkg.id,
90
91
  runtime: { coreVersion: coreManifest.version, corePath },
91
92
  folderPath,
92
- name: pkg.workflowCode?.projectInfo?.localizedNames?.[language] ?? pkg.name ?? path.basename(folderPath),
93
+ name: resolveWorkflowProjectName(pkg.name ?? path.basename(folderPath), projectInfo, language),
93
94
  projectType: structure.projectType,
94
95
  ...parameters(structure),
95
96
  entrypoints: (structure.entrypoints ?? []).map((entry) => ({ id: entry.id, title: entry.title, group: entry.group, description: entry.description, execution: entry.execution, ...parameters(entry) })),
@@ -99,7 +100,7 @@ try {
99
100
  defaultEntrypoint: structure.defaultEntrypoint,
100
101
  artifactEntry: structure.kanban ? createKanbanArtifactEntryPath(structure.kanban) : undefined,
101
102
  kanban: structure.kanban ? { artifactDir: structure.kanban.artifactDir, entry: structure.kanban.entry } : undefined,
102
- projectInfo: structure.kanban ? readKanbanProjectInfo(pkg) : undefined,
103
+ projectInfo,
103
104
  conversation: structure.conversation,
104
105
  requiresLogin: await requiresSystemAi(folderPath),
105
106
  });
@@ -360,7 +360,7 @@ h1 {
360
360
  animation: spin 1.2s linear infinite;
361
361
  }
362
362
  .parameter-error {
363
- flex: 1;
363
+ flex: 1 1 220px;
364
364
  min-width: 0;
365
365
  font-size: 13px;
366
366
  line-height: 1.6;
@@ -360,7 +360,7 @@ h1 {
360
360
  animation: spin 1.2s linear infinite;
361
361
  }
362
362
  .parameter-error {
363
- flex: 1;
363
+ flex: 1 1 220px;
364
364
  min-width: 0;
365
365
  font-size: 13px;
366
366
  line-height: 1.6;
@@ -1732,7 +1732,6 @@ var KanbanMethodHub = class {
1732
1732
  import { readFile as readFile2, readdir, realpath as realpath2 } from "fs/promises";
1733
1733
  import { createHash } from "crypto";
1734
1734
  import path2 from "path";
1735
- var readKanbanProjectInfo = readWorkflowProjectInfo;
1736
1735
  var webProjectDataDirectory = (storageDir, projectDir) => path2.join(storageDir, createHash("sha256").update(projectDir).digest("hex").slice(0, 24));
1737
1736
  async function localKanbanRelatedProjects(project) {
1738
1737
  const info = readWorkflowProjectInfo(JSON.parse(await readFile2(path2.join(project.folderPath, "package.json"), "utf8")));
@@ -1872,7 +1871,7 @@ var KanbanController = class {
1872
1871
  async load() {
1873
1872
  const pkg = JSON.parse(await readFile3(path3.join(this.project.folderPath, "package.json"), "utf8"));
1874
1873
  const artifact = readKanbanArtifactConfig(pkg);
1875
- const projectInfo = readKanbanProjectInfo(pkg);
1874
+ const projectInfo = readWorkflowProjectInfo(pkg);
1876
1875
  let params;
1877
1876
  try {
1878
1877
  params = parseKanbanManifestText(await readFile3(path3.join(this.project.folderPath, "kanban.json"), "utf8")).params;
@@ -2761,6 +2760,9 @@ var ResourcePreviews = class {
2761
2760
  this.generation++;
2762
2761
  this.entries.clear();
2763
2762
  }
2763
+ get revision() {
2764
+ return this.generation;
2765
+ }
2764
2766
  async server(id, suffix, init = {}) {
2765
2767
  const connection = this.connection();
2766
2768
  if (!connection) {
@@ -2785,6 +2787,9 @@ var ResourcePreviews = class {
2785
2787
  const id = card.target.projectId ?? this.owner.id;
2786
2788
  if (card.target.source === "server") {
2787
2789
  if (card.kind === "kv" || card.kind === "knowledge") {
2790
+ if (id.toLowerCase() === this.owner.id.toLowerCase()) {
2791
+ return this.owner;
2792
+ }
2788
2793
  return { id, uri: `workflow-server:${id}`, folderPath: "", name: id, projectType: "workflow", fields: [], entrypoints: [] };
2789
2794
  }
2790
2795
  const snapshot = await this.server(id, "/structure"), structure = snapshot.structure;
@@ -2942,17 +2947,20 @@ var ResourcePreviews = class {
2942
2947
  return entry.data;
2943
2948
  }
2944
2949
  async asset(url) {
2950
+ const generation = this.generation;
2945
2951
  if (url.pathname.startsWith("/kanban/")) {
2946
2952
  for (const entry of this.entries.values()) {
2947
2953
  if (entry.local && url.pathname.startsWith(`/kanban/${entry.local.nonce}/`)) {
2948
- return entry.local.asset(url);
2954
+ const asset2 = await entry.local.asset(url);
2955
+ return generation === this.generation ? asset2 : void 0;
2949
2956
  }
2950
2957
  }
2951
2958
  return;
2952
2959
  }
2953
2960
  const match = /^\/resource-assets\/([^/]+)\/(.+)$/.exec(url.pathname);
2954
2961
  const remote = match && this.entries.get(match[1])?.remote;
2955
- if (!remote || remote.connection !== this.connection()) {
2962
+ const connection = this.connection();
2963
+ if (!remote || remote.connection.serverUrl !== connection?.serverUrl || remote.connection.accessToken !== connection?.accessToken) {
2956
2964
  return;
2957
2965
  }
2958
2966
  const asset = decodeURIComponent(match[2]);
@@ -2964,7 +2972,11 @@ var ResourcePreviews = class {
2964
2972
  if (!response.ok) {
2965
2973
  return;
2966
2974
  }
2967
- return { content: Buffer.from(await response.arrayBuffer()), headers: {
2975
+ const content = Buffer.from(await response.arrayBuffer());
2976
+ if (generation !== this.generation) {
2977
+ return;
2978
+ }
2979
+ return { content, headers: {
2968
2980
  "Content-Type": response.headers.get("content-type") ?? "application/octet-stream",
2969
2981
  "Content-Security-Policy": `${response.headers.get("content-security-policy") ?? "default-src 'none'"}; frame-ancestors 'self' vscode-webview: vscode-file: http://127.0.0.1:* http://localhost:*`,
2970
2982
  "Cache-Control": "no-store",
@@ -2973,6 +2985,7 @@ var ResourcePreviews = class {
2973
2985
  } };
2974
2986
  }
2975
2987
  async bridge(id, value) {
2988
+ const generation = this.generation;
2976
2989
  const data = this.get(id), project = data.project, call = parseKanbanBridgeCall(value);
2977
2990
  if (data.format !== "kanban" || !project) {
2978
2991
  throw new Error(t("This project does not provide a Kanban preview."));
@@ -2983,17 +2996,22 @@ var ResourcePreviews = class {
2983
2996
  if (call.operation === "runtime.getLocale") {
2984
2997
  return locale();
2985
2998
  }
2999
+ let result;
2986
3000
  if (data.card.target.source === "server" || project.projectInfo?.dataStorage?.mode === "server") {
2987
- return this.server(project.id, "/kanban/bridge", { method: "POST", body: JSON.stringify({ call }) });
2988
- }
2989
- if (call.operation === "files.readFile") {
3001
+ result = await this.server(project.id, "/kanban/bridge", { method: "POST", body: JSON.stringify({ call }) });
3002
+ } else if (call.operation === "files.readFile") {
2990
3003
  const file = await this.runtime.readFile(project, String(call.input.fileId));
2991
- return { file: file.reference, base64: (await readFile4(file.path)).toString("base64") };
3004
+ result = { file: file.reference, base64: (await readFile4(file.path)).toString("base64") };
3005
+ } else {
3006
+ if (!this.runtime.kanbanBridge) {
3007
+ throw new Error(t("The resource project is unavailable."));
3008
+ }
3009
+ result = await this.runtime.kanbanBridge(project, call);
2992
3010
  }
2993
- if (!this.runtime.kanbanBridge) {
2994
- throw new Error(t("The resource project is unavailable."));
3011
+ if (generation !== this.generation) {
3012
+ throw new Error(t("Resource access changed. Open the card again."));
2995
3013
  }
2996
- return this.runtime.kanbanBridge(project, call);
3014
+ return result;
2997
3015
  }
2998
3016
  };
2999
3017
 
@@ -3077,7 +3095,8 @@ async function startWebServer(options) {
3077
3095
  project,
3078
3096
  ...isKanban ? { kanban: kanbanController.state() } : isWorkflow ? workflowActions.state() : { sessions: controller.sessions, activeId: controller.activeId, running: controller.running, parameterValues: controller.current.parameterValues ?? {} },
3079
3097
  account: { ...account, user: account.user && { userId: account.user.userId, email: account.user.email, displayName: account.user.displayName, avatarUrl: account.user.avatarUrl } },
3080
- authenticationRevision: authRevision
3098
+ authenticationRevision: authRevision,
3099
+ resourceRevision: resources.revision
3081
3100
  }, [...sensitiveTokens], false));
3082
3101
  const broadcast = () => {
3083
3102
  if (broadcastTimer) {
@@ -3667,7 +3686,7 @@ ${token}`;
3667
3686
  return;
3668
3687
  }
3669
3688
  if (url.pathname === "/api/resource-state" && request.method === "GET") {
3670
- json(response, 200, { type: "state", authenticationRevision: authRevision });
3689
+ json(response, 200, { type: "state", authenticationRevision: authRevision, resourceRevision: resources.revision });
3671
3690
  return;
3672
3691
  }
3673
3692
  if (url.pathname === "/api/events" && request.method === "GET") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workflow-code/cli",
3
- "version": "0.2.4-20261012007.codex-studio-integration",
3
+ "version": "0.2.4-20261013002.codex-studio-integration",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "workflow-code": "./dist/index.js"
@@ -38,14 +38,14 @@
38
38
  "workflow-code": "0.2.4-20260929001",
39
39
  "@workflow-code/auth-config": "0.1.0",
40
40
  "@workflow-code/execution-targets": "0.1.0",
41
+ "@workflow-code/i18n": "0.1.0",
41
42
  "@workflow-code/kanban-project": "0.1.0",
42
43
  "@workflow-code/openai-responses": "0.1.0",
43
- "@workflow-code/i18n": "0.1.0",
44
44
  "@workflow-code/project-dependencies": "0.1.0",
45
45
  "@workflow-code/project-info": "0.1.0",
46
46
  "@workflow-code/project-upload": "0.1.0",
47
- "@workflow-code/workflow-ids": "0.1.0",
48
47
  "@workflow-code/runtime-compatibility": "0.1.0",
48
+ "@workflow-code/workflow-ids": "0.1.0",
49
49
  "@workflow-code/workflow-mcp": "0.1.0"
50
50
  },
51
51
  "scripts": {