@celljs/ta-dash 4.42.0 → 4.44.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",
@@ -984,6 +991,11 @@ var TaCallSceneUtil;
984
991
  var MOVES = 40;
985
992
  // ../ta-protocol/esm/common/cloud-protocol.js
986
993
  var TaCloudServer = Symbol("TaCloudServer");
994
+ var TaCloudTools;
995
+ (function(TaCloudTools2) {
996
+ TaCloudTools2.DIR = ".ta/tools";
997
+ TaCloudTools2.BIN = `${TaCloudTools2.DIR}/bin`;
998
+ })(TaCloudTools || (TaCloudTools = {}));
987
999
  var PATTERN = /^(\*|(\*\.)?[a-z0-9_]([a-z0-9_-]*[a-z0-9_])?(\.[a-z0-9_]([a-z0-9_-]*[a-z0-9_])?)*)(:(\d{1,5}|\*))?$/;
988
1000
  var PORTS = [80, 443];
989
1001
  var TaEgressHosts;
@@ -1063,6 +1075,61 @@ var TaEgressHosts;
1063
1075
  }
1064
1076
  TaEgressHosts2.refusal = refusal;
1065
1077
  })(TaEgressHosts || (TaEgressHosts = {}));
1078
+ // ../ta-protocol/esm/common/command-prelude.js
1079
+ var CommandPrelude;
1080
+ (function(CommandPrelude2) {
1081
+ function quote(value) {
1082
+ return `'${value.replace(/'/g, `'\\''`)}'`;
1083
+ }
1084
+ CommandPrelude2.quote = quote;
1085
+ function usesGit(command) {
1086
+ return /(^|[\s;&|(`])git\s+-?[A-Za-z]/.test(command);
1087
+ }
1088
+ CommandPrelude2.usesGit = usesGit;
1089
+ function usesSsh(command) {
1090
+ return /(^|[\s;&|(`/])(ssh|scp|sftp|rsync|git)(\s|$)/.test(command);
1091
+ }
1092
+ CommandPrelude2.usesSsh = usesSsh;
1093
+ function gitHelper(name, user) {
1094
+ return `!f() { test "$1" = get || return 0; printf 'username=%s\\npassword=%s\\n' ${quote(user)} "$TA_SECRET_${name}"; }; f`;
1095
+ }
1096
+ CommandPrelude2.gitHelper = gitHelper;
1097
+ function script(parts) {
1098
+ const lines = [];
1099
+ for (const [name, value] of parts.env) {
1100
+ lines.push(`export TA_SECRET_${name}=${quote(value)}`);
1101
+ }
1102
+ if (parts.git.length) {
1103
+ lines.push("ta_git=${GIT_CONFIG_COUNT:-0}");
1104
+ const config = (key, value) => {
1105
+ lines.push(`export "GIT_CONFIG_KEY_$ta_git"=${quote(key)} "GIT_CONFIG_VALUE_$ta_git"=${quote(value)}`, "ta_git=$((ta_git + 1))");
1106
+ };
1107
+ for (const one of parts.git) {
1108
+ const key = `credential.https://${one.host}.helper`;
1109
+ config(key, "");
1110
+ config(key, gitHelper(one.name, one.user));
1111
+ }
1112
+ lines.push("export GIT_CONFIG_COUNT=$ta_git GIT_TERMINAL_PROMPT=0", "unset ta_git");
1113
+ }
1114
+ if (parts.proxy) {
1115
+ const url = quote(parts.proxy.url);
1116
+ const bundle = quote(parts.proxy.bundle);
1117
+ lines.push(`export HTTPS_PROXY=${url} https_proxy=${url} HTTP_PROXY=${url} http_proxy=${url} NODE_USE_ENV_PROXY=1`, "export NO_PROXY='localhost,127.0.0.1,::1' no_proxy='localhost,127.0.0.1,::1'", `export SSL_CERT_FILE=${bundle} CURL_CA_BUNDLE=${bundle} REQUESTS_CA_BUNDLE=${bundle} NODE_EXTRA_CA_CERTS=${bundle} GIT_SSL_CAINFO=${bundle} DENO_CERT=${bundle}`, "unset ALL_PROXY all_proxy");
1118
+ }
1119
+ if (parts.keys.length) {
1120
+ lines.push('eval "$(ssh-agent -s -t 1800)" >/dev/null');
1121
+ for (const key of parts.keys) {
1122
+ lines.push(`ssh-add -q ${quote(key)} </dev/null >/dev/null 2>&1`);
1123
+ }
1124
+ lines.push("trap 'ssh-agent -k >/dev/null 2>&1' EXIT");
1125
+ }
1126
+ lines.push("true");
1127
+ return `${lines.join(`
1128
+ `)}
1129
+ `;
1130
+ }
1131
+ CommandPrelude2.script = script;
1132
+ })(CommandPrelude || (CommandPrelude = {}));
1066
1133
  // ../ta-protocol/esm/common/confine-protocol.js
