{"_id":"@aroha-sdk/orchestrator","_rev":"6-8dfbcd4b8cdb5ac63215e4b84ce13f6f","name":"@aroha-sdk/orchestrator","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"@aroha-sdk/orchestrator","version":"1.0.0","_id":"@aroha-sdk/orchestrator@1.0.0","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"dist":{"shasum":"6cdfda78e8b787baa24f15b051af326993d89e1a","tarball":"https://registry.npmjs.org/@aroha-sdk/orchestrator/-/orchestrator-1.0.0.tgz","fileCount":18,"integrity":"sha512-sf13JOiRvDH7Y97/TULyByR+N+MsmY9IhoPvYJfY8h5zm9o2fVqzG0IRjkzoAQrTeC+Ty8NQlzLYwd0JTPbpug==","signatures":[{"sig":"MEQCIHFY5LmDBoDC9iGbKeF5azhRg+8ZtneW6cmnpE+Lv+sYAiBxRiqEeIC1VMypE2FGCA6a7sW+wasX7MFqN7E61OXN5A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":120502},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"67cbe687cd0664deb4374aaa75788c9d7119d74b","scripts":{"dev":"tsc -p tsconfig.json --watch","test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"_npmVersion":"11.13.0","description":"Aroha orchestration layer: saga execution engine, agent selector, negotiator","directories":{},"_nodeVersion":"24.16.0","dependencies":{"uuid":"^10.0.0","@aroha-sdk/core":"^1.0.0","@aroha-sdk/registry":"^1.0.0","@aroha-sdk/settlement":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.4.5","@types/node":"^20.14.0","@types/uuid":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/orchestrator_1.0.0_1782173745241_0.5019111327185115","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@aroha-sdk/orchestrator","version":"1.2.0","_id":"@aroha-sdk/orchestrator@1.2.0","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"dist":{"shasum":"f33286ad15aeaccdf81062f7d4daab3486ac8d1e","tarball":"https://registry.npmjs.org/@aroha-sdk/orchestrator/-/orchestrator-1.2.0.tgz","fileCount":65,"integrity":"sha512-41SLBKQ24Ie8LluL5DuQWPumYSL+jaSNP1NjV9I2Ab1Ur/akX4WPHe1RqosSlfeCpQl2ZW6JCR9UKIS9MiprVg==","signatures":[{"sig":"MEYCIQChB9xYUzlMVd2ir3aQ00bEd2if/XzvmJhjTt+mJsPhLAIhAKSz7oXofkMEtAgkCtv95+4fE1B5sxTSp5uinbvsb6Y7","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":302799},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"3fd6d5ab883e07e6c38989dc642f87ef70bb6320","scripts":{"dev":"tsc -p tsconfig.json --watch","test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"_npmVersion":"11.13.0","description":"Aroha orchestration layer: saga execution engine, agent selector, negotiator","directories":{},"_nodeVersion":"24.16.0","dependencies":{"uuid":"^10.0.0","@aroha-sdk/core":"^1.0.0","@aroha-sdk/registry":"^1.0.0","@aroha-sdk/settlement":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.4.5","@types/node":"^20.14.0","@types/uuid":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/orchestrator_1.2.0_1782181548501_0.6846410283330078","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@aroha-sdk/orchestrator","version":"1.2.1","_id":"@aroha-sdk/orchestrator@1.2.1","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"dist":{"shasum":"d522083f0ebed16bc7c6726d64d06d802a97cc56","tarball":"https://registry.npmjs.org/@aroha-sdk/orchestrator/-/orchestrator-1.2.1.tgz","fileCount":71,"integrity":"sha512-nl2gJChAQ9VQw4Xd+cqd9l4P4ykllUEmnbxnu4YNDRfq7Un4JdCQIIj6kMH8UEIg9jBMy96bD6x38pnIdKIgEA==","signatures":[{"sig":"MEYCIQCLmiRH1PVISL+s8mNgGkLuBVSfD62jsTSRT1N/ISeEbQIhAKglG9MnlTN8y8ZN0VEW6UNRTxtboMwOP1YI1VHb3Dns","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":338794},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"a7fc3b14f2e9a4b83b1483442dc68e46d0ac4872","scripts":{"dev":"tsc -p tsconfig.json --watch","test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"_npmVersion":"11.16.0","description":"Aroha orchestration layer: saga execution engine, agent selector, negotiator","directories":{},"_nodeVersion":"24.18.0","dependencies":{"uuid":"^10.0.0","@aroha-sdk/core":"^1.0.0","@aroha-sdk/registry":"^1.0.0","@aroha-sdk/settlement":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.4.5","@types/node":"^20.14.0","@types/uuid":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/orchestrator_1.2.1_1783118060114_0.5558048593716238","host":"s3://npm-registry-packages-npm-production"}},"1.2.2":{"name":"@aroha-sdk/orchestrator","version":"1.2.2","license":"MIT","_id":"@aroha-sdk/orchestrator@1.2.2","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"dist":{"shasum":"a0ab80d5314b6ffde1bc7f208edc578de249fdc7","tarball":"https://registry.npmjs.org/@aroha-sdk/orchestrator/-/orchestrator-1.2.2.tgz","fileCount":71,"integrity":"sha512-oSO3vOPNiDE6YBXVX0iNB7AapqIGnXGkzDkC/WNRm3AHKWmFfGurQD3DfyCv0q1FOQFIIep3ZTSbsXhowtcC1g==","signatures":[{"sig":"MEUCIGZrG8oz37HnrlA55WNYbJB3SMhR8ZMws2+SYHTJXdf3AiEAoVElszBCYS8YH8ZHqOw3yYGeP1JrebnaAvTX82pzYrQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":338857},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"ca0800d55b453d5e9b38ffce3dff055f010619eb","scripts":{"dev":"tsc -p tsconfig.json --watch","test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"_npmVersion":"11.16.0","description":"Aroha orchestration layer: saga execution engine, agent selector, negotiator","directories":{},"_nodeVersion":"24.18.0","dependencies":{"uuid":"^10.0.0","@aroha-sdk/core":"^1.0.0","@aroha-sdk/registry":"^1.0.0","@aroha-sdk/settlement":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.4.5","@types/node":"^20.14.0","@types/uuid":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/orchestrator_1.2.2_1783119737575_0.21897743065952135","host":"s3://npm-registry-packages-npm-production"}},"1.2.3":{"name":"@aroha-sdk/orchestrator","version":"1.2.3","license":"MIT","_id":"@aroha-sdk/orchestrator@1.2.3","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"dist":{"shasum":"470a55905defa35232a1154d3b628b12126a85c6","tarball":"https://registry.npmjs.org/@aroha-sdk/orchestrator/-/orchestrator-1.2.3.tgz","fileCount":72,"integrity":"sha512-mtk1Poi2/GuN4VJ1+TvMEOfu9c/yHNmYIt+yWlslBFYJeU/QUF7j9oOsoDFPsR/hHfUT85A5gZkPNnVwXOGG9A==","signatures":[{"sig":"MEQCIFPLTuS8YhfClOyYh8QRXu4RQgxCtDnzFUpqRDraPcPKAiAff5vwPHIJr+9kdLQSVPSZaNHKnDtArERQwiqEzYkMeg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":345568},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"ab12f436a63322ab52f1516f35184f264e803c7a","scripts":{"dev":"tsc -p tsconfig.json --watch","test":"vitest run","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"_npmVersion":"11.17.0","description":"Aroha orchestration layer: saga execution engine, agent selector, negotiator","directories":{},"_nodeVersion":"24.19.0","dependencies":{"@aroha-sdk/core":"^1.0.0","@aroha-sdk/registry":"^1.0.0","@aroha-sdk/settlement":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.4.5","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/orchestrator_1.2.3_1786718302062_0.942772233762027","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@aroha-sdk/orchestrator","version":"1.3.0","description":"Aroha orchestration layer: saga execution engine, agent selector, negotiator","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc -p tsconfig.json","test":"vitest run","dev":"tsc -p tsconfig.json --watch"},"dependencies":{"@aroha-sdk/core":"^1.0.0","@aroha-sdk/credentials":"^1.0.0","@aroha-sdk/registry":"^1.0.0","@aroha-sdk/settlement":"^1.0.0"},"devDependencies":{"typescript":"^5.4.5","vitest":"^1.6.0","@types/node":"^20.14.0"},"license":"MIT","engines":{"node":">=18.0.0"},"gitHead":"8fa8563aea2cc73fcd7a82d1c56063a3d9edc7d6","_id":"@aroha-sdk/orchestrator@1.3.0","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-jR/164kkUnbuniSHxl3iMsX+UAHwWI/arkPvZLO6tnXMMNPFaw4awrJvqo1UdGNcshba6Y1yv3odSwxKNvZEJw==","shasum":"5b20cd854fd10899461b8dab0ce3c4b41c773f53","tarball":"https://registry.npmjs.org/@aroha-sdk/orchestrator/-/orchestrator-1.3.0.tgz","fileCount":91,"unpackedSize":442332,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIH/ZBmeHnjTyvC0Qaq0bFn1MlUPgazUBiD6ykHXnMLpFAiEAhnsNpVTwD3bljRoEgHu0vsyqrTSJdZLRkAnqN5nA7RE="}]},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"directories":{},"maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/orchestrator_1.3.0_1787073849668_0.9420033476351621"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-23T00:15:44.992Z","modified":"2026-08-18T17:24:10.048Z","1.0.0":"2026-06-23T00:15:45.405Z","1.2.0":"2026-06-23T02:25:48.661Z","1.2.1":"2026-07-03T22:34:20.251Z","1.2.2":"2026-07-03T23:02:17.716Z","1.2.3":"2026-08-14T14:38:22.250Z","1.3.0":"2026-08-18T17:24:09.823Z"},"license":"MIT","description":"Aroha orchestration layer: saga execution engine, agent selector, negotiator","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"readme":"# @aroha-sdk/orchestrator\n\n![Stable](https://img.shields.io/badge/status-stable-brightgreen) ![npm](https://img.shields.io/npm/v/@aroha-sdk/orchestrator)\n\nSaga engine for multi-agent workflows — orchestrates the mandate delegation chain across distributed agent calls.\n\n## Install\n\n```bash\nnpm install @aroha-sdk/orchestrator\n```\n\n## Quick example\n\n```typescript\nimport { SagaEngine } from \"@aroha-sdk/orchestrator\";\nimport { issueIntentMandate, attenuateToPayment } from \"@aroha-sdk/credentials\";\n\nconst saga = new SagaEngine({ did: orchestratorDID, privateKey: orchestratorPrivateKey });\n\n// Issue the root mandate and run the saga\nconst { mandate: rootMandate } = await issueIntentMandate(\n  humanDID, orchestratorDID,\n  { spendLimitUsd: 500, allowedActions: [\"book-flights\", \"book-hotels\"] },\n  humanPrivateKey, 3_600_000,\n);\n\nconst result = await saga.run([\n  {\n    agentUrl: \"http://flight-agent/v1/run\",\n    // Attenuate scope before each step\n    mandate: await attenuateToPayment(rootMandate, flightAgentDID, { spendLimitUsd: 300 }, orchestratorPrivateKey),\n    message: \"Book a flight from AKL to NRT on 2026-08-01\",\n    compensate: async () => saga.cancel(\"flight-agent\"),\n  },\n  {\n    agentUrl: \"http://hotel-agent/v1/run\",\n    mandate: await attenuateToPayment(rootMandate, hotelAgentDID, { spendLimitUsd: 200 }, orchestratorPrivateKey),\n    message: \"Book a hotel in Tokyo for 5 nights\",\n    compensate: async () => saga.cancel(\"hotel-agent\"),\n  },\n]);\n// If any step fails, compensations run in reverse order\n```\n\n## Why this exists in the mandate chain\n\nThe orchestrator is where scope attenuation happens in practice. At each step in the saga, the orchestrator holds its own mandate and issues a narrower one to each sub-agent — so a hotel booking agent can never spend flight budget, and no agent can exceed what the human originally authorized.\n\n## API\n\n- `SagaEngine` — manages a sequence of agent calls with attenuation, rollback, and compensation.\n  - `saga.run(steps)` — execute steps in order, running compensations on failure.\n  - `saga.cancel(agentId)` — trigger a compensation call to the named agent.\n- `selectAgent(capability, registry)` — discover an agent by capability from the registry.\n- `fanOut(steps)` — execute saga steps in parallel and await all results.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}