@workflow-code/cli 0.2.4-20261012005.codex-studio-integration → 0.2.4-20261012006.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-6SWHMU2A.js");
27
+ const webCli = await import("./web-FDREEISF.js");
28
28
  return webCli.main(argv.slice(1));
29
29
  }
30
30
  if (argv[0] === "workspace") {
@@ -12643,6 +12643,8 @@
12643
12643
  "Configuration name": "\u914D\u7F6E\u540D\u79F0",
12644
12644
  "Connecting to project": "\u6B63\u5728\u8FDE\u63A5\u9879\u76EE",
12645
12645
  "Connection changed.": "\u8FDE\u63A5\u5DF2\u53D8\u66F4\u3002",
12646
+ "Copy timed out.": "\u590D\u5236\u8D85\u65F6\u3002",
12647
+ "Host clipboard is unavailable.": "\u5BBF\u4E3B\u526A\u8D34\u677F\u4E0D\u53EF\u7528\u3002",
12646
12648
  "Connection interrupted": "\u8FDE\u63A5\u5DF2\u4E2D\u65AD",
12647
12649
  "Connection interrupted.": "\u8FDE\u63A5\u5DF2\u4E2D\u65AD\u3002",
12648
12650
  "Connection not verified": "\u8FDE\u63A5\u672A\u9A8C\u8BC1",
@@ -15693,6 +15695,69 @@ ${state2.user?.avatarUrl ?? ""}`;
15693
15695
  }
15694
15696
  };
15695
15697
 
15698
+ // src/web/ui/clipboard-bridge.ts
15699
+ var ClipboardBridge = class {
15700
+ constructor(send, browserWrite, requiresHost = false) {
15701
+ this.send = send;
15702
+ this.browserWrite = browserWrite;
15703
+ this.requiresHost = requiresHost;
15704
+ }
15705
+ send;
15706
+ browserWrite;
15707
+ requiresHost;
15708
+ enabled = false;
15709
+ pending = /* @__PURE__ */ new Map();
15710
+ enable(version) {
15711
+ this.enabled = version === 1;
15712
+ }
15713
+ async writeText(text2) {
15714
+ if (!this.enabled) {
15715
+ if (this.requiresHost) {
15716
+ throw new Error(t2("Host clipboard is unavailable."));
15717
+ }
15718
+ return this.browserWrite(text2);
15719
+ }
15720
+ const requestId = crypto.randomUUID();
15721
+ return new Promise((resolve, reject) => {
15722
+ const timer = setTimeout(() => {
15723
+ this.pending.delete(requestId);
15724
+ reject(new Error(t2("Copy timed out.")));
15725
+ }, 1e4);
15726
+ this.pending.set(requestId, { resolve, reject, timer });
15727
+ try {
15728
+ this.send({ type: "workflow-clipboard", version: 1, command: "writeText", requestId, text: text2 });
15729
+ } catch (error) {
15730
+ clearTimeout(timer);
15731
+ this.pending.delete(requestId);
15732
+ reject(error);
15733
+ }
15734
+ });
15735
+ }
15736
+ receive(reply) {
15737
+ if (reply?.version !== 1 || typeof reply.requestId !== "string" || typeof reply.ok !== "boolean" || reply.error !== void 0 && typeof reply.error !== "string") {
15738
+ return;
15739
+ }
15740
+ const pending2 = this.pending.get(reply.requestId);
15741
+ if (!pending2) {
15742
+ return;
15743
+ }
15744
+ this.pending.delete(reply.requestId);
15745
+ clearTimeout(pending2.timer);
15746
+ if (reply.ok) {
15747
+ pending2.resolve();
15748
+ } else {
15749
+ pending2.reject(new Error(reply.error || t2("Host clipboard is unavailable.")));
15750
+ }
15751
+ }
15752
+ dispose() {
15753
+ for (const pending2 of this.pending.values()) {
15754
+ clearTimeout(pending2.timer);
15755
+ pending2.reject(new Error(t2("Connection changed.")));
15756
+ }
15757
+ this.pending.clear();
15758
+ }
15759
+ };
15760
+
15696
15761
  // src/web/ui/host.ts
15697
15762
  function acquireWorkflowHost() {
15698
15763
  const embedded = globalThis.acquireVsCodeApi;
@@ -15714,6 +15779,12 @@ ${state2.user?.avatarUrl ?? ""}`;
15714
15779
  window.parent.postMessage(message, "*");
15715
15780
  }
