pinokiod 8.3.7 → 8.3.10
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/kernel/agent_instructions.js +56 -0
- package/kernel/app_log_sessions.js +1 -1
- package/kernel/bin/node.js +2 -2
- package/kernel/environment.js +6 -98
- package/kernel/managed_skills.js +2 -1
- package/kernel/prototype.js +7 -0
- package/kernel/request_file.js +53 -0
- package/package.json +1 -1
- package/prototype/system/SKILL_PINOKIO.md +5 -2
- package/server/index.js +12 -1
- package/server/lib/brain.js +305 -0
- package/server/public/agent-bar-app.css +359 -0
- package/server/public/agent-bar-app.js +837 -0
- package/server/public/agent-bar-attach.css +142 -0
- package/server/public/agent-bar-attach.js +299 -0
- package/server/public/agent-bar-panel.css +788 -0
- package/server/public/agent-bar-panel.js +1915 -0
- package/server/public/agent-bar-shell.css +128 -0
- package/server/public/agent-bar-shell.js +251 -0
- package/server/public/agent-bar.css +972 -0
- package/server/public/agent-bar.js +1513 -0
- package/server/public/common.js +65 -0
- package/server/public/layout.js +13 -1
- package/server/public/logs.js +22 -0
- package/server/routes/apps.js +6 -0
- package/server/socket.js +6 -2
- package/server/views/app.ejs +13 -0
- package/server/views/partials/main_sidebar.ejs +7 -0
- package/system/plugin/opencode/pinokio.js +8 -2
- package/system/plugin/opencode-auto/pinokio.js +4 -1
- package/test/agent-instructions.test.js +69 -0
- package/test/app-log-sessions.test.js +29 -0
- package/test/brain.test.js +301 -0
- package/test/managed-skills.test.js +6 -1
- package/test/node-bin.test.js +4 -4
- package/test/request-file.test.js +93 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
// The brain: the one folder every Ask from the top bar runs in.
|
|
4
|
+
//
|
|
5
|
+
// <pinokio home>/brain
|
|
6
|
+
// AGENTS.md, CLAUDE.md, GEMINI.md the same fixed instructions
|
|
7
|
+
// me/preferences.md which app the user wants for which kind of task
|
|
8
|
+
// me/log.md one line per Ask
|
|
9
|
+
// me/files/<id>/ the files given to, or made by, one Ask
|
|
10
|
+
// .pinokio-temp/requests/<id>.md one Ask's request (kernel/request_file.js)
|
|
11
|
+
//
|
|
12
|
+
// What agents learn about an app is not kept here but in the app's own folder:
|
|
13
|
+
//
|
|
14
|
+
// <pinokio home>/api/<app>/.pinokio-skill
|
|
15
|
+
// SKILL.md, clients/, references/
|
|
16
|
+
//
|
|
17
|
+
// Pinokio, not the agent, does the bookkeeping: it tells the agent where each
|
|
18
|
+
// app's skill is, writes the instruction files and adds a log line. It only
|
|
19
|
+
// rewrites instruction files it wrote itself, and none of this bookkeeping can
|
|
20
|
+
// stop an Ask. An Ask from an app's page runs in the app's own folder, so there
|
|
21
|
+
// the place of the app's skill and the output folder are added to the request,
|
|
22
|
+
// which is written into that folder's .pinokio-temp/requests.
|
|
23
|
+
|
|
24
|
+
const fs = require("fs")
|
|
25
|
+
const path = require("path")
|
|
26
|
+
const crypto = require("crypto")
|
|
27
|
+
const git = require("isomorphic-git")
|
|
28
|
+
const ManagedSkills = require("../../kernel/managed_skills")
|
|
29
|
+
const RequestFile = require("../../kernel/request_file")
|
|
30
|
+
|
|
31
|
+
const LOG_PROMPT_LENGTH = 200
|
|
32
|
+
const BRAIN_HEADING = "# Pinokio Brain"
|
|
33
|
+
// The same instructions under each name an agent may look for. `AGENTS.md` is
|
|
34
|
+
// read by most agents. Claude skips it when a `CLAUDE.md` is in the folder or
|
|
35
|
+
// any folder above, and Gemini does not read it unless told to.
|
|
36
|
+
const INSTRUCTION_FILES = ["AGENTS.md", "CLAUDE.md", "GEMINI.md"]
|
|
37
|
+
const SKILL_FOLDER = ".pinokio-skill"
|
|
38
|
+
|
|
39
|
+
const brainRoot = (kernel) => kernel.path("brain")
|
|
40
|
+
|
|
41
|
+
// ---- an app's skill ---------------------------------------------------------
|
|
42
|
+
// An app's version is the commit its launcher is at, plus the commit of each
|
|
43
|
+
// repository the launcher keeps the app's code in: a folder directly inside
|
|
44
|
+
// the launcher's folder (`app`, `facefusion`) or directly inside `app`
|
|
45
|
+
// (`app/comfyui`). An update to either one changes the version.
|
|
46
|
+
const commitOf = async (dir) => {
|
|
47
|
+
const repository = await fs.promises.stat(path.resolve(dir, ".git", "HEAD")).then(() => true, () => false)
|
|
48
|
+
return repository ? git.resolveRef({ fs, dir, ref: "HEAD" }).then((oid) => oid.slice(0, 7), () => "") : ""
|
|
49
|
+
}
|
|
50
|
+
const foldersIn = (dir) => {
|
|
51
|
+
return fs.promises.readdir(dir, { withFileTypes: true }).then((entries) => {
|
|
52
|
+
return entries.filter((entry) => entry.isDirectory() && entry.name !== ".git").map((entry) => path.resolve(dir, entry.name)).sort()
|
|
53
|
+
}, () => [])
|
|
54
|
+
}
|
|
55
|
+
const versionOf = async (appDir) => {
|
|
56
|
+
const inside = [...await foldersIn(appDir), ...await foldersIn(path.resolve(appDir, "app"))]
|
|
57
|
+
const commits = await Promise.all([appDir, ...inside].map(commitOf))
|
|
58
|
+
return commits.filter(Boolean).join("+")
|
|
59
|
+
}
|
|
60
|
+
// The app version a saved skill was learned on; null when no skill is saved.
|
|
61
|
+
const skillVersion = async (skillDir) => {
|
|
62
|
+
const content = await fs.promises.readFile(path.resolve(skillDir, "SKILL.md"), "utf8").catch(() => "")
|
|
63
|
+
if (!content) {
|
|
64
|
+
return null
|
|
65
|
+
}
|
|
66
|
+
const head = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)
|
|
67
|
+
const line = head && head[1].match(/^version:\s*(.*)$/m)
|
|
68
|
+
return line ? line[1].trim().replace(/^["']|["']$/g, "") : ""
|
|
69
|
+
}
|
|
70
|
+
const describeApp = async (kernel, appName) => {
|
|
71
|
+
const appDir = kernel.path("api", appName)
|
|
72
|
+
const skillDir = path.resolve(appDir, SKILL_FOLDER)
|
|
73
|
+
const [appVersion, learnedOn] = await Promise.all([versionOf(appDir), skillVersion(skillDir)])
|
|
74
|
+
let state = "none"
|
|
75
|
+
if (learnedOn !== null) {
|
|
76
|
+
state = appVersion && learnedOn !== appVersion ? "check" : "current"
|
|
77
|
+
// The folder keeps itself out of the app's own git: one file that ignores
|
|
78
|
+
// everything in it, written when missing and never replaced.
|
|
79
|
+
await fs.promises.writeFile(path.resolve(skillDir, ".gitignore"), "*\n", { flag: "wx" }).catch(() => {})
|
|
80
|
+
}
|
|
81
|
+
return { skill_dir: skillDir, skill_state: state, app_version: appVersion }
|
|
82
|
+
}
|
|
83
|
+
// Search results tell the agent where each app's skill is, so the agent never
|
|
84
|
+
// has to name the folder itself.
|
|
85
|
+
const addSkills = async (kernel, apps) => {
|
|
86
|
+
if (!Array.isArray(apps)) {
|
|
87
|
+
return apps
|
|
88
|
+
}
|
|
89
|
+
return Promise.all(apps.map(async (app) => {
|
|
90
|
+
try {
|
|
91
|
+
const appName = app && (app.app_id || app.name)
|
|
92
|
+
return appName ? { ...app, ...await describeApp(kernel, appName) } : app
|
|
93
|
+
} catch (_) {
|
|
94
|
+
return app
|
|
95
|
+
}
|
|
96
|
+
}))
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ---- before each Ask --------------------------------------------------------
|
|
100
|
+
const createBrain = ({ kernel, copyUploads, pluginHref }) => {
|
|
101
|
+
const two = (number) => String(number).padStart(2, "0")
|
|
102
|
+
const newId = (now) => {
|
|
103
|
+
const day = `${now.getFullYear()}${two(now.getMonth() + 1)}${two(now.getDate())}`
|
|
104
|
+
return `${day}-${crypto.randomBytes(4).toString("hex")}`
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Fixed text: it only comes out different when Pinokio's own skills change.
|
|
108
|
+
const buildInstructions = async () => {
|
|
109
|
+
const pinokio = (await ManagedSkills.readEnabledManagedSkillBody(kernel, "pinokio").catch(() => "")).trim()
|
|
110
|
+
const gepeto = await ManagedSkills.getManagedSkill(kernel, "gepeto", { sync: false }).catch(() => null)
|
|
111
|
+
const sections = [
|
|
112
|
+
[
|
|
113
|
+
BRAIN_HEADING,
|
|
114
|
+
"",
|
|
115
|
+
"This file is written by Pinokio. Do not edit it: Pinokio puts its own text back before the next Ask.",
|
|
116
|
+
"",
|
|
117
|
+
"This folder is shared by every Ask on this computer. Other Asks may be running here at the same time, so do not delete or move files you did not create.",
|
|
118
|
+
"",
|
|
119
|
+
"- What was learned about an app is kept in that app's own folder: the `skill_dir` given with the app's search result.",
|
|
120
|
+
"- Files you make for a request go in the output folder named at the end of the request."
|
|
121
|
+
].join("\n"),
|
|
122
|
+
[
|
|
123
|
+
"## Which app to use",
|
|
124
|
+
"",
|
|
125
|
+
"Before choosing an app, read `me/preferences.md` if it exists. Each line there is the user's own choice of app for a kind of task. A line that fits the request wins over the ranking rules.",
|
|
126
|
+
"",
|
|
127
|
+
"Keep that file right:",
|
|
128
|
+
"- When the user says which app to use for a kind of task, or names an app in a request (\"use X to do Y\"), write one line: the kind of task in a few words, then the app's `app_id` in backticks. Example: ``- speak text aloud: `Qwen3-TTS-MLX` ``",
|
|
129
|
+
"- When no line fits and you had to choose between several apps that could do it, finish the request first. Then ask the user once, in one line, whether to use that app for this kind of task from now on. Write the line only if they say yes.",
|
|
130
|
+
"- Keep one line per kind of task. If there is already one, replace it.",
|
|
131
|
+
"- When the user says to stop using an app for a kind of task, or the app is no longer installed, remove the line.",
|
|
132
|
+
"- Tell the user in one line what you saved or removed."
|
|
133
|
+
].join("\n")
|
|
134
|
+
]
|
|
135
|
+
if (pinokio) {
|
|
136
|
+
sections.push(["## Pinokio", "", pinokio].join("\n"))
|
|
137
|
+
}
|
|
138
|
+
if (gepeto && gepeto.enabled && gepeto.valid && gepeto.path) {
|
|
139
|
+
sections.push([
|
|
140
|
+
"## Building launchers",
|
|
141
|
+
"",
|
|
142
|
+
`Before building or changing a Pinokio launcher, read \`${gepeto.path}\`.`
|
|
143
|
+
].join("\n"))
|
|
144
|
+
}
|
|
145
|
+
return `${sections.join("\n\n")}\n`
|
|
146
|
+
}
|
|
147
|
+
const writeInstructions = async (dir) => {
|
|
148
|
+
const content = await buildInstructions()
|
|
149
|
+
for (const filename of INSTRUCTION_FILES) {
|
|
150
|
+
const filepath = path.resolve(dir, filename)
|
|
151
|
+
// written when missing; rewritten only when its first line is Pinokio's own
|
|
152
|
+
// heading. Any other file, or one that cannot be read, is left alone.
|
|
153
|
+
const existing = await fs.promises.readFile(filepath, "utf8").catch((error) => (error.code === "ENOENT" ? undefined : null))
|
|
154
|
+
const ours = typeof existing === "string" && existing.split(/\r?\n/, 1)[0] === BRAIN_HEADING
|
|
155
|
+
if (existing === undefined || (ours && existing !== content)) {
|
|
156
|
+
await attempt(filename, () => fs.promises.writeFile(filepath, content, "utf8"))
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const appendLog = async (dir, { id, now, tool, app, prompt }) => {
|
|
162
|
+
const when = `${now.getFullYear()}-${two(now.getMonth() + 1)}-${two(now.getDate())} ${two(now.getHours())}:${two(now.getMinutes())}`
|
|
163
|
+
let asked = prompt.replace(/\s+/g, " ").trim()
|
|
164
|
+
if (asked.length > LOG_PROMPT_LENGTH) {
|
|
165
|
+
asked = `${asked.slice(0, LOG_PROMPT_LENGTH)}…`
|
|
166
|
+
}
|
|
167
|
+
const who = `${String(tool || "agent").replace(/\s+/g, " ").slice(0, 80)}${app ? ` in ${app}` : ""}`
|
|
168
|
+
const line = `- ${when} | ${id} | ${who} | ${asked}\n`
|
|
169
|
+
await fs.promises.appendFile(path.resolve(dir, "me", "log.md"), line, "utf8")
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Bookkeeping must never stop an Ask: a step that fails is reported and skipped.
|
|
173
|
+
const attempt = async (what, step) => {
|
|
174
|
+
try {
|
|
175
|
+
return await step()
|
|
176
|
+
} catch (error) {
|
|
177
|
+
console.warn(`[brain] ${what} failed:`, error && error.message ? error.message : error)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const makeFolders = (dir) => attempt("folders", () => fs.promises.mkdir(path.resolve(dir, "me", "files"), { recursive: true }))
|
|
182
|
+
|
|
183
|
+
const prepare = async ({ prompt, tool, uploadToken }) => {
|
|
184
|
+
const href = pluginHref(tool)
|
|
185
|
+
const dir = brainRoot(kernel)
|
|
186
|
+
const now = new Date()
|
|
187
|
+
const id = newId(now)
|
|
188
|
+
await fs.promises.mkdir(dir, { recursive: true }) // the agent starts here
|
|
189
|
+
await makeFolders(dir)
|
|
190
|
+
|
|
191
|
+
// The request the agent gets: the user's words, then where this Ask's files are.
|
|
192
|
+
const request = prompt ? [prompt] : []
|
|
193
|
+
if (uploadToken) {
|
|
194
|
+
const filesDir = path.resolve(dir, "me", "files", id)
|
|
195
|
+
await fs.promises.mkdir(filesDir)
|
|
196
|
+
let copied = []
|
|
197
|
+
try {
|
|
198
|
+
copied = await copyUploads(uploadToken, filesDir)
|
|
199
|
+
} finally {
|
|
200
|
+
if (copied.length === 0) {
|
|
201
|
+
await fs.promises.rm(filesDir, { recursive: true, force: true }).catch(() => {})
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (copied.length > 0) {
|
|
205
|
+
request.push(`Attached files:\n${copied.map((name) => `- me/files/${id}/${name}`).join("\n")}`)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// The agent is started with one line that points to the request, which is
|
|
209
|
+
// in a file in this folder (spec/requirements/request-files.md).
|
|
210
|
+
let requestLine = ""
|
|
211
|
+
if (request.length > 0) {
|
|
212
|
+
request.push(`Output folder: me/files/${id}/`)
|
|
213
|
+
requestLine = await RequestFile.save(dir, id, request.join("\n\n"))
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
await attempt("instructions", () => writeInstructions(dir))
|
|
217
|
+
await attempt("log", () => appendLog(dir, { id, now, tool, prompt }))
|
|
218
|
+
|
|
219
|
+
const params = new URLSearchParams()
|
|
220
|
+
params.set("cwd", dir)
|
|
221
|
+
params.set("chrome", "full")
|
|
222
|
+
params.set("session", id)
|
|
223
|
+
if (requestLine) {
|
|
224
|
+
params.set("prompt", requestLine)
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
ok: true,
|
|
228
|
+
cwd: dir,
|
|
229
|
+
url: `${href}?${params.toString()}`
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// An Ask from an app's page. The agent runs in the app's folder, which the
|
|
234
|
+
// page starts itself; this writes the request into that folder and hands back
|
|
235
|
+
// the line the page starts the agent with (spec/requirements/request-files.md).
|
|
236
|
+
const prepareForApp = async ({ app, prompt, tool, files }) => {
|
|
237
|
+
const appDir = /^[^/\\:]+$/.test(app) && app !== "." && app !== ".." ? kernel.path("api", app) : ""
|
|
238
|
+
const appStat = appDir ? await fs.promises.stat(appDir).catch(() => null) : null
|
|
239
|
+
if (!appStat || !appStat.isDirectory()) {
|
|
240
|
+
const error = new Error("App not found.")
|
|
241
|
+
error.status = 404
|
|
242
|
+
throw error
|
|
243
|
+
}
|
|
244
|
+
// only files the page uploaded for this app
|
|
245
|
+
const uploads = path.resolve(appDir, ".pinokio-temp", "uploads")
|
|
246
|
+
const attached = files.map((file) => (typeof file === "string" ? path.resolve(file) : ""))
|
|
247
|
+
const outside = attached.some((file) => {
|
|
248
|
+
const inside = file ? path.relative(uploads, file) : ""
|
|
249
|
+
return !inside || inside.startsWith("..") || path.isAbsolute(inside)
|
|
250
|
+
})
|
|
251
|
+
if (outside || (!prompt && attached.length === 0)) {
|
|
252
|
+
const error = new Error(outside ? "Attached files must be this app's uploads." : "The request is empty.")
|
|
253
|
+
error.status = 400
|
|
254
|
+
throw error
|
|
255
|
+
}
|
|
256
|
+
const dir = brainRoot(kernel)
|
|
257
|
+
const now = new Date()
|
|
258
|
+
const id = newId(now)
|
|
259
|
+
await makeFolders(dir)
|
|
260
|
+
|
|
261
|
+
const { skill_dir, skill_state, app_version } = await describeApp(kernel, app)
|
|
262
|
+
const request = prompt ? [prompt] : []
|
|
263
|
+
if (attached.length > 0) {
|
|
264
|
+
request.push(`Attached files:\n${attached.map((file) => `- ${file}`).join("\n")}`)
|
|
265
|
+
}
|
|
266
|
+
request.push([
|
|
267
|
+
"Pinokio brain:",
|
|
268
|
+
`- This app's skill (skill_dir): ${skill_dir} (skill_state: ${skill_state}${app_version ? `, app_version: ${app_version}` : ""})`,
|
|
269
|
+
`- Output folder: ${path.resolve(dir, "me", "files", id)}`
|
|
270
|
+
].join("\n"))
|
|
271
|
+
const requestLine = await RequestFile.save(appDir, id, request.join("\n\n"))
|
|
272
|
+
await attempt("log", () => appendLog(dir, { id, now, tool, app, prompt }))
|
|
273
|
+
return {
|
|
274
|
+
ok: true,
|
|
275
|
+
prompt: requestLine
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const handleAsk = async (req, res) => {
|
|
280
|
+
try {
|
|
281
|
+
const body = req.body && typeof req.body === "object" ? req.body : {}
|
|
282
|
+
const ask = {
|
|
283
|
+
prompt: typeof body.prompt === "string" ? body.prompt.trim() : "",
|
|
284
|
+
tool: typeof body.tool === "string" ? body.tool : "",
|
|
285
|
+
uploadToken: typeof body.uploadToken === "string" ? body.uploadToken.trim() : "",
|
|
286
|
+
app: typeof body.app === "string" ? body.app : "",
|
|
287
|
+
files: Array.isArray(body.files) ? body.files : []
|
|
288
|
+
}
|
|
289
|
+
res.json(await (ask.app ? prepareForApp(ask) : prepare(ask)))
|
|
290
|
+
} catch (error) {
|
|
291
|
+
const status = Number.isInteger(error && error.status) ? error.status : 500
|
|
292
|
+
res.status(status).json({
|
|
293
|
+
ok: false,
|
|
294
|
+
error: error && error.message ? error.message : "Failed to prepare the Ask."
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return { handleAsk }
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
module.exports = {
|
|
303
|
+
addSkills,
|
|
304
|
+
createBrain
|
|
305
|
+
}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/* Agent bar on app pages (see agent-bar-app.js).
|
|
2
|
+
- the app card (icon, name, Disk/CPU/RAM) sits at the top of the left sidebar
|
|
3
|
+
- "News" (the Feed panel's button) is a row at the bottom of that card
|
|
4
|
+
- the top navbar holds the "Ask AI about <app>" bar */
|
|
5
|
+
/* App page: the app block (icon column + name + Disk/CPU/RAM), moved from the
|
|
6
|
+
navbar to the top of the app sidebar */
|
|
7
|
+
#app-sidebar .agent-bar-app-identity {
|
|
8
|
+
flex: 0 0 auto;
|
|
9
|
+
align-self: stretch;
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-columns: 44px minmax(0, 1fr);
|
|
12
|
+
grid-template-rows: auto auto;
|
|
13
|
+
column-gap: 10px;
|
|
14
|
+
row-gap: 1px;
|
|
15
|
+
align-items: center;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
width: auto;
|
|
18
|
+
max-width: none;
|
|
19
|
+
height: auto;
|
|
20
|
+
min-height: 0;
|
|
21
|
+
margin: 0 0 8px;
|
|
22
|
+
padding: 8px;
|
|
23
|
+
border-radius: 10px;
|
|
24
|
+
overflow: visible;
|
|
25
|
+
}
|
|
26
|
+
#app-sidebar .agent-bar-app-identity .app-header-identity-separator,
|
|
27
|
+
#app-sidebar .agent-bar-app-identity .app-header-identity-icon {
|
|
28
|
+
display: none;
|
|
29
|
+
}
|
|
30
|
+
/* the info root contributes its children (icon button, name button) straight to the grid */
|
|
31
|
+
#app-sidebar .agent-bar-app-identity .app-header-info {
|
|
32
|
+
display: contents;
|
|
33
|
+
}
|
|
34
|
+
.agent-bar-app-icon {
|
|
35
|
+
grid-column: 1;
|
|
36
|
+
grid-row: 1 / span 2;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
width: 44px;
|
|
39
|
+
height: 44px;
|
|
40
|
+
margin: 0;
|
|
41
|
+
padding: 6px;
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
border: 1px solid rgba(15, 23, 42, 0.1);
|
|
46
|
+
border-radius: 10px;
|
|
47
|
+
background: #ffffff;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
50
|
+
body.dark .agent-bar-app-icon {
|
|
51
|
+
border-color: rgba(255, 255, 255, 0.12);
|
|
52
|
+
background: rgba(255, 255, 255, 0.06);
|
|
53
|
+
}
|
|
54
|
+
.agent-bar-app-icon img {
|
|
55
|
+
display: block;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
object-fit: contain;
|
|
59
|
+
border-radius: 4px;
|
|
60
|
+
}
|
|
61
|
+
#app-sidebar .agent-bar-app-identity .app-header-info-trigger {
|
|
62
|
+
grid-column: 2;
|
|
63
|
+
grid-row: 1;
|
|
64
|
+
align-self: end;
|
|
65
|
+
justify-self: start;
|
|
66
|
+
justify-content: flex-start;
|
|
67
|
+
min-width: 0;
|
|
68
|
+
max-width: 100%;
|
|
69
|
+
height: auto;
|
|
70
|
+
min-height: 22px;
|
|
71
|
+
margin: 0 0 0 -6px;
|
|
72
|
+
padding: 2px 6px;
|
|
73
|
+
border-radius: 6px;
|
|
74
|
+
}
|
|
75
|
+
#app-sidebar .agent-bar-app-identity .app-header-identity-title {
|
|
76
|
+
flex: 1 1 auto;
|
|
77
|
+
min-width: 0;
|
|
78
|
+
max-width: none;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
text-overflow: ellipsis;
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
text-align: left;
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
line-height: 18px;
|
|
85
|
+
}
|
|
86
|
+
#app-sidebar .agent-bar-app-identity .resource-usage {
|
|
87
|
+
grid-column: 2;
|
|
88
|
+
grid-row: 2;
|
|
89
|
+
align-self: start;
|
|
90
|
+
justify-self: start;
|
|
91
|
+
min-width: 0;
|
|
92
|
+
max-width: 100%;
|
|
93
|
+
}
|
|
94
|
+
#app-sidebar .agent-bar-app-identity .resource-usage-trigger {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-wrap: wrap;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: 1px 8px;
|
|
99
|
+
max-width: 100%;
|
|
100
|
+
height: auto;
|
|
101
|
+
margin: 0 0 0 -6px;
|
|
102
|
+
padding: 2px 6px;
|
|
103
|
+
border-radius: 6px;
|
|
104
|
+
text-align: left;
|
|
105
|
+
}
|
|
106
|
+
/* both popovers open under the whole block, left-aligned with it, and are
|
|
107
|
+
positioned by agent-bar.js so the sidebar cannot clip them */
|
|
108
|
+
#app-sidebar .agent-bar-app-identity .app-header-info-popover {
|
|
109
|
+
position: fixed;
|
|
110
|
+
right: auto;
|
|
111
|
+
margin: 0;
|
|
112
|
+
cursor: default;
|
|
113
|
+
}
|
|
114
|
+
/* One card: the whole block is one click target; app info and the resource
|
|
115
|
+
switches live in the same popover */
|
|
116
|
+
#app-sidebar .agent-bar-app-card {
|
|
117
|
+
pointer-events: auto;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
transition: border-color 120ms ease, background-color 120ms ease;
|
|
120
|
+
}
|
|
121
|
+
#app-sidebar .agent-bar-app-card:hover {
|
|
122
|
+
border-color: rgba(15, 23, 42, 0.22);
|
|
123
|
+
background: #ffffff;
|
|
124
|
+
}
|
|
125
|
+
body.dark #app-sidebar .agent-bar-app-card:hover {
|
|
126
|
+
border-color: rgba(255, 255, 255, 0.24);
|
|
127
|
+
background: rgba(255, 255, 255, 0.06);
|
|
128
|
+
}
|
|
129
|
+
#app-sidebar .agent-bar-app-card .agent-bar-app-icon,
|
|
130
|
+
#app-sidebar .agent-bar-app-card .app-header-info-trigger,
|
|
131
|
+
#app-sidebar .agent-bar-app-card .resource-usage-trigger {
|
|
132
|
+
background: transparent;
|
|
133
|
+
box-shadow: none;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
}
|
|
136
|
+
#app-sidebar .agent-bar-app-card .agent-bar-app-icon {
|
|
137
|
+
background: #ffffff;
|
|
138
|
+
}
|
|
139
|
+
body.dark #app-sidebar .agent-bar-app-card .agent-bar-app-icon {
|
|
140
|
+
background: rgba(255, 255, 255, 0.06);
|
|
141
|
+
}
|
|
142
|
+
#app-sidebar .agent-bar-app-card .resource-usage-trigger::after {
|
|
143
|
+
display: none;
|
|
144
|
+
}
|
|
145
|
+
.agent-bar-app-stats {
|
|
146
|
+
pointer-events: auto;
|
|
147
|
+
grid-column: 2;
|
|
148
|
+
grid-row: 2;
|
|
149
|
+
align-self: start;
|
|
150
|
+
min-width: 0;
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-wrap: wrap;
|
|
153
|
+
align-items: center;
|
|
154
|
+
gap: 1px 8px;
|
|
155
|
+
font: 700 11px/14px system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
156
|
+
color: rgba(15, 23, 42, 0.62);
|
|
157
|
+
}
|
|
158
|
+
body.dark .agent-bar-app-stats {
|
|
159
|
+
color: rgba(250, 250, 250, 0.66);
|
|
160
|
+
}
|
|
161
|
+
.agent-bar-app-stats i {
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
/* the real resource block, now a section of the one popover */
|
|
165
|
+
.agent-bar-merged-resource-root {
|
|
166
|
+
display: block;
|
|
167
|
+
position: static;
|
|
168
|
+
margin: 10px 0 0;
|
|
169
|
+
padding: 10px 0 0;
|
|
170
|
+
border-top: 1px solid rgba(15, 23, 42, 0.08);
|
|
171
|
+
}
|
|
172
|
+
body.dark .agent-bar-merged-resource-root {
|
|
173
|
+
border-top-color: rgba(255, 255, 255, 0.1);
|
|
174
|
+
}
|
|
175
|
+
#app-sidebar .agent-bar-app-card .agent-bar-merged-resource-root > .resource-usage-trigger {
|
|
176
|
+
display: none !important;
|
|
177
|
+
}
|
|
178
|
+
#app-sidebar .agent-bar-app-card:focus {
|
|
179
|
+
outline: none;
|
|
180
|
+
}
|
|
181
|
+
.agent-bar-merged-resources.resource-usage-popover,
|
|
182
|
+
.agent-bar-merged-resources.resource-usage-popover.hidden {
|
|
183
|
+
position: static;
|
|
184
|
+
display: block !important;
|
|
185
|
+
box-sizing: border-box;
|
|
186
|
+
width: auto;
|
|
187
|
+
min-width: 0;
|
|
188
|
+
max-width: none;
|
|
189
|
+
margin: 0;
|
|
190
|
+
padding: 0;
|
|
191
|
+
border: 0;
|
|
192
|
+
border-radius: 0;
|
|
193
|
+
background: transparent;
|
|
194
|
+
box-shadow: none;
|
|
195
|
+
}
|
|
196
|
+
/* the popover now sits over page content, so it needs a solid surface */
|
|
197
|
+
#app-sidebar .agent-bar-app-card .app-header-info-popover {
|
|
198
|
+
background: #ffffff;
|
|
199
|
+
-webkit-backdrop-filter: none;
|
|
200
|
+
backdrop-filter: none;
|
|
201
|
+
opacity: 1;
|
|
202
|
+
}
|
|
203
|
+
body.dark #app-sidebar .agent-bar-app-card .app-header-info-popover {
|
|
204
|
+
background: #131315;
|
|
205
|
+
}
|
|
206
|
+
.agent-bar__lead {
|
|
207
|
+
flex: none;
|
|
208
|
+
width: 16px;
|
|
209
|
+
height: 16px;
|
|
210
|
+
margin: 3px 2px 0 8px;
|
|
211
|
+
color: var(--agent-bar-muted);
|
|
212
|
+
-webkit-mask-size: 16px 16px;
|
|
213
|
+
mask-size: 16px 16px;
|
|
214
|
+
}
|
|
215
|
+
/* News: a strip attached to the bottom of the app card */
|
|
216
|
+
#app-sidebar .agent-bar-app-card {
|
|
217
|
+
grid-template-rows: auto auto auto;
|
|
218
|
+
}
|
|
219
|
+
.agent-bar-feed-row {
|
|
220
|
+
grid-column: 1 / -1;
|
|
221
|
+
grid-row: 3;
|
|
222
|
+
pointer-events: auto;
|
|
223
|
+
box-sizing: border-box;
|
|
224
|
+
display: flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
gap: 8px;
|
|
227
|
+
height: 30px;
|
|
228
|
+
margin: 8px -8px -8px;
|
|
229
|
+
padding: 0 10px 0 12px;
|
|
230
|
+
border: 0;
|
|
231
|
+
border-top: 1px solid rgba(15, 23, 42, 0.08);
|
|
232
|
+
border-radius: 0 0 9px 9px;
|
|
233
|
+
background: transparent;
|
|
234
|
+
color: #111827;
|
|
235
|
+
font: 600 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
236
|
+
letter-spacing: 0;
|
|
237
|
+
text-align: left;
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
transition: background-color 120ms ease;
|
|
240
|
+
}
|
|
241
|
+
.agent-bar-feed-row:hover {
|
|
242
|
+
background: rgba(15, 23, 42, 0.05);
|
|
243
|
+
}
|
|
244
|
+
.agent-bar-feed-row.selected {
|
|
245
|
+
background: rgba(15, 23, 42, 0.07);
|
|
246
|
+
}
|
|
247
|
+
.agent-bar-feed-row > i {
|
|
248
|
+
width: 14px;
|
|
249
|
+
font-size: 11px;
|
|
250
|
+
color: rgba(55, 65, 81, 0.86);
|
|
251
|
+
text-align: center;
|
|
252
|
+
}
|
|
253
|
+
.agent-bar-feed-row > .agent-bar-feed-chevron {
|
|
254
|
+
width: auto;
|
|
255
|
+
margin-left: auto;
|
|
256
|
+
font-size: 9px;
|
|
257
|
+
color: rgba(55, 65, 81, 0.5);
|
|
258
|
+
transition: transform 120ms ease, color 120ms ease;
|
|
259
|
+
}
|
|
260
|
+
.agent-bar-feed-row:hover > .agent-bar-feed-chevron,
|
|
261
|
+
.agent-bar-feed-row.selected > .agent-bar-feed-chevron {
|
|
262
|
+
color: rgba(17, 24, 39, 0.9);
|
|
263
|
+
transform: translateX(1px);
|
|
264
|
+
}
|
|
265
|
+
/* Panel open: the chevron points back the other way (clicking closes it). */
|
|
266
|
+
.agent-bar-feed-row.selected > .agent-bar-feed-chevron {
|
|
267
|
+
transform: rotate(180deg);
|
|
268
|
+
}
|
|
269
|
+
.agent-bar-feed-row.selected:hover > .agent-bar-feed-chevron {
|
|
270
|
+
transform: rotate(180deg) translateX(1px);
|
|
271
|
+
}
|
|
272
|
+
body.dark .agent-bar-feed-row {
|
|
273
|
+
border-top-color: rgba(255, 255, 255, 0.1);
|
|
274
|
+
color: rgba(250, 250, 250, 0.96);
|
|
275
|
+
}
|
|
276
|
+
body.dark .agent-bar-feed-row:hover,
|
|
277
|
+
body.dark .agent-bar-feed-row.selected {
|
|
278
|
+
background: rgba(255, 255, 255, 0.08);
|
|
279
|
+
}
|
|
280
|
+
body.dark .agent-bar-feed-row > i {
|
|
281
|
+
color: rgba(161, 161, 170, 0.92);
|
|
282
|
+
}
|
|
283
|
+
body.dark .agent-bar-feed-row > .agent-bar-feed-chevron {
|
|
284
|
+
color: rgba(161, 161, 170, 0.6);
|
|
285
|
+
}
|
|
286
|
+
body.dark .agent-bar-feed-row:hover > .agent-bar-feed-chevron,
|
|
287
|
+
body.dark .agent-bar-feed-row.selected > .agent-bar-feed-chevron {
|
|
288
|
+
color: rgba(250, 250, 250, 0.96);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* Before the page is rearranged (see PENDING_CLASS in agent-bar-app.js), the parts
|
|
292
|
+
of the top bar that are about to move or be replaced are not drawn. */
|
|
293
|
+
html.agent-bar-app-pending header.navheader h1 > .app-header-identity,
|
|
294
|
+
html.agent-bar-app-pending header.navheader #ask-ai-tab,
|
|
295
|
+
html.agent-bar-app-pending header.navheader #community-toggle {
|
|
296
|
+
visibility: hidden !important;
|
|
297
|
+
}
|
|
298
|
+
/* While the app-page bar is active, the two navbar buttons it replaces are hidden
|
|
299
|
+
(they stay in the page; the News row and the bar use them). */
|
|
300
|
+
html.agent-bar-app header.navheader #ask-ai-tab,
|
|
301
|
+
html.agent-bar-app header.navheader #community-toggle {
|
|
302
|
+
display: none !important;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/* ---- Phones (the app page's own phone layout, see followLayout in agent-bar-app.js) ----
|
|
306
|
+
The page's strip (logo, app name) is at the bottom there. With the bar it is
|
|
307
|
+
the top bar instead, as on the home page on phones: the logo, which opens the
|
|
308
|
+
menu, and the bar. The app's name and stats are the card at the top of that
|
|
309
|
+
menu. */
|
|
310
|
+
html.agent-bar-app-phone {
|
|
311
|
+
--agent-bar-app-strip: calc(46px + env(safe-area-inset-top));
|
|
312
|
+
/* nothing is at the bottom any more: what the page keeps clear of it reaches the edge */
|
|
313
|
+
--mobile-bottom-bar-height: 0px;
|
|
314
|
+
}
|
|
315
|
+
html.agent-bar-app-phone .mobile-bottom-nav {
|
|
316
|
+
order: -1;
|
|
317
|
+
top: 0;
|
|
318
|
+
bottom: auto;
|
|
319
|
+
margin-top: 0;
|
|
320
|
+
min-height: var(--agent-bar-app-strip);
|
|
321
|
+
padding: env(safe-area-inset-top) 8px 0;
|
|
322
|
+
border-top: 0;
|
|
323
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
|
324
|
+
}
|
|
325
|
+
html.agent-bar-app-phone body.dark .mobile-bottom-nav {
|
|
326
|
+
border-bottom-color: rgba(255, 255, 255, 0.08);
|
|
327
|
+
}
|
|
328
|
+
html.agent-bar-app-phone .mobile-bottom-nav__identity {
|
|
329
|
+
display: none;
|
|
330
|
+
}
|
|
331
|
+
html.agent-bar-app-phone .mobile-bottom-nav > .agent-bar {
|
|
332
|
+
flex: 1 1 auto;
|
|
333
|
+
min-width: 0;
|
|
334
|
+
display: flex;
|
|
335
|
+
margin: 0 2px 0 6px;
|
|
336
|
+
}
|
|
337
|
+
/* 16px text, so a phone does not zoom the page when the input is focused */
|
|
338
|
+
html.agent-bar-app-phone .agent-bar .agent-bar__input {
|
|
339
|
+
font-size: 16px;
|
|
340
|
+
}
|
|
341
|
+
/* the menu and what dims the page behind it start under the top bar */
|
|
342
|
+
html.agent-bar-app-phone body .appcanvas > aside,
|
|
343
|
+
html.agent-bar-app-phone body.mobile-menu-open .mobile-menu-backdrop,
|
|
344
|
+
html.agent-bar-app-phone body.mobile-menu-open .mobile-menu-fallback {
|
|
345
|
+
top: var(--agent-bar-app-strip);
|
|
346
|
+
}
|
|
347
|
+
html.agent-bar-app-phone body .appcanvas > aside {
|
|
348
|
+
padding-top: 12px;
|
|
349
|
+
}
|
|
350
|
+
/* the card's stats line keeps its own place (the menu gives every disk figure a side margin) */
|
|
351
|
+
html.agent-bar-app-phone .appcanvas > aside .agent-bar-app-stats .disk-usage {
|
|
352
|
+
margin: 0;
|
|
353
|
+
}
|
|
354
|
+
/* the menu's own Ask AI and Feed rows: the bar and the card's News row do their job
|
|
355
|
+
(they stay in the page; News presses the Feed row) */
|
|
356
|
+
html.agent-bar-app-phone .appcanvas > aside .mobile-nav-ask-ai,
|
|
357
|
+
html.agent-bar-app-phone .appcanvas > aside .mobile-nav-community {
|
|
358
|
+
display: none !important;
|
|
359
|
+
}
|