@fieldwangai/agentflow 0.1.117 → 0.1.118

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.
@@ -3337,9 +3337,11 @@ function prdWorkflowShareLinkSummary(record, shareToken, publicBaseUrl, userId =
3337
3337
  workflowShare: token,
3338
3338
  });
3339
3339
  const base = String(publicBaseUrl || "").replace(/\/+$/, "");
3340
+ const shortUrl = `${base}/w/${encodeURIComponent(token)}`;
3340
3341
  return {
3341
3342
  tapdId: String(record.tapdId || ""),
3342
3343
  url: `${base}/workspace?${query.toString()}`,
3344
+ shortUrl,
3343
3345
  active: true,
3344
3346
  readOnly: true,
3345
3347
  createdAt: record.shareCreatedAt || "",
@@ -11096,6 +11098,40 @@ export function startUiServer({
11096
11098
  isAdmin: Boolean(authUser.isAdmin),
11097
11099
  adminOwnerId: String(url.searchParams.get("adminOwnerId") || "").trim(),
11098
11100
  } : {};
11101
+ if (req.method === "GET" && url.pathname.startsWith("/w/")) {
11102
+ const parts = url.pathname.split("/").filter(Boolean);
11103
+ if (parts.length !== 2) {
11104
+ res.writeHead(404);
11105
+ res.end("Not found");
11106
+ return;
11107
+ }
11108
+ let shareToken = "";
11109
+ try {
11110
+ shareToken = decodeURIComponent(parts[1] || "");
11111
+ } catch {
11112
+ res.writeHead(404);
11113
+ res.end("Not found");
11114
+ return;
11115
+ }
11116
+ const record = getPrdWorkflowCollaborationByShareToken(shareToken);
11117
+ if (!record) {
11118
+ res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
11119
+ res.end("Workflow share link is invalid or has been revoked");
11120
+ return;
11121
+ }
11122
+ const query = new URLSearchParams({
11123
+ view: "workflow",
11124
+ tapdId: String(record.tapdId || ""),
11125
+ workflowShare: shareToken,
11126
+ });
11127
+ res.writeHead(302, {
11128
+ Location: `/workspace?${query.toString()}`,
11129
+ "Cache-Control": "no-store",
11130
+ "Referrer-Policy": "no-referrer",
11131
+ });
11132
+ res.end();
11133
+ return;
11134
+ }
11099
11135
  if (req.method === "GET" && url.pathname === "/api/auth/session-token") {
11100
11136
  if (!authUser?.userId) {
11101
11137
  json(res, 401, { error: "Unauthorized" });
@@ -11418,7 +11454,7 @@ export function startUiServer({
11418
11454
  json(res, 200, {
11419
11455
  ok: true,
11420
11456
  snapshot,
11421
- ...(workflowShare ? { workflowShare, shareUrl: workflowShare.url } : {}),
11457
+ ...(workflowShare ? { workflowShare, shareUrl: workflowShare.shortUrl || workflowShare.url } : {}),
11422
11458
  });
11423
11459
  } catch (e) {
11424
11460
  json(res, 500, { error: (e && e.message) || String(e) });
@@ -11607,7 +11643,7 @@ export function startUiServer({
11607
11643
  json(res, 200, {
11608
11644
  ok: true,
11609
11645
  snapshot: withDiagnostic,
11610
- ...(workflowShare ? { workflowShare, shareUrl: workflowShare.url } : {}),
11646
+ ...(workflowShare ? { workflowShare, shareUrl: workflowShare.shortUrl || workflowShare.url } : {}),
11611
11647
  });
11612
11648
  } catch (e) {
11613
11649
  json(res, 500, { error: (e && e.message) || String(e) });