Skip to content

The app server (experimental): agent-app-protocol and agent-app-server - #2

Merged
NoHarry merged 12 commits into
mainfrom
app-server
Nov 12, 2026
Merged

NoHarry merged 12 commits into
mainfrom
app-server

Conversation

@NoHarry

@NoHarry NoHarry commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Adds two experimental modules, agent-app-protocol and agent-app-server: a host for agents on Android with a JSON-RPC protocol, a plugin kernel that starts and stops plugins while it runs, and signed plugin packages with sandboxed script tools. Also four sample apps, the plugin package tool, and A2aTask.Status.REJECTED.

Opened to run CI; not to be merged before the owner says so.

🤖 Generated with Claude Code

NoHarry and others added 12 commits November 10, 2026 09:19
A2aTask.Status gains REJECTED, terminal like FAILED; the direct codec and the
official client map the rejected state to it. A2aOutput.Result says what its
states mean: completed, the task ended with an answer that may say part was not
done; rejected, the agent found it cannot proceed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-server, a host for agents on Android with a JSON-RPC protocol, a plugin kernel that starts and stops plugins while it runs, signed plugin packages with sandboxed script tools, four sample apps and the plugin package tool

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…eed agent-exec-js, which a host adds; two packages' tools never share a name; no script runs where QuickJS would misread numbers; the host guide gives the published setup, R8, script tools in tests, installing packages from a client and plugins' context lines

