clavarium 0.2.515-next.1 → 0.2.516-next.1
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/config/tools.json +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/server/settingswords.mjs +1 -1
- package/server/signinhelp.mjs +13 -1
- package/web/app.js +1 -1
package/config/tools.json
CHANGED
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"type:(Not logged in|Login expired|OAuth token (has )?expired|Invalid API key)[^\\n]{0,24}/login=/login",
|
|
78
78
|
"keys:Select login method:=Enter",
|
|
79
79
|
"link:https://(claude\\.ai|claude\\.com|console\\.anthropic\\.com)/\\S*oauth\\S*",
|
|
80
|
+
"keys:OAuth error[\\s\\S]{0,160}Press Enter to retry=Enter",
|
|
80
81
|
"code:Paste code here"
|
|
81
82
|
]
|
|
82
83
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.516-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.516-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/settingswords.mjs
CHANGED
|
@@ -14,7 +14,7 @@ export const SETTINGS_WORDS_FR = {
|
|
|
14
14
|
/* The sign-in of a tool: its code pasted in a field, kept nowhere; the companion, its user's choice (#405). */
|
|
15
15
|
'set-signin-code-line': 'Une fois connecté, collez le code.', 'set-signin-code-sent': 'Code envoyé à l\'outil.', 'set-signin-code-act': 'Coller le code',
|
|
16
16
|
'set-signin-code-title': 'Code de connexion', 'set-signin-code-send': 'Envoyer', 'set-signin-code-bad': 'Ce n\'est pas un code.',
|
|
17
|
-
'set-signin-code-late': 'L\'outil n\'attend plus de code.', 'set-signin-code-failed': 'Non envoyé. Réessayez.',
|
|
17
|
+
'set-signin-code-late': 'L\'outil n\'attend plus de code.', 'set-signin-code-failed': 'Non envoyé. Réessayez.', 'set-signin-code-rejected': 'Code refusé. Collez-le à nouveau.',
|
|
18
18
|
'set-companion-yours': 'Votre choix, votre responsabilité',
|
|
19
19
|
/* Chat › when its thread is archived (talk.mjs setSplit). */
|
|
20
20
|
'set-chat-split': 'Archiver son fil', 'set-split-2000': 'Tous les 2 000 messages', 'set-split-5000': 'Tous les 5 000',
|
package/server/signinhelp.mjs
CHANGED
|
@@ -53,6 +53,8 @@ export const OFFER_EVERY_MS = 6000;
|
|
|
53
53
|
const SCREEN_LINES = 12;
|
|
54
54
|
export const CODE_LINE = 'Once signed in, paste the code.';
|
|
55
55
|
export const CODE_SENT = 'Code sent to the tool.';
|
|
56
|
+
/* How long its tool is given to leave its prompt once a code is typed: still there, the code was not accepted. */
|
|
57
|
+
export const CODE_SETTLE_MS = 12_000;
|
|
56
58
|
export const NONE = 'none';
|
|
57
59
|
const ASK_BYTES = 16_384;
|
|
58
60
|
const LINK_MAX = 4000;
|
|
@@ -88,6 +90,7 @@ export class SigninHelp {
|
|
|
88
90
|
#offered = new Map();
|
|
89
91
|
#looked = new Map();
|
|
90
92
|
#typing = new Set();
|
|
93
|
+
codeSettleMs = CODE_SETTLE_MS;
|
|
91
94
|
|
|
92
95
|
/* `store`: { get(), set(v) } of { general, per: { name: companion | NONE } }. `conversations()`: [{ name, tool }].
|
|
93
96
|
`tools()`: config/tools.json as read. `awake()`, `chatOn(name)`. `workFolder(name)`. `browsers(name)`: the
|
|
@@ -194,7 +197,16 @@ export class SigninHelp {
|
|
|
194
197
|
if (!at) throw new Refusal(409, 'Its tool is not waiting for a code now.');
|
|
195
198
|
const typed = await Promise.resolve(this.#type(name, code)).catch(() => false);
|
|
196
199
|
if (!typed) throw new Refusal(502, 'The code could not be typed into the tool.');
|
|
197
|
-
/*
|
|
200
|
+
/* STILL AT ITS PROMPT (22-11, a wrong code on a real machine): the ask stays, so that the field can be used
|
|
201
|
+
again and nothing else is typed into that prompt meanwhile. */
|
|
202
|
+
const end = Date.now() + this.codeSettleMs;
|
|
203
|
+
let waiting = await this.atCodePrompt(name, exec).catch(() => false);
|
|
204
|
+
while (waiting && Date.now() < end) {
|
|
205
|
+
await new Promise((r) => { setTimeout(r, 1000).unref?.(); });
|
|
206
|
+
waiting = await this.atCodePrompt(name, exec).catch(() => false);
|
|
207
|
+
}
|
|
208
|
+
if (waiting) throw new Refusal(422, 'The tool did not accept this code.');
|
|
209
|
+
/* Accepted: the ask is over, whatever comes next is not this code. */
|
|
198
210
|
const dir = this.#chat(name);
|
|
199
211
|
if (this.#own(dir)) { try { rmSync(join(dir, ASK), { force: true }); } catch { /* it runs out by itself */ } }
|
|
200
212
|
this.#route(name, { id: ask.id, route: 'done' });
|
package/web/app.js
CHANGED
|
@@ -9117,7 +9117,7 @@
|
|
|
9117
9117
|
try { status = (await fetch(`${API}/conversations/${encodeURIComponent(to)}/signin-code?c=${encodeURIComponent(to)}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ code }) })).status; } catch { /* said below */ }
|
|
9118
9118
|
send.disabled = false;
|
|
9119
9119
|
if (status === 200) { box.close(); void thread?.refresh?.(); return; }
|
|
9120
|
-
why.textContent = status === 400 ? uiSaid('set-signin-code-bad', 'This is not a code.') : status === 409 ? uiSaid('set-signin-code-late', 'The tool is no longer waiting for a code.') : uiSaid('set-signin-code-failed', 'Not sent. Try again.');
|
|
9120
|
+
why.textContent = status === 400 ? uiSaid('set-signin-code-bad', 'This is not a code.') : status === 409 ? uiSaid('set-signin-code-late', 'The tool is no longer waiting for a code.') : status === 422 ? uiSaid('set-signin-code-rejected', 'Code not accepted. Paste it again.') : uiSaid('set-signin-code-failed', 'Not sent. Try again.');
|
|
9121
9121
|
why.hidden = false; input.focus();
|
|
9122
9122
|
});
|
|
9123
9123
|
}
|