Repository navigation
feat: any app and any agent: names in any script, Python SDK 0.2, conformance for any app - #59
Closed
ahmad-ajmal wants to merge 61 commits into
Closed
ahmad-ajmal wants to merge 61 commits into
ahmad-ajmal wants to merge 61 commits into
Conversation
…ose by that order manifest.json may carry `transports`, an ordered list of cli, mcp and http. The first is the app's primary channel and the rest are fallbacks; without it the order is cli, mcp, http. Entries are kinds, never addresses. The gate checks it, the builder may edit it, toolkit-sync keeps it, `scaffold --transport` puts one first, and inspect reports it. Identity gains optional `transports` and `mcpUrl` (published by adapters in a later change). Arriving by CLI at an app that asks for another transport first says so. Skills, AGENTS.md and the README say how to choose, and how to operate over plain HTTP when there is no CLI. Spec: spec/v0_2/transports.md.
…ame its app adapter-core serves the app as an MCP server at POST /api/_a2app/mcp/<app id>. Each tool call is one request through the adapter's own router, so the guard, scopes, approval, idempotency, rate limits and audit are the ones HTTP callers meet. Ten tools, the same in every app (spec/v0_2/mcp-tools.json); MCP 2026-07-28 and, without sessions, the three handshake revisions before it. The caller is a credential, never a browser session. HTTP callers may name the app they mean (X-A2App-App); another app answers 409 app_mismatch. The CLI names a verified remote app on every call, and reads identity without its credential. Identity publishes `transports` and `mcpUrl`. Conformance class D covers the binding, and the starter conformance checks it against a running app on any stack.
Agents given only a task and an app picked the right transport each time, and stopped at every refusal. What slowed them is fixed: tools take an entity or operation by its own name, a declared operation is preferred over a raw write, the HTTP routes are listed in full, what to do when a scope or an approval is missing and the person can't be reached, and an MCP server that answers app_mismatch is another app's.
A destructive operation may name a read-only `preview` that says what it would do. Its answer comes with the 428, and the key covers it: when the answer changes, nothing runs, and the caller is shown the new one. Anything else that changes leaves the approval standing. Two fixes for every destructive operation: a key works only for the credential that asked, and a refused key always comes with one that works. A 428 says why (`reason`: asked, changed, spent, mismatch). The gate and the adapter refuse a preview that is not one. The sidecar runs an adopted app's own read route. The CLI shows the preview before the line that would run the call. The react-node starter's clear-done names list-done. Spec: spec/v0_2/approvals.md.
The Ruby port of the reference's transports and approvals: identity publishes the declared transports and the MCP address, a call that names another app is refused, and the app answers MCP by sending each tool call through its own router. A 428 says why, its key works for the caller that asked, and a destructive operation may name a preview its approval is held to; the starter's clear-done names list-done. Header values are read as text, as Node reads them, so an idempotency key is one key over HTTP and MCP (SQLite kept the two apart); keys stored before are converted. The adapter is built at boot, so a declaration it refuses stops the app instead of failing its first request.
The Go adapter serves the app's MCP endpoint, refuses a call that names another app, and holds an approval to what the person was shown. - identity publishes `transports` and `mcpUrl`; a malformed declaration does not start; X-A2App-App of another app is 409 app_mismatch - MCP: ten tools, each one request through Handle, stateless and handshake revisions, credentials only - approvals carry a reason, are stored for the caller and the call, and cover the preview the operation names - the starter's clear-done names list-done as its preview - the self-test covers all of it
The read-only check used the name as written and the route decodes it, so a
percent-encoded name ("clear%2Ddone") passed the check and ran. The name is
decoded once, checked, and sent as that one segment. Scopes always applied; what
was missing is the promise a harness relies on when it runs a read-only tool
without asking. Found by the Go port's comparison run.
Brings the native Rust adapter up to adapter-core for spec/v0_2 transports.md and approvals.md: - identity publishes transports and mcpUrl; a malformed declaration does not start, and a list without mcp serves no endpoint - X-A2App-App refuses a call meant for another app (409 app_mismatch) - POST /api/_a2app/mcp/<app id>: ten tools, word for word the spec's, each one request through the adapter's own dispatch - every 428 says why and carries a key issued to its caller, for its call; a preview is run as the caller, shown, and covered by the key - the starter's clear-done names list-done as its preview - query_operation judges the decoded operation name, the one it runs - the selftest covers all of it
…pter The FastAPI adapter serves the app's MCP endpoint, publishes its transports, refuses a call that names another app, and asks for approval the way adapter-core does: a reason on every 428, a key held for the caller that asked, and previews that an approval is held to. The starter's clear-done names list-done as its preview.
As in the reference: the read-only check used the name as written and the route decodes it, so a percent-encoded name passed the check and ran. The name is decoded once, checked, and sent as that one segment.
…base adapter Identity publishes the declared transports and the MCP endpoint; a call that names another app is refused on every route but identity; approvals are bound to the caller and, where an operation names a preview, to what it would do. Every MCP tool call is one request to the app's own loopback address, the same path HTTP callers take: PocketBase serves records itself, so there is no router to hand the call to. The launcher says where that is, and refuses to start on a malformed transports list or preview.
The MCP tools promise it and the records API ignored it. A key already applied is a 409 naming the record, before the guard; a new one is recorded in the same transaction as the row, so a write that fails uses none and two at once with one key make one record. An app's own record hooks stay outside that transaction.
… read-only The root called a module read-only for any caller with less than everything in it, so one that could write every record was told it could not. `full` is now everything, `read-only` nothing that changes anything, and `partial` what lies between; a module with only operations is judged the same way, and PocketBase no longer says full to everyone. The CLI reads a word it does not know as some access. An older one prints "no access" for `partial`, so it is released no later than the adapters.
The bridge told every harness to use the a2app CLI. It now uses the first of the app's transports the run can reach, and writes the prompt for it. Over MCP, the harness gets a configuration file for that one run with the app's endpoint and the task's own credential: 0600, only its path in the arguments, removed when the run ends. Routes in harnesses.json gain `transports` and `mcpArgs`; the built-in claude route has the latter. An inbound route gets the app's address, order and MCP endpoint in its body. Plugins say what to do when the CLI is missing, and no longer call it the only way to operate an app. The account page shows the app's MCP address beside a new token.
- An agent that came by MCP is told the app's order: in the server's instructions, in whoami, and in the first describe (conventions.transports). The skill and AGENTS.md say to read it before the first call. - A 401 says where a credential comes from (A2APP_TOKEN, the account page), and no longer points at .agent-token. HTTP is reachable only with a credential in hand, where the work changes anything. - dev, the skills and AGENTS.md say that only a2app moves to the candidate: connected MCP tools and the usual address still reach the live app. - scaffold writes `transports` only when it is a choice, so an older agent-app accepts the app. It refuses --transport mcp on a blueprint that does not serve MCP, the gate refuses it on a running app, and serve names a malformed list. - starter conformance says what it did not check. - Docs keep the token off the command line; a missing CLI is the person's to install.
Modules and operations may be named in letters of any script, with capitals, and modules may have a command's name: `a2app <app> ./tasks` is then the place. The gate finds a spec's sections by a comment on the heading, so the spec may be in the person's language. The walk quotes names that are more than one word.
This was referenced Dec 1, 2026
Collaborator
Author
|
Replaced by #61, which has this same code. The branch is kept. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Works with more apps and more agents: names in any script, specs in any language, a Python SDK that speaks 0.2, and conformance for an app that is not a starter. From the second audit's search for hardcoded rules.
Merge after #58. Until then this diff includes the stack; see only this PR's changes.
What changes
Büro,заметки,zählen), in Unicode NFC. Before: lower-case ASCII only. Entities follow the blueprint's database.a2app <app> ./tasksis the place,a2app <app> tasksthe command. Before, eight names were refused.## Функции <!-- a2app: Features -->.conformance/starter/run.mjsandmulti-user/run.mjsread the app's own describe, take flags, and say what they could not check. A destructive operation of an unknown app runs only when--destructive-opnames it.Things to know
./tasksas a module called./tasks.F-ids are conventions in ASCII; framework text to agents is English (codes are machine-readable); a fourth transport is a protocol version, and needs the schemas and five adapters as well as the table.Tests
pnpm -r build,typecheck,test; conformance 150/150; the Python SDK's own tests.tasks,Büroandзаметкиand an operationzählen: gate, walk and calls.Bücher,записка; no string field; no entities; operations only), and 12 deliberately broken ones, all of which fail..testfiles are added.