view infinite_canvas/BUILD @ 280:49e9e591c9bb

Add persistent dictation, prewarmed WebRTC speech input, Copilot SDK routing, animated conversation lifecycle controls, parking, and architecture coverage.
author MrJuneJune <me@mrjunejune.com>
date Tue, 18 Aug 2026 19:14:53 -0700
parents 8d560f50ed4c
children c57149ad216e
line wrap: on
line source

load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
load("//gui_ze:gui_ze.bzl", "move_files_into_dir")
load("//third_party/raylib:raylib.bzl", "raylib_binary")

cc_library(
  name = "theme",
  srcs = ["theme.c"],
  hdrs = ["theme.h"],
  deps = [
    "//dowa:dowa",
    "//third_party/raylib:raylib",
  ],
  linkopts = select({
    "//config:windows": ["-ladvapi32"],
    "//conditions:default": [],
  }),
)

cc_library(
  name = "canvas",
  srcs = ["canvas.c"],
  hdrs = [
    "canvas.h",
    "generated/lucide_data.h",
  ],
  deps = [
    "//dowa:dowa",
    ":theme",
    "//third_party/raylib:raylib",
  ],
  visibility = ["//visibility:public"],
)

cc_library(
  name = "dev_ui",
  srcs = ["dev_ui.c"],
  hdrs = ["dev_ui.h"],
  deps = [
    ":canvas",
    ":theme",
    "//third_party/raylib:raygui",
  ],
)

cc_library(
  name = "web_surface",
  srcs = select({
    "//config:linux": ["web_surface_native.cc"],
    "//config:macos": ["web_surface_native.cc"],
    "//config:windows": ["web_surface_native.cc"],
    "//conditions:default": ["web_surface_web.c"],
  }),
  hdrs = ["web_surface.h"],
  copts = select({
    "//config:linux": ["-std=c++20"],
    "//config:macos": ["-std=c++20"],
    "//conditions:default": [],
  }),
  deps = [
    ":canvas",
    ":theme",
    "//dowa:dowa",
    "//third_party/raylib:raylib",
  ] + select({
    "//config:linux": [
      "@cef//:cef",
      "@cef//:cef_wrapper",
    ],
    "//config:macos": ["@cef//:cef_wrapper"],
    "//config:windows": ["@cef//:cef_wrapper"],
    "//conditions:default": [],
  }),
)

cc_library(
  name = "agent_service",
  srcs = select({
    "//config:linux": ["agent_service_copilot.c"],
    "//config:macos": ["agent_service_stub.c"],
    "//config:windows": ["agent_service_stub.c"],
    "//conditions:default": ["agent_service_stub.c"],
  }),
  hdrs = ["agent_service.h"],
  deps = [
    ":canvas",
    "//dowa:dowa",
  ] + select({
    "//config:linux": ["//mrjunejune:inference_bridge"],
    "//conditions:default": [],
  }),
  linkopts = select({
    "//config:linux": ["-lpthread"],
    "//conditions:default": [],
  }),
)

filegroup(
  name = "inter_font",
  srcs = ["assets/Inter-Variable.ttf"],
)

filegroup(
  name = "fonts",
  srcs = [
    ":inter_font",
    "assets/OFL.txt",
  ],
)

filegroup(
  name = "image_placeholder",
  srcs = ["assets/image-placeholder.svg"],
)

filegroup(
  name = "image_view",
  srcs = ["assets/image-view.html"],
)

filegroup(
  name = "lucide_license",
  srcs = ["assets/LUCIDE_LICENSE.txt"],
)

raylib_binary(
  name = "app_bin",
  srcs = ["main.c"],
  data = [
    ":fonts",
    ":image_placeholder",
    ":image_view",
    ":lucide_license",
  ] + select({
    "//config:linux": [
      "@cef//:resources",
      "@cef//:sos",
    ],
    "//config:macos": ["@cef//:cef_framework"],
    "//config:windows": [
      "@cef//:dlls",
      "@cef//:resources",
    ],
    "//conditions:default": [],
  }),
  deps = [
    ":agent_service",
    ":canvas",
    ":web_surface",
    "//dowa:dowa",
    "//third_party/raylib:raylib",
  ],
)

