@dopamint-fun/open-sdk 0.2.0-dev.5 → 0.2.0-dev.7
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/dist/claim.js +1 -1
- package/dist/cli.js +18 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/settlement.d.ts +0 -1
- package/dist/settlement.js +0 -6
- package/package.json +1 -1
package/dist/claim.js
CHANGED
|
@@ -146,5 +146,5 @@ export function decodeClaimInvite(token) {
|
|
|
146
146
|
/** Where the owner goes to accept: the agent's claim page with the token. */
|
|
147
147
|
export function claimInviteLink(arenaOrigin, agentIdHex, token) {
|
|
148
148
|
const id = agentIdHex.startsWith("0x") ? agentIdHex : `0x${agentIdHex}`;
|
|
149
|
-
return `${arenaOrigin.replace(/\/$/, "")}/
|
|
149
|
+
return `${arenaOrigin.replace(/\/$/, "")}/open/agents/${id}/claim?invite=${token}`;
|
|
150
150
|
}
|
package/dist/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ import { acceptAndAwaitAdmission } from "./offer.js";
|
|
|
24
24
|
import { playTour, queueUntilSeated } from "./tour.js";
|
|
25
25
|
import { joinRoomWhenComposed, MIN_ROOM_SEATS, openRoom, roomInvitePrompt, } from "./room.js";
|
|
26
26
|
import { disputeHolding, JoinRefused, joinTransaction, leaveTransaction, listTournaments, matchmakingOverLine, planJoin, presentToTournament, readAgentEntry, readAgentEntrySettled, playsHeldBy, giveBackTransaction, readTournament, sponsorAndExecute, tournamentIdArg, } from "./openTournament.js";
|
|
27
|
-
import {
|
|
27
|
+
import { buildConsentRequest, DEFAULT_OPEN_API_BASE_URL, digestForPrompt, settlementConsentPath, verifyConsentDisclosure, } from "./settlement.js";
|
|
28
28
|
import { actionSigningBytes, joinSigningBytes, requireSessionVersion, resumeSigningBytes, SESSION_VERSION, } from "./sessionWire.js";
|
|
29
29
|
import { describeNext, refusalMessageFromText } from "./refusal.js";
|
|
30
30
|
function fail(message) {
|
|
@@ -579,7 +579,7 @@ function runRecordPath(keyFile) {
|
|
|
579
579
|
}
|
|
580
580
|
function writeRunRecord(keyFile, record) {
|
|
581
581
|
const path = runRecordPath(keyFile);
|
|
582
|
-
const watchUrl = `${record.productUrl.replace(/\/$/, "")}/
|
|
582
|
+
const watchUrl = `${record.productUrl.replace(/\/$/, "")}/open/matches/0x${record.executionId.replace(/^0x/i, "")}`;
|
|
583
583
|
writeFileSync(path, `${JSON.stringify({ ...record, watchUrl, at: new Date().toISOString() }, null, 2)}\n`, { mode: 0o600 });
|
|
584
584
|
return path;
|
|
585
585
|
}
|
|
@@ -640,7 +640,7 @@ async function signedGet(productUrl, target, agent, agentIdHex) {
|
|
|
640
640
|
headers: { [AGENT_HTTP_CAPABILITY_HEADER]: header },
|
|
641
641
|
});
|
|
642
642
|
}
|
|
643
|
-
/** `dopa-open me`:
|
|
643
|
+
/** `dopa-open me`: Open's record of this agent, signed for.
|
|
644
644
|
*
|
|
645
645
|
* Both agents that played on 2026-09-06 wrote this request by hand, against
|
|
646
646
|
* the skill's own warning that a hand-written signature drifts by a byte. */
|
|
@@ -661,7 +661,7 @@ async function resolveAgentId(productUrl, ownerAddressHex, given) {
|
|
|
661
661
|
const body = (await response.json());
|
|
662
662
|
const agents = body.agents ?? [];
|
|
663
663
|
if (agents.length === 0)
|
|
664
|
-
fail(`no agent on this
|
|
664
|
+
fail(`no agent on this Open deployment is claimed by ${ownerAddressHex}. The roster lists an agent under the wallet that ` +
|
|
665
665
|
"claimed it, so one that registered itself is not here until it is claimed; pass --agent-id (register printed it)");
|
|
666
666
|
if (agents.length > 1)
|
|
667
667
|
fail(`this key owns ${agents.length} agents; pass --agent-id to say which:\n ${agents
|
|
@@ -860,7 +860,12 @@ async function consentToTerminal(options) {
|
|
|
860
860
|
const record = JSON.parse(offerBody);
|
|
861
861
|
if (!record.admission)
|
|
862
862
|
fail("offer is not admitted; there is no execution to settle");
|
|
863
|
-
|
|
863
|
+
/* The settlement verbs live on the product origin — `/v1/authority/…` is
|
|
864
|
+
the product's public route, which forwards to the shard that admitted
|
|
865
|
+
the execution. The session's own origin serves `/v1/exec/` only, so
|
|
866
|
+
deriving the consent root from `session_base_url` asks a listener that
|
|
867
|
+
does not serve this spelling. */
|
|
868
|
+
const origin = options.productUrl.replace(/\/$/, "");
|
|
864
869
|
const path = settlementConsentPath(record.admission.execution_id);
|
|
865
870
|
const promptResponse = await fetch(`${origin}${path}`);
|
|
866
871
|
const promptText = await promptResponse.text();
|
|
@@ -1083,7 +1088,7 @@ async function commandQueue(args) {
|
|
|
1083
1088
|
Labelled `agent_page`, never `watch`. It was `watch` for one release, and
|
|
1084
1089
|
an agent reading that line handed its operator a profile under the word
|
|
1085
1090
|
WATCH; `watch` is the table, printed below once there is one. */
|
|
1086
|
-
console.log(`agent_page ${client.productUrl.replace(/\/$/, "")}/
|
|
1091
|
+
console.log(`agent_page ${client.productUrl.replace(/\/$/, "")}/open/agents/0x${values["agent-id"].replace(/^0x/i, "")}`);
|
|
1087
1092
|
let lastWaitingLine = "";
|
|
1088
1093
|
const seated = await queueUntilSeated(client, tour, {
|
|
1089
1094
|
minAgents,
|
|
@@ -1138,7 +1143,7 @@ async function commandQueue(args) {
|
|
|
1138
1143
|
executionId: admitted.executionId,
|
|
1139
1144
|
};
|
|
1140
1145
|
const recordPath = writeRunRecord(values.key, runRecord);
|
|
1141
|
-
console.log(`watch ${client.productUrl.replace(/\/$/, "")}/
|
|
1146
|
+
console.log(`watch ${client.productUrl.replace(/\/$/, "")}/open/matches/0x${admitted.executionId.replace(/^0x/i, "")}`);
|
|
1142
1147
|
console.log(`run_record ${recordPath}`);
|
|
1143
1148
|
console.log(`reconnect ${reconnectCommand(values.key, runRecord)}`);
|
|
1144
1149
|
takeSeatLock(values.key, values["agent-id"]);
|
|
@@ -1269,7 +1274,7 @@ async function commandRoom(args) {
|
|
|
1269
1274
|
that word is the match link on every door, and `room join` prints it
|
|
1270
1275
|
once the room composes, so two different links under one label was a
|
|
1271
1276
|
thing an agent had to be warned about. */
|
|
1272
|
-
console.log(`room_page ${client.productUrl.replace(/\/$/, "")}/
|
|
1277
|
+
console.log(`room_page ${client.productUrl.replace(/\/$/, "")}/open/tours/private-room/tables/${room.tableId}`);
|
|
1273
1278
|
return;
|
|
1274
1279
|
}
|
|
1275
1280
|
const tableId = values["table-id"];
|
|
@@ -1318,7 +1323,7 @@ async function commandRoom(args) {
|
|
|
1318
1323
|
executionId: admitted.executionId,
|
|
1319
1324
|
};
|
|
1320
1325
|
const recordPath = writeRunRecord(values.key, runRecord);
|
|
1321
|
-
console.log(`watch ${client.productUrl.replace(/\/$/, "")}/
|
|
1326
|
+
console.log(`watch ${client.productUrl.replace(/\/$/, "")}/open/matches/0x${admitted.executionId.replace(/^0x/i, "")}`);
|
|
1322
1327
|
console.log(`run_record ${recordPath}`);
|
|
1323
1328
|
console.log(`reconnect ${reconnectCommand(values.key, runRecord)}`);
|
|
1324
1329
|
takeSeatLock(values.key, values["agent-id"]);
|
|
@@ -1630,7 +1635,7 @@ async function commandTournament(args) {
|
|
|
1630
1635
|
console.log(`offer ${offerId}`);
|
|
1631
1636
|
console.log(`seat ${seated.seat}`);
|
|
1632
1637
|
if (seated.executionId)
|
|
1633
|
-
console.log(`watch ${client.productUrl.replace(/\/$/, "")}/
|
|
1638
|
+
console.log(`watch ${client.productUrl.replace(/\/$/, "")}/open/matches/${seated.executionId}`);
|
|
1634
1639
|
if (!values.play)
|
|
1635
1640
|
return;
|
|
1636
1641
|
const seat = seated.seat;
|
|
@@ -1672,7 +1677,7 @@ async function commandTournament(args) {
|
|
|
1672
1677
|
}
|
|
1673
1678
|
/** `dopa-open claim-invite`: the link a wallet needs to claim this agent.
|
|
1674
1679
|
*
|
|
1675
|
-
* A claim is two consents. The wallet signs on
|
|
1680
|
+
* A claim is two consents. The wallet signs on Open's claim page; you, holding
|
|
1676
1681
|
* the agent's key, sign the invitation that lets it. Name the wallet with
|
|
1677
1682
|
* `--owner` to make the link good for that wallet alone; leave it out and the
|
|
1678
1683
|
* link is good for whoever opens it, for as long as `--hours` says. */
|
|
@@ -1706,7 +1711,7 @@ async function commandClaimInvite(args) {
|
|
|
1706
1711
|
expects the old form. Both decode to the same 192 bytes. */
|
|
1707
1712
|
const token = encodeClaimInvite(invite);
|
|
1708
1713
|
const linkToken = encodeClaimInviteCompact(invite);
|
|
1709
|
-
/*
|
|
1714
|
+
/* Open's pages and its API share an origin on a deployment; a local
|
|
1710
1715
|
stack serves them apart, which is what --arena-url is for. */
|
|
1711
1716
|
const arena = (values["arena-url"] ?? productUrl).replace(/\/$/, "");
|
|
1712
1717
|
console.log(`invite ${token}`);
|
|
@@ -1718,7 +1723,7 @@ const USAGE = `usage: dopa-open <command>
|
|
|
1718
1723
|
|
|
1719
1724
|
keygen generate a keypair into .dopa-keypair (Sui suiprivkey format)
|
|
1720
1725
|
address print the owner address and public key of an existing key file
|
|
1721
|
-
me print
|
|
1726
|
+
me print Open's record of this agent, signed for (agent/me)
|
|
1722
1727
|
claim-invite
|
|
1723
1728
|
mint the claim link a wallet needs to claim this agent
|
|
1724
1729
|
register self-allocate and register the agent with a product deployment
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { actionSigningBytes, encodeActionFrame, encodeJoinFrame, encodeResumeFra
|
|
|
5
5
|
export { encodeAckFrame, SESSION_ERROR_NAMES, MAX_PREDICTION_PACING_MS, admitAuthorityEvent, applyPredictionGateStatus, decodeAuthorityMessage, freshSessionBoundary, predictionGateMessage, predictionGatePreparationOf, predictionGateTargetReceipt, sessionErrorHint, sessionErrorName, PredictionGateConflictError, SessionBoundaryError, type AcceptedSessionBoundary, type AuthorityMessage, type PredictionGateMessage, type PredictionGateOpening, type PredictionGatePreparation, type PredictionGateRelease, type PredictionGateStatus, type PredictionWindowRef, type ReceiptRef, type ResumeCursor, type StateRef, type ViewSnapshot, } from "./sessionCodec.js";
|
|
6
6
|
export { type OpenTableView, type PlayReport, type SeatDecision, type SeatDecisionResult, type SeatPosition, SessionClient, SessionRefusal, chooseSeatAction, playSeat, } from "./session.js";
|
|
7
7
|
export { cardFromByte, decodeLegalActions, decodeParticipantView, encodeAction, pickAction, type Card, type Rank, type Suit, type TexasAction, type TexasLegalActions, type TexasSeatView, } from "./texas.js";
|
|
8
|
-
export {
|
|
8
|
+
export { buildConsentRequest, DEFAULT_OPEN_API_BASE_URL, digestForPrompt, recomputeSettlementDigest, settlementConsentPath, verifyConsentDisclosure, } from "./settlement.js";
|
|
9
9
|
export { PACKAGE_NAME, RELEASE_CHANNELS, channelDistTag, installCommand, installSpec, resolveChannel, versionMatchesChannel, type ReleaseChannel, } from "./channel.js";
|
|
10
10
|
export { fromHex, toHex } from "./bytes.js";
|
|
11
11
|
export { AGENT_HTTP_CAPABILITY_HEADER, AGENT_HTTP_CAPABILITY_NONCE_BYTES, MAX_AGENT_HTTP_CAPABILITY_WINDOW_MS, agentHttpCanonicalPayload, agentHttpSigningBytes, decodeAgentHttpHeader, encodeAgentHttpHeader, mintAgentHttpCapability, type AgentHttpBinding, type AgentHttpCapability, } from "./agentHttp.js";
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { actionSigningBytes, encodeActionFrame, encodeJoinFrame, encodeResumeFra
|
|
|
12
12
|
export { encodeAckFrame, SESSION_ERROR_NAMES, MAX_PREDICTION_PACING_MS, admitAuthorityEvent, applyPredictionGateStatus, decodeAuthorityMessage, freshSessionBoundary, predictionGateMessage, predictionGatePreparationOf, predictionGateTargetReceipt, sessionErrorHint, sessionErrorName, PredictionGateConflictError, SessionBoundaryError, } from "./sessionCodec.js";
|
|
13
13
|
export { SessionClient, SessionRefusal, chooseSeatAction, playSeat, } from "./session.js";
|
|
14
14
|
export { cardFromByte, decodeLegalActions, decodeParticipantView, encodeAction, pickAction, } from "./texas.js";
|
|
15
|
-
export {
|
|
15
|
+
export { buildConsentRequest, DEFAULT_OPEN_API_BASE_URL, digestForPrompt, recomputeSettlementDigest, settlementConsentPath, verifyConsentDisclosure, } from "./settlement.js";
|
|
16
16
|
export { PACKAGE_NAME, RELEASE_CHANNELS, channelDistTag, installCommand, installSpec, resolveChannel, versionMatchesChannel, } from "./channel.js";
|
|
17
17
|
export { fromHex, toHex } from "./bytes.js";
|
|
18
18
|
export { AGENT_HTTP_CAPABILITY_HEADER, AGENT_HTTP_CAPABILITY_NONCE_BYTES, MAX_AGENT_HTTP_CAPABILITY_WINDOW_MS, agentHttpCanonicalPayload, agentHttpSigningBytes, decodeAgentHttpHeader, encodeAgentHttpHeader, mintAgentHttpCapability, } from "./agentHttp.js";
|
package/dist/settlement.d.ts
CHANGED
|
@@ -57,5 +57,4 @@ export declare function buildConsentRequest(args: ConsentDisclosure & {
|
|
|
57
57
|
signature: Uint8Array;
|
|
58
58
|
}): ConsentRequest;
|
|
59
59
|
export declare function settlementConsentPath(executionIdHex: string): string;
|
|
60
|
-
export declare function authorityOriginFromSessionBase(sessionBaseUrl: string): string;
|
|
61
60
|
export declare function digestForPrompt(prompt: ConsentPrompt): Uint8Array;
|
package/dist/settlement.js
CHANGED
|
@@ -110,12 +110,6 @@ export function settlementConsentPath(executionIdHex) {
|
|
|
110
110
|
const hex = executionIdHex.replace(/^0x/, "");
|
|
111
111
|
return `/v1/authority/executions/${hex}/settlements`;
|
|
112
112
|
}
|
|
113
|
-
export function authorityOriginFromSessionBase(sessionBaseUrl) {
|
|
114
|
-
const idx = sessionBaseUrl.indexOf("/v1/exec/");
|
|
115
|
-
if (idx <= 0)
|
|
116
|
-
throw new Error(`admission session_base_url is not an execution session URL: ${sessionBaseUrl}`);
|
|
117
|
-
return sessionBaseUrl.slice(0, idx);
|
|
118
|
-
}
|
|
119
113
|
export function digestForPrompt(prompt) {
|
|
120
114
|
const terminal = decodeTerminalState(fromHex(prompt.encoded_terminal_state));
|
|
121
115
|
return recomputeSettlementDigest(fromHex(prompt.anchor_context), terminal);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dopamint-fun/open-sdk",
|
|
3
|
-
"version": "0.2.0-dev.
|
|
3
|
+
"version": "0.2.0-dev.7",
|
|
4
4
|
"description": "DOPA-OPEN client SDK: generate and hold your own agent key, sign registrations, and play a Participant Session",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|