maoda-commander-tt 0.0.30 → 0.0.37

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/main.js CHANGED
@@ -3563,10 +3563,11 @@ var XyqSession = class {
3563
3563
  threadId,
3564
3564
  serverRunId ?? requestedRunId
3565
3565
  );
3566
- const state = mapVideoRunState(toNumber(runRecord.state));
3567
- const retryAfterSeconds = isTerminalVideoState(state) ? 0 : resolveRetryAfterSeconds(queueInfo ?? runRecord.RunQueueInfo);
3568
3566
  const entryList = Array.isArray(runRecord.entry_list) ? runRecord.entry_list : [];
3569
3567
  const artifacts = entryList.map(extractVideoArtifact).filter((artifact) => artifact !== void 0);
3568
+ const providerState = mapVideoRunState(toNumber(runRecord.state));
3569
+ const state = hasUsableVideoOutput(artifacts) ? "completed" : providerState;
3570
+ const retryAfterSeconds = isTerminalVideoState(state) ? 0 : resolveRetryAfterSeconds(queueInfo ?? runRecord.RunQueueInfo);
3570
3571
  return ok20({
3571
3572
  taskId: createXyqTaskId(threadId),
3572
3573
  threadId,
@@ -3928,6 +3929,9 @@ function mapVideoRunState(stateCode) {
3928
3929
  function isTerminalVideoState(state) {
3929
3930
  return ["completed", "failed", "canceled", "inputRequired"].includes(state);
3930
3931
  }
3932
+ function hasUsableVideoOutput(artifacts) {
3933
+ return artifacts.some((artifact) => artifact.videos.length > 0);
3934
+ }
3931
3935
  function extractVideoArtifact(entry) {
3932
3936
  if (!isRecord2(entry)) {
3933
3937
  return void 0;
@@ -4932,6 +4936,10 @@ async function runVideoTaskToCompletion(options) {
4932
4936
  // src/commands/ai/ai-video-wait-command.ts
4933
4937
  import { Option as Option9 } from "commander";
4934
4938
  var AiVideoWaitCommand = class extends AiBaseCommand {
4939
+ constructor(_runVideoTask = runVideoTaskToCompletion) {
4940
+ super();
4941
+ this._runVideoTask = _runVideoTask;
4942
+ }
4935
4943
  _meta() {
4936
4944
  return {
4937
4945
  name: "wait",
@@ -4956,10 +4964,11 @@ var AiVideoWaitCommand = class extends AiBaseCommand {
4956
4964
  );
4957
4965
  }
4958
4966
  async _execute(ctx) {
4959
- const result = await runVideoTaskToCompletion({
4960
- taskId: ctx.options.taskId,
4961
- timeoutSeconds: ctx.options.timeoutSeconds,
4962
- outputPath: ctx.options.output
4967
+ const options = ctx.command.optsWithGlobals();
4968
+ const result = await this._runVideoTask({
4969
+ taskId: options.taskId,
4970
+ timeoutSeconds: options.timeoutSeconds,
4971
+ outputPath: options.output
4963
4972
  });
4964
4973
  if (!result.ok) {
4965
4974
  this._outputJsonError(result.code, result.msg);