Compare commits

...
13 Commits
Author SHA1 Message Date
ZacharyZhang-NYandClaude Opus 5.5 48dfddffef Linux packages: set the project homepage the deb format requires
Build Release Installers / Release for the tag (push) Successful in 10s
Build Release Installers / Linux packages (AppImage + deb x64) (push) Successful in 2m0s
CI / Typecheck, lint, tests, e2e (push) Successful in 3m6s
Build Release Installers / Windows installer (NSIS x64) (push) Successful in 1m5s
Build Release Installers / macOS installers (dmg + zip, x64 + arm64) (push) Successful in 10m33s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:54:20 -04:00
ZacharyZhang-NYandClaude Opus 5.5 8299346fbd CI on Gitea: cap test workers so a shared runner does not time out; tag pushes build and attach Windows, Linux and macOS installers to the Gitea release; version 1.5.0
CI / Typecheck, lint, tests, e2e (push) Successful in 3m29s
Build Release Installers / Release for the tag (push) Successful in 11s
Build Release Installers / Linux packages (AppImage + deb x64) (push) Failing after 37s
Build Release Installers / Windows installer (NSIS x64) (push) Successful in 55s
Build Release Installers / macOS installers (dmg + zip, x64 + arm64) (push) Successful in 6m53s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:33:46 -04:00
ZacharyZhang-NY 15a93165e0 docs: add AGit pull request instructions
CI / Typecheck, lint, tests, e2e (push) Failing after 5m34s
2026-10-09 19:46:34 +00:00
ZacharyZhang-NYandClaude Opus 5.5 05ad409624 S3.10: office card shows the person's pixel portrait; provider policy explanations move into column tooltips
CI / Typecheck, lint, tests, e2e (push) Failing after 6m37s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 14:03:19 -04:00
ZacharyZhang-NYandClaude Opus 5.5 e5a4e87300 S3.9: the org chart draws everyone as their office pixel person, with one shared CEO rule
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:56:49 -04:00
ZacharyZhang-NYandClaude Opus 5.5 ccd698602e S3.8: office people show real agent state: running, queued, cooling down, blocked or idle, from sessions, task holds and pending approvals
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:51:04 -04:00
ZacharyZhang-NYandClaude Opus 5.5 202418f81c S3.7: isometric office assets: animated monitors, coffee machine with steam, toilets, sinks, real-time wall clock, decorative window weather; explanatory on-screen notes and the hint bubble removed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:34:12 -04:00
ZacharyZhang-NYandClaude Opus 5.5 23c7d55b1d S3.6: isometric 2.5D office engine: projection, depth-sorted blocks and people, half-resolution pixel rendering, day-part and season palette
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:03:04 -04:00
ZacharyZhang-NYandClaude Opus 5.5 5dfc2a6dc6 S3.5: every page on the pixel grid: tokenised type, square corners, pixel charts with HTML axis labels
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:45:15 -04:00
ZacharyZhang-NYandClaude Opus 5.5 c97adc14cb S3.4: pixel shell, navigation and global search
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:29:12 -04:00
ZacharyZhang-NYandClaude Opus 5.5 08ff96eec8 S3.3: pixel components: name-plate dialog titles, sunken fields, raised tabs, notched badges, XP bars, inventory slots, guide hint bubbles, game-over errors with Continue
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:23:17 -04:00
ZacharyZhang-NYandClaude Opus 5.5 a6036308b7 S3.2: hand-placed 12x12 pixel icon set replaces lucide and reicon
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:13:33 -04:00
ZacharyZhang-NYandClaude Opus 5.5 86dbb4efa1 S3.1: pixel design language: palette with day-part and season rotation, Fusion Pixel font on whole screen pixels, dither ground, 9-slice dialogs, pixel buttons, menu arrow
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:07:31 -04:00
123 changed files with 2513 additions and 1345 deletions

No files matched your search

+55 -45
View File
@@ -1,28 +1,38 @@
name: Build Release Installers name: Build Release Installers
# Builds Windows and macOS installers when a release is published and # A pushed v* tag builds Windows, Linux and macOS installers on the Gitea
# attaches them to it. macOS builds are signed and notarized only when the # runners and attaches them to the tag's release. The tag must equal
# runner has the Developer ID identity and the APPLE_API_ISSUER and # "v" + package.json version. macOS builds are signed and notarized when the
# APPLE_API_KEY_P8 secrets are set; otherwise they are ad-hoc signed. # Developer ID certificate and the APPLE_API_* secrets are present; otherwise
# they are ad-hoc signed.
on: on:
release: push:
types: [published] tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: "Release tag to attach installers to (back-fill)"
required: true
permissions: permissions:
contents: write contents: write
env: env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs: jobs:
release:
name: Release for the tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
package-manager-cache: false
- name: Check version and create the release
run: node scripts/gitea-release.mjs create
windows: windows:
name: Windows installer (NSIS x64) name: Windows installer (NSIS x64)
needs: release
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
@@ -31,27 +41,36 @@ jobs:
node-version: 24 node-version: 24
package-manager-cache: false package-manager-cache: false
- name: Enable pnpm via corepack - name: Enable pnpm via corepack
run: | run: corepack enable pnpm
corepack enable pnpm
pnpm --version
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
- name: Build installer - name: Build installer
run: pnpm run package:win run: pnpm run package:win
- name: List artifacts - name: Upload installer
run: Get-ChildItem release run: node scripts/gitea-release.mjs upload release
- name: Upload installer to release
env: linux:
GH_TOKEN: ${{ github.token }} name: Linux packages (AppImage + deb x64)
TAG: ${{ github.event.release.tag_name || inputs.tag }} needs: release
run: | runs-on: ubuntu-latest
$exts = @('.exe', '.dmg', '.zip', '.AppImage', '.deb') steps:
$files = Get-ChildItem release -File | Where-Object { $exts -contains $_.Extension } - uses: actions/checkout@v5
if (-not $files) { throw "no uploadable artifacts found in release/" } - uses: actions/setup-node@v5
gh release upload $env:TAG @($files.FullName) --clobber with:
node-version: 24
package-manager-cache: false
- name: Enable pnpm via corepack
run: corepack enable pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm run package:linux
- name: Upload packages
run: node scripts/gitea-release.mjs upload release
macos: macos:
name: macOS installers (dmg + zip, x64 + arm64) name: macOS installers (dmg + zip, x64 + arm64)
needs: release
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
@@ -60,20 +79,20 @@ jobs:
node-version: 24 node-version: 24
package-manager-cache: false package-manager-cache: false
- name: Enable pnpm via corepack - name: Enable pnpm via corepack
run: | run: corepack enable pnpm
corepack enable pnpm
pnpm --version
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
- name: Detect signing capability - name: Detect signing capability
id: signing id: signing
env: env:
CSC_LINK: ${{ secrets.CSC_LINK }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }} APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }}
run: | run: |
if security find-identity -v -p codesigning | grep -q "Developer ID Application: Yang Zhang (9PDD8M2SMS)" && [ -n "$APPLE_API_ISSUER" ] && [ -n "$APPLE_API_KEY_P8" ]; then if { [ -n "$CSC_LINK" ] || security find-identity -v -p codesigning | grep -q "Developer ID Application: Yang Zhang (9PDD8M2SMS)"; } && [ -n "$APPLE_API_ISSUER" ] && [ -n "$APPLE_API_KEY_ID" ] && [ -n "$APPLE_API_KEY_P8" ]; then
echo "signed=true" >> "$GITHUB_OUTPUT" echo "signed=true" >> "$GITHUB_OUTPUT"
echo "Developer ID identity and notarization credentials found: building signed + notarized installers." echo "Developer ID certificate and notarization credentials found: building signed + notarized installers."
else else
echo "signed=false" >> "$GITHUB_OUTPUT" echo "signed=false" >> "$GITHUB_OUTPUT"
echo "::warning::Building ad-hoc-signed, un-notarized macOS installers." echo "::warning::Building ad-hoc-signed, un-notarized macOS installers."
@@ -81,12 +100,15 @@ jobs:
- name: Build installers (signed + notarized) - name: Build installers (signed + notarized)
if: steps.signing.outputs.signed == 'true' if: steps.signing.outputs.signed == 'true'
env: env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_API_KEY: ${{ runner.temp }}/apple-api-key.p8 APPLE_API_KEY: ${{ runner.temp }}/apple-api-key.p8
APPLE_API_KEY_ID: ZDCSZ5IE7071 APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }} APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }}
run: | run: |
printf '%s' "$APPLE_API_KEY_P8" > "$APPLE_API_KEY" printf '%s' "$APPLE_API_KEY_P8" > "$APPLE_API_KEY"
trap 'rm -f "$APPLE_API_KEY"' EXIT
pnpm build pnpm build
pnpm exec electron-builder --mac --x64 --arm64 --publish never -c.forceCodeSigning=true pnpm exec electron-builder --mac --x64 --arm64 --publish never -c.forceCodeSigning=true
- name: Build installers (ad-hoc fallback) - name: Build installers (ad-hoc fallback)
@@ -94,17 +116,5 @@ jobs:
run: | run: |
pnpm build pnpm build
pnpm exec electron-builder --mac --x64 --arm64 --publish never --config electron-builder.unsigned.yml pnpm exec electron-builder --mac --x64 --arm64 --publish never --config electron-builder.unsigned.yml
- name: List artifacts - name: Upload installers
run: ls -la release run: node scripts/gitea-release.mjs upload release
- name: Upload installers to release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.event.release.tag_name || inputs.tag }}
run: |
shopt -s nullglob
files=(release/*.dmg release/*.zip)
if [ ${#files[@]} -eq 0 ]; then
echo "no uploadable artifacts found in release/" >&2
exit 1
fi
gh release upload "$TAG" "${files[@]}" --clobber
+15
View File
@@ -0,0 +1,15 @@
# Contributing
## Opening a pull request on git.zacharyzhang.com
Forking is disabled on this server. Open pull requests with AGit instead:
1. Register an account at https://git.zacharyzhang.com
2. Clone, commit your changes, then push to a `refs/for/<target-branch>` ref:
```bash
git clone https://git.zacharyzhang.com/ZacharyZhang-NY/AgentCompany.git
git push origin HEAD:refs/for/main -o topic=<short-name> -o title="<PR title>" -o description="<PR body>"
```
3. To update the pull request, push again with the same `topic`.
+2 -3
View File
@@ -1,9 +1,10 @@
{ {
"name": "agentcompany-new", "name": "agentcompany-new",
"version": "1.4.1", "version": "1.5.0",
"private": true, "private": true,
"type": "module", "type": "module",
"description": "Enterprise Electron control plane for AI agent companies.", "description": "Enterprise Electron control plane for AI agent companies.",
"homepage": "https://git.zacharyzhang.com/ZacharyZhang-NY/AgentCompany",
"author": { "author": {
"name": "AgentCompany", "name": "AgentCompany",
"email": "dev@agentcompany.ai" "email": "dev@agentcompany.ai"
@@ -31,11 +32,9 @@
"postinstall": "node scripts/ensure-electron.cjs" "postinstall": "node scripts/ensure-electron.cjs"
}, },
"dependencies": { "dependencies": {
"lucide-react": "0.468.0",
"react": "19.2.4", "react": "19.2.4",
"react-dom": "19.2.4", "react-dom": "19.2.4",
"react-markdown": "10.1.0", "react-markdown": "10.1.0",
"reicon-react": "^1.1.2",
"remark-gfm": "4.0.1", "remark-gfm": "4.0.1",
"zod": "4.3.6" "zod": "4.3.6"
}, },
-24
View File
@@ -14,9 +14,6 @@ importers:
.: .:
dependencies: dependencies:
lucide-react:
specifier: 0.468.0
version: 0.468.0(react@19.2.4)
react: react:
specifier: 19.2.4 specifier: 19.2.4
version: 19.2.4 version: 19.2.4
@@ -26,9 +23,6 @@ importers:
react-markdown: react-markdown:
specifier: 10.1.0 specifier: 10.1.0
version: 10.1.0(@types/react@19.2.2)(react@19.2.4) version: 10.1.0(@types/react@19.2.2)(react@19.2.4)
reicon-react:
specifier: ^1.1.2
version: 1.1.2(react@19.2.4)
remark-gfm: remark-gfm:
specifier: 4.0.1 specifier: 4.0.1
version: 4.0.1 version: 4.0.1
@@ -1950,11 +1944,6 @@ packages:
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
engines: {node: '>=10'} engines: {node: '>=10'}
lucide-react@0.468.0:
resolution: {integrity: sha512-6koYRhnM2N0GGZIdXzSeiNwguv1gt/FAjZOiPl76roBi3xKEXa4WmfpxgQwTTL4KipXjefrnf3oV4IsYhi4JFA==}
peerDependencies:
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc
magic-string@0.30.21: magic-string@0.30.21:
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
@@ -2426,11 +2415,6 @@ packages:
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
reicon-react@1.1.2:
resolution: {integrity: sha512-dbp1CPEPKFjWfG41lGRMWi74YKfKJlb2JcB/TRBAUQF6jalZYW1dRZisRPCpze5TfQwRBD30p40qnoY+oYi7MQ==}
peerDependencies:
react: '>=16.8.0'
remark-gfm@4.0.1: remark-gfm@4.0.1:
resolution: {integrity: sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==} resolution: {integrity: sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==}
@@ -4908,10 +4892,6 @@ snapshots:
dependencies: dependencies:
yallist: 4.0.0 yallist: 4.0.0
lucide-react@0.468.0(react@19.2.4):
dependencies:
react: 19.2.4
magic-string@0.30.21: magic-string@0.30.21:
dependencies: dependencies:
'@jridgewell/sourcemap-codec': 1.5.5 '@jridgewell/sourcemap-codec': 1.5.5
@@ -5623,10 +5603,6 @@ snapshots:
string_decoder: 1.1.1 string_decoder: 1.1.1
util-deprecate: 1.0.2 util-deprecate: 1.0.2
reicon-react@1.1.2(react@19.2.4):
dependencies:
react: 19.2.4
remark-gfm@4.0.1: remark-gfm@4.0.1:
dependencies: dependencies:
'@types/mdast': 4.0.4 '@types/mdast': 4.0.4
+53
View File
@@ -0,0 +1,53 @@
// Gitea release for the pushed tag: `create` checks the tag against package.json and opens the release; `upload` attaches installers.
import { openAsBlob } from "node:fs";
import { readdir, readFile } from "node:fs/promises";
import { basename, join } from "node:path";
const INSTALLER = /\.(exe|dmg|zip|AppImage|deb)$/;
function env(name) {
const value = process.env[name];
if (!value) throw new Error(`${name} is not set.`);
return value;
}
const api = `${env("GITHUB_SERVER_URL")}/api/v1/repos/${env("GITHUB_REPOSITORY")}`;
const tag = env("GITHUB_REF_NAME");
const headers = { Authorization: `token ${env("GITEA_TOKEN")}` };
async function call(method, path, body) {
const response = await fetch(`${api}${path}`, { method, headers: body instanceof FormData ? headers : { ...headers, "Content-Type": "application/json" }, body: body instanceof FormData ? body : body && JSON.stringify(body) });
if (!response.ok) throw new Error(`${method} ${path} failed: ${response.status} ${await response.text()}`);
return response.status === 204 ? null : response.json();
}
async function create() {
const { version } = JSON.parse(await readFile("package.json", "utf8"));
if (tag !== `v${version}`) throw new Error(`Tag ${tag} does not match package.json version ${version}; bump the version before tagging.`);
const existing = await fetch(`${api}/releases/tags/${tag}`, { headers });
if (existing.ok) return console.log(`Release ${tag} already exists.`);
if (existing.status !== 404) throw new Error(`Looking up release ${tag} failed: ${existing.status} ${await existing.text()}`);
await call("POST", "/releases", { tag_name: tag, name: `AgentCompany ${version}`, draft: false, prerelease: false });
console.log(`Created release ${tag}.`);
}
async function upload(dir) {
const files = (await readdir(dir)).filter((name) => INSTALLER.test(name)).map((name) => join(dir, name));
if (files.length === 0) throw new Error(`No installers found in ${dir}.`);
const release = await call("GET", `/releases/tags/${tag}`);
for (const file of files) {
const name = basename(file);
// A re-run replaces the asset instead of failing on the duplicate name.
const old = release.assets.find((asset) => asset.name === name);
if (old) await call("DELETE", `/releases/${release.id}/assets/${old.id}`);
const form = new FormData();
form.append("attachment", await openAsBlob(file), name);
await call("POST", `/releases/${release.id}/assets?name=${encodeURIComponent(name)}`, form);
console.log(`Uploaded ${name}.`);
}
}
const [command, dir] = process.argv.slice(2);
if (command === "create") await create();
else if (command === "upload") await upload(dir ?? "release");
else throw new Error(`Unknown command ${command}; use create or upload.`);
+1 -1
View File
@@ -21,7 +21,7 @@ export const organizationContracts = {
goalTitle: z.string(), goalDescription: z.string(), providerKey: z.string(), providerSecret: z.string(), providerModel: z.string(), goalTitle: z.string(), goalDescription: z.string(), providerKey: z.string(), providerSecret: z.string(), providerModel: z.string(),
}) satisfies z.ZodType<C.BootstrapOnboardingInput>, }) satisfies z.ZodType<C.BootstrapOnboardingInput>,
setActiveOrganization: z.strictObject({ orgId: id }) satisfies z.ZodType<C.SetActiveOrganizationInput>, setActiveOrganization: z.strictObject({ orgId: id }) satisfies z.ZodType<C.SetActiveOrganizationInput>,
setUiPreferences: z.strictObject({ theme: z.enum(["system", "light", "dark"]).optional(), language: z.enum(["en", "zh"]).optional() }) satisfies z.ZodType<C.SetUiPreferencesInput>, setUiPreferences: z.strictObject({ theme: z.enum(["system", "light", "dark", "clock"]).optional(), language: z.enum(["en", "zh"]).optional() }) satisfies z.ZodType<C.SetUiPreferencesInput>,
deleteOrganization: z.strictObject({ orgId: id }) satisfies z.ZodType<C.DeleteOrganizationInput>, deleteOrganization: z.strictObject({ orgId: id }) satisfies z.ZodType<C.DeleteOrganizationInput>,
createOrganization: z.strictObject({ createOrganization: z.strictObject({
organizationName: z.string(), description: z.string().optional(), mission: z.string(), goal: z.string(), employeeName: z.string(), organizationName: z.string(), description: z.string().optional(), mission: z.string(), goal: z.string(), employeeName: z.string(),
+1 -1
View File
@@ -10,7 +10,7 @@ export function setAutonomousPaused(db: DatabaseSync, paused: boolean): void {
} }
/** The app-wide theme and language, kept for every company. */ /** The app-wide theme and language, kept for every company. */
export function updateUiPreferences(db: DatabaseSync, input: { theme?: "system" | "light" | "dark"; language?: "en" | "zh" }): void { export function updateUiPreferences(db: DatabaseSync, input: { theme?: "system" | "light" | "dark" | "clock"; language?: "en" | "zh" }): void {
const current = db.prepare("select theme, language from app_state where id = 1") const current = db.prepare("select theme, language from app_state where id = 1")
.get() as { theme: string; language: string } | undefined; .get() as { theme: string; language: string } | undefined;
const theme = input.theme ?? current?.theme ?? "system"; const theme = input.theme ?? current?.theme ?? "system";
+1 -1
View File
@@ -67,7 +67,7 @@ export class OrganizationService {
setAutonomousPaused(this.db, paused); setAutonomousPaused(this.db, paused);
} }
updateUiPreferences(input: { theme?: "system" | "light" | "dark"; language?: "en" | "zh" }): void { updateUiPreferences(input: { theme?: "system" | "light" | "dark" | "clock"; language?: "en" | "zh" }): void {
updateUiPreferences(this.db, input); updateUiPreferences(this.db, input);
} }
+5 -13
View File
@@ -1,3 +1,5 @@
import { usePaletteClock } from "../shared/palette-clock";
import { usePixelScale } from "../shared/pixel-scale";
import { Modal } from "../shared/Modal"; import { Modal } from "../shared/Modal";
import { StaleBanner } from "./StaleBanner"; import { StaleBanner } from "./StaleBanner";
import { oneOf, readViewState, seedViewState, writeViewState } from "../shared/view-state"; import { oneOf, readViewState, seedViewState, writeViewState } from "../shared/view-state";
@@ -8,7 +10,7 @@ import { hasPageUnsaved } from "../shared/unsaved";
import { ErrorBoundary } from "../shared/ErrorBoundary"; import { ErrorBoundary } from "../shared/ErrorBoundary";
import { StartupScreen } from "./StartupScreen"; import { StartupScreen } from "./StartupScreen";
import type { Focus } from "../pages/types"; import type { Focus } from "../pages/types";
import { useEffect, useMemo, useState } from "react"; import { useMemo, useState } from "react";
import { Shell } from "../shared/Shell"; import { Shell } from "../shared/Shell";
import { ROUTE_IDS, type RouteId } from "../shared/routes"; import { ROUTE_IDS, type RouteId } from "../shared/routes";
import { AvatarDirectoryContext, type AvatarLook } from "../shared/ui"; import { AvatarDirectoryContext, type AvatarLook } from "../shared/ui";
@@ -67,18 +69,8 @@ export function App() {
}, [snapshot?.agents, snapshot?.employees, snapshot?.activeOrgId]); }, [snapshot?.agents, snapshot?.employees, snapshot?.activeOrgId]);
const [creatingOrg, setCreatingOrg] = useState(false); const [creatingOrg, setCreatingOrg] = useState(false);
const theme = snapshot?.uiPreferences.theme ?? "system"; usePaletteClock(snapshot?.uiPreferences.theme ?? "system");
useEffect(() => { usePixelScale();
const media = window.matchMedia("(prefers-color-scheme: dark)");
const apply = () => {
const resolved = theme === "system" ? (media.matches ? "dark" : "light") : theme;
document.documentElement.dataset.theme = resolved;
};
apply();
if (theme !== "system") return;
media.addEventListener("change", apply);
return () => media.removeEventListener("change", apply);
}, [theme]);
if (!snapshot) { if (!snapshot) {
// A failed manual retry is already recorded in syncFailure, which the screen shows. // A failed manual retry is already recorded in syncFailure, which the screen shows.
+1 -1
View File
@@ -8,7 +8,7 @@ const RISK_NAMES = { low: () => t("Low"), medium: () => t("Medium"), high: () =>
export function AutonomySummary({ mode }: { mode: "ai_ceo" | "ai_cofounder" }) { export function AutonomySummary({ mode }: { mode: "ai_ceo" | "ai_cofounder" }) {
const gated = { level: RISK_NAMES[COMPANY_PRESETS.taskRiskCeiling](), amount: dollars(COMPANY_PRESETS.hireReviewAboveCents) }; const gated = { level: RISK_NAMES[COMPANY_PRESETS.taskRiskCeiling](), amount: dollars(COMPANY_PRESETS.hireReviewAboveCents) };
return ( return (
<section aria-label={t("What this mode allows")} style={{ fontSize: 13, color: "var(--text-2)", lineHeight: 1.6 }}> <section aria-label={t("What this mode allows")} style={{ fontSize: "var(--fs-body)", color: "var(--text-2)", lineHeight: 1.6 }}>
<ul style={{ margin: 0, paddingLeft: 18 }}> <ul style={{ margin: 0, paddingLeft: 18 }}>
<li>{mode === "ai_ceo" <li>{mode === "ai_ceo"
? t("Approved without you: tasks above {level} risk, tasks that run commands in a workspace, and hires over {amount} a month.", gated) ? t("Approved without you: tasks above {level} risk, tasks that run commands in a workspace, and hires over {amount} a month.", gated)
+12 -12
View File
@@ -168,15 +168,15 @@ export function Onboarding({
<div> <div>
<div className="row" style={{ gap: 8 }}> <div className="row" style={{ gap: 8 }}>
<div className="brand-mark">A</div> <div className="brand-mark">A</div>
<div style={{ fontWeight: 540 }}>AgentCompany</div> <div>AgentCompany</div>
{cancel && step !== "connectors" && ( {cancel && step !== "connectors" && (
<button type="button" className="button ghost" style={{ marginLeft: "auto" }} onClick={cancel}> <button type="button" className="button ghost" style={{ marginLeft: "auto" }} onClick={cancel}>
{t("Cancel")} {t("Cancel")}
</button> </button>
)} )}
</div> </div>
<h1 className="page-h1" style={{ fontSize: 24, marginTop: 32, letterSpacing: "-0.02em" }}>{t("Start your AI company.")}</h1> <h1 className="page-h1" style={{ fontSize: "var(--fs-display)", marginTop: 32 }}>{t("Start your AI company.")}</h1>
<p className="page-sub" style={{ maxWidth: 460, fontSize: 14, lineHeight: 1.55 }}> <p className="page-sub" style={{ maxWidth: 460, fontSize: "var(--fs-body)", lineHeight: 1.55 }}>
{t("Stand up the workspace, bind the provider, and queue the first operating loop.")} {t("Stand up the workspace, bind the provider, and queue the first operating loop.")}
</p> </p>
<div className="onboarding-steps"> <div className="onboarding-steps">
@@ -188,11 +188,11 @@ export function Onboarding({
<div className="card" style={{ maxWidth: 460 }}> <div className="card" style={{ maxWidth: 460 }}>
<div className="card-label" style={{ marginBottom: 10 }}>{t("Runtime selected")}</div> <div className="card-label" style={{ marginBottom: 10 }}>{t("Runtime selected")}</div>
<div className="row" style={{ gap: 10 }}> <div className="row" style={{ gap: 10 }}>
<Icon name="bot" size={18} /> <Icon name="bot" />
<strong style={{ fontSize: 14 }}>{selectedProvider.label}</strong> <strong style={{ fontSize: "var(--fs-body)" }}>{selectedProvider.label}</strong>
{draft.providerModel && <Pill tone="violet">{draft.providerModel}</Pill>} {draft.providerModel && <Pill tone="violet">{draft.providerModel}</Pill>}
</div> </div>
<div style={{ marginTop: 10, fontSize: 12, color: "var(--text-3)" }}> <div style={{ marginTop: 10, fontSize: "var(--fs-body)", color: "var(--text-3)" }}>
{t("We never embed the key in the build. Credentials encrypt locally via OS-protected storage.")} {t("We never embed the key in the build. Credentials encrypt locally via OS-protected storage.")}
</div> </div>
</div> </div>
@@ -201,7 +201,7 @@ export function Onboarding({
<form className="onboarding-panel" onSubmit={submit} noValidate> <form className="onboarding-panel" onSubmit={submit} noValidate>
<div key={step} className="step-view"> <div key={step} className="step-view">
{restored && step !== "connectors" && ( {restored && step !== "connectors" && (
<p role="status" style={{ fontSize: 13, color: "var(--text-2)", margin: "0 0 12px" }}> <p role="status" style={{ fontSize: "var(--fs-body)", color: "var(--text-2)", margin: "0 0 12px" }}>
{t("Your progress was restored. Keys are never saved before launch, so enter yours again.")} {t("Your progress was restored. Keys are never saved before launch, so enter yours again.")}
</p> </p>
)} )}
@@ -249,7 +249,7 @@ export function Onboarding({
/> />
)} )}
</div> </div>
{error && <div style={{ color: "var(--red)", marginTop: 16, fontSize: 14 }}>{error}</div>} {error && <div style={{ color: "var(--red)", marginTop: 16, fontSize: "var(--fs-body)" }}>{error}</div>}
</form> </form>
</main> </main>
</div> </div>
@@ -284,10 +284,10 @@ function WelcomeStep({
/> />
</div> </div>
<RestartForLanguage language={language} /> <RestartForLanguage language={language} />
<p style={{ color: "var(--text-2)", fontSize: 14, lineHeight: 1.55 }}> <p style={{ color: "var(--text-2)", fontSize: "var(--fs-body)", lineHeight: 1.55 }}>
{t("AgentCompany sets up your operating loop in six steps. Bring an API key, pick a runtime for the founding CEO, and we'll wire up the first goal, project, and task.")} {t("AgentCompany sets up your operating loop in six steps. Bring an API key, pick a runtime for the founding CEO, and we'll wire up the first goal, project, and task.")}
</p> </p>
<ul style={{ paddingLeft: 20, color: "var(--text-2)", lineHeight: 1.8, margin: 0, fontSize: 14 }}> <ul style={{ paddingLeft: 20, color: "var(--text-2)", lineHeight: 1.8, margin: 0, fontSize: "var(--fs-body)" }}>
<li>{t("Connect one model provider (OpenAI, Anthropic, xAI, or Groq).")}</li> <li>{t("Connect one model provider (OpenAI, Anthropic, xAI, or Groq).")}</li>
<li>{t("Name the company and the human board chair.")}</li> <li>{t("Name the company and the human board chair.")}</li>
<li>{t("Pick execution mode and bind the workspace path.")}</li> <li>{t("Pick execution mode and bind the workspace path.")}</li>
@@ -321,7 +321,7 @@ function CompanyStep({ draft, onChange, onBack, onNext }: StepProps) {
<Field label={t("Workspace path (optional)")}> <Field label={t("Workspace path (optional)")}>
<div className="row" style={{ gap: 6 }}> <div className="row" style={{ gap: 6 }}>
<input className="input" value={draft.workspacePath} onChange={(event) => onChange({ workspacePath: event.target.value })} /> <input className="input" value={draft.workspacePath} onChange={(event) => onChange({ workspacePath: event.target.value })} />
<Button tone="ghost" onClick={chooseWorkspace}><Icon name="folder" size={16} /> {t("Choose")}</Button> <Button tone="ghost" onClick={chooseWorkspace}><Icon name="folder" /> {t("Choose")}</Button>
</div> </div>
</Field> </Field>
<Actions onBack={onBack} onNext={onNext} /> <Actions onBack={onBack} onNext={onNext} />
@@ -333,7 +333,7 @@ function ModeStep({ draft, onChange, onBack, onNext }: StepProps) {
return ( return (
<div className="form-grid"> <div className="form-grid">
<h2 className="page-h1">{t("Mode")}</h2> <h2 className="page-h1">{t("Mode")}</h2>
<p style={{ color: "var(--text-3)", fontSize: 14 }}>{t("How autonomous should the CEO be?")}</p> <p style={{ color: "var(--text-3)", fontSize: "var(--fs-body)" }}>{t("How autonomous should the CEO be?")}</p>
<ModeCard <ModeCard
title={t("AI CEO")} title={t("AI CEO")}
description={t("Runs on its own: approves its risky work and large hires, and writes deliverables without review.")} description={t("Runs on its own: approves its risky work and large hires, and writes deliverables without review.")}
@@ -25,7 +25,7 @@ export function ProviderStep({
return ( return (
<div className="form-grid"> <div className="form-grid">
<h2 className="page-h1">{t("Provider")}</h2> <h2 className="page-h1">{t("Provider")}</h2>
<p style={{ color: "var(--text-3)", fontSize: 14 }}> <p style={{ color: "var(--text-3)", fontSize: "var(--fs-body)" }}>
{t("Pick the runtime for the founding CEO. You can attach more providers in Settings later.")} {t("Pick the runtime for the founding CEO. You can attach more providers in Settings later.")}
</p> </p>
<div className="option-grid"> <div className="option-grid">
@@ -112,7 +112,7 @@ function ProviderCredentialFields({
return ( return (
<div className="provider-inline-form"> <div className="provider-inline-form">
{selected.credentialHelp && ( {selected.credentialHelp && (
<div style={{ fontSize: 13, color: "var(--text-3)", lineHeight: 1.5 }}>{selected.credentialHelp}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", lineHeight: 1.5 }}>{selected.credentialHelp}</div>
)} )}
{isOAuthLike ? ( {isOAuthLike ? (
<ProviderOAuthConnect <ProviderOAuthConnect
@@ -160,7 +160,7 @@ function ProviderCredentialFields({
{loading ? t("Getting models...") : fetched ? t("Reload models") : t("Get models")} {loading ? t("Getting models...") : fetched ? t("Reload models") : t("Get models")}
</Button> </Button>
)} )}
{loadError && <div style={{ color: "var(--red)", fontSize: 12 }}>{loadError}</div>} {loadError && <div style={{ color: "var(--red)", fontSize: "var(--fs-body)" }}>{loadError}</div>}
{(hasCredential || isCustom) && ( {(hasCredential || isCustom) && (
<Field label={t("Model")}> <Field label={t("Model")}>
{fetched || showCuratedList ? ( {fetched || showCuratedList ? (
+1 -1
View File
@@ -9,7 +9,7 @@ export function StaleBanner({ failure, syncedAt, onRetry }: { failure: SyncFailu
// Outside the app root, so it stays usable while a dialog makes the app inert. // Outside the app root, so it stays usable while a dialog makes the app inert.
return createPortal( return createPortal(
<div role="alert" className="card" style={{ position: "fixed", top: 8, left: "50%", transform: "translateX(-50%)", zIndex: 900, display: "flex", gap: 10, alignItems: "center", padding: "8px 12px", borderColor: "var(--amber, var(--red))", maxWidth: "min(720px, calc(100vw - 32px))" }}> <div role="alert" className="card" style={{ position: "fixed", top: 8, left: "50%", transform: "translateX(-50%)", zIndex: 900, display: "flex", gap: 10, alignItems: "center", padding: "8px 12px", borderColor: "var(--amber, var(--red))", maxWidth: "min(720px, calc(100vw - 32px))" }}>
<div style={{ fontSize: 13, minWidth: 0 }}> <div style={{ fontSize: "var(--fs-body)", minWidth: 0 }}>
<strong>{t("Not up to date.")}</strong>{" "} <strong>{t("Not up to date.")}</strong>{" "}
{syncedAt ? t("Showing data from {time}.", { time: formatTime(syncedAt) }) : null}{" "} {syncedAt ? t("Showing data from {time}.", { time: formatTime(syncedAt) }) : null}{" "}
<span style={{ color: "var(--text-2)", wordBreak: "break-word" }}>{t("Updating failed: {reason} (attempt {count}).", { reason: failure.message, count: failure.attempts })}</span> <span style={{ color: "var(--text-2)", wordBreak: "break-word" }}>{t("Updating failed: {reason} (attempt {count}).", { reason: failure.message, count: failure.attempts })}</span>
+7 -7
View File
@@ -1,4 +1,4 @@
import { Button } from "../shared/ui"; import { GameOver } from "../shared/GameOver";
import { t } from "../i18n/i18n"; import { t } from "../i18n/i18n";
import type { SyncFailure } from "./useSnapshot"; import type { SyncFailure } from "./useSnapshot";
@@ -7,12 +7,12 @@ export function StartupScreen({ failure, onRetry }: { failure: SyncFailure | nul
return ( return (
<div className="app-shell" style={{ display: "grid", placeItems: "center", padding: 24 }}> <div className="app-shell" style={{ display: "grid", placeItems: "center", padding: 24 }}>
{failure ? ( {failure ? (
<div role="alert" style={{ maxWidth: 480, display: "grid", gap: 12, textAlign: "center" }}> <GameOver
<strong>{t("AgentCompany could not load its data.")}</strong> title={t("AgentCompany could not load its data.")}
<div className="mono" style={{ fontSize: 12, color: "var(--text-2)", wordBreak: "break-word" }}>{failure.message}</div> error={failure.message}
<div style={{ fontSize: 13, color: "var(--text-3)" }}>{t("Retrying every few seconds (attempt {count}).", { count: failure.attempts })}</div> note={t("Retrying every few seconds (attempt {count}); Continue tries now.", { count: failure.attempts })}
<div><Button onClick={onRetry}>{t("Retry now")}</Button></div> onContinue={onRetry}
</div> />
) : ( ) : (
<div role="status" style={{ color: "var(--text-3)" }}>{t("Starting AgentCompany…")}</div> <div role="status" style={{ color: "var(--text-3)" }}>{t("Starting AgentCompany…")}</div>
)} )}
Binary file not shown.
@@ -0,0 +1,96 @@
Fusion Pixel Font
https://github.com/TakWolf/fusion-pixel-font
Copyright (c) 2022, TakWolf (https://takwolf.com).
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,96 @@
Ark Pixel Font
https://github.com/TakWolf/ark-pixel-font
Copyright (c) 2021, TakWolf (https://takwolf.com).
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,108 @@
[Cubic 11]
These fonts are free software.
Unlimited permission is granted to use, copy, and distribute them, with or without modification, either commercially or noncommercially.
THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY.
此字型是免費的。
無論您是否進行對本字型進行商業或非商業性修改,均可無限制地使用,複製和分發它們。
本字型的衍生品之授權必須與此字型相同,且不作任何擔保。
[JF Dot M+H 12]
Copyright(c) 2005 M+ FONTS PROJECT
[M+ BITMAP FONTS]
Copyright (C) 2002-2004 COZ
These fonts are free software.
Unlimited permission is granted to use, copy, and distribute it, with or without modification, either commercially and noncommercially.
THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY.
これらのフォントはフリー(自由な)ソフトウエアです。
あらゆる改変の有無に関わらず、また商業的な利用であっても、自由にご利用、複製、再配布することができますが、全て無保証とさせていただきます。
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
Copyright (c) 2019–2025 Lee Minseo (quiple@quiple.dev)
This font software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+2 -2
View File
@@ -20,8 +20,8 @@ const APPROVAL_KINDS: Record<string, string> = {
}; };
export const approvalKindLabel = (kind: string) => labelOf("approval kind", APPROVAL_KINDS, kind); export const approvalKindLabel = (kind: string) => labelOf("approval kind", APPROVAL_KINDS, kind);
const OFFICE_ACTIVITIES: Record<string, string> = { active: t("Active"), thinking: t("Thinking"), busy: t("Busy"), idle: t("Idle") }; const OFFICE_STATES: Record<string, string> = { running: t("Running"), queued: t("Queued"), cooldown: t("Cooling down"), blocked: t("Blocked"), idle: t("Idle") };
export const officeActivityLabel = (activity: string) => labelOf("office activity", OFFICE_ACTIVITIES, activity); export const officeStateLabel = (state: string) => labelOf("office state", OFFICE_STATES, state);
const APPROVAL_STATES: Record<string, string> = { pending: t("Pending"), approved: t("Approved"), declined: t("Declined"), superseded: t("Superseded") }; const APPROVAL_STATES: Record<string, string> = { pending: t("Pending"), approved: t("Approved"), declined: t("Declined"), superseded: t("Superseded") };
export const approvalStateLabel = (state: string) => labelOf("approval state", APPROVAL_STATES, state); export const approvalStateLabel = (state: string) => labelOf("approval state", APPROVAL_STATES, state);
+11 -11
View File
@@ -256,12 +256,13 @@ export const zh: Record<string, string> = {
"Base URL is required.": "请填写基础 URL。", "Base URL is required.": "请填写基础 URL。",
"Billing": "用量账单", "Billing": "用量账单",
"Blocked": "受阻", "Blocked": "受阻",
"Cooling down": "冷却中",
"Waiting for your approval.": "正在等待你的审批。",
"Board": "看板", "Board": "看板",
"Browse": "浏览", "Browse": "浏览",
"Budget": "预算", "Budget": "预算",
"Budget cap": "预算上限", "Budget cap": "预算上限",
"Budget utilization": "预算使用率", "Budget utilization": "预算使用率",
"Busy": "忙碌",
"By agent": "按智能体", "By agent": "按智能体",
"CEO": "CEO", "CEO": "CEO",
"CEO OFFICE": "CEO 办公室", "CEO OFFICE": "CEO 办公室",
@@ -343,7 +344,6 @@ export const zh: Record<string, string> = {
"That file could not be read as an image.": "无法将该文件读取为图片。", "That file could not be read as an image.": "无法将该文件读取为图片。",
"Conversation messages": "会话消息", "Conversation messages": "会话消息",
"Office tools": "办公室工具", "Office tools": "办公室工具",
"Agents with work stay at their desks. Only idle agents walk to coffee, snacks or the meeting table.": "有工作的智能体会一直待在工位;只有空闲的智能体才会去咖啡机、零食区或会议桌。",
"Avatar": "头像", "Avatar": "头像",
"Avatar emoji": "头像表情", "Avatar emoji": "头像表情",
"Avatar color": "头像颜色", "Avatar color": "头像颜色",
@@ -580,7 +580,6 @@ export const zh: Record<string, string> = {
"Team": "团队", "Team": "团队",
"Tests": "测试", "Tests": "测试",
"Theme": "主题", "Theme": "主题",
"Thinking": "思考中",
"Progress": "进度", "Progress": "进度",
"Title": "标题", "Title": "标题",
"Today": "今天", "Today": "今天",
@@ -601,6 +600,14 @@ export const zh: Record<string, string> = {
"Version (semver)": "版本(semver)", "Version (semver)": "版本(semver)",
"Visibility": "可见性", "Visibility": "可见性",
"Needs you": "需要你处理", "Needs you": "需要你处理",
"Goal progress": "目标进度",
"Budget allocated": "已分配预算",
"Budget compared with the largest agent budget": "与最高智能体预算相比",
"GAME OVER": "游戏结束",
"The rest of the app still works; Continue tries this page again.": "应用其他部分仍可使用;点“继续”会重新打开此页。",
"Continue reloads the window; your data is kept.": "点“继续”会重新加载窗口;数据会保留。",
"Retrying every few seconds (attempt {count}); Continue tries now.": "每隔几秒自动重试(第 {count} 次);点“继续”立即重试。",
"Follow the clock": "跟随时间(夜间变暗)",
"Next in line": "下一项工作", "Next in line": "下一项工作",
"Stopped: {reason}": "已停下:{reason}", "Stopped: {reason}": "已停下:{reason}",
"{n} more after these": "之后还有 {n} 项", "{n} more after these": "之后还有 {n} 项",
@@ -701,8 +708,6 @@ export const zh: Record<string, string> = {
"Waiting for the {name} sign-in in your browser (check {check} of {checks}).": "正在等待你在浏览器中完成 {name} 登录(第 {check}/{checks} 次检查)。", "Waiting for the {name} sign-in in your browser (check {check} of {checks}).": "正在等待你在浏览器中完成 {name} 登录(第 {check}/{checks} 次检查)。",
"Stop waiting": "停止等待", "Stop waiting": "停止等待",
"People to mention": "可提及的人", "People to mention": "可提及的人",
"Only a task runs: an agent picks it up and does the work. Goals and projects group tasks; documents and knowledge are what agents read and write along the way.": "只有任务会被执行:智能体接手任务并完成工作。目标和项目用来归组任务;文档和知识是智能体在工作中读写的内容。",
"Agents read and write these while working on tasks. Nothing here starts work; a task does.": "智能体在执行任务时读写这些内容。这里的内容不会自行启动工作,只有任务会。",
"{title}: use the arrow keys to read each value": "{title}:用方向键逐项读取数值", "{title}: use the arrow keys to read each value": "{title}:用方向键逐项读取数值",
"{rate}% of judged work accepted": "已评判的工作中 {rate}% 被接受", "{rate}% of judged work accepted": "已评判的工作中 {rate}% 被接受",
"No work judged yet": "还没有评判过的工作", "No work judged yet": "还没有评判过的工作",
@@ -719,7 +724,7 @@ export const zh: Record<string, string> = {
"Copy failed": "复制失败", "Copy failed": "复制失败",
"Checking account status with Composio…": "正在向 Composio 核对账号状态…", "Checking account status with Composio…": "正在向 Composio 核对账号状态…",
"Account status checked with Composio at {time}.": "已于 {time} 向 Composio 核对账号状态。", "Account status checked with Composio at {time}.": "已于 {time} 向 Composio 核对账号状态。",
"Account status could not be checked with Composio: {reason}. The statuses below may be out of date.": "无法向 Composio 核对账号状态:{reason}。下方状态可能已过时。", "Account status could not be checked with Composio, so the statuses below may be out of date. Reason: {reason}": "无法向 Composio 核对账号状态,下方状态可能已过时。原因:{reason}",
"{name} ({label}) is connected.": "{name}({label})已连接。", "{name} ({label}) is connected.": "{name}({label})已连接。",
"{name} ({label}) is still not connected. If you finished signing in, check again; otherwise connect again.": "{name}({label})仍未连接。如果已经完成登录,请再次检查;否则请重新连接。", "{name} ({label}) is still not connected. If you finished signing in, check again; otherwise connect again.": "{name}({label})仍未连接。如果已经完成登录,请再次检查;否则请重新连接。",
"Check again": "再次检查", "Check again": "再次检查",
@@ -741,12 +746,7 @@ export const zh: Record<string, string> = {
"Stay": "留下", "Stay": "留下",
"This page could not be shown.": "此页面无法显示。", "This page could not be shown.": "此页面无法显示。",
"AgentCompany hit an error it could not recover from here.": "AgentCompany 遇到了无法在此恢复的错误。", "AgentCompany hit an error it could not recover from here.": "AgentCompany 遇到了无法在此恢复的错误。",
"The rest of the app still works; go to another page or try this one again.": "应用的其他部分仍可使用;可以前往其他页面,或重试此页面。",
"Reloading the window starts it again; your data is kept.": "重新加载窗口即可重新开始;你的数据会保留。",
"Try again": "重试",
"Reload": "重新加载",
"AgentCompany could not load its data.": "AgentCompany 无法加载数据。", "AgentCompany could not load its data.": "AgentCompany 无法加载数据。",
"Retrying every few seconds (attempt {count}).": "每隔几秒重试一次(第 {count} 次)。",
"Retry now": "立即重试", "Retry now": "立即重试",
"Starting AgentCompany…": "正在启动 AgentCompany…", "Starting AgentCompany…": "正在启动 AgentCompany…",
"Direct: only its members take part, and every message wakes the other members. As the board, you can read it even when you are not a member.": "私聊:只有成员参与,每条消息都会唤醒其他成员。作为董事会,即使你不是成员也能阅读。", "Direct: only its members take part, and every message wakes the other members. As the board, you can read it even when you are not a member.": "私聊:只有成员参与,每条消息都会唤醒其他成员。作为董事会,即使你不是成员也能阅读。",
+1
View File
@@ -7,6 +7,7 @@ import "./styles/fonts.css";
import "./styles.css"; import "./styles.css";
import "./styles/components.css"; import "./styles/components.css";
import "./overlays.css"; import "./overlays.css";
import "./styles/pixel.css";
ReactDOM.createRoot(document.getElementById("root")!).render( ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode> <React.StrictMode>
+4 -9
View File
@@ -12,10 +12,6 @@
width: min(520px, 100%); width: min(520px, 100%);
max-height: min(760px, 100%); max-height: min(760px, 100%);
overflow: auto; overflow: auto;
border: 1px solid var(--border);
border-radius: var(--r-xl);
background: var(--panel);
box-shadow: 0 20px 60px rgba(24, 24, 24, 0.18);
padding: var(--sp-5); padding: var(--sp-5);
animation: overlay-enter var(--motion-base) var(--ease-out-expo); animation: overlay-enter var(--motion-base) var(--ease-out-expo);
} }
@@ -27,7 +23,8 @@
from { opacity: 0; transform: translateY(8px) scale(0.98); } from { opacity: 0; transform: translateY(8px) scale(0.98); }
to { opacity: 1; transform: none; } to { opacity: 1; transform: none; }
} }
.modal-title { margin: 0 0 var(--sp-4); font-size: var(--fs-title); font-weight: 600; letter-spacing: -0.01em; } /* Dialog name plate, as a speaker's name above an RPG text box. */
.modal-title { display: inline-block; margin: 0 0 var(--sp-4); padding: 2px 10px; font-size: var(--fs-title); background: var(--btn-primary-bg); color: var(--btn-primary-fg); box-shadow: 2px 2px 0 0 var(--border-strong); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-5); } .modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-5); }
.onboarding-window { .onboarding-window {
@@ -107,7 +104,7 @@
.option-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); } .option-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.option-card:active { transform: scale(0.99); } .option-card:active { transform: scale(0.99); }
.option-card.active { border-color: var(--text-1); box-shadow: inset 0 0 0 1px var(--text-1); } .option-card.active { border-color: var(--text-1); box-shadow: inset 0 0 0 1px var(--text-1); }
.option-card .opt-title { font-size: var(--fs-body); font-weight: 540; } .option-card .opt-title { font-size: var(--fs-body); }
.option-card .opt-sub { font-size: var(--fs-caption); color: var(--text-3); margin-top: var(--sp-1); } .option-card .opt-sub { font-size: var(--fs-caption); color: var(--text-3); margin-top: var(--sp-1); }
.provider-inline-form { .provider-inline-form {
display: grid; display: grid;
@@ -145,8 +142,6 @@
.menu-label { .menu-label {
padding: var(--sp-2) var(--sp-2) var(--sp-1); padding: var(--sp-2) var(--sp-2) var(--sp-1);
font-size: var(--fs-caption); font-size: var(--fs-caption);
font-weight: 540;
letter-spacing: 0.01em;
color: var(--text-3); color: var(--text-3);
} }
.menu-row { .menu-row {
@@ -164,7 +159,7 @@
transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out); transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
} }
.menu-row:hover { background: var(--hover); color: var(--text-1); } .menu-row:hover { background: var(--hover); color: var(--text-1); }
.menu-row.active { background: var(--panel-3); color: var(--text-1); font-weight: 540; } .menu-row.active { background: var(--panel-3); color: var(--text-1); }
.menu-row.danger { color: var(--red); } .menu-row.danger { color: var(--red); }
.menu-row.danger:hover { background: rgba(210, 59, 59, 0.1); color: var(--red); } .menu-row.danger:hover { background: rgba(210, 59, 59, 0.1); color: var(--red); }
.menu-row .menu-check { margin-left: auto; color: var(--accent); display: inline-flex; } .menu-row .menu-check { margin-left: auto; color: var(--accent); display: inline-flex; }
+14 -15
View File
@@ -158,7 +158,7 @@ export function ApprovalsPage({ snapshot, actions, navigate, focus }: PageProps)
{decided.length > 0 && ( {decided.length > 0 && (
<> <>
<div className="section-label" style={{ margin: "32px 0 10px" }}>{t("Recently decided")}</div> <div className="section-label" style={{ margin: "32px 0 10px" }}>{t("Recently decided")}</div>
{driftError && <div style={{ color: "var(--red)", fontSize: 13, marginBottom: 8 }}>{t("Could not check approved content: {message}", { message: driftError })}</div>} {driftError && <div style={{ color: "var(--red)", fontSize: "var(--fs-body)", marginBottom: 8 }}>{t("Could not check approved content: {message}", { message: driftError })}</div>}
<div className="card" style={{ padding: 0, overflow: "hidden" }}> <div className="card" style={{ padding: 0, overflow: "hidden" }}>
{shownDecided.map((approval, index) => ( {shownDecided.map((approval, index) => (
<DecidedRow <DecidedRow
@@ -176,7 +176,7 @@ export function ApprovalsPage({ snapshot, actions, navigate, focus }: PageProps)
</div> </div>
{decided.length > decidedLimit && ( {decided.length > decidedLimit && (
<div className="row" style={{ justifyContent: "center", marginTop: 12, gap: 10 }}> <div className="row" style={{ justifyContent: "center", marginTop: 12, gap: 10 }}>
<span style={{ fontSize: 12, color: "var(--text-3)" }}>{t("Showing {shown} of {total}", { shown: Math.min(decidedLimit, decided.length), total: decided.length })}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("Showing {shown} of {total}", { shown: Math.min(decidedLimit, decided.length), total: decided.length })}</span>
<Button size="small" onClick={() => setDecidedLimit((limit) => limit + DECIDED_PAGE)}>{t("Show earlier decisions")}</Button> <Button size="small" onClick={() => setDecidedLimit((limit) => limit + DECIDED_PAGE)}>{t("Show earlier decisions")}</Button>
</div> </div>
)} )}
@@ -232,7 +232,7 @@ function StatTile({ label, value, tone }: { label: string; value: string; tone?:
<div className="card-label" style={{ marginBottom: 6 }}>{label}</div> <div className="card-label" style={{ marginBottom: 6 }}>{label}</div>
<div <div
className="num" className="num"
style={{ fontSize: 18, fontWeight: 600, color: tone === "amber" ? "var(--amber)" : "var(--text-1)", letterSpacing: "-0.02em" }} style={{ fontSize: "var(--fs-display)", color: tone === "amber" ? "var(--amber)" : "var(--text-1)" }}
> >
{value} {value}
</div> </div>
@@ -266,7 +266,6 @@ function ApprovalRow({
<div <div
style={{ style={{
border: "1px solid var(--border)", border: "1px solid var(--border)",
borderRadius: 12,
background: "var(--panel)", background: "var(--panel)",
padding: 18, padding: 18,
marginBottom: 10, marginBottom: 10,
@@ -276,20 +275,20 @@ function ApprovalRow({
alignItems: "flex-start", alignItems: "flex-start",
}} }}
> >
<div style={{ width: 3, alignSelf: "stretch", background: tone.color, borderRadius: 2 }} /> <div style={{ width: 3, alignSelf: "stretch", background: tone.color }} />
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0 }}>
<div className="row" style={{ marginBottom: 4 }}> <div className="row" style={{ marginBottom: 4 }}>
<span style={{ fontSize: 12, color: tone.color, fontWeight: 540, letterSpacing: "0.02em" }}>{tone.label}</span> <span style={{ fontSize: "var(--fs-body)", color: tone.color }}>{tone.label}</span>
<span style={{ color: "var(--text-4)" }}>·</span> <span style={{ color: "var(--text-4)" }}>·</span>
<Pill>{approvalKindLabel(approval.kind)}</Pill> <Pill>{approvalKindLabel(approval.kind)}</Pill>
</div> </div>
<div style={{ fontSize: 15, fontWeight: 540, letterSpacing: "-0.01em", marginBottom: 4 }}>{approval.title}</div> <div style={{ fontSize: "var(--fs-body)", marginBottom: 4 }}>{approval.title}</div>
<div style={{ fontSize: 14, color: "var(--text-2)", lineHeight: 1.5, marginBottom: 12, whiteSpace: "pre-wrap" }}> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-2)", lineHeight: 1.5, marginBottom: 12, whiteSpace: "pre-wrap" }}>
{approval.details} {approval.details}
</div> </div>
<div className="row" style={{ gap: 8 }}> <div className="row" style={{ gap: 8 }}>
<Avatar name={requester} size="sm" bot={isBot} /> <Avatar name={requester} size="sm" bot={isBot} />
<span style={{ fontSize: 12, color: "var(--text-3)" }}>{t("Requested by {requester}", { requester })} · {formatRelative(approval.createdAt)}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("Requested by {requester}", { requester })} · {formatRelative(approval.createdAt)}</span>
</div> </div>
</div> </div>
<div style={{ display: "flex", flexDirection: "column", gap: 6, alignItems: "flex-end" }}> <div style={{ display: "flex", flexDirection: "column", gap: 6, alignItems: "flex-end" }}>
@@ -336,27 +335,27 @@ function DecidedRow({
style={{ style={{
gap: 12, gap: 12,
padding: "12px 18px", padding: "12px 18px",
fontSize: 14, fontSize: "var(--fs-body)",
borderBottom: last ? "none" : "1px solid var(--border-soft)", borderBottom: last ? "none" : "1px solid var(--border-soft)",
background: focused ? "var(--accent-soft)" : undefined, background: focused ? "var(--accent-soft)" : undefined,
}} }}
> >
<Icon name={approved ? "check" : "x"} size={14} color={approved ? "var(--green)" : superseded ? "var(--text-3)" : "var(--red)"} /> <Icon name={approved ? "check" : "x"} color={approved ? "var(--green)" : superseded ? "var(--text-3)" : "var(--red)"} />
<button <button
type="button" type="button"
className="link-button" className="link-button"
aria-label={t("View record of {title}", { title: approval.title })} aria-label={t("View record of {title}", { title: approval.title })}
onClick={onView} onClick={onView}
style={{ flex: 1, fontWeight: 480, color: "var(--text-1)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", textAlign: "left" }} style={{ flex: 1, color: "var(--text-1)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", textAlign: "left" }}
> >
{approval.title} {approval.title}
</button> </button>
{approval.sourceEntityType === "task" && approval.sourceEntityId && ( {approval.sourceEntityType === "task" && approval.sourceEntityId && (
<button type="button" className="link-button" style={{ fontSize: 12 }} onClick={() => onOpenTask(approval.sourceEntityId!)}>{t("Open task")}</button> <button type="button" className="link-button" style={{ fontSize: "var(--fs-body)" }} onClick={() => onOpenTask(approval.sourceEntityId!)}>{t("Open task")}</button>
)} )}
{drift && <Pill tone="amber">{drift === "changed" ? t("Changed since approval") : t("Removed since approval")}</Pill>} {drift && <Pill tone="amber">{drift === "changed" ? t("Changed since approval") : t("Removed since approval")}</Pill>}
<Avatar name={requester} size="sm" bot /> <Avatar name={requester} size="sm" bot />
<div style={{ fontSize: 12, color: "var(--text-3)", width: 180, textAlign: "right", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", width: 180, textAlign: "right", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>
{decidedLabel} · {formatRelative(approval.decidedAt ?? approval.createdAt)}{superseded ? "" : ` · ${decider.split(" ")[0]}`} {decidedLabel} · {formatRelative(approval.decidedAt ?? approval.createdAt)}{superseded ? "" : ` · ${decider.split(" ")[0]}`}
</div> </div>
</div> </div>
@@ -412,7 +411,7 @@ function BatchSummary({ total, result, onDismiss }: { total: number; result: Bat
return ( return (
<div role="status" className="card" style={{ padding: 14, marginBottom: 16 }}> <div role="status" className="card" style={{ padding: 14, marginBottom: 16 }}>
<div className="row" style={{ gap: 8 }}> <div className="row" style={{ gap: 8 }}>
<span style={{ fontWeight: 600 }}>{t("Approved {n} of {total}.", { n: result.approved.length, total })}</span> <span>{t("Approved {n} of {total}.", { n: result.approved.length, total })}</span>
<span style={{ marginLeft: "auto" }}><Button size="small" tone="ghost" onClick={onDismiss}>{t("Dismiss")}</Button></span> <span style={{ marginLeft: "auto" }}><Button size="small" tone="ghost" onClick={onDismiss}>{t("Dismiss")}</Button></span>
</div> </div>
{result.failed.map((failure) => ( {result.failed.map((failure) => (
+1 -1
View File
@@ -46,7 +46,7 @@ export function ConnectorsPage({ snapshot, actions }: PageProps) {
return ( return (
<div style={{ maxWidth: 1060 }}> <div style={{ maxWidth: 1060 }}>
<h2 style={{ margin: "0 0 18px", fontSize: 16, fontWeight: 600 }}>{t("Connectors")}</h2> <h2 style={{ margin: "0 0 18px", fontSize: "var(--fs-body)" }}>{t("Connectors")}</h2>
{connectError && <ErrorText message={connectError} />} {connectError && <ErrorText message={connectError} />}
+4 -4
View File
@@ -90,7 +90,7 @@ export function FilesPage({ snapshot, actions, focus }: PageProps) {
]} ]}
/> />
<Button tone="primary" onClick={upload}> <Button tone="primary" onClick={upload}>
<Icon name="upload" size={16} /> {t("Upload")} <Icon name="upload" /> {t("Upload")}
</Button> </Button>
</TopbarActions> </TopbarActions>
<h1 className="page-h1">{t("Files")}</h1> <h1 className="page-h1">{t("Files")}</h1>
@@ -119,7 +119,7 @@ export function FilesPage({ snapshot, actions, focus }: PageProps) {
<div className="row" style={{ marginBottom: 10 }}> <div className="row" style={{ marginBottom: 10 }}>
<div className="section-label">{labelFor(section)}</div> <div className="section-label">{labelFor(section)}</div>
<div style={{ marginLeft: "auto", fontSize: 12, color: "var(--text-3)" }}>{t("Modified")} ↓</div> <div style={{ marginLeft: "auto", fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("Modified")} ↓</div>
</div> </div>
{view === "list" ? ( {view === "list" ? (
@@ -163,7 +163,7 @@ function FilesFilter({
<Popover <Popover
trigger={({ toggle }) => ( trigger={({ toggle }) => (
<button type="button" className="button ghost" aria-label={t("Filter files")} onClick={toggle}> <button type="button" className="button ghost" aria-label={t("Filter files")} onClick={toggle}>
<Icon name="filter" size={16} color={scan !== "all" ? "var(--accent)" : "currentColor"} /> <Icon name="filter" color={scan !== "all" ? "var(--accent)" : "currentColor"} />
</button> </button>
)} )}
> >
@@ -173,7 +173,7 @@ function FilesFilter({
{options.map((option) => ( {options.map((option) => (
<MenuRow key={option.id} active={scan === option.id} onClick={() => onScan(option.id)}> <MenuRow key={option.id} active={scan === option.id} onClick={() => onScan(option.id)}>
{option.label} {option.label}
{scan === option.id && <span className="menu-check"><Icon name="check" size={16} /></span>} {scan === option.id && <span className="menu-check"><Icon name="check" /></span>}
</MenuRow> </MenuRow>
))} ))}
</> </>
+24 -27
View File
@@ -1,3 +1,4 @@
import { XpBar } from "../shared/XpBar";
import { runTriggerLabel } from "../i18n/labels"; import { runTriggerLabel } from "../i18n/labels";
import { goalProgress, type GoalPace } from "./home/goal-progress"; import { goalProgress, type GoalPace } from "./home/goal-progress";
import { nextUp } from "./home/next-up"; import { nextUp } from "./home/next-up";
@@ -57,7 +58,7 @@ export function HomePage({ snapshot, actions, navigate }: PageProps) {
return ( return (
<div className="page-wide" style={{ maxWidth: 1240 }}> <div className="page-wide" style={{ maxWidth: 1240 }}>
<TopbarActions> <TopbarActions>
<Button tone="primary" onClick={() => setNewTaskOpen(true)}><Icon name="plus" size={16} /> {t("New task")}</Button> <Button tone="primary" onClick={() => setNewTaskOpen(true)}><Icon name="plus" /> {t("New task")}</Button>
</TopbarActions> </TopbarActions>
<h1 className="page-h1">{greeting}, {firstName}</h1> <h1 className="page-h1">{greeting}, {firstName}</h1>
<p className="page-sub">{renderSummary(needsYou.length, agents.length)}</p> <p className="page-sub">{renderSummary(needsYou.length, agents.length)}</p>
@@ -114,17 +115,15 @@ function GoalCard({
return ( return (
<section className="card"> <section className="card">
<div className="card-label" style={{ marginBottom: 12 }}>{t("Quarter goal")}</div> <div className="card-label" style={{ marginBottom: 12 }}>{t("Quarter goal")}</div>
<div style={{ fontSize: 16, fontWeight: 540, lineHeight: 1.4, letterSpacing: "-0.01em", display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", minHeight: 44 }}> <div style={{ fontSize: "var(--fs-body)", lineHeight: 1.4, display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", minHeight: 44 }}>
{goal ? goal.title : t("Set the first goal for {organizationName}.", { organizationName })} {goal ? goal.title : t("Set the first goal for {organizationName}.", { organizationName })}
</div> </div>
<div className="row" style={{ alignItems: "baseline", gap: 8, marginTop: 16 }}> <div className="row" style={{ alignItems: "baseline", gap: 8, marginTop: 16 }}>
<span className="num" style={{ fontSize: 18, fontWeight: 600 }}>{progress ? `${percent}%` : "—"}</span> <span className="num" style={{ fontSize: "var(--fs-display)" }}>{progress ? `${percent}%` : "—"}</span>
<span style={{ fontSize: 12, color: "var(--text-3)" }}>{progress?.pace ? statusLabel(progress.pace) : t("no target date")}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{progress?.pace ? statusLabel(progress.pace) : t("no target date")}</span>
{goal && <TargetDate goal={goal} actions={actions} />} {goal && <TargetDate goal={goal} actions={actions} />}
</div> </div>
<div style={{ marginTop: 12, height: 4, background: "var(--panel-3)", borderRadius: 999, overflow: "hidden" }}> <div style={{ marginTop: 12 }}><XpBar percent={percent} label={t("Goal progress")} /></div>
<div style={{ width: `${percent}%`, height: "100%", background: "var(--text-1)", transition: "width var(--motion-slow) var(--ease-out)" }} />
</div>
{goal?.status === "active" && goal.stalledReason && ( {goal?.status === "active" && goal.stalledReason && (
<div className="row" style={{ marginTop: 12, gap: 8, alignItems: "center" }}> <div className="row" style={{ marginTop: 12, gap: 8, alignItems: "center" }}>
<span className="form-error" role="status" style={{ flex: 1, marginTop: 0 }}>{goal.stalledReason}</span> <span className="form-error" role="status" style={{ flex: 1, marginTop: 0 }}>{goal.stalledReason}</span>
@@ -153,23 +152,21 @@ function SpendCard({
<section className="card"> <section className="card">
<div className="card-label" style={{ marginBottom: 12 }}>{t("Monthly budget")}</div> <div className="card-label" style={{ marginBottom: 12 }}>{t("Monthly budget")}</div>
<div className="row" style={{ alignItems: "baseline", gap: 6 }}> <div className="row" style={{ alignItems: "baseline", gap: 6 }}>
<span className="num" style={{ fontSize: 18, fontWeight: 600 }}>{money(totalBudgetCents)}</span> <span className="num" style={{ fontSize: "var(--fs-display)" }}>{money(totalBudgetCents)}</span>
<span style={{ fontSize: 12, color: "var(--text-3)" }}>{capCents > 0 ? `/ ${money(capCents)}` : t("allocated")}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{capCents > 0 ? `/ ${money(capCents)}` : t("allocated")}</span>
</div>
<div style={{ marginTop: 12, height: 4, background: "var(--panel-3)", borderRadius: 999, overflow: "hidden" }}>
<div style={{ width: `${fillPct}%`, height: "100%", background: "var(--text-1)" }} />
</div> </div>
<div style={{ marginTop: 12 }}><XpBar percent={fillPct} label={t("Budget allocated")} /></div>
<div style={{ marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }}> <div style={{ marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }}>
{connected.slice(0, 3).map((provider) => { {connected.slice(0, 3).map((provider) => {
const allocatedCents = agents.filter((agent) => agent.modelProviderId === provider.id).reduce((sum, agent) => sum + agent.budgetCents, 0); const allocatedCents = agents.filter((agent) => agent.modelProviderId === provider.id).reduce((sum, agent) => sum + agent.budgetCents, 0);
return ( return (
<div key={provider.id} className="row" style={{ fontSize: 14 }}> <div key={provider.id} className="row" style={{ fontSize: "var(--fs-body)" }}>
<span style={{ color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</span> <span style={{ color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</span>
<span className="num mono" style={{ marginLeft: "auto", color: "var(--text-1)", fontWeight: 500 }}>{money(allocatedCents)}</span> <span className="num mono" style={{ marginLeft: "auto", color: "var(--text-1)" }}>{money(allocatedCents)}</span>
</div> </div>
); );
})} })}
{connected.length === 0 && <span style={{ fontSize: 14, color: "var(--text-3)" }}>{t("No providers connected")}</span>} {connected.length === 0 && <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("No providers connected")}</span>}
</div> </div>
</section> </section>
); );
@@ -191,7 +188,7 @@ function RunActivityCard({
<section className="card"> <section className="card">
<div className="row" style={{ marginBottom: 12 }}> <div className="row" style={{ marginBottom: 12 }}>
<span className="card-label">{t("Agent runs")}</span> <span className="card-label">{t("Agent runs")}</span>
<button type="button" className="link-button" style={{ marginLeft: "auto", fontSize: 12 }} onClick={onViewAll}>{t("All runs")} →</button> <button type="button" className="link-button" style={{ marginLeft: "auto", fontSize: "var(--fs-body)" }} onClick={onViewAll}>{t("All runs")} →</button>
</div> </div>
<div style={{ display: "flex", flexDirection: "column", gap: 12 }}> <div style={{ display: "flex", flexDirection: "column", gap: 12 }}>
{recent.map((run) => { {recent.map((run) => {
@@ -201,15 +198,15 @@ function RunActivityCard({
<div key={run.id} className="row" style={{ gap: 10 }}> <div key={run.id} className="row" style={{ gap: 10 }}>
{agent && <Avatar name={agent.name} size="sm" bot />} {agent && <Avatar name={agent.name} size="sm" bot />}
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 14, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{task?.title ?? run.taskId}</div> <div style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{task?.title ?? run.taskId}</div>
<div style={{ fontSize: 12, color: "var(--text-3)" }}>{agent?.name ?? t("Agent")} · {runTriggerLabel(run.trigger)}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{agent?.name ?? t("Agent")} · {runTriggerLabel(run.trigger)}</div>
</div> </div>
<Pill tone={runStateTone(run.state)}>{runStateLabel(run.state)}</Pill> <Pill tone={runStateTone(run.state)}>{runStateLabel(run.state)}</Pill>
<span className="mono" style={{ fontSize: 12, color: "var(--text-3)", flexShrink: 0 }}>{formatRelative(run.createdAt)}</span> <span className="mono" style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", flexShrink: 0 }}>{formatRelative(run.createdAt)}</span>
</div> </div>
); );
})} })}
{recent.length === 0 && <div style={{ fontSize: 14, color: "var(--text-3)" }}>{t("No runs yet")}</div>} {recent.length === 0 && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("No runs yet")}</div>}
</div> </div>
</section> </section>
); );
@@ -233,7 +230,7 @@ function RecentMessagesCard({
<section className="card"> <section className="card">
<div className="row" style={{ marginBottom: 12 }}> <div className="row" style={{ marginBottom: 12 }}>
<span className="card-label">{t("Recent messages")}</span> <span className="card-label">{t("Recent messages")}</span>
<button type="button" className="link-button" style={{ marginLeft: "auto", fontSize: 12 }} onClick={onViewAll}>{t("Open chat")} →</button> <button type="button" className="link-button" style={{ marginLeft: "auto", fontSize: "var(--fs-body)" }} onClick={onViewAll}>{t("Open chat")} →</button>
</div> </div>
<div style={{ display: "flex", flexDirection: "column", gap: 12 }}> <div style={{ display: "flex", flexDirection: "column", gap: 12 }}>
{recent.map((msg) => { {recent.map((msg) => {
@@ -247,16 +244,16 @@ function RecentMessagesCard({
<Avatar name={name} size="sm" bot={msg.senderType === "agent"} /> <Avatar name={name} size="sm" bot={msg.senderType === "agent"} />
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div className="row" style={{ gap: 6 }}> <div className="row" style={{ gap: 6 }}>
<span style={{ fontSize: 14, fontWeight: 540 }}>{name}</span> <span style={{ fontSize: "var(--fs-body)" }}>{name}</span>
{space && <span style={{ fontSize: 12, color: "var(--text-3)" }}>#{space.name}</span>} {space && <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>#{space.name}</span>}
<span className="mono" style={{ marginLeft: "auto", fontSize: 12, color: "var(--text-3)", flexShrink: 0 }}>{formatTime(msg.createdAt)}</span> <span className="mono" style={{ marginLeft: "auto", fontSize: "var(--fs-body)", color: "var(--text-3)", flexShrink: 0 }}>{formatTime(msg.createdAt)}</span>
</div> </div>
<div style={{ fontSize: 14, color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", lineHeight: 1.4 }}>{preview}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", lineHeight: 1.4 }}>{preview}</div>
</div> </div>
</div> </div>
); );
})} })}
{recent.length === 0 && <div style={{ fontSize: 14, color: "var(--text-3)" }}>{t("No messages yet")}</div>} {recent.length === 0 && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("No messages yet")}</div>}
</div> </div>
</section> </section>
); );
@@ -316,7 +313,7 @@ function TargetDate({ goal, actions }: { goal: GoalRecord; actions: PageProps["a
}; };
return ( return (
<span style={{ marginLeft: "auto", display: "inline-flex", alignItems: "center", gap: 6 }}> <span style={{ marginLeft: "auto", display: "inline-flex", alignItems: "center", gap: 6 }}>
<input className="input" type="date" aria-label={t("Target date")} value={value} onChange={(event) => change(event.target.value)} style={{ height: 26, padding: "0 6px", fontSize: 12 }} /> <input className="input" type="date" aria-label={t("Target date")} value={value} onChange={(event) => change(event.target.value)} style={{ height: 26, padding: "0 6px", fontSize: "var(--fs-body)" }} />
{error && <span className="form-error" role="alert">{error}</span>} {error && <span className="form-error" role="alert">{error}</span>}
</span> </span>
); );
+1 -2
View File
@@ -30,7 +30,7 @@ export function LibraryPage({ snapshot, actions, focus }: PageProps) {
return ( return (
<div className="split-main"> <div className="split-main">
<aside className="secondary-pane"> <aside className="secondary-pane">
<div style={{ fontSize: 14, fontWeight: 600, padding: "4px 8px 14px" }}>{t("Library")}</div> <div style={{ fontSize: "var(--fs-body)", padding: "4px 8px 14px" }}>{t("Library")}</div>
<div className="nav" style={{ gap: 1 }}> <div className="nav" style={{ gap: 1 }}>
{TABS.map((item) => ( {TABS.map((item) => (
<button <button
@@ -49,7 +49,6 @@ export function LibraryPage({ snapshot, actions, focus }: PageProps) {
<div className="content"> <div className="content">
<div className="page"> <div className="page">
<h1 className="page-h1">{tab === "documents" ? t("Documents") : t("Knowledge")}</h1> <h1 className="page-h1">{tab === "documents" ? t("Documents") : t("Knowledge")}</h1>
<p className="page-sub">{t("Agents read and write these while working on tasks. Nothing here starts work; a task does.")}</p>
{tab === "documents" {tab === "documents"
? <DocumentsPanel focusId={focus?.kind === "document" ? focus.id : null} orgId={orgId} employeeId={employee.id} documents={documents} tasks={tasks} actions={actions} /> ? <DocumentsPanel focusId={focus?.kind === "document" ? focus.id : null} orgId={orgId} employeeId={employee.id} documents={documents} tasks={tasks} actions={actions} />
: <KnowledgePanel focusId={focus?.kind === "knowledge" ? focus.id : null} orgId={orgId} employeeId={employee.id} entries={entries} scopes={scopes} actions={actions} />} : <KnowledgePanel focusId={focus?.kind === "knowledge" ? focus.id : null} orgId={orgId} employeeId={employee.id} entries={entries} scopes={scopes} actions={actions} />}
+53 -43
View File
@@ -5,9 +5,14 @@ import { activeOrgId, requireActiveEmployee } from "./types";
import { hashString, renderOffice, type RenderPerson } from "./office/office-renderer"; import { hashString, renderOffice, type RenderPerson } from "./office/office-renderer";
import { OfficeSimulation, cameraFor, type MoveInput } from "./office/simulation"; import { OfficeSimulation, cameraFor, type MoveInput } from "./office/simulation";
import { AgentDetailCard } from "./office/AgentDetailCard"; import { AgentDetailCard } from "./office/AgentDetailCard";
import { officeActivityLabel } from "../i18n/labels"; import { officeStateLabel } from "../i18n/labels";
import { cardPositionFor, CARD_FALLBACK_H } from "./office/agent-card-position"; import { cardPositionFor, CARD_FALLBACK_H } from "./office/agent-card-position";
import type { AgentActivity, Camera, OfficeAgentInput, Vec } from "./office/office-types"; import { isoFrame, isoPixelSize, pickAt, toIso, type IsoFrame } from "./office/iso";
import { dayPart, season } from "../shared/palette-clock";
import { pixelScale } from "../shared/pixel-scale";
import type { Camera, OfficeAgentInput } from "./office/office-types";
import { officeStatus } from "./office/agent-state";
import { ceoIdOf, officeRoster } from "./office/roster";
import { t } from "../i18n/i18n"; import { t } from "../i18n/i18n";
const FPS_INTERVAL = 1000 / 24; const FPS_INTERVAL = 1000 / 24;
@@ -29,6 +34,8 @@ export function OfficePage({ snapshot }: PageProps) {
const canvasRef = useRef<HTMLCanvasElement>(null); const canvasRef = useRef<HTMLCanvasElement>(null);
const keysRef = useRef<MoveInput>({ up: false, down: false, left: false, right: false }); const keysRef = useRef<MoveInput>({ up: false, down: false, left: false, right: false });
const cameraRef = useRef<Camera>({ x: 0, y: 0 }); const cameraRef = useRef<Camera>({ x: 0, y: 0 });
/** How the last frame mapped plan to screen, for turning clicks into picks. */
const viewRef = useRef<{ frame: IsoFrame; pixel: number } | null>(null);
const selectedIdRef = useRef<string | null>(null); const selectedIdRef = useRef<string | null>(null);
const cardBoxRef = useRef<HTMLDivElement>(null); const cardBoxRef = useRef<HTMLDivElement>(null);
const [selectedId, setSelectedId] = useState<string | null>(null); const [selectedId, setSelectedId] = useState<string | null>(null);
@@ -36,10 +43,9 @@ export function OfficePage({ snapshot }: PageProps) {
if (simRef.current === null) simRef.current = new OfficeSimulation(); if (simRef.current === null) simRef.current = new OfficeSimulation();
const inputs = useMemo<OfficeAgentInput[]>(() => { const inputs = useMemo<OfficeAgentInput[]>(() => {
const orgAgents = snapshot.agents const orgAgents = officeRoster(snapshot.agents.filter((agent) => agent.orgId === orgId));
.filter((agent) => agent.orgId === orgId && agent.lifecycle === "active") const allTasks = snapshot.tasks.filter((task) => task.orgId === orgId);
.sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id)); const orgTasks = allTasks.filter(isBusinessTask);
const orgTasks = snapshot.tasks.filter((task) => task.orgId === orgId && isBusinessTask(task));
return orgAgents.map((agent) => ({ return orgAgents.map((agent) => ({
id: agent.id, id: agent.id,
name: agent.name, name: agent.name,
@@ -47,10 +53,10 @@ export function OfficePage({ snapshot }: PageProps) {
title: agent.title, title: agent.title,
department: agent.department, department: agent.department,
roleLevel: agent.roleLevel, roleLevel: agent.roleLevel,
activity: resolveActivity(snapshot.chatPresence, snapshot.taskRuns, agent.id), status: officeStatus(agent.id, { runs: snapshot.taskRuns, tasks: allTasks, approvals: snapshot.approvals }),
taskTitle: orgTasks.find((task) => task.assigneeAgentId === agent.id && task.status === "in_progress")?.title ?? null, taskTitle: orgTasks.find((task) => task.assigneeAgentId === agent.id && task.status === "in_progress")?.title ?? null,
})); }));
}, [snapshot.agents, snapshot.tasks, snapshot.chatPresence, snapshot.taskRuns, orgId]); }, [snapshot.agents, snapshot.tasks, snapshot.approvals, snapshot.taskRuns, orgId]);
useEffect(() => { useEffect(() => {
simRef.current!.sync(inputs); simRef.current!.sync(inputs);
@@ -112,6 +118,7 @@ export function OfficePage({ snapshot }: PageProps) {
let running = true; let running = true;
let raf = 0; let raf = 0;
let lastFrame = 0; let lastFrame = 0;
const scene = document.createElement("canvas");
const tick = (now: number) => { const tick = (now: number) => {
if (!running) return; if (!running) return;
@@ -134,13 +141,16 @@ export function OfficePage({ snapshot }: PageProps) {
const sim = simRef.current!; const sim = simRef.current!;
sim.step(elapsed, keysRef.current); sim.step(elapsed, keysRef.current);
const focus = sim.player ? { x: sim.player.x, y: sim.player.y } : { x: sim.plan.world.w / 2, y: viewH / 2 }; const frame = isoFrame(sim.plan.world);
const camera = cameraFor(sim.plan.world, viewW, viewH, focus); const pixel = isoPixelSize(dpr);
const focus = sim.player ? { x: sim.player.x, y: sim.player.y } : { x: sim.plan.world.w / 2, y: sim.plan.world.h / 2 };
const camera = cameraFor(frame.size, viewW / pixel, viewH / pixel, toIso(frame, focus));
cameraRef.current = camera; cameraRef.current = camera;
viewRef.current = { frame, pixel };
const people: RenderPerson[] = sim.agents.map((agent) => ({ const people: RenderPerson[] = sim.agents.map((agent) => ({
id: agent.input.id, id: agent.input.id,
name: agent.input.name, name: agent.input.name,
activity: agent.input.activity, state: agent.input.status.state,
x: agent.x, x: agent.x,
y: agent.y, y: agent.y,
desk: agent.isCeo ? sim.plan.ceoDesk : sim.plan.desks[agent.deskIndex!].bounds, desk: agent.isCeo ? sim.plan.ceoDesk : sim.plan.desks[agent.deskIndex!].bounds,
@@ -156,7 +166,7 @@ export function OfficePage({ snapshot }: PageProps) {
people.push({ people.push({
id: `board:${sim.player.employeeId}`, id: `board:${sim.player.employeeId}`,
name: sim.player.name, name: sim.player.name,
activity: "idle", state: "idle",
x: sim.player.x, x: sim.player.x,
y: sim.player.y, y: sim.player.y,
desk: null, desk: null,
@@ -169,7 +179,22 @@ export function OfficePage({ snapshot }: PageProps) {
carrying: null, carrying: null,
}); });
} }
renderOffice(ctx, viewW, viewH, sim.plan, camera, people, now, new Date(), selectedIdRef.current); const clock = new Date();
renderOffice(ctx, scene, {
frame,
plan: sim.plan,
camera,
pixel,
fontScale: pixelScale(dpr),
viewW,
viewH,
people,
timeMs: now,
clock,
dayPart: dayPart(clock),
season: season(clock),
selectedId: selectedIdRef.current,
});
// The detail card rides beside its agent, even while they walk. // The detail card rides beside its agent, even while they walk.
const cardBox = cardBoxRef.current; const cardBox = cardBoxRef.current;
@@ -178,7 +203,8 @@ export function OfficePage({ snapshot }: PageProps) {
: null; : null;
if (cardBox && selected) { if (cardBox && selected) {
const cardH = cardBox.offsetHeight || CARD_FALLBACK_H; const cardH = cardBox.offsetHeight || CARD_FALLBACK_H;
const position = cardPositionFor({ x: selected.x, y: selected.y }, camera, viewW, viewH, cardH); const feet = toIso(frame, selected);
const position = cardPositionFor({ x: (feet.x - camera.x) * pixel, y: (feet.y - camera.y) * pixel }, { x: 0, y: 0 }, viewW, viewH, cardH);
cardBox.style.transform = `translate(${position.left}px, ${position.top}px)`; cardBox.style.transform = `translate(${position.left}px, ${position.top}px)`;
cardBox.style.visibility = "visible"; cardBox.style.visibility = "visible";
} }
@@ -191,28 +217,26 @@ export function OfficePage({ snapshot }: PageProps) {
}; };
}, []); }, []);
const worldPointFrom = (event: MouseEvent<HTMLCanvasElement>): Vec | null => { /** The agent drawn under the pointer, picked in the same iso pixels the frame was drawn in. */
const agentAt = (event: MouseEvent<HTMLCanvasElement>) => {
const canvas = canvasRef.current; const canvas = canvasRef.current;
if (!canvas) return null; const view = viewRef.current;
if (!canvas || !view) return null;
const bounds = canvas.getBoundingClientRect(); const bounds = canvas.getBoundingClientRect();
return { const point = {
x: event.clientX - bounds.left + cameraRef.current.x, x: (event.clientX - bounds.left) / view.pixel + Math.round(cameraRef.current.x),
y: event.clientY - bounds.top + cameraRef.current.y, y: (event.clientY - bounds.top) / view.pixel + Math.round(cameraRef.current.y),
}; };
return pickAt(view.frame, simRef.current!.agents, point);
}; };
const onCanvasClick = (event: MouseEvent<HTMLCanvasElement>) => { const onCanvasClick = (event: MouseEvent<HTMLCanvasElement>) => {
const point = worldPointFrom(event); const hit = agentAt(event);
if (!point) return;
const hit = simRef.current!.hitTest(point);
setSelectedId(hit ? hit.input.id : null); setSelectedId(hit ? hit.input.id : null);
}; };
const onCanvasMouseMove = (event: MouseEvent<HTMLCanvasElement>) => { const onCanvasMouseMove = (event: MouseEvent<HTMLCanvasElement>) => {
const canvas = canvasRef.current; event.currentTarget.style.cursor = agentAt(event) ? "pointer" : "default";
const point = worldPointFrom(event);
if (!canvas || !point) return;
canvas.style.cursor = simRef.current!.hitTest(point) ? "pointer" : "default";
}; };
return ( return (
@@ -227,7 +251,7 @@ export function OfficePage({ snapshot }: PageProps) {
/> />
{selectedAgent && ( {selectedAgent && (
<div ref={cardBoxRef} style={{ position: "absolute", left: 0, top: 0, willChange: "transform", visibility: "hidden" }}> <div ref={cardBoxRef} style={{ position: "absolute", left: 0, top: 0, willChange: "transform", visibility: "hidden" }}>
<AgentDetailCard agent={selectedAgent} onClose={() => setSelectedId(null)} /> <AgentDetailCard agent={selectedAgent} isCeo={selectedAgent.id === ceoIdOf(inputs)} onClose={() => setSelectedId(null)} />
</div> </div>
)} )}
<div className="office-toolbar" role="toolbar" aria-label={t("Office tools")}> <div className="office-toolbar" role="toolbar" aria-label={t("Office tools")}>
@@ -236,26 +260,12 @@ export function OfficePage({ snapshot }: PageProps) {
aria-label={t("Show a person")} aria-label={t("Show a person")}
value={selectedId ?? ""} value={selectedId ?? ""}
onChange={(event) => setSelectedId(event.target.value || null)} onChange={(event) => setSelectedId(event.target.value || null)}
style={{ width: 200, height: 30 }} style={{ width: 200 }}
> >
<option value="">{t("Show a person…")}</option> <option value="">{t("Show a person…")}</option>
{inputs.map((input) => <option key={input.id} value={input.id}>{t("{name}, {activity}", { name: input.name, activity: officeActivityLabel(input.activity) })}</option>)} {inputs.map((input) => <option key={input.id} value={input.id}>{t("{name}, {activity}", { name: input.name, activity: officeStateLabel(input.status.state) })}</option>)}
</select> </select>
<span className="office-legend">{t("Agents with work stay at their desks. Only idle agents walk to coffee, snacks or the meeting table.")}</span>
</div> </div>
</div> </div>
); );
} }
function resolveActivity(
presence: Array<{ principalType: string; principalId: string; status: string }>,
runs: Array<{ agentId: string | null; state: string }>,
agentId: string,
): AgentActivity {
if (runs.some((run) => run.agentId === agentId && run.state === "running")) return "active";
const record = presence.find((row) => row.principalType === "agent" && row.principalId === agentId);
if (record?.status === "thinking") return "thinking";
if (record?.status === "waiting_approval" || record?.status === "busy") return "busy";
if (record?.status === "active" || record?.status === "online") return "active";
return "idle";
}
+19 -20
View File
@@ -90,8 +90,8 @@ export function RunsPage({ snapshot, actions, navigate, focus }: PageProps) {
<div className="split-main"> <div className="split-main">
<aside className="secondary-pane" style={{ width: 340 }}> <aside className="secondary-pane" style={{ width: 340 }}>
<div style={{ padding: "12px 12px 8px" }}> <div style={{ padding: "12px 12px 8px" }}>
<div style={{ fontSize: 14, fontWeight: 600, marginBottom: 8 }}>{t("Runs")}</div> <div style={{ fontSize: "var(--fs-body)", marginBottom: 8 }}>{t("Runs")}</div>
<div className="row" style={{ gap: 8, marginBottom: 8, fontSize: 12, color: "var(--text-3)" }}> <div className="row" style={{ gap: 8, marginBottom: 8, fontSize: "var(--fs-body)", color: "var(--text-3)" }}>
<span>{t("{n} queued", { n: queued })}</span><span>·</span><span>{t("{n} running", { n: running })}</span><span>·</span><span>{t("{n} failed", { n: failed })}</span> <span>{t("{n} queued", { n: queued })}</span><span>·</span><span>{t("{n} running", { n: running })}</span><span>·</span><span>{t("{n} failed", { n: failed })}</span>
</div> </div>
<input <input
@@ -118,10 +118,10 @@ export function RunsPage({ snapshot, actions, navigate, focus }: PageProps) {
onClick={() => setSelectedId(run.id)} onClick={() => setSelectedId(run.id)}
> >
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 14, fontWeight: 500, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <div style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{task?.title ?? run.taskId} {task?.title ?? run.taskId}
</div> </div>
<div style={{ fontSize: 12, color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{agent?.name ?? t("Agent")} · {runTriggerLabel(run.trigger)} {agent?.name ?? t("Agent")} · {runTriggerLabel(run.trigger)}
</div> </div>
</div> </div>
@@ -129,11 +129,11 @@ export function RunsPage({ snapshot, actions, navigate, focus }: PageProps) {
</button> </button>
); );
})} })}
{filtered.length === 0 && <div style={{ padding: 16, fontSize: 14, color: "var(--text-3)" }}>{t("No runs")}</div>} {filtered.length === 0 && <div style={{ padding: 16, fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("No runs")}</div>}
{historyError && <div className="form-error" role="alert" style={{ padding: "0 16px" }}>{historyError}</div>} {historyError && <div className="form-error" role="alert" style={{ padding: "0 16px" }}>{historyError}</div>}
<div style={{ padding: 12, display: "flex", justifyContent: "center" }}> <div style={{ padding: 12, display: "flex", justifyContent: "center" }}>
{olderDone {olderDone
? <span style={{ fontSize: 12, color: "var(--text-3)" }}>{t("These are all the runs.")}</span> ? <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("These are all the runs.")}</span>
: <Button size="small" onClick={loadOlder}>{t("Show older runs")}</Button>} : <Button size="small" onClick={loadOlder}>{t("Show older runs")}</Button>}
</div> </div>
</div> </div>
@@ -142,7 +142,7 @@ export function RunsPage({ snapshot, actions, navigate, focus }: PageProps) {
{selected ? ( {selected ? (
<RunDetail key={selected.id} run={selected} tasks={tasks} agents={agents} providers={providers} actions={actions} onOpenTask={(taskId) => navigate("work", { kind: "task", id: taskId })} /> <RunDetail key={selected.id} run={selected} tasks={tasks} agents={agents} providers={providers} actions={actions} onOpenTask={(taskId) => navigate("work", { kind: "task", id: taskId })} />
) : ( ) : (
<div style={{ display: "grid", placeItems: "center", height: "100%", color: "var(--text-3)", fontSize: 14 }}> <div style={{ display: "grid", placeItems: "center", height: "100%", color: "var(--text-3)", fontSize: "var(--fs-body)" }}>
{t("Select a run")} {t("Select a run")}
</div> </div>
)} )}
@@ -190,10 +190,10 @@ function RunDetail({ run, tasks, agents, providers, actions, onOpenTask }: {
<div className="row" style={{ gap: 10, marginBottom: 16 }}> <div className="row" style={{ gap: 10, marginBottom: 16 }}>
{agent && <Avatar name={agent.name} size="sm" bot />} {agent && <Avatar name={agent.name} size="sm" bot />}
<div> <div>
<button type="button" className="link-button" style={{ fontSize: 16, fontWeight: 600 }} aria-label={t("Open task {title}", { title: task?.title ?? run.taskId })} onClick={() => onOpenTask(run.taskId)}> <button type="button" className="link-button" style={{ fontSize: "var(--fs-body)" }} aria-label={t("Open task {title}", { title: task?.title ?? run.taskId })} onClick={() => onOpenTask(run.taskId)}>
{task?.title ?? run.taskId} {task?.title ?? run.taskId}
</button> </button>
<div style={{ fontSize: 12, color: "var(--text-3)" }}>{run.id}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{run.id}</div>
</div> </div>
<Pill tone={runTone(run.state)}>{runLabel(run.state)}</Pill> <Pill tone={runTone(run.state)}>{runLabel(run.state)}</Pill>
{run.state === "running" && <Button size="small" onClick={stop} disabled={busy}>{t("Stop")}</Button>} {run.state === "running" && <Button size="small" onClick={stop} disabled={busy}>{t("Stop")}</Button>}
@@ -201,13 +201,13 @@ function RunDetail({ run, tasks, agents, providers, actions, onOpenTask }: {
{run.state === "failed" && <Button size="small" onClick={again} disabled={busy}>{busy ? t("Running…") : t("Retry")}</Button>} {run.state === "failed" && <Button size="small" onClick={again} disabled={busy}>{busy ? t("Running…") : t("Retry")}</Button>}
{(run.state === "stopped" || run.state === "superseded") && <Button size="small" onClick={again} disabled={busy}>{busy ? t("Running…") : t("Resume")}</Button>} {(run.state === "stopped" || run.state === "superseded") && <Button size="small" onClick={again} disabled={busy}>{busy ? t("Running…") : t("Resume")}</Button>}
</div> </div>
{run.state === "queued" && <div style={{ fontSize: 12, color: "var(--text-3)", marginBottom: 8 }}>{t("A cancelled session can start again on the next heartbeat; block the task to keep it stopped.")}</div>} {run.state === "queued" && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", marginBottom: 8 }}>{t("A cancelled session can start again on the next heartbeat; block the task to keep it stopped.")}</div>}
{(run.state === "failed" || run.state === "stopped" || run.state === "superseded") && ( {(run.state === "failed" || run.state === "stopped" || run.state === "superseded") && (
<div style={{ fontSize: 12, color: "var(--text-3)", marginBottom: 8 }}>{t("A new session on the task picks up from what earlier sessions did and where they stopped.")}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", marginBottom: 8 }}>{t("A new session on the task picks up from what earlier sessions did and where they stopped.")}</div>
)} )}
{controlError && <div className="form-error" role="alert">{controlError}</div>} {controlError && <div className="form-error" role="alert">{controlError}</div>}
<div style={{ display: "grid", gridTemplateColumns: "120px 1fr", gap: "8px 16px", fontSize: 14, marginBottom: 20 }}> <div style={{ display: "grid", gridTemplateColumns: "120px 1fr", gap: "8px 16px", fontSize: "var(--fs-body)", marginBottom: 20 }}>
<MetaLabel>{t("Agent")}</MetaLabel><div>{agent?.name ?? "—"} ({agent?.role ?? "—"})</div> <MetaLabel>{t("Agent")}</MetaLabel><div>{agent?.name ?? "—"} ({agent?.role ?? "—"})</div>
<MetaLabel>{t("Provider")}</MetaLabel><div>{provider?.label ?? "—"}</div> <MetaLabel>{t("Provider")}</MetaLabel><div>{provider?.label ?? "—"}</div>
<MetaLabel>{t("Model")}</MetaLabel><div>{run.runModel ?? t("Chosen when the session starts")}</div> <MetaLabel>{t("Model")}</MetaLabel><div>{run.runModel ?? t("Chosen when the session starts")}</div>
@@ -216,7 +216,7 @@ function RunDetail({ run, tasks, agents, providers, actions, onOpenTask }: {
{run.startedAt && (<><MetaLabel>{t("Started")}</MetaLabel><div>{formatRelative(run.startedAt)}</div></>)} {run.startedAt && (<><MetaLabel>{t("Started")}</MetaLabel><div>{formatRelative(run.startedAt)}</div></>)}
{run.completedAt && (<><MetaLabel>{t("Completed")}</MetaLabel><div>{formatRelative(run.completedAt)}</div></>)} {run.completedAt && (<><MetaLabel>{t("Completed")}</MetaLabel><div>{formatRelative(run.completedAt)}</div></>)}
{durationMs !== null && (<><MetaLabel>{t("Duration")}</MetaLabel><div>{formatDuration(durationMs)}</div></>)} {durationMs !== null && (<><MetaLabel>{t("Duration")}</MetaLabel><div>{formatDuration(durationMs)}</div></>)}
<MetaLabel>{t("Context")}</MetaLabel><div className="mono" style={{ fontSize: 12, overflow: "hidden", textOverflow: "ellipsis" }}>{run.executionContextId}</div> <MetaLabel>{t("Context")}</MetaLabel><div className="mono" style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis" }}>{run.executionContextId}</div>
</div> </div>
<RunRequestList loaded={loadedRequests} /> <RunRequestList loaded={loadedRequests} />
@@ -224,28 +224,28 @@ function RunDetail({ run, tasks, agents, providers, actions, onOpenTask }: {
{run.state === "superseded" && run.errorMessage && ( {run.state === "superseded" && run.errorMessage && (
<div className="card" style={{ padding: 16, marginBottom: 16 }}> <div className="card" style={{ padding: 16, marginBottom: 16 }}>
<div className="section-label" style={{ marginBottom: 8 }}>{t("Why it did not run")}</div> <div className="section-label" style={{ marginBottom: 8 }}>{t("Why it did not run")}</div>
<div style={{ fontSize: 14, color: "var(--text-1)", whiteSpace: "pre-wrap", lineHeight: 1.5 }}>{run.errorMessage}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-1)", whiteSpace: "pre-wrap", lineHeight: 1.5 }}>{run.errorMessage}</div>
</div> </div>
)} )}
{run.state === "failed" && run.errorMessage && ( {run.state === "failed" && run.errorMessage && (
<div className="card" style={{ padding: 16, marginBottom: 16, borderColor: "var(--red)" }}> <div className="card" style={{ padding: 16, marginBottom: 16, borderColor: "var(--red)" }}>
<div className="section-label" style={{ color: "var(--red)", marginBottom: 8 }}>{t("Error")}</div> <div className="section-label" style={{ color: "var(--red)", marginBottom: 8 }}>{t("Error")}</div>
<div style={{ fontSize: 14, color: "var(--text-1)", whiteSpace: "pre-wrap", lineHeight: 1.5 }}>{run.errorMessage}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-1)", whiteSpace: "pre-wrap", lineHeight: 1.5 }}>{run.errorMessage}</div>
</div> </div>
)} )}
{run.capabilityWarnings && ( {run.capabilityWarnings && (
<div className="card" style={{ padding: 16, marginBottom: 16, borderColor: "var(--amber)" }}> <div className="card" style={{ padding: 16, marginBottom: 16, borderColor: "var(--amber)" }}>
<div className="section-label" style={{ color: "var(--amber)", marginBottom: 8 }}>{t("Missing this run")}</div> <div className="section-label" style={{ color: "var(--amber)", marginBottom: 8 }}>{t("Missing this run")}</div>
<div style={{ fontSize: 14, color: "var(--text-1)", whiteSpace: "pre-wrap", lineHeight: 1.5 }}>{run.capabilityWarnings}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-1)", whiteSpace: "pre-wrap", lineHeight: 1.5 }}>{run.capabilityWarnings}</div>
</div> </div>
)} )}
{request && ( {request && (
<div className="card" style={{ padding: 16, marginBottom: 16 }}> <div className="card" style={{ padding: 16, marginBottom: 16 }}>
<div className="section-label" style={{ marginBottom: 8 }}>{t("Provider request")}</div> <div className="section-label" style={{ marginBottom: 8 }}>{t("Provider request")}</div>
<div style={{ display: "grid", gridTemplateColumns: "120px 1fr", gap: "8px 16px", fontSize: 14 }}> <div style={{ display: "grid", gridTemplateColumns: "120px 1fr", gap: "8px 16px", fontSize: "var(--fs-body)" }}>
<MetaLabel>{t("Request ID")}</MetaLabel><div className="mono" style={{ fontSize: 12, overflow: "hidden", textOverflow: "ellipsis" }}>{request.id}</div> <MetaLabel>{t("Request ID")}</MetaLabel><div className="mono" style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis" }}>{request.id}</div>
<MetaLabel>{t("Model")}</MetaLabel><div>{request.model}</div> <MetaLabel>{t("Model")}</MetaLabel><div>{request.model}</div>
<MetaLabel>{t("State")}</MetaLabel><div>{requestStateLabel(request.state)}</div> <MetaLabel>{t("State")}</MetaLabel><div>{requestStateLabel(request.state)}</div>
<MetaLabel>{t("Input chars")}</MetaLabel><div className="num">{request.inputCharCount.toLocaleString()}</div> <MetaLabel>{t("Input chars")}</MetaLabel><div className="num">{request.inputCharCount.toLocaleString()}</div>
@@ -257,7 +257,7 @@ function RunDetail({ run, tasks, agents, providers, actions, onOpenTask }: {
<div style={{ marginTop: 12 }}> <div style={{ marginTop: 12 }}>
<div className="section-label" style={{ marginBottom: 6 }}>{t("Response")}</div> <div className="section-label" style={{ marginBottom: 6 }}>{t("Response")}</div>
<div style={{ <div style={{
fontSize: 12, fontSize: "var(--fs-body)",
color: "var(--text-2)", color: "var(--text-2)",
whiteSpace: "pre-wrap", whiteSpace: "pre-wrap",
lineHeight: 1.5, lineHeight: 1.5,
@@ -265,7 +265,6 @@ function RunDetail({ run, tasks, agents, providers, actions, onOpenTask }: {
overflow: "auto", overflow: "auto",
padding: 10, padding: 10,
background: "var(--panel-3)", background: "var(--panel-3)",
borderRadius: 8,
fontFamily: "var(--font-mono)", fontFamily: "var(--font-mono)",
}}> }}>
{request.responseText} {request.responseText}
+1 -1
View File
@@ -46,7 +46,7 @@ export function SettingsPage({ snapshot, actions, focus }: PageProps) {
return ( return (
<div className="split-main"> <div className="split-main">
<aside className="secondary-pane"> <aside className="secondary-pane">
<div style={{ fontSize: 14, fontWeight: 600, padding: "4px 8px 14px" }}>{t("Settings")}</div> <div style={{ fontSize: "var(--fs-body)", padding: "4px 8px 14px" }}>{t("Settings")}</div>
<div className="pane-scroll"> <div className="pane-scroll">
<NavGroup items={TABS} active={tab} onChange={(next) => requestLeave(() => setTab(next))} /> <NavGroup items={TABS} active={tab} onChange={(next) => requestLeave(() => setTab(next))} />
</div> </div>
+12 -17
View File
@@ -1,3 +1,4 @@
import { XpBar } from "../shared/XpBar";
import { useRevealObject } from "../shared/reveal"; import { useRevealObject } from "../shared/reveal";
import { oneOf, usePersistentState } from "../shared/view-state"; import { oneOf, usePersistentState } from "../shared/view-state";
import { agentModel } from "../../../shared/agent-model"; import { agentModel } from "../../../shared/agent-model";
@@ -105,9 +106,9 @@ export function TeamPage({ snapshot, actions, focus }: PageProps) {
<div className="page"> <div className="page">
<TopbarActions> <TopbarActions>
<Button tone="ghost" onClick={() => cycleFilter(filter, setFilter)} title={t("Filter")}> <Button tone="ghost" onClick={() => cycleFilter(filter, setFilter)} title={t("Filter")}>
<Icon name="filter" size={16} /> {filterLabel(filter)} <Icon name="filter" /> {filterLabel(filter)}
</Button> </Button>
<Button tone="primary" onClick={openHireDialog}><Icon name="plus" size={16} /> {t("Hire")}</Button> <Button tone="primary" onClick={openHireDialog}><Icon name="plus" /> {t("Hire")}</Button>
</TopbarActions> </TopbarActions>
<h1 className="page-h1">{t("Team")}</h1> <h1 className="page-h1">{t("Team")}</h1>
<p className="page-sub"> <p className="page-sub">
@@ -154,7 +155,7 @@ export function TeamPage({ snapshot, actions, focus }: PageProps) {
<input className="input" name="modelId" list="hire-model-suggestions" value={hireModelId} disabled={!hireProviderId} placeholder={providers.find((provider) => provider.id === hireProviderId)?.model ?? ""} onChange={(event) => setHireModelId(event.currentTarget.value)} /> <input className="input" name="modelId" list="hire-model-suggestions" value={hireModelId} disabled={!hireProviderId} placeholder={providers.find((provider) => provider.id === hireProviderId)?.model ?? ""} onChange={(event) => setHireModelId(event.currentTarget.value)} />
</Field> </Field>
<ModelSuggestions id="hire-model-suggestions" providerId={hireProviderId} providers={providers} catalog={snapshot.providerCatalog} /> <ModelSuggestions id="hire-model-suggestions" providerId={hireProviderId} providers={providers} catalog={snapshot.providerCatalog} />
<p style={{ fontSize: 12, color: "var(--text-3)", margin: 0 }}>{t("Leave the model blank to use the provider's default. A changed model applies from the agent's next session.")}</p> <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", margin: 0 }}>{t("Leave the model blank to use the provider's default. A changed model applies from the agent's next session.")}</p>
<Field label={t("Manager")}> <Field label={t("Manager")}>
<select className="input" name="managerAgentId" defaultValue=""> <select className="input" name="managerAgentId" defaultValue="">
<option value="">{t("None")}</option> <option value="">{t("None")}</option>
@@ -180,13 +181,13 @@ export function TeamPage({ snapshot, actions, focus }: PageProps) {
<Field label={t("Department")}><input className="input" name="department" defaultValue={editingAgent.department} required /></Field> <Field label={t("Department")}><input className="input" name="department" defaultValue={editingAgent.department} required /></Field>
<Field label={t("Monthly budget")}><input className="input" name="budget" type="number" min="0" step="1" defaultValue={editingAgent.budgetCents / 100} /></Field> <Field label={t("Monthly budget")}><input className="input" name="budget" type="number" min="0" step="1" defaultValue={editingAgent.budgetCents / 100} /></Field>
<EditModelFields agent={editingAgent} providers={providers} catalog={snapshot.providerCatalog} /> <EditModelFields agent={editingAgent} providers={providers} catalog={snapshot.providerCatalog} />
<p style={{ fontSize: 12, color: "var(--text-3)", margin: 0 }}>{t("Leave the model blank to use the provider's default. A changed model applies from the agent's next session.")}</p> <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", margin: 0 }}>{t("Leave the model blank to use the provider's default. A changed model applies from the agent's next session.")}</p>
<Field label={t("Seniority")}> <Field label={t("Seniority")}>
{/* The CEO's rank carries company-wide powers, so it is shown, never picked. */} {/* The CEO's rank carries company-wide powers, so it is shown, never picked. */}
{editingAgent.roleLevel === "c_suite" ? ( {editingAgent.roleLevel === "c_suite" ? (
<> <>
<input type="hidden" name="roleLevel" value="c_suite" /> <input type="hidden" name="roleLevel" value="c_suite" />
<div style={{ fontSize: 13, color: "var(--text-2)" }}>{t("CEO: hires officers, grants connectors and skills, and closes goals. This rank cannot be changed.")}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-2)" }}>{t("CEO: hires officers, grants connectors and skills, and closes goals. This rank cannot be changed.")}</div>
</> </>
) : ( ) : (
<select className="input" name="roleLevel" defaultValue={editingAgent.roleLevel}> <select className="input" name="roleLevel" defaultValue={editingAgent.roleLevel}>
@@ -300,8 +301,8 @@ function RosterRow({ row, last, onEdit }: { row: RosterEntry; last: boolean; onE
<div className="row" style={{ gap: 10, minWidth: 0 }}> <div className="row" style={{ gap: 10, minWidth: 0 }}>
<Avatar name={row.name} size="sm" bot={!row.human} /> <Avatar name={row.name} size="sm" bot={!row.human} />
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0 }}>
<div style={{ fontWeight: 500, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{row.name}</div> <div style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{row.name}</div>
<div style={{ fontSize: 12, color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{row.role}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{row.role}</div>
</div> </div>
</div> </div>
<div style={{ color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{row.dept}</div> <div style={{ color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{row.dept}</div>
@@ -309,7 +310,7 @@ function RosterRow({ row, last, onEdit }: { row: RosterEntry; last: boolean; onE
style={{ style={{
color: "var(--text-2)", color: "var(--text-2)",
fontFamily: row.human ? "inherit" : "var(--font-mono)", fontFamily: row.human ? "inherit" : "var(--font-mono)",
fontSize: row.human ? 13 : 12, fontSize: "var(--fs-body)",
overflow: "hidden", overflow: "hidden",
textOverflow: "ellipsis", textOverflow: "ellipsis",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@@ -322,16 +323,10 @@ function RosterRow({ row, last, onEdit }: { row: RosterEntry; last: boolean; onE
<span style={{ color: "var(--text-4)" }}>—</span> <span style={{ color: "var(--text-4)" }}>—</span>
) : ( ) : (
<div className="row" style={{ gap: 8 }}> <div className="row" style={{ gap: 8 }}>
<div style={{ flex: 1, height: 3, background: "var(--panel-3)", borderRadius: 2, overflow: "hidden", maxWidth: 100 }}> <div style={{ flex: 1, maxWidth: 100 }}>
<div <XpBar percent={row.budgetCapCents && row.budgetCapCents > 0 ? (row.budgetCents / row.budgetCapCents) * 100 : 0} label={t("Budget compared with the largest agent budget")} />
style={{
width: `${row.budgetCapCents && row.budgetCapCents > 0 ? Math.min(100, Math.round((row.budgetCents / row.budgetCapCents) * 100)) : 0}%`,
height: "100%",
background: "var(--text-2)",
}}
/>
</div> </div>
<span className="num mono" style={{ fontSize: 12, color: "var(--text-3)" }}>{money(row.budgetCents)}</span> <span className="num mono" style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{money(row.budgetCents)}</span>
</div> </div>
)} )}
</div> </div>
+13 -17
View File
@@ -108,12 +108,11 @@ export function WorkPage({ snapshot, actions, navigate, focus }: PageProps) {
onPriority={setPriorityFilter} onPriority={setPriorityFilter}
onAssignee={setAssigneeFilter} onAssignee={setAssigneeFilter}
/> />
<Button tone="ghost" onClick={() => setNewGoalOpen(true)}><Icon name="plus" size={16} /> {t("Goal")}</Button> <Button tone="ghost" onClick={() => setNewGoalOpen(true)}><Icon name="plus" /> {t("Goal")}</Button>
<Button tone="ghost" onClick={() => setNewProjectOpen(true)}><Icon name="plus" size={16} /> {t("Project")}</Button> <Button tone="ghost" onClick={() => setNewProjectOpen(true)}><Icon name="plus" /> {t("Project")}</Button>
<Button tone="primary" onClick={() => setNewTaskOpen(true)}><Icon name="plus" size={16} /> {t("New task")}</Button> <Button tone="primary" onClick={() => setNewTaskOpen(true)}><Icon name="plus" /> {t("New task")}</Button>
</TopbarActions> </TopbarActions>
<h1 className="page-h1">{t("Work")}</h1> <h1 className="page-h1">{t("Work")}</h1>
<p className="page-sub">{t("Only a task runs: an agent picks it up and does the work. Goals and projects group tasks; documents and knowledge are what agents read and write along the way.")}</p>
{scope && ( {scope && (
<div className="row" style={{ gap: 8, marginBottom: 8 }}> <div className="row" style={{ gap: 8, marginBottom: 8 }}>
<Pill> <Pill>
@@ -121,7 +120,7 @@ export function WorkPage({ snapshot, actions, navigate, focus }: PageProps) {
? t("Goal: {title}", { title: goals.find((goal) => goal.id === scope.id)?.title ?? scope.id }) ? t("Goal: {title}", { title: goals.find((goal) => goal.id === scope.id)?.title ?? scope.id })
: t("Project: {name}", { name: projects.find((project) => project.id === scope.id)?.name ?? scope.id })} : t("Project: {name}", { name: projects.find((project) => project.id === scope.id)?.name ?? scope.id })}
</Pill> </Pill>
<button type="button" className="link-button" style={{ fontSize: 12 }} onClick={() => setScope(null)}>{t("Show all work")}</button> <button type="button" className="link-button" style={{ fontSize: "var(--fs-body)" }} onClick={() => setScope(null)}>{t("Show all work")}</button>
</div> </div>
)} )}
<p className="page-sub"> <p className="page-sub">
@@ -227,7 +226,7 @@ function WorkFilter({
<Popover <Popover
trigger={({ toggle }) => ( trigger={({ toggle }) => (
<button type="button" className="button ghost" aria-label={t("Filter tasks")} onClick={toggle}> <button type="button" className="button ghost" aria-label={t("Filter tasks")} onClick={toggle}>
<Icon name="filter" size={16} color={active ? "var(--accent)" : "currentColor"} /> <Icon name="filter" color={active ? "var(--accent)" : "currentColor"} />
</button> </button>
)} )}
> >
@@ -237,19 +236,19 @@ function WorkFilter({
{priorities.map((option) => ( {priorities.map((option) => (
<MenuRow key={option.id} active={priority === option.id} onClick={() => onPriority(option.id)}> <MenuRow key={option.id} active={priority === option.id} onClick={() => onPriority(option.id)}>
{option.label} {option.label}
{priority === option.id && <span className="menu-check"><Icon name="check" size={16} /></span>} {priority === option.id && <span className="menu-check"><Icon name="check" /></span>}
</MenuRow> </MenuRow>
))} ))}
<MenuDivider /> <MenuDivider />
<MenuLabel>{t("Assignee")}</MenuLabel> <MenuLabel>{t("Assignee")}</MenuLabel>
<MenuRow active={assignee === "all"} onClick={() => onAssignee("all")}> <MenuRow active={assignee === "all"} onClick={() => onAssignee("all")}>
{t("All assignees")} {t("All assignees")}
{assignee === "all" && <span className="menu-check"><Icon name="check" size={16} /></span>} {assignee === "all" && <span className="menu-check"><Icon name="check" /></span>}
</MenuRow> </MenuRow>
{agents.map((agent) => ( {agents.map((agent) => (
<MenuRow key={agent.id} active={assignee === agent.id} onClick={() => onAssignee(agent.id)}> <MenuRow key={agent.id} active={assignee === agent.id} onClick={() => onAssignee(agent.id)}>
{agent.name} {agent.name}
{assignee === agent.id && <span className="menu-check"><Icon name="check" size={16} /></span>} {assignee === agent.id && <span className="menu-check"><Icon name="check" /></span>}
</MenuRow> </MenuRow>
))} ))}
</> </>
@@ -286,9 +285,9 @@ function BoardView({
return ( return (
<div key={column.id} style={{ display: "flex", flexDirection: "column", minWidth: 0, minHeight: 0 }}> <div key={column.id} style={{ display: "flex", flexDirection: "column", minWidth: 0, minHeight: 0 }}>
<div className="row" style={{ padding: "4px 6px 8px", flexShrink: 0 }}> <div className="row" style={{ padding: "4px 6px 8px", flexShrink: 0 }}>
<span style={{ width: 8, height: 8, borderRadius: 2, background: column.tone, flexShrink: 0 }} /> <span style={{ width: 8, height: 8, background: column.tone, flexShrink: 0 }} />
<span style={{ fontSize: 12, fontWeight: 540 }}>{column.label}</span> <span style={{ fontSize: "var(--fs-body)" }}>{column.label}</span>
<span className="num" style={{ fontSize: 12, color: "var(--text-3)" }}>{columnTasks.length}</span> <span className="num" style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{columnTasks.length}</span>
<IconButton icon="plus" label={t("Add task")} onClick={onCreate} /> <IconButton icon="plus" label={t("Add task")} onClick={onCreate} />
</div> </div>
<div style={{ flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column", gap: 8, paddingBottom: 24 }}> <div style={{ flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column", gap: 8, paddingBottom: 24 }}>
@@ -341,7 +340,6 @@ function TaskCard({
style={{ style={{
background: "var(--panel)", background: "var(--panel)",
border: "1px solid var(--border)", border: "1px solid var(--border)",
borderRadius: 10,
padding: 12, padding: 12,
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
@@ -351,15 +349,13 @@ function TaskCard({
}} }}
> >
<div style={{ display: "flex", alignItems: "flex-start", gap: 6 }}> <div style={{ display: "flex", alignItems: "flex-start", gap: 6 }}>
{task.priority === "high" && <span style={{ width: 3, height: 14, background: "var(--red)", borderRadius: 2, marginTop: 2, flexShrink: 0 }} />} {task.priority === "high" && <span style={{ width: 3, height: 14, background: "var(--red)", marginTop: 2, flexShrink: 0 }} />}
<div <div
style={{ style={{
flex: 1, flex: 1,
minWidth: 0, minWidth: 0,
fontSize: 14, fontSize: "var(--fs-body)",
fontWeight: 480,
lineHeight: 1.35, lineHeight: 1.35,
letterSpacing: "-0.005em",
color: task.status === "done" ? "var(--text-3)" : "var(--text-1)", color: task.status === "done" ? "var(--text-3)" : "var(--text-1)",
display: "-webkit-box", display: "-webkit-box",
WebkitLineClamp: 3, WebkitLineClamp: 3,
@@ -45,14 +45,14 @@ export function ApprovalDetailDialog({
<IconButton icon="x" label={t("Close")} onClick={onClose} /> <IconButton icon="x" label={t("Close")} onClick={onClose} />
</div> </div>
<div className="row" style={{ flexWrap: "wrap", gap: 6, marginBottom: 14 }}> <div className="row" style={{ flexWrap: "wrap", gap: 6, marginBottom: 14 }}>
<span style={{ fontSize: 12, color: tone.color, fontWeight: 540, letterSpacing: "0.02em" }}>{tone.label}</span> <span style={{ fontSize: "var(--fs-body)", color: tone.color }}>{tone.label}</span>
<span style={{ color: "var(--text-4)" }}>·</span> <span style={{ color: "var(--text-4)" }}>·</span>
<Pill>{approvalKindLabel(approval.kind)}</Pill> <Pill>{approvalKindLabel(approval.kind)}</Pill>
</div> </div>
<p style={{ margin: "0 0 16px", color: "var(--text-2)", fontSize: 14, lineHeight: 1.55, whiteSpace: "pre-wrap" }}> <p style={{ margin: "0 0 16px", color: "var(--text-2)", fontSize: "var(--fs-body)", lineHeight: 1.55, whiteSpace: "pre-wrap" }}>
{approval.details} {approval.details}
</p> </p>
<div style={{ display: "grid", gridTemplateColumns: "100px 1fr", gap: "10px 14px", fontSize: 12 }}> <div style={{ display: "grid", gridTemplateColumns: "100px 1fr", gap: "10px 14px", fontSize: "var(--fs-body)" }}>
<span style={{ color: "var(--text-3)" }}>{t("Requested by")}</span> <span style={{ color: "var(--text-3)" }}>{t("Requested by")}</span>
<span>{requester}</span> <span>{requester}</span>
{approval.sourceEntityType && ( {approval.sourceEntityType && (
@@ -117,8 +117,8 @@ export function ApprovalRecordDialog({ approval, requester, decider, drift, onCl
<Pill>{approvalKindLabel(approval.kind)}</Pill> <Pill>{approvalKindLabel(approval.kind)}</Pill>
{drift && <Pill tone="amber">{drift === "changed" ? t("Changed since approval") : t("Removed since approval")}</Pill>} {drift && <Pill tone="amber">{drift === "changed" ? t("Changed since approval") : t("Removed since approval")}</Pill>}
</div> </div>
<p style={{ margin: "0 0 16px", color: "var(--text-2)", fontSize: 14, lineHeight: 1.55, whiteSpace: "pre-wrap" }}>{approval.details}</p> <p style={{ margin: "0 0 16px", color: "var(--text-2)", fontSize: "var(--fs-body)", lineHeight: 1.55, whiteSpace: "pre-wrap" }}>{approval.details}</p>
<div style={{ display: "grid", gridTemplateColumns: "110px 1fr", gap: "10px 14px", fontSize: 12 }}> <div style={{ display: "grid", gridTemplateColumns: "110px 1fr", gap: "10px 14px", fontSize: "var(--fs-body)" }}>
<span style={{ color: "var(--text-3)" }}>{t("Requested by")}</span> <span style={{ color: "var(--text-3)" }}>{t("Requested by")}</span>
<span>{requester} · {formatRelative(approval.createdAt)}</span> <span>{requester} · {formatRelative(approval.createdAt)}</span>
<span style={{ color: "var(--text-3)" }}>{t("Decided by")}</span> <span style={{ color: "var(--text-3)" }}>{t("Decided by")}</span>
+5 -5
View File
@@ -80,7 +80,7 @@ export function ChatComposer({
return ( return (
<form onSubmit={onSubmit} onInput={() => { if (spaceId && ref.current) noteTyping(spaceId, ref.current.value); }} data-space-id={spaceId ?? undefined} style={{ padding: 14, paddingTop: 4, flexShrink: 0 }}> <form onSubmit={onSubmit} onInput={() => { if (spaceId && ref.current) noteTyping(spaceId, ref.current.value); }} data-space-id={spaceId ?? undefined} style={{ padding: 14, paddingTop: 4, flexShrink: 0 }}>
<div style={{ border: "1px solid var(--border-strong)", borderRadius: 12, background: "var(--panel)", padding: "10px 12px" }}> <div style={{ border: "1px solid var(--border-strong)", background: "var(--panel)", padding: "10px 12px" }}>
<MentionTextarea <MentionTextarea
name="message" name="message"
defaultValue={draft.body} defaultValue={draft.body}
@@ -97,7 +97,7 @@ export function ChatComposer({
<IconButton icon="sparkle" label={t("Commands")} onClick={() => setSlashOpen((open) => !open)} disabled={locked} /> <IconButton icon="sparkle" label={t("Commands")} onClick={() => setSlashOpen((open) => !open)} disabled={locked} />
{attachments.map((attachment) => ( {attachments.map((attachment) => (
<span key={attachment.id} className="pill" style={{ maxWidth: 220 }}> <span key={attachment.id} className="pill" style={{ maxWidth: 220 }}>
<Icon name="file" size={14} /> <Icon name="file" />
<span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{attachment.name}</span> <span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{attachment.name}</span>
<button <button
type="button" type="button"
@@ -106,13 +106,13 @@ export function ChatComposer({
onClick={() => onAttachmentRemove(attachment.id)} onClick={() => onAttachmentRemove(attachment.id)}
style={{ display: "inline-flex", border: 0, background: "transparent", padding: 0, color: "var(--text-3)", cursor: "pointer" }} style={{ display: "inline-flex", border: 0, background: "transparent", padding: 0, color: "var(--text-3)", cursor: "pointer" }}
> >
<Icon name="x" size={14} /> <Icon name="x" />
</button> </button>
</span> </span>
))} ))}
<div style={{ marginLeft: "auto", display: "flex", alignItems: "center", gap: 6 }}> <div style={{ marginLeft: "auto", display: "flex", alignItems: "center", gap: 6 }}>
<span className="mono" style={{ fontSize: 12, color: "var(--text-3)" }}>{shortcutLabel("Enter")}</span> <span className="mono" style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{shortcutLabel("Enter")}</span>
<Button tone="primary" size="small" type="submit" disabled={locked}><Icon name="send" size={12} /> {t("Send")}</Button> <Button tone="primary" size="small" type="submit" disabled={locked}><Icon name="send" /> {t("Send")}</Button>
</div> </div>
</div> </div>
{send.error && <div className="form-error" role="alert">{t("Not sent: {reason}", { reason: send.error })}</div>} {send.error && <div className="form-error" role="alert">{t("Not sent: {reason}", { reason: send.error })}</div>}
@@ -239,7 +239,7 @@ export function ChatConversation({
</div> </div>
{!atBottom && ( {!atBottom && (
<button type="button" className="jump-latest" onClick={() => jumpToLatest("smooth")}> <button type="button" className="jump-latest" onClick={() => jumpToLatest("smooth")}>
<span aria-hidden style={{ fontSize: 13, lineHeight: 1 }}>↓</span> <span aria-hidden style={{ fontSize: "var(--fs-body)", lineHeight: 1 }}>↓</span>
{t("Jump to latest")} {t("Jump to latest")}
</button> </button>
)} )}
@@ -297,11 +297,11 @@ function ConversationHeader({
}; };
return ( return (
<header className="row" style={{ height: 52, padding: "0 24px", borderBottom: "1px solid var(--border-soft)", flexShrink: 0 }}> <header className="row" style={{ height: 52, padding: "0 24px", borderBottom: "1px solid var(--border-soft)", flexShrink: 0 }}>
<Icon name={space.visibility === "restricted" ? "lock" : "hash"} size={15} color="var(--text-3)" /> <Icon name={space.visibility === "restricted" ? "lock" : "hash"} color="var(--text-3)" />
<span style={{ fontSize: 14, fontWeight: 600 }}>{space.name}</span> <span style={{ fontSize: "var(--fs-body)" }}>{space.name}</span>
<span <span
style={{ style={{
fontSize: 12, fontSize: "var(--fs-body)",
color: "var(--text-3)", color: "var(--text-3)",
borderLeft: "1px solid var(--border)", borderLeft: "1px solid var(--border)",
paddingLeft: 10, paddingLeft: 10,
@@ -341,20 +341,20 @@ function MembersButton({ space, members }: { space: ChatSpaceRecord; members: Sp
trigger={({ toggle }) => ( trigger={({ toggle }) => (
<button type="button" onClick={toggle} aria-label={t("Members ({count})", { count: String(members.length) })} style={{ display: "flex", alignItems: "center", gap: 6, border: 0, background: "transparent", cursor: "pointer", padding: 0 }}> <button type="button" onClick={toggle} aria-label={t("Members ({count})", { count: String(members.length) })} style={{ display: "flex", alignItems: "center", gap: 6, border: 0, background: "transparent", cursor: "pointer", padding: 0 }}>
<AvatarStack names={members.slice(0, 5).map((member) => member.name)} /> <AvatarStack names={members.slice(0, 5).map((member) => member.name)} />
<span style={{ fontSize: 12, color: "var(--text-3)" }}>{members.length}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{members.length}</span>
</button> </button>
)} )}
> >
{() => ( {() => (
// A large roster scrolls inside the window instead of running past it. // A large roster scrolls inside the window instead of running past it.
<div className="members-roster" style={{ padding: 12, width: 320, maxHeight: "min(480px, calc(100vh - 120px))", overflowY: "auto", display: "flex", flexDirection: "column", gap: 10 }}> <div className="members-roster" style={{ padding: 12, width: 320, maxHeight: "min(480px, calc(100vh - 120px))", overflowY: "auto", display: "flex", flexDirection: "column", gap: 10 }}>
<div style={{ fontSize: 12, color: "var(--text-3)" }}>{spaceReaders(space)}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{spaceReaders(space)}</div>
{members.map((member) => ( {members.map((member) => (
<div key={member.id} className="row" style={{ gap: 8, alignItems: "flex-start" }}> <div key={member.id} className="row" style={{ gap: 8, alignItems: "flex-start" }}>
<Avatar name={member.name} size="sm" bot={member.bot} /> <Avatar name={member.name} size="sm" bot={member.bot} />
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0 }}>
<div style={{ fontSize: 13, fontWeight: 540 }}>{member.name}</div> <div style={{ fontSize: "var(--fs-body)" }}>{member.name}</div>
<div style={{ fontSize: 12, color: "var(--text-3)" }}>{member.duty}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{member.duty}</div>
</div> </div>
</div> </div>
))} ))}
+16 -20
View File
@@ -84,14 +84,14 @@ export function ChatMessageRow({
<Avatar name={name} bot={bot} /> <Avatar name={name} bot={bot} />
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div className="row" style={{ alignItems: "baseline", gap: 8, marginBottom: 2 }}> <div className="row" style={{ alignItems: "baseline", gap: 8, marginBottom: 2 }}>
<span style={{ fontSize: 14, fontWeight: 540 }}>{name}</span> <span style={{ fontSize: "var(--fs-body)" }}>{name}</span>
<span className="mono" style={{ fontSize: 12, color: "var(--text-3)" }}>{formatTime(message.createdAt)}</span> <span className="mono" style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{formatTime(message.createdAt)}</span>
{message.editedAt && !deleted && <span style={{ fontSize: 12, color: "var(--text-3)" }}>{t("(edited)")}</span>} {message.editedAt && !deleted && <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("(edited)")}</span>}
{!editing && (canModify || (onOpenThread && !deleted)) && ( {!editing && (canModify || (onOpenThread && !deleted)) && (
<span style={{ marginLeft: "auto", display: "flex", gap: 2 }}> <span style={{ marginLeft: "auto", display: "flex", gap: 2 }}>
{onOpenThread && !deleted && <IconButton icon="chat" label={t("Reply in thread")} size={16} onClick={onOpenThread} />} {onOpenThread && !deleted && <IconButton icon="chat" label={t("Reply in thread")} onClick={onOpenThread} />}
{canModify && <IconButton icon="edit" label={t("Edit message")} size={16} onClick={() => setEditing(true)} />} {canModify && <IconButton icon="edit" label={t("Edit message")} onClick={() => setEditing(true)} />}
{canModify && <IconButton icon="x" label={t("Delete message")} size={16} onClick={onDelete} />} {canModify && <IconButton icon="x" label={t("Delete message")} onClick={onDelete} />}
</span> </span>
)} )}
</div> </div>
@@ -102,7 +102,7 @@ export function ChatMessageRow({
? t("Replying in thread: {snippet}", { snippet: thread.replyTo.snippet }) ? t("Replying in thread: {snippet}", { snippet: thread.replyTo.snippet })
: t("Replying to {name}: {snippet}", { name: thread.replyTo.name, snippet: thread.replyTo.snippet })} : t("Replying to {name}: {snippet}", { name: thread.replyTo.name, snippet: thread.replyTo.snippet })}
onClick={onOpenThread} onClick={onOpenThread}
style={{ display: "block", maxWidth: "100%", margin: "0 0 4px", padding: 0, border: 0, background: "transparent", color: "var(--text-3)", fontSize: 12, textAlign: "left", cursor: "pointer", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }} style={{ display: "block", maxWidth: "100%", margin: "0 0 4px", padding: 0, border: 0, background: "transparent", color: "var(--text-3)", fontSize: "var(--fs-body)", textAlign: "left", cursor: "pointer", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}
> >
↳ {thread.replyTo.name === null ? thread.replyTo.snippet : `${thread.replyTo.name}: ${thread.replyTo.snippet}`} ↳ {thread.replyTo.name === null ? thread.replyTo.snippet : `${thread.replyTo.name}: ${thread.replyTo.snippet}`}
</button> </button>
@@ -113,7 +113,7 @@ export function ChatMessageRow({
</div> </div>
)} )}
{deleted ? ( {deleted ? (
<div style={{ fontSize: 14, color: "var(--text-3)", fontStyle: "italic" }}>{t("Message deleted")}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", fontStyle: "italic" }}>{t("Message deleted")}</div>
) : editing ? ( ) : editing ? (
<form onSubmit={submitEdit} onInput={() => setChanged(true)}> <form onSubmit={submitEdit} onInput={() => setChanged(true)}>
<textarea <textarea
@@ -132,7 +132,7 @@ export function ChatMessageRow({
</div> </div>
</form> </form>
) : ( ) : (
<div style={{ fontSize: 14, color: "var(--text-1)", lineHeight: 1.5, wordBreak: "break-word" }}> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-1)", lineHeight: 1.5, wordBreak: "break-word" }}>
{renderBody(message.bodyMd, messageMentions, context)} {renderBody(message.bodyMd, messageMentions, context)}
</div> </div>
)} )}
@@ -146,17 +146,17 @@ export function ChatMessageRow({
</div> </div>
)} )}
{thread && thread.replyCount > 0 && ( {thread && thread.replyCount > 0 && (
<button type="button" onClick={onOpenThread} style={{ marginTop: 4, padding: 0, border: 0, background: "transparent", color: "var(--accent)", fontSize: 12, cursor: "pointer" }}> <button type="button" onClick={onOpenThread} style={{ marginTop: 4, padding: 0, border: 0, background: "transparent", color: "var(--accent)", fontSize: "var(--fs-body)", cursor: "pointer" }}>
{thread.replyCount === 1 ? t("1 reply") : t("{count} replies", { count: String(thread.replyCount) })} {thread.replyCount === 1 ? t("1 reply") : t("{count} replies", { count: String(thread.replyCount) })}
</button> </button>
)} )}
{replyStatuses.filter((status) => status.state !== "replied").map((status) => ( {replyStatuses.filter((status) => status.state !== "replied").map((status) => (
<div key={`${status.agentId}-${status.state}`} role="status" style={{ fontSize: 12, color: status.state === "failed" || status.state === "expired" ? "var(--red)" : "var(--text-3)", marginTop: 4 }}> <div key={`${status.agentId}-${status.state}`} role="status" style={{ fontSize: "var(--fs-body)", color: status.state === "failed" || status.state === "expired" ? "var(--red)" : "var(--text-3)", marginTop: 4 }}>
{replyStatusText(status, context)} {replyStatusText(status, context)}
</div> </div>
))} ))}
{readers.length > 0 && ( {readers.length > 0 && (
<div style={{ fontSize: 12, color: "var(--text-3)", marginTop: 4 }}> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", marginTop: 4 }}>
{t("Read by {names}", { names: readers.join(", ") })} {t("Read by {names}", { names: readers.join(", ") })}
</div> </div>
)} )}
@@ -200,8 +200,6 @@ function renderBody(body: string, mentions: ChatMentionRecord[], context: Messag
background: failed ? "rgba(255,100,80,0.1)" : "var(--accent-soft)", background: failed ? "rgba(255,100,80,0.1)" : "var(--accent-soft)",
color: failed ? "var(--text-3)" : "var(--accent)", color: failed ? "var(--text-3)" : "var(--accent)",
padding: "1px 5px", padding: "1px 5px",
borderRadius: 4,
fontWeight: 500,
textDecoration: failed ? "line-through" : undefined, textDecoration: failed ? "line-through" : undefined,
}} }}
> >
@@ -235,7 +233,6 @@ function AttachmentCard({ file, handoff = false, onOpen }: { file: FileObjectRec
style={{ style={{
maxWidth: 360, maxWidth: 360,
border: "1px solid var(--border)", border: "1px solid var(--border)",
borderRadius: 10,
padding: 10, padding: 10,
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
@@ -247,25 +244,24 @@ function AttachmentCard({ file, handoff = false, onOpen }: { file: FileObjectRec
style={{ style={{
width: 32, width: 32,
height: 32, height: 32,
borderRadius: 6,
background: "var(--panel-3)", background: "var(--panel-3)",
color: "var(--text-2)", color: "var(--text-2)",
display: "grid", display: "grid",
placeItems: "center", placeItems: "center",
}} }}
> >
<Icon name={file.kind === "folder" ? "folder" : "file"} size={16} /> <Icon name={file.kind === "folder" ? "folder" : "file"} />
</div> </div>
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div className="row" style={{ gap: 6, minWidth: 0 }}> <div className="row" style={{ gap: 6, minWidth: 0 }}>
<span style={{ fontSize: 12, fontWeight: 540, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{file.name}</span> <span style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{file.name}</span>
{handoff && ( {handoff && (
<span className="pill violet" style={{ flexShrink: 0 }}> <span className="pill violet" style={{ flexShrink: 0 }}>
<Icon name="bot" size={10} /> {t("AI → AI")} <Icon name="bot" /> {t("AI → AI")}
</span> </span>
)} )}
</div> </div>
<div style={{ fontSize: 12, color: "var(--text-3)" }}>{fileKindLabel(file.kind)}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{fileKindLabel(file.kind)}</div>
</div> </div>
{canOpen && <IconButton icon="arrowUpRight" label={t("Open {name}", { name: file.name })} onClick={onOpen ?? undefined} />} {canOpen && <IconButton icon="arrowUpRight" label={t("Open {name}", { name: file.name })} onClick={onOpen ?? undefined} />}
</div> </div>
+4 -6
View File
@@ -84,7 +84,7 @@ export function ChatSidebar({
return ( return (
<aside className="secondary-pane" style={{ width: paneWidth, position: "relative" }}> <aside className="secondary-pane" style={{ width: paneWidth, position: "relative" }}>
<div className="row" style={{ padding: "4px 8px 12px" }}> <div className="row" style={{ padding: "4px 8px 12px" }}>
<div style={{ fontSize: 14, fontWeight: 600 }}>{t("Messages")}</div> <div style={{ fontSize: "var(--fs-body)" }}>{t("Messages")}</div>
<IconButton icon="plus" label={t("New space")} onClick={onCreateSpace} /> <IconButton icon="plus" label={t("New space")} onClick={onCreateSpace} />
</div> </div>
<div className="pane-scroll"> <div className="pane-scroll">
@@ -147,7 +147,6 @@ function ConversationRow({
style={{ style={{
width: 22, width: 22,
height: 22, height: 22,
borderRadius: 6,
background: "var(--panel-3)", background: "var(--panel-3)",
display: "inline-flex", display: "inline-flex",
alignItems: "center", alignItems: "center",
@@ -156,14 +155,13 @@ function ConversationRow({
marginTop: 2, marginTop: 2,
}} }}
> >
<Icon name={conversation.space.visibility === "restricted" ? "lock" : "hash"} size={13} color="var(--text-3)" /> <Icon name={conversation.space.visibility === "restricted" ? "lock" : "hash"} color="var(--text-3)" />
</span> </span>
)} )}
<span style={{ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 1 }}> <span style={{ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 1 }}>
<span className="row" style={{ gap: 8 }}> <span className="row" style={{ gap: 8 }}>
<span <span
style={{ style={{
fontWeight: conversation.unread > 0 ? 600 : 520,
overflow: "hidden", overflow: "hidden",
textOverflow: "ellipsis", textOverflow: "ellipsis",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@@ -174,14 +172,14 @@ function ConversationRow({
{conversation.title} {conversation.title}
</span> </span>
{conversation.isCeo && <span className="convo-ceo-badge">{t("CEO")}</span>} {conversation.isCeo && <span className="convo-ceo-badge">{t("CEO")}</span>}
<span style={{ fontSize: 11, color: "var(--text-3)", flexShrink: 0 }}> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", flexShrink: 0 }}>
{conversation.preview ? formatRelative(conversation.lastActivityAt) : ""} {conversation.preview ? formatRelative(conversation.lastActivityAt) : ""}
</span> </span>
</span> </span>
<span className="row" style={{ gap: 8 }}> <span className="row" style={{ gap: 8 }}>
<span <span
style={{ style={{
fontSize: 12, fontSize: "var(--fs-body)",
color: "var(--text-3)", color: "var(--text-3)",
overflow: "hidden", overflow: "hidden",
textOverflow: "ellipsis", textOverflow: "ellipsis",
+7 -7
View File
@@ -97,7 +97,7 @@ export function ChatTimeline({
</div>, </div>,
); );
} else { } else {
elements.push(<div key="history-start" style={{ textAlign: "center", fontSize: 12, color: "var(--text-3)", marginBottom: 16 }}>{t("This is the start of the conversation.")}</div>); elements.push(<div key="history-start" style={{ textAlign: "center", fontSize: "var(--fs-body)", color: "var(--text-3)", marginBottom: 16 }}>{t("This is the start of the conversation.")}</div>);
} }
let lastDay = ""; let lastDay = "";
for (const message of visible) { for (const message of visible) {
@@ -138,7 +138,7 @@ function DayDivider({ label }: { label: string }) {
return ( return (
<div className="row" style={{ gap: 12, margin: "8px 0 16px" }}> <div className="row" style={{ gap: 12, margin: "8px 0 16px" }}>
<div style={{ flex: 1, height: 1, background: "var(--border-soft)" }} /> <div style={{ flex: 1, height: 1, background: "var(--border-soft)" }} />
<div style={{ fontSize: 12, color: "var(--text-3)", fontWeight: 540 }}>{label}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{label}</div>
<div style={{ flex: 1, height: 1, background: "var(--border-soft)" }} /> <div style={{ flex: 1, height: 1, background: "var(--border-soft)" }} />
</div> </div>
); );
@@ -146,14 +146,14 @@ function DayDivider({ label }: { label: string }) {
function ApprovalInline({ approval, onApprove, onDecline }: { approval: ApprovalRecord; onApprove: () => void; onDecline: () => void }) { function ApprovalInline({ approval, onApprove, onDecline }: { approval: ApprovalRecord; onApprove: () => void; onDecline: () => void }) {
return ( return (
<div style={{ margin: "14px 0 18px 44px", maxWidth: 480, border: "1px solid var(--border-strong)", borderRadius: 12, background: "var(--panel)", padding: 14 }}> <div style={{ margin: "14px 0 18px 44px", maxWidth: 480, border: "1px solid var(--border-strong)", background: "var(--panel)", padding: 14 }}>
<div className="row" style={{ marginBottom: 8 }}> <div className="row" style={{ marginBottom: 8 }}>
<Icon name="approve" size={14} color="var(--amber)" /> <Icon name="approve" color="var(--amber)" />
<span style={{ fontSize: 12, color: "var(--amber)", fontWeight: 540 }}>{t("Approval needed")}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--amber)" }}>{t("Approval needed")}</span>
<Pill tone={approval.risk === "high" ? "red" : approval.risk === "medium" ? "amber" : undefined}>{riskLabel(approval.risk)}</Pill> <Pill tone={approval.risk === "high" ? "red" : approval.risk === "medium" ? "amber" : undefined}>{riskLabel(approval.risk)}</Pill>
</div> </div>
<div style={{ fontSize: 14, fontWeight: 540, marginBottom: 4 }}>{approval.title}</div> <div style={{ fontSize: "var(--fs-body)", marginBottom: 4 }}>{approval.title}</div>
<div style={{ fontSize: 12, color: "var(--text-3)", marginBottom: 12, lineHeight: 1.5 }}>{approval.details}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", marginBottom: 12, lineHeight: 1.5 }}>{approval.details}</div>
<div className="row" style={{ gap: 6 }}> <div className="row" style={{ gap: 6 }}>
<Button tone="primary" size="small" onClick={onApprove}>{t("Approve")}</Button> <Button tone="primary" size="small" onClick={onApprove}>{t("Approve")}</Button>
<Button size="small" onClick={onDecline}>{t("Decline")}</Button> <Button size="small" onClick={onDecline}>{t("Decline")}</Button>
@@ -125,7 +125,6 @@ export function MentionTextarea({
marginBottom: 4, marginBottom: 4,
background: "var(--panel)", background: "var(--panel)",
border: "1px solid var(--border)", border: "1px solid var(--border)",
borderRadius: 10,
boxShadow: "0 4px 16px rgba(0,0,0,0.12)", boxShadow: "0 4px 16px rgba(0,0,0,0.12)",
maxHeight: 200, maxHeight: 200,
overflow: "auto", overflow: "auto",
@@ -149,13 +148,13 @@ export function MentionTextarea({
border: 0, border: 0,
background: i === index ? "var(--accent-soft)" : "transparent", background: i === index ? "var(--accent-soft)" : "transparent",
cursor: "pointer", cursor: "pointer",
fontSize: 14, fontSize: "var(--fs-body)",
color: "var(--text-1)", color: "var(--text-1)",
textAlign: "left", textAlign: "left",
}} }}
> >
<Avatar name={c.displayName} size="sm" bot={c.bot} /> <Avatar name={c.displayName} size="sm" bot={c.bot} />
<span style={{ fontWeight: 500 }}>{c.label}</span> <span>{c.label}</span>
</button> </button>
))} ))}
</div> </div>
@@ -175,7 +174,7 @@ export function MentionTextarea({
border: 0, border: 0,
resize: "none", resize: "none",
outline: "none", outline: "none",
fontSize: 14, fontSize: "var(--fs-body)",
color: "var(--text-1)", color: "var(--text-1)",
background: "transparent", background: "transparent",
padding: 0, padding: 0,
@@ -7,7 +7,7 @@ import { t } from "../../i18n/i18n";
export type SpaceType = "company" | "division" | "department" | "project" | "pod" | "ad_hoc" | "direct"; export type SpaceType = "company" | "division" | "department" | "project" | "pod" | "ad_hoc" | "direct";
export type Visibility = "workspace" | "restricted"; export type Visibility = "workspace" | "restricted";
const hint = { fontSize: 12, color: "var(--text-3)", margin: 0, lineHeight: 1.5 } as const; const hint = { fontSize: "var(--fs-body)", color: "var(--text-3)", margin: 0, lineHeight: 1.5 } as const;
/** Each choice says what it changes: who is a member, who can read it, and which agents a message wakes. */ /** Each choice says what it changes: who is a member, who can read it, and which agents a message wakes. */
export function NewSpaceDialog({ open, employee, employees, agents, onClose, onSubmit }: { export function NewSpaceDialog({ open, employee, employees, agents, onClose, onSubmit }: {
+1 -1
View File
@@ -74,7 +74,7 @@ export function ThreadPanel({
return ( return (
<aside role="complementary" aria-label={t("Thread")} style={{ width: 360, flexShrink: 0, display: "flex", flexDirection: "column", borderLeft: "1px solid var(--border-soft)", background: "var(--panel)" }}> <aside role="complementary" aria-label={t("Thread")} style={{ width: 360, flexShrink: 0, display: "flex", flexDirection: "column", borderLeft: "1px solid var(--border-soft)", background: "var(--panel)" }}>
<header className="row" style={{ height: 52, padding: "0 16px", borderBottom: "1px solid var(--border-soft)", flexShrink: 0 }}> <header className="row" style={{ height: 52, padding: "0 16px", borderBottom: "1px solid var(--border-soft)", flexShrink: 0 }}>
<span style={{ fontSize: 14, fontWeight: 600 }}>{t("Thread")}</span> <span style={{ fontSize: "var(--fs-body)" }}>{t("Thread")}</span>
<span style={{ marginLeft: "auto" }}><IconButton icon="x" label={t("Close thread")} onClick={onClose} /></span> <span style={{ marginLeft: "auto" }}><IconButton icon="x" label={t("Close thread")} onClick={onClose} /></span>
</header> </header>
<div style={{ flex: 1, overflow: "auto", padding: "16px 16px 8px" }}> <div style={{ flex: 1, overflow: "auto", padding: "16px 16px 8px" }}>
@@ -7,14 +7,14 @@ import type { AccountSync } from "./useConnectorCatalog";
export function AccountSyncNote({ sync, onRetry }: { sync: AccountSync; onRetry: () => void }) { export function AccountSyncNote({ sync, onRetry }: { sync: AccountSync; onRetry: () => void }) {
if (sync.phase === "failed") { if (sync.phase === "failed") {
return ( return (
<div role="alert" className="row" style={{ gap: 10, fontSize: 13, marginBottom: 14, color: "var(--red)" }}> <div role="alert" className="row" style={{ gap: 10, fontSize: "var(--fs-body)", marginBottom: 14, color: "var(--red)" }}>
<span style={{ flex: 1, minWidth: 0, wordBreak: "break-word" }}>{t("Account status could not be checked with Composio: {reason}. The statuses below may be out of date.", { reason: sync.message })}</span> <span style={{ flex: 1, minWidth: 0, wordBreak: "break-word" }}>{t("Account status could not be checked with Composio, so the statuses below may be out of date. Reason: {reason}", { reason: sync.message })}</span>
<Button size="small" onClick={onRetry}>{t("Retry")}</Button> <Button size="small" onClick={onRetry}>{t("Retry")}</Button>
</div> </div>
); );
} }
return ( return (
<div role="status" style={{ fontSize: 12, marginBottom: 14, color: "var(--text-3)" }}> <div role="status" style={{ fontSize: "var(--fs-body)", marginBottom: 14, color: "var(--text-3)" }}>
{sync.phase === "syncing" ? t("Checking account status with Composio…") : t("Account status checked with Composio at {time}.", { time: formatTime(sync.at) })} {sync.phase === "syncing" ? t("Checking account status with Composio…") : t("Account status checked with Composio at {time}.", { time: formatTime(sync.at) })}
</div> </div>
); );
@@ -68,7 +68,7 @@ export function ConnectedList({
const grantable = agents.filter((agent) => agent.roleLevel !== "c_suite" && !grants.some((grant) => grant.agentId === agent.id && grant.toolkitSlug === account.toolkitSlug)); const grantable = agents.filter((agent) => agent.roleLevel !== "c_suite" && !grants.some((grant) => grant.agentId === agent.id && grant.toolkitSlug === account.toolkitSlug));
const busy = busySlug !== null; const busy = busySlug !== null;
return ( return (
<div key={account.id} style={{ border: "1px solid var(--border)", borderRadius: 12, padding: 14, background: "var(--panel)" }}> <div key={account.id} style={{ border: "1px solid var(--border)", padding: 14, background: "var(--panel)" }}>
<div className="row" style={{ gap: 10 }}> <div className="row" style={{ gap: 10 }}>
<ToolkitTile <ToolkitTile
name={account.toolkitName} name={account.toolkitName}
@@ -76,8 +76,8 @@ export function ConnectedList({
logoUrl={logoBySlug.get(account.toolkitSlug) ?? null} logoUrl={logoBySlug.get(account.toolkitSlug) ?? null}
size={30} size={30}
/> />
<span style={{ fontWeight: 600, fontSize: 13.5 }}>{account.toolkitName}</span> <span style={{ fontSize: "var(--fs-body)" }}>{account.toolkitName}</span>
<span style={{ color: "var(--text-2)", fontSize: 12.5 }}>{account.label}</span> <span style={{ color: "var(--text-2)", fontSize: "var(--fs-body)" }}>{account.label}</span>
<Pill tone={STATUS_TONE[account.status]} dot>{account.status.charAt(0) + account.status.slice(1).toLowerCase()}</Pill> <Pill tone={STATUS_TONE[account.status]} dot>{account.status.charAt(0) + account.status.slice(1).toLowerCase()}</Pill>
{account.pendingAccountId && <Pill tone="amber" dot>{t("Reconnect waiting for authorization")}</Pill>} {account.pendingAccountId && <Pill tone="amber" dot>{t("Reconnect waiting for authorization")}</Pill>}
<span className="row" style={{ gap: 6, marginLeft: "auto" }}> <span className="row" style={{ gap: 6, marginLeft: "auto" }}>
@@ -96,7 +96,7 @@ export function ConnectedList({
{holders.map((holder) => ( {holders.map((holder) => (
<span key={holder.agentId} className="row" style={{ gap: 2 }}> <span key={holder.agentId} className="row" style={{ gap: 2 }}>
<Pill>{holder.text}</Pill> <Pill>{holder.text}</Pill>
<IconButton icon="x" size={12} label={t("Revoke {name}", { name: holder.text })} disabled={busy} onClick={() => onRevoke(holder.agentId, account.toolkitSlug)} /> <IconButton icon="x" label={t("Revoke {name}", { name: holder.text })} disabled={busy} onClick={() => onRevoke(holder.agentId, account.toolkitSlug)} />
</span> </span>
))} ))}
{account.status === "ACTIVE" && grantable.length > 0 && ( {account.status === "ACTIVE" && grantable.length > 0 && (
@@ -7,7 +7,7 @@ export function SignInStatus({ signIn, onStop, onCheckAgain }: { signIn: SignIn;
const name = signIn.slug; const name = signIn.slug;
const failed = signIn.phase === "failed" || signIn.phase === "timed_out"; const failed = signIn.phase === "failed" || signIn.phase === "timed_out";
return ( return (
<div role={failed ? "alert" : "status"} className="row" style={{ gap: 10, fontSize: 13, marginBottom: 14, color: failed ? "var(--red)" : "var(--text-2)" }}> <div role={failed ? "alert" : "status"} className="row" style={{ gap: 10, fontSize: "var(--fs-body)", marginBottom: 14, color: failed ? "var(--red)" : "var(--text-2)" }}>
<span style={{ flex: 1, minWidth: 0 }}> <span style={{ flex: 1, minWidth: 0 }}>
{signIn.phase === "waiting" && t("Waiting for the {name} sign-in in your browser (check {check} of {checks}).", { name, check: signIn.check, checks: signIn.checks })} {signIn.phase === "waiting" && t("Waiting for the {name} sign-in in your browser (check {check} of {checks}).", { name, check: signIn.check, checks: signIn.checks })}
{signIn.phase === "connected" && t("{name} ({label}) is connected.", { name, label: signIn.label })} {signIn.phase === "connected" && t("{name} ({label}) is connected.", { name, label: signIn.label })}
@@ -20,7 +20,7 @@ export function ToolkitTile({ name, slug, logoUrl, size = 34 }: { name: string;
alt="" alt=""
width={size} width={size}
height={size} height={size}
style={{ width: size, height: size, borderRadius: 9, objectFit: "cover", flexShrink: 0 }} style={{ width: size, height: size, objectFit: "cover", flexShrink: 0 }}
/> />
); );
} }
@@ -29,14 +29,12 @@ export function ToolkitTile({ name, slug, logoUrl, size = 34 }: { name: string;
style={{ style={{
width: size, width: size,
height: size, height: size,
borderRadius: 9,
background: tileColor(slug), background: tileColor(slug),
color: "#fff", color: "#fff",
display: "inline-flex", display: "inline-flex",
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
fontSize: size * 0.44, fontSize: "var(--fs-body)",
fontWeight: 600,
flexShrink: 0, flexShrink: 0,
}} }}
> >
@@ -67,14 +65,14 @@ export function ToolkitCatalog({
<section> <section>
<div className="row" style={{ marginBottom: 12, gap: 10 }}> <div className="row" style={{ marginBottom: 12, gap: 10 }}>
<div className="section-label" style={{ flex: 1 }}>{t("Catalog")}</div> <div className="section-label" style={{ flex: 1 }}>{t("Catalog")}</div>
<div className="row" style={{ gap: 6, background: "var(--panel-2)", borderRadius: 8, padding: "5px 10px", width: 240 }}> <div className="row" style={{ gap: 6, background: "var(--panel-2)", padding: "5px 10px", width: 240 }}>
<Icon name="search" size={13} color="var(--text-3)" /> <Icon name="search" color="var(--text-3)" />
<input <input
aria-label={t("Search connectors")} aria-label={t("Search connectors")}
value={query} value={query}
onChange={(event) => setQuery(event.target.value)} onChange={(event) => setQuery(event.target.value)}
placeholder={t("Search connectors")} placeholder={t("Search connectors")}
style={{ border: 0, outline: 0, background: "transparent", fontSize: 13, flex: 1, minWidth: 0, color: "var(--text-1)" }} style={{ border: 0, outline: 0, background: "transparent", fontSize: "var(--fs-body)", flex: 1, minWidth: 0, color: "var(--text-1)" }}
/> />
</div> </div>
</div> </div>
@@ -86,7 +84,6 @@ export function ToolkitCatalog({
key={entry.slug} key={entry.slug}
style={{ style={{
border: "1px solid var(--border)", border: "1px solid var(--border)",
borderRadius: 12,
padding: 12, padding: 12,
background: "var(--panel)", background: "var(--panel)",
display: "flex", display: "flex",
@@ -95,7 +92,7 @@ export function ToolkitCatalog({
}} }}
> >
<ToolkitTile name={entry.name} slug={entry.slug} logoUrl={entry.logoUrl} /> <ToolkitTile name={entry.name} slug={entry.slug} logoUrl={entry.logoUrl} />
<span style={{ fontWeight: 600, fontSize: 13.5, flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <span style={{ fontSize: "var(--fs-body)", flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{entry.name} {entry.name}
</span> </span>
{connected ? ( {connected ? (
+2 -5
View File
@@ -9,7 +9,7 @@ export function FileIcon({ kind, big = false }: { kind: string; big?: boolean })
if (kind === "folder") { if (kind === "folder") {
return ( return (
<div style={{ width: big ? 28 : 22, height: big ? 28 : 22, display: "grid", placeItems: "center", color: "var(--text-3)" }}> <div style={{ width: big ? 28 : 22, height: big ? 28 : 22, display: "grid", placeItems: "center", color: "var(--text-3)" }}>
<Icon name="folder" size={big ? 22 : 17} /> <Icon name="folder" />
</div> </div>
); );
} }
@@ -20,14 +20,11 @@ export function FileIcon({ kind, big = false }: { kind: string; big?: boolean })
style={{ style={{
width: big ? 28 : 22, width: big ? 28 : 22,
height: big ? 28 : 22, height: big ? 28 : 22,
borderRadius: big ? 6 : 4,
background: `${map.color}14`, background: `${map.color}14`,
color: map.color, color: map.color,
display: "grid", display: "grid",
placeItems: "center", placeItems: "center",
fontSize: big ? 9 : 8, fontSize: "var(--fs-body)",
fontWeight: 700,
letterSpacing: 0.5,
}} }}
> >
{label} {label}
+8 -18
View File
@@ -26,7 +26,7 @@ export function FilesGrid({
onTogglePin: (file: FileObjectRecord) => void; onTogglePin: (file: FileObjectRecord) => void;
}) { }) {
return ( return (
<div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(220px, 1fr))", gap: 12 }}> <div className="inventory">
{files.map((file) => ( {files.map((file) => (
<PinnedCard <PinnedCard
key={file.id} key={file.id}
@@ -58,22 +58,12 @@ export function PinnedCard({
return ( return (
<div <div
data-object-id={file.id} data-object-id={file.id}
className={canOpen ? "clickable-card" : ""} className={`inventory-slot ${canOpen ? "clickable-card" : ""}`.trim()}
role={canOpen ? "button" : undefined} role={canOpen ? "button" : undefined}
tabIndex={canOpen ? 0 : undefined} tabIndex={canOpen ? 0 : undefined}
onClick={canOpen ? onOpen : undefined} onClick={canOpen ? onOpen : undefined}
onKeyDown={canOpen ? (event) => { if (event.key === "Enter") onOpen(); } : undefined} onKeyDown={canOpen ? (event) => { if (event.key === "Enter") onOpen(); } : undefined}
style={{ style={{ cursor: canOpen ? "pointer" : "default" }}
border: "1px solid var(--border)",
borderRadius: 10,
background: "var(--panel)",
padding: 14,
display: "flex",
flexDirection: "column",
gap: 10,
minWidth: 0,
cursor: canOpen ? "pointer" : "default",
}}
> >
<div className="row" style={{ gap: 10 }}> <div className="row" style={{ gap: 10 }}>
<FileIcon kind={file.kind} big /> <FileIcon kind={file.kind} big />
@@ -83,23 +73,23 @@ export function PinnedCard({
onClick={(event) => { event.stopPropagation(); onUnpin(); }} onClick={(event) => { event.stopPropagation(); onUnpin(); }}
style={{ marginLeft: "auto", padding: 4, border: 0, background: "transparent", color: file.pinned ? "var(--accent)" : "var(--text-4)", cursor: "pointer" }} style={{ marginLeft: "auto", padding: 4, border: 0, background: "transparent", color: file.pinned ? "var(--accent)" : "var(--text-4)", cursor: "pointer" }}
> >
<Icon name="pin" size={14} /> <Icon name="pin" />
</button> </button>
</div> </div>
<div style={{ fontSize: 14, fontWeight: 540, letterSpacing: "-0.005em", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <div style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{file.name} {file.name}
</div> </div>
<div className="mono" style={{ color: "var(--text-3)", fontSize: 10, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <div className="mono" style={{ color: "var(--text-3)", fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
sha:{shortChecksum(file.sha256)} · obj:{shortObjectRef(file.storagePath)} sha:{shortChecksum(file.sha256)} · obj:{shortObjectRef(file.storagePath)}
</div> </div>
<div className="row" style={{ gap: 6 }}> <div className="row" style={{ gap: 6 }}>
<ScanPill file={file} /> <ScanPill file={file} />
<span className="mono" style={{ color: "var(--text-3)", fontSize: 12 }}>{grantCount}</span> <span className="mono" style={{ color: "var(--text-3)", fontSize: "var(--fs-body)" }}>{grantCount}</span>
</div> </div>
<ScanLabelStrip file={file} /> <ScanLabelStrip file={file} />
<div className="row" style={{ gap: 8, marginTop: "auto", minWidth: 0 }}> <div className="row" style={{ gap: 8, marginTop: "auto", minWidth: 0 }}>
<Avatar name={ownerName} size="sm" bot={isAgentOwner(file)} /> <Avatar name={ownerName} size="sm" bot={isAgentOwner(file)} />
<span style={{ fontSize: 12, color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{formatRelative(file.updatedAt ?? file.createdAt)} · {ownerName.split(" ")[0]} {formatRelative(file.updatedAt ?? file.createdAt)} · {ownerName.split(" ")[0]}
</span> </span>
</div> </div>
+5 -5
View File
@@ -77,23 +77,23 @@ function FileRow({
<div className="row" style={{ gap: 10, minWidth: 0 }}> <div className="row" style={{ gap: 10, minWidth: 0 }}>
<FileIcon kind={file.kind} /> <FileIcon kind={file.kind} />
<div style={{ display: "grid", gap: 3, minWidth: 0 }}> <div style={{ display: "grid", gap: 3, minWidth: 0 }}>
<span style={{ fontWeight: 480, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{file.name}</span> <span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{file.name}</span>
<span className="mono" style={{ color: "var(--text-3)", fontSize: 10, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <span className="mono" style={{ color: "var(--text-3)", fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
sha:{shortChecksum(file.sha256)} · obj:{shortObjectRef(file.storagePath)} sha:{shortChecksum(file.sha256)} · obj:{shortObjectRef(file.storagePath)}
</span> </span>
</div> </div>
{file.pinned && <Pill tone="violet" dot>{t("Pinned")}</Pill>} {file.pinned && <Pill tone="violet" dot>{t("Pinned")}</Pill>}
</div> </div>
<div className="num mono" style={{ color: "var(--text-3)", fontSize: 12 }}>{formatBytes(file.sizeBytes)}</div> <div className="num mono" style={{ color: "var(--text-3)", fontSize: "var(--fs-body)" }}>{formatBytes(file.sizeBytes)}</div>
<div className="row" style={{ gap: 8, minWidth: 0 }}> <div className="row" style={{ gap: 8, minWidth: 0 }}>
<Avatar name={owner} size="sm" bot={isAgentOwner(file)} /> <Avatar name={owner} size="sm" bot={isAgentOwner(file)} />
<span style={{ color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{owner}</span> <span style={{ color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{owner}</span>
</div> </div>
<div className="row" style={{ gap: 6, minWidth: 0 }}> <div className="row" style={{ gap: 6, minWidth: 0 }}>
<ScanPill file={file} /> <ScanPill file={file} />
<span className="mono" style={{ color: "var(--text-3)", fontSize: 12 }}>{grantCount}</span> <span className="mono" style={{ color: "var(--text-3)", fontSize: "var(--fs-body)" }}>{grantCount}</span>
</div> </div>
<div style={{ color: "var(--text-3)", fontSize: 12 }}>{formatRelative(file.updatedAt ?? file.createdAt)}</div> <div style={{ color: "var(--text-3)", fontSize: "var(--fs-body)" }}>{formatRelative(file.updatedAt ?? file.createdAt)}</div>
<div style={{ textAlign: "right" }} onClick={(event) => event.stopPropagation()}> <div style={{ textAlign: "right" }} onClick={(event) => event.stopPropagation()}>
<Popover trigger={({ toggle }) => <IconButton icon="more" label={t("Actions for {name}", { name: file.name })} onClick={toggle} />}> <Popover trigger={({ toggle }) => <IconButton icon="more" label={t("Actions for {name}", { name: file.name })} onClick={toggle} />}>
{(close) => ( {(close) => (
+3 -2
View File
@@ -1,4 +1,5 @@
import { Icon } from "../../shared/ui"; import { Icon } from "../../shared/ui";
import type { IconName } from "../../shared/Icon";
import type { AgentRecord, FileObjectRecord } from "../../../../shared/domain"; import type { AgentRecord, FileObjectRecord } from "../../../../shared/domain";
import { isRecent, type Section } from "./file-helpers"; import { isRecent, type Section } from "./file-helpers";
import { t } from "../../i18n/i18n"; import { t } from "../../i18n/i18n";
@@ -84,7 +85,7 @@ function TreeItem({
active, active,
onClick, onClick,
}: { }: {
icon: string; icon: IconName;
label: string; label: string;
count: number; count: number;
active: boolean; active: boolean;
@@ -92,7 +93,7 @@ function TreeItem({
}) { }) {
return ( return (
<button type="button" aria-current={active ? "true" : undefined} className={`nav-item ${active ? "active" : ""}`.trim()} onClick={onClick}> <button type="button" aria-current={active ? "true" : undefined} className={`nav-item ${active ? "active" : ""}`.trim()} onClick={onClick}>
<span className="icon-box"><Icon name={icon} size={18} /></span> <span className="icon-box"><Icon name={icon} /></span>
<span>{label}</span> <span>{label}</span>
<span className="nav-badge num">{count}</span> <span className="nav-badge num">{count}</span>
</button> </button>
+38 -25
View File
@@ -4,7 +4,8 @@ import { useState, type ReactNode, type KeyboardEvent } from "react";
import type { AgentRecord, TaskRecord } from "../../../../shared/domain"; import type { AgentRecord, TaskRecord } from "../../../../shared/domain";
import { t } from "../../i18n/i18n"; import { t } from "../../i18n/i18n";
const CHART_H = 116; /** Plot height; axis labels sit below it as HTML text. */
const PLOT_H = 100;
const CHART_W = 260; const CHART_W = 260;
const BAR_GAP = 4; const BAR_GAP = 4;
@@ -30,7 +31,7 @@ function ChartCard({ title, readout, values, point, onPoint, children }: {
}; };
return ( return (
<section className="card metric-card" aria-label={title}> <section className="card metric-card" aria-label={title}>
<div className="row" style={{ marginBottom: 12, gap: 8 }}> <div style={{ display: "grid", gap: 4, marginBottom: 12 }}>
<span className="card-label">{title}</span> <span className="card-label">{title}</span>
<span className="metric-readout num" aria-live="polite">{readout}</span> <span className="metric-readout num" aria-live="polite">{readout}</span>
</div> </div>
@@ -60,28 +61,27 @@ export function AgentWorkloadChart({ agents, tasks }: { agents: AgentRecord[]; t
return ( return (
<ChartCard title={t("Agent workload")} readout={readout} values={data.map((d) => `${d.label}: ${d.count}`)} point={hover} onPoint={setHover}> <ChartCard title={t("Agent workload")} readout={readout} values={data.map((d) => `${d.label}: ${d.count}`)} point={hover} onPoint={setHover}>
<svg viewBox={`0 0 ${CHART_W} ${CHART_H}`} style={{ width: "100%", height: CHART_H }}> <svg viewBox={`0 0 ${CHART_W} ${PLOT_H}`} preserveAspectRatio="none" shapeRendering="crispEdges" style={{ width: "100%", height: PLOT_H }}>
{data.map((d, i) => { {data.map((d, i) => {
const h = (d.count / max) * (CHART_H - 22); const h = (d.count / max) * (PLOT_H - 6);
const x = i * (barW + BAR_GAP); const x = i * (barW + BAR_GAP);
return ( return (
<g key={d.key} onMouseEnter={() => setHover(i)} onMouseLeave={() => setHover(null)}> <g key={d.key} onMouseEnter={() => setHover(i)} onMouseLeave={() => setHover(null)}>
<rect x={x} y={0} width={barW} height={CHART_H - 16} fill="transparent" /> <rect x={x} y={0} width={barW} height={PLOT_H} fill="transparent" />
<rect <rect
x={x} x={x}
y={CHART_H - h - 16} y={PLOT_H - h}
width={barW} width={barW}
height={Math.max(2, h)} height={Math.max(2, h)}
rx={4}
fill="var(--accent)" fill="var(--accent)"
opacity={hover === null || hover === i ? 0.85 : 0.32} opacity={hover === null || hover === i ? 0.85 : 0.32}
style={{ transition: "opacity var(--motion-fast) var(--ease-out)" }} style={{ transition: "opacity var(--motion-fast) var(--ease-out)" }}
/> />
<text x={x + barW / 2} y={CHART_H - 2} textAnchor="middle" fontSize="9" fill="var(--text-3)">{d.label}</text>
</g> </g>
); );
})} })}
</svg> </svg>
<ChartAxis labels={data.map((d) => d.label)} />
</ChartCard> </ChartCard>
); );
} }
@@ -96,28 +96,27 @@ export function RunActivityChart({ days }: { days: UsageDays }) {
return ( return (
<ChartCard title={t("Run activity")} readout={readout} values={buckets.map((b) => `${b.label}: ${b.count}`)} point={hover} onPoint={setHover}> <ChartCard title={t("Run activity")} readout={readout} values={buckets.map((b) => `${b.label}: ${b.count}`)} point={hover} onPoint={setHover}>
<svg viewBox={`0 0 ${CHART_W} ${CHART_H}`} style={{ width: "100%", height: CHART_H }}> <svg viewBox={`0 0 ${CHART_W} ${PLOT_H}`} preserveAspectRatio="none" shapeRendering="crispEdges" style={{ width: "100%", height: PLOT_H }}>
{buckets.map((b, i) => { {buckets.map((b, i) => {
const h = (b.count / max) * (CHART_H - 24); const h = (b.count / max) * (PLOT_H - 6);
const x = i * (barW + BAR_GAP); const x = i * (barW + BAR_GAP);
return ( return (
<g key={`${b.label}-${i}`} onMouseEnter={() => setHover(i)} onMouseLeave={() => setHover(null)}> <g key={`${b.label}-${i}`} onMouseEnter={() => setHover(i)} onMouseLeave={() => setHover(null)}>
<rect x={x} y={0} width={barW} height={CHART_H - 16} fill="transparent" /> <rect x={x} y={0} width={barW} height={PLOT_H} fill="transparent" />
<rect <rect
x={x} x={x}
y={CHART_H - h - 16} y={PLOT_H - h}
width={barW} width={barW}
height={Math.max(2, h)} height={Math.max(2, h)}
rx={4}
fill="var(--text-1)" fill="var(--text-1)"
opacity={hover === null || hover === i ? 0.82 : 0.28} opacity={hover === null || hover === i ? 0.82 : 0.28}
style={{ transition: "opacity var(--motion-fast) var(--ease-out)" }} style={{ transition: "opacity var(--motion-fast) var(--ease-out)" }}
/> />
<text x={x + barW / 2} y={CHART_H - 2} textAnchor="middle" fontSize="9" fill="var(--text-3)">{b.label}</text>
</g> </g>
); );
})} })}
</svg> </svg>
<ChartAxis labels={buckets.map((b) => b.label)} />
</ChartCard> </ChartCard>
); );
} }
@@ -139,16 +138,18 @@ export function AcceptanceChart({ days }: { days: UsageDays }) {
readout={t("{accepted} done · {returned} sent back · sessions: {ok} ended, {failed} failed", { accepted, returned, ok: completed, failed })} readout={t("{accepted} done · {returned} sent back · sessions: {ok} ended, {failed} failed", { accepted, returned, ok: completed, failed })}
values={[judged > 0 ? t("{rate}% of judged work accepted", { rate }) : t("No work judged yet")]} values={[judged > 0 ? t("{rate}% of judged work accepted", { rate }) : t("No work judged yet")]}
> >
<svg viewBox="0 0 100 100" style={{ width: 96, height: 96, margin: "4px auto", display: "block" }}> <div style={{ position: "relative", width: 96, height: 96, margin: "4px auto" }}>
<svg viewBox="0 0 100 100" shapeRendering="crispEdges" style={{ width: 96, height: 96, display: "block" }}>
<circle cx="50" cy="50" r="42" fill="none" stroke="var(--panel-3)" strokeWidth="8" /> <circle cx="50" cy="50" r="42" fill="none" stroke="var(--panel-3)" strokeWidth="8" />
<circle <circle
cx="50" cy="50" r="42" fill="none" stroke="var(--green)" strokeWidth="8" cx="50" cy="50" r="42" fill="none" stroke="var(--green)" strokeWidth="8"
strokeDasharray={circumference} strokeDashoffset={offset} strokeDasharray={circumference} strokeDashoffset={offset}
strokeLinecap="round" transform="rotate(-90 50 50)" transform="rotate(-90 50 50)"
style={{ transition: "stroke-dashoffset var(--motion-slow) var(--ease-out)" }} style={{ transition: "stroke-dashoffset var(--motion-slow) var(--ease-out)" }}
/> />
<text x="50" y="50" textAnchor="middle" dominantBaseline="central" fontSize="20" fontWeight="600" fill="var(--text-1)">{judged > 0 ? `${rate}%` : "—"}</text>
</svg> </svg>
<span className="num" style={{ position: "absolute", inset: 0, display: "grid", placeItems: "center", fontSize: "var(--fs-display)" }}>{judged > 0 ? `${rate}%` : "—"}</span>
</div>
</ChartCard> </ChartCard>
); );
} }
@@ -161,7 +162,7 @@ export function CostTrendChart({ days }: { days: UsageDays }) {
const max = Math.max(1, ...tokenBuckets.map((b) => b.tokens)); const max = Math.max(1, ...tokenBuckets.map((b) => b.tokens));
const coords = tokenBuckets.map((b, i) => ({ const coords = tokenBuckets.map((b, i) => ({
x: (i / 6) * (CHART_W - 10) + 5, x: (i / 6) * (CHART_W - 10) + 5,
y: CHART_H - 20 - (b.tokens / max) * (CHART_H - 30), y: PLOT_H - 4 - (b.tokens / max) * (PLOT_H - 8),
b, b,
})); }));
const points = coords.map((c) => `${c.x},${c.y}`).join(" "); const points = coords.map((c) => `${c.x},${c.y}`).join(" ");
@@ -175,20 +176,32 @@ export function CostTrendChart({ days }: { days: UsageDays }) {
return ( return (
<ChartCard title={t("Token usage")} readout={readout} values={tokenBuckets.map((b) => `${b.label}: ${compact(b.tokens)}`)} point={hover} onPoint={setHover}> <ChartCard title={t("Token usage")} readout={readout} values={tokenBuckets.map((b) => `${b.label}: ${compact(b.tokens)}`)} point={hover} onPoint={setHover}>
<svg viewBox={`0 0 ${CHART_W} ${CHART_H}`} style={{ width: "100%", height: CHART_H }}> <svg viewBox={`0 0 ${CHART_W} ${PLOT_H}`} shapeRendering="crispEdges" style={{ width: "100%", height: PLOT_H }}>
<polyline points={points} fill="none" stroke="var(--accent)" strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" /> <polyline points={points} fill="none" stroke="var(--accent)" strokeWidth="2" />
{coords.map((c, i) => ( {coords.map((c, i) => {
const side = hover === i ? 8 : 6;
return (
<g key={`${c.b.label}-${i}`} onMouseEnter={() => setHover(i)} onMouseLeave={() => setHover(null)}> <g key={`${c.b.label}-${i}`} onMouseEnter={() => setHover(i)} onMouseLeave={() => setHover(null)}>
<circle cx={c.x} cy={c.y} r="9" fill="transparent" /> <rect x={c.x - 9} y={c.y - 9} width={18} height={18} fill="transparent" />
<circle cx={c.x} cy={c.y} r={hover === i ? 4 : 3} fill="var(--accent)" style={{ transition: "r var(--motion-fast) var(--ease-out)" }} /> <rect x={c.x - side / 2} y={c.y - side / 2} width={side} height={side} fill="var(--accent)" />
<text x={c.x} y={CHART_H - 2} textAnchor="middle" fontSize="9" fill="var(--text-3)">{c.b.label}</text>
</g> </g>
))} );
})}
</svg> </svg>
<ChartAxis labels={tokenBuckets.map((b) => b.label)} />
</ChartCard> </ChartCard>
); );
} }
/** Axis labels as pixel text, one evenly spaced cell per datum under the plot. */
function ChartAxis({ labels }: { labels: string[] }) {
return (
<div aria-hidden="true" style={{ display: "flex", marginTop: 2, fontSize: "var(--fs-caption)", color: "var(--text-3)" }}>
{labels.map((label, index) => <span key={index} style={{ flex: 1, textAlign: "center", overflow: "hidden", whiteSpace: "nowrap" }}>{label}</span>)}
</div>
);
}
function compact(count: number): string { function compact(count: number): string {
if (count >= 1_000_000) return `${(count / 1_000_000).toFixed(1)}M`; if (count >= 1_000_000) return `${(count / 1_000_000).toFixed(1)}M`;
if (count >= 1000) return `${(count / 1000).toFixed(count >= 10000 ? 0 : 1)}k`; if (count >= 1000) return `${(count / 1000).toFixed(count >= 10000 ? 0 : 1)}k`;
+5 -5
View File
@@ -5,8 +5,8 @@ import { Button, Icon, Pill } from "../../shared/ui";
import type { NextUpItem } from "./next-up"; import type { NextUpItem } from "./next-up";
const SHOWN = 3; const SHOWN = 3;
const TITLE = { fontSize: 14, fontWeight: 500, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } as const; const TITLE = { fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } as const;
const META = { fontSize: 12, color: "var(--text-3)", margin: "2px 0 8px" } as const; const META = { fontSize: "var(--fs-body)", color: "var(--text-3)", margin: "2px 0 8px" } as const;
/** Home's one place for what to look at next: decisions and stopped work in priority order, or else the next task in line. */ /** Home's one place for what to look at next: decisions and stopped work in priority order, or else the next task in line. */
export function NextUpCard({ export function NextUpCard({
@@ -35,8 +35,8 @@ export function NextUpCard({
</div> </div>
{needsYou.length === 0 ? ( {needsYou.length === 0 ? (
<> <>
<div className="row" style={{ gap: 8, color: "var(--text-3)", fontSize: 14, marginBottom: 12 }}> <div className="row" style={{ gap: 8, color: "var(--text-3)", fontSize: "var(--fs-body)", marginBottom: 12 }}>
<Icon name="check" size={16} /><span>{t("You're all caught up")}</span> <Icon name="check" /><span>{t("You're all caught up")}</span>
</div> </div>
{next?.kind === "next" && ( {next?.kind === "next" && (
<div> <div>
@@ -68,7 +68,7 @@ export function NextUpCard({
<Button size="small" onClick={() => onOpenTask(item.task.id)}>{t("Open")}</Button> <Button size="small" onClick={() => onOpenTask(item.task.id)}>{t("Open")}</Button>
</li> </li>
) : null)} ) : null)}
{more > 0 && <li style={{ fontSize: 12, color: "var(--text-3)" }}>{t("{n} more after these", { n: more })}</li>} {more > 0 && <li style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("{n} more after these", { n: more })}</li>}
</ol> </ol>
)} )}
</section> </section>
@@ -97,14 +97,14 @@ export function DocumentsPanel({
style={{ display: "grid", justifyItems: "start", gap: 2 }} style={{ display: "grid", justifyItems: "start", gap: 2 }}
> >
<span>{doc.title}</span> <span>{doc.title}</span>
<span style={{ fontSize: 12, color: "var(--text-3)" }}>{doc.docType} · v{doc.version} · {formatTime(doc.updatedAt)}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{doc.docType} · v{doc.version} · {formatTime(doc.updatedAt)}</span>
</button> </button>
))} ))}
</div> </div>
{selected && ( {selected && (
<article aria-label={selected.title} style={{ minWidth: 0 }}> <article aria-label={selected.title} style={{ minWidth: 0 }}>
<div className="row" style={{ gap: 8, marginBottom: 8, flexWrap: "wrap" }}> <div className="row" style={{ gap: 8, marginBottom: 8, flexWrap: "wrap" }}>
<h2 style={{ margin: 0, fontSize: 18 }}>{shown?.title ?? selected.title}</h2> <h2 style={{ margin: 0, fontSize: "var(--fs-display)" }}>{shown?.title ?? selected.title}</h2>
<Pill>{selected.docType}</Pill> <Pill>{selected.docType}</Pill>
<Pill tone={selected.status === "approved" ? "green" : undefined}>{documentStatusLabel(shown?.status ?? selected.status)}</Pill> <Pill tone={selected.status === "approved" ? "green" : undefined}>{documentStatusLabel(shown?.status ?? selected.status)}</Pill>
</div> </div>
@@ -131,7 +131,7 @@ export function KnowledgePanel({
style={{ display: "grid", justifyItems: "start", gap: 2 }} style={{ display: "grid", justifyItems: "start", gap: 2 }}
> >
<span>{entry.topic}</span> <span>{entry.topic}</span>
<span style={{ fontSize: 12, color: "var(--text-3)" }}>{entry.category} · {entry.scopeType} · {entry.importance}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{entry.category} · {entry.scopeType} · {entry.importance}</span>
</button> </button>
))} ))}
</div> </div>
@@ -139,7 +139,7 @@ export function KnowledgePanel({
{selected && ( {selected && (
<article aria-label={selected.topic} style={{ minWidth: 0 }}> <article aria-label={selected.topic} style={{ minWidth: 0 }}>
<div className="row" style={{ gap: 8, marginBottom: 8, flexWrap: "wrap" }}> <div className="row" style={{ gap: 8, marginBottom: 8, flexWrap: "wrap" }}>
<h2 style={{ margin: 0, fontSize: 18 }}>{selected.topic}</h2> <h2 style={{ margin: 0, fontSize: "var(--fs-display)" }}>{selected.topic}</h2>
<Pill>{selected.category}</Pill> <Pill>{selected.category}</Pill>
<Pill>{selected.scopeType}</Pill> <Pill>{selected.scopeType}</Pill>
<Pill tone={entryState(selected, now) === "active" ? "green" : "amber"}>{entryState(selected, now)}</Pill> <Pill tone={entryState(selected, now) === "active" ? "green" : "amber"}>{entryState(selected, now)}</Pill>
@@ -155,7 +155,7 @@ export function KnowledgePanel({
<ol style={{ display: "grid", gap: 10, paddingLeft: 18 }}> <ol style={{ display: "grid", gap: 10, paddingLeft: 18 }}>
{revisions.map((revision) => ( {revisions.map((revision) => (
<li key={revision.revision}> <li key={revision.revision}>
<div style={{ fontSize: 12, color: "var(--text-3)" }}> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>
r{revision.revision} · {formatTime(revision.createdAt)} · {revision.changedByType} · {revision.reason} r{revision.revision} · {formatTime(revision.createdAt)} · {revision.changedByType} · {revision.reason}
</div> </div>
<div style={{ whiteSpace: "pre-wrap" }}>{revision.content}</div> <div style={{ whiteSpace: "pre-wrap" }}>{revision.content}</div>
@@ -1,13 +1,16 @@
import { Avatar, Icon, IconButton, Pill } from "../../shared/ui"; import { Icon, IconButton, Pill } from "../../shared/ui";
import { officeActivityLabel, roleLevelLabel } from "../../i18n/labels"; import { officeStateLabel, roleLevelLabel } from "../../i18n/labels";
import { t } from "../../i18n/i18n"; import { t } from "../../i18n/i18n";
import type { AgentActivity, OfficeAgentInput } from "./office-types"; import { TaskHoldNotice } from "../work/TaskHoldNotice";
import type { OfficeAgentInput } from "./office-types";
import { PixelAvatar } from "./PixelAvatar";
import type { OfficeState } from "./agent-state";
const STATE_TONE: Record<OfficeState, "green" | "amber" | "red" | undefined> = {
const ACTIVITY_TONE: Record<AgentActivity, "green" | "violet" | "amber" | undefined> = { running: "green",
active: "green", queued: undefined,
thinking: "violet", cooldown: "amber",
busy: "amber", blocked: "red",
idle: undefined, idle: undefined,
}; };
@@ -15,7 +18,7 @@ const ACTIVITY_TONE: Record<AgentActivity, "green" | "violet" | "amber" | undefi
* Floating profile card for the agent selected on the office floor. The page * Floating profile card for the agent selected on the office floor. The page
* owns its placement (it follows the sprite); the card only sizes itself. * owns its placement (it follows the sprite); the card only sizes itself.
*/ */
export function AgentDetailCard({ agent, onClose }: { agent: OfficeAgentInput; onClose: () => void }) { export function AgentDetailCard({ agent, isCeo, onClose }: { agent: OfficeAgentInput; isCeo: boolean; onClose: () => void }) {
return ( return (
<div <div
role="dialog" role="dialog"
@@ -24,30 +27,30 @@ export function AgentDetailCard({ agent, onClose }: { agent: OfficeAgentInput; o
width: 264, width: 264,
background: "var(--panel)", background: "var(--panel)",
border: "1px solid var(--border-strong)", border: "1px solid var(--border-strong)",
borderRadius: 12,
boxShadow: "0 12px 32px rgba(16,16,24,0.18)", boxShadow: "0 12px 32px rgba(16,16,24,0.18)",
padding: 14, padding: 14,
}} }}
> >
<div className="row" style={{ gap: 10, alignItems: "flex-start" }}> <div className="row" style={{ gap: 10, alignItems: "flex-start" }}>
<Avatar name={agent.name} size="lg" bot /> <PixelAvatar id={agent.id} isCeo={isCeo} />
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 14, fontWeight: 600, lineHeight: 1.3, wordBreak: "break-word" }}>{agent.name}</div> <div style={{ fontSize: "var(--fs-body)", lineHeight: 1.3, wordBreak: "break-word" }}>{agent.name}</div>
<div style={{ fontSize: 12, color: "var(--text-2)", marginTop: 1, wordBreak: "break-word" }}>{agent.title}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-2)", marginTop: 1, wordBreak: "break-word" }}>{agent.title}</div>
</div> </div>
<IconButton icon="x" label={t("Close agent details")} onClick={onClose} /> <IconButton icon="x" label={t("Close agent details")} onClick={onClose} />
</div> </div>
<div className="row" style={{ gap: 6, marginTop: 10, flexWrap: "wrap" }}> <div className="row" style={{ gap: 6, marginTop: 10, flexWrap: "wrap" }}>
<Pill>{agent.department}</Pill> <Pill>{agent.department}</Pill>
<Pill>{roleLevelLabel(agent.roleLevel)}</Pill> <Pill>{roleLevelLabel(agent.roleLevel)}</Pill>
<Pill tone={ACTIVITY_TONE[agent.activity]} dot>{officeActivityLabel(agent.activity)}</Pill> <Pill tone={STATE_TONE[agent.status.state]} dot>{officeStateLabel(agent.status.state)}</Pill>
</div> </div>
{agent.status.hold && <div style={{ marginTop: 10 }}><TaskHoldNotice hold={agent.status.hold} /></div>}
{agent.taskTitle && ( {agent.taskTitle && (
<div className="row" style={{ gap: 7, marginTop: 12, alignItems: "flex-start" }}> <div className="row" style={{ gap: 7, marginTop: 12, alignItems: "flex-start" }}>
<Icon name="work" size={13} color="var(--text-3)" /> <Icon name="work" color="var(--text-3)" />
<span <span
style={{ style={{
fontSize: 12, fontSize: "var(--fs-body)",
color: "var(--text-2)", color: "var(--text-2)",
lineHeight: 1.45, lineHeight: 1.45,
display: "-webkit-box", display: "-webkit-box",
@@ -0,0 +1,24 @@
import { useEffect, useRef } from "react";
import { appearanceFor, drawPerson } from "./sprites";
const W = 24;
const H = 24;
/** Each sprite pixel shows as a 2×2 block. */
const ZOOM = 2;
/** The person as the office draws them, from the shoulders up, so a face on the org chart is the same face at the desk. */
export function PixelAvatar({ id, isCeo }: { id: string; isCeo: boolean }) {
const ref = useRef<HTMLCanvasElement>(null);
useEffect(() => {
const canvas = ref.current!;
const scale = ZOOM * Math.max(1, Math.ceil(window.devicePixelRatio));
canvas.width = W * scale;
canvas.height = H * scale;
const ctx = canvas.getContext("2d");
if (!ctx) throw new Error("The avatar canvas has no 2D context.");
ctx.imageSmoothingEnabled = false;
ctx.setTransform(scale, 0, 0, scale, 0, 0);
drawPerson(ctx, W / 2, H + 10, appearanceFor(id, isCeo), { facing: "south", walkPhase: 0, working: false, carrying: null, timeMs: 0, animSeed: 0 }, isCeo);
}, [id, isCeo]);
return <canvas ref={ref} className="pixel-avatar" data-person={id} aria-hidden="true" style={{ width: W * ZOOM, height: H * ZOOM }} />;
}
@@ -0,0 +1,33 @@
import type { TaskHold } from "../../../../shared/domain";
import { t } from "../../i18n/i18n";
/** What an agent in the office is doing, from real records: a running session, work held for the operator or a provider cooldown, a queued session, or nothing. */
export type OfficeState = "running" | "blocked" | "cooldown" | "queued" | "idle";
export interface OfficeStatus {
state: OfficeState;
/** What holds a blocked or cooling-down agent. */
hold: TaskHold | null;
}
interface Inputs {
runs: Array<{ agentId: string | null; state: string }>;
tasks: Array<{ id: string; assigneeAgentId: string | null; status: string; hold: TaskHold | null }>;
approvals: Array<{ sourceEntityType: string | null; sourceEntityId: string | null; state: string }>;
}
/** The one state an agent shows: running beats blocked, which beats a cooldown, which beats a queued session. */
export function officeStatus(agentId: string, inputs: Inputs): OfficeStatus {
const runs = inputs.runs.filter((run) => run.agentId === agentId);
if (runs.some((run) => run.state === "running")) return { state: "running", hold: null };
const open = inputs.tasks.filter((task) => task.assigneeAgentId === agentId && task.status !== "done");
const holds = open.filter((task) => task.hold !== null).map((task) => task.hold!);
const operator = holds.find((hold) => hold.waitingOn === "operator");
if (operator) return { state: "blocked", hold: operator };
const awaitingApproval = inputs.approvals.some((approval) => approval.state === "pending" && approval.sourceEntityType === "task" && open.some((task) => task.id === approval.sourceEntityId));
if (awaitingApproval) return { state: "blocked", hold: { reason: t("Waiting for your approval."), waitingOn: "operator", resumesAt: null } };
const provider = holds.find((hold) => hold.waitingOn === "provider");
if (provider) return { state: "cooldown", hold: provider };
if (runs.some((run) => run.state === "queued")) return { state: "queued", hold: null };
return { state: "idle", hold: null };
}
+88
View File
@@ -0,0 +1,88 @@
import type { Rect, Vec } from "./office-types";
// 2:1 isometric projection of the plan; the simulation stays in plan units, depth grows with x + y.
const K = 0.5;
/** Head room above the plan's north edge for the back wall and signs. */
export const SKY_MARGIN = 64;
/** Height of the back (north and west) walls, in iso pixels. */
export const BACK_WALL_H = 48;
export interface IsoFrame {
originX: number;
size: { w: number; h: number };
}
export function isoFrame(world: { w: number; h: number }): IsoFrame {
return { originX: world.h * K, size: { w: (world.w + world.h) * K, h: ((world.w + world.h) * K) / 2 + SKY_MARGIN } };
}
export function toIso(frame: IsoFrame, p: Vec, z = 0): Vec {
return { x: frame.originX + (p.x - p.y) * K, y: SKY_MARGIN + ((p.x + p.y) * K) / 2 - z };
}
/** The ground-plane point under an iso pixel. */
export function fromIso(frame: IsoFrame, s: Vec): Vec {
const difference = (s.x - frame.originX) / K;
const sum = ((s.y - SKY_MARGIN) * 2) / K;
return { x: (sum + difference) / 2, y: (sum - difference) / 2 };
}
export function depthOf(p: Vec): number {
return p.x + p.y;
}
/** Draws plan-space art (rects in plan units) flat onto the iso ground. */
export function setGroundTransform(ctx: CanvasRenderingContext2D, frame: IsoFrame): void {
ctx.transform(K, K / 2, -K, K / 2, frame.originX, SKY_MARGIN);
}
/** Draws face-space art onto a south-facing face at plan y = `planeY` whose top is at height `topZ`: x runs along the face, y down from its top. */
export function setSouthFaceTransform(ctx: CanvasRenderingContext2D, frame: IsoFrame, planeY: number, topZ: number): void {
ctx.transform(K, K / 2, 0, 1, frame.originX - planeY * K, SKY_MARGIN + (planeY * K) / 2 - topZ);
}
export interface BoxColors {
top: string;
south: string;
east: string;
}
/** An extruded block over a plan footprint, from `z` up `height` iso pixels; its top and two camera-facing sides. */
export function drawBox(ctx: CanvasRenderingContext2D, frame: IsoFrame, foot: Rect, z: number, height: number, colors: BoxColors): void {
const x0 = foot.x;
const y0 = foot.y;
const x1 = foot.x + foot.w;
const y1 = foot.y + foot.h;
const top = z + height;
polygon(ctx, colors.south, [toIso(frame, { x: x0, y: y1 }, z), toIso(frame, { x: x1, y: y1 }, z), toIso(frame, { x: x1, y: y1 }, top), toIso(frame, { x: x0, y: y1 }, top)]);
polygon(ctx, colors.east, [toIso(frame, { x: x1, y: y1 }, z), toIso(frame, { x: x1, y: y0 }, z), toIso(frame, { x: x1, y: y0 }, top), toIso(frame, { x: x1, y: y1 }, top)]);
polygon(ctx, colors.top, [toIso(frame, { x: x0, y: y0 }, top), toIso(frame, { x: x1, y: y0 }, top), toIso(frame, { x: x1, y: y1 }, top), toIso(frame, { x: x0, y: y1 }, top)]);
}
function polygon(ctx: CanvasRenderingContext2D, color: string, points: Vec[]): void {
ctx.fillStyle = color;
ctx.beginPath();
ctx.moveTo(Math.round(points[0]!.x), Math.round(points[0]!.y));
for (const point of points.slice(1)) ctx.lineTo(Math.round(point.x), Math.round(point.y));
ctx.closePath();
ctx.fill();
}
/** Sprite box around a person's feet in iso pixels, matching how sprites are drawn. */
const SPRITE = { halfW: 10, above: 40, below: 4 };
/** The person whose drawn sprite covers an iso point, frontmost first; at equal depth the later one, as it is drawn on top. */
export function pickAt<T extends Vec>(frame: IsoFrame, people: T[], point: Vec): T | null {
let hit: T | null = null;
for (const person of people) {
const feet = toIso(frame, person);
const inside = Math.abs(point.x - feet.x) <= SPRITE.halfW && point.y >= feet.y - SPRITE.above && point.y <= feet.y + SPRITE.below;
if (inside && (hit === null || depthOf(person) >= depthOf(hit))) hit = person;
}
return hit;
}
/** Screen size of one iso pixel in CSS px: two CSS px rounded to whole device pixels. */
export function isoPixelSize(devicePixelRatio: number): number {
return Math.max(1, Math.round(2 * devicePixelRatio)) / devicePixelRatio;
}
+115 -78
View File
@@ -1,12 +1,15 @@
import type { AgentActivity, Camera, FloorPlan, Rect } from "./office-types"; import type { Camera, FloorPlan, Rect } from "./office-types";
import { deskScreenRect, drawWorld } from "./scene-renderer"; import type { OfficeState } from "./agent-state";
import { skyScene } from "./sky"; import { drawBackWalls, drawGround, sceneDrawables, type Drawable } from "./scene-renderer";
import { depthOf, toIso, type IsoFrame } from "./iso";
import { skyScene, weatherFor } from "./sky";
import { drawPerson, type Carrying, type Facing, type SpriteAppearance } from "./sprites"; import { drawPerson, type Carrying, type Facing, type SpriteAppearance } from "./sprites";
import type { DayPart, Season } from "../../shared/palette-clock";
export interface RenderPerson { export interface RenderPerson {
id: string; id: string;
name: string; name: string;
activity: AgentActivity; state: OfficeState;
x: number; x: number;
y: number; y: number;
desk: Rect | null; desk: Rect | null;
@@ -19,10 +22,40 @@ export interface RenderPerson {
carrying: Carrying; carrying: Carrying;
} }
const ACTIVITY_DOT: Partial<Record<AgentActivity, string>> = { /** One frame's inputs: the scene in iso pixels, and how those pixels land on the screen. */
active: "#34d399", export interface OfficeFrame {
thinking: "#818cf8", frame: IsoFrame;
busy: "#f59e0b", plan: FloorPlan;
/** Camera top-left, in iso pixels. */
camera: Camera;
/** CSS px per iso pixel. */
pixel: number;
/** CSS px per pixel-font pixel, for the crisp text drawn over the scene. */
fontScale: number;
viewW: number;
viewH: number;
people: RenderPerson[];
timeMs: number;
clock: Date;
dayPart: DayPart;
season: Season;
selectedId: string | null;
}
/** Marker over the head: green running, grey queued, amber cooling down, red blocked; none when idle. */
const STATE_MARK: Partial<Record<OfficeState, string>> = {
running: "#34d399",
queued: "#9aa3b2",
cooldown: "#f59e0b",
blocked: "#ef4444",
};
/** The day part washes over the whole floor: warm at dawn and dusk, blue at night. */
const DAY_TINT: Record<DayPart, string | null> = {
dawn: "#f3d9d6",
day: null,
dusk: "#f0c6a0",
night: "#7d8bc0",
}; };
export function hashString(value: string): number { export function hashString(value: string): number {
@@ -31,94 +64,98 @@ export function hashString(value: string): number {
return Math.abs(hash); return Math.abs(hash);
} }
/** /** Draws the scene at iso-pixel resolution on `scene`, depth-sorted, then scales it up unsmoothed onto `ctx` and writes labels in the pixel font. */
* Composes one frame: static world under the camera transform, then desks' export function renderOffice(ctx: CanvasRenderingContext2D, scene: HTMLCanvasElement, input: OfficeFrame): void {
* activity glow, then people (painter's order by y) with full-name labels. const sceneW = Math.ceil(input.viewW / input.pixel);
*/ const sceneH = Math.ceil(input.viewH / input.pixel);
export function renderOffice( if (scene.width !== sceneW || scene.height !== sceneH) {
ctx: CanvasRenderingContext2D, scene.width = sceneW;
viewW: number, scene.height = sceneH;
viewH: number,
plan: FloorPlan,
camera: Camera,
people: RenderPerson[],
timeMs: number,
clock: Date,
selectedId: string | null,
): void {
ctx.fillStyle = "#14161c";
ctx.fillRect(0, 0, viewW, viewH);
ctx.save();
ctx.translate(-camera.x, -camera.y);
drawWorld(ctx, plan, { x: camera.x, y: camera.y, w: viewW, h: viewH }, skyScene(clock));
for (const person of people) {
if (!person.desk) continue;
if (person.activity !== "active" && person.activity !== "thinking") continue;
const screen = deskScreenRect(person.desk);
ctx.fillStyle = "#1c3a2c";
ctx.fillRect(screen.x, screen.y, screen.w, screen.h);
ctx.fillStyle = "#37d38a";
const lines = 3 + (hashString(person.id) % 3);
for (let i = 0; i < lines; i++) {
const width = 6 + ((hashString(person.id) >> (i * 3)) % 14);
ctx.fillRect(screen.x + 3, screen.y + 3 + i * 3, width, 1);
} }
const sctx = scene.getContext("2d");
if (!sctx) throw new Error("The office scene canvas has no 2D context.");
sctx.setTransform(1, 0, 0, 1, 0, 0);
sctx.fillStyle = "#14161c";
sctx.fillRect(0, 0, sceneW, sceneH);
sctx.translate(-Math.round(input.camera.x), -Math.round(input.camera.y));
drawGround(sctx, input.frame, input.plan);
drawBackWalls(sctx, input.frame, input.plan, { sky: skyScene(input.clock), weather: weatherFor(input.clock), clock: input.clock, timeMs: input.timeMs });
const screens = new Map(input.people.filter((person) => person.desk).map((person) => [person.desk!, person.state]));
const items: Drawable[] = [...sceneDrawables(input.frame, input.plan, input.season, screens, input.timeMs), ...input.people.map((person) => personDrawable(input, person))];
items.sort((a, b) => a.depth - b.depth);
for (const item of items) item.draw(sctx);
const tint = DAY_TINT[input.dayPart];
if (tint) {
sctx.setTransform(1, 0, 0, 1, 0, 0);
sctx.globalCompositeOperation = "multiply";
sctx.fillStyle = tint;
sctx.fillRect(0, 0, sceneW, sceneH);
sctx.globalCompositeOperation = "source-over";
} }
const ordered = [...people].sort((a, b) => a.y - b.y); ctx.imageSmoothingEnabled = false;
for (const person of ordered) { ctx.drawImage(scene, 0, 0, sceneW * input.pixel, sceneH * input.pixel);
if (person.id === selectedId) { drawLabels(ctx, input);
ctx.strokeStyle = "rgba(94,106,210,0.9)";
ctx.lineWidth = 2;
ctx.beginPath();
ctx.ellipse(Math.round(person.x), Math.round(person.y) + 2, 13, 6, 0, 0, Math.PI * 2);
ctx.stroke();
} }
const working = (person.activity === "active" || person.activity === "thinking") && person.walkPhase === 0;
drawPerson(ctx, person.x, person.y, person.appearance, { function personDrawable(input: OfficeFrame, person: RenderPerson): Drawable {
return {
// Just in front of anything sharing the same footprint centre.
depth: depthOf(person) + 0.5,
draw: (ctx) => {
const feet = toIso(input.frame, person);
if (person.id === input.selectedId) {
ctx.fillStyle = "rgba(94,106,210,0.9)";
ctx.fillRect(Math.round(feet.x) - 12, Math.round(feet.y), 24, 2);
ctx.fillRect(Math.round(feet.x) - 14, Math.round(feet.y) - 2, 2, 2);
ctx.fillRect(Math.round(feet.x) + 12, Math.round(feet.y) - 2, 2, 2);
}
const working = person.state === "running" && person.walkPhase === 0;
drawPerson(ctx, feet.x, feet.y, person.appearance, {
facing: person.facing, facing: person.facing,
walkPhase: person.walkPhase, walkPhase: person.walkPhase,
working, working,
carrying: person.carrying, carrying: person.carrying,
timeMs, timeMs: input.timeMs,
animSeed: person.animSeed, animSeed: person.animSeed,
}, person.isCeo); }, person.isCeo);
const dot = ACTIVITY_DOT[person.activity]; const dot = STATE_MARK[person.state];
if (dot) { if (dot) {
ctx.fillStyle = dot; ctx.fillStyle = dot;
ctx.beginPath(); ctx.fillRect(Math.round(feet.x) + 8, Math.round(feet.y) - 40, 4, 4);
ctx.arc(Math.round(person.x) + 10, Math.round(person.y) - 36, 3, 0, Math.PI * 2);
ctx.fill();
} }
} },
for (const person of ordered) drawNameLabel(ctx, person); };
ctx.restore();
} }
function drawNameLabel(ctx: CanvasRenderingContext2D, person: RenderPerson): void { /** Names under people and room signs over doors, in the pixel font at screen resolution so they stay crisp. */
ctx.font = "600 9px -apple-system, 'Segoe UI', sans-serif"; function drawLabels(ctx: CanvasRenderingContext2D, input: OfficeFrame): void {
const width = Math.ceil(ctx.measureText(person.name).width) + 10; const size = 12 * input.fontScale;
const x = Math.round(person.x - width / 2); ctx.font = `${size}px "Fusion Pixel"`;
const y = Math.round(person.y + 7);
ctx.fillStyle = person.isPlayer ? "rgba(94,106,210,0.92)" : "rgba(22,22,28,0.78)";
drawRoundedRect(ctx, x, y, width, 13, 4);
ctx.fillStyle = "#f2f2f5";
ctx.textAlign = "center"; ctx.textAlign = "center";
ctx.textBaseline = "middle"; ctx.textBaseline = "top";
ctx.fillText(person.name, person.x, y + 7); const screen = (x: number, y: number, z = 0) => {
const iso = toIso(input.frame, { x, y }, z);
return { x: Math.round((iso.x - Math.round(input.camera.x)) * input.pixel), y: Math.round((iso.y - Math.round(input.camera.y)) * input.pixel) };
};
for (const room of input.plan.rooms) {
const at = screen(room.doorCx, room.bounds.y + room.bounds.h, 22);
plate(ctx, room.label, at.x, at.y - size, size, "rgba(47,42,37,0.9)");
}
for (const person of [...input.people].sort((a, b) => depthOf(a) - depthOf(b))) {
const at = screen(person.x, person.y);
plate(ctx, person.name, at.x, at.y + 6 * input.pixel, size, person.isPlayer ? "rgba(94,106,210,0.92)" : "rgba(22,22,28,0.78)");
}
ctx.textAlign = "start"; ctx.textAlign = "start";
ctx.textBaseline = "alphabetic"; ctx.textBaseline = "alphabetic";
} }
function drawRoundedRect(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, r: number): void { function plate(ctx: CanvasRenderingContext2D, text: string, cx: number, top: number, size: number, background: string): void {
ctx.beginPath(); const width = Math.ceil(ctx.measureText(text).width) + size;
ctx.moveTo(x + r, y); ctx.fillStyle = background;
ctx.arcTo(x + w, y, x + w, y + h, r); ctx.fillRect(Math.round(cx - width / 2), top, width, Math.round(size * 1.5));
ctx.arcTo(x + w, y + h, x, y + h, r); ctx.fillStyle = "#f2f2f5";
ctx.arcTo(x, y + h, x, y, r); ctx.fillText(text, cx, top + Math.round(size * 0.25));
ctx.arcTo(x, y, x + w, y, r);
ctx.fill();
} }
@@ -1,3 +1,4 @@
import type { OfficeStatus } from "./agent-state";
export interface Vec { export interface Vec {
x: number; x: number;
y: number; y: number;
@@ -61,8 +62,6 @@ export interface FloorPlan {
entrance: Vec; entrance: Vec;
} }
export type AgentActivity = "active" | "thinking" | "busy" | "idle";
/** Snapshot-derived facts the office simulation needs about one agent. */ /** Snapshot-derived facts the office simulation needs about one agent. */
export interface OfficeAgentInput { export interface OfficeAgentInput {
id: string; id: string;
@@ -71,7 +70,7 @@ export interface OfficeAgentInput {
title: string; title: string;
department: string; department: string;
roleLevel: string; roleLevel: string;
activity: AgentActivity; status: OfficeStatus;
taskTitle: string | null; taskTitle: string | null;
} }
+101
View File
@@ -0,0 +1,101 @@
import type { OfficeState } from "./agent-state";
import type { Rect } from "./office-types";
import { drawBox, setSouthFaceTransform, toIso, type IsoFrame } from "./iso";
/** Hand angles in radians, clockwise from twelve, for a local time. */
export function clockHands(date: Date): { hour: number; minute: number } {
const minutes = date.getMinutes();
return {
hour: (((date.getHours() % 12) + minutes / 60) / 12) * 2 * Math.PI,
minute: (minutes / 60) * 2 * Math.PI,
};
}
/** A 16-pixel wall clock in wall-face coordinates (x along the wall, y down), showing the real time. */
export function drawWallClock(ctx: CanvasRenderingContext2D, x: number, y: number, date: Date): void {
ctx.fillStyle = "#3f3831";
ctx.fillRect(x + 2, y, 12, 16);
ctx.fillRect(x, y + 2, 16, 12);
ctx.fillStyle = "#f2efe8";
ctx.fillRect(x + 2, y + 2, 12, 12);
ctx.fillStyle = "#8a8378";
for (const [tx, ty] of [[7, 2], [12, 7], [7, 12], [2, 7]] as const) ctx.fillRect(x + tx, y + ty, 2, 1);
const hands = clockHands(date);
hand(ctx, x + 8, y + 8, hands.minute, 5, "#2b2622");
hand(ctx, x + 8, y + 8, hands.hour, 3, "#b3543f");
}
function hand(ctx: CanvasRenderingContext2D, cx: number, cy: number, angle: number, length: number, color: string): void {
ctx.fillStyle = color;
for (let step = 0; step <= length; step++) {
ctx.fillRect(Math.round(cx + Math.sin(angle) * step - 0.5), Math.round(cy - Math.cos(angle) * step - 0.5), 1, 1);
}
}
/** A desk monitor's screen on its south face: scrolling code while running, a progress dot for queued, an amber sweep for a cooldown, a blinking red mark when blocked, a standby light when idle. */
export function drawMonitorScreen(ctx: CanvasRenderingContext2D, frame: IsoFrame, monitor: Rect, z: number, height: number, state: OfficeState, timeMs: number, seed: number): void {
ctx.save();
setSouthFaceTransform(ctx, frame, monitor.y + monitor.h, z + height);
const glass = { x: monitor.x + 2, y: 2, w: monitor.w - 4, h: height - 4 };
ctx.fillStyle = state === "running" ? "#0f2a1c" : state === "blocked" ? "#2a1012" : "#20242c";
ctx.fillRect(glass.x, glass.y, glass.w, glass.h);
if (state === "running") {
const scroll = Math.floor(timeMs / 350);
ctx.fillStyle = "#37d38a";
for (let row = 0; row < 4; row++) {
const width = 4 + ((seed * 7 + (scroll + row) * 13) % (glass.w - 6));
ctx.fillRect(glass.x + 1 + (row % 2) * 2, glass.y + 1 + row * 2, width, 1);
}
if (Math.floor(timeMs / 500) % 2 === 0) ctx.fillRect(glass.x + glass.w - 3, glass.y + glass.h - 2, 2, 1);
} else if (state === "queued") {
ctx.fillStyle = "#9aa3b2";
for (let dot = 0; dot <= Math.floor(timeMs / 400) % 3; dot++) ctx.fillRect(glass.x + 2 + dot * 3, glass.y + glass.h / 2, 2, 1);
} else if (state === "cooldown") {
ctx.fillStyle = "#e0a23a";
ctx.fillRect(glass.x + 1, glass.y + glass.h / 2, Math.max(1, (glass.w - 2) * (1 - ((timeMs / 4000) % 1))), 1);
} else if (state === "blocked") {
if (Math.floor(timeMs / 500) % 2 === 0) {
ctx.fillStyle = "#ef4444";
const cx = Math.round(glass.x + glass.w / 2);
ctx.fillRect(cx, glass.y + 1, 1, glass.h - 4);
ctx.fillRect(cx, glass.y + glass.h - 2, 1, 1);
}
} else {
ctx.fillStyle = "#e0a23a";
ctx.fillRect(glass.x + glass.w - 2, glass.y + glass.h - 1, 1, 1);
}
ctx.restore();
}
/** The snack bar's coffee machine: body, cap, a lit button and a cup, with steam curling up from the cup. */
export function drawCoffeeMachine(ctx: CanvasRenderingContext2D, frame: IsoFrame, foot: Rect, z: number, timeMs: number): void {
drawBox(ctx, frame, foot, z, 14, { top: "#454b52", south: "#2e3238", east: "#23262b" });
drawBox(ctx, frame, { x: foot.x + 1, y: foot.y + 1, w: foot.w - 2, h: 5 }, z + 14, 3, { top: "#5a616a", south: "#3c4249", east: "#30353b" });
ctx.save();
setSouthFaceTransform(ctx, frame, foot.y + foot.h, z + 14);
ctx.fillStyle = Math.floor(timeMs / 700) % 2 === 0 ? "#e2553b" : "#8f3426";
ctx.fillRect(foot.x + 2, 2, 2, 2);
ctx.fillStyle = "#d8d3c8";
ctx.fillRect(foot.x + foot.w / 2 - 2, 9, 4, 4);
ctx.restore();
const cup = toIso(frame, { x: foot.x + foot.w / 2, y: foot.y + foot.h }, z + 6);
for (let puff = 0; puff < 3; puff++) {
const rise = ((timeMs / 120 + puff * 5) % 15);
ctx.fillStyle = `rgba(242,242,245,${0.75 * (1 - rise / 15)})`;
ctx.fillRect(Math.round(cup.x + Math.sin((rise + puff) / 2) * 1.5), Math.round(cup.y - 4 - rise), 1, 1);
}
}
/** A toilet against the back wall: tank and bowl in porcelain white, the bowl's opening shaded. */
export function drawToilet(ctx: CanvasRenderingContext2D, frame: IsoFrame, cx: number, backY: number): void {
const porcelain = { top: "#f4f6f8", south: "#d9dee4", east: "#c3c9d0" };
drawBox(ctx, frame, { x: cx - 6, y: backY, w: 12, h: 5 }, 0, 16, porcelain);
drawBox(ctx, frame, { x: cx - 5, y: backY + 5, w: 10, h: 11 }, 0, 8, porcelain);
drawBox(ctx, frame, { x: cx - 3, y: backY + 7, w: 6, h: 7 }, 8, 0, { top: "#9fb2c4", south: "#9fb2c4", east: "#9fb2c4" });
}
/** A wash basin set into a counter top at height `z`: a pale rim around a shaded bowl. */
export function drawBasin(ctx: CanvasRenderingContext2D, frame: IsoFrame, basin: Rect, z: number): void {
drawBox(ctx, frame, basin, z, 0, { top: "#e4ebf2", south: "#e4ebf2", east: "#e4ebf2" });
drawBox(ctx, frame, { x: basin.x + 4, y: basin.y + 3, w: basin.w - 8, h: basin.h - 6 }, z, 0, { top: "#8fa3b7", south: "#8fa3b7", east: "#8fa3b7" });
}
+11
View File
@@ -0,0 +1,11 @@
/** Agents who come to the office, in hire order: the office and the org chart read the same list. */
export function officeRoster<T extends { id: string; lifecycle: string; createdAt: string }>(agents: T[]): T[] {
return agents
.filter((agent) => agent.lifecycle === "active")
.sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id));
}
/** The first c-suite agent on the roster holds the CEO office and wears the CEO's look. */
export function ceoIdOf(roster: Array<{ id: string; roleLevel: string }>): string | null {
return roster.find((agent) => agent.roleLevel === "c_suite")?.id ?? null;
}
+222 -300
View File
@@ -1,24 +1,33 @@
import type { OfficeState } from "./agent-state";
import type { FloorPlan, Rect, RoomSpec } from "./office-types"; import type { FloorPlan, Rect, RoomSpec } from "./office-types";
import { WALL } from "./floor-plan"; import { WALL } from "./floor-plan";
import { drawWindowSky, type SkyScene } from "./sky"; import { drawWeather, drawWindowSky, type SkyScene, type Weather } from "./sky";
import { BACK_WALL_H, depthOf, drawBox, setGroundTransform, setSouthFaceTransform, type BoxColors, type IsoFrame } from "./iso";
import { drawBasin, drawCoffeeMachine, drawMonitorScreen, drawToilet, drawWallClock } from "./props";
import type { Season } from "../../shared/palette-clock";
/** /** One thing in the scene that people can stand in front of or behind; drawn in depth order with them. */
* Draws the static office world in a 3/4 top-down pixel style: wood floor, export interface Drawable {
* room interiors, wall faces with windows, furniture, and door signage. depth: number;
* Everything here is a pure function of the floor plan and the visible rect. draw: (ctx: CanvasRenderingContext2D) => void;
*/ }
/** Height of the visible north-wall face inside each room. */ /** A piece of the scene and the plan footprint it sorts by. */
export const WALL_FACE_H = 48; export interface SceneDrawable extends Drawable {
foot: Rect;
}
/** Interior walls are cut away to this height so rooms stay visible. */
const INNER_WALL_H = 14;
/** Longest side of a block that sorts as one piece. */
const PIECE = 32;
const PALETTE = { const PALETTE = {
wood: "#b08a62", wood: "#b08a62",
woodSeam: "#9c7852", woodSeam: "#9c7852",
corridor: "#a8815c", corridor: "#a8815c",
wallFill: "#4c4239", wall: "#6b5f52",
wallEdge: "#3b332c", wallTop: "#4c4239",
wallFace: "#6b5f52",
wallFaceShadow: "#5d5246",
baseboard: "#4f463c", baseboard: "#4f463c",
ceoCarpet: "#5c6a94", ceoCarpet: "#5c6a94",
ceoCarpetEdge: "#505d85", ceoCarpetEdge: "#505d85",
@@ -28,50 +37,42 @@ const PALETTE = {
snackTileB: "#cbb891", snackTileB: "#cbb891",
restTileA: "#adbfd2", restTileA: "#adbfd2",
restTileB: "#9db0c5", restTileB: "#9db0c5",
deskWood: "#8a6d4c", desk: "#8a6d4c",
deskWoodDark: "#75593b", deskExec: "#6a5238",
deskLeg: "#5f4832", monitor: "#4b5058",
screenOff: "#20242c",
monitorShell: "#4b5058",
chair: "#3d4148", chair: "#3d4148",
chairDark: "#33373d",
frame: "#3f3831", frame: "#3f3831",
signPlate: "#2f2a25", panelSeam: "#5d5246",
signText: "#d8cfc2",
} as const; } as const;
export function drawWorld(ctx: CanvasRenderingContext2D, plan: FloorPlan, view: Rect, sky: SkyScene): void { const LEAVES: Record<Season, { leaf: string; light: string }> = {
drawFloor(ctx, plan, view); spring: { leaf: "#5f9a52", light: "#e9a3c2" },
for (const room of plan.rooms) drawRoomFloor(ctx, room); summer: { leaf: "#3f7f3a", light: "#6fb25c" },
drawStructure(ctx, plan, sky); autumn: { leaf: "#b5652a", light: "#e0a23a" },
for (const room of plan.rooms) drawRoomFurniture(ctx, plan, room); winter: { leaf: "#5a7466", light: "#e8eef2" },
drawCorridorPlants(ctx, plan); };
for (const desk of plan.desks) {
if (rectsTouch(view, expand(desk.bounds, 40))) drawDesk(ctx, desk.bounds, false); /** Top, south and east faces of a block from one base colour: lit from above, the east side darkest. */
} export function faces(hex: string): BoxColors {
for (const room of plan.rooms) drawDoorSign(ctx, room); return { top: hex, south: shade(hex, 0.82), east: shade(hex, 0.66) };
drawEntrance(ctx, plan);
} }
/** The monitor screen glass for a desk; the activity glow overlay reuses it. */ /** Floor, rugs and tiles, flat on the ground plane. */
export function deskScreenRect(desk: Rect): Rect { export function drawGround(ctx: CanvasRenderingContext2D, frame: IsoFrame, plan: FloorPlan): void {
return { x: desk.x + desk.w / 2 - 13, y: desk.y - 15, w: 26, h: 15 }; ctx.save();
} setGroundTransform(ctx, frame);
function drawFloor(ctx: CanvasRenderingContext2D, plan: FloorPlan, view: Rect): void {
const { w, h } = plan.world; const { w, h } = plan.world;
ctx.fillStyle = PALETTE.wood; ctx.fillStyle = PALETTE.wood;
ctx.fillRect(0, 0, w, h); ctx.fillRect(0, 0, w, h);
ctx.fillStyle = PALETTE.woodSeam; ctx.fillStyle = PALETTE.woodSeam;
const top = Math.max(0, Math.floor(view.y / 16) * 16); for (let y = 0; y < h; y += 16) {
const bottom = Math.min(h, view.y + view.h);
for (let y = top; y < bottom; y += 16) {
ctx.fillRect(0, y, w, 1); ctx.fillRect(0, y, w, 1);
const offset = (y / 16) % 2 === 0 ? 0 : 48; for (let x = (y / 16) % 2 === 0 ? 0 : 48; x < w; x += 96) ctx.fillRect(x, y, 1, 16);
for (let x = offset; x < w; x += 96) ctx.fillRect(x, y, 1, 16);
} }
ctx.fillStyle = PALETTE.corridor; ctx.fillStyle = PALETTE.corridor;
ctx.fillRect(WALL, 288, plan.world.w - 2 * WALL, 64); ctx.fillRect(WALL, 288, w - 2 * WALL, 64);
for (const room of plan.rooms) drawRoomFloor(ctx, room);
ctx.restore();
} }
function drawRoomFloor(ctx: CanvasRenderingContext2D, room: RoomSpec): void { function drawRoomFloor(ctx: CanvasRenderingContext2D, room: RoomSpec): void {
@@ -84,9 +85,7 @@ function drawRoomFloor(ctx: CanvasRenderingContext2D, room: RoomSpec): void {
ctx.strokeRect(b.x + 6, b.y + 6, b.w - 12, b.h - 12); ctx.strokeRect(b.x + 6, b.y + 6, b.w - 12, b.h - 12);
return; return;
} }
const [tileA, tileB] = room.kind === "snack" const [tileA, tileB] = room.kind === "snack" ? [PALETTE.snackTileA, PALETTE.snackTileB] : [PALETTE.restTileA, PALETTE.restTileB];
? [PALETTE.snackTileA, PALETTE.snackTileB]
: [PALETTE.restTileA, PALETTE.restTileB];
for (let ty = 0; ty < b.h; ty += 16) { for (let ty = 0; ty < b.h; ty += 16) {
for (let tx = 0; tx < b.w; tx += 16) { for (let tx = 0; tx < b.w; tx += 16) {
ctx.fillStyle = ((tx + ty) / 16) % 2 === 0 ? tileA : tileB; ctx.fillStyle = ((tx + ty) / 16) % 2 === 0 ? tileA : tileB;
@@ -95,280 +94,203 @@ function drawRoomFloor(ctx: CanvasRenderingContext2D, room: RoomSpec): void {
} }
} }
function drawStructure(ctx: CanvasRenderingContext2D, plan: FloorPlan, sky: SkyScene): void { /** What the back walls show: the sky and weather outside, and the time for the wall clock. */
export interface Outside {
sky: SkyScene;
weather: Weather;
clock: Date;
timeMs: number;
}
/** The tall north and west walls, which everything stands in front of, with panels, windows, a clock and wall art on the north face. */
export function drawBackWalls(ctx: CanvasRenderingContext2D, frame: IsoFrame, plan: FloorPlan, outside: Outside): void {
const { w, h } = plan.world; const { w, h } = plan.world;
ctx.fillStyle = PALETTE.wallFill; const wall = faces(PALETTE.wall);
ctx.fillRect(0, 0, w, WALL); drawBox(ctx, frame, { x: 0, y: WALL, w: WALL, h: 280 }, 0, BACK_WALL_H, wall);
ctx.fillRect(0, h - WALL, w, WALL); drawBox(ctx, frame, { x: 0, y: 344, w: WALL, h: h - 344 - WALL }, 0, BACK_WALL_H, wall);
ctx.fillRect(0, WALL, WALL, 280); drawBox(ctx, frame, { x: 0, y: 0, w, h: WALL }, 0, BACK_WALL_H, { ...wall, top: PALETTE.wallTop });
ctx.fillRect(0, 344, WALL, h - 344 - WALL); ctx.save();
ctx.fillRect(w - WALL, WALL, WALL, h - 2 * WALL); setSouthFaceTransform(ctx, frame, WALL, BACK_WALL_H);
ctx.fillStyle = PALETTE.wallTop;
for (const room of plan.rooms) {
const b = room.bounds;
ctx.fillStyle = PALETTE.wallFace;
ctx.fillRect(b.x, b.y, b.w, WALL_FACE_H);
ctx.fillStyle = PALETTE.wallFaceShadow;
ctx.fillRect(b.x, b.y + WALL_FACE_H - 6, b.w, 6);
ctx.fillStyle = PALETTE.baseboard;
ctx.fillRect(b.x, b.y + WALL_FACE_H, b.w, 2);
drawRoomWindows(ctx, room, sky);
}
ctx.fillStyle = PALETTE.wallFill;
ctx.fillRect(304, WALL, WALL, 272);
ctx.fillRect(624, WALL, WALL, 272);
ctx.fillRect(896, WALL, WALL, 272);
for (const room of plan.rooms) drawSouthWall(ctx, room);
ctx.fillStyle = PALETTE.wallEdge;
ctx.fillRect(0, 0, w, 2); ctx.fillRect(0, 0, w, 2);
} ctx.fillStyle = PALETTE.panelSeam;
for (let x = 32; x < w; x += 32) ctx.fillRect(x, 2, 1, BACK_WALL_H - 5);
function drawSouthWall(ctx: CanvasRenderingContext2D, room: RoomSpec): void { ctx.fillStyle = PALETTE.baseboard;
const b = room.bounds; ctx.fillRect(0, BACK_WALL_H - 3, w, 3);
const y = b.y + b.h; for (const room of plan.rooms) {
const gapL = room.doorCx - 24; windowRects(room).forEach((rect, index) => {
const gapR = room.doorCx + 24; const seed = Math.round(room.bounds.x) + index * 53;
ctx.fillStyle = PALETTE.wallFill;
ctx.fillRect(b.x - WALL, y, gapL - b.x + WALL, WALL);
ctx.fillRect(gapR, y, b.x + b.w - gapR + WALL, WALL);
ctx.fillStyle = PALETTE.wallEdge;
ctx.fillRect(b.x - WALL, y + WALL - 2, gapL - b.x + WALL, 2);
ctx.fillRect(gapR, y + WALL - 2, b.x + b.w - gapR + WALL, 2);
ctx.fillStyle = PALETTE.frame; ctx.fillStyle = PALETTE.frame;
ctx.fillRect(gapL - 3, y, 3, WALL); ctx.fillRect(rect.x - 2, rect.y - 2, rect.w + 4, rect.h + 4);
ctx.fillRect(gapR, y, 3, WALL); drawWindowSky(ctx, rect, outside.sky, seed);
drawWeather(ctx, rect, outside.weather, outside.timeMs, seed);
ctx.fillStyle = PALETTE.frame;
ctx.fillRect(rect.x + rect.w / 2 - 1, rect.y, 2, rect.h);
});
}
drawWallArt(ctx);
drawWallClock(ctx, 664, 10, outside.clock);
ctx.restore();
} }
function drawRoomWindows(ctx: CanvasRenderingContext2D, room: RoomSpec, sky: SkyScene): void { /** Window glass on each room's stretch of the north wall face: x along the wall, y down from its top. */
const rects = windowRects(room);
for (let i = 0; i < rects.length; i++) {
drawWindowFrame(ctx, rects[i], sky, Math.round(room.bounds.x) + i * 53);
}
}
/** Window glass rects on each room's north wall face (world coordinates). */
export function windowRects(room: RoomSpec): Rect[] { export function windowRects(room: RoomSpec): Rect[] {
const b = room.bounds; const b = room.bounds;
const y = b.y + 8; if (room.kind === "restroom") return [{ x: b.x + b.w - 190, y: 12, w: 44, h: 18 }];
const h = WALL_FACE_H - 20; if (room.kind === "snack") return [{ x: b.x + 104, y: 8, w: 72, h: 24 }];
if (room.kind === "restroom") { return [{ x: b.x + 28, y: 8, w: 72, h: 24 }, { x: b.x + b.w - 100, y: 8, w: 72, h: 24 }];
return [{ x: b.x + b.w - 190, y: y + 6, w: 44, h: h - 10 }];
} }
if (room.kind === "snack") {
return [{ x: b.x + 24, y, w: 72, h }]; function drawWallArt(ctx: CanvasRenderingContext2D): void {
// CEO office wall screen and meeting-room whiteboard, between their windows.
ctx.fillStyle = PALETTE.frame;
ctx.fillRect(143, 8, 34, 22);
ctx.fillStyle = "#7f96b8";
ctx.fillRect(145, 10, 30, 18);
ctx.fillStyle = "#f2efe8";
ctx.fillRect(424, 6, 96, 28);
ctx.fillStyle = "#b3543f";
ctx.fillRect(432, 12, 26, 3);
ctx.fillStyle = "#4f7fae";
ctx.fillRect(432, 19, 40, 3);
ctx.fillStyle = "#6d9c6b";
ctx.fillRect(432, 26, 33, 3);
// Restroom mirror over the sinks.
ctx.fillStyle = PALETTE.frame;
ctx.fillRect(934, 8, 84, 22);
ctx.fillStyle = "#b9d3e6";
ctx.fillRect(936, 10, 80, 18);
ctx.fillStyle = "#e3f0f8";
ctx.fillRect(944, 12, 2, 12);
ctx.fillRect(948, 12, 1, 8);
} }
const w = 72;
/** A block sorted by its footprint centre; one resting on `support` touches exactly one piece of it (overhanging its outer edge is fine) and sorts just after that piece. */
export function blockDrawable(frame: IsoFrame, foot: Rect, height: number, colors: BoxColors, z = 0, support?: Rect): SceneDrawable {
return { foot, depth: support ? restingDepth(foot, support) : centerDepth(foot), draw: (ctx) => drawBox(ctx, frame, foot, z, height, colors) };
}
function restingDepth(foot: Rect, support: Rect): number {
const under = split(support).filter((piece) => overlaps(piece, foot));
if (under.length !== 1) throw new Error("A resting block must touch exactly one piece of its support.");
return centerDepth(under[0]!) + 0.25;
}
function centerDepth(rect: Rect): number {
return depthOf({ x: rect.x + rect.w / 2, y: rect.y + rect.h / 2 });
}
/** Interior walls, furniture and desks as blocks, each sorted by depth against the people; `screens` gives each desk's screen its agent's state, and `timeMs` animates screens and steam. */
export function sceneDrawables(frame: IsoFrame, plan: FloorPlan, season: Season, screens: Map<Rect, OfficeState>, timeMs: number): SceneDrawable[] {
const items: SceneDrawable[] = [];
// Long blocks go in pieces so each sorts against nearby people on its own.
const block = (foot: Rect, height: number, colors: BoxColors, z = 0, support?: Rect) => {
for (const piece of support ? [foot] : split(foot)) items.push(blockDrawable(frame, piece, height, colors, z, support));
};
for (const wall of innerWalls(plan)) block(wall, INNER_WALL_H, faces(PALETTE.wall));
const leaves = LEAVES[season];
const plant = (cx: number, cy: number) => {
const pot = { x: cx - 6, y: cy - 6, w: 12, h: 12 };
block(pot, 8, faces("#8a5a3b"));
block({ x: cx - 8, y: cy - 8, w: 16, h: 16 }, 12, faces(leaves.leaf), 8, pot);
block({ x: cx - 4, y: cy - 4, w: 8, h: 8 }, 6, faces(leaves.light), 20, pot);
};
// CEO office: rug, executive desk, sofa, plant.
block({ x: 32, y: 96, w: 24, h: 72 }, 10, faces("#7a4a41"));
plant(280, 40);
deskBlocks(plan.ceoDesk, true, screens.get(plan.ceoDesk) ?? "idle", timeMs).forEach((item) => items.push(item(frame)));
// Meeting room: table and chairs.
block({ x: 392, y: 120, w: 160, h: 64 }, 12, faces("#75593b"));
for (let i = 0; i < 3; i++) {
block({ x: 414 + i * 52, y: 100, w: 14, h: 12 }, 8, faces(PALETTE.chair));
block({ x: 414 + i * 52, y: 192, w: 14, h: 12 }, 8, faces(PALETTE.chair));
}
// Snack bar: counter, fridge, coffee machine, table and stools.
const counter = { x: 656, y: 40, w: 224, h: 28 };
block(counter, 16, faces("#8f8578"));
block({ x: 700, y: 20, w: 24, h: 20 }, 22, faces("#d5dade"));
const machine = { x: 726, y: 44, w: 14, h: 14 };
items.push({ foot: machine, depth: restingDepth(machine, counter), draw: (ctx) => drawCoffeeMachine(ctx, frame, machine, 16, timeMs) });
block({ x: 792, y: 46, w: 12, h: 10 }, 8, faces("#c9a86a"), 16, counter);
block({ x: 826, y: 46, w: 12, h: 10 }, 10, faces("#b3543f"), 16, counter);
block({ x: 748, y: 170, w: 40, h: 40 }, 12, faces("#94897b"));
block({ x: 728, y: 182, w: 12, h: 12 }, 7, faces("#6d5334"));
block({ x: 796, y: 182, w: 12, h: 12 }, 7, faces("#6d5334"));
// Restroom: three open stalls with toilets between partitions, and a sink counter.
for (let i = 0; i < 3; i++) {
const cx = 1084 + i * 40;
const toilet = { x: cx - 6, y: WALL + 2, w: 12, h: 16 };
items.push({ foot: toilet, depth: centerDepth(toilet), draw: (ctx) => drawToilet(ctx, frame, cx, WALL + 2) });
}
for (let i = 0; i <= 3; i++) block({ x: 1063 + i * 40, y: WALL, w: 2, h: 48 }, INNER_WALL_H, faces("#7d8a99"));
const sinks = { x: 928, y: 32, w: 96, h: 32 };
block(sinks, 14, { top: "#c6d2de", south: "#a7b4c2", east: "#909eae" });
for (let i = 0; i < 2; i++) {
const basin = { x: sinks.x + 2 + i * 64, y: sinks.y + 8, w: 28, h: 16 };
items.push({ foot: basin, depth: restingDepth(basin, sinks), draw: (ctx) => drawBasin(ctx, frame, basin, 14) });
}
for (const [cx, cy] of [[312, 300], [632, 300], [904, 300]] as const) plant(cx, cy);
for (const desk of plan.desks) deskBlocks(desk.bounds, false, screens.get(desk.bounds) ?? "idle", timeMs).forEach((item) => items.push(item(frame)));
return items;
}
/** A desk, its monitor and its chair, each a separate block so a seated person sorts between them. */
function deskBlocks(desk: Rect, executive: boolean, screen: OfficeState, timeMs: number): Array<(frame: IsoFrame) => SceneDrawable> {
const monitor = deskMonitor(desk);
return [ return [
{ x: b.x + 28, y, w, h }, ...split(desk).map((piece) => (frame: IsoFrame) => blockDrawable(frame, piece, 14, faces(executive ? PALETTE.deskExec : PALETTE.desk))),
{ x: b.x + b.w - 28 - w, y, w, h }, (frame) => {
const shell = blockDrawable(frame, monitor, 12, { top: PALETTE.monitor, south: PALETTE.monitor, east: shade(PALETTE.monitor, 0.7) }, 14, desk);
return { foot: monitor, depth: shell.depth, draw: (ctx) => {
shell.draw(ctx);
drawMonitorScreen(ctx, frame, monitor, 14, 12, screen, timeMs, Math.round(desk.x + desk.y));
} };
},
(frame) => blockDrawable(frame, { x: desk.x + desk.w / 2 - 8, y: desk.y + desk.h + 6, w: 16, h: 12 }, 9, faces(PALETTE.chair)),
]; ];
} }
function drawWindowFrame(ctx: CanvasRenderingContext2D, rect: Rect, sky: SkyScene, seed: number): void { /** Footprint of a desk's monitor, at the back of the desktop with its screen facing south, inside the desk piece that holds the desk's centre. */
ctx.fillStyle = PALETTE.frame; function deskMonitor(desk: Rect): Rect {
ctx.fillRect(rect.x - 3, rect.y - 3, rect.w + 6, rect.h + 6); const piece = Math.floor(desk.w / 2 / PIECE) * PIECE;
drawWindowSky(ctx, rect, sky, seed); return { x: desk.x + piece + 3, y: desk.y + 4, w: 26, h: 6 };
ctx.fillStyle = PALETTE.frame;
ctx.fillRect(rect.x + rect.w / 2 - 1, rect.y, 2, rect.h);
} }
function drawRoomFurniture(ctx: CanvasRenderingContext2D, plan: FloorPlan, room: RoomSpec): void { /** Partitions, room fronts (with door gaps) and the low outer east and south walls. */
if (room.kind === "ceo") drawCeoFurniture(ctx, plan); function innerWalls(plan: FloorPlan): Rect[] {
if (room.kind === "meeting") drawMeetingFurniture(ctx); const { w, h } = plan.world;
if (room.kind === "snack") drawSnackFurniture(ctx); const walls: Rect[] = [
if (room.kind === "restroom") drawRestroomFurniture(ctx); { x: 304, y: WALL, w: WALL, h: 272 },
{ x: 624, y: WALL, w: WALL, h: 272 },
{ x: 896, y: WALL, w: WALL, h: 272 },
{ x: w - WALL, y: WALL, w: WALL, h: h - 2 * WALL },
{ x: 0, y: h - WALL, w, h: WALL },
];
for (const room of plan.rooms) {
const b = room.bounds;
const y = b.y + b.h;
walls.push({ x: b.x - WALL, y, w: room.doorCx - 24 - b.x + WALL, h: WALL });
walls.push({ x: room.doorCx + 24, y, w: b.x + b.w - room.doorCx - 24 + WALL, h: WALL });
}
return walls;
} }
function drawCeoFurniture(ctx: CanvasRenderingContext2D, plan: FloorPlan): void { function split(block: Rect): Rect[] {
const desk = plan.ceoDesk; const pieces: Rect[] = [];
ctx.fillStyle = "#414b6e"; for (let dy = 0; dy < block.h; dy += PIECE) {
ctx.fillRect(desk.x - 16, desk.y - 8, desk.w + 32, desk.h + 40); for (let dx = 0; dx < block.w; dx += PIECE) {
drawDesk(ctx, desk, true); pieces.push({ x: block.x + dx, y: block.y + dy, w: Math.min(PIECE, block.w - dx), h: Math.min(PIECE, block.h - dy) });
drawSofa(ctx, 32, 96); }
drawPlant(ctx, 280, 48); }
// Wall screen centered in the gap between the two windows (116..204). return pieces;
ctx.fillStyle = PALETTE.frame;
ctx.fillRect(143, 24, 34, 22);
ctx.fillStyle = "#7f96b8";
ctx.fillRect(145, 26, 30, 18);
ctx.fillStyle = "#5c7a9c";
ctx.fillRect(145, 36, 30, 8);
} }
function drawMeetingFurniture(ctx: CanvasRenderingContext2D): void { function overlaps(a: Rect, b: Rect): boolean {
const table: Rect = { x: 392, y: 120, w: 160, h: 64 };
ctx.fillStyle = PALETTE.deskWoodDark;
ctx.fillRect(table.x, table.y, table.w, table.h);
ctx.fillStyle = PALETTE.deskWood;
ctx.fillRect(table.x + 3, table.y + 3, table.w - 6, table.h - 9);
for (let i = 0; i < 3; i++) {
drawChair(ctx, table.x + 22 + i * 52, table.y - 16);
drawChair(ctx, table.x + 22 + i * 52, table.y + table.h + 4);
}
// Whiteboard centered in the gap between the two windows (420..524).
ctx.fillStyle = "#f2efe8";
ctx.fillRect(424, 22, 96, 30);
ctx.fillStyle = PALETTE.frame;
ctx.strokeStyle = PALETTE.frame;
ctx.lineWidth = 2;
ctx.strokeRect(424, 22, 96, 30);
ctx.fillStyle = "#b3543f";
ctx.fillRect(432, 30, 26, 3);
ctx.fillStyle = "#4f7fae";
ctx.fillRect(432, 38, 40, 3);
ctx.fillStyle = "#6d9c6b";
ctx.fillRect(432, 44, 33, 3);
}
function drawSnackFurniture(ctx: CanvasRenderingContext2D): void {
ctx.fillStyle = "#8f8578";
ctx.fillRect(656, 40, 224, 28);
ctx.fillStyle = "#a99e8f";
ctx.fillRect(656, 40, 224, 8);
ctx.fillStyle = "#d5dade";
ctx.fillRect(660, 8, 30, 48);
ctx.fillStyle = "#b9c0c6";
ctx.fillRect(660, 30, 30, 3);
ctx.fillRect(682, 14, 4, 12);
drawCoffeeMachine(ctx, 694, 26);
ctx.fillStyle = "#c9a86a";
ctx.fillRect(806, 30, 14, 12);
ctx.fillStyle = "#b3543f";
ctx.fillRect(826, 28, 12, 14);
ctx.fillStyle = "#6d9c6b";
ctx.fillRect(844, 30, 12, 12);
ctx.fillStyle = "#94897b";
ctx.fillRect(748, 170, 40, 40);
ctx.fillStyle = "#a89d8e";
ctx.fillRect(751, 173, 34, 34);
drawStool(ctx, 738, 184);
drawStool(ctx, 792, 184);
}
function drawCoffeeMachine(ctx: CanvasRenderingContext2D, x: number, y: number): void {
ctx.fillStyle = "#2e3238";
ctx.fillRect(x, y, 22, 30);
ctx.fillStyle = "#454b52";
ctx.fillRect(x + 2, y + 2, 18, 8);
ctx.fillStyle = "#c9553e";
ctx.fillRect(x + 8, y + 12, 6, 4);
ctx.fillStyle = "#d8d3c8";
ctx.fillRect(x + 7, y + 20, 8, 7);
}
function drawRestroomFurniture(ctx: CanvasRenderingContext2D): void {
for (let i = 0; i < 3; i++) {
const x = 1064 + i * 40;
ctx.fillStyle = "#7d8a99";
ctx.fillRect(x, 16, 40, 72);
ctx.fillStyle = "#8f9dad";
ctx.fillRect(x + 4, 28, 32, 58);
ctx.fillStyle = "#6c7887";
ctx.fillRect(x + 30, 54, 4, 8);
}
ctx.fillStyle = "#c6d2de";
ctx.fillRect(928, 32, 96, 32);
ctx.fillStyle = "#e4ebf2";
for (let i = 0; i < 2; i++) ctx.fillRect(940 + i * 44, 38, 28, 14);
ctx.fillStyle = "#aab8c6";
ctx.fillRect(936, 18, 80, 10);
}
function drawCorridorPlants(ctx: CanvasRenderingContext2D, plan: FloorPlan): void {
void plan;
drawPlant(ctx, 312, 300);
drawPlant(ctx, 632, 300);
drawPlant(ctx, 904, 300);
}
function drawPlant(ctx: CanvasRenderingContext2D, cx: number, cy: number): void {
ctx.fillStyle = "#8a5a3b";
ctx.fillRect(cx - 7, cy, 14, 10);
ctx.fillStyle = "#4e7a46";
ctx.fillRect(cx - 9, cy - 12, 18, 12);
ctx.fillStyle = "#659a58";
ctx.fillRect(cx - 5, cy - 18, 10, 8);
}
function drawSofa(ctx: CanvasRenderingContext2D, x: number, y: number): void {
ctx.fillStyle = "#7a4a41";
ctx.fillRect(x, y, 24, 72);
ctx.fillStyle = "#94594e";
ctx.fillRect(x + 8, y + 4, 16, 64);
}
function drawChair(ctx: CanvasRenderingContext2D, x: number, y: number): void {
ctx.fillStyle = PALETTE.chairDark;
ctx.fillRect(x, y, 16, 12);
ctx.fillStyle = PALETTE.chair;
ctx.fillRect(x + 2, y + 2, 12, 8);
}
function drawStool(ctx: CanvasRenderingContext2D, x: number, y: number): void {
ctx.fillStyle = "#6d5334";
ctx.fillRect(x, y, 10, 10);
}
function drawDesk(ctx: CanvasRenderingContext2D, desk: Rect, executive: boolean): void {
ctx.fillStyle = PALETTE.deskLeg;
ctx.fillRect(desk.x + 4, desk.y + desk.h - 6, 5, 10);
ctx.fillRect(desk.x + desk.w - 9, desk.y + desk.h - 6, 5, 10);
ctx.fillStyle = executive ? "#5f4a33" : PALETTE.deskWoodDark;
ctx.fillRect(desk.x, desk.y, desk.w, desk.h);
ctx.fillStyle = executive ? "#75593b" : PALETTE.deskWood;
ctx.fillRect(desk.x + 2, desk.y + 2, desk.w - 4, desk.h - 7);
const screen = deskScreenRect(desk);
ctx.fillStyle = PALETTE.monitorShell;
ctx.fillRect(screen.x - 2, screen.y - 2, screen.w + 4, screen.h + 4);
ctx.fillStyle = PALETTE.screenOff;
ctx.fillRect(screen.x, screen.y, screen.w, screen.h);
ctx.fillStyle = PALETTE.monitorShell;
ctx.fillRect(screen.x + screen.w / 2 - 3, screen.y + screen.h + 2, 6, 3);
if (executive) {
ctx.fillStyle = "#d8d3c8";
ctx.fillRect(desk.x + desk.w - 22, desk.y + 8, 12, 8);
ctx.fillStyle = "#4e7a46";
ctx.fillRect(desk.x + 8, desk.y + 6, 8, 10);
}
ctx.fillStyle = "#23262b";
ctx.fillRect(desk.x + desk.w / 2 - 8, desk.y + desk.h - 12, 16, 5);
drawChair(ctx, desk.x + desk.w / 2 - 8, desk.y + desk.h + 4);
}
function drawDoorSign(ctx: CanvasRenderingContext2D, room: RoomSpec): void {
const label = room.label;
ctx.font = "bold 8px monospace";
const width = ctx.measureText(label).width + 10;
const x = room.doorCx - width / 2;
const y = room.bounds.y + room.bounds.h - 13;
ctx.fillStyle = PALETTE.signPlate;
ctx.fillRect(x, y, width, 12);
ctx.fillStyle = PALETTE.signText;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(label, room.doorCx, y + 7);
ctx.textAlign = "start";
ctx.textBaseline = "alphabetic";
}
function drawEntrance(ctx: CanvasRenderingContext2D, plan: FloorPlan): void {
void plan;
ctx.fillStyle = PALETTE.frame;
ctx.fillRect(0, 292, 4, 56);
ctx.fillStyle = "#7fb3d9";
ctx.fillRect(4, 296, 4, 48);
ctx.fillStyle = "#8d6a45";
ctx.fillRect(20, 300, 26, 40);
ctx.fillStyle = "#9c7852";
ctx.fillRect(22, 302, 22, 36);
}
function rectsTouch(a: Rect, b: Rect): boolean {
return a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y; return a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y;
} }
function expand(rect: Rect, margin: number): Rect { function shade(hex: string, factor: number): string {
return { x: rect.x - margin, y: rect.y - margin, w: rect.w + margin * 2, h: rect.h + margin * 2 }; const value = Number.parseInt(hex.slice(1), 16);
const channel = (shift: number) => Math.round(((value >> shift) & 0xff) * factor);
return `rgb(${channel(16)}, ${channel(8)}, ${channel(0)})`;
} }
+5 -20
View File
@@ -1,6 +1,7 @@
import { buildFloorPlan, findPath } from "./floor-plan"; import { buildFloorPlan, findPath } from "./floor-plan";
import type { AmenitySpot, Camera, FloorPlan, OfficeAgentInput, Rect, Vec } from "./office-types"; import type { AmenitySpot, Camera, FloorPlan, OfficeAgentInput, Rect, Vec } from "./office-types";
import { appearanceFor, type Carrying, type Facing, type SpriteAppearance } from "./sprites"; import { appearanceFor, type Carrying, type Facing, type SpriteAppearance } from "./sprites";
import { ceoIdOf } from "./roster";
export type AgentBehavior = export type AgentBehavior =
| { kind: "seated" } | { kind: "seated" }
@@ -116,7 +117,7 @@ export class OfficeSimulation {
switch (agent.behavior.kind) { switch (agent.behavior.kind) {
case "seated": { case "seated": {
agent.settledMs += dt; agent.settledMs += dt;
if (agent.input.activity === "idle" && agent.settledMs >= SETTLE_MS && this.random() < dt / MEAN_TRIP_INTERVAL_MS) { if (agent.input.status.state === "idle" && agent.settledMs >= SETTLE_MS && this.random() < dt / MEAN_TRIP_INTERVAL_MS) {
agent.settledMs = 0; agent.settledMs = 0;
this.startTrip(agent); this.startTrip(agent);
} }
@@ -160,7 +161,7 @@ export class OfficeSimulation {
conveneMeeting(): number { conveneMeeting(): number {
const spots = this.plan.amenities.filter((spot) => spot.kind === "meeting"); const spots = this.plan.amenities.filter((spot) => spot.kind === "meeting");
const candidates = this.agents.filter( const candidates = this.agents.filter(
(agent) => agent.input.activity === "idle" && agent.behavior.kind === "seated" && agent.settledMs >= SETTLE_MS, (agent) => agent.input.status.state === "idle" && agent.behavior.kind === "seated" && agent.settledMs >= SETTLE_MS,
); );
if (candidates.length < 2 || spots.length < 2) return 0; if (candidates.length < 2 || spots.length < 2) return 0;
const size = Math.min(spots.length, candidates.length, 2 + Math.floor(this.random() * 3)); const size = Math.min(spots.length, candidates.length, 2 + Math.floor(this.random() * 3));
@@ -244,22 +245,6 @@ export class OfficeSimulation {
agent.behavior = { kind: "seated" }; agent.behavior = { kind: "seated" };
} }
/**
* Returns the agent whose drawn body contains the world point, preferring
* the visually frontmost (largest y). Tests against the same positions the
* renderer draws, so clicks always match what is on screen.
*/
hitTest(point: Vec): AgentSim | null {
let hit: AgentSim | null = null;
for (const agent of this.agents) {
const inBody =
point.x >= agent.x - 10 && point.x <= agent.x + 10 &&
point.y >= agent.y - 36 && point.y <= agent.y + 4;
if (inBody && (hit === null || agent.y > hit.y)) hit = agent;
}
return hit;
}
private stepPlayer(player: PlayerSim, dt: number, input: MoveInput): void { private stepPlayer(player: PlayerSim, dt: number, input: MoveInput): void {
let dx = (input.right ? 1 : 0) - (input.left ? 1 : 0); let dx = (input.right ? 1 : 0) - (input.left ? 1 : 0);
let dy = (input.down ? 1 : 0) - (input.up ? 1 : 0); let dy = (input.down ? 1 : 0) - (input.up ? 1 : 0);
@@ -294,7 +279,7 @@ export class OfficeSimulation {
* else takes open-floor desks in order. * else takes open-floor desks in order.
*/ */
sync(inputs: OfficeAgentInput[]): void { sync(inputs: OfficeAgentInput[]): void {
const ceoId = inputs.find((input) => input.roleLevel === "c_suite")?.id ?? null; const ceoId = ceoIdOf(inputs);
const openCount = inputs.filter((input) => input.id !== ceoId).length; const openCount = inputs.filter((input) => input.id !== ceoId).length;
const planRebuilt = openCount !== this.openDeskDemand; const planRebuilt = openCount !== this.openDeskDemand;
if (planRebuilt) { if (planRebuilt) {
@@ -325,7 +310,7 @@ export class OfficeSimulation {
settledMs: prev?.settledMs ?? 0, settledMs: prev?.settledMs ?? 0,
}; };
const onBreak = agent.behavior.kind === "dwelling" || (agent.behavior.kind === "walking" && agent.behavior.destination === "amenity"); const onBreak = agent.behavior.kind === "dwelling" || (agent.behavior.kind === "walking" && agent.behavior.destination === "amenity");
const workStarted = input.activity !== "idle" && onBreak; const workStarted = input.status.state !== "idle" && onBreak;
if (workStarted || (planRebuilt && prev && (agent.x !== seat.x || agent.y !== seat.y))) { if (workStarted || (planRebuilt && prev && (agent.x !== seat.x || agent.y !== seat.y))) {
this.sendHome(agent); this.sendHome(agent);
} }
+29
View File
@@ -1,4 +1,5 @@
import type { Rect } from "./office-types"; import type { Rect } from "./office-types";
import { season } from "../../shared/palette-clock";
/** /**
* The world outside the office windows, driven by real local time: night * The world outside the office windows, driven by real local time: night
@@ -155,6 +156,34 @@ function drawSkyline(ctx: CanvasRenderingContext2D, glass: Rect, scene: SkyScene
} }
} }
export type Weather = "clear" | "rain" | "snow" | "leaves";
/** Decoration for the view outside, from the season and a per-day roll; never a forecast. */
export function weatherFor(date: Date): Weather {
const dayKey = date.getFullYear() * 400 + date.getMonth() * 32 + date.getDate();
const roll = Math.abs(Math.imul(dayKey ^ 0x5bd1e995, 2654435761) >> 7) % 100;
switch (season(date)) {
case "winter": return roll < 60 ? "snow" : "clear";
case "spring": return roll < 40 ? "rain" : "clear";
case "summer": return roll < 15 ? "rain" : "clear";
case "autumn": return roll < 45 ? "leaves" : roll < 65 ? "rain" : "clear";
}
}
/** Falling rain, snow or leaves inside a window, moving with time; each pane gets its own scatter. */
export function drawWeather(ctx: CanvasRenderingContext2D, glass: Rect, weather: Weather, timeMs: number, seed: number): void {
if (weather === "clear") return;
const style = { rain: { color: "rgba(200,220,255,0.75)", w: 1, h: 3, speed: 0.06, drift: 0.01 }, snow: { color: "#f4f6fb", w: 1, h: 1, speed: 0.008, drift: 0.004 }, leaves: { color: "#d9822b", w: 2, h: 1, speed: 0.012, drift: 0.01 } }[weather];
ctx.fillStyle = style.color;
const count = Math.max(3, Math.floor(glass.w / 6));
for (let i = 0; i < count; i++) {
const offset = (seed * 37 + i * 53) % 1000;
const fall = (offset + timeMs * style.speed) % glass.h;
const sway = (offset * 7 + timeMs * style.drift) % glass.w;
ctx.fillRect(Math.floor(glass.x + sway), Math.floor(glass.y + fall), style.w, Math.min(style.h, glass.y + glass.h - Math.floor(glass.y + fall)));
}
}
function rgb(r: number, g: number, b: number): Rgb { function rgb(r: number, g: number, b: number): Rgb {
return { r, g, b }; return { r, g, b };
} }
@@ -19,9 +19,9 @@ export function RunRequestList({ loaded }: { loaded: LoadedRequests | null }) {
return ( return (
<div style={{ marginBottom: 20 }}> <div style={{ marginBottom: 20 }}>
<div className="section-label" style={{ marginBottom: 8 }}>{t("Model calls ({count})", { count: String(requests.length) })}</div> <div className="section-label" style={{ marginBottom: 8 }}>{t("Model calls ({count})", { count: String(requests.length) })}</div>
{requests.length === 0 && <div style={{ fontSize: 13, color: "var(--text-3)" }}>{t("This run made no model call.")}</div>} {requests.length === 0 && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("This run made no model call.")}</div>}
{requests.map((request, index) => ( {requests.map((request, index) => (
<div key={request.id} className="row" style={{ gap: 10, fontSize: 13, padding: "6px 0", borderBottom: "1px solid var(--border-soft)" }}> <div key={request.id} className="row" style={{ gap: 10, fontSize: "var(--fs-body)", padding: "6px 0", borderBottom: "1px solid var(--border-soft)" }}>
<span className="mono" style={{ color: "var(--text-3)", width: 24 }}>{index + 1}</span> <span className="mono" style={{ color: "var(--text-3)", width: 24 }}>{index + 1}</span>
<span style={{ width: 96 }}>{purposeLabel(request.purpose)}</span> <span style={{ width: 96 }}>{purposeLabel(request.purpose)}</span>
<span className="mono" style={{ flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" }}>{request.model}</span> <span className="mono" style={{ flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" }}>{request.model}</span>
@@ -1,3 +1,4 @@
import { XpBar } from "../../shared/XpBar";
import { Avatar, Pill } from "../../shared/ui"; import { Avatar, Pill } from "../../shared/ui";
import type { AgentRecord, HiringPolicyRecord, ProviderRecord } from "../../../../shared/domain"; import type { AgentRecord, HiringPolicyRecord, ProviderRecord } from "../../../../shared/domain";
import { money } from "../types"; import { money } from "../types";
@@ -42,7 +43,7 @@ export function BillingPanel({
<div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 12, marginBottom: 20 }}> <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 12, marginBottom: 20 }}>
<div className="card" style={{ padding: 14 }}> <div className="card" style={{ padding: 14 }}>
<div className="card-label" style={{ marginBottom: 8 }}>{t("Token usage (30d)")}</div> <div className="card-label" style={{ marginBottom: 8 }}>{t("Token usage (30d)")}</div>
<div style={{ display: "grid", gridTemplateColumns: "100px 1fr", gap: "6px 14px", fontSize: 12 }}> <div style={{ display: "grid", gridTemplateColumns: "100px 1fr", gap: "6px 14px", fontSize: "var(--fs-body)" }}>
<span style={{ color: "var(--text-3)" }}>{t("Input")}</span><span className="num">{inputTokens.toLocaleString()}</span> <span style={{ color: "var(--text-3)" }}>{t("Input")}</span><span className="num">{inputTokens.toLocaleString()}</span>
<span style={{ color: "var(--text-3)" }}>{t("of which cached")}</span><span className="num">{cachedTokens.toLocaleString()}</span> <span style={{ color: "var(--text-3)" }}>{t("of which cached")}</span><span className="num">{cachedTokens.toLocaleString()}</span>
<span style={{ color: "var(--text-3)" }}>{t("Output")}</span><span className="num">{outputTokens.toLocaleString()}</span> <span style={{ color: "var(--text-3)" }}>{t("Output")}</span><span className="num">{outputTokens.toLocaleString()}</span>
@@ -52,14 +53,12 @@ export function BillingPanel({
</div> </div>
<div className="card" style={{ padding: 14 }}> <div className="card" style={{ padding: 14 }}>
<div className="card-label" style={{ marginBottom: 8 }}>{t("Spent this month")}</div> <div className="card-label" style={{ marginBottom: 8 }}>{t("Spent this month")}</div>
<div style={{ height: 6, background: "var(--panel-3)", borderRadius: 3, overflow: "hidden", marginBottom: 8 }}> <div style={{ marginBottom: 8 }}><XpBar percent={totalBudget > 0 ? (spentCents / totalBudget) * 100 : 0} label={t("Spent this month")} /></div>
<div style={{ width: `${totalBudget > 0 ? Math.min(100, Math.round((spentCents / totalBudget) * 100)) : 0}%`, height: "100%", background: "var(--accent)" }} /> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>
</div>
<div style={{ fontSize: 12, color: "var(--text-3)" }}>
{t("${spent} of ${allocated} allocated to agents", { spent: (spentCents / 100).toFixed(2), allocated: (totalBudget / 100).toFixed(2) })} {t("${spent} of ${allocated} allocated to agents", { spent: (spentCents / 100).toFixed(2), allocated: (totalBudget / 100).toFixed(2) })}
{unpricedCalls > 0 && <> · {t("{count} calls not priced", { count: unpricedCalls })}</>} {unpricedCalls > 0 && <> · {t("{count} calls not priced", { count: unpricedCalls })}</>}
</div> </div>
<div style={{ fontSize: 12, color: "var(--text-3)", marginTop: 4 }}> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", marginTop: 4 }}>
{totalCap > 0 ? t("Allocations use {percent}% of department caps", { percent: Math.round((totalBudget / totalCap) * 100) }) : t("No budget cap set")} {totalCap > 0 ? t("Allocations use {percent}% of department caps", { percent: Math.round((totalBudget / totalCap) * 100) }) : t("No budget cap set")}
</div> </div>
</div> </div>
@@ -74,12 +73,12 @@ export function BillingPanel({
<div key={row.agent.id} className="table-row" style={{ gridTemplateColumns: "minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)", borderBottom: i === agentSpend.length - 1 ? "none" : "1px solid var(--border-soft)" }}> <div key={row.agent.id} className="table-row" style={{ gridTemplateColumns: "minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)", borderBottom: i === agentSpend.length - 1 ? "none" : "1px solid var(--border-soft)" }}>
<div className="row" style={{ gap: 8 }}> <div className="row" style={{ gap: 8 }}>
<Avatar name={row.agent.name} size="sm" bot /> <Avatar name={row.agent.name} size="sm" bot />
<span style={{ fontWeight: 480 }}>{row.agent.name}</span> <span>{row.agent.name}</span>
</div> </div>
<div className="num mono">{money(row.agent.budgetCents)}</div> <div className="num mono">{money(row.agent.budgetCents)}</div>
<div className="num mono">{row.requestCount}</div> <div className="num mono">{row.requestCount}</div>
<div className="num mono" style={{ fontSize: 12 }}>{row.tokens.toLocaleString()}</div> <div className="num mono" style={{ fontSize: "var(--fs-body)" }}>{row.tokens.toLocaleString()}</div>
<div className="num mono" style={{ fontSize: 12 }}>${(row.spentCents / 100).toFixed(2)}</div> <div className="num mono" style={{ fontSize: "var(--fs-body)" }}>${(row.spentCents / 100).toFixed(2)}</div>
</div> </div>
))} ))}
</div> </div>
@@ -96,8 +95,8 @@ export function BillingPanel({
return ( return (
<div key={provider.id} className="table-row" style={{ gridTemplateColumns: "minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)", borderBottom: index === providers.length - 1 ? "none" : "1px solid var(--border-soft)" }}> <div key={provider.id} className="table-row" style={{ gridTemplateColumns: "minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)", borderBottom: index === providers.length - 1 ? "none" : "1px solid var(--border-soft)" }}>
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0 }}>
<div style={{ fontWeight: 540 }}>{provider.label}</div> <div>{provider.label}</div>
{provider.model && <div style={{ fontSize: 12, color: "var(--text-3)" }}>{provider.model}</div>} {provider.model && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{provider.model}</div>}
</div> </div>
<div className="num mono">{activity?.requests ?? 0}</div> <div className="num mono">{activity?.requests ?? 0}</div>
<div>{errors > 0 ? <Pill tone="amber">{errors}</Pill> : <span className="num mono" style={{ color: "var(--text-3)" }}>0</span>}</div> <div>{errors > 0 ? <Pill tone="amber">{errors}</Pill> : <span className="num mono" style={{ color: "var(--text-3)" }}>0</span>}</div>
@@ -114,7 +113,7 @@ function StatTile({ label, value, tone }: { label: string; value: string; tone?:
return ( return (
<div className="card" style={{ padding: 14 }}> <div className="card" style={{ padding: 14 }}>
<div className="card-label" style={{ marginBottom: 6 }}>{label}</div> <div className="card-label" style={{ marginBottom: 6 }}>{label}</div>
<div className="num" style={{ fontSize: 18, fontWeight: 600, color: tone === "red" ? "var(--red)" : "var(--text-1)" }}>{value}</div> <div className="num" style={{ fontSize: "var(--fs-display)", color: tone === "red" ? "var(--red)" : "var(--text-1)" }}>{value}</div>
</div> </div>
); );
} }
@@ -44,10 +44,10 @@ export function CompanyDialog({ organization, open, actions, onClose }: { organi
<option value="zh">{WORK_LANGUAGE_NAMES.zh}</option> <option value="zh">{WORK_LANGUAGE_NAMES.zh}</option>
</select> </select>
</Field> </Field>
<p style={{ fontSize: 12, color: "var(--text-3)", margin: 0 }}>{t("Agents write messages, tasks, documents and deliverables in it. The display language does not change it, and a task can set its own.")}</p> <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", margin: 0 }}>{t("Agents write messages, tasks, documents and deliverables in it. The display language does not change it, and a task can set its own.")}</p>
<label className="checkbox-row"><input type="checkbox" name="autoApproveHires" defaultChecked={organization.autoApproveHires} /> {t("Auto-approve hires")}</label> <label className="checkbox-row"><input type="checkbox" name="autoApproveHires" defaultChecked={organization.autoApproveHires} /> {t("Auto-approve hires")}</label>
<label className="checkbox-row"><input type="checkbox" name="reviewDeliverables" defaultChecked={organization.reviewDeliverables} /> {t("Review deliverables before they are written")}</label> <label className="checkbox-row"><input type="checkbox" name="reviewDeliverables" defaultChecked={organization.reviewDeliverables} /> {t("Review deliverables before they are written")}</label>
<div style={{ fontSize: 12, color: "var(--text-3)" }}>{t("Changes apply to work from now on; requests already waiting keep their state.")}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("Changes apply to work from now on; requests already waiting keep their state.")}</div>
{error && <div className="form-error" role="alert">{error}</div>} {error && <div className="form-error" role="alert">{error}</div>}
</Dialog> </Dialog>
); );
@@ -48,7 +48,7 @@ export function DisconnectProviderDialog({ orgId, provider, revokesRemotely, act
) : impact === null ? ( ) : impact === null ? (
state.kind !== "error" && <p style={{ margin: 0, color: "var(--text-3)" }}>{t("Checking what this affects…")}</p> state.kind !== "error" && <p style={{ margin: 0, color: "var(--text-3)" }}>{t("Checking what this affects…")}</p>
) : ( ) : (
<ul style={{ margin: 0, paddingLeft: 18, lineHeight: 1.6, fontSize: 13 }}> <ul style={{ margin: 0, paddingLeft: 18, lineHeight: 1.6, fontSize: "var(--fs-body)" }}>
<li>{impact.agents.length <li>{impact.agents.length
? t("Agents on this provider stop working until it is reconnected or they move to another provider: {names}.", { names: impact.agents.join(", ") }) ? t("Agents on this provider stop working until it is reconnected or they move to another provider: {names}.", { names: impact.agents.join(", ") })
: t("No agent uses this provider.")}</li> : t("No agent uses this provider.")}</li>
@@ -20,11 +20,11 @@ export function GoalAuditPanel({ organization, providers, actions }: { organizat
return ( return (
<section> <section>
<div className="section-label" style={{ marginBottom: 6 }}>{t("Goal audit")}</div> <div className="section-label" style={{ marginBottom: 6 }}>{t("Goal audit")}</div>
<p style={{ color: "var(--text-2)", fontSize: 13, margin: "0 0 12px" }}> <p style={{ color: "var(--text-2)", fontSize: "var(--fs-body)", margin: "0 0 12px" }}>
{t("An independent model checks every goal before it closes. Pick one your agents do not use, ideally from another provider.")} {t("An independent model checks every goal before it closes. Pick one your agents do not use, ideally from another provider.")}
</p> </p>
{!organization.auditModelId && ( {!organization.auditModelId && (
<p style={{ color: "var(--red)", fontSize: 13, margin: "0 0 12px" }}>{t("No auditor is set, so goals cannot be closed yet.")}</p> <p style={{ color: "var(--red)", fontSize: "var(--fs-body)", margin: "0 0 12px" }}>{t("No auditor is set, so goals cannot be closed yet.")}</p>
)} )}
<form className="row" style={{ gap: 10, alignItems: "flex-end" }} onSubmit={save}> <form className="row" style={{ gap: 10, alignItems: "flex-end" }} onSubmit={save}>
<Field label={t("Provider")}> <Field label={t("Provider")}>
@@ -38,7 +38,7 @@ export function GoalAuditPanel({ organization, providers, actions }: { organizat
</Field> </Field>
<Button type="submit">{t("Save")}</Button> <Button type="submit">{t("Save")}</Button>
</form> </form>
{error && <p style={{ color: "var(--red)", fontSize: 13, margin: "8px 0 0" }}>{error}</p>} {error && <p style={{ color: "var(--red)", fontSize: "var(--fs-body)", margin: "8px 0 0" }}>{error}</p>}
</section> </section>
); );
} }
@@ -20,7 +20,7 @@ export function LanguageField({ uiPreferences, actions }: { uiPreferences: UiPre
<option value="en">{NAMES.en}</option> <option value="en">{NAMES.en}</option>
<option value="zh">{NAMES.zh}</option> <option value="zh">{NAMES.zh}</option>
</select> </select>
<span style={{ fontSize: 12, color: "var(--text-3)" }}>{t("Changes only what you see; agents keep the company's working language.")}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("Changes only what you see; agents keep the company's working language.")}</span>
<RestartForLanguage language={uiPreferences.language} /> <RestartForLanguage language={uiPreferences.language} />
</Field> </Field>
); );
@@ -47,12 +47,12 @@ export function RestartForLanguage({ language }: { language: UiLanguage }) {
}; };
return ( return (
<> <>
<span className="row" style={{ gap: 8, fontSize: 12 }} role="status"> <span className="row" style={{ gap: 8, fontSize: "var(--fs-body)" }} role="status">
{t("{language} applies after a restart.", { language: NAMES[language] })} {t("{language} applies after a restart.", { language: NAMES[language] })}
<Button size="small" onClick={confirm}>{t("Restart now")}</Button> <Button size="small" onClick={confirm}>{t("Restart now")}</Button>
</span> </span>
<Dialog title={t("Restart to switch language?")} open={confirming} submitLabel={t("Restart now")} onClose={() => setConfirming(false)} onSubmit={(event) => { event.preventDefault(); restart(); }}> <Dialog title={t("Restart to switch language?")} open={confirming} submitLabel={t("Restart now")} onClose={() => setConfirming(false)} onSubmit={(event) => { event.preventDefault(); restart(); }}>
<ul style={{ margin: 0, paddingLeft: 18, lineHeight: 1.6, fontSize: 13 }}> <ul style={{ margin: 0, paddingLeft: 18, lineHeight: 1.6, fontSize: "var(--fs-body)" }}>
<li>{t("Text you typed but have not sent or saved is lost.")}</li> <li>{t("Text you typed but have not sent or saved is lost.")}</li>
<li>{running === null <li>{running === null
? t("Counting running agent sessions…") ? t("Counting running agent sessions…")
@@ -44,7 +44,7 @@ export function ProviderConnectFields({
if (entry.authType === "api_key") { if (entry.authType === "api_key") {
return ( return (
<> <>
<p style={{ fontSize: 12, color: "var(--text-3)", lineHeight: 1.5, margin: 0 }}>{entry.credentialHelp}</p> <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", lineHeight: 1.5, margin: 0 }}>{entry.credentialHelp}</p>
<Field label={t("API key")}><input className="input" name="secret" type="password" required autoFocus /></Field> <Field label={t("API key")}><input className="input" name="secret" type="password" required autoFocus /></Field>
<ModelPicker entry={entry} provider={provider} /> <ModelPicker entry={entry} provider={provider} />
</> </>
@@ -56,7 +56,7 @@ export function ProviderConnectFields({
function SavedEndpointForm({ provider, entry }: { provider: ProviderRecord; entry: ProviderCatalogEntry }) { function SavedEndpointForm({ provider, entry }: { provider: ProviderRecord; entry: ProviderCatalogEntry }) {
const { endpoint, error } = useSavedEndpoint(provider, entry); const { endpoint, error } = useSavedEndpoint(provider, entry);
if (error) return <div className="form-error" role="alert">{t("The saved settings could not be read: {error}", { error })}</div>; if (error) return <div className="form-error" role="alert">{t("The saved settings could not be read: {error}", { error })}</div>;
if (endpoint === undefined) return <p style={{ fontSize: 12, color: "var(--text-3)", margin: 0 }}>{t("Loading saved settings…")}</p>; if (endpoint === undefined) return <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", margin: 0 }}>{t("Loading saved settings…")}</p>;
return entry.customEndpoint return entry.customEndpoint
? <CompatFieldsForm entry={entry} provider={provider} saved={endpoint} /> ? <CompatFieldsForm entry={entry} provider={provider} saved={endpoint} />
: <CloudFieldsForm entry={entry} provider={provider} saved={endpoint} />; : <CloudFieldsForm entry={entry} provider={provider} saved={endpoint} />;
@@ -78,7 +78,7 @@ export function ProviderOAuthFields({
const [model, setModel] = useState(provider.model ?? entry.defaultModel ?? entry.models[0]?.id ?? ""); const [model, setModel] = useState(provider.model ?? entry.defaultModel ?? entry.models[0]?.id ?? "");
return ( return (
<> <>
<p style={{ fontSize: 12, color: "var(--text-3)", lineHeight: 1.5, margin: 0 }}>{entry.credentialHelp}</p> <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", lineHeight: 1.5, margin: 0 }}>{entry.credentialHelp}</p>
<Field label={t("Default model")}> <Field label={t("Default model")}>
{entry.models.length ? ( {entry.models.length ? (
<select className="input" value={model} onChange={(event) => setModel(event.target.value)}> <select className="input" value={model} onChange={(event) => setModel(event.target.value)}>
@@ -105,7 +105,7 @@ function CompatFieldsForm({ entry, provider, saved }: { entry: ProviderCatalogEn
const [baseUrl, setBaseUrl] = useState(saved?.baseUrl ?? ""); const [baseUrl, setBaseUrl] = useState(saved?.baseUrl ?? "");
return ( return (
<> <>
<p style={{ fontSize: 12, color: "var(--text-3)", lineHeight: 1.5, margin: 0 }}>{entry.credentialHelp}</p> <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", lineHeight: 1.5, margin: 0 }}>{entry.credentialHelp}</p>
<Field label={t("Base URL")}> <Field label={t("Base URL")}>
<input <input
className="input" className="input"
@@ -178,9 +178,9 @@ export function ModelPicker({ entry, provider }: { entry: ProviderCatalogEntry;
{check === "running" ? t("Checking...") : t("Check for agent work")} {check === "running" ? t("Checking...") : t("Check for agent work")}
</button> </button>
)} )}
{typeof check === "object" && check.passed && <div style={{ color: "var(--green)", fontSize: 12, marginTop: 4 }}>{t("This model follows instructions and calls tools.")}</div>} {typeof check === "object" && check.passed && <div style={{ color: "var(--green)", fontSize: "var(--fs-body)", marginTop: 4 }}>{t("This model follows instructions and calls tools.")}</div>}
{typeof check === "object" && !check.passed && <div style={{ color: "var(--red)", fontSize: 12, marginTop: 4 }}>{t("This model cannot do agent work here: {detail}", { detail: check.detail })}</div>} {typeof check === "object" && !check.passed && <div style={{ color: "var(--red)", fontSize: "var(--fs-body)", marginTop: 4 }}>{t("This model cannot do agent work here: {detail}", { detail: check.detail })}</div>}
{error && <div style={{ color: "var(--red)", fontSize: 12, marginTop: 4 }}>{error}</div>} {error && <div style={{ color: "var(--red)", fontSize: "var(--fs-body)", marginTop: 4 }}>{error}</div>}
</Field> </Field>
); );
} }
@@ -190,7 +190,7 @@ function CloudFieldsForm({ entry, provider, saved }: { entry: ProviderCatalogEnt
const update = (patch: Partial<ProviderEndpoint>) => setState((current) => ({ ...current, ...patch })); const update = (patch: Partial<ProviderEndpoint>) => setState((current) => ({ ...current, ...patch }));
return ( return (
<> <>
<p style={{ fontSize: 12, color: "var(--text-3)", lineHeight: 1.5, margin: 0 }}>{entry.credentialHelp}</p> <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", lineHeight: 1.5, margin: 0 }}>{entry.credentialHelp}</p>
<Field label={t("Base URL")}> <Field label={t("Base URL")}>
<input className="input" name="cloudBaseUrl" value={state.baseUrl} onChange={(event) => update({ baseUrl: event.target.value })} /> <input className="input" name="cloudBaseUrl" value={state.baseUrl} onChange={(event) => update({ baseUrl: event.target.value })} />
</Field> </Field>
@@ -23,20 +23,18 @@ export function ProviderPolicyTable({
return ( return (
<> <>
<div className="section-label" style={{ marginBottom: 6 }}>{t("Runtime policy")}</div> <div className="section-label" style={{ marginBottom: 6 }}>{t("Runtime policy")}</div>
{/* What each column governs, so a change is made knowing what it reaches. */}
<ul style={{ fontSize: 12, color: "var(--text-3)", lineHeight: 1.6, margin: "0 0 10px", paddingLeft: 18 }}>
<li>{t("Scope: “Workspace” refuses every call that is not made for a workspace, including agent sessions on tasks without one.")}</li>
<li>{t("Data policy: zero data retention refuses background requests, so it also switches background off.")}</li>
<li>{t("Background: lets requests from the request console run in the provider's background mode.")}</li>
<li>{t("Monthly limit: counts every model call this company makes through the provider in the calendar month (UTC); at the limit, calls are refused and agent work waits until the month resets.")}</li>
<li>{t("Context window: the size new sessions fit prompts, skills, history and tool results into; sessions already running keep theirs.")}</li>
</ul>
<div className="card" style={{ padding: 0, overflowX: "auto", marginBottom: 28 }}> <div className="card" style={{ padding: 0, overflowX: "auto", marginBottom: 28 }}>
<div <div
className="table-row head" className="table-row head"
style={{ gridTemplateColumns: POLICY_GRID, minWidth: 940 }} style={{ gridTemplateColumns: POLICY_GRID, minWidth: 940 }}
> >
<div>{t("Provider")}</div><div>{t("Scope")}</div><div>{t("Data policy")}</div><div>{t("Background")}</div><div>{t("Monthly limit")}</div><div>{t("Context window (tokens)")}</div><div>{t("Usage")}</div> <div>{t("Provider")}</div>
<div title={t("Scope: “Workspace” refuses every call that is not made for a workspace, including agent sessions on tasks without one.")}>{t("Scope")}</div>
<div title={t("Data policy: zero data retention refuses background requests, so it also switches background off.")}>{t("Data policy")}</div>
<div title={t("Background: lets requests from the request console run in the provider's background mode.")}>{t("Background")}</div>
<div title={t("Monthly limit: counts every model call this company makes through the provider in the calendar month (UTC); at the limit, calls are refused and agent work waits until the month resets.")}>{t("Monthly limit")}</div>
<div title={t("Context window: the size new sessions fit prompts, skills, history and tool results into; sessions already running keep theirs.")}>{t("Context window (tokens)")}</div>
<div>{t("Usage")}</div>
</div> </div>
{providers.map((provider, index) => ( {providers.map((provider, index) => (
<ProviderPolicyRow <ProviderPolicyRow
@@ -123,8 +121,8 @@ function ProviderPolicyRow({
}} }}
> >
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0 }}>
<div style={{ fontWeight: 540, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</div> <div style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</div>
{linkedNote && <div style={{ fontSize: 12, color: "var(--text-3)" }}>{linkedNote}</div>} {linkedNote && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{linkedNote}</div>}
</div> </div>
<select <select
className="input" className="input"
@@ -144,7 +142,7 @@ function ProviderPolicyRow({
<option value={PROVIDER_DATA_POLICY.STANDARD}>{t("Standard retention")}</option> <option value={PROVIDER_DATA_POLICY.STANDARD}>{t("Standard retention")}</option>
<option value={PROVIDER_DATA_POLICY.ZERO_DATA_RETENTION}>{t("Zero data retention")}</option> <option value={PROVIDER_DATA_POLICY.ZERO_DATA_RETENTION}>{t("Zero data retention")}</option>
</select> </select>
<label className="row" style={{ gap: 8, fontSize: 12, color: "var(--text-2)" }}> <label className="row" style={{ gap: 8, fontSize: "var(--fs-body)", color: "var(--text-2)" }}>
<input <input
aria-label={t("{label} background execution", { label: provider.label })} aria-label={t("{label} background execution", { label: provider.label })}
type="checkbox" type="checkbox"
@@ -174,7 +172,7 @@ function ProviderPolicyRow({
/> />
<div> <div>
<div className="num mono">{rateLimit.requestCount} / {rateLimit.monthlyRequestLimit}</div> <div className="num mono">{rateLimit.requestCount} / {rateLimit.monthlyRequestLimit}</div>
<div style={{ fontSize: 11, color: "var(--text-3)" }}>{t("Resets {date} (UTC)", { date: rateLimit.windowEnd.slice(0, 10) })}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("Resets {date} (UTC)", { date: rateLimit.windowEnd.slice(0, 10) })}</div>
<div className="row" style={{ gap: 6, marginTop: 4 }}> <div className="row" style={{ gap: 6, marginTop: 4 }}>
<button type="button" className="button small" aria-label={t("Save {label} policy", { label: provider.label })} onClick={savePolicy} disabled={!dirty || status?.kind === "saving"}> <button type="button" className="button small" aria-label={t("Save {label} policy", { label: provider.label })} onClick={savePolicy} disabled={!dirty || status?.kind === "saving"}>
{t("Save")} {t("Save")}
@@ -108,7 +108,7 @@ export function ProviderRequestPanel({
</div> </div>
<Button type="submit" tone="primary"> <Button type="submit" tone="primary">
<span className="row" style={{ gap: 6 }}> <span className="row" style={{ gap: 6 }}>
<Icon name="send" size={16} /> <Icon name="send" />
{t("Run")} {t("Run")}
</span> </span>
</Button> </Button>
@@ -171,8 +171,8 @@ function ProviderRequestRow({
}} }}
> >
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0 }}>
<div style={{ fontWeight: 540, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</div> <div style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</div>
<div className="mono" style={{ fontSize: 12, color: "var(--text-3)" }}>{request.model}</div> <div className="mono" style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{request.model}</div>
</div> </div>
<div className="mono" style={{ color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{workspace?.name ?? t("Organization")}</div> <div className="mono" style={{ color: "var(--text-2)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{workspace?.name ?? t("Organization")}</div>
<div className="mono" style={{ color: "var(--text-2)" }}>{request.executionMode}</div> <div className="mono" style={{ color: "var(--text-2)" }}>{request.executionMode}</div>
@@ -180,7 +180,7 @@ function ProviderRequestRow({
<div className="mono" style={{ color: "var(--text-2)" }}>{t("{count} chars", { count: request.outputCharCount })}</div> <div className="mono" style={{ color: "var(--text-2)" }}>{t("{count} chars", { count: request.outputCharCount })}</div>
<Button size="small" tone="ghost" onClick={cancel} disabled={!canCancel}> <Button size="small" tone="ghost" onClick={cancel} disabled={!canCancel}>
<span className="row" style={{ gap: 5 }}> <span className="row" style={{ gap: 5 }}>
<Icon name="x" size={12} /> <Icon name="x" />
{t("Cancel")} {t("Cancel")}
</span> </span>
</Button> </Button>
@@ -140,7 +140,7 @@ export function ProvidersPanel({ orgId, companyName, employeeId, providers, auth
) )
)} )}
{active && ( {active && (
<p style={{ fontSize: 12, color: "var(--text-3)", margin: 0 }}> <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", margin: 0 }}>
{t("The default model reaches {following} agents without their own model; {own} keep their own. Sessions already started keep the model they began with.", { following: defaultModelReach(agents, active.id).following, own: defaultModelReach(agents, active.id).ownModel })} {t("The default model reaches {following} agents without their own model; {own} keep their own. Sessions already started keep the model they began with.", { following: defaultModelReach(agents, active.id).following, own: defaultModelReach(agents, active.id).ownModel })}
</p> </p>
)} )}
@@ -170,7 +170,7 @@ export function ProvidersPanel({ orgId, companyName, employeeId, providers, auth
<> <>
<ModelPicker entry={modelForEntry} provider={modelFor} /> <ModelPicker entry={modelForEntry} provider={modelFor} />
{modelError && <div className="form-error" role="alert">{modelError}</div>} {modelError && <div className="form-error" role="alert">{modelError}</div>}
<p style={{ fontSize: 12, color: "var(--text-3)", margin: 0 }}> <p style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", margin: 0 }}>
{t("The default model reaches {following} agents without their own model; {own} keep their own. Sessions already started keep the model they began with.", { following: defaultModelReach(agents, modelFor.id).following, own: defaultModelReach(agents, modelFor.id).ownModel })} {t("The default model reaches {following} agents without their own model; {own} keep their own. Sessions already started keep the model they began with.", { following: defaultModelReach(agents, modelFor.id).following, own: defaultModelReach(agents, modelFor.id).ownModel })}
</p> </p>
</> </>
@@ -215,7 +215,7 @@ function ProviderPricesRow({ orgId, provider, actions }: { orgId: string; provid
); );
return ( return (
<div className="table-row" style={{ gridTemplateColumns: PRICE_GRID, minWidth: 640 }}> <div className="table-row" style={{ gridTemplateColumns: PRICE_GRID, minWidth: 640 }}>
<div style={{ fontWeight: 540 }}>{provider.label}{provider.inputCentsPerMtok === null && <div style={{ fontSize: 12, color: "var(--text-3)" }}>{t("Unpriced: spend is not counted")}</div>}</div> <div>{provider.label}{provider.inputCentsPerMtok === null && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("Unpriced: spend is not counted")}</div>}</div>
{field(t("input"), input, setInput)} {field(t("input"), input, setInput)}
{field(t("cached input"), cached, setCached)} {field(t("cached input"), cached, setCached)}
{field(t("output"), output, setOutput)} {field(t("output"), output, setOutput)}
@@ -259,18 +259,17 @@ function ProviderRow({
padding: 14, padding: 14,
background: "var(--panel)", background: "var(--panel)",
border: "1px solid var(--border)", border: "1px solid var(--border)",
borderRadius: 10,
}} }}
> >
<ProviderLogo providerKey={provider.providerKey} label={provider.label} /> <ProviderLogo providerKey={provider.providerKey} label={provider.label} />
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 13.5, fontWeight: 540, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</div> <div style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</div>
<div style={{ fontSize: 12, color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{provider.model ? `${provider.model} · ` : ""}{readableAuth(provider.authType)}{authProfile ? ` · ${credentialSourceLabel(authProfile.sourceType)}` : ""} {provider.model ? `${provider.model} · ` : ""}{readableAuth(provider.authType)}{authProfile ? ` · ${credentialSourceLabel(authProfile.sourceType)}` : ""}
</div> </div>
</div> </div>
<ProviderHealth provider={provider} /> <ProviderHealth provider={provider} />
<div className="num mono" style={{ fontSize: 13, minWidth: 72, textAlign: "right" }}> <div className="num mono" style={{ fontSize: "var(--fs-body)", minWidth: 72, textAlign: "right" }}>
{boundCount === 1 ? t("{count} agent", { count: boundCount }) : t("{count} agents", { count: boundCount })} {boundCount === 1 ? t("{count} agent", { count: boundCount }) : t("{count} agents", { count: boundCount })}
</div> </div>
<span className="reveal row" style={{ gap: 6 }}> <span className="reveal row" style={{ gap: 6 }}>
@@ -308,14 +307,13 @@ function ProviderCard({ provider, onConnect }: { provider: ProviderRecord; onCon
padding: 14, padding: 14,
background: "var(--panel)", background: "var(--panel)",
border: "1px solid var(--border)", border: "1px solid var(--border)",
borderRadius: 10,
minWidth: 0, minWidth: 0,
}} }}
> >
<ProviderLogo providerKey={provider.providerKey} label={provider.label} /> <ProviderLogo providerKey={provider.providerKey} label={provider.label} />
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 13.5, fontWeight: 540, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</div> <div style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</div>
<div style={{ fontSize: 12, color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{readableAuth(provider.authType)} {readableAuth(provider.authType)}
</div> </div>
</div> </div>
@@ -10,5 +10,5 @@ export function ScopeNote({ scope, company }: { scope: SettingScope; company: st
: scope === "company_folders" : scope === "company_folders"
? t("Applies to {company} only; the folders are on this computer.", { company }) ? t("Applies to {company} only; the folders are on this computer.", { company })
: t("Applies to {company} only.", { company }); : t("Applies to {company} only.", { company });
return <div role="note" className="scope-note" style={{ fontSize: 12, color: "var(--text-3)", margin: "4px 0 10px" }}>{text}</div>; return <div role="note" className="scope-note" style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", margin: "4px 0 10px" }}>{text}</div>;
} }
@@ -67,7 +67,7 @@ export function WorkspacePanel({
<div className="page"> <div className="page">
<div className="row" style={{ alignItems: "baseline" }}> <div className="row" style={{ alignItems: "baseline" }}>
<h1 className="page-h1">{t("General")}</h1> <h1 className="page-h1">{t("General")}</h1>
<span style={{ marginLeft: "auto" }}><Button onClick={() => setEditOpen(true)}><Icon name="edit" size={14} /> {t("Edit company")}</Button></span> <span style={{ marginLeft: "auto" }}><Button onClick={() => setEditOpen(true)}><Icon name="edit" /> {t("Edit company")}</Button></span>
</div> </div>
<ScopeNote scope="company" company={organization.name} /> <ScopeNote scope="company" company={organization.name} />
<CompanyDialog key={editOpen ? "open" : "closed"} organization={organization} open={editOpen} actions={actions} onClose={() => setEditOpen(false)} /> <CompanyDialog key={editOpen ? "open" : "closed"} organization={organization} open={editOpen} actions={actions} onClose={() => setEditOpen(false)} />
@@ -100,6 +100,7 @@ export function WorkspacePanel({
<option value="system">{t("System")}</option> <option value="system">{t("System")}</option>
<option value="light">{t("Light")}</option> <option value="light">{t("Light")}</option>
<option value="dark">{t("Dark")}</option> <option value="dark">{t("Dark")}</option>
<option value="clock">{t("Follow the clock")}</option>
</select> </select>
</Field> </Field>
<LanguageField uiPreferences={uiPreferences} actions={actions} /> <LanguageField uiPreferences={uiPreferences} actions={actions} />
@@ -108,7 +109,7 @@ export function WorkspacePanel({
<div className="row reveal-row" style={{ marginBottom: 8 }}> <div className="row reveal-row" style={{ marginBottom: 8 }}>
<div className="section-label">{t("Workspaces")}</div> <div className="section-label">{t("Workspaces")}</div>
<span className="reveal" style={{ marginLeft: "auto" }}> <span className="reveal" style={{ marginLeft: "auto" }}>
<Button tone="ghost" onClick={() => setCreateOpen(true)}><Icon name="plus" size={16} /> {t("Add")}</Button> <Button tone="ghost" onClick={() => setCreateOpen(true)}><Icon name="plus" /> {t("Add")}</Button>
</span> </span>
</div> </div>
<ScopeNote scope="company_folders" company={organization.name} /> <ScopeNote scope="company_folders" company={organization.name} />
@@ -125,7 +126,7 @@ export function WorkspacePanel({
const form = document.querySelector<HTMLFormElement>("form:has([name='localPath'])"); const form = document.querySelector<HTMLFormElement>("form:has([name='localPath'])");
if (form) void chooseDirectory(form); if (form) void chooseDirectory(form);
}}> }}>
<Icon name="folder" size={16} /> {t("Browse")} <Icon name="folder" /> {t("Browse")}
</Button> </Button>
</div> </div>
</Field> </Field>
@@ -143,7 +144,7 @@ export function WorkspacePanel({
function KeyValue({ label, value }: { label: string; value: string }) { function KeyValue({ label, value }: { label: string; value: string }) {
return ( return (
<div className="row" style={{ padding: "6px 0", borderBottom: "1px solid var(--border-soft)" }}> <div className="row" style={{ padding: "6px 0", borderBottom: "1px solid var(--border-soft)" }}>
<span style={{ color: "var(--text-3)", width: 120, flexShrink: 0, fontSize: 12 }}>{label}</span> <span style={{ color: "var(--text-3)", width: 120, flexShrink: 0, fontSize: "var(--fs-body)" }}>{label}</span>
<span style={{ flex: 1, color: "var(--text-1)", overflow: "hidden", textOverflow: "ellipsis" }}>{value}</span> <span style={{ flex: 1, color: "var(--text-1)", overflow: "hidden", textOverflow: "ellipsis" }}>{value}</span>
</div> </div>
); );
@@ -33,8 +33,8 @@ export function WorkspaceRow({ workspace, projects, focused, actions }: { worksp
<div role="group" aria-label={workspace.name} aria-current={focused ? "true" : undefined} style={{ padding: "8px 0", borderBottom: "1px solid var(--border-soft)", background: focused ? "var(--accent-soft)" : undefined }}> <div role="group" aria-label={workspace.name} aria-current={focused ? "true" : undefined} style={{ padding: "8px 0", borderBottom: "1px solid var(--border-soft)", background: focused ? "var(--accent-soft)" : undefined }}>
<div className="row" style={{ gap: 8 }}> <div className="row" style={{ gap: 8 }}>
<div style={{ minWidth: 0, flex: 1 }}> <div style={{ minWidth: 0, flex: 1 }}>
<div style={{ fontWeight: 540 }}>{workspace.name}</div> <div>{workspace.name}</div>
<div style={{ fontSize: 12, color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{workspace.localPath}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{workspace.localPath}</div>
</div> </div>
{workspace.isPrimary {workspace.isPrimary
? <Pill tone="violet">{t("Primary")}</Pill> ? <Pill tone="violet">{t("Primary")}</Pill>
@@ -44,7 +44,7 @@ export function WorkspaceRow({ workspace, projects, focused, actions }: { worksp
</div> </div>
{confirmRemove && ( {confirmRemove && (
<div className="row" role="alertdialog" aria-label={t("Remove this workspace?")} style={{ gap: 8, marginTop: 6 }}> <div className="row" role="alertdialog" aria-label={t("Remove this workspace?")} style={{ gap: 8, marginTop: 6 }}>
<span style={{ fontSize: 13 }}>{t("Remove this workspace? Its folder stays on disk.")}</span> <span style={{ fontSize: "var(--fs-body)" }}>{t("Remove this workspace? Its folder stays on disk.")}</span>
<Button size="small" tone="primary" onClick={() => act(() => actions.run(() => window.agentCompany.deleteWorkspace({ orgId, workspaceId: workspace.id })))}>{t("Remove")}</Button> <Button size="small" tone="primary" onClick={() => act(() => actions.run(() => window.agentCompany.deleteWorkspace({ orgId, workspaceId: workspace.id })))}>{t("Remove")}</Button>
<Button size="small" tone="ghost" onClick={() => { setConfirmRemove(false); setError(null); }}>{t("Cancel")}</Button> <Button size="small" tone="ghost" onClick={() => { setConfirmRemove(false); setError(null); }}>{t("Cancel")}</Button>
</div> </div>
@@ -55,7 +55,7 @@ export function WorkspaceRow({ workspace, projects, focused, actions }: { worksp
<Field label={t("Local path")}> <Field label={t("Local path")}>
<div className="row" style={{ gap: 6 }}> <div className="row" style={{ gap: 6 }}>
<input className="input" name="localPath" data-workspace-path={workspace.id} defaultValue={workspace.localPath} required style={{ flex: 1 }} /> <input className="input" name="localPath" data-workspace-path={workspace.id} defaultValue={workspace.localPath} required style={{ flex: 1 }} />
<Button tone="ghost" onClick={browse}><Icon name="folder" size={16} /> {t("Browse")}</Button> <Button tone="ghost" onClick={browse}><Icon name="folder" /> {t("Browse")}</Button>
</div> </div>
</Field> </Field>
<Field label={t("Project")}> <Field label={t("Project")}>
+5 -3
View File
@@ -1,9 +1,10 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Avatar } from "../../shared/ui"; import { PixelAvatar } from "../office/PixelAvatar";
import { ceoIdOf, officeRoster } from "../office/roster";
import type { AgentRecord, EmployeeRecord } from "../../../../shared/domain"; import type { AgentRecord, EmployeeRecord } from "../../../../shared/domain";
import { t } from "../../i18n/i18n"; import { t } from "../../i18n/i18n";
const NODE_W = 208; const NODE_W = 232;
const NODE_H = 64; const NODE_H = 64;
const H_GAP = 24; const H_GAP = 24;
const V_GAP = 44; const V_GAP = 44;
@@ -47,6 +48,7 @@ export function OrgChartTree({
onSelectAgent: (agentId: string) => void; onSelectAgent: (agentId: string) => void;
}) { }) {
const layout = useMemo(() => buildLayout(boardChair, agents), [boardChair, agents]); const layout = useMemo(() => buildLayout(boardChair, agents), [boardChair, agents]);
const ceoId = useMemo(() => ceoIdOf(officeRoster(agents)), [agents]);
const scrollRef = useRef<HTMLDivElement>(null); const scrollRef = useRef<HTMLDivElement>(null);
const scaleRef = useRef(1); const scaleRef = useRef(1);
const pendingCenter = useRef<{ cx: number; cy: number } | null>(null); const pendingCenter = useRef<{ cx: number; cy: number } | null>(null);
@@ -126,7 +128,7 @@ export function OrgChartTree({
onClick={() => { if (node.agentId) onSelectAgent(node.agentId); }} onClick={() => { if (node.agentId) onSelectAgent(node.agentId); }}
disabled={!node.agentId} disabled={!node.agentId}
> >
<Avatar name={node.name} bot={!node.human} size="sm" /> {node.id !== "__org__" && <PixelAvatar id={node.id} isCeo={node.id === ceoId} />}
<span className="org-node-text"> <span className="org-node-text">
<span className="org-node-name">{node.name}</span> <span className="org-node-name">{node.name}</span>
<span className="org-node-role">{node.role}</span> <span className="org-node-role">{node.role}</span>
+2 -2
View File
@@ -43,8 +43,8 @@ export function ListView({
style={{ gridTemplateColumns: GRID, borderBottom: last ? "none" : "1px solid var(--border-soft)" }} style={{ gridTemplateColumns: GRID, borderBottom: last ? "none" : "1px solid var(--border-soft)" }}
> >
<div className="row" style={{ gap: 8, minWidth: 0, overflow: "hidden" }}> <div className="row" style={{ gap: 8, minWidth: 0, overflow: "hidden" }}>
{task.risk === "high" && <span style={{ width: 3, height: 12, background: "var(--red)", borderRadius: 2, flexShrink: 0 }} />} {task.risk === "high" && <span style={{ width: 3, height: 12, background: "var(--red)", flexShrink: 0 }} />}
<span style={{ fontWeight: 480, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}> <span style={{ minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{task.title} {task.title}
</span> </span>
{project && <span style={{ flexShrink: 0 }}><Pill>{truncate(project.name, 24)}</Pill></span>} {project && <span style={{ flexShrink: 0 }}><Pill>{truncate(project.name, 24)}</Pill></span>}
+7 -8
View File
@@ -19,7 +19,7 @@ export function ProgressView({ tasks, goals, projects }: { tasks: TaskRecord[];
return ( return (
<section key={goal.id} className="card" style={{ padding: 18 }}> <section key={goal.id} className="card" style={{ padding: 18 }}>
<div className="row" style={{ gap: 12 }}> <div className="row" style={{ gap: 12 }}>
<span style={{ fontWeight: 560, fontSize: 14, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 }}> <span style={{ fontSize: "var(--fs-body)", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 }}>
{goal.title} {goal.title}
</span> </span>
<CompletionReadout tasks={linked} /> <CompletionReadout tasks={linked} />
@@ -34,7 +34,7 @@ export function ProgressView({ tasks, goals, projects }: { tasks: TaskRecord[];
<div key={project.id} className="row" style={{ gap: 12 }}> <div key={project.id} className="row" style={{ gap: 12 }}>
<span <span
style={{ style={{
fontSize: 13, fontSize: "var(--fs-body)",
color: "var(--text-2)", color: "var(--text-2)",
minWidth: 0, minWidth: 0,
overflow: "hidden", overflow: "hidden",
@@ -59,7 +59,7 @@ export function ProgressView({ tasks, goals, projects }: { tasks: TaskRecord[];
{unlinked.length > 0 && ( {unlinked.length > 0 && (
<section className="card" style={{ padding: 18 }}> <section className="card" style={{ padding: 18 }}>
<div className="row" style={{ gap: 12 }}> <div className="row" style={{ gap: 12 }}>
<span style={{ fontWeight: 560, fontSize: 14, color: "var(--text-2)", flex: 1 }}>{t("Unlinked tasks")}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-2)", flex: 1 }}>{t("Unlinked tasks")}</span>
<CompletionReadout tasks={unlinked} /> <CompletionReadout tasks={unlinked} />
</div> </div>
<StatusBar tasks={unlinked} height={6} style={{ marginTop: 12 }} /> <StatusBar tasks={unlinked} height={6} style={{ marginTop: 12 }} />
@@ -80,7 +80,7 @@ function counts(tasks: TaskRecord[]): Map<TaskStatus, number> {
function StatusBar({ tasks, height, style }: { tasks: TaskRecord[]; height: number; style?: React.CSSProperties }) { function StatusBar({ tasks, height, style }: { tasks: TaskRecord[]; height: number; style?: React.CSSProperties }) {
const byStatus = counts(tasks); const byStatus = counts(tasks);
if (tasks.length === 0) { if (tasks.length === 0) {
return <div style={{ height, borderRadius: height, background: "var(--panel-3)", ...style }} />; return <div style={{ height, background: "var(--panel-3)", ...style }} />;
} }
return ( return (
<div style={{ display: "flex", gap: 2, height, ...style }}> <div style={{ display: "flex", gap: 2, height, ...style }}>
@@ -93,7 +93,6 @@ function StatusBar({ tasks, height, style }: { tasks: TaskRecord[]; height: numb
style={{ style={{
flex: count, flex: count,
background: segment.tone, background: segment.tone,
borderRadius: height,
minWidth: height, minWidth: height,
}} }}
/> />
@@ -108,8 +107,8 @@ function Legend({ tasks }: { tasks: TaskRecord[] }) {
return ( return (
<div className="row" style={{ gap: 14, marginTop: 10, flexWrap: "wrap" }}> <div className="row" style={{ gap: 14, marginTop: 10, flexWrap: "wrap" }}>
{SEGMENTS.map((segment) => ( {SEGMENTS.map((segment) => (
<span key={segment.id} className="row" style={{ gap: 6, fontSize: 12, color: "var(--text-3)" }}> <span key={segment.id} className="row" style={{ gap: 6, fontSize: "var(--fs-body)", color: "var(--text-3)" }}>
<span style={{ width: 8, height: 8, borderRadius: 2, background: segment.tone, flexShrink: 0 }} /> <span style={{ width: 8, height: 8, background: segment.tone, flexShrink: 0 }} />
<span className="num">{byStatus.get(segment.id) ?? 0}</span> <span className="num">{byStatus.get(segment.id) ?? 0}</span>
{segment.label} {segment.label}
</span> </span>
@@ -121,7 +120,7 @@ function Legend({ tasks }: { tasks: TaskRecord[] }) {
function CompletionReadout({ tasks }: { tasks: TaskRecord[] }) { function CompletionReadout({ tasks }: { tasks: TaskRecord[] }) {
const done = tasks.filter((task) => task.status === TASK_STATUS.DONE).length; const done = tasks.filter((task) => task.status === TASK_STATUS.DONE).length;
return ( return (
<span className="num" style={{ color: "var(--text-3)", fontSize: 13, flexShrink: 0 }}> <span className="num" style={{ color: "var(--text-3)", fontSize: "var(--fs-body)", flexShrink: 0 }}>
{done} / {tasks.length} {done} / {tasks.length}
</span> </span>
); );
@@ -53,7 +53,7 @@ function ProjectCard({
<article className="card" style={{ padding: 14, minWidth: 0 }}> <article className="card" style={{ padding: 14, minWidth: 0 }}>
<div className="row" style={{ alignItems: "flex-start", gap: 10 }}> <div className="row" style={{ alignItems: "flex-start", gap: 10 }}>
<div style={{ minWidth: 0, flex: 1 }}> <div style={{ minWidth: 0, flex: 1 }}>
<div style={{ fontWeight: 560, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{project.name}</div> <div style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{project.name}</div>
<div className="row" style={{ marginTop: 8, gap: 6, flexWrap: "wrap" }}> <div className="row" style={{ marginTop: 8, gap: 6, flexWrap: "wrap" }}>
<Pill>{project.status.replace(/_/g, " ")}</Pill> <Pill>{project.status.replace(/_/g, " ")}</Pill>
<Pill>{t("{done} / {total} tasks", { done, total: tasks.length })}</Pill> <Pill>{t("{done} / {total} tasks", { done, total: tasks.length })}</Pill>
@@ -64,7 +64,7 @@ function ProjectCard({
{lead && ( {lead && (
<div className="row" style={{ gap: 6, flexShrink: 0 }}> <div className="row" style={{ gap: 6, flexShrink: 0 }}>
<Avatar name={lead.name} size="sm" bot /> <Avatar name={lead.name} size="sm" bot />
<span style={{ fontSize: 12, color: "var(--text-2)" }}>{lead.name}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-2)" }}>{lead.name}</span>
</div> </div>
)} )}
</div> </div>
@@ -147,7 +147,7 @@ export function TaskDetailDialog({
<div className="modal" style={{ maxWidth: 560 }}> <div className="modal" style={{ maxWidth: 560 }}>
{confirmClose && <DiscardConfirm onKeep={() => setConfirmClose(false)} onDiscard={onClose} />} {confirmClose && <DiscardConfirm onKeep={() => setConfirmClose(false)} onDiscard={onClose} />}
<div className="row" style={{ alignItems: "flex-start", gap: 10, marginBottom: 8 }}> <div className="row" style={{ alignItems: "flex-start", gap: 10, marginBottom: 8 }}>
{task.priority === "high" && <span style={{ width: 3, height: 18, background: "var(--red)", borderRadius: 2, marginTop: 2, flexShrink: 0 }} />} {task.priority === "high" && <span style={{ width: 3, height: 18, background: "var(--red)", marginTop: 2, flexShrink: 0 }} />}
<h2 className="modal-title" style={{ margin: 0, flex: 1 }}>{task.title}</h2> <h2 className="modal-title" style={{ margin: 0, flex: 1 }}>{task.title}</h2>
<IconButton icon="edit" label={t("Edit")} onClick={() => { setEditError(null); setEditing(true); }} /> <IconButton icon="edit" label={t("Edit")} onClick={() => { setEditError(null); setEditing(true); }} />
<IconButton icon="x" label={t("Close")} onClick={requestClose} /> <IconButton icon="x" label={t("Close")} onClick={requestClose} />
@@ -203,15 +203,15 @@ export function TaskDetailDialog({
)} )}
{actionError && <div className="form-error" role="alert" style={{ marginTop: 8 }}>{actionError}</div>} {actionError && <div className="form-error" role="alert" style={{ marginTop: 8 }}>{actionError}</div>}
<div className="modal-actions"> <div className="modal-actions">
<Button tone="ghost" onClick={askDelete} disabled={deleteImpact !== null}><Icon name="x" size={16} /> {t("Delete")}</Button> <Button tone="ghost" onClick={askDelete} disabled={deleteImpact !== null}><Icon name="x" /> {t("Delete")}</Button>
{task.blockedReason {task.blockedReason
? <Button onClick={() => act(() => onBlock(task, null))}>{t("Unblock")}</Button> ? <Button onClick={() => act(() => onBlock(task, null))}>{t("Unblock")}</Button>
: task.status !== TASK_STATUS.DONE && !blocking && <Button onClick={() => setBlocking(true)}>{t("Block")}</Button>} : task.status !== TASK_STATUS.DONE && !blocking && <Button onClick={() => setBlocking(true)}>{t("Block")}</Button>}
{task.status === TASK_STATUS.REVIEW && <Button onClick={() => act(() => onMove(task, TASK_STATUS.IN_PROGRESS))}>{t("Send back")}</Button>} {task.status === TASK_STATUS.REVIEW && <Button onClick={() => act(() => onMove(task, TASK_STATUS.IN_PROGRESS))}>{t("Send back")}</Button>}
{task.status === TASK_STATUS.DONE && <Button onClick={() => act(() => onMove(task, TASK_STATUS.IN_PROGRESS))}>{t("Reopen")}</Button>} {task.status === TASK_STATUS.DONE && <Button onClick={() => act(() => onMove(task, TASK_STATUS.IN_PROGRESS))}>{t("Reopen")}</Button>}
{task.status === TASK_STATUS.IN_PROGRESS && <Button onClick={() => act(() => onMove(task, TASK_STATUS.BACKLOG))}>{t("Back to backlog")}</Button>} {task.status === TASK_STATUS.IN_PROGRESS && <Button onClick={() => act(() => onMove(task, TASK_STATUS.BACKLOG))}>{t("Back to backlog")}</Button>}
{assignee && <Button onClick={() => onRun(task)} disabled={runBlocker(task, provider, taskRuns) !== null}><Icon name="send" size={16} /> {t("Run")}</Button>} {assignee && <Button onClick={() => onRun(task)} disabled={runBlocker(task, provider, taskRuns) !== null}><Icon name="send" /> {t("Run")}</Button>}
{advanceTo && <Button tone="primary" onClick={() => onAdvance(task)}><Icon name="check" size={16} /> {prettyStatus(advanceTo)}</Button>} {advanceTo && <Button tone="primary" onClick={() => onAdvance(task)}><Icon name="check" /> {prettyStatus(advanceTo)}</Button>}
</div> </div>
{editing && ( {editing && (
@@ -244,9 +244,9 @@ function OverviewTab({ task, assignee, project, goal, workspace, provider, runs,
<> <>
{task.hold && <TaskHoldNotice hold={task.hold} />} {task.hold && <TaskHoldNotice hold={task.hold} />}
{task.description && ( {task.description && (
<p style={{ margin: "0 0 14px", color: "var(--text-2)", fontSize: 14, lineHeight: 1.55, whiteSpace: "pre-wrap" }}>{task.description}</p> <p style={{ margin: "0 0 14px", color: "var(--text-2)", fontSize: "var(--fs-body)", lineHeight: 1.55, whiteSpace: "pre-wrap" }}>{task.description}</p>
)} )}
<div style={{ display: "grid", gridTemplateColumns: "100px 1fr", gap: "8px 14px", fontSize: 12 }}> <div style={{ display: "grid", gridTemplateColumns: "100px 1fr", gap: "8px 14px", fontSize: "var(--fs-body)" }}>
<MetaLabel>{t("Assignee")}</MetaLabel> <MetaLabel>{t("Assignee")}</MetaLabel>
<div className="row" style={{ gap: 8 }}> <div className="row" style={{ gap: 8 }}>
{assignee ? (<><Avatar name={assignee.name} size="sm" bot /><span>{assignee.name}</span>{provider && <span style={{ color: "var(--text-3)" }}>({provider.label})</span>}</>) : <span style={{ color: "var(--text-4)" }}>{t("Unassigned")}</span>} {assignee ? (<><Avatar name={assignee.name} size="sm" bot /><span>{assignee.name}</span>{provider && <span style={{ color: "var(--text-3)" }}>({provider.label})</span>}</>) : <span style={{ color: "var(--text-4)" }}>{t("Unassigned")}</span>}
@@ -266,14 +266,14 @@ function OverviewTab({ task, assignee, project, goal, workspace, provider, runs,
<button type="button" className="link-button" aria-label={t("Open run {id}", { id: run.id })} onClick={() => navigate("runs", { kind: "run", id: run.id })}> <button type="button" className="link-button" aria-label={t("Open run {id}", { id: run.id })} onClick={() => navigate("runs", { kind: "run", id: run.id })}>
<Pill tone={runTone(run.state)}>{prettyRunState(run.state)}</Pill> <Pill tone={runTone(run.state)}>{prettyRunState(run.state)}</Pill>
</button> </button>
<span style={{ color: "var(--text-3)", fontSize: 12 }}>{runTriggerLabel(run.trigger)}</span> <span style={{ color: "var(--text-3)", fontSize: "var(--fs-body)" }}>{runTriggerLabel(run.trigger)}</span>
<span className="num" style={{ marginLeft: "auto", color: "var(--text-3)", fontSize: 12 }}>{formatRelative(run.createdAt)}</span> <span className="num" style={{ marginLeft: "auto", color: "var(--text-3)", fontSize: "var(--fs-body)" }}>{formatRelative(run.createdAt)}</span>
</div> </div>
{run.state === "failed" && run.errorMessage && ( {run.state === "failed" && run.errorMessage && (
<span style={{ color: "var(--red)", fontSize: 12, paddingLeft: 4 }}>{run.errorMessage}</span> <span style={{ color: "var(--red)", fontSize: "var(--fs-body)", paddingLeft: 4 }}>{run.errorMessage}</span>
)} )}
{run.capabilityWarnings && ( {run.capabilityWarnings && (
<span style={{ color: "var(--amber)", fontSize: 12, paddingLeft: 4, whiteSpace: "pre-wrap" }}>{t("Missing this run")}: {run.capabilityWarnings}</span> <span style={{ color: "var(--amber)", fontSize: "var(--fs-body)", paddingLeft: 4, whiteSpace: "pre-wrap" }}>{t("Missing this run")}: {run.capabilityWarnings}</span>
)} )}
</div> </div>
))} ))}
@@ -287,13 +287,13 @@ function OverviewTab({ task, assignee, project, goal, workspace, provider, runs,
function SubtasksTab({ subtasks, agents, onOpenTask }: { subtasks: TaskRecord[]; agents: AgentRecord[]; onOpenTask: (taskId: string) => void }) { function SubtasksTab({ subtasks, agents, onOpenTask }: { subtasks: TaskRecord[]; agents: AgentRecord[]; onOpenTask: (taskId: string) => void }) {
return ( return (
<div style={{ minHeight: 60 }}> <div style={{ minHeight: 60 }}>
{subtasks.length === 0 && <div style={{ fontSize: 14, color: "var(--text-3)" }}>{t("No subtasks")}</div>} {subtasks.length === 0 && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("No subtasks")}</div>}
{subtasks.map((st) => { {subtasks.map((st) => {
const owner = agents.find((a) => a.id === st.assigneeAgentId); const owner = agents.find((a) => a.id === st.assigneeAgentId);
return ( return (
<div key={st.id} className="row" style={{ gap: 10, padding: "8px 0", borderBottom: "1px solid var(--border-soft)" }}> <div key={st.id} className="row" style={{ gap: 10, padding: "8px 0", borderBottom: "1px solid var(--border-soft)" }}>
<Icon name={st.status === TASK_STATUS.DONE ? "check" : "work"} size={16} color={st.status === TASK_STATUS.DONE ? "var(--green)" : "var(--text-3)"} /> <Icon name={st.status === TASK_STATUS.DONE ? "check" : "work"} color={st.status === TASK_STATUS.DONE ? "var(--green)" : "var(--text-3)"} />
<button type="button" className="link-button" aria-label={t("Open task {title}", { title: st.title })} onClick={() => onOpenTask(st.id)} style={{ flex: 1, fontSize: 14, fontWeight: 480, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", textAlign: "left" }}>{st.title}</button> <button type="button" className="link-button" aria-label={t("Open task {title}", { title: st.title })} onClick={() => onOpenTask(st.id)} style={{ flex: 1, fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", textAlign: "left" }}>{st.title}</button>
<Pill>{prettyStatus(st.status)}</Pill> <Pill>{prettyStatus(st.status)}</Pill>
{owner && <Avatar name={owner.name} size="sm" bot />} {owner && <Avatar name={owner.name} size="sm" bot />}
</div> </div>
@@ -312,18 +312,18 @@ function ActivityTab({ audit, approvals, onOpenApproval }: { audit: AuditEventRe
{approvals.map((a) => ( {approvals.map((a) => (
<div key={a.id} className="row" style={{ gap: 8, padding: "6px 0" }}> <div key={a.id} className="row" style={{ gap: 8, padding: "6px 0" }}>
<Pill tone={a.state === "approved" ? "green" : a.state === "pending" ? "amber" : "red"}>{approvalStateLabel(a.state)}</Pill> <Pill tone={a.state === "approved" ? "green" : a.state === "pending" ? "amber" : "red"}>{approvalStateLabel(a.state)}</Pill>
<button type="button" className="link-button" style={{ fontSize: 12 }} aria-label={t("Open approval {title}", { title: a.title })} onClick={() => onOpenApproval(a.id)}>{a.title}</button> <button type="button" className="link-button" style={{ fontSize: "var(--fs-body)" }} aria-label={t("Open approval {title}", { title: a.title })} onClick={() => onOpenApproval(a.id)}>{a.title}</button>
<span className="mono" style={{ marginLeft: "auto", fontSize: 12, color: "var(--text-3)" }}>{formatRelative(a.createdAt)}</span> <span className="mono" style={{ marginLeft: "auto", fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{formatRelative(a.createdAt)}</span>
</div> </div>
))} ))}
</div> </div>
)} )}
<div className="section-label">{t("Events")}</div> <div className="section-label">{t("Events")}</div>
{audit.length === 0 && <div style={{ fontSize: 14, color: "var(--text-3)" }}>{t("No events")}</div>} {audit.length === 0 && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("No events")}</div>}
{audit.map((e) => ( {audit.map((e) => (
<div key={e.id} className="row" style={{ gap: 8, padding: "5px 0" }}> <div key={e.id} className="row" style={{ gap: 8, padding: "5px 0" }}>
<span className="mono" style={{ fontSize: 12, color: "var(--text-3)", flexShrink: 0 }}>{formatRelative(e.createdAt)}</span> <span className="mono" style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", flexShrink: 0 }}>{formatRelative(e.createdAt)}</span>
<span style={{ fontSize: 12, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{taskEventLabel(e.action)}</span> <span style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{taskEventLabel(e.action)}</span>
</div> </div>
))} ))}
</div> </div>
@@ -339,9 +339,9 @@ function EditOverlay({ onEdited, task, companyLanguage, agents, allTasks, projec
const beneath = descendantIds(task.id, allTasks); const beneath = descendantIds(task.id, allTasks);
const otherTasks = allTasks.filter((t) => t.id !== task.id && t.orgId === task.orgId && !beneath.has(t.id)); const otherTasks = allTasks.filter((t) => t.id !== task.id && t.orgId === task.orgId && !beneath.has(t.id));
return ( return (
<div style={{ position: "absolute", inset: 0, background: "var(--bg)", borderRadius: 14, padding: 24, overflow: "auto", zIndex: 2 }}> <div style={{ position: "absolute", inset: 0, background: "var(--bg)", padding: 24, overflow: "auto", zIndex: 2 }}>
<form onSubmit={submit} onInput={onEdited} onChange={onEdited} aria-busy={busy}> <form onSubmit={submit} onInput={onEdited} onChange={onEdited} aria-busy={busy}>
<h3 style={{ margin: "0 0 14px", fontSize: 15, fontWeight: 600 }}>{t("Edit task")}</h3> <h3 style={{ margin: "0 0 14px", fontSize: "var(--fs-body)" }}>{t("Edit task")}</h3>
<Field label={t("Title")}><input className="input" name="title" defaultValue={task.title} required /></Field> <Field label={t("Title")}><input className="input" name="title" defaultValue={task.title} required /></Field>
<Field label={t("Description")}><textarea className="input" name="description" rows={4} defaultValue={task.description} /></Field> <Field label={t("Description")}><textarea className="input" name="description" rows={4} defaultValue={task.description} /></Field>
<Field label={t("Assignee")}> <Field label={t("Assignee")}>
@@ -423,10 +423,10 @@ function DeleteConfirm({ impact, onConfirm, onCancel }: { impact: TaskDeleteImpa
impact.pendingApprovals > 0 && t("{n} pending approvals for it stay pending.", { n: impact.pendingApprovals }), impact.pendingApprovals > 0 && t("{n} pending approvals for it stay pending.", { n: impact.pendingApprovals }),
].filter((line): line is string => typeof line === "string"); ].filter((line): line is string => typeof line === "string");
return ( return (
<div role="alertdialog" aria-label={t("Delete this task?")} style={{ marginTop: 12, padding: 12, border: "1px solid var(--red)", borderRadius: 10 }}> <div role="alertdialog" aria-label={t("Delete this task?")} style={{ marginTop: 12, padding: 12, border: "1px solid var(--red)" }}>
<div style={{ fontWeight: 600, marginBottom: 6 }}>{t("Delete this task?")}</div> <div style={{ marginBottom: 6 }}>{t("Delete this task?")}</div>
{lines.length === 0 && <div style={{ fontSize: 13, color: "var(--text-2)" }}>{t("Nothing else is affected.")}</div>} {lines.length === 0 && <div style={{ fontSize: "var(--fs-body)", color: "var(--text-2)" }}>{t("Nothing else is affected.")}</div>}
{lines.map((line) => <div key={line} style={{ fontSize: 13, color: "var(--text-2)" }}>{line}</div>)} {lines.map((line) => <div key={line} style={{ fontSize: "var(--fs-body)", color: "var(--text-2)" }}>{line}</div>)}
{impact.running > 0 && <div className="form-error" role="alert">{t("A session is running; stop it or wait for it before deleting.")}</div>} {impact.running > 0 && <div className="form-error" role="alert">{t("A session is running; stop it or wait for it before deleting.")}</div>}
<div className="row" style={{ gap: 8, marginTop: 10 }}> <div className="row" style={{ gap: 8, marginTop: 10 }}>
<Button tone="primary" size="small" onClick={onConfirm} disabled={impact.running > 0}>{t("Delete task")}</Button> <Button tone="primary" size="small" onClick={onConfirm} disabled={impact.running > 0}>{t("Delete task")}</Button>
@@ -14,9 +14,9 @@ export function TaskHoldNotice({ hold }: { hold: TaskHold }) {
: t("Waiting on you."); : t("Waiting on you.");
const color = hold.waitingOn === "operator" ? "var(--red)" : "var(--amber)"; const color = hold.waitingOn === "operator" ? "var(--red)" : "var(--amber)";
return ( return (
<div role="status" style={{ marginBottom: 12, fontSize: 13, color, lineHeight: 1.5 }}> <div role="status" style={{ marginBottom: 12, fontSize: "var(--fs-body)", color, lineHeight: 1.5 }}>
<div>{hold.reason}</div> <div>{hold.reason}</div>
<div style={{ fontWeight: 600 }}>{next}</div> <div>{next}</div>
</div> </div>
); );
} }
+1 -1
View File
@@ -7,7 +7,7 @@ export function DiscardConfirm({ onKeep, onDiscard }: { onKeep: () => void; onDi
return ( return (
<Modal label={t("Discard your changes?")} role="alertdialog" onEscape={onKeep} onBackdrop={onKeep}> <Modal label={t("Discard your changes?")} role="alertdialog" onEscape={onKeep} onBackdrop={onKeep}>
<div className="modal" style={{ maxWidth: 360 }}> <div className="modal" style={{ maxWidth: 360 }}>
<p style={{ margin: "0 0 12px", fontSize: 14 }}>{t("Discard your changes?")}</p> <p style={{ margin: "0 0 12px", fontSize: "var(--fs-body)" }}>{t("Discard your changes?")}</p>
<div className="modal-actions"> <div className="modal-actions">
<Button tone="ghost" onClick={onKeep}>{t("Keep editing")}</Button> <Button tone="ghost" onClick={onKeep}>{t("Keep editing")}</Button>
<Button tone="primary" onClick={onDiscard}>{t("Discard")}</Button> <Button tone="primary" onClick={onDiscard}>{t("Discard")}</Button>
+8 -12
View File
@@ -1,5 +1,5 @@
import { Component, type ErrorInfo, type ReactNode } from "react"; import { Component, type ErrorInfo, type ReactNode } from "react";
import { Button } from "./ui"; import { GameOver } from "./GameOver";
import { t } from "../i18n/i18n"; import { t } from "../i18n/i18n";
/** Contains a render error to the part of the app that threw, says what failed, and offers a way back; the error is logged with its component stack. */ /** Contains a render error to the part of the app that threw, says what failed, and offers a way back; the error is logged with its component stack. */
@@ -19,17 +19,13 @@ export class ErrorBoundary extends Component<{ scope: "page" | "app"; children:
if (!error) return this.props.children; if (!error) return this.props.children;
const page = this.props.scope === "page"; const page = this.props.scope === "page";
return ( return (
<div role="alert" style={{ padding: 24, display: "grid", gap: 10, maxWidth: 560 }}> <div style={{ padding: 24 }}>
<strong>{page ? t("This page could not be shown.") : t("AgentCompany hit an error it could not recover from here.")}</strong> <GameOver
<div className="mono" style={{ fontSize: 12, color: "var(--text-2)", wordBreak: "break-word" }}>{error.message}</div> title={page ? t("This page could not be shown.") : t("AgentCompany hit an error it could not recover from here.")}
<div style={{ fontSize: 13, color: "var(--text-3)" }}> error={error.message}
{page ? t("The rest of the app still works; go to another page or try this one again.") : t("Reloading the window starts it again; your data is kept.")} note={page ? t("The rest of the app still works; Continue tries this page again.") : t("Continue reloads the window; your data is kept.")}
</div> onContinue={page ? () => this.setState({ error: null }) : () => window.location.reload()}
<div> />
{page
? <Button onClick={() => this.setState({ error: null })}>{t("Try again")}</Button>
: <Button onClick={() => window.location.reload()}>{t("Reload")}</Button>}
</div>
</div> </div>
); );
} }
+1 -1
View File
@@ -17,7 +17,7 @@ export function ErrorText({ message, action }: { message: string; action?: { lab
}); });
}; };
return ( return (
<div role="alert" className="row" style={{ gap: 10, alignItems: "flex-start", fontSize: 13, color: "var(--red)", marginBottom: 14 }}> <div role="alert" className="row" style={{ gap: 10, alignItems: "flex-start", fontSize: "var(--fs-body)", color: "var(--red)", marginBottom: 14 }}>
<span style={{ flex: 1, minWidth: 0, whiteSpace: "pre-wrap", wordBreak: "break-word", userSelect: "text" }}>{message}</span> <span style={{ flex: 1, minWidth: 0, whiteSpace: "pre-wrap", wordBreak: "break-word", userSelect: "text" }}>{message}</span>
<Button size="small" onClick={copyMessage}>{copy === "copied" ? t("Copied") : copy === "failed" ? t("Copy failed") : t("Copy")}</Button> <Button size="small" onClick={copyMessage}>{copy === "copied" ? t("Copied") : copy === "failed" ? t("Copy failed") : t("Copy")}</Button>
{action && <Button size="small" onClick={action.onClick}>{action.label}</Button>} {action && <Button size="small" onClick={action.onClick}>{action.label}</Button>}
+1 -1
View File
@@ -29,7 +29,7 @@ export function FailureToasts() {
<div style={{ position: "fixed", right: 16, bottom: 16, zIndex: 1000, display: "grid", gap: 8, maxWidth: 420 }}> <div style={{ position: "fixed", right: 16, bottom: 16, zIndex: 1000, display: "grid", gap: 8, maxWidth: 420 }}>
{failures.map((failure) => ( {failures.map((failure) => (
<div key={failure.id} role="alert" className="card" style={{ display: "flex", gap: 8, alignItems: "flex-start", borderColor: "var(--red)", padding: 12 }}> <div key={failure.id} role="alert" className="card" style={{ display: "flex", gap: 8, alignItems: "flex-start", borderColor: "var(--red)", padding: 12 }}>
<div style={{ flex: 1, minWidth: 0, fontSize: 13 }}> <div style={{ flex: 1, minWidth: 0, fontSize: "var(--fs-body)" }}>
<strong style={{ display: "block", marginBottom: 2 }}>{t("That did not work")}</strong> <strong style={{ display: "block", marginBottom: 2 }}>{t("That did not work")}</strong>
<span style={{ color: "var(--text-2)", wordBreak: "break-word" }}>{failure.message}</span> <span style={{ color: "var(--text-2)", wordBreak: "break-word" }}>{failure.message}</span>
</div> </div>
+16
View File
@@ -0,0 +1,16 @@
import type { ReactNode } from "react";
import { Button } from "./ui";
import { t } from "../i18n/i18n";
/** A failure as a game-over screen: what failed, the error itself, what happens next, and Continue to try again. */
export function GameOver({ title, error, note, onContinue }: { title: string; error: string; note: ReactNode; onContinue: () => void }) {
return (
<div role="alert" className="game-over modal">
<div className="game-over-banner" aria-hidden="true">{t("GAME OVER")}</div>
<strong>{title}</strong>
<div className="mono game-over-error">{error}</div>
<div className="game-over-note">{note}</div>
<div><Button tone="primary" onClick={onContinue}>{t("Continue")}</Button></div>
</div>
);
}
+17 -68
View File
@@ -1,79 +1,28 @@
import type { ReactNode } from "react"; import { PIXEL_ICONS } from "./pixel-icons";
const PATHS: Record<string, ReactNode> = { export type IconName = keyof typeof PIXEL_ICONS;
home: <><path d="M3 12 12 3l9 9" /><path d="M5 10v10h14V10" /></>,
inbox: <><path d="M22 12h-6l-2 3h-4l-2-3H2" /><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11Z" /></>,
team: <><circle cx="9" cy="8" r="3.2" /><path d="M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6" /><circle cx="17" cy="9" r="2.6" /><path d="M21 18.5c0-2.5-2-4.5-4.5-4.5" /></>,
work: <><rect x="3" y="4" width="18" height="16" rx="2" /><path d="M8 4v16M16 4v16" /></>,
chat: <path d="M21 12a8 8 0 0 1-11.6 7.15L4 20l1-4.4A8 8 0 1 1 21 12Z" />,
docs: <><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" /><path d="M14 3v5h5" /></>,
approve: <><path d="M9 12l2 2 4-4" /><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z" /></>,
social: <><path d="M4 11a8 8 0 0 1 8-8" /><path d="M4 11v4a4 4 0 0 0 4 4h1" /><circle cx="18" cy="6" r="2" /><circle cx="6" cy="18" r="2" /><circle cx="18" cy="18" r="2" /><path d="M8 17l8-9M18 8v8" /></>,
settings: <><circle cx="12" cy="12" r="3" /><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1Z" /></>,
search: <><circle cx="11" cy="11" r="7" /><path d="m20 20-3-3" /></>,
plus: <path d="M12 5v14M5 12h14" />,
minus: <path d="M5 12h14" />,
chevron: <path d="m9 18 6-6-6-6" />,
chevronDown: <path d="m6 9 6 6 6-6" />,
chevronLeft: <path d="m15 18-6-6 6-6" />,
more: <><circle cx="5" cy="12" r="1" /><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /></>,
edit: <><path d="M12 20h9" /><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z" /></>,
filter: <path d="M3 5h18M6 12h12M10 19h4" />,
file: <><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" /><path d="M14 3v6h6" /></>,
folder: <path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" />,
grid: <><rect x="3" y="3" width="7" height="7" rx="1" /><rect x="14" y="3" width="7" height="7" rx="1" /><rect x="3" y="14" width="7" height="7" rx="1" /><rect x="14" y="14" width="7" height="7" rx="1" /></>,
list: <path d="M8 6h13M8 12h13M8 18h13M4 6h.01M4 12h.01M4 18h.01" />,
upload: <><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><path d="m17 8-5-5-5 5M12 3v12" /></>,
arrowRight: <path d="M5 12h14M13 5l7 7-7 7" />,
arrowUpRight: <path d="M7 17 17 7M7 7h10v10" />,
sparkle: <path d="M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1" />,
bot: <><rect x="4" y="7" width="16" height="12" rx="3" /><circle cx="9" cy="13" r="1" /><circle cx="15" cy="13" r="1" /><path d="M12 3v4M8 19v2M16 19v2" /></>,
user: <><circle cx="12" cy="8" r="4" /><path d="M4 21c0-4.4 3.6-8 8-8s8 3.6 8 8" /></>,
check: <path d="M5 12.5 10 17l9-10" />,
x: <path d="M18 6 6 18M6 6l12 12" />,
pin: <><path d="m12 17 .01 5M9.2 12.8 5 17M19 8c-1.3 0-3.5.3-4.7 1.5l-2 2c-.4.5-.4 1.1 0 1.5L14.7 15c.4.4 1 .4 1.5 0l2-2C19.4 11.6 20 9.5 20 8.2c0-.1-.1-.2-.2-.2" /></>,
attach: <path d="m21 11.5-9.6 9.6a5.5 5.5 0 0 1-7.8-7.8l9.6-9.6a3.7 3.7 0 0 1 5.2 5.2L8.8 18.4a1.8 1.8 0 0 1-2.6-2.6L15 7" />,
send: <><path d="m22 2-7 20-4-9-9-4Z" /><path d="M22 2 11 13" /></>,
hash: <path d="M4 9h16M4 15h16M10 3 8 21M16 3l-2 18" />,
lock: <><rect x="4" y="11" width="16" height="10" rx="2" /><path d="M8 11V7a4 4 0 0 1 8 0v4" /></>,
bell: <><path d="M6 8a6 6 0 1 1 12 0c0 7 3 9 3 9H3s3-2 3-9" /><path d="M10 21a2 2 0 0 0 4 0" /></>,
cmd: <path d="M15 15h3a3 3 0 0 0 0-6h-3v6Zm0 0v-6h-6m6 6v3a3 3 0 0 1-6 0v-3m0 0H6a3 3 0 0 1 0-6h3m0 6v-6m0 0V6a3 3 0 1 0-3 3h3Z" />,
refresh: <><path d="M21 12a9 9 0 1 1-3-6.7" /><path d="M21 3v6h-6" /></>,
pause: <><rect x="6" y="5" width="4" height="14" rx="1" /><rect x="14" y="5" width="4" height="14" rx="1" /></>,
shield: <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z" />,
calendar: <><rect x="3" y="4.5" width="18" height="16" rx="2" /><path d="M3 9h18M8 2.5v4M16 2.5v4" /></>,
target: <><circle cx="12" cy="12" r="8" /><circle cx="12" cy="12" r="3.6" /></>,
};
export type IconName = keyof typeof PATHS | (string & {}); /** Each row's lit runs as one path, so an icon is a single crisp shape. */
function bitmapPath(bitmap: string): string {
return bitmap.split(" ").flatMap((row, y) =>
[...row.matchAll(/#+/g)].map((run) => `M${run.index} ${y}h${run[0].length}v1h-${run[0].length}z`),
).join("");
}
export function Icon({ const PATHS = Object.fromEntries(Object.entries(PIXEL_ICONS).map(([name, bitmap]) => [name, bitmapPath(bitmap)])) as Record<IconName, string>;
name,
size = 18, /** A 12-pixel icon drawn on the same whole-screen-pixel grid as the pixel font. */
color = "currentColor", export function Icon({ name, color = "currentColor" }: { name: IconName; color?: string }) {
strokeWidth = 1.5,
}: {
name: IconName;
size?: number;
color?: string;
strokeWidth?: number;
}) {
const node = PATHS[name];
if (!node) throw new Error(`Unknown icon: ${name}`);
return ( return (
<svg <svg
width={size} viewBox="0 0 12 12"
height={size} className="pixel-icon"
viewBox="0 0 24 24" fill={color}
fill="none" shapeRendering="crispEdges"
stroke={color}
strokeWidth={strokeWidth}
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true" aria-hidden="true"
focusable="false" focusable="false"
> >
{node} <path d={PATHS[name]} />
</svg> </svg>
); );
} }
+16 -29
View File
@@ -1,34 +1,21 @@
import { import { Icon, type IconName } from "./Icon";
BookOpen,
Briefcase,
Buildings2,
ChatRoundDots,
Folder,
Gear,
Home,
Plug2,
Send,
ShieldCheck,
Users,
} from "reicon-react";
import type { RouteId } from "./Shell"; import type { RouteId } from "./Shell";
/** One glyph per navigation surface, from the Reicon set. */ /** One pixel glyph per navigation surface. */
const NAV_ICONS: Record<RouteId, typeof Home> = { const NAV_ICONS: Record<RouteId, IconName> = {
home: Home, home: "home",
work: Briefcase, work: "work",
team: Users, team: "team",
chat: ChatRoundDots, chat: "chat",
runs: Send, runs: "send",
files: Folder, files: "folder",
library: BookOpen, library: "book",
approvals: ShieldCheck, approvals: "approve",
connectors: Plug2, connectors: "plug",
office: Buildings2, office: "building",
settings: Gear, settings: "settings",
}; };
export function NavIcon({ route, size = 18 }: { route: RouteId; size?: number }) { export function NavIcon({ route }: { route: RouteId }) {
const Glyph = NAV_ICONS[route]; return <Icon name={NAV_ICONS[route]} />;
return <Glyph size={size} />;
} }
+6 -6
View File
@@ -62,7 +62,7 @@ export function OrgSwitcher({ snapshot, activeOrgId, onSelect, onNew, onDelete }
> >
<span className="brand-mark">{orgInitial(active.name)}</span> <span className="brand-mark">{orgInitial(active.name)}</span>
<span className="brand-name">{active.name}</span> <span className="brand-name">{active.name}</span>
<Icon name="chevronDown" size={14} color="var(--text-3)" /> <Icon name="chevronDown" color="var(--text-3)" />
</button> </button>
{open && (confirmingOrg ? ( {open && (confirmingOrg ? (
<div role="menu" className="org-menu"> <div role="menu" className="org-menu">
@@ -100,8 +100,8 @@ export function OrgSwitcher({ snapshot, activeOrgId, onSelect, onNew, onDelete }
> >
<span className="brand-mark sm">{orgInitial(org.name)}</span> <span className="brand-mark sm">{orgInitial(org.name)}</span>
<span className="org-menu-name">{org.name}</span> <span className="org-menu-name">{org.name}</span>
{org.id === activeOrgId && <Icon name="check" size={14} color="var(--text-1)" />} {org.id === activeOrgId && <Icon name="check" color="var(--text-1)" />}
<span className="org-menu-chevron"><Icon name="chevron" size={14} /></span> <span className="org-menu-chevron"><Icon name="chevron" /></span>
</button> </button>
</CascadeRow> </CascadeRow>
))} ))}
@@ -112,7 +112,7 @@ export function OrgSwitcher({ snapshot, activeOrgId, onSelect, onNew, onDelete }
className="org-menu-action" className="org-menu-action"
onClick={() => { setOpen(false); setConfirmingDelete(null); onNew(); }} onClick={() => { setOpen(false); setConfirmingDelete(null); onNew(); }}
> >
<span className="icon-box" style={{ width: 18, height: 18 }}><Icon name="plus" size={16} color="var(--text-2)" /></span> <span className="icon-box" style={{ width: 18, height: 18 }}><Icon name="plus" color="var(--text-2)" /></span>
<span>{t("New organization")}</span> <span>{t("New organization")}</span>
</button> </button>
</CascadeMenu> </CascadeMenu>
@@ -137,12 +137,12 @@ function OrgActions({
<div className="org-menu-section-label">{org.name}</div> <div className="org-menu-section-label">{org.name}</div>
{!isActive && ( {!isActive && (
<button type="button" role="menuitem" className="org-menu-action" onClick={onSwitch}> <button type="button" role="menuitem" className="org-menu-action" onClick={onSwitch}>
<span className="icon-box" style={{ width: 18, height: 18 }}><Icon name="arrowRight" size={16} color="var(--text-2)" /></span> <span className="icon-box" style={{ width: 18, height: 18 }}><Icon name="arrowRight" color="var(--text-2)" /></span>
<span>{t("Switch to this org")}</span> <span>{t("Switch to this org")}</span>
</button> </button>
)} )}
<button type="button" role="menuitem" className="org-menu-action danger" onClick={onDelete}> <button type="button" role="menuitem" className="org-menu-action danger" onClick={onDelete}>
<span className="icon-box" style={{ width: 18, height: 18 }}><Icon name="x" size={16} color="var(--red)" /></span> <span className="icon-box" style={{ width: 18, height: 18 }}><Icon name="x" color="var(--red)" /></span>
<span>{t("Delete organization")}</span> <span>{t("Delete organization")}</span>
</button> </button>
</> </>
+2 -4
View File
@@ -51,7 +51,7 @@ export function ProviderLogo({ providerKey, label, size = 30 }: { providerKey: s
alt="" alt=""
width={size} width={size}
height={size} height={size}
style={{ width: size, height: size, borderRadius: 7, objectFit: "cover", background: "#fff", flexShrink: 0 }} style={{ width: size, height: size, objectFit: "cover", background: "#fff", flexShrink: 0 }}
/> />
); );
} }
@@ -60,13 +60,11 @@ export function ProviderLogo({ providerKey, label, size = 30 }: { providerKey: s
style={{ style={{
width: size, width: size,
height: size, height: size,
borderRadius: 7,
background: "#a1a1aa", background: "#a1a1aa",
color: "#fff", color: "#fff",
display: "grid", display: "grid",
placeItems: "center", placeItems: "center",
fontSize: Math.round(size * 0.42), fontSize: "var(--fs-body)",
fontWeight: 600,
flexShrink: 0, flexShrink: 0,
}} }}
> >
@@ -73,7 +73,7 @@ export function ProviderOAuthConnect({
if (phase === "done") { if (phase === "done") {
return ( return (
<div className="oauth-connect-row done"> <div className="oauth-connect-row done">
<Icon name="check" size={14} color="var(--green)" /> <Icon name="check" color="var(--green)" />
<span>{t("Signed in to {label}", { label })}</span> <span>{t("Signed in to {label}", { label })}</span>
<button type="button" className="link-button" onClick={run}>{t("Sign in again")}</button> <button type="button" className="link-button" onClick={run}>{t("Sign in again")}</button>
</div> </div>
+13 -43
View File
@@ -118,51 +118,51 @@ export function SearchDialog({
return ( return (
<Modal label={t("Search")} onEscape={onClose} onBackdrop={onClose} backdropStyle={overlayStyle}> <Modal label={t("Search")} onEscape={onClose} onBackdrop={onClose} backdropStyle={overlayStyle}>
<form onSubmit={submit} style={panelStyle}> <form onSubmit={submit} className="modal search-panel">
<div className="row" style={{ padding: "10px 12px", borderBottom: "1px solid var(--border-soft)" }}> <div className="row search-query">
<Icon name="search" size={14} color="var(--text-3)" /> <Icon name="search" color="var(--text-3)" />
<input <input
autoFocus autoFocus
aria-label={t("Search query")} aria-label={t("Search query")}
value={query} value={query}
onChange={(event) => setQuery(event.target.value)} onChange={(event) => setQuery(event.target.value)}
style={inputStyle} className="search-query-input"
/> />
<select <select
aria-label={t("Search filter")} aria-label={t("Search filter")}
className="input" className="input"
value={filter} value={filter}
onChange={(event) => setFilter(event.target.value as SearchFilter)} onChange={(event) => setFilter(event.target.value as SearchFilter)}
style={{ width: 150, height: 28, padding: "2px 8px", fontSize: 12 }} style={{ width: 150, height: 28, padding: "2px 8px", fontSize: "var(--fs-body)" }}
> >
<option value="all">{t("All")}</option> <option value="all">{t("All")}</option>
{SEARCH_ENTITY_TYPES.map((type) => <option key={type} value={type}>{LABELS[type]}</option>)} {SEARCH_ENTITY_TYPES.map((type) => <option key={type} value={type}>{LABELS[type]}</option>)}
</select> </select>
<Button size="small" onClick={onClose}>{t("Close")}</Button> <Button size="small" onClick={onClose}>{t("Close")}</Button>
</div> </div>
<div style={{ maxHeight: 420, overflow: "auto", padding: 8 }} aria-busy={searching}> <div className="search-results" aria-busy={searching}>
{searching && <div role="status" style={{ padding: 8, fontSize: 13, color: "var(--text-3)" }}>{t("Searching…")}</div>} {searching && <div role="status" style={{ padding: 8, fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("Searching…")}</div>}
{current?.error && <div className="form-error" role="alert">{t("Search failed: {reason}", { reason: current.error })}</div>} {current?.error && <div className="form-error" role="alert">{t("Search failed: {reason}", { reason: current.error })}</div>}
{visibleResults.map((result) => ( {visibleResults.map((result) => (
<button <button
key={`${result.entityType}:${result.entityId}`} key={`${result.entityType}:${result.entityId}`}
type="button" type="button"
onClick={() => openResult(result)} onClick={() => openResult(result)}
style={rowStyle} className="search-row"
> >
<Pill>{LABELS[result.entityType]}</Pill> <Pill>{LABELS[result.entityType]}</Pill>
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 14, fontWeight: 540, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{result.title}</div> <div style={{ fontSize: "var(--fs-body)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{result.title}</div>
<div style={{ fontSize: 12, color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{result.preview}</div> <div style={{ fontSize: "var(--fs-body)", color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{result.preview}</div>
</div> </div>
<span style={{ fontSize: 12, color: "var(--text-3)" }}>{result.facets.type}</span> <span style={{ fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{result.facets.type}</span>
</button> </button>
))} ))}
{current && !current.error && current.total === 0 && ( {current && !current.error && current.total === 0 && (
<div role="status" style={{ padding: 8, fontSize: 13, color: "var(--text-3)" }}>{t("Nothing matches “{words}”.", { words: trimmed })}</div> <div role="status" style={{ padding: 8, fontSize: "var(--fs-body)", color: "var(--text-3)" }}>{t("Nothing matches “{words}”.", { words: trimmed })}</div>
)} )}
{current && current.total > 0 && ( {current && current.total > 0 && (
<div className="row" style={{ padding: "6px 8px", fontSize: 12, color: "var(--text-3)" }}> <div className="row" style={{ padding: "6px 8px", fontSize: "var(--fs-body)", color: "var(--text-3)" }}>
<span role="status">{t("Showing {shown} of {total}", { shown: current.results.length, total: current.total })}</span> <span role="status">{t("Showing {shown} of {total}", { shown: current.results.length, total: current.total })}</span>
{current.results.length < current.total && ( {current.results.length < current.total && (
<span style={{ marginLeft: "auto" }}><Button size="small" onClick={showMore} disabled={loadingMore}>{loadingMore ? t("Loading…") : t("Show more")}</Button></span> <span style={{ marginLeft: "auto" }}><Button size="small" onClick={showMore} disabled={loadingMore}>{loadingMore ? t("Loading…") : t("Show more")}</Button></span>
@@ -210,33 +210,3 @@ const overlayStyle = {
placeItems: "start center", placeItems: "start center",
paddingTop: "12vh", paddingTop: "12vh",
} satisfies CSSProperties; } satisfies CSSProperties;
const panelStyle = {
width: "min(680px, calc(100vw - 32px))",
border: "1px solid var(--border)",
borderRadius: 12,
background: "var(--panel)",
boxShadow: "var(--shadow-md)",
overflow: "hidden",
} satisfies CSSProperties;
const inputStyle = {
flex: 1,
minWidth: 0,
border: 0,
outline: "none",
background: "transparent",
fontSize: 14,
} satisfies CSSProperties;
const rowStyle = {
width: "100%",
border: 0,
borderRadius: 8,
background: "transparent",
display: "flex",
alignItems: "center",
gap: 10,
padding: "9px 10px",
textAlign: "left",
} satisfies CSSProperties;
+1 -1
View File
@@ -93,7 +93,7 @@ export function Shell({
onDelete={onDeleteOrg} onDelete={onDeleteOrg}
/> />
<button type="button" className="search-bar" aria-label={t("Search")} onClick={() => setSearchOpen(true)}> <button type="button" className="search-bar" aria-label={t("Search")} onClick={() => setSearchOpen(true)}>
<Icon name="search" size={13} /> <Icon name="search" />
<span>{t("Search")}</span> <span>{t("Search")}</span>
<span className="search-kbd">{shortcutLabel("K")}</span> <span className="search-kbd">{shortcutLabel("K")}</span>
</button> </button>
+9
View File
@@ -0,0 +1,9 @@
/** An XP-style bar: a framed track filled in pixel blocks, announced as a progress value. */
export function XpBar({ percent, label }: { percent: number; label: string }) {
const filled = Math.max(0, Math.min(100, Math.round(percent)));
return (
<div className="xp-bar" role="progressbar" aria-label={label} aria-valuemin={0} aria-valuemax={100} aria-valuenow={filled}>
<div className="xp-fill" style={{ width: `${filled}%` }} />
</div>
);
}
+53
View File
@@ -0,0 +1,53 @@
import { useEffect, useState } from "react";
import type { UiTheme } from "../../../shared/snapshot-domain";
export type DayPart = "dawn" | "day" | "dusk" | "night";
export type Season = "spring" | "summer" | "autumn" | "winter";
/** Local-hour bands the palette rotates through. */
export function dayPart(now: Date): DayPart {
const hour = now.getHours();
if (hour >= 5 && hour < 8) return "dawn";
if (hour >= 8 && hour < 17) return "day";
if (hour >= 17 && hour < 20) return "dusk";
return "night";
}
/** Meteorological seasons by month, northern hemisphere. */
export function season(now: Date): Season {
const month = now.getMonth();
if (month >= 2 && month <= 4) return "spring";
if (month >= 5 && month <= 7) return "summer";
if (month >= 8 && month <= 10) return "autumn";
return "winter";
}
export function resolveTheme(theme: UiTheme, prefersDark: boolean, now: Date): "light" | "dark" {
if (theme === "system") return prefersDark ? "dark" : "light";
if (theme === "clock") return dayPart(now) === "night" ? "dark" : "light";
return theme;
}
const TICK_MS = 60_000;
/** Applies the theme, day part and season to the document root, rechecked every minute and whenever the OS scheme changes. */
export function usePaletteClock(theme: UiTheme): void {
const [now, setNow] = useState(() => new Date());
const [prefersDark, setPrefersDark] = useState(() => window.matchMedia("(prefers-color-scheme: dark)").matches);
useEffect(() => {
const timer = window.setInterval(() => setNow(new Date()), TICK_MS);
const media = window.matchMedia("(prefers-color-scheme: dark)");
const onScheme = () => setPrefersDark(media.matches);
media.addEventListener("change", onScheme);
return () => {
window.clearInterval(timer);
media.removeEventListener("change", onScheme);
};
}, []);
const resolved = resolveTheme(theme, prefersDark, now);
const part = dayPart(now);
const time = season(now);
useEffect(() => {
Object.assign(document.documentElement.dataset, { theme: resolved, daypart: part, season: time });
}, [resolved, part, time]);
}
+38
View File
@@ -0,0 +1,38 @@
/** Hand-placed 12x12 pixel icons: rows separated by spaces, "#" is a lit pixel. */
export const PIXEL_ICONS = {
home: ".....##..... ....####.... ...##..##... ..##....##.. .##......##. ############ .#........#. .#..####..#. .#..#..#..#. .#..#..#..#. .#..#..#..#. .##########.",
work: "............ ....####.... ....#..#.... ############ #..........# #..........# #####..##### #....##....# #..........# #..........# ############ ............",
team: "............ ..##....##.. .####..####. .####..####. ..##....##.. ............ .####..####. ######.##### ######.##### ######.##### ............ ............",
user: "............ ....####.... ...######... ...######... ...######... ....####.... ............ ..########.. .##########. .##########. .##########. ............",
chat: "............ .##########. #..........# #..........# #.##.##.##.# #..........# #..........# .###.######. ...#.#...... ...##....... ...#........ ............",
send: "..........## ........#### ......###.## ....###..##. ..###...##.. ####...##... ..###.##.... ....####.... .....###.... ......##.... ......#..... ............",
folder: "............ ####........ #..#........ #..#######.. #........#.. ############ #..........# #..........# #..........# #..........# ############ ............",
file: "#######..... #.....##.... #.....#.#... #.....####.. #........#.. #.#####..#.. #........#.. #.#####..#.. #........#.. #.####...#.. #........#.. ##########..",
book: "............ .####..####. #....##....# #.##.##.##.# #....##....# #.##.##.##.# #....##....# #.##.##.##.# #....##....# .####..####. .....##..... ............",
approve: ".....##..... ..########.. .#........#. .#........#. .#......#.#. .#.#...##.#. .#.##.##..#. .#..###...#. ..#..#...#.. ...#....#... ....#..#.... .....##.....",
plug: "............ ...#....#... ...#....#... ..########.. ..#......#.. ..#......#.. ..#......#.. ...#....#... ....####.... .....##..... .....##..... .....##.....",
building: "..########.. ..#......#.. ..#.##.#.#.. ..#......#.. ..#.##.#.#.. ..#......#.. ..#.##.#.#.. ..#......#.. ###.####.### #.#.#..#.#.# #.#.#..#.#.# ############",
settings: ".....##..... ..#.####.#.. .##########. ..###..###.. .###....###. ####....#### ####....#### .###....###. ..###..###.. .##########. ..#.####.#.. .....##.....",
search: "............ ..#####..... .#.....#.... #.......#... #.......#... #.......#... #.......#... .#.....#.... ..######.... .......###.. ........###. .........##.",
plus: "............ ............ .....##..... .....##..... .....##..... ..########.. ..########.. .....##..... .....##..... .....##..... ............ ............",
minus: "............ ............ ............ ............ ............ ..########.. ..########.. ............ ............ ............ ............ ............",
chevron: "............ ............ ....##...... .....##..... ......##.... .......##... .......##... ......##.... .....##..... ....##...... ............ ............",
chevronDown: "............ ............ ............ ............ ..##....##.. ...##..##... ....####.... .....##..... ............ ............ ............ ............",
chevronLeft: "............ ............ ......##.... .....##..... ....##...... ...##....... ...##....... ....##...... .....##..... ......##.... ............ ............",
more: "............ ............ ............ ............ ............ .##..##..##. .##..##..##. ............ ............ ............ ............ ............",
edit: ".........##. ........#### .......####. ......####.. .....####... ....####.... ...####..... ..####...... .#.##....... .##......... .###........ ............",
filter: "............ ############ .##########. ..########.. ...######... ....####.... ....####.... ....####.... ....####.... ....###..... ....##...... ............",
grid: "............ .####..####. .####..####. .####..####. .####..####. ............ ............ .####..####. .####..####. .####..####. .####..####. ............",
list: "............ ##..######## ##..######## ............ ............ ##..######## ##..######## ............ ............ ##..######## ##..######## ............",
upload: ".....##..... ....####.... ...######... ..##.##.##.. .....##..... .....##..... .....##..... #....##....# #..........# #..........# ############ ............",
arrowRight: "............ ............ .......#.... .......##... .......###.. ##########.. ##########.. .......###.. .......##... .......#.... ............ ............",
arrowUpRight: "............ ....#######. .....######. ........###. .......####. ......###.#. .....###.... ....###..... ...###...... ..###....... .###........ ............",
sparkle: ".....##..... .....##..... .....##..... ....####.... ..########.. ############ ..########.. ....####.... .....##..... .....##..... .....##..... ............",
bot: ".....##..... .....##..... ..########.. .#........#. .#.##..##.#. .#.##..##.#. .#........#. .#..####..#. .#........#. ..########.. ...#....#... ...#....#...",
check: "............ ............ ..........## .........##. ........##.. .......##... ##....##.... .##..##..... ..####...... ...##....... ............ ............",
x: "............ .##......##. ..##....##.. ...##..##... ....####.... .....##..... ....####.... ...##..##... ..##....##.. .##......##. ............ ............",
pin: "............ ....######.. .....####... .....####... .....####... ....######.. ...########. .......#.... .......#.... .......#.... .......#.... ............",
attach: "....####.... ...#....#... ...#.##.#... ...#.#..#... ...#.#..#... ...#.#..#... ...#.#..#... ...#.#..#... ...#....#... ...#....#... ....####.... ............",
hash: "............ ...#...#.... ...#...#.... .#########.. ...#...#.... ...#...#.... ..#...#..... #########... ..#...#..... ..#...#..... ............ ............",
lock: "............ ....####.... ...#....#... ...#....#... ...#....#... ..########.. ..########.. ..###..###.. ..###..###.. ..########.. ..########.. ............",
} as const;
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more