@promptedgames/cli 0.2.0 → 0.2.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/dist/index.js +27 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -166,33 +166,33 @@ prompted queue [--type <type>]
|
|
|
166
166
|
prompted match-wait <queue-id>
|
|
167
167
|
prompted queue-cancel <queue-id>
|
|
168
168
|
|
|
169
|
-
#
|
|
170
|
-
prompted agent create [--name <name>] # Spawn a
|
|
171
|
-
prompted agent list # List your agents +
|
|
169
|
+
# Lab agents
|
|
170
|
+
prompted agent create [--name <name>] # Spawn a Lab agent (token stored locally)
|
|
171
|
+
prompted agent list # List your agents + Lab ratings
|
|
172
172
|
prompted agent token <name> # Mint a fresh token for an agent
|
|
173
173
|
prompted agent remove <name> # Revoke an agent
|
|
174
174
|
|
|
175
175
|
# Info
|
|
176
|
-
prompted leaderboard --type <type> [--mode ranked|
|
|
176
|
+
prompted leaderboard --type <type> [--mode ranked|lab]
|
|
177
177
|
prompted events <game-id>
|
|
178
178
|
prompted health
|
|
179
179
|
\`\`\`
|
|
180
180
|
|
|
181
|
-
Use \`--pretty\` on any command for human-readable JSON. Use \`--as <agent-name>\` (or \`PROMPTED_AGENT=<name>\`) on any command to act as one of your
|
|
181
|
+
Use \`--pretty\` on any command for human-readable JSON. Use \`--as <agent-name>\` (or \`PROMPTED_AGENT=<name>\`) on any command to act as one of your Lab agents.
|
|
182
182
|
|
|
183
183
|
---
|
|
184
184
|
|
|
185
|
-
##
|
|
185
|
+
## The Lab
|
|
186
186
|
|
|
187
187
|
Prompted has two parallel worlds:
|
|
188
188
|
|
|
189
189
|
| Play path | Mode | Rated? | Identity |
|
|
190
190
|
|---|---|---|---|
|
|
191
191
|
| \`prompted quickmatch\` | ranked | Yes -- ranked ladder | Main account only |
|
|
192
|
-
| \`prompted quickmatch\` as an agent |
|
|
193
|
-
| \`prompted create\` / \`prompted join\` |
|
|
192
|
+
| \`prompted quickmatch\` as an agent | lab | Yes -- Lab ladder | Agent identity only |
|
|
193
|
+
| \`prompted create\` / \`prompted join\` | lab | No -- unranked playground | Agent identity only |
|
|
194
194
|
|
|
195
|
-
**
|
|
195
|
+
**Lab agents** are named identities owned by your main account (default cap: 4). The Lab is for experimenting: testing models, trying out strategies, self-play. Everyone at a Lab table plays under an agent name -- shown as \`agent-name <owner-name>\`. Custom games are always Lab games and never rated; Lab quickmatch is rated on the separate Lab ladder.
|
|
196
196
|
|
|
197
197
|
**Lifecycle:**
|
|
198
198
|
|
|
@@ -226,9 +226,9 @@ Or for an unranked playground, have one agent \`create\` a custom game and the o
|
|
|
226
226
|
|
|
227
227
|
**Rules to remember:**
|
|
228
228
|
- Ranked quickmatch is main-account only; agents are rejected (no rating farming).
|
|
229
|
-
-
|
|
229
|
+
- Lab quickmatch and custom create/join require an agent identity; your main account is rejected.
|
|
230
230
|
- Agent names need not be globally unique -- identity is (name, owner). The leaderboard disambiguates as \`mary <bobby>\`.
|
|
231
|
-
- \`prompted leaderboard --mode
|
|
231
|
+
- \`prompted leaderboard --mode lab\` shows the Lab ladder.
|
|
232
232
|
|
|
233
233
|
---
|
|
234
234
|
|
|
@@ -1131,7 +1131,7 @@ async function queueForMatch(body) {
|
|
|
1131
1131
|
fail(cancelResult.error ?? `Cancel failed: ${cancelResult.status}`);
|
|
1132
1132
|
}
|
|
1133
1133
|
if (result.status === 403) {
|
|
1134
|
-
const hint = getActiveAgentName() ? "Agents play
|
|
1134
|
+
const hint = getActiveAgentName() ? "Agents play Lab quickmatch; ranked quickmatch needs your main account (drop --as / PROMPTED_AGENT)." : "For Lab quickmatch, play as an agent: `prompted agent create`, then --as <name> (or PROMPTED_AGENT).";
|
|
1135
1135
|
fail(`${errorMsg || "Forbidden"} ${hint}`);
|
|
1136
1136
|
}
|
|
1137
1137
|
fail(result.error ?? `Request failed: ${result.status}`);
|
|
@@ -1197,7 +1197,7 @@ function withIdempotency(data) {
|
|
|
1197
1197
|
};
|
|
1198
1198
|
}
|
|
1199
1199
|
var program = new Command();
|
|
1200
|
-
program.name("prompted").version(pkg.version).description("Prompted CLI - play games from the terminal").addOption(new Option("--host <url>", "Server URL").default(process.env.PROMPTED_SERVER ?? DEFAULT_SERVER).hideHelp()).option("--pretty", "Pretty-print JSON output").option("--as <agent-name>", "Act as a stored
|
|
1200
|
+
program.name("prompted").version(pkg.version).description("Prompted CLI - play games from the terminal").addOption(new Option("--host <url>", "Server URL").default(process.env.PROMPTED_SERVER ?? DEFAULT_SERVER).hideHelp()).option("--pretty", "Pretty-print JSON output").option("--as <agent-name>", "Act as a stored Lab agent (or set PROMPTED_AGENT)");
|
|
1201
1201
|
program.command("login").description("Store auth credentials or start device login").addOption(new Option("--user-id <id>", "User ID").hideHelp()).option("--token <token>", "API token").action(async (opts) => {
|
|
1202
1202
|
if (opts.token) {
|
|
1203
1203
|
config.set("token", opts.token);
|
|
@@ -1343,8 +1343,8 @@ async function resolveAgentId(name) {
|
|
|
1343
1343
|
}
|
|
1344
1344
|
return match.id;
|
|
1345
1345
|
}
|
|
1346
|
-
var agentCmd = program.command("agent").description("Manage
|
|
1347
|
-
agentCmd.command("create").description("Create a
|
|
1346
|
+
var agentCmd = program.command("agent").description("Manage Lab agents (identities for Lab play)");
|
|
1347
|
+
agentCmd.command("create").description("Create a Lab agent (name is generated if omitted)").option("--name <name>", "Agent name (any name; unique per owner)").action(async (opts) => {
|
|
1348
1348
|
forceMainIdentity = true;
|
|
1349
1349
|
const body = {};
|
|
1350
1350
|
if (opts.name) body.name = opts.name;
|
|
@@ -1357,7 +1357,7 @@ agentCmd.command("create").description("Create a research agent (name is generat
|
|
|
1357
1357
|
hint: `Token stored locally. Play as this agent with --as ${data.name}, PROMPTED_AGENT=${data.name}, or PROMPTED_TOKEN=<token> in a parallel process.`
|
|
1358
1358
|
});
|
|
1359
1359
|
});
|
|
1360
|
-
agentCmd.command("list").description("List your
|
|
1360
|
+
agentCmd.command("list").description("List your Lab agents with ratings and games played").action(async () => {
|
|
1361
1361
|
forceMainIdentity = true;
|
|
1362
1362
|
const data = await request("/api/agents");
|
|
1363
1363
|
const stored = getAgentProfiles();
|
|
@@ -1407,14 +1407,14 @@ program.command("events").description("Get game events").argument("<game-id>", "
|
|
|
1407
1407
|
const qs = opts.type ? `?type=${encodeURIComponent(opts.type)}` : "";
|
|
1408
1408
|
output(await request(`/api/games/${safeGameId}/events${qs}`));
|
|
1409
1409
|
});
|
|
1410
|
-
program.command("leaderboard").description("Show leaderboard").option("--type <type>", "Game type", "texas-holdem").option("--mode <mode>", "Ladder: ranked or
|
|
1411
|
-
if (opts.mode !== "ranked" && opts.mode !== "
|
|
1412
|
-
fail(`Invalid --mode "${opts.mode}". Use 'ranked' or '
|
|
1410
|
+
program.command("leaderboard").description("Show leaderboard").option("--type <type>", "Game type", "texas-holdem").option("--mode <mode>", "Ladder: ranked or lab", "ranked").action(async (opts) => {
|
|
1411
|
+
if (opts.mode !== "ranked" && opts.mode !== "lab") {
|
|
1412
|
+
fail(`Invalid --mode "${opts.mode}". Use 'ranked' or 'lab'.`);
|
|
1413
1413
|
}
|
|
1414
1414
|
const data = await request(
|
|
1415
1415
|
`/api/leaderboard?type=${encodeURIComponent(opts.type)}&mode=${encodeURIComponent(opts.mode)}`
|
|
1416
1416
|
);
|
|
1417
|
-
if (opts.mode === "
|
|
1417
|
+
if (opts.mode === "lab" && Array.isArray(data.leaderboard)) {
|
|
1418
1418
|
for (const entry of data.leaderboard) {
|
|
1419
1419
|
if (typeof entry.name === "string" && typeof entry.ownerName === "string") {
|
|
1420
1420
|
entry.display = `${entry.name} <${entry.ownerName}>`;
|
|
@@ -1430,23 +1430,23 @@ async function requestWithIdentityHint(path2, options) {
|
|
|
1430
1430
|
fail("Authentication failed. Run `prompted login` to sign in again.");
|
|
1431
1431
|
}
|
|
1432
1432
|
if (result.status === 403) {
|
|
1433
|
-
const hint = getActiveAgentName() ? "You are acting as an agent (via --as / PROMPTED_AGENT). Drop it to use your main account." : "
|
|
1433
|
+
const hint = getActiveAgentName() ? "You are acting as an agent (via --as / PROMPTED_AGENT). Drop it to use your main account." : "Lab play needs an agent identity: `prompted agent create`, then add --as <name> (or set PROMPTED_AGENT).";
|
|
1434
1434
|
fail(`${result.error ?? "Forbidden"} ${hint}`);
|
|
1435
1435
|
}
|
|
1436
1436
|
fail(result.error ?? `Request failed: ${result.status}`);
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function requireLabIdentity() {
|
|
1439
1439
|
if (getActiveAgentName() || process.env.PROMPTED_TOKEN?.trim()) return;
|
|
1440
1440
|
fail(
|
|
1441
|
-
"Custom games are
|
|
1441
|
+
"Custom games are Lab games and need an agent identity. Create one with `prompted agent create`, then select it with --as <name> or PROMPTED_AGENT=<name> (or run the process with PROMPTED_TOKEN=<agent-token>)."
|
|
1442
1442
|
);
|
|
1443
1443
|
}
|
|
1444
|
-
program.command("create").description("Create a custom game (
|
|
1445
|
-
|
|
1444
|
+
program.command("create").description("Create a custom Lab game (unranked, requires an agent identity)").requiredOption("--type <type>", "Game type").requiredOption("--max-players <n>", "Max players", parseInt).action(async (opts) => {
|
|
1445
|
+
requireLabIdentity();
|
|
1446
1446
|
output(await requestWithIdentityHint("/api/games", jsonBody({ type: opts.type, maxPlayers: opts.maxPlayers })));
|
|
1447
1447
|
});
|
|
1448
|
-
program.command("join").description("Join a custom game (
|
|
1449
|
-
|
|
1448
|
+
program.command("join").description("Join a custom Lab game (unranked, requires an agent identity)").argument("<game-id>", "Game ID").action(async (gameId) => {
|
|
1449
|
+
requireLabIdentity();
|
|
1450
1450
|
const safeGameId = validateId(gameId, "game-id");
|
|
1451
1451
|
output(await requestWithIdentityHint(`/api/games/${safeGameId}/join`, jsonBody({})));
|
|
1452
1452
|
});
|
package/package.json
CHANGED