clay-server 5.7.0-beta.1 → 5.7.0-beta.3
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 +4 -0
- package/bin/cli.js +2 -0
- package/lib/clay-product-control.js +1 -1
- package/lib/cli-project-recovery.js +22 -0
- package/lib/daemon.js +2 -0
- package/lib/project-admin-overview.js +4 -4
- package/lib/project-ownership-recovery.js +7 -5
- package/lib/project-recovery-approvals.js +38 -0
- package/lib/public/app.js +1 -0
- package/lib/public/css/project-admin-overview.css +9 -0
- package/lib/public/css/project-settings-modal.css +5 -0
- package/lib/public/mate-avatars/B01.webp +0 -0
- package/lib/public/mate-avatars/B02.webp +0 -0
- package/lib/public/mate-avatars/B03.webp +0 -0
- package/lib/public/mate-avatars/B04.webp +0 -0
- package/lib/public/mate-avatars/B05.webp +0 -0
- package/lib/public/mate-avatars/B06.webp +0 -0
- package/lib/public/mate-avatars/B07.webp +0 -0
- package/lib/public/mate-avatars/B08.webp +0 -0
- package/lib/public/mate-avatars/B09.webp +0 -0
- package/lib/public/mate-avatars/B10.webp +0 -0
- package/lib/public/mate-avatars/B11.webp +0 -0
- package/lib/public/mate-avatars/B12.webp +0 -0
- package/lib/public/mate-avatars/B13.webp +0 -0
- package/lib/public/mate-avatars/B14.webp +0 -0
- package/lib/public/mate-avatars/B15.webp +0 -0
- package/lib/public/mate-avatars/B16.webp +0 -0
- package/lib/public/mate-avatars/B17.webp +0 -0
- package/lib/public/mate-avatars/B18.webp +0 -0
- package/lib/public/mate-avatars/B19.webp +0 -0
- package/lib/public/mate-avatars/B20.webp +0 -0
- package/lib/public/mate-avatars/B21.webp +0 -0
- package/lib/public/mate-avatars/B22.webp +0 -0
- package/lib/public/mate-avatars/B23.webp +0 -0
- package/lib/public/mate-avatars/B24.webp +0 -0
- package/lib/public/mate-avatars/B25.webp +0 -0
- package/lib/public/mate-avatars/B26.webp +0 -0
- package/lib/public/mate-avatars/B27.webp +0 -0
- package/lib/public/mate-avatars/B28.webp +0 -0
- package/lib/public/mate-avatars/B29.webp +0 -0
- package/lib/public/mate-avatars/B30.webp +0 -0
- package/lib/public/mate-avatars/B31.webp +0 -0
- package/lib/public/mate-avatars/B32.webp +0 -0
- package/lib/public/mate-avatars/B33.webp +0 -0
- package/lib/public/mate-avatars/B34.webp +0 -0
- package/lib/public/mate-avatars/B35.webp +0 -0
- package/lib/public/mate-avatars/B36.webp +0 -0
- package/lib/public/mate-avatars/B37.webp +0 -0
- package/lib/public/mate-avatars/B38.webp +0 -0
- package/lib/public/mate-avatars/B39.webp +0 -0
- package/lib/public/mate-avatars/B40.webp +0 -0
- package/lib/public/mate-avatars/B41.webp +0 -0
- package/lib/public/mate-avatars/B42.webp +0 -0
- package/lib/public/mate-avatars/B43.webp +0 -0
- package/lib/public/mate-avatars/B44.webp +0 -0
- package/lib/public/mate-avatars/B45.webp +0 -0
- package/lib/public/mate-avatars/B46.webp +0 -0
- package/lib/public/mate-avatars/B47.webp +0 -0
- package/lib/public/mate-avatars/B48.webp +0 -0
- package/lib/public/mate-avatars/C01.webp +0 -0
- package/lib/public/mate-avatars/C02.webp +0 -0
- package/lib/public/mate-avatars/C03.webp +0 -0
- package/lib/public/mate-avatars/C04.webp +0 -0
- package/lib/public/mate-avatars/C05.webp +0 -0
- package/lib/public/mate-avatars/C06.webp +0 -0
- package/lib/public/mate-avatars/C07.webp +0 -0
- package/lib/public/mate-avatars/C08.webp +0 -0
- package/lib/public/mate-avatars/C09.webp +0 -0
- package/lib/public/mate-avatars/C10.webp +0 -0
- package/lib/public/mate-avatars/C11.webp +0 -0
- package/lib/public/mate-avatars/C12.webp +0 -0
- package/lib/public/mate-avatars/C13.webp +0 -0
- package/lib/public/mate-avatars/C14.webp +0 -0
- package/lib/public/mate-avatars/C15.webp +0 -0
- package/lib/public/mate-avatars/C16.webp +0 -0
- package/lib/public/mate-avatars/C17.webp +0 -0
- package/lib/public/mate-avatars/C18.webp +0 -0
- package/lib/public/mate-avatars/C19.webp +0 -0
- package/lib/public/mate-avatars/C20.webp +0 -0
- package/lib/public/mate-avatars/C21.webp +0 -0
- package/lib/public/mate-avatars/C22.webp +0 -0
- package/lib/public/mate-avatars/C23.webp +0 -0
- package/lib/public/mate-avatars/C24.webp +0 -0
- package/lib/public/mate-avatars/C25.webp +0 -0
- package/lib/public/mate-avatars/C26.webp +0 -0
- package/lib/public/mate-avatars/C27.webp +0 -0
- package/lib/public/mate-avatars/C28.webp +0 -0
- package/lib/public/mate-avatars/C29.webp +0 -0
- package/lib/public/mate-avatars/C30.webp +0 -0
- package/lib/public/mate-avatars/C31.webp +0 -0
- package/lib/public/mate-avatars/C32.webp +0 -0
- package/lib/public/mate-avatars/C33.webp +0 -0
- package/lib/public/mate-avatars/C34.webp +0 -0
- package/lib/public/mate-avatars/C35.webp +0 -0
- package/lib/public/mate-avatars/C36.webp +0 -0
- package/lib/public/mate-avatars/C37.webp +0 -0
- package/lib/public/mate-avatars/C38.webp +0 -0
- package/lib/public/mate-avatars/C39.webp +0 -0
- package/lib/public/mate-avatars/C40.webp +0 -0
- package/lib/public/mate-avatars/C41.webp +0 -0
- package/lib/public/mate-avatars/C42.webp +0 -0
- package/lib/public/mate-avatars/C43.webp +0 -0
- package/lib/public/mate-avatars/C44.webp +0 -0
- package/lib/public/mate-avatars/C45.webp +0 -0
- package/lib/public/mate-avatars/C46.webp +0 -0
- package/lib/public/mate-avatars/C47.webp +0 -0
- package/lib/public/mate-avatars/C48.webp +0 -0
- package/lib/public/mate-avatars/lead-clay.webp +0 -0
- package/lib/public/mates/ally.webp +0 -0
- package/lib/public/mates/sage.webp +0 -0
- package/lib/public/mates/scout.webp +0 -0
- package/lib/public/modules/avatar.js +7 -3
- package/lib/public/modules/mate-loading-scene.js +1 -1
- package/lib/public/modules/project-admin-overview.js +6 -0
- package/lib/public/modules/project-mate-creation-workspace.js +1 -1
- package/lib/public/modules/project-ownership-recovery.js +27 -8
- package/lib/public/modules/projects-hub-view.js +1 -1
- package/lib/public/modules/projects-hub.js +3 -3
- package/lib/public/pane-assets/app-F5HT6UBS.js +1 -0
- package/lib/public/pane-assets/{chunk-7IDJFDUF.js → chunk-36DKYFF7.js} +1 -1
- package/lib/public/pane-assets/{chunk-UEQM5YNB.js → chunk-456GZLSN.js} +1 -1
- package/lib/public/pane-assets/chunk-4DO3PVB6.js +1 -0
- package/lib/public/pane-assets/{chunk-H2Z5IANY.js → chunk-4OYHHFXK.js} +1 -1
- package/lib/public/pane-assets/{chunk-7DMFCL3J.js → chunk-5ZLXFYKX.js} +1 -1
- package/lib/public/pane-assets/chunk-7KXKVFMO.js +1 -0
- package/lib/public/pane-assets/{chunk-42POZKMA.js → chunk-7LMTNV75.js} +1 -1
- package/lib/public/pane-assets/chunk-AIRF4FGA.js +1 -0
- package/lib/public/pane-assets/{chunk-3WQWIQ53.js → chunk-BHPXDA3T.js} +1 -1
- package/lib/public/pane-assets/chunk-F53Z5ENN.js +1 -0
- package/lib/public/pane-assets/{chunk-YZAEN74U.js → chunk-I4YXQNGC.js} +1 -1
- package/lib/public/pane-assets/chunk-IPKNCCKT.js +1 -0
- package/lib/public/pane-assets/chunk-IQUAB2OC.js +1 -0
- package/lib/public/pane-assets/chunk-JN4ECDNO.js +1 -0
- package/lib/public/pane-assets/{chunk-SDEVOBXA.js → chunk-JSG3RTJJ.js} +1 -1
- package/lib/public/pane-assets/{chunk-I74MAWWL.js → chunk-LQC2OFJT.js} +1 -1
- package/lib/public/pane-assets/{chunk-5525OCE4.js → chunk-OUGX7G6H.js} +1 -1
- package/lib/public/pane-assets/{chunk-NTWCEBHU.js → chunk-SPYG4RI4.js} +1 -1
- package/lib/public/pane-assets/{chunk-G2OD6CYE.js → chunk-SWJBRRHJ.js} +1 -1
- package/lib/public/pane-assets/{chunk-WBLXJD4Q.js → chunk-VMT3NK4O.js} +1 -1
- package/lib/public/pane-assets/{chunk-6WHHBK62.js → chunk-WIBQ3XAQ.js} +89 -89
- package/lib/public/pane-assets/{chunk-NZYCUCTU.js → chunk-WNWMF2SR.js} +1 -1
- package/lib/public/pane-assets/{chunk-IPEGITRJ.js → chunk-XKB3BBTT.js} +1 -1
- package/lib/public/pane-assets/manifest.json +393 -393
- package/lib/public/pane-assets/{style-WRLOVB6B.css → style-IPMITHXL.css} +1 -1
- package/lib/public/welcome-art/conversation-desk.webp +0 -0
- package/lib/public/welcome-art/mate-clay.webp +0 -0
- package/lib/public/welcome-art/project-clay.webp +0 -0
- package/lib/server-project-ownership.js +6 -2
- package/package.json +1 -1
- package/lib/public/pane-assets/app-KYK2HXZR.js +0 -1
- package/lib/public/pane-assets/chunk-3CGVMON5.js +0 -1
- package/lib/public/pane-assets/chunk-53PJD7FQ.js +0 -1
- package/lib/public/pane-assets/chunk-C4BC5QKM.js +0 -1
- package/lib/public/pane-assets/chunk-OX66WEZB.js +0 -1
- package/lib/public/pane-assets/chunk-TA6KA3QG.js +0 -1
- package/lib/public/pane-assets/chunk-TDKHZ2NU.js +0 -1
- package/lib/public/pane-assets/chunk-ZBCR4WTM.js +0 -1
package/README.md
CHANGED
|
@@ -101,6 +101,10 @@ The community-built [Clay Stream Deck plugin](https://github.com/egns-ai/clay-st
|
|
|
101
101
|
|
|
102
102
|
Building something with Clay Studio? Share it in [GitHub Discussions](https://github.com/chadbyte/clay/discussions).
|
|
103
103
|
|
|
104
|
+
## Contributing
|
|
105
|
+
|
|
106
|
+
Bug reports, feature suggestions, and pull requests for bug fixes and performance improvements are welcome. New features, intentional behavior changes, and major structural changes are designed and implemented by the maintainer; propose and discuss them in issues rather than submitting implementations. See [Contributing](CONTRIBUTING.md) for scope and submission guidance.
|
|
107
|
+
|
|
104
108
|
## Disclaimer
|
|
105
109
|
|
|
106
110
|
Clay Studio is not affiliated with the providers of the coding agents it supports. Product names and trademarks belong to their respective owners. The software is provided "as is," and users are responsible for complying with the terms of their selected providers.
|
package/bin/cli.js
CHANGED
|
@@ -51,6 +51,7 @@ function openUrl(url) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
var args = process.argv.slice(2);
|
|
54
|
+
if (require("../lib/cli-project-recovery").handleRecoveryCommand(args, { send: sendIPCCommand, socketPath: socketPath, finish: function (code) { process.exit(code); } })) return;
|
|
54
55
|
var port = _isDev ? 2635 : 2633;
|
|
55
56
|
var useHttps = true;
|
|
56
57
|
var forceMkcert = false;
|
|
@@ -126,6 +127,7 @@ for (var i = 0; i < args.length; i++) {
|
|
|
126
127
|
console.log("Usage: clay-server [-p|--port <port>] [--host <address>] [--no-https] [--no-update] [--debug] [-y|--yes] [--pin <pin>] [--shutdown] [--restart]");
|
|
127
128
|
console.log(" clay-server --add <path> Add a project to the running daemon");
|
|
128
129
|
console.log(" clay-server --remove <path> Remove a project from the running daemon");
|
|
130
|
+
console.log(" clay-server --authorize-project-recovery <slug> --owner <username>");
|
|
129
131
|
console.log(" clay-server --list List registered projects");
|
|
130
132
|
console.log("");
|
|
131
133
|
console.log("Options:");
|
|
@@ -84,7 +84,7 @@ function attachClayProductControl(ctx) {
|
|
|
84
84
|
vendorUsage: { tools: ["read_vendor_usage"], scope: "Read-only usage of the owner's own vendor accounts and sessions in one owned project, through the same service as the top bar; the owner's identity only, no refresh, credentials, URLs, commands or settings. Account figures keep each vendor's units; unreadable usage is reported with its reason." },
|
|
85
85
|
taskExecution: "Use propose_project_assignment or propose_project_follow_up to route execution through a project Driver. A stopped session cannot be resumed by this control layer.",
|
|
86
86
|
mcp: { tools: ['read_mcp_connections', 'inspect_mcp_connection_change', 'apply_mcp_connection_change', 'discover_mcp_connections', 'propose_mcp_import'], scope: 'Owner-private agent MCP catalog shared with supported Drivers and Mates. Read connections/tools and bounded Xcode readiness; exact owner-reviewed local/remote add, enable/disable, test, rename/remove, sign-in start, Xcode connect/disconnect and Client MCP toggles. Same authoritative services as human MCP management. Secure credential/token/permission forms and Client setup can be requested on the exact approving interface, with changed-context refusal and explicit client acknowledgement; acceptance does not prove visible rendering. Credentials are never accepted in agent arguments. Extension/bridge installation, extension server definitions, Xcode settings/license and direct session approval policy changes remain human steps. No general Server Settings or User Settings dispatch.', receipts: 'At most 100 per source query, ten-minute expiry, no automatic replay, no durable receipt after restart.' },
|
|
87
|
-
unsupported: { projectOwnershipRecovery: "Human administrator-only diagnosis and reviewed recovery in Project settings or the restricted project Access page. Orphan projects have no verified owner to authorize canonical project controls; canonical Clay cannot inspect or claim them.
|
|
87
|
+
unsupported: { projectOwnershipRecovery: "Human administrator-only diagnosis and reviewed recovery in Project settings or the restricted project Access page. Orphan projects have no verified owner to authorize canonical project controls; canonical Clay cannot inspect or claim them. Local machine operator approvals are CLI-only and require subsequent human administrator review. OS identity provisioning remains manual.", personalProviders: "Personal AI provider installation discovery, reviewed supported installation, sign-in and audio transcription API keys are available only in authenticated human settings. No canonical credential, provider installation or sign-in operation is exposed.", worktrees: "Worktree icon edits, exclusion and disk deletion are available only through human product controls. Restoring exclusions and reconciling pending worktree removals have no in-app operation.", archive: "No authoritative session archive service exists.", send: "Use reviewed Driver assignment or follow-up.", runtime: "New TUI presentation and cross-provider thread migration are unavailable. runtime=gui closes a legacy Claude terminal with acknowledged exit. vendor_new_session creates a private blank GUI session and retains the original without execution.", projectLifecycle: ctx.projectLifecycle ? "Create, register, rename, remove registration, project environment and owner access controls use exact human review. OS filesystem sharing changes are unavailable through this service." : "Unavailable in this runtime." },
|
|
88
88
|
excluded: ["serverSettings", "userSettings", "workerCreation", "pairOrchestration"] };
|
|
89
89
|
}
|
|
90
90
|
function inspect(args) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Local operator authority: this command never runs through the browser API.
|
|
2
|
+
function handleRecoveryCommand(args, ctx) {
|
|
3
|
+
function finish(code) { if (ctx.finish) ctx.finish(code); else process.exitCode = code; }
|
|
4
|
+
var index = args.indexOf('--authorize-project-recovery');
|
|
5
|
+
if (index === -1 || args.includes('--help') || args.includes('-h')) return false;
|
|
6
|
+
var slug = args[index + 1], ownerIndex = args.indexOf('--owner'), owner = args[ownerIndex + 1];
|
|
7
|
+
var expected = ['--authorize-project-recovery', slug, '--owner', owner];
|
|
8
|
+
if (args.includes('--dev')) expected.push('--dev');
|
|
9
|
+
if (!slug || !/^[a-z0-9_-]+$/.test(slug) || ownerIndex === -1 || !owner || owner.startsWith('--') || args.length !== expected.length || args.some(function (arg) { return !expected.includes(arg); })) {
|
|
10
|
+
console.error('Usage: clay-server [--dev] --authorize-project-recovery <slug> --owner <existing-username>'); finish(1); return true;
|
|
11
|
+
}
|
|
12
|
+
ctx.send(ctx.socketPath(), { cmd: 'authorize_project_recovery', slug: slug, owner: owner }).then(function (result) {
|
|
13
|
+
if (!result.ok) { console.error('Recovery approval failed: ' + result.error); finish(1); return; }
|
|
14
|
+
console.log('Approved recovery of ' + result.slug + ' to ' + result.owner.name + '.');
|
|
15
|
+
console.log('In Project Settings → Access → Server approval, enter this one-use code:');
|
|
16
|
+
console.log(result.approvalCode);
|
|
17
|
+
console.log('Expires at ' + new Date(result.expiresAt).toISOString() + '. Restarting the daemon also expires it. Ownership has not changed.');
|
|
18
|
+
finish(0);
|
|
19
|
+
}).catch(function (error) { console.error('Recovery approval failed: ' + error.message); finish(1); });
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
module.exports = { handleRecoveryCommand: handleRecoveryCommand };
|
package/lib/daemon.js
CHANGED
|
@@ -947,6 +947,8 @@ if (existingConfig && existingConfig.pid && existingConfig.pid !== process.pid)
|
|
|
947
947
|
var ipc = createIPCServer(socketPath(), function (msg) {
|
|
948
948
|
console.log("[daemon] IPC:", msg.cmd);
|
|
949
949
|
switch (msg.cmd) {
|
|
950
|
+
case "authorize_project_recovery":
|
|
951
|
+
return ownershipRecovery.approve(msg.slug, msg.owner);
|
|
950
952
|
case "add_project": {
|
|
951
953
|
if (!msg.path) return { ok: false, error: "missing path" };
|
|
952
954
|
var absPath = path.resolve(msg.path);
|
|
@@ -35,10 +35,10 @@ function escape(value) {
|
|
|
35
35
|
|
|
36
36
|
function page(metadata, projects) {
|
|
37
37
|
var privacyText = metadata.ownershipRecovery
|
|
38
|
-
? "Content remains restricted because no verified owner is available.
|
|
38
|
+
? "Content remains restricted because no verified owner is available. Open Access to recover ownership with verified account mapping or approval from the server operator."
|
|
39
39
|
: "Conversations, files and terminals are private. Ask the owner to share project access.";
|
|
40
40
|
var accessText = metadata.ownershipRecovery
|
|
41
|
-
? "Ownership needs recovery.
|
|
41
|
+
? "Ownership needs recovery. Use the recovery checks below. If automatic verification cannot identify an owner, follow the server approval instructions."
|
|
42
42
|
: "Only the project owner can change ownership, visibility and sharing. Administrator status does not grant access to private content.";
|
|
43
43
|
var navigation = projects.filter(function (project) { return !project.isMate; }).map(function (project) {
|
|
44
44
|
return { slug: project.slug, title: project.title || project.project || project.slug, icon: typeof project.icon === 'string' ? project.icon : null,
|
|
@@ -47,8 +47,8 @@ function page(metadata, projects) {
|
|
|
47
47
|
var payload = JSON.stringify({ project: metadata, projects: navigation }).replace(/</g, "\\u003c");
|
|
48
48
|
function fact(label, value) { return '<div><dt>' + escape(label) + '</dt><dd>' + escape(value === null ? 'Unavailable' : String(value)) + '</dd></div>'; }
|
|
49
49
|
return '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>' + escape(metadata.title) + ' · Clay</title>' +
|
|
50
|
-
'<script src="/appearance-bootstrap.js"></script><link rel="stylesheet" href="/style.css"><link rel="stylesheet" href="/css/project-admin-overview.css"></head><body class="project-admin-page">' +
|
|
51
|
-
'<div id="layout"><header id="top-bar"><a href="/" class="top-bar-brand-link" aria-label="Clay home"><span class="top-bar-brand-wordmark"></span></a><span class="project-admin-role">Server administration</span></header>' +
|
|
50
|
+
'<script src="/workspace-background-catalog.js"></script><script src="/appearance-bootstrap.js"></script><link rel="stylesheet" href="/style.css"><link rel="stylesheet" href="/css/project-admin-overview.css"></head><body class="project-admin-page">' +
|
|
51
|
+
'<div id="layout"><header id="top-bar"><a href="/" class="top-bar-brand-link" aria-label="Clay home"><span class="top-bar-brand-wordmark"></span></a><span class="project-admin-role">Server administration</span><a class="settings-btn-sm" href="/?settings=server" aria-label="Open Server Settings">Settings</a></header>' +
|
|
52
52
|
'<div id="layout-body"><nav id="icon-strip" aria-label="Projects"><a class="icon-strip-home" href="/" aria-label="Clay home" data-tip="Clay home"><img class="icon-strip-logo" src="/clay-studio-symbol.png" alt="" width="38" height="38"></a><div class="icon-strip-separator"></div><div class="icon-strip-projects" id="icon-strip-projects"></div></nav>' +
|
|
53
53
|
'<main id="main-area" class="project-admin-overview"><div class="project-admin-canvas"><div class="project-admin-heading"><div><p class="project-admin-eyebrow">Project overview</p><h1>' + escape(metadata.title) + '</h1><p id="project-admin-parent" hidden></p></div><span class="project-admin-access-badge">Content restricted</span></div>' +
|
|
54
54
|
'<div role="tablist" aria-label="Project information"><button type="button" role="tab" aria-selected="true" id="overview-tab" aria-controls="overview-panel">Overview</button><button type="button" role="tab" aria-selected="false" id="access-tab" aria-controls="access-panel">Access</button></div>' +
|
|
@@ -6,7 +6,7 @@ var REASONS = {
|
|
|
6
6
|
project_path_unverified: 'The project directory is not a verified real directory. The server operator must check its canonical path.',
|
|
7
7
|
project_unavailable: 'The server cannot inspect the project directory. The server operator must restore the directory or its filesystem access.',
|
|
8
8
|
identity_unresolved: 'A configured system account cannot be resolved. The server operator must repair verified account provisioning.',
|
|
9
|
-
mapping_unavailable: 'No verified account-to-system-user mapping is available.
|
|
9
|
+
mapping_unavailable: 'No verified account-to-system-user mapping is available.',
|
|
10
10
|
owner_not_verified: 'No mapped account matches both the directory owner and its real home. The server operator must verify the original ownership and mapping.',
|
|
11
11
|
ambiguous_mapping: 'More than one account shares a system identity or overlapping home. The server operator must resolve the ambiguity.',
|
|
12
12
|
no_administrator: 'No existing administrator is available for the public project recovery policy.',
|
|
@@ -15,6 +15,7 @@ var REASONS = {
|
|
|
15
15
|
};
|
|
16
16
|
function createRecoveryService(ctx) {
|
|
17
17
|
var publicationFailures = new Map();
|
|
18
|
+
var approvals = require('./project-recovery-approvals').attachRecoveryApprovals(Object.assign({}, ctx, { inspect: inspect }));
|
|
18
19
|
function inspect(slug) {
|
|
19
20
|
var config = ctx.getConfig(), accounts = ctx.getAccounts();
|
|
20
21
|
var project = (config.projects || []).find(function (entry) { return entry.slug === slug; });
|
|
@@ -38,22 +39,23 @@ function createRecoveryService(ctx) {
|
|
|
38
39
|
var failed = publicationFailures.get(slug) === revision;
|
|
39
40
|
return { slug: slug, status: failed ? 'publication_failed' : healthy ? 'healthy' : candidate ? 'ready' : 'blocked', code: failed ? 'publication_failed' : evidence.code, message: failed ? 'Ownership was saved but runtime publication failed. The server operator must reload the saved configuration before further recovery.' : REASONS[evidence.code], revision: revision,
|
|
40
41
|
owner: candidate ? { id: candidate.id, name: candidate.displayName || candidate.username } : null,
|
|
41
|
-
checkedAt: Date.now(), sessionOwnersChanged: false };
|
|
42
|
+
operatorApprovalAvailable: !config.osUsers && !healthy && !failed, checkedAt: Date.now(), sessionOwnersChanged: false };
|
|
42
43
|
}
|
|
43
|
-
function apply(slug, revision, authorize) {
|
|
44
|
+
function apply(slug, revision, authorize, approvalCode) {
|
|
44
45
|
authorize();
|
|
45
|
-
var check = inspect(slug);
|
|
46
|
+
var check = approvalCode ? approvals.review(slug, approvalCode, authorize().id) : inspect(slug);
|
|
46
47
|
if (check.status !== 'ready' || check.revision !== revision) throw new Error('Ownership evidence changed or recovery is unavailable. Check again and review the current result.');
|
|
47
48
|
authorize();
|
|
48
49
|
var next = JSON.parse(JSON.stringify(ctx.getConfig()));
|
|
49
50
|
var project = next.projects.find(function (entry) { return entry.slug === slug; });
|
|
50
51
|
project.ownerId = check.owner.id; delete project.ownershipRecovery;
|
|
51
52
|
// Persistence must complete before any runtime or account can see repaired ownership.
|
|
53
|
+
if (approvalCode) approvals.consume(approvalCode);
|
|
52
54
|
ctx.persist(next);
|
|
53
55
|
try { ctx.publish(next, slug, check.owner.id); }
|
|
54
56
|
catch (error) { publicationFailures.set(slug, revision); return { ok: false, status: 'publication_failed', persisted: true, error: 'Ownership was saved, but runtime publication failed. Ask the server operator to reload the saved configuration; do not repeat recovery.' }; }
|
|
55
57
|
return { ok: true, status: 'recovered', persisted: true, owner: check.owner, sessionOwnersChanged: false };
|
|
56
58
|
}
|
|
57
|
-
return { inspect: inspect, apply: apply };
|
|
59
|
+
return { inspect: inspect, apply: apply, approve: approvals.issue, reviewApproval: approvals.review };
|
|
58
60
|
}
|
|
59
61
|
module.exports = { createRecoveryService: createRecoveryService };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Only the daemon's local IPC operator can issue these approvals. HTTP can review them.
|
|
2
|
+
var crypto = require('crypto');
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
function attachRecoveryApprovals(ctx) {
|
|
6
|
+
var tickets = new Map();
|
|
7
|
+
function now() { return ctx.now ? ctx.now() : Date.now(); }
|
|
8
|
+
function hash(code) { return crypto.createHash('sha256').update(code).digest('hex'); }
|
|
9
|
+
function prune() { tickets.forEach(function (ticket, key) { if (ticket.expiresAt <= now()) tickets.delete(key); }); }
|
|
10
|
+
function issue(slug, username) {
|
|
11
|
+
try {
|
|
12
|
+
prune();
|
|
13
|
+
var check = ctx.inspect(slug);
|
|
14
|
+
if (!check.operatorApprovalAvailable || ctx.getConfig().osUsers) throw new Error('Local operator approval is unavailable. Repair the verified system identity mapping when OS isolation is enabled.');
|
|
15
|
+
var account = ctx.getAccounts().find(function (entry) { return entry.username === username; });
|
|
16
|
+
if (!account) throw new Error('Choose an existing account by its exact username.');
|
|
17
|
+
var project = ctx.getConfig().projects.find(function (entry) { return entry.slug === slug; });
|
|
18
|
+
if (!fs.lstatSync(project.path).isDirectory() || fs.realpathSync(project.path) !== path.resolve(project.path)) throw new Error('Restore the real project directory before approving recovery.');
|
|
19
|
+
if (tickets.size >= 100) throw new Error('Too many outstanding approvals. Wait for an approval to expire.');
|
|
20
|
+
var code = crypto.randomBytes(24).toString('hex');
|
|
21
|
+
var ticket = { slug: slug, revision: check.revision, owner: { id: account.id, name: account.displayName || account.username }, expiresAt: now() + 600000, actorId: null };
|
|
22
|
+
tickets.set(hash(code), ticket);
|
|
23
|
+
return { ok: true, slug: slug, owner: ticket.owner, approvalCode: code, expiresAt: ticket.expiresAt };
|
|
24
|
+
} catch (error) { return { ok: false, error: error.message }; }
|
|
25
|
+
}
|
|
26
|
+
function review(slug, code, actorId) {
|
|
27
|
+
prune();
|
|
28
|
+
var ticket = typeof code === 'string' && tickets.get(hash(code));
|
|
29
|
+
if (!actorId || !ticket || ticket.slug !== slug || (ticket.actorId && ticket.actorId !== actorId)) throw new Error('Approval is invalid, expired or already used. Ask the server operator for a new approval.');
|
|
30
|
+
var check = ctx.inspect(slug);
|
|
31
|
+
if (!check.operatorApprovalAvailable || check.revision !== ticket.revision || ctx.getConfig().osUsers) throw new Error('The project or accounts changed. Ask the server operator to approve the current state.');
|
|
32
|
+
ticket.actorId = actorId;
|
|
33
|
+
return Object.assign({}, check, { status: 'ready', code: 'operator_approved', owner: ticket.owner, expiresAt: ticket.expiresAt, message: 'The server operator approved this recovery owner. Review the exact project and account before applying.' });
|
|
34
|
+
}
|
|
35
|
+
function consume(code) { tickets.delete(hash(code)); }
|
|
36
|
+
return { issue: issue, review: review, consume: consume };
|
|
37
|
+
}
|
|
38
|
+
module.exports = { attachRecoveryApprovals: attachRecoveryApprovals };
|
package/lib/public/app.js
CHANGED
|
@@ -1255,6 +1255,7 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
1255
1255
|
}
|
|
1256
1256
|
if (d.user && d.user.id) { store.set({ myUserId: d.user.id }); requestDefaultVendor(); }
|
|
1257
1257
|
store.set({ authIdentityLoaded: true });
|
|
1258
|
+
if (bootParams.get('settings') === 'server' && !paneMode) openSettings({ scope: 'server' });
|
|
1258
1259
|
store.set({ permissions: d.permissions || null, projectsAccessLoaded: true });
|
|
1259
1260
|
if (d.mustChangePin) showForceChangePinOverlay();
|
|
1260
1261
|
// Single-user mode: clear user strip skeletons immediately (no presence message will arrive)
|
|
@@ -44,3 +44,12 @@
|
|
|
44
44
|
.ownership-recovery h3 { font-size:14px; }
|
|
45
45
|
.ownership-recovery button { min-height:32px; margin:4px 8px 4px 0; padding:4px 10px; border:1px solid var(--border); border-radius:8px; color:var(--text); background:var(--bg-alt); cursor:pointer; font:inherit; }
|
|
46
46
|
.ownership-review { padding:12px; border:1px solid var(--border); border-radius:8px; }
|
|
47
|
+
|
|
48
|
+
.project-admin-page #top-bar > .settings-btn-sm { flex-shrink: 0; margin-right: 12px; text-decoration: none; }
|
|
49
|
+
.ownership-recovery code { display: block; overflow-wrap: anywhere; font-size: 11px; }
|
|
50
|
+
.ownership-recovery form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 12px 0; }
|
|
51
|
+
.ownership-recovery label { display: grid; gap: 6px; max-width: 100%; font-size: 12px; }
|
|
52
|
+
.ownership-recovery .settings-input { min-width: 0; max-width: 100%; }
|
|
53
|
+
|
|
54
|
+
/* Restricted pages have no mobile workspace header to host Settings. */
|
|
55
|
+
body.project-admin-page #top-bar { display:flex !important; }
|
|
@@ -62,3 +62,8 @@
|
|
|
62
62
|
#project-settings .ownership-recovery p { font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
|
|
63
63
|
.ownership-review { margin-top:12px; padding:12px; border:1px solid var(--border); border-radius:8px; }
|
|
64
64
|
.ownership-review button + button { margin-left:8px; }
|
|
65
|
+
|
|
66
|
+
#project-settings .ownership-recovery code { display:block; overflow-wrap:anywhere; font-size:11px; }
|
|
67
|
+
#project-settings .ownership-recovery form { display:flex; flex-wrap:wrap; align-items:end; gap:8px; margin:12px 0; }
|
|
68
|
+
#project-settings .ownership-recovery label { display:grid; gap:6px; max-width:100%; font-size:12px; }
|
|
69
|
+
#project-settings .ownership-recovery .settings-input { min-width:0; max-width:100%; }
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -32,14 +32,18 @@ function mappedMateAvatarId(mate) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export function mateCatalogAvatarUrl(id) {
|
|
35
|
-
if (id === 'lead-clay') return '/mate-avatars/lead-clay.
|
|
36
|
-
return typeof id === 'string' && /^[BC](0[1-9]|[1-3][0-9]|4[0-8])$/.test(id) ? '/mate-avatars/' + id + '.
|
|
35
|
+
if (id === 'lead-clay') return '/mate-avatars/lead-clay.webp?v=5';
|
|
36
|
+
return typeof id === 'string' && /^[BC](0[1-9]|[1-3][0-9]|4[0-8])$/.test(id) ? '/mate-avatars/' + id + '.webp?v=5' : '';
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// Build avatar URL for a mate object, preferring custom avatar if set.
|
|
40
40
|
export function mateAvatarUrl(mate, size) {
|
|
41
41
|
if (!mate) return mateCatalogAvatarUrl('B01');
|
|
42
42
|
var p = mate.profile || mate;
|
|
43
|
-
|
|
43
|
+
var custom = p.avatarCustom || mate.avatarCustom;
|
|
44
|
+
if (custom) {
|
|
45
|
+
if (/^\/mates\/(ally\.png|scout\.png|sage\.jpg)$/.test(custom)) return custom.replace(/\.(png|jpg)$/, '.webp?v=1');
|
|
46
|
+
return custom;
|
|
47
|
+
}
|
|
44
48
|
return mateCatalogAvatarUrl(p.avatarCatalogId) || mateCatalogAvatarUrl(mate.builtinKey === 'clay' ? 'lead-clay' : mappedMateAvatarId(mate));
|
|
45
49
|
}
|
|
@@ -3,7 +3,7 @@ export function mateLoadingMarkup() {
|
|
|
3
3
|
return '<div data-clay-loading class="mate-loading" role="status" aria-live="polite">' +
|
|
4
4
|
'<div class="mate-loading-scene" aria-hidden="true">' +
|
|
5
5
|
'<img class="mate-loading-avatar" alt="">' +
|
|
6
|
-
'<img class="mate-loading-desk" src="/welcome-art/conversation-desk.
|
|
6
|
+
'<img class="mate-loading-desk" src="/welcome-art/conversation-desk.webp?v=1" alt="" decoding="async">' +
|
|
7
7
|
'</div><p class="mate-loading-label"></p>' +
|
|
8
8
|
'<div class="mate-loading-dots" aria-hidden="true"><span></span><span></span><span></span></div></div>';
|
|
9
9
|
}
|
|
@@ -143,3 +143,9 @@ if (data.project.ownershipRecovery) {
|
|
|
143
143
|
var parentLink = document.createElement('a'); parentLink.href = '/p/' + encodeURIComponent(data.project.parentSlug) + '/'; parentLink.textContent = 'Recover ownership in the parent project'; recovery.appendChild(parentLink);
|
|
144
144
|
} else mountOwnershipRecovery(recovery, data.project.slug);
|
|
145
145
|
}
|
|
146
|
+
|
|
147
|
+
if (data.project.ownershipRecovery) {
|
|
148
|
+
var recoverLink = document.createElement('button'); recoverLink.type = 'button'; recoverLink.className = 'settings-btn-sm'; recoverLink.textContent = 'Recover ownership';
|
|
149
|
+
recoverLink.onclick = function () { document.getElementById('access-tab').click(); document.getElementById('access-tab').focus(); };
|
|
150
|
+
document.querySelector('.project-admin-notice').appendChild(recoverLink);
|
|
151
|
+
}
|
|
@@ -97,7 +97,7 @@ function choiceButton(artwork, title, description) {
|
|
|
97
97
|
button.type = 'button';
|
|
98
98
|
button.className = 'project-create-choice-option';
|
|
99
99
|
var image = document.createElement('img');
|
|
100
|
-
image.src = '/welcome-art/' + artwork + '.
|
|
100
|
+
image.src = '/welcome-art/' + artwork + '.webp?v=1';
|
|
101
101
|
image.alt = '';
|
|
102
102
|
image.width = 1536;
|
|
103
103
|
image.height = 1024;
|