15716
15781
  });
15782
+ const clipboard = new ClipboardBridge(
15783
+ (message) => window.parent.postMessage(message, "*"),
15784
+ (text2) => navigator.clipboard.writeText(text2),
15785
+ window.parent !== window && document.body.dataset.accountHost === "true"
15786
+ );
15787
+ addEventListener("pagehide", () => clipboard.dispose());
15717
15788
  const connection = new BrowserConnection((message) => {
15718
15789
  if (message.type === "state" && message.account) {
15719
15790
  accountPanel.update(message.account);
@@ -15736,6 +15807,10 @@ ${state2.user?.avatarUrl ?? ""}`;
15736
15807
  if (event.data.traceVersion !== void 0) {
15737
15808
  trace.enable(event.data.traceVersion);
15738
15809
  }
15810
+ if (event.data.clipboardVersion !== void 0) {
15811
+ clipboard.enable(event.data.clipboardVersion);
15812
+ }
15813
+ clipboard.receive(event.data.clipboard);
15739
15814
  const traceCommand = trace.command(event.data.traceCommand);
15740
15815
  if (traceCommand) {
15741
15816
  void request2(traceCommand).catch((error) => trace.receive({ type: "trace-run", runId: traceCommand.id, error: error.message }));
@@ -15829,8 +15904,13 @@ ${state2.user?.avatarUrl ?? ""}`;
15829
15904
  }
15830
15905
  }
15831
15906
  if (message.type === "copy") {
15832
- void navigator.clipboard.writeText(message.text).catch((error) => emit({ type: "error", message: error.message }));
15833
- return;
15907
+ try {
15908
+ await clipboard.writeText(message.text);
15909
+ } catch (error) {
15910
+ emit({ type: "error", message: error.message });
15911
+ return false;
15912
+ }
15913
+ return true;
15834
15914
  }
15835
15915
  if (message.type === "attach") {
15836
15916
  chooseFiles(message);
@@ -12643,6 +12643,8 @@
12643
12643
  "Configuration name": "\u914D\u7F6E\u540D\u79F0",
12644
12644
  "Connecting to project": "\u6B63\u5728\u8FDE\u63A5\u9879\u76EE",
12645
12645
  "Connection changed.": "\u8FDE\u63A5\u5DF2\u53D8\u66F4\u3002",
12646
+ "Copy timed out.": "\u590D\u5236\u8D85\u65F6\u3002",
12647
+ "Host clipboard is unavailable.": "\u5BBF\u4E3B\u526A\u8D34\u677F\u4E0D\u53EF\u7528\u3002",
12646
12648
  "Connection interrupted": "\u8FDE\u63A5\u5DF2\u4E2D\u65AD",
12647
12649
  "Connection interrupted.": "\u8FDE\u63A5\u5DF2\u4E2D\u65AD\u3002",
12648
12650
  "Connection not verified": "\u8FDE\u63A5\u672A\u9A8C\u8BC1",
@@ -17386,6 +17388,69 @@ ${state.user?.avatarUrl ?? ""}`;
17386
17388
  }
17387
17389
  };
17388
17390
 
17391
+ // src/web/ui/clipboard-bridge.ts
17392
+ var ClipboardBridge = class {
17393
+ constructor(send, browserWrite, requiresHost = false) {
17394
+ this.send = send;
17395
+ this.browserWrite = browserWrite;
17396
+ this.requiresHost = requiresHost;
17397
+ }
17398
+ send;
17399
+ browserWrite;
17400
+ requiresHost;
17401
+ enabled = false;
17402
+ pending = /* @__PURE__ */ new Map();
17403
+ enable(version) {
17404
+ this.enabled = version === 1;
17405
+ }
17406
+ async writeText(text3) {
17407
+ if (!this.enabled) {
17408
+ if (this.requiresHost) {
17409
+ throw new Error(t2("Host clipboard is unavailable."));
17410
+ }
17411
+ return this.browserWrite(text3);
17412
+ }
17413
+ const requestId = crypto.randomUUID();
17414
+ return new Promise((resolve, reject) => {
17415
+ const timer = setTimeout(() => {
17416
+ this.pending.delete(requestId);
17417
+ reject(new Error(t2("Copy timed out.")));
17418
+ }, 1e4);
17419
+ this.pending.set(requestId, { resolve, reject, timer });
17420
+ try {
17421
+ this.send({ type: "workflow-clipboard", version: 1, command: "writeText", requestId, text: text3 });
17422
+ } catch (error) {
17423
+ clearTimeout(timer);
17424
+ this.pending.delete(requestId);
17425
+ reject(error);
17426
+ }
17427
+ });
17428
+ }
17429
+ receive(reply) {
17430
+ if (reply?.version !== 1 || typeof reply.requestId !== "string" || typeof reply.ok !== "boolean" || reply.error !== void 0 && typeof reply.error !== "string") {
17431
+ return;
17432
+ }
17433
+ const pending = this.pending.get(reply.requestId);
17434
+ if (!pending) {
17435
+ return;
17436
+ }
17437
+ this.pending.delete(reply.requestId);
17438
+ clearTimeout(pending.timer);
17439
+ if (reply.ok) {
17440
+ pending.resolve();
17441
+ } else {
17442
+ pending.reject(new Error(reply.error || t2("Host clipboard is unavailable.")));
17443
+ }
17444
+ }
17445
+ dispose() {
17446
+ for (const pending of this.pending.values()) {
17447
+ clearTimeout(pending.timer);
17448
+ pending.reject(new Error(t2("Connection changed.")));
17449
+ }
17450
+ this.pending.clear();
17451
+ }
17452
+ };
17453
+
17389
17454
  // src/web/ui/host.ts
17390
17455
  function acquireWorkflowHost() {
17391
17456
  const embedded = globalThis.acquireVsCodeApi;
@@ -17407,6 +17472,12 @@ ${state.user?.avatarUrl ?? ""}`;
17407
17472
  window.parent.postMessage(message, "*");
17408
17473
  }
17409
17474
  });
