@vibedev-si/dsh-vibedev 0.2.6 → 0.3.0

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.
@@ -5,13 +5,21 @@
5
5
  * background job, so a task keeps being followed after its job is stopped and
6
6
  * after the host restarts.
7
7
  *
8
- * Money rules: a task record is removed only when the first submission was
9
- * refused outright, so nothing can exist under its key. Every answer that
10
- * leaves the outcome open (no answer, a gateway error, a 409) keeps the record,
11
- * and the same request is resent under the same key, which returns the
12
- * original task when there is one. A resend that is refused outright is
13
- * retried only briefly, so a refused request is not created later behind the
14
- * user's back.
8
+ * Money rules, and the rule that one operation creates at most one task:
9
+ *
10
+ * - A submission is settled by the gateway's structured verdict
11
+ * (`submission_state` and `retry_action`) first, and only by the HTTP status
12
+ * when it sends none. `rejected`/`retry_action: none` is final: the reason is
13
+ * saved and nothing is sent again — not by the tool, not by the background
14
+ * loop, not after a restart. `retryable` on its own never authorizes creating
15
+ * another task.
16
+ * - An unknown outcome keeps the record and settles it under the SAME key and
17
+ * the SAME body, which the gateway answers with the original task when there
18
+ * is one. A new key is minted only for a new request the user asks for.
19
+ * - Once a gateway task id is known the task is only polled; a failed poll
20
+ * never submits anything.
21
+ * - A refusal that left nothing under the key ends the record as failed with
22
+ * the gateway's own reason, so the person sees why.
15
23
  * @module dsh-vibedev/tasks/tracker
16
24
  */
17
25
  import type { GatewayHttp } from '../gateway/http.js';
@@ -27,13 +35,12 @@ export interface TrackerOptions {
27
35
  readonly sleep?: (ms: number, signal: AbortSignal) => Promise<void>;
28
36
  /** Give up on a task this long after it was created. Defaults to 3 hours. */
29
37
  readonly maxAgeMs?: number;
30
- /** An unconfirmed submission is resent until it is this old. Defaults to 5 minutes. */
31
- readonly resendWindowMs?: number;
32
38
  /**
33
- * A resend refused outright is retried until the task is this old, in case
34
- * an earlier attempt is still being created. Defaults to 3 minutes.
39
+ * How long an unconfirmed submission is reconciled under its own key before
40
+ * the task is given up. Defaults to 5 minutes: this settles what became of
41
+ * that one submission, it never creates another task.
35
42
  */
36
- readonly refusalGraceMs?: number;
43
+ readonly resendWindowMs?: number;
37
44
  /** Download attempts for a finished task before its links are reported instead. Defaults to 5. */
38
45
  readonly downloadAttempts?: number;
39
46
  /** The largest output downloaded. Defaults to 2 GiB. */
@@ -42,13 +49,34 @@ export interface TrackerOptions {
42
49
  readonly claimStaleMs?: number;
43
50
  }
44
51
  /**
45
- * Whether a failed submission may still have created the task: no answer, an
46
- * unreadable answer, a gateway error that is not "busy", or a 409 such as
47
- * `VIDEO_SUBMISSION_IN_PROGRESS` (an earlier attempt is still being submitted).
52
+ * How a failed submission may be taken further.
53
+ *
54
+ * - `rejected`: the request is refused for good (a parameter refusal, a
55
+ * provider-side rejection, a key conflict); nothing exists under the key and
56
+ * nothing may be created again for this operation.
57
+ * - `reconcile`: the outcome is unknown — the same key and the same body are
58
+ * sent again only to settle what became of that one submission. This never
59
+ * mints a new key and never asks the provider for a new task.
60
+ * - `wait`: nothing was created and the same request may be sent later (busy,
61
+ * rate limited, no balance); the key stays the same.
62
+ */
63
+ export type SubmissionRecovery = 'rejected' | 'reconcile' | 'wait';
64
+ /**
65
+ * What a failed submission means.
66
+ *
67
+ * The two STOP rules are read before anything that would keep the operation
68
+ * alive, so no verdict can talk the plugin into sending a refused request
69
+ * again: `retry_action: none` (the provider refused it) and
70
+ * `VIDEO_SUBMISSION_AMBIGUOUS` (the gateway's key answers this forever) end the
71
+ * operation even when the same answer also says the outcome is unknown.
72
+ *
73
+ * After those, the gateway's structured verdict decides, and only when it
74
+ * sends none do the HTTP status and the older codes. `retryable` says recovery
75
+ * is still needed; it never authorizes creating another task.
48
76
  * @param error - the failure.
49
- * @returns true when the same key should be sent again.
77
+ * @returns how it may be taken further.
50
78
  */
51
- export declare function outcomeUnknown(error: unknown): boolean;
79
+ export declare function submissionRecovery(error: unknown): SubmissionRecovery;
52
80
  /**
53
81
  * The live progress line of a running task.
54
82
  * @param task - the gateway's view.
@@ -122,6 +150,6 @@ export declare class TaskTracker {
122
150
  * shutdown mid-download throws, so the task stays open and is resumed.
123
151
  */
124
152
  private saveOutputs;
125
- /** Download one output: the authenticated `/content` route, then the gateway's no-login link. */
153
+ /** Use a returned signed URL verbatim and without the app token; old gateways without a URL use `/content`. */
126
154
  private fetchOutput;
127
155
  }
