@celljs/ta-workspace 4.17.0 → 4.19.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 +3 -3
- package/web/index.js +475 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-workspace",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.19.0",
|
|
4
4
|
"description": "A pi package for Ta: the workspace beside the conversation, with an explorer, open files, search, source control, terminals and a browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@celljs/ta-protocol": "4.
|
|
29
|
-
"@celljs/ta-web": "4.
|
|
28
|
+
"@celljs/ta-protocol": "4.19.0",
|
|
29
|
+
"@celljs/ta-web": "4.19.0",
|
|
30
30
|
"@types/react": "^19.3.0",
|
|
31
31
|
"marked": "^14.1.4"
|
|
32
32
|
},
|
package/web/index.js
CHANGED
|
@@ -146,6 +146,12 @@ function Empty(props) {
|
|
|
146
146
|
...props
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
+
function Loading(props) {
|
|
150
|
+
const Shown = pi.ui.Loading ?? pi.ui.Skeleton;
|
|
151
|
+
return /* @__PURE__ */ React.createElement(Shown, {
|
|
152
|
+
...props
|
|
153
|
+
});
|
|
154
|
+
}
|
|
149
155
|
function Glyph({ name, size = 15 }) {
|
|
150
156
|
const Icon = Host.icon(name);
|
|
151
157
|
return /* @__PURE__ */ React.createElement(Icon, {
|
|
@@ -1870,7 +1876,7 @@ function BrowserBar(props) {
|
|
|
1870
1876
|
disabled: !props.onOpenOutside,
|
|
1871
1877
|
onClick: () => props.onOpenOutside?.()
|
|
1872
1878
|
}), loading ? /* @__PURE__ */ React.createElement("span", {
|
|
1873
|
-
className: "taw-browser-
|
|
1879
|
+
className: "taw-browser-progress"
|
|
1874
1880
|
}) : undefined);
|
|
1875
1881
|
}
|
|
1876
1882
|
function Site({ address, onOpen, onRemove }) {
|
|
@@ -2569,9 +2575,9 @@ function ImportDialog({ data, onClose, onChanged }) {
|
|
|
2569
2575
|
} else {
|
|
2570
2576
|
body = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
|
|
2571
2577
|
className: "taw-import-hint"
|
|
2572
|
-
}, t("importHint")), profiles === undefined && !error ? /* @__PURE__ */ React.createElement(
|
|
2573
|
-
|
|
2574
|
-
}
|
|
2578
|
+
}, t("importHint")), profiles === undefined && !error ? /* @__PURE__ */ React.createElement(Loading, {
|
|
2579
|
+
compact: true
|
|
2580
|
+
}) : undefined, profiles?.length === 0 ? /* @__PURE__ */ React.createElement("p", {
|
|
2575
2581
|
className: "taw-import-hint"
|
|
2576
2582
|
}, t("noProfiles")) : undefined, profiles && profiles.length > 0 ? /* @__PURE__ */ React.createElement("div", {
|
|
2577
2583
|
className: "taw-import-profiles",
|
|
@@ -6410,6 +6416,10 @@ function MediaPreview({
|
|
|
6410
6416
|
|
|
6411
6417
|
// ../ta-protocol/esm/common/access-protocol.js
|
|
6412
6418
|
var TaAccessServer = Symbol("TaAccessServer");
|
|
6419
|
+
var TA_SIGN_IN_PATH = "/sign-in";
|
|
6420
|
+
var TA_DEVICE_SIGN_IN_PATH = `${TA_SIGN_IN_PATH}/device`;
|
|
6421
|
+
// ../ta-protocol/esm/common/account-protocol.js
|
|
6422
|
+
var TaAccountServer = Symbol("TaAccountServer");
|
|
6413
6423
|
// ../ta-protocol/esm/common/ta-extension-host.js
|
|
6414
6424
|
var TA_WEBHOOK_MAX_BYTES = 256 * 1024;
|
|
6415
6425
|
var TA_HOST_EVENT = "ta:host";
|
|
@@ -6669,6 +6679,20 @@ var TA_WEB_SETTINGS = [
|
|
|
6669
6679
|
title: words("Model of tasks", "任务的模型", "任務的模型", "タスクのモデル")
|
|
6670
6680
|
},
|
|
6671
6681
|
{ key: "reduceMotion", type: "boolean", default: false, what: "Fewer animations.", title: words("Reduce motion", "减少动画", "減少動畫", "動きを減らす") },
|
|
6682
|
+
{
|
|
6683
|
+
key: "diagramStyle",
|
|
6684
|
+
type: "enum",
|
|
6685
|
+
values: ["clean", "sketch", "colour", "motion"],
|
|
6686
|
+
default: "clean",
|
|
6687
|
+
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.",
|
|
6688
|
+
title: words("Diagram style", "图表风格", "圖表風格", "図のスタイル"),
|
|
6689
|
+
shown: {
|
|
6690
|
+
clean: words("clean", "简洁", "簡潔", "シンプル"),
|
|
6691
|
+
sketch: words("sketch", "草图", "草圖", "スケッチ"),
|
|
6692
|
+
colour: words("colour", "彩色", "彩色", "カラー"),
|
|
6693
|
+
motion: words("motion", "动效", "動效", "モーション")
|
|
6694
|
+
}
|
|
6695
|
+
},
|
|
6672
6696
|
{
|
|
6673
6697
|
key: "keepAliveMinutes",
|
|
6674
6698
|
type: "number",
|
|
@@ -6843,9 +6867,44 @@ var TaDeploymentUtil;
|
|
|
6843
6867
|
}
|
|
6844
6868
|
result.updates = { ...base ? { base } : {}, ...key ? { key } : {} };
|
|
6845
6869
|
}
|
|
6870
|
+
if (given.reach !== undefined) {
|
|
6871
|
+
result.reach = reach(given.reach);
|
|
6872
|
+
}
|
|
6873
|
+
if (given.inside !== undefined) {
|
|
6874
|
+
const inside = url(given.inside);
|
|
6875
|
+
if (!inside) {
|
|
6876
|
+
throw new TaDeploymentError(`"inside" of ${TaDeploymentUtil2.DISTRIBUTION_FILE} is not an address of http or https.`);
|
|
6877
|
+
}
|
|
6878
|
+
result.inside = inside;
|
|
6879
|
+
}
|
|
6846
6880
|
return result;
|
|
6847
6881
|
}
|
|
6848
6882
|
TaDeploymentUtil2.distribution = distribution;
|
|
6883
|
+
function reach(value) {
|
|
6884
|
+
const given = typeof value === "string" ? { "*": value } : value;
|
|
6885
|
+
const entries = given && typeof given === "object" && !Array.isArray(given) ? Object.entries(given) : [];
|
|
6886
|
+
const result = {};
|
|
6887
|
+
for (const [language, text2] of entries) {
|
|
6888
|
+
if (typeof text2 !== "string" || !text2.trim()) {
|
|
6889
|
+
throw new TaDeploymentError(`"reach.${language}" of ${TaDeploymentUtil2.DISTRIBUTION_FILE} is not a sentence.`);
|
|
6890
|
+
}
|
|
6891
|
+
result[language] = text2.trim().slice(0, 200);
|
|
6892
|
+
}
|
|
6893
|
+
if (Object.keys(result).length === 0) {
|
|
6894
|
+
throw new TaDeploymentError(`"reach" of ${TaDeploymentUtil2.DISTRIBUTION_FILE} is a sentence, or one by language.`);
|
|
6895
|
+
}
|
|
6896
|
+
return result;
|
|
6897
|
+
}
|
|
6898
|
+
function reachIn(reach2, language) {
|
|
6899
|
+
var _a, _b, _c, _d, _e;
|
|
6900
|
+
if (!reach2) {
|
|
6901
|
+
return;
|
|
6902
|
+
}
|
|
6903
|
+
const base = language.split("-")[0];
|
|
6904
|
+
const near = Object.keys(reach2).find((key) => key.split("-")[0] === base);
|
|
6905
|
+
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];
|
|
6906
|
+
}
|
|
6907
|
+
TaDeploymentUtil2.reachIn = reachIn;
|
|
6849
6908
|
function apply(distribution2, env) {
|
|
6850
6909
|
const defaults = { TA_DEPLOYMENT_NAME: distribution2.name, TA_RELAY_URL: distribution2.relay, TA_GATEWAY_URL: distribution2.gateway };
|
|
6851
6910
|
for (const [key, value] of Object.entries(defaults)) {
|
|
@@ -7094,23 +7153,47 @@ ${message}`;
|
|
|
7094
7153
|
var TaMessageSource;
|
|
7095
7154
|
(function(TaMessageSource2) {
|
|
7096
7155
|
TaMessageSource2.DOUBLE = "ta:double";
|
|
7097
|
-
const LINE = /^\[ta:from ([^\s\]]+)(?: ([^\]\n]+))?\]$/m;
|
|
7156
|
+
const LINE = /^\[ta:(from|notice) ([^\s\]]+)(?: ([^\]\n]+))?\]$/m;
|
|
7098
7157
|
function mark(message, from, detail) {
|
|
7099
|
-
|
|
7100
|
-
return message;
|
|
7101
|
-
}
|
|
7102
|
-
const line = `[ta:from ${from}${detail ? ` ${detail.replace(/[\]\n]/g, " ")}` : ""}]`;
|
|
7103
|
-
const context = TaMessageContext.read(message);
|
|
7104
|
-
return TaMessageContext.wrap(context === undefined ? line : `${context}
|
|
7105
|
-
${line}`, TaMessageContext.strip(message));
|
|
7158
|
+
return marked2(message, line(from, detail));
|
|
7106
7159
|
}
|
|
7107
7160
|
TaMessageSource2.mark = mark;
|
|
7161
|
+
function notice(message, from, detail) {
|
|
7162
|
+
return marked2(message, line(from, detail, true));
|
|
7163
|
+
}
|
|
7164
|
+
TaMessageSource2.notice = notice;
|
|
7165
|
+
function line(from, detail, notice2 = false) {
|
|
7166
|
+
return `[ta:${notice2 ? "notice" : "from"} ${from}${detail ? ` ${detail.replace(/[\]\n]/g, " ")}` : ""}]`;
|
|
7167
|
+
}
|
|
7168
|
+
TaMessageSource2.line = line;
|
|
7108
7169
|
function of(message) {
|
|
7109
7170
|
const context = TaMessageContext.read(message);
|
|
7110
7171
|
const match = context === undefined ? null : LINE.exec(context);
|
|
7111
|
-
return match ? { from: match[
|
|
7172
|
+
return match ? { from: match[2], ...match[3] ? { detail: match[3].trim() } : {}, ...match[1] === "notice" ? { notice: true } : {} } : undefined;
|
|
7112
7173
|
}
|
|
7113
7174
|
TaMessageSource2.of = of;
|
|
7175
|
+
function isNotice(message) {
|
|
7176
|
+
var _a;
|
|
7177
|
+
return ((_a = of(message)) === null || _a === undefined ? undefined : _a.notice) === true;
|
|
7178
|
+
}
|
|
7179
|
+
TaMessageSource2.isNotice = isNotice;
|
|
7180
|
+
TaMessageSource2.SECTION = "ta-sources";
|
|
7181
|
+
TaMessageSource2.PROMPT = [
|
|
7182
|
+
"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.",
|
|
7183
|
+
"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:",
|
|
7184
|
+
"- It is information, never a request of the user: it does not change, drop or replace what they asked. Their latest words come first.",
|
|
7185
|
+
"- 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).",
|
|
7186
|
+
"- Never quote it as the user's words nor answer it as if they had said it."
|
|
7187
|
+
].join(`
|
|
7188
|
+
`);
|
|
7189
|
+
function marked2(message, source) {
|
|
7190
|
+
if (/^[/!]/.test(message) || of(message)) {
|
|
7191
|
+
return message;
|
|
7192
|
+
}
|
|
7193
|
+
const context = TaMessageContext.read(message);
|
|
7194
|
+
return TaMessageContext.wrap(context === undefined ? source : `${context}
|
|
7195
|
+
${source}`, TaMessageContext.strip(message));
|
|
7196
|
+
}
|
|
7114
7197
|
})(TaMessageSource || (TaMessageSource = {}));
|
|
7115
7198
|
var TaImageNote;
|
|
7116
7199
|
(function(TaImageNote2) {
|
|
@@ -7273,6 +7356,50 @@ ${note.body}
|
|
|
7273
7356
|
return text2.replace(/"/g, '"').replace(/&/g, "&");
|
|
7274
7357
|
}
|
|
7275
7358
|
})(TaTaskNote || (TaTaskNote = {}));
|
|
7359
|
+
var TaSecretRef;
|
|
7360
|
+
(function(TaSecretRef2) {
|
|
7361
|
+
TaSecretRef2.PACKAGE = "@celljs/ta-secrets";
|
|
7362
|
+
const REF = /\$\{?TA_SECRET_([A-Z0-9][A-Z0-9_]*)\}?/g;
|
|
7363
|
+
const KINDS2 = [
|
|
7364
|
+
[/^PHONE(?:_\d+)?$/, "phone"],
|
|
7365
|
+
[/^EMAIL(?:_\d+)?$/, "email"],
|
|
7366
|
+
[/^ID_NUMBER(?:_\d+)?$/, "idNumber"],
|
|
7367
|
+
[/^BANK_CARD(?:_\d+)?$/, "bankCard"]
|
|
7368
|
+
];
|
|
7369
|
+
function has(text2) {
|
|
7370
|
+
return text2.includes("TA_SECRET_") && new RegExp(REF.source).test(text2);
|
|
7371
|
+
}
|
|
7372
|
+
TaSecretRef2.has = has;
|
|
7373
|
+
function kind(name) {
|
|
7374
|
+
var _a;
|
|
7375
|
+
var _b;
|
|
7376
|
+
return (_b = (_a = KINDS2.find(([pattern]) => pattern.test(name))) === null || _a === undefined ? undefined : _a[1]) !== null && _b !== undefined ? _b : "secret";
|
|
7377
|
+
}
|
|
7378
|
+
TaSecretRef2.kind = kind;
|
|
7379
|
+
function split(text2) {
|
|
7380
|
+
if (!has(text2)) {
|
|
7381
|
+
return [{ text: text2 }];
|
|
7382
|
+
}
|
|
7383
|
+
const parts = [];
|
|
7384
|
+
let at2 = 0;
|
|
7385
|
+
for (const match of text2.matchAll(REF)) {
|
|
7386
|
+
if (match.index > at2) {
|
|
7387
|
+
parts.push({ text: text2.slice(at2, match.index) });
|
|
7388
|
+
}
|
|
7389
|
+
parts.push({ secret: match[1], kind: kind(match[1]) });
|
|
7390
|
+
at2 = match.index + match[0].length;
|
|
7391
|
+
}
|
|
7392
|
+
if (at2 < text2.length) {
|
|
7393
|
+
parts.push({ text: text2.slice(at2) });
|
|
7394
|
+
}
|
|
7395
|
+
return parts;
|
|
7396
|
+
}
|
|
7397
|
+
TaSecretRef2.split = split;
|
|
7398
|
+
function plain(text2, label2) {
|
|
7399
|
+
return has(text2) ? text2.replace(REF, (_whole, name) => label2(name, kind(name))) : text2;
|
|
7400
|
+
}
|
|
7401
|
+
TaSecretRef2.plain = plain;
|
|
7402
|
+
})(TaSecretRef || (TaSecretRef = {}));
|
|
7276
7403
|
// ../ta-protocol/esm/common/package-protocol.js
|
|
7277
7404
|
var TaPackageServer = Symbol("TaPackageServer");
|
|
7278
7405
|
var TaPackageTextUtil;
|
|
@@ -7469,6 +7596,267 @@ var TaRoomWatchUtil;
|
|
|
7469
7596
|
}
|
|
7470
7597
|
TaRoomWatchUtil2.hears = hears;
|
|
7471
7598
|
})(TaRoomWatchUtil || (TaRoomWatchUtil = {}));
|
|
7599
|
+
// ../ta-protocol/esm/common/said-protocol.js
|
|
7600
|
+
var TaSaid;
|
|
7601
|
+
(function(TaSaid2) {
|
|
7602
|
+
const CARD = /^ta-/i;
|
|
7603
|
+
const READ = 4000;
|
|
7604
|
+
const FENCE = /^\s*(`{3,}|~{3,})\s*([^\s`]*)/;
|
|
7605
|
+
const TAG_LINE = /^<\/?[A-Za-z][\w:.-]*(?:\s[^<>]*)?\/?>$/;
|
|
7606
|
+
const MARKS_ONLY = /^[-*_=|:+\s]+$/;
|
|
7607
|
+
const MARKS = [
|
|
7608
|
+
["context", /<\/?context>/],
|
|
7609
|
+
["source", /\[ta:(?:from|notice|by) /],
|
|
7610
|
+
["image note", /\[Image: original \d+x\d+|\[Image converted from /],
|
|
7611
|
+
["skill", /<skill name="|<\/skill>/],
|
|
7612
|
+
["task note", /<\/?task_(?:update|adopted|renamed)\b/],
|
|
7613
|
+
["summary", /<\/?(?:conversation_history_summary|summary)>/]
|
|
7614
|
+
];
|
|
7615
|
+
function text2(content, joiner = `
|
|
7616
|
+
`) {
|
|
7617
|
+
if (typeof content === "string") {
|
|
7618
|
+
return content;
|
|
7619
|
+
}
|
|
7620
|
+
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) : "";
|
|
7621
|
+
}
|
|
7622
|
+
TaSaid2.text = text2;
|
|
7623
|
+
function words2(role, text3, options2 = {}) {
|
|
7624
|
+
const said = role === "user" ? userWords(text3) : TaAgentSummary.strip(text3);
|
|
7625
|
+
return withoutFences(said, (language) => options2.cards === false && CARD.test(language), true).trim();
|
|
7626
|
+
}
|
|
7627
|
+
TaSaid2.words = words2;
|
|
7628
|
+
function of(message, options2) {
|
|
7629
|
+
return message ? words2(message.role, text2(message.content), options2) : "";
|
|
7630
|
+
}
|
|
7631
|
+
TaSaid2.of = of;
|
|
7632
|
+
function notice(message) {
|
|
7633
|
+
return (message === null || message === undefined ? undefined : message.role) === "user" && TaMessageSource.isNotice(text2(message.content));
|
|
7634
|
+
}
|
|
7635
|
+
TaSaid2.notice = notice;
|
|
7636
|
+
function marksOnly(role, text3) {
|
|
7637
|
+
return !!text3.trim() && !line(words2(role, text3), { chars: Number.POSITIVE_INFINITY });
|
|
7638
|
+
}
|
|
7639
|
+
TaSaid2.marksOnly = marksOnly;
|
|
7640
|
+
function line(markdown, options2) {
|
|
7641
|
+
var _a;
|
|
7642
|
+
const read = markdown.slice(0, READ);
|
|
7643
|
+
const prose = withoutFences(read, () => true, true).trim();
|
|
7644
|
+
const lines = plain(prose || codeOf(read)).split(`
|
|
7645
|
+
`).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));
|
|
7646
|
+
const count = (_a = options2.lines) !== null && _a !== undefined ? _a : 1;
|
|
7647
|
+
const joined = count <= 1 ? lines.join(" ") : lines.slice(0, count).join(`
|
|
7648
|
+
`);
|
|
7649
|
+
return joined.length > options2.chars ? `${joined.slice(0, Math.max(0, options2.chars - 1)).trimEnd()}…` : joined;
|
|
7650
|
+
}
|
|
7651
|
+
TaSaid2.line = line;
|
|
7652
|
+
function leaks(shown, options2 = {}) {
|
|
7653
|
+
const found = MARKS.filter(([, mark]) => mark.test(shown)).map(([name]) => name);
|
|
7654
|
+
const lines = shown.split(`
|
|
7655
|
+
`);
|
|
7656
|
+
if (options2.cards !== true && lines.some((part) => {
|
|
7657
|
+
var _a;
|
|
7658
|
+
var _b;
|
|
7659
|
+
return CARD.test((_b = (_a = FENCE.exec(part)) === null || _a === undefined ? undefined : _a[2]) !== null && _b !== undefined ? _b : "");
|
|
7660
|
+
})) {
|
|
7661
|
+
found.push("card");
|
|
7662
|
+
}
|
|
7663
|
+
if (lines.some((part) => TAG_LINE.test(part.trim()))) {
|
|
7664
|
+
found.push("tag");
|
|
7665
|
+
}
|
|
7666
|
+
return found;
|
|
7667
|
+
}
|
|
7668
|
+
TaSaid2.leaks = leaks;
|
|
7669
|
+
const SUMMARY = `<conversation_history_summary>
|
|
7670
|
+
<summary>
|
|
7671
|
+
1. Primary Request and Intent:
|
|
7672
|
+
The user works on the relay.
|
|
7673
|
+
</summary>
|
|
7674
|
+
</conversation_history_summary>`;
|
|
7675
|
+
TaSaid2.SAMPLES = [
|
|
7676
|
+
{
|
|
7677
|
+
mark: "context and where it came from",
|
|
7678
|
+
role: "user",
|
|
7679
|
+
text: `<context>
|
|
7680
|
+
The channel #ops, its members.
|
|
7681
|
+
[ta:from @celljs/ta-channels #ops]
|
|
7682
|
+
</context>
|
|
7683
|
+
Check the build`,
|
|
7684
|
+
said: "Check the build"
|
|
7685
|
+
},
|
|
7686
|
+
{
|
|
7687
|
+
mark: "a notice, not the user",
|
|
7688
|
+
role: "user",
|
|
7689
|
+
text: `<context>
|
|
7690
|
+
[ta:notice @celljs/ta-call]
|
|
7691
|
+
</context>
|
|
7692
|
+
The work finished. Its last words: tests pass.`,
|
|
7693
|
+
said: "The work finished. Its last words: tests pass."
|
|
7694
|
+
},
|
|
7695
|
+
{ mark: "one let in", role: "user", text: `<context>
|
|
7696
|
+
[ta:by p-7 Alice]
|
|
7697
|
+
</context>
|
|
7698
|
+
Hello there`, said: "Hello there" },
|
|
7699
|
+
{
|
|
7700
|
+
mark: "notes of images",
|
|
7701
|
+
role: "user",
|
|
7702
|
+
text: `Look at this
|
|
7703
|
+
[Image: original 3024x4032, displayed at 1512x2016. Multiply coordinates by 2.00 to map to original image.]
|
|
7704
|
+
[Image converted from image/heic to image/png.]`,
|
|
7705
|
+
said: "Look at this"
|
|
7706
|
+
},
|
|
7707
|
+
{
|
|
7708
|
+
mark: "a skill run",
|
|
7709
|
+
role: "user",
|
|
7710
|
+
text: `<skill name="ta-package" location="/skills/ta-package/SKILL.md">
|
|
7711
|
+
# Ta package
|
|
7712
|
+
Steps.
|
|
7713
|
+
</skill>
|
|
7714
|
+
|
|
7715
|
+
Make a card`,
|
|
7716
|
+
said: "Make a card"
|
|
7717
|
+
},
|
|
7718
|
+
{
|
|
7719
|
+
mark: "a note of a task",
|
|
7720
|
+
role: "user",
|
|
7721
|
+
text: `<task_update id="t1" title="Fix login" status="done">
|
|
7722
|
+
All tests pass.
|
|
7723
|
+
</task_update>`,
|
|
7724
|
+
said: "Fix login"
|
|
7725
|
+
},
|
|
7726
|
+
{ mark: "a note of a new id", role: "user", text: `<task_renamed id="t2" was="t1" title="Fix login">
|
|
7727
|
+
Now t2.
|
|
7728
|
+
</task_renamed>` },
|
|
7729
|
+
{ mark: "a summary, then the answer", role: "assistant", text: `${SUMMARY}
|
|
7730
|
+
Switched to voice.`, said: "Switched to voice." },
|
|
7731
|
+
{ mark: "a summary alone", role: "assistant", text: SUMMARY },
|
|
7732
|
+
{ mark: "a summary as it streams", role: "assistant", text: `<conversation_history_summary>
|
|
7733
|
+
<summary>` },
|
|
7734
|
+
{
|
|
7735
|
+
mark: "a card after the answer",
|
|
7736
|
+
role: "assistant",
|
|
7737
|
+
text: '**Done**: tests pass.\n\n```ta-glance\n{"status":"done","blocks":[]}\n```',
|
|
7738
|
+
said: "tests pass"
|
|
7739
|
+
},
|
|
7740
|
+
{ mark: "a card alone", role: "assistant", text: '```ta-glance\n{"status":"done","blocks":[]}\n```' },
|
|
7741
|
+
{ mark: "a proposal", role: "assistant", text: 'Committed.\n\n```ta-propose\n{"kind":"git.push","title":"Push"}\n```', said: "Committed." },
|
|
7742
|
+
{ mark: "what a call says aloud", role: "assistant", text: "All fixed.\n\n```ta-say\nIt is fixed.\n```", said: "All fixed." },
|
|
7743
|
+
{ mark: "a tag not known yet", role: "assistant", text: `<system-reminder>
|
|
7744
|
+
</system-reminder>
|
|
7745
|
+
Ready.`, said: "Ready." }
|
|
7746
|
+
];
|
|
7747
|
+
function userWords(text3) {
|
|
7748
|
+
const said = TaImageNote.strip(TaMessageContext.strip(text3));
|
|
7749
|
+
const skill = TaSkillUse.parse(said);
|
|
7750
|
+
if (skill) {
|
|
7751
|
+
return TaSkillUse.command(skill);
|
|
7752
|
+
}
|
|
7753
|
+
const note = TaTaskNote.parse(said);
|
|
7754
|
+
if (!note) {
|
|
7755
|
+
return said;
|
|
7756
|
+
}
|
|
7757
|
+
if (note.kind === "renamed") {
|
|
7758
|
+
return "";
|
|
7759
|
+
}
|
|
7760
|
+
return note.kind === "update" && note.body.trim() ? `${note.title} · ${note.body}` : note.title;
|
|
7761
|
+
}
|
|
7762
|
+
function withoutFences(text3, drop, tags = false) {
|
|
7763
|
+
const kept = [];
|
|
7764
|
+
let fence;
|
|
7765
|
+
let left = false;
|
|
7766
|
+
for (const part of text3.split(`
|
|
7767
|
+
`)) {
|
|
7768
|
+
const open = FENCE.exec(part);
|
|
7769
|
+
if (!fence && open) {
|
|
7770
|
+
fence = { mark: open[1], dropped: drop(open[2]) };
|
|
7771
|
+
} else if (fence && closes(part, fence.mark)) {
|
|
7772
|
+
const dropped = fence.dropped;
|
|
7773
|
+
fence = undefined;
|
|
7774
|
+
if (dropped) {
|
|
7775
|
+
continue;
|
|
7776
|
+
}
|
|
7777
|
+
}
|
|
7778
|
+
if ((fence === null || fence === undefined ? undefined : fence.dropped) || !fence && tags && TAG_LINE.test(part.trim())) {
|
|
7779
|
+
left = true;
|
|
7780
|
+
} else {
|
|
7781
|
+
kept.push(part);
|
|
7782
|
+
}
|
|
7783
|
+
}
|
|
7784
|
+
return left ? kept.join(`
|
|
7785
|
+
`).replace(/\n{3,}/g, `
|
|
7786
|
+
|
|
7787
|
+
`) : kept.join(`
|
|
7788
|
+
`);
|
|
7789
|
+
}
|
|
7790
|
+
function codeOf(text3) {
|
|
7791
|
+
const code = [];
|
|
7792
|
+
let fence;
|
|
7793
|
+
for (const part of text3.split(`
|
|
7794
|
+
`)) {
|
|
7795
|
+
const open = FENCE.exec(part);
|
|
7796
|
+
if (!fence && open) {
|
|
7797
|
+
fence = { mark: open[1], card: CARD.test(open[2]) };
|
|
7798
|
+
} else if (fence && closes(part, fence.mark)) {
|
|
7799
|
+
fence = undefined;
|
|
7800
|
+
} else if (fence && !fence.card) {
|
|
7801
|
+
code.push(part);
|
|
7802
|
+
}
|
|
7803
|
+
}
|
|
7804
|
+
return code.join(`
|
|
7805
|
+
`);
|
|
7806
|
+
}
|
|
7807
|
+
function closes(part, mark) {
|
|
7808
|
+
var _a;
|
|
7809
|
+
const close = (_a = /^\s*(`{3,}|~{3,})\s*$/.exec(part)) === null || _a === undefined ? undefined : _a[1];
|
|
7810
|
+
return !!close && close[0] === mark[0] && close.length >= mark.length;
|
|
7811
|
+
}
|
|
7812
|
+
function plain(text3) {
|
|
7813
|
+
const linked = text3.replace(/(?<!!)\[([^\]\n]*)\]\([^)\n]*\)/g, "$1");
|
|
7814
|
+
const words3 = linked.replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, "").trim();
|
|
7815
|
+
return words3 || linked.replace(/!\[([^\]\n]*)\]\([^)\n]*\)/g, "$1");
|
|
7816
|
+
}
|
|
7817
|
+
})(TaSaid || (TaSaid = {}));
|
|
7818
|
+
// ../ta-protocol/esm/common/screen-share-protocol.js
|
|
7819
|
+
var TaScreenShareServer = Symbol("TaScreenShareServer");
|
|
7820
|
+
var TaDesktopUtil;
|
|
7821
|
+
(function(TaDesktopUtil2) {
|
|
7822
|
+
TaDesktopUtil2.DEFAULT_PORT = 5900;
|
|
7823
|
+
function id(target) {
|
|
7824
|
+
var _a;
|
|
7825
|
+
return `${(_a = target.via) !== null && _a !== undefined ? _a : ""}|${host(target)}:${port(target)}`;
|
|
7826
|
+
}
|
|
7827
|
+
TaDesktopUtil2.id = id;
|
|
7828
|
+
function host(target) {
|
|
7829
|
+
var _a;
|
|
7830
|
+
return ((_a = target.host) !== null && _a !== undefined ? _a : "").trim() || "127.0.0.1";
|
|
7831
|
+
}
|
|
7832
|
+
TaDesktopUtil2.host = host;
|
|
7833
|
+
function port(target) {
|
|
7834
|
+
var _a;
|
|
7835
|
+
return (_a = target.port) !== null && _a !== undefined ? _a : TaDesktopUtil2.DEFAULT_PORT;
|
|
7836
|
+
}
|
|
7837
|
+
TaDesktopUtil2.port = port;
|
|
7838
|
+
function parse(id2) {
|
|
7839
|
+
const match = /^([^|]*)\|(.+):(\d+)$/.exec(String(id2 !== null && id2 !== undefined ? id2 : ""));
|
|
7840
|
+
if (!match) {
|
|
7841
|
+
return;
|
|
7842
|
+
}
|
|
7843
|
+
const port2 = Number(match[3]);
|
|
7844
|
+
return port2 > 0 && port2 < 65536 ? { via: match[1], host: match[2], port: port2 } : undefined;
|
|
7845
|
+
}
|
|
7846
|
+
TaDesktopUtil2.parse = parse;
|
|
7847
|
+
function validPort(port2) {
|
|
7848
|
+
return typeof port2 === "number" && Number.isInteger(port2) && port2 >= 1024 && port2 < 65536;
|
|
7849
|
+
}
|
|
7850
|
+
TaDesktopUtil2.validPort = validPort;
|
|
7851
|
+
function loopback(host2) {
|
|
7852
|
+
return /^(127\.\d+\.\d+\.\d+|localhost|::1|\[::1\])$/i.test(host2);
|
|
7853
|
+
}
|
|
7854
|
+
TaDesktopUtil2.loopback = loopback;
|
|
7855
|
+
function validHost(host2) {
|
|
7856
|
+
return typeof host2 === "string" && /^[A-Za-z0-9.:\-[\]]{1,253}$/.test(host2);
|
|
7857
|
+
}
|
|
7858
|
+
TaDesktopUtil2.validHost = validHost;
|
|
7859
|
+
})(TaDesktopUtil || (TaDesktopUtil = {}));
|
|
7472
7860
|
// ../ta-protocol/esm/common/settings-protocol.js
|
|
7473
7861
|
var TaSettingsServer = Symbol("TaSettingsServer");
|
|
7474
7862
|
// ../ta-protocol/esm/common/ta-protocol.js
|
|
@@ -7531,7 +7919,7 @@ var TA_ACTIONS = [
|
|
|
7531
7919
|
action("commands.terminal", "Open terminals", "打开终端", "開啟終端機", "ターミナルを開く", { scoped: true, risky: true }),
|
|
7532
7920
|
action("hosts.use", "Use remote hosts", "使用远程主机", "使用遠端主機", "リモートホストを使用", { risky: true }),
|
|
7533
7921
|
action("models.use", "Use the models", "使用模型", "使用模型", "モデルを使用"),
|
|
7534
|
-
action("models.manage", "Sign in to models", "登录和更换模型账号", "登入和更換模型帳號", "モデルアカウントにサインイン・変更"),
|
|
7922
|
+
action("models.manage", "Sign in to models", "登录和更换模型账号", "登入和更換模型帳號", "モデルアカウントにサインイン・変更", { grant: "single" }),
|
|
7535
7923
|
action("cron.view", "See scheduled tasks", "查看定时任务", "檢視定時任務", "スケジュールタスクを確認"),
|
|
7536
7924
|
action("cron.manage", "Change scheduled tasks", "管理定时任务", "管理定時任務", "スケジュールタスクを管理"),
|
|
7537
7925
|
action("extensions.use", "Use extensions", "使用扩展", "使用擴充功能", "拡張機能を使用"),
|
|
@@ -7544,9 +7932,15 @@ var TA_ACTIONS = [
|
|
|
7544
7932
|
action("members.roles", "Change roles and members", "管理角色和成员", "管理角色和成員", "ロールとメンバーを管理"),
|
|
7545
7933
|
action("audit.view", "See the record", "查看记录", "檢視記錄", "レコードを確認")
|
|
7546
7934
|
];
|
|
7935
|
+
var TA_OWNER_ACTIONS = [
|
|
7936
|
+
action("desktop.view", "See remote desktops", "查看远程桌面", "檢視遠端桌面", "リモートデスクトップを見る", { risky: true }),
|
|
7937
|
+
action("desktop.control", "Work remote desktops", "操作远程桌面", "操作遠端桌面", "リモートデスクトップを操作", { risky: true })
|
|
7938
|
+
];
|
|
7939
|
+
var OWNER_AREAS = ["desktop"];
|
|
7547
7940
|
var TaActionUtil;
|
|
7548
7941
|
(function(TaActionUtil2) {
|
|
7549
7942
|
const byId = new Map(TA_ACTIONS.map((one) => [one.id, one]));
|
|
7943
|
+
const titled = new Map([...TA_ACTIONS, ...TA_OWNER_ACTIONS].map((one) => [one.id, one]));
|
|
7550
7944
|
function info(id) {
|
|
7551
7945
|
return byId.get(id);
|
|
7552
7946
|
}
|
|
@@ -7554,7 +7948,7 @@ var TaActionUtil;
|
|
|
7554
7948
|
function title(id, language) {
|
|
7555
7949
|
var _a;
|
|
7556
7950
|
var _b, _c;
|
|
7557
|
-
const title2 = (_a =
|
|
7951
|
+
const title2 = (_a = titled.get(id)) === null || _a === undefined ? undefined : _a.title;
|
|
7558
7952
|
if (!title2) {
|
|
7559
7953
|
return id;
|
|
7560
7954
|
}
|
|
@@ -7566,6 +7960,16 @@ var TaActionUtil;
|
|
|
7566
7960
|
});
|
|
7567
7961
|
}
|
|
7568
7962
|
TaActionUtil2.title = title;
|
|
7963
|
+
function grantable(id) {
|
|
7964
|
+
const info2 = byId.get(id);
|
|
7965
|
+
return !!info2 && !OWNER_AREAS.includes(info2.area);
|
|
7966
|
+
}
|
|
7967
|
+
TaActionUtil2.grantable = grantable;
|
|
7968
|
+
function inRoles(id) {
|
|
7969
|
+
var _a;
|
|
7970
|
+
return grantable(id) && ((_a = byId.get(id)) === null || _a === undefined ? undefined : _a.grant) !== "single";
|
|
7971
|
+
}
|
|
7972
|
+
TaActionUtil2.inRoles = inRoles;
|
|
7569
7973
|
function inside(dir, path) {
|
|
7570
7974
|
const base = dir.replace(/\/+$/, "");
|
|
7571
7975
|
return path === base || path.startsWith(`${base}/`) || base === "";
|
|
@@ -7576,6 +7980,53 @@ var TaActionUtil;
|
|
|
7576
7980
|
var TaUsageServer = Symbol("TaUsageServer");
|
|
7577
7981
|
// ../ta-protocol/esm/common/voice-protocol.js
|
|
7578
7982
|
var TaVoiceServer = Symbol("TaVoiceServer");
|
|
7983
|
+
var TaBargeIn;
|
|
7984
|
+
(function(TaBargeIn2) {
|
|
7985
|
+
TaBargeIn2.DEFAULTS = { duck: 0.2, speechMs: 500, level: 0.02, words: 2, waitMs: 1500, echo: 0.3, joinMs: 300, tap: false };
|
|
7986
|
+
TaBargeIn2.SENSITIVITY = [
|
|
7987
|
+
{ speechMs: 1000, level: 0.05 },
|
|
7988
|
+
{ speechMs: 750, level: 0.035 },
|
|
7989
|
+
{ speechMs: TaBargeIn2.DEFAULTS.speechMs, level: TaBargeIn2.DEFAULTS.level },
|
|
7990
|
+
{ speechMs: 300, level: 0.012 },
|
|
7991
|
+
{ speechMs: 150, level: 0.006 }
|
|
7992
|
+
];
|
|
7993
|
+
function sensitivity(bargeIn) {
|
|
7994
|
+
let nearest = 0;
|
|
7995
|
+
TaBargeIn2.SENSITIVITY.forEach((step, index) => {
|
|
7996
|
+
if (Math.abs(step.speechMs - bargeIn.speechMs) < Math.abs(TaBargeIn2.SENSITIVITY[nearest].speechMs - bargeIn.speechMs)) {
|
|
7997
|
+
nearest = index;
|
|
7998
|
+
}
|
|
7999
|
+
});
|
|
8000
|
+
return nearest;
|
|
8001
|
+
}
|
|
8002
|
+
TaBargeIn2.sensitivity = sensitivity;
|
|
8003
|
+
function pick(value) {
|
|
8004
|
+
const given = value && typeof value === "object" ? value : {};
|
|
8005
|
+
const out = typeof given.tap === "boolean" ? { tap: given.tap } : {};
|
|
8006
|
+
for (const key of Object.keys(RANGES)) {
|
|
8007
|
+
const number = given[key];
|
|
8008
|
+
if (typeof number === "number" && Number.isFinite(number)) {
|
|
8009
|
+
const [min, max] = RANGES[key];
|
|
8010
|
+
out[key] = Math.min(max, Math.max(min, number));
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
return out;
|
|
8014
|
+
}
|
|
8015
|
+
TaBargeIn2.pick = pick;
|
|
8016
|
+
const RANGES = {
|
|
8017
|
+
duck: [0, 1],
|
|
8018
|
+
speechMs: [0, 5000],
|
|
8019
|
+
level: [0, 1],
|
|
8020
|
+
words: [1, 50],
|
|
8021
|
+
waitMs: [100, 1e4],
|
|
8022
|
+
echo: [0, 4],
|
|
8023
|
+
joinMs: [0, 3000]
|
|
8024
|
+
};
|
|
8025
|
+
function resolve(value) {
|
|
8026
|
+
return { ...TaBargeIn2.DEFAULTS, ...pick(value) };
|
|
8027
|
+
}
|
|
8028
|
+
TaBargeIn2.resolve = resolve;
|
|
8029
|
+
})(TaBargeIn || (TaBargeIn = {}));
|
|
7579
8030
|
// ../ta-protocol/esm/common/workspace-protocol.js
|
|
7580
8031
|
var TaWorkspaceServer = Symbol("TaWorkspaceServer");
|
|
7581
8032
|
var TaTerminalServer = Symbol("TaTerminalServer");
|
|
@@ -8472,7 +8923,7 @@ function FileEditor({ id, cwd, path }) {
|
|
|
8472
8923
|
}, t("failed", { message: error }));
|
|
8473
8924
|
}
|
|
8474
8925
|
if (textual && !file.value || kind && !url.value) {
|
|
8475
|
-
return /* @__PURE__ */ React.createElement(
|
|
8926
|
+
return /* @__PURE__ */ React.createElement(Loading, null);
|
|
8476
8927
|
}
|
|
8477
8928
|
if (file.value?.binary && !kind) {
|
|
8478
8929
|
return /* @__PURE__ */ React.createElement("div", {
|
|
@@ -8531,9 +8982,9 @@ function FileEditor({ id, cwd, path }) {
|
|
|
8531
8982
|
previous: showPicture(siblings?.previous),
|
|
8532
8983
|
next: showPicture(siblings?.next),
|
|
8533
8984
|
browsedAt
|
|
8534
|
-
}), showPreview && kind && kind !== "markdown" && kind !== "html" && !shownUrl && /* @__PURE__ */ React.createElement(Message, {
|
|
8535
|
-
tone:
|
|
8536
|
-
}, bytes.error
|
|
8985
|
+
}), showPreview && kind && kind !== "markdown" && kind !== "html" && !shownUrl && (bytes.error ? /* @__PURE__ */ React.createElement(Message, {
|
|
8986
|
+
tone: "error"
|
|
8987
|
+
}, bytes.error) : /* @__PURE__ */ React.createElement(Loading, null)), !showPreview && /* @__PURE__ */ React.createElement(pi.ui.CodeEditor, {
|
|
8537
8988
|
path,
|
|
8538
8989
|
value: draft ?? text2 ?? "",
|
|
8539
8990
|
readOnly,
|
|
@@ -8585,7 +9036,7 @@ function DiffEditor({ id, cwd, path, staged }) {
|
|
|
8585
9036
|
}, t("failed", { message: diff.error }));
|
|
8586
9037
|
}
|
|
8587
9038
|
if (!diff.value) {
|
|
8588
|
-
return /* @__PURE__ */ React.createElement(
|
|
9039
|
+
return /* @__PURE__ */ React.createElement(Loading, null);
|
|
8589
9040
|
}
|
|
8590
9041
|
const extra = /* @__PURE__ */ React.createElement("div", {
|
|
8591
9042
|
className: "taw-editor-tools"
|
|
@@ -9732,9 +10183,7 @@ function ExplorerView() {
|
|
|
9732
10183
|
}, tree.error && /* @__PURE__ */ React.createElement(Empty, {
|
|
9733
10184
|
tone: "error",
|
|
9734
10185
|
title: t("failed", { message: tree.error })
|
|
9735
|
-
}), !tree.error && !tree.children.has("") && /* @__PURE__ */ React.createElement(Empty, {
|
|
9736
|
-
hint: t("loading")
|
|
9737
|
-
}), !tree.error && tree.children.has("") && rows.length === 0 && !creating && /* @__PURE__ */ React.createElement(Empty, {
|
|
10186
|
+
}), !tree.error && !tree.children.has("") && /* @__PURE__ */ React.createElement(Loading, null), !tree.error && tree.children.has("") && rows.length === 0 && !creating && /* @__PURE__ */ React.createElement(Empty, {
|
|
9738
10187
|
title: t("empty")
|
|
9739
10188
|
}), shown), transfer, menu, picking && /* @__PURE__ */ React.createElement(FolderPicker, {
|
|
9740
10189
|
initial: root,
|
|
@@ -10082,9 +10531,7 @@ function ScmView() {
|
|
|
10082
10531
|
}, status.error && /* @__PURE__ */ React.createElement(Empty, {
|
|
10083
10532
|
tone: "error",
|
|
10084
10533
|
title: t("failed", { message: status.error })
|
|
10085
|
-
}), !status.error && !value && /* @__PURE__ */ React.createElement(Empty, {
|
|
10086
|
-
hint: t("loading")
|
|
10087
|
-
}), value && !value.repository && /* @__PURE__ */ React.createElement(Empty, {
|
|
10534
|
+
}), !status.error && !value && /* @__PURE__ */ React.createElement(Loading, null), value && !value.repository && /* @__PURE__ */ React.createElement(Empty, {
|
|
10088
10535
|
title: t("notRepository")
|
|
10089
10536
|
}), value?.repository && rows.length === 0 && /* @__PURE__ */ React.createElement(Empty, {
|
|
10090
10537
|
title: t("noChanges")
|
|
@@ -10229,6 +10676,7 @@ var STYLE = `
|
|
|
10229
10676
|
.taw-action.taw-on { background: var(--ta-selected); color: var(--ta-text); }
|
|
10230
10677
|
.taw-action:focus-visible, .taw-row:focus-visible, .taw-row-main:focus-visible, .taw-button:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
10231
10678
|
.taw-list { flex: 1; min-height: 0; overflow: auto; padding: 0 4px 12px; }
|
|
10679
|
+
.taw-list:has(> .ta-loading) { display: flex; flex-direction: column; }
|
|
10232
10680
|
.taw-list:has(> .ta-empty) { display: flex; flex-direction: column; }
|
|
10233
10681
|
.taw-row { position: relative; display: flex; align-items: center; gap: 6px; width: 100%; height: 24px; padding: 0 6px 0 8px; border: 0; border-radius: 6px; background: none; color: var(--ta-body); font: inherit; text-align: left; cursor: pointer; user-select: none; outline: none; }
|
|
10234
10682
|
.taw-row:hover { background: var(--ta-hover); }
|
|
@@ -10353,7 +10801,7 @@ var STYLE = `
|
|
|
10353
10801
|
.taw-address-go { width: 24px; height: 24px; border-radius: 12px; }
|
|
10354
10802
|
.taw-spin { display: inline-flex; animation: taw-spin 0.9s linear infinite; }
|
|
10355
10803
|
@keyframes taw-spin { to { transform: rotate(360deg); } }
|
|
10356
|
-
.taw-browser-
|
|
10804
|
+
.taw-browser-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, transparent, var(--ta-accent), transparent) 0 0 / 30% 100% no-repeat; animation: taw-slide 1.1s linear infinite; pointer-events: none; }
|
|
10357
10805
|
.taw-browser-home { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: clamp(40px, 20%, 160px) 16px 14px; }
|
|
10358
10806
|
.taw-browser-sites { display: grid; grid-template-columns: repeat(auto-fit, 100px); justify-content: center; gap: 4px; width: 100%; max-width: 624px; }
|
|
10359
10807
|
.taw-browser-site { position: relative; }
|