@songsid/agend 2.4.0-beta.10 → 2.4.0-beta.12
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-view.d.ts +29 -0
- package/dist/accounts-view.js +2 -14
- package/dist/accounts-view.js.map +1 -1
- package/dist/agent-endpoint.d.ts +1 -0
- package/dist/agent-endpoint.js +4 -2
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/auth-api.d.ts +2 -0
- package/dist/auth-api.js +29 -2
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.js +35 -9
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex-precaution.d.ts +7 -0
- package/dist/backend/codex-precaution.js +102 -0
- package/dist/backend/codex-precaution.js.map +1 -0
- package/dist/backend/codex.d.ts +1 -0
- package/dist/backend/codex.js +18 -0
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/grok.js +21 -6
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/types.d.ts +9 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-server.js +1 -1
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.js +3 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/claude-install-kind.d.ts +19 -0
- package/dist/claude-install-kind.js +54 -0
- package/dist/claude-install-kind.js.map +1 -0
- package/dist/cli-audited.js +3 -3
- package/dist/cli-audited.js.map +1 -1
- package/dist/daemon.d.ts +5 -0
- package/dist/daemon.js +22 -4
- package/dist/daemon.js.map +1 -1
- package/dist/event-log.d.ts +12 -0
- package/dist/event-log.js +40 -0
- package/dist/event-log.js.map +1 -1
- package/dist/fleet-manager.d.ts +122 -2
- package/dist/fleet-manager.js +482 -27
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +38 -6
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -1
- package/dist/hub/admin-dashboard.js +3 -3
- package/dist/hub/admin-dashboard.js.map +1 -1
- package/dist/hub/agent-catalog-model.d.ts +276 -0
- package/dist/hub/agent-catalog-model.js +49 -0
- package/dist/hub/agent-catalog-model.js.map +1 -0
- package/dist/hub/agent-catalog.d.ts +137 -0
- package/dist/hub/agent-catalog.js +118 -0
- package/dist/hub/agent-catalog.js.map +1 -0
- package/dist/hub/agent-intro-model.d.ts +38 -0
- package/dist/hub/agent-intro-model.js +14 -0
- package/dist/hub/agent-intro-model.js.map +1 -0
- package/dist/hub/agent-intro-tool.d.ts +35 -0
- package/dist/hub/agent-intro-tool.js +83 -0
- package/dist/hub/agent-intro-tool.js.map +1 -0
- package/dist/hub/agent-intro.d.ts +31 -0
- package/dist/hub/agent-intro.js +51 -0
- package/dist/hub/agent-intro.js.map +1 -0
- package/dist/hub/catalog.d.ts +4 -2
- package/dist/hub/catalog.js +19 -3
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.d.ts +3 -0
- package/dist/hub/client.js +47 -1
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +19 -5
- package/dist/hub/compose/member.js +94 -13
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.d.ts +5 -0
- package/dist/hub/compose/server.js +6 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/execution/service.d.ts +1 -1
- package/dist/hub/execution/service.js +1 -0
- package/dist/hub/execution/service.js.map +1 -1
- package/dist/hub/http/compose.d.ts +3 -0
- package/dist/hub/http/compose.js +122 -15
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/schema.js +15 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/mcp/tools.js +2 -1
- package/dist/hub/mcp/tools.js.map +1 -1
- package/dist/hub/member/agent-catalog.d.ts +28 -0
- package/dist/hub/member/agent-catalog.js +80 -0
- package/dist/hub/member/agent-catalog.js.map +1 -0
- package/dist/hub/member/agent-intro.d.ts +28 -0
- package/dist/hub/member/agent-intro.js +66 -0
- package/dist/hub/member/agent-intro.js.map +1 -0
- package/dist/hub/member/exposure-api.d.ts +3 -3
- package/dist/hub/member/exposure-api.js +4 -4
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/exposures.d.ts +12 -4
- package/dist/hub/member/exposures.js +27 -13
- package/dist/hub/member/exposures.js.map +1 -1
- package/dist/hub/member/room-ask.d.ts +14 -1
- package/dist/hub/member/room-ask.js +76 -10
- package/dist/hub/member/room-ask.js.map +1 -1
- package/dist/hub/member/room-context-budget.d.ts +5 -0
- package/dist/hub/member/room-context-budget.js +34 -0
- package/dist/hub/member/room-context-budget.js.map +1 -0
- package/dist/hub/member/room-notification.d.ts +1 -1
- package/dist/hub/member/room-post.d.ts +6 -3
- package/dist/hub/member/room-post.js +9 -3
- package/dist/hub/member/room-post.js.map +1 -1
- package/dist/hub/member/sharing-journal.d.ts +252 -0
- package/dist/hub/member/sharing-journal.js +212 -0
- package/dist/hub/member/sharing-journal.js.map +1 -0
- package/dist/hub/member/sharing-link.d.ts +25 -0
- package/dist/hub/member/sharing-link.js +68 -0
- package/dist/hub/member/sharing-link.js.map +1 -0
- package/dist/hub/member/sharing-result.d.ts +6 -0
- package/dist/hub/member/sharing-result.js +46 -0
- package/dist/hub/member/sharing-result.js.map +1 -0
- package/dist/hub/member/sharing.d.ts +37 -0
- package/dist/hub/member/sharing.js +181 -0
- package/dist/hub/member/sharing.js.map +1 -0
- package/dist/hub/personal/owner-host.d.ts +6 -0
- package/dist/hub/personal/owner-host.js +4 -2
- package/dist/hub/personal/owner-host.js.map +1 -1
- package/dist/hub/protocol.d.ts +398 -4
- package/dist/hub/protocol.js +13 -5
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/room-answer-status-model.d.ts +3 -0
- package/dist/hub/room-answer-status-model.js +4 -0
- package/dist/hub/room-answer-status-model.js.map +1 -0
- package/dist/hub/room-brief-model.d.ts +30 -0
- package/dist/hub/room-brief-model.js +37 -0
- package/dist/hub/room-brief-model.js.map +1 -0
- package/dist/hub/room-context-model.d.ts +2 -0
- package/dist/hub/room-context-model.js +2 -2
- package/dist/hub/room-context-model.js.map +1 -1
- package/dist/hub/room-members-model.d.ts +63 -0
- package/dist/hub/room-members-model.js +7 -0
- package/dist/hub/room-members-model.js.map +1 -0
- package/dist/hub/rooms/agents.d.ts +1 -0
- package/dist/hub/rooms/agents.js +62 -11
- package/dist/hub/rooms/agents.js.map +1 -1
- package/dist/hub/rooms/brief.d.ts +18 -0
- package/dist/hub/rooms/brief.js +39 -0
- package/dist/hub/rooms/brief.js.map +1 -0
- package/dist/hub/rooms/direct-view.d.ts +5 -1
- package/dist/hub/rooms/direct-view.js +2 -2
- package/dist/hub/rooms/direct-view.js.map +1 -1
- package/dist/hub/rooms/members-page.d.ts +33 -0
- package/dist/hub/rooms/members-page.js +37 -0
- package/dist/hub/rooms/members-page.js.map +1 -0
- package/dist/hub/rooms/purpose.d.ts +7 -0
- package/dist/hub/rooms/purpose.js +14 -0
- package/dist/hub/rooms/purpose.js.map +1 -0
- package/dist/hub/rooms/service.d.ts +43 -0
- package/dist/hub/rooms/service.js +80 -22
- package/dist/hub/rooms/service.js.map +1 -1
- package/dist/hub/rooms/types.d.ts +6 -1
- package/dist/hub/rooms.d.ts +1 -0
- package/dist/hub/rooms.js +9 -4
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/runtime.d.ts +1 -1
- package/dist/hub/server.js +49 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/sharing-previous-access.d.ts +22 -0
- package/dist/hub/sharing-previous-access.js +93 -0
- package/dist/hub/sharing-previous-access.js.map +1 -0
- package/dist/hub/sharing-requests.d.ts +171 -0
- package/dist/hub/sharing-requests.js +311 -0
- package/dist/hub/sharing-requests.js.map +1 -0
- package/dist/hub/sharing-retention.d.ts +47 -0
- package/dist/hub/sharing-retention.js +83 -0
- package/dist/hub/sharing-retention.js.map +1 -0
- package/dist/hub/sharing-withdrawal.d.ts +14 -0
- package/dist/hub/sharing-withdrawal.js +28 -0
- package/dist/hub/sharing-withdrawal.js.map +1 -0
- package/dist/hub/types.d.ts +13 -5
- package/dist/hub-page-sharing-settings.d.ts +6 -0
- package/dist/hub-page-sharing-settings.js +19 -0
- package/dist/hub-page-sharing-settings.js.map +1 -0
- package/dist/hub-room-reply-warning.d.ts +2 -0
- package/dist/hub-room-reply-warning.js +16 -0
- package/dist/hub-room-reply-warning.js.map +1 -0
- package/dist/hub-sharing-notice.d.ts +43 -0
- package/dist/hub-sharing-notice.js +34 -0
- package/dist/hub-sharing-notice.js.map +1 -0
- package/dist/instance-lifecycle.d.ts +15 -0
- package/dist/instance-lifecycle.js +36 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +78 -0
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +26 -0
- package/dist/login-controller.js +72 -2
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.js +1 -1
- package/dist/login-flows.js.map +1 -1
- package/dist/native-mcp.js +1 -1
- package/dist/native-mcp.js.map +1 -1
- package/dist/needs-you-hub.js +1 -1
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +8 -1
- package/dist/needs-you.js +6 -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/outbound-handlers.d.ts +2 -1
- package/dist/outbound-handlers.js +17 -4
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +10 -0
- package/dist/outbound-schemas.js +3 -1
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +9 -3
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/remote-card-answer.d.ts +1 -1
- package/dist/remote-card-answer.js +8 -1
- package/dist/remote-card-answer.js.map +1 -1
- package/dist/remote-card-prompt.js +1 -1
- package/dist/remote-card-prompt.js.map +1 -1
- package/dist/restart-progress.d.ts +6 -0
- package/dist/restart-progress.js +5 -0
- package/dist/restart-progress.js.map +1 -1
- package/dist/settings-api.d.ts +1 -0
- package/dist/settings-api.js +84 -10
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +3 -0
- package/dist/settings-baseline.js +2 -2
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-change.js +1 -0
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.d.ts +3 -0
- package/dist/settings-effect.js +33 -2
- package/dist/settings-effect.js.map +1 -1
- package/dist/tool-permissions.js +3 -3
- package/dist/tool-permissions.js.map +1 -1
- package/dist/ui/chat-quote.js +3 -261
- package/dist/ui/fleet-office-card.js +8 -4
- package/dist/ui/fleet-office-pack.d.ts +1 -0
- package/dist/ui/fleet-office-pack.js +6 -2
- package/dist/ui/fleet-office-play.js +84 -0
- package/dist/ui/fleet-office-store.js +23 -0
- package/dist/ui/fleet-office-zones.js +5 -1
- package/dist/ui/fleet-office.js +78 -8
- package/dist/ui/host-install.js +77 -3
- package/dist/ui/hub-agent-intro.js +35 -0
- package/dist/ui/hub-attachments.js +81 -3
- package/dist/ui/hub-chat-strings.js +4 -4
- package/dist/ui/hub-client.js +16 -1
- package/dist/ui/hub-grant-picker.js +25 -11
- package/dist/ui/hub-group-strings.js +3 -3
- package/dist/ui/hub-intro-notice.js +16 -0
- package/dist/ui/hub-my-agents-model.js +42 -0
- package/dist/ui/hub-my-agents-strings.js +18 -0
- package/dist/ui/hub-my-agents.js +144 -0
- package/dist/ui/hub-owner-strings.js +5 -5
- package/dist/ui/hub-personal-agent.js +5 -4
- package/dist/ui/hub-room-composer.js +37 -6
- package/dist/ui/hub-room-list.js +4 -3
- package/dist/ui/hub-room-members.js +5 -2
- package/dist/ui/hub-room-new.js +8 -5
- package/dist/ui/hub-room-purpose.js +19 -0
- package/dist/ui/hub-room-search.js +1 -1
- package/dist/ui/hub-room-settings.js +9 -0
- package/dist/ui/hub-room-strings.js +6 -4
- package/dist/ui/hub-room-thread.js +70 -17
- package/dist/ui/hub-strings.js +5 -5
- package/dist/ui/hub-welcome.js +6 -6
- package/dist/ui/notice-hub-sharing.js +81 -0
- package/dist/ui/panel-chat.js +19 -5
- package/dist/ui/panel-hub.js +77 -29
- package/dist/ui/panel-notices.js +2 -1
- package/dist/ui/settings-hub-connection.js +2 -2
- package/dist/ui/settings-hub-page-sharing.js +52 -0
- package/dist/ui/settings-hub.js +4 -2
- package/dist/ui/settings-registry.js +1 -0
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-shell.js +14 -2
- package/dist/ui/shared/app-store.js +6 -2
- package/dist/ui/shared/app.js +3 -1
- package/dist/ui/shared/chat-msg-actions.js +3 -1
- package/dist/ui/shared/chat-quote.js +261 -0
- package/dist/ui/shared/hub-chat.css +31 -0
- package/dist/ui/shared/hub-my-agents.css +35 -0
- package/dist/ui/shared/hub-rooms-u2.css +5 -0
- package/dist/ui/shared/module-warm.d.ts +3 -0
- package/dist/ui/shared/module-warm.js +39 -0
- package/dist/web-api.d.ts +21 -5
- package/dist/web-api.js +138 -7
- package/dist/web-api.js.map +1 -1
- package/dist/web-asset-version.d.ts +65 -0
- package/dist/web-asset-version.js +259 -0
- package/dist/web-asset-version.js.map +1 -0
- package/dist/web-host-guard.js +3 -1
- package/dist/web-host-guard.js.map +1 -1
- package/dist/web-host-install.d.ts +30 -3
- package/dist/web-host-install.js +50 -4
- package/dist/web-host-install.js.map +1 -1
- package/dist/web-notices.d.ts +17 -0
- package/dist/web-notices.js +47 -6
- package/dist/web-notices.js.map +1 -1
- package/dist/web-terminal.d.ts +5 -0
- package/dist/web-terminal.js +11 -0
- package/dist/web-terminal.js.map +1 -1
- package/launcher/agend-install.cjs +48 -7
- package/package.json +1 -1
package/dist/web-api.js
CHANGED
|
@@ -40,7 +40,9 @@ import { MAX_COMMAND_ARGS } from "./web-commands.js";
|
|
|
40
40
|
import { ROUTE_WORKER_CSP, ROUTE_WORKER_PATH, sendPanelHtml } from "./web-host-guard.js";
|
|
41
41
|
import { libavoidFile } from "./web-libavoid.js";
|
|
42
42
|
import { shellRoute } from "./web-shell-routes.js";
|
|
43
|
-
import { createReadStream, createWriteStream, readFileSync } from "node:fs";
|
|
43
|
+
import { createReadStream, createWriteStream, existsSync, readFileSync } from "node:fs";
|
|
44
|
+
import { servedAssets } from "./auth-api.js";
|
|
45
|
+
import { assetIntact, assetsUnchanged, assetVersion, assetVersionMark, answerStaleAsset, buildModuleGraph, staticClosure, versionShell, IMMUTABLE_PRIVATE } from "./web-asset-version.js";
|
|
44
46
|
import { join, dirname } from "node:path";
|
|
45
47
|
import { fileURLToPath } from "node:url";
|
|
46
48
|
import { createHash, createHmac, randomUUID } from "node:crypto";
|
|
@@ -1704,7 +1706,8 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
|
|
|
1704
1706
|
* after it). `GET` reads the current install; `POST` `{ backend }` starts one — the browser names a CLI, the server looks up the registry's command, nothing it sends
|
|
1705
1707
|
* is ever run; `POST …/cancel` `{}` stops the running one. Every answer is no-store.
|
|
1706
1708
|
*/
|
|
1707
|
-
const HOST_INSTALL_STATUS = { not_allowed: 403, unsupported: 400, already: 409, not_installed: 409, up_to_date: 409, version_unreadable: 409,
|
|
1709
|
+
const HOST_INSTALL_STATUS = { not_allowed: 403, unsupported: 400, already: 409, not_installed: 409, up_to_date: 409, version_unreadable: 409, cli_self_updating: 409,
|
|
1710
|
+
not_npm: 409, still_npm: 409, no_npm_copy: 409, busy: 409, shutting_down: 503, failed: 500 };
|
|
1708
1711
|
function handleHostInstall(req, res, url, ctx, path, method) {
|
|
1709
1712
|
res.setHeader("Cache-Control", "private, no-store");
|
|
1710
1713
|
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
@@ -1801,7 +1804,9 @@ function handleHostInstall(req, res, url, ctx, path, method) {
|
|
|
1801
1804
|
}
|
|
1802
1805
|
}
|
|
1803
1806
|
// AGEND-136: `POST /ui/host-update { backend }` is the same request for an update: the server picks the command and the audited release; the page sends only the CLI's id.
|
|
1804
|
-
|
|
1807
|
+
// M-3307: `/ui/host-native-switch` and `/ui/host-npm-remove` are the switch to Claude's native install and the npm copy's removal (web-host-install.ts modes).
|
|
1808
|
+
const mode = path === "/ui/host-update" ? "update" : path === "/ui/host-native-switch" ? "native" : path === "/ui/host-npm-remove" ? "remove-npm" : "install";
|
|
1809
|
+
const result = await installs.begin(now, parsed.data.backend, settingsRequestExecution(req), mode);
|
|
1805
1810
|
if ("error" in result)
|
|
1806
1811
|
json(res, HOST_INSTALL_STATUS[result.error] ?? 409, { error: result.error, ...(result.message ? { message: result.message } : {}) });
|
|
1807
1812
|
else
|
|
@@ -2674,9 +2679,27 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2674
2679
|
json(res, 400, { error: "Invalid file name" });
|
|
2675
2680
|
return true;
|
|
2676
2681
|
}
|
|
2682
|
+
// M-3314: /ui/js/v-<V>/… (rewritten to this path before the gate): this process's <V> is kept for good, privately; an
|
|
2683
|
+
// older tab's gets the stale-tab answer — once the gate above let the session through, as the plain path.
|
|
2684
|
+
const mark = assetVersionMark(req);
|
|
2685
|
+
if (mark && !mark.current) {
|
|
2686
|
+
if (!existsSync(join(__dirname, "ui", fileName))) {
|
|
2687
|
+
json(res, 404, { error: "File not found" });
|
|
2688
|
+
return true;
|
|
2689
|
+
}
|
|
2690
|
+
answerStaleAsset(res, path);
|
|
2691
|
+
return true;
|
|
2692
|
+
}
|
|
2677
2693
|
try {
|
|
2678
2694
|
const js = readFileSync(join(__dirname, "ui", fileName), "utf-8");
|
|
2695
|
+
// A file rewritten under this running process is not what <V> named (an update or a rollback before its restart).
|
|
2696
|
+
if (mark && !assetIntact(fileName, js)) {
|
|
2697
|
+
answerStaleAsset(res, path);
|
|
2698
|
+
return true;
|
|
2699
|
+
}
|
|
2679
2700
|
res.setHeader("Content-Type", "application/javascript; charset=utf-8");
|
|
2701
|
+
if (mark)
|
|
2702
|
+
res.setHeader("Cache-Control", IMMUTABLE_PRIVATE);
|
|
2680
2703
|
// #2182: the route worker's own, narrower-reaching policy (ROUTE_WORKER_CSP); every other file keeps the page's.
|
|
2681
2704
|
if (path === ROUTE_WORKER_PATH)
|
|
2682
2705
|
res.setHeader("Content-Security-Policy", ROUTE_WORKER_CSP);
|
|
@@ -3443,6 +3466,51 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3443
3466
|
handleSendMessage(req, res, ctx);
|
|
3444
3467
|
return true;
|
|
3445
3468
|
}
|
|
3469
|
+
// M-3293 (#4119): "Tell" — an Office pat or feed, for the agent's next real message (never a turn, never a wake). The
|
|
3470
|
+
// Office is an admin's (decision 7933bf90: over the public link too), as the archive's reads: a guest (no Office) or a
|
|
3471
|
+
// read-only session is refused; a registered instance; a person (a session revoked meanwhile: 401).
|
|
3472
|
+
if (method === "POST" && path === "/ui/office-tell") {
|
|
3473
|
+
const admission = adminAdmissionOf(req, url, ctx);
|
|
3474
|
+
if (!admission || guestRequestOf(req)) {
|
|
3475
|
+
req.resume();
|
|
3476
|
+
json(res, 403, { error: "admin_only" });
|
|
3477
|
+
return true;
|
|
3478
|
+
}
|
|
3479
|
+
(async () => {
|
|
3480
|
+
let raw;
|
|
3481
|
+
try {
|
|
3482
|
+
raw = await parseBody(req);
|
|
3483
|
+
}
|
|
3484
|
+
catch {
|
|
3485
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
3486
|
+
return;
|
|
3487
|
+
}
|
|
3488
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
3489
|
+
return;
|
|
3490
|
+
// Fable #4130: still that admin once the body is in (a session demoted meanwhile queues nothing), as the other admin POSTs.
|
|
3491
|
+
if (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req)) {
|
|
3492
|
+
json(res, 403, { error: "admin_only" });
|
|
3493
|
+
return;
|
|
3494
|
+
}
|
|
3495
|
+
const b = raw;
|
|
3496
|
+
const instance = typeof b?.instance === "string" ? b.instance : "", kind = b?.kind;
|
|
3497
|
+
if (!instance || instance.length > 128 || !safeInstanceSegment(instance) || (kind !== "pat" && kind !== "feed")) {
|
|
3498
|
+
json(res, 400, { error: "instance and kind (pat or feed) required" });
|
|
3499
|
+
return;
|
|
3500
|
+
}
|
|
3501
|
+
if (!registeredChatInstance(ctx, instance) && !ctx.instanceIpcClients.has(instance)) {
|
|
3502
|
+
json(res, 404, { error: `Instance not found: ${instance}` });
|
|
3503
|
+
return;
|
|
3504
|
+
}
|
|
3505
|
+
const person = webPersonOf(req, new URL(req.url ?? "/", "http://localhost"), ctx);
|
|
3506
|
+
if (!person) {
|
|
3507
|
+
json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
|
|
3508
|
+
return;
|
|
3509
|
+
}
|
|
3510
|
+
json(res, 200, { queued: ctx.officeTell?.(instance, person.name, kind) ?? false });
|
|
3511
|
+
})();
|
|
3512
|
+
return true;
|
|
3513
|
+
}
|
|
3446
3514
|
// ── Files (C2): upload one file for an instance; fetch a file by the id the fleet issued for it ──
|
|
3447
3515
|
if (method === "POST" && path === "/ui/upload") {
|
|
3448
3516
|
handleUpload(req, res, url, ctx);
|
|
@@ -3938,7 +4006,16 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3938
4006
|
json(res, 400, { error: "instance, nonce and action required" });
|
|
3939
4007
|
return;
|
|
3940
4008
|
}
|
|
3941
|
-
const
|
|
4009
|
+
const needsHuman = ctx.webPromptNeedsHuman?.(nonce) === true;
|
|
4010
|
+
if (needsHuman) {
|
|
4011
|
+
const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
4012
|
+
if (verdict.kind !== "allow" || verdict.via !== "session" || verdict.session.tier !== "admin") {
|
|
4013
|
+
json(res, 403, { error: "This decision needs a signed-in administrator" });
|
|
4014
|
+
return;
|
|
4015
|
+
}
|
|
4016
|
+
}
|
|
4017
|
+
const r = needsHuman ? await click(instance, nonce, action, text, true)
|
|
4018
|
+
: text === undefined ? await click(instance, nonce, action) : await click(instance, nonce, action, text);
|
|
3942
4019
|
// 409: answered elsewhere first, expired, or never open — the page drops the buttons on `gone`.
|
|
3943
4020
|
json(res, r.status, r.status === 200 ? { answered: true } : { error: r.error ?? "Refused", ...(r.status === 409 ? { gone: true } : {}) });
|
|
3944
4021
|
})().catch(err => {
|
|
@@ -4191,7 +4268,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
4191
4268
|
return handleBrowserBackendSignIns(req, res, url, ctx);
|
|
4192
4269
|
if (path === "/ui/backend-login" || path.startsWith("/ui/backend-login/"))
|
|
4193
4270
|
return handleBackendLogin(req, res, url, ctx, path, method);
|
|
4194
|
-
if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || path
|
|
4271
|
+
if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || HOST_CLI_PATHS.has(path))
|
|
4195
4272
|
return handleHostInstall(req, res, url, ctx, path, method);
|
|
4196
4273
|
// #3292: before the accounts prefix — its Add pattern (`POST /ui/accounts/<backend>`) would read "keep-alive" as a backend.
|
|
4197
4274
|
if (path === "/ui/accounts/keep-alive")
|
|
@@ -5768,6 +5845,7 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5768
5845
|
// A claimed clientId is settled however this ends: with the messageId once accepted, else forgotten.
|
|
5769
5846
|
let claim;
|
|
5770
5847
|
let acceptedId = null;
|
|
5848
|
+
let tellPasted; // #4145: the pasted-token line, after this message's own (whatever the send's end)
|
|
5771
5849
|
try {
|
|
5772
5850
|
const raw = JSON.parse(body);
|
|
5773
5851
|
const parsed = SendMessageSchema.safeParse(raw);
|
|
@@ -5776,7 +5854,17 @@ function handleSendMessage(req, res, ctx) {
|
|
|
5776
5854
|
json(res, 400, { error: `${issue.path.join(".") || "body"}: ${issue.message}` });
|
|
5777
5855
|
return;
|
|
5778
5856
|
}
|
|
5779
|
-
const { instance, message:
|
|
5857
|
+
const { instance, message: sent, attachments = [], replyTo, clientId } = parsed.data;
|
|
5858
|
+
// #4145: this fleet's sign-in access token pasted here is hidden before it goes anywhere (the agent, the chat's
|
|
5859
|
+
// history, the topic's copy, the activity log), and taken back at once — a new one goes privately.
|
|
5860
|
+
const pasted = ctx.screenLoginToken?.(sent) ?? null;
|
|
5861
|
+
const typed = pasted?.text ?? sent;
|
|
5862
|
+
const pastedNotice = pasted?.live ? (ctx.loginTokenPasted?.() ?? Promise.resolve(null)).catch(() => null) : null;
|
|
5863
|
+
if (pastedNotice)
|
|
5864
|
+
tellPasted = () => void pastedNotice.then(notice => {
|
|
5865
|
+
if (notice)
|
|
5866
|
+
ctx.emitSseEvent("message", { instance, role: "status", sender: "AgEnD", text: notice, ts: new Date().toISOString(), messageId: newWebMessageId() });
|
|
5867
|
+
});
|
|
5780
5868
|
const native = isWindowsInstance(ctx.fleetConfig?.instances[instance]);
|
|
5781
5869
|
if (native && !nativeCliAuthorization(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
|
|
5782
5870
|
json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
|
|
@@ -6020,6 +6108,7 @@ function handleSendMessage(req, res, ctx) {
|
|
|
6020
6108
|
}
|
|
6021
6109
|
finally {
|
|
6022
6110
|
claim?.settle(acceptedId);
|
|
6111
|
+
tellPasted?.();
|
|
6023
6112
|
}
|
|
6024
6113
|
});
|
|
6025
6114
|
}
|
|
@@ -6512,6 +6601,40 @@ export function serveHubWorkspaceShell(res, hub) {
|
|
|
6512
6601
|
* The app shell page. `opts.hubWorkspace`: the page is a Hub's own workspace (slice 1's Hub listener only — the fleet's
|
|
6513
6602
|
* listener never passes it), so it is drawn as the Hub shell.
|
|
6514
6603
|
*/
|
|
6604
|
+
let moduleGraphMemo = null;
|
|
6605
|
+
/** M-3314: the served modules' static imports, read once per process (its files do not change under it). */
|
|
6606
|
+
export function appModuleGraph() { return moduleGraphMemo ??= buildModuleGraph(join(__dirname, "ui"), servedAssets()); }
|
|
6607
|
+
/** M-3314: the module each panel's route loads (app.js's own dynamic imports). */
|
|
6608
|
+
export const PANEL_MODULES = {
|
|
6609
|
+
chat: "/ui/js/panel-chat.js", fleet: "/ui/js/panel-fleet.js", settings: "/ui/js/panel-settings.js", needs: "/ui/js/panel-needs.js",
|
|
6610
|
+
details: "/ui/js/panel-details.js", log: "/ui/js/panel-log.js", notices: "/ui/js/panel-notices.js", "windows-agent": "/ui/js/panel-windows-agent.js",
|
|
6611
|
+
view: "/assets/panel-view.js",
|
|
6612
|
+
};
|
|
6613
|
+
/**
|
|
6614
|
+
* M-3314: what this load of the shell imports, statically or as app.js boots it, so it can be asked for in one wave:
|
|
6615
|
+
* app.js; for a signed-in page the chat (always booted) and the panel of the route; for an admin's page also what
|
|
6616
|
+
* app.js loads for every admin (backend sign-in, agent proposals) and, with the chat workspace, its modules. Nothing a
|
|
6617
|
+
* page of that kind would not load anyway — a guest's or a reader's page preloads only what it imports itself.
|
|
6618
|
+
*/
|
|
6619
|
+
export function shellPreload(mode, guest, path, workspace) {
|
|
6620
|
+
const graph = appModuleGraph();
|
|
6621
|
+
const entries = ["/assets/app.js"];
|
|
6622
|
+
const route = shellRoute("GET", path);
|
|
6623
|
+
const panel = route?.kind === "shell" ? route.route.panel : null;
|
|
6624
|
+
if (panel === "view")
|
|
6625
|
+
entries.push(PANEL_MODULES.view);
|
|
6626
|
+
if (mode === "full") {
|
|
6627
|
+
entries.push(PANEL_MODULES.chat);
|
|
6628
|
+
if (!guest) {
|
|
6629
|
+
if (panel && panel !== "chat" && panel !== "view" && PANEL_MODULES[panel])
|
|
6630
|
+
entries.push(PANEL_MODULES[panel]);
|
|
6631
|
+
entries.push("/ui/js/backend-signin.js", "/ui/js/agent-proposals.js");
|
|
6632
|
+
if (workspace)
|
|
6633
|
+
entries.push("/ui/js/chat-workspace.js", PANEL_MODULES.details, PANEL_MODULES.log, PANEL_MODULES.view);
|
|
6634
|
+
}
|
|
6635
|
+
}
|
|
6636
|
+
return staticClosure(graph, entries);
|
|
6637
|
+
}
|
|
6515
6638
|
export function serveAppShell(req, res, ctx, mode, opts = {}) {
|
|
6516
6639
|
// A Hub workspace is drawn from nothing of this fleet's: no fleet cookie, session, preference or preview is read.
|
|
6517
6640
|
if (opts.hubWorkspace) {
|
|
@@ -6538,7 +6661,15 @@ export function serveAppShell(req, res, ctx, mode, opts = {}) {
|
|
|
6538
6661
|
const fileViewer = own ? evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false }) : null;
|
|
6539
6662
|
const fileFrame = own && fileViewer?.kind === "allow" && fileViewer.via === "session" && fileViewer.session.tier === "admin" ? `${own}/ui/reply-preview` : null;
|
|
6540
6663
|
const frameSrc = [previewFrames, fileFrame].filter(Boolean).join(" ");
|
|
6541
|
-
|
|
6664
|
+
const bodyTag = shellBodyTag(req, ctx, mode, viewer);
|
|
6665
|
+
const page = withAppIconLinks(html).replace('<html lang="en">', shellHtmlTag(ctx, mode, viewer)).replace("<body>", bodyTag);
|
|
6666
|
+
// M-3314: the shell's files under this version, and the modules this load will import preloaded at once.
|
|
6667
|
+
const guest = mode === "full" && !!viewer?.guest;
|
|
6668
|
+
const preload = shellPreload(mode, guest, new URL(req.url ?? "/", "http://localhost").pathname, bodyTag.includes('data-chat-workspace="1"'));
|
|
6669
|
+
// Only while the files are still the ones <V> names: between an update's install and its restart the shell is the
|
|
6670
|
+
// plain one (no-store files, as before this change), never one that names <V> over files it does not describe.
|
|
6671
|
+
const shell = assetsUnchanged() ? versionShell(page, assetVersion(), preload, mode === "full" && !guest ? appModuleGraph() : undefined) : page;
|
|
6672
|
+
sendPanelHtml(res, shell, 200, {}, { ...(frameSrc ? { frameSrc } : {}), mediaSrc });
|
|
6542
6673
|
}
|
|
6543
6674
|
catch {
|
|
6544
6675
|
json(res, 500, { error: "app.html not found" });
|