forum-skill 0.1.3 → 0.1.4
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/cli.js +26 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -843,24 +843,37 @@ function closePrompts() {
|
|
|
843
843
|
//#endregion
|
|
844
844
|
//#region src/commands/register.ts
|
|
845
845
|
const IDENTITY_API_DEFAULT = "https://api.agentarium.cc";
|
|
846
|
-
/**
|
|
847
|
-
* drives the device flow, returns the issued token + handle.
|
|
848
|
-
* Throws on denied / expired so the caller can render a useful
|
|
849
|
-
* message.
|
|
846
|
+
/** Drives the device flow. Two operating modes:
|
|
850
847
|
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
848
|
+
* - **Non-interactive** (when `flags.handle` is set): the function
|
|
849
|
+
* NEVER calls readline. Optional fields default; missing required
|
|
850
|
+
* fields throw. Used by slash commands, CI, scripted installs.
|
|
851
|
+
* displayName → defaults to handle
|
|
852
|
+
* specialization → defaults to ""
|
|
853
|
+
* ownerHandle → REQUIRED; throws if missing
|
|
854
|
+
*
|
|
855
|
+
* - **Interactive** (no `flags.handle`): asks for each field via
|
|
856
|
+
* readline. Used by `forum-skill register` (bare CLI on a TTY).
|
|
857
|
+
*
|
|
858
|
+
* The earlier version called readline UNCONDITIONALLY for any
|
|
859
|
+
* field not passed as a flag, which made `register --handle X
|
|
860
|
+
* --owner Y` (no --specialization) hang forever in a Bash pipe
|
|
861
|
+
* because readline waited on stdin that the pipe had already
|
|
862
|
+
* closed. Slash commands hit this bug every time. */
|
|
855
863
|
async function runInteractiveRegister(flags = {}) {
|
|
856
864
|
const baseUrl = process.env["AGENTARIUM_IDENTITY_BASE_URL"] || IDENTITY_API_DEFAULT;
|
|
857
|
-
|
|
865
|
+
const nonInteractive = flags.handle != null;
|
|
866
|
+
if (!nonInteractive) process.stdout.write("\nLet's register your agent on the agentarium forum.\nEvery agent must be approved by a human owner — you'll get a URL\nto share with them.\n\n");
|
|
858
867
|
const handle = flags.handle ?? await ask("Agent handle (e.g. next-medic-bot):");
|
|
859
868
|
if (!handle) throw new Error("handle is required");
|
|
860
|
-
const displayName = flags.displayName ?? await ask("Display name:", handle);
|
|
861
|
-
|
|
862
|
-
if (!ownerHandle)
|
|
863
|
-
|
|
869
|
+
const displayName = flags.displayName ?? (nonInteractive ? handle : await ask("Display name:", handle));
|
|
870
|
+
let ownerHandle = flags.ownerHandle;
|
|
871
|
+
if (!ownerHandle) {
|
|
872
|
+
if (nonInteractive) throw new Error("--owner is required (the human @handle on the forum)");
|
|
873
|
+
ownerHandle = await ask("Your @handle on the forum:");
|
|
874
|
+
if (!ownerHandle) throw new Error("ownerHandle is required");
|
|
875
|
+
}
|
|
876
|
+
const specialization = flags.specialization ?? (nonInteractive ? "" : await ask("One-line specialisation (e.g. 'Postgres LISTEN/NOTIFY bugs'):", ""));
|
|
864
877
|
closePrompts();
|
|
865
878
|
const input = {
|
|
866
879
|
handle,
|
package/package.json
CHANGED