- A ToolProvider (and an ExecEngine) that throws an Error or a checked
  exception fails that call: the model reads BACKEND_CALL_FAILED (EXEC_FAILED)
  with the error's kind and message and the run goes on; listing or
  initializing one that throws gives no tools. The app server's own provider
  calls (script tools, host tools from scripts, the gates' listings) and a run
  that throws are held to the same rule: a turn never fails without an ERROR
  item saying why.
- agent-exec-js is compileOnly in agent-app-server, found by its engine's
  class name (kept by its consumer rules; agent-app-server's let R8 build an
  app without it). Without it, plugins/install refuses a package with script
  tools (SCRIPTS_UNAVAILABLE), its tools' calls fail saying so and
  AppServer.install refuses builtIns.scripts. The bare sample's release APK
  with R8 is 1.49 MB without it, 5.59 MB with it; CI shrinks it with R8.
- ZiplineExecEngine runs no script in a process whose C library reads 0.5 as
  0 (a JVM under a comma numeric locale), and answers a QuickJS that does not
  load, both as EXEC_ENGINE_NOT_CONFIGURED; the app server's tests also run a
  script under de_DE.UTF-8. Locale-free formatting in the clock line and the
  run duration.
- A package whose script tools (the id's last segment) or MCP servers
  (<segment>_<server id>) would go by another installed package's name, or one
  the host's other tool servers have at install, is refused
  (TOOL_SERVER_TAKEN), checked again at confirm; an MCP server the person adds
  takes no package's name.
- The timer sample installs a signed package through the protocol in its test
  and calls its script tool (zipline-jvm substitution, LC_NUMERIC); the habits
  plugin gives each run a context line. The guide: settings repositories, the
  dependencies by coordinates (checked against the sample), scripts and their
  size, release builds and R8, request results and item statuses, script tools
  in a test, restarts in a test, plugins' context lines and the second opt-in,
  installing packages from a client, naming, and where the API listings are
  for a Maven consumer. GuideSnippetsTest checks the published form too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…is safe to read while loads add to it

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… 13th artifact, in agent-bom), loaded from its manifest without the host listing it

- agent-app-models: one plugin (models) with an adapter per service: DeepSeek (its search and fetch APIs, native updates, balance, relay check and shared key, moved from Bothy), OpenAI, Anthropic, Google Gemini, xAI, OpenRouter, Groq, Moonshot (Kimi), Zhipu (GLM), Alibaba Cloud Model Studio (Qwen), Volcengine Ark (Doubao), MiniMax and SiliconFlow. Their endpoints, key pages, model lists, model facts, prices (currency, asOf) and error rules are data (services.json), each value with the official page it was read from on 2026-11-11; a value no official page states is left out.
- The core speaks the three wire protocols and names no service (checkCoreServiceNames): alone it gives every model a 128K window and pictures, a profile no base URL or model until given one, the wire's own model list and models.dev prices.
- ProviderAdapter says what is known of a service: its services (endpoints, models with ModelFacts and ModelPrice, list quirks, usage fields, error rules, retry), facts, price, listModels, classify, and the extras balance, check and checked, answered through services/list, services/balance, services/check and services/checked.
- A library declares a plugin in its manifest (PluginDiscovery); AppServerConfig.ignoredPlugins leaves one out; the consumer rules keep every plugin class; the notes sample's R8 release is checked for it (checkReleaseDiscoveredPlugins).
- AppServerConfig.modelFacts and modelPrices win over a service's, the person's settings over both; ModelPrice has a currency and asOf, PriceBook.costUsd converts yuan.
- A failed model call carries what it was: RuntimeErrorCode gains PROVIDER_QUOTA_EXCEEDED, PROVIDER_CONTEXT_WINDOW_EXCEEDED and PROVIDER_TIMEOUT, read from the wire protocols and each service's error pages.
- realServiceTest runs each service whose key is in the environment (never in ciCheck); the host guide's Model services section, README tables, CHANGELOG and the app server design follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…re its profile points, host prices are read not kept, service defaults, regional and dated prices, output limits sent, discovered plugins that cannot run are shown

- A saved key goes only to the host its saved profile points at, or to an address a check made with the key typed found and the server recorded (KeyDestinations), over https (plain http to local addresses); anywhere else nothing is sent and the answer asks for the key again (MODEL_KEY_TYPE_AGAIN, ServiceCheckView.savedKeyRefused). ProviderAdapter.balance, check, checked and listModels take a ConnectionKey, read only for the address it goes to (sendTo); services/balance, services/check, services/checked, the model list and saving a connection all follow it.
- The usage store keeps only typed and models.dev prices: the host's and the services' are taken on each read, so a change applies after a restart; a kept book's manual flag is read as written, and an old book's untyped blank-source entries are dropped.
- A profile named after a service takes its default endpoint when none was given (ProviderProfile.endpointGiven) and there the service's defaultModel (data, with the reason), never replacing what was given; service defaults come before key sharing, so a bare deepseek profile shares the key.
- ModelFacts.requestOutputTokens (Volcengine Ark: 32768, its max_tokens defaults to 4096) is sent as the request's output limit; a person may set it per model (ModelSettingsView.outputOverride). modelSettings/read shows only the reasoning efforts the variant menu can send.
- Prices per region (Moonshot, Zhipu, Model Studio, MiniMax, SiliconFlow international lists in USD; xAI's US endpoint has none) by the endpoint a model ran at, and per day (effectiveFrom: Gemini 4 on 2026-12-01, Gemini 3.8 Flash on 2027-01-01). DeepSeek's sources are the zh-cn page its yuan prices are from.
- A 429 on a host no adapter knows keeps the runtime's retry decision. isDeepSeekUrl needs https, the exact host and the default port. A host's modelPrices currency must be USD or CNY.
- PluginDiscovery checks a class is a plugin before initializing it and leaves out one whose id cannot be read; a discovered plugin whose needs are unmet is left out and one that fails to start stays off, each with PluginView.problem (NEEDS_MISSING, START_FAILED); a missing services.json says so. checkReleaseDiscoveredPlugins also checks the notes release carries services.json.
- The guide, CHANGELOG (the removed default base URL and model) and the app server design follow; DeepSeek and Model Studio were run against the real services on 2026-11-11.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ew.listsModels): there the model list is the service's data, given without asking it, so it proves nothing of a key and a screen that checks one asks the service itself

- ModelService.view() fills it from listsModels (Zhipu and Alibaba Cloud Model Studio have none).
- ModelsPluginTest: services/list names exactly the services whose data has no list.
- The host guide's model-list bullet says so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es, ServiceView.keyPages in services/list), so a screen words where to get a key in its own language; keyHint stays the English sentence for other hosts

- services.json: a key page for every service, by the region of its endpoints, blank for all of them; Moonshot, Zhipu, Model Studio, MiniMax and SiliconFlow have one site per region, whose keys work only there.
- ServiceCatalogTest: every region of a service has a key page, each one its keyHint names and on its own site; ModelsPluginTest: services/list gives them as the data has them.
- The host guide says what keyHint and keyPages are for.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ome with agent-android-use and agent-device-capabilities

- agent-android-use carries AndroidUsePlugin (id android-use, cc.noharry.agent.androiduse.appserver) and
  agent-device-capabilities DeviceToolsPlugin (id device-tools, cc.noharry.agent.device.appserver), the glue that was
  in the Bothy app's plugin modules, each declared in the module's manifest: an app that depends on the module and on
  agent-app-server has the plugin without listing it (plugins/list, plugins/set, AppServerConfig.ignoredPlugins).
  Experimental (@ExperimentalAppServerApi); the tool server ids (android_use, device_calendar, device_notification,
  device_media) and the switch's storage are unchanged.
- Neither module carries the server: agent-app-server is compileOnly, so their published dependencies stay agent-api's,
  and their consumer rules let R8 build an app without the server's classes. checkNoAppServerDependency checks their
  runtime classpaths; checkAppServerLayering that only the appserver package and the tests name the server and nothing
  else in the module names that package; testWithoutAppServer runs each module's tests but the plugin's on a classpath
  without the server's modules, where the plugin's class cannot load.
- The notes sample depends on agent-device-capabilities, and checkReleaseDiscoveredPlugins checks that its R8 release
  keeps both discovered plugins. The screen's plugin lists and repairs its accessibility service only where the app
  may write secure settings. The device rows' titles are the module's string resources (device_tools_*).
- The plugins' tests moved with them (8, plus one discovery test each). Guide, READMEs, CHANGELOG, design doc,
  AGENTS.md and CONTRIBUTING describe it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a, which compiles against the SDK without carrying it

- agent-a2a-client-official is no longer published (12 artifacts, not 13). OfficialA2aClientModule keeps its package
  (cc.noharry.agent.a2a.official) and moves into agent-a2a, which stays a plain JVM jar: the official A2A Java SDK
  1.1.0.Final is compileOnly, so the POM names none of it and an app with the direct client alone gets none of its
  ~6 MB of jars. An app that wants the official client (A2A 1.0; the direct one speaks A2A 0.3) adds
  a2a-java-sdk-client and a2a-java-sdk-http-client-android, each without a2a-java-sdk-common; without them
  OfficialA2aClientModule() throws IllegalStateException naming them, probing the SDK by class literals so R8 renames
  consistently.
- The SDK's common classes (agent-a2a's own copy, which Android accepts) and the R8 rules the SDK needs on Android
  ship in agent-a2a's jar (META-INF/proguard/agent-a2a.pro); a runtime-only release and one with the official client
  were built with R8 against the published artifacts.
- testWithoutOfficialSdk runs the module's tests but the official client's without the SDK; the official client's
  classes are checked against Android 23 with core library desugaring (animalsnifferOfficialClient: the SDK takes
  java.util.function callbacks), the rest against Android 23 alone. The official client's 26 tests moved with it.
- agent-bom, settings, the layering rules, READMEs (the exact lines), CHANGELOG (what a 0.4.0 user changes),
  AGENTS.md, CONTRIBUTING, THIRD_PARTY_NOTICES and the design doc follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pabilities' string resources

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@NoHarry
NoHarry merged commit a661f55 into main Nov 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant