lattris 0.2.1 → 0.2.2
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/README.md +1 -1
- package/dist/build.json +1 -1
- package/dist/dispatch-form.js +51 -3
- package/dist/dispatch-words.js +16 -3
- package/dist/dispatch.js +2 -2
- package/dist/entry/setup.js +14 -2
- package/dist/main.js +2 -6
- package/dist/memory/access.js +8 -8
- package/dist/memory/get-help.js +5 -3
- package/dist/memory/views.js +2 -1
- package/dist/nouns/contact.js +43 -8
- package/dist/nouns/index.js +16 -3
- package/dist/nouns/invite.js +45 -19
- package/dist/nouns/questions.js +56 -3
- package/dist/nouns/share.js +55 -47
- package/dist/nouns/words.js +14 -4
- package/dist/render/rows.js +12 -0
- package/dist/request/door.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ lattris memory read and manage blocks
|
|
|
49
49
|
lattris link connect two blocks
|
|
50
50
|
lattris get read your blocks, questions and invites, and your datasets' rows
|
|
51
51
|
lattris ask ask a question of a tree
|
|
52
|
-
lattris invite invite someone
|
|
52
|
+
lattris invite invite someone, naming the email address the invitation admits
|
|
53
53
|
lattris contact manage contacts
|
|
54
54
|
```
|
|
55
55
|
|
package/dist/build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commit":"
|
|
1
|
+
{"commit":"cd0e945f0414da75fcda6791858d868210416e73","builtAt":"2026-10-10T02:56:29Z"}
|
package/dist/dispatch-form.js
CHANGED
|
@@ -8,7 +8,12 @@ import { refusalOf } from "./request/api-fetch.js";
|
|
|
8
8
|
import { EXIT, isRefusal } from "./store/exit.js";
|
|
9
9
|
import { buildBody, describeAudience, fillIn, fillPath, readWords, refuse, resolveContact, urlOf } from "./dispatch-words.js";
|
|
10
10
|
export const runForm = async (cfg, io, form, rest) => {
|
|
11
|
-
const
|
|
11
|
+
const words = form.dropLeadingWords !== undefined &&
|
|
12
|
+
rest.length > 0 &&
|
|
13
|
+
form.dropLeadingWords.includes(rest[0])
|
|
14
|
+
? rest.slice(1)
|
|
15
|
+
: rest;
|
|
16
|
+
const typed = readWords(form, words);
|
|
12
17
|
if (isRefusal(typed))
|
|
13
18
|
return typed;
|
|
14
19
|
const steps = form.steps ?? {};
|
|
@@ -36,6 +41,8 @@ export const runForm = async (cfg, io, form, rest) => {
|
|
|
36
41
|
}
|
|
37
42
|
if (selector !== undefined && isGroupWord(selector))
|
|
38
43
|
return refuse(groupsNotBuilt(selector));
|
|
44
|
+
if (steps.contact?.createIfMissing && selector?.includes('@'))
|
|
45
|
+
return refuse(`${form.usage}\n`);
|
|
39
46
|
if (steps.pipedNeedsYes && !io.stdin.isTTY && !typed.on.has('--yes')) {
|
|
40
47
|
return refuse(steps.pipedNeedsYes.message);
|
|
41
48
|
}
|
|
@@ -55,6 +62,7 @@ export const runForm = async (cfg, io, form, rest) => {
|
|
|
55
62
|
if (typeof accessToken !== 'string')
|
|
56
63
|
return accessToken;
|
|
57
64
|
let missingName;
|
|
65
|
+
let recording = false;
|
|
58
66
|
const reserved = [
|
|
59
67
|
...(steps.contact?.publicWord === undefined ? [] : [steps.contact.publicWord]),
|
|
60
68
|
...(steps.contact?.reserved ?? [])
|
|
@@ -95,6 +103,27 @@ export const runForm = async (cfg, io, form, rest) => {
|
|
|
95
103
|
missingName = resolution.displayName;
|
|
96
104
|
}
|
|
97
105
|
}
|
|
106
|
+
if (steps.contact?.email && context.reserved === undefined && !wantsPublic) {
|
|
107
|
+
const rule = steps.contact.email;
|
|
108
|
+
const typedEmail = typed.flags[rule.flag]?.trim();
|
|
109
|
+
const held = context.contact?.email || undefined;
|
|
110
|
+
const name = sanitizeForTerminal(context.contact?.displayName ?? missingName ?? '');
|
|
111
|
+
if (typedEmail === undefined && held === undefined) {
|
|
112
|
+
return refuse(fillIn(missingName === undefined ? rule.required : rule.requiredNew, { name }));
|
|
113
|
+
}
|
|
114
|
+
if (typedEmail !== undefined &&
|
|
115
|
+
held !== undefined &&
|
|
116
|
+
typedEmail.toLowerCase() !== held.toLowerCase()) {
|
|
117
|
+
return refuse(fillIn(rule.conflict, {
|
|
118
|
+
name,
|
|
119
|
+
typed: sanitizeForTerminal(typedEmail),
|
|
120
|
+
held: sanitizeForTerminal(held),
|
|
121
|
+
'contact.id': context.contact?.id ?? ''
|
|
122
|
+
}), EXIT.GENERIC);
|
|
123
|
+
}
|
|
124
|
+
context.email = held ?? typedEmail;
|
|
125
|
+
recording = held === undefined && context.contact !== undefined;
|
|
126
|
+
}
|
|
98
127
|
if (steps.memory === 'always' || (steps.memory === 'at-tty' && io.stdin.isTTY)) {
|
|
99
128
|
const fetched = await io.api(accessToken, `${cfg.apiUrl}/memories/${encodeURIComponent(typed.positionals[0])}`);
|
|
100
129
|
if (!fetched.ok)
|
|
@@ -114,12 +143,15 @@ export const runForm = async (cfg, io, form, rest) => {
|
|
|
114
143
|
const name = sanitizeForTerminal(context.contact?.displayName ?? missingName ?? '');
|
|
115
144
|
const question = fillIn(missingName !== undefined && steps.confirm.whenMissing
|
|
116
145
|
? steps.confirm.whenMissing
|
|
117
|
-
: steps.confirm.
|
|
146
|
+
: recording && steps.confirm.whenRecording
|
|
147
|
+
? steps.confirm.whenRecording
|
|
148
|
+
: steps.confirm.question, {
|
|
118
149
|
...Object.fromEntries(typed.positionals.map((p, i) => [`p${i}`, sanitizeForTerminal(p)])),
|
|
119
150
|
name,
|
|
120
151
|
title: sanitizeForTerminal(context.memory?.title ?? '(untitled)'),
|
|
121
152
|
'memory.id': context.memory?.id ?? '',
|
|
122
153
|
'contact.id': context.contact?.id ?? '',
|
|
154
|
+
email: sanitizeForTerminal(context.email ?? ''),
|
|
123
155
|
audience: context.contact?.displayName ?? describeAudience(selector ?? '')
|
|
124
156
|
});
|
|
125
157
|
const answer = await confirmAction(io, question);
|
|
@@ -138,7 +170,11 @@ export const runForm = async (cfg, io, form, rest) => {
|
|
|
138
170
|
const created = await io.api(accessToken, `${cfg.apiUrl}/contacts`, {
|
|
139
171
|
method: 'POST',
|
|
140
172
|
headers: { 'Content-Type': 'application/json' },
|
|
141
|
-
body: JSON.stringify({
|
|
173
|
+
body: JSON.stringify({
|
|
174
|
+
displayName: missingName,
|
|
175
|
+
type: 'person',
|
|
176
|
+
...(context.email === undefined ? {} : { email: context.email })
|
|
177
|
+
})
|
|
142
178
|
});
|
|
143
179
|
if (!created.ok)
|
|
144
180
|
return refusalOf(created);
|
|
@@ -146,6 +182,18 @@ export const runForm = async (cfg, io, form, rest) => {
|
|
|
146
182
|
context.createdContact = true;
|
|
147
183
|
body = buildBody(form, typed, stdin, context);
|
|
148
184
|
}
|
|
185
|
+
else if (recording && context.contact !== undefined) {
|
|
186
|
+
const updated = await io.api(accessToken, `${cfg.apiUrl}/contacts/${encodeURIComponent(context.contact.id)}`, {
|
|
187
|
+
method: 'PATCH',
|
|
188
|
+
headers: { 'Content-Type': 'application/json' },
|
|
189
|
+
body: JSON.stringify({ email: context.email })
|
|
190
|
+
});
|
|
191
|
+
if (!updated.ok)
|
|
192
|
+
return refusalOf(updated);
|
|
193
|
+
context.contact = updated.data;
|
|
194
|
+
context.recordedEmail = true;
|
|
195
|
+
body = buildBody(form, typed, stdin, context);
|
|
196
|
+
}
|
|
149
197
|
else if (context.contact !== undefined || wantsPublic || context.reserved !== undefined) {
|
|
150
198
|
body = buildBody(form, typed, stdin, context);
|
|
151
199
|
}
|
package/dist/dispatch-words.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { resolveContact } from "./render/rows.js";
|
|
2
|
-
import { renderRunHint } from "./render/text.js";
|
|
2
|
+
import { renderRunHint, sanitizeForTerminal } from "./render/text.js";
|
|
3
3
|
import { parseArgs } from "./request/flags.js";
|
|
4
4
|
import { EXIT, refusal } from "./store/exit.js";
|
|
5
5
|
import { isUuidKey } from "./store/write-identity.js";
|
|
6
6
|
export const refuse = (message, exit = EXIT.USAGE) => refusal(message, exit);
|
|
7
7
|
export const fillIn = (template, values) => template.replace(/\{([\w.]+)(?::([^}]*))?\}/g, (_m, key, arg) => key === 'hint' ? renderRunHint((arg ?? '').split(' ')) : (values[key] ?? ''));
|
|
8
|
+
const looksLikeAnAddress = (word) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(word);
|
|
8
9
|
export const readWords = (form, rest) => {
|
|
9
10
|
const on = new Set();
|
|
10
11
|
const counts = new Map();
|
|
@@ -22,6 +23,11 @@ export const readWords = (form, rest) => {
|
|
|
22
23
|
}
|
|
23
24
|
if (notAnId !== undefined)
|
|
24
25
|
return refuse(notAnId);
|
|
26
|
+
if (form.joinPositionals && positionals.length > 1) {
|
|
27
|
+
if (positionals.some((word) => isUuidKey(word)))
|
|
28
|
+
return refuse(`${form.usage}\n`);
|
|
29
|
+
positionals.splice(0, positionals.length, positionals.join(' '));
|
|
30
|
+
}
|
|
25
31
|
const typed = { positionals, flags: flags, on };
|
|
26
32
|
const tooMany = form.positionalsAtMost ?? form.positionals;
|
|
27
33
|
if (positionals.length < form.positionals ||
|
|
@@ -61,6 +67,12 @@ export const readWords = (form, rest) => {
|
|
|
61
67
|
return refuse(fillIn(rule.message, { value }));
|
|
62
68
|
}
|
|
63
69
|
}
|
|
70
|
+
for (const rule of form.addressFlags ?? []) {
|
|
71
|
+
const value = typed.flags[rule.key];
|
|
72
|
+
if (value !== undefined && !looksLikeAnAddress(value.trim())) {
|
|
73
|
+
return refuse(fillIn(rule.message, { value: sanitizeForTerminal(value.trim()) }));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
64
76
|
for (const rule of form.requireWhen ?? []) {
|
|
65
77
|
const value = typed.flags[rule.key];
|
|
66
78
|
if (value !== undefined &&
|
|
@@ -78,8 +90,9 @@ export const valueOf = (source, typed, stdin, context) => {
|
|
|
78
90
|
return typed.positionals[source.positional];
|
|
79
91
|
if ('stdin' in source)
|
|
80
92
|
return stdin;
|
|
81
|
-
if ('context' in source)
|
|
82
|
-
return context.contact?.id;
|
|
93
|
+
if ('context' in source) {
|
|
94
|
+
return source.context === 'email' ? context.email : context.contact?.id;
|
|
95
|
+
}
|
|
83
96
|
if (!('switch' in source))
|
|
84
97
|
return source.value;
|
|
85
98
|
return typed.on.has(source.switch) ? source.value : source.otherwise;
|
package/dist/dispatch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveVerb } from "./nouns/words.js";
|
|
2
2
|
import { renderRefusal } from "./render/output.js";
|
|
3
3
|
import { sanitizeForTerminal } from "./render/text.js";
|
|
4
4
|
import { HELP_TOKENS } from "./request/flags.js";
|
|
@@ -18,8 +18,8 @@ export const dispatch = async (cfg, io, registry, argv) => {
|
|
|
18
18
|
const typedWord = argv[0];
|
|
19
19
|
if (typedWord === undefined)
|
|
20
20
|
return false;
|
|
21
|
-
const word = VERB_ALIASES[typedWord] ?? typedWord;
|
|
22
21
|
const rest = argv.slice(1);
|
|
22
|
+
const word = resolveVerb(typedWord, rest[0]);
|
|
23
23
|
const nounFirst = registry.nouns.find((n) => n.grammar === 'noun-first' && wordsOf(n).includes(word));
|
|
24
24
|
if (nounFirst) {
|
|
25
25
|
const first = rest[0];
|
package/dist/entry/setup.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { dirname, join, resolve } from 'node:path';
|
|
2
3
|
import { promptLine } from "../render/prompt.js";
|
|
3
4
|
import { LATTRIS_PERMISSION_RULE, SETUP_FLAG_NAMES, SETUP_HELP, buildBootFile, buildTransitionInstructions, parseBootRootId, withLattrisPermission } from "../entry/setup-boot.js";
|
|
4
5
|
import { parseArgs } from "../request/flags.js";
|
|
5
6
|
import { HELP_TOKENS } from "../request/flags.js";
|
|
6
7
|
import { sanitizeForTerminal } from "../render/text.js";
|
|
7
|
-
import { refusal } from "../store/exit.js";
|
|
8
|
+
import { isRefusal, refusal } from "../store/exit.js";
|
|
8
9
|
import { refusalOf } from "../request/api-fetch.js";
|
|
9
10
|
import { signedIn } from "../request/access-token.js";
|
|
11
|
+
import { noteWriteHeaders, requireWriteIdentity } from "../store/write-identity.js";
|
|
10
12
|
export const promptAnswer = (answer) => {
|
|
11
13
|
if (answer === null)
|
|
12
14
|
return 'no';
|
|
@@ -91,6 +93,13 @@ export const setup = async (cfg, io, args) => {
|
|
|
91
93
|
return;
|
|
92
94
|
}
|
|
93
95
|
}
|
|
96
|
+
let identity;
|
|
97
|
+
if (flags.root === undefined) {
|
|
98
|
+
const found = requireWriteIdentity(io.store, io.stdin.isTTY);
|
|
99
|
+
if (isRefusal(found))
|
|
100
|
+
return found;
|
|
101
|
+
identity = found;
|
|
102
|
+
}
|
|
94
103
|
let name = flags.name;
|
|
95
104
|
if (flags.root === undefined && name === undefined) {
|
|
96
105
|
if (!io.stdin.isTTY) {
|
|
@@ -118,7 +127,10 @@ export const setup = async (cfg, io, args) => {
|
|
|
118
127
|
else {
|
|
119
128
|
const created = await io.api(accessToken, `${cfg.apiUrl}/memories/notes`, {
|
|
120
129
|
method: 'POST',
|
|
121
|
-
headers: {
|
|
130
|
+
headers: {
|
|
131
|
+
'Content-Type': 'application/json',
|
|
132
|
+
...(identity ? noteWriteHeaders(identity, randomUUID()) : {})
|
|
133
|
+
},
|
|
122
134
|
body: JSON.stringify({
|
|
123
135
|
title: name,
|
|
124
136
|
content: 'Root of this memory tree. Freshly scaffolded by `lattris setup` — ' +
|
package/dist/main.js
CHANGED
|
@@ -17,7 +17,7 @@ import { machinesRoot, resolveActorDir, resolveSessionHome, stateHome } from "./
|
|
|
17
17
|
import { sessionIdentityWarning } from "./store/session.js";
|
|
18
18
|
import { currentPackageVersion, printVersion } from "./version.js";
|
|
19
19
|
import { checkForNewVersion } from "./request/version-check.js";
|
|
20
|
-
import { COMMAND_WORDS,
|
|
20
|
+
import { COMMAND_WORDS, resolveVerb } from "./nouns/words.js";
|
|
21
21
|
import { validAccessToken } from "./request/access-token.js";
|
|
22
22
|
import { apiFetch } from "./request/api-fetch.js";
|
|
23
23
|
import { ask, readAll } from "./request/stdin.js";
|
|
@@ -147,11 +147,7 @@ const main = async () => {
|
|
|
147
147
|
if (isRefusal(cfg))
|
|
148
148
|
return cfg;
|
|
149
149
|
const rawCommand = argv[2];
|
|
150
|
-
const command = rawCommand !== undefined
|
|
151
|
-
? Object.hasOwn(VERB_ALIASES, rawCommand)
|
|
152
|
-
? VERB_ALIASES[rawCommand]
|
|
153
|
-
: rawCommand
|
|
154
|
-
: rawCommand;
|
|
150
|
+
const command = rawCommand !== undefined ? resolveVerb(rawCommand, argv[3]) : rawCommand;
|
|
155
151
|
void checkForNewVersion({ files: here.files, network: io.network, stderr: io.stderr }, {
|
|
156
152
|
currentVersion: currentPackageVersion(here.files),
|
|
157
153
|
stateDir: join(stateHome(here), 'lattris'),
|
package/dist/memory/access.js
CHANGED
|
@@ -7,7 +7,8 @@ import { refusalOf } from "../request/api-fetch.js";
|
|
|
7
7
|
import { EXIT, refusal } from "../store/exit.js";
|
|
8
8
|
export const GET_ACCESS_HELP = [
|
|
9
9
|
'get access — may one contact, or one phone number, see a memory of yours,',
|
|
10
|
-
'and because of which share.',
|
|
10
|
+
'or one someone shared with you, and because of which share. For a shared',
|
|
11
|
+
"memory the answer comes from your own shares and the owner's public one.",
|
|
11
12
|
'',
|
|
12
13
|
'Usage:',
|
|
13
14
|
' lattris get access <memory-id-or-prefix> --for <contact | number>',
|
|
@@ -24,18 +25,17 @@ export const GET_ACCESS_HELP = [
|
|
|
24
25
|
const ACCESS_FLAGS = { '--for': 'for' };
|
|
25
26
|
const isPhoneWord = (word) => word.startsWith('+');
|
|
26
27
|
const formatAccessDecision = (d, asked) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const stranger = d.forContact === null ? ` (${describeForContact(null, asked)})` : '';
|
|
28
|
+
const contact = d.forContact ?? null;
|
|
29
|
+
const who = contact === null ? sanitizeForTerminal(asked) : sanitizeForTerminal(contact.displayName);
|
|
30
|
+
const stranger = contact === null ? ` (${describeForContact(null, asked)})` : '';
|
|
31
31
|
const verdict = d.open
|
|
32
32
|
? `open — ${who} may see it${stranger}`
|
|
33
33
|
: `shut — ${who} may not see it${stranger}`;
|
|
34
|
-
const because = d.decidedBy.length === 0
|
|
35
|
-
?
|
|
34
|
+
const because = (d.decidedBy ?? []).length === 0
|
|
35
|
+
? contact === null
|
|
36
36
|
? 'because: no public share'
|
|
37
37
|
: 'because: nothing is set for them'
|
|
38
|
-
: `because: ${d.decidedBy.map(formatAccessRow).join('; ')}`;
|
|
38
|
+
: `because: ${(d.decidedBy ?? []).map(formatAccessRow).join('; ')}`;
|
|
39
39
|
return `${verdict}\n${because}`;
|
|
40
40
|
};
|
|
41
41
|
export const contactIdFor = async (cfg, io, accessToken, word) => {
|
package/dist/memory/get-help.js
CHANGED
|
@@ -34,9 +34,11 @@ export const GET_HELP = [
|
|
|
34
34
|
' session needs it, while a full address carries it',
|
|
35
35
|
' --shared-with-me list memories other people granted to you; each row',
|
|
36
36
|
' names its owner and whether it is on your graph',
|
|
37
|
-
' --for <contact> what one of your contacts may see of your memories
|
|
38
|
-
' exact name or id from
|
|
39
|
-
'
|
|
37
|
+
' --for <contact> what one of your contacts may see of your memories and',
|
|
38
|
+
' of the ones shared with you: an exact name or id from',
|
|
39
|
+
' `lattris contact list`. The rows carry what they would',
|
|
40
|
+
' see, a row of another owner names them, and the first',
|
|
41
|
+
' line names the contact',
|
|
40
42
|
' --for-phone <number> the same for a phone number in full international',
|
|
41
43
|
' form; a number no contact holds is a stranger, who',
|
|
42
44
|
' sees public memories only',
|
package/dist/memory/views.js
CHANGED
|
@@ -3,9 +3,10 @@ import { sanitizeForTerminal } from "../render/text.js";
|
|
|
3
3
|
import { stripTrailingSlash } from "../store/environment.js";
|
|
4
4
|
export const formatDeletedLine = (b) => `${b.id} ${b.deletedAt ?? '-'} rev ${b.revisionNo ?? '-'} ${b.fingerprint ?? '-'} ${sanitizeForTerminal(b.title ?? '(untitled)')}`;
|
|
5
5
|
export const formatDeletedPage = (page) => page.items.map((i) => formatDeletedLine(i)).join('\n');
|
|
6
|
+
const graphWord = (b) => b.consented === undefined ? '' : `${b.consented ? 'on graph' : 'off graph'} `;
|
|
6
7
|
export const formatBlockLine = (b) => b.ownerHandle === undefined
|
|
7
8
|
? `${b.id} ${b.handle} ${b.capturedAt} ${b.intent ?? '-'} ${b.visibility.public ? 'public' : '-'} ${sanitizeForTerminal(b.title ?? '(untitled)')}`
|
|
8
|
-
: `${b.id} ${b.handle} ${b.capturedAt} by ${sanitizeForTerminal(b.ownerDisplayName ?? b.ownerHandle)} (@${b.ownerHandle}) ${b
|
|
9
|
+
: `${b.id} ${b.handle} ${b.capturedAt} by ${sanitizeForTerminal(b.ownerDisplayName ?? b.ownerHandle)} (@${b.ownerHandle}) ${graphWord(b)}${sanitizeForTerminal(b.title ?? '(untitled)')}`;
|
|
9
10
|
const SLUG_MAX = 60;
|
|
10
11
|
const slugify = (title) => (title ?? '')
|
|
11
12
|
.toLowerCase()
|
package/dist/nouns/contact.js
CHANGED
|
@@ -20,22 +20,37 @@ const CONTACT_HELP = [
|
|
|
20
20
|
' it at a block of yours (an AI role at its page)',
|
|
21
21
|
' lattris contact delete <id-or-name> [--yes] remove a contact nothing holds on to: asks at a',
|
|
22
22
|
' terminal, needs --yes on a pipe',
|
|
23
|
+
' lattris contact link <id-or-name> --handle <h>',
|
|
24
|
+
' ask the account at that handle to let this',
|
|
25
|
+
' contact stand for it; they accept from their inbox',
|
|
23
26
|
'',
|
|
24
27
|
' --email <v> the address you keep for this contact. It is your record',
|
|
25
28
|
' alone: the contact never sees it, nobody else reads it,',
|
|
26
29
|
' and changing it asks nobody',
|
|
27
|
-
' --phone <v> the number
|
|
30
|
+
' --phone <v> the number this contact is reached at, in full',
|
|
28
31
|
' international form: + then digits, like +61412345678.',
|
|
29
32
|
' One per contact, and no two of your contacts may hold',
|
|
30
|
-
' one number.
|
|
33
|
+
' one number.',
|
|
31
34
|
' --root <block-id> the full id of one of your own blocks, never a prefix; the',
|
|
32
35
|
' API refuses a block you do not own',
|
|
36
|
+
' --handle <h> the public address of the account you are asking, as it',
|
|
37
|
+
' appears at /by/<handle>. A handle that names nobody is',
|
|
38
|
+
' answered exactly as one that names an account, and nothing',
|
|
39
|
+
' is sent, so a typo is not told apart from a private page',
|
|
33
40
|
'',
|
|
34
41
|
'A contact shows "linked" once it stands for a Lattris account: yours are',
|
|
35
42
|
'linked when someone accepts the invitation you minted for that contact,',
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'a
|
|
43
|
+
'or the link request you sent for it, and the person who invited or asked',
|
|
44
|
+
'you appears among your contacts, linked, the moment you accept. A share',
|
|
45
|
+
'or a deny names any contact, linked or not; a linked contact also sees a',
|
|
46
|
+
'share on the website.',
|
|
47
|
+
'',
|
|
48
|
+
'A link request carries your name and handle to their inbox, nothing else:',
|
|
49
|
+
'not the name you keep for them, not their email. They answer with',
|
|
50
|
+
'`lattris accept contact <id>` or `lattris decline contact <id>`; a decline',
|
|
51
|
+
'is not reported back. The newest ask stands: asking again for a different',
|
|
52
|
+
'account, or a handle that names nobody, takes the earlier request back.',
|
|
53
|
+
'You see the outcome where you see a share: the contact reads linked.',
|
|
39
54
|
'',
|
|
40
55
|
'Another person’s contact is not yours to read or change: the API answers',
|
|
41
56
|
'not found. A block names a contact with --contributor <id>, on capture and',
|
|
@@ -43,7 +58,7 @@ const CONTACT_HELP = [
|
|
|
43
58
|
'',
|
|
44
59
|
'A contact that contributed a memory, that an invitation links, or that a',
|
|
45
60
|
'deny names cannot be deleted: the API refuses and says which. A deny is',
|
|
46
|
-
'lifted with `lattris
|
|
61
|
+
'lifted with `lattris remove deny <id> --to <contact>` first, so the same',
|
|
47
62
|
'number added back later never skips it.'
|
|
48
63
|
].join('\n');
|
|
49
64
|
const deniedBlocksWords = (body, contactId) => {
|
|
@@ -53,8 +68,8 @@ const deniedBlocksWords = (body, contactId) => {
|
|
|
53
68
|
if (!Array.isArray(blocks) || blocks.length === 0)
|
|
54
69
|
return '';
|
|
55
70
|
const lines = blocks.map((b) => ` ${b.id} ${sanitizeForTerminal(b.title ?? '(untitled)')} — ${renderRunHint([
|
|
56
|
-
'
|
|
57
|
-
'
|
|
71
|
+
'remove',
|
|
72
|
+
'deny',
|
|
58
73
|
b.id,
|
|
59
74
|
'--to',
|
|
60
75
|
contactId
|
|
@@ -197,6 +212,26 @@ export const contacts = {
|
|
|
197
212
|
refusalWords: (body, context) => deniedBlocksWords(body, context.contact?.id ?? ''),
|
|
198
213
|
renderTo: 'stderr',
|
|
199
214
|
render: (_answer, context) => `Deleted contact ${sanitizeForTerminal(context.contact?.displayName ?? context.positionals[0])}`
|
|
215
|
+
},
|
|
216
|
+
link: {
|
|
217
|
+
usage: 'Usage: lattris contact link <id-or-name> --handle <h>',
|
|
218
|
+
flags: { '--handle': 'handle' },
|
|
219
|
+
positionals: 1,
|
|
220
|
+
idPositionals: [0],
|
|
221
|
+
requiredFlags: ['handle'],
|
|
222
|
+
steps: {
|
|
223
|
+
contact: {
|
|
224
|
+
from: ['p0'],
|
|
225
|
+
mustBePerson: '{name} is an AI contact; only a person contact can stand for an account.\n'
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
request: {
|
|
229
|
+
method: 'POST',
|
|
230
|
+
path: '/contacts/{contact.id}/link',
|
|
231
|
+
body: { handle: { flag: 'handle' } }
|
|
232
|
+
},
|
|
233
|
+
renderAlways: true,
|
|
234
|
+
render: (_answer, context) => `Asked @${sanitizeForTerminal(context.flags.handle ?? '')} to let ${sanitizeForTerminal(context.contact?.displayName ?? context.positionals[0])} stand for their account. They answer from their inbox; the contact reads linked once they accept.`
|
|
200
235
|
}
|
|
201
236
|
})
|
|
202
237
|
};
|
package/dist/nouns/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import { CONSENT_HELP } from "./consent.js";
|
|
|
5
5
|
import { datasets } from "./datasets.js";
|
|
6
6
|
import { LINK_HELP, edges } from "./edges.js";
|
|
7
7
|
import { INVITE_HELP, invites } from "./invite.js";
|
|
8
|
-
import { ASK_HELP, CLOSE_HELP, CLOSE_USAGE, questions } from "./questions.js";
|
|
9
|
-
import { DENY_HELP,
|
|
8
|
+
import { ACCEPT_HELP, ACCEPT_USAGE, ASK_HELP, CLOSE_HELP, CLOSE_USAGE, DECLINE_HELP, DECLINE_USAGE, questions } from "./questions.js";
|
|
9
|
+
import { DENY_HELP, REMOVE_DENY_HELP, SHARE_HELP, UNSHARE_HELP, grants } from "./share.js";
|
|
10
10
|
export const listNouns = [contacts, questions, edges, invites, grants, datasets];
|
|
11
11
|
export const listVerbs = {
|
|
12
12
|
ask: { help: ASK_HELP, helpBeforeAuth: true },
|
|
@@ -16,6 +16,18 @@ export const listVerbs = {
|
|
|
16
16
|
bareIsHelp: true,
|
|
17
17
|
badNoun: { stderr: `${CLOSE_USAGE}\n` }
|
|
18
18
|
},
|
|
19
|
+
accept: {
|
|
20
|
+
help: ACCEPT_HELP,
|
|
21
|
+
helpBeforeAuth: true,
|
|
22
|
+
bareIsHelp: true,
|
|
23
|
+
badNoun: { stderr: `${ACCEPT_USAGE}\n` }
|
|
24
|
+
},
|
|
25
|
+
decline: {
|
|
26
|
+
help: DECLINE_HELP,
|
|
27
|
+
helpBeforeAuth: true,
|
|
28
|
+
bareIsHelp: true,
|
|
29
|
+
badNoun: { stderr: `${DECLINE_USAGE}\n` }
|
|
30
|
+
},
|
|
19
31
|
link: { help: LINK_HELP, helpBeforeAuth: true, bareIsHelp: true },
|
|
20
32
|
unlink: { help: LINK_HELP, helpBeforeAuth: true, bareIsHelp: true },
|
|
21
33
|
invite: { help: INVITE_HELP },
|
|
@@ -36,8 +48,9 @@ export const listVerbs = {
|
|
|
36
48
|
bareIsHelp: true,
|
|
37
49
|
badNoun: { stderr: 'Usage: lattris deny memory <id> --to <all-contacts | contact>\n' }
|
|
38
50
|
},
|
|
51
|
+
remove: { help: REMOVE_DENY_HELP, helpBeforeAuth: true },
|
|
39
52
|
undeny: {
|
|
40
|
-
help:
|
|
53
|
+
help: REMOVE_DENY_HELP,
|
|
41
54
|
helpBeforeAuth: true,
|
|
42
55
|
bareIsHelp: true,
|
|
43
56
|
badNoun: {
|
package/dist/nouns/invite.js
CHANGED
|
@@ -3,15 +3,16 @@ import { sanitizeForTerminal } from "../render/text.js";
|
|
|
3
3
|
const inviteLink = (webUrl, token) => `${webUrl}/i/${token}`;
|
|
4
4
|
const formatInvite = (webUrl, i) => {
|
|
5
5
|
const label = i.targetName ? ` — ${sanitizeForTerminal(i.targetName)}` : '';
|
|
6
|
+
const admits = i.email ? `\n admits ${sanitizeForTerminal(i.email)}` : '';
|
|
6
7
|
if (i.redeemedAt) {
|
|
7
8
|
const who = i.redeemedBy
|
|
8
9
|
? `${sanitizeForTerminal(i.redeemedBy.displayName ?? i.redeemedBy.handle)} (${sanitizeForTerminal(i.redeemedBy.handle)})`
|
|
9
10
|
: 'someone';
|
|
10
|
-
return `taken${label}\n by ${who} on ${i.redeemedAt}`;
|
|
11
|
+
return `taken${label}${admits}\n by ${who} on ${i.redeemedAt}`;
|
|
11
12
|
}
|
|
12
13
|
if (i.revokedAt)
|
|
13
|
-
return `revoked${label}\n minted ${i.createdAt}`;
|
|
14
|
-
return `live${label}\n ${inviteLink(webUrl, i.token)}\n minted ${i.createdAt}`;
|
|
14
|
+
return `revoked${label}${admits}\n minted ${i.createdAt}`;
|
|
15
|
+
return `live${label}${admits}\n ${inviteLink(webUrl, i.token)}\n minted ${i.createdAt}`;
|
|
15
16
|
};
|
|
16
17
|
const INVITE_HELP = [
|
|
17
18
|
'invite — bring one person in.',
|
|
@@ -25,16 +26,22 @@ const INVITE_HELP = [
|
|
|
25
26
|
'when you send it.',
|
|
26
27
|
'',
|
|
27
28
|
'Usage:',
|
|
28
|
-
' lattris invite <contact-name-or-id> [--yes]',
|
|
29
|
-
' lattris invite --for <name-or-id> [--yes] compatibility spelling',
|
|
29
|
+
' lattris invite <contact-name-or-id> [--email <address>] [--yes]',
|
|
30
|
+
' lattris invite --for <name-or-id> [--email <address>] [--yes] compatibility spelling',
|
|
30
31
|
'',
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
32
|
+
'An invitation admits one email address: the one the person will sign up',
|
|
33
|
+
'with. The contact must be one of yours. A name is matched exactly, ignoring',
|
|
34
|
+
'case, and a name of more than one word needs no quotes. If that name does',
|
|
35
|
+
'not exist, a person contact is created holding that email before minting.',
|
|
36
|
+
'A contact that already holds an email needs no --email, and its email is',
|
|
37
|
+
'the one sent; one that holds a different email is refused, never changed.',
|
|
38
|
+
'A contact holding none has the email recorded on it first. Duplicate names',
|
|
39
|
+
'are never guessed: use the contact id shown by `lattris contact list`.',
|
|
35
40
|
'',
|
|
36
|
-
' --
|
|
37
|
-
'
|
|
41
|
+
' --email <address> the address the invitation admits; needed unless the',
|
|
42
|
+
' contact already holds one',
|
|
43
|
+
' --yes required when not at a terminal (there is no prompt',
|
|
44
|
+
' to answer there); at a terminal you are always asked.',
|
|
38
45
|
'',
|
|
39
46
|
'To see the ones you have out: lattris get invites'
|
|
40
47
|
].join('\n');
|
|
@@ -42,33 +49,52 @@ const inviteVerb = {
|
|
|
42
49
|
verb: 'invite',
|
|
43
50
|
form: {
|
|
44
51
|
usage: INVITE_HELP,
|
|
45
|
-
flags: { '--for': 'for' },
|
|
52
|
+
flags: { '--for': 'for', '--email': 'email' },
|
|
46
53
|
switches: ['--yes'],
|
|
47
54
|
positionals: 0,
|
|
48
55
|
positionalsAtMost: 1,
|
|
56
|
+
joinPositionals: true,
|
|
49
57
|
contradictions: [{ a: 'p0', b: 'for', message: `${INVITE_HELP}\n` }],
|
|
58
|
+
addressFlags: [{ key: 'email', message: '--email takes an email address, not "{value}".\n' }],
|
|
50
59
|
steps: {
|
|
51
60
|
contact: {
|
|
52
61
|
from: ['p0', 'flag:for'],
|
|
53
62
|
required: 'A contact name or id is required.\n',
|
|
54
63
|
mustBePerson: '{name} is an AI contact. An invitation must go to a person contact.\n',
|
|
55
|
-
createIfMissing: true
|
|
64
|
+
createIfMissing: true,
|
|
65
|
+
email: {
|
|
66
|
+
flag: 'email',
|
|
67
|
+
required: 'No email for {name}: an invitation admits one address, and this contact holds none. Pass --email <address>.\n',
|
|
68
|
+
requiredNew: '{name} is not among your contacts. Creating them for an invitation needs --email <address>.\n',
|
|
69
|
+
conflict: '{name} holds {held}, and --email says {typed}. Pass the one the contact holds, or change it first: lattris contact update {contact.id} --email <address>\n'
|
|
70
|
+
}
|
|
56
71
|
},
|
|
57
72
|
pipedNeedsYes: {
|
|
58
73
|
message: 'Refusing to mint without confirmation. Pass --yes once the person has asked you to invite someone.\n'
|
|
59
74
|
},
|
|
60
75
|
confirm: {
|
|
61
|
-
question: 'Mint an invitation for {name}? [y/N] ',
|
|
62
|
-
whenMissing: 'Create person contact "{name}" and mint their invitation? [y/N] ',
|
|
76
|
+
question: 'Mint an invitation for {name}, admitting {email}? [y/N] ',
|
|
77
|
+
whenMissing: 'Create person contact "{name}" holding {email}, and mint their invitation? [y/N] ',
|
|
78
|
+
whenRecording: 'Record {email} on {name}, and mint their invitation? [y/N] ',
|
|
63
79
|
onNo: { text: 'Not minted.\n', to: 'stdout' }
|
|
64
80
|
}
|
|
65
81
|
},
|
|
66
|
-
request: {
|
|
82
|
+
request: {
|
|
83
|
+
method: 'POST',
|
|
84
|
+
path: '/invites',
|
|
85
|
+
body: { contactId: { context: 'contact.id' }, email: { context: 'email' } }
|
|
86
|
+
},
|
|
67
87
|
render: (data, context) => {
|
|
68
88
|
const i = data;
|
|
69
89
|
const contact = context.contact;
|
|
70
|
-
|
|
71
|
-
|
|
90
|
+
const admitted = sanitizeForTerminal(i.email ?? context.email ?? '');
|
|
91
|
+
const first = context.createdContact
|
|
92
|
+
? `Recorded person contact ${formatContact(contact)}.\n\n`
|
|
93
|
+
: context.recordedEmail
|
|
94
|
+
? `Recorded ${admitted} on ${sanitizeForTerminal(contact.displayName)}.\n\n`
|
|
95
|
+
: '';
|
|
96
|
+
return (first +
|
|
97
|
+
`Invitation minted${i.targetName ? ` for ${sanitizeForTerminal(i.targetName)}` : ''}, admitting ${admitted}.\n\n` +
|
|
72
98
|
` ${inviteLink(context.webUrl, i.token)}\n\n` +
|
|
73
99
|
`Hand it to ONE person — it is spent when someone signs up with it.\n` +
|
|
74
100
|
`It is not permission to join; whether they may register is decided separately.\n` +
|
|
@@ -84,7 +110,7 @@ const getInvites = {
|
|
|
84
110
|
positionals: 0,
|
|
85
111
|
request: { method: 'GET', path: '/invites' },
|
|
86
112
|
render: (list, context) => list.length === 0
|
|
87
|
-
? 'No invitations yet. `lattris invite <contact>` mints one.'
|
|
113
|
+
? 'No invitations yet. `lattris invite <contact> --email <address>` mints one.'
|
|
88
114
|
: list.map((i) => formatInvite(context.webUrl, i)).join('\n\n')
|
|
89
115
|
}
|
|
90
116
|
};
|
package/dist/nouns/questions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatAsked, formatClosed, formatQuestionList } from "../render/rows.js";
|
|
1
|
+
import { formatAsked, formatClosed, formatLinkAnswer, formatQuestionList } from "../render/rows.js";
|
|
2
2
|
export const ASK_HELP = [
|
|
3
3
|
'ask — leave a question on someone’s tree.',
|
|
4
4
|
'',
|
|
@@ -106,11 +106,64 @@ const getQuestions = {
|
|
|
106
106
|
: 'No questions on your tree.'
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
+
const ACCEPT_USAGE = 'Usage: lattris accept contact <id-or-prefix>';
|
|
110
|
+
const DECLINE_USAGE = 'Usage: lattris decline contact <id-or-prefix>';
|
|
111
|
+
export const ACCEPT_HELP = [
|
|
112
|
+
'accept — say yes to a request in your inbox to link you as a contact.',
|
|
113
|
+
'',
|
|
114
|
+
ACCEPT_USAGE,
|
|
115
|
+
'',
|
|
116
|
+
' <id-or-prefix> the request’s full UUID, or a >=4-char hex prefix over',
|
|
117
|
+
' YOUR OWN link requests — an ambiguous prefix refuses and',
|
|
118
|
+
' lists the candidates, like `close question`',
|
|
119
|
+
'',
|
|
120
|
+
'Accepting links both sides at once: their contact comes to stand for your',
|
|
121
|
+
'account, and a contact naming them appears among yours, linked. If you',
|
|
122
|
+
'had asked them too, your contact from that request is the one linked and',
|
|
123
|
+
'that request closes as accepted as well. A request whose contact was',
|
|
124
|
+
'linked elsewhere meanwhile closes as superseded and links nothing.',
|
|
125
|
+
'Your inbox: lattris get questions'
|
|
126
|
+
].join('\n');
|
|
127
|
+
export const DECLINE_HELP = [
|
|
128
|
+
'decline — say no to a request in your inbox to link you as a contact.',
|
|
129
|
+
'',
|
|
130
|
+
DECLINE_USAGE,
|
|
131
|
+
'',
|
|
132
|
+
' <id-or-prefix> the request’s full UUID, or a >=4-char hex prefix over',
|
|
133
|
+
' YOUR OWN link requests',
|
|
134
|
+
'',
|
|
135
|
+
'Declining closes the request and changes nothing else; the person who',
|
|
136
|
+
'asked is not told. Your inbox: lattris get questions'
|
|
137
|
+
].join('\n');
|
|
138
|
+
const acceptVerb = {
|
|
139
|
+
verb: 'accept',
|
|
140
|
+
nouns: ['contact', 'contacts'],
|
|
141
|
+
form: {
|
|
142
|
+
usage: ACCEPT_USAGE,
|
|
143
|
+
idPositionals: [0],
|
|
144
|
+
positionals: 1,
|
|
145
|
+
unknownFlagIsUsage: true,
|
|
146
|
+
request: { method: 'POST', path: '/questions/{p0}/accept' },
|
|
147
|
+
render: (q) => formatLinkAnswer(q)
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const declineVerb = {
|
|
151
|
+
verb: 'decline',
|
|
152
|
+
nouns: ['contact', 'contacts'],
|
|
153
|
+
form: {
|
|
154
|
+
usage: DECLINE_USAGE,
|
|
155
|
+
idPositionals: [0],
|
|
156
|
+
positionals: 1,
|
|
157
|
+
unknownFlagIsUsage: true,
|
|
158
|
+
request: { method: 'POST', path: '/questions/{p0}/decline' },
|
|
159
|
+
render: (q) => formatLinkAnswer(q)
|
|
160
|
+
}
|
|
161
|
+
};
|
|
109
162
|
export const questions = {
|
|
110
163
|
name: 'questions',
|
|
111
164
|
words: { singular: 'question', plural: 'questions' },
|
|
112
165
|
help: CLOSE_HELP,
|
|
113
|
-
verbs: [askVerb, closeVerb, getQuestions]
|
|
166
|
+
verbs: [askVerb, closeVerb, getQuestions, acceptVerb, declineVerb]
|
|
114
167
|
};
|
|
115
|
-
export { CLOSE_USAGE };
|
|
168
|
+
export { ACCEPT_USAGE, CLOSE_USAGE, DECLINE_USAGE };
|
|
116
169
|
//# sourceMappingURL=questions.js.map
|
package/dist/nouns/share.js
CHANGED
|
@@ -8,7 +8,8 @@ const PUBLIC_CANNOT_BE_DENIED = 'public cannot be denied: a deny names a contact
|
|
|
8
8
|
export const SHARE_HELP = [
|
|
9
9
|
'share — allow an audience to see a memory: public, all your contacts,',
|
|
10
10
|
'or one contact. A contact needs no Lattris account; a linked contact also',
|
|
11
|
-
'sees it on the website.',
|
|
11
|
+
'sees it on the website. A memory someone shared with you takes a contact',
|
|
12
|
+
"share too, for your own contacts; public is the owner's alone.",
|
|
12
13
|
'',
|
|
13
14
|
'Usage:',
|
|
14
15
|
' lattris share memory <id-or-prefix> --with <public | all-contacts | contact> [--yes]',
|
|
@@ -21,14 +22,15 @@ export const SHARE_HELP = [
|
|
|
21
22
|
' asked, --yes or not.',
|
|
22
23
|
'',
|
|
23
24
|
'A deny on the memory beats any allow: the answer names who is still shut',
|
|
24
|
-
'out, and `lattris
|
|
25
|
-
'has access succeeds and changes nothing.',
|
|
25
|
+
'out, and `lattris remove deny` lifts it. Sharing with an audience that',
|
|
26
|
+
'already has access succeeds and changes nothing.',
|
|
26
27
|
'',
|
|
27
28
|
'Alias: publish → share'
|
|
28
29
|
].join('\n');
|
|
29
30
|
export const DENY_HELP = [
|
|
30
31
|
'deny — shut a memory to one contact or to all your contacts, whatever',
|
|
31
|
-
'else allows it. Nothing is asked: a deny is the safe direction.',
|
|
32
|
+
'else allows it. Nothing is asked: a deny is the safe direction. A memory',
|
|
33
|
+
'someone shared with you takes a deny too, for your own contacts.',
|
|
32
34
|
'',
|
|
33
35
|
'Usage:',
|
|
34
36
|
' lattris deny memory <id-or-prefix> --to <all-contacts | contact>',
|
|
@@ -39,15 +41,18 @@ export const DENY_HELP = [
|
|
|
39
41
|
'',
|
|
40
42
|
'A deny cannot hold while the memory is public or shared on the website',
|
|
41
43
|
'with the person it would shut out; the refusal names the share in the',
|
|
42
|
-
'way. `lattris
|
|
44
|
+
'way. `lattris remove deny` lifts a deny.'
|
|
43
45
|
].join('\n');
|
|
44
|
-
export const
|
|
45
|
-
'
|
|
46
|
+
export const REMOVE_DENY_HELP = [
|
|
47
|
+
'remove deny — lift a deny from a memory, for one contact or for all your',
|
|
46
48
|
'contacts. It opens the memory to whatever allows it, so it asks at a',
|
|
47
|
-
'terminal and needs --yes on a pipe.',
|
|
49
|
+
'terminal and needs --yes on a pipe. A memory someone shared with you',
|
|
50
|
+
'takes it too, for your own denies.',
|
|
48
51
|
'',
|
|
49
52
|
'Usage:',
|
|
50
|
-
' lattris
|
|
53
|
+
' lattris remove deny [memory] <id-or-prefix> --to <all-contacts | contact> [--yes]',
|
|
54
|
+
'',
|
|
55
|
+
'Alias: undeny memory <id> → remove deny <id>'
|
|
51
56
|
].join('\n');
|
|
52
57
|
const isAccessGrant = (grant) => typeof grant === 'object' &&
|
|
53
58
|
grant !== null &&
|
|
@@ -87,7 +92,7 @@ const otherEffectWords = (asked) => (body, context) => {
|
|
|
87
92
|
const id = context.memory?.id ?? context.positionals[0];
|
|
88
93
|
const who = context.contact?.id ?? ALL_CONTACTS;
|
|
89
94
|
return found === 'deny'
|
|
90
|
-
? `This is a deny, not a share. Lift it with: ${renderRunHint(['
|
|
95
|
+
? `This is a deny, not a share. Lift it with: ${renderRunHint(['remove', 'deny', id, '--to', who])}\n`
|
|
91
96
|
: `This is a share, not a deny. Withdraw it with: ${renderRunHint(['unshare', 'memory', id, '--with', who])}\n`;
|
|
92
97
|
};
|
|
93
98
|
const inTheWay = (body) => {
|
|
@@ -162,46 +167,49 @@ const denyVerb = {
|
|
|
162
167
|
render: (_grant, context) => `Denied memory ${context.positionals[0]} to ${context.contact ? sanitizeForTerminal(context.contact.displayName) : 'all contacts'}`
|
|
163
168
|
}
|
|
164
169
|
};
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
requireFlag: { key: 'to', message: DENY_WORDS },
|
|
176
|
-
pipedNeedsYes: {
|
|
177
|
-
message: 'Refusing to lift a deny without confirmation on a non-interactive session. Pass --yes to skip the prompt.\n'
|
|
178
|
-
},
|
|
179
|
-
contact: {
|
|
180
|
-
from: ['flag:to'],
|
|
181
|
-
reserved: [ALL_CONTACTS],
|
|
182
|
-
refusedWords: { public: PUBLIC_CANNOT_BE_DENIED }
|
|
183
|
-
},
|
|
184
|
-
memory: 'at-tty',
|
|
185
|
-
confirm: {
|
|
186
|
-
question: 'Lift the deny on "{title}" ({memory.id}) for {audience}? [y/N] ',
|
|
187
|
-
onNo: { text: 'Cancelled.\n', to: 'stderr' },
|
|
188
|
-
onInterrupted: { text: 'Cancelled.\n', exit: 1 }
|
|
189
|
-
}
|
|
170
|
+
const liftingForm = {
|
|
171
|
+
usage: 'Usage: lattris remove deny [memory] <id> --to <all-contacts | contact> [--yes]',
|
|
172
|
+
flags: { '--to': 'to' },
|
|
173
|
+
switches: ['--yes'],
|
|
174
|
+
positionals: 1,
|
|
175
|
+
idPositionals: [0],
|
|
176
|
+
steps: {
|
|
177
|
+
requireFlag: { key: 'to', message: DENY_WORDS },
|
|
178
|
+
pipedNeedsYes: {
|
|
179
|
+
message: 'Refusing to lift a deny without confirmation on a non-interactive session. Pass --yes to skip the prompt.\n'
|
|
190
180
|
},
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
181
|
+
contact: {
|
|
182
|
+
from: ['flag:to'],
|
|
183
|
+
reserved: [ALL_CONTACTS],
|
|
184
|
+
refusedWords: { public: PUBLIC_CANNOT_BE_DENIED }
|
|
195
185
|
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
186
|
+
memory: 'at-tty',
|
|
187
|
+
confirm: {
|
|
188
|
+
question: 'Lift the deny on "{title}" ({memory.id}) for {audience}? [y/N] ',
|
|
189
|
+
onNo: { text: 'Cancelled.\n', to: 'stderr' },
|
|
190
|
+
onInterrupted: { text: 'Cancelled.\n', exit: 1 }
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
request: {
|
|
194
|
+
method: 'DELETE',
|
|
195
|
+
path: '/memories/{memory.id}/grants/contact/{contact.id}?effect=deny',
|
|
196
|
+
pathFor: { [ALL_CONTACTS]: '/memories/{memory.id}/grants/all-contacts?effect=deny' }
|
|
197
|
+
},
|
|
198
|
+
ambiguousRefusal: true,
|
|
199
|
+
refusalWords: otherEffectWords('deny'),
|
|
200
|
+
renderTo: 'stderr',
|
|
201
|
+
render: (_data, context) => `Lifted the deny on memory ${context.memory?.id ?? context.positionals[0]} for ${context.contact ? sanitizeForTerminal(context.contact.displayName) : 'all contacts'}`
|
|
202
|
+
};
|
|
203
|
+
const removeDenyVerb = {
|
|
204
|
+
verb: 'remove',
|
|
205
|
+
nouns: ['deny'],
|
|
206
|
+
form: { ...liftingForm, dropLeadingWords: ['memory'] }
|
|
201
207
|
};
|
|
208
|
+
const undenyVerb = { verb: 'undeny', nouns: ['memory', 'memories'], form: liftingForm };
|
|
202
209
|
export const UNSHARE_HELP = [
|
|
203
210
|
'unshare — withdraw an audience from a memory. No confirmation — withdrawal',
|
|
204
|
-
'is the safe direction.',
|
|
211
|
+
'is the safe direction. A memory someone shared with you takes it too, for',
|
|
212
|
+
"your own contact shares; public is the owner's alone.",
|
|
205
213
|
'',
|
|
206
214
|
'Usage:',
|
|
207
215
|
' lattris unshare memory <id-or-prefix> --with <public | all-contacts | contact>',
|
|
@@ -214,7 +222,7 @@ export const UNSHARE_HELP = [
|
|
|
214
222
|
'',
|
|
215
223
|
'Bare (no --with): refuses and shows what the memory is currently shared',
|
|
216
224
|
'with, so you can see the state and the fix in one line. A deny is lifted',
|
|
217
|
-
'with `lattris
|
|
225
|
+
'with `lattris remove deny`, not here.',
|
|
218
226
|
'',
|
|
219
227
|
'Alias: unpublish → unshare'
|
|
220
228
|
].join('\n');
|
|
@@ -261,6 +269,6 @@ export const grants = {
|
|
|
261
269
|
name: 'grants',
|
|
262
270
|
words: { singular: 'grant', plural: 'grants' },
|
|
263
271
|
help: SHARE_HELP,
|
|
264
|
-
verbs: [shareVerb, unshareVerb, denyVerb, undenyVerb, consent]
|
|
272
|
+
verbs: [shareVerb, unshareVerb, denyVerb, removeDenyVerb, undenyVerb, consent]
|
|
265
273
|
};
|
|
266
274
|
//# sourceMappingURL=share.js.map
|
package/dist/nouns/words.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const VERB_ALIASES = {
|
|
2
2
|
read: 'get',
|
|
3
3
|
show: 'get',
|
|
4
4
|
view: 'get',
|
|
@@ -7,6 +7,11 @@ export const VERB_ALIASES = {
|
|
|
7
7
|
publish: 'share',
|
|
8
8
|
unpublish: 'unshare'
|
|
9
9
|
};
|
|
10
|
+
export const resolveVerb = (typed, next) => typed === 'remove' && next === 'deny'
|
|
11
|
+
? 'remove'
|
|
12
|
+
: Object.hasOwn(VERB_ALIASES, typed)
|
|
13
|
+
? VERB_ALIASES[typed]
|
|
14
|
+
: typed;
|
|
10
15
|
export const USAGE_LINES = [
|
|
11
16
|
' lattris login Sign in via the browser (PKCE) and store the session',
|
|
12
17
|
' lattris setup Transition this repo’s Claude to Lattris as its memory system',
|
|
@@ -19,17 +24,19 @@ export const USAGE_LINES = [
|
|
|
19
24
|
' lattris capture session <transcript> Save an AI conversation — the whole chain from its file',
|
|
20
25
|
' lattris capture recording Keep a recording \u2014 held audio, a source, or a transcript file',
|
|
21
26
|
' lattris get memories List your memories, newest first, with filters (--for <contact> for what they may see)',
|
|
22
|
-
' lattris contact create "<name>" Record a person or an AI you work with (--ai, --phone); add, list, get, update, delete',
|
|
23
|
-
' lattris invite <contact>
|
|
27
|
+
' lattris contact create "<name>" Record a person or an AI you work with (--ai, --phone); add, list, get, update, delete, link',
|
|
28
|
+
' lattris invite <contact> [--email <address>] Mint an invitation for one of your person contacts, admitting one address',
|
|
24
29
|
' lattris get invites List the invitations you have minted',
|
|
25
30
|
' lattris get memory <id> Read one memory back \u2014 words and edges (--links/--depth/--content)',
|
|
26
31
|
' lattris ask <handle> Leave a question on someone\u2019s tree \u2014 `echo "\u2026" | lattris ask <handle>`',
|
|
27
32
|
' lattris get questions The questions on your tree, open first (--mine: ones you asked)',
|
|
28
33
|
' lattris close question <id> Close a question (--close-as updated|declined|already-answered)',
|
|
34
|
+
' lattris accept contact <id> Say yes to a request to link you as a contact: both sides link',
|
|
35
|
+
' lattris decline contact <id> Say no to one; nothing changes and the asker is not told',
|
|
29
36
|
' lattris share memory <id> Allow an audience to see it (--with public | all-contacts | <contact>)',
|
|
30
37
|
' lattris unshare memory <id> Withdraw an audience (--with public | all-contacts | <contact>)',
|
|
31
38
|
' lattris deny memory <id> Shut it to a contact or all contacts, whatever allows it (--to)',
|
|
32
|
-
' lattris
|
|
39
|
+
' lattris remove deny <id> Lift a deny (--to all-contacts | <contact>)',
|
|
33
40
|
' lattris get access <id> May a contact or a number see it, and because of what (--for)',
|
|
34
41
|
' lattris consent <id> Put a memory shared with you on your graph (--withdraw reverses)',
|
|
35
42
|
' lattris link <from> <to> State that one memory leads to another (--verb, --reason)',
|
|
@@ -61,6 +68,8 @@ export const COMMAND_WORDS = new Set([
|
|
|
61
68
|
'get',
|
|
62
69
|
'ask',
|
|
63
70
|
'close',
|
|
71
|
+
'accept',
|
|
72
|
+
'decline',
|
|
64
73
|
'delete',
|
|
65
74
|
'update',
|
|
66
75
|
'link',
|
|
@@ -70,6 +79,7 @@ export const COMMAND_WORDS = new Set([
|
|
|
70
79
|
'unshare',
|
|
71
80
|
'deny',
|
|
72
81
|
'undeny',
|
|
82
|
+
'remove',
|
|
73
83
|
'consent',
|
|
74
84
|
'restore',
|
|
75
85
|
'erase',
|
package/dist/render/rows.js
CHANGED
|
@@ -36,12 +36,19 @@ export const formatAccess = (rows) => rows.length === 0 ? '(nothing set)' : rows
|
|
|
36
36
|
export const describeForContact = (c, asked) => c === null
|
|
37
37
|
? `no contact holds ${sanitizeForTerminal(asked ?? 'that number')}; a stranger sees public memories only`
|
|
38
38
|
: `${sanitizeForTerminal(c.displayName)} (${c.type}${c.phone ? `, ${sanitizeForTerminal(c.phone)}` : ''})`;
|
|
39
|
+
const askerLine = (q) => `${sanitizeForTerminal(q.askerName ?? '(unnamed)')} (@${sanitizeForTerminal(q.sharerHandle ?? '(unknown)')})`;
|
|
39
40
|
export const formatQuestion = (q) => {
|
|
40
41
|
const lines = [`id ${q.id}`, `createdAt ${q.createdAt}`];
|
|
41
42
|
if (q.kind === 'share') {
|
|
42
43
|
lines.push(`shared by @${sanitizeForTerminal(q.sharerHandle ?? '(unknown)')}`, `memory ${q.aboutBlockId ?? '(missing)'}`, `seen ${q.seenAt ?? '(unseen)'}`);
|
|
43
44
|
return lines.join('\n');
|
|
44
45
|
}
|
|
46
|
+
if (q.kind === 'contact_link') {
|
|
47
|
+
lines.push(`link request ${askerLine(q)} asks to link you as a contact`, q.closedAs === null
|
|
48
|
+
? `answer ${renderRunHint(['accept', 'contact', q.id])} or ${renderRunHint(['decline', 'contact', q.id])}`
|
|
49
|
+
: `closed as ${sanitizeForTerminal(q.closedAs)}${q.closedAt ? ` ${q.closedAt}` : ''}`);
|
|
50
|
+
return lines.join('\n');
|
|
51
|
+
}
|
|
45
52
|
if (q.aboutBlockId)
|
|
46
53
|
lines.push(`about ${q.aboutBlockId}`);
|
|
47
54
|
lines.push(q.closedAs === null
|
|
@@ -60,6 +67,11 @@ export const formatAsked = (q) => {
|
|
|
60
67
|
lines.push(` createdAt ${q.createdAt}`);
|
|
61
68
|
return lines.join('\n');
|
|
62
69
|
};
|
|
70
|
+
export const formatLinkAnswer = (q) => q.closedAs === 'accepted'
|
|
71
|
+
? `Linked ${askerLine(q)} as a contact; their contact now stands for your account.`
|
|
72
|
+
: q.closedAs === 'superseded'
|
|
73
|
+
? `Nothing linked: a contact on ${askerLine(q)}'s side already stands for an account, so the request is closed as superseded.`
|
|
74
|
+
: `Declined the link request from ${askerLine(q)}. Nothing changed, and they are not told.`;
|
|
63
75
|
export const formatClosed = (q) => `Closed question ${q.id} (${sanitizeForTerminal(q.closedAs ?? '')})${q.closeBlockId ? ` → ${q.closeBlockId}` : ''}`;
|
|
64
76
|
export const formatEdgeReceipt = (heading, e) => [
|
|
65
77
|
`${heading} (verb: ${sanitizeForTerminal(e.verb)})`,
|
package/dist/request/door.js
CHANGED
|
@@ -8,6 +8,7 @@ export const parseErrorBody = (text) => {
|
|
|
8
8
|
return {};
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
+
const SECURITY_CODE = /^(?:security|auth)[:/]/;
|
|
11
12
|
export const classifyApiError = (status, body) => {
|
|
12
13
|
if (body.next?.action) {
|
|
13
14
|
return { message: body.message ?? 'Action required.', next: body.next, exit: EXIT.DOOR };
|
|
@@ -19,7 +20,7 @@ export const classifyApiError = (status, body) => {
|
|
|
19
20
|
exit: EXIT.NOAUTH
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
if (status === 403) {
|
|
23
|
+
if (status === 403 && (body.code === undefined || SECURITY_CODE.test(body.code))) {
|
|
23
24
|
return {
|
|
24
25
|
message: body.message ?? 'Your session lacks a required scope.',
|
|
25
26
|
next: { action: 'login' },
|