@flop-labs/sdk 0.0.0-stage → 0.4.0
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/CHANGELOG.md +315 -0
- package/LICENSE +238 -0
- package/README.md +622 -2
- package/dist/a2a/agent-card.d.ts +56 -0
- package/dist/a2a/agent-card.d.ts.map +1 -0
- package/dist/a2a/agent-card.js +111 -0
- package/dist/a2a/agent-card.js.map +1 -0
- package/dist/a2a/index.d.ts +11 -0
- package/dist/a2a/index.d.ts.map +1 -0
- package/dist/a2a/index.js +11 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/a2a/task-lifecycle.d.ts +41 -0
- package/dist/a2a/task-lifecycle.d.ts.map +1 -0
- package/dist/a2a/task-lifecycle.js +60 -0
- package/dist/a2a/task-lifecycle.js.map +1 -0
- package/dist/a2a/types.d.ts +96 -0
- package/dist/a2a/types.d.ts.map +1 -0
- package/dist/a2a/types.js +23 -0
- package/dist/a2a/types.js.map +1 -0
- package/dist/a2a-cjs/agent-card.js +115 -0
- package/dist/a2a-cjs/agent-card.js.map +1 -0
- package/dist/a2a-cjs/index.js +21 -0
- package/dist/a2a-cjs/index.js.map +1 -0
- package/dist/a2a-cjs/package.json +1 -0
- package/dist/a2a-cjs/task-lifecycle.js +64 -0
- package/dist/a2a-cjs/task-lifecycle.js.map +1 -0
- package/dist/a2a-cjs/types.js +26 -0
- package/dist/a2a-cjs/types.js.map +1 -0
- package/dist/adaptor.d.ts +39 -0
- package/dist/adaptor.d.ts.map +1 -0
- package/dist/adaptor.js +130 -0
- package/dist/adaptor.js.map +1 -0
- package/dist/agent/errors.d.ts +95 -0
- package/dist/agent/errors.d.ts.map +1 -0
- package/dist/agent/errors.js +132 -0
- package/dist/agent/errors.js.map +1 -0
- package/dist/agent/task-delegation.d.ts +283 -0
- package/dist/agent/task-delegation.d.ts.map +1 -0
- package/dist/agent/task-delegation.js +444 -0
- package/dist/agent/task-delegation.js.map +1 -0
- package/dist/agent/types.d.ts +19 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +7 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/agent-wallet.d.ts +197 -0
- package/dist/agent-wallet.d.ts.map +1 -0
- package/dist/agent-wallet.js +408 -0
- package/dist/agent-wallet.js.map +1 -0
- package/dist/amhl.d.ts +61 -0
- package/dist/amhl.d.ts.map +1 -0
- package/dist/amhl.js +161 -0
- package/dist/amhl.js.map +1 -0
- package/dist/attestation.d.ts +126 -0
- package/dist/attestation.d.ts.map +1 -0
- package/dist/attestation.js +287 -0
- package/dist/attestation.js.map +1 -0
- package/dist/bip340-adaptor.d.ts +8 -0
- package/dist/bip340-adaptor.d.ts.map +1 -0
- package/dist/bip340-adaptor.js +129 -0
- package/dist/bip340-adaptor.js.map +1 -0
- package/dist/btc-relayer.d.ts +42 -0
- package/dist/btc-relayer.d.ts.map +1 -0
- package/dist/btc-relayer.js +40 -0
- package/dist/btc-relayer.js.map +1 -0
- package/dist/bundle/index.esm.js +2 -0
- package/dist/bundle/index.esm.js.map +1 -0
- package/dist/bundle/index.umd.cjs +2 -0
- package/dist/bundle/index.umd.cjs.map +1 -0
- package/dist/capability-claim-sink.d.ts +5 -0
- package/dist/capability-claim-sink.d.ts.map +1 -0
- package/dist/capability-claim-sink.js +6 -0
- package/dist/capability-claim-sink.js.map +1 -0
- package/dist/chain.d.ts +63 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +100 -0
- package/dist/chain.js.map +1 -0
- package/dist/client.d.ts +356 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +863 -0
- package/dist/client.js.map +1 -0
- package/dist/compute-channel/adaptor-settlement.d.ts +19 -0
- package/dist/compute-channel/adaptor-settlement.d.ts.map +1 -0
- package/dist/compute-channel/adaptor-settlement.js +40 -0
- package/dist/compute-channel/adaptor-settlement.js.map +1 -0
- package/dist/compute-channel/agent-client.d.ts +141 -0
- package/dist/compute-channel/agent-client.d.ts.map +1 -0
- package/dist/compute-channel/agent-client.js +265 -0
- package/dist/compute-channel/agent-client.js.map +1 -0
- package/dist/compute-channel/agent-driver.d.ts +59 -0
- package/dist/compute-channel/agent-driver.d.ts.map +1 -0
- package/dist/compute-channel/agent-driver.js +364 -0
- package/dist/compute-channel/agent-driver.js.map +1 -0
- package/dist/compute-channel/chain.d.ts +245 -0
- package/dist/compute-channel/chain.d.ts.map +1 -0
- package/dist/compute-channel/chain.js +490 -0
- package/dist/compute-channel/chain.js.map +1 -0
- package/dist/compute-channel/chat-render.d.ts +21 -0
- package/dist/compute-channel/chat-render.d.ts.map +1 -0
- package/dist/compute-channel/chat-render.js +87 -0
- package/dist/compute-channel/chat-render.js.map +1 -0
- package/dist/compute-channel/crypto.d.ts +19 -0
- package/dist/compute-channel/crypto.d.ts.map +1 -0
- package/dist/compute-channel/crypto.js +52 -0
- package/dist/compute-channel/crypto.js.map +1 -0
- package/dist/compute-channel/da.d.ts +111 -0
- package/dist/compute-channel/da.d.ts.map +1 -0
- package/dist/compute-channel/da.js +320 -0
- package/dist/compute-channel/da.js.map +1 -0
- package/dist/compute-channel/deepseek-v41.d.ts +56 -0
- package/dist/compute-channel/deepseek-v41.d.ts.map +1 -0
- package/dist/compute-channel/deepseek-v41.js +267 -0
- package/dist/compute-channel/deepseek-v41.js.map +1 -0
- package/dist/compute-channel/direct-session-chain.d.ts +3 -0
- package/dist/compute-channel/direct-session-chain.d.ts.map +1 -0
- package/dist/compute-channel/direct-session-chain.js +245 -0
- package/dist/compute-channel/direct-session-chain.js.map +1 -0
- package/dist/compute-channel/direct-session.d.ts +78 -0
- package/dist/compute-channel/direct-session.d.ts.map +1 -0
- package/dist/compute-channel/direct-session.js +208 -0
- package/dist/compute-channel/direct-session.js.map +1 -0
- package/dist/compute-channel/dispute.d.ts +103 -0
- package/dist/compute-channel/dispute.d.ts.map +1 -0
- package/dist/compute-channel/dispute.js +314 -0
- package/dist/compute-channel/dispute.js.map +1 -0
- package/dist/compute-channel/flop-meter.d.ts +96 -0
- package/dist/compute-channel/flop-meter.d.ts.map +1 -0
- package/dist/compute-channel/flop-meter.js +210 -0
- package/dist/compute-channel/flop-meter.js.map +1 -0
- package/dist/compute-channel/flop-submitter.d.ts +40 -0
- package/dist/compute-channel/flop-submitter.d.ts.map +1 -0
- package/dist/compute-channel/flop-submitter.js +134 -0
- package/dist/compute-channel/flop-submitter.js.map +1 -0
- package/dist/compute-channel/hybrid-candidate.d.ts +22 -0
- package/dist/compute-channel/hybrid-candidate.d.ts.map +1 -0
- package/dist/compute-channel/hybrid-candidate.js +155 -0
- package/dist/compute-channel/hybrid-candidate.js.map +1 -0
- package/dist/compute-channel/hybrid-metering.d.ts +36 -0
- package/dist/compute-channel/hybrid-metering.d.ts.map +1 -0
- package/dist/compute-channel/hybrid-metering.js +69 -0
- package/dist/compute-channel/hybrid-metering.js.map +1 -0
- package/dist/compute-channel/hybrid.d.ts +16 -0
- package/dist/compute-channel/hybrid.d.ts.map +1 -0
- package/dist/compute-channel/hybrid.js +98 -0
- package/dist/compute-channel/hybrid.js.map +1 -0
- package/dist/compute-channel/index.d.ts +47 -0
- package/dist/compute-channel/index.d.ts.map +1 -0
- package/dist/compute-channel/index.js +48 -0
- package/dist/compute-channel/index.js.map +1 -0
- package/dist/compute-channel/lane-producer.d.ts +92 -0
- package/dist/compute-channel/lane-producer.d.ts.map +1 -0
- package/dist/compute-channel/lane-producer.js +265 -0
- package/dist/compute-channel/lane-producer.js.map +1 -0
- package/dist/compute-channel/layered.d.ts +77 -0
- package/dist/compute-channel/layered.d.ts.map +1 -0
- package/dist/compute-channel/layered.js +220 -0
- package/dist/compute-channel/layered.js.map +1 -0
- package/dist/compute-channel/lineage.d.ts +19 -0
- package/dist/compute-channel/lineage.d.ts.map +1 -0
- package/dist/compute-channel/lineage.js +28 -0
- package/dist/compute-channel/lineage.js.map +1 -0
- package/dist/compute-channel/miner-host.d.ts +329 -0
- package/dist/compute-channel/miner-host.d.ts.map +1 -0
- package/dist/compute-channel/miner-host.js +880 -0
- package/dist/compute-channel/miner-host.js.map +1 -0
- package/dist/compute-channel/model-config.d.ts +87 -0
- package/dist/compute-channel/model-config.d.ts.map +1 -0
- package/dist/compute-channel/model-config.js +697 -0
- package/dist/compute-channel/model-config.js.map +1 -0
- package/dist/compute-channel/offers.d.ts +57 -0
- package/dist/compute-channel/offers.d.ts.map +1 -0
- package/dist/compute-channel/offers.js +182 -0
- package/dist/compute-channel/offers.js.map +1 -0
- package/dist/compute-channel/point-claim-sink.d.ts +5 -0
- package/dist/compute-channel/point-claim-sink.d.ts.map +1 -0
- package/dist/compute-channel/point-claim-sink.js +6 -0
- package/dist/compute-channel/point-claim-sink.js.map +1 -0
- package/dist/compute-channel/protocol.d.ts +243 -0
- package/dist/compute-channel/protocol.d.ts.map +1 -0
- package/dist/compute-channel/protocol.js +249 -0
- package/dist/compute-channel/protocol.js.map +1 -0
- package/dist/compute-channel/runtime-storage.d.ts +6 -0
- package/dist/compute-channel/runtime-storage.d.ts.map +1 -0
- package/dist/compute-channel/runtime-storage.js +11 -0
- package/dist/compute-channel/runtime-storage.js.map +1 -0
- package/dist/compute-channel/sampled-audit.d.ts +24 -0
- package/dist/compute-channel/sampled-audit.d.ts.map +1 -0
- package/dist/compute-channel/sampled-audit.js +97 -0
- package/dist/compute-channel/sampled-audit.js.map +1 -0
- package/dist/compute-channel/session-auth.d.ts +6 -0
- package/dist/compute-channel/session-auth.d.ts.map +1 -0
- package/dist/compute-channel/session-auth.js +23 -0
- package/dist/compute-channel/session-auth.js.map +1 -0
- package/dist/compute-channel/session-estimate.d.ts +103 -0
- package/dist/compute-channel/session-estimate.d.ts.map +1 -0
- package/dist/compute-channel/session-estimate.js +140 -0
- package/dist/compute-channel/session-estimate.js.map +1 -0
- package/dist/compute-channel/session-prior-bank.d.ts +61 -0
- package/dist/compute-channel/session-prior-bank.d.ts.map +1 -0
- package/dist/compute-channel/session-prior-bank.js +74 -0
- package/dist/compute-channel/session-prior-bank.js.map +1 -0
- package/dist/compute-channel/session-prior.d.ts +145 -0
- package/dist/compute-channel/session-prior.d.ts.map +1 -0
- package/dist/compute-channel/session-prior.js +325 -0
- package/dist/compute-channel/session-prior.js.map +1 -0
- package/dist/compute-channel/session-store.d.ts +51 -0
- package/dist/compute-channel/session-store.d.ts.map +1 -0
- package/dist/compute-channel/session-store.js +186 -0
- package/dist/compute-channel/session-store.js.map +1 -0
- package/dist/compute-channel/session.d.ts +120 -0
- package/dist/compute-channel/session.d.ts.map +1 -0
- package/dist/compute-channel/session.js +232 -0
- package/dist/compute-channel/session.js.map +1 -0
- package/dist/compute-channel/toploc-checker.d.ts +384 -0
- package/dist/compute-channel/toploc-checker.d.ts.map +1 -0
- package/dist/compute-channel/toploc-checker.js +794 -0
- package/dist/compute-channel/toploc-checker.js.map +1 -0
- package/dist/compute-channel/toploc-completion-rpc.d.ts +26 -0
- package/dist/compute-channel/toploc-completion-rpc.d.ts.map +1 -0
- package/dist/compute-channel/toploc-completion-rpc.js +391 -0
- package/dist/compute-channel/toploc-completion-rpc.js.map +1 -0
- package/dist/compute-channel/toploc-completion.d.ts +109 -0
- package/dist/compute-channel/toploc-completion.d.ts.map +1 -0
- package/dist/compute-channel/toploc-completion.js +301 -0
- package/dist/compute-channel/toploc-completion.js.map +1 -0
- package/dist/compute-channel/toploc-evidence.d.ts +185 -0
- package/dist/compute-channel/toploc-evidence.d.ts.map +1 -0
- package/dist/compute-channel/toploc-evidence.js +299 -0
- package/dist/compute-channel/toploc-evidence.js.map +1 -0
- package/dist/compute-channel/toploc-gumbel.d.ts +149 -0
- package/dist/compute-channel/toploc-gumbel.d.ts.map +1 -0
- package/dist/compute-channel/toploc-gumbel.js +245 -0
- package/dist/compute-channel/toploc-gumbel.js.map +1 -0
- package/dist/compute-channel/toploc.d.ts +63 -0
- package/dist/compute-channel/toploc.d.ts.map +1 -0
- package/dist/compute-channel/toploc.js +197 -0
- package/dist/compute-channel/toploc.js.map +1 -0
- package/dist/compute-channel/transcript.d.ts +127 -0
- package/dist/compute-channel/transcript.d.ts.map +1 -0
- package/dist/compute-channel/transcript.js +279 -0
- package/dist/compute-channel/transcript.js.map +1 -0
- package/dist/compute-channel/transport-http.d.ts +217 -0
- package/dist/compute-channel/transport-http.d.ts.map +1 -0
- package/dist/compute-channel/transport-http.js +625 -0
- package/dist/compute-channel/transport-http.js.map +1 -0
- package/dist/coordination.d.ts +341 -0
- package/dist/coordination.d.ts.map +1 -0
- package/dist/coordination.js +481 -0
- package/dist/coordination.js.map +1 -0
- package/dist/da-client.d.ts +124 -0
- package/dist/da-client.d.ts.map +1 -0
- package/dist/da-client.js +127 -0
- package/dist/da-client.js.map +1 -0
- package/dist/discovery/capabilities.d.ts +129 -0
- package/dist/discovery/capabilities.d.ts.map +1 -0
- package/dist/discovery/capabilities.js +398 -0
- package/dist/discovery/capabilities.js.map +1 -0
- package/dist/discovery/discovery-service.d.ts +476 -0
- package/dist/discovery/discovery-service.d.ts.map +1 -0
- package/dist/discovery/discovery-service.js +1005 -0
- package/dist/discovery/discovery-service.js.map +1 -0
- package/dist/discovery/examples.d.ts +50 -0
- package/dist/discovery/examples.d.ts.map +1 -0
- package/dist/discovery/examples.js +163 -0
- package/dist/discovery/examples.js.map +1 -0
- package/dist/discovery/fee-estimation.d.ts +550 -0
- package/dist/discovery/fee-estimation.d.ts.map +1 -0
- package/dist/discovery/fee-estimation.js +921 -0
- package/dist/discovery/fee-estimation.js.map +1 -0
- package/dist/discovery/index.d.ts +38 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +32 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/metered-pricing.d.ts +100 -0
- package/dist/discovery/metered-pricing.d.ts.map +1 -0
- package/dist/discovery/metered-pricing.js +150 -0
- package/dist/discovery/metered-pricing.js.map +1 -0
- package/dist/discovery/priority.d.ts +16 -0
- package/dist/discovery/priority.d.ts.map +1 -0
- package/dist/discovery/priority.js +17 -0
- package/dist/discovery/priority.js.map +1 -0
- package/dist/discovery/scoring.d.ts +231 -0
- package/dist/discovery/scoring.d.ts.map +1 -0
- package/dist/discovery/scoring.js +354 -0
- package/dist/discovery/scoring.js.map +1 -0
- package/dist/ecdsa-adaptor.d.ts +72 -0
- package/dist/ecdsa-adaptor.d.ts.map +1 -0
- package/dist/ecdsa-adaptor.js +351 -0
- package/dist/ecdsa-adaptor.js.map +1 -0
- package/dist/errors.d.ts +98 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +190 -0
- package/dist/errors.js.map +1 -0
- package/dist/escrow.d.ts +116 -0
- package/dist/escrow.d.ts.map +1 -0
- package/dist/escrow.js +172 -0
- package/dist/escrow.js.map +1 -0
- package/dist/evm-relayer.d.ts +12 -0
- package/dist/evm-relayer.d.ts.map +1 -0
- package/dist/evm-relayer.js +25 -0
- package/dist/evm-relayer.js.map +1 -0
- package/dist/experimental.d.ts +3 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +3 -0
- package/dist/experimental.js.map +1 -0
- package/dist/faucet.d.ts +141 -0
- package/dist/faucet.d.ts.map +1 -0
- package/dist/faucet.js +312 -0
- package/dist/faucet.js.map +1 -0
- package/dist/finality-status.d.ts +21 -0
- package/dist/finality-status.d.ts.map +1 -0
- package/dist/finality-status.js +10 -0
- package/dist/finality-status.js.map +1 -0
- package/dist/generated-client/capabilities.d.ts +83 -0
- package/dist/generated-client/capabilities.d.ts.map +1 -0
- package/dist/generated-client/capabilities.js +87 -0
- package/dist/generated-client/capabilities.js.map +1 -0
- package/dist/generated-client/cli.d.ts +3 -0
- package/dist/generated-client/cli.d.ts.map +1 -0
- package/dist/generated-client/cli.js +33 -0
- package/dist/generated-client/cli.js.map +1 -0
- package/dist/generated-client/errors.d.ts +13 -0
- package/dist/generated-client/errors.d.ts.map +1 -0
- package/dist/generated-client/errors.js +23 -0
- package/dist/generated-client/errors.js.map +1 -0
- package/dist/generated-client/factory.d.ts +28 -0
- package/dist/generated-client/factory.d.ts.map +1 -0
- package/dist/generated-client/factory.js +182 -0
- package/dist/generated-client/factory.js.map +1 -0
- package/dist/generated-client/generator.d.ts +9 -0
- package/dist/generated-client/generator.d.ts.map +1 -0
- package/dist/generated-client/generator.js +80 -0
- package/dist/generated-client/generator.js.map +1 -0
- package/dist/generated-client/index.d.ts +11 -0
- package/dist/generated-client/index.d.ts.map +1 -0
- package/dist/generated-client/index.js +6 -0
- package/dist/generated-client/index.js.map +1 -0
- package/dist/generated-client/profile.d.ts +166 -0
- package/dist/generated-client/profile.d.ts.map +1 -0
- package/dist/generated-client/profile.js +158 -0
- package/dist/generated-client/profile.js.map +1 -0
- package/dist/generated-client/templates/agent-chat.d.ts +16 -0
- package/dist/generated-client/templates/agent-chat.d.ts.map +1 -0
- package/dist/generated-client/templates/agent-chat.js +12 -0
- package/dist/generated-client/templates/agent-chat.js.map +1 -0
- package/dist/generated-client/templates/index.d.ts +4 -0
- package/dist/generated-client/templates/index.d.ts.map +1 -0
- package/dist/generated-client/templates/index.js +4 -0
- package/dist/generated-client/templates/index.js.map +1 -0
- package/dist/generated-client/templates/miner-operator.d.ts +16 -0
- package/dist/generated-client/templates/miner-operator.d.ts.map +1 -0
- package/dist/generated-client/templates/miner-operator.js +12 -0
- package/dist/generated-client/templates/miner-operator.js.map +1 -0
- package/dist/generated-client/templates/model-publisher.d.ts +21 -0
- package/dist/generated-client/templates/model-publisher.d.ts.map +1 -0
- package/dist/generated-client/templates/model-publisher.js +13 -0
- package/dist/generated-client/templates/model-publisher.js.map +1 -0
- package/dist/hardware.d.ts +68 -0
- package/dist/hardware.d.ts.map +1 -0
- package/dist/hardware.js +222 -0
- package/dist/hardware.js.map +1 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +140 -0
- package/dist/index.js.map +1 -0
- package/dist/model-loader/canonical.d.ts +79 -0
- package/dist/model-loader/canonical.d.ts.map +1 -0
- package/dist/model-loader/canonical.js +116 -0
- package/dist/model-loader/canonical.js.map +1 -0
- package/dist/model-loader/dir.d.ts +26 -0
- package/dist/model-loader/dir.d.ts.map +1 -0
- package/dist/model-loader/dir.js +109 -0
- package/dist/model-loader/dir.js.map +1 -0
- package/dist/model-loader/dmverity.d.ts +78 -0
- package/dist/model-loader/dmverity.d.ts.map +1 -0
- package/dist/model-loader/dmverity.js +141 -0
- package/dist/model-loader/dmverity.js.map +1 -0
- package/dist/model-loader/download-state.d.ts +24 -0
- package/dist/model-loader/download-state.d.ts.map +1 -0
- package/dist/model-loader/download-state.js +99 -0
- package/dist/model-loader/download-state.js.map +1 -0
- package/dist/model-loader/fetch.d.ts +51 -0
- package/dist/model-loader/fetch.d.ts.map +1 -0
- package/dist/model-loader/fetch.js +410 -0
- package/dist/model-loader/fetch.js.map +1 -0
- package/dist/model-loader/file-table.d.ts +38 -0
- package/dist/model-loader/file-table.d.ts.map +1 -0
- package/dist/model-loader/file-table.js +106 -0
- package/dist/model-loader/file-table.js.map +1 -0
- package/dist/model-loader/hf-preflight.d.ts +65 -0
- package/dist/model-loader/hf-preflight.d.ts.map +1 -0
- package/dist/model-loader/hf-preflight.js +179 -0
- package/dist/model-loader/hf-preflight.js.map +1 -0
- package/dist/model-loader/index.d.ts +27 -0
- package/dist/model-loader/index.d.ts.map +1 -0
- package/dist/model-loader/index.js +21 -0
- package/dist/model-loader/index.js.map +1 -0
- package/dist/model-loader/registry.d.ts +24 -0
- package/dist/model-loader/registry.d.ts.map +1 -0
- package/dist/model-loader/registry.js +105 -0
- package/dist/model-loader/registry.js.map +1 -0
- package/dist/model-loader/types.d.ts +101 -0
- package/dist/model-loader/types.d.ts.map +1 -0
- package/dist/model-loader/types.js +13 -0
- package/dist/model-loader/types.js.map +1 -0
- package/dist/model-loader/verify.d.ts +83 -0
- package/dist/model-loader/verify.d.ts.map +1 -0
- package/dist/model-loader/verify.js +138 -0
- package/dist/model-loader/verify.js.map +1 -0
- package/dist/model-qualification.d.ts +79 -0
- package/dist/model-qualification.d.ts.map +1 -0
- package/dist/model-qualification.js +135 -0
- package/dist/model-qualification.js.map +1 -0
- package/dist/near-relayer.d.ts +30 -0
- package/dist/near-relayer.d.ts.map +1 -0
- package/dist/near-relayer.js +81 -0
- package/dist/near-relayer.js.map +1 -0
- package/dist/paid-storage/bytes.d.ts +21 -0
- package/dist/paid-storage/bytes.d.ts.map +1 -0
- package/dist/paid-storage/bytes.js +71 -0
- package/dist/paid-storage/bytes.js.map +1 -0
- package/dist/paid-storage/chain.d.ts +20 -0
- package/dist/paid-storage/chain.d.ts.map +1 -0
- package/dist/paid-storage/chain.js +182 -0
- package/dist/paid-storage/chain.js.map +1 -0
- package/dist/paid-storage/client.d.ts +161 -0
- package/dist/paid-storage/client.d.ts.map +1 -0
- package/dist/paid-storage/client.js +1038 -0
- package/dist/paid-storage/client.js.map +1 -0
- package/dist/paid-storage/cloudflare.d.ts +4 -0
- package/dist/paid-storage/cloudflare.d.ts.map +1 -0
- package/dist/paid-storage/cloudflare.js +9 -0
- package/dist/paid-storage/cloudflare.js.map +1 -0
- package/dist/paid-storage/codec.d.ts +8 -0
- package/dist/paid-storage/codec.d.ts.map +1 -0
- package/dist/paid-storage/codec.js +92 -0
- package/dist/paid-storage/codec.js.map +1 -0
- package/dist/paid-storage/crypto.d.ts +27 -0
- package/dist/paid-storage/crypto.d.ts.map +1 -0
- package/dist/paid-storage/crypto.js +91 -0
- package/dist/paid-storage/crypto.js.map +1 -0
- package/dist/paid-storage/heads.d.ts +26 -0
- package/dist/paid-storage/heads.d.ts.map +1 -0
- package/dist/paid-storage/heads.js +208 -0
- package/dist/paid-storage/heads.js.map +1 -0
- package/dist/paid-storage/index.d.ts +14 -0
- package/dist/paid-storage/index.d.ts.map +1 -0
- package/dist/paid-storage/index.js +7 -0
- package/dist/paid-storage/index.js.map +1 -0
- package/dist/paid-storage/memory-wire.d.ts +85 -0
- package/dist/paid-storage/memory-wire.d.ts.map +1 -0
- package/dist/paid-storage/memory-wire.js +147 -0
- package/dist/paid-storage/memory-wire.js.map +1 -0
- package/dist/paid-storage/node-store.d.ts +9 -0
- package/dist/paid-storage/node-store.d.ts.map +1 -0
- package/dist/paid-storage/node-store.js +34 -0
- package/dist/paid-storage/node-store.js.map +1 -0
- package/dist/paid-storage/profile.d.ts +21 -0
- package/dist/paid-storage/profile.d.ts.map +1 -0
- package/dist/paid-storage/profile.js +22 -0
- package/dist/paid-storage/profile.js.map +1 -0
- package/dist/paid-storage/store.d.ts +18 -0
- package/dist/paid-storage/store.d.ts.map +1 -0
- package/dist/paid-storage/store.js +32 -0
- package/dist/paid-storage/store.js.map +1 -0
- package/dist/paid-storage/transport.d.ts +70 -0
- package/dist/paid-storage/transport.d.ts.map +1 -0
- package/dist/paid-storage/transport.js +140 -0
- package/dist/paid-storage/transport.js.map +1 -0
- package/dist/paid-storage/vouchers.d.ts +75 -0
- package/dist/paid-storage/vouchers.d.ts.map +1 -0
- package/dist/paid-storage/vouchers.js +239 -0
- package/dist/paid-storage/vouchers.js.map +1 -0
- package/dist/paid-storage-wire.d.ts +11 -0
- package/dist/paid-storage-wire.d.ts.map +1 -0
- package/dist/paid-storage-wire.js +184 -0
- package/dist/paid-storage-wire.js.map +1 -0
- package/dist/point-claims.d.ts +40 -0
- package/dist/point-claims.d.ts.map +1 -0
- package/dist/point-claims.js +98 -0
- package/dist/point-claims.js.map +1 -0
- package/dist/quickstart.d.ts +307 -0
- package/dist/quickstart.d.ts.map +1 -0
- package/dist/quickstart.js +536 -0
- package/dist/quickstart.js.map +1 -0
- package/dist/react/context.d.ts +10 -0
- package/dist/react/context.d.ts.map +1 -0
- package/dist/react/context.js +16 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/hooks.d.ts +206 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +560 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +4 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/provider.d.ts +18 -0
- package/dist/react/provider.d.ts.map +1 -0
- package/dist/react/provider.js +17 -0
- package/dist/react/provider.js.map +1 -0
- package/dist/relayer.d.ts +122 -0
- package/dist/relayer.d.ts.map +1 -0
- package/dist/relayer.js +203 -0
- package/dist/relayer.js.map +1 -0
- package/dist/runtime-compatibility.d.ts +8 -0
- package/dist/runtime-compatibility.d.ts.map +1 -0
- package/dist/runtime-compatibility.js +20 -0
- package/dist/runtime-compatibility.js.map +1 -0
- package/dist/session-manager.d.ts +197 -0
- package/dist/session-manager.d.ts.map +1 -0
- package/dist/session-manager.js +429 -0
- package/dist/session-manager.js.map +1 -0
- package/dist/solana-ptlc.d.ts +64 -0
- package/dist/solana-ptlc.d.ts.map +1 -0
- package/dist/solana-ptlc.js +137 -0
- package/dist/solana-ptlc.js.map +1 -0
- package/dist/staking-client.d.ts +103 -0
- package/dist/staking-client.d.ts.map +1 -0
- package/dist/staking-client.js +308 -0
- package/dist/staking-client.js.map +1 -0
- package/dist/staking-types.d.ts +203 -0
- package/dist/staking-types.d.ts.map +1 -0
- package/dist/staking-types.js +16 -0
- package/dist/staking-types.js.map +1 -0
- package/dist/submit-tx.d.ts +14 -0
- package/dist/submit-tx.d.ts.map +1 -0
- package/dist/submit-tx.js +33 -0
- package/dist/submit-tx.js.map +1 -0
- package/dist/templates/index.d.ts +52 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +123 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/ton/index.d.ts +52 -0
- package/dist/ton/index.d.ts.map +1 -0
- package/dist/ton/index.js +163 -0
- package/dist/ton/index.js.map +1 -0
- package/dist/ton-relayer.d.ts +26 -0
- package/dist/ton-relayer.d.ts.map +1 -0
- package/dist/ton-relayer.js +22 -0
- package/dist/ton-relayer.js.map +1 -0
- package/dist/tracing.d.ts +48 -0
- package/dist/tracing.d.ts.map +1 -0
- package/dist/tracing.js +108 -0
- package/dist/tracing.js.map +1 -0
- package/dist/transaction-signer.d.ts +13 -0
- package/dist/transaction-signer.d.ts.map +1 -0
- package/dist/transaction-signer.js +13 -0
- package/dist/transaction-signer.js.map +1 -0
- package/dist/trust-root.d.ts +56 -0
- package/dist/trust-root.d.ts.map +1 -0
- package/dist/trust-root.js +28 -0
- package/dist/trust-root.js.map +1 -0
- package/dist/types.d.ts +201 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/validator-staking-client.d.ts +87 -0
- package/dist/validator-staking-client.d.ts.map +1 -0
- package/dist/validator-staking-client.js +226 -0
- package/dist/validator-staking-client.js.map +1 -0
- package/dist/virtuals-acp.d.ts +149 -0
- package/dist/virtuals-acp.d.ts.map +1 -0
- package/dist/virtuals-acp.js +418 -0
- package/dist/virtuals-acp.js.map +1 -0
- package/dist/wallet-manager.d.ts +199 -0
- package/dist/wallet-manager.d.ts.map +1 -0
- package/dist/wallet-manager.js +425 -0
- package/dist/wallet-manager.js.map +1 -0
- package/dist/wallets/burner.d.ts +45 -0
- package/dist/wallets/burner.d.ts.map +1 -0
- package/dist/wallets/burner.js +58 -0
- package/dist/wallets/burner.js.map +1 -0
- package/dist/wallets/index.d.ts +26 -0
- package/dist/wallets/index.d.ts.map +1 -0
- package/dist/wallets/index.js +20 -0
- package/dist/wallets/index.js.map +1 -0
- package/dist/wallets/injected.d.ts +22 -0
- package/dist/wallets/injected.d.ts.map +1 -0
- package/dist/wallets/injected.js +45 -0
- package/dist/wallets/injected.js.map +1 -0
- package/dist/wallets/ledger.d.ts +76 -0
- package/dist/wallets/ledger.d.ts.map +1 -0
- package/dist/wallets/ledger.js +106 -0
- package/dist/wallets/ledger.js.map +1 -0
- package/dist/wallets/near.d.ts +69 -0
- package/dist/wallets/near.d.ts.map +1 -0
- package/dist/wallets/near.js +101 -0
- package/dist/wallets/near.js.map +1 -0
- package/dist/wallets/types.d.ts +42 -0
- package/dist/wallets/types.d.ts.map +1 -0
- package/dist/wallets/types.js +31 -0
- package/dist/wallets/types.js.map +1 -0
- package/dist/wallets/walletconnect.d.ts +38 -0
- package/dist/wallets/walletconnect.d.ts.map +1 -0
- package/dist/wallets/walletconnect.js +94 -0
- package/dist/wallets/walletconnect.js.map +1 -0
- package/dist/weak-subjectivity.d.ts +213 -0
- package/dist/weak-subjectivity.d.ts.map +1 -0
- package/dist/weak-subjectivity.js +389 -0
- package/dist/weak-subjectivity.js.map +1 -0
- package/dist/x402-types/channel-types.d.ts +78 -0
- package/dist/x402-types/channel-types.d.ts.map +1 -0
- package/dist/x402-types/channel-types.js +5 -0
- package/dist/x402-types/channel-types.js.map +1 -0
- package/dist/x402-types/exact-flop.d.ts +29 -0
- package/dist/x402-types/exact-flop.d.ts.map +1 -0
- package/dist/x402-types/exact-flop.js +64 -0
- package/dist/x402-types/exact-flop.js.map +1 -0
- package/dist/x402-types/index.d.ts +65 -0
- package/dist/x402-types/index.d.ts.map +1 -0
- package/dist/x402-types/index.js +26 -0
- package/dist/x402-types/index.js.map +1 -0
- package/dist/x402.d.ts +111 -0
- package/dist/x402.d.ts.map +1 -0
- package/dist/x402.js +206 -0
- package/dist/x402.js.map +1 -0
- package/package.json +165 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport-http.d.ts","sourceRoot":"","sources":["../../src/compute-channel/transport-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAoD,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE5G,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAEL,qBAAqB,EAErB,KAAK,IAAI,EACT,KA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/**
|
|
2
|
+
* @file HTTP transport: agent ⇆ miner session wire (devnet).
|
|
3
|
+
* @module sdk/typescript/compute-channel/transport-http
|
|
4
|
+
*
|
|
5
|
+
* The {@link SessionTransport} the agent injects to stream turns directly to a
|
|
6
|
+
* live miner over plain HTTP, plus the tiny handshake the agent runs first to
|
|
7
|
+
* learn the miner's enclave key + on-chain address (so it can commit them at
|
|
8
|
+
* `open_channel`). Receipts are still verified end-to-end by the agent — this
|
|
9
|
+
* layer only moves bytes. Production hardens this to RA-TLS; the receipt crypto
|
|
10
|
+
* is identical either way.
|
|
11
|
+
*/
|
|
12
|
+
import { decodeChatRenderContext, encodeChatRenderContext } from "./chat-render.js";
|
|
13
|
+
import { hexToU8a, u8aToHex } from "@polkadot/util";
|
|
14
|
+
import { RetentionClass } from "./da.js";
|
|
15
|
+
import { FenceBreachError } from "./miner-host.js";
|
|
16
|
+
import { u8aEq } from "./protocol.js";
|
|
17
|
+
import { blake2_256, TranscriptLeafVersion, turnEvidenceHash, } from "./transcript.js";
|
|
18
|
+
/** Reserved signed-output prefix; each frame is kind:u8, length:u32be, payload. */
|
|
19
|
+
const SIGNED_FRAMES_FAMILY = new TextEncoder().encode("FLOP-TURN-FRAMES-");
|
|
20
|
+
const SIGNED_FRAMES_V1 = new TextEncoder().encode("FLOP-TURN-FRAMES-V1\0");
|
|
21
|
+
const SIGNED_FRAMES_V2 = new TextEncoder().encode("FLOP-TURN-FRAMES-V2\0");
|
|
22
|
+
function startsWithBytes(output, prefix) {
|
|
23
|
+
return output.length >= prefix.length && prefix.every((byte, index) => output[index] === byte);
|
|
24
|
+
}
|
|
25
|
+
export function hasReservedTurnOutputPrefix(output) {
|
|
26
|
+
return startsWithBytes(output, SIGNED_FRAMES_FAMILY);
|
|
27
|
+
}
|
|
28
|
+
export function isFramedTurnOutput(output) {
|
|
29
|
+
return startsWithBytes(output, SIGNED_FRAMES_V1) || startsWithBytes(output, SIGNED_FRAMES_V2);
|
|
30
|
+
}
|
|
31
|
+
export function encodeSignedTurnOutputFrames(frames, context) {
|
|
32
|
+
if (frames.length === 0)
|
|
33
|
+
throw new Error("signed output frame sequence is empty");
|
|
34
|
+
const canonical = context ? encodeChatRenderContext(context) : undefined;
|
|
35
|
+
const prefix = canonical ? SIGNED_FRAMES_V2 : SIGNED_FRAMES_V1;
|
|
36
|
+
const headerLength = prefix.length + (canonical ? 4 + canonical.length : 0);
|
|
37
|
+
const length = frames.reduce((sum, frame) => {
|
|
38
|
+
if (frame.data.length > 0xffff_ffff)
|
|
39
|
+
throw new Error("signed output frame is too large");
|
|
40
|
+
return sum + 5 + frame.data.length;
|
|
41
|
+
}, headerLength);
|
|
42
|
+
const output = new Uint8Array(length);
|
|
43
|
+
output.set(prefix);
|
|
44
|
+
let offset = prefix.length;
|
|
45
|
+
if (canonical) {
|
|
46
|
+
new DataView(output.buffer).setUint32(offset, canonical.length, false);
|
|
47
|
+
offset += 4;
|
|
48
|
+
output.set(canonical, offset);
|
|
49
|
+
offset += canonical.length;
|
|
50
|
+
}
|
|
51
|
+
for (const frame of frames) {
|
|
52
|
+
if (frame.kind !== "output" && frame.kind !== "tool_call")
|
|
53
|
+
throw new Error("unknown signed output frame kind");
|
|
54
|
+
output[offset] = frame.kind === "output" ? 0 : 1;
|
|
55
|
+
new DataView(output.buffer).setUint32(offset + 1, frame.data.length, false);
|
|
56
|
+
offset += 5;
|
|
57
|
+
output.set(frame.data, offset);
|
|
58
|
+
offset += frame.data.length;
|
|
59
|
+
}
|
|
60
|
+
return output;
|
|
61
|
+
}
|
|
62
|
+
function renderHeader(output) {
|
|
63
|
+
if (startsWithBytes(output, SIGNED_FRAMES_V1))
|
|
64
|
+
return { offset: SIGNED_FRAMES_V1.length };
|
|
65
|
+
if (!startsWithBytes(output, SIGNED_FRAMES_V2)) {
|
|
66
|
+
if (hasReservedTurnOutputPrefix(output))
|
|
67
|
+
throw new Error("unsupported signed output frame version");
|
|
68
|
+
return { offset: 0 };
|
|
69
|
+
}
|
|
70
|
+
let offset = SIGNED_FRAMES_V2.length;
|
|
71
|
+
if (output.length - offset < 4)
|
|
72
|
+
throw new Error("truncated chat render context header");
|
|
73
|
+
const length = new DataView(output.buffer, output.byteOffset).getUint32(offset, false);
|
|
74
|
+
offset += 4;
|
|
75
|
+
if (length > output.length - offset)
|
|
76
|
+
throw new Error("truncated chat render context");
|
|
77
|
+
const context = decodeChatRenderContext(output.slice(offset, offset + length));
|
|
78
|
+
return { context, offset: offset + length };
|
|
79
|
+
}
|
|
80
|
+
export function decodeTurnRenderContext(output) {
|
|
81
|
+
return renderHeader(output).context;
|
|
82
|
+
}
|
|
83
|
+
export function decodeSignedTurnOutputFrames(output) {
|
|
84
|
+
if (!isFramedTurnOutput(output))
|
|
85
|
+
throw new Error("unsupported signed output frame version");
|
|
86
|
+
const frames = [];
|
|
87
|
+
let offset = renderHeader(output).offset;
|
|
88
|
+
while (offset < output.length) {
|
|
89
|
+
if (output.length - offset < 5)
|
|
90
|
+
throw new Error("truncated signed output frame header");
|
|
91
|
+
const kind = output[offset] === 0 ? "output" : output[offset] === 1 ? "tool_call" : undefined;
|
|
92
|
+
if (!kind)
|
|
93
|
+
throw new Error("unknown signed output frame kind");
|
|
94
|
+
const length = new DataView(output.buffer, output.byteOffset).getUint32(offset + 1, false);
|
|
95
|
+
offset += 5;
|
|
96
|
+
if (length > output.length - offset)
|
|
97
|
+
throw new Error("truncated signed output frame data");
|
|
98
|
+
frames.push({ kind, data: output.slice(offset, offset + length) });
|
|
99
|
+
offset += length;
|
|
100
|
+
}
|
|
101
|
+
if (frames.length === 0)
|
|
102
|
+
throw new Error("signed output frame sequence is empty");
|
|
103
|
+
return frames;
|
|
104
|
+
}
|
|
105
|
+
/** Unwrap text-only signed frames for callers of the byte-oriented `turn()` API. */
|
|
106
|
+
export function decodeTextTurnOutput(output) {
|
|
107
|
+
if (!isFramedTurnOutput(output)) {
|
|
108
|
+
if (hasReservedTurnOutputPrefix(output))
|
|
109
|
+
throw new Error("unsupported signed output frame version");
|
|
110
|
+
return output;
|
|
111
|
+
}
|
|
112
|
+
const frames = decodeSignedTurnOutputFrames(output);
|
|
113
|
+
if (frames.some((frame) => frame.kind !== "output"))
|
|
114
|
+
throw new Error("text turn contains tool frames");
|
|
115
|
+
const text = new Uint8Array(frames.reduce((size, frame) => size + frame.data.length, 0));
|
|
116
|
+
let offset = 0;
|
|
117
|
+
for (const frame of frames) {
|
|
118
|
+
text.set(frame.data, offset);
|
|
119
|
+
offset += frame.data.length;
|
|
120
|
+
}
|
|
121
|
+
return text;
|
|
122
|
+
}
|
|
123
|
+
/** Rebuild exactly the bytes committed by hOut; never downgrade a tool turn to raw output. */
|
|
124
|
+
export function reconstructSignedTurnOutput(frames, receipt) {
|
|
125
|
+
if (frames.some((frame) => frame.kind !== "output" && frame.kind !== "tool_call")) {
|
|
126
|
+
throw new Error("unknown signed output frame kind");
|
|
127
|
+
}
|
|
128
|
+
const framed = isFramedTurnOutput(receipt.output);
|
|
129
|
+
if (!framed && hasReservedTurnOutputPrefix(receipt.output)) {
|
|
130
|
+
throw new Error("unsupported signed output frame version");
|
|
131
|
+
}
|
|
132
|
+
if (!framed && (frames.some((frame) => frame.kind === "tool_call") || receipt.finishReason === "tool_calls")) {
|
|
133
|
+
throw new Error("tool turn lacks signed frame encoding");
|
|
134
|
+
}
|
|
135
|
+
if (framed && receipt.finishReason === "tool_calls" && !frames.some((frame) => frame.kind === "tool_call")) {
|
|
136
|
+
throw new Error("tool turn lacks signed tool frames");
|
|
137
|
+
}
|
|
138
|
+
const context = decodeTurnRenderContext(receipt.output);
|
|
139
|
+
if (context && context.finishReason !== receipt.finishReason)
|
|
140
|
+
throw new Error("chat render finish reason mismatch");
|
|
141
|
+
const output = framed
|
|
142
|
+
? encodeSignedTurnOutputFrames(frames, context)
|
|
143
|
+
: new Uint8Array(frames.reduce((size, frame) => size + frame.data.length, 0));
|
|
144
|
+
if (!framed) {
|
|
145
|
+
let offset = 0;
|
|
146
|
+
for (const frame of frames) {
|
|
147
|
+
output.set(frame.data, offset);
|
|
148
|
+
offset += frame.data.length;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (!u8aEq(output, receipt.output))
|
|
152
|
+
throw new Error("chunk reconstruction does not match terminal output");
|
|
153
|
+
return output;
|
|
154
|
+
}
|
|
155
|
+
function encodeIdentity(identity) {
|
|
156
|
+
return {
|
|
157
|
+
...identity,
|
|
158
|
+
modelHash: u8aToHex(identity.modelHash),
|
|
159
|
+
decodePolicyHash: u8aToHex(identity.decodePolicyHash),
|
|
160
|
+
measuredRoot: u8aToHex(identity.measuredRoot),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function decodeIdentity(identity) {
|
|
164
|
+
return {
|
|
165
|
+
...identity,
|
|
166
|
+
modelHash: hexToU8a(identity.modelHash),
|
|
167
|
+
decodePolicyHash: hexToU8a(identity.decodePolicyHash),
|
|
168
|
+
measuredRoot: hexToU8a(identity.measuredRoot),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export function encodeTurnReceipt(r) {
|
|
172
|
+
const wire = {
|
|
173
|
+
leafVersion: r.leafVersion,
|
|
174
|
+
turnIndex: r.turnIndex,
|
|
175
|
+
hIn: u8aToHex(r.hIn),
|
|
176
|
+
hOut: u8aToHex(r.hOut),
|
|
177
|
+
output: u8aToHex(r.output),
|
|
178
|
+
gN: r.gN.toString(),
|
|
179
|
+
minerRecvMs: r.minerRecvMs.toString(),
|
|
180
|
+
minerDoneMs: r.minerDoneMs.toString(),
|
|
181
|
+
latencyMs: r.latencyMs.toString(),
|
|
182
|
+
enclaveSig: u8aToHex(r.enclaveSig),
|
|
183
|
+
runningRoot: u8aToHex(r.runningRoot),
|
|
184
|
+
};
|
|
185
|
+
if (r.decodePolicyHash)
|
|
186
|
+
wire.decodePolicyHash = u8aToHex(r.decodePolicyHash);
|
|
187
|
+
if (r.promptTokens !== undefined)
|
|
188
|
+
wire.promptTokens = r.promptTokens.toString();
|
|
189
|
+
if (r.completionTokens !== undefined)
|
|
190
|
+
wire.completionTokens = r.completionTokens.toString();
|
|
191
|
+
if (r.finishReason !== undefined)
|
|
192
|
+
wire.finishReason = r.finishReason;
|
|
193
|
+
if (r.modelIdentity !== undefined)
|
|
194
|
+
wire.modelIdentity = encodeIdentity(r.modelIdentity);
|
|
195
|
+
if (r.hIds)
|
|
196
|
+
wire.hIds = u8aToHex(r.hIds);
|
|
197
|
+
if (r.toplocCommitmentHash)
|
|
198
|
+
wire.toplocCommitmentHash = u8aToHex(r.toplocCommitmentHash);
|
|
199
|
+
return wire;
|
|
200
|
+
}
|
|
201
|
+
export function decodeTurnReceipt(w) {
|
|
202
|
+
if (!Object.values(TranscriptLeafVersion).includes(w.leafVersion)) {
|
|
203
|
+
throw new Error(`unsupported transcript leaf version: ${String(w.leafVersion)}`);
|
|
204
|
+
}
|
|
205
|
+
const receipt = {
|
|
206
|
+
leafVersion: w.leafVersion,
|
|
207
|
+
turnIndex: w.turnIndex,
|
|
208
|
+
hIn: hexToU8a(w.hIn),
|
|
209
|
+
hOut: hexToU8a(w.hOut),
|
|
210
|
+
output: hexToU8a(w.output),
|
|
211
|
+
gN: BigInt(w.gN),
|
|
212
|
+
minerRecvMs: BigInt(w.minerRecvMs),
|
|
213
|
+
minerDoneMs: BigInt(w.minerDoneMs),
|
|
214
|
+
latencyMs: BigInt(w.latencyMs),
|
|
215
|
+
enclaveSig: hexToU8a(w.enclaveSig),
|
|
216
|
+
runningRoot: hexToU8a(w.runningRoot),
|
|
217
|
+
};
|
|
218
|
+
if (w.decodePolicyHash)
|
|
219
|
+
receipt.decodePolicyHash = hexToU8a(w.decodePolicyHash);
|
|
220
|
+
if (w.promptTokens !== undefined)
|
|
221
|
+
receipt.promptTokens = BigInt(w.promptTokens);
|
|
222
|
+
if (w.completionTokens !== undefined)
|
|
223
|
+
receipt.completionTokens = BigInt(w.completionTokens);
|
|
224
|
+
if (w.finishReason !== undefined)
|
|
225
|
+
receipt.finishReason = w.finishReason;
|
|
226
|
+
if (w.modelIdentity !== undefined)
|
|
227
|
+
receipt.modelIdentity = decodeIdentity(w.modelIdentity);
|
|
228
|
+
if (w.hIds)
|
|
229
|
+
receipt.hIds = hexToU8a(w.hIds);
|
|
230
|
+
if (w.toplocCommitmentHash)
|
|
231
|
+
receipt.toplocCommitmentHash = hexToU8a(w.toplocCommitmentHash);
|
|
232
|
+
return receipt;
|
|
233
|
+
}
|
|
234
|
+
/** Frame a committed turn. Non-streaming callers collect these same frames. */
|
|
235
|
+
export function encodeTurnFrames(receipt, chunkBytes = 16 * 1024, kind = "output") {
|
|
236
|
+
if (!Number.isInteger(chunkBytes) || chunkBytes < 1)
|
|
237
|
+
throw new RangeError("chunkBytes must be positive");
|
|
238
|
+
if (kind !== "output")
|
|
239
|
+
throw new Error("legacy tool frames require signed frame encoding");
|
|
240
|
+
const frames = [];
|
|
241
|
+
if (isFramedTurnOutput(receipt.output)) {
|
|
242
|
+
for (const frame of decodeSignedTurnOutputFrames(receipt.output)) {
|
|
243
|
+
frames.push({ type: "chunk", sequence: frames.length, kind: frame.kind, data: u8aToHex(frame.data) });
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
if (hasReservedTurnOutputPrefix(receipt.output))
|
|
248
|
+
throw new Error("unsupported signed output frame version");
|
|
249
|
+
if (receipt.finishReason === "tool_calls")
|
|
250
|
+
throw new Error("tool turn lacks signed frame encoding");
|
|
251
|
+
for (let offset = 0; offset < receipt.output.length; offset += chunkBytes) {
|
|
252
|
+
frames.push({
|
|
253
|
+
type: "chunk",
|
|
254
|
+
sequence: frames.length,
|
|
255
|
+
kind,
|
|
256
|
+
data: u8aToHex(receipt.output.slice(offset, offset + chunkBytes)),
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
frames.push({ type: "terminal", sequence: frames.length, receipt: encodeTurnReceipt(receipt) });
|
|
261
|
+
return frames;
|
|
262
|
+
}
|
|
263
|
+
/** Strict stream collector: no duplicate/missing/reordered/post-terminal frames. */
|
|
264
|
+
export function collectTurnFrames(frames, expectedRunningRoot) {
|
|
265
|
+
const parts = [];
|
|
266
|
+
let terminal;
|
|
267
|
+
for (let i = 0; i < frames.length; i++) {
|
|
268
|
+
const frame = frames[i];
|
|
269
|
+
if (terminal)
|
|
270
|
+
throw new Error("post-terminal frame");
|
|
271
|
+
if (!Number.isInteger(frame.sequence) || frame.sequence !== i) {
|
|
272
|
+
throw new Error(`chunk sequence mismatch: expected ${i}, got ${frame.sequence}`);
|
|
273
|
+
}
|
|
274
|
+
if (frame.type === "chunk")
|
|
275
|
+
parts.push({ kind: frame.kind, data: hexToU8a(frame.data) });
|
|
276
|
+
else
|
|
277
|
+
terminal = decodeTurnReceipt(frame.receipt);
|
|
278
|
+
}
|
|
279
|
+
if (!terminal)
|
|
280
|
+
throw new Error("missing terminal receipt");
|
|
281
|
+
const output = reconstructSignedTurnOutput(parts, terminal);
|
|
282
|
+
const providerFields = [terminal.promptTokens, terminal.completionTokens, terminal.finishReason, terminal.modelIdentity];
|
|
283
|
+
const providerGrade = providerFields.every((field) => field !== undefined);
|
|
284
|
+
if (!providerGrade && providerFields.some((field) => field !== undefined))
|
|
285
|
+
throw new Error("partial provider evidence");
|
|
286
|
+
const hOut = providerGrade
|
|
287
|
+
? turnEvidenceHash(output, terminal.promptTokens, terminal.completionTokens, terminal.finishReason, terminal.modelIdentity)
|
|
288
|
+
: blake2_256(output);
|
|
289
|
+
if (!u8aEq(hOut, terminal.hOut))
|
|
290
|
+
throw new Error("terminal evidence hash mismatch");
|
|
291
|
+
if (expectedRunningRoot && !u8aEq(expectedRunningRoot, terminal.runningRoot))
|
|
292
|
+
throw new Error("terminal running root mismatch");
|
|
293
|
+
return terminal;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Default per-turn liveness deadline (ENG-4 client `T_idle`). 60s comfortably
|
|
297
|
+
* clears the p99 of a real prefill+decode turn on a busy miner while still
|
|
298
|
+
* bounding a fully-stalled/dead miner: without it `serveTurn`'s bare `fetch`
|
|
299
|
+
* never settles, so a hung miner wedges the agent's turn loop indefinitely
|
|
300
|
+
* (session-migration-semantics.md L135). `0`/`undefined` disables the deadline.
|
|
301
|
+
*/
|
|
302
|
+
export const DEFAULT_TURN_TIMEOUT_MS = 60_000;
|
|
303
|
+
/**
|
|
304
|
+
* A per-turn network call exceeded the transport's `turnTimeoutMs` deadline
|
|
305
|
+
* (miner stalled / unreachable). Distinct from {@link FenceBreachError} and the
|
|
306
|
+
* agent's receipt-verification errors so a caller can branch on liveness:
|
|
307
|
+
* retry the turn vs abort → `session.close()` (force_settle the verified prefix).
|
|
308
|
+
*/
|
|
309
|
+
export class TurnTimeoutError extends Error {
|
|
310
|
+
turnIndex;
|
|
311
|
+
elapsedMs;
|
|
312
|
+
kind = "TurnTimeout";
|
|
313
|
+
constructor(
|
|
314
|
+
/** Turn being served/acked/checkpointed when the deadline fired. */
|
|
315
|
+
turnIndex,
|
|
316
|
+
/** Wall-clock ms elapsed before the abort. */
|
|
317
|
+
elapsedMs, message) {
|
|
318
|
+
super(message ?? `turn ${turnIndex} timed out after ${elapsedMs}ms`);
|
|
319
|
+
this.turnIndex = turnIndex;
|
|
320
|
+
this.elapsedMs = elapsedMs;
|
|
321
|
+
this.name = "TurnTimeoutError";
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Race `run` against an AbortController deadline. On expiry the fetch is aborted
|
|
326
|
+
* and a {@link TurnTimeoutError} (carrying `turnIndex` + elapsed) is thrown;
|
|
327
|
+
* `timeoutMs <= 0` disables the deadline (bare fetch, legacy behavior).
|
|
328
|
+
*/
|
|
329
|
+
async function withTurnTimeout(turnIndex, timeoutMs, run, externalSignal) {
|
|
330
|
+
if ((!timeoutMs || timeoutMs <= 0) && !externalSignal)
|
|
331
|
+
return run(undefined);
|
|
332
|
+
const ctrl = new AbortController();
|
|
333
|
+
const started = Date.now();
|
|
334
|
+
let timedOut = false;
|
|
335
|
+
const abortExternal = () => ctrl.abort(externalSignal?.reason);
|
|
336
|
+
if (externalSignal?.aborted)
|
|
337
|
+
abortExternal();
|
|
338
|
+
else
|
|
339
|
+
externalSignal?.addEventListener("abort", abortExternal, { once: true });
|
|
340
|
+
const timer = timeoutMs > 0
|
|
341
|
+
? setTimeout(() => { timedOut = true; ctrl.abort(); }, timeoutMs)
|
|
342
|
+
: undefined;
|
|
343
|
+
try {
|
|
344
|
+
return await run(ctrl.signal);
|
|
345
|
+
}
|
|
346
|
+
catch (e) {
|
|
347
|
+
if (timedOut)
|
|
348
|
+
throw new TurnTimeoutError(turnIndex, Date.now() - started);
|
|
349
|
+
throw e;
|
|
350
|
+
}
|
|
351
|
+
finally {
|
|
352
|
+
if (timer)
|
|
353
|
+
clearTimeout(timer);
|
|
354
|
+
externalSignal?.removeEventListener("abort", abortExternal);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
async function postJson(url, body, signal, headers = {}, requestHeaders) {
|
|
358
|
+
const encoded = JSON.stringify(body);
|
|
359
|
+
const res = await fetch(url, {
|
|
360
|
+
method: "POST",
|
|
361
|
+
headers: { "Content-Type": "application/json", ...headers, ...requestHeaders?.("POST", new URL(url).pathname, encoded) },
|
|
362
|
+
body: encoded,
|
|
363
|
+
signal,
|
|
364
|
+
});
|
|
365
|
+
if (!res.ok)
|
|
366
|
+
throw new Error(`${url} → ${res.status} ${await res.text()}`);
|
|
367
|
+
return res.json();
|
|
368
|
+
}
|
|
369
|
+
/** Agent → miner handshake: fetch the enclave key + address before open. */
|
|
370
|
+
export async function fetchMinerSessionInfo(baseUrl, headers = {}, signal) {
|
|
371
|
+
const res = await fetch(`${baseUrl.replace(/\/$/, "")}/session/info`, { headers, signal });
|
|
372
|
+
if (!res.ok)
|
|
373
|
+
throw new Error(`miner /session/info → ${res.status}`);
|
|
374
|
+
const j = await res.json();
|
|
375
|
+
// Fail-closed: missing maxUnackedGn ⇒ single-turn credit (0), never unlimited.
|
|
376
|
+
const maxUnackedGn = j.maxUnackedGn === undefined || j.maxUnackedGn === null || j.maxUnackedGn === ""
|
|
377
|
+
? 0n
|
|
378
|
+
: BigInt(j.maxUnackedGn);
|
|
379
|
+
const calibration = j.calibration
|
|
380
|
+
? {
|
|
381
|
+
ready: j.calibration.ready === true,
|
|
382
|
+
state: String(j.calibration.state ?? "missing"),
|
|
383
|
+
currentBlock: BigInt(j.calibration.currentBlock ?? 0),
|
|
384
|
+
...(j.calibration.expiresAt == null ? {} : { expiresAt: BigInt(j.calibration.expiresAt) }),
|
|
385
|
+
...(j.calibration.capGflopsPerSec == null
|
|
386
|
+
? {}
|
|
387
|
+
: { capGflopsPerSec: BigInt(j.calibration.capGflopsPerSec) }),
|
|
388
|
+
}
|
|
389
|
+
: undefined;
|
|
390
|
+
return {
|
|
391
|
+
image: j.image,
|
|
392
|
+
minerAddress: j.minerAddress,
|
|
393
|
+
enclaveKey: hexToU8a(j.enclaveKey),
|
|
394
|
+
model: j.model,
|
|
395
|
+
modelHash: hexToU8a(j.modelHash),
|
|
396
|
+
measuredRoot: hexToU8a(j.modelIdentity?.measuredRoot ?? j.modelHash),
|
|
397
|
+
decodePolicyHash: hexToU8a(j.modelIdentity?.decodePolicyHash ?? `0x${"00".repeat(32)}`),
|
|
398
|
+
precision: Number(j.modelIdentity?.precision ?? 0),
|
|
399
|
+
modelIdentity: j.modelIdentity ? decodeIdentity(j.modelIdentity) : undefined,
|
|
400
|
+
isReady: j.is_ready !== false,
|
|
401
|
+
maxUnackedGn,
|
|
402
|
+
calibration,
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
/** Tell the miner to spin up a host bound to the freshly-opened channel. */
|
|
406
|
+
export async function notifyMinerOpen(baseUrl, channelId, agentKey, headers = {},
|
|
407
|
+
/** Liveness bound: without it a stalled `/session/open` never settles. */
|
|
408
|
+
signal, requestHeaders) {
|
|
409
|
+
const body = {
|
|
410
|
+
channelId: u8aToHex(channelId),
|
|
411
|
+
agentKey: u8aToHex(agentKey),
|
|
412
|
+
};
|
|
413
|
+
await postJson(`${baseUrl.replace(/\/$/, "")}/session/open`, body, signal, headers, requestHeaders);
|
|
414
|
+
}
|
|
415
|
+
function cooperativeCloseBody(claim) {
|
|
416
|
+
return {
|
|
417
|
+
channelId: u8aToHex(claim.channelId),
|
|
418
|
+
finalRoot: u8aToHex(claim.finalRoot),
|
|
419
|
+
aggregateGn: claim.aggregateGn.toString(),
|
|
420
|
+
payable: claim.payable.toString(),
|
|
421
|
+
agentReceiptSig: u8aToHex(claim.agentReceiptSig),
|
|
422
|
+
claimedMeasuredRoot: u8aToHex(claim.claimedMeasuredRoot),
|
|
423
|
+
transcriptRef: claim.transcriptRef === null ? null : {
|
|
424
|
+
commitment: u8aToHex(claim.transcriptRef.commitment),
|
|
425
|
+
providerId: claim.transcriptRef.providerId,
|
|
426
|
+
retention: claim.transcriptRef.retention,
|
|
427
|
+
},
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
/** Prepare the exact final claim and its proof; this endpoint never pays out. */
|
|
431
|
+
export async function notifyMinerPrepareRetirement(baseUrl, claim, headers = {}, signal, requestHeaders) {
|
|
432
|
+
const body = cooperativeCloseBody(claim);
|
|
433
|
+
const response = await postJson(`${baseUrl.replace(/\/$/, "")}/session/prepare-retirement`, body, signal, headers, requestHeaders);
|
|
434
|
+
const prepared = response?.prepared;
|
|
435
|
+
const ref = prepared?.transcriptRef;
|
|
436
|
+
if (response?.ok !== true || response.settled != null
|
|
437
|
+
|| prepared?.channelId !== body.channelId || prepared.finalRoot !== body.finalRoot
|
|
438
|
+
|| prepared.aggregateGn !== body.aggregateGn || prepared.payable !== body.payable
|
|
439
|
+
|| prepared.claimedMeasuredRoot !== body.claimedMeasuredRoot
|
|
440
|
+
|| typeof ref?.commitment !== "string" || !/^0x[0-9a-f]{64}$/.test(ref.commitment)
|
|
441
|
+
|| ref.providerId !== 0 || ref.retention !== RetentionClass.Ephemeral
|
|
442
|
+
|| (body.transcriptRef !== null && (ref.commitment !== body.transcriptRef.commitment
|
|
443
|
+
|| ref.providerId !== body.transcriptRef.providerId || ref.retention !== body.transcriptRef.retention))) {
|
|
444
|
+
throw new Error("miner returned a mismatched prepared retirement");
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
channelId: claim.channelId.slice(), finalRoot: claim.finalRoot.slice(),
|
|
448
|
+
aggregateGn: claim.aggregateGn, payable: claim.payable,
|
|
449
|
+
claimedMeasuredRoot: claim.claimedMeasuredRoot.slice(),
|
|
450
|
+
transcriptRef: { commitment: hexToU8a(ref.commitment), providerId: ref.providerId, retention: ref.retention },
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* POST the co-signed cooperative claim to the miner. Returns the Settled
|
|
455
|
+
* payload when the miner submitted `settle`; `null` when the miner is in
|
|
456
|
+
* no-chain mode (agent falls back to unilateral force_settle).
|
|
457
|
+
*/
|
|
458
|
+
export async function notifyMinerClose(baseUrl, claim, headers = {},
|
|
459
|
+
/** Liveness bound: without it a stalled `/session/close` never settles. */
|
|
460
|
+
signal, requestHeaders) {
|
|
461
|
+
const body = cooperativeCloseBody(claim);
|
|
462
|
+
const j = await postJson(`${baseUrl.replace(/\/$/, "")}/session/close`, body, signal, headers, requestHeaders);
|
|
463
|
+
if (!j?.settled)
|
|
464
|
+
return null;
|
|
465
|
+
return j.settled;
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* {@link SessionTransport} over HTTP. `channelId` is unknown until the channel
|
|
469
|
+
* opens on-chain, so it's bound via {@link bind} before the first turn.
|
|
470
|
+
*/
|
|
471
|
+
export class HttpSessionTransport {
|
|
472
|
+
baseUrl;
|
|
473
|
+
options;
|
|
474
|
+
channelId = null;
|
|
475
|
+
/** Count of `serveTurn` invocations — the turnIndex a timeout is tagged with. */
|
|
476
|
+
servedTurns = 0;
|
|
477
|
+
turnTimeoutMs;
|
|
478
|
+
constructor(baseUrl,
|
|
479
|
+
/**
|
|
480
|
+
* Per-turn liveness deadline (ms). Default {@link DEFAULT_TURN_TIMEOUT_MS};
|
|
481
|
+
* `0` disables it. Applied to every per-turn network call (turn/ack/checkpoint).
|
|
482
|
+
*/
|
|
483
|
+
turnTimeoutMs = DEFAULT_TURN_TIMEOUT_MS, options = {}) {
|
|
484
|
+
this.baseUrl = baseUrl;
|
|
485
|
+
this.options = options;
|
|
486
|
+
this.turnTimeoutMs = turnTimeoutMs;
|
|
487
|
+
}
|
|
488
|
+
bind(channelId) {
|
|
489
|
+
this.channelId = channelId;
|
|
490
|
+
}
|
|
491
|
+
async serveTurn(input) {
|
|
492
|
+
if (!this.channelId)
|
|
493
|
+
throw new Error("HttpSessionTransport: channel not bound");
|
|
494
|
+
const base = this.baseUrl.replace(/\/$/, "");
|
|
495
|
+
const turnIndex = this.servedTurns;
|
|
496
|
+
// The body read stays inside the deadline: an NDJSON miner flushes headers with
|
|
497
|
+
// its first chunk, so `fetch` resolves early and a stall mid-stream would drain
|
|
498
|
+
// outside the timer, wedging the turn loop instead of raising TurnTimeoutError.
|
|
499
|
+
const { res, text, framesEmitted } = await withTurnTimeout(turnIndex, this.turnTimeoutMs, async (signal) => {
|
|
500
|
+
const body = JSON.stringify({ channelId: u8aToHex(this.channelId), input: u8aToHex(input) });
|
|
501
|
+
const res = await fetch(`${base}/session/turn`, {
|
|
502
|
+
method: "POST",
|
|
503
|
+
headers: {
|
|
504
|
+
"Content-Type": "application/json",
|
|
505
|
+
Accept: "application/x-ndjson",
|
|
506
|
+
...this.options.headers,
|
|
507
|
+
...this.options.requestHeaders?.("POST", "/session/turn", body),
|
|
508
|
+
},
|
|
509
|
+
body,
|
|
510
|
+
signal,
|
|
511
|
+
});
|
|
512
|
+
const ndjson = res.ok && res.headers?.get?.("content-type")?.includes("application/x-ndjson");
|
|
513
|
+
if (!ndjson || !res.body)
|
|
514
|
+
return { res, text: await res.text(), framesEmitted: false };
|
|
515
|
+
const reader = res.body.getReader();
|
|
516
|
+
const decoder = new TextDecoder();
|
|
517
|
+
let text = "";
|
|
518
|
+
let pending = "";
|
|
519
|
+
let expectedSequence = 0;
|
|
520
|
+
let terminalSeen = false;
|
|
521
|
+
let fullyRead = false;
|
|
522
|
+
const emitFrame = (line) => {
|
|
523
|
+
const frame = JSON.parse(line);
|
|
524
|
+
if (terminalSeen)
|
|
525
|
+
throw new Error("post-terminal frame");
|
|
526
|
+
if (!Number.isInteger(frame.sequence) || frame.sequence !== expectedSequence) {
|
|
527
|
+
throw new Error(`chunk sequence mismatch: expected ${expectedSequence}, got ${frame.sequence}`);
|
|
528
|
+
}
|
|
529
|
+
expectedSequence += 1;
|
|
530
|
+
terminalSeen = frame.type === "terminal";
|
|
531
|
+
this.options.onFrame?.(frame);
|
|
532
|
+
};
|
|
533
|
+
try {
|
|
534
|
+
while (true) {
|
|
535
|
+
const { done, value } = await reader.read();
|
|
536
|
+
if (done)
|
|
537
|
+
break;
|
|
538
|
+
const chunk = decoder.decode(value, { stream: true });
|
|
539
|
+
text += chunk;
|
|
540
|
+
pending += chunk;
|
|
541
|
+
const lines = pending.split("\n");
|
|
542
|
+
pending = lines.pop() ?? "";
|
|
543
|
+
for (const line of lines) {
|
|
544
|
+
if (line.trim())
|
|
545
|
+
emitFrame(line);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
const tail = decoder.decode();
|
|
549
|
+
text += tail;
|
|
550
|
+
pending += tail;
|
|
551
|
+
if (pending.trim())
|
|
552
|
+
emitFrame(pending);
|
|
553
|
+
fullyRead = true;
|
|
554
|
+
}
|
|
555
|
+
finally {
|
|
556
|
+
if (!fullyRead)
|
|
557
|
+
void reader.cancel().catch(() => { });
|
|
558
|
+
reader.releaseLock();
|
|
559
|
+
}
|
|
560
|
+
return { res, text, framesEmitted: true };
|
|
561
|
+
}, this.options.signal);
|
|
562
|
+
this.servedTurns += 1;
|
|
563
|
+
if (res.ok && res.headers?.get?.("content-type")?.includes("application/x-ndjson")) {
|
|
564
|
+
const frames = text
|
|
565
|
+
.split("\n")
|
|
566
|
+
.filter((line) => line.trim().length > 0)
|
|
567
|
+
.map((line) => JSON.parse(line));
|
|
568
|
+
if (!framesEmitted)
|
|
569
|
+
for (const frame of frames)
|
|
570
|
+
this.options.onFrame?.(frame);
|
|
571
|
+
return collectTurnFrames(frames);
|
|
572
|
+
}
|
|
573
|
+
let body;
|
|
574
|
+
try {
|
|
575
|
+
body = text ? JSON.parse(text) : {};
|
|
576
|
+
}
|
|
577
|
+
catch {
|
|
578
|
+
throw new Error(`${base}/session/turn → ${res.status} ${text}`);
|
|
579
|
+
}
|
|
580
|
+
if (!res.ok) {
|
|
581
|
+
if (body?.error === "MaxUnackedGnExceeded" || body?.kind === "MaxUnackedGnExceeded") {
|
|
582
|
+
throw new FenceBreachError(BigInt(body.unackedGn ?? 0), BigInt(body.maxUnackedGn ?? 0), body.lastCheckpoint
|
|
583
|
+
? {
|
|
584
|
+
finalRoot: hexToU8a(body.lastCheckpoint.finalRoot),
|
|
585
|
+
aggregateGn: BigInt(body.lastCheckpoint.aggregateGn),
|
|
586
|
+
payable: BigInt(body.lastCheckpoint.payable ?? body.lastCheckpoint.aggregateGn),
|
|
587
|
+
throughTurn: Number(body.lastCheckpoint.throughTurn),
|
|
588
|
+
agentReceiptSig: hexToU8a(body.lastCheckpoint.agentReceiptSig),
|
|
589
|
+
}
|
|
590
|
+
: null, body.message);
|
|
591
|
+
}
|
|
592
|
+
throw new Error(`${base}/session/turn → ${res.status} ${text}`);
|
|
593
|
+
}
|
|
594
|
+
return decodeTurnReceipt(body);
|
|
595
|
+
}
|
|
596
|
+
/** POST a verified turn-ack so the miner can clear unpaid-tail exposure. */
|
|
597
|
+
async recordAck(ack) {
|
|
598
|
+
if (!this.channelId)
|
|
599
|
+
throw new Error("HttpSessionTransport: channel not bound");
|
|
600
|
+
await withTurnTimeout(ack.turnIndex, this.turnTimeoutMs, (signal) => postJson(`${this.baseUrl.replace(/\/$/, "")}/session/ack`, {
|
|
601
|
+
channelId: u8aToHex(this.channelId),
|
|
602
|
+
turnIndex: ack.turnIndex,
|
|
603
|
+
leafHash: u8aToHex(ack.leafHash),
|
|
604
|
+
agentSendMs: ack.agentSendMs.toString(),
|
|
605
|
+
agentRecvMs: ack.agentRecvMs.toString(),
|
|
606
|
+
agentSig: u8aToHex(ack.agentSig),
|
|
607
|
+
timingStatus: ack.timingStatus,
|
|
608
|
+
scoredLatencyMs: ack.scoredLatencyMs.toString(),
|
|
609
|
+
}, signal, this.options.headers, this.options.requestHeaders), this.options.signal);
|
|
610
|
+
}
|
|
611
|
+
/** POST a co-signed cumulative checkpoint for force_settle material. */
|
|
612
|
+
async recordCheckpoint(checkpoint) {
|
|
613
|
+
if (!this.channelId)
|
|
614
|
+
throw new Error("HttpSessionTransport: channel not bound");
|
|
615
|
+
await withTurnTimeout(checkpoint.throughTurn, this.turnTimeoutMs, (signal) => postJson(`${this.baseUrl.replace(/\/$/, "")}/session/checkpoint`, {
|
|
616
|
+
channelId: u8aToHex(this.channelId),
|
|
617
|
+
finalRoot: u8aToHex(checkpoint.finalRoot),
|
|
618
|
+
aggregateGn: checkpoint.aggregateGn.toString(),
|
|
619
|
+
payable: checkpoint.payable.toString(),
|
|
620
|
+
throughTurn: checkpoint.throughTurn,
|
|
621
|
+
agentReceiptSig: u8aToHex(checkpoint.agentReceiptSig),
|
|
622
|
+
}, signal, this.options.headers, this.options.requestHeaders), this.options.signal);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
//# sourceMappingURL=transport-http.js.map
|