@workflow-code/cli 0.2.4-20261011009.codex-cli-web → 0.2.4-20261012002.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-
|
|
27
|
+
const webCli = await import("./web-Z66GHLM3.js");
|
|
28
28
|
return webCli.main(argv.slice(1));
|
|
29
29
|
}
|
|
30
30
|
if (argv[0] === "workspace") {
|
|
@@ -2704,6 +2704,87 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
2704
2704
|
});
|
|
2705
2705
|
}
|
|
2706
2706
|
|
|
2707
|
+
// src/web/ui/trace-bridge.ts
|
|
2708
|
+
function traceSnapshot(state2) {
|
|
2709
|
+
const project2 = state2.project;
|
|
2710
|
+
if (!project2 || !["conversation", "workflow"].includes(project2.projectType)) {
|
|
2711
|
+
return;
|
|
2712
|
+
}
|
|
2713
|
+
const base = { project: { id: project2.id, name: project2.name, projectType: project2.projectType }, running: state2.running };
|
|
2714
|
+
if (project2.projectType === "workflow") {
|
|
2715
|
+
return { ...base, runs: state2.runs, selectedId: state2.selectedId, run: state2.run, occupiedRun: state2.occupiedRun, history: state2.history };
|
|
2716
|
+
}
|
|
2717
|
+
return { ...base, activeId: state2.activeId, sessions: (state2.sessions ?? []).map((session) => ({
|
|
2718
|
+
id: session.id,
|
|
2719
|
+
title: session.title,
|
|
2720
|
+
createdAt: session.createdAt,
|
|
2721
|
+
updatedAt: session.updatedAt,
|
|
2722
|
+
messages: (session.messages ?? []).map((message) => {
|
|
2723
|
+
const { id, role, content, items, error, status, durationMs, createdAt, model, runId, report, events, pendingInput, resolvedInputs } = message;
|
|
2724
|
+
return { id, role, content, items, error, status, durationMs, createdAt, model, runId, report, events, pendingInput, resolvedInputs };
|
|
2725
|
+
})
|
|
2726
|
+
})) };
|
|
2727
|
+
}
|
|
2728
|
+
var TraceBridge = class {
|
|
2729
|
+
constructor(send) {
|
|
2730
|
+
this.send = send;
|
|
2731
|
+
}
|
|
2732
|
+
send;
|
|
2733
|
+
enabled = false;
|
|
2734
|
+
snapshot;
|
|
2735
|
+
status = "connecting";
|
|
2736
|
+
get active() {
|
|
2737
|
+
return this.enabled;
|
|
2738
|
+
}
|
|
2739
|
+
enable(version) {
|
|
2740
|
+
this.enabled = version === 1;
|
|
2741
|
+
if (this.enabled) {
|
|
2742
|
+
this.publish("status", { status: this.status });
|
|
2743
|
+
if (this.snapshot) {
|
|
2744
|
+
this.publish("state", { snapshot: this.snapshot });
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
receive(message) {
|
|
2749
|
+
if (message.type === "state") {
|
|
2750
|
+
this.snapshot = traceSnapshot(message);
|
|
2751
|
+
if (this.snapshot) {
|
|
2752
|
+
this.publish("state", { snapshot: this.snapshot });
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
if (message.type === "connection") {
|
|
2756
|
+
this.status = message.status;
|
|
2757
|
+
this.publish("status", { status: this.status });
|
|
2758
|
+
}
|
|
2759
|
+
if (message.type === "trace-run") {
|
|
2760
|
+
this.publish("run", { run: message.run, runId: message.runId, error: message.error });
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
open(target) {
|
|
2764
|
+
if (!this.enabled) {
|
|
2765
|
+
return false;
|
|
2766
|
+
}
|
|
2767
|
+
this.publish("open", { target: { sessionId: target.sessionId, messageId: target.messageId, runId: target.runId } });
|
|
2768
|
+
return true;
|
|
2769
|
+
}
|
|
2770
|
+
command(value) {
|
|
2771
|
+
if (!this.enabled || this.snapshot?.project.projectType !== "workflow") {
|
|
2772
|
+
return;
|
|
2773
|
+
}
|
|
2774
|
+
if (value?.type === "run" && typeof value.runId === "string") {
|
|
2775
|
+
return { type: "workflow-trace", id: value.runId };
|
|
2776
|
+
}
|
|
2777
|
+
if (value?.type === "more") {
|
|
2778
|
+
return { type: "workflow-history", query: "", more: true };
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
publish(kind, value) {
|
|
2782
|
+
if (this.enabled) {
|
|
2783
|
+
this.send({ type: "workflow-trace", version: 1, kind, ...value });
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
};
|
|
2787
|
+
|
|
2707
2788
|
// src/web/ui/host.ts
|
|
2708
2789
|
function acquireWorkflowHost() {
|
|
2709
2790
|
const embedded = globalThis.acquireVsCodeApi;
|
|
@@ -2720,10 +2801,16 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
2720
2801
|
}
|
|
2721
2802
|
const storageKey = `workflow-web:${document.querySelector("meta[name=workflow-project]")?.content ?? location.pathname}`;
|
|
2722
2803
|
const emit = (message) => window.dispatchEvent(new MessageEvent("message", { data: message }));
|
|
2804
|
+
const trace = new TraceBridge((message) => {
|
|
2805
|
+
if (window.parent !== window) {
|
|
2806
|
+
window.parent.postMessage(message, "*");
|
|
2807
|
+
}
|
|
2808
|
+
});
|
|
2723
2809
|
const connection = new BrowserConnection((message) => {
|
|
2724
2810
|
if (message.type === "state" && message.account) {
|
|
2725
2811
|
accountPanel.update(message.account);
|
|
2726
2812
|
}
|
|
2813
|
+
trace.receive(message);
|
|
2727
2814
|
emit(message);
|
|
2728
2815
|
});
|
|
2729
2816
|
const request2 = async (message) => {
|
|
@@ -2738,11 +2825,25 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
2738
2825
|
if (event.data.theme === "dark" || event.data.theme === "light") {
|
|
2739
2826
|
document.documentElement.dataset.theme = event.data.theme;
|
|
2740
2827
|
}
|
|
2828
|
+
if (event.data.traceVersion !== void 0) {
|
|
2829
|
+
trace.enable(event.data.traceVersion);
|
|
2830
|
+
}
|
|
2831
|
+
const traceCommand = trace.command(event.data.traceCommand);
|
|
2832
|
+
if (traceCommand) {
|
|
2833
|
+
void request2(traceCommand).catch((error) => trace.receive({ type: "trace-run", runId: traceCommand.id, error: error.message }));
|
|
2834
|
+
}
|
|
2741
2835
|
if (event.data.command === "new" || event.data.command === "history") {
|
|
2742
2836
|
emit({ type: "assistant-command", command: event.data.command });
|
|
2743
2837
|
}
|
|
2744
2838
|
});
|
|
2745
2839
|
const handleReply = (reply) => {
|
|
2840
|
+
trace.receive(reply);
|
|
2841
|
+
if (reply.type === "trace-run") {
|
|
2842
|
+
if (!trace.active) {
|
|
2843
|
+
handleReply({ type: "preview", title: "\u8F68\u8FF9", content: reply.run });
|
|
2844
|
+
}
|
|
2845
|
+
return;
|
|
2846
|
+
}
|
|
2746
2847
|
if (reply.type === "download") {
|
|
2747
2848
|
const url = URL.createObjectURL(new Blob([reply.content], { type: reply.mimeType ?? "application/json" }));
|
|
2748
2849
|
const link = document.createElement("a");
|
|
@@ -2810,6 +2911,14 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
2810
2911
|
if (message.type === "ready") {
|
|
2811
2912
|
return;
|
|
2812
2913
|
}
|
|
2914
|
+
if (message.type === "trace") {
|
|
2915
|
+
if (trace.open(message)) {
|
|
2916
|
+
return;
|
|
2917
|
+
}
|
|
2918
|
+
if (message.runId && !message.messageId) {
|
|
2919
|
+
message = { type: "workflow-trace", id: message.runId };
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2813
2922
|
if (message.type === "copy") {
|
|
2814
2923
|
void navigator.clipboard.writeText(message.text).catch((error) => emit({ type: "error", message: error.message }));
|
|
2815
2924
|
return;
|
package/dist/web/workflow-ui.js
CHANGED
|
@@ -3247,13 +3247,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
3247
3247
|
continue;
|
|
3248
3248
|
}
|
|
3249
3249
|
let output = record(content.output);
|
|
3250
|
+
const details = record(output?.details);
|
|
3250
3251
|
if (Array.isArray(output?.content) && output.content.length === 1) {
|
|
3251
3252
|
try {
|
|
3252
3253
|
output = record(JSON.parse(String(record(output.content[0])?.text)));
|
|
3253
3254
|
} catch {
|
|
3254
3255
|
}
|
|
3255
3256
|
}
|
|
3256
|
-
let descriptor = record(record(output?.details)?.resourceCard);
|
|
3257
|
+
let descriptor = record(details?.resourceCard) ?? record(record(output?.details)?.resourceCard);
|
|
3257
3258
|
const input = record(content.input) ?? {};
|
|
3258
3259
|
const tool = string(content.tool) ?? "";
|
|
3259
3260
|
if (tool === "workflow-ui_present_card") {
|
|
@@ -4395,6 +4396,87 @@ ${state.user?.avatarUrl ?? ""}`;
|
|
|
4395
4396
|
});
|
|
4396
4397
|
}
|
|
4397
4398
|
|
|
4399
|
+
// src/web/ui/trace-bridge.ts
|
|
4400
|
+
function traceSnapshot(state) {
|
|
4401
|
+
const project = state.project;
|
|
4402
|
+
if (!project || !["conversation", "workflow"].includes(project.projectType)) {
|
|
4403
|
+
return;
|
|
4404
|
+
}
|
|
4405
|
+
const base = { project: { id: project.id, name: project.name, projectType: project.projectType }, running: state.running };
|
|
4406
|
+
if (project.projectType === "workflow") {
|
|
4407
|
+
return { ...base, runs: state.runs, selectedId: state.selectedId, run: state.run, occupiedRun: state.occupiedRun, history: state.history };
|
|
4408
|
+
}
|
|
4409
|
+
return { ...base, activeId: state.activeId, sessions: (state.sessions ?? []).map((session) => ({
|
|
4410
|
+
id: session.id,
|
|
4411
|
+
title: session.title,
|
|
4412
|
+
createdAt: session.createdAt,
|
|
4413
|
+
updatedAt: session.updatedAt,
|
|
4414
|
+
messages: (session.messages ?? []).map((message) => {
|
|
4415
|
+
const { id, role, content, items, error, status, durationMs, createdAt, model, runId, report, events, pendingInput, resolvedInputs } = message;
|
|
4416
|
+
return { id, role, content, items, error, status, durationMs, createdAt, model, runId, report, events, pendingInput, resolvedInputs };
|
|
4417
|
+
})
|
|
4418
|
+
})) };
|
|
4419
|
+
}
|
|
4420
|
+
var TraceBridge = class {
|
|
4421
|
+
constructor(send) {
|
|
4422
|
+
this.send = send;
|
|
4423
|
+
}
|
|
4424
|
+
send;
|
|
4425
|
+
enabled = false;
|
|
4426
|
+
snapshot;
|
|
4427
|
+
status = "connecting";
|
|
4428
|
+
get active() {
|
|
4429
|
+
return this.enabled;
|
|
4430
|
+
}
|
|
4431
|
+
enable(version) {
|
|
4432
|
+
this.enabled = version === 1;
|
|
4433
|
+
if (this.enabled) {
|
|
4434
|
+
this.publish("status", { status: this.status });
|
|
4435
|
+
if (this.snapshot) {
|
|
4436
|
+
this.publish("state", { snapshot: this.snapshot });
|
|
4437
|
+
}
|
|
4438
|
+
}
|
|
4439
|
+
}
|
|
4440
|
+
receive(message) {
|
|
4441
|
+
if (message.type === "state") {
|
|
4442
|
+
this.snapshot = traceSnapshot(message);
|
|
4443
|
+
if (this.snapshot) {
|
|
4444
|
+
this.publish("state", { snapshot: this.snapshot });
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
if (message.type === "connection") {
|
|
4448
|
+
this.status = message.status;
|
|
4449
|
+
this.publish("status", { status: this.status });
|
|
4450
|
+
}
|
|
4451
|
+
if (message.type === "trace-run") {
|
|
4452
|
+
this.publish("run", { run: message.run, runId: message.runId, error: message.error });
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
open(target) {
|
|
4456
|
+
if (!this.enabled) {
|
|
4457
|
+
return false;
|
|
4458
|
+
}
|
|
4459
|
+
this.publish("open", { target: { sessionId: target.sessionId, messageId: target.messageId, runId: target.runId } });
|
|
4460
|
+
return true;
|
|
4461
|
+
}
|
|
4462
|
+
command(value) {
|
|
4463
|
+
if (!this.enabled || this.snapshot?.project.projectType !== "workflow") {
|
|
4464
|
+
return;
|
|
4465
|
+
}
|
|
4466
|
+
if (value?.type === "run" && typeof value.runId === "string") {
|
|
4467
|
+
return { type: "workflow-trace", id: value.runId };
|
|
4468
|
+
}
|
|
4469
|
+
if (value?.type === "more") {
|
|
4470
|
+
return { type: "workflow-history", query: "", more: true };
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
publish(kind, value) {
|
|
4474
|
+
if (this.enabled) {
|
|
4475
|
+
this.send({ type: "workflow-trace", version: 1, kind, ...value });
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4478
|
+
};
|
|
4479
|
+
|
|
4398
4480
|
// src/web/ui/host.ts
|
|
4399
4481
|
function acquireWorkflowHost() {
|
|
4400
4482
|
const embedded = globalThis.acquireVsCodeApi;
|
|
@@ -4411,10 +4493,16 @@ ${state.user?.avatarUrl ?? ""}`;
|
|
|
4411
4493
|
}
|
|
4412
4494
|
const storageKey = `workflow-web:${document.querySelector("meta[name=workflow-project]")?.content ?? location.pathname}`;
|
|
4413
4495
|
const emit = (message) => window.dispatchEvent(new MessageEvent("message", { data: message }));
|
|
4496
|
+
const trace = new TraceBridge((message) => {
|
|
4497
|
+
if (window.parent !== window) {
|
|
4498
|
+
window.parent.postMessage(message, "*");
|
|
4499
|
+
}
|
|
4500
|
+
});
|
|
4414
4501
|
const connection = new BrowserConnection((message) => {
|
|
4415
4502
|
if (message.type === "state" && message.account) {
|
|
4416
4503
|
accountPanel.update(message.account);
|
|
4417
4504
|
}
|
|
4505
|
+
trace.receive(message);
|
|
4418
4506
|
emit(message);
|
|
4419
4507
|
});
|
|
4420
4508
|
const request = async (message) => {
|
|
@@ -4429,11 +4517,25 @@ ${state.user?.avatarUrl ?? ""}`;
|
|
|
4429
4517
|
if (event.data.theme === "dark" || event.data.theme === "light") {
|
|
4430
4518
|
document.documentElement.dataset.theme = event.data.theme;
|
|
4431
4519
|
}
|
|
4520
|
+
if (event.data.traceVersion !== void 0) {
|
|
4521
|
+
trace.enable(event.data.traceVersion);
|
|
4522
|
+
}
|
|
4523
|
+
const traceCommand = trace.command(event.data.traceCommand);
|
|
4524
|
+
if (traceCommand) {
|
|
4525
|
+
void request(traceCommand).catch((error) => trace.receive({ type: "trace-run", runId: traceCommand.id, error: error.message }));
|
|
4526
|
+
}
|
|
4432
4527
|
if (event.data.command === "new" || event.data.command === "history") {
|
|
4433
4528
|
emit({ type: "assistant-command", command: event.data.command });
|
|
4434
4529
|
}
|
|
4435
4530
|
});
|
|
4436
4531
|
const handleReply = (reply) => {
|
|
4532
|
+
trace.receive(reply);
|
|
4533
|
+
if (reply.type === "trace-run") {
|
|
4534
|
+
if (!trace.active) {
|
|
4535
|
+
handleReply({ type: "preview", title: "\u8F68\u8FF9", content: reply.run });
|
|
4536
|
+
}
|
|
4537
|
+
return;
|
|
4538
|
+
}
|
|
4437
4539
|
if (reply.type === "download") {
|
|
4438
4540
|
const url = URL.createObjectURL(new Blob([reply.content], { type: reply.mimeType ?? "application/json" }));
|
|
4439
4541
|
const link = document.createElement("a");
|
|
@@ -4501,6 +4603,14 @@ ${state.user?.avatarUrl ?? ""}`;
|
|
|
4501
4603
|
if (message.type === "ready") {
|
|
4502
4604
|
return;
|
|
4503
4605
|
}
|
|
4606
|
+
if (message.type === "trace") {
|
|
4607
|
+
if (trace.open(message)) {
|
|
4608
|
+
return;
|
|
4609
|
+
}
|
|
4610
|
+
if (message.runId && !message.messageId) {
|
|
4611
|
+
message = { type: "workflow-trace", id: message.runId };
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4504
4614
|
if (message.type === "copy") {
|
|
4505
4615
|
void navigator.clipboard.writeText(message.text).catch((error) => emit({ type: "error", message: error.message }));
|
|
4506
4616
|
return;
|
|
@@ -5268,7 +5378,7 @@ ${state.user?.avatarUrl ?? ""}`;
|
|
|
5268
5378
|
resource: (card) => post({ type: "resource", messageId: view.message.id, cardId: card.id })
|
|
5269
5379
|
});
|
|
5270
5380
|
const actions = root.querySelector(".message-actions");
|
|
5271
|
-
actions.prepend(iconButton("
|
|
5381
|
+
actions.prepend(iconButton("history", "\u8F68\u8FF9", () => post({ type: "trace", messageId: view.message.id, runId: view.message.runId })));
|
|
5272
5382
|
const exportButton = iconButton("export", "\u5BFC\u51FA\u8FD0\u884C\u8BB0\u5F55", () => {
|
|
5273
5383
|
exportButton.disabled = true;
|
|
5274
5384
|
exportButton.innerHTML = iconHtml("loading");
|
|
@@ -6248,6 +6248,87 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
6248
6248
|
});
|
|
6249
6249
|
}
|
|
6250
6250
|
|
|
6251
|
+
// src/web/ui/trace-bridge.ts
|
|
6252
|
+
function traceSnapshot(state2) {
|
|
6253
|
+
const project = state2.project;
|
|
6254
|
+
if (!project || !["conversation", "workflow"].includes(project.projectType)) {
|
|
6255
|
+
return;
|
|
6256
|
+
}
|
|
6257
|
+
const base = { project: { id: project.id, name: project.name, projectType: project.projectType }, running: state2.running };
|
|
6258
|
+
if (project.projectType === "workflow") {
|
|
6259
|
+
return { ...base, runs: state2.runs, selectedId: state2.selectedId, run: state2.run, occupiedRun: state2.occupiedRun, history: state2.history };
|
|
6260
|
+
}
|
|
6261
|
+
return { ...base, activeId: state2.activeId, sessions: (state2.sessions ?? []).map((session) => ({
|
|
6262
|
+
id: session.id,
|
|
6263
|
+
title: session.title,
|
|
6264
|
+
createdAt: session.createdAt,
|
|
6265
|
+
updatedAt: session.updatedAt,
|
|
6266
|
+
messages: (session.messages ?? []).map((message) => {
|
|
6267
|
+
const { id, role, content, items, error, status, durationMs, createdAt, model, runId, report, events, pendingInput, resolvedInputs } = message;
|
|
6268
|
+
return { id, role, content, items, error, status, durationMs, createdAt, model, runId, report, events, pendingInput, resolvedInputs };
|
|
6269
|
+
})
|
|
6270
|
+
})) };
|
|
6271
|
+
}
|
|
6272
|
+
var TraceBridge = class {
|
|
6273
|
+
constructor(send) {
|
|
6274
|
+
this.send = send;
|
|
6275
|
+
}
|
|
6276
|
+
send;
|
|
6277
|
+
enabled = false;
|
|
6278
|
+
snapshot;
|
|
6279
|
+
status = "connecting";
|
|
6280
|
+
get active() {
|
|
6281
|
+
return this.enabled;
|
|
6282
|
+
}
|
|
6283
|
+
enable(version) {
|
|
6284
|
+
this.enabled = version === 1;
|
|
6285
|
+
if (this.enabled) {
|
|
6286
|
+
this.publish("status", { status: this.status });
|
|
6287
|
+
if (this.snapshot) {
|
|
6288
|
+
this.publish("state", { snapshot: this.snapshot });
|
|
6289
|
+
}
|
|
6290
|
+
}
|
|
6291
|
+
}
|
|
6292
|
+
receive(message) {
|
|
6293
|
+
if (message.type === "state") {
|
|
6294
|
+
this.snapshot = traceSnapshot(message);
|
|
6295
|
+
if (this.snapshot) {
|
|
6296
|
+
this.publish("state", { snapshot: this.snapshot });
|
|
6297
|
+
}
|
|
6298
|
+
}
|
|
6299
|
+
if (message.type === "connection") {
|
|
6300
|
+
this.status = message.status;
|
|
6301
|
+
this.publish("status", { status: this.status });
|
|
6302
|
+
}
|
|
6303
|
+
if (message.type === "trace-run") {
|
|
6304
|
+
this.publish("run", { run: message.run, runId: message.runId, error: message.error });
|
|
6305
|
+
}
|
|
6306
|
+
}
|
|
6307
|
+
open(target) {
|
|
6308
|
+
if (!this.enabled) {
|
|
6309
|
+
return false;
|
|
6310
|
+
}
|
|
6311
|
+
this.publish("open", { target: { sessionId: target.sessionId, messageId: target.messageId, runId: target.runId } });
|
|
6312
|
+
return true;
|
|
6313
|
+
}
|
|
6314
|
+
command(value) {
|
|
6315
|
+
if (!this.enabled || this.snapshot?.project.projectType !== "workflow") {
|
|
6316
|
+
return;
|
|
6317
|
+
}
|
|
6318
|
+
if (value?.type === "run" && typeof value.runId === "string") {
|
|
6319
|
+
return { type: "workflow-trace", id: value.runId };
|
|
6320
|
+
}
|
|
6321
|
+
if (value?.type === "more") {
|
|
6322
|
+
return { type: "workflow-history", query: "", more: true };
|
|
6323
|
+
}
|
|
6324
|
+
}
|
|
6325
|
+
publish(kind, value) {
|
|
6326
|
+
if (this.enabled) {
|
|
6327
|
+
this.send({ type: "workflow-trace", version: 1, kind, ...value });
|
|
6328
|
+
}
|
|
6329
|
+
}
|
|
6330
|
+
};
|
|
6331
|
+
|
|
6251
6332
|
// src/web/ui/host.ts
|
|
6252
6333
|
function acquireWorkflowHost() {
|
|
6253
6334
|
const embedded = globalThis.acquireVsCodeApi;
|
|
@@ -6264,10 +6345,16 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
6264
6345
|
}
|
|
6265
6346
|
const storageKey = `workflow-web:${document.querySelector("meta[name=workflow-project]")?.content ?? location.pathname}`;
|
|
6266
6347
|
const emit = (message) => window.dispatchEvent(new MessageEvent("message", { data: message }));
|
|
6348
|
+
const trace = new TraceBridge((message) => {
|
|
6349
|
+
if (window.parent !== window) {
|
|
6350
|
+
window.parent.postMessage(message, "*");
|
|
6351
|
+
}
|
|
6352
|
+
});
|
|
6267
6353
|
const connection = new BrowserConnection((message) => {
|
|
6268
6354
|
if (message.type === "state" && message.account) {
|
|
6269
6355
|
accountPanel.update(message.account);
|
|
6270
6356
|
}
|
|
6357
|
+
trace.receive(message);
|
|
6271
6358
|
emit(message);
|
|
6272
6359
|
});
|
|
6273
6360
|
const request = async (message) => {
|
|
@@ -6282,11 +6369,25 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
6282
6369
|
if (event.data.theme === "dark" || event.data.theme === "light") {
|
|
6283
6370
|
document.documentElement.dataset.theme = event.data.theme;
|
|
6284
6371
|
}
|
|
6372
|
+
if (event.data.traceVersion !== void 0) {
|
|
6373
|
+
trace.enable(event.data.traceVersion);
|
|
6374
|
+
}
|
|
6375
|
+
const traceCommand = trace.command(event.data.traceCommand);
|
|
6376
|
+
if (traceCommand) {
|
|
6377
|
+
void request(traceCommand).catch((error) => trace.receive({ type: "trace-run", runId: traceCommand.id, error: error.message }));
|
|
6378
|
+
}
|
|
6285
6379
|
if (event.data.command === "new" || event.data.command === "history") {
|
|
6286
6380
|
emit({ type: "assistant-command", command: event.data.command });
|
|
6287
6381
|
}
|
|
6288
6382
|
});
|
|
6289
6383
|
const handleReply = (reply) => {
|
|
6384
|
+
trace.receive(reply);
|
|
6385
|
+
if (reply.type === "trace-run") {
|
|
6386
|
+
if (!trace.active) {
|
|
6387
|
+
handleReply({ type: "preview", title: "\u8F68\u8FF9", content: reply.run });
|
|
6388
|
+
}
|
|
6389
|
+
return;
|
|
6390
|
+
}
|
|
6290
6391
|
if (reply.type === "download") {
|
|
6291
6392
|
const url = URL.createObjectURL(new Blob([reply.content], { type: reply.mimeType ?? "application/json" }));
|
|
6292
6393
|
const link = document.createElement("a");
|
|
@@ -6354,6 +6455,14 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
6354
6455
|
if (message.type === "ready") {
|
|
6355
6456
|
return;
|
|
6356
6457
|
}
|
|
6458
|
+
if (message.type === "trace") {
|
|
6459
|
+
if (trace.open(message)) {
|
|
6460
|
+
return;
|
|
6461
|
+
}
|
|
6462
|
+
if (message.runId && !message.messageId) {
|
|
6463
|
+
message = { type: "workflow-trace", id: message.runId };
|
|
6464
|
+
}
|
|
6465
|
+
}
|
|
6357
6466
|
if (message.type === "copy") {
|
|
6358
6467
|
void navigator.clipboard.writeText(message.text).catch((error) => emit({ type: "error", message: error.message }));
|
|
6359
6468
|
return;
|
|
@@ -7073,13 +7182,14 @@ ${state2.user?.avatarUrl ?? ""}`;
|
|
|
7073
7182
|
continue;
|
|
7074
7183
|
}
|
|
7075
7184
|
let output2 = record(content.output);
|
|
7185
|
+
const details = record(output2?.details);
|
|
7076
7186
|
if (Array.isArray(output2?.content) && output2.content.length === 1) {
|
|
7077
7187
|
try {
|
|
7078
7188
|
output2 = record(JSON.parse(String(record(output2.content[0])?.text)));
|
|
7079
7189
|
} catch {
|
|
7080
7190
|
}
|
|
7081
7191
|
}
|
|
7082
|
-
let descriptor = record(record(output2?.details)?.resourceCard);
|
|
7192
|
+
let descriptor = record(details?.resourceCard) ?? record(record(output2?.details)?.resourceCard);
|
|
7083
7193
|
const input = record(content.input) ?? {};
|
|
7084
7194
|
const tool = string(content.tool) ?? "";
|
|
7085
7195
|
if (tool === "workflow-ui_present_card") {
|
|
@@ -8306,6 +8416,9 @@ ${JSON.stringify(output2.details, null, 2)}` : "");
|
|
|
8306
8416
|
</main><dialog id="history-dialog" class="conversation-dialog"><header><label class="history-search">${iconHtml("search")}<input id="search-history" type="search" placeholder="\u641C\u7D22\u8FD0\u884C\u8BB0\u5F55" aria-label="\u641C\u7D22\u8FD0\u884C\u8BB0\u5F55"></label><button id="close-history" class="icon-button" title="\u5173\u95ED" aria-label="\u5173\u95ED">${iconHtml("close")}</button></header><div id="search-results" class="dialog-body"></div><button id="search-more" class="all-history" hidden>\u52A0\u8F7D\u66F4\u591A</button></dialog>
|
|
8307
8417
|
<dialog id="node-dialog" class="conversation-dialog"><header><h2 id="node-title"></h2><button id="close-node" class="icon-button" title="\u5173\u95ED" aria-label="\u5173\u95ED">${iconHtml("close")}</button></header><pre id="node-detail" class="dialog-body web-preview"></pre></dialog>`;
|
|
8308
8418
|
var element = (id) => document.getElementById(id);
|
|
8419
|
+
var traceButton = iconButton("history", "\u8F68\u8FF9", () => post({ type: "trace", runId: state?.run?.id }));
|
|
8420
|
+
traceButton.id = "open-trace";
|
|
8421
|
+
document.querySelector(".run-heading-actions").prepend(traceButton);
|
|
8309
8422
|
var state;
|
|
8310
8423
|
var entrypointId;
|
|
8311
8424
|
var entrySignature = "";
|
|
@@ -1840,13 +1840,14 @@ function conversationResourceCards(items, projectId, conversationId) {
|
|
|
1840
1840
|
continue;
|
|
1841
1841
|
}
|
|
1842
1842
|
let output = record(content.output);
|
|
1843
|
+
const details = record(output?.details);
|
|
1843
1844
|
if (Array.isArray(output?.content) && output.content.length === 1) {
|
|
1844
1845
|
try {
|
|
1845
1846
|
output = record(JSON.parse(String(record(output.content[0])?.text)));
|
|
1846
1847
|
} catch {
|
|
1847
1848
|
}
|
|
1848
1849
|
}
|
|
1849
|
-
let descriptor = record(record(output?.details)?.resourceCard);
|
|
1850
|
+
let descriptor = record(details?.resourceCard) ?? record(record(output?.details)?.resourceCard);
|
|
1850
1851
|
const input = record(content.input) ?? {};
|
|
1851
1852
|
const tool = string(content.tool) ?? "";
|
|
1852
1853
|
if (tool === "workflow-ui_present_card") {
|
|
@@ -2028,6 +2029,14 @@ function createWorkflowActions(controller, runtime, project, revision, changed)
|
|
|
2028
2029
|
case "workflow-select":
|
|
2029
2030
|
await controller.select(message.id ? String(message.id) : void 0);
|
|
2030
2031
|
break;
|
|
2032
|
+
case "workflow-trace": {
|
|
2033
|
+
const run = controller.runs.find((record2) => record2.id === message.id);
|
|
2034
|
+
if (!run) {
|
|
2035
|
+
throw new Error("Run no longer exists.");
|
|
2036
|
+
}
|
|
2037
|
+
replies.push({ type: "trace-run", runId: run.id, run });
|
|
2038
|
+
break;
|
|
2039
|
+
}
|
|
2031
2040
|
case "workflow-draft": {
|
|
2032
2041
|
const draft = { values: values(message.params ?? {}, id) };
|
|
2033
2042
|
if (message.inputMode !== void 0) {
|
|
@@ -2855,7 +2864,7 @@ ${token}`;
|
|
|
2855
2864
|
if (message.type === "export-message") {
|
|
2856
2865
|
replies.push({ type: "download", name: `run-${answer.id}.json`, content: JSON.stringify(redactWorkflowData(answer, [...sensitiveTokens], false), null, 2) }, { type: "exported", sessionId: current.id, messageId: answer.id });
|
|
2857
2866
|
} else {
|
|
2858
|
-
replies.push({ type: "preview", title: message.type === "logs" ? "\u8FD0\u884C\u65E5\u5FD7" : "\
|
|
2867
|
+
replies.push({ type: "preview", title: message.type === "logs" ? "\u8FD0\u884C\u65E5\u5FD7" : "\u8F68\u8FF9", content: message.type === "logs" ? answer.report?.logs ?? "" : { report: answer.report, events: answer.events, items: answer.items } });
|
|
2859
2868
|
}
|
|
2860
2869
|
break;
|
|
2861
2870
|
}
|
|
@@ -3277,7 +3286,7 @@ async function main(argv) {
|
|
|
3277
3286
|
};
|
|
3278
3287
|
process.once("SIGINT", close);
|
|
3279
3288
|
process.once("SIGTERM", close);
|
|
3280
|
-
console.log(options.json ? JSON.stringify({ type: "ready", protocolVersion: 1, hostProtocolVersion: 1, assistantProtocolVersion: host?.assistant ? ASSISTANT_PROTOCOL_VERSION : void 0, url: app.url, project: { id: app.project.id, name: app.project.name, projectType: app.project.projectType }, runtime: app.project.runtime }) : `Workflow Web: ${app.url}`);
|
|
3289
|
+
console.log(options.json ? JSON.stringify({ type: "ready", protocolVersion: 1, hostProtocolVersion: 1, traceProtocolVersion: 1, assistantProtocolVersion: host?.assistant ? ASSISTANT_PROTOCOL_VERSION : void 0, url: app.url, project: { id: app.project.id, name: app.project.name, projectType: app.project.projectType }, runtime: app.project.runtime }) : `Workflow Web: ${app.url}`);
|
|
3281
3290
|
if (lines) {
|
|
3282
3291
|
void (async () => {
|
|
3283
3292
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workflow-code/cli",
|
|
3
|
-
"version": "0.2.4-
|
|
3
|
+
"version": "0.2.4-20261012002.codex-cli-web",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"workflow-code": "./dist/index.js"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"zod": "4.4.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"workflow-code": "0.2.4-20260929001"
|
|
24
|
+
"workflow-code": ">=0.2.4-20260929001 <0.2.5-0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@dagrejs/dagre": "1.1.8",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"vitest": "^4.1.7",
|
|
38
38
|
"workflow-code": "0.2.4-20260929001",
|
|
39
39
|
"@workflow-code/auth-config": "0.1.0",
|
|
40
|
-
"@workflow-code/i18n": "0.1.0",
|
|
41
40
|
"@workflow-code/execution-targets": "0.1.0",
|
|
41
|
+
"@workflow-code/i18n": "0.1.0",
|
|
42
42
|
"@workflow-code/kanban-project": "0.1.0",
|
|
43
43
|
"@workflow-code/openai-responses": "0.1.0",
|
|
44
44
|
"@workflow-code/project-dependencies": "0.1.0",
|