Watch
1
0
Fork
You've already forked souveraine
0
souveraine/surfaces/quickshell/modules/ii/dock/DockManifest.qml
Fimeg 8f42fc953d publish: the public projection begins here
This is a projection, not a development branch. The tree above was constructed
from the internal source named below under a manifest that decides which paths
may leave, then scanned as a whole tree rather than as a series of patches, and
only then published.

Public history starts here because the history before it was not admissible,
and neither was the tree. What used to stand in this repository included a
rescue copy of another machine, a directory of phone handoffs, deployment
wired to one house, and a submodule pointing at a forge no stranger can reach.
None of that was ever the product. It stays in the private forge, which is
allowed to hold the whole working organism, and this is what was deliberately
sent out instead.

Three mechanisms produced this tree, in decreasing order of trust. A top-level
path the manifest does not name never arrives at all, which is the one that
catches directories nobody has thought of yet. Named internal files inside
admitted roots are dropped. A short, reviewed table replaces deployment
defaults that a public build must not carry -- an endpoint aimed at one LAN, a
VPN profile belonging to one phone, packaging built from one checkout path.

Everything after this commit is an ordinary publication with the same three
trailers, so a force push stops being routine and starts meaning that
something deliberate happened. The trailers bind the projection to its source
without pretending the public SHA is the private one: same lineage, different
tree, and the record says so.

Source-Sha: 8f27b1e76a8fef560a336aba18e6990713ff1047
Policy-Sha: 6b261d2f3e6e1fb19874846ba4bb1dfe15565d25b8618c1c1afba0419c101d27
Tree-Digest: 18ec3563c5e5ef9a414993a9f6734b251ff9ed3cd56eebdd6cac01e45c6e3067
2026-09-04 15:55:48 -04:00

150 lines
5.8 KiB
QML

// Dock manifest — the dock's state projected for external consumers
// (the agent, the settings app, anything that needs to read or act on the
// dock without parsing QML). See docs/tasks/souveraine-shell-ecosystem.md.
//
// This is a QtObject instantiated inside Dock.qml's Scope (as
// DockLocal.DockManifest), NOT a qs.services singleton. Reason: GlobalStates.qml
// imports qs.services, so a DockManifest singleton would form a circular import
// (GlobalStates → qs.services → DockManifest) that QML can't resolve. As a local
// type in the dock dir it sidesteps that cycle. It carries its own `import qs`
// (for GlobalStates) and `import qs.modules.common` (for Config) — local types
// do NOT inherit the importing file's imports.
//
// Two halves:
// 1. manifest() — read-only snapshot of pinned apps, stacks,
// visibility state, and mode.
// 2. guarded methods — pin/unpin/restack/rename. Every method validates
// its inputs and refuses mutation when the dock is
// in a state that forbids it. Returns a result object.
//
// The agent does NOT get a new toolcall integration here — Souveraine's
// existing harness integration calls these methods. The teaching of when
// to use them lives in the Souveraine School, not in this file.
import qs
import qs.services
import qs.modules.common
import QtQuick
QtObject {
id: root
// --- Read-only projection -------------------------------------------
// One shape the agent (and the dock-stacks settings editor) can rely on.
function manifest() {
const ta = TaskbarApps;
const stacks = (ta ? ta.stacksList() : []).map(s => ({
id: s.id,
name: s.name,
members: s.members
}));
const stackedMembers = new Set();
for (const s of stacks)
for (const m of s.members) stackedMembers.add(String(m).toLowerCase());
const pinned = (Config.options?.dock?.pinnedApps ?? [])
.filter(id => !stackedMembers.has(String(id).toLowerCase()));
return {
mode: Config.options?.souveraine?.phone ? "phone" : "desktop",
hidden: root._isHidden(),
pinned: root.dockState(),
pinnedApps: pinned,
stacks: stacks,
canMutate: root._canMutate(),
blockReason: root._blockReason()
};
}
// The dock's computed visibility, bound by Dock.qml. Read, never derived:
// the ladder this used to keep could not see the home-zone rule and so
// answered "hidden" on the one zone where the dock is always furniture.
property string visibility: "hidden"
// Visible state as a stable string the agent can reason about. The osk and
// lock strings are the *reason* a hidden dock is hidden, not a second
// opinion about whether it is.
function dockState() {
if (GlobalStates.screenLocked) return "locked";
if (root.visibility === "hidden" && GlobalStates.oskOpen) return "suppressed-by-osk";
return root.visibility;
}
// --- Guarded mutation ------------------------------------------------
// Every mutation returns { ok, reason? }. No throw, no silent failure.
function pin(appId) {
const guard = root._checkMutatable(appId);
if (!guard.ok) return guard;
if (TaskbarApps.isPinned(appId)) return { ok: true, reason: "already-pinned" };
TaskbarApps.togglePin(appId);
return { ok: true };
}
function unpin(appId) {
const guard = root._checkMutatable(appId);
if (!guard.ok) return guard;
if (TaskbarApps.stackContaining(appId)) {
return { ok: false, reason: "app is in a stack; use unstackMember" };
}
if (!TaskbarApps.isPinned(appId)) return { ok: true, reason: "not-pinned" };
TaskbarApps.togglePin(appId);
return { ok: true };
}
function addToStack(stackId, appId) {
const guard = root._checkMutatable(appId);
if (!guard.ok) return guard;
if (!root._stackExists(stackId)) return { ok: false, reason: "no-such-stack" };
TaskbarApps.addToStack(stackId, appId);
return { ok: true };
}
function removeFromStack(stackId, appId) {
const guard = root._checkMutatable(appId);
if (!guard.ok) return guard;
if (!root._stackExists(stackId)) return { ok: false, reason: "no-such-stack" };
TaskbarApps.removeFromStack(stackId, appId);
return { ok: true };
}
function renameStack(stackId, newName) {
const guard = root._checkMutatable();
if (!guard.ok) return guard;
if (!root._stackExists(stackId)) return { ok: false, reason: "no-such-stack" };
const name = String(newName ?? "").trim();
if (!name) return { ok: false, reason: "empty-name" };
TaskbarApps.renameStack(stackId, name);
return { ok: true };
}
// --- State checks (the guardrails) ----------------------------------
function _canMutate() { return root._blockReason() === ""; }
function _blockReason() {
if (GlobalStates.screenLocked) return "screen-locked";
if (GlobalStates.oskOpen) return "osk-open";
if (GlobalStates.dockDragInProgress) return "drag-in-progress";
return "";
}
function _checkMutatable(appId) {
const reason = root._blockReason();
if (reason) return { ok: false, reason: reason };
if (appId !== undefined && !String(appId).trim()) {
return { ok: false, reason: "empty-app-id" };
}
return { ok: true };
}
function _stackExists(stackId) {
return TaskbarApps.stacksList().some(s => s.id === stackId);
}
function _isHidden() {
return GlobalStates.screenLocked || root.visibility === "hidden";
}
}