17475
+ const clipboard = new ClipboardBridge(
17476
+ (message) => window.parent.postMessage(message, "*"),
17477
+ (text3) => navigator.clipboard.writeText(text3),
17478
+ window.parent !== window && document.body.dataset.accountHost === "true"
17479
+ );
17480
+ addEventListener("pagehide", () => clipboard.dispose());
17410
17481
  const connection = new BrowserConnection((message) => {
17411
17482
  if (message.type === "state" && message.account) {
17412
17483
  accountPanel.update(message.account);
@@ -17429,6 +17500,10 @@ ${state.user?.avatarUrl ?? ""}`;
17429
17500
  if (event.data.traceVersion !== void 0) {
17430
17501
  trace.enable(event.data.traceVersion);
17431
17502
  }
17503
+ if (event.data.clipboardVersion !== void 0) {
17504
+ clipboard.enable(event.data.clipboardVersion);
17505
+ }
17506
+ clipboard.receive(event.data.clipboard);
17432
17507
  const traceCommand = trace.command(event.data.traceCommand);
17433
17508
  if (traceCommand) {
17434
17509
  void request(traceCommand).catch((error) => trace.receive({ type: "trace-run", runId: traceCommand.id, error: error.message }));
@@ -17522,8 +17597,13 @@ ${state.user?.avatarUrl ?? ""}`;
17522
17597
  }
17523
17598
  }
17524
17599
  if (message.type === "copy") {
17525
- void navigator.clipboard.writeText(message.text).catch((error) => emit({ type: "error", message: error.message }));
17526
- return;
17600
+ try {
17601
+ await clipboard.writeText(message.text);
17602
+ } catch (error) {
17603
+ emit({ type: "error", message: error.message });
17604
+ return false;
17605
+ }
17606
+ return true;
17527
17607
  }
17528
17608
  if (message.type === "attach") {
17529
17609
  chooseFiles(message);
@@ -18249,8 +18329,10 @@ ${state.user?.avatarUrl ?? ""}`;
18249
18329
  error.textContent = message;
18250
18330
  error.hidden = false;
18251
18331
  }
18252
- function copy2(text3, button) {
18253
- vscode.postMessage({ type: "copy", text: text3 });
18332
+ async function copy2(text3, button) {
18333
+ if (await vscode.postMessage({ type: "copy", text: text3 }) === false) {
18334
+ return;
18335
+ }
18254
18336
  button.innerHTML = iconHtml("check");
18255
18337
  button.title = t2("Copied");
18256
18338
  setTimeout(() => {
@@ -16172,6 +16172,8 @@
16172
16172
  "Configuration name": "\u914D\u7F6E\u540D\u79F0",
16173
16173
  "Connecting to project": "\u6B63\u5728\u8FDE\u63A5\u9879\u76EE",
16174
16174
  "Connection changed.": "\u8FDE\u63A5\u5DF2\u53D8\u66F4\u3002",
16175
+ "Copy timed out.": "\u590D\u5236\u8D85\u65F6\u3002",
16176
+ "Host clipboard is unavailable.": "\u5BBF\u4E3B\u526A\u8D34\u677F\u4E0D\u53EF\u7528\u3002",
16175
16177
  "Connection interrupted": "\u8FDE\u63A5\u5DF2\u4E2D\u65AD",
16176
16178
  "Connection interrupted.": "\u8FDE\u63A5\u5DF2\u4E2D\u65AD\u3002",
16177
16179
  "Connection not verified": "\u8FDE\u63A5\u672A\u9A8C\u8BC1",
@@ -19237,6 +19239,69 @@ ${state2.user?.avatarUrl ?? ""}`;
19237
19239
  }
19238
19240
  };
