ignis-agent-cli 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +2 -1
  2. package/dist/index.js +71 -37
  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
  `);
@@ -767,12 +773,39 @@ function buildLoginCommand() {
767
773
  return command;
768
774
  }
769
775
 
776
+ // src/commands/result.ts
777
+ import { Command as Command6, Option as Option4 } from "commander";
778
+ function buildResultCommand() {
779
+ const command = new Command6("result");
780
+ 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(
781
+ wrapCommand(async (turnId, options) => {
782
+ const { client, config } = await createClient(options);
783
+ const sessionId = options.session?.trim() || getSessionForContext(config);
784
+ let turn;
785
+ if (turnId?.trim()) {
786
+ turn = await client.getTurn(turnId.trim());
787
+ } else if (sessionId) {
788
+ turn = await client.getLatestSessionTurn(sessionId);
789
+ } else {
790
+ throw new IgnisCliError("No turn or session selected. Pass <turn-id>, --session, or run `ignis ask` in this directory first.");
791
+ }
792
+ if (options.json) {
793
+ printJson(turn);
794
+ } else {
795
+ printTurnHuman(turn);
796
+ }
797
+ return mapTurnSnapshotExitCode(turn.status);
798
+ })
799
+ );
800
+ return addRuntimeOptions(command);
801
+ }
802
+
770
803
  // src/commands/resume.ts
771
804
  import { readFile as readFile4 } from "fs/promises";
772
- import { Command as Command6, Option as Option4 } from "commander";
805
+ import { Command as Command7, Option as Option5 } from "commander";
773
806
  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(
807
+ const command = new Command7("resume");
808
+ 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
809
  wrapCommand(async (turnId, options) => {
777
810
  const { client } = await createClient(options);
778
811
  const response = await buildResumePayload(options);
@@ -828,13 +861,13 @@ async function parseJsonInput(value) {
828
861
  }
829
862
 
830
863
  // src/commands/skills.ts
831
- import { Command as Command7, Option as Option5 } from "commander";
864
+ import { Command as Command8, Option as Option6 } from "commander";
832
865
  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)));
866
+ const command = new Command8("skills");
867
+ 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
868
  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)));
869
+ const listCommand = new Command8("list");
870
+ 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
871
  addRuntimeOptions(listCommand);
839
872
  command.addCommand(listCommand);
840
873
  return command;
@@ -861,11 +894,30 @@ function toNonNegativeInt2(value, fallbackValue) {
861
894
  return parsed;
862
895
  }
863
896
 
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(
897
+ // src/commands/upload.ts
898
+ import { Command as Command9 } from "commander";
899
+ function buildUploadCommand() {
900
+ const command = new Command9("upload");
901
+ command.description("Upload a file and return its file_id").argument("<path>", "Local file path").action(
902
+ wrapCommand(async (filePath, options) => {
903
+ const { client } = await createClient(options);
904
+ const uploaded = await client.uploadFile(filePath);
905
+ if (options.json) {
906
+ printJson(uploaded);
907
+ } else {
908
+ printUploadHuman(uploaded);
909
+ }
910
+ return 0;
911
+ })
912
+ );
913
+ return addRuntimeOptions(command);
914
+ }
915
+
916
+ // src/commands/wait.ts
917
+ import { Command as Command10, Option as Option7 } from "commander";
918
+ function buildWaitCommand() {
919
+ const command = new Command10("wait");
920
+ 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
921
  wrapCommand(async (turnId, options) => {
870
922
  const { client, config } = await createClient(options);
871
923
  const sessionId = options.session?.trim() || getSessionForContext(config);
@@ -877,7 +929,7 @@ function buildStatusCommand() {
877
929
  } else {
878
930
  throw new IgnisCliError("No turn or session selected. Pass <turn-id>, --session, or run `ignis ask` in this directory first.");
879
931
  }
880
- if (options.wait && (turn.status === "running" || turn.status === "queued")) {
932
+ if (turn.status === "running" || turn.status === "queued") {
881
933
  turn = await client.waitForTurn(turn, {
882
934
  timeoutMs: Number.parseInt(options.timeoutMs, 10) || 3e5
883
935
  });
@@ -893,33 +945,15 @@ function buildStatusCommand() {
893
945
  return addRuntimeOptions(command);
894
946
  }
895
947
 
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
948
  // src/index.ts
916
- var program = new Command10();
917
- program.name("ignis").description("Ignis CLI for Ultra-Mai").version("0.1.0");
949
+ var program = new Command11();
950
+ program.name("ignis").description("Ignis CLI for Ultra-Mai").version("0.1.1");
918
951
  program.addCommand(buildLoginCommand());
919
952
  program.addCommand(buildAskCommand());
920
953
  program.addCommand(buildHistoryCommand());
921
954
  program.addCommand(buildSkillsCommand());
922
- program.addCommand(buildStatusCommand());
955
+ program.addCommand(buildResultCommand());
956
+ program.addCommand(buildWaitCommand());
923
957
  program.addCommand(buildResumeCommand());
924
958
  program.addCommand(buildCancelCommand());
925
959
  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.1",
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",