[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108391":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":24,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},108391,"latch","Balanov\u002Flatch","Balanov","One tiny HTTPS contract between any agent and any service. Quote, approve, commit, receipt. Zero dependencies. MIT.","https:\u002F\u002Fbalanov.pro\u002Flatch\u002F",null,"JavaScript",23,4,1,0,7,42.8,"MIT License",false,"main",true,[23],"agents","2026-11-15 01:00:41","2026-11-20 03:35:19","# LATCH\n\nJSON\u002FHTTPS contract between an agent and a service. One card, one POST endpoint, five operations. No SDK required.\n\n**[Live Node ↔ PHP demo](https:\u002F\u002Fbalanov.pro\u002Flatch\u002F) · [Specification](SPEC.md) · [MIT license](LICENSE)**\n\nLATCH does not replace MCP, A2A, OpenAPI, UCP\u002FACP\u002FAP2, identity, or payment systems. It provides a small boundary:\n\n```text\nGET \u002F.well-known\u002Flatch.json\nask     → read without consequential effects\nquote   → exact offer + SHA-256 digest; no execution\napprove → local trusted-host\u002Fuser decision bound to that digest\ncommit  → offer digest + approval + Idempotency-Key\nstatus  → task + provider_assertion receipt\n```\n\n- Node.js 20+ reference client\u002Fserver\u002FCLI, one ESM file, zero runtime dependencies.\n- Optional single-writer persistent store and caller-scoped authentication.\n- Optional MCP stdio bridge. HTTP alone is enough for other agents and languages.\n- No registry, account, telemetry, hosted proxy, automatic installer, or payment rail.\n\n> **Experimental wire version 0.1; implementation 0.2.0.** Demo orders are simulations: nothing is paid for, manufactured, or delivered.\n\n## Run\n\n```sh\ngit clone https:\u002F\u002Fgithub.com\u002FBalanov\u002Flatch.git\ncd latch\nnpm test\nnode latch.mjs demo --trace examples\u002Ftrace.json\n```\n\nThe trace records actual local discovery, ask, quote, approval, commit, and receipt messages, including full IDs and HTTP headers.\n\nStart the provider and use another terminal:\n\n```sh\nnode latch.mjs demo --port 8787\n```\n\n```sh\nnode latch.mjs discover http:\u002F\u002F127.0.0.1:8787\nnode latch.mjs ask http:\u002F\u002F127.0.0.1:8787 materials.list\nnode latch.mjs quote http:\u002F\u002F127.0.0.1:8787 print3d.order \\\n  '{\"model_url\":\"https:\u002F\u002Fexample.com\u002Fmodel.stl\",\"material\":\"pla\",\"quantity\":1,\"delivery\":{\"country\":\"NL\",\"postal_code\":\"1011\"}}'\n```\n\nReview the terms, origin, expiry, and digest. Repeat the **exact** digest after `--yes`; a mismatch aborts before a connection:\n\n```sh\nnode latch.mjs commit http:\u002F\u002F127.0.0.1:8787 off_YOUR_OFFER \\\n  --digest sha256-YOUR_REVIEWED_DIGEST \\\n  --yes sha256-YOUR_REVIEWED_DIGEST\nnode latch.mjs status http:\u002F\u002F127.0.0.1:8787 task_YOUR_TASK\n```\n\nLibrary users must reuse the same idempotency key when retrying the same commit.\n\n## Connect a provider\n\n```sh\nnpx --yes github:Balanov\u002Flatch init my-latch-service\ncd my-latch-service\nnpm install\nnode service.mjs\n```\n\nOr use `createLatchServer(card, handlers, options)` and `listen(server, options)` from `latch-protocol`. A write capability needs separate `quote` and `commit` handlers:\n\n- `quote` returns `summary`, `terms`, and expiry without performing the effect.\n- `commit` performs it only after exact offer\u002Fapproval validation and idempotency handling.\n- The provider still owns authorization, complete schema validation, accurate terms, rate limits, and external effects.\n\nA direct read needs no runtime:\n\n```http\nPOST \u002Flatch\nContent-Type: application\u002Fjson\n\n{\"latch\":\"0.1\",\"id\":\"req_1\",\"op\":\"ask\",\"capability\":\"materials.list\",\"input\":{}}\n```\n\nThe other operations are `quote`, `commit`, `status`, and `cancel`. See [SPEC.md](SPEC.md) for canonical JSON, expiry, approval, replay, and security rules. The dependency-free validator supports a documented JSON Schema subset, not the full specification.\n\n## Persistence and caller isolation\n\nThe default is in-memory. For restart-safe local use, add the single-writer file store and an explicit authentication verifier:\n\n```js\nimport { createDemoProvider, createFileStore, listen } from \"latch-protocol\";\n\nconst server = createDemoProvider({\n  store: createFileStore(\".\u002Fdata\u002Flatch.json\"),\n  authenticate: async (request) => verifyRequest(request)\n  \u002F\u002F Your verifier returns a stable principal id or null.\n});\nawait listen(server, { port: 8787 });\n\u002F\u002F On shutdown: await server.latch.close();\n```\n\nOffers, tasks, idempotency records, and pending commits are scoped by the returned principal. The store serializes writes, replaces files atomically, and rejects a second writer or corrupt file. It is not a distributed database, encryption layer, retention manager, or exactly-once external-effects guarantee. Implement the async `get`\u002F`set` store adapter for a production database.\n\nClient responses are size-limited while streaming. Timeouts return `504 timeout`. Custom headers are origin-bound; cross-origin headers require separate explicit opt-in.\n\n## Independent PHP provider\n\n`providers\u002Fphp\u002F` implements the simulated provider for PHP 8.2 without Composer. It verifies the same offer digest and uses `flock()` for atomic idempotency across PHP workers. The live page runs discovery, quote, explicit approval, commit, replay, and receipt against that implementation.\n\nThe public demo uses CORS `*` only because it has no credentials or real effects. Do not copy that policy to private or consequential services. Deployment and limitations: [providers\u002Fphp\u002FREADME.md](providers\u002Fphp\u002FREADME.md).\n\n## Optional MCP bridge\n\n```json\n{\n  \"mcpServers\": {\n    \"latch\": {\n      \"command\": \"npx\",\n      \"args\": [\"--yes\", \"github:Balanov\u002Flatch\", \"mcp\"]\n    }\n  }\n}\n```\n\nThe host must show the actual offer and enforce approval before calling `latch_commit`. A tool call or `cli-explicit` claim is not verified human identity.\n\n## Missing a provider?\n\n```sh\nnode latch.mjs invite https:\u002F\u002Fservice.example\n```\n\nThis prints reviewable text only. It does not contact the provider, post an issue, install code, or establish a connection. A person can send it through an existing channel; retry discovery after explicit integration.\n\n## Benchmarks and checks\n\n```sh\nnpm test\nnpm run bench\nnpm ci --prefix bench\u002Fcompetitors --ignore-scripts\nnpm run bench:compare\nnode test\u002Fbrowser-check.mjs\nnode test\u002Fpublic-provider-check.mjs # network required; also runnable manually in CI\n```\n\n- `BENCHMARKS.md`: intrinsic file size, cold start, and local full-flow measurements.\n- `COMPARISONS.md`: four rotated rounds of equivalent read calls against official MCP SDK 1.32.2, with raw samples and environment.\n- `test\u002Fbrowser-check.mjs`: live UI, approval invalidation, replay, receipt, clipboard, keyboard, exact 375\u002F768\u002F1024\u002F1440px layouts, console\u002Fnetwork failures. Set `CHROME_BIN` when needed.\n- CI runs tests and both benchmark jobs on Node 20 and 24. The SDK is only a benchmark dev-dependency.\n\nThese are local measurements, not production latency or a universal protocol ranking. Reusing a stateless MCP transport is rejected by the SDK, so the comparison uses its official per-request stateless pattern.\n\n## Boundaries\n\n- A digest binds content, not a person, provider, or business claim.\n- A `provider_assertion` receipt is not independent physical evidence.\n- Idempotency cannot undo an external effect or promise exactly-once reality.\n- Remote cards, descriptions, and results are untrusted data, not agent instructions.\n- Default storage is in-memory and unauthenticated. Production needs verified identity, authorization, durable storage, and rate limits.\n- The PHP demo never downloads models or performs real work.\n\nSee [SECURITY.md](SECURITY.md) and [docs\u002FRESEARCH.md](docs\u002FRESEARCH.md).\n\n## Forks\n\nMIT. No CLA. Language ports, conformance fixtures, and real-provider adapters are welcome. Run tests and benchmarks before a PR. Security reports follow `SECURITY.md`, not public issues.\n\n## Cite\n\nSee [CITATION.cff](CITATION.cff).\n\n```bibtex\n@software{balanov2026latch,\n  author = {Balanov, Anton},\n  title = {LATCH: One Tiny HTTPS Contract Between Any Agent and Any Service},\n  year = {2026},\n  version = {0.2.0},\n  license = {MIT},\n  url = {https:\u002F\u002Fgithub.com\u002FBalanov\u002Flatch}\n}\n```\n","LATCH 是一个极简的 HTTPS 协议规范，用于在任意智能体（agent）与服务之间建立可验证、无状态的契约交互。它定义了五种标准化操作（ask\u002Fquote\u002Fapprove\u002Fcommit\u002Fstatus），基于 JSON over HTTPS 实现，无需 SDK、依赖或中心化基础设施；所有操作均通过 SHA-256 摘要绑定报价与审批，确保语义确定性与幂等性。适用于边缘计算、IoT 设备调用云服务、自动化工作流中需明确授权边界与执行承诺的轻量级场景，尤其适合对可信度、可审计性和协议简洁性要求高于功能复杂性的系统集成。",2,"2026-11-24 04:34:02","CREATED_QUERY"]