@celljs/ta-dash 4.41.0 → 4.43.0

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/host/index.mjs CHANGED
@@ -653,6 +653,13 @@ var TA_WEB_SETTINGS = [
653
653
  what: "Conversations not updated for these days are archived (out of the list, found by search); 0 for none.",
654
654
  title: words("Archive old conversations", "归档旧对话", "歸檔舊對話", "古い会話をアーカイブ")
655
655
  },
656
+ {
657
+ key: "clipboardLinks",
658
+ type: "boolean",
659
+ default: true,
660
+ what: "Links of Ta in what the user copied are offered as Ta comes back to the front, and in what they paste, with Open.",
661
+ title: words("Spot links of Ta you copy", "识别复制的 Ta 链接", "識別複製的 Ta 連結", "コピーした Ta のリンクを見つける")
662
+ },
656
663
  {
657
664
  key: "recentShots",
658
665
  type: "boolean",
@@ -3070,6 +3077,23 @@ var TaWorkMark;
3070
3077
  return TaWorkMark2.COMMENTED.includes(language) ? `<!-- ta-work: ${work} -->` : `"work": "${work}"`;
3071
3078
  }
3072
3079
  TaWorkMark2.mark = mark;
3080
+ function unnamed(language, code) {
3081
+ if (!of(language, code)) {
3082
+ return code;
3083
+ }
3084
+ if (TaWorkMark2.COMMENTED.includes(language)) {
3085
+ return code.replace(TaWorkMark2.COMMENT, "").replace(/^\s*\n/, "");
3086
+ }
3087
+ const stripped = code.replace(/"work"\s*:\s*"work-[a-z0-9]{1,32}"\s*,\s*/, "");
3088
+ try {
3089
+ if (!of(language, stripped) && JSON.parse(stripped)) {
3090
+ return stripped;
3091
+ }
3092
+ } catch (_a) {}
3093
+ const value = JSON.parse(code);
3094
+ return JSON.stringify(Object.fromEntries(Object.entries(value).filter(([key]) => key !== "work")), null, 2);
3095
+ }
3096
+ TaWorkMark2.unnamed = unnamed;
3073
3097
  })(TaWorkMark || (TaWorkMark = {}));
3074
3098
  // ../ta-protocol/esm/common/work-point.js
3075
3099
  var TaWorkPoint;
@@ -3175,6 +3199,15 @@ var TaWorkTitle;
3175
3199
  }
3176
3200
  }
3177
3201
  TaWorkTitle2.of = of;
