@celljs/ta-channels 4.13.1 → 4.15.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/extension/index.mjs +78 -13
- package/host/index.mjs +291 -190
- package/package.json +12 -8
- package/web/index.js +483 -47
package/extension/index.mjs
CHANGED
|
@@ -698,6 +698,45 @@ var NoticeUtil;
|
|
|
698
698
|
NoticeUtil.firstLine = firstLine;
|
|
699
699
|
})(NoticeUtil ||= {});
|
|
700
700
|
|
|
701
|
+
// ../ta-protocol/esm/common/language.js
|
|
702
|
+
var TaLanguageUtil;
|
|
703
|
+
(function(TaLanguageUtil2) {
|
|
704
|
+
TaLanguageUtil2.ALL = ["zh-CN", "zh-TW", "en-US", "ja-JP"];
|
|
705
|
+
TaLanguageUtil2.NAMES = { "zh-CN": "简体中文", "zh-TW": "繁體中文", "en-US": "English", "ja-JP": "日本語" };
|
|
706
|
+
function of(tag) {
|
|
707
|
+
const said = (tag !== null && tag !== undefined ? tag : "").toLowerCase().replace(/_/g, "-");
|
|
708
|
+
if (/^zh(\b|-)/.test(said)) {
|
|
709
|
+
return /-hant\b/.test(said) || !/-hans\b/.test(said) && /-(tw|hk|mo)\b/.test(said) ? "zh-TW" : "zh-CN";
|
|
710
|
+
}
|
|
711
|
+
return /^ja(\b|-)/.test(said) ? "ja-JP" : "en-US";
|
|
712
|
+
}
|
|
713
|
+
TaLanguageUtil2.of = of;
|
|
714
|
+
function server(env = typeof process === "undefined" ? {} : process.env) {
|
|
715
|
+
return of(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG);
|
|
716
|
+
}
|
|
717
|
+
TaLanguageUtil2.server = server;
|
|
718
|
+
function pick(language, words) {
|
|
719
|
+
return words[of(language)];
|
|
720
|
+
}
|
|
721
|
+
TaLanguageUtil2.pick = pick;
|
|
722
|
+
function say(words) {
|
|
723
|
+
return words[server()];
|
|
724
|
+
}
|
|
725
|
+
TaLanguageUtil2.say = say;
|
|
726
|
+
function chinese(language) {
|
|
727
|
+
return of(language).startsWith("zh");
|
|
728
|
+
}
|
|
729
|
+
TaLanguageUtil2.chinese = chinese;
|
|
730
|
+
function cjk(language) {
|
|
731
|
+
return of(language) !== "en-US";
|
|
732
|
+
}
|
|
733
|
+
TaLanguageUtil2.cjk = cjk;
|
|
734
|
+
function list(language, items) {
|
|
735
|
+
return items.join(cjk(language) ? "、" : ", ");
|
|
736
|
+
}
|
|
737
|
+
TaLanguageUtil2.list = list;
|
|
738
|
+
})(TaLanguageUtil || (TaLanguageUtil = {}));
|
|
739
|
+
|
|
701
740
|
// web-src/handoff.ts
|
|
702
741
|
var HandOff;
|
|
703
742
|
((HandOff) => {
|
|
@@ -737,7 +776,12 @@ var HandOff;
|
|
|
737
776
|
`- When the conversation holds nothing to hand over yet, say so and ask what ${to} should do.`
|
|
738
777
|
].join(`
|
|
739
778
|
`);
|
|
740
|
-
const line = language
|
|
779
|
+
const line = TaLanguageUtil.pick(language, {
|
|
780
|
+
"zh-CN": `把这件事交给 ${to}`,
|
|
781
|
+
"zh-TW": `把這件事交給 ${to}`,
|
|
782
|
+
"en-US": `Hand this over to ${to}`,
|
|
783
|
+
"ja-JP": `これを ${to} に引き継ぐ`
|
|
784
|
+
});
|
|
741
785
|
return `<context>
|
|
742
786
|
${context}
|
|
743
787
|
</context>
|
|
@@ -767,8 +811,13 @@ ${line}`;
|
|
|
767
811
|
}
|
|
768
812
|
HandOff.find = find;
|
|
769
813
|
function message(origin, brief, language) {
|
|
770
|
-
const title = origin.title?.trim() || (language
|
|
771
|
-
const head = language
|
|
814
|
+
const title = origin.title?.trim() || TaLanguageUtil.pick(language, { "zh-CN": "一个对话", "zh-TW": "一個對話", "en-US": "a conversation", "ja-JP": "ある会話" });
|
|
815
|
+
const head = TaLanguageUtil.pick(language, {
|
|
816
|
+
"zh-CN": `(交接自“${title}”)`,
|
|
817
|
+
"zh-TW": `(交接自「${title}」)`,
|
|
818
|
+
"en-US": `(Handed over from “${title}”)`,
|
|
819
|
+
"ja-JP": `(“${title}” から引き継ぎました)`
|
|
820
|
+
});
|
|
772
821
|
const context = [
|
|
773
822
|
"The user handed you this work from another conversation of theirs, which you do not see; the brief below is all it says. Go on from there in this conversation, which the user follows; ask them when the brief leaves out something you need.",
|
|
774
823
|
origin.sessionFile ? `That conversation is pi's session file ${origin.sessionFile}${origin.cwd ? `, working in ${origin.cwd}` : ""}: read it only when the brief is not enough.` : ""
|
|
@@ -783,14 +832,19 @@ ${brief.trim()}`;
|
|
|
783
832
|
}
|
|
784
833
|
HandOff.message = message;
|
|
785
834
|
function channelText(origin, brief, language) {
|
|
786
|
-
const title = origin.title?.trim() || (language
|
|
787
|
-
return `${language
|
|
835
|
+
const title = origin.title?.trim() || TaLanguageUtil.pick(language, { "zh-CN": "一个对话", "zh-TW": "一個對話", "en-US": "a conversation", "ja-JP": "ある会話" });
|
|
836
|
+
return `${TaLanguageUtil.pick(language, {
|
|
837
|
+
"zh-CN": `(交接自“${title}”)`,
|
|
838
|
+
"zh-TW": `(交接自「${title}」)`,
|
|
839
|
+
"en-US": `(Handed over from “${title}”)`,
|
|
840
|
+
"ja-JP": `(“${title}” から引き継ぎました)`
|
|
841
|
+
})}
|
|
788
842
|
|
|
789
843
|
${brief.trim()}`;
|
|
790
844
|
}
|
|
791
845
|
HandOff.channelText = channelText;
|
|
792
846
|
function serverLanguage(env = typeof process === "undefined" ? {} : process.env) {
|
|
793
|
-
return
|
|
847
|
+
return TaLanguageUtil.of(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG || "");
|
|
794
848
|
}
|
|
795
849
|
HandOff.serverLanguage = serverLanguage;
|
|
796
850
|
function result(target) {
|
|
@@ -853,15 +907,25 @@ var MemberTools;
|
|
|
853
907
|
|
|
854
908
|
// web-src/team-ask.ts
|
|
855
909
|
var WORDS = {
|
|
856
|
-
|
|
910
|
+
"zh-CN": {
|
|
911
|
+
build: "组建团队 #{channel}?",
|
|
912
|
+
post: "把工作交给 #{channel}?",
|
|
913
|
+
new: "(新建)"
|
|
914
|
+
},
|
|
915
|
+
"zh-TW": {
|
|
916
|
+
build: "組建團隊 #{channel}?",
|
|
917
|
+
post: "把工作交給 #{channel}?",
|
|
918
|
+
new: "(新建)"
|
|
919
|
+
},
|
|
920
|
+
"en-US": {
|
|
857
921
|
build: "Build the team #{channel}?",
|
|
858
922
|
post: "Hand work to #{channel}?",
|
|
859
923
|
new: "(new)"
|
|
860
924
|
},
|
|
861
|
-
|
|
862
|
-
build: "
|
|
863
|
-
post: "
|
|
864
|
-
new: "
|
|
925
|
+
"ja-JP": {
|
|
926
|
+
build: "チーム #{channel} を構築しますか?",
|
|
927
|
+
post: "作業を #{channel} に引き継ぎますか?",
|
|
928
|
+
new: "(新規)"
|
|
865
929
|
}
|
|
866
930
|
};
|
|
867
931
|
var ROLE_CHARS = 90;
|
|
@@ -870,11 +934,12 @@ var TeamAsk;
|
|
|
870
934
|
((TeamAsk) => {
|
|
871
935
|
TeamAsk.REFUSED = "The user did not let this start. Ask them what they want instead; do not try it again unasked.";
|
|
872
936
|
function language(env = process.env) {
|
|
873
|
-
return
|
|
937
|
+
return TaLanguageUtil.of(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG || "");
|
|
874
938
|
}
|
|
875
939
|
TeamAsk.language = language;
|
|
876
940
|
function question(tool, params, team, allowed, env = process.env) {
|
|
877
|
-
const
|
|
941
|
+
const lang = language(env);
|
|
942
|
+
const w = WORDS[lang];
|
|
878
943
|
if (tool === "create_channel") {
|
|
879
944
|
const names = Array.isArray(params.members) ? params.members.map(String) : [];
|
|
880
945
|
const lines = names.map((name) => {
|