@celljs/ta-protocol 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/esm/common/access-protocol.d.ts +41 -0
- package/esm/common/access-protocol.js +7 -0
- package/esm/common/app-protocol.d.ts +120 -0
- package/esm/common/app-protocol.js +213 -0
- package/esm/common/delegate-protocol.d.ts +30 -0
- package/esm/common/delegate-protocol.js +52 -0
- package/esm/common/deployment-protocol.d.ts +72 -0
- package/esm/common/deployment-protocol.js +171 -0
- package/esm/common/error-protocol.d.ts +42 -0
- package/esm/common/error-protocol.js +45 -0
- package/esm/common/event-protocol.d.ts +63 -0
- package/esm/common/event-protocol.js +2 -0
- package/esm/common/gateway-protocol.d.ts +29 -0
- package/esm/common/index.d.ts +11 -0
- package/esm/common/index.js +11 -0
- package/esm/common/message-protocol.d.ts +134 -0
- package/esm/common/message-protocol.js +322 -0
- package/esm/common/page-protocol.d.ts +56 -0
- package/esm/common/page-protocol.js +12 -0
- package/esm/common/path-map.d.ts +24 -0
- package/esm/common/path-map.js +127 -0
- package/esm/common/presence-protocol.js +1 -1
- package/esm/common/redactor.d.ts +12 -0
- package/esm/common/redactor.js +49 -11
- package/esm/common/relay-protocol.d.ts +20 -0
- package/esm/common/room-protocol.d.ts +52 -1
- package/esm/common/said-protocol.d.ts +76 -0
- package/esm/common/said-protocol.js +239 -0
- package/esm/common/screen-share-protocol.d.ts +304 -0
- package/esm/common/screen-share-protocol.js +88 -0
- package/esm/common/settings-protocol.d.ts +8 -0
- package/esm/common/settings-protocol.js +2 -0
- package/esm/common/ta-extension-host.d.ts +64 -1
- package/esm/common/ta-extension-host.js +8 -0
- package/esm/common/ta-protocol.d.ts +53 -175
- package/esm/common/ta-protocol.js +0 -234
- package/esm/common/team-protocol.d.ts +13 -2
- package/esm/common/team-protocol.js +27 -2
- package/esm/common/voice-protocol.d.ts +184 -0
- package/esm/common/voice-protocol.js +57 -0
- package/lib/common/access-protocol.d.ts +41 -0
- package/lib/common/access-protocol.js +8 -1
- package/lib/common/app-protocol.d.ts +121 -0
- package/lib/common/app-protocol.js +216 -0
- package/lib/common/delegate-protocol.d.ts +31 -0
- package/lib/common/delegate-protocol.js +55 -0
- package/lib/common/deployment-protocol.d.ts +73 -0
- package/lib/common/deployment-protocol.js +175 -0
- package/lib/common/error-protocol.d.ts +43 -0
- package/lib/common/error-protocol.js +48 -0
- package/lib/common/event-protocol.d.ts +64 -0
- package/lib/common/event-protocol.js +3 -0
- package/lib/common/gateway-protocol.d.ts +29 -0
- package/lib/common/index.d.ts +11 -0
- package/lib/common/index.js +11 -0
- package/lib/common/message-protocol.d.ts +135 -0
- package/lib/common/message-protocol.js +325 -0
- package/lib/common/page-protocol.d.ts +57 -0
- package/lib/common/page-protocol.js +15 -0
- package/lib/common/path-map.d.ts +25 -0
- package/lib/common/path-map.js +130 -0
- package/lib/common/presence-protocol.js +7 -7
- package/lib/common/redactor.d.ts +12 -0
- package/lib/common/redactor.js +49 -11
- package/lib/common/relay-protocol.d.ts +20 -0
- package/lib/common/room-protocol.d.ts +52 -1
- package/lib/common/said-protocol.d.ts +77 -0
- package/lib/common/said-protocol.js +242 -0
- package/lib/common/screen-share-protocol.d.ts +305 -0
- package/lib/common/screen-share-protocol.js +91 -0
- package/lib/common/settings-protocol.d.ts +8 -0
- package/lib/common/settings-protocol.js +3 -1
- package/lib/common/ta-extension-host.d.ts +64 -1
- package/lib/common/ta-extension-host.js +9 -1
- package/lib/common/ta-protocol.d.ts +53 -175
- package/lib/common/ta-protocol.js +1 -235
- package/lib/common/team-protocol.d.ts +13 -2
- package/lib/common/team-protocol.js +28 -3
- package/lib/common/voice-protocol.d.ts +185 -0
- package/lib/common/voice-protocol.js +60 -0
- package/package.json +1 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaPathMap = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A path of one computer as it is on another (docs/design/ta-sync.md 8.4): a move from Windows to Linux or back, a
|
|
6
|
+
* project in another folder. A base is matched whatever its separators, and regardless of case for a path of Windows;
|
|
7
|
+
* what follows it takes the separators of the base it is mapped to.
|
|
8
|
+
*/
|
|
9
|
+
var TaPathMap;
|
|
10
|
+
(function (TaPathMap) {
|
|
11
|
+
/** `C:\...`, `c:/...` or `\\server\share`. */
|
|
12
|
+
function isWindows(path) {
|
|
13
|
+
return /^[a-zA-Z]:([\\/]|$)/.test(path) || /^\\\\[^\\]/.test(path);
|
|
14
|
+
}
|
|
15
|
+
TaPathMap.isWindows = isWindows;
|
|
16
|
+
/** The parts of `path` after `base`, none when it is `base`; undefined when it is not `base` nor under it. */
|
|
17
|
+
function rest(path, base) {
|
|
18
|
+
const windows = isWindows(base);
|
|
19
|
+
if (windows ? !isWindows(path) : !base.startsWith('/') || !path.startsWith('/')) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const within = parts(base, windows);
|
|
23
|
+
const all = parts(path, windows);
|
|
24
|
+
if (!within.length || all.length < within.length) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const same = (a, b) => (windows ? a.toLowerCase() === b.toLowerCase() : a === b);
|
|
28
|
+
return within.every((part, i) => same(part, all[i])) ? all.slice(within.length) : undefined;
|
|
29
|
+
}
|
|
30
|
+
TaPathMap.rest = rest;
|
|
31
|
+
function under(path, base) {
|
|
32
|
+
return rest(path, base) !== undefined;
|
|
33
|
+
}
|
|
34
|
+
TaPathMap.under = under;
|
|
35
|
+
/** `parts` under `base`, with its separator. */
|
|
36
|
+
function join(base, parts) {
|
|
37
|
+
if (!parts.length) {
|
|
38
|
+
return base;
|
|
39
|
+
}
|
|
40
|
+
const sep = isWindows(base) ? '\\' : '/';
|
|
41
|
+
return `${base.replace(/[\\/]+$/, '')}${sep}${parts.join(sep)}`;
|
|
42
|
+
}
|
|
43
|
+
TaPathMap.join = join;
|
|
44
|
+
/** The last part of a path, of either kind. */
|
|
45
|
+
function basename(path) {
|
|
46
|
+
var _a;
|
|
47
|
+
return ((_a = path
|
|
48
|
+
.split(/[\\/]+/)
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.pop()) !== null && _a !== void 0 ? _a : '');
|
|
51
|
+
}
|
|
52
|
+
TaPathMap.basename = basename;
|
|
53
|
+
/** A path under the deepest base of `pairs` it is under, as it is there; else itself. */
|
|
54
|
+
function path(value, pairs) {
|
|
55
|
+
for (const [from, to] of deepest(pairs)) {
|
|
56
|
+
const found = rest(value, from);
|
|
57
|
+
if (found) {
|
|
58
|
+
return join(to, found);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
TaPathMap.path = path;
|
|
64
|
+
/** The paths in a text (a command, `dir:<path>`), each mapped as `path` maps it; a path ends at a space or a quote. */
|
|
65
|
+
function text(value, pairs) {
|
|
66
|
+
const order = deepest(pairs);
|
|
67
|
+
if (!order.length) {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
const end = String.raw `\s"'<>|*?:;,`;
|
|
71
|
+
const pattern = new RegExp(String.raw `(^|[^\w.~-])(?:${order.map(([from]) => `(${source(from)})`).join('|')})((?:[\\/][^\\/${end}]*)*)(?=$|[\\/${end})\]}])`, 'g');
|
|
72
|
+
return value.replace(pattern, (...match) => {
|
|
73
|
+
var _a;
|
|
74
|
+
const before = match[1];
|
|
75
|
+
const found = order.findIndex((_, i) => match[i + 2] !== undefined);
|
|
76
|
+
const tail = (_a = match[order.length + 2]) !== null && _a !== void 0 ? _a : '';
|
|
77
|
+
return `${before}${join(order[found][1], tail.split(/[\\/]+/).filter(Boolean))}`;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
TaPathMap.text = text;
|
|
81
|
+
/** Every string of a value of JSON, keys too, mapped: a whole path as `path` maps it, paths in a text as `text` does. */
|
|
82
|
+
function json(value, pairs) {
|
|
83
|
+
const order = deepest(pairs);
|
|
84
|
+
if (!order.length) {
|
|
85
|
+
return value;
|
|
86
|
+
}
|
|
87
|
+
const one = (each) => {
|
|
88
|
+
const whole = path(each, order);
|
|
89
|
+
return whole !== each ? whole : text(each, order);
|
|
90
|
+
};
|
|
91
|
+
const walk = (each) => {
|
|
92
|
+
if (typeof each === 'string') {
|
|
93
|
+
return one(each);
|
|
94
|
+
}
|
|
95
|
+
if (Array.isArray(each)) {
|
|
96
|
+
return each.map(walk);
|
|
97
|
+
}
|
|
98
|
+
if (each && typeof each === 'object') {
|
|
99
|
+
return Object.fromEntries(Object.entries(each).map(([key, inner]) => [one(key), walk(inner)]));
|
|
100
|
+
}
|
|
101
|
+
return each;
|
|
102
|
+
};
|
|
103
|
+
return walk(value);
|
|
104
|
+
}
|
|
105
|
+
TaPathMap.json = json;
|
|
106
|
+
function parts(path, windows) {
|
|
107
|
+
return path.split(windows ? /[\\/]+/ : /\/+/).filter(Boolean);
|
|
108
|
+
}
|
|
109
|
+
/** The pairs that map something, the deepest base first: a path goes under the nearest. */
|
|
110
|
+
function deepest(pairs) {
|
|
111
|
+
return pairs
|
|
112
|
+
.filter(([from, to]) => from && to && from !== to && parts(from, isWindows(from)).length > 0)
|
|
113
|
+
.sort(([a], [b]) => parts(b, isWindows(b)).length - parts(a, isWindows(a)).length);
|
|
114
|
+
}
|
|
115
|
+
/** A base as a pattern: its parts by any separator, and for Windows regardless of case. */
|
|
116
|
+
function source(base) {
|
|
117
|
+
const windows = isWindows(base);
|
|
118
|
+
const quote = (part) => [...part]
|
|
119
|
+
.map(char => windows && char.toLowerCase() !== char.toUpperCase()
|
|
120
|
+
? `[${char.toLowerCase()}${char.toUpperCase()}]`
|
|
121
|
+
: char.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
|
122
|
+
.join('');
|
|
123
|
+
const each = parts(base, windows).map(quote);
|
|
124
|
+
if (!windows) {
|
|
125
|
+
return `/${each.join('/+')}`;
|
|
126
|
+
}
|
|
127
|
+
return `${base.startsWith('\\\\') ? String.raw `\\\\` : ''}${each.join(String.raw `[\\/]+`)}`;
|
|
128
|
+
}
|
|
129
|
+
})(TaPathMap || (exports.TaPathMap = TaPathMap = {}));
|
|
130
|
+
//# sourceMappingURL=path-map.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TaMessageAuthor = exports.TA_PRESENCE_EXPIRY_MS = exports.TA_PRESENCE_HEARTBEAT_MS = exports.TA_PRESENCE_SERVICE = exports.TaPresenceServer = void 0;
|
|
4
|
-
const
|
|
4
|
+
const message_protocol_1 = require("./message-protocol");
|
|
5
5
|
exports.TaPresenceServer = Symbol('TaPresenceServer');
|
|
6
6
|
exports.TA_PRESENCE_SERVICE = 'TaPresenceServer';
|
|
7
7
|
/** A page says what it is at again this often while it lasts, the same or not. */
|
|
@@ -19,13 +19,13 @@ var TaMessageAuthor;
|
|
|
19
19
|
const LINES = /^\[ta:by [^\]\n]*\]$\n?/gm;
|
|
20
20
|
/** `message` without the lines of an author. */
|
|
21
21
|
function strip(message) {
|
|
22
|
-
const context =
|
|
22
|
+
const context = message_protocol_1.TaMessageContext.read(message);
|
|
23
23
|
if (context === undefined || !LINE.test(context)) {
|
|
24
24
|
return message;
|
|
25
25
|
}
|
|
26
26
|
const kept = context.replace(LINES, '').replace(/\n+$/, '');
|
|
27
|
-
const body =
|
|
28
|
-
return kept.trim() ?
|
|
27
|
+
const body = message_protocol_1.TaMessageContext.strip(message);
|
|
28
|
+
return kept.trim() ? message_protocol_1.TaMessageContext.wrap(kept, body) : body;
|
|
29
29
|
}
|
|
30
30
|
TaMessageAuthor.strip = strip;
|
|
31
31
|
/** `message` as written by `id`, called `name`; a command (`/compact`, `!ls`) stays a command. */
|
|
@@ -35,14 +35,14 @@ var TaMessageAuthor;
|
|
|
35
35
|
return plain;
|
|
36
36
|
}
|
|
37
37
|
const line = `[ta:by ${id.replace(/[\s\]]/g, '')} ${name.replace(/[\]\n]/g, ' ').trim() || id}]`;
|
|
38
|
-
const context =
|
|
39
|
-
return
|
|
38
|
+
const context = message_protocol_1.TaMessageContext.read(plain);
|
|
39
|
+
return message_protocol_1.TaMessageContext.wrap(context === undefined ? line : `${context}\n${line}`, message_protocol_1.TaMessageContext.strip(plain));
|
|
40
40
|
}
|
|
41
41
|
TaMessageAuthor.mark = mark;
|
|
42
42
|
/** Who wrote it; undefined for the user of the Ta (no line). */
|
|
43
43
|
function of(message) {
|
|
44
44
|
var _a;
|
|
45
|
-
const context =
|
|
45
|
+
const context = message_protocol_1.TaMessageContext.read(message);
|
|
46
46
|
const match = context === undefined ? null : LINE.exec(context);
|
|
47
47
|
return match ? { id: match[1], name: ((_a = match[2]) !== null && _a !== void 0 ? _a : match[1]).trim() } : undefined;
|
|
48
48
|
}
|
package/lib/common/redactor.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** What a secret is replaced with. */
|
|
2
2
|
export declare const REDACTED = "[redacted]";
|
|
3
|
+
/** Where a secret is in a text (Redactor.spans). */
|
|
4
|
+
export interface RedactorSpan {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
kind: string;
|
|
8
|
+
}
|
|
3
9
|
/**
|
|
4
10
|
* What looks like a secret in what is shared (docs/design/ta-link.md 2.8): keys of model services and code hosts,
|
|
5
11
|
* tokens, private keys, passwords in assignments and in URLs. It errs on hiding: a shared conversation is read
|
|
@@ -11,6 +17,12 @@ export declare class Redactor {
|
|
|
11
17
|
text(text: string): string;
|
|
12
18
|
/** Strings of a value, deep, each cut to `max` characters. */
|
|
13
19
|
value(value: unknown, max: number): unknown;
|
|
20
|
+
/**
|
|
21
|
+
* Where secrets are in a text, by the same patterns, none overlapping, the first first: what the vault of
|
|
22
|
+
* ta-secrets takes out of what the user sends. `kind` names it: `GITHUB_TOKEN`, `API_KEY` (an `sk-` key),
|
|
23
|
+
* `PRIVATE_KEY`, `BEARER_TOKEN`, `URL_PASSWORD`, or the name it was assigned to (`DB_PASSWORD`).
|
|
24
|
+
*/
|
|
25
|
+
static spans(text: string): RedactorSpan[];
|
|
14
26
|
static cut(text: string, max: number): string;
|
|
15
27
|
protected hide(): string;
|
|
16
28
|
/** What is plainly not a secret: an environment variable, a placeholder, what was hidden already. */
|
package/lib/common/redactor.js
CHANGED
|
@@ -3,17 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Redactor = exports.REDACTED = void 0;
|
|
4
4
|
/** What a secret is replaced with. */
|
|
5
5
|
exports.REDACTED = '[redacted]';
|
|
6
|
-
/** Secrets that have a shape of their own: the whole match goes. */
|
|
6
|
+
/** Secrets that have a shape of their own, by what they are: the whole match goes. */
|
|
7
7
|
const WHOLE = [
|
|
8
|
-
/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g,
|
|
9
|
-
/\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}/g,
|
|
10
|
-
/\bgh[pousr]_[A-Za-z0-9]{30,}\b/g,
|
|
11
|
-
/\bgithub_pat_[A-Za-z0-9_]{40,}\b/g,
|
|
12
|
-
/\bglpat-[A-Za-z0-9_-]{20,}\b/g,
|
|
13
|
-
/\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g,
|
|
14
|
-
/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,
|
|
15
|
-
/\bAIza[0-9A-Za-z_-]{35}\b/g,
|
|
16
|
-
/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g,
|
|
8
|
+
['PRIVATE_KEY', /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g],
|
|
9
|
+
['API_KEY', /\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}/g],
|
|
10
|
+
['GITHUB_TOKEN', /\bgh[pousr]_[A-Za-z0-9]{30,}\b/g],
|
|
11
|
+
['GITHUB_TOKEN', /\bgithub_pat_[A-Za-z0-9_]{40,}\b/g],
|
|
12
|
+
['GITLAB_TOKEN', /\bglpat-[A-Za-z0-9_-]{20,}\b/g],
|
|
13
|
+
['SLACK_TOKEN', /\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g],
|
|
14
|
+
['AWS_ACCESS_KEY_ID', /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g],
|
|
15
|
+
['GOOGLE_API_KEY', /\bAIza[0-9A-Za-z_-]{35}\b/g],
|
|
16
|
+
['JWT', /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g],
|
|
17
17
|
];
|
|
18
18
|
/** Secrets named by what is before them: what is before stays. */
|
|
19
19
|
const NAMED = [
|
|
@@ -33,7 +33,7 @@ class Redactor {
|
|
|
33
33
|
}
|
|
34
34
|
text(text) {
|
|
35
35
|
let out = text;
|
|
36
|
-
for (const pattern of WHOLE) {
|
|
36
|
+
for (const [, pattern] of WHOLE) {
|
|
37
37
|
out = out.replace(pattern, () => this.hide());
|
|
38
38
|
}
|
|
39
39
|
out = out.replace(NAMED[0], (_match, before) => before + this.hide());
|
|
@@ -54,6 +54,44 @@ class Redactor {
|
|
|
54
54
|
}
|
|
55
55
|
return value;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Where secrets are in a text, by the same patterns, none overlapping, the first first: what the vault of
|
|
59
|
+
* ta-secrets takes out of what the user sends. `kind` names it: `GITHUB_TOKEN`, `API_KEY` (an `sk-` key),
|
|
60
|
+
* `PRIVATE_KEY`, `BEARER_TOKEN`, `URL_PASSWORD`, or the name it was assigned to (`DB_PASSWORD`).
|
|
61
|
+
*/
|
|
62
|
+
static spans(text) {
|
|
63
|
+
var _a;
|
|
64
|
+
var _b;
|
|
65
|
+
const found = [];
|
|
66
|
+
for (const [kind, pattern] of WHOLE) {
|
|
67
|
+
for (const match of text.matchAll(pattern)) {
|
|
68
|
+
found.push({ start: match.index, end: match.index + match[0].length, kind });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (const match of text.matchAll(NAMED[0])) {
|
|
72
|
+
found.push({ start: match.index + match[1].length, end: match.index + match[0].length, kind: 'BEARER_TOKEN' });
|
|
73
|
+
}
|
|
74
|
+
for (const match of text.matchAll(NAMED[1])) {
|
|
75
|
+
if (!Redactor.placeholder(match[2])) {
|
|
76
|
+
const start = match.index + match[1].length;
|
|
77
|
+
const name = (_b = (_a = /[A-Za-z0-9_.-]+/.exec(match[1])) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : 'SECRET';
|
|
78
|
+
found.push({ start, end: start + match[2].length, kind: name.replace(/[^A-Za-z0-9]+/g, '_').toUpperCase() });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
for (const match of text.matchAll(NAMED[2])) {
|
|
82
|
+
const start = match.index + match[1].length;
|
|
83
|
+
found.push({ start, end: start + match[2].length, kind: 'URL_PASSWORD' });
|
|
84
|
+
}
|
|
85
|
+
found.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
86
|
+
const spans = [];
|
|
87
|
+
for (const span of found) {
|
|
88
|
+
const last = spans.at(-1);
|
|
89
|
+
if (!last || span.start >= last.end) {
|
|
90
|
+
spans.push(span);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return spans;
|
|
94
|
+
}
|
|
57
95
|
static cut(text, max) {
|
|
58
96
|
return text.length > max ? `${text.slice(0, max)}…` : text;
|
|
59
97
|
}
|
|
@@ -105,6 +105,18 @@ export interface TaRelays {
|
|
|
105
105
|
}[];
|
|
106
106
|
/** The types of services packages registered (WebDAV, S3…), to add one of. */
|
|
107
107
|
types?: TaRelayTypeInfo[];
|
|
108
|
+
/** The deployment of Ta joined (TaRelayServer.joinDeployment): its relay is the default of what is new. */
|
|
109
|
+
deployment?: TaJoinedDeployment;
|
|
110
|
+
}
|
|
111
|
+
/** A deployment of Ta joined by its address (docs/design/ta-deploy.md 8). */
|
|
112
|
+
export interface TaJoinedDeployment {
|
|
113
|
+
/** The address the user gave. */
|
|
114
|
+
url: string;
|
|
115
|
+
name?: string;
|
|
116
|
+
/** Its gateway: a Ta in the cloud of one's own account there, or its sandbox as a cloud workspace. */
|
|
117
|
+
gateway?: string;
|
|
118
|
+
/** The id of its relay in TaRelays.relays. */
|
|
119
|
+
relay?: string;
|
|
108
120
|
}
|
|
109
121
|
/** What asking a relay what it is found (TaRelayServer.probeRelay). */
|
|
110
122
|
export interface TaRelayProbe {
|
|
@@ -164,6 +176,14 @@ export interface TaRelayServer {
|
|
|
164
176
|
* on the relay it was made on.
|
|
165
177
|
*/
|
|
166
178
|
chooseRelay(feature: TaRelayFeature, id: string | null): Promise<TaRelays>;
|
|
179
|
+
/**
|
|
180
|
+
* Joins a deployment of Ta by the address of any of its services (its gateway, its relay), which says what it is at
|
|
181
|
+
* /.well-known/ta: its relay is added and made the default of new pairings, rooms and links; what was made before
|
|
182
|
+
* stays where it is.
|
|
183
|
+
*/
|
|
184
|
+
joinDeployment(url: string): Promise<TaRelays>;
|
|
185
|
+
/** Leaves the deployment joined: the relay of this build is the default again. */
|
|
186
|
+
leaveDeployment(): Promise<TaRelays>;
|
|
167
187
|
/** Asks a relay, by its id or address, what it can do and how much; never throws. */
|
|
168
188
|
probeRelay(idOrUrl: string): Promise<TaRelayProbe>;
|
|
169
189
|
/**
|
|
@@ -49,6 +49,8 @@ export interface TaRoomInfo {
|
|
|
49
49
|
relay?: string;
|
|
50
50
|
/** This Ta made it. */
|
|
51
51
|
owner: boolean;
|
|
52
|
+
/** Of a room this Ta made: the members it lets in at most (TaRoomServer.configureRoom). */
|
|
53
|
+
capacity?: number;
|
|
52
54
|
ownerName: string;
|
|
53
55
|
status: TaRoomStatus;
|
|
54
56
|
/** Why it is `gone`: `closed` by the owner, `removed` by the owner, the `invite` no longer works. */
|
|
@@ -99,6 +101,33 @@ export interface TaFriendRequest {
|
|
|
99
101
|
via: 'link' | 'room';
|
|
100
102
|
room?: string;
|
|
101
103
|
}
|
|
104
|
+
/** A group chat a friend invited the user into (TaRoomServer.listGroupInvites): theirs to join or not. */
|
|
105
|
+
export interface TaGroupInvite {
|
|
106
|
+
/** The id of the room. */
|
|
107
|
+
room: string;
|
|
108
|
+
title: string;
|
|
109
|
+
by: {
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
look?: string;
|
|
113
|
+
};
|
|
114
|
+
at: number;
|
|
115
|
+
expiresAt: number;
|
|
116
|
+
}
|
|
117
|
+
/** A link a friend sent the user from the share sheet (TaRoomServer.listFriendShares): opened as every link of Ta is. */
|
|
118
|
+
export interface TaFriendShare {
|
|
119
|
+
id: string;
|
|
120
|
+
link: string;
|
|
121
|
+
title: string;
|
|
122
|
+
by: {
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
look?: string;
|
|
126
|
+
};
|
|
127
|
+
at: number;
|
|
128
|
+
/** The user opened it once. */
|
|
129
|
+
seen: boolean;
|
|
130
|
+
}
|
|
102
131
|
/**
|
|
103
132
|
* The kind of a Ta's room of friends: unlisted, its members the friends. Features that give friends something keep it
|
|
104
133
|
* in this room (Moments its posts, `post:` and the like); `back:` is the rooms' own.
|
|
@@ -155,7 +184,7 @@ export interface TaRoomServer {
|
|
|
155
184
|
}): Promise<TaRoomInfo>;
|
|
156
185
|
/**
|
|
157
186
|
* The link others ask to join by (the owner only): the one of before while it has a day left; else, or with `renew`,
|
|
158
|
-
* a new one for `days` (7 by default,
|
|
187
|
+
* a new one for `days` (7 by default, 365 at most), and the links of before stop working.
|
|
159
188
|
*/
|
|
160
189
|
invite(room: string, options?: {
|
|
161
190
|
days?: number;
|
|
@@ -164,6 +193,10 @@ export interface TaRoomServer {
|
|
|
164
193
|
link: string;
|
|
165
194
|
expiresAt: number;
|
|
166
195
|
}>;
|
|
196
|
+
/** The owner's choices for a room: the members it lets in at most (16 by default, 2 to 100); those in already stay. */
|
|
197
|
+
configureRoom(room: string, options: {
|
|
198
|
+
members?: number;
|
|
199
|
+
}): Promise<TaRoomInfo>;
|
|
167
200
|
/** Asks to join the room of a link: `waiting` till its owner answers. Ask the user first. */
|
|
168
201
|
join(link: string): Promise<TaRoomInfo>;
|
|
169
202
|
/** Those asking to join the rooms of this Ta. */
|
|
@@ -197,6 +230,24 @@ export interface TaRoomServer {
|
|
|
197
230
|
addFriend(link: string): Promise<void>;
|
|
198
231
|
/** Asks a member of a room the user is in to be friends (its member id). Ask the user first. */
|
|
199
232
|
offerFriend(room: string, member: string): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Invites friends (their identity ids) into a group chat of the user's own: each finds it in their Ta, and is let in
|
|
235
|
+
* at once once they join; no one else is. How many were invited. Ask the user first. Newer than some Ta services.
|
|
236
|
+
*/
|
|
237
|
+
inviteFriends(room: string, friends: string[]): Promise<number>;
|
|
238
|
+
/** The group chats friends invited the user into, not joined nor turned down. */
|
|
239
|
+
listGroupInvites(): Promise<TaGroupInvite[]>;
|
|
240
|
+
/** Sends a link of Ta to friends, sealed for each (docs/design/ta-links.md 4): how many it went to. */
|
|
241
|
+
sendToFriends(friends: string[], item: {
|
|
242
|
+
link: string;
|
|
243
|
+
title: string;
|
|
244
|
+
}): Promise<number>;
|
|
245
|
+
/** What friends sent the user, the latest first. */
|
|
246
|
+
listFriendShares(): Promise<TaFriendShare[]>;
|
|
247
|
+
/** The user opened one (`keep`), or let it go. */
|
|
248
|
+
answerFriendShare(id: string, keep: boolean): Promise<void>;
|
|
249
|
+
/** The user's answer to an invitation into a group chat (its room id). Only ever on the user's word. */
|
|
250
|
+
answerGroupInvite(room: string, accept: boolean): Promise<void>;
|
|
200
251
|
/** Those asking the user to be friends. */
|
|
201
252
|
listFriendRequests(): Promise<TaFriendRequest[]>;
|
|
202
253
|
/** The user's answer to one asking to be friends (its identity id). Only ever on the user's word, never on an agent's. */
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** How {@link TaSaid.words} reads a message. */
|
|
2
|
+
export interface TaSaidOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Keep the fenced blocks of Ta's languages (`ta-glance`, `ta-plot`…), which Ta's pages draw as cards (the
|
|
5
|
+
* default); false where nothing draws them, as the chat of a bot.
|
|
6
|
+
*/
|
|
7
|
+
cards?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** How long {@link TaSaid.line} is. */
|
|
10
|
+
export interface TaSaidLineOptions {
|
|
11
|
+
/** At most so many characters, an ellipsis where it is cut. */
|
|
12
|
+
chars: number;
|
|
13
|
+
/** At most so many lines, each a line of its own; 1, the default, joins them all on one line. */
|
|
14
|
+
lines?: number;
|
|
15
|
+
}
|
|
16
|
+
/** A message with a mark of the model in it, as it comes (TaSaid.SAMPLES). */
|
|
17
|
+
export interface TaSaidSample {
|
|
18
|
+
/** The mark, in a few words. */
|
|
19
|
+
mark: string;
|
|
20
|
+
role: 'user' | 'assistant';
|
|
21
|
+
text: string;
|
|
22
|
+
/** Words a person reads of it, in what words and line give; none when nothing of it is for a person. */
|
|
23
|
+
said?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* What a person reads of a message (docs/design/ta-said.md). The text of pi's messages holds marks that are for the
|
|
27
|
+
* model or for a program, not for people: the `<context>` of a message of the user and the line of where it came
|
|
28
|
+
* from in it, pi's notes of images, the `<skill>` block of `/skill:name`, the notes of the double's tasks, the summary
|
|
29
|
+
* an external agent compacts its context to, and fenced blocks of Ta's languages, which a page draws as cards or
|
|
30
|
+
* leaves out. Every place that shows people what was said (a list, a notice, a link shared, a bot's chat, a copy, a
|
|
31
|
+
* voice) reads it here, never the text itself, and never strips a mark of its own: a new mark is added to
|
|
32
|
+
* message-protocol.ts, to words and to SAMPLES, and every place is right at once. The specs of those places run
|
|
33
|
+
* SAMPLES through them and check with leaks that nothing of the model is left.
|
|
34
|
+
*/
|
|
35
|
+
export declare namespace TaSaid {
|
|
36
|
+
/** The text of the content of a message of pi: its text parts, joined by `joiner`. */
|
|
37
|
+
function text(content: unknown, joiner?: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* What a person reads of the text of a message, as Markdown, empty when nothing of it is for a person. Of the
|
|
40
|
+
* user's, what they typed: without the context for the model and pi's notes of its images, a skill they ran as
|
|
41
|
+
* `/skill:name` and what follows, a note of the double's tasks as the task (its title, and how it ended), none of a
|
|
42
|
+
* note of a new id. Of the agent's, without the summary it compacted its context to (empty while only its tags
|
|
43
|
+
* have come). A line that is a tag alone, outside code, is left out too; `cards: false` also leaves out the
|
|
44
|
+
* fenced blocks of Ta's languages.
|
|
45
|
+
*/
|
|
46
|
+
function words(role: string | undefined, text: string, options?: TaSaidOptions): string;
|
|
47
|
+
/** {@link words} of a message of pi. */
|
|
48
|
+
function of(message: {
|
|
49
|
+
role?: string;
|
|
50
|
+
content?: unknown;
|
|
51
|
+
} | undefined, options?: TaSaidOptions): string;
|
|
52
|
+
/**
|
|
53
|
+
* Whether a message is a notice of a part of Ta, not the user's (TaMessageSource.notice): a page shows it as a line
|
|
54
|
+
* of its own, not as their bubble, and a list neither titles a conversation by it nor shows it as what was said last.
|
|
55
|
+
*/
|
|
56
|
+
function notice(message: {
|
|
57
|
+
role?: string;
|
|
58
|
+
content?: unknown;
|
|
59
|
+
} | undefined): boolean;
|
|
60
|
+
/** Whether a text that says something holds marks only: a message that is no words for a person (the summary alone). */
|
|
61
|
+
function marksOnly(role: string | undefined, text: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Markdown as the plain words of a preview, as a messenger shows the last thing said: without fenced blocks (the
|
|
64
|
+
* code of one when there is nothing else, never a block of Ta's languages), the marks of Markdown at the start
|
|
65
|
+
* of lines and around words, a line that is a tag alone, links by their words, pictures by the words that name
|
|
66
|
+
* them in a message of pictures only.
|
|
67
|
+
*/
|
|
68
|
+
function line(markdown: string, options: TaSaidLineOptions): string;
|
|
69
|
+
/**
|
|
70
|
+
* The marks of the model a text shown to a person still holds, by name: none is right. For the specs of the
|
|
71
|
+
* places that show what was said; `cards: true` where Ta's pages draw the blocks of its languages.
|
|
72
|
+
*/
|
|
73
|
+
function leaks(shown: string, options?: TaSaidOptions): string[];
|
|
74
|
+
/** A message with each mark, as it comes: what the specs of every place that shows what was said run through it. */
|
|
75
|
+
const SAMPLES: readonly TaSaidSample[];
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=said-protocol.d.ts.map
|