@@ -9,8 +9,6 @@ import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
9
9
  import type { CredentialChain } from '../auth/credentials.js';
10
10
  import type { PluginLogin } from '../auth/login.js';
11
11
  import type { MediaRuntime } from '../runtime.js';
12
- /** Where new users register. */
13
- export declare const REGISTER_URL = "https://vibedev.jzsaas.com";
14
12
  /**
15
13
  * Build the tool.
16
14
  * @param runtime - the media runtime.
@@ -58,7 +58,7 @@ export interface Submitted {
58
58
  /**
59
59
  * Submit a task and start its report. An unconfirmed submission is not an
60
60
  * error here: the agent must not resubmit it, so it is reported like any
61
- * other task while the tracker resends it under the same key.
61
+ * other task while the tracker settles that one submission under the same key.
62
62
  * @param runtime - the media runtime.
63
63
  * @param exec - the tool call.
64
64
  * @param draft - the task to submit.
@@ -78,12 +78,15 @@ export declare function checkReferenceFile(model: MediaModel, input: VideoInput,
78
78
  */
79
79
  export declare function referenceByteLimit(model: MediaModel, input: VideoInput): number;
80
80
  /**
81
- * Check reference video durations once the gateway has measured them.
81
+ * Check the measured lengths of the reference media once the gateway has
82
+ * measured them. A reference's OWN length is what is checked — never the
83
+ * requested output duration — and only against the limits that model declares.
82
84
  * @param model - the video model.
83
85
  * @param videos - the uploaded reference videos, in order.
86
+ * @param audios - the uploaded reference audios, in order.
84
87
  * @throws {@link MediaError} when a clip or the total is outside the model's limits.
85
88
  */
86
- export declare function checkReferenceDurations(model: MediaModel, videos: readonly ReferenceMedia[]): void;
89
+ export declare function checkReferenceDurations(model: MediaModel, videos: readonly ReferenceMedia[], audios?: readonly ReferenceMedia[]): void;
87
90
  /**
88
91
  * The `/v1/videos` body for a plan whose inputs are uploaded. The gateway reads
89
92
  * one vocabulary and translates it per provider.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedev-si/dsh-vibedev",
3
- "version": "0.2.6",
3
+ "version": "0.3.0",
4
4
  "description": "VibeDev 账号与模型:在 DeepSeek Harness 里登录 VibeDev,与 DeepSeek 账号并存,使用 VibeDev 网关的模型(Claude、GPT 等),并生成图片、视频、音乐和播客 · VibeDev account and models for DeepSeek Harness: sign in to VibeDev next to the DeepSeek account and use the VibeDev gateway's models (Claude, GPT and more), plus image, video, music and podcast generation",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",