ignis-agent-cli 0.1.1 → 0.1.3
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 +9 -1
- package/dist/index.js +32 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,15 @@ npm install -g ignis-agent-cli
|
|
|
11
11
|
## Configure
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
ignis login --
|
|
14
|
+
ignis login --config-url <user_config_link>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Treat `config_url` as a short-lived bootstrap link. Fetch it once, save local config, and do not redistribute it.
|
|
18
|
+
|
|
19
|
+
Fallback:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
ignis login --base-url https://ignis-cli.funplus-marketing.ai --token <cli_token>
|
|
15
23
|
```
|
|
16
24
|
|
|
17
25
|
This stores config in `~/.ignis/config.json` and reuses the current working directory as the default session context.
|
package/dist/index.js
CHANGED
|
@@ -588,7 +588,7 @@ function inferExitCode(error) {
|
|
|
588
588
|
// src/commands/ask.ts
|
|
589
589
|
function buildAskCommand() {
|
|
590
590
|
const command = new Command2("ask");
|
|
591
|
-
command.description("Submit one turn").argument("[message]", "Message text").addOption(new Option2("--prompt-file <path>", "Read prompt text from file")).addOption(new Option2("--attach <path>", "Upload and attach a file").default([], void 0).argParser(collectValues)).addOption(new Option2("--file-id <id>", "Reuse an existing uploaded file_id").default([], void 0).argParser(collectValues)).addOption(new Option2("--session <id>", "Continue an existing session")).addOption(new Option2("--new", "Start a new session instead of reusing the cwd session")).addOption(new Option2("--canvas <id>", "Create a new session under an existing canvas")).addOption(new Option2("--agent <name>", "Override agent name")).addOption(new Option2("--
|
|
591
|
+
command.description("Submit one turn").argument("[message]", "Message text").addOption(new Option2("--prompt-file <path>", "Read prompt text from file")).addOption(new Option2("--attach <path>", "Upload and attach a file").default([], void 0).argParser(collectValues)).addOption(new Option2("--file-id <id>", "Reuse an existing uploaded file_id").default([], void 0).argParser(collectValues)).addOption(new Option2("--session <id>", "Continue an existing session")).addOption(new Option2("--new", "Start a new session instead of reusing the cwd session")).addOption(new Option2("--canvas <id>", "Create a new session under an existing canvas")).addOption(new Option2("--agent <name>", "Override agent name")).addOption(new Option2("--async", "Return immediately after submission without polling")).addOption(new Option2("--wait-ms <ms>", "Per-request server wait window").default("25000")).addOption(new Option2("--timeout-ms <ms>", "Client-side polling timeout").default("300000")).addOption(new Option2("--no-session-cache", "Do not read or write cwd-scoped session cache")).hook("preAction", () => {
|
|
592
592
|
}).action(
|
|
593
593
|
wrapCommand(async (messageArg, options) => {
|
|
594
594
|
const message = await resolvePrompt(messageArg, options.promptFile);
|
|
@@ -611,7 +611,6 @@ function buildAskCommand() {
|
|
|
611
611
|
message,
|
|
612
612
|
file_ids: fileIds,
|
|
613
613
|
agent: options.agent?.trim() || void 0,
|
|
614
|
-
skill_id: options.skill,
|
|
615
614
|
wait_ms: options.async ? 0 : toPositiveInt(options.waitMs, 25e3),
|
|
616
615
|
idempotency_key: crypto.randomUUID()
|
|
617
616
|
};
|
|
@@ -749,20 +748,29 @@ function toNonNegativeInt(value, fallbackValue) {
|
|
|
749
748
|
import { Command as Command5 } from "commander";
|
|
750
749
|
function buildLoginCommand() {
|
|
751
750
|
const command = new Command5("login");
|
|
752
|
-
command.description("Store CLI token and base URL in ~/.ignis/config.json").
|
|
751
|
+
command.description("Store CLI token and base URL in ~/.ignis/config.json").option("--base-url <url>", "Backend base URL").option("--token <token>", "CLI token").option("--config-url <url>", "Fetch a short-lived config JSON").option("--json", "Print machine-readable JSON output").action(
|
|
753
752
|
wrapCommand(async (options) => {
|
|
753
|
+
const remoteConfig = options.configUrl?.trim() ? await fetchRemoteConfig(options.configUrl.trim()) : null;
|
|
754
|
+
const resolvedBaseUrl = (options.baseUrl?.trim() || remoteConfig?.baseUrl || "").replace(/\/+$/, "");
|
|
755
|
+
const resolvedToken = options.token?.trim() || remoteConfig?.cliToken || "";
|
|
756
|
+
if (!resolvedBaseUrl || !resolvedToken) {
|
|
757
|
+
throw new Error(
|
|
758
|
+
"Missing login config. Use `ignis login --config-url ...` or pass both --base-url and --token."
|
|
759
|
+
);
|
|
760
|
+
}
|
|
754
761
|
const config = await loadConfig();
|
|
755
762
|
const nextConfig = {
|
|
756
763
|
...config,
|
|
757
|
-
baseUrl:
|
|
758
|
-
cliToken:
|
|
764
|
+
baseUrl: resolvedBaseUrl,
|
|
765
|
+
cliToken: resolvedToken
|
|
759
766
|
};
|
|
760
767
|
await saveConfig(nextConfig);
|
|
761
768
|
if (options.json) {
|
|
762
769
|
printJson({
|
|
763
770
|
ok: true,
|
|
764
771
|
config_path: getConfigPath(),
|
|
765
|
-
base_url: nextConfig.baseUrl
|
|
772
|
+
base_url: nextConfig.baseUrl,
|
|
773
|
+
source: remoteConfig ? "config_url" : "direct"
|
|
766
774
|
});
|
|
767
775
|
} else {
|
|
768
776
|
printLoginHuman(getConfigPath());
|
|
@@ -772,6 +780,23 @@ function buildLoginCommand() {
|
|
|
772
780
|
);
|
|
773
781
|
return command;
|
|
774
782
|
}
|
|
783
|
+
async function fetchRemoteConfig(configUrl) {
|
|
784
|
+
const response = await fetch(configUrl, {
|
|
785
|
+
headers: {
|
|
786
|
+
Accept: "application/json, text/plain;q=0.9, */*;q=0.8"
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
if (!response.ok) {
|
|
790
|
+
throw new Error(`Failed to fetch config URL: ${response.status} ${response.statusText}`);
|
|
791
|
+
}
|
|
792
|
+
const payload = await response.json();
|
|
793
|
+
const baseUrl = String(payload.baseUrl || payload.base_url || "").trim().replace(/\/+$/, "");
|
|
794
|
+
const cliToken = String(payload.cliToken || payload.cli_token || "").trim();
|
|
795
|
+
if (!baseUrl || !cliToken) {
|
|
796
|
+
throw new Error("Config URL response must include baseUrl/base_url and cliToken/cli_token");
|
|
797
|
+
}
|
|
798
|
+
return { baseUrl, cliToken };
|
|
799
|
+
}
|
|
775
800
|
|
|
776
801
|
// src/commands/result.ts
|
|
777
802
|
import { Command as Command6, Option as Option4 } from "commander";
|
|
@@ -947,7 +972,7 @@ function buildWaitCommand() {
|
|
|
947
972
|
|
|
948
973
|
// src/index.ts
|
|
949
974
|
var program = new Command11();
|
|
950
|
-
program.name("ignis").description("Ignis CLI for Ultra-Mai").version("0.1.
|
|
975
|
+
program.name("ignis").description("Ignis CLI for Ultra-Mai").version("0.1.2");
|
|
951
976
|
program.addCommand(buildLoginCommand());
|
|
952
977
|
program.addCommand(buildAskCommand());
|
|
953
978
|
program.addCommand(buildHistoryCommand());
|