ignis-agent-cli 0.1.0 → 0.1.2

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.
Files changed (3) hide show
  1. package/README.md +2 -1
  2. package/dist/index.js +72 -39
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -24,7 +24,8 @@ ignis ask --prompt-file prompt.md --attach image.png --json
24
24
  ignis ask --file-id image_123.png "继续分析这张图"
25
25
  ignis history
26
26
  ignis skills --query video
27
- ignis status <turn_id>
27
+ ignis result <turn_id>
28
+ ignis wait <turn_id>
28
29
  ignis resume <turn_id> --answer "继续"
29
30
  ignis cancel <turn_id>
30
31
  ignis upload ./demo.png
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { Command as Command10 } from "commander";
4
+ import { Command as Command11 } from "commander";
5
5
 
6
6
  // src/commands/ask.ts
7
7
  import { readFile as readFile3 } from "fs/promises";
@@ -530,6 +530,12 @@ function mapTurnExitCode(status) {
530
530
  }
531
531
  return 1;
532
532
  }
533
+ function mapTurnSnapshotExitCode(status) {
534
+ if (status === "queued" || status === "running") {
535
+ return 0;
536
+ }
537
+ return mapTurnExitCode(status);
538
+ }
533
539
  function printProgress(message) {
534
540
  process.stderr.write(`${message}
535
541
  `);
@@ -582,7 +588,7 @@ function inferExitCode(error) {
582
588
  // src/commands/ask.ts
583
589
  function buildAskCommand() {
584
590
  const command = new Command2("ask");
585
- 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("--skill <id>", "Skill ID").default("base")).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", () => {
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", () => {
586
592
  }).action(
587
593
  wrapCommand(async (messageArg, options) => {
588
594
  const message = await resolvePrompt(messageArg, options.promptFile);
@@ -605,7 +611,6 @@ function buildAskCommand() {
605
611
  message,
606
612
  file_ids: fileIds,
607
613
  agent: options.agent?.trim() || void 0,
608
- skill_id: options.skill,
609
614
  wait_ms: options.async ? 0 : toPositiveInt(options.waitMs, 25e3),
610
615
  idempotency_key: crypto.randomUUID()
611
616
  };
@@ -767,12 +772,39 @@ function buildLoginCommand() {
767
772
  return command;
768
773
  }
769
774
 
775
+ // src/commands/result.ts
776
+ import { Command as Command6, Option as Option4 } from "commander";
777
+ function buildResultCommand() {
778
+ const command = new Command6("result");
779
+ command.description("Fetch the current result snapshot for a turn or session").argument("[turn-id]", "Turn ID").addOption(new Option4("--session <id>", "Resolve the latest turn from a session")).action(
780
+ wrapCommand(async (turnId, options) => {
781
+ const { client, config } = await createClient(options);
782
+ const sessionId = options.session?.trim() || getSessionForContext(config);
783
+ let turn;
784
+ if (turnId?.trim()) {
785
+ turn = await client.getTurn(turnId.trim());
786
+ } else if (sessionId) {
787
+ turn = await client.getLatestSessionTurn(sessionId);
788
+ } else {
789
+ throw new IgnisCliError("No turn or session selected. Pass <turn-id>, --session, or run `ignis ask` in this directory first.");
790
+ }
791
+ if (options.json) {
792
+ printJson(turn);
793
+ } else {
794
+ printTurnHuman(turn);
795
+ }
796
+ return mapTurnSnapshotExitCode(turn.status);
797
+ })
798
+ );
799
+ return addRuntimeOptions(command);
800
+ }
801
+
770
802
  // src/commands/resume.ts
771
803
  import { readFile as readFile4 } from "fs/promises";
772
- import { Command as Command6, Option as Option4 } from "commander";
804
+ import { Command as Command7, Option as Option5 } from "commander";
773
805
  function buildResumeCommand() {
774
- const command = new Command6("resume");
775
- command.description("Resume an interrupted turn").argument("<turn-id>", "Interrupted turn ID").addOption(new Option4("--answer <text>", "Provide one answer value").default([], void 0).argParser(collectValues)).addOption(new Option4("--payload <json-or-@file>", "Raw resume payload JSON")).addOption(new Option4("--cancel", "Cancel the interrupted turn instead of answering")).addOption(new Option4("--async", "Return immediately after submission without polling")).addOption(new Option4("--wait-ms <ms>", "Per-request server wait window").default("25000")).addOption(new Option4("--timeout-ms <ms>", "Client-side polling timeout").default("300000")).action(
806
+ const command = new Command7("resume");
807
+ command.description("Resume an interrupted turn").argument("<turn-id>", "Interrupted turn ID").addOption(new Option5("--answer <text>", "Provide one answer value").default([], void 0).argParser(collectValues)).addOption(new Option5("--payload <json-or-@file>", "Raw resume payload JSON")).addOption(new Option5("--cancel", "Cancel the interrupted turn instead of answering")).addOption(new Option5("--async", "Return immediately after submission without polling")).addOption(new Option5("--wait-ms <ms>", "Per-request server wait window").default("25000")).addOption(new Option5("--timeout-ms <ms>", "Client-side polling timeout").default("300000")).action(
776
808
  wrapCommand(async (turnId, options) => {
777
809
  const { client } = await createClient(options);
778
810
  const response = await buildResumePayload(options);
@@ -828,13 +860,13 @@ async function parseJsonInput(value) {
828
860
  }
829
861
 
830
862
  // src/commands/skills.ts
831
- import { Command as Command7, Option as Option5 } from "commander";
863
+ import { Command as Command8, Option as Option6 } from "commander";
832
864
  function buildSkillsCommand() {
833
- const command = new Command7("skills");
834
- command.description("List/search available skills").addOption(new Option5("--query <text>", "Search skills by keyword").default("")).addOption(new Option5("--limit <n>", "Number of skills to fetch").default("50")).addOption(new Option5("--offset <n>", "Number of skills to skip").default("0")).action(wrapCommand(async (options) => handleSkillsList(options)));
865
+ const command = new Command8("skills");
866
+ command.description("List/search available skills").addOption(new Option6("--query <text>", "Search skills by keyword").default("")).addOption(new Option6("--limit <n>", "Number of skills to fetch").default("50")).addOption(new Option6("--offset <n>", "Number of skills to skip").default("0")).action(wrapCommand(async (options) => handleSkillsList(options)));
835
867
  addRuntimeOptions(command);
836
- const listCommand = new Command7("list");
837
- listCommand.description("List/search available skills").addOption(new Option5("--query <text>", "Search skills by keyword").default("")).addOption(new Option5("--limit <n>", "Number of skills to fetch").default("50")).addOption(new Option5("--offset <n>", "Number of skills to skip").default("0")).action(wrapCommand(async (options) => handleSkillsList(options)));
868
+ const listCommand = new Command8("list");
869
+ listCommand.description("List/search available skills").addOption(new Option6("--query <text>", "Search skills by keyword").default("")).addOption(new Option6("--limit <n>", "Number of skills to fetch").default("50")).addOption(new Option6("--offset <n>", "Number of skills to skip").default("0")).action(wrapCommand(async (options) => handleSkillsList(options)));
838
870
  addRuntimeOptions(listCommand);
839
871
  command.addCommand(listCommand);
840
872
  return command;
@@ -861,11 +893,30 @@ function toNonNegativeInt2(value, fallbackValue) {
861
893
  return parsed;
862
894
  }
863
895
 
864
- // src/commands/status.ts
865
- import { Command as Command8, Option as Option6 } from "commander";
866
- function buildStatusCommand() {
867
- const command = new Command8("status");
868
- command.description("Fetch the latest state of a turn or session").argument("[turn-id]", "Turn ID").addOption(new Option6("--session <id>", "Resolve the latest turn from a session")).addOption(new Option6("--wait", "Poll until terminal state")).addOption(new Option6("--timeout-ms <ms>", "Client-side polling timeout").default("300000")).action(
896
+ // src/commands/upload.ts
897
+ import { Command as Command9 } from "commander";
898
+ function buildUploadCommand() {
899
+ const command = new Command9("upload");
900
+ command.description("Upload a file and return its file_id").argument("<path>", "Local file path").action(
901
+ wrapCommand(async (filePath, options) => {
902
+ const { client } = await createClient(options);
903
+ const uploaded = await client.uploadFile(filePath);
904
+ if (options.json) {
905
+ printJson(uploaded);
906
+ } else {
907
+ printUploadHuman(uploaded);
908
+ }
909
+ return 0;
910
+ })
911
+ );
912
+ return addRuntimeOptions(command);
913
+ }
914
+
915
+ // src/commands/wait.ts
916
+ import { Command as Command10, Option as Option7 } from "commander";
917
+ function buildWaitCommand() {
918
+ const command = new Command10("wait");
919
+ command.description("Wait until a turn reaches a terminal state").argument("[turn-id]", "Turn ID").addOption(new Option7("--session <id>", "Resolve the latest turn from a session")).addOption(new Option7("--timeout-ms <ms>", "Client-side polling timeout").default("300000")).action(
869
920
  wrapCommand(async (turnId, options) => {
870
921
  const { client, config } = await createClient(options);
871
922
  const sessionId = options.session?.trim() || getSessionForContext(config);
@@ -877,7 +928,7 @@ function buildStatusCommand() {
877
928
  } else {
878
929
  throw new IgnisCliError("No turn or session selected. Pass <turn-id>, --session, or run `ignis ask` in this directory first.");
879
930
  }
880
- if (options.wait && (turn.status === "running" || turn.status === "queued")) {
931
+ if (turn.status === "running" || turn.status === "queued") {
881
932
  turn = await client.waitForTurn(turn, {
882
933
  timeoutMs: Number.parseInt(options.timeoutMs, 10) || 3e5
883
934
  });
@@ -893,33 +944,15 @@ function buildStatusCommand() {
893
944
  return addRuntimeOptions(command);
894
945
  }
895
946
 
896
- // src/commands/upload.ts
897
- import { Command as Command9 } from "commander";
898
- function buildUploadCommand() {
899
- const command = new Command9("upload");
900
- command.description("Upload a file and return its file_id").argument("<path>", "Local file path").action(
901
- wrapCommand(async (filePath, options) => {
902
- const { client } = await createClient(options);
903
- const uploaded = await client.uploadFile(filePath);
904
- if (options.json) {
905
- printJson(uploaded);
906
- } else {
907
- printUploadHuman(uploaded);
908
- }
909
- return 0;
910
- })
911
- );
912
- return addRuntimeOptions(command);
913
- }
914
-
915
947
  // src/index.ts
916
- var program = new Command10();
917
- program.name("ignis").description("Ignis CLI for Ultra-Mai").version("0.1.0");
948
+ var program = new Command11();
949
+ program.name("ignis").description("Ignis CLI for Ultra-Mai").version("0.1.1");
918
950
  program.addCommand(buildLoginCommand());
919
951
  program.addCommand(buildAskCommand());
920
952
  program.addCommand(buildHistoryCommand());
921
953
  program.addCommand(buildSkillsCommand());
922
- program.addCommand(buildStatusCommand());
954
+ program.addCommand(buildResultCommand());
955
+ program.addCommand(buildWaitCommand());
923
956
  program.addCommand(buildResumeCommand());
924
957
  program.addCommand(buildCancelCommand());
925
958
  program.addCommand(buildUploadCommand());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ignis-agent-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Stateless CLI for the Ultra-Mai Agent V2 service",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -11,7 +11,7 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/adtech-crypto/mai-2-tmp/issues"
13
13
  },
14
- "homepage": "https://github.com/adtech-crypto/mai-2-tmp/tree/test/ignis",
14
+ "homepage": "https://github.com/adtech-crypto/mai-2-tmp/tree/test/ignis-cli",
15
15
  "keywords": [
16
16
  "ignis",
17
17
  "cli",