@workflow-code/cli 0.2.4-20261012005.codex-studio-integration → 0.2.4-20261012007.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 +1 -1
- package/dist/web/kanban-workspace.css +76 -10
- package/dist/web/kanban-workspace.js +201 -10
- package/dist/web/resource-preview.css +2172 -0
- package/dist/web/resource-preview.js +16515 -0
- package/dist/web/worker.mjs +3 -3
- package/dist/web/workflow-ui.css +76 -10
- package/dist/web/workflow-ui.js +337 -31
- package/dist/web/workflow-workspace.css +76 -10
- package/dist/web/workflow-workspace.js +329 -29
- package/dist/{web-6SWHMU2A.js → web-ROA37F4H.js} +514 -167
- package/package.json +3 -3
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-ROA37F4H.js");
|
|
28
28
|
return webCli.main(argv.slice(1));
|
|
29
29
|
}
|
|
30
30
|
if (argv[0] === "workspace") {
|
|
@@ -1072,23 +1072,89 @@ main {
|
|
|
1072
1072
|
margin-top: 12px;
|
|
1073
1073
|
}
|
|
1074
1074
|
.resource-card {
|
|
1075
|
-
display:
|
|
1076
|
-
|
|
1077
|
-
gap: 8px;
|
|
1075
|
+
display: block;
|
|
1076
|
+
width: 100%;
|
|
1078
1077
|
min-width: 0;
|
|
1079
|
-
|
|
1080
|
-
min-height: 36px;
|
|
1081
|
-
padding: 6px 10px;
|
|
1078
|
+
margin: 8px 0;
|
|
1082
1079
|
border: 1px solid var(--border);
|
|
1083
1080
|
border-radius: 6px;
|
|
1084
1081
|
background: var(--vscode-editor-background);
|
|
1082
|
+
overflow: hidden;
|
|
1083
|
+
container-type: inline-size;
|
|
1084
|
+
}
|
|
1085
|
+
.resource-card-row {
|
|
1086
|
+
display: flex;
|
|
1087
|
+
align-items: center;
|
|
1088
|
+
gap: 4px;
|
|
1089
|
+
min-height: 44px;
|
|
1090
|
+
padding: 4px 8px;
|
|
1091
|
+
}
|
|
1092
|
+
.resource-target {
|
|
1093
|
+
display: flex;
|
|
1094
|
+
align-items: center;
|
|
1095
|
+
gap: 10px;
|
|
1096
|
+
flex: 1;
|
|
1097
|
+
min-width: 0;
|
|
1098
|
+
min-height: 36px;
|
|
1099
|
+
padding: 6px 4px;
|
|
1100
|
+
border: 0;
|
|
1101
|
+
background: transparent;
|
|
1085
1102
|
text-align: left;
|
|
1086
1103
|
}
|
|
1087
|
-
.resource-
|
|
1104
|
+
.resource-target > .codicon {
|
|
1105
|
+
flex: none;
|
|
1106
|
+
color: var(--muted);
|
|
1107
|
+
}
|
|
1108
|
+
.resource-title {
|
|
1088
1109
|
min-width: 0;
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1110
|
+
white-space: normal;
|
|
1111
|
+
overflow-wrap: anywhere;
|
|
1112
|
+
line-height: 1.5;
|
|
1113
|
+
}
|
|
1114
|
+
.resource-card-row > .icon-button {
|
|
1115
|
+
flex: none;
|
|
1116
|
+
width: 28px;
|
|
1117
|
+
height: 28px;
|
|
1118
|
+
}
|
|
1119
|
+
@container (max-width: 280px) {
|
|
1120
|
+
.resource-card-row {
|
|
1121
|
+
flex-wrap: wrap;
|
|
1122
|
+
}
|
|
1123
|
+
.resource-target {
|
|
1124
|
+
flex-basis: 100%;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
.resource-inline {
|
|
1128
|
+
height: 360px;
|
|
1129
|
+
max-height: 70vh;
|
|
1130
|
+
min-height: 160px;
|
|
1131
|
+
border-top: 1px solid var(--border);
|
|
1132
|
+
overflow: auto;
|
|
1133
|
+
}
|
|
1134
|
+
.resource-inline[role] {
|
|
1135
|
+
padding: 12px;
|
|
1136
|
+
color: var(--muted);
|
|
1137
|
+
}
|
|
1138
|
+
.resource-inline[role=alert] {
|
|
1139
|
+
color: var(--vscode-errorForeground);
|
|
1140
|
+
}
|
|
1141
|
+
.resource-inline iframe {
|
|
1142
|
+
display: block;
|
|
1143
|
+
width: 100%;
|
|
1144
|
+
height: 100%;
|
|
1145
|
+
border: 0;
|
|
1146
|
+
}
|
|
1147
|
+
.resource-call-details {
|
|
1148
|
+
padding: 8px 12px;
|
|
1149
|
+
border-top: 1px solid var(--border);
|
|
1150
|
+
max-height: 320px;
|
|
1151
|
+
overflow: auto;
|
|
1152
|
+
}
|
|
1153
|
+
.resource-call-details pre {
|
|
1154
|
+
margin: 0;
|
|
1155
|
+
font-size: 11px;
|
|
1156
|
+
white-space: pre-wrap;
|
|
1157
|
+
overflow-wrap: anywhere;
|
|
1092
1158
|
}
|
|
1093
1159
|
.input-prompt {
|
|
1094
1160
|
margin: 16px 0;
|
|
@@ -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",
|
|
@@ -12883,7 +12885,33 @@
|
|
|
12883
12885
|
"Write file": "\u5199\u5165\u6587\u4EF6",
|
|
12884
12886
|
Yes: "\u662F",
|
|
12885
12887
|
"Zoom in": "\u653E\u5927",
|
|
12886
|
-
"Zoom out": "\u7F29\u5C0F"
|
|
12888
|
+
"Zoom out": "\u7F29\u5C0F",
|
|
12889
|
+
"Open resource": "\u6253\u5F00\u8D44\u6E90",
|
|
12890
|
+
"Show in conversation": "\u5728\u5BF9\u8BDD\u4E2D\u5C55\u793A",
|
|
12891
|
+
"Hide preview": "\u6536\u8D77\u9884\u89C8",
|
|
12892
|
+
"Open in new window": "\u5728\u65B0\u7A97\u53E3\u4E2D\u6253\u5F00",
|
|
12893
|
+
"Tool call details": "\u5DE5\u5177\u8C03\u7528\u8BE6\u60C5",
|
|
12894
|
+
"Please sign in to preview this server resource.": "\u8BF7\u767B\u5F55\u540E\u9884\u89C8\u670D\u52A1\u5668\u8D44\u6E90\u3002",
|
|
12895
|
+
"You do not have access to this resource.": "\u4F60\u6CA1\u6709\u6B64\u8D44\u6E90\u7684\u8BBF\u95EE\u6743\u9650\u3002",
|
|
12896
|
+
"The resource project is unavailable.": "\u8D44\u6E90\u6240\u5C5E\u9879\u76EE\u4E0D\u53EF\u7528\u3002",
|
|
12897
|
+
"The resource project is unavailable. Import or open the target project first.": "\u8D44\u6E90\u6240\u5C5E\u9879\u76EE\u4E0D\u53EF\u7528\uFF0C\u8BF7\u5148\u5BFC\u5165\u6216\u6253\u5F00\u76EE\u6807\u9879\u76EE\u3002",
|
|
12898
|
+
"The project does not allow this storage location.": "\u9879\u76EE\u4E0D\u5141\u8BB8\u4F7F\u7528\u6B64\u5B58\u50A8\u4F4D\u7F6E\u3002",
|
|
12899
|
+
"This resource no longer exists.": "\u6B64\u8D44\u6E90\u5DF2\u4E0D\u5B58\u5728\u3002",
|
|
12900
|
+
"Server source files cannot be previewed by this card.": "\u6B64\u5361\u7247\u4E0D\u652F\u6301\u9884\u89C8\u670D\u52A1\u5668\u6E90\u7801\u6587\u4EF6\u3002",
|
|
12901
|
+
"File is outside this project.": "\u6587\u4EF6\u4E0D\u5728\u6B64\u9879\u76EE\u4E2D\u3002",
|
|
12902
|
+
"File preview exceeds 2 MiB.": "\u6587\u4EF6\u9884\u89C8\u5927\u5C0F\u8D85\u8FC7 2 MiB\u3002",
|
|
12903
|
+
"This project does not provide a Kanban preview.": "\u6B64\u9879\u76EE\u4E0D\u63D0\u4F9B\u770B\u677F\u9884\u89C8\u3002",
|
|
12904
|
+
"Invalid resource preview URL.": "\u8D44\u6E90\u9884\u89C8\u5730\u5740\u65E0\u6548\u3002",
|
|
12905
|
+
"This preview configuration no longer exists.": "\u6B64\u9884\u89C8\u914D\u7F6E\u5DF2\u4E0D\u5B58\u5728\u3002",
|
|
12906
|
+
"Resource access changed. Open the card again.": "\u8D44\u6E90\u8BBF\u95EE\u72B6\u6001\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u5361\u7247\u3002",
|
|
12907
|
+
"This resource preview is read-only.": "\u6B64\u8D44\u6E90\u9884\u89C8\u4E3A\u53EA\u8BFB\u3002",
|
|
12908
|
+
"Invalid resource action.": "\u8D44\u6E90\u64CD\u4F5C\u65E0\u6548\u3002",
|
|
12909
|
+
"Run no longer exists.": "\u6B64\u8FD0\u884C\u5DF2\u4E0D\u5B58\u5728\u3002",
|
|
12910
|
+
"Conversation changed.": "\u4F1A\u8BDD\u5DF2\u53D8\u5316\u3002",
|
|
12911
|
+
"Unable to load this preview. Retry or open it separately.": "\u65E0\u6CD5\u52A0\u8F7D\u6B64\u9884\u89C8\uFF0C\u8BF7\u91CD\u8BD5\u6216\u5355\u72EC\u6253\u5F00\u3002",
|
|
12912
|
+
"Open in browser": "\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00",
|
|
12913
|
+
"No resources": "\u6682\u65E0\u8D44\u6E90",
|
|
12914
|
+
"Allow popups to open this resource in a new window.": "\u8BF7\u5141\u8BB8\u5F39\u51FA\u7A97\u53E3\u4EE5\u5355\u72EC\u6253\u5F00\u6B64\u8D44\u6E90\u3002"
|
|
12887
12915
|
};
|
|
12888
12916
|
|
|
12889
12917
|
// src/web/localization.ts
|
|
@@ -15331,11 +15359,14 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15331
15359
|
var ConnectionError = class extends Error {
|
|
15332
15360
|
};
|
|
15333
15361
|
var BrowserConnection = class {
|
|
15334
|
-
constructor(emit) {
|
|
15362
|
+
constructor(emit, live = true) {
|
|
15335
15363
|
this.emit = emit;
|
|
15364
|
+
this.live = live;
|
|
15336
15365
|
if (this.token) {
|
|
15366
|
+
const query = new URLSearchParams(location.search);
|
|
15367
|
+
query.delete("session");
|
|
15337
15368
|
sessionStorage.setItem("workflow-web-session", this.token);
|
|
15338
|
-
history.replaceState(null, "", `${location.pathname}${
|
|
15369
|
+
history.replaceState(null, "", `${location.pathname}${query.size ? `?${query}` : ""}`);
|
|
15339
15370
|
}
|
|
15340
15371
|
queueMicrotask(() => {
|
|
15341
15372
|
this.banner = document.createElement("div");
|
|
@@ -15369,6 +15400,7 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15369
15400
|
});
|
|
15370
15401
|
}
|
|
15371
15402
|
emit;
|
|
15403
|
+
live;
|
|
15372
15404
|
clientId = crypto.randomUUID();
|
|
15373
15405
|
source;
|
|
15374
15406
|
banner;
|
|
@@ -15376,10 +15408,11 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15376
15408
|
handshake;
|
|
15377
15409
|
epoch = 0;
|
|
15378
15410
|
retry;
|
|
15411
|
+
snapshotTimer;
|
|
15379
15412
|
status = "connecting";
|
|
15380
15413
|
attempts = 0;
|
|
15381
15414
|
closed = false;
|
|
15382
|
-
token = new URLSearchParams(location.hash.slice(1)).get("session") ?? sessionStorage.getItem("workflow-web-session");
|
|
15415
|
+
token = new URLSearchParams(location.hash.slice(1)).get("session") ?? new URLSearchParams(location.search).get("session") ?? sessionStorage.getItem("workflow-web-session");
|
|
15383
15416
|
update(status) {
|
|
15384
15417
|
this.status = status;
|
|
15385
15418
|
this.emit({ type: "connection", status });
|
|
@@ -15402,6 +15435,7 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15402
15435
|
this.source?.close();
|
|
15403
15436
|
this.source = void 0;
|
|
15404
15437
|
clearTimeout(this.retry);
|
|
15438
|
+
clearTimeout(this.snapshotTimer);
|
|
15405
15439
|
}
|
|
15406
15440
|
interrupted() {
|
|
15407
15441
|
this.disconnect();
|
|
@@ -15455,6 +15489,10 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15455
15489
|
if (!session.ok) {
|
|
15456
15490
|
throw new Error("Cannot connect to the project.");
|
|
15457
15491
|
}
|
|
15492
|
+
if (!this.live) {
|
|
15493
|
+
await this.snapshot(epoch);
|
|
15494
|
+
return;
|
|
15495
|
+
}
|
|
15458
15496
|
const eventsUrl = new URL(this.fileUrl("/api/events"), location.href);
|
|
15459
15497
|
eventsUrl.searchParams.set("clientId", this.clientId);
|
|
15460
15498
|
const source = this.source = new EventSource(eventsUrl.href);
|
|
@@ -15491,6 +15529,39 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15491
15529
|
});
|
|
15492
15530
|
return this.connecting;
|
|
15493
15531
|
}
|
|
15532
|
+
async snapshot(epoch) {
|
|
15533
|
+
if (epoch !== this.epoch || this.closed) {
|
|
15534
|
+
return;
|
|
15535
|
+
}
|
|
15536
|
+
const response = await fetch("/api/resource-state", { headers: this.headers(), signal: AbortSignal.timeout(1e4) });
|
|
15537
|
+
if (epoch !== this.epoch || this.closed) {
|
|
15538
|
+
return;
|
|
15539
|
+
}
|
|
15540
|
+
if (response.status === 401) {
|
|
15541
|
+
this.disconnect();
|
|
15542
|
+
this.update("expired");
|
|
15543
|
+
return;
|
|
15544
|
+
}
|
|
15545
|
+
if (!response.ok) {
|
|
15546
|
+
throw new Error("Cannot connect to the project.");
|
|
15547
|
+
}
|
|
15548
|
+
const state2 = await response.json();
|
|
15549
|
+
if (epoch !== this.epoch || this.closed) {
|
|
15550
|
+
return;
|
|
15551
|
+
}
|
|
15552
|
+
if (this.status !== "connected") {
|
|
15553
|
+
this.attempts = 0;
|
|
15554
|
+
this.update("connected");
|
|
15555
|
+
}
|
|
15556
|
+
this.emit(state2);
|
|
15557
|
+
this.snapshotTimer = setTimeout(() => {
|
|
15558
|
+
void this.snapshot(epoch).catch(() => {
|
|
15559
|
+
if (epoch === this.epoch && !this.closed) {
|
|
15560
|
+
this.interrupted();
|
|
15561
|
+
}
|
|
15562
|
+
});
|
|
15563
|
+
}, 5e3);
|
|
15564
|
+
}
|
|
15494
15565
|
async request(message) {
|
|
15495
15566
|
await this.connecting;
|
|
15496
15567
|
if (this.status !== "connected") {
|
|
@@ -15536,7 +15607,12 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15536
15607
|
return this.token ? { Authorization: `Bearer ${this.token}` } : {};
|
|
15537
15608
|
}
|
|
15538
15609
|
fileUrl(path) {
|
|
15539
|
-
|
|
15610
|
+
if (!this.token) {
|
|
15611
|
+
return path;
|
|
15612
|
+
}
|
|
15613
|
+
const url = new URL(path, location.href);
|
|
15614
|
+
url.searchParams.set("session", this.token);
|
|
15615
|
+
return `${url.pathname}${url.search}${url.hash}`;
|
|
15540
15616
|
}
|
|
15541
15617
|
publicFiles(value) {
|
|
15542
15618
|
if (Array.isArray(value)) {
|
|
@@ -15693,8 +15769,71 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15693
15769
|
}
|
|
15694
15770
|
};
|
|
15695
15771
|
|
|
15772
|
+
// src/web/ui/clipboard-bridge.ts
|
|
15773
|
+
var ClipboardBridge = class {
|
|
15774
|
+
constructor(send, browserWrite, requiresHost = false) {
|
|
15775
|
+
this.send = send;
|
|
15776
|
+
this.browserWrite = browserWrite;
|
|
15777
|
+
this.requiresHost = requiresHost;
|
|
15778
|
+
}
|
|
15779
|
+
send;
|
|
15780
|
+
browserWrite;
|
|
15781
|
+
requiresHost;
|
|
15782
|
+
enabled = false;
|
|
15783
|
+
pending = /* @__PURE__ */ new Map();
|
|
15784
|
+
enable(version) {
|
|
15785
|
+
this.enabled = version === 1;
|
|
15786
|
+
}
|
|
15787
|
+
async writeText(text2) {
|
|
15788
|
+
if (!this.enabled) {
|
|
15789
|
+
if (this.requiresHost) {
|
|
15790
|
+
throw new Error(t2("Host clipboard is unavailable."));
|
|
15791
|
+
}
|
|
15792
|
+
return this.browserWrite(text2);
|
|
15793
|
+
}
|
|
15794
|
+
const requestId = crypto.randomUUID();
|
|
15795
|
+
return new Promise((resolve, reject) => {
|
|
15796
|
+
const timer = setTimeout(() => {
|
|
15797
|
+
this.pending.delete(requestId);
|
|
15798
|
+
reject(new Error(t2("Copy timed out.")));
|
|
15799
|
+
}, 1e4);
|
|
15800
|
+
this.pending.set(requestId, { resolve, reject, timer });
|
|
15801
|
+
try {
|
|
15802
|
+
this.send({ type: "workflow-clipboard", version: 1, command: "writeText", requestId, text: text2 });
|
|
15803
|
+
} catch (error) {
|
|
15804
|
+
clearTimeout(timer);
|
|
15805
|
+
this.pending.delete(requestId);
|
|
15806
|
+
reject(error);
|
|
15807
|
+
}
|
|
15808
|
+
});
|
|
15809
|
+
}
|
|
15810
|
+
receive(reply) {
|
|
15811
|
+
if (reply?.version !== 1 || typeof reply.requestId !== "string" || typeof reply.ok !== "boolean" || reply.error !== void 0 && typeof reply.error !== "string") {
|
|
15812
|
+
return;
|
|
15813
|
+
}
|
|
15814
|
+
const pending2 = this.pending.get(reply.requestId);
|
|
15815
|
+
if (!pending2) {
|
|
15816
|
+
return;
|
|
15817
|
+
}
|
|
15818
|
+
this.pending.delete(reply.requestId);
|
|
15819
|
+
clearTimeout(pending2.timer);
|
|
15820
|
+
if (reply.ok) {
|
|
15821
|
+
pending2.resolve();
|
|
15822
|
+
} else {
|
|
15823
|
+
pending2.reject(new Error(reply.error || t2("Host clipboard is unavailable.")));
|
|
15824
|
+
}
|
|
15825
|
+
}
|
|
15826
|
+
dispose() {
|
|
15827
|
+
for (const pending2 of this.pending.values()) {
|
|
15828
|
+
clearTimeout(pending2.timer);
|
|
15829
|
+
pending2.reject(new Error(t2("Connection changed.")));
|
|
15830
|
+
}
|
|
15831
|
+
this.pending.clear();
|
|
15832
|
+
}
|
|
15833
|
+
};
|
|
15834
|
+
|
|
15696
15835
|
// src/web/ui/host.ts
|
|
15697
|
-
function acquireWorkflowHost() {
|
|
15836
|
+
function acquireWorkflowHost(options = {}) {
|
|
15698
15837
|
const embedded = globalThis.acquireVsCodeApi;
|
|
15699
15838
|
if (embedded) {
|
|
15700
15839
|
return embedded();
|
|
@@ -15714,13 +15853,20 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15714
15853
|
window.parent.postMessage(message, "*");
|
|
15715
15854
|
}
|
|
15716
15855
|
});
|
|
15856
|
+
let resourceHost = false;
|
|
15857
|
+
const clipboard = new ClipboardBridge(
|
|
15858
|
+
(message) => window.parent.postMessage(message, "*"),
|
|
15859
|
+
(text2) => navigator.clipboard.writeText(text2),
|
|
15860
|
+
window.parent !== window && document.body.dataset.accountHost === "true"
|
|
15861
|
+
);
|
|
15862
|
+
addEventListener("pagehide", () => clipboard.dispose());
|
|
15717
15863
|
const connection = new BrowserConnection((message) => {
|
|
15718
15864
|
if (message.type === "state" && message.account) {
|
|
15719
15865
|
accountPanel.update(message.account);
|
|
15720
15866
|
}
|
|
15721
15867
|
trace.receive(message);
|
|
15722
15868
|
emit(message);
|
|
15723
|
-
});
|
|
15869
|
+
}, options.live);
|
|
15724
15870
|
const request2 = async (message) => {
|
|
15725
15871
|
for (const entry of await connection.request(message)) {
|
|
15726
15872
|
handleReply(entry);
|
|
@@ -15736,6 +15882,16 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15736
15882
|
if (event.data.traceVersion !== void 0) {
|
|
15737
15883
|
trace.enable(event.data.traceVersion);
|
|
15738
15884
|
}
|
|
15885
|
+
if (event.data.clipboardVersion !== void 0) {
|
|
15886
|
+
clipboard.enable(event.data.clipboardVersion);
|
|
15887
|
+
}
|
|
15888
|
+
if (event.data.resourceVersion === 1) {
|
|
15889
|
+
resourceHost = true;
|
|
15890
|
+
}
|
|
15891
|
+
if (event.data.resourceError) {
|
|
15892
|
+
emit(event.data.resourceError);
|
|
15893
|
+
}
|
|
15894
|
+
clipboard.receive(event.data.clipboard);
|
|
15739
15895
|
const traceCommand = trace.command(event.data.traceCommand);
|
|
15740
15896
|
if (traceCommand) {
|
|
15741
15897
|
void request2(traceCommand).catch((error) => trace.receive({ type: "trace-run", runId: traceCommand.id, error: error.message }));
|
|
@@ -15752,7 +15908,14 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15752
15908
|
}
|
|
15753
15909
|
return;
|
|
15754
15910
|
}
|
|
15755
|
-
if (reply.type === "
|
|
15911
|
+
if (reply.type === "resource-preview") {
|
|
15912
|
+
reply.url = connection.fileUrl(reply.url);
|
|
15913
|
+
if (reply.action === "inline") {
|
|
15914
|
+
emit(reply);
|
|
15915
|
+
} else {
|
|
15916
|
+
window.open(reply.url, "_blank", "noopener");
|
|
15917
|
+
}
|
|
15918
|
+
} else if (reply.type === "download") {
|
|
15756
15919
|
const url = URL.createObjectURL(new Blob([reply.content], { type: reply.mimeType ?? "application/json" }));
|
|
15757
15920
|
const link = document.createElement("a");
|
|
15758
15921
|
link.href = url;
|
|
@@ -15820,6 +15983,29 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15820
15983
|
if (message.type === "ready") {
|
|
15821
15984
|
return;
|
|
15822
15985
|
}
|
|
15986
|
+
if (message.type === "resource" && message.action !== "inline" && resourceHost) {
|
|
15987
|
+
window.parent.postMessage({ type: "workflow-resource", version: 1, request: message }, "*");
|
|
15988
|
+
return;
|
|
15989
|
+
}
|
|
15990
|
+
if (message.type === "resource" && message.action !== "inline") {
|
|
15991
|
+
const popup = window.open("", "_blank");
|
|
15992
|
+
try {
|
|
15993
|
+
const reply = (await connection.request(message)).find((reply2) => reply2.type === "resource-preview");
|
|
15994
|
+
if (reply && popup) {
|
|
15995
|
+
popup.opener = null;
|
|
15996
|
+
popup.location.href = connection.fileUrl(reply.url);
|
|
15997
|
+
} else {
|
|
15998
|
+
popup?.close();
|
|
15999
|
+
if (reply) {
|
|
16000
|
+
emit({ type: "error", message: t2("Allow popups to open this resource in a new window.") });
|
|
16001
|
+
}
|
|
16002
|
+
}
|
|
16003
|
+
} catch (error) {
|
|
16004
|
+
popup?.close();
|
|
16005
|
+
emit({ type: "error", requestId: message.requestId, message: error.message });
|
|
16006
|
+
}
|
|
16007
|
+
return;
|
|
16008
|
+
}
|
|
15823
16009
|
if (message.type === "trace") {
|
|
15824
16010
|
if (trace.open(message)) {
|
|
15825
16011
|
return;
|
|
@@ -15829,8 +16015,13 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
15829
16015
|
}
|
|
15830
16016
|
}
|
|
15831
16017
|
if (message.type === "copy") {
|
|
15832
|
-
|
|
15833
|
-
|
|
16018
|
+
try {
|
|
16019
|
+
await clipboard.writeText(message.text);
|
|
16020
|
+
} catch (error) {
|
|
16021
|
+
emit({ type: "error", message: error.message });
|
|
16022
|
+
return false;
|
|
16023
|
+
}
|
|
16024
|
+
return true;
|
|
15834
16025
|
}
|
|
15835
16026
|
if (message.type === "attach") {
|
|
15836
16027
|
chooseFiles(message);
|