@songsid/agend 2.4.0-beta.14 → 2.4.0-beta.16
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/dist/accounts-profiles.d.ts +1 -1
- package/dist/accounts-view.d.ts +3 -0
- package/dist/accounts-view.js.map +1 -1
- package/dist/auth-api.js +5 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.d.ts +6 -1
- package/dist/backend/claude-code.js +63 -8
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/kiro.js +6 -1
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/types.d.ts +2 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-command.d.ts +4 -2
- package/dist/backend-command.js +3 -0
- package/dist/backend-command.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +1 -0
- package/dist/browser-backend-signins.js +3 -1
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/classic-channel-manager.d.ts +1 -0
- package/dist/classic-channel-manager.js +4 -1
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/claude-credential-change.d.ts +22 -0
- package/dist/claude-credential-change.js +47 -0
- package/dist/claude-credential-change.js.map +1 -0
- package/dist/claude-credential-launch.d.ts +62 -0
- package/dist/claude-credential-launch.js +304 -0
- package/dist/claude-credential-launch.js.map +1 -0
- package/dist/claude-credential-runner.d.ts +1 -0
- package/dist/claude-credential-runner.js +56 -0
- package/dist/claude-credential-runner.js.map +1 -0
- package/dist/claude-credential-vault.d.ts +51 -0
- package/dist/claude-credential-vault.js +252 -0
- package/dist/claude-credential-vault.js.map +1 -0
- package/dist/claude-setup-token-transport.d.ts +9 -0
- package/dist/claude-setup-token-transport.js +82 -0
- package/dist/claude-setup-token-transport.js.map +1 -0
- package/dist/claude-setup-token.d.ts +51 -0
- package/dist/claude-setup-token.js +83 -0
- package/dist/claude-setup-token.js.map +1 -0
- package/dist/cli-audited.js +7 -6
- package/dist/cli-audited.js.map +1 -1
- package/dist/command-report.d.ts +11 -0
- package/dist/command-report.js +2 -0
- package/dist/command-report.js.map +1 -0
- package/dist/config-validator.js +9 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/contact-auth-api.d.ts +2 -1
- package/dist/contact-auth-api.js +15 -5
- package/dist/contact-auth-api.js.map +1 -1
- package/dist/contact-auth-policy.d.ts +5 -0
- package/dist/contact-auth-policy.js +2 -0
- package/dist/contact-auth-policy.js.map +1 -1
- package/dist/contact-auth-store.d.ts +12 -1
- package/dist/contact-auth-store.js +67 -5
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/contact-auth-types.d.ts +27 -1
- package/dist/contact-auth-types.js.map +1 -1
- package/dist/daemon.d.ts +5 -0
- package/dist/daemon.js +59 -3
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-level-config.d.ts +1 -1
- package/dist/fleet-level-config.js +1 -0
- package/dist/fleet-level-config.js.map +1 -1
- package/dist/fleet-manager.d.ts +48 -3
- package/dist/fleet-manager.js +446 -27
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +16 -6
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +4 -1
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +23 -5
- package/dist/host-monitoring-config.d.ts +14 -0
- package/dist/host-monitoring-config.js +31 -0
- package/dist/host-monitoring-config.js.map +1 -0
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/instance-config-impact.js +1 -1
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instructions.js +1 -0
- package/dist/instructions.js.map +1 -1
- package/dist/locale.d.ts +2 -0
- package/dist/locale.js +19 -1
- package/dist/locale.js.map +1 -1
- package/dist/needs-you-hub.js +3 -0
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +2 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/profile-signins.d.ts +1 -0
- package/dist/profile-signins.js +3 -1
- package/dist/profile-signins.js.map +1 -1
- package/dist/public-web-gateway.js +2 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +21 -2
- package/dist/public-web-link.js +22 -2
- package/dist/public-web-link.js.map +1 -1
- package/dist/settings-api.d.ts +12 -0
- package/dist/settings-api.js +146 -7
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +2 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +13 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/topic-commands.d.ts +7 -1
- package/dist/topic-commands.js +98 -88
- package/dist/topic-commands.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/ui/accounts-view.js +12 -6
- package/dist/ui/backend-signin.js +3 -1
- package/dist/ui/chat-commands.js +2 -0
- package/dist/ui/chat-popout-transport.js +49 -19
- package/dist/ui/chat-popout.js +15 -1
- package/dist/ui/chat-store.js +1 -1
- package/dist/ui/claude-credentials.js +112 -0
- package/dist/ui/claude-setup-token.js +36 -0
- package/dist/ui/contact-auth-client.js +9 -2
- package/dist/ui/contact-auth-strings.js +78 -16
- package/dist/ui/contact-authorizations.js +47 -26
- package/dist/ui/contact-needs.js +22 -6
- package/dist/ui/contact-permissions.js +55 -10
- package/dist/ui/contact-tool-groups.js +39 -0
- package/dist/ui/fleet-canvas.js +3 -2
- package/dist/ui/fleet-office-card.js +414 -41
- package/dist/ui/fleet-office-dialogue.js +3 -3
- package/dist/ui/fleet-office-pack.d.ts +67 -1
- package/dist/ui/fleet-office-pack.js +412 -18
- package/dist/ui/fleet-office-play.js +262 -3
- package/dist/ui/fleet-office-skin.js +67 -20
- package/dist/ui/fleet-office-zones.js +19 -1
- package/dist/ui/fleet-office.js +393 -47
- package/dist/ui/office-share-page.js +5 -1
- package/dist/ui/panel-chat.js +47 -3
- package/dist/ui/panel-fleet.js +1 -1
- package/dist/ui/panel-needs.js +7 -4
- package/dist/ui/panel-settings.js +2 -1
- package/dist/ui/preview-popout.js +134 -0
- package/dist/ui/reply-file-preview.js +1 -1
- package/dist/ui/settings-appearance.js +6 -1
- package/dist/ui/settings-host-monitoring.js +51 -0
- package/dist/ui/settings-registry.js +1 -1
- package/dist/ui/settings-shared.js +3 -2
- package/dist/ui/shared/app-i18n.js +4 -0
- package/dist/ui/shared/app-shell.js +16 -7
- package/dist/ui/shared/app.css +266 -27
- package/dist/ui/shared/app.js +7 -1
- package/dist/ui/shared/chat-strings.js +8 -2
- package/dist/ui/shared/info-tip.js +64 -0
- package/dist/ui/shared/office-dialogue.css +12 -0
- package/dist/ui/shared/preview-panel.js +44 -18
- package/dist/ui/shared/preview-popout.css +11 -0
- package/dist/ui/shared/theme-picker.js +46 -0
- package/dist/ui/shared/theme.js +47 -4
- package/dist/ui/shared/tokens.css +273 -0
- package/dist/ui/shared/ui-confirm.js +5 -2
- package/dist/ui/shared/usage-dialog.js +9 -34
- package/dist/ui/shared/view-strings.js +2 -0
- package/dist/usage/i18n-keys.d.ts +1 -1
- package/dist/usage/i18n-keys.js +1 -1
- package/dist/usage/i18n-keys.js.map +1 -1
- package/dist/usage/providers.d.ts +1 -0
- package/dist/usage/providers.js +14 -1
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.js +5 -2
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/web-api.d.ts +5 -1
- package/dist/web-api.js +29 -9
- package/dist/web-api.js.map +1 -1
- package/dist/web-claude-credentials.d.ts +31 -0
- package/dist/web-claude-credentials.js +138 -0
- package/dist/web-claude-credentials.js.map +1 -0
- package/dist/web-commands.d.ts +5 -2
- package/dist/web-commands.js +4 -2
- package/dist/web-commands.js.map +1 -1
- package/dist/web-office-skins.d.ts +7 -2
- package/dist/web-office-skins.js +42 -16
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-session.d.ts +20 -1
- package/dist/web-session.js +27 -0
- package/dist/web-session.js.map +1 -1
- package/dist/web-terminal.d.ts +4 -0
- package/dist/web-terminal.js +16 -1
- package/dist/web-terminal.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
// #3637: a bounded data handoff between exact same-origin windows, never an authentication channel.
|
|
2
2
|
import { isSafeInstanceName, chatPath } from "/assets/app-route.js";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const protocols = {
|
|
4
|
+
chat: { channel: "agend-chat-popout-v1", payload: "draft", presentation: "popout" },
|
|
5
|
+
preview: { channel: "agend-preview-popout-v1", payload: "locator", presentation: "preview" },
|
|
6
|
+
};
|
|
7
|
+
const message = (wire, type, fields) => ({ channel: wire.channel, type, ...fields });
|
|
8
|
+
const valid = (wire, data) => !!data && data.channel === wire.channel && typeof data.type === "string";
|
|
6
9
|
export const POPOUT_DEADLINE_MS = 15_000;
|
|
10
|
+
function secureNonce(crypto) {
|
|
11
|
+
try {
|
|
12
|
+
if (typeof crypto?.randomUUID === "function") return crypto.randomUUID();
|
|
13
|
+
if (typeof crypto?.getRandomValues !== "function") return null;
|
|
14
|
+
const bytes = crypto.getRandomValues(new Uint8Array(16));
|
|
15
|
+
bytes[6] = (bytes[6] & 15) | 64; bytes[8] = (bytes[8] & 63) | 128;
|
|
16
|
+
const hex = [...bytes].map(n => n.toString(16).padStart(2, "0")).join("");
|
|
17
|
+
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20);
|
|
18
|
+
} catch { return null; }
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
|
|
8
|
-
export function createPopoutTransport({ win = window, scope, notify = () => {}, now = () => performance.now() }) {
|
|
22
|
+
export function createPopoutTransport({ win = window, scope, notify = () => {}, now = () => performance.now(), kind = "chat" }) {
|
|
23
|
+
const wire = Object.hasOwn(protocols, kind) ? protocols[kind] : null;
|
|
9
24
|
let alive = true, pending = null;
|
|
10
25
|
const cancel = reason => { if (pending) pending.finish(reason); };
|
|
11
26
|
function open({ name, payload, current, complete }) {
|
|
12
|
-
if (!alive || !scope || !isSafeInstanceName(name) || !current()) return false;
|
|
27
|
+
if (!wire || !alive || !scope || !isSafeInstanceName(name) || !current()) return false;
|
|
13
28
|
if (pending) { notify("busy"); return false; }
|
|
14
|
-
const origin = win.location.origin, nonce = win.crypto
|
|
29
|
+
const origin = win.location.origin, nonce = secureNonce(win.crypto), started = now();
|
|
30
|
+
if (!nonce) { notify("retained"); return false; }
|
|
15
31
|
let child = null, offered = false, done = false;
|
|
16
32
|
const time = () => now() >= started && now() < started + POPOUT_DEADLINE_MS;
|
|
17
33
|
const finish = reason => {
|
|
@@ -21,13 +37,13 @@ export function createPopoutTransport({ win = window, scope, notify = () => {},
|
|
|
21
37
|
if (reason) notify(reason);
|
|
22
38
|
};
|
|
23
39
|
const receive = event => {
|
|
24
|
-
if (done || !child || event.source !== child || event.origin !== origin || !valid(event.data)) return;
|
|
40
|
+
if (done || !child || event.source !== child || event.origin !== origin || !valid(wire, event.data)) return;
|
|
25
41
|
const data = event.data;
|
|
26
42
|
if (data.name !== name || data.scope !== scope) return;
|
|
27
43
|
if (!time() || child.closed || !current()) { finish("retained"); return; }
|
|
28
44
|
if (data.type === "ready" && !offered) {
|
|
29
45
|
offered = true;
|
|
30
|
-
try { child.postMessage(message(
|
|
46
|
+
try { child.postMessage(message(wire, wire.payload, { name, scope, nonce, payload }), origin); } catch { finish("retained"); }
|
|
31
47
|
} else if (offered && data.nonce === nonce && ["received", "refused"].includes(data.type)) {
|
|
32
48
|
// Consume before invoking any callback; a duplicate ACK cannot close a later pane.
|
|
33
49
|
finish();
|
|
@@ -39,7 +55,7 @@ export function createPopoutTransport({ win = window, scope, notify = () => {},
|
|
|
39
55
|
const timer = setInterval(() => { if (!time() || child?.closed || !current()) finish("retained"); }, 100);
|
|
40
56
|
pending = { finish }; win.addEventListener("message", receive);
|
|
41
57
|
// This must stay in the click stack. noopener would return null even after a successful open.
|
|
42
|
-
try { child = win.open(`${chatPath(name)}?presentation
|
|
58
|
+
try { child = win.open(`${chatPath(name)}?presentation=${wire.presentation}`, "_blank", "popup,width=760,height=800"); } catch { /* blocked */ }
|
|
43
59
|
if (!child) { finish("blocked"); return false; }
|
|
44
60
|
return true;
|
|
45
61
|
}
|
|
@@ -47,9 +63,10 @@ export function createPopoutTransport({ win = window, scope, notify = () => {},
|
|
|
47
63
|
return { open, cancel, close() { alive = false; cancel(); win.removeEventListener("pagehide", hide); } };
|
|
48
64
|
}
|
|
49
65
|
|
|
50
|
-
export function receivePopoutDraft({ win = window, name, scope, ready, current, accept, notify = () => {}, now = () => performance.now() }) {
|
|
66
|
+
export function receivePopoutDraft({ win = window, name, scope, ready, current, accept, notify = () => {}, now = () => performance.now(), kind = "chat" }) {
|
|
67
|
+
const wire = Object.hasOwn(protocols, kind) ? protocols[kind] : null;
|
|
51
68
|
const parent = win.opener, origin = win.location.origin, started = now();
|
|
52
|
-
if (!parent || !scope || !isSafeInstanceName(name)) return () => {};
|
|
69
|
+
if (!wire || !parent || !scope || !isSafeInstanceName(name)) return () => {};
|
|
53
70
|
let sent = false, done = false;
|
|
54
71
|
const time = () => now() >= started && now() < started + POPOUT_DEADLINE_MS;
|
|
55
72
|
const finish = () => {
|
|
@@ -58,23 +75,36 @@ export function receivePopoutDraft({ win = window, name, scope, ready, current,
|
|
|
58
75
|
};
|
|
59
76
|
const receive = event => {
|
|
60
77
|
const data = event.data;
|
|
61
|
-
if (done || !sent || event.source !== parent || event.origin !== origin || !valid(data) || data.type !==
|
|
78
|
+
if (done || !sent || event.source !== parent || event.origin !== origin || !valid(wire, data) || data.type !== wire.payload
|
|
62
79
|
|| data.name !== name || data.scope !== scope || typeof data.nonce !== "string" || !/^[0-9a-f-]{36}$/.test(data.nonce)) return;
|
|
63
|
-
const
|
|
64
|
-
|
|
80
|
+
const stillCurrent = () => time() && current() && ready();
|
|
81
|
+
const allowed = stillCurrent();
|
|
82
|
+
// Consume before any asynchronous history read; no replay can initiate another read.
|
|
65
83
|
finish();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
84
|
+
const answer = result => {
|
|
85
|
+
const accepted = result === true && (kind !== "preview" || stillCurrent());
|
|
86
|
+
try { parent.postMessage(message(wire, accepted ? "received" : "refused", { name, scope, nonce: data.nonce }), origin); } catch { /* parent keeps its original */ }
|
|
87
|
+
if (!accepted) notify("retained");
|
|
88
|
+
};
|
|
89
|
+
try {
|
|
90
|
+
const result = allowed && (kind === "preview" ? accept(data.payload, stillCurrent) : accept(data.payload));
|
|
91
|
+
if (kind === "preview" && result && typeof result.then === "function") result.then(answer, () => answer(false));
|
|
92
|
+
else answer(result);
|
|
93
|
+
} catch { answer(false); }
|
|
94
|
+
|
|
70
95
|
};
|
|
71
96
|
const tick = () => {
|
|
72
97
|
if (!time() || !current() || parent.closed) { finish(); return; }
|
|
73
98
|
if (!sent && ready()) {
|
|
74
99
|
sent = true;
|
|
75
|
-
try { parent.postMessage(message("ready", { name, scope }), origin); } catch { finish(); }
|
|
100
|
+
try { parent.postMessage(message(wire, "ready", { name, scope }), origin); } catch { finish(); }
|
|
76
101
|
}
|
|
77
102
|
};
|
|
78
103
|
const timer = setInterval(tick, 50); win.addEventListener("message", receive); win.addEventListener("pagehide", finish); tick();
|
|
79
104
|
return finish;
|
|
80
105
|
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
// Preview uses the same bounded exact-window protocol, with a separate channel and asynchronous own-history validation.
|
|
109
|
+
export const createPreviewPopoutTransport = opts => createPopoutTransport({ ...opts, kind: "preview" });
|
|
110
|
+
export const receivePreviewPopout = opts => receivePopoutDraft({ ...opts, kind: "preview" });
|
package/dist/ui/chat-popout.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// #3637: optional presentation/data only. Every new window boots the existing authenticated chat independently.
|
|
2
2
|
import { appStore, guestPage } from "/assets/app-store.js";
|
|
3
3
|
import { agentRoute } from "/assets/chat-workspace-model.js";
|
|
4
|
-
import { parseRoute } from "/assets/app-route.js";
|
|
4
|
+
import { parseRoute, chatPath, isSafeInstanceName } from "/assets/app-route.js";
|
|
5
5
|
import { Shell, shellStore } from "/assets/app-shell.js";
|
|
6
6
|
import { register, t } from "/assets/app-i18n.js";
|
|
7
7
|
import { toast } from "/assets/ui-toast.js";
|
|
@@ -16,6 +16,20 @@ register("chatPopout", {
|
|
|
16
16
|
export const popoutText = key => t(`chatPopout.${key}`);
|
|
17
17
|
const supported = chat => chat?.popoutDraftVersion === 1 && chat.popoutDraftReady?.() === true && Shell.popoutVersion === 1
|
|
18
18
|
&& getComputedStyle(document.documentElement).getPropertyValue("--chat-popout-version").trim() === "1";
|
|
19
|
+
/** A fresh Office chat is not a pane transfer: leave the Office and every draft owner untouched. */
|
|
20
|
+
export function openOfficeChatWindow(name, { win = window, notify = reason => toast(popoutText(reason), false) } = {}) {
|
|
21
|
+
const boot = globalThis.document?.body?.dataset, auth = globalThis.AgendAuth, app = appStore.get();
|
|
22
|
+
if (guestPage() || boot?.chatWorkspace !== "1" || !boot.chatLayoutScope || !app.ready
|
|
23
|
+
|| typeof auth?.sessionEnded !== "function" || auth.sessionEnded() || !isSafeInstanceName(name)
|
|
24
|
+
|| !app.instances.some(it => it.name === name)) return false;
|
|
25
|
+
let child;
|
|
26
|
+
// Keep the normal popup handle for reliable blocked-window feedback, then immediately detach the opener.
|
|
27
|
+
try { child = win.open(`${chatPath(name)}?presentation=popout`, "_blank", "popup,width=760,height=800"); } catch { /* blocked */ }
|
|
28
|
+
if (!child) { notify("blocked"); return false; }
|
|
29
|
+
try { child.opener = null; } catch { /* the browser may already have detached it */ }
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
export function createPanePopout({ scope, chat, win = window, notify = reason => toast(popoutText(reason), false) }) {
|
|
20
34
|
if (!supported(chat) || guestPage() || !scope) return null;
|
|
21
35
|
let alive = true;
|
package/dist/ui/chat-store.js
CHANGED
|
@@ -717,7 +717,7 @@ export function createChatStore(deps) {
|
|
|
717
717
|
const follow = r && r.follow && r.follow.kind === "compact" ? r.follow : null;
|
|
718
718
|
showCommand(target, r && r.choices ? { command, busy: false, choices: r.choices }
|
|
719
719
|
: r && r.error ? { command, busy: false, error: r.error, ...(opts.action ? { choices: pending.choices } : {}) }
|
|
720
|
-
: { command, busy: false, text: (r && r.text) || "", ...(r && r.sent === true ? { sent: true } : {}), ...(follow ? { compact: follow.id ? "running" : "unknown", watch: follow.id } : {}) });
|
|
720
|
+
: { command, busy: false, text: (r && r.text) || "", ...(r && r.report ? { report: r.report } : {}), ...(r && r.sent === true ? { sent: true } : {}), ...(follow ? { compact: follow.id ? "running" : "unknown", watch: follow.id } : {}) });
|
|
721
721
|
changed(target);
|
|
722
722
|
}
|
|
723
723
|
// Board 003648ac: an answer the server marks `sent` leaves by itself; a sent /compact says "compacting…" until the
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ClaudeTokenFetch } from "./claude-setup-token.js";
|
|
2
|
+
// Local verified credential management; no credential is read back or persisted by this page.
|
|
3
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
4
|
+
import { register, t, lang } from "/assets/app-i18n.js";
|
|
5
|
+
import { showDialog, closeDialog } from "/assets/app-shell.js";
|
|
6
|
+
import { Dialog } from "/assets/ui-dialog.js";
|
|
7
|
+
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
8
|
+
import { Icon } from "/assets/ui-icons.js";
|
|
9
|
+
import { Skeleton, ErrorState } from "/assets/ui-states.js";
|
|
10
|
+
import { toast } from "/assets/ui-toast.js";
|
|
11
|
+
register("claudeCredentials", {
|
|
12
|
+
en: {
|
|
13
|
+
title: "Connect Claude Code", profile: "Account", default: "Default connection",
|
|
14
|
+
help: "What’s this?", method: "Connection method", subscription: "Subscription login", oauth: "Token from setup-token", api: "Anthropic API key",
|
|
15
|
+
subscriptionHint: "Continue to Claude’s official sign-in page.",
|
|
16
|
+
oauthHint: "Paste a subscription token you already obtained with setup-token. This uses your Claude subscription; subscription limits still apply.",
|
|
17
|
+
apiHint: "Create a key in Anthropic Console. API usage is billed separately from a Claude subscription.",
|
|
18
|
+
tokenLabel: "Setup token", apiLabel: "API key", paste: "Paste the credential here", local: "Only on this AgEnD computer, with a verified administrator session.",
|
|
19
|
+
saved: "Stored encrypted. This does not confirm that Anthropic accepts it. No model request is made on Save.",
|
|
20
|
+
runtime: "Same-user access", runtimeHint: "An agent running as the same OS user can still obtain the credential at runtime. Encryption is not isolation.",
|
|
21
|
+
cancel: "Cancel", close: "Close", continue: "Continue to sign in", save: "Save credential", done: "Saved · not verified. No model request was made.",
|
|
22
|
+
usage: "No subscription meters for pasted credentials. Local usage, when available, is an estimate.",
|
|
23
|
+
replace: "Replace credential", replacement: "Replacement keeps this account’s name and assignments. A confirmation lists the agents that must restart. If format or storage checks fail, the earlier credential stays unchanged.",
|
|
24
|
+
remove: "Remove saved credential", removeTitle: "Remove this credential?", removeHint: "The account and conversation stay. Move or stop its agents first. This removes only AgEnD’s copy; revoke the credential at Anthropic to invalidate it elsewhere.",
|
|
25
|
+
tokenTag: "Subscription token", apiTag: "API key · pay as you go", notChecked: "Saved · not verified", restriction: "Open this computer’s local dashboard to paste, replace or remove a credential. Public links are refused, even for a verified administrator."
|
|
26
|
+
},
|
|
27
|
+
"zh-TW": {
|
|
28
|
+
title: "連接 Claude Code", profile: "帳號", default: "預設連接",
|
|
29
|
+
help: "這是什麼?", method: "連接方式", subscription: "訂閱帳號登入", oauth: "貼上 setup-token", api: "貼上 Anthropic API key",
|
|
30
|
+
subscriptionHint: "前往 Claude 官方網站完成登入。",
|
|
31
|
+
oauthHint: "貼上你已透過 setup-token 取得的訂閱 token。這會使用 Claude 訂閱,仍受訂閱額度限制。",
|
|
32
|
+
apiHint: "在 Anthropic Console 建立 API key。API 用量另行計費,不包含在 Claude 訂閱中。",
|
|
33
|
+
tokenLabel: "Setup token", apiLabel: "API key", paste: "在這裡貼上憑證", local: "僅限在這台 AgEnD 電腦,以已驗證的管理員身分操作。",
|
|
34
|
+
saved: "加密儲存不代表 Anthropic 已接受這組憑證。按儲存不會送出模型請求。",
|
|
35
|
+
runtime: "同一使用者的存取範圍", runtimeHint: "以同一個作業系統使用者執行的 Agent,仍可能在執行時取得憑證。加密不代表隔離。",
|
|
36
|
+
cancel: "取消", close: "關閉", continue: "繼續登入", save: "儲存憑證", done: "已儲存・尚未驗證,沒有送出模型請求。",
|
|
37
|
+
usage: "貼上的憑證不顯示訂閱額度表;若有本機用量紀錄,會標明是估計值。",
|
|
38
|
+
replace: "替換憑證", replacement: "替換後保留帳號名稱與 Agent 指派。確認畫面會列出需要重新啟動的 Agent;新憑證若未通過儲存檢查,原憑證保持不變。",
|
|
39
|
+
remove: "移除儲存的憑證", removeTitle: "移除這組憑證?", removeHint: "保留帳號與對話。請先移走或停止使用它的 Agent。這只會移除 AgEnD 的副本;如要讓其他地方也無法使用,請到 Anthropic 撤銷憑證。",
|
|
40
|
+
tokenTag: "訂閱 token", apiTag: "API key · 按量付費", notChecked: "已儲存 · 尚未驗證", restriction: "請在這台電腦的本機儀表板貼上、替換或移除憑證。公開連結一律拒絕,即使已驗證的管理員也一樣。"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
register("claudeCredentialErrors", {
|
|
45
|
+
en:{local:"Open the local dashboard on the AgEnD computer and verify your administrator session, then try again. Public links cannot manage saved credentials.",inUse:"This account is in use. Wait for its agents to finish, or stop paused sessions, then try again. No credential was changed.",conflict:"This account changed in another session. Reload its connection details and try again.",invalid:"Enter a single-line credential between 16 and 16,384 bytes.",failed:"The credential could not be saved. The previous credential is unchanged; retry from the local dashboard.",read:"Could not read this account’s connection details.",retry:"Retry",restart:"Agents using this account; running agents restart only when idle:",stop:"Agents using this account; running agents stop only when idle:",pending:"Saved, but these agents still need a restart from their page:",confirm:"Save and restart idle agents",removed:"Saved credential removed. The account and conversation remain.",managedPolicy:"Organization-managed Claude settings are not supported."},
|
|
46
|
+
"zh-TW":{local:"請在執行 AgEnD 的電腦開啟本機儀表板、驗證管理員身分後再試。公開連結不能管理保存的憑證。",inUse:"這個帳號正在使用中。請等 Agent 完成工作,或先停止暫停的工作階段後再試;憑證尚未變更。",conflict:"其他工作階段已變更這個帳號。請重新讀取連接資訊後再試。",invalid:"請輸入單行憑證,長度須為 16 至 16,384 位元組。",failed:"無法儲存憑證。原憑證保持不變,請從本機儀表板重試。",read:"無法讀取這個帳號的連接資訊。",retry:"重試",restart:"使用這個帳號的 Agent;執行中的 Agent 只會在空閒時重啟:",stop:"使用這個帳號的 Agent;執行中的 Agent 只會在空閒時停止:",pending:"已儲存,以下 Agent 仍需從各自的頁面重新啟動:",confirm:"儲存並重啟空閒的 Agent",removed:"已移除保存的憑證,帳號與對話仍保留。",managedPolicy:"不支援由組織管理的 Claude 設定。"}
|
|
47
|
+
});
|
|
48
|
+
export const credentialText=key=>t("claudeCredentials."+key);
|
|
49
|
+
const e=key=>t("claudeCredentialErrors."+key);
|
|
50
|
+
export const credentialError=code=>{const key=String(code||"").replace(/-/g,"_");return e(["credential_local_verified_required","credential_session_changed","unauthorized","forbidden"].includes(key)?"local":key==="credential_in_use"?"inUse":key==="credential_conflict"?"conflict":key==="credential_invalid"||key==="credential_body_bound"?"invalid":"failed");};
|
|
51
|
+
export function credentialHelpUrl(method){return "https://songsid.github.io/AgEnD/"+(lang()==="zh-TW"?"zh-tw/":"")+"docs/claude-credentials/#"+method;}
|
|
52
|
+
async function api(profile,method="GET",body){
|
|
53
|
+
const path="/ui/claude-credentials"+(method==="GET"&&profile?"?profile="+encodeURIComponent(profile):"");
|
|
54
|
+
try{const r=await fetch(path,{method,credentials:"same-origin",cache:"no-store",...(body?{headers:{"Content-Type":"application/json"},body:JSON.stringify(body)}:{})});const result=await r.json();return {ok:r.ok,...result};}
|
|
55
|
+
catch{return {ok:false,error:"credential_unavailable"};}
|
|
56
|
+
}
|
|
57
|
+
async function loadConnection(profile){
|
|
58
|
+
const result=await api(profile);if(result.ok)return {...result,local:true};
|
|
59
|
+
if(result.error!=="credential_local_verified_required")return result;
|
|
60
|
+
try{const response=await fetch("/ui/accounts",{credentials:"same-origin",cache:"no-store"});if(!response.ok)return result;
|
|
61
|
+
const view=await response.json(),row=view.clis?.find(cli=>cli.backend==="claude-code")?.rows?.find(row=>row.scope?.kind==="host"&&(row.profile||null)===(profile||null));
|
|
62
|
+
if(!row||row.credentialUnavailable)return result;return {ok:true,local:false,credential:row.credential||null};
|
|
63
|
+
}catch{return result;}
|
|
64
|
+
}
|
|
65
|
+
const changed=()=>window.dispatchEvent(new Event("agend-credentials-changed"));
|
|
66
|
+
export function openClaudeCredentials(options){return showDialog(ClaudeCredentialsDialog,options);}
|
|
67
|
+
export async function removeClaudeCredential(profile){
|
|
68
|
+
const result=await api(profile);if(!result.ok){toast(credentialError(result.error));return;}
|
|
69
|
+
if(!await confirmDialog({title:credentialText("removeTitle"),message:[profile||credentialText("default"),credentialText("removeHint"),...(result.consumers?.users?.length?[e("stop"),...result.consumers.users]:[])].join("\n\n"),confirmLabel:credentialText("remove"),danger:true}))return;
|
|
70
|
+
const saved=await api(profile,"DELETE",{profile:profile||null,revision:result.credential?.revision||0,confirm:true,...(result.consumers?.users?.length?{restart:true,consumersRevision:result.consumers.revision}:{})});
|
|
71
|
+
if(!saved.ok){toast(credentialError(saved.error));return;}changed();toast(e("removed"),true);
|
|
72
|
+
}
|
|
73
|
+
export function ClaudeCredentialsDialog({profile,initial="subscription",continueSubscription,onClose}){
|
|
74
|
+
const [method,setMethod]=useState(initial),[read,setRead]=useState(null),[busy,setBusy]=useState(false),[error,setError]=useState(""),[done,setDone]=useState(false),[pending,setPending]=useState([]),[hasInput,setHasInput]=useState(false),input=useRef(null),active=useRef(true);
|
|
75
|
+
const inputRef=useRef(node=>{if(input.current&&input.current!==node)input.current.value="";input.current=node;});
|
|
76
|
+
const close=()=>{if(input.current)input.current.value="";active.current=false;(onClose||closeDialog)();};
|
|
77
|
+
const load=()=>{setRead(null);void loadConnection(profile).then(result=>{if(active.current)setRead(result);});};
|
|
78
|
+
useEffect(()=>{active.current=true;load();return()=>{active.current=false;if(input.current)input.current.value="";};},[profile]);
|
|
79
|
+
const save=async()=>{
|
|
80
|
+
setError("");if(!read?.ok){setError(credentialError(read?.error));return;}
|
|
81
|
+
if(!read.local){
|
|
82
|
+
// Public/native sign-in retains its existing flow; changing a managed source remains local-only.
|
|
83
|
+
if(method==="subscription"&&read.credential?.source!=="managed"){close();continueSubscription?.();return;}
|
|
84
|
+
setError(e("local"));return;
|
|
85
|
+
}
|
|
86
|
+
const value=input.current?.value||"";
|
|
87
|
+
if(method!=="subscription"&&(!value||/\s/.test(value)||new TextEncoder().encode(value).length<16||new TextEncoder().encode(value).length>16384)){setError(e("invalid"));return;}
|
|
88
|
+
setBusy(true);
|
|
89
|
+
try{
|
|
90
|
+
const consumers=read.consumers;
|
|
91
|
+
if(consumers?.users?.length&&!await confirmDialog({title:d(method==="subscription"?"continue":"replace"),message:[d("replacement"),e("restart"),...consumers.users].join("\n\n"),confirmLabel:e("confirm")}))return;
|
|
92
|
+
if(!active.current)return;
|
|
93
|
+
const result=await api(profile,method==="subscription"?"POST":"PUT",{profile:profile||null,revision:read.credential?.revision||0,...(consumers?.users?.length?{restart:true,consumersRevision:consumers.revision}:{}),...(method==="subscription"?{source:"subscription",confirm:true}:{kind:method==="oauth"?"setup-token":"api-key",value})});
|
|
94
|
+
if(!active.current)return;
|
|
95
|
+
if(!result.ok){setError(credentialError(result.error));return;}
|
|
96
|
+
if(input.current)input.current.value="";setHasInput(false);changed();setPending(result.pending||[]);setRead({...read,ok:true,credential:result.credential});
|
|
97
|
+
if(method==="subscription"){close();continueSubscription?.();}else setDone(true);
|
|
98
|
+
}finally{if(active.current)setBusy(false);}
|
|
99
|
+
};
|
|
100
|
+
const d=credentialText;
|
|
101
|
+
return html`<${Dialog} title=${d(initial==="subscription"?"title":"replace")} cls="credential-dialog" busy=${busy} onClose=${close} actions=${html`<button type="button" class="btn" disabled=${busy} onClick=${close}>${d(done?"close":"cancel")}</button><button type="button" class="btn btn-primary" disabled=${busy||!read?.ok||done||(method!=="subscription"&&(!hasInput||!read.local))} onClick=${save}>${d(method==="subscription"?"continue":"save")}</button>`}>
|
|
102
|
+
<p><strong>${d("profile")}: ${profile||d("default")}</strong></p>
|
|
103
|
+
<fieldset class="field" disabled=${busy}><legend>${d("method")}</legend><div class="checks">${["subscription","oauth","api"].map(kind=>html`<div class="credential-method-row"><label class="check"><input type="radio" name="claude-credential-method" value=${kind} checked=${method===kind} onChange=${()=>{if(input.current)input.current.value="";setMethod(kind);setHasInput(false);setDone(false);setError("");}} /><span>${d(kind)}</span></label><a class="btn btn-ghost credential-help" data-trust="navigation" href=${credentialHelpUrl(kind)} target="_blank" rel="noopener noreferrer">${d("help")}<${Icon} name="external" size=${14} /></a></div>`)}</div></fieldset>
|
|
104
|
+
<p>${d(method+"Hint")}</p>
|
|
105
|
+
${!read?html`<${Skeleton} variant="rows" lines=${2} />`:!read.ok?html`<${ErrorState} title=${e("read")} message=${["credential_unavailable"].includes(read.error)?e("read"):credentialError(read.error)} onRetry=${load} />`:null}
|
|
106
|
+
${method==="oauth"?html`<${ClaudeTokenFetch} key=${profile?"profile:"+profile:"default"} profile=${profile} read=${read} onBusy=${setBusy} onSaved=${result=>{if(input.current)input.current.value="";setHasInput(false);changed();setRead({...read,credential:result.credential});setPending(result.pending||[]);setDone(true);}} />`:null}
|
|
107
|
+
${method!=="subscription"?html`<div class="field"><label for="claudeCredentialSecret">${d(method==="oauth"?"tokenLabel":"apiLabel")}</label><input ref=${inputRef.current} id="claudeCredentialSecret" type="password" onInput=${event=>setHasInput(!!event.target.value)} disabled=${busy||done||!read?.ok||!read.local} autocomplete="off" spellcheck=${false} placeholder=${d("paste")} /><p class="note">${d("saved")}</p></div><p class="note">${read?.local?d("local"):e("local")}</p>${initial!=="subscription"?html`<p class="note">${d("replacement")}</p>`:null}<details class="credential-disclosure"><summary><span>${d("runtime")}</span><${Icon} name="chevron" size=${16} /></summary><p class="note">${d("runtimeHint")}</p></details>`:null}
|
|
108
|
+
<p class="note credential-managed-policy">${e("managedPolicy")}</p>
|
|
109
|
+
${pending.length?html`<p role="status" class="note">${e("pending")} ${pending.join(", ")}</p>`:null}
|
|
110
|
+
${error?html`<p role="alert" class="err">${error}</p>`:null}${done?html`<p role="status">${d("done")}</p>`:null}
|
|
111
|
+
</${Dialog}>`;
|
|
112
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Safe Connect-account views only. The token never reaches this module.
|
|
2
|
+
import { html, useEffect, useRef, useState } from "/assets/app-html.js";
|
|
3
|
+
import { register, t } from "/assets/app-i18n.js";
|
|
4
|
+
import { confirmDialog } from "/assets/ui-confirm.js";
|
|
5
|
+
register("claudeTokenFetch",{
|
|
6
|
+
en:{get:"Get a token for me",paste:"Or paste a setup-token below",hint:"AgEnD opens a private sign-in session. Sign in on Claude’s website; the token goes straight into encrypted storage and is never displayed.",open:"Open sign-in page",code:"Authorization code",submit:"Submit authorization code",cancel:"Cancel connecting",waiting:"Waiting for Claude’s sign-in page…",working:"Waiting for you to finish signing in…",done:"Token saved. No model request was made.",failed:"The token could not be confirmed saved. Read the account status before retrying here or pasting a token below.",expired:"Sign-in timed out after 10 minutes. Retry here or paste a token below.",revoked:"Your verified session changed. Open this computer’s local dashboard, verify again, and retry.",cleanup:"The private session could not be confirmed closed. Ask the host operator to check it before reconnecting.",confirm:"Get a token and replace the saved credential?",restart:"After sign-in, agents using this account restart only when idle:",go:"Continue",pending:"Saved; these agents still need a restart:"},
|
|
7
|
+
"zh-TW":{get:"幫我取得 Token",paste:"或在下方貼上 setup-token",hint:"AgEnD 會開啟私密登入工作階段。請在 Claude 網站登入;Token 會直接加密保存,不會顯示出來。",open:"開啟登入頁面",code:"授權碼",submit:"送出授權碼",cancel:"取消連接",waiting:"正在等候 Claude 登入頁面…",working:"正在等你完成登入…",done:"Token 已儲存,沒有發出模型請求。",failed:"無法確認 Token 是否已儲存。請先讀取帳號狀態,再在這裡重試或在下方貼上 Token。",expired:"登入已超過 10 分鐘。請重試,或在下方貼上 Token。",revoked:"已驗證的工作階段已變更。請在這台電腦開啟本機儀表板,重新驗證後再試。",cleanup:"無法確認私密工作階段已關閉。請先請主機操作者檢查,再重新連接。",confirm:"要取得 Token 並取代保存的憑證嗎?",restart:"登入後,使用這個帳號的 Agent 只會在空閒時重啟:",go:"繼續",pending:"已儲存,以下 Agent 仍需重啟:"}
|
|
8
|
+
});
|
|
9
|
+
const text=k=>t("claudeTokenFetch."+k);
|
|
10
|
+
async function request(body){try{const r=await fetch("/ui/claude-credentials/setup-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)});const value=await r.json();return r.ok?value:{error:value.error||"credential_unavailable"};}catch{return {error:"credential_unavailable"};}}
|
|
11
|
+
export function ClaudeTokenFetch({profile,read,onBusy,onSaved}){
|
|
12
|
+
const [run,setRun]=useState(null),[error,setError]=useState(""),[starting,setStarting]=useState(false);
|
|
13
|
+
const current=useRef(null),alive=useRef(true),input=useRef(null),owned=useRef(null),pending=useRef(false);
|
|
14
|
+
const ongoing=run&&!["done","failed"].includes(run.login.phase);
|
|
15
|
+
const receive=value=>{if(!alive.current)return;if(value.error){setError(value.error.includes("session")||value.error.includes("verified")?"revoked":"failed");onBusy?.(false);setRun(previous=>previous?{...previous,login:{...previous.login,phase:"failed"}}:null);return;}current.current=value;setRun(value);if(value.login.phase==="done"){owned.current=null;onSaved?.(value);}if(value.login.phase==="done"||value.login.phase==="failed")onBusy?.(false);};
|
|
16
|
+
useEffect(()=>{alive.current=true;return()=>{alive.current=false;if(input.current)input.current.value="";const id=owned.current;if(id)void request({operation:"cancel",id});onBusy?.(false);};},[]);
|
|
17
|
+
useEffect(()=>{if(!ongoing)return;let stopped=false;const timer=setInterval(()=>{if(pending.current)return;pending.current=true;void request({operation:"read",id:run.login.id}).then(value=>{if(!stopped)receive(value);}).finally(()=>{pending.current=false;});},500);return()=>{stopped=true;clearInterval(timer);};},[ongoing,run?.login.id]);
|
|
18
|
+
const start=async()=>{setError("");if(!read?.ok||!read.local)return;setStarting(true);try{
|
|
19
|
+
const consumers=read.consumers;
|
|
20
|
+
if(consumers?.users?.length&&!await confirmDialog({title:text("confirm"),message:[text("restart"),...consumers.users].join("\n\n"),confirmLabel:text("go")}))return;
|
|
21
|
+
if(!alive.current)return;onBusy?.(true);
|
|
22
|
+
const result=await request({operation:"start",profile:profile||null,revision:read.credential?.revision||0,...(consumers?.users?.length?{restart:true,consumersRevision:consumers.revision}:{})});
|
|
23
|
+
if(result.started)owned.current=result.started;
|
|
24
|
+
if(!alive.current){if(result.started)void request({operation:"cancel",id:result.started});return;}
|
|
25
|
+
if(result.error)onBusy?.(false);receive(result);
|
|
26
|
+
}finally{if(alive.current)setStarting(false);}};
|
|
27
|
+
const cancel=async()=>{const id=owned.current||current.current?.login?.id;if(!id)return;owned.current=null;receive(await request({operation:"cancel",id}));};
|
|
28
|
+
const submit=async()=>{const value=input.current?.value||"";if(!value||!current.current)return;const login=current.current.login;const result=await request({operation:"input",id:login.id,revision:login.revision,action:{kind:"code",value}});if(input.current)input.current.value="";receive(result);};
|
|
29
|
+
const login=run?.login,reason=login?.reason,fail=reason==="expired"?"expired":reason==="revoked"?"revoked":reason==="cleanup_failed"?"cleanup":"failed";
|
|
30
|
+
return html`<section class="field credential-token-fetch"><button type="button" class="btn" disabled=${starting||ongoing||!read?.ok||!read.local} onClick=${start}>${text("get")}</button><p class="note">${text("hint")}</p>
|
|
31
|
+
${ongoing?html`<p role="status">${text(login.url?"working":"waiting")}</p>${login.url?html`<a class="btn btn-primary" data-trust="navigation" href=${login.url} target="_blank" rel="noopener noreferrer">${text("open")}</a>`:null}
|
|
32
|
+
${login.phase==="code"&&login.canAct?html`<div class="field"><label for="claudeSetupTokenCode">${text("code")}</label><input ref=${input} id="claudeSetupTokenCode" type="password" autocomplete="off" spellcheck=${false} /><button type="button" class="btn" onClick=${submit}>${text("submit")}</button></div>`:null}
|
|
33
|
+
<button type="button" class="btn danger" onClick=${cancel}>${text("cancel")}</button>`:null}
|
|
34
|
+
${error||login?.phase==="failed"?html`<p role="alert" class="err">${text(error||fail)}</p>`:null}${login?.phase==="done"?html`<p role="status">${text("done")}</p>`:null}
|
|
35
|
+
${run?.pending?.length?html`<p class="note">${text("pending")} ${run.pending.join(", ")}</p>`:null}<p class="note">${text("paste")}</p></section>`;
|
|
36
|
+
}
|
|
@@ -16,8 +16,10 @@ async function call(method, url, body) {
|
|
|
16
16
|
} catch { return { ok: false, status: 0, code: "failed" }; }
|
|
17
17
|
if (!r.ok) {
|
|
18
18
|
let code = codeOf(r.status);
|
|
19
|
-
if (r.status === 409 || r.status === 400) {
|
|
20
|
-
try { const b = await r.json(); const c = b && (b.code || b.error); if (CONFLICTS.has(c) || c === "invalid-approver"
|
|
19
|
+
if (r.status === 409 || r.status === 400 || r.status === 403) {
|
|
20
|
+
try { const b = await r.json(); const c = b && (b.code || b.error); if (CONFLICTS.has(c) || c === "invalid-approver" || c === "verification-required") code = c;
|
|
21
|
+
else if (c === "Write rejected — missing or wrong CSRF token (reload the page)") code = "csrf";
|
|
22
|
+
else if (c === "Cross-site request rejected") code = "cross-site"; } catch { /* no body: the status's own code */ }
|
|
21
23
|
}
|
|
22
24
|
return { ok: false, status: r.status, code };
|
|
23
25
|
}
|
|
@@ -29,6 +31,8 @@ const enc = encodeURIComponent;
|
|
|
29
31
|
export const getPermissions = (name) => call("GET", `/ui/api/instances/${enc(name)}/contact-permissions`);
|
|
30
32
|
/** ContactPermissionsWrite (with the revision read) → ContactPermissions. */
|
|
31
33
|
export const putPermissions = (name, write) => call("PUT", `/ui/api/instances/${enc(name)}/contact-permissions`, write);
|
|
34
|
+
/** Explicit administrator override; never accepts a client-supplied origin/person. */
|
|
35
|
+
export const clearOrigin = (name, snapshot) => call("POST", `/ui/api/instances/${enc(name)}/contact-permissions/origin-clear`, snapshot);
|
|
32
36
|
/** ContactTicketPage: { items, nextCursor }; filters: status, agent, person (an exact server identity key), cursor. */
|
|
33
37
|
export function listTickets(filters = {}) {
|
|
34
38
|
const q = new URLSearchParams();
|
|
@@ -46,3 +50,6 @@ export const shortTicketId = (id) => { const s = String(id || ""); return /^R[a-
|
|
|
46
50
|
/** A person's whole server identity as the server's canonical key — JSON of [platform, adapterId, userId] (ids may hold any
|
|
47
51
|
* punctuation) — what the person filter takes; never a name. */
|
|
48
52
|
export const personKey = (p) => (p ? JSON.stringify([p.platform, p.adapterId, p.userId]) : "");
|
|
53
|
+
|
|
54
|
+
/** Reminder dismissal only; never a contact approval or a permissions write. */
|
|
55
|
+
export const dismissSuggestion = (id) => call("POST", "/ui/needs/ack", { id });
|
|
@@ -19,9 +19,17 @@ register("contactAuth", {
|
|
|
19
19
|
switchRestricted: "Switch to restricted", switchLegacy: "Turn restricted mode off",
|
|
20
20
|
confirmRestricted: "Switch this room to restricted mode?", confirmLegacy: "Turn restricted mode off? Requests from this room will go to other agents without approval. Work already handed to another agent stays as it is.",
|
|
21
21
|
wouldDisableTitle: "These tools will stop in this room:", wouldDisableNone: "No tool this room uses now will stop.",
|
|
22
|
+
// M-3387: what stops, by kind and layer.
|
|
23
|
+
toolsLostTitle: "AgEnD tools this room loses ({0}):", toolGroupLine: "• {0} ({1})",
|
|
24
|
+
toolGroup_fleet: "Fleet status and settings", toolGroup_agents: "Creating, starting and stopping agents and teams", toolGroup_usage: "Usage and logs",
|
|
25
|
+
toolGroup_schedules: "Schedules", toolGroup_tasks: "Task board and decisions", toolGroup_look: "Appearance, office and emoji",
|
|
26
|
+
toolGroup_repos: "Repositories and deployments", toolGroup_hub: "Hub rooms",
|
|
27
|
+
cliToolsLine: "The AI tool's own tools ({0}): {1}",
|
|
28
|
+
toolLayers: "Two layers: switching takes AgEnD's own tools away from this room. The AI tool's own tools (its shell, files, web) are stopped by the command-line guard, and only where the guard covers this room.",
|
|
29
|
+
showAllTools: "Show all {0} tool names",
|
|
22
30
|
impactIncomplete: "The backend's own tool list couldn't be read, so other tools may stop too.",
|
|
23
31
|
suggestBanner: "We suggest switching this room to restricted mode.",
|
|
24
|
-
switchOriginNote: "After switching, existing history is treated as unknown. New contacts, including an admin's, need approval; allowed-contact grants cannot match. Approval
|
|
32
|
+
switchOriginNote: "After switching, existing history is treated as unknown. New contacts, including an admin's, need approval; allowed-contact grants cannot match. Approval endorses this delivery without adding its origin to the receiving agent or clearing the source agent's retained origin.",
|
|
25
33
|
// Approvers
|
|
26
34
|
approversTitle: "Approvers", approversInherited: "Inherited from the agent's channel admins.", approversNone: "No channel approvers are selected. A verified host operator is the only permitted approver.",
|
|
27
35
|
approverRemove: "Remove {0}", approversReset: "Use the channel admins again",
|
|
@@ -60,31 +68,56 @@ register("contactAuth", {
|
|
|
60
68
|
grantsNote: "For a known origin, every originating person needs a matching allowed contact. Unknown origins cannot match these grants and need separate approval.",
|
|
61
69
|
grantRow: "{0} → {1}", grantVerbs: "For: {0}", grantExpires: "Until {0}", grantUses: "{0} uses left", grantUnlimited: "Until it expires",
|
|
62
70
|
grantRemove: "Remove", grantRemoveConfirm: "Remove this allowed contact? Later requests will ask again.",
|
|
71
|
+
originTitle: "Retained origin", originClear: "Clear retained origin", originCleared: "Retained origin cleared.",
|
|
72
|
+
originKind_none: "No retained origin", originKind_human: "One known person", originKind_mixed: "Multiple known people", originKind_unknown: "Unknown origin",
|
|
73
|
+
originPeople: "Originating people", originPeopleNone: "No known person.", originChain: "Agent hops", originChainNone: "No retained hops",
|
|
74
|
+
originReceipts: "{0} retained receipts", originLastCleared: "Last cleared by {0} at {1}",
|
|
75
|
+
originRetainedNote: "Origins stay with this agent, including work inherited from other agents. Only a managing administrator can explicitly clear them; idle, compaction and later admin messages do not.",
|
|
76
|
+
originClearConfirm: "Clear this agent's retained origin? You accept its current conversation as your own work. Earlier text is not erased. New non-admin requests will require approval again. Other agents, existing tickets and grants are unchanged.",
|
|
63
77
|
// History
|
|
64
78
|
historyTitle: "History", historyNone: "Nothing yet.",
|
|
79
|
+
"action_origin-clear": "Retained origin cleared",
|
|
65
80
|
action_policy: "Settings changed", action_approve: "Approved", action_decline: "Declined", "action_grant-add": "Contact allowed", "action_grant-remove": "Contact removed",
|
|
66
81
|
// Tickets
|
|
67
|
-
ticket: "Contact request #{0}", forwarded: "Forwarded (approved)",
|
|
82
|
+
ticketTitle: "Contact request", ticket: "Contact request #{0}", forwarded: "Forwarded (approved)",
|
|
68
83
|
state_pending: "Waiting for approval", state_approved: "Approved", state_delivered: "Forwarded", state_declined: "Declined", state_expired: "Expired", state_unknown: "Unknown",
|
|
69
84
|
verb_send_to_instance: "message", verb_delegate_task: "task", verb_request_information: "question", verb_broadcast: "broadcast", verb_report_result: "report",
|
|
70
85
|
from: "From {0}", via: "Via {0}", to: "To {0}", origin_unknown: "Origin unknown", origin_mixed: "Earlier non-admin request",
|
|
71
86
|
"reason_earlier-non-admin": "This agent's retained history includes non-admin input, so this contact needs approval.",
|
|
72
87
|
"reason_unknown-origin": "This agent's retained history has an unknown origin, so this contact needs approval.",
|
|
73
|
-
|
|
88
|
+
// M-3385: under the reason — what an approval leaves as it is, and the one way this agent stops needing approval.
|
|
89
|
+
resetNote: "Approving forwards only this request and leaves the receiving agent's origin unchanged. For this agent's contacts to stop needing approval, a managing administrator can clear its retained origin in its Permissions; it never resets on its own.",
|
|
74
90
|
created: "Asked {0}", expires: "Expires {0}", decided: "{0} by {1}",
|
|
75
|
-
approveOnce: "Approve once", decline: "Decline",
|
|
76
|
-
|
|
91
|
+
approveOnce: "Approve once", decline: "Decline", alsoAllowUntil: "Until", alsoAllowUses: "Uses (empty: no limit)",
|
|
92
|
+
// M-3385: what the card's parts do, said where they are.
|
|
93
|
+
// M-3385 (the user, 11-20): short visible words; the detail in an ⓘ (ui-style-guide rule 14).
|
|
94
|
+
alsoAllow: "Forward requests like this from now on",
|
|
95
|
+
alsoAllowMore: "{0}'s {1} requests from {2} to {3} will be forwarded without asking. This adds an allowed contact to {3}'s Permissions, until the date or the number of uses you set; you can remove it there at any time.",
|
|
96
|
+
alsoAllowAbout: "About forwarding requests like this",
|
|
97
|
+
messageLabel: "What it asks",
|
|
98
|
+
expiresPending: "Expires {0}: a request waits {1} minutes for a decision. After that nothing is forwarded, even if it was approved.",
|
|
99
|
+
decidedNote: "Approve = forward this request once.",
|
|
100
|
+
decidedNoteMore: "The receiving agent's later contacts are judged by its own history only; this approval doesn't carry the requester's origin forward. So if its own history allows it, the receiving agent may pass the approved content on to other agents without another approval.",
|
|
101
|
+
decidedNoteAbout: "About approving",
|
|
77
102
|
deliveryNote: "Forwarded means the request was delivered, not that the work is done.",
|
|
78
103
|
// Fleet → Authorizations
|
|
79
|
-
pageTitle: "Authorizations", pageLead: "
|
|
104
|
+
pageTitle: "Authorizations", pageLead: "Contact requests from ClassicBot rooms to other agents.",
|
|
80
105
|
filterStatus: "Show", filter_pending: "Waiting", filter_all: "All", filterAgent: "Agent", filterAny: "Any",
|
|
81
106
|
filterPerson: "Only {0}", filterPersonClear: "Show everyone",
|
|
82
|
-
empty: "No requests.", emptyPending: "Nothing is waiting for approval.", more: "Show more",
|
|
107
|
+
emptyHint: "Contact requests from restricted ClassicBot rooms to other agents appear here.", viewAll: "View all records", empty: "No requests.", emptyPending: "Nothing is waiting for approval.", more: "Show more",
|
|
83
108
|
decideFailed: "Couldn't record the decision.", alreadyDecided: "This request was decided elsewhere. It has been reloaded.",
|
|
84
109
|
// Needs you / suggestion
|
|
85
|
-
needsTitle: "{0} wants to contact {1}", needsOpen: "Open",
|
|
110
|
+
needsTitle: "{0} wants to contact {1}", needsOpen: "Open in Authorizations",
|
|
86
111
|
suggestTitle: "We suggest switching this room to restricted mode",
|
|
112
|
+
suggestGroup: "{0} existing ClassicBot room(s) can switch to restricted mode",
|
|
87
113
|
suggestBody: "Requests from people who aren't admins to other agents would wait for approval first.",
|
|
114
|
+
laterRefresh: "This page’s write verification failed. Reopen the dashboard at its own address, refresh it, then choose Later again.",
|
|
115
|
+
laterSignedOut: "Your session has ended. Sign in again, then choose Later.",
|
|
116
|
+
laterVerify: "Verify your administrator identity in Sign-in status, then choose Later. Nothing was hidden.",
|
|
117
|
+
laterForbidden: "This account is not an administrator for this room. Sign in with that room’s administrator account, then try again.",
|
|
118
|
+
laterMissing: "This reminder or its action is no longer available. Refresh this page, then try again.",
|
|
119
|
+
laterNetwork: "Could not reach AgEnD. Check your connection, then choose Later again.",
|
|
120
|
+
laterUnavailable: "Could not save this reminder. Check free space and file permissions on the AgEnD host, then try again.",
|
|
88
121
|
suggestSwitch: "Switch this room", suggestView: "See the impact and allowed contacts", suggestLater: "Later",
|
|
89
122
|
},
|
|
90
123
|
"zh-TW": {
|
|
@@ -99,9 +132,16 @@ register("contactAuth", {
|
|
|
99
132
|
switchRestricted: "切換為受限模式", switchLegacy: "關閉受限模式",
|
|
100
133
|
confirmRestricted: "要將這個房間切換為受限模式嗎?", confirmLegacy: "要關閉受限模式嗎?這個房間的請求將直接送給其他 Agent,不需核准。已交給其他 Agent 的工作不會因此改變。",
|
|
101
134
|
wouldDisableTitle: "這個房間將停用下列工具:", wouldDisableNone: "這個房間目前使用的工具都不會停用。",
|
|
135
|
+
toolsLostTitle: "這個房間會失去的 AgEnD 工具({0} 個):", toolGroupLine: "• {0}({1})",
|
|
136
|
+
toolGroup_fleet: "Fleet 狀態與設定", toolGroup_agents: "建立、啟動與停止 Agent 和團隊", toolGroup_usage: "用量與紀錄",
|
|
137
|
+
toolGroup_schedules: "排程", toolGroup_tasks: "任務板與決策", toolGroup_look: "外觀、辦公室與表情",
|
|
138
|
+
toolGroup_repos: "程式庫與部署", toolGroup_hub: "Hub 房間",
|
|
139
|
+
cliToolsLine: "AI 工具本身的工具({0} 個):{1}",
|
|
140
|
+
toolLayers: "分成兩層:切換後,這個房間會失去 AgEnD 自己的工具;AI 工具本身的工具(命令列、檔案、網路)則由命令列防護停用,而且只有在防護涵蓋這個房間時才會停用。",
|
|
141
|
+
showAllTools: "顯示全部 {0} 個工具名稱",
|
|
102
142
|
impactIncomplete: "無法讀取後端本身的工具清單,因此可能還有其他工具會停用。",
|
|
103
143
|
suggestBanner: "建議將這個房間切換為受限模式。",
|
|
104
|
-
switchOriginNote: "
|
|
144
|
+
switchOriginNote: "切換後,既有歷史會視為來源不明。包含管理員在內的新聯絡都須逐筆核准,允許的聯絡授權無法配對;核准是對這次轉交背書,不會將來源加到接收的 Agent,也不會清除發送 Agent 自己保留的來源。",
|
|
105
145
|
approversTitle: "核准人", approversInherited: "沿用這個 Agent 所在頻道的管理員。", approversNone: "尚未選定頻道核准人,僅允許已驗證的主機操作者核准。",
|
|
106
146
|
approverRemove: "移除 {0}", approversReset: "改回沿用頻道管理員",
|
|
107
147
|
approverAdmins: "目前核准人必須是 Fleet 管理員。", approverPick: "新增核准人", approverAdd: "新增", approverNone: "選擇…",
|
|
@@ -136,27 +176,49 @@ register("contactAuth", {
|
|
|
136
176
|
grantsNote: "來源已知時,每位最初提問者都須有相符的允許聯絡授權。來源不明無法配對這些授權,須另外核准。",
|
|
137
177
|
grantRow: "{0} → {1}", grantVerbs: "用途:{0}", grantExpires: "到 {0} 為止", grantUses: "剩下 {0} 次", grantUnlimited: "到期前不限次數",
|
|
138
178
|
grantRemove: "移除", grantRemoveConfirm: "要移除這個常用轉交嗎?之後的請求會再次詢問。",
|
|
179
|
+
originTitle: "保留的來源", originClear: "清除保留的來源", originCleared: "已清除保留的來源。",
|
|
180
|
+
originKind_none: "沒有保留的來源", originKind_human: "一位已知提問者", originKind_mixed: "多位已知提問者", originKind_unknown: "來源不明",
|
|
181
|
+
originPeople: "最初提問者", originPeopleNone: "沒有已知提問者。", originChain: "Agent 轉交路徑", originChainNone: "沒有保留的轉交路徑",
|
|
182
|
+
originReceipts: "保留 {0} 筆來源紀錄", originLastCleared: "最後由 {0} 於 {1} 清除",
|
|
183
|
+
originRetainedNote: "來源會跟著這個 Agent 保留,包含從其他 Agent 接手的工作。只有具管理權限的管理員能明確清除;閒置、壓縮對話或後來的管理員訊息都不會清除。",
|
|
184
|
+
originClearConfirm: "清除此 Agent 保留的來源?這表示你接受目前對話作為自己的工作,先前文字不會刪除。新的非管理員請求仍會再次需要核准。其他 Agent、既有申請與授權都不變。",
|
|
185
|
+
"action_origin-clear": "已清除保留的來源",
|
|
139
186
|
historyTitle: "紀錄", historyNone: "目前沒有紀錄。",
|
|
140
187
|
action_policy: "設定已變更", action_approve: "已核准", action_decline: "已拒絕", "action_grant-add": "已加入常用轉交", "action_grant-remove": "已移除常用轉交",
|
|
141
|
-
ticket: "聯絡申請 #{0}", forwarded: "已准轉交",
|
|
188
|
+
ticketTitle: "聯絡申請", ticket: "聯絡申請 #{0}", forwarded: "已准轉交",
|
|
142
189
|
state_pending: "等待核准", state_approved: "已核准", state_delivered: "已准轉交", state_declined: "已拒絕", state_expired: "已過期", state_unknown: "狀態不明",
|
|
143
190
|
verb_send_to_instance: "訊息", verb_delegate_task: "交辦工作", verb_request_information: "詢問", verb_broadcast: "廣播", verb_report_result: "回報結果",
|
|
144
191
|
from: "來自 {0}", via: "經由 {0}", to: "給 {0}", origin_unknown: "來源不明", origin_mixed: "先前有非管理員的請求",
|
|
145
192
|
"reason_earlier-non-admin": "這個 Agent 保留的歷史含有非管理員輸入,因此這次聯絡需要核准。",
|
|
146
193
|
"reason_unknown-origin": "這個 Agent 保留的歷史來源不明,因此這次聯絡需要核准。",
|
|
147
|
-
resetNote: "
|
|
194
|
+
resetNote: "核准只會轉交這一筆,接收 Agent 的來源維持原狀。若要讓這個 Agent 之後的聯絡不再需要核准,具管理權限的管理員可以在它的「權限」頁清除保留的來源;來源不會自動重設。",
|
|
148
195
|
created: "{0} 提出", expires: "{0} 到期", decided: "{1} 於 {0} 處理",
|
|
149
|
-
approveOnce: "核准這一次", decline: "拒絕",
|
|
150
|
-
|
|
196
|
+
approveOnce: "核准這一次", decline: "拒絕", alsoAllowUntil: "到期時間", alsoAllowUses: "次數(留空表示不限)",
|
|
197
|
+
alsoAllow: "之後同樣的請求也直接轉交",
|
|
198
|
+
alsoAllowMore: "之後 {0} 從 {2} 發給 {3} 的{1}請求會直接轉交,不必再核准。這會在 {3} 的權限頁新增一筆常用轉交,到你設定的到期時間或次數用完為止;隨時可以在那裡移除。",
|
|
199
|
+
alsoAllowAbout: "「同樣的請求也直接轉交」的說明",
|
|
200
|
+
messageLabel: "請求內容",
|
|
201
|
+
expiresPending: "{0} 到期:申請只等待 {1} 分鐘,逾時後即使已核准也不會轉交。",
|
|
202
|
+
decidedNote: "核准=只轉交這一次。",
|
|
203
|
+
decidedNoteMore: "接收 Agent 之後聯絡其他 Agent 時,只看它自己原本的歷史,這次核准不會把提問者的來源帶過去;因此,如果它自己的歷史允許,它可以把已核准的內容繼續轉交給其他 Agent,不必再次取得核准。",
|
|
204
|
+
decidedNoteAbout: "核准的說明",
|
|
151
205
|
deliveryNote: "「已准轉交」表示請求已送達,不代表工作已完成。",
|
|
152
|
-
pageTitle: "授權", pageLead: "ClassicBot 房間對其他 Agent
|
|
206
|
+
pageTitle: "授權", pageLead: "ClassicBot 房間對其他 Agent 提出的聯絡申請與核准紀錄。",
|
|
153
207
|
filterStatus: "顯示", filter_pending: "等待中", filter_all: "全部", filterAgent: "Agent", filterAny: "任何",
|
|
154
208
|
filterPerson: "只看 {0}", filterPersonClear: "顯示所有人",
|
|
155
|
-
empty: "沒有請求。", emptyPending: "沒有等待核准的請求。", more: "顯示更多",
|
|
209
|
+
emptyHint: "當受限模式的 ClassicBot 房間向其他 Agent 提出聯絡申請時,會顯示在這裡。", viewAll: "查看全部紀錄", empty: "沒有請求。", emptyPending: "沒有等待核准的請求。", more: "顯示更多",
|
|
156
210
|
decideFailed: "無法記錄這個決定。", alreadyDecided: "這個請求已在其他地方處理,已重新載入。",
|
|
157
|
-
needsTitle: "{0} 想聯絡 {1}", needsOpen: "
|
|
211
|
+
needsTitle: "{0} 想聯絡 {1}", needsOpen: "在「授權」頁開啟",
|
|
158
212
|
suggestTitle: "建議將這個房間切換為受限模式",
|
|
213
|
+
suggestGroup: "{0} 個既有 ClassicBot 房間可以切換為受限模式",
|
|
159
214
|
suggestBody: "非管理員對其他 Agent 的請求,將先經過核准才會送出。",
|
|
215
|
+
laterRefresh: "這個頁面的寫入驗證未通過。請從儀表板原網址開啟並重新整理,再按「稍後」。",
|
|
216
|
+
laterSignedOut: "登入已失效。請重新登入,再按「稍後」。",
|
|
217
|
+
laterVerify: "請先在「登入狀態」驗證管理員身分,再按「稍後」。提醒尚未隱藏。",
|
|
218
|
+
laterForbidden: "這個帳號不是該房間的管理員。請以該房間的管理員帳號登入後再試。",
|
|
219
|
+
laterMissing: "這則提醒或操作已不存在。請重新整理頁面後再試。",
|
|
220
|
+
laterNetwork: "無法連上 AgEnD。請確認網路連線,再按「稍後」。",
|
|
221
|
+
laterUnavailable: "無法儲存這則提醒。請檢查 AgEnD 主機的可用空間與檔案權限後再試。",
|
|
160
222
|
suggestSwitch: "切換這個房間", suggestView: "查看影響與常用轉交", suggestLater: "稍後",
|
|
161
223
|
},
|
|
162
224
|
});
|