This repository was archived by the owner on Oct 21, 2026. It is now read-only.
Repository navigation
Commit 972a40c
authored
feat(client): consume brand identity agents/services allowlists (#479)
* feat(schema): accept optional agents/services on the config build bundle
CODE-618: the client-side schema and brand-identity mirror must accept the
publisher's optional per-brand agents/services fields (subset of known agent
kinds / kebab-case service ids) before any restricted-brand bundle can be
consumed. Absent stays absent so unrestricted builds are byte-identical.
* feat(desktop): render and surface the build-time agent/service allowlist
CODE-618: mirrors brand.ts's MAIN_VITE_BRAND_IDENTITY precedent for a new
MAIN_VITE_AGENT_RESTRICTIONS define, parsed once at boot into
AGENT_RESTRICTIONS (fail-closed on a present-but-invalid snapshot, same as
the brand identity). Exposes it to the renderer via a new synchronous
systemBridge.identity.restrictions() IPC channel (sendSync, like
settings.snapshot) so the composer's harness picker never flashes the full
agent set on a restricted build. Absent bundle agents/services is a
no-op end to end.
* feat(daemon): gate new agent adapters by the restricted-brand allowlist
CODE-618: apps/daemon/src/config.ts#daemonAllowedAgents() parses
LINKCODE_ALLOWED_AGENTS (set by the desktop supervisor from AGENT_RESTRICTIONS,
next commit); restrictedAdapterFactory() wraps createAdapter to reject any
kind outside it via the existing EngineDeps.factory injection seam — no
change to @linkcode/agent-adapter itself. Only gates new adapter
construction: a session started before a restriction landed keeps replaying
on its existing adapter, and history reads never call this. Also skips
background-refreshing a disallowed agent's managed install at boot. `null`
(unrestricted) is an exact no-op.
* feat(desktop): exclude restricted agents' SDKs from packaged builds
CODE-618 acceptance (a): agentFilesExcludes() maps each disallowed agent kind
to its staged node_modules SDK package (claude-agent-sdk / codex /
opencode-ai sdk -- pi's SDK is a hosted download and grok-build has no SDK,
so neither needs an entry). package-app.mts wraps the resolved
electron-builder config in a temporary `extends` overlay adding these as
`files` excludes only when the rendered bundle declares `agents`;
verify-artifacts.mts asserts their absence post-pack by exact asar path
segment (never a prefix match, so e.g. @openai/codex-darwin-* can't
false-positive). Both are no-ops when the bundle carries no `agents`,
keeping the standard build's packaging and verification unchanged.
* feat(mobile): thread the build-time agent allowlist into the config bootstrap
CODE-618: BundledConfigBootstrap gains allowedAgents/allowedServices
(bundle.agents/.services ?? null); the dev sentinel and every existing
platform fixture stay null (unrestricted), so today's builds are unaffected.
new-thread-sheet.tsx's kind picker narrows to BUNDLED_CONFIG_BOOTSTRAP
.allowedAgents ?? every known kind, and hides its whole Section outright
(never just disables) once at most one kind remains selectable -- mobile is
single-process, so this needs no IPC.
* feat(workbench,ui): filter the harness picker and add-account catalog by brand
CODE-618 acceptance (c, d): selectableHarnessKinds(providers, allowedAgents?)
intersects the enabled set with the brand allowlist; workbench.tsx threads
it in from a new Workbench allowedAgents prop (desktop's app.tsx supplies
systemBridge.identity.restrictions().allowedAgents, keeping this package
IPC-free). composer-controls.tsx's ModelSelectorMenu now hides the harness
submenu at <=1 selectable harness instead of 0, so a single remaining
harness disappears everywhere the picker is rendered.
add-flow.tsx's ServiceCatalogView filters two axes: oauth entries by their
bound agent against allowedAgents, everything else (including custom, which
needs no special case since it is excluded by the same id-set intersection
as any other service) by allowedServices. serviceById, the account
list/detail, and account resolution stay unfiltered everywhere, so an
account bound to a since-hidden service keeps rendering and resolving.
agents-settings.tsx's row list gets the same allowedAgents narrowing (hides
the row rather than disabling its switch); view.ts's account-binding
resolution is untouched.
All of the above default to null (unrestricted) and are no-ops for the
standard/unbranded build.
* fix(engine,daemon): fix CI ESM load, history-read regression, and review findings
CODE-618 PR review fixups:
- schema/brand-identity: config-bundle.mts loads unbundled under plain Node
(CI's Desktop App Entry / e2e:unpackaged), and its import chain reached
brand-identity.ts's `import { AgentKindSchema } from '@linkcode/schema'` --
a barrel re-exporting a directory, which the bare Node ESM loader cannot
resolve (ERR_UNSUPPORTED_DIR_IMPORT). remote-config.ts's own
`./model/primitives` import hit the same loader via the
`@linkcode/schema/remote-config` subpath. Both now duplicate the known
agent-kind list locally instead of importing it as a value, matching this
codebase's CONFIG_PLATFORMS/CONFIG_CHANNELS precedent; `AgentKind` stays a
type-only import (erased before it reaches the runtime loader).
- engine/daemon gating: the previous `EngineDeps.factory` wrapper threw for
any excluded kind, but `SessionOrchestrator.list()` and `HistoryService`
call the bare factory for every *persisted* record's `historyCapabilities`
-- one history session of an excluded kind broke the whole `session.list`.
Moved enforcement to the one place that actually constructs a *live*
adapter to start/resume/relaunch a run (`SessionOrchestrator.startLive`),
gated by a new `EngineDeps.allowedAgents` threaded in from the daemon;
history reads and `list()` are never touched. Renamed
apps/daemon/src/agent-factory.ts to agent-restrictions.ts and replaced the
removed `restrictedAdapterFactory` with `filterAgentRuntimes` (masks a
disallowed agent as `missing` in the boot-probe snapshot regardless of how
it was actually detected) and `restrictedAssetService` (refuses
`asset.ensure` for an excluded agent's managed download, reusing
ManagedAssetService's existing "cannot be installed here" path -- tool
assets are never agent-gated). `services` stays catalog-only filtering, as
planned; daemon-side enforcement was never in scope for it.
- composer-controls.tsx: reverted the harness AgentIcon's visibility back to
`harnesses.length > 0` (only the submenu itself hides at <=1) -- a single
remaining harness, restricted build or a user manually disabling every
other one from Settings, still needs the icon since it is the only
harness signal once the picker disappears.
- electron-renderer.ts: `identity.restrictions()` now throws when the main
process's sendSync snapshot is missing instead of defaulting to
unrestricted -- this gates which agents/services render, so a missing
snapshot must fail closed like every other security boundary here, not
silently widen access. Kept the guard manual (no foxts/guard import):
apps/desktop's preload externalizes every non-workspace dependency it
doesn't explicitly bundle, the same reason this file already stays
zod-free.
- small cleanups: dropped an unreachable branch in daemonAllowedAgents()
(split always yields >=1 element for a non-empty string);
config-bundle.mts's ambient MAIN_VITE_AGENT_RESTRICTIONS guard now matches
its neighboring `!== undefined` checks; package-app.mts's files-exclude
overlay now writes into a fresh mkdtempSync directory instead of a fixed
filename, so two concurrent (or one interrupted) packaging runs can't
collide.
* fix(desktop): import agent-package-excludes with an explicit extension
package-app.mts and verify-artifacts.mts run under bare node, whose ESM
loader rejects extensionless relative imports; tsx-run scripts were
unaffected.
* fix(engine,daemon): close review gaps in the restricted-brand allowlist
- gate agent.catalog in AgentRequestHandler: startCatalog spawns real
agent processes for codex/opencode, and the old factory wrapper's
coverage of this path was lost when enforcement moved to startLive
- hide excluded agents' managed assets from asset statuses/subscribe so
the wrapper agrees with filterAgentRuntimes and the ensure refusal
- pin both hand-duplicated agent-kind lists to AgentKindSchema with
drift tests1 parent 41087da commit 972a40c
50 files changed
Lines changed: 1273 additions & 42 deletions
File tree
- apps
- daemon/src
- __tests__
- desktop
- scripts
- src
- __tests__
- build
- __tests__
- main
- __tests__
- renderer/src
- settings
- mobile/src
- components/host
- runtime/config
- __tests__
- packages
- client/workbench/src
- settings
- providers
- __tests__
- surface
- foundation
- common/src/config
- __tests__
- schema/src
- __tests__
- host/engine/src
- __tests__
- agent
- session
- presentation/ui/src/shell
- __tests__
- system-plane/ipc/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
634 | 636 | | |
635 | 637 | | |
636 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
91 | 104 | | |
92 | 105 | | |
93 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
187 | 189 | | |
188 | 190 | | |
189 | 191 | | |
190 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
| |||
228 | 233 | | |
229 | 234 | | |
230 | 235 | | |
231 | | - | |
232 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
233 | 242 | | |
234 | 243 | | |
235 | 244 | | |
| |||
267 | 276 | | |
268 | 277 | | |
269 | 278 | | |
| 279 | + | |
270 | 280 | | |
271 | 281 | | |
272 | 282 | | |
| |||
284 | 294 | | |
285 | 295 | | |
286 | 296 | | |
287 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
288 | 300 | | |
289 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
290 | 305 | | |
291 | 306 | | |
292 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
110 | 118 | | |
111 | 119 | | |
112 | 120 | | |
| |||
180 | 188 | | |
181 | 189 | | |
182 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
183 | 200 | | |
| 201 | + | |
184 | 202 | | |
185 | 203 | | |
186 | 204 | | |
| |||
0 commit comments