3202
+ function repeats(own, titled) {
3203
+ const plain = (text) => {
3204
+ var _a;
3205
+ return (_a = clean(text === null || text === undefined ? undefined : text.replace(/[*_`]+/g, ""))) === null || _a === undefined ? undefined : _a.toLowerCase();
3206
+ };
3207
+ const shown = plain(titled);
3208
+ return shown !== undefined && plain(own) === shown;
3209
+ }
3210
+ TaWorkTitle2.repeats = repeats;
3178
3211
  function clean(text) {
3179
3212
  const line = text === null || text === undefined ? undefined : text.trim().replace(/\s+/g, " ");
3180
3213
  return line ? line.slice(0, 60) : undefined;
@@ -3191,6 +3224,29 @@ ${fence}`;
3191
3224
  }
3192
3225
  TaWorkBlock2.fenced = fenced;
3193
3226
  })(TaWorkBlock || (TaWorkBlock = {}));
3227
+ var TaWorkFile;
3228
+ (function(TaWorkFile2) {
3229
+ const TYPE = /^text\/vnd\.([a-z0-9-]+)\+markdown$/;
3230
+ function type(language2) {
3231
+ return `text/vnd.${language2}+markdown`;
3232
+ }
3233
+ TaWorkFile2.type = type;
3234
+ function language(type2) {
3235
+ var _a;
3236
+ const found = (_a = TYPE.exec(type2)) === null || _a === undefined ? undefined : _a[1];
3237
+ return found && TaWorkTitle.is(found) ? found : undefined;
3238
+ }
3239
+ TaWorkFile2.language = language;
3240
+ function name(title2) {
3241
+ const clean = Array.from(title2, (char) => char < " " || '\\/:*?"<>|'.includes(char) ? " " : char).join("").replace(/\s+/g, " ").trim().slice(0, 60);
3242
+ return `${clean || "work"}.md`;
3243
+ }
3244
+ TaWorkFile2.name = name;
3245
+ function title(name2) {
3246
+ return name2.replace(/\.md$/i, "");
3247
+ }
3248
+ TaWorkFile2.title = title;
3249
+ })(TaWorkFile || (TaWorkFile = {}));
3194
3250
  // ../ta-protocol/esm/common/workspace-protocol.js
3195
3251
  var TaWorkspaceServer = Symbol("TaWorkspaceServer");
3196
3252
  var TaTerminalServer = Symbol("TaTerminalServer");
@@ -4016,6 +4072,9 @@ class DashHost {
4016
4072
  if (event.type !== "turn_end" || event.error || event.aborted || event.group) {
4017
4073
  return;
4018
4074
  }
4075
+ if (event.actors?.some((actor) => actor !== TA_OWNER)) {
4076
+ return;
4077
+ }
4019
4078
  const cwd = this.local(event.cwd);
4020
4079
  const text2 = (await this.host.getLastAssistantText(event.sessionId)).text ?? "";
4021
4080
  let allowed = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-dash",
3
- "version": "4.41.0",
3
+ "version": "4.43.0",
4
4
  "description": "A pi package for Ta: dashboards of replies whose numbers come from queries run on the user's computer, kept current, each showing the query behind it",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/core": "4.41.0",
31
- "@celljs/ta-protocol": "4.41.0",
32
- "@celljs/ta-web": "4.41.0",
30
+ "@celljs/core": "4.43.0",
31
+ "@celljs/ta-protocol": "4.43.0",
32
+ "@celljs/ta-web": "4.43.0",
33
33
  "@types/node": "^24.0.0",
34
34
  "@types/react": "^19.3.3"
35
35
  },
package/web/index.js CHANGED
@@ -21,6 +21,99 @@ var DashLimits;
21
21
  DashLimits.MIN_REFRESH_MS = 60000;
22
22
  })(DashLimits ||= {});
23
23
 
24
+ // ../ta-protocol/esm/common/work-title.js
25
+ var TA_WORK_BLOCKS = {
26
+ "ta-play": "Gamepad2",
27
+ "ta-plot": "ChartSpline",
28
+ "ta-3d": "Box",
29
+ "ta-glance": "LayoutDashboard",
30
+ "ta-doc": "FileText",
31
+ "ta-slides": "Presentation",
32
+ "ta-sheet": "Sheet",
33
+ "ta-dash": "Gauge",
34
+ "ta-motion": "Film"
35
+ };
36
+ var TaWorkTitle;
37
+ (function(TaWorkTitle2) {
38
+ function is(language) {
39
+ return Object.keys(TA_WORK_BLOCKS).includes(language);
40
+ }
41
+ TaWorkTitle2.is = is;
42
+ const MARKDOWN = ["ta-doc", "ta-slides"];
43
+ function of(language, code) {
44
+ var _a, _b;
45
+ if (MARKDOWN.includes(language)) {
46
+ const heading = (_a = /^ {0,3}#{1,6}\s+(.+?)\s*#*\s*$/m.exec(code.replace(/^ {0,3}(`{3,}|~{3,})[\s\S]*?^ {0,3}\1/gm, ""))) === null || _a === undefined ? undefined : _a[1];
47
+ return clean(heading === null || heading === undefined ? undefined : heading.replace(/[*_`]+/g, ""));
48
+ }
49
+ if (language === "ta-play") {
50
+ const title = (_b = /<title[^>]*>([^<]*)<\/title>/i.exec(code)) === null || _b === undefined ? undefined : _b[1];
51
+ return clean(title === null || title === undefined ? undefined : title.replace(/&(amp|lt|gt|quot|#39);/g, (_, name) => {
52
+ var _a2;
53
+ return (_a2 = { amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'" }[name]) !== null && _a2 !== undefined ? _a2 : "";
54
+ }));
55
+ }
56
+ try {
57
+ const value = JSON.parse(code);
58
+ if (typeof (value === null || value === undefined ? undefined : value.title) === "string") {
59
+ return clean(value.title);
60
+ }
61
+ const first = Array.isArray(value === null || value === undefined ? undefined : value.blocks) ? value.blocks.find((block) => typeof (block === null || block === undefined ? undefined : block.title) === "string" || typeof (block === null || block === undefined ? undefined : block.question) === "string") : undefined;
62
+ return clean(typeof (first === null || first === undefined ? undefined : first.title) === "string" ? first.title : typeof (first === null || first === undefined ? undefined : first.question) === "string" ? first.question : undefined);
63
+ } catch (_c) {
64
+ return;
65
+ }
66
+ }
67
+ TaWorkTitle2.of = of;
68
+ function repeats(own, titled) {
69
+ const plain = (text) => {
70
+ var _a;
71
+ return (_a = clean(text === null || text === undefined ? undefined : text.replace(/[*_`]+/g, ""))) === null || _a === undefined ? undefined : _a.toLowerCase();
72
+ };
73
+ const shown = plain(titled);
74
+ return shown !== undefined && plain(own) === shown;
75
+ }
76
+ TaWorkTitle2.repeats = repeats;
77
+ function clean(text) {
78
+ const line = text === null || text === undefined ? undefined : text.trim().replace(/\s+/g, " ");
79
+ return line ? line.slice(0, 60) : undefined;
80
+ }
81
+ })(TaWorkTitle || (TaWorkTitle = {}));
82
+ var TaWorkBlock;
83
+ (function(TaWorkBlock2) {
84
+ function fenced(language, code) {
85
+ const longest = Math.max(2, ...[...code.matchAll(/`+/g)].map((run) => run[0].length));
86
+ const fence = "`".repeat(longest + 1);
87
+ return `${fence}${language}
88
+ ${code}
89
+ ${fence}`;
90
+ }
91
+ TaWorkBlock2.fenced = fenced;
92
+ })(TaWorkBlock || (TaWorkBlock = {}));
93
+ var TaWorkFile;
94
+ (function(TaWorkFile2) {
95
+ const TYPE = /^text\/vnd\.([a-z0-9-]+)\+markdown$/;
96
+ function type(language2) {
97
+ return `text/vnd.${language2}+markdown`;
98
+ }
99
+ TaWorkFile2.type = type;
100
+ function language(type2) {
101
+ var _a;
102
+ const found = (_a = TYPE.exec(type2)) === null || _a === undefined ? undefined : _a[1];
103
+ return found && TaWorkTitle.is(found) ? found : undefined;
104
+ }
105
+ TaWorkFile2.language = language;
106
+ function name(title2) {
107
+ const clean = Array.from(title2, (char) => char < " " || '\\/:*?"<>|'.includes(char) ? " " : char).join("").replace(/\s+/g, " ").trim().slice(0, 60);
108
+ return `${clean || "work"}.md`;
109
+ }
110
+ TaWorkFile2.name = name;
111
+ function title(name2) {
112
+ return name2.replace(/\.md$/i, "");
113
+ }
114
+ TaWorkFile2.title = title;
115
+ })(TaWorkFile || (TaWorkFile = {}));
116
+
24
117
  // web-src/dash-rows.ts
25
118
  var ROW_KEYS = ["rows", "data", "results", "result", "items", "records", "values"];
26
119
  function cell(value) {
@@ -727,9 +820,11 @@ function dashView(pi) {
727
820
  open,
728
821
  onOpen,
729
822
  props,
730
- title
823
+ title,
824
+ shared
731
825
  }) {
732
826
  const result = answer?.result;
827
+ const ago = result && !result.error ? DashWords.ago(words, result.at) : undefined;
733
828
  const query = dash.sources.find((source) => source.name === tile2.source)?.run ?? "";
734
829
  let body;
735
830
  if (!result) {
@@ -786,9 +881,9 @@ function dashView(pi) {
786
881
  className: "tdash-tile-head"
787
882
  }, /* @__PURE__ */ React.createElement("span", {
788
883
  className: "tdash-label"
789
- }, tile2.label), result && !result.error && /* @__PURE__ */ React.createElement("span", {
884
+ }, tile2.label), ago && ago !== shared && /* @__PURE__ */ React.createElement("span", {
790
885
  className: "tdash-ago"
791
- }, DashWords.ago(words, result.at))), body, tile2.note && /* @__PURE__ */ React.createElement("div", {
886
+ }, ago)), body, tile2.note && /* @__PURE__ */ React.createElement("div", {
792
887
  className: "tdash-note"
793
888
  }, tile2.note), open && /* @__PURE__ */ React.createElement(Detail, {
794
889
  tile: tile2,
@@ -907,7 +1002,7 @@ function dashView(pi) {
907
1002
  ref: card
908
1003
  }, /* @__PURE__ */ React.createElement("div", {
909
1004
  className: "tdash-head"
910
- }, /* @__PURE__ */ React.createElement("div", {
1005
+ }, !TaWorkTitle.repeats(title, props.titled) && /* @__PURE__ */ React.createElement("div", {
911
1006
  className: "tdash-title"
912
1007
  }, title), /* @__PURE__ */ React.createElement("div", {
913
1008
  className: "tdash-fresh"
@@ -938,7 +1033,7 @@ function dashView(pi) {
938
1033
  className: "tdash-ask-hint"
939
1034
  }, words.askHint), /* @__PURE__ */ React.createElement("button", {
940
1035
  type: "button",
941
- className: acting ? "tdash-allow ta-busy" : "tdash-allow",
1036
+ className: acting ? "ta-button ta-primary ta-busy" : "ta-button ta-primary",
942
1037
  disabled: busy,
943
1038
  onClick: () => void run(() => load("approve"))
944
1039
  }, words.allow)), /* @__PURE__ */ React.createElement("div", {
@@ -953,7 +1048,8 @@ function dashView(pi) {
953
1048
  open: open === index,
954
1049
  onOpen: () => setOpen(open === index ? undefined : index),
955
1050
  props,
956
- title
1051
+ title,
1052
+ shared: oldest !== undefined ? DashWords.ago(words, oldest) : undefined
957
1053
  }))), props.send && times.length > 0 && /* @__PURE__ */ React.createElement("div", {
958
1054
  className: "tdash-next"
959
1055
  }, /* @__PURE__ */ React.createElement("button", {
@@ -996,7 +1092,11 @@ function dashView(pi) {
996
1092
 
997
1093
  // web-src/style.ts
998
1094
  var STYLE = `
999
- /* A dashboard of a reply (\`\`\`ta-dash): a head with when it was fetched, tiles in a grid, the query behind a tile once tapped. */
1095
+ /*
1096
+ * A dashboard of a reply (\`\`\`ta-dash): a head with when it was fetched, tiles in a grid, the query behind a tile once
1097
+ * tapped. One frame, the card's (AGENTS.md "A block has one frame"): a tile is a fill, a chart in it has no frame of its
1098
+ * own, the query is a fill on the tile, its buttons are chips.
1099
+ */
1000
1100
  .tdash-card {
1001
1101
  --tdash-s: var(--ta-font-scale, 1);
1002
1102
  margin: 2px 0 12px;
@@ -1012,36 +1112,36 @@ var STYLE = `
1012
1112
  }
1013
1113
  .ta-code-embedded > .tdash-card { margin: 0; padding: 0; max-width: none; border: 0; background: none; }
1014
1114
  .tdash-making, .tdash-failed { color: var(--ta-muted); }
1015
- .tdash-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
1115
+ .tdash-head { display: flex; align-items: center; gap: 8px; margin: -2px -4px 10px 0; }
1016
1116
  .tdash-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1017
1117
  .tdash-fresh { flex: 1; min-width: 0; color: var(--ta-muted); font-size: calc(12px * var(--tdash-s)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1018
1118
  .tdash-refresh {
1019
1119
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
1020
- border: 1px solid var(--ta-border); border-radius: 8px; background: transparent; color: var(--ta-muted); cursor: pointer;
1120
+ border: 0; border-radius: 8px; background: transparent; color: var(--ta-muted); cursor: pointer;
1021
1121
  }
1022
1122
  .tdash-refresh:hover { color: var(--ta-text); background: var(--ta-hover); }
1023
1123
  .tdash-refresh[data-busy] svg { animation: tdash-spin 0.9s linear infinite; }
1024
1124
  @keyframes tdash-spin { to { transform: rotate(360deg); } }
1025
1125
  .tdash-banner { margin-bottom: 10px; color: var(--ta-muted); font-size: calc(12px * var(--tdash-s)); }
1026
- .tdash-ask { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--ta-border); border-radius: 10px; background: var(--ta-hover); }
1126
+ .tdash-ask { margin-bottom: 10px; padding: 10px 12px; border-radius: 10px; background: var(--ta-raised); }
1027
1127
  .tdash-ask-title { font-weight: 600; margin-bottom: 6px; }
1028
1128
  .tdash-ask-hint { color: var(--ta-muted); font-size: calc(12px * var(--tdash-s)); margin: 6px 0 8px; }
1029
- .tdash-allow {
1030
- padding: 5px 14px; border: 0; border-radius: 8px; background: var(--ta-accent); color: #fff; font: inherit; cursor: pointer;
1031
- }
1032
- .tdash-allow:disabled { opacity: 0.6; }
1033
1129
  .tdash-query {
1034
- margin: 4px 0 0; padding: 6px 8px; border-radius: 6px; background: var(--ta-card); border: 1px solid var(--ta-border);
1035
- font-family: var(--ta-mono, ui-monospace, monospace); font-size: calc(11.5px * var(--tdash-s));
1036
- white-space: pre-wrap; word-break: break-all; max-height: 140px; overflow: auto;
1130
+ margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--ta-card); color: var(--ta-body, var(--ta-text));
1131
+ font-family: var(--ta-mono, ui-monospace, monospace); font-size: calc(11.5px * var(--tdash-s)); line-height: 1.55;
1132
+ white-space: pre-wrap; overflow-wrap: anywhere; max-height: 140px; overflow: auto;
1037
1133
  }
1038
1134
  .tdash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
1039
1135
  .tdash-tile {
1040
- min-width: 0; padding: 10px 12px; border: 1px solid var(--ta-border); border-radius: 10px; cursor: pointer;
1041
- transition: border-color 0.15s;
1136
+ min-width: 0; padding: 10px 12px; border-radius: 10px; background: var(--ta-raised); cursor: pointer;
1137
+ transition: background 0.15s;
1042
1138
  }
1043
- .tdash-tile:hover, .tdash-tile[data-open] { border-color: var(--ta-accent); }
1139
+ .tdash-tile:hover { background: var(--ta-hover); }
1140
+ .tdash-tile:focus-visible { outline: 2px solid var(--ta-border-focus); outline-offset: 1px; }
1141
+ .tdash-tile[data-open] { background: var(--ta-raised); cursor: default; }
1044
1142
  .tdash-tile:not([data-kind="stat"]) { grid-column: span 2; }
1143
+ /* Opened, a tile takes the whole row: its query reads in full, the tile beside it does not stretch to its height. */
1144
+ .tdash-tile[data-open] { grid-column: 1 / -1; }
1045
1145
  @container (max-width: 340px) { .tdash-tile:not([data-kind="stat"]) { grid-column: 1 / -1; } }
1046
1146
  .tdash-tile-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
1047
1147
  .tdash-label { flex: 1; min-width: 0; color: var(--ta-muted); font-size: calc(12px * var(--tdash-s)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -1056,15 +1156,18 @@ var STYLE = `
1056
1156
  .tdash-pending { color: var(--ta-muted); padding: 6px 0; }
1057
1157
  .tdash-error { color: var(--ta-red, #dc2626); font-size: calc(12px * var(--tdash-s)); word-break: break-word; }
1058
1158
  .tdash-note { margin-top: 4px; color: var(--ta-muted); font-size: calc(11.5px * var(--tdash-s)); }
1059
- .tdash-detail { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--ta-border); cursor: default; }
1159
+ .tdash-detail { margin-top: 10px; cursor: default; }
1060
1160
  .tdash-detail-head { color: var(--ta-muted); font-size: calc(11.5px * var(--tdash-s)); }
1061
1161
  .tdash-facts { margin-top: 6px; color: var(--ta-muted); font-size: calc(11.5px * var(--tdash-s)); }
1062
1162
  .tdash-actions, .tdash-next { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
1063
1163
  .tdash-actions button, .tdash-next button {
1064
- display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px solid var(--ta-border); border-radius: 999px;
1065
- background: transparent; color: var(--ta-text); font: inherit; font-size: calc(12px * var(--tdash-s)); cursor: pointer;
1164
+ display: inline-flex; align-items: center; gap: 5px; height: calc(28px * var(--tdash-s)); padding: 0 12px 0 10px; border: 0; border-radius: 999px;
1165
+ background: var(--ta-chip); color: var(--ta-text); font: inherit; font-size: calc(12px * var(--tdash-s)); cursor: pointer;
1166
+ transition: background 0.15s;
1066
1167
  }
1067
- .tdash-actions button:hover, .tdash-next button:hover { background: var(--ta-hover); }
1168
+ .tdash-actions button { background: var(--ta-card); }
1169
+ .tdash-actions button svg, .tdash-next button svg { color: var(--ta-muted); }
1170
+ .tdash-actions button:hover, .tdash-next button:hover { background: var(--ta-hover-strong); }
1068
1171
  .tdash-next { margin-top: 10px; }
1069
1172
  `;
1070
1173
  function injectStyle() {