raylib_binary(
  name = "dev_bin",
  srcs = ["main.c"],
  data = [
    ":fonts",
    ":image_placeholder",
    ":image_view",
    ":lucide_license",
  ] + select({
    "//config:linux": [
      "@cef//:resources",
      "@cef//:sos",
    ],
    "//config:macos": ["@cef//:cef_framework"],
    "//config:windows": [
      "@cef//:dlls",
      "@cef//:resources",
    ],
    "//conditions:default": [],
  }),
  defines = ["INFINITE_CANVAS_DEV_UI"],
  deps = [
    ":agent_service",
    ":canvas",
    ":dev_ui",
    ":theme",
    ":web_surface",
    "//dowa:dowa",
    "//third_party/raylib:raylib",
  ],
)

sh_binary(
  name = "app_linux",
  srcs = ["run_native.sh"],
  data = [":app_bin"],
)

sh_binary(
  name = "dev_linux",
  srcs = ["run_native.sh"],
  data = [":dev_bin"],
)

sh_binary(
  name = "orchestration_dev",
  srcs = ["run_orchestration_dev.sh"],
  data = [
    ":dev",
    "//dictation:server",
    "//mrjunejune:canvas_orchestration_launcher",
    "//mrjunejune/inference:copilot_sidecar_zip",
    "//mrjunejune/inference:litellm_config.yaml",
    "//mrjunejune/inference:litellm_proxy_zip",
    "@copilot_cli_linux_x86_64//:copilot",
    "@python_3_11//:files",
    "@python_3_11//:python3",
  ],
  target_compatible_with = select({
    "//config:linux": [],
    "//conditions:default": ["@platforms//:incompatible"],
  }),
)

alias(
  name = "agent_dev",
  actual = ":orchestration_dev",
)

alias(
  name = "app",
  actual = select({
    "//config:linux": ":app_linux",
    "//conditions:default": ":app_bin",
  }),
)

alias(
  name = "dev",
  actual = select({
    "//config:linux": ":dev_linux",
    "//conditions:default": ":dev_bin",
  }),
)

filegroup(
  name = "shell",
  srcs = ["index.html"],
)

raylib_binary(
  name = "web_bin",
  srcs = ["main.c"],
  additional_linker_inputs = [
    ":image_placeholder",
    ":inter_font",
  ],
  data = [
    ":fonts",
    ":image_placeholder",
  ],
  defines = ["INFINITE_CANVAS_DEV_UI"],
  deps = [
    ":agent_service",
    ":canvas",
    ":dev_ui",
    ":web_surface",
    "//dowa:dowa",
    "//third_party/raylib:raylib",
  ],
  linkopts_wasm = [
    "-sUSE_GLFW=3",
    "-sMIN_WEBGL_VERSION=2",
    "-sMAX_WEBGL_VERSION=2",
    "-sALLOW_MEMORY_GROWTH",
    "--preload-file=$(location :inter_font)@/infinite_canvas/assets/Inter-Variable.ttf",
    "--preload-file=$(location :image_placeholder)@/infinite_canvas/assets/image-placeholder.svg",
  ],
)

wasm_cc_binary(
  name = "infinite_canvas_wasm",
  cc_target = ":web_bin",
)

move_files_into_dir(
  name = "web_bundle",
  srcs = [
    ":infinite_canvas_wasm",
    ":lucide_license",
    ":shell",
  ],
  dest = "web",
)

cc_test(
  name = "canvas_test",
  srcs = ["canvas_test.c"],
  deps = [":canvas"],
)

cc_test(
  name = "agent_service_test",
  srcs = ["agent_service_test.c"],
  args = [
    "$(rootpath //mrjunejune/test:inference_bridge_fake_sidecar)",
  ],
  data = [
    "//mrjunejune/test:inference_bridge_fake_sidecar",
  ],
  deps = [
    ":agent_service",
    "//dowa:dowa",
  ],
  linkopts = ["-lpthread"],
  target_compatible_with = select({
    "//config:linux": [],
    "//conditions:default": ["@platforms//:incompatible"],
  }),
)

sh_test(
  name = "dictation_policy_test",
  srcs = ["dictation_policy_test.sh"],
  args = [
    "$(rootpath :web_surface_native.cc)",
    "$(rootpath :main.c)",
    "$(rootpath :dev_ui.c)",
  ],
  data = [
    "dev_ui.c",
    "main.c",
    "web_surface_native.cc",
  ],
)

sh_binary(
  name = "serve",
  srcs = ["serve.sh"],
  data = [":web_bundle"],
)