1067
1134
  var TA_CONFINED_MARK = "[ta:confined]";
1068
1135
  var AT = String.raw`(?:^|[;&|(\`]|\$\()\s*(?:sudo\s+|env\s+(?:\S+=\S*\s+)*|npx\s+|bunx\s+|pnpm\s+(?:exec|dlx)\s+|yarn\s+dlx\s+|exec\s+|xargs\s+(?:-\S+\s+)*)*`;
@@ -3070,6 +3137,23 @@ var TaWorkMark;
3070
3137
  return TaWorkMark2.COMMENTED.includes(language) ? `<!-- ta-work: ${work} -->` : `"work": "${work}"`;
3071
3138
  }
3072
3139
  TaWorkMark2.mark = mark;
3140
+ function unnamed(language, code) {
3141
+ if (!of(language, code)) {
3142
+ return code;
3143
+ }
3144
+ if (TaWorkMark2.COMMENTED.includes(language)) {
3145
+ return code.replace(TaWorkMark2.COMMENT, "").replace(/^\s*\n/, "");
3146
+ }
3147
+ const stripped = code.replace(/"work"\s*:\s*"work-[a-z0-9]{1,32}"\s*,\s*/, "");
3148
+ try {
3149
+ if (!of(language, stripped) && JSON.parse(stripped)) {
3150
+ return stripped;
3151
+ }
3152
+ } catch (_a) {}
3153
+ const value = JSON.parse(code);
3154
+ return JSON.stringify(Object.fromEntries(Object.entries(value).filter(([key]) => key !== "work")), null, 2);
3155
+ }
3156
+ TaWorkMark2.unnamed = unnamed;
3073
3157
  })(TaWorkMark || (TaWorkMark = {}));
3074
3158
  // ../ta-protocol/esm/common/work-point.js
3075
3159
  var TaWorkPoint;
@@ -3175,6 +3259,15 @@ var TaWorkTitle;
3175
3259
  }
3176
3260
  }
3177
3261
  TaWorkTitle2.of = of;
