Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T00:51:39.650Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

generate-omega-icon-family

138 lines · 4.3 KB · text
1#!/usr/bin/env bash
2# Regenerate Omega package icons from the pinned OpenAgents Desktop sources.
3#
4# Channel badges are deferred: every release channel reuses the unbadged icon
5# until OpenAgents approves distinct channel artwork.
6set -euo pipefail
7
8root="$(cd "$(dirname "$0")/.." && pwd)"
9cd "$root"
10
11python3 - <<'PY'
12from __future__ import annotations
13
14import hashlib
15import json
16import shutil
17from pathlib import Path
18
19from PIL import Image
20
21ROOT = Path("crates/zed/resources")
22SOURCE_PNG = ROOT / "icon_family/source/openagents-icon.png"
23SOURCE_ICNS = ROOT / "icon_family/source/openagents-icon.icns"
24MANIFEST_PATH = ROOT / "icon_family/manifest.json"
25
26PINNED_PNG_SHA256 = "1f80f8d36d459e2bf62c3d1fcb05f42cf6c2a26b84aeb320eb89bedbb489d551"
27PINNED_ICNS_SHA256 = "f6d748c1765161ec785f55137afd548cf1ff23de12d2de14383e8a01c697654d"
28PNG_SOURCE_COMMIT = "owner-supplied-2026-07-25-omega-hd4-kontext-1k"
29ICNS_SOURCE_COMMIT = "generated-2026-07-25-from-omega-hd4-kontext-1k"
30
31
32def sha256(path: Path) -> str:
33    return hashlib.sha256(path.read_bytes()).hexdigest()
34
35
36def write_png(path: Path, image: Image.Image) -> dict:
37    image.save(path, format="PNG")
38    width, height = image.size
39    return {
40        "sha256": sha256(path),
41        "pixels": [width, height],
42        "format": "png",
43        "derived_from": "icon_family/source/openagents-icon.png",
44    }
45
46
47png_digest = sha256(SOURCE_PNG)
48icns_digest = sha256(SOURCE_ICNS)
49if png_digest != PINNED_PNG_SHA256:
50    raise SystemExit(f"pinned PNG digest mismatch: {png_digest}")
51if icns_digest != PINNED_ICNS_SHA256:
52    raise SystemExit(f"pinned ICNS digest mismatch: {icns_digest}")
53
54source = Image.open(SOURCE_PNG).convert("RGBA")
55if source.size != (1024, 1024):
56    raise SystemExit(f"pinned PNG must be 1024x1024, got {source.size}")
57
58png_512 = source.resize((512, 512), Image.Resampling.LANCZOS)
59png_1024 = source.copy()
60
61png_outputs = {
62    "app-icon.png": png_512,
63    "app-icon@2x.png": png_1024,
64    "app-icon-dev.png": png_512,
65    "app-icon-dev@2x.png": png_1024,
66    "app-icon-nightly.png": png_512,
67    "app-icon-nightly@2x.png": png_1024,
68    "app-icon-preview.png": png_512,
69    "app-icon-preview@2x.png": png_1024,
70}
71
72manifest = {
73    "channel_badges": "deferred",
74    "channel_badges_note": (
75        "All four channels reuse the unbadged OpenAgents Desktop icon until "
76        "OpenAgents approves channel badges."
77    ),
78    "pinned_source": {
79        "png_path": "icon_family/source/openagents-icon.png",
80        "png_sha256": png_digest,
81        "png_source_commit": PNG_SOURCE_COMMIT,
82        "png_pixels": [1024, 1024],
83        "icns_path": "icon_family/source/openagents-icon.icns",
84        "icns_sha256": icns_digest,
85        "icns_source_commit": ICNS_SOURCE_COMMIT,
86        "upstream_png": "apps/openagents-desktop/resources/openagents-icon.png",
87        "upstream_icns": "apps/openagents-desktop/resources/openagents-icon.icns",
88    },
89    "outputs": {},
90}
91
92for name, image in png_outputs.items():
93    path = ROOT / name
94    manifest["outputs"][name] = write_png(path, image)
95    print(f"wrote {path}")
96
97document_icns = ROOT / "Document.icns"
98shutil.copyfile(SOURCE_ICNS, document_icns)
99manifest["outputs"]["Document.icns"] = {
100    "sha256": sha256(document_icns),
101    "format": "icns",
102    "derived_from": "icon_family/source/openagents-icon.icns",
103    "note": (
104        "Document associations reuse the OpenAgents app icon until a distinct "
105        "document glyph is designed."
106    ),
107}
108print(f"wrote {document_icns}")
109
110ico_sizes = [16, 32, 48, 256]
111ico_images = [source.resize((size, size), Image.Resampling.LANCZOS) for size in ico_sizes]
112windows = ROOT / "windows"
113for name in (
114    "app-icon.ico",
115    "app-icon-dev.ico",
116    "app-icon-nightly.ico",
117    "app-icon-preview.ico",
118):
119    path = windows / name
120    largest = ico_images[-1]
121    largest.save(
122        path,
123        format="ICO",
124        sizes=[(size, size) for size in ico_sizes],
125        append_images=ico_images[:-1],
126    )
127    manifest["outputs"][f"windows/{name}"] = {
128        "sha256": sha256(path),
129        "format": "ico",
130        "sizes": ico_sizes,
131        "derived_from": "icon_family/source/openagents-icon.png",
132    }
133    print(f"wrote {path}")
134
135MANIFEST_PATH.write_text(json.dumps(manifest, indent=2) + "\n")
136print(f"wrote {MANIFEST_PATH}")
137PY
138
Served at tenant.openagents/omega Member data and write actions are omitted.