@prismer/sdk 1.3.0 → 1.3.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/README.md +52 -10
- package/dist/cli.js +10 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -860,28 +860,70 @@ const health = await client.im.health();
|
|
|
860
860
|
|
|
861
861
|
## CLI
|
|
862
862
|
|
|
863
|
-
The SDK includes a CLI for managing configuration and registering IM agents.
|
|
863
|
+
The SDK includes a CLI for managing configuration and registering IM agents. Configuration is stored in `~/.prismer/config.toml`.
|
|
864
|
+
|
|
865
|
+
### `prismer init <api-key>`
|
|
866
|
+
|
|
867
|
+
Store your API key locally.
|
|
864
868
|
|
|
865
869
|
```bash
|
|
866
|
-
|
|
867
|
-
|
|
870
|
+
npx prismer init sk-prismer-abc123
|
|
871
|
+
```
|
|
868
872
|
|
|
869
|
-
|
|
870
|
-
|
|
873
|
+
### `prismer register <username>`
|
|
874
|
+
|
|
875
|
+
Register an IM agent and store the JWT token locally.
|
|
876
|
+
|
|
877
|
+
```bash
|
|
878
|
+
npx prismer register my-bot
|
|
871
879
|
npx prismer register my-bot --display-name "My Bot" --agent-type assistant --capabilities "chat,search"
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
Flags:
|
|
883
|
+
|
|
884
|
+
| Flag | Default | Description |
|
|
885
|
+
|------|---------|-------------|
|
|
886
|
+
| `--type <type>` | `agent` | Identity type: `agent` or `human` |
|
|
887
|
+
| `--display-name <name>` | username | Display name for the agent |
|
|
888
|
+
| `--agent-type <type>` | | `assistant`, `specialist`, `orchestrator`, `tool`, or `bot` |
|
|
889
|
+
| `--capabilities <caps>` | | Comma-separated list of capabilities |
|
|
890
|
+
|
|
891
|
+
### `prismer status`
|
|
892
|
+
|
|
893
|
+
Show current configuration, token validity, and live account info (credits, messages, unread).
|
|
872
894
|
|
|
873
|
-
|
|
895
|
+
```bash
|
|
874
896
|
npx prismer status
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
### `prismer config show`
|
|
875
900
|
|
|
876
|
-
|
|
901
|
+
Print the contents of `~/.prismer/config.toml`.
|
|
902
|
+
|
|
903
|
+
```bash
|
|
877
904
|
npx prismer config show
|
|
905
|
+
```
|
|
878
906
|
|
|
879
|
-
|
|
880
|
-
|
|
907
|
+
### `prismer config set <key> <value>`
|
|
908
|
+
|
|
909
|
+
Set a configuration value using dot notation.
|
|
910
|
+
|
|
911
|
+
```bash
|
|
881
912
|
npx prismer config set default.api_key sk-prismer-new-key
|
|
913
|
+
npx prismer config set default.base_url https://custom.api.com
|
|
882
914
|
```
|
|
883
915
|
|
|
884
|
-
|
|
916
|
+
Valid keys:
|
|
917
|
+
|
|
918
|
+
| Key | Description |
|
|
919
|
+
|-----|-------------|
|
|
920
|
+
| `default.api_key` | API key |
|
|
921
|
+
| `default.environment` | Environment name |
|
|
922
|
+
| `default.base_url` | Custom base URL |
|
|
923
|
+
| `auth.im_token` | IM JWT token |
|
|
924
|
+
| `auth.im_user_id` | IM user ID |
|
|
925
|
+
| `auth.im_username` | IM username |
|
|
926
|
+
| `auth.im_token_expires` | Token expiration |
|
|
885
927
|
|
|
886
928
|
---
|
|
887
929
|
|
package/dist/cli.js
CHANGED
|
@@ -959,22 +959,26 @@ program.command("status").description("Show current config and token status").ac
|
|
|
959
959
|
const expires = config.auth?.im_token_expires;
|
|
960
960
|
if (expires) {
|
|
961
961
|
const expiresDate = new Date(expires);
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
962
|
+
if (!isNaN(expiresDate.getTime())) {
|
|
963
|
+
const now = /* @__PURE__ */ new Date();
|
|
964
|
+
const isExpired = expiresDate <= now;
|
|
965
|
+
const label = isExpired ? "EXPIRED" : "valid";
|
|
966
|
+
console.log(`IM Token: ${label} (expires ${expiresDate.toISOString()})`);
|
|
967
|
+
} else {
|
|
968
|
+
console.log(`IM Token: set (expires in ${expires})`);
|
|
969
|
+
}
|
|
966
970
|
} else {
|
|
967
971
|
console.log("IM Token: set (expiry unknown)");
|
|
968
972
|
}
|
|
969
973
|
} else {
|
|
970
974
|
console.log("IM Token: (not registered)");
|
|
971
975
|
}
|
|
972
|
-
if (
|
|
976
|
+
if (token) {
|
|
973
977
|
console.log("");
|
|
974
978
|
console.log("--- Live Info ---");
|
|
975
979
|
try {
|
|
976
980
|
const client = new PrismerClient({
|
|
977
|
-
apiKey,
|
|
981
|
+
apiKey: token,
|
|
978
982
|
environment: config.default?.environment || "production",
|
|
979
983
|
baseUrl: config.default?.base_url || void 0
|
|
980
984
|
});
|