@celljs/ta-extensions 4.16.0 → 4.18.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/package.json +4 -4
- package/skills/ta-package/SKILL.md +67 -9
- package/web/index.js +1187 -255
package/web/index.js
CHANGED
|
@@ -173,7 +173,6 @@ var EN = {
|
|
|
173
173
|
trust: "An extension runs code on this computer: import only those of people you trust.",
|
|
174
174
|
dropToImport: "Drop to import",
|
|
175
175
|
notArchive: "Only a .tgz file of an extension imports.",
|
|
176
|
-
loading: "Loading…",
|
|
177
176
|
kinds: {
|
|
178
177
|
extensions: "Commands",
|
|
179
178
|
web: "On the page",
|
|
@@ -298,7 +297,6 @@ var ZH = {
|
|
|
298
297
|
trust: "扩展会在这台电脑上运行代码:只导入你信任的人给的扩展。",
|
|
299
298
|
dropToImport: "松开即可导入",
|
|
300
299
|
notArchive: "只能导入扩展的 .tgz 文件。",
|
|
301
|
-
loading: "正在加载…",
|
|
302
300
|
kinds: {
|
|
303
301
|
extensions: "命令",
|
|
304
302
|
web: "界面",
|
|
@@ -408,7 +406,6 @@ var ZH_TW = {
|
|
|
408
406
|
trust: "擴充功能會在這台電腦上執行程式碼:只匯入你信任的人給的擴充功能。",
|
|
409
407
|
dropToImport: "鬆開即可匯入",
|
|
410
408
|
notArchive: "只能匯入擴充功能的 .tgz 檔案。",
|
|
411
|
-
loading: "正在載入…",
|
|
412
409
|
kinds: {
|
|
413
410
|
extensions: "命令",
|
|
414
411
|
web: "介面",
|
|
@@ -518,7 +515,6 @@ var JA = {
|
|
|
518
515
|
trust: "拡張機能はこのコンピュータ上でコードを実行します。信頼できる人から提供された拡張機能のみをインポートしてください。",
|
|
519
516
|
dropToImport: "ドロップしてインポート",
|
|
520
517
|
notArchive: "拡張機能の .tgz ファイルのみインポートできます。",
|
|
521
|
-
loading: "読み込み中…",
|
|
522
518
|
kinds: {
|
|
523
519
|
extensions: "コマンド",
|
|
524
520
|
web: "ページ",
|
|
@@ -865,8 +861,515 @@ class MarketStore {
|
|
|
865
861
|
|
|
866
862
|
// ../ta-protocol/esm/common/access-protocol.js
|
|
867
863
|
var TaAccessServer = Symbol("TaAccessServer");
|
|
864
|
+
var TA_SIGN_IN_PATH = "/sign-in";
|
|
865
|
+
var TA_DEVICE_SIGN_IN_PATH = `${TA_SIGN_IN_PATH}/device`;
|
|
866
|
+
// ../ta-protocol/esm/common/ta-extension-host.js
|
|
867
|
+
var TA_WEBHOOK_MAX_BYTES = 256 * 1024;
|
|
868
|
+
var TA_HOST_EVENT = "ta:host";
|
|
869
|
+
var TaHostUtil;
|
|
870
|
+
(function(TaHostUtil2) {
|
|
871
|
+
TaHostUtil2.WAIT_MS = 1000;
|
|
872
|
+
function reach(events, name, waitMs = TaHostUtil2.WAIT_MS) {
|
|
873
|
+
return new Promise((resolve) => {
|
|
874
|
+
let heard = false;
|
|
875
|
+
let answered = false;
|
|
876
|
+
const timer = setTimeout(() => resolve(undefined), waitMs);
|
|
877
|
+
const request = {
|
|
878
|
+
name,
|
|
879
|
+
heard: () => {
|
|
880
|
+
heard = true;
|
|
881
|
+
},
|
|
882
|
+
resolve: (answer) => {
|
|
883
|
+
answered = true;
|
|
884
|
+
clearTimeout(timer);
|
|
885
|
+
resolve(answer);
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
events.emit(TA_HOST_EVENT, request);
|
|
889
|
+
if (!heard && !answered) {
|
|
890
|
+
clearTimeout(timer);
|
|
891
|
+
resolve(undefined);
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
TaHostUtil2.reach = reach;
|
|
896
|
+
function marked(systemPrompt, mark) {
|
|
897
|
+
return role(systemPrompt).includes(mark);
|
|
898
|
+
}
|
|
899
|
+
TaHostUtil2.marked = marked;
|
|
900
|
+
function role(systemPrompt) {
|
|
901
|
+
if (!systemPrompt) {
|
|
902
|
+
return "";
|
|
903
|
+
}
|
|
904
|
+
const open = `<addendum>
|
|
905
|
+
`;
|
|
906
|
+
const start = systemPrompt.indexOf(open);
|
|
907
|
+
const context = systemPrompt.indexOf(`<project_context>
|
|
908
|
+
`);
|
|
909
|
+
if (start < 0 || context >= 0 && context < start) {
|
|
910
|
+
return "";
|
|
911
|
+
}
|
|
912
|
+
const end = systemPrompt.indexOf(`
|
|
913
|
+
</addendum>`, start);
|
|
914
|
+
return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
|
|
915
|
+
}
|
|
916
|
+
TaHostUtil2.role = role;
|
|
917
|
+
})(TaHostUtil || (TaHostUtil = {}));
|
|
918
|
+
var TA_ASK_ENTRY = "ta-ask";
|
|
919
|
+
var TaAskUtil;
|
|
920
|
+
(function(TaAskUtil2) {
|
|
921
|
+
const LENGTH = 120;
|
|
922
|
+
function entry(question) {
|
|
923
|
+
const line = question.replace(/\s+/g, " ").trim();
|
|
924
|
+
return { question: line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line };
|
|
925
|
+
}
|
|
926
|
+
TaAskUtil2.entry = entry;
|
|
927
|
+
function asking(entries) {
|
|
928
|
+
var _a;
|
|
929
|
+
for (let i = entries.length - 1;i >= 0; i--) {
|
|
930
|
+
const entry2 = entries[i];
|
|
931
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
if (entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY) {
|
|
935
|
+
return read(entry2);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
TaAskUtil2.asking = asking;
|
|
941
|
+
function next(asked, entry2) {
|
|
942
|
+
var _a;
|
|
943
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
return entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY ? read(entry2) : asked;
|
|
947
|
+
}
|
|
948
|
+
TaAskUtil2.next = next;
|
|
949
|
+
function read(found) {
|
|
950
|
+
var _a;
|
|
951
|
+
const question = (_a = found.data) === null || _a === undefined ? undefined : _a.question;
|
|
952
|
+
if (typeof question !== "string" || !question.trim()) {
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
const at = found.timestamp ? Date.parse(found.timestamp) : Number.NaN;
|
|
956
|
+
return { question: entry(question).question, at: Number.isNaN(at) ? 0 : at };
|
|
957
|
+
}
|
|
958
|
+
})(TaAskUtil || (TaAskUtil = {}));
|
|
959
|
+
|
|
960
|
+
// ../ta-protocol/esm/common/delegate-protocol.js
|
|
961
|
+
var TaDelegateUtil;
|
|
962
|
+
(function(TaDelegateUtil2) {
|
|
963
|
+
TaDelegateUtil2.LEVELS = ["less", "balanced", "more"];
|
|
964
|
+
TaDelegateUtil2.DEFAULT = "balanced";
|
|
965
|
+
TaDelegateUtil2.WORK_TOOLS = ["read", "bash", "powershell", "edit", "write", "grep", "find", "ls"];
|
|
966
|
+
TaDelegateUtil2.CHANGE_TOOLS = ["edit", "write"];
|
|
967
|
+
const LIMITS = {
|
|
968
|
+
less: { noChanges: false },
|
|
969
|
+
balanced: { noChanges: true, steps: 6 },
|
|
970
|
+
more: { noChanges: true, steps: 2 }
|
|
971
|
+
};
|
|
972
|
+
function parse(value) {
|
|
973
|
+
return TaDelegateUtil2.LEVELS.includes(value) ? value : TaDelegateUtil2.DEFAULT;
|
|
974
|
+
}
|
|
975
|
+
TaDelegateUtil2.parse = parse;
|
|
976
|
+
function mark(level) {
|
|
977
|
+
return `(delegate=${level})`;
|
|
978
|
+
}
|
|
979
|
+
TaDelegateUtil2.mark = mark;
|
|
980
|
+
function levelOf(systemPrompt) {
|
|
981
|
+
const role = TaHostUtil.role(systemPrompt);
|
|
982
|
+
return TaDelegateUtil2.LEVELS.find((level) => role.includes(mark(level)));
|
|
983
|
+
}
|
|
984
|
+
TaDelegateUtil2.levelOf = levelOf;
|
|
985
|
+
function limits(level) {
|
|
986
|
+
return LIMITS[level];
|
|
987
|
+
}
|
|
988
|
+
TaDelegateUtil2.limits = limits;
|
|
989
|
+
function refusal(level, tool, steps) {
|
|
990
|
+
if (!TaDelegateUtil2.WORK_TOOLS.includes(tool)) {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
const limit = LIMITS[level];
|
|
994
|
+
if (limit.noChanges && TaDelegateUtil2.CHANGE_TOOLS.includes(tool)) {
|
|
995
|
+
return "You do not change files yourself: hand this to a task with start_task, with instructions complete enough to do it. The user set how much you hand out in the settings of the double.";
|
|
996
|
+
}
|
|
997
|
+
if (limit.steps !== undefined && steps >= limit.steps) {
|
|
998
|
+
return "You have looked enough for this: hand the work to a task with start_task now, with what you found in its instructions, and tell the user what you started.";
|
|
999
|
+
}
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
TaDelegateUtil2.refusal = refusal;
|
|
1003
|
+
})(TaDelegateUtil || (TaDelegateUtil = {}));
|
|
1004
|
+
|
|
1005
|
+
// ../ta-protocol/esm/common/app-protocol.js
|
|
1006
|
+
var FONT_SIZES = ["small", "standard", "large", "xlarge"];
|
|
1007
|
+
var words = (en, zh, tw, ja) => ({ "en-US": en, "zh-CN": zh, "zh-TW": tw, "ja-JP": ja });
|
|
1008
|
+
var SYSTEM = words("as the system", "跟随系统", "跟隨系統", "システムに合わせる");
|
|
1009
|
+
var FONT_SHOWN = {
|
|
1010
|
+
small: words("small", "小", "小", "小"),
|
|
1011
|
+
standard: words("standard", "标准", "標準", "標準"),
|
|
1012
|
+
large: words("large", "大", "大", "大"),
|
|
1013
|
+
xlarge: words("extra large", "特大", "特大", "特大")
|
|
1014
|
+
};
|
|
1015
|
+
var TA_WEB_SETTINGS = [
|
|
1016
|
+
{
|
|
1017
|
+
key: "theme",
|
|
1018
|
+
type: "enum",
|
|
1019
|
+
values: ["system", "light", "dark"],
|
|
1020
|
+
default: "system",
|
|
1021
|
+
what: "Light or dark look; system follows the device.",
|
|
1022
|
+
title: words("Theme", "外观", "外觀", "外観"),
|
|
1023
|
+
shown: { system: SYSTEM, light: words("light", "浅色", "淺色", "ライト"), dark: words("dark", "深色", "深色", "ダーク") }
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
key: "language",
|
|
1027
|
+
type: "enum",
|
|
1028
|
+
values: ["system", ...TaLanguageUtil.ALL],
|
|
1029
|
+
default: "system",
|
|
1030
|
+
what: "The language of Ta's pages and of what Ta says; system follows the device.",
|
|
1031
|
+
title: words("Language", "语言", "語言", "言語"),
|
|
1032
|
+
shown: {
|
|
1033
|
+
system: SYSTEM,
|
|
1034
|
+
...Object.fromEntries(TaLanguageUtil.ALL.map((language) => [
|
|
1035
|
+
language,
|
|
1036
|
+
words(TaLanguageUtil.NAMES[language], TaLanguageUtil.NAMES[language], TaLanguageUtil.NAMES[language], TaLanguageUtil.NAMES[language])
|
|
1037
|
+
]))
|
|
1038
|
+
}
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
key: "fontSize",
|
|
1042
|
+
type: "enum",
|
|
1043
|
+
values: FONT_SIZES,
|
|
1044
|
+
default: "standard",
|
|
1045
|
+
what: "The size of the text of the whole page.",
|
|
1046
|
+
title: words("Text size", "字体大小", "字型大小", "文字サイズ"),
|
|
1047
|
+
shown: FONT_SHOWN
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
key: "chatFontSize",
|
|
1051
|
+
type: "enum",
|
|
1052
|
+
values: FONT_SIZES,
|
|
1053
|
+
default: "standard",
|
|
1054
|
+
what: "The size of the text of conversations, on top of fontSize.",
|
|
1055
|
+
title: words("Text size of conversations", "对话字体大小", "對話字型大小", "会話の文字サイズ"),
|
|
1056
|
+
shown: FONT_SHOWN
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
key: "speak",
|
|
1060
|
+
type: "boolean",
|
|
1061
|
+
default: false,
|
|
1062
|
+
what: "Read every reply aloud.",
|
|
1063
|
+
title: words("Read replies aloud", "朗读回复", "朗讀回覆", "返信を読み上げ")
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
key: "speakTalk",
|
|
1067
|
+
type: "boolean",
|
|
1068
|
+
default: false,
|
|
1069
|
+
what: "Read the reply aloud when the user spoke to the double by voice.",
|
|
1070
|
+
title: words("Read aloud what was asked by voice", "语音提问时朗读回复", "語音提問時朗讀回覆", "音声で聞いたら読み上げ")
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
key: "callCaptions",
|
|
1074
|
+
type: "boolean",
|
|
1075
|
+
default: false,
|
|
1076
|
+
what: "Show captions in a call: what the user says and what Ta reads.",
|
|
1077
|
+
title: words("Call captions", "通话字幕", "通話字幕", "通話の字幕")
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
key: "voice",
|
|
1081
|
+
type: "string",
|
|
1082
|
+
default: "",
|
|
1083
|
+
what: "The voice replies are read with (a voiceURI of the device's voices); empty for the most natural one.",
|
|
1084
|
+
title: words("Voice", "朗读声音", "朗讀聲音", "読み上げの声")
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
key: "confirmTasks",
|
|
1088
|
+
type: "boolean",
|
|
1089
|
+
default: false,
|
|
1090
|
+
what: "The double asks before it hands out work.",
|
|
1091
|
+
title: words("Ask before handing out work", "派任务前先问我", "派任務前先問我", "作業を割り当てる前に確認")
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
key: "maxTasks",
|
|
1095
|
+
type: "number",
|
|
1096
|
+
values: [0, 2, 4, 8],
|
|
1097
|
+
default: 0,
|
|
1098
|
+
what: "How many of the double's tasks run at once; 0 for as many as it starts.",
|
|
1099
|
+
title: words("Tasks at once", "同时运行的任务", "同時執行的任務", "同時に実行するタスク")
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
key: "delegate",
|
|
1103
|
+
type: "enum",
|
|
1104
|
+
values: TaDelegateUtil.LEVELS,
|
|
1105
|
+
default: TaDelegateUtil.DEFAULT,
|
|
1106
|
+
what: "How much of the work the double hands out to tasks rather than doing it itself.",
|
|
1107
|
+
title: words("Hand out work", "派活多少", "派活多少", "作業の割り当て"),
|
|
1108
|
+
shown: { less: words("less", "少", "少", "少なめ"), balanced: words("balanced", "适中", "適中", "ふつう"), more: words("more", "多", "多", "多め") }
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
key: "assistantModel",
|
|
1112
|
+
type: "model",
|
|
1113
|
+
default: "",
|
|
1114
|
+
what: "The model of the double, <provider>/<model id>; empty for the default model.",
|
|
1115
|
+
title: words("Model of the double", "分身的模型", "分身的模型", "分身のモデル")
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
key: "taskModel",
|
|
1119
|
+
type: "model",
|
|
1120
|
+
default: "",
|
|
1121
|
+
what: "The model of the tasks the double starts; empty for the default model.",
|
|
1122
|
+
title: words("Model of tasks", "任务的模型", "任務的模型", "タスクのモデル")
|
|
1123
|
+
},
|
|
1124
|
+
{ key: "reduceMotion", type: "boolean", default: false, what: "Fewer animations.", title: words("Reduce motion", "减少动画", "減少動畫", "動きを減らす") },
|
|
1125
|
+
{
|
|
1126
|
+
key: "diagramStyle",
|
|
1127
|
+
type: "enum",
|
|
1128
|
+
values: ["clean", "sketch", "colour", "motion"],
|
|
1129
|
+
default: "clean",
|
|
1130
|
+
what: "How diagrams in replies draw: in the colours of the page, as by hand, a colour to a node, or coming in with flowing lines.",
|
|
1131
|
+
title: words("Diagram style", "图表风格", "圖表風格", "図のスタイル"),
|
|
1132
|
+
shown: {
|
|
1133
|
+
clean: words("clean", "简洁", "簡潔", "シンプル"),
|
|
1134
|
+
sketch: words("sketch", "草图", "草圖", "スケッチ"),
|
|
1135
|
+
colour: words("colour", "彩色", "彩色", "カラー"),
|
|
1136
|
+
motion: words("motion", "动效", "動效", "モーション")
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
key: "keepAliveMinutes",
|
|
1141
|
+
type: "number",
|
|
1142
|
+
values: [1, 5, 15, 30],
|
|
1143
|
+
default: 5,
|
|
1144
|
+
what: "How long an extension started on open keeps running once left, in minutes.",
|
|
1145
|
+
title: words("Keep extensions running", "扩展离开后保留", "擴充功能離開後保留", "拡張機能を保持")
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
key: "chatFoldDays",
|
|
1149
|
+
type: "number",
|
|
1150
|
+
values: [3, 7, 30, 0],
|
|
1151
|
+
default: 7,
|
|
1152
|
+
what: "Conversations not updated for these days fold at the end of the list; 0 for none.",
|
|
1153
|
+
title: words("Fold old conversations", "折叠旧对话", "摺疊舊對話", "古い会話を折りたたむ")
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
key: "chatArchiveDays",
|
|
1157
|
+
type: "number",
|
|
1158
|
+
values: [30, 90, 365, 0],
|
|
1159
|
+
default: 30,
|
|
1160
|
+
what: "Conversations not updated for these days are archived (out of the list, found by search); 0 for none.",
|
|
1161
|
+
title: words("Archive old conversations", "归档旧对话", "歸檔舊對話", "古い会話をアーカイブ")
|
|
1162
|
+
},
|
|
1163
|
+
{
|
|
1164
|
+
key: "recentShots",
|
|
1165
|
+
type: "boolean",
|
|
1166
|
+
default: true,
|
|
1167
|
+
what: "The screenshot just taken is offered above the message box, once.",
|
|
1168
|
+
title: words("Offer recent screenshots", "提示刚截的图", "提示剛截的圖", "撮ったばかりのスクリーンショットを提案")
|
|
1169
|
+
}
|
|
1170
|
+
];
|
|
1171
|
+
var TaAppUtil;
|
|
1172
|
+
(function(TaAppUtil2) {
|
|
1173
|
+
function check(spec, value) {
|
|
1174
|
+
var _a, _b;
|
|
1175
|
+
switch (spec.type) {
|
|
1176
|
+
case "boolean":
|
|
1177
|
+
return typeof value === "boolean" ? undefined : "true or false";
|
|
1178
|
+
case "string":
|
|
1179
|
+
return typeof value === "string" ? undefined : "a string";
|
|
1180
|
+
case "model":
|
|
1181
|
+
return value === "" || typeof value === "string" && /^[^/\s]+\/\S+$/.test(value) ? undefined : "<provider>/<model id>, or empty";
|
|
1182
|
+
default:
|
|
1183
|
+
return ((_a = spec.values) === null || _a === undefined ? undefined : _a.includes(value)) ? undefined : `one of ${(_b = spec.values) === null || _b === undefined ? undefined : _b.map((one) => JSON.stringify(one)).join(", ")}`;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
TaAppUtil2.check = check;
|
|
1187
|
+
function shown(value, language, spec) {
|
|
1188
|
+
var _a;
|
|
1189
|
+
const named = (_a = spec === null || spec === undefined ? undefined : spec.shown) === null || _a === undefined ? undefined : _a[String(value)];
|
|
1190
|
+
if (named) {
|
|
1191
|
+
return TaLanguageUtil.pick(language, named);
|
|
1192
|
+
}
|
|
1193
|
+
if (typeof value === "boolean") {
|
|
1194
|
+
return TaLanguageUtil.pick(language, value ? words("on", "开", "開", "オン") : words("off", "关", "關", "オフ"));
|
|
1195
|
+
}
|
|
1196
|
+
if (value === "" || value === undefined || value === null) {
|
|
1197
|
+
return TaLanguageUtil.pick(language, words("default", "默认", "預設", "デフォルト"));
|
|
1198
|
+
}
|
|
1199
|
+
return String(value);
|
|
1200
|
+
}
|
|
1201
|
+
TaAppUtil2.shown = shown;
|
|
1202
|
+
})(TaAppUtil || (TaAppUtil = {}));
|
|
868
1203
|
// ../ta-protocol/esm/common/auth-protocol.js
|
|
869
1204
|
var TaAuthServer = Symbol("TaAuthServer");
|
|
1205
|
+
// ../ta-protocol/esm/common/deployment-protocol.js
|
|
1206
|
+
var TA_WELL_KNOWN_PATH = "/.well-known/ta";
|
|
1207
|
+
|
|
1208
|
+
class TaDeploymentError extends Error {
|
|
1209
|
+
}
|
|
1210
|
+
var TaDeploymentUtil;
|
|
1211
|
+
(function(TaDeploymentUtil2) {
|
|
1212
|
+
TaDeploymentUtil2.DISTRIBUTION_FILE = "distribution.json";
|
|
1213
|
+
function url(value) {
|
|
1214
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
try {
|
|
1218
|
+
const parsed = new URL(value.trim());
|
|
1219
|
+
if (!/^https?:$/.test(parsed.protocol) || parsed.search || parsed.hash || parsed.username || parsed.password) {
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
return `${parsed.origin}${parsed.pathname}`.replace(/\/+$/, "");
|
|
1223
|
+
} catch (_a) {
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
TaDeploymentUtil2.url = url;
|
|
1228
|
+
function name(value) {
|
|
1229
|
+
return typeof value === "string" && value.trim() ? value.trim().slice(0, 80) : undefined;
|
|
1230
|
+
}
|
|
1231
|
+
function describe(env, own, version) {
|
|
1232
|
+
var _a, _b;
|
|
1233
|
+
const gateway = (_a = url(own.gateway)) !== null && _a !== undefined ? _a : url(env.TA_GATEWAY_URL);
|
|
1234
|
+
const relay = (_b = url(own.relay)) !== null && _b !== undefined ? _b : url(env.TA_RELAY_URL);
|
|
1235
|
+
const called = name(env.TA_DEPLOYMENT_NAME);
|
|
1236
|
+
return { v: 1, ...called ? { name: called } : {}, ...gateway ? { gateway } : {}, ...relay ? { relay } : {}, ...version ? { version } : {} };
|
|
1237
|
+
}
|
|
1238
|
+
TaDeploymentUtil2.describe = describe;
|
|
1239
|
+
TaDeploymentUtil2.HEADERS = {
|
|
1240
|
+
"content-type": "application/json",
|
|
1241
|
+
"access-control-allow-origin": "*",
|
|
1242
|
+
"cache-control": "no-store"
|
|
1243
|
+
};
|
|
1244
|
+
function parse(value) {
|
|
1245
|
+
const given = value;
|
|
1246
|
+
if (!given || typeof given !== "object" || given.v !== 1) {
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
const deployment = describe({ TA_DEPLOYMENT_NAME: given.name, TA_GATEWAY_URL: given.gateway, TA_RELAY_URL: given.relay }, {});
|
|
1250
|
+
const version = name(given.version);
|
|
1251
|
+
return version ? { ...deployment, version } : deployment;
|
|
1252
|
+
}
|
|
1253
|
+
TaDeploymentUtil2.parse = parse;
|
|
1254
|
+
async function discover(address, timeoutMs = 6000) {
|
|
1255
|
+
const base = url(address);
|
|
1256
|
+
if (!base) {
|
|
1257
|
+
throw new TaDeploymentError(`${address} is not an address of http or https.`);
|
|
1258
|
+
}
|
|
1259
|
+
const controller = new AbortController;
|
|
1260
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
1261
|
+
try {
|
|
1262
|
+
const response = await fetch(`${base}${TA_WELL_KNOWN_PATH}`, { signal: controller.signal, redirect: "follow" });
|
|
1263
|
+
if (!response.ok) {
|
|
1264
|
+
throw new TaDeploymentError(`${base} is not a deployment of Ta (${response.status}).`);
|
|
1265
|
+
}
|
|
1266
|
+
const deployment = parse(await response.json().catch(() => {
|
|
1267
|
+
return;
|
|
1268
|
+
}));
|
|
1269
|
+
if (!deployment || !deployment.gateway && !deployment.relay) {
|
|
1270
|
+
throw new TaDeploymentError(`${base} is not a deployment of Ta.`);
|
|
1271
|
+
}
|
|
1272
|
+
return deployment;
|
|
1273
|
+
} catch (error) {
|
|
1274
|
+
if ((error === null || error === undefined ? undefined : error.name) === "AbortError") {
|
|
1275
|
+
throw new TaDeploymentError(`${base} did not answer in time.`);
|
|
1276
|
+
}
|
|
1277
|
+
throw error;
|
|
1278
|
+
} finally {
|
|
1279
|
+
clearTimeout(timer);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
TaDeploymentUtil2.discover = discover;
|
|
1283
|
+
function distribution(value) {
|
|
1284
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1285
|
+
throw new TaDeploymentError(`${TaDeploymentUtil2.DISTRIBUTION_FILE} holds a JSON object.`);
|
|
1286
|
+
}
|
|
1287
|
+
const given = value;
|
|
1288
|
+
const result = {};
|
|
1289
|
+
if (given.name !== undefined) {
|
|
1290
|
+
result.name = name(given.name);
|
|
1291
|
+
}
|
|
1292
|
+
for (const key of ["relay", "gateway"]) {
|
|
1293
|
+
if (given[key] !== undefined) {
|
|
1294
|
+
const address = url(given[key]);
|
|
1295
|
+
if (!address) {
|
|
1296
|
+
throw new TaDeploymentError(`"${key}" of ${TaDeploymentUtil2.DISTRIBUTION_FILE} is not an address of http or https.`);
|
|
1297
|
+
}
|
|
1298
|
+
result[key] = address;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
if (given.updates !== undefined) {
|
|
1302
|
+
const updates = given.updates;
|
|
1303
|
+
const base = url(updates === null || updates === undefined ? undefined : updates.base);
|
|
1304
|
+
if (!base && (updates === null || updates === undefined ? undefined : updates.base) !== undefined) {
|
|
1305
|
+
throw new TaDeploymentError(`"updates.base" of ${TaDeploymentUtil2.DISTRIBUTION_FILE} is not an address of http or https.`);
|
|
1306
|
+
}
|
|
1307
|
+
const key = typeof (updates === null || updates === undefined ? undefined : updates.key) === "string" && updates.key.includes("PUBLIC KEY") ? updates.key : undefined;
|
|
1308
|
+
if ((updates === null || updates === undefined ? undefined : updates.key) !== undefined && !key) {
|
|
1309
|
+
throw new TaDeploymentError(`"updates.key" of ${TaDeploymentUtil2.DISTRIBUTION_FILE} is a public key in PEM.`);
|
|
1310
|
+
}
|
|
1311
|
+
result.updates = { ...base ? { base } : {}, ...key ? { key } : {} };
|
|
1312
|
+
}
|
|
1313
|
+
if (given.reach !== undefined) {
|
|
1314
|
+
result.reach = reach(given.reach);
|
|
1315
|
+
}
|
|
1316
|
+
if (given.inside !== undefined) {
|
|
1317
|
+
const inside = url(given.inside);
|
|
1318
|
+
if (!inside) {
|
|
1319
|
+
throw new TaDeploymentError(`"inside" of ${TaDeploymentUtil2.DISTRIBUTION_FILE} is not an address of http or https.`);
|
|
1320
|
+
}
|
|
1321
|
+
result.inside = inside;
|
|
1322
|
+
}
|
|
1323
|
+
return result;
|
|
1324
|
+
}
|
|
1325
|
+
TaDeploymentUtil2.distribution = distribution;
|
|
1326
|
+
function reach(value) {
|
|
1327
|
+
const given = typeof value === "string" ? { "*": value } : value;
|
|
1328
|
+
const entries = given && typeof given === "object" && !Array.isArray(given) ? Object.entries(given) : [];
|
|
1329
|
+
const result = {};
|
|
1330
|
+
for (const [language, text] of entries) {
|
|
1331
|
+
if (typeof text !== "string" || !text.trim()) {
|
|
1332
|
+
throw new TaDeploymentError(`"reach.${language}" of ${TaDeploymentUtil2.DISTRIBUTION_FILE} is not a sentence.`);
|
|
1333
|
+
}
|
|
1334
|
+
result[language] = text.trim().slice(0, 200);
|
|
1335
|
+
}
|
|
1336
|
+
if (Object.keys(result).length === 0) {
|
|
1337
|
+
throw new TaDeploymentError(`"reach" of ${TaDeploymentUtil2.DISTRIBUTION_FILE} is a sentence, or one by language.`);
|
|
1338
|
+
}
|
|
1339
|
+
return result;
|
|
1340
|
+
}
|
|
1341
|
+
function reachIn(reach2, language) {
|
|
1342
|
+
var _a, _b, _c, _d, _e;
|
|
1343
|
+
if (!reach2) {
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
const base = language.split("-")[0];
|
|
1347
|
+
const near = Object.keys(reach2).find((key) => key.split("-")[0] === base);
|
|
1348
|
+
return (_e = (_d = (_c = (_b = (_a = reach2[language]) !== null && _a !== undefined ? _a : reach2[base]) !== null && _b !== undefined ? _b : near && reach2[near]) !== null && _c !== undefined ? _c : reach2["*"]) !== null && _d !== undefined ? _d : reach2.en) !== null && _e !== undefined ? _e : Object.values(reach2)[0];
|
|
1349
|
+
}
|
|
1350
|
+
TaDeploymentUtil2.reachIn = reachIn;
|
|
1351
|
+
function apply(distribution2, env) {
|
|
1352
|
+
const defaults = { TA_DEPLOYMENT_NAME: distribution2.name, TA_RELAY_URL: distribution2.relay, TA_GATEWAY_URL: distribution2.gateway };
|
|
1353
|
+
for (const [key, value] of Object.entries(defaults)) {
|
|
1354
|
+
if (value && !env[key]) {
|
|
1355
|
+
env[key] = value;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
TaDeploymentUtil2.apply = apply;
|
|
1360
|
+
})(TaDeploymentUtil || (TaDeploymentUtil = {}));
|
|
1361
|
+
// ../ta-protocol/esm/common/error-protocol.js
|
|
1362
|
+
var TaErrorUtil;
|
|
1363
|
+
(function(TaErrorUtil2) {
|
|
1364
|
+
function code(error) {
|
|
1365
|
+
var _a;
|
|
1366
|
+
var _b;
|
|
1367
|
+
const failure = error;
|
|
1368
|
+
const code2 = (_b = failure === null || failure === undefined ? undefined : failure.code) !== null && _b !== undefined ? _b : (_a = failure === null || failure === undefined ? undefined : failure.data) === null || _a === undefined ? undefined : _a.code;
|
|
1369
|
+
return typeof code2 === "string" ? code2 : undefined;
|
|
1370
|
+
}
|
|
1371
|
+
TaErrorUtil2.code = code;
|
|
1372
|
+
})(TaErrorUtil || (TaErrorUtil = {}));
|
|
870
1373
|
// ../ta-protocol/esm/common/gateway-protocol.js
|
|
871
1374
|
var TaGatewayServer = Symbol("TaGatewayServer");
|
|
872
1375
|
// ../ta-protocol/esm/common/location.js
|
|
@@ -930,19 +1433,19 @@ var TaLocation;
|
|
|
930
1433
|
TaLocation2.isHost = isHost;
|
|
931
1434
|
const FLAGS = /^-[46AaCfGgKkMNnqsTtVvXxYy]+$/;
|
|
932
1435
|
function readHost(input) {
|
|
933
|
-
const
|
|
934
|
-
if (
|
|
935
|
-
|
|
1436
|
+
const words2 = input.trim().split(/\s+/).filter(Boolean);
|
|
1437
|
+
if (words2[0] === "ssh") {
|
|
1438
|
+
words2.shift();
|
|
936
1439
|
}
|
|
937
1440
|
let destination;
|
|
938
1441
|
let port;
|
|
939
1442
|
let user;
|
|
940
1443
|
const options = [];
|
|
941
|
-
for (let i = 0;i <
|
|
942
|
-
const word =
|
|
1444
|
+
for (let i = 0;i < words2.length; i++) {
|
|
1445
|
+
const word = words2[i];
|
|
943
1446
|
const glued = /^-([pl])(.+)$/.exec(word);
|
|
944
1447
|
if (word === "-p" || word === "-l" || glued) {
|
|
945
|
-
const value = glued ? glued[2] :
|
|
1448
|
+
const value = glued ? glued[2] : words2[++i];
|
|
946
1449
|
if (value === undefined) {
|
|
947
1450
|
return { error: "invalid" };
|
|
948
1451
|
}
|
|
@@ -952,7 +1455,7 @@ var TaLocation;
|
|
|
952
1455
|
user = value;
|
|
953
1456
|
}
|
|
954
1457
|
} else if (word === "-o" || word.startsWith("-o")) {
|
|
955
|
-
const value = word === "-o" ?
|
|
1458
|
+
const value = word === "-o" ? words2[++i] : word.slice(2);
|
|
956
1459
|
const option = /^(port|user)\s*=?\s*(.+)$/i.exec(value !== null && value !== undefined ? value : "");
|
|
957
1460
|
if (!option) {
|
|
958
1461
|
options.push(`-o ${value !== null && value !== undefined ? value : ""}`.trim());
|
|
@@ -962,7 +1465,7 @@ var TaLocation;
|
|
|
962
1465
|
user = option[2];
|
|
963
1466
|
}
|
|
964
1467
|
} else if (FLAGS.test(word)) {} else if (word.startsWith("-")) {
|
|
965
|
-
options.push(/^-[bBcDeEFiIJLmOQRSwW]$/.test(word) &&
|
|
1468
|
+
options.push(/^-[bBcDeEFiIJLmOQRSwW]$/.test(word) && words2[i + 1] !== undefined ? `${word} ${words2[++i]}` : word);
|
|
966
1469
|
} else if (destination === undefined) {
|
|
967
1470
|
destination = word;
|
|
968
1471
|
} else {
|
|
@@ -1068,44 +1571,7 @@ var TaLocation;
|
|
|
1068
1571
|
return squeezed.length > 1 ? squeezed.replace(/\/$/, "") : squeezed;
|
|
1069
1572
|
}
|
|
1070
1573
|
})(TaLocation || (TaLocation = {}));
|
|
1071
|
-
// ../ta-protocol/esm/common/
|
|
1072
|
-
var TaPackageServer = Symbol("TaPackageServer");
|
|
1073
|
-
var TaPackageTextUtil;
|
|
1074
|
-
(function(TaPackageTextUtil2) {
|
|
1075
|
-
function pick(text, language) {
|
|
1076
|
-
var _a, _b, _c, _d, _e;
|
|
1077
|
-
if (text === undefined || typeof text === "string") {
|
|
1078
|
-
return text;
|
|
1079
|
-
}
|
|
1080
|
-
const base = language.split("-")[0];
|
|
1081
|
-
const kin = Object.keys(text).find((key) => key.split("-")[0] === base);
|
|
1082
|
-
return (_e = (_d = (_c = (_b = (_a = text[language]) !== null && _a !== undefined ? _a : text[base]) !== null && _b !== undefined ? _b : kin === undefined ? undefined : text[kin]) !== null && _c !== undefined ? _c : text.en) !== null && _d !== undefined ? _d : text["en-US"]) !== null && _e !== undefined ? _e : Object.values(text)[0];
|
|
1083
|
-
}
|
|
1084
|
-
TaPackageTextUtil2.pick = pick;
|
|
1085
|
-
})(TaPackageTextUtil || (TaPackageTextUtil = {}));
|
|
1086
|
-
// ../ta-protocol/esm/common/ta-protocol.js
|
|
1087
|
-
var TaServer = Symbol("TaServer");
|
|
1088
|
-
var TaClient = Symbol("TaClient");
|
|
1089
|
-
var TaErrorUtil;
|
|
1090
|
-
(function(TaErrorUtil2) {
|
|
1091
|
-
function code(error) {
|
|
1092
|
-
var _a;
|
|
1093
|
-
var _b;
|
|
1094
|
-
const failure = error;
|
|
1095
|
-
const code2 = (_b = failure === null || failure === undefined ? undefined : failure.code) !== null && _b !== undefined ? _b : (_a = failure === null || failure === undefined ? undefined : failure.data) === null || _a === undefined ? undefined : _a.code;
|
|
1096
|
-
return typeof code2 === "string" ? code2 : undefined;
|
|
1097
|
-
}
|
|
1098
|
-
TaErrorUtil2.code = code;
|
|
1099
|
-
})(TaErrorUtil || (TaErrorUtil = {}));
|
|
1100
|
-
var TaSlashCommandUtil;
|
|
1101
|
-
(function(TaSlashCommandUtil2) {
|
|
1102
|
-
function description(command, language) {
|
|
1103
|
-
var _a, _b;
|
|
1104
|
-
const { descriptions } = command;
|
|
1105
|
-
return (_b = (_a = descriptions === null || descriptions === undefined ? undefined : descriptions[language]) !== null && _a !== undefined ? _a : descriptions === null || descriptions === undefined ? undefined : descriptions[language.split("-")[0]]) !== null && _b !== undefined ? _b : command.description;
|
|
1106
|
-
}
|
|
1107
|
-
TaSlashCommandUtil2.description = description;
|
|
1108
|
-
})(TaSlashCommandUtil || (TaSlashCommandUtil = {}));
|
|
1574
|
+
// ../ta-protocol/esm/common/message-protocol.js
|
|
1109
1575
|
var TaMessageContext;
|
|
1110
1576
|
(function(TaMessageContext2) {
|
|
1111
1577
|
const BLOCK = /^<context>\n?[\s\S]*?\n?<\/context>\n?/;
|
|
@@ -1130,23 +1596,47 @@ ${message}`;
|
|
|
1130
1596
|
var TaMessageSource;
|
|
1131
1597
|
(function(TaMessageSource2) {
|
|
1132
1598
|
TaMessageSource2.DOUBLE = "ta:double";
|
|
1133
|
-
const LINE = /^\[ta:from ([^\s\]]+)(?: ([^\]\n]+))?\]$/m;
|
|
1599
|
+
const LINE = /^\[ta:(from|notice) ([^\s\]]+)(?: ([^\]\n]+))?\]$/m;
|
|
1134
1600
|
function mark(message, from, detail) {
|
|
1135
|
-
|
|
1136
|
-
return message;
|
|
1137
|
-
}
|
|
1138
|
-
const line = `[ta:from ${from}${detail ? ` ${detail.replace(/[\]\n]/g, " ")}` : ""}]`;
|
|
1139
|
-
const context = TaMessageContext.read(message);
|
|
1140
|
-
return TaMessageContext.wrap(context === undefined ? line : `${context}
|
|
1141
|
-
${line}`, TaMessageContext.strip(message));
|
|
1601
|
+
return marked(message, line(from, detail));
|
|
1142
1602
|
}
|
|
1143
1603
|
TaMessageSource2.mark = mark;
|
|
1604
|
+
function notice(message, from, detail) {
|
|
1605
|
+
return marked(message, line(from, detail, true));
|
|
1606
|
+
}
|
|
1607
|
+
TaMessageSource2.notice = notice;
|
|
1608
|
+
function line(from, detail, notice2 = false) {
|
|
1609
|
+
return `[ta:${notice2 ? "notice" : "from"} ${from}${detail ? ` ${detail.replace(/[\]\n]/g, " ")}` : ""}]`;
|
|
1610
|
+
}
|
|
1611
|
+
TaMessageSource2.line = line;
|
|
1144
1612
|
function of(message) {
|
|
1145
1613
|
const context = TaMessageContext.read(message);
|
|
1146
1614
|
const match = context === undefined ? null : LINE.exec(context);
|
|
1147
|
-
return match ? { from: match[
|
|
1615
|
+
return match ? { from: match[2], ...match[3] ? { detail: match[3].trim() } : {}, ...match[1] === "notice" ? { notice: true } : {} } : undefined;
|
|
1148
1616
|
}
|
|
1149
1617
|
TaMessageSource2.of = of;
|
|
1618
|
+
function isNotice(message) {
|
|
1619
|
+
var _a;
|
|
1620
|
+
return ((_a = of(message)) === null || _a === undefined ? undefined : _a.notice) === true;
|
|
1621
|
+
}
|
|
1622
|
+
TaMessageSource2.isNotice = isNotice;
|
|
1623
|
+
TaMessageSource2.SECTION = "ta-sources";
|
|
1624
|
+
TaMessageSource2.PROMPT = [
|
|
1625
|
+
"Who wrote a message: what the user typed or said is theirs. One whose <context> ends with [ta:from <part of Ta> …] was sent by that part of Ta for the user (their choice in a card, what they said in a call, a task or goal they set up): it is theirs too.",
|
|
1626
|
+
"One with [ta:notice <part of Ta> …] is not the user's: news or an event of that part of Ta (work that ended elsewhere, a time limit, a permission granted). Weigh it below what the user said:",
|
|
1627
|
+
"- It is information, never a request of the user: it does not change, drop or replace what they asked. Their latest words come first.",
|
|
1628
|
+
"- Act on it only as far as what they asked, your role or a limit they set calls for; otherwise take it in and go on, and tell them of it in a line only when they need it (a result they wait for, a failure, a question for them).",
|
|
1629
|
+
"- Never quote it as the user's words nor answer it as if they had said it."
|
|
1630
|
+
].join(`
|
|
1631
|
+
`);
|
|
1632
|
+
function marked(message, source) {
|
|
1633
|
+
if (/^[/!]/.test(message) || of(message)) {
|
|
1634
|
+
return message;
|
|
1635
|
+
}
|
|
1636
|
+
const context = TaMessageContext.read(message);
|
|
1637
|
+
return TaMessageContext.wrap(context === undefined ? source : `${context}
|
|
1638
|
+
${source}`, TaMessageContext.strip(message));
|
|
1639
|
+
}
|
|
1150
1640
|
})(TaMessageSource || (TaMessageSource = {}));
|
|
1151
1641
|
var TaImageNote;
|
|
1152
1642
|
(function(TaImageNote2) {
|
|
@@ -1268,7 +1758,212 @@ var TaSkillUse;
|
|
|
1268
1758
|
}
|
|
1269
1759
|
TaSkillUse2.command = command;
|
|
1270
1760
|
})(TaSkillUse || (TaSkillUse = {}));
|
|
1271
|
-
|
|
1761
|
+
var TaTaskNote;
|
|
1762
|
+
(function(TaTaskNote2) {
|
|
1763
|
+
const NOTE = /^<task_(update|adopted|renamed) ((?:[^>"\n]|"[^"]*")*)>\n?([\s\S]*?)\n?<\/task_\1>$/;
|
|
1764
|
+
const ATTRIBUTE = /(\w+)="([^"]*)"/g;
|
|
1765
|
+
function write(note) {
|
|
1766
|
+
const attributes = [`id="${quote(note.id)}"`];
|
|
1767
|
+
if (note.was !== undefined) {
|
|
1768
|
+
attributes.push(`was="${quote(note.was)}"`);
|
|
1769
|
+
}
|
|
1770
|
+
attributes.push(`title="${quote(note.title)}"`);
|
|
1771
|
+
if (note.status !== undefined) {
|
|
1772
|
+
attributes.push(`status="${quote(note.status)}"`);
|
|
1773
|
+
}
|
|
1774
|
+
return `<task_${note.kind} ${attributes.join(" ")}>
|
|
1775
|
+
${note.body}
|
|
1776
|
+
</task_${note.kind}>`;
|
|
1777
|
+
}
|
|
1778
|
+
TaTaskNote2.write = write;
|
|
1779
|
+
function parse(text) {
|
|
1780
|
+
const match = NOTE.exec(text.trim());
|
|
1781
|
+
if (!match) {
|
|
1782
|
+
return;
|
|
1783
|
+
}
|
|
1784
|
+
const attributes = {};
|
|
1785
|
+
for (const [, name, value] of match[2].matchAll(ATTRIBUTE)) {
|
|
1786
|
+
attributes[name] = unquote(value);
|
|
1787
|
+
}
|
|
1788
|
+
if (!attributes.id || attributes.title === undefined) {
|
|
1789
|
+
return;
|
|
1790
|
+
}
|
|
1791
|
+
const { id, title, status, was } = attributes;
|
|
1792
|
+
return { kind: match[1], id, title, ...status ? { status } : {}, ...was ? { was } : {}, body: match[3] };
|
|
1793
|
+
}
|
|
1794
|
+
TaTaskNote2.parse = parse;
|
|
1795
|
+
function quote(text) {
|
|
1796
|
+
return text.replace(/&/g, "&").replace(/"/g, """).replace(/\n/g, " ");
|
|
1797
|
+
}
|
|
1798
|
+
function unquote(text) {
|
|
1799
|
+
return text.replace(/"/g, '"').replace(/&/g, "&");
|
|
1800
|
+
}
|
|
1801
|
+
})(TaTaskNote || (TaTaskNote = {}));
|
|
1802
|
+
var TaSecretRef;
|
|
1803
|
+
(function(TaSecretRef2) {
|
|
1804
|
+
TaSecretRef2.PACKAGE = "@celljs/ta-secrets";
|
|
1805
|
+
const REF = /\$\{?TA_SECRET_([A-Z0-9][A-Z0-9_]*)\}?/g;
|
|
1806
|
+
const KINDS = [
|
|
1807
|
+
[/^PHONE(?:_\d+)?$/, "phone"],
|
|
1808
|
+
[/^EMAIL(?:_\d+)?$/, "email"],
|
|
1809
|
+
[/^ID_NUMBER(?:_\d+)?$/, "idNumber"],
|
|
1810
|
+
[/^BANK_CARD(?:_\d+)?$/, "bankCard"]
|
|
1811
|
+
];
|
|
1812
|
+
function has(text) {
|
|
1813
|
+
return text.includes("TA_SECRET_") && new RegExp(REF.source).test(text);
|
|
1814
|
+
}
|
|
1815
|
+
TaSecretRef2.has = has;
|
|
1816
|
+
function kind(name) {
|
|
1817
|
+
var _a;
|
|
1818
|
+
var _b;
|
|
1819
|
+
return (_b = (_a = KINDS.find(([pattern]) => pattern.test(name))) === null || _a === undefined ? undefined : _a[1]) !== null && _b !== undefined ? _b : "secret";
|
|
1820
|
+
}
|
|
1821
|
+
TaSecretRef2.kind = kind;
|
|
1822
|
+
function split(text) {
|
|
1823
|
+
if (!has(text)) {
|
|
1824
|
+
return [{ text }];
|
|
1825
|
+
}
|
|
1826
|
+
const parts = [];
|
|
1827
|
+
let at = 0;
|
|
1828
|
+
for (const match of text.matchAll(REF)) {
|
|
1829
|
+
if (match.index > at) {
|
|
1830
|
+
parts.push({ text: text.slice(at, match.index) });
|
|
1831
|
+
}
|
|
1832
|
+
parts.push({ secret: match[1], kind: kind(match[1]) });
|
|
1833
|
+
at = match.index + match[0].length;
|
|
1834
|
+
}
|
|
1835
|
+
if (at < text.length) {
|
|
1836
|
+
parts.push({ text: text.slice(at) });
|
|
1837
|
+
}
|
|
1838
|
+
return parts;
|
|
1839
|
+
}
|
|
1840
|
+
TaSecretRef2.split = split;
|
|
1841
|
+
function plain(text, label) {
|
|
1842
|
+
return has(text) ? text.replace(REF, (_whole, name) => label(name, kind(name))) : text;
|
|
1843
|
+
}
|
|
1844
|
+
TaSecretRef2.plain = plain;
|
|
1845
|
+
})(TaSecretRef || (TaSecretRef = {}));
|
|
1846
|
+
// ../ta-protocol/esm/common/package-protocol.js
|
|
1847
|
+
var TaPackageServer = Symbol("TaPackageServer");
|
|
1848
|
+
var TaPackageTextUtil;
|
|
1849
|
+
(function(TaPackageTextUtil2) {
|
|
1850
|
+
function pick(text, language) {
|
|
1851
|
+
var _a, _b, _c, _d, _e;
|
|
1852
|
+
if (text === undefined || typeof text === "string") {
|
|
1853
|
+
return text;
|
|
1854
|
+
}
|
|
1855
|
+
const base = language.split("-")[0];
|
|
1856
|
+
const kin = Object.keys(text).find((key) => key.split("-")[0] === base);
|
|
1857
|
+
return (_e = (_d = (_c = (_b = (_a = text[language]) !== null && _a !== undefined ? _a : text[base]) !== null && _b !== undefined ? _b : kin === undefined ? undefined : text[kin]) !== null && _c !== undefined ? _c : text.en) !== null && _d !== undefined ? _d : text["en-US"]) !== null && _e !== undefined ? _e : Object.values(text)[0];
|
|
1858
|
+
}
|
|
1859
|
+
TaPackageTextUtil2.pick = pick;
|
|
1860
|
+
})(TaPackageTextUtil || (TaPackageTextUtil = {}));
|
|
1861
|
+
// ../ta-protocol/esm/common/page-protocol.js
|
|
1862
|
+
var TaPageServer = Symbol("TaPageServer");
|
|
1863
|
+
// ../ta-protocol/esm/common/path-map.js
|
|
1864
|
+
var TaPathMap;
|
|
1865
|
+
(function(TaPathMap2) {
|
|
1866
|
+
function isWindows(path2) {
|
|
1867
|
+
return /^[a-zA-Z]:([\\/]|$)/.test(path2) || /^\\\\[^\\]/.test(path2);
|
|
1868
|
+
}
|
|
1869
|
+
TaPathMap2.isWindows = isWindows;
|
|
1870
|
+
function rest(path2, base) {
|
|
1871
|
+
const windows = isWindows(base);
|
|
1872
|
+
if (windows ? !isWindows(path2) : !base.startsWith("/") || !path2.startsWith("/")) {
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
const within = parts(base, windows);
|
|
1876
|
+
const all = parts(path2, windows);
|
|
1877
|
+
if (!within.length || all.length < within.length) {
|
|
1878
|
+
return;
|
|
1879
|
+
}
|
|
1880
|
+
const same = (a, b) => windows ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
1881
|
+
return within.every((part, i) => same(part, all[i])) ? all.slice(within.length) : undefined;
|
|
1882
|
+
}
|
|
1883
|
+
TaPathMap2.rest = rest;
|
|
1884
|
+
function under(path2, base) {
|
|
1885
|
+
return rest(path2, base) !== undefined;
|
|
1886
|
+
}
|
|
1887
|
+
TaPathMap2.under = under;
|
|
1888
|
+
function join(base, parts2) {
|
|
1889
|
+
if (!parts2.length) {
|
|
1890
|
+
return base;
|
|
1891
|
+
}
|
|
1892
|
+
const sep = isWindows(base) ? "\\" : "/";
|
|
1893
|
+
return `${base.replace(/[\\/]+$/, "")}${sep}${parts2.join(sep)}`;
|
|
1894
|
+
}
|
|
1895
|
+
TaPathMap2.join = join;
|
|
1896
|
+
function basename(path2) {
|
|
1897
|
+
var _a;
|
|
1898
|
+
return (_a = path2.split(/[\\/]+/).filter(Boolean).pop()) !== null && _a !== undefined ? _a : "";
|
|
1899
|
+
}
|
|
1900
|
+
TaPathMap2.basename = basename;
|
|
1901
|
+
function path(value, pairs) {
|
|
1902
|
+
for (const [from, to] of deepest(pairs)) {
|
|
1903
|
+
const found = rest(value, from);
|
|
1904
|
+
if (found) {
|
|
1905
|
+
return join(to, found);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
return value;
|
|
1909
|
+
}
|
|
1910
|
+
TaPathMap2.path = path;
|
|
1911
|
+
function text(value, pairs) {
|
|
1912
|
+
const order = deepest(pairs);
|
|
1913
|
+
if (!order.length) {
|
|
1914
|
+
return value;
|
|
1915
|
+
}
|
|
1916
|
+
const end = String.raw`\s"'<>|*?:;,`;
|
|
1917
|
+
const pattern = new RegExp(String.raw`(^|[^\w.~-])(?:${order.map(([from]) => `(${source(from)})`).join("|")})((?:[\\/][^\\/${end}]*)*)(?=$|[\\/${end})\]}])`, "g");
|
|
1918
|
+
return value.replace(pattern, (...match) => {
|
|
1919
|
+
var _a;
|
|
1920
|
+
const before = match[1];
|
|
1921
|
+
const found = order.findIndex((_, i) => match[i + 2] !== undefined);
|
|
1922
|
+
const tail = (_a = match[order.length + 2]) !== null && _a !== undefined ? _a : "";
|
|
1923
|
+
return `${before}${join(order[found][1], tail.split(/[\\/]+/).filter(Boolean))}`;
|
|
1924
|
+
});
|
|
1925
|
+
}
|
|
1926
|
+
TaPathMap2.text = text;
|
|
1927
|
+
function json(value, pairs) {
|
|
1928
|
+
const order = deepest(pairs);
|
|
1929
|
+
if (!order.length) {
|
|
1930
|
+
return value;
|
|
1931
|
+
}
|
|
1932
|
+
const one = (each) => {
|
|
1933
|
+
const whole = path(each, order);
|
|
1934
|
+
return whole !== each ? whole : text(each, order);
|
|
1935
|
+
};
|
|
1936
|
+
const walk = (each) => {
|
|
1937
|
+
if (typeof each === "string") {
|
|
1938
|
+
return one(each);
|
|
1939
|
+
}
|
|
1940
|
+
if (Array.isArray(each)) {
|
|
1941
|
+
return each.map(walk);
|
|
1942
|
+
}
|
|
1943
|
+
if (each && typeof each === "object") {
|
|
1944
|
+
return Object.fromEntries(Object.entries(each).map(([key, inner]) => [one(key), walk(inner)]));
|
|
1945
|
+
}
|
|
1946
|
+
return each;
|
|
1947
|
+
};
|
|
1948
|
+
return walk(value);
|
|
1949
|
+
}
|
|
1950
|
+
TaPathMap2.json = json;
|
|
1951
|
+
function parts(path2, windows) {
|
|
1952
|
+
return path2.split(windows ? /[\\/]+/ : /\/+/).filter(Boolean);
|
|
1953
|
+
}
|
|
1954
|
+
function deepest(pairs) {
|
|
1955
|
+
return pairs.filter(([from, to]) => from && to && from !== to && parts(from, isWindows(from)).length > 0).sort(([a], [b]) => parts(b, isWindows(b)).length - parts(a, isWindows(a)).length);
|
|
1956
|
+
}
|
|
1957
|
+
function source(base) {
|
|
1958
|
+
const windows = isWindows(base);
|
|
1959
|
+
const quote = (part) => [...part].map((char) => windows && char.toLowerCase() !== char.toUpperCase() ? `[${char.toLowerCase()}${char.toUpperCase()}]` : char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("");
|
|
1960
|
+
const each = parts(base, windows).map(quote);
|
|
1961
|
+
if (!windows) {
|
|
1962
|
+
return `/${each.join("/+")}`;
|
|
1963
|
+
}
|
|
1964
|
+
return `${base.startsWith("\\\\") ? String.raw`\\\\` : ""}${each.join(String.raw`[\\/]+`)}`;
|
|
1965
|
+
}
|
|
1966
|
+
})(TaPathMap || (TaPathMap = {}));
|
|
1272
1967
|
// ../ta-protocol/esm/common/presence-protocol.js
|
|
1273
1968
|
var TaPresenceServer = Symbol("TaPresenceServer");
|
|
1274
1969
|
var TaMessageAuthor;
|
|
@@ -1344,100 +2039,281 @@ var TaRoomWatchUtil;
|
|
|
1344
2039
|
}
|
|
1345
2040
|
TaRoomWatchUtil2.hears = hears;
|
|
1346
2041
|
})(TaRoomWatchUtil || (TaRoomWatchUtil = {}));
|
|
1347
|
-
// ../ta-protocol/esm/common/
|
|
1348
|
-
var
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
(
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
};
|
|
1370
|
-
events.emit(TA_HOST_EVENT, request);
|
|
1371
|
-
if (!heard && !answered) {
|
|
1372
|
-
clearTimeout(timer);
|
|
1373
|
-
resolve(undefined);
|
|
1374
|
-
}
|
|
1375
|
-
});
|
|
2042
|
+
// ../ta-protocol/esm/common/said-protocol.js
|
|
2043
|
+
var TaSaid;
|
|
2044
|
+
(function(TaSaid2) {
|
|
2045
|
+
const CARD = /^ta-/i;
|
|
2046
|
+
const READ = 4000;
|
|
2047
|
+
const FENCE = /^\s*(`{3,}|~{3,})\s*([^\s`]*)/;
|
|
2048
|
+
const TAG_LINE = /^<\/?[A-Za-z][\w:.-]*(?:\s[^<>]*)?\/?>$/;
|
|
2049
|
+
const MARKS_ONLY = /^[-*_=|:+\s]+$/;
|
|
2050
|
+
const MARKS = [
|
|
2051
|
+
["context", /<\/?context>/],
|
|
2052
|
+
["source", /\[ta:(?:from|notice|by) /],
|
|
2053
|
+
["image note", /\[Image: original \d+x\d+|\[Image converted from /],
|
|
2054
|
+
["skill", /<skill name="|<\/skill>/],
|
|
2055
|
+
["task note", /<\/?task_(?:update|adopted|renamed)\b/],
|
|
2056
|
+
["summary", /<\/?(?:conversation_history_summary|summary)>/]
|
|
2057
|
+
];
|
|
2058
|
+
function text(content, joiner = `
|
|
2059
|
+
`) {
|
|
2060
|
+
if (typeof content === "string") {
|
|
2061
|
+
return content;
|
|
2062
|
+
}
|
|
2063
|
+
return Array.isArray(content) ? content.filter((part) => (part === null || part === undefined ? undefined : part.type) === "text" && typeof part.text === "string").map((part) => part.text).join(joiner) : "";
|
|
1376
2064
|
}
|
|
1377
|
-
|
|
1378
|
-
function
|
|
1379
|
-
|
|
2065
|
+
TaSaid2.text = text;
|
|
2066
|
+
function words2(role, text2, options = {}) {
|
|
2067
|
+
const said = role === "user" ? userWords(text2) : TaAgentSummary.strip(text2);
|
|
2068
|
+
return withoutFences(said, (language) => options.cards === false && CARD.test(language), true).trim();
|
|
1380
2069
|
}
|
|
1381
|
-
|
|
1382
|
-
function
|
|
1383
|
-
|
|
1384
|
-
return "";
|
|
1385
|
-
}
|
|
1386
|
-
const open = `<addendum>
|
|
1387
|
-
`;
|
|
1388
|
-
const start = systemPrompt.indexOf(open);
|
|
1389
|
-
const context = systemPrompt.indexOf(`<project_context>
|
|
1390
|
-
`);
|
|
1391
|
-
if (start < 0 || context >= 0 && context < start) {
|
|
1392
|
-
return "";
|
|
1393
|
-
}
|
|
1394
|
-
const end = systemPrompt.indexOf(`
|
|
1395
|
-
</addendum>`, start);
|
|
1396
|
-
return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
|
|
2070
|
+
TaSaid2.words = words2;
|
|
2071
|
+
function of(message, options) {
|
|
2072
|
+
return message ? words2(message.role, text(message.content), options) : "";
|
|
1397
2073
|
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
var TaAskUtil;
|
|
1402
|
-
(function(TaAskUtil2) {
|
|
1403
|
-
const LENGTH = 120;
|
|
1404
|
-
function entry(question) {
|
|
1405
|
-
const line = question.replace(/\s+/g, " ").trim();
|
|
1406
|
-
return { question: line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line };
|
|
2074
|
+
TaSaid2.of = of;
|
|
2075
|
+
function notice(message) {
|
|
2076
|
+
return (message === null || message === undefined ? undefined : message.role) === "user" && TaMessageSource.isNotice(text(message.content));
|
|
1407
2077
|
}
|
|
1408
|
-
|
|
1409
|
-
function
|
|
2078
|
+
TaSaid2.notice = notice;
|
|
2079
|
+
function marksOnly(role, text2) {
|
|
2080
|
+
return !!text2.trim() && !line(words2(role, text2), { chars: Number.POSITIVE_INFINITY });
|
|
2081
|
+
}
|
|
2082
|
+
TaSaid2.marksOnly = marksOnly;
|
|
2083
|
+
function line(markdown, options) {
|
|
1410
2084
|
var _a;
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
2085
|
+
const read = markdown.slice(0, READ);
|
|
2086
|
+
const prose = withoutFences(read, () => true, true).trim();
|
|
2087
|
+
const lines = plain(prose || codeOf(read)).split(`
|
|
2088
|
+
`).map((part) => part.replace(/^\s*(?:#{1,6}\s+|>\s*|[-*+]\s+|\d+[.)]\s+)/, "").replace(/\*{1,3}|`+|~~|(?<![\p{L}\p{N}])_{1,3}|_{1,3}(?![\p{L}\p{N}])/gu, "").replace(/\s+/g, " ").trim()).filter((part) => part && !MARKS_ONLY.test(part) && !TAG_LINE.test(part));
|
|
2089
|
+
const count = (_a = options.lines) !== null && _a !== undefined ? _a : 1;
|
|
2090
|
+
const joined = count <= 1 ? lines.join(" ") : lines.slice(0, count).join(`
|
|
2091
|
+
`);
|
|
2092
|
+
return joined.length > options.chars ? `${joined.slice(0, Math.max(0, options.chars - 1)).trimEnd()}…` : joined;
|
|
2093
|
+
}
|
|
2094
|
+
TaSaid2.line = line;
|
|
2095
|
+
function leaks(shown, options = {}) {
|
|
2096
|
+
const found = MARKS.filter(([, mark]) => mark.test(shown)).map(([name]) => name);
|
|
2097
|
+
const lines = shown.split(`
|
|
2098
|
+
`);
|
|
2099
|
+
if (options.cards !== true && lines.some((part) => {
|
|
2100
|
+
var _a;
|
|
2101
|
+
var _b;
|
|
2102
|
+
return CARD.test((_b = (_a = FENCE.exec(part)) === null || _a === undefined ? undefined : _a[2]) !== null && _b !== undefined ? _b : "");
|
|
2103
|
+
})) {
|
|
2104
|
+
found.push("card");
|
|
2105
|
+
}
|
|
2106
|
+
if (lines.some((part) => TAG_LINE.test(part.trim()))) {
|
|
2107
|
+
found.push("tag");
|
|
2108
|
+
}
|
|
2109
|
+
return found;
|
|
2110
|
+
}
|
|
2111
|
+
TaSaid2.leaks = leaks;
|
|
2112
|
+
const SUMMARY = `<conversation_history_summary>
|
|
2113
|
+
<summary>
|
|
2114
|
+
1. Primary Request and Intent:
|
|
2115
|
+
The user works on the relay.
|
|
2116
|
+
</summary>
|
|
2117
|
+
</conversation_history_summary>`;
|
|
2118
|
+
TaSaid2.SAMPLES = [
|
|
2119
|
+
{
|
|
2120
|
+
mark: "context and where it came from",
|
|
2121
|
+
role: "user",
|
|
2122
|
+
text: `<context>
|
|
2123
|
+
The channel #ops, its members.
|
|
2124
|
+
[ta:from @celljs/ta-channels #ops]
|
|
2125
|
+
</context>
|
|
2126
|
+
Check the build`,
|
|
2127
|
+
said: "Check the build"
|
|
2128
|
+
},
|
|
2129
|
+
{
|
|
2130
|
+
mark: "a notice, not the user",
|
|
2131
|
+
role: "user",
|
|
2132
|
+
text: `<context>
|
|
2133
|
+
[ta:notice @celljs/ta-call]
|
|
2134
|
+
</context>
|
|
2135
|
+
The work finished. Its last words: tests pass.`,
|
|
2136
|
+
said: "The work finished. Its last words: tests pass."
|
|
2137
|
+
},
|
|
2138
|
+
{ mark: "one let in", role: "user", text: `<context>
|
|
2139
|
+
[ta:by p-7 Alice]
|
|
2140
|
+
</context>
|
|
2141
|
+
Hello there`, said: "Hello there" },
|
|
2142
|
+
{
|
|
2143
|
+
mark: "notes of images",
|
|
2144
|
+
role: "user",
|
|
2145
|
+
text: `Look at this
|
|
2146
|
+
[Image: original 3024x4032, displayed at 1512x2016. Multiply coordinates by 2.00 to map to original image.]
|
|
2147
|
+
[Image converted from image/heic to image/png.]`,
|
|
2148
|
+
said: "Look at this"
|
|
2149
|
+
},
|
|
2150
|
+
{
|
|
2151
|
+
mark: "a skill run",
|
|
2152
|
+
role: "user",
|
|
2153
|
+
text: `<skill name="ta-package" location="/skills/ta-package/SKILL.md">
|
|
2154
|
+
# Ta package
|
|
2155
|
+
Steps.
|
|
2156
|
+
</skill>
|
|
2157
|
+
|
|
2158
|
+
Make a card`,
|
|
2159
|
+
said: "Make a card"
|
|
2160
|
+
},
|
|
2161
|
+
{
|
|
2162
|
+
mark: "a note of a task",
|
|
2163
|
+
role: "user",
|
|
2164
|
+
text: `<task_update id="t1" title="Fix login" status="done">
|
|
2165
|
+
All tests pass.
|
|
2166
|
+
</task_update>`,
|
|
2167
|
+
said: "Fix login"
|
|
2168
|
+
},
|
|
2169
|
+
{ mark: "a note of a new id", role: "user", text: `<task_renamed id="t2" was="t1" title="Fix login">
|
|
2170
|
+
Now t2.
|
|
2171
|
+
</task_renamed>` },
|
|
2172
|
+
{ mark: "a summary, then the answer", role: "assistant", text: `${SUMMARY}
|
|
2173
|
+
Switched to voice.`, said: "Switched to voice." },
|
|
2174
|
+
{ mark: "a summary alone", role: "assistant", text: SUMMARY },
|
|
2175
|
+
{ mark: "a summary as it streams", role: "assistant", text: `<conversation_history_summary>
|
|
2176
|
+
<summary>` },
|
|
2177
|
+
{
|
|
2178
|
+
mark: "a card after the answer",
|
|
2179
|
+
role: "assistant",
|
|
2180
|
+
text: '**Done**: tests pass.\n\n```ta-glance\n{"status":"done","blocks":[]}\n```',
|
|
2181
|
+
said: "tests pass"
|
|
2182
|
+
},
|
|
2183
|
+
{ mark: "a card alone", role: "assistant", text: '```ta-glance\n{"status":"done","blocks":[]}\n```' },
|
|
2184
|
+
{ mark: "a proposal", role: "assistant", text: 'Committed.\n\n```ta-propose\n{"kind":"git.push","title":"Push"}\n```', said: "Committed." },
|
|
2185
|
+
{ mark: "what a call says aloud", role: "assistant", text: "All fixed.\n\n```ta-say\nIt is fixed.\n```", said: "All fixed." },
|
|
2186
|
+
{ mark: "a tag not known yet", role: "assistant", text: `<system-reminder>
|
|
2187
|
+
</system-reminder>
|
|
2188
|
+
Ready.`, said: "Ready." }
|
|
2189
|
+
];
|
|
2190
|
+
function userWords(text2) {
|
|
2191
|
+
const said = TaImageNote.strip(TaMessageContext.strip(text2));
|
|
2192
|
+
const skill = TaSkillUse.parse(said);
|
|
2193
|
+
if (skill) {
|
|
2194
|
+
return TaSkillUse.command(skill);
|
|
2195
|
+
}
|
|
2196
|
+
const note = TaTaskNote.parse(said);
|
|
2197
|
+
if (!note) {
|
|
2198
|
+
return said;
|
|
2199
|
+
}
|
|
2200
|
+
if (note.kind === "renamed") {
|
|
2201
|
+
return "";
|
|
2202
|
+
}
|
|
2203
|
+
return note.kind === "update" && note.body.trim() ? `${note.title} · ${note.body}` : note.title;
|
|
2204
|
+
}
|
|
2205
|
+
function withoutFences(text2, drop, tags = false) {
|
|
2206
|
+
const kept = [];
|
|
2207
|
+
let fence;
|
|
2208
|
+
let left = false;
|
|
2209
|
+
for (const part of text2.split(`
|
|
2210
|
+
`)) {
|
|
2211
|
+
const open = FENCE.exec(part);
|
|
2212
|
+
if (!fence && open) {
|
|
2213
|
+
fence = { mark: open[1], dropped: drop(open[2]) };
|
|
2214
|
+
} else if (fence && closes(part, fence.mark)) {
|
|
2215
|
+
const dropped = fence.dropped;
|
|
2216
|
+
fence = undefined;
|
|
2217
|
+
if (dropped) {
|
|
2218
|
+
continue;
|
|
2219
|
+
}
|
|
1415
2220
|
}
|
|
1416
|
-
if (
|
|
1417
|
-
|
|
2221
|
+
if ((fence === null || fence === undefined ? undefined : fence.dropped) || !fence && tags && TAG_LINE.test(part.trim())) {
|
|
2222
|
+
left = true;
|
|
2223
|
+
} else {
|
|
2224
|
+
kept.push(part);
|
|
1418
2225
|
}
|
|
1419
2226
|
}
|
|
1420
|
-
return
|
|
2227
|
+
return left ? kept.join(`
|
|
2228
|
+
`).replace(/\n{3,}/g, `
|
|
2229
|
+
|
|
2230
|
+
`) : kept.join(`
|
|
2231
|
+
`);
|
|
1421
2232
|
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
2233
|
+
function codeOf(text2) {
|
|
2234
|
+
const code = [];
|
|
2235
|
+
let fence;
|
|
2236
|
+
for (const part of text2.split(`
|
|
2237
|
+
`)) {
|
|
2238
|
+
const open = FENCE.exec(part);
|
|
2239
|
+
if (!fence && open) {
|
|
2240
|
+
fence = { mark: open[1], card: CARD.test(open[2]) };
|
|
2241
|
+
} else if (fence && closes(part, fence.mark)) {
|
|
2242
|
+
fence = undefined;
|
|
2243
|
+
} else if (fence && !fence.card) {
|
|
2244
|
+
code.push(part);
|
|
2245
|
+
}
|
|
1427
2246
|
}
|
|
1428
|
-
return
|
|
2247
|
+
return code.join(`
|
|
2248
|
+
`);
|
|
1429
2249
|
}
|
|
1430
|
-
|
|
1431
|
-
function read(found) {
|
|
2250
|
+
function closes(part, mark) {
|
|
1432
2251
|
var _a;
|
|
1433
|
-
const
|
|
1434
|
-
|
|
2252
|
+
const close = (_a = /^\s*(`{3,}|~{3,})\s*$/.exec(part)) === null || _a === undefined ? undefined : _a[1];
|
|
2253
|
+
return !!close && close[0] === mark[0] && close.length >= mark.length;
|
|
2254
|
+
}
|
|
2255
|
+
function plain(text2) {
|
|
2256
|
+
const linked = text2.replace(/(?<!!)\[([^\]\n]*)\]\([^)\n]*\)/g, "$1");
|
|
2257
|
+
const words3 = linked.replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, "").trim();
|
|
2258
|
+
return words3 || linked.replace(/!\[([^\]\n]*)\]\([^)\n]*\)/g, "$1");
|
|
2259
|
+
}
|
|
2260
|
+
})(TaSaid || (TaSaid = {}));
|
|
2261
|
+
// ../ta-protocol/esm/common/screen-share-protocol.js
|
|
2262
|
+
var TaScreenShareServer = Symbol("TaScreenShareServer");
|
|
2263
|
+
var TaDesktopUtil;
|
|
2264
|
+
(function(TaDesktopUtil2) {
|
|
2265
|
+
TaDesktopUtil2.DEFAULT_PORT = 5900;
|
|
2266
|
+
function id(target) {
|
|
2267
|
+
var _a;
|
|
2268
|
+
return `${(_a = target.via) !== null && _a !== undefined ? _a : ""}|${host(target)}:${port(target)}`;
|
|
2269
|
+
}
|
|
2270
|
+
TaDesktopUtil2.id = id;
|
|
2271
|
+
function host(target) {
|
|
2272
|
+
var _a;
|
|
2273
|
+
return ((_a = target.host) !== null && _a !== undefined ? _a : "").trim() || "127.0.0.1";
|
|
2274
|
+
}
|
|
2275
|
+
TaDesktopUtil2.host = host;
|
|
2276
|
+
function port(target) {
|
|
2277
|
+
var _a;
|
|
2278
|
+
return (_a = target.port) !== null && _a !== undefined ? _a : TaDesktopUtil2.DEFAULT_PORT;
|
|
2279
|
+
}
|
|
2280
|
+
TaDesktopUtil2.port = port;
|
|
2281
|
+
function parse(id2) {
|
|
2282
|
+
const match = /^([^|]*)\|(.+):(\d+)$/.exec(String(id2 !== null && id2 !== undefined ? id2 : ""));
|
|
2283
|
+
if (!match) {
|
|
1435
2284
|
return;
|
|
1436
2285
|
}
|
|
1437
|
-
const
|
|
1438
|
-
return {
|
|
2286
|
+
const port2 = Number(match[3]);
|
|
2287
|
+
return port2 > 0 && port2 < 65536 ? { via: match[1], host: match[2], port: port2 } : undefined;
|
|
1439
2288
|
}
|
|
1440
|
-
|
|
2289
|
+
TaDesktopUtil2.parse = parse;
|
|
2290
|
+
function validPort(port2) {
|
|
2291
|
+
return typeof port2 === "number" && Number.isInteger(port2) && port2 >= 1024 && port2 < 65536;
|
|
2292
|
+
}
|
|
2293
|
+
TaDesktopUtil2.validPort = validPort;
|
|
2294
|
+
function loopback(host2) {
|
|
2295
|
+
return /^(127\.\d+\.\d+\.\d+|localhost|::1|\[::1\])$/i.test(host2);
|
|
2296
|
+
}
|
|
2297
|
+
TaDesktopUtil2.loopback = loopback;
|
|
2298
|
+
function validHost(host2) {
|
|
2299
|
+
return typeof host2 === "string" && /^[A-Za-z0-9.:\-[\]]{1,253}$/.test(host2);
|
|
2300
|
+
}
|
|
2301
|
+
TaDesktopUtil2.validHost = validHost;
|
|
2302
|
+
})(TaDesktopUtil || (TaDesktopUtil = {}));
|
|
2303
|
+
// ../ta-protocol/esm/common/settings-protocol.js
|
|
2304
|
+
var TaSettingsServer = Symbol("TaSettingsServer");
|
|
2305
|
+
// ../ta-protocol/esm/common/ta-protocol.js
|
|
2306
|
+
var TaServer = Symbol("TaServer");
|
|
2307
|
+
var TaClient = Symbol("TaClient");
|
|
2308
|
+
var TaSlashCommandUtil;
|
|
2309
|
+
(function(TaSlashCommandUtil2) {
|
|
2310
|
+
function description(command, language) {
|
|
2311
|
+
var _a, _b;
|
|
2312
|
+
const { descriptions } = command;
|
|
2313
|
+
return (_b = (_a = descriptions === null || descriptions === undefined ? undefined : descriptions[language]) !== null && _a !== undefined ? _a : descriptions === null || descriptions === undefined ? undefined : descriptions[language.split("-")[0]]) !== null && _b !== undefined ? _b : command.description;
|
|
2314
|
+
}
|
|
2315
|
+
TaSlashCommandUtil2.description = description;
|
|
2316
|
+
})(TaSlashCommandUtil || (TaSlashCommandUtil = {}));
|
|
1441
2317
|
// ../ta-protocol/esm/common/team-protocol.js
|
|
1442
2318
|
var TA_UNDECLARED = "extensions.install";
|
|
1443
2319
|
var TaPermissionUtil;
|
|
@@ -1486,7 +2362,7 @@ var TA_ACTIONS = [
|
|
|
1486
2362
|
action("commands.terminal", "Open terminals", "打开终端", "開啟終端機", "ターミナルを開く", { scoped: true, risky: true }),
|
|
1487
2363
|
action("hosts.use", "Use remote hosts", "使用远程主机", "使用遠端主機", "リモートホストを使用", { risky: true }),
|
|
1488
2364
|
action("models.use", "Use the models", "使用模型", "使用模型", "モデルを使用"),
|
|
1489
|
-
action("models.manage", "Sign in to models", "登录和更换模型账号", "登入和更換模型帳號", "モデルアカウントにサインイン・変更"),
|
|
2365
|
+
action("models.manage", "Sign in to models", "登录和更换模型账号", "登入和更換模型帳號", "モデルアカウントにサインイン・変更", { grant: "single" }),
|
|
1490
2366
|
action("cron.view", "See scheduled tasks", "查看定时任务", "檢視定時任務", "スケジュールタスクを確認"),
|
|
1491
2367
|
action("cron.manage", "Change scheduled tasks", "管理定时任务", "管理定時任務", "スケジュールタスクを管理"),
|
|
1492
2368
|
action("extensions.use", "Use extensions", "使用扩展", "使用擴充功能", "拡張機能を使用"),
|
|
@@ -1499,9 +2375,15 @@ var TA_ACTIONS = [
|
|
|
1499
2375
|
action("members.roles", "Change roles and members", "管理角色和成员", "管理角色和成員", "ロールとメンバーを管理"),
|
|
1500
2376
|
action("audit.view", "See the record", "查看记录", "檢視記錄", "レコードを確認")
|
|
1501
2377
|
];
|
|
2378
|
+
var TA_OWNER_ACTIONS = [
|
|
2379
|
+
action("desktop.view", "See remote desktops", "查看远程桌面", "檢視遠端桌面", "リモートデスクトップを見る", { risky: true }),
|
|
2380
|
+
action("desktop.control", "Work remote desktops", "操作远程桌面", "操作遠端桌面", "リモートデスクトップを操作", { risky: true })
|
|
2381
|
+
];
|
|
2382
|
+
var OWNER_AREAS = ["desktop"];
|
|
1502
2383
|
var TaActionUtil;
|
|
1503
2384
|
(function(TaActionUtil2) {
|
|
1504
2385
|
const byId = new Map(TA_ACTIONS.map((one) => [one.id, one]));
|
|
2386
|
+
const titled = new Map([...TA_ACTIONS, ...TA_OWNER_ACTIONS].map((one) => [one.id, one]));
|
|
1505
2387
|
function info(id) {
|
|
1506
2388
|
return byId.get(id);
|
|
1507
2389
|
}
|
|
@@ -1509,7 +2391,7 @@ var TaActionUtil;
|
|
|
1509
2391
|
function title(id, language) {
|
|
1510
2392
|
var _a;
|
|
1511
2393
|
var _b, _c;
|
|
1512
|
-
const title2 = (_a =
|
|
2394
|
+
const title2 = (_a = titled.get(id)) === null || _a === undefined ? undefined : _a.title;
|
|
1513
2395
|
if (!title2) {
|
|
1514
2396
|
return id;
|
|
1515
2397
|
}
|
|
@@ -1521,6 +2403,16 @@ var TaActionUtil;
|
|
|
1521
2403
|
});
|
|
1522
2404
|
}
|
|
1523
2405
|
TaActionUtil2.title = title;
|
|
2406
|
+
function grantable(id) {
|
|
2407
|
+
const info2 = byId.get(id);
|
|
2408
|
+
return !!info2 && !OWNER_AREAS.includes(info2.area);
|
|
2409
|
+
}
|
|
2410
|
+
TaActionUtil2.grantable = grantable;
|
|
2411
|
+
function inRoles(id) {
|
|
2412
|
+
var _a;
|
|
2413
|
+
return grantable(id) && ((_a = byId.get(id)) === null || _a === undefined ? undefined : _a.grant) !== "single";
|
|
2414
|
+
}
|
|
2415
|
+
TaActionUtil2.inRoles = inRoles;
|
|
1524
2416
|
function inside(dir, path) {
|
|
1525
2417
|
const base = dir.replace(/\/+$/, "");
|
|
1526
2418
|
return path === base || path.startsWith(`${base}/`) || base === "";
|
|
@@ -1529,6 +2421,55 @@ var TaActionUtil;
|
|
|
1529
2421
|
})(TaActionUtil || (TaActionUtil = {}));
|
|
1530
2422
|
// ../ta-protocol/esm/common/usage-protocol.js
|
|
1531
2423
|
var TaUsageServer = Symbol("TaUsageServer");
|
|
2424
|
+
// ../ta-protocol/esm/common/voice-protocol.js
|
|
2425
|
+
var TaVoiceServer = Symbol("TaVoiceServer");
|
|
2426
|
+
var TaBargeIn;
|
|
2427
|
+
(function(TaBargeIn2) {
|
|
2428
|
+
TaBargeIn2.DEFAULTS = { duck: 0.2, speechMs: 500, level: 0.02, words: 2, waitMs: 1500, echo: 0.3, joinMs: 300, tap: false };
|
|
2429
|
+
TaBargeIn2.SENSITIVITY = [
|
|
2430
|
+
{ speechMs: 1000, level: 0.05 },
|
|
2431
|
+
{ speechMs: 750, level: 0.035 },
|
|
2432
|
+
{ speechMs: TaBargeIn2.DEFAULTS.speechMs, level: TaBargeIn2.DEFAULTS.level },
|
|
2433
|
+
{ speechMs: 300, level: 0.012 },
|
|
2434
|
+
{ speechMs: 150, level: 0.006 }
|
|
2435
|
+
];
|
|
2436
|
+
function sensitivity(bargeIn) {
|
|
2437
|
+
let nearest = 0;
|
|
2438
|
+
TaBargeIn2.SENSITIVITY.forEach((step, index) => {
|
|
2439
|
+
if (Math.abs(step.speechMs - bargeIn.speechMs) < Math.abs(TaBargeIn2.SENSITIVITY[nearest].speechMs - bargeIn.speechMs)) {
|
|
2440
|
+
nearest = index;
|
|
2441
|
+
}
|
|
2442
|
+
});
|
|
2443
|
+
return nearest;
|
|
2444
|
+
}
|
|
2445
|
+
TaBargeIn2.sensitivity = sensitivity;
|
|
2446
|
+
function pick(value) {
|
|
2447
|
+
const given = value && typeof value === "object" ? value : {};
|
|
2448
|
+
const out = typeof given.tap === "boolean" ? { tap: given.tap } : {};
|
|
2449
|
+
for (const key of Object.keys(RANGES)) {
|
|
2450
|
+
const number = given[key];
|
|
2451
|
+
if (typeof number === "number" && Number.isFinite(number)) {
|
|
2452
|
+
const [min, max] = RANGES[key];
|
|
2453
|
+
out[key] = Math.min(max, Math.max(min, number));
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
return out;
|
|
2457
|
+
}
|
|
2458
|
+
TaBargeIn2.pick = pick;
|
|
2459
|
+
const RANGES = {
|
|
2460
|
+
duck: [0, 1],
|
|
2461
|
+
speechMs: [0, 5000],
|
|
2462
|
+
level: [0, 1],
|
|
2463
|
+
words: [1, 50],
|
|
2464
|
+
waitMs: [100, 1e4],
|
|
2465
|
+
echo: [0, 4],
|
|
2466
|
+
joinMs: [0, 3000]
|
|
2467
|
+
};
|
|
2468
|
+
function resolve(value) {
|
|
2469
|
+
return { ...TaBargeIn2.DEFAULTS, ...pick(value) };
|
|
2470
|
+
}
|
|
2471
|
+
TaBargeIn2.resolve = resolve;
|
|
2472
|
+
})(TaBargeIn || (TaBargeIn = {}));
|
|
1532
2473
|
// ../ta-protocol/esm/common/workspace-protocol.js
|
|
1533
2474
|
var TaWorkspaceServer = Symbol("TaWorkspaceServer");
|
|
1534
2475
|
var TaTerminalServer = Symbol("TaTerminalServer");
|
|
@@ -1562,7 +2503,7 @@ function useBusy(ui) {
|
|
|
1562
2503
|
|
|
1563
2504
|
// web-src/import-dialog.tsx
|
|
1564
2505
|
function ImportDialog({ pi, actions, onClose }) {
|
|
1565
|
-
const
|
|
2506
|
+
const words2 = actions.words;
|
|
1566
2507
|
const { Dialog, icons } = pi.ui;
|
|
1567
2508
|
const Upload = icons.Upload ?? icons.Download;
|
|
1568
2509
|
const input = React.useRef(null);
|
|
@@ -1581,12 +2522,12 @@ function ImportDialog({ pi, actions, onClose }) {
|
|
|
1581
2522
|
};
|
|
1582
2523
|
const take = (file) => file && void run(() => actions.importFile(file));
|
|
1583
2524
|
return /* @__PURE__ */ React.createElement(Dialog, {
|
|
1584
|
-
title:
|
|
2525
|
+
title: words2.importTitle,
|
|
1585
2526
|
onClose
|
|
1586
2527
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
1587
2528
|
className: "tax-dialog"
|
|
1588
2529
|
}, /* @__PURE__ */ React.createElement("section", {
|
|
1589
|
-
"aria-label":
|
|
2530
|
+
"aria-label": words2.importTitle,
|
|
1590
2531
|
className: `tax-drop${over ? " tax-over" : ""}`,
|
|
1591
2532
|
onDragOver: (event) => {
|
|
1592
2533
|
event.preventDefault();
|
|
@@ -1600,11 +2541,11 @@ function ImportDialog({ pi, actions, onClose }) {
|
|
|
1600
2541
|
}
|
|
1601
2542
|
}, Upload && /* @__PURE__ */ React.createElement(Upload, {
|
|
1602
2543
|
size: 22
|
|
1603
|
-
}), /* @__PURE__ */ React.createElement("div", null, busy ?
|
|
2544
|
+
}), /* @__PURE__ */ React.createElement("div", null, busy ? words2.working : /* @__PURE__ */ React.createElement(React.Fragment, null, words2.dropHere, " ", /* @__PURE__ */ React.createElement("button", {
|
|
1604
2545
|
type: "button",
|
|
1605
2546
|
className: "tax-link",
|
|
1606
2547
|
onClick: () => input.current?.click()
|
|
1607
|
-
},
|
|
2548
|
+
}, words2.chooseFile))), /* @__PURE__ */ React.createElement("input", {
|
|
1608
2549
|
ref: input,
|
|
1609
2550
|
type: "file",
|
|
1610
2551
|
accept: ".tgz,.gz,application/gzip",
|
|
@@ -1615,7 +2556,7 @@ function ImportDialog({ pi, actions, onClose }) {
|
|
|
1615
2556
|
}
|
|
1616
2557
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
1617
2558
|
className: "tax-or"
|
|
1618
|
-
},
|
|
2559
|
+
}, words2.orSource), /* @__PURE__ */ React.createElement("form", {
|
|
1619
2560
|
className: "tax-source",
|
|
1620
2561
|
onSubmit: (event) => {
|
|
1621
2562
|
event.preventDefault();
|
|
@@ -1623,16 +2564,16 @@ function ImportDialog({ pi, actions, onClose }) {
|
|
|
1623
2564
|
}
|
|
1624
2565
|
}, /* @__PURE__ */ React.createElement("input", {
|
|
1625
2566
|
value: source,
|
|
1626
|
-
placeholder:
|
|
2567
|
+
placeholder: words2.sourcePlaceholder,
|
|
1627
2568
|
spellCheck: false,
|
|
1628
2569
|
onChange: (event) => setSource(event.target.value)
|
|
1629
2570
|
}), /* @__PURE__ */ React.createElement("button", {
|
|
1630
2571
|
type: "submit",
|
|
1631
2572
|
className: "tax-button",
|
|
1632
2573
|
disabled: busy || !source.trim()
|
|
1633
|
-
}, busy ?
|
|
2574
|
+
}, busy ? words2.working : words2.install)), /* @__PURE__ */ React.createElement("div", {
|
|
1634
2575
|
className: "tax-note"
|
|
1635
|
-
},
|
|
2576
|
+
}, words2.trust)));
|
|
1636
2577
|
}
|
|
1637
2578
|
|
|
1638
2579
|
// web-src/market-util.ts
|
|
@@ -1713,8 +2654,8 @@ var MarketUtil;
|
|
|
1713
2654
|
}
|
|
1714
2655
|
MarketUtil.shortName = shortName;
|
|
1715
2656
|
function monogram(name) {
|
|
1716
|
-
const
|
|
1717
|
-
const letters = (
|
|
2657
|
+
const words2 = shortName(name).split(/[-_.\s]+/).filter(Boolean);
|
|
2658
|
+
const letters = (words2.length > 1 ? words2[0][0] + words2[1][0] : (words2[0] ?? name).slice(0, 2)).toUpperCase();
|
|
1718
2659
|
let hash = 0;
|
|
1719
2660
|
for (let i = 0;i < name.length; i++) {
|
|
1720
2661
|
hash = hash * 31 + name.charCodeAt(i) | 0;
|
|
@@ -1820,7 +2761,7 @@ function PackageName({ name }) {
|
|
|
1820
2761
|
}
|
|
1821
2762
|
function InstallButton({ context, name, large }) {
|
|
1822
2763
|
const { pi, actions } = context;
|
|
1823
|
-
const
|
|
2764
|
+
const words2 = actions.words;
|
|
1824
2765
|
const status = useMarketStatus(context, name);
|
|
1825
2766
|
const size = large ? " tax-install-large" : "";
|
|
1826
2767
|
if (status.kind === "installing") {
|
|
@@ -1832,7 +2773,7 @@ function InstallButton({ context, name, large }) {
|
|
|
1832
2773
|
className: "tax-spin"
|
|
1833
2774
|
}, /* @__PURE__ */ React.createElement(Loader, {
|
|
1834
2775
|
size: large ? 15 : 13
|
|
1835
|
-
})),
|
|
2776
|
+
})), words2.installing);
|
|
1836
2777
|
}
|
|
1837
2778
|
if (status.kind !== "none") {
|
|
1838
2779
|
const Check = icon(pi, "Check");
|
|
@@ -1840,7 +2781,7 @@ function InstallButton({ context, name, large }) {
|
|
|
1840
2781
|
className: `tax-install tax-install-done${size}`
|
|
1841
2782
|
}, status.kind === "installed" && /* @__PURE__ */ React.createElement(Check, {
|
|
1842
2783
|
size: large ? 15 : 13
|
|
1843
|
-
}), status.kind === "installed" ?
|
|
2784
|
+
}), status.kind === "installed" ? words2.installedTag : words2.builtinTag);
|
|
1844
2785
|
}
|
|
1845
2786
|
return /* @__PURE__ */ React.createElement("button", {
|
|
1846
2787
|
type: "button",
|
|
@@ -1849,17 +2790,20 @@ function InstallButton({ context, name, large }) {
|
|
|
1849
2790
|
event.stopPropagation();
|
|
1850
2791
|
actions.installFromMarket(name);
|
|
1851
2792
|
}
|
|
1852
|
-
},
|
|
2793
|
+
}, words2.install);
|
|
1853
2794
|
}
|
|
1854
2795
|
|
|
1855
2796
|
// web-src/market-detail.tsx
|
|
2797
|
+
var noBack = (_open, _close) => false;
|
|
1856
2798
|
function MarketDetailView({ context, name, onBack }) {
|
|
1857
2799
|
const { pi, market, actions } = context;
|
|
1858
|
-
const
|
|
2800
|
+
const words2 = actions.words;
|
|
2801
|
+
const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
|
|
1859
2802
|
const [detail, setDetail] = React.useState();
|
|
1860
2803
|
const [error, setError] = React.useState();
|
|
1861
2804
|
const [attempt, setAttempt] = React.useState(0);
|
|
1862
2805
|
const [opening, setOpening] = React.useState(false);
|
|
2806
|
+
(pi.ui.useBackLayer ?? noBack)(true, onBack);
|
|
1863
2807
|
React.useEffect(() => {
|
|
1864
2808
|
let live = true;
|
|
1865
2809
|
setError(undefined);
|
|
@@ -1890,18 +2834,18 @@ function MarketDetailView({ context, name, onBack }) {
|
|
|
1890
2834
|
const facts = [
|
|
1891
2835
|
summary?.publisher,
|
|
1892
2836
|
summary?.version && `v${summary.version}`,
|
|
1893
|
-
summary?.downloads ? ExtensionWords.fill(
|
|
2837
|
+
summary?.downloads ? ExtensionWords.fill(words2.perMonth, { count: MarketUtil.compact(summary.downloads) }) : undefined,
|
|
1894
2838
|
detail?.license,
|
|
1895
2839
|
ago
|
|
1896
2840
|
].filter((fact) => !!fact);
|
|
1897
2841
|
const links = [
|
|
1898
2842
|
{ key: "npm", label: "npm", href: summary?.links.npm ?? `https://www.npmjs.com/package/${name}` },
|
|
1899
|
-
{ key: "source", label:
|
|
1900
|
-
{ key: "home", label:
|
|
2843
|
+
{ key: "source", label: words2.source, href: summary?.links.repository },
|
|
2844
|
+
{ key: "home", label: words2.homepage, href: summary?.links.homepage !== summary?.links.repository ? summary?.links.homepage : undefined }
|
|
1901
2845
|
].filter((link) => !!link.href && /^https?:\/\//.test(link.href));
|
|
1902
2846
|
const kinds = detail?.resources.length ? detail.resources : summary?.kinds ?? [];
|
|
1903
2847
|
const hasWeb = kinds.includes("web");
|
|
1904
|
-
const tags = ((detail?.resources.length) ? detail.resources : summary?.kinds ?? []).map((type) => type === "web" ?
|
|
2848
|
+
const tags = ((detail?.resources.length) ? detail.resources : summary?.kinds ?? []).map((type) => type === "web" ? words2.kinds.web : words2.marketKinds[type]);
|
|
1905
2849
|
return /* @__PURE__ */ React.createElement("article", {
|
|
1906
2850
|
className: "tax-detail",
|
|
1907
2851
|
"aria-label": name
|
|
@@ -1911,7 +2855,7 @@ function MarketDetailView({ context, name, onBack }) {
|
|
|
1911
2855
|
onClick: onBack
|
|
1912
2856
|
}, /* @__PURE__ */ React.createElement(ArrowLeft, {
|
|
1913
2857
|
size: 15
|
|
1914
|
-
}), " ",
|
|
2858
|
+
}), " ", words2.back), /* @__PURE__ */ React.createElement("header", {
|
|
1915
2859
|
className: "tax-detail-head"
|
|
1916
2860
|
}, /* @__PURE__ */ React.createElement(PackageFace, {
|
|
1917
2861
|
name,
|
|
@@ -1939,25 +2883,25 @@ function MarketDetailView({ context, name, onBack }) {
|
|
|
1939
2883
|
}), status.kind === "none" && hasWeb && /* @__PURE__ */ React.createElement("button", {
|
|
1940
2884
|
type: "button",
|
|
1941
2885
|
className: "tax-button tax-button-quiet",
|
|
1942
|
-
title:
|
|
2886
|
+
title: words2.openNowHint,
|
|
1943
2887
|
disabled: opening,
|
|
1944
2888
|
onClick: () => {
|
|
1945
2889
|
setOpening(true);
|
|
1946
2890
|
actions.openFromMarket(name).finally(() => setOpening(false));
|
|
1947
2891
|
}
|
|
1948
|
-
}, opening ?
|
|
2892
|
+
}, opening ? words2.openingNow : words2.openNow), status.kind === "installed" && /* @__PURE__ */ React.createElement("button", {
|
|
1949
2893
|
type: "button",
|
|
1950
2894
|
className: "tax-button tax-button-quiet",
|
|
1951
2895
|
onClick: () => void actions.remove(status.pkg)
|
|
1952
2896
|
}, /* @__PURE__ */ React.createElement(Trash, {
|
|
1953
2897
|
size: 14
|
|
1954
|
-
}), " ",
|
|
2898
|
+
}), " ", words2.remove), /* @__PURE__ */ React.createElement("button", {
|
|
1955
2899
|
type: "button",
|
|
1956
2900
|
className: "tax-button tax-button-quiet",
|
|
1957
2901
|
onClick: () => pi.ui.shareExtension({ title: name, source: `npm:${name}` })
|
|
1958
2902
|
}, /* @__PURE__ */ React.createElement(QrCode, {
|
|
1959
2903
|
size: 14
|
|
1960
|
-
}), " ",
|
|
2904
|
+
}), " ", words2.share), links.map((link) => /* @__PURE__ */ React.createElement("a", {
|
|
1961
2905
|
key: link.key,
|
|
1962
2906
|
className: "tax-button tax-button-quiet",
|
|
1963
2907
|
href: link.href,
|
|
@@ -1979,21 +2923,20 @@ function MarketDetailView({ context, name, onBack }) {
|
|
|
1979
2923
|
loading: "lazy"
|
|
1980
2924
|
}) : null, /* @__PURE__ */ React.createElement("section", {
|
|
1981
2925
|
className: "tax-readme",
|
|
1982
|
-
"aria-label":
|
|
2926
|
+
"aria-label": words2.readmeTitle
|
|
1983
2927
|
}, error ? /* @__PURE__ */ React.createElement("div", {
|
|
1984
2928
|
className: "tax-empty tax-market-error"
|
|
1985
2929
|
}, /* @__PURE__ */ React.createElement("span", null, error), /* @__PURE__ */ React.createElement("button", {
|
|
1986
2930
|
type: "button",
|
|
1987
2931
|
className: "tax-button",
|
|
1988
2932
|
onClick: () => setAttempt(attempt + 1)
|
|
1989
|
-
},
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
}, /* @__PURE__ */ React.createElement("span", null), /* @__PURE__ */ React.createElement("span", null), /* @__PURE__ */ React.createElement("span", null)) : detail.readme ? /* @__PURE__ */ React.createElement(Markdown, {
|
|
2933
|
+
}, words2.retry)) : !detail ? /* @__PURE__ */ React.createElement(Loading, {
|
|
2934
|
+
compact: true
|
|
2935
|
+
}) : detail.readme ? /* @__PURE__ */ React.createElement(Markdown, {
|
|
1993
2936
|
text: detail.readme
|
|
1994
2937
|
}) : /* @__PURE__ */ React.createElement("div", {
|
|
1995
2938
|
className: "tax-note"
|
|
1996
|
-
},
|
|
2939
|
+
}, words2.noReadme)));
|
|
1997
2940
|
}
|
|
1998
2941
|
|
|
1999
2942
|
// web-src/market-view.tsx
|
|
@@ -2032,7 +2975,7 @@ function MarketView({ context }) {
|
|
|
2032
2975
|
}
|
|
2033
2976
|
function MarketList({ context, onOpen }) {
|
|
2034
2977
|
const { pi, market, actions } = context;
|
|
2035
|
-
const
|
|
2978
|
+
const words2 = actions.words;
|
|
2036
2979
|
const state = React.useSyncExternalStore((listener) => market.subscribe(listener), () => market.state);
|
|
2037
2980
|
const [text, setText] = React.useState(state.query);
|
|
2038
2981
|
const input = React.useRef(null);
|
|
@@ -2049,6 +2992,7 @@ function MarketList({ context, onOpen }) {
|
|
|
2049
2992
|
const { packages, loading, error, query, total, next } = state;
|
|
2050
2993
|
const count = query ? next === undefined ? packages?.length : undefined : total;
|
|
2051
2994
|
const first = loading && !packages;
|
|
2995
|
+
const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
|
|
2052
2996
|
return /* @__PURE__ */ React.createElement("div", {
|
|
2053
2997
|
className: "tax-market"
|
|
2054
2998
|
}, /* @__PURE__ */ React.createElement("form", {
|
|
@@ -2063,8 +3007,8 @@ function MarketList({ context, onOpen }) {
|
|
|
2063
3007
|
ref: input,
|
|
2064
3008
|
type: "search",
|
|
2065
3009
|
value: text,
|
|
2066
|
-
placeholder:
|
|
2067
|
-
"aria-label":
|
|
3010
|
+
placeholder: words2.marketSearch,
|
|
3011
|
+
"aria-label": words2.marketSearch,
|
|
2068
3012
|
spellCheck: false,
|
|
2069
3013
|
onChange: (event) => setText(event.target.value),
|
|
2070
3014
|
onKeyDown: (event) => {
|
|
@@ -2076,8 +3020,8 @@ function MarketList({ context, onOpen }) {
|
|
|
2076
3020
|
}), text && /* @__PURE__ */ React.createElement("button", {
|
|
2077
3021
|
type: "button",
|
|
2078
3022
|
className: "tax-search-clear",
|
|
2079
|
-
"aria-label":
|
|
2080
|
-
title:
|
|
3023
|
+
"aria-label": words2.marketClear,
|
|
3024
|
+
title: words2.marketClear,
|
|
2081
3025
|
onClick: () => {
|
|
2082
3026
|
pick("");
|
|
2083
3027
|
input.current?.focus();
|
|
@@ -2086,7 +3030,7 @@ function MarketList({ context, onOpen }) {
|
|
|
2086
3030
|
size: 14
|
|
2087
3031
|
}))), /* @__PURE__ */ React.createElement("div", {
|
|
2088
3032
|
className: "tax-topics"
|
|
2089
|
-
},
|
|
3033
|
+
}, words2.topics.map((topic) => /* @__PURE__ */ React.createElement("button", {
|
|
2090
3034
|
key: topic.query,
|
|
2091
3035
|
type: "button",
|
|
2092
3036
|
className: `tax-topic${query === topic.query ? " tax-active" : ""}`,
|
|
@@ -2094,25 +3038,19 @@ function MarketList({ context, onOpen }) {
|
|
|
2094
3038
|
onClick: () => pick(query === topic.query ? "" : topic.query)
|
|
2095
3039
|
}, topic.label))), /* @__PURE__ */ React.createElement("div", {
|
|
2096
3040
|
className: "tax-section-head"
|
|
2097
|
-
}, /* @__PURE__ */ React.createElement("h2", null, query ?
|
|
3041
|
+
}, /* @__PURE__ */ React.createElement("h2", null, query ? words2.marketResults : words2.marketPopular, loading && packages && /* @__PURE__ */ React.createElement("span", {
|
|
2098
3042
|
className: "tax-spin tax-head-spin"
|
|
2099
3043
|
}, React.createElement(icon(pi, "LoaderCircle"), { size: 13 }))), count !== undefined && !error && /* @__PURE__ */ React.createElement("span", {
|
|
2100
3044
|
className: "tax-count-note"
|
|
2101
|
-
}, ExtensionWords.fill(
|
|
3045
|
+
}, ExtensionWords.fill(words2.marketCount, { count: count.toLocaleString(pi.ui.language) }))), error ? /* @__PURE__ */ React.createElement("div", {
|
|
2102
3046
|
className: "tax-empty tax-market-error"
|
|
2103
|
-
}, /* @__PURE__ */ React.createElement("strong", null,
|
|
3047
|
+
}, /* @__PURE__ */ React.createElement("strong", null, words2.marketError), /* @__PURE__ */ React.createElement("span", null, error), /* @__PURE__ */ React.createElement("button", {
|
|
2104
3048
|
type: "button",
|
|
2105
3049
|
className: "tax-button",
|
|
2106
3050
|
onClick: () => void market.search(text)
|
|
2107
|
-
},
|
|
2108
|
-
className: "tax-grid",
|
|
2109
|
-
"aria-busy": "true"
|
|
2110
|
-
}, Array.from({ length: 6 }, (_, index) => /* @__PURE__ */ React.createElement("div", {
|
|
2111
|
-
key: index,
|
|
2112
|
-
className: "tax-card tax-skeleton"
|
|
2113
|
-
}))) : packages?.length === 0 ? /* @__PURE__ */ React.createElement("div", {
|
|
3051
|
+
}, words2.retry)) : first ? /* @__PURE__ */ React.createElement(Loading, null) : packages?.length === 0 ? /* @__PURE__ */ React.createElement("div", {
|
|
2114
3052
|
className: "tax-empty"
|
|
2115
|
-
}, ExtensionWords.fill(
|
|
3053
|
+
}, ExtensionWords.fill(words2.marketEmpty, { query })) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
2116
3054
|
className: "tax-grid"
|
|
2117
3055
|
}, packages?.map((pkg) => /* @__PURE__ */ React.createElement(MarketCard, {
|
|
2118
3056
|
key: pkg.name,
|
|
@@ -2123,11 +3061,11 @@ function MarketList({ context, onOpen }) {
|
|
|
2123
3061
|
context
|
|
2124
3062
|
})), /* @__PURE__ */ React.createElement("div", {
|
|
2125
3063
|
className: "tax-note tax-market-note"
|
|
2126
|
-
},
|
|
3064
|
+
}, words2.marketNote));
|
|
2127
3065
|
}
|
|
2128
3066
|
function MoreSentinel({ context }) {
|
|
2129
3067
|
const { market, actions } = context;
|
|
2130
|
-
const
|
|
3068
|
+
const words2 = actions.words;
|
|
2131
3069
|
const state = React.useSyncExternalStore((listener) => market.subscribe(listener), () => market.state);
|
|
2132
3070
|
const ref = React.useRef(null);
|
|
2133
3071
|
const more = !!state.packages && state.next !== undefined;
|
|
@@ -2146,11 +3084,11 @@ function MoreSentinel({ context }) {
|
|
|
2146
3084
|
return /* @__PURE__ */ React.createElement("div", {
|
|
2147
3085
|
ref,
|
|
2148
3086
|
className: "tax-more"
|
|
2149
|
-
}, more ?
|
|
3087
|
+
}, more ? words2.loadingMore : words2.allShown);
|
|
2150
3088
|
}
|
|
2151
3089
|
function MarketCard({ context, pkg, onOpen }) {
|
|
2152
3090
|
const { pi, actions } = context;
|
|
2153
|
-
const
|
|
3091
|
+
const words2 = actions.words;
|
|
2154
3092
|
const Down = icon(pi, "ArrowDown");
|
|
2155
3093
|
const ago = MarketUtil.ago(pkg.date, pi.ui.language);
|
|
2156
3094
|
return /* @__PURE__ */ React.createElement("div", {
|
|
@@ -2181,11 +3119,11 @@ function MarketCard({ context, pkg, onOpen }) {
|
|
|
2181
3119
|
className: "tax-card-meta"
|
|
2182
3120
|
}, pkg.publisher && /* @__PURE__ */ React.createElement("span", {
|
|
2183
3121
|
className: "tax-ellipsis"
|
|
2184
|
-
}, ExtensionWords.fill(
|
|
3122
|
+
}, ExtensionWords.fill(words2.by, { name: pkg.publisher })), pkg.downloads !== undefined && pkg.downloads > 0 && /* @__PURE__ */ React.createElement("span", {
|
|
2185
3123
|
className: "tax-downloads"
|
|
2186
3124
|
}, /* @__PURE__ */ React.createElement(Down, {
|
|
2187
3125
|
size: 11
|
|
2188
|
-
}), ExtensionWords.fill(
|
|
3126
|
+
}), ExtensionWords.fill(words2.perMonth, { count: MarketUtil.compact(pkg.downloads) })))), /* @__PURE__ */ React.createElement(InstallButton, {
|
|
2189
3127
|
context,
|
|
2190
3128
|
name: pkg.name
|
|
2191
3129
|
})), /* @__PURE__ */ React.createElement("p", {
|
|
@@ -2195,7 +3133,7 @@ function MarketCard({ context, pkg, onOpen }) {
|
|
|
2195
3133
|
}, pkg.kinds.map((kind) => /* @__PURE__ */ React.createElement("span", {
|
|
2196
3134
|
key: kind,
|
|
2197
3135
|
className: "tax-tag"
|
|
2198
|
-
},
|
|
3136
|
+
}, words2.marketKinds[kind])), ago && /* @__PURE__ */ React.createElement("span", {
|
|
2199
3137
|
className: "tax-card-time"
|
|
2200
3138
|
}, ago)));
|
|
2201
3139
|
}
|
|
@@ -2385,7 +3323,7 @@ function KindPicture({ pi, kind }) {
|
|
|
2385
3323
|
// web-src/page.tsx
|
|
2386
3324
|
function ExtensionsPage({ context }) {
|
|
2387
3325
|
const { pi, store, actions, importing } = context;
|
|
2388
|
-
const
|
|
3326
|
+
const words2 = actions.words;
|
|
2389
3327
|
const tab = context.tab.use();
|
|
2390
3328
|
const dialog = importing.use();
|
|
2391
3329
|
const [dragging, setDragging] = React.useState(false);
|
|
@@ -2393,12 +3331,12 @@ function ExtensionsPage({ context }) {
|
|
|
2393
3331
|
store.load();
|
|
2394
3332
|
}, [store]);
|
|
2395
3333
|
const tabs = [
|
|
2396
|
-
{ key: "mine", label:
|
|
2397
|
-
{ key: "market", label:
|
|
3334
|
+
{ key: "mine", label: words2.tabMine, icon: "Puzzle" },
|
|
3335
|
+
{ key: "market", label: words2.tabMarket, icon: "Store" }
|
|
2398
3336
|
];
|
|
2399
3337
|
const files = (event) => Array.from(event.dataTransfer.types).includes("Files");
|
|
2400
3338
|
return /* @__PURE__ */ React.createElement("section", {
|
|
2401
|
-
"aria-label":
|
|
3339
|
+
"aria-label": words2.title,
|
|
2402
3340
|
className: "tax-page",
|
|
2403
3341
|
onDragOver: (event) => {
|
|
2404
3342
|
if (files(event) && !dialog) {
|
|
@@ -2426,7 +3364,7 @@ function ExtensionsPage({ context }) {
|
|
|
2426
3364
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2427
3365
|
className: "tax-tabs",
|
|
2428
3366
|
role: "tablist",
|
|
2429
|
-
"aria-label":
|
|
3367
|
+
"aria-label": words2.title
|
|
2430
3368
|
}, tabs.map((item) => {
|
|
2431
3369
|
const TabIcon = icon(pi, item.icon, "PackageOpen");
|
|
2432
3370
|
return /* @__PURE__ */ React.createElement("button", {
|
|
@@ -2448,7 +3386,7 @@ function ExtensionsPage({ context }) {
|
|
|
2448
3386
|
context
|
|
2449
3387
|
})), dragging && /* @__PURE__ */ React.createElement("div", {
|
|
2450
3388
|
className: "tax-drop-overlay"
|
|
2451
|
-
},
|
|
3389
|
+
}, words2.dropToImport), dialog && /* @__PURE__ */ React.createElement(ImportDialog, {
|
|
2452
3390
|
pi,
|
|
2453
3391
|
actions,
|
|
2454
3392
|
onClose: () => importing.set(false)
|
|
@@ -2456,7 +3394,8 @@ function ExtensionsPage({ context }) {
|
|
|
2456
3394
|
}
|
|
2457
3395
|
function MineView({ context }) {
|
|
2458
3396
|
const { pi, store, actions, importing } = context;
|
|
2459
|
-
const
|
|
3397
|
+
const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
|
|
3398
|
+
const words2 = actions.words;
|
|
2460
3399
|
const { packages, removing } = React.useSyncExternalStore((listener) => store.subscribe(listener), () => store.state);
|
|
2461
3400
|
const [starting, setStarting] = React.useState(false);
|
|
2462
3401
|
const groups = ExtensionsUtil.group(packages ?? []);
|
|
@@ -2478,16 +3417,17 @@ function MineView({ context }) {
|
|
|
2478
3417
|
className: "tax-hero"
|
|
2479
3418
|
}, /* @__PURE__ */ React.createElement("h1", null, /* @__PURE__ */ React.createElement(Sparkles, {
|
|
2480
3419
|
size: 20
|
|
2481
|
-
}), " ",
|
|
2482
|
-
placeholder:
|
|
3420
|
+
}), " ", words2.heroTitle), /* @__PURE__ */ React.createElement("p", null, words2.heroText), /* @__PURE__ */ React.createElement(Composer, {
|
|
3421
|
+
placeholder: words2.placeholder,
|
|
2483
3422
|
onSend: make,
|
|
2484
|
-
commands: true
|
|
3423
|
+
commands: true,
|
|
3424
|
+
draft: "make"
|
|
2485
3425
|
}), /* @__PURE__ */ React.createElement("div", {
|
|
2486
3426
|
className: "tax-kinds"
|
|
2487
3427
|
}, /* @__PURE__ */ React.createElement(PictureCards, {
|
|
2488
3428
|
columns: 4,
|
|
2489
3429
|
compactColumns: 2,
|
|
2490
|
-
cards:
|
|
3430
|
+
cards: words2.examples.map((example) => ({
|
|
2491
3431
|
key: example.kind,
|
|
2492
3432
|
picture: /* @__PURE__ */ React.createElement(KindPicture, {
|
|
2493
3433
|
pi,
|
|
@@ -2502,7 +3442,7 @@ function MineView({ context }) {
|
|
|
2502
3442
|
className: "tax-section"
|
|
2503
3443
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2504
3444
|
className: "tax-section-head"
|
|
2505
|
-
}, /* @__PURE__ */ React.createElement("h2", null,
|
|
3445
|
+
}, /* @__PURE__ */ React.createElement("h2", null, words2.mine, groups.mine.length > 0 && /* @__PURE__ */ React.createElement("span", {
|
|
2506
3446
|
className: "tax-count"
|
|
2507
3447
|
}, groups.mine.length)), /* @__PURE__ */ React.createElement("button", {
|
|
2508
3448
|
type: "button",
|
|
@@ -2510,19 +3450,19 @@ function MineView({ context }) {
|
|
|
2510
3450
|
onClick: () => importing.set(true)
|
|
2511
3451
|
}, /* @__PURE__ */ React.createElement(Upload, {
|
|
2512
3452
|
size: 14
|
|
2513
|
-
}), " ",
|
|
2514
|
-
|
|
2515
|
-
}
|
|
3453
|
+
}), " ", words2.import)), packages === undefined ? /* @__PURE__ */ React.createElement(Loading, {
|
|
3454
|
+
compact: true
|
|
3455
|
+
}) : groups.mine.length === 0 ? /* @__PURE__ */ React.createElement(Empty, {
|
|
2516
3456
|
compact: true,
|
|
2517
|
-
title:
|
|
2518
|
-
hint:
|
|
3457
|
+
title: words2.mineEmpty,
|
|
3458
|
+
hint: words2.mineEmptyHint
|
|
2519
3459
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
2520
3460
|
type: "button",
|
|
2521
3461
|
className: "tax-button",
|
|
2522
3462
|
onClick: () => context.tab.set("market")
|
|
2523
3463
|
}, /* @__PURE__ */ React.createElement(Store, {
|
|
2524
3464
|
size: 14
|
|
2525
|
-
}), " ",
|
|
3465
|
+
}), " ", words2.browseMarket)) : /* @__PURE__ */ React.createElement("div", {
|
|
2526
3466
|
className: "tax-list"
|
|
2527
3467
|
}, groups.mine.map((pkg) => /* @__PURE__ */ React.createElement(PackageRow, {
|
|
2528
3468
|
key: pkg.id,
|
|
@@ -2534,7 +3474,7 @@ function MineView({ context }) {
|
|
|
2534
3474
|
className: "tax-section"
|
|
2535
3475
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2536
3476
|
className: "tax-section-head"
|
|
2537
|
-
}, /* @__PURE__ */ React.createElement("h2", null,
|
|
3477
|
+
}, /* @__PURE__ */ React.createElement("h2", null, words2.installed, /* @__PURE__ */ React.createElement("span", {
|
|
2538
3478
|
className: "tax-count"
|
|
2539
3479
|
}, groups.installed.length))), /* @__PURE__ */ React.createElement("div", {
|
|
2540
3480
|
className: "tax-list"
|
|
@@ -2548,13 +3488,13 @@ function MineView({ context }) {
|
|
|
2548
3488
|
className: "tax-section"
|
|
2549
3489
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2550
3490
|
className: "tax-section-head"
|
|
2551
|
-
}, /* @__PURE__ */ React.createElement("h2", null,
|
|
3491
|
+
}, /* @__PURE__ */ React.createElement("h2", null, words2.shareTitle)), /* @__PURE__ */ React.createElement(ShareSteps, {
|
|
2552
3492
|
pi,
|
|
2553
3493
|
actions
|
|
2554
3494
|
})));
|
|
2555
3495
|
}
|
|
2556
3496
|
function ShareSteps({ pi, actions }) {
|
|
2557
|
-
const
|
|
3497
|
+
const words2 = actions.words;
|
|
2558
3498
|
const steps = [icon(pi, "Download"), icon(pi, "FileArchive", "File"), icon(pi, "Upload")];
|
|
2559
3499
|
const Arrow = icon(pi, "ArrowRight");
|
|
2560
3500
|
return /* @__PURE__ */ React.createElement("div", {
|
|
@@ -2562,7 +3502,7 @@ function ShareSteps({ pi, actions }) {
|
|
|
2562
3502
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2563
3503
|
className: "tax-steps"
|
|
2564
3504
|
}, steps.map((Step, index) => /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
2565
|
-
key:
|
|
3505
|
+
key: words2.shareSteps[index]
|
|
2566
3506
|
}, index > 0 && /* @__PURE__ */ React.createElement("span", {
|
|
2567
3507
|
className: "tax-step-arrow"
|
|
2568
3508
|
}, /* @__PURE__ */ React.createElement(Arrow, {
|
|
@@ -2573,12 +3513,12 @@ function ShareSteps({ pi, actions }) {
|
|
|
2573
3513
|
className: "tax-step-icon"
|
|
2574
3514
|
}, /* @__PURE__ */ React.createElement(Step, {
|
|
2575
3515
|
size: 20
|
|
2576
|
-
})), /* @__PURE__ */ React.createElement("span", null,
|
|
3516
|
+
})), /* @__PURE__ */ React.createElement("span", null, words2.shareSteps[index]))))), /* @__PURE__ */ React.createElement("div", {
|
|
2577
3517
|
className: "tax-note"
|
|
2578
|
-
},
|
|
3518
|
+
}, words2.shareMore));
|
|
2579
3519
|
}
|
|
2580
3520
|
function PackageRow({ pi, actions, pkg, removing }) {
|
|
2581
|
-
const
|
|
3521
|
+
const words2 = actions.words;
|
|
2582
3522
|
const [switching, run] = useBusy(pi.ui);
|
|
2583
3523
|
const { touch, handheld } = pi.ui.useDevice();
|
|
2584
3524
|
const [menu, openMenu] = pi.ui.useContextMenu();
|
|
@@ -2587,17 +3527,17 @@ function PackageRow({ pi, actions, pkg, removing }) {
|
|
|
2587
3527
|
const More = icon(pi, "Ellipsis");
|
|
2588
3528
|
const title = TaPackageTextUtil.pick(pkg.title, pi.ui.language) ?? pkg.name;
|
|
2589
3529
|
const summary = TaPackageTextUtil.pick(pkg.summary, pi.ui.language) ?? pkg.description;
|
|
2590
|
-
const tags = [...pkg.resources.map((type) =>
|
|
3530
|
+
const tags = [...pkg.resources.map((type) => words2.kinds[type]), ...pkg.scope === "project" ? [words2.project] : []];
|
|
2591
3531
|
const share = () => pi.ui.shareExtension({ title, source: mine ? undefined : pkg.source, packageId: pkg.id });
|
|
2592
|
-
const remove = { key: "remove", label:
|
|
3532
|
+
const remove = { key: "remove", label: words2.remove, icon: "Trash2", danger: true, run: () => actions.remove(pkg) };
|
|
2593
3533
|
const buttons = mine ? [
|
|
2594
|
-
{ key: "change", label:
|
|
2595
|
-
{ key: "export", label:
|
|
2596
|
-
{ key: "share", label:
|
|
3534
|
+
{ key: "change", label: words2.change, icon: "Pencil", run: () => actions.change(pkg) },
|
|
3535
|
+
{ key: "export", label: words2.export, icon: "Download", run: () => actions.exportPackage(pkg) },
|
|
3536
|
+
{ key: "share", label: words2.share, icon: "QrCode", run: async () => share() },
|
|
2597
3537
|
remove
|
|
2598
3538
|
] : [
|
|
2599
|
-
{ key: "copy", label:
|
|
2600
|
-
{ key: "share", label:
|
|
3539
|
+
{ key: "copy", label: words2.copySource, icon: "Copy", run: () => actions.copySource(pkg) },
|
|
3540
|
+
{ key: "share", label: words2.share, icon: "QrCode", run: async () => share() },
|
|
2601
3541
|
remove
|
|
2602
3542
|
];
|
|
2603
3543
|
const item = (button) => ({
|
|
@@ -2616,7 +3556,7 @@ function PackageRow({ pi, actions, pkg, removing }) {
|
|
|
2616
3556
|
const SwipeRow = pi.ui.SwipeRow;
|
|
2617
3557
|
return /* @__PURE__ */ React.createElement(SwipeRow, {
|
|
2618
3558
|
className: "tax-item",
|
|
2619
|
-
actions: [{ key: "remove", label:
|
|
3559
|
+
actions: [{ key: "remove", label: words2.remove, danger: true, run: () => void remove.run() }]
|
|
2620
3560
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2621
3561
|
className: `tax-row${pkg.enabled ? "" : " tax-off"}${removing ? " ta-pending" : ""}`,
|
|
2622
3562
|
"aria-busy": removing || undefined,
|
|
@@ -2640,8 +3580,8 @@ function PackageRow({ pi, actions, pkg, removing }) {
|
|
|
2640
3580
|
}, description))), touch ? /* @__PURE__ */ React.createElement("button", {
|
|
2641
3581
|
type: "button",
|
|
2642
3582
|
className: "tax-action tax-more",
|
|
2643
|
-
title:
|
|
2644
|
-
"aria-label":
|
|
3583
|
+
title: words2.more,
|
|
3584
|
+
"aria-label": words2.more,
|
|
2645
3585
|
"aria-haspopup": "menu",
|
|
2646
3586
|
onClick: (event) => openMenu(event, items)
|
|
2647
3587
|
}, /* @__PURE__ */ React.createElement(More, {
|
|
@@ -2664,7 +3604,7 @@ function PackageRow({ pi, actions, pkg, removing }) {
|
|
|
2664
3604
|
type: "checkbox",
|
|
2665
3605
|
role: "switch",
|
|
2666
3606
|
className: `ta-switch tax-switch${switching || removing ? " ta-busy" : ""}`,
|
|
2667
|
-
"aria-label": ExtensionWords.fill(
|
|
3607
|
+
"aria-label": ExtensionWords.fill(words2.turnOn, { name: title }),
|
|
2668
3608
|
"aria-checked": pkg.enabled,
|
|
2669
3609
|
"aria-busy": switching || undefined,
|
|
2670
3610
|
checked: pkg.enabled,
|
|
@@ -2683,7 +3623,7 @@ function matches(query, ...texts) {
|
|
|
2683
3623
|
}
|
|
2684
3624
|
function registerSearches(context) {
|
|
2685
3625
|
const { pi, store, market, actions } = context;
|
|
2686
|
-
const
|
|
3626
|
+
const words2 = () => ExtensionWords.of(pi.ui.language);
|
|
2687
3627
|
const subscribe = (listener) => store.subscribe(listener);
|
|
2688
3628
|
const packages = () => store.state.packages ?? store.load().then(() => store.state.packages ?? []);
|
|
2689
3629
|
const showMarket = (name) => {
|
|
@@ -2703,7 +3643,7 @@ function registerSearches(context) {
|
|
|
2703
3643
|
return {
|
|
2704
3644
|
key: pkg.id,
|
|
2705
3645
|
title,
|
|
2706
|
-
detail: TaPackageTextUtil.pick(pkg.summary, pi.ui.language) ?? pkg.description ?? (pkg.origin === "package" ? pkg.source :
|
|
3646
|
+
detail: TaPackageTextUtil.pick(pkg.summary, pi.ui.language) ?? pkg.description ?? (pkg.origin === "package" ? pkg.source : words2().madeHere),
|
|
2707
3647
|
icon: icon(pi, pkg.icon ?? "Puzzle", "Puzzle"),
|
|
2708
3648
|
tint: pkg.name,
|
|
2709
3649
|
open: () => void openPackage(pkg),
|
|
@@ -2711,7 +3651,7 @@ function registerSearches(context) {
|
|
|
2711
3651
|
[
|
|
2712
3652
|
{
|
|
2713
3653
|
key: "share",
|
|
2714
|
-
label:
|
|
3654
|
+
label: words2().share,
|
|
2715
3655
|
icon: icon(pi, "QrCode", "Share2"),
|
|
2716
3656
|
run: () => pi.ui.shareExtension({ title, source: pkg.origin === "package" ? pkg.source : undefined, packageId: pkg.id })
|
|
2717
3657
|
}
|
|
@@ -2732,12 +3672,12 @@ function registerSearches(context) {
|
|
|
2732
3672
|
return Array.isArray(list) ? page(list) : list.then(page);
|
|
2733
3673
|
}
|
|
2734
3674
|
});
|
|
2735
|
-
pi.registerSearch(local("installed", () =>
|
|
2736
|
-
pi.registerSearch(local("builtin", () =>
|
|
3675
|
+
pi.registerSearch(local("installed", () => words2().installedTitle, 10, (pkg) => pkg.origin !== "builtin"));
|
|
3676
|
+
pi.registerSearch(local("builtin", () => words2().builtinTitle, 20, (pkg) => pkg.origin === "builtin"));
|
|
2737
3677
|
const next = new Map;
|
|
2738
3678
|
pi.registerSearch({
|
|
2739
3679
|
key: "market",
|
|
2740
|
-
title: () =>
|
|
3680
|
+
title: () => words2().tabMarket,
|
|
2741
3681
|
order: 30,
|
|
2742
3682
|
remote: true,
|
|
2743
3683
|
subscribe,
|
|
@@ -2754,7 +3694,7 @@ function registerSearches(context) {
|
|
|
2754
3694
|
next.set(trimmed, result.next);
|
|
2755
3695
|
}
|
|
2756
3696
|
const installed = new Set((store.state.packages ?? []).map((pkg) => pkg.name));
|
|
2757
|
-
const say =
|
|
3697
|
+
const say = words2();
|
|
2758
3698
|
return {
|
|
2759
3699
|
more: result.next !== undefined,
|
|
2760
3700
|
items: result.packages.map((pkg) => ({
|
|
@@ -2804,15 +3744,15 @@ function ModelSetting({ pi }) {
|
|
|
2804
3744
|
});
|
|
2805
3745
|
}
|
|
2806
3746
|
function makeSettings(pi) {
|
|
2807
|
-
const
|
|
3747
|
+
const words2 = () => ExtensionWords.of(pi.ui.language);
|
|
2808
3748
|
return {
|
|
2809
|
-
title: () =>
|
|
3749
|
+
title: () => words2().settingsTitle,
|
|
2810
3750
|
icon: icon(pi, "Sparkles", "Puzzle"),
|
|
2811
3751
|
rows: [
|
|
2812
3752
|
{
|
|
2813
3753
|
key: "model",
|
|
2814
|
-
label: () =>
|
|
2815
|
-
description: () =>
|
|
3754
|
+
label: () => words2().modelLabel,
|
|
3755
|
+
description: () => words2().modelHint,
|
|
2816
3756
|
stacked: true,
|
|
2817
3757
|
render: () => /* @__PURE__ */ React.createElement(ModelSetting, {
|
|
2818
3758
|
pi
|
|
@@ -2901,9 +3841,6 @@ button.tax-install-large { background: var(--ta-green); color: var(--ta-brand-te
|
|
|
2901
3841
|
button.tax-install-large:hover { background: var(--ta-green); filter: brightness(1.07); }
|
|
2902
3842
|
.tax-spin { display: inline-flex; animation: tax-spin 900ms linear infinite; }
|
|
2903
3843
|
@keyframes tax-spin { to { transform: rotate(360deg); } }
|
|
2904
|
-
.tax-skeleton { cursor: default; border-color: transparent; background: linear-gradient(100deg, var(--ta-hover) 40%, var(--ta-hover-strong) 50%, var(--ta-hover) 60%) 0 0 / 200% 100%; animation: tax-shimmer 1.4s linear infinite; opacity: .6; }
|
|
2905
|
-
.tax-skeleton:hover { border-color: transparent; box-shadow: none; transform: none; }
|
|
2906
|
-
@keyframes tax-shimmer { to { background-position: -200% 0; } }
|
|
2907
3844
|
.tax-more { padding: 6px 0 2px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); text-align: center; }
|
|
2908
3845
|
.tax-market-error { display: flex; flex-direction: column; align-items: center; gap: 8px; }
|
|
2909
3846
|
.tax-market-error strong { color: var(--ta-text); font-weight: 600; }
|
|
@@ -2928,11 +3865,6 @@ button.tax-install-large:hover { background: var(--ta-green); filter: brightness
|
|
|
2928
3865
|
.tax-preview { display: block; width: 100%; max-height: 380px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: var(--ta-raised); object-fit: contain; }
|
|
2929
3866
|
.tax-readme { padding-top: 20px; border-top: 1px solid var(--ta-border-muted); font-size: calc(14px * var(--ta-font-scale)); min-width: 0; overflow-wrap: anywhere; }
|
|
2930
3867
|
.tax-readme img { max-width: 100%; height: auto; }
|
|
2931
|
-
.tax-readme-loading { display: flex; flex-direction: column; gap: 12px; }
|
|
2932
|
-
.tax-readme-loading span { height: 12px; border-radius: 6px; background: linear-gradient(100deg, var(--ta-hover) 40%, var(--ta-hover-strong) 50%, var(--ta-hover) 60%) 0 0 / 200% 100%; animation: tax-shimmer 1.4s linear infinite; }
|
|
2933
|
-
.tax-readme-loading span:nth-child(1) { width: 92%; }
|
|
2934
|
-
.tax-readme-loading span:nth-child(2) { width: 78%; }
|
|
2935
|
-
.tax-readme-loading span:nth-child(3) { width: 85%; }
|
|
2936
3868
|
@media (max-width: 640px) {
|
|
2937
3869
|
.tax-detail-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 14px; }
|
|
2938
3870
|
.tax-detail-title { display: contents; }
|
|
@@ -2946,7 +3878,7 @@ button.tax-install-large:hover { background: var(--ta-green); filter: brightness
|
|
|
2946
3878
|
// web-src/style.ts
|
|
2947
3879
|
var STYLE = `
|
|
2948
3880
|
.tax-page { --tax-accent: var(--ta-green); position: relative; height: 100%; overflow: auto; color: var(--ta-text); font-size: calc(13.5px * var(--ta-font-scale)); }
|
|
2949
|
-
.tax-body { display: flex; flex-direction: column; gap: 32px; max-width:
|
|
3881
|
+
.tax-body { display: flex; flex-direction: column; gap: 32px; max-width: var(--ta-page-wide); margin: 0 auto; padding: 28px 24px 56px; box-sizing: border-box; }
|
|
2950
3882
|
.tax-hero { display: flex; flex-direction: column; gap: 10px; }
|
|
2951
3883
|
.tax-hero h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: calc(20px * var(--ta-font-scale)); font-weight: 600; letter-spacing: -0.01em; }
|
|
2952
3884
|
.tax-hero h1 svg { color: var(--tax-accent); }
|
|
@@ -3044,11 +3976,11 @@ function activate(pi) {
|
|
|
3044
3976
|
context
|
|
3045
3977
|
}),
|
|
3046
3978
|
menu: () => {
|
|
3047
|
-
const
|
|
3979
|
+
const words2 = ExtensionWords.of(pi.ui.language);
|
|
3048
3980
|
return [
|
|
3049
3981
|
[
|
|
3050
|
-
{ key: "market", label:
|
|
3051
|
-
{ key: "import", label:
|
|
3982
|
+
{ key: "market", label: words2.tabMarket, icon: icons.Store ?? icons.PackageOpen, run: () => context.tab.set("market") },
|
|
3983
|
+
{ key: "import", label: words2.import, icon: icons.Upload, run: () => context.importing.set(true) }
|
|
3052
3984
|
]
|
|
3053
3985
|
];
|
|
3054
3986
|
},
|