19239
19241
 
19242
+ // src/web/ui/clipboard-bridge.ts
19243
+ var ClipboardBridge = class {
19244
+ constructor(send, browserWrite, requiresHost = false) {
19245
+ this.send = send;
19246
+ this.browserWrite = browserWrite;
19247
+ this.requiresHost = requiresHost;
19248
+ }
19249
+ send;
19250
+ browserWrite;
19251
+ requiresHost;
19252
+ enabled = false;
19253
+ pending = /* @__PURE__ */ new Map();
19254
+ enable(version) {
19255
+ this.enabled = version === 1;
19256
+ }
19257
+ async writeText(text3) {
19258
+ if (!this.enabled) {
19259
+ if (this.requiresHost) {
19260
+ throw new Error(t2("Host clipboard is unavailable."));
19261
+ }
19262
+ return this.browserWrite(text3);
19263
+ }
19264
+ const requestId2 = crypto.randomUUID();
19265
+ return new Promise((resolve2, reject) => {
19266
+ const timer = setTimeout(() => {
19267
+ this.pending.delete(requestId2);
19268
+ reject(new Error(t2("Copy timed out.")));
19269
+ }, 1e4);
19270
+ this.pending.set(requestId2, { resolve: resolve2, reject, timer });
19271
+ try {
19272
+ this.send({ type: "workflow-clipboard", version: 1, command: "writeText", requestId: requestId2, text: text3 });
19273
+ } catch (error) {
19274
+ clearTimeout(timer);
19275
+ this.pending.delete(requestId2);
19276
+ reject(error);
19277
+ }
19278
+ });
19279
+ }
19280
+ receive(reply) {
19281
+ if (reply?.version !== 1 || typeof reply.requestId !== "string" || typeof reply.ok !== "boolean" || reply.error !== void 0 && typeof reply.error !== "string") {
19282
+ return;
19283
+ }
19284
+ const pending = this.pending.get(reply.requestId);
19285
+ if (!pending) {
19286
+ return;
19287
+ }
19288
+ this.pending.delete(reply.requestId);
19289
+ clearTimeout(pending.timer);
19290
+ if (reply.ok) {
19291
+ pending.resolve();
19292
+ } else {
19293
+ pending.reject(new Error(reply.error || t2("Host clipboard is unavailable.")));
19294
+ }
19295
+ }
19296
+ dispose() {
19297
+ for (const pending of this.pending.values()) {
19298
+ clearTimeout(pending.timer);
19299
+ pending.reject(new Error(t2("Connection changed.")));
19300
+ }
19301
+ this.pending.clear();
19302
+ }
19303
+ };
19304
+
19240
19305
  // src/web/ui/host.ts