3262
+ function repeats(own, titled) {
3263
+ const plain = (text) => {
3264
+ var _a;
3265
+ return (_a = clean(text === null || text === undefined ? undefined : text.replace(/[*_`]+/g, ""))) === null || _a === undefined ? undefined : _a.toLowerCase();
3266
+ };
3267
+ const shown = plain(titled);
3268
+ return shown !== undefined && plain(own) === shown;
3269
+ }
3270
+ TaWorkTitle2.repeats = repeats;
3178
3271
  function clean(text) {
3179
3272
  const line = text === null || text === undefined ? undefined : text.trim().replace(/\s+/g, " ");
3180
3273
  return line ? line.slice(0, 60) : undefined;
@@ -3191,6 +3284,29 @@ ${fence}`;
3191
3284
  }
3192
3285
  TaWorkBlock2.fenced = fenced;
3193
3286
  })(TaWorkBlock || (TaWorkBlock = {}));
3287
+ var TaWorkFile;
3288
+ (function(TaWorkFile2) {
3289
+ const TYPE = /^text\/vnd\.([a-z0-9-]+)\+markdown$/;
3290
+ function type(language2) {
3291
+ return `text/vnd.${language2}+markdown`;
3292
+ }
3293
+ TaWorkFile2.type = type;
3294
+ function language(type2) {
3295
+ var _a;
3296
+ const found = (_a = TYPE.exec(type2)) === null || _a === undefined ? undefined : _a[1];
3297
+ return found && TaWorkTitle.is(found) ? found : undefined;
3298
+ }
3299
+ TaWorkFile2.language = language;
3300
+ function name(title2) {
3301
+ const clean = Array.from(title2, (char) => char < " " || '\\/:*?"<>|'.includes(char) ? " " : char).join("").replace(/\s+/g, " ").trim().slice(0, 60);
3302
+ return `${clean || "work"}.md`;
3303
+ }
3304
+ TaWorkFile2.name = name;
3305
+ function title(name2) {
3306
+ return name2.replace(/\.md$/i, "");
3307
+ }
3308
+ TaWorkFile2.title = title;
3309
+ })(TaWorkFile || (TaWorkFile = {}));
3194
3310
  // ../ta-protocol/esm/common/workspace-protocol.js
3195
3311
  var TaWorkspaceServer = Symbol("TaWorkspaceServer");
3196
3312
  var TaTerminalServer = Symbol("TaTerminalServer");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-dash",
3
- "version": "4.42.0",
3
+ "version": "4.44.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.42.0",
31
- "@celljs/ta-protocol": "4.42.0",
32
- "@celljs/ta-web": "4.42.0",
30
+ "@celljs/core": "4.44.0",
31
+ "@celljs/ta-protocol": "4.44.0",
32
+ "@celljs/ta-web": "4.44.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) {
@@ -909,7 +1002,7 @@ function dashView(pi) {
909
1002
  ref: card
910
1003
  }, /* @__PURE__ */ React.createElement("div", {
911
1004
  className: "tdash-head"
912
- }, /* @__PURE__ */ React.createElement("div", {
1005
+ }, !TaWorkTitle.repeats(title, props.titled) && /* @__PURE__ */ React.createElement("div", {
913
1006
  className: "tdash-title"
914
1007
  }, title), /* @__PURE__ */ React.createElement("div", {
915
1008
  className: "tdash-fresh"
@@ -940,7 +1033,7 @@ function dashView(pi) {
940
1033
  className: "tdash-ask-hint"
941
1034
  }, words.askHint), /* @__PURE__ */ React.createElement("button", {
942
1035
  type: "button",
943
- className: acting ? "tdash-allow ta-busy" : "tdash-allow",
1036
+ className: acting ? "ta-button ta-primary ta-busy" : "ta-button ta-primary",
944
1037
  disabled: busy,
945
1038
  onClick: () => void run(() => load("approve"))
946
1039
  }, words.allow)), /* @__PURE__ */ React.createElement("div", {
@@ -1033,10 +1126,6 @@ var STYLE = `
1033
1126
  .tdash-ask { margin-bottom: 10px; padding: 10px 12px; border-radius: 10px; background: var(--ta-raised); }
1034
1127
  .tdash-ask-title { font-weight: 600; margin-bottom: 6px; }
1035
1128
  .tdash-ask-hint { color: var(--ta-muted); font-size: calc(12px * var(--tdash-s)); margin: 6px 0 8px; }
1036
- .tdash-allow {
1037
- padding: 5px 14px; border: 0; border-radius: 8px; background: var(--ta-accent); color: #fff; font: inherit; cursor: pointer;
1038
- }
1039
- .tdash-allow:disabled { opacity: 0.6; }
1040
1129
  .tdash-query {
1041
1130
  margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--ta-card); color: var(--ta-body, var(--ta-text));
1042
1131
  font-family: var(--ta-mono, ui-monospace, monospace); font-size: calc(11.5px * var(--tdash-s)); line-height: 1.55;