Files
Skald-Circle/web/index.html
T
Daniele 488c702517
Nightly Build / build (push) Successful in 5m36s
feat(files): a Files section over the caller's whole space
Until now file browsing existed only inside a project, and the two memory
stores were reachable only by the agent's tools. `#files` is the general
surface: home, both memory stores, the shared folders and projects the
caller belongs to, plus the read-only skills and docs trees.

The root is virtual, and that is the design. Anchoring at `~` is wrong:
the explorer reads host-side, while `shared/`, `projects/`, `skills/` and
`docs/` are bind mounts inside the container — a page rooted at the home
would show less than the user has with no way to reach the rest, and on
native Linux would show Docker's empty mountpoint stubs, a door that
appears to work and leads nowhere. So level 0 is a synthetic list from the
new `GET /api/files/roots`, serialized from the caller's `UserFs` plus the
two virtual memory roots. It sends `kind`, never a label: labels are copy
and get translated.

`GET /api/files/dir` now answers `{ path, can_write, entries }`, and a
memory path is classified before `resolve_view_path` (which refuses one)
and listed from `memory_docs`: one level derived from the flat key space
by the pure `memory_docs::immediate_children`, over a single query whose
unslashed prefix also spots an exact note as "not a directory". Memory is
read-only from the page — every writer routes through `resolve_view_path`,
and `shared-memory/*` is `@fs_write require` for the agent, so a button
that walks past that rule is a decision of its own.

The explorer moves out of projects into `shared/file-explorer.js`, taking
`root` + `rootLabel` and reading `can_write` from the listing rather than
from its host: writability changes per branch and comes from the same
`UserFs::can_write_to` the server rejects writes with, so the buttons
offered and the writes accepted cannot disagree. Deep-linking needed it
steerable without a two-way binding, hence `rel` in and
`explorer-navigate` out — the event fires only for a click, never for a
`rel` the host set, so echoing it back is a no-op.

The URL carries the agent path of the open folder in one parameter, the
same vocabulary the assistant uses, so a link is shareable and pasteable
into a conversation; which root it belongs to is derived, not stored.

docs/: a new files.md, plus two pages this made false — shared-folders.md
claimed in three places that a shared folder has no explorer, and
memory.md never said a user can now read their own notes.
2026-08-22 20:09:56 +01:00

136 lines
5.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Skald</title>
<link rel="icon" href="/assets/icons/favicon.ico" sizes="any" />
<link rel="icon" href="/assets/icons/icon-192.png" type="image/png" />
<!-- Redirect mobile browsers to the mobile UI -->
<script>
(function () {
var isMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) || window.innerWidth < 768;
if (isMobile) window.location.replace('/mobile.html');
})();
</script>
<!-- Apply theme before render to avoid flash. localStorage wins over OS preference. -->
<script>
(function () {
const saved = localStorage.getItem('theme');
const dark = saved ? saved === 'dark' : window.matchMedia('(prefers-color-scheme: dark)').matches;
document.documentElement.setAttribute('data-bs-theme', dark ? 'dark' : 'light');
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
if (!localStorage.getItem('theme')) {
document.documentElement.setAttribute('data-bs-theme', e.matches ? 'dark' : 'light');
}
});
})();
</script>
<!-- Font -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" />
<!-- Bootstrap 5 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" />
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" />
<link rel="stylesheet" href="css/variables.css" />
<link rel="stylesheet" href="css/topbar.css" />
<link rel="stylesheet" href="css/sidebar.css" />
<link rel="stylesheet" href="css/copilot.css" />
<link rel="stylesheet" href="css/copilot-messages.css" />
<link rel="stylesheet" href="css/copilot-input.css" />
<link rel="stylesheet" href="css/agent-tasks.css" />
<link rel="stylesheet" href="css/dialogs.css" />
<link rel="stylesheet" href="css/page-shell.css" />
<link rel="stylesheet" href="css/page-header.css" />
<link rel="stylesheet" href="css/connectors.css" />
<link rel="stylesheet" href="css/models-hub.css" />
<link rel="stylesheet" href="css/tasks/base.css" />
<link rel="stylesheet" href="css/tasks/history.css" />
<link rel="stylesheet" href="css/models-llm.css" />
<link rel="stylesheet" href="css/models-image.css" />
<link rel="stylesheet" href="css/llm-providers.css" />
<link rel="stylesheet" href="css/agents.css" />
<link rel="stylesheet" href="css/approval-groups.css" />
<link rel="stylesheet" href="css/approval-rules.css" />
<link rel="stylesheet" href="css/inbox-cards.css" />
<link rel="stylesheet" href="css/config.css" />
<link rel="stylesheet" href="css/system-agents.css" />
<link rel="stylesheet" href="css/agent-inbox.css" />
<link rel="stylesheet" href="css/home.css" />
<link rel="stylesheet" href="css/llm-requests.css" />
<link rel="stylesheet" href="css/setup-page.css" />
<link rel="stylesheet" href="css/users-roles.css" />
<link rel="stylesheet" href="css/projects/base.css" />
<link rel="stylesheet" href="css/projects/board.css" />
<link rel="stylesheet" href="css/file-viewer.css" />
<link rel="stylesheet" href="css/hljs-theme.css" />
<!-- pdf.js TextLayer's DOM contract (selectable text over the rendered pages). -->
<link rel="stylesheet" href="/vendor/pdf-text-layer.css" />
<script src="/vendor/cronstrue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js"></script>
<script type="importmap">
{
"imports": {
"lit": "/vendor/lit-all.min.js",
"lit/directives/unsafe-html.js": "/vendor/lit-all.min.js",
"lit/directives/keyed.js": "/vendor/lit-all.min.js",
"marked": "/vendor/marked.esm.js",
"dompurify": "/vendor/purify.es.mjs",
"cronstrue": "/vendor/cronstrue.mjs"
}
}
</script>
</head>
<body>
<div id="app">
<app-topbar></app-topbar>
<div class="app-body">
<app-sidebar></app-sidebar>
<div class="app-workspace" id="app-workspace"></div>
<agents-page></agents-page>
<users-page></users-page>
<roles-page></roles-page>
<shared-folders-page></shared-folders-page>
<connectors-page></connectors-page>
<connector-detail-page></connector-detail-page>
<plugin-page-host></plugin-page-host>
<plugin-catalog-page></plugin-catalog-page>
<plugin-detail-page></plugin-detail-page>
<marketplace-page></marketplace-page>
<profile-page style="display:none"></profile-page>
<llm-providers-page></llm-providers-page>
<models-hub-page></models-hub-page>
<tasks-page></tasks-page>
<approval-groups-page></approval-groups-page>
<approval-rules-page></approval-rules-page>
<config-page></config-page>
<dashboard-page></dashboard-page>
<agent-inbox-page></agent-inbox-page>
<llm-requests-page></llm-requests-page>
<session-detail-page style="display:none"></session-detail-page>
<system-agents-page style="display:none"></system-agents-page>
<projects-page style="display:none"></projects-page>
<files-page style="display:none"></files-page>
<file-viewer-page style="display:none"></file-viewer-page>
<tool-detail-page style="display:none"></tool-detail-page>
<app-copilot></app-copilot>
</div>
</div>
<setup-page style="display:none"></setup-page>
<login-page style="display:none"></login-page>
<script type="module" src="app.js"></script>
</body>
</html>