19241
19306
  function acquireWorkflowHost() {
19242
19307
  const embedded = globalThis.acquireVsCodeApi;
@@ -19258,6 +19323,12 @@ ${state2.user?.avatarUrl ?? ""}`;
19258
19323
  window.parent.postMessage(message, "*");
19259
19324
  }
19260
19325
  });
19326
+ const clipboard = new ClipboardBridge(
19327
+ (message) => window.parent.postMessage(message, "*"),
19328
+ (text3) => navigator.clipboard.writeText(text3),
19329
+ window.parent !== window && document.body.dataset.accountHost === "true"
19330
+ );
19331
+ addEventListener("pagehide", () => clipboard.dispose());
19261
19332
  const connection = new BrowserConnection((message) => {
19262
19333
  if (message.type === "state" && message.account) {
19263
19334
  accountPanel.update(message.account);
@@ -19280,6 +19351,10 @@ ${state2.user?.avatarUrl ?? ""}`;
19280
19351
  if (event.data.traceVersion !== void 0) {
19281
19352
  trace.enable(event.data.traceVersion);
19282
19353
  }
19354
+ if (event.data.clipboardVersion !== void 0) {
19355
+ clipboard.enable(event.data.clipboardVersion);
19356
+ }
19357
+ clipboard.receive(event.data.clipboard);
19283
19358
  const traceCommand = trace.command(event.data.traceCommand);
19284
19359
  if (traceCommand) {
19285
19360
  void request(traceCommand).catch((error) => trace.receive({ type: "trace-run", runId: traceCommand.id, error: error.message }));
@@ -19373,8 +19448,13 @@ ${state2.user?.avatarUrl ?? ""}`;
19373
19448
  }
19374
19449
  }
19375
19450
  if (message.type === "copy") {
19376
- void navigator.clipboard.writeText(message.text).catch((error) => emit({ type: "error", message: error.message }));
19377
- return;
19451
+ try {
19452
+ await clipboard.writeText(message.text);
19453
+ } catch (error) {
19454
+ emit({ type: "error", message: error.message });
19455
+ return false;
19456
+ }
19457
+ return true;
19378
19458
  }
19379
19459
  if (message.type === "attach") {
19380
19460
  chooseFiles(message);
@@ -100,6 +100,8 @@ var messages_zh_cn_default = {
100
100
  "Configuration name": "\u914D\u7F6E\u540D\u79F0",
101
101
  "Connecting to project": "\u6B63\u5728\u8FDE\u63A5\u9879\u76EE",
102
102
  "Connection changed.": "\u8FDE\u63A5\u5DF2\u53D8\u66F4\u3002",
103
+ "Copy timed out.": "\u590D\u5236\u8D85\u65F6\u3002",
104
+ "Host clipboard is unavailable.": "\u5BBF\u4E3B\u526A\u8D34\u677F\u4E0D\u53EF\u7528\u3002",
103
105
  "Connection interrupted": "\u8FDE\u63A5\u5DF2\u4E2D\u65AD",
104
106
  "Connection interrupted.": "\u8FDE\u63A5\u5DF2\u4E2D\u65AD\u3002",
105
107
  "Connection not verified": "\u8FDE\u63A5\u672A\u9A8C\u8BC1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workflow-code/cli",
3
- "version": "0.2.4-20261012005.codex-studio-integration",
3
+ "version": "0.2.4-20261012006.codex-studio-integration",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "workflow-code": "./dist/index.js"