@agentsgot/agent-kit 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +5 -0
- package/README.md +13 -2
- package/dist/a2a.d.ts +35 -0
- package/dist/a2a.d.ts.map +1 -0
- package/dist/a2a.js +109 -0
- package/dist/a2a.js.map +1 -0
- package/dist/cli/binding.d.ts +24 -0
- package/dist/cli/binding.d.ts.map +1 -0
- package/dist/cli/binding.js +52 -0
- package/dist/cli/binding.js.map +1 -0
- package/dist/cli/commands.d.ts +18 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +191 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/context.d.ts +61 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +147 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/doctor.d.ts +34 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +109 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/home.d.ts +37 -0
- package/dist/cli/home.d.ts.map +1 -0
- package/dist/cli/home.js +77 -0
- package/dist/cli/home.js.map +1 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +120 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/install.d.ts +19 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +64 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/keystore.d.ts +25 -0
- package/dist/cli/keystore.d.ts.map +1 -0
- package/dist/cli/keystore.js +57 -0
- package/dist/cli/keystore.js.map +1 -0
- package/dist/cli/mcp.d.ts +7 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +28 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/prompt.d.ts +10 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +71 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/reports.d.ts +42 -0
- package/dist/cli/reports.d.ts.map +1 -0
- package/dist/cli/reports.js +121 -0
- package/dist/cli/reports.js.map +1 -0
- package/dist/cli/run.d.ts +21 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +125 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/wallet.d.ts +19 -0
- package/dist/cli/wallet.d.ts.map +1 -0
- package/dist/cli/wallet.js +58 -0
- package/dist/cli/wallet.js.map +1 -0
- package/dist/guides.d.ts +7 -0
- package/dist/guides.d.ts.map +1 -0
- package/dist/guides.js +94 -0
- package/dist/guides.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/llm.d.ts +16 -0
- package/dist/llm.d.ts.map +1 -0
- package/dist/llm.js +30 -0
- package/dist/llm.js.map +1 -0
- package/dist/mcp/cli.d.ts +3 -0
- package/dist/mcp/cli.d.ts.map +1 -0
- package/dist/mcp/cli.js +6 -0
- package/dist/mcp/cli.js.map +1 -0
- package/dist/mcp/server.d.ts +38 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +693 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/ports.d.ts +123 -0
- package/dist/ports.d.ts.map +1 -0
- package/dist/ports.js +134 -0
- package/dist/ports.js.map +1 -0
- package/dist/roles.d.ts +16 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/roles.js +49 -0
- package/dist/roles.js.map +1 -0
- package/dist/runner.d.ts +126 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +292 -0
- package/dist/runner.js.map +1 -0
- package/dist/schedules.d.ts +34 -0
- package/dist/schedules.d.ts.map +1 -0
- package/dist/schedules.js +116 -0
- package/dist/schedules.js.map +1 -0
- package/dist/sdk/base64.d.ts +4 -0
- package/dist/sdk/base64.d.ts.map +1 -0
- package/dist/sdk/base64.js +15 -0
- package/dist/sdk/base64.js.map +1 -0
- package/dist/sdk/client.d.ts +198 -0
- package/dist/sdk/client.d.ts.map +1 -0
- package/dist/sdk/client.js +413 -0
- package/dist/sdk/client.js.map +1 -0
- package/dist/security.d.ts +10 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +24 -0
- package/dist/security.js.map +1 -0
- package/dist/skills.d.ts +21 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +93 -0
- package/dist/skills.js.map +1 -0
- package/dist/workers.d.ts +64 -0
- package/dist/workers.d.ts.map +1 -0
- package/dist/workers.js +127 -0
- package/dist/workers.js.map +1 -0
- package/dist/zip.d.ts +8 -0
- package/dist/zip.d.ts.map +1 -0
- package/dist/zip.js +80 -0
- package/dist/zip.js.map +1 -0
- package/docs/README.md +25 -0
- package/docs/architecture.md +18 -0
- package/docs/deployment.md +35 -0
- package/docs/reference/01-RULES.md +822 -0
- package/docs/reference/02-INTERFACES.md +487 -0
- package/docs/reference/03-STAKING-PENALTY-SPEC.md +739 -0
- package/docs/updates.md +65 -0
- package/docs/verification.md +72 -0
- package/package.json +88 -4
- package/skills/dist/agent-skills.json +68 -0
- package/skills/dist/arbitrator/SKILL.md +186 -0
- package/skills/dist/executor/SKILL.md +219 -0
- package/skills/dist/publisher/SKILL.md +172 -0
- package/skills/dist/tester/SKILL.md +198 -0
- package/vendor/shared/ARCHITECTURE.md +97 -0
- package/vendor/shared/README.md +5 -0
- package/vendor/shared/abi/index.js +2 -0
- package/vendor/shared/abi/index.ts +2 -0
- package/vendor/shared/abi/protocol/AgentRegistry.js +1623 -0
- package/vendor/shared/abi/protocol/AgentRegistry.json +1623 -0
- package/vendor/shared/abi/protocol/AgentRegistry.ts +1623 -0
- package/vendor/shared/abi/protocol/ArbitrationCaseProofVerifier.js +154 -0
- package/vendor/shared/abi/protocol/ArbitrationCaseProofVerifier.json +154 -0
- package/vendor/shared/abi/protocol/ArbitrationCaseProofVerifier.ts +154 -0
- package/vendor/shared/abi/protocol/ArbitrationCourt.js +1550 -0
- package/vendor/shared/abi/protocol/ArbitrationCourt.json +1550 -0
- package/vendor/shared/abi/protocol/ArbitrationCourt.ts +1550 -0
- package/vendor/shared/abi/protocol/ArbitrationPool.js +509 -0
- package/vendor/shared/abi/protocol/ArbitrationPool.json +509 -0
- package/vendor/shared/abi/protocol/ArbitrationPool.ts +509 -0
- package/vendor/shared/abi/protocol/ArbitrationProgressor.js +44 -0
- package/vendor/shared/abi/protocol/ArbitrationProgressor.json +44 -0
- package/vendor/shared/abi/protocol/ArbitrationProgressor.ts +44 -0
- package/vendor/shared/abi/protocol/ArbitrationSelection.js +1153 -0
- package/vendor/shared/abi/protocol/ArbitrationSelection.json +1153 -0
- package/vendor/shared/abi/protocol/ArbitrationSelection.ts +1153 -0
- package/vendor/shared/abi/protocol/ArbitrationSettlement.js +956 -0
- package/vendor/shared/abi/protocol/ArbitrationSettlement.json +956 -0
- package/vendor/shared/abi/protocol/ArbitrationSettlement.ts +956 -0
- package/vendor/shared/abi/protocol/ArbitrationStream.js +964 -0
- package/vendor/shared/abi/protocol/ArbitrationStream.json +964 -0
- package/vendor/shared/abi/protocol/ArbitrationStream.ts +964 -0
- package/vendor/shared/abi/protocol/EmissionController.js +1436 -0
- package/vendor/shared/abi/protocol/EmissionController.json +1436 -0
- package/vendor/shared/abi/protocol/EmissionController.ts +1436 -0
- package/vendor/shared/abi/protocol/HourlyAnchor.js +611 -0
- package/vendor/shared/abi/protocol/HourlyAnchor.json +611 -0
- package/vendor/shared/abi/protocol/HourlyAnchor.ts +611 -0
- package/vendor/shared/abi/protocol/IncentiveVault.js +480 -0
- package/vendor/shared/abi/protocol/IncentiveVault.json +480 -0
- package/vendor/shared/abi/protocol/IncentiveVault.ts +480 -0
- package/vendor/shared/abi/protocol/ParamRegistry.js +814 -0
- package/vendor/shared/abi/protocol/ParamRegistry.json +814 -0
- package/vendor/shared/abi/protocol/ParamRegistry.ts +814 -0
- package/vendor/shared/abi/protocol/PlatformTreasury.js +553 -0
- package/vendor/shared/abi/protocol/PlatformTreasury.json +553 -0
- package/vendor/shared/abi/protocol/PlatformTreasury.ts +553 -0
- package/vendor/shared/abi/protocol/ProtocolProof.js +1171 -0
- package/vendor/shared/abi/protocol/ProtocolProof.json +1171 -0
- package/vendor/shared/abi/protocol/ProtocolProof.ts +1171 -0
- package/vendor/shared/abi/protocol/PublisherStaking.js +1227 -0
- package/vendor/shared/abi/protocol/PublisherStaking.json +1227 -0
- package/vendor/shared/abi/protocol/PublisherStaking.ts +1227 -0
- package/vendor/shared/abi/protocol/RewardVesting.js +1027 -0
- package/vendor/shared/abi/protocol/RewardVesting.json +1027 -0
- package/vendor/shared/abi/protocol/RewardVesting.ts +1027 -0
- package/vendor/shared/abi/protocol/TaskEscrow.js +2219 -0
- package/vendor/shared/abi/protocol/TaskEscrow.json +2219 -0
- package/vendor/shared/abi/protocol/TaskEscrow.ts +2219 -0
- package/vendor/shared/abi/protocol/TesterAssignment.js +1375 -0
- package/vendor/shared/abi/protocol/TesterAssignment.json +1375 -0
- package/vendor/shared/abi/protocol/TesterAssignment.ts +1375 -0
- package/vendor/shared/abi/protocol/ValidatorStaking.js +1614 -0
- package/vendor/shared/abi/protocol/ValidatorStaking.json +1614 -0
- package/vendor/shared/abi/protocol/ValidatorStaking.ts +1614 -0
- package/vendor/shared/abi/protocol/index.js +19 -0
- package/vendor/shared/abi/protocol/index.ts +19 -0
- package/vendor/shared/abi/token/AGTToken.js +1018 -0
- package/vendor/shared/abi/token/AGTToken.json +1018 -0
- package/vendor/shared/abi/token/AGTToken.ts +1018 -0
- package/vendor/shared/abi/token/GenesisDistributor.js +242 -0
- package/vendor/shared/abi/token/GenesisDistributor.json +242 -0
- package/vendor/shared/abi/token/GenesisDistributor.ts +242 -0
- package/vendor/shared/abi/token/LPLocker.js +21 -0
- package/vendor/shared/abi/token/LPLocker.json +21 -0
- package/vendor/shared/abi/token/LPLocker.ts +21 -0
- package/vendor/shared/abi/token/LaunchLiquidity.js +335 -0
- package/vendor/shared/abi/token/LaunchLiquidity.json +335 -0
- package/vendor/shared/abi/token/LaunchLiquidity.ts +335 -0
- package/vendor/shared/abi/token/LiquidityAdder.js +228 -0
- package/vendor/shared/abi/token/LiquidityAdder.json +228 -0
- package/vendor/shared/abi/token/LiquidityAdder.ts +228 -0
- package/vendor/shared/abi/token/TaxDistributor.js +235 -0
- package/vendor/shared/abi/token/TaxDistributor.json +235 -0
- package/vendor/shared/abi/token/TaxDistributor.ts +235 -0
- package/vendor/shared/abi/token/TestFaucet.js +214 -0
- package/vendor/shared/abi/token/TestFaucet.json +214 -0
- package/vendor/shared/abi/token/TestFaucet.ts +214 -0
- package/vendor/shared/abi/token/index.js +7 -0
- package/vendor/shared/abi/token/index.ts +7 -0
- package/vendor/shared/dist/abi/index.d.ts +3 -0
- package/vendor/shared/dist/abi/index.d.ts.map +1 -0
- package/vendor/shared/dist/abi/index.js +3 -0
- package/vendor/shared/dist/abi/index.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/AgentRegistry.d.ts +1249 -0
- package/vendor/shared/dist/abi/protocol/AgentRegistry.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/AgentRegistry.js +1624 -0
- package/vendor/shared/dist/abi/protocol/AgentRegistry.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCaseProofVerifier.d.ts +119 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCaseProofVerifier.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCaseProofVerifier.js +155 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCaseProofVerifier.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCourt.d.ts +1205 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCourt.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCourt.js +1551 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCourt.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationPool.d.ts +391 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationPool.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationPool.js +510 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationPool.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationProgressor.d.ts +34 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationProgressor.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationProgressor.js +45 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationProgressor.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSelection.d.ts +885 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSelection.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSelection.js +1154 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSelection.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSettlement.d.ts +742 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSettlement.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSettlement.js +957 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSettlement.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationStream.d.ts +741 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationStream.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationStream.js +965 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationStream.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/EmissionController.d.ts +1110 -0
- package/vendor/shared/dist/abi/protocol/EmissionController.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/EmissionController.js +1437 -0
- package/vendor/shared/dist/abi/protocol/EmissionController.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/HourlyAnchor.d.ts +467 -0
- package/vendor/shared/dist/abi/protocol/HourlyAnchor.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/HourlyAnchor.js +612 -0
- package/vendor/shared/dist/abi/protocol/HourlyAnchor.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/IncentiveVault.d.ts +369 -0
- package/vendor/shared/dist/abi/protocol/IncentiveVault.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/IncentiveVault.js +481 -0
- package/vendor/shared/dist/abi/protocol/IncentiveVault.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ParamRegistry.d.ts +628 -0
- package/vendor/shared/dist/abi/protocol/ParamRegistry.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ParamRegistry.js +815 -0
- package/vendor/shared/dist/abi/protocol/ParamRegistry.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/PlatformTreasury.d.ts +426 -0
- package/vendor/shared/dist/abi/protocol/PlatformTreasury.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/PlatformTreasury.js +554 -0
- package/vendor/shared/dist/abi/protocol/PlatformTreasury.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ProtocolProof.d.ts +903 -0
- package/vendor/shared/dist/abi/protocol/ProtocolProof.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ProtocolProof.js +1172 -0
- package/vendor/shared/dist/abi/protocol/ProtocolProof.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/PublisherStaking.d.ts +947 -0
- package/vendor/shared/dist/abi/protocol/PublisherStaking.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/PublisherStaking.js +1228 -0
- package/vendor/shared/dist/abi/protocol/PublisherStaking.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/RewardVesting.d.ts +793 -0
- package/vendor/shared/dist/abi/protocol/RewardVesting.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/RewardVesting.js +1028 -0
- package/vendor/shared/dist/abi/protocol/RewardVesting.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/TaskEscrow.d.ts +1725 -0
- package/vendor/shared/dist/abi/protocol/TaskEscrow.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/TaskEscrow.js +2220 -0
- package/vendor/shared/dist/abi/protocol/TaskEscrow.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/TesterAssignment.d.ts +1058 -0
- package/vendor/shared/dist/abi/protocol/TesterAssignment.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/TesterAssignment.js +1376 -0
- package/vendor/shared/dist/abi/protocol/TesterAssignment.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ValidatorStaking.d.ts +1236 -0
- package/vendor/shared/dist/abi/protocol/ValidatorStaking.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ValidatorStaking.js +1615 -0
- package/vendor/shared/dist/abi/protocol/ValidatorStaking.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/index.d.ts +20 -0
- package/vendor/shared/dist/abi/protocol/index.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/index.js +20 -0
- package/vendor/shared/dist/abi/protocol/index.js.map +1 -0
- package/vendor/shared/dist/abi/token/AGTToken.d.ts +786 -0
- package/vendor/shared/dist/abi/token/AGTToken.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/AGTToken.js +1019 -0
- package/vendor/shared/dist/abi/token/AGTToken.js.map +1 -0
- package/vendor/shared/dist/abi/token/GenesisDistributor.d.ts +187 -0
- package/vendor/shared/dist/abi/token/GenesisDistributor.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/GenesisDistributor.js +243 -0
- package/vendor/shared/dist/abi/token/GenesisDistributor.js.map +1 -0
- package/vendor/shared/dist/abi/token/LPLocker.d.ts +16 -0
- package/vendor/shared/dist/abi/token/LPLocker.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/LPLocker.js +22 -0
- package/vendor/shared/dist/abi/token/LPLocker.js.map +1 -0
- package/vendor/shared/dist/abi/token/LaunchLiquidity.d.ts +260 -0
- package/vendor/shared/dist/abi/token/LaunchLiquidity.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/LaunchLiquidity.js +336 -0
- package/vendor/shared/dist/abi/token/LaunchLiquidity.js.map +1 -0
- package/vendor/shared/dist/abi/token/LiquidityAdder.d.ts +176 -0
- package/vendor/shared/dist/abi/token/LiquidityAdder.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/LiquidityAdder.js +229 -0
- package/vendor/shared/dist/abi/token/LiquidityAdder.js.map +1 -0
- package/vendor/shared/dist/abi/token/TaxDistributor.d.ts +182 -0
- package/vendor/shared/dist/abi/token/TaxDistributor.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/TaxDistributor.js +236 -0
- package/vendor/shared/dist/abi/token/TaxDistributor.js.map +1 -0
- package/vendor/shared/dist/abi/token/TestFaucet.d.ts +164 -0
- package/vendor/shared/dist/abi/token/TestFaucet.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/TestFaucet.js +215 -0
- package/vendor/shared/dist/abi/token/TestFaucet.js.map +1 -0
- package/vendor/shared/dist/abi/token/index.d.ts +8 -0
- package/vendor/shared/dist/abi/token/index.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/index.js +8 -0
- package/vendor/shared/dist/abi/token/index.js.map +1 -0
- package/vendor/shared/dist/emission-schedule.d.ts +51 -0
- package/vendor/shared/dist/emission-schedule.d.ts.map +1 -0
- package/vendor/shared/dist/emission-schedule.js +116 -0
- package/vendor/shared/dist/emission-schedule.js.map +1 -0
- package/vendor/shared/dist/index.d.ts +7 -0
- package/vendor/shared/dist/index.d.ts.map +1 -0
- package/vendor/shared/dist/index.js +7 -0
- package/vendor/shared/dist/index.js.map +1 -0
- package/vendor/shared/dist/params/index.d.ts +6 -0
- package/vendor/shared/dist/params/index.d.ts.map +1 -0
- package/vendor/shared/dist/params/index.js +84 -0
- package/vendor/shared/dist/params/index.js.map +1 -0
- package/vendor/shared/dist/protocol-proofs.d.ts +267 -0
- package/vendor/shared/dist/protocol-proofs.d.ts.map +1 -0
- package/vendor/shared/dist/protocol-proofs.js +205 -0
- package/vendor/shared/dist/protocol-proofs.js.map +1 -0
- package/vendor/shared/dist/rules/index.d.ts +204 -0
- package/vendor/shared/dist/rules/index.d.ts.map +1 -0
- package/vendor/shared/dist/rules/index.js +802 -0
- package/vendor/shared/dist/rules/index.js.map +1 -0
- package/vendor/shared/dist/rules/spec-content.d.ts +21 -0
- package/vendor/shared/dist/rules/spec-content.d.ts.map +1 -0
- package/vendor/shared/dist/rules/spec-content.js +90 -0
- package/vendor/shared/dist/rules/spec-content.js.map +1 -0
- package/vendor/shared/dist/rules/task-risk.d.ts +35 -0
- package/vendor/shared/dist/rules/task-risk.d.ts.map +1 -0
- package/vendor/shared/dist/rules/task-risk.js +438 -0
- package/vendor/shared/dist/rules/task-risk.js.map +1 -0
- package/vendor/shared/dist/schemas/domain.d.ts +195 -0
- package/vendor/shared/dist/schemas/domain.d.ts.map +1 -0
- package/vendor/shared/dist/schemas/domain.js +158 -0
- package/vendor/shared/dist/schemas/domain.js.map +1 -0
- package/vendor/shared/dist/schemas/draft.d.ts +730 -0
- package/vendor/shared/dist/schemas/draft.d.ts.map +1 -0
- package/vendor/shared/dist/schemas/draft.js +110 -0
- package/vendor/shared/dist/schemas/draft.js.map +1 -0
- package/vendor/shared/dist/schemas/enums.d.ts +130 -0
- package/vendor/shared/dist/schemas/enums.d.ts.map +1 -0
- package/vendor/shared/dist/schemas/enums.js +63 -0
- package/vendor/shared/dist/schemas/enums.js.map +1 -0
- package/vendor/shared/dist/schemas/index.d.ts +4 -0
- package/vendor/shared/dist/schemas/index.d.ts.map +1 -0
- package/vendor/shared/dist/schemas/index.js +4 -0
- package/vendor/shared/dist/schemas/index.js.map +1 -0
- package/vendor/shared/dist/units.d.ts +10 -0
- package/vendor/shared/dist/units.d.ts.map +1 -0
- package/vendor/shared/dist/units.js +44 -0
- package/vendor/shared/dist/units.js.map +1 -0
- package/vendor/shared/openapi.json +78754 -0
- package/vendor/shared/package.json +43 -0
- package/vendor/shared/params/params.json +152 -0
- package/vendor/shared/params/ranges.json +574 -0
- package/vendor/shared/src/emission-schedule.ts +151 -0
- package/vendor/shared/src/index.ts +6 -0
- package/vendor/shared/src/params/index.ts +139 -0
- package/vendor/shared/src/protocol-proofs.ts +235 -0
- package/vendor/shared/src/rules/index.ts +1081 -0
- package/vendor/shared/src/rules/spec-content.ts +120 -0
- package/vendor/shared/src/rules/task-risk.ts +550 -0
- package/vendor/shared/src/schemas/domain.ts +187 -0
- package/vendor/shared/src/schemas/draft.ts +141 -0
- package/vendor/shared/src/schemas/enums.ts +73 -0
- package/vendor/shared/src/schemas/index.ts +3 -0
- package/vendor/shared/src/units.ts +43 -0
- package/vendor/shared/test/emission-schedule.test.ts +115 -0
- package/vendor/shared/test/fixtures/emission-vectors.json +1055 -0
- package/vendor/shared/test/fixtures.ts +65 -0
- package/vendor/shared/test/params.test.ts +48 -0
- package/vendor/shared/test/properties.test.ts +136 -0
- package/vendor/shared/test/protocol-proofs.test.ts +88 -0
- package/vendor/shared/test/rules.test.ts +474 -0
- package/vendor/shared/test/schemas.test.ts +130 -0
- package/vendor/shared/test/task-risk.test.ts +489 -0
- package/vendor/shared/tsconfig.abi.json +11 -0
- package/vendor/shared/tsconfig.json +23 -0
- package/vendor/shared/types/api/index.d.ts +303 -0
- package/vendor/shared/vitest.config.ts +8 -0
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
import { mcpInstructions, roleGuide } from "../guides.js";
|
|
2
|
+
import { isRole, ROLES } from "../roles.js";
|
|
3
|
+
import { base64ToBytes } from "../sdk/base64.js";
|
|
4
|
+
/** "What to call next" appended to every tool description so agents never stall mid-loop. */
|
|
5
|
+
export const TOOL_NEXT_STEPS = {
|
|
6
|
+
list_tasks: "get_task, then claim_task for a task whose criteria you can satisfy.",
|
|
7
|
+
get_task: "claim_task (executor) or submit_test_report (drawn tester).",
|
|
8
|
+
claim_task: "heartbeat_claim before leaseExpiresAt, then submit_work.",
|
|
9
|
+
submit_work: "IMMEDIATELY draw_testers with the same taskId; nobody else will.",
|
|
10
|
+
draw_testers: "If revealPending, call draw_testers again in ~30s. Otherwise poll get_next_actions until POST_RESULT appears.",
|
|
11
|
+
get_submission: "Evaluate every criterion, then submit_test_report.",
|
|
12
|
+
submit_test_report: "get_next_actions; nothing else is required for this delivery.",
|
|
13
|
+
get_final_result: "Ask the user to approve, then send_transaction with the returned tx.",
|
|
14
|
+
claim_rewards: "Ask the user to approve, then send_transaction.",
|
|
15
|
+
join_tester_pool: "If canJoin, ask the user to approve and send_transaction; then heartbeat.",
|
|
16
|
+
join_arbitrator_pool: "If canJoin, ask the user to approve and send_transaction; then list_arbitrator_cases.",
|
|
17
|
+
check_publish_accounts: "Tell the user which account can publish and what each choice means; get their explicit choice before publish_task.",
|
|
18
|
+
publish_task: "Ask the user to approve, then send_transaction with the returned txRequest (keeps its from).",
|
|
19
|
+
accept_result: "Ask the user to approve, then send_transaction.",
|
|
20
|
+
review_task: "Ask the user to approve, then send_transaction.",
|
|
21
|
+
get_next_actions: "Execute items in order; each item names the request (and tool) to use. APPEAL_DECISION → get_task, verify the posted result, then waive_appeal (no objection) or open_appeal (with statement). POST_RESULT from any related party → get_final_result → send_transaction.",
|
|
22
|
+
get_eligibility: "Resolve each missing step (its request field names the call), then get_next_actions.",
|
|
23
|
+
heartbeat: "get_next_actions.",
|
|
24
|
+
heartbeat_claim: "submit_work when the delivery is ready.",
|
|
25
|
+
list_arbitrator_cases: "get_dispute for each case in CONFIRMING/COMMIT/REVEAL.",
|
|
26
|
+
get_dispute: "confirm_arbitration_seat (CONFIRMING) or arbitration_vote_intent (COMMIT/REVEAL).",
|
|
27
|
+
confirm_arbitration_seat: "send_transaction within arbAcceptWindowHours.",
|
|
28
|
+
arbitration_vote_intent: "Persist salt locally; send commitTx now; send revealTx as soon as REVEAL opens.",
|
|
29
|
+
send_transaction: "get_next_actions to confirm the state advanced.",
|
|
30
|
+
list_actions: "send_transaction for a callable trigger after user approval.",
|
|
31
|
+
sign_delivery: "IMMEDIATELY draw_testers with the same taskId.",
|
|
32
|
+
get_submission_file: "Judge every criterion, then submit_test_report.",
|
|
33
|
+
list_rewards: "claim_rewards with the claimable scheduleIds.",
|
|
34
|
+
get_rewards_breakdown: "claim_rewards / claim_arb_stream as needed.",
|
|
35
|
+
open_appeal: "Ask the user to approve, then send_transaction (appeal fee).",
|
|
36
|
+
waive_appeal: "Ask the user to approve, then send_transaction.",
|
|
37
|
+
get_arb_stream_pending: "If available and pendingWei > 0, claim_arb_stream.",
|
|
38
|
+
claim_arb_stream: "Ask the user to approve, then send_transaction.",
|
|
39
|
+
claim_tester_seat: "Ask the user to approve, then send_transaction from the tester wallet.",
|
|
40
|
+
submit_fallback_report: "Ask the user to approve, then send_transaction before the deadline.",
|
|
41
|
+
get_role_guide: "get_eligibility, then get_next_actions.",
|
|
42
|
+
};
|
|
43
|
+
function deliveryBlob(file) {
|
|
44
|
+
if (typeof file.base64 === "string")
|
|
45
|
+
return new Blob([base64ToBytes(file.base64)], {
|
|
46
|
+
type: file.contentType ?? "application/octet-stream",
|
|
47
|
+
});
|
|
48
|
+
if (typeof file.text === "string")
|
|
49
|
+
return new Blob([file.text], { type: file.contentType ?? "text/plain" });
|
|
50
|
+
throw new Error(`Delivery file ${file.name} needs text or base64 content.`);
|
|
51
|
+
}
|
|
52
|
+
function object(input) {
|
|
53
|
+
if (typeof input !== "object" || input === null || Array.isArray(input))
|
|
54
|
+
throw new Error("Tool input must be an object.");
|
|
55
|
+
return input;
|
|
56
|
+
}
|
|
57
|
+
export class AgentGridMcpServer {
|
|
58
|
+
client;
|
|
59
|
+
options;
|
|
60
|
+
tools;
|
|
61
|
+
publishIntents = new Map();
|
|
62
|
+
keyOwner;
|
|
63
|
+
walletClient;
|
|
64
|
+
constructor(client, options = {}) {
|
|
65
|
+
this.client = client;
|
|
66
|
+
this.options = options;
|
|
67
|
+
const schema = (properties, required = []) => ({
|
|
68
|
+
type: "object",
|
|
69
|
+
properties,
|
|
70
|
+
required,
|
|
71
|
+
additionalProperties: false,
|
|
72
|
+
});
|
|
73
|
+
this.tools = [
|
|
74
|
+
{
|
|
75
|
+
name: "list_tasks",
|
|
76
|
+
description: "List matching agentsgot tasks. Requires scope tasks:read. Delegated API keys with this scope may call on behalf of the key owner.",
|
|
77
|
+
inputSchema: schema({
|
|
78
|
+
cursor: { type: "string" },
|
|
79
|
+
limit: { type: "integer" },
|
|
80
|
+
status: { type: "string" },
|
|
81
|
+
}),
|
|
82
|
+
run: (input) => this.client.listTasks(input),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "get_task",
|
|
86
|
+
description: "Get full agentsgot task details, including signed delivery executors and artifact hashes when available. Requires scope tasks:read.",
|
|
87
|
+
inputSchema: schema({ taskId: { type: "string" } }, ["taskId"]),
|
|
88
|
+
run: (input) => this.client.getTask(String(input.taskId)),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "claim_task",
|
|
92
|
+
description: "Create an off-chain claim lease. Claiming does not occupy a participant slot; the slot is taken only when the delivery signature makes the claim SUBMITTED. Blocked when signed deliveries already reach maxParticipants. Requires scope tasks:claim. A delegated agent uses the key owner's identity for the claim.",
|
|
93
|
+
inputSchema: schema({ taskId: { type: "string" }, idempotencyKey: { type: "string" } }, [
|
|
94
|
+
"taskId",
|
|
95
|
+
"idempotencyKey",
|
|
96
|
+
]),
|
|
97
|
+
run: (input) => this.client.claimTask(String(input.taskId), String(input.idempotencyKey)),
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "submit_work",
|
|
101
|
+
description: "Upload work and return its CID and delivery signature status. Requires scope work:submit. Each file needs a relative path name (src/index.ts; no leading /, no ..) and either text or base64 content (zip, images). Limits are in get_task → viewer.submissionLimits. A delegated agent signs the ExecutorDelivery typed data with its own wallet; the backend records the signer_address.",
|
|
102
|
+
inputSchema: schema({
|
|
103
|
+
claimId: { type: "string" },
|
|
104
|
+
files: {
|
|
105
|
+
type: "array",
|
|
106
|
+
items: {
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
name: { type: "string", description: "Relative path, e.g. src/index.ts" },
|
|
110
|
+
text: { type: "string", description: "UTF-8 content" },
|
|
111
|
+
base64: { type: "string", description: "Binary content, e.g. delivery.zip" },
|
|
112
|
+
contentType: { type: "string" },
|
|
113
|
+
},
|
|
114
|
+
required: ["name"],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
evidence: { type: "string" },
|
|
118
|
+
idempotencyKey: { type: "string" },
|
|
119
|
+
}, ["claimId", "files", "idempotencyKey"]),
|
|
120
|
+
run: async (input) => {
|
|
121
|
+
const files = input.files.map((file) => ({
|
|
122
|
+
name: file.name,
|
|
123
|
+
content: deliveryBlob(file),
|
|
124
|
+
}));
|
|
125
|
+
const result = await this.client.submitWork({
|
|
126
|
+
claimId: String(input.claimId),
|
|
127
|
+
files,
|
|
128
|
+
...(input.evidence === undefined ? {} : { evidence: String(input.evidence) }),
|
|
129
|
+
idempotencyKey: String(input.idempotencyKey),
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
submissionId: result.id,
|
|
133
|
+
cid: result.cid,
|
|
134
|
+
cidHash: result.cidHash,
|
|
135
|
+
signatureStatus: result.status,
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "claim_rewards",
|
|
141
|
+
description: "Return a caller-paid RewardVesting claim transaction for up to 100 owned schedules without sending it. Use only unique scheduleIds with a CLAIMABLE tranche from list_rewards. Requires scope rewards:claim.",
|
|
142
|
+
inputSchema: schema({
|
|
143
|
+
scheduleIds: {
|
|
144
|
+
type: "array",
|
|
145
|
+
items: { type: "string" },
|
|
146
|
+
minItems: 1,
|
|
147
|
+
maxItems: 100,
|
|
148
|
+
uniqueItems: true,
|
|
149
|
+
},
|
|
150
|
+
}, ["scheduleIds"]),
|
|
151
|
+
run: (input) => this.client.createRewardClaim(input.scheduleIds),
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "join_tester_pool",
|
|
155
|
+
description: "Return a caller-paid TesterAssignment.joinPool() intent from GET /staking/tester-pool-join-intent without sending it. Includes inPool, meetsMinimum, and canJoin. ValidatorStaking.deposit alone does not enter the tester draw pool. Optional chainId + testerAssignment encode locally instead of calling the API.",
|
|
156
|
+
inputSchema: schema({
|
|
157
|
+
chainId: { type: "integer", minimum: 1 },
|
|
158
|
+
testerAssignment: {
|
|
159
|
+
type: "string",
|
|
160
|
+
description: "Optional TesterAssignment proxy; when set with chainId, skip the API.",
|
|
161
|
+
},
|
|
162
|
+
}),
|
|
163
|
+
run: (input) => {
|
|
164
|
+
if (input.chainId !== undefined && input.testerAssignment !== undefined) {
|
|
165
|
+
return Promise.resolve(this.client.prepareJoinTesterPool({
|
|
166
|
+
chainId: Number(input.chainId),
|
|
167
|
+
testerAssignment: String(input.testerAssignment),
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
return this.client.getJoinTesterPoolIntent();
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: "check_publish_accounts",
|
|
175
|
+
description: "Call before publish_task. The publisher's PublisherStaking stake backs every task it publishes. Reports, for the API key owner and (when different) the local signing wallet: publish scope, stake vs required, wallet AGT, gas, who has to sign, and whether the key owner granted the local wallet a publish operator allowance (operator: the local wallet sends createTaskFor for the owner and pays gas, the owner's stake backs the task). Pass reserveWei from the draft cost to include the new task.",
|
|
176
|
+
inputSchema: schema({ reserveWei: { type: "string" } }),
|
|
177
|
+
run: (input) => this.publishAccounts(input.reserveWei === undefined ? undefined : String(input.reserveWei)),
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: "publish_task",
|
|
181
|
+
description: "Build a TaskSpec V4 publish intent; txRequest.from is the only wallet that may send it. When the local wallet differs from the API key owner, publishAs is required and must be the user's explicit choice after check_publish_accounts: operator publishes for the key owner (its stake and identity) with the local wallet sending createTaskFor under the owner's publish grant; keyOwner is refused here (the owner publishes from their own wallet on the web); localWallet signs the local wallet into its own session and makes it the publisher. Requires scope tasks:publish for keyOwner and operator.",
|
|
182
|
+
inputSchema: schema({
|
|
183
|
+
specification: { type: "object" },
|
|
184
|
+
idempotencyKey: { type: "string" },
|
|
185
|
+
publishAs: { type: "string", enum: ["operator", "keyOwner", "localWallet"] },
|
|
186
|
+
}, ["specification", "idempotencyKey"]),
|
|
187
|
+
run: (input) => {
|
|
188
|
+
const key = String(input.idempotencyKey);
|
|
189
|
+
const existing = this.publishIntents.get(key);
|
|
190
|
+
if (existing)
|
|
191
|
+
return existing;
|
|
192
|
+
const created = this.publish(input.publishAs, input.specification);
|
|
193
|
+
this.publishIntents.set(key, created);
|
|
194
|
+
created.catch(() => this.publishIntents.delete(key));
|
|
195
|
+
return created;
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "accept_result",
|
|
200
|
+
description: "Return the publisher's caller-paid acceptance transaction for a posted result without sending it. Uses the local wallet's own session when it is the task's publisher. A local wallet holding the publisher's active publish operator grant may send it like the publisher; any other sender has to wait for the review window to end. Requires scope tasks:publish.",
|
|
201
|
+
inputSchema: schema({ taskId: { type: "string" } }, ["taskId"]),
|
|
202
|
+
run: async (input) => (await this.publisherClient(String(input.taskId))).getAcceptResult(String(input.taskId)),
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "get_next_actions",
|
|
206
|
+
description: "Every pending duty for this wallet across roles (claim heartbeat, sign delivery, tester draw commit/reveal, test reports, postResult, publisher review, arbitration confirm/commit/reveal, reward claims, triggers), sorted by priority then deadline. Each item names the exact request to make. Tasks the local wallet published under its own identity are merged in with account=localWallet. Poll every few minutes.",
|
|
207
|
+
inputSchema: schema({}),
|
|
208
|
+
run: () => this.nextActions(),
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "get_eligibility",
|
|
212
|
+
description: "Per-role eligibility (executor, tester, arbitrator, publisher) with stake shortfall in wei, pool membership, online status and the missing onboarding steps. Thresholds come from params.json.",
|
|
213
|
+
inputSchema: schema({}),
|
|
214
|
+
run: () => this.client.getEligibility(),
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "heartbeat",
|
|
218
|
+
description: "POST /agents/heartbeat so the network counts this agent online. Testers and arbitrators are only drawn while online.",
|
|
219
|
+
inputSchema: schema({}),
|
|
220
|
+
run: () => this.client.reportPresence(),
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: "heartbeat_claim",
|
|
224
|
+
description: "Renew an execution claim lease before leaseExpiresAt. Requires tasks:claim.",
|
|
225
|
+
inputSchema: schema({ claimId: { type: "string" } }, ["claimId"]),
|
|
226
|
+
run: (input) => this.client.heartbeatClaim(String(input.claimId)),
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: "draw_testers",
|
|
230
|
+
description: "Executor step right after submit_work: commit the tester draw seed and reveal it. If reveal returns 409 (seed block not mined yet) the commit result is returned with revealPending=true; call again in ~30s.",
|
|
231
|
+
inputSchema: schema({ taskId: { type: "string" } }, ["taskId"]),
|
|
232
|
+
run: async (input) => {
|
|
233
|
+
const taskId = String(input.taskId);
|
|
234
|
+
const committed = await this.client.commitTesterDraw(taskId);
|
|
235
|
+
try {
|
|
236
|
+
return { revealPending: false, draw: await this.client.revealTesterDraw(taskId) };
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
return {
|
|
240
|
+
revealPending: true,
|
|
241
|
+
draw: committed,
|
|
242
|
+
error: error instanceof Error ? error.message : String(error),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: "get_submission",
|
|
249
|
+
description: "Read a delivery (manifest, cid, typed data). Testers and jurors use this before judging. Requires tasks:read.",
|
|
250
|
+
inputSchema: schema({ submissionId: { type: "string" } }, ["submissionId"]),
|
|
251
|
+
run: (input) => this.client.getSubmission(String(input.submissionId)),
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: "submit_test_report",
|
|
255
|
+
description: "Tester: sign the TestReport typed data with the local wallet and submit it. criteria must cover every acceptance criterion id. Idempotency defaults to test-report:{taskId}:{submissionId}. Requires work:submit.",
|
|
256
|
+
inputSchema: schema({
|
|
257
|
+
taskId: { type: "string" },
|
|
258
|
+
submissionId: { type: "string" },
|
|
259
|
+
approved: { type: "boolean" },
|
|
260
|
+
criteria: {
|
|
261
|
+
type: "array",
|
|
262
|
+
items: {
|
|
263
|
+
type: "object",
|
|
264
|
+
properties: {
|
|
265
|
+
criterionId: { type: "string" },
|
|
266
|
+
passed: { type: "boolean" },
|
|
267
|
+
note: { type: "string" },
|
|
268
|
+
},
|
|
269
|
+
required: ["criterionId", "passed", "note"],
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
summary: { type: "string" },
|
|
273
|
+
}, ["taskId", "submissionId", "approved", "criteria", "summary"]),
|
|
274
|
+
run: (input) => this.client.submitTestReport({
|
|
275
|
+
taskId: String(input.taskId),
|
|
276
|
+
submissionId: String(input.submissionId),
|
|
277
|
+
approved: Boolean(input.approved),
|
|
278
|
+
criteria: input.criteria,
|
|
279
|
+
summary: String(input.summary),
|
|
280
|
+
}),
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: "get_final_result",
|
|
284
|
+
description: "Return the caller-paid postResult transaction once every drawn tester has reported. 409 TASK_EXECUTION_WINDOW_OPEN means wait.",
|
|
285
|
+
inputSchema: schema({ taskId: { type: "string" } }, ["taskId"]),
|
|
286
|
+
run: (input) => this.client.getFinalResult(String(input.taskId)),
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: "review_task",
|
|
290
|
+
description: "Publisher review of a RESULT_POSTED task: accept, or reject with a reason and failed criterion ids. Returns a caller-paid transaction. Requires tasks:publish.",
|
|
291
|
+
inputSchema: schema({
|
|
292
|
+
taskId: { type: "string" },
|
|
293
|
+
accept: { type: "boolean" },
|
|
294
|
+
reason: { type: "string" },
|
|
295
|
+
criteria: { type: "array", items: { type: "string" } },
|
|
296
|
+
}, ["taskId", "accept"]),
|
|
297
|
+
run: async (input) => (await this.publisherClient(String(input.taskId))).reviewTask(String(input.taskId), {
|
|
298
|
+
accept: Boolean(input.accept),
|
|
299
|
+
...(input.reason === undefined ? {} : { reason: String(input.reason) }),
|
|
300
|
+
...(input.criteria === undefined ? {} : { criteria: input.criteria }),
|
|
301
|
+
}),
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: "join_arbitrator_pool",
|
|
305
|
+
description: "Return the caller-paid ArbitrationCourt.joinArbitrator() intent with inPool, meetsMinimum, stakeAgt and canJoin. Does not send it.",
|
|
306
|
+
inputSchema: schema({}),
|
|
307
|
+
run: () => this.client.getJoinArbitratorPoolIntent(),
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: "list_arbitrator_cases",
|
|
311
|
+
description: "Cases where this wallet holds a seat, with phase and phaseDeadline.",
|
|
312
|
+
inputSchema: schema({}),
|
|
313
|
+
run: () => this.client.listArbitratorCases(),
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: "get_dispute",
|
|
317
|
+
description: "Full dispute: criteria, seats, fallback state and deadlines.",
|
|
318
|
+
inputSchema: schema({ caseId: { type: "string" } }, ["caseId"]),
|
|
319
|
+
run: (input) => this.client.getDispute(String(input.caseId)),
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: "confirm_arbitration_seat",
|
|
323
|
+
description: "Return the caller-paid seat confirmation transaction. Send within arbAcceptWindowHours.",
|
|
324
|
+
inputSchema: schema({ caseId: { type: "string" } }, ["caseId"]),
|
|
325
|
+
run: (input) => this.client.confirmArbitrationSeat(String(input.caseId)),
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: "arbitration_vote_intent",
|
|
329
|
+
description: "Build commitTx and revealTx for one vote per criterion. Omit salt on commit to get a fresh random salt; PERSIST the returned salt locally and pass the same salt and votes again at reveal time.",
|
|
330
|
+
inputSchema: schema({
|
|
331
|
+
caseId: { type: "string" },
|
|
332
|
+
salt: { type: "string" },
|
|
333
|
+
votes: {
|
|
334
|
+
type: "array",
|
|
335
|
+
items: {
|
|
336
|
+
type: "object",
|
|
337
|
+
properties: { satisfied: { type: "boolean" }, reason: { type: "string" } },
|
|
338
|
+
required: ["satisfied", "reason"],
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
}, ["caseId", "votes"]),
|
|
342
|
+
run: (input) => this.client.createArbitrationVoteIntent(String(input.caseId), input.votes, ...(input.salt === undefined ? [] : [String(input.salt)])),
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: "send_transaction",
|
|
346
|
+
description: "Send a caller-paid transaction intent ({chainId,from?,to,data,value}) from the local wallet. Always pass from when the intent has one: a mismatch with the local wallet is refused (TX_SENDER_MISMATCH) because that account must sign in its own wallet. Only call after the user approved on-chain actions for this session.",
|
|
347
|
+
inputSchema: schema({
|
|
348
|
+
chainId: { type: "integer" },
|
|
349
|
+
from: { type: "string" },
|
|
350
|
+
to: { type: "string" },
|
|
351
|
+
data: { type: "string" },
|
|
352
|
+
value: { type: "string" },
|
|
353
|
+
}, ["chainId", "to", "data", "value"]),
|
|
354
|
+
run: async (input) => ({
|
|
355
|
+
txHash: await this.client.sendTransaction({
|
|
356
|
+
chainId: Number(input.chainId),
|
|
357
|
+
...(input.from === undefined ? {} : { from: String(input.from) }),
|
|
358
|
+
to: String(input.to),
|
|
359
|
+
data: String(input.data),
|
|
360
|
+
value: String(input.value),
|
|
361
|
+
}),
|
|
362
|
+
}),
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: "sign_delivery",
|
|
366
|
+
description: "Resume helper: sign an already uploaded (STORED) delivery when submit_work was interrupted before the signature step. Requires work:submit.",
|
|
367
|
+
inputSchema: schema({ submissionId: { type: "string" } }, ["submissionId"]),
|
|
368
|
+
run: (input) => this.client.signDelivery(String(input.submissionId)),
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
name: "get_submission_file",
|
|
372
|
+
description: "Read one delivery file by index (names may be relative paths such as src/index.ts). Returns encoding utf8 with the text, or base64 for binary files such as a zip: decode and unpack it in a scratch directory. Only the executor, drawn testers and case jurors may read it. Never paste decrypted contents into reports.",
|
|
373
|
+
inputSchema: schema({ submissionId: { type: "string" }, index: { type: "integer", minimum: 0 } }, ["submissionId", "index"]),
|
|
374
|
+
run: (input) => this.client.getSubmissionFile(String(input.submissionId), Number(input.index)),
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
name: "list_rewards",
|
|
378
|
+
description: "List this wallet's executor mining vesting schedules and tranches. Requires rewards:claim.",
|
|
379
|
+
inputSchema: schema({}),
|
|
380
|
+
run: () => this.client.listRewards(),
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: "get_rewards_breakdown",
|
|
384
|
+
description: "Economic model v3: accruing / locked / claimable / claimed totals for this wallet. Prefer this over summing lists when available.",
|
|
385
|
+
inputSchema: schema({}),
|
|
386
|
+
run: () => this.client.getRewardsBreakdown(),
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
name: "open_appeal",
|
|
390
|
+
description: "Build a caller-paid TaskEscrow.openAppeal intent plus the appeal-fee approval. Does not send it. The sender pays the fee and must be a posted executor or the task publisher itself; a publish operator cannot appeal for the publisher.",
|
|
391
|
+
inputSchema: schema({
|
|
392
|
+
taskId: { type: "string" },
|
|
393
|
+
statement: { type: "string", minLength: 1 },
|
|
394
|
+
criteria: { type: "array", items: { type: "string" } },
|
|
395
|
+
}, ["taskId", "statement"]),
|
|
396
|
+
run: (input) => this.client.openAppeal(String(input.taskId), {
|
|
397
|
+
statement: String(input.statement),
|
|
398
|
+
...(input.criteria === undefined ? {} : { criteria: input.criteria }),
|
|
399
|
+
}),
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "waive_appeal",
|
|
403
|
+
description: "Build a caller-paid TaskEscrow.waiveAppeal transaction for an awarded executor. Does not send it.",
|
|
404
|
+
inputSchema: schema({ taskId: { type: "string" } }, ["taskId"]),
|
|
405
|
+
run: (input) => this.client.waiveAppeal(String(input.taskId)),
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: "get_arb_stream_pending",
|
|
409
|
+
description: "Read this wallet's pending ArbitrationStream balance and weight.",
|
|
410
|
+
inputSchema: schema({}),
|
|
411
|
+
run: () => this.client.getArbStreamPending(),
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: "claim_arb_stream",
|
|
415
|
+
description: "Return a caller-paid arbitrator stream claim intent (10% emission). Does not send it.",
|
|
416
|
+
inputSchema: schema({}),
|
|
417
|
+
run: () => this.client.claimArbStream(),
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
name: "claim_tester_seat",
|
|
421
|
+
description: "Tester: return a caller-paid claim, with a Merkle proof against a settled hourly seat snapshot, for this wallet's seat mining (15% emission). Claims may repeat as later hours settle; FULLY_CLAIMED is terminal. Does not send it.",
|
|
422
|
+
inputSchema: schema({ taskId: { type: "string" } }, ["taskId"]),
|
|
423
|
+
run: (input) => this.client.claimTesterSeat(String(input.taskId)),
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: "list_executor_shares",
|
|
427
|
+
description: "Executor: list this wallet's leaves in posted executor Merkle roots. POSTED waits for settlement; CLAIMABLE must be vested with vest_executor_shares before any reward tranche appears; CLAIMED is done.",
|
|
428
|
+
inputSchema: schema({}),
|
|
429
|
+
run: () => this.client.listExecutorShares(),
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
name: "vest_executor_shares",
|
|
433
|
+
description: "Executor: return a TaskEscrow.claimExecutorShares transaction that turns settled shares into vesting schedules (≤ 50 leaves). Anyone may send it and rewards always go to each executor, so a delegated signer can pay gas. includeOthers adds other unclaimed executors of the task. Does not send it.",
|
|
434
|
+
inputSchema: schema({ taskId: { type: "string" }, includeOthers: { type: "boolean" } }, [
|
|
435
|
+
"taskId",
|
|
436
|
+
]),
|
|
437
|
+
run: (input) => this.client.vestExecutorShares(String(input.taskId), input.includeOthers === true),
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: "submit_fallback_report",
|
|
441
|
+
description: "Fallback reviewer: build the caller-paid submitFallbackReport transaction for a dispute. Evaluate every criterion first. Does not send it.",
|
|
442
|
+
inputSchema: schema({
|
|
443
|
+
caseId: { type: "string" },
|
|
444
|
+
approved: { type: "boolean" },
|
|
445
|
+
criteria: { type: "array" },
|
|
446
|
+
summary: { type: "string" },
|
|
447
|
+
}, ["caseId", "approved", "criteria", "summary"]),
|
|
448
|
+
run: (input) => this.client.createFallbackReportIntent(String(input.caseId), {
|
|
449
|
+
approved: Boolean(input.approved),
|
|
450
|
+
criteria: input.criteria,
|
|
451
|
+
summary: String(input.summary),
|
|
452
|
+
}),
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: "get_role_guide",
|
|
456
|
+
description: "Closed-loop playbook for one role (executor|tester|arbitrator|publisher): thresholds from params.json, steps, schedules and safety rules.",
|
|
457
|
+
inputSchema: schema({ role: { type: "string", enum: [...ROLES] } }, ["role"]),
|
|
458
|
+
run: async (input) => {
|
|
459
|
+
const role = String(input.role);
|
|
460
|
+
if (!isRole(role))
|
|
461
|
+
throw new Error(`Unknown role ${role}`);
|
|
462
|
+
return { role, guide: roleGuide(role) };
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
name: "list_actions",
|
|
467
|
+
description: "List caller-triggerable protocol transactions. Requires scope tasks:read.",
|
|
468
|
+
inputSchema: schema({ address: { type: "string" }, subjectId: { type: "string" } }),
|
|
469
|
+
run: (input) => this.client.listActions({
|
|
470
|
+
...(input.address === undefined ? {} : { address: String(input.address) }),
|
|
471
|
+
...(input.subjectId === undefined ? {} : { subjectId: String(input.subjectId) }),
|
|
472
|
+
}),
|
|
473
|
+
},
|
|
474
|
+
];
|
|
475
|
+
}
|
|
476
|
+
/** The API key owner (principal); differs from the local wallet under delegation. */
|
|
477
|
+
ownerAddress() {
|
|
478
|
+
this.keyOwner ??= this.client
|
|
479
|
+
.getEligibility()
|
|
480
|
+
.then(({ address }) => address.toLowerCase())
|
|
481
|
+
.catch((error) => {
|
|
482
|
+
this.keyOwner = undefined;
|
|
483
|
+
throw error;
|
|
484
|
+
});
|
|
485
|
+
return this.keyOwner;
|
|
486
|
+
}
|
|
487
|
+
localWalletClient() {
|
|
488
|
+
const factory = this.options.walletSession;
|
|
489
|
+
if (!factory)
|
|
490
|
+
return Promise.reject(new Error("This host cannot sign the local wallet into its own session; publish from the key owner's wallet instead."));
|
|
491
|
+
this.walletClient ??= factory().catch((error) => {
|
|
492
|
+
this.walletClient = undefined;
|
|
493
|
+
throw error;
|
|
494
|
+
});
|
|
495
|
+
return this.walletClient;
|
|
496
|
+
}
|
|
497
|
+
async publish(publishAs, spec) {
|
|
498
|
+
const local = this.client.walletAddress.toLowerCase();
|
|
499
|
+
const owner = await this.ownerAddress();
|
|
500
|
+
if (owner === local)
|
|
501
|
+
return this.client.publishTask(spec);
|
|
502
|
+
if (publishAs === "operator")
|
|
503
|
+
return this.client.publishTask(spec, { operator: local });
|
|
504
|
+
if (publishAs === "localWallet")
|
|
505
|
+
return (await this.localWalletClient()).publishTask(spec);
|
|
506
|
+
if (publishAs === "keyOwner")
|
|
507
|
+
throw new Error(`Only ${owner} can send createTask as the key owner, and this agent only holds ${local}. Ask the user to publish from ${owner} on the web publish page, or choose publishAs=operator if check_publish_accounts shows ${owner} granted ${local} a publish operator allowance.`);
|
|
508
|
+
throw new Error(`The local wallet ${local} is not the API key owner ${owner}. Run check_publish_accounts, tell the user which account can publish, and pass publishAs with their explicit choice.`);
|
|
509
|
+
}
|
|
510
|
+
/** Publisher-only calls must come from the task's publisher identity. */
|
|
511
|
+
async publisherClient(taskId) {
|
|
512
|
+
const local = this.client.walletAddress.toLowerCase();
|
|
513
|
+
const task = await this.client.getTask(taskId);
|
|
514
|
+
if (task.publisher.toLowerCase() !== local)
|
|
515
|
+
return this.client;
|
|
516
|
+
return (await this.ownerAddress()) === local ? this.client : this.localWalletClient();
|
|
517
|
+
}
|
|
518
|
+
async nextActions() {
|
|
519
|
+
const own = await this.client.getNextActions();
|
|
520
|
+
const local = this.client.walletAddress.toLowerCase();
|
|
521
|
+
if (own.address.toLowerCase() === local || !this.options.walletSession)
|
|
522
|
+
return own;
|
|
523
|
+
const published = await this.client.listTasks({ publisher: local, limit: 1 });
|
|
524
|
+
if (!published.items.length)
|
|
525
|
+
return own;
|
|
526
|
+
const mine = await (await this.localWalletClient()).getNextActions();
|
|
527
|
+
const items = [
|
|
528
|
+
...own.items,
|
|
529
|
+
...mine.items.map((item) => ({ ...item, account: "localWallet" })),
|
|
530
|
+
].sort((left, right) => left.priority - right.priority ||
|
|
531
|
+
(left.deadline ?? "\uffff").localeCompare(right.deadline ?? "\uffff"));
|
|
532
|
+
return { ...own, items };
|
|
533
|
+
}
|
|
534
|
+
async publishAccounts(reserveWei) {
|
|
535
|
+
const eligibility = await this.client.getEligibility();
|
|
536
|
+
const owner = eligibility.address.toLowerCase();
|
|
537
|
+
this.keyOwner ??= Promise.resolve(owner);
|
|
538
|
+
const local = this.client.walletAddress.toLowerCase();
|
|
539
|
+
const delegated = owner !== local;
|
|
540
|
+
const hasPublishScope = !eligibility.roles.publisher.missing.some(({ code }) => code === "SCOPE_MISSING");
|
|
541
|
+
const [ownerState, operatorState, localState] = await Promise.all([
|
|
542
|
+
this.client.getPublisherReadiness(owner, reserveWei),
|
|
543
|
+
delegated ? this.client.getPublisherReadiness(owner, reserveWei, local) : null,
|
|
544
|
+
delegated ? this.client.getPublisherReadiness(local, reserveWei) : null,
|
|
545
|
+
]);
|
|
546
|
+
const keyOwner = {
|
|
547
|
+
...ownerState,
|
|
548
|
+
hasPublishScope,
|
|
549
|
+
canPublish: ownerState.ready && hasPublishScope,
|
|
550
|
+
signer: delegated
|
|
551
|
+
? "the user, from the key owner's own wallet on the web publish page"
|
|
552
|
+
: "this agent (local wallet)",
|
|
553
|
+
};
|
|
554
|
+
const localWallet = localState && {
|
|
555
|
+
...localState,
|
|
556
|
+
canPublish: localState.ready && Boolean(this.options.walletSession),
|
|
557
|
+
signer: "this agent (local wallet), under the local wallet's own sign-in",
|
|
558
|
+
consequences: "The local wallet becomes the publisher: the reserve comes from its stake, refunds return to it, it reviews and accepts the result, and the task is not listed under the key owner's account.",
|
|
559
|
+
};
|
|
560
|
+
const operator = operatorState && {
|
|
561
|
+
...operatorState,
|
|
562
|
+
hasPublishScope,
|
|
563
|
+
canPublish: operatorState.ready && hasPublishScope,
|
|
564
|
+
signer: `this agent (local wallet), sending createTaskFor for ${owner}`,
|
|
565
|
+
consequences: `${owner} stays the publisher: the reserve comes from its stake and is drawn from its grant allowance, refunds return to it and the task is listed under its account. The local wallet only signs and pays gas; it may accept the result and amend the spec once, but appeals and maintenance disputes still need ${owner}'s own wallet.`,
|
|
566
|
+
grant: operatorState.operator?.active
|
|
567
|
+
? "Active. The key owner can change or revoke it in Agent Center (PublisherStaking.setPublishOperator)."
|
|
568
|
+
: `Not granted. ${owner} can authorize ${local} in Agent Center → publish operator (PublisherStaking.setPublishOperator(${local}, allowance, expiresAt)); after that this agent publishes for it without browser signing per task.`,
|
|
569
|
+
};
|
|
570
|
+
const ready = [
|
|
571
|
+
operator?.canPublish && "operator",
|
|
572
|
+
localWallet?.canPublish && "localWallet",
|
|
573
|
+
keyOwner.canPublish && "keyOwner",
|
|
574
|
+
].filter(Boolean);
|
|
575
|
+
const recommendation = ready[0] ?? "none";
|
|
576
|
+
const options = {
|
|
577
|
+
operator: `for the key owner ${owner} through this agent (publishAs=operator; the owner's stake, no browser signing)`,
|
|
578
|
+
localWallet: `as the local wallet ${local} (publishAs=localWallet; its own stake and identity, consequences above)`,
|
|
579
|
+
keyOwner: `from the key owner's own wallet ${owner} on the web publish page (the user signs there)`,
|
|
580
|
+
};
|
|
581
|
+
const next = !delegated
|
|
582
|
+
? keyOwner.canPublish
|
|
583
|
+
? "publish_task, then send_transaction after the user approves."
|
|
584
|
+
: "Report each missing item and the address to fund; do not publish yet."
|
|
585
|
+
: recommendation === "none"
|
|
586
|
+
? `Neither account can publish yet: report each missing item (stake shortfall, gas, publish scope, operator grant) and which address it applies to. ${operator?.grant ?? ""}`.trim()
|
|
587
|
+
: recommendation === "keyOwner" && ready.length === 1
|
|
588
|
+
? `Only the key owner ${owner} can publish, from its own wallet on the web publish page. ${operator?.grant ?? ""}`.trim()
|
|
589
|
+
: `Ask the user to choose: ${ready.map((choice) => options[choice]).join("; or ")}. Pass publishAs with their answer.`;
|
|
590
|
+
return { delegated, keyOwner, operator, localWallet, recommendation, next };
|
|
591
|
+
}
|
|
592
|
+
async handle(request) {
|
|
593
|
+
if (request.method === "initialize")
|
|
594
|
+
return {
|
|
595
|
+
jsonrpc: "2.0",
|
|
596
|
+
id: request.id,
|
|
597
|
+
result: {
|
|
598
|
+
protocolVersion: "2025-06-18",
|
|
599
|
+
capabilities: { tools: {}, prompts: {} },
|
|
600
|
+
serverInfo: { name: "agentsgot", version: "1.1.0" },
|
|
601
|
+
instructions: mcpInstructions(),
|
|
602
|
+
},
|
|
603
|
+
};
|
|
604
|
+
if (request.method === "notifications/initialized")
|
|
605
|
+
return null;
|
|
606
|
+
if (request.method === "prompts/list")
|
|
607
|
+
return {
|
|
608
|
+
jsonrpc: "2.0",
|
|
609
|
+
id: request.id,
|
|
610
|
+
result: {
|
|
611
|
+
prompts: ROLES.map((role) => ({
|
|
612
|
+
name: `role_${role}`,
|
|
613
|
+
description: `Closed-loop playbook, thresholds and schedules for the ${role} role.`,
|
|
614
|
+
arguments: [],
|
|
615
|
+
})),
|
|
616
|
+
},
|
|
617
|
+
};
|
|
618
|
+
if (request.method === "prompts/get") {
|
|
619
|
+
const params = object(request.params);
|
|
620
|
+
const role = String(params.name ?? "").replace(/^role_/u, "");
|
|
621
|
+
if (!isRole(role))
|
|
622
|
+
return {
|
|
623
|
+
jsonrpc: "2.0",
|
|
624
|
+
id: request.id,
|
|
625
|
+
error: { code: -32602, message: "Unknown prompt" },
|
|
626
|
+
};
|
|
627
|
+
return {
|
|
628
|
+
jsonrpc: "2.0",
|
|
629
|
+
id: request.id,
|
|
630
|
+
result: {
|
|
631
|
+
description: `agentsgot ${role} playbook`,
|
|
632
|
+
messages: [{ role: "user", content: { type: "text", text: roleGuide(role) } }],
|
|
633
|
+
},
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
if (request.method === "tools/list")
|
|
637
|
+
return {
|
|
638
|
+
jsonrpc: "2.0",
|
|
639
|
+
id: request.id,
|
|
640
|
+
result: {
|
|
641
|
+
tools: this.tools.map(({ run: _run, ...tool }) => {
|
|
642
|
+
const next = TOOL_NEXT_STEPS[tool.name];
|
|
643
|
+
return next ? { ...tool, description: `${tool.description} Next: ${next}` } : tool;
|
|
644
|
+
}),
|
|
645
|
+
},
|
|
646
|
+
};
|
|
647
|
+
if (request.method === "tools/call") {
|
|
648
|
+
const params = object(request.params);
|
|
649
|
+
const tool = this.tools.find(({ name }) => name === params.name);
|
|
650
|
+
if (!tool)
|
|
651
|
+
return { jsonrpc: "2.0", id: request.id, error: { code: -32602, message: "Unknown tool" } };
|
|
652
|
+
try {
|
|
653
|
+
const result = await tool.run(object(params.arguments ?? {}));
|
|
654
|
+
const next = TOOL_NEXT_STEPS[tool.name];
|
|
655
|
+
return {
|
|
656
|
+
jsonrpc: "2.0",
|
|
657
|
+
id: request.id,
|
|
658
|
+
result: {
|
|
659
|
+
content: [
|
|
660
|
+
{ type: "text", text: JSON.stringify(result) },
|
|
661
|
+
...(next ? [{ type: "text", text: `Next: ${next}` }] : []),
|
|
662
|
+
],
|
|
663
|
+
structuredContent: result,
|
|
664
|
+
...(next ? { _meta: { next } } : {}),
|
|
665
|
+
},
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
catch (error) {
|
|
669
|
+
return {
|
|
670
|
+
jsonrpc: "2.0",
|
|
671
|
+
id: request.id,
|
|
672
|
+
result: {
|
|
673
|
+
isError: true,
|
|
674
|
+
content: [
|
|
675
|
+
{ type: "text", text: error instanceof Error ? error.message : String(error) },
|
|
676
|
+
],
|
|
677
|
+
},
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
return { jsonrpc: "2.0", id: request.id, error: { code: -32601, message: "Method not found" } };
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
export async function serveStdio(server, io) {
|
|
685
|
+
for await (const line of io.lines) {
|
|
686
|
+
if (!line.trim())
|
|
687
|
+
continue;
|
|
688
|
+
const response = await server.handle(JSON.parse(line));
|
|
689
|
+
if (response)
|
|
690
|
+
io.write(`${JSON.stringify(response)}\n`);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
//# sourceMappingURL=server.js.map
|