@vibedev-si/dsh-vibedev 0.3.11 → 0.5.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.
- package/README.md +193 -10
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/client/client.account-center.js +13555 -0
- package/client/client.js +3503 -878
- package/cordis.patch.yml +5 -0
- package/lib/account/center-business-contract.d.ts +22 -0
- package/lib/account/center-business.d.ts +6 -0
- package/lib/account/center-contract.d.ts +12 -0
- package/lib/account/center-monitor-contract.d.ts +10 -0
- package/lib/account/center-price-contract.d.ts +5 -0
- package/lib/account/center.d.ts +7 -0
- package/lib/account/index.d.ts +14 -0
- package/lib/{anthropic-messages-BgIfgjNt.js → anthropic-messages-QcnVMGaA.js} +11 -11
- package/lib/contract-v1.types.d.ts +134 -0
- package/lib/contracts.d.ts +34 -0
- package/lib/fetch/host-web.d.ts +34 -0
- package/lib/fetch/provider.d.ts +125 -0
- package/lib/fetch/wiring.d.ts +124 -0
- package/lib/gateway/errors.d.ts +29 -1
- package/lib/gateway/http.d.ts +24 -0
- package/lib/host-locales.d.ts +4 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.js +3630 -505
- package/lib/{node-D58f7Ea6.js → node-CcLPV4RA.js} +4 -4
- package/lib/{node-Br-0fshF.js → node-vkDR3GtK.js} +2 -2
- package/lib/pricing.d.ts +21 -1
- package/lib/search/provider.d.ts +28 -5
- package/lib/service.d.ts +36 -9
- package/lib/tasks/remote.d.ts +4 -4
- package/lib/tasks/store.d.ts +54 -9
- package/lib/tasks/tracker.d.ts +45 -45
- package/lib/tools/image.d.ts +1 -0
- package/lib/tools/video.d.ts +3 -0
- package/lib/util/files.d.ts +2 -0
- package/locale/en.json +13 -0
- package/locale/zh.json +13 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/LICENSE +22 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/README.md +154 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/catalog/catalog.json +167 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/catalog-updates.js +326 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/catalog-validator.js +263 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/client.js +2816 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/cordis.patch.yml +5 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/icon.svg +5 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/index.js +169 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/locale/en.json +6 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/locale/zh.json +6 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/package.json +75 -0
- package/node_modules/@vibedev-si/dsh-ecosystem/remote-catalog.js +212 -0
- package/package.json +41 -24
- package/scripts/verify-fetch-joint.mjs +72 -0
package/cordis.patch.yml
CHANGED
|
@@ -3,3 +3,8 @@
|
|
|
3
3
|
- insert:
|
|
4
4
|
- id: dsh-vibedev
|
|
5
5
|
name: '@vibedev-si/dsh-vibedev'
|
|
6
|
+
# An explicit ecosystem row (including a disabled one) owns its configuration.
|
|
7
|
+
# Read full group data so the result does not depend on plugin load order.
|
|
8
|
+
- id: vibedev-ecosystem-companion
|
|
9
|
+
name: '@vibedev-si/dsh-ecosystem'
|
|
10
|
+
disabled: !!js "!!ctx.get('loader') && [...ctx.get('loader').entries()].some(entry => { const contains = rows => rows.some(row => row.id !== 'vibedev-ecosystem-companion' && row.name === '@vibedev-si/dsh-ecosystem' || row.group && Array.isArray(row.config) && contains(row.config)); return contains(entry.parent.data); })"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Fixed native account reads/actions; no renderer-selected URL or method. */
|
|
2
|
+
export declare const BUSINESS_READ_PATHS: readonly ["payment/config", "payment/checkout-info", "payment/plans", "payment/limits", "payment/orders/my", "payment/orders/detail", "payment/orders/refund-eligible-providers", "redeem/history", "affiliate", "affiliate/program", "affiliate/consumption-rules", "affiliate/consumption", "profile", "actions/status"];
|
|
3
|
+
export type BusinessReadPath = typeof BUSINESS_READ_PATHS[number];
|
|
4
|
+
export declare const BUSINESS_ACTIONS: readonly ["payment/create", "payment/cancel", "payment/refund", "payment/verify", "redeem/apply", "affiliate/refresh", "affiliate/transfer", "profile/update"];
|
|
5
|
+
export type BusinessActionKind = typeof BUSINESS_ACTIONS[number];
|
|
6
|
+
export interface ParsedBusinessAction {
|
|
7
|
+
wire: string;
|
|
8
|
+
method: 'POST' | 'PUT';
|
|
9
|
+
payload: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export declare const validOperationId: (value: unknown) => value is string;
|
|
12
|
+
/** HTTPS payment links are server-issued; QR payment schemes are never navigated automatically. */
|
|
13
|
+
export declare function safeBusinessUrl(value: unknown, qr?: boolean): string | undefined;
|
|
14
|
+
export declare function safeAvatarUrl(value: unknown): string | undefined;
|
|
15
|
+
export declare function businessQuery(path: BusinessReadPath, params: URLSearchParams): {
|
|
16
|
+
wire: string;
|
|
17
|
+
query: URLSearchParams;
|
|
18
|
+
fresh: boolean;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export declare function validateBusinessAction(kind: BusinessActionKind, body: unknown): ParsedBusinessAction | undefined;
|
|
21
|
+
export declare function projectBusinessRead(path: BusinessReadPath, value: unknown): unknown;
|
|
22
|
+
export declare function projectBusinessReceipt(value: unknown): unknown;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ConnectionFetchRoute } from '@deepseek-ai/dsh-client-connection';
|
|
2
|
+
import type { AccountService } from './index.js';
|
|
3
|
+
import type { GatewayHttp } from '../gateway/http.js';
|
|
4
|
+
/** The buffered wire body must be unambiguous before it is canonicalized and fingerprinted. */
|
|
5
|
+
export declare function uniqueBusinessJson(raw: string): unknown;
|
|
6
|
+
export declare function accountBusinessActionsRoutes(http: GatewayHttp, account: AccountService): ConnectionFetchRoute[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const CENTER_READ_PATHS: readonly ["auth/me", "usage", "usage/dashboard/stats", "usage/dashboard/trend", "usage/dashboard/models", "subscriptions/summary", "entitlements", "usage/stats", "usage/details", "usage/errors", "usage/errors/detail", "usage/dashboard/snapshot-v2", "groups/available", "user/platform-quotas", "subscriptions", "subscriptions/progress", "model-plaza", "channel-monitor-v2/dimensions", "channel-monitor-v2/snapshot", "channel-monitor-v2/models", "channel-monitor-v2/matrix", "channel-monitor-v2/errors", "channel-monitors/status", "channel-monitors/detail", "payment/config", "payment/checkout-info", "payment/plans", "payment/limits", "payment/orders/my", "payment/orders/detail", "payment/orders/refund-eligible-providers", "redeem/history", "affiliate", "affiliate/program", "affiliate/consumption-rules", "affiliate/consumption", "profile", "actions/status"];
|
|
2
|
+
export type CenterReadPath = typeof CENTER_READ_PATHS[number];
|
|
3
|
+
export declare function positiveCenterId(value: string): boolean;
|
|
4
|
+
/** Returns undefined for any unsupported/duplicate/invalid parameter. */
|
|
5
|
+
export declare function centerQuery(path: CenterReadPath, params: URLSearchParams): {
|
|
6
|
+
wire: string;
|
|
7
|
+
query: URLSearchParams;
|
|
8
|
+
fresh: boolean;
|
|
9
|
+
} | undefined;
|
|
10
|
+
/** Legacy summary only: monetary weekly fields become a percentage, never a five-hour window. */
|
|
11
|
+
export declare function projectAccountData(value: unknown): unknown;
|
|
12
|
+
export declare function projectCenterRoute(path: CenterReadPath, value: unknown): unknown;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Fixed, authenticated monitor reads. This projection also protects admin AppTokens. */
|
|
2
|
+
export declare const MONITOR_READ_PATHS: readonly ["channel-monitor-v2/dimensions", "channel-monitor-v2/snapshot", "channel-monitor-v2/models", "channel-monitor-v2/matrix", "channel-monitor-v2/errors", "channel-monitors/status", "channel-monitors/detail"];
|
|
3
|
+
export type MonitorReadPath = typeof MONITOR_READ_PATHS[number];
|
|
4
|
+
export declare function projectMonitorRoute(path: string, value: unknown): unknown;
|
|
5
|
+
/** Repeated dimensions are retained; scalar duplicates and caller-selected scopes fail closed. */
|
|
6
|
+
export declare function validateMonitorQuery(path: string, params: URLSearchParams): {
|
|
7
|
+
wire: string;
|
|
8
|
+
query: URLSearchParams;
|
|
9
|
+
fresh: boolean;
|
|
10
|
+
} | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Only public DNS HTTPS references become navigable links. No credentials, IPs or local hosts. */
|
|
2
|
+
export declare function publicReferenceUrl(value: unknown): string | undefined;
|
|
3
|
+
export declare function projectModelPlaza(value: unknown): unknown;
|
|
4
|
+
/** Duplicate, unknown, identity and unbounded catalog filters fail closed. */
|
|
5
|
+
export declare function validateModelPlazaQuery(params: URLSearchParams): URLSearchParams | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Read-only, field-allowlisted Host bridge. Credentials never enter the client response. */
|
|
2
|
+
import type { ConnectionFetchRoute } from '@deepseek-ai/dsh-client-connection';
|
|
3
|
+
import type { AccountService } from './index.js';
|
|
4
|
+
import type { GatewayHttp } from '../gateway/http.js';
|
|
5
|
+
export { CENTER_READ_PATHS, projectAccountData } from './center-contract.js';
|
|
6
|
+
export declare const CENTER_PREFIX = "/api/dsh-vibedev/account-center";
|
|
7
|
+
export declare function accountCenterRoutes(http: GatewayHttp, account: AccountService): ConnectionFetchRoute[];
|
package/lib/account/index.d.ts
CHANGED
|
@@ -28,12 +28,19 @@ import type { ConnectionFetchRoute } from '@deepseek-ai/dsh-client-connection';
|
|
|
28
28
|
import type { CredentialChain } from '../auth/credentials.js';
|
|
29
29
|
import type { PluginLogin, SignInAttempt } from '../auth/login.js';
|
|
30
30
|
import type { GatewayCredential } from '../gateway/http.js';
|
|
31
|
+
import type { AccountCenterPage } from '../contracts.js';
|
|
31
32
|
/** Path prefix of the plugin's Host routes. */
|
|
32
33
|
export declare const ACCOUNT_ROUTE_PREFIX = "/api/dsh-vibedev/account";
|
|
33
34
|
/** Where the active credential comes from. */
|
|
34
35
|
export type AccountSource = 'host' | 'plugin' | 'key' | 'none';
|
|
35
36
|
/** What the account pages render. */
|
|
36
37
|
export interface AccountView {
|
|
38
|
+
readonly accountCenter?: {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly page: AccountCenterPage;
|
|
41
|
+
readonly revision: number;
|
|
42
|
+
readonly expiresAt: number;
|
|
43
|
+
};
|
|
37
44
|
readonly source: AccountSource;
|
|
38
45
|
/** The signed-in person, when known. */
|
|
39
46
|
readonly user?: {
|
|
@@ -111,6 +118,9 @@ export interface AccountServiceOptions {
|
|
|
111
118
|
readonly refreshCatalog?: () => Promise<void>;
|
|
112
119
|
/** Present the VibeDev account as the app's main account. */
|
|
113
120
|
readonly primary?: boolean;
|
|
121
|
+
/** A stable user became known after startup or an account change. */
|
|
122
|
+
readonly identityAvailable?: (userId: string) => void;
|
|
123
|
+
readonly identityInvalidated?: () => void;
|
|
114
124
|
readonly fetch?: typeof globalThis.fetch;
|
|
115
125
|
readonly now?: () => number;
|
|
116
126
|
/** Timer seams for the reads after a charge and the long poll. */
|
|
@@ -120,6 +130,10 @@ export interface AccountServiceOptions {
|
|
|
120
130
|
/** The account state behind the pages. */
|
|
121
131
|
export declare class AccountService {
|
|
122
132
|
private readonly options;
|
|
133
|
+
private announcedUserId?;
|
|
134
|
+
private navigation;
|
|
135
|
+
openAccountCenter(page?: AccountCenterPage): void;
|
|
136
|
+
consumeNavigation(id: string): boolean;
|
|
123
137
|
private balanceCache;
|
|
124
138
|
/** A background read of a stale balance, so only one runs at a time. */
|
|
125
139
|
private revalidating;
|
|
@@ -798,7 +798,7 @@ function redactSensitive(body) {
|
|
|
798
798
|
*/
|
|
799
799
|
async function checkCredentialsFileSafety(path, onWarn = (m) => console.warn(`anthropic-sdk: ${m}`)) {
|
|
800
800
|
if (typeof process === "undefined" || process.platform === "win32") return;
|
|
801
|
-
const { fs } = await import("./node-
|
|
801
|
+
const { fs } = await import("./node-vkDR3GtK.js").then((n) => n.i);
|
|
802
802
|
let resolved = path;
|
|
803
803
|
let st;
|
|
804
804
|
try {
|
|
@@ -818,7 +818,7 @@ async function checkCredentialsFileSafety(path, onWarn = (m) => console.warn(`an
|
|
|
818
818
|
* Creates the parent directory with mode 0700 and the file with mode 0600.
|
|
819
819
|
*/
|
|
820
820
|
async function writeCredentialsFileAtomic(targetPath, data) {
|
|
821
|
-
const { fs, path } = await import("./node-
|
|
821
|
+
const { fs, path } = await import("./node-vkDR3GtK.js").then((n) => n.i);
|
|
822
822
|
const dir = path.dirname(targetPath);
|
|
823
823
|
await fs.promises.mkdir(dir, {
|
|
824
824
|
recursive: true,
|
|
@@ -1128,7 +1128,7 @@ const loadConfigWithSource = async (profile) => {
|
|
|
1128
1128
|
const profileName = profile ?? await getActiveProfileName();
|
|
1129
1129
|
if (profileName === null) return null;
|
|
1130
1130
|
validateProfileName(profileName);
|
|
1131
|
-
const { fs, path } = await import("./node-
|
|
1131
|
+
const { fs, path } = await import("./node-vkDR3GtK.js").then((n) => n.i);
|
|
1132
1132
|
const configPath = path.join(rootConfigPath, "configs", `${profileName}.json`);
|
|
1133
1133
|
let configRaw;
|
|
1134
1134
|
try {
|
|
@@ -1205,12 +1205,12 @@ const getCredentialsPath = async (config, profile) => {
|
|
|
1205
1205
|
const profileName = profile ?? await getActiveProfileName();
|
|
1206
1206
|
if (!profileName) return null;
|
|
1207
1207
|
validateProfileName(profileName);
|
|
1208
|
-
const { path } = await import("./node-
|
|
1208
|
+
const { path } = await import("./node-vkDR3GtK.js").then((n) => n.i);
|
|
1209
1209
|
return path.join(rootConfigPath, "credentials", `${profileName}.json`);
|
|
1210
1210
|
};
|
|
1211
1211
|
const getRootConfigPath = async () => {
|
|
1212
1212
|
if (!supportsLocalConfigFiles()) return null;
|
|
1213
|
-
const { path } = await import("./node-
|
|
1213
|
+
const { path } = await import("./node-vkDR3GtK.js").then((n) => n.i);
|
|
1214
1214
|
const configDir = readEnv("ANTHROPIC_CONFIG_DIR");
|
|
1215
1215
|
if (configDir) return configDir;
|
|
1216
1216
|
if (getPlatformHeaders()["X-Stainless-OS"] === "Windows") {
|
|
@@ -1235,7 +1235,7 @@ const getActiveProfileName = async () => {
|
|
|
1235
1235
|
if (!rootConfigPath) return null;
|
|
1236
1236
|
const profileName = readEnv("ANTHROPIC_PROFILE");
|
|
1237
1237
|
if (profileName) return profileName;
|
|
1238
|
-
const { fs, path } = await import("./node-
|
|
1238
|
+
const { fs, path } = await import("./node-vkDR3GtK.js").then((n) => n.i);
|
|
1239
1239
|
const filePath = path.join(rootConfigPath, "active_config");
|
|
1240
1240
|
try {
|
|
1241
1241
|
return (await fs.promises.readFile(filePath, "utf-8")).trim() || "default";
|
|
@@ -1253,7 +1253,7 @@ const getActiveProfileName = async () => {
|
|
|
1253
1253
|
function identityTokenFromFile(path) {
|
|
1254
1254
|
if (!path) throw new AnthropicError("Identity token file path is empty");
|
|
1255
1255
|
return async () => {
|
|
1256
|
-
const { fs } = await import("./node-
|
|
1256
|
+
const { fs } = await import("./node-vkDR3GtK.js").then((n) => n.i);
|
|
1257
1257
|
let content;
|
|
1258
1258
|
try {
|
|
1259
1259
|
content = await fs.promises.readFile(path, "utf-8");
|
|
@@ -1341,7 +1341,7 @@ function oidcFederationProvider(config) {
|
|
|
1341
1341
|
*/
|
|
1342
1342
|
function userOAuthProvider(config) {
|
|
1343
1343
|
return async (opts) => {
|
|
1344
|
-
const { fs } = await import("./node-
|
|
1344
|
+
const { fs } = await import("./node-vkDR3GtK.js").then((n) => n.i);
|
|
1345
1345
|
await checkCredentialsFileSafety(config.credentialsPath, config.onSafetyWarning);
|
|
1346
1346
|
let raw;
|
|
1347
1347
|
try {
|
|
@@ -1518,7 +1518,7 @@ function resolveIdentityTokenProvider(auth) {
|
|
|
1518
1518
|
*/
|
|
1519
1519
|
function cachedExchangeProvider(exchange, credentialsPath, onCacheWriteError, onSafetyWarning) {
|
|
1520
1520
|
return async (opts) => {
|
|
1521
|
-
const { fs } = await import("./node-
|
|
1521
|
+
const { fs } = await import("./node-vkDR3GtK.js").then((n) => n.i);
|
|
1522
1522
|
await checkCredentialsFileSafety(credentialsPath, onSafetyWarning);
|
|
1523
1523
|
let existing;
|
|
1524
1524
|
try {
|
|
@@ -5211,7 +5211,7 @@ _EnvironmentWorker_signal = /* @__PURE__ */ new WeakMap(), _EnvironmentWorker_in
|
|
|
5211
5211
|
const ctrl = new AbortController();
|
|
5212
5212
|
const detachExternal = linkAbort(externalSignal, ctrl);
|
|
5213
5213
|
const lease = new Lease(ctrl);
|
|
5214
|
-
const agentToolset = await import("./node-
|
|
5214
|
+
const agentToolset = await import("./node-CcLPV4RA.js");
|
|
5215
5215
|
let leaseTtlMs;
|
|
5216
5216
|
let runner;
|
|
5217
5217
|
const heartbeatPromise = heartbeatLoop(sessionClient, work, lease, log, this.requestOptions, (ttlMs) => {
|
|
@@ -13469,4 +13469,4 @@ function mapStopReason(reason, stopDetails) {
|
|
|
13469
13469
|
//#endregion
|
|
13470
13470
|
export { checkMemorySyncInterval as a, decodeUTF8 as c, AnthropicError as d, __classPrivateFieldGet as f, MIN_MEMORY_SYNC_INTERVAL_MS as i, encodeUTF8 as l, promiseWithResolvers as n, isStatus as o, __classPrivateFieldSet as p, DEFAULT_MEMORY_SYNC_INTERVAL_MS as r, loggerFor as s, stream, streamSimple, anthropic_messages_exports as t, ToolError as u };
|
|
13471
13471
|
|
|
13472
|
-
//# sourceMappingURL=anthropic-messages-
|
|
13472
|
+
//# sourceMappingURL=anthropic-messages-QcnVMGaA.js.map
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/** Wire types for CONTRACT-V1.md. Synthetic fixtures are not live capabilities. */
|
|
2
|
+
export type Capability = 'errors-v1' | 'account-center-read-v1' | 'account-center-write-v1' | 'web-session-v1' | 'media-quotes-v1' | 'image-idempotency-v1' | 'subscription-billing-v1';
|
|
3
|
+
export type DecimalAmount = string;
|
|
4
|
+
export type ErrorCategory = 'authentication' | 'access_restricted' | 'billing' | 'model_unavailable' | 'invalid_input' | 'content_rejected' | 'rate_limited' | 'service_unavailable' | 'submission_uncertain' | 'internal_error';
|
|
5
|
+
export type Stage = 'auth' | 'catalog' | 'quote' | 'upload' | 'submit' | 'poll' | 'generation' | 'download' | 'settle';
|
|
6
|
+
export type SubmissionState = 'not_submitted' | 'submitting' | 'accepted' | 'unknown' | 'rejected';
|
|
7
|
+
export type BillingState = 'not_charged' | 'reserved' | 'settled' | 'released' | 'unknown';
|
|
8
|
+
export type RetryAction = 'none' | 'retry_same_key' | 'reconcile' | 'poll' | 'download' | 'modify_input' | 'reauthenticate';
|
|
9
|
+
export interface GatewayError {
|
|
10
|
+
type: string;
|
|
11
|
+
code: string;
|
|
12
|
+
gateway_code: string;
|
|
13
|
+
category: ErrorCategory;
|
|
14
|
+
message: string;
|
|
15
|
+
stage: Stage;
|
|
16
|
+
request_id: string;
|
|
17
|
+
task_id: string | null;
|
|
18
|
+
operation_id?: string;
|
|
19
|
+
retryable: boolean;
|
|
20
|
+
retry_action: RetryAction;
|
|
21
|
+
retry_after_seconds?: number | null;
|
|
22
|
+
submission_state: SubmissionState;
|
|
23
|
+
billing_state: BillingState;
|
|
24
|
+
}
|
|
25
|
+
export interface Envelope<T> {
|
|
26
|
+
code: 0;
|
|
27
|
+
message: string;
|
|
28
|
+
data: T;
|
|
29
|
+
}
|
|
30
|
+
export interface Balance {
|
|
31
|
+
currency: 'CNY';
|
|
32
|
+
available_amount: DecimalAmount;
|
|
33
|
+
frozen_amount: DecimalAmount;
|
|
34
|
+
total_amount: DecimalAmount;
|
|
35
|
+
}
|
|
36
|
+
export interface QuotaWindow {
|
|
37
|
+
state: 'available' | 'exhausted' | 'unlimited' | 'not_started';
|
|
38
|
+
remaining_percent: number | null;
|
|
39
|
+
resets_at: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface Subscription {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
status: 'active' | 'expired' | 'revoked' | 'pending';
|
|
45
|
+
expires_at: string | null;
|
|
46
|
+
priority: number;
|
|
47
|
+
windows: {
|
|
48
|
+
five_hour: QuotaWindow;
|
|
49
|
+
seven_day: QuotaWindow;
|
|
50
|
+
};
|
|
51
|
+
usable: boolean;
|
|
52
|
+
blocking_reasons: {
|
|
53
|
+
code: string;
|
|
54
|
+
window?: string;
|
|
55
|
+
retry_at?: string | null;
|
|
56
|
+
}[];
|
|
57
|
+
}
|
|
58
|
+
export interface AccountFeatures {
|
|
59
|
+
available_channels: boolean;
|
|
60
|
+
channel_status: boolean;
|
|
61
|
+
model_prices?: boolean;
|
|
62
|
+
recharge: boolean;
|
|
63
|
+
redeem: boolean;
|
|
64
|
+
affiliate: boolean;
|
|
65
|
+
profile: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface Entitlements {
|
|
68
|
+
contract_version: '1.0';
|
|
69
|
+
revision: string;
|
|
70
|
+
server_time: string;
|
|
71
|
+
capabilities: Capability[];
|
|
72
|
+
balance: Balance;
|
|
73
|
+
subscriptions: Subscription[];
|
|
74
|
+
features: AccountFeatures;
|
|
75
|
+
subscription_billing_enabled: boolean;
|
|
76
|
+
subscription_snapshot_available: boolean;
|
|
77
|
+
}
|
|
78
|
+
export type AccountPage = 'dashboard' | 'usage' | 'subscriptions' | 'available_channels' | 'channel_status' | 'model_prices' | 'recharge' | 'orders' | 'redeem' | 'affiliate' | 'profile';
|
|
79
|
+
export interface MediaAccountContext {
|
|
80
|
+
gatewayOrigin: string;
|
|
81
|
+
userId?: string;
|
|
82
|
+
revision?: string;
|
|
83
|
+
signedIn: boolean;
|
|
84
|
+
}
|
|
85
|
+
export type MediaKind = 'video' | 'audio' | 'image';
|
|
86
|
+
export interface BillingSource {
|
|
87
|
+
kind: 'subscription' | 'balance';
|
|
88
|
+
subscription_id: string | null;
|
|
89
|
+
}
|
|
90
|
+
export interface VideoQuoteRequest {
|
|
91
|
+
kind: 'video';
|
|
92
|
+
model: string;
|
|
93
|
+
operation_id: string;
|
|
94
|
+
parameters: {
|
|
95
|
+
mode: string;
|
|
96
|
+
duration_seconds: number;
|
|
97
|
+
resolution: string;
|
|
98
|
+
ratio: string;
|
|
99
|
+
generate_audio?: boolean;
|
|
100
|
+
reference_image_count?: number;
|
|
101
|
+
reference_video_seconds?: number;
|
|
102
|
+
reference_audio_seconds?: number;
|
|
103
|
+
};
|
|
104
|
+
preferred_billing_source?: BillingSource | null;
|
|
105
|
+
}
|
|
106
|
+
export interface MediaQuote {
|
|
107
|
+
object: 'media.quote';
|
|
108
|
+
quote_id: string;
|
|
109
|
+
operation_id: string;
|
|
110
|
+
kind: MediaKind;
|
|
111
|
+
model: string;
|
|
112
|
+
currency: 'CNY';
|
|
113
|
+
estimated_amount: DecimalAmount;
|
|
114
|
+
reservation_amount: DecimalAmount | null;
|
|
115
|
+
unit: 'token_million' | 'video_token_million' | 'output_second' | 'original_audio_second' | 'image' | 'request';
|
|
116
|
+
unit_price: DecimalAmount;
|
|
117
|
+
basis: Record<string, string | number | boolean | null>;
|
|
118
|
+
billing_source: BillingSource;
|
|
119
|
+
pricing_version: string;
|
|
120
|
+
expires_at: string;
|
|
121
|
+
is_estimate: boolean;
|
|
122
|
+
final_usage_basis: 'provider_reported' | 'fixed';
|
|
123
|
+
fallback_allowed: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface MediaOperation {
|
|
126
|
+
operation_id: string;
|
|
127
|
+
kind: MediaKind;
|
|
128
|
+
task_id: string | null;
|
|
129
|
+
submission_state: SubmissionState;
|
|
130
|
+
billing_state: BillingState;
|
|
131
|
+
status: string;
|
|
132
|
+
result_available: boolean;
|
|
133
|
+
error: GatewayError | null;
|
|
134
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** CONTRACT-V1.md 1.0.0-rc.1. Capabilities describe implemented support, never authorization. */
|
|
2
|
+
export declare const CLIENT_CAPABILITIES: readonly ["errors-v1", "media-quotes-v1"];
|
|
3
|
+
export type ErrorCategory = 'authentication' | 'access_restricted' | 'billing' | 'model_unavailable' | 'invalid_input' | 'content_rejected' | 'rate_limited' | 'service_unavailable' | 'submission_uncertain' | 'internal_error';
|
|
4
|
+
export type ErrorStage = 'auth' | 'catalog' | 'quote' | 'upload' | 'submit' | 'poll' | 'generation' | 'download' | 'settle';
|
|
5
|
+
export type SubmissionState = 'not_submitted' | 'submitting' | 'accepted' | 'unknown' | 'rejected';
|
|
6
|
+
export type BillingState = 'not_charged' | 'reserved' | 'settled' | 'released' | 'unknown';
|
|
7
|
+
export interface BillingSource {
|
|
8
|
+
readonly kind: 'balance' | 'subscription';
|
|
9
|
+
readonly subscriptionId?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export declare const ACCOUNT_PAGES: readonly ["dashboard", "usage", "subscriptions", "available_channels", "channel_status", "model_prices", "recharge", "orders", "redeem", "affiliate", "profile"];
|
|
12
|
+
export type AccountCenterPage = typeof ACCOUNT_PAGES[number];
|
|
13
|
+
export declare const NATIVE_ACCOUNT_PAGES: Set<"dashboard" | "usage" | "subscriptions" | "available_channels" | "channel_status" | "model_prices" | "recharge" | "orders" | "redeem" | "affiliate" | "profile">;
|
|
14
|
+
export declare function normalizeAccountPage(page: AccountCenterPage): AccountCenterPage;
|
|
15
|
+
export interface MediaAccountContext {
|
|
16
|
+
readonly gatewayOrigin: string;
|
|
17
|
+
readonly userId?: string;
|
|
18
|
+
readonly revision?: string;
|
|
19
|
+
readonly signedIn: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface SafeTaskError {
|
|
22
|
+
readonly code: string;
|
|
23
|
+
readonly message: string;
|
|
24
|
+
readonly category?: string;
|
|
25
|
+
readonly stage?: string;
|
|
26
|
+
readonly requestId?: string;
|
|
27
|
+
readonly taskId?: string;
|
|
28
|
+
readonly operationId?: string;
|
|
29
|
+
readonly retryable?: boolean;
|
|
30
|
+
readonly retryAction?: string;
|
|
31
|
+
readonly retryAfterSeconds?: number;
|
|
32
|
+
readonly submissionState?: string;
|
|
33
|
+
readonly billingState?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web-seam members that VibeDev hosts add to the official DeepSeek Harness SDK this package compiles against. Every
|
|
3
|
+
* member is optional because official DSH hosts lack it: code reading one checks for it first, and a result without
|
|
4
|
+
* the facts keeps the official meaning of `url` and `statusCode`.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { WebFetchProvider } from '@deepseek-ai/dsh-web';
|
|
8
|
+
declare module '@deepseek-ai/dsh-web' {
|
|
9
|
+
interface WebFetchResult {
|
|
10
|
+
/** The original requested URL, when the provider records it. */
|
|
11
|
+
readonly requestedUrl?: string;
|
|
12
|
+
/** Page title supplied by the provider, when available. */
|
|
13
|
+
readonly title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* How the content was obtained. `http`: `url` and `statusCode` were observed from the target. `extracted`: a
|
|
16
|
+
* page-extraction service returned text; the target's final URL and status are unknown, `url` repeats the
|
|
17
|
+
* requested URL and `statusCode` is 200 for usable content, and VibeDev hosts present both as unknown.
|
|
18
|
+
*/
|
|
19
|
+
readonly contentSource?: 'http' | 'extracted';
|
|
20
|
+
/** Evidence about the source response body before consumer limits; absence makes no completeness claim. */
|
|
21
|
+
readonly sourceCompleteness?: 'unknown' | 'complete';
|
|
22
|
+
/** Markup of a `text` body; `markdown` when the provider returned Markdown. */
|
|
23
|
+
readonly bodyFormat?: 'markdown';
|
|
24
|
+
}
|
|
25
|
+
interface WebRuntime {
|
|
26
|
+
/**
|
|
27
|
+
* The fetch provider registered under `id`, read from the live registry without selecting or running it.
|
|
28
|
+
* VibeDev hosts only.
|
|
29
|
+
* @param id - the provider id its registration used, such as `http`.
|
|
30
|
+
* @returns the registered provider, or `undefined` when no fetch provider has that id.
|
|
31
|
+
*/
|
|
32
|
+
getFetchProvider?(id: string): WebFetchProvider | undefined;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/** Gateway extracted-content Fetch V1. Registration and rollout remain with the composition owner. */
|
|
2
|
+
import { WebError } from '@deepseek-ai/dsh-web';
|
|
3
|
+
import type { WebFetchProvider, WebFetchRequest, WebFetchResult } from '@deepseek-ai/dsh-web';
|
|
4
|
+
import type { GatewayCredential } from '../gateway/http.js';
|
|
5
|
+
declare const FETCH_PATH = "/v1/vibedev/web-fetch";
|
|
6
|
+
declare const SECURITY_SCOPE = "initial_url_precheck_provider_managed_fetch";
|
|
7
|
+
/** Only limits and semantics the gateway advertises, without target-HTTP guarantees. */
|
|
8
|
+
export interface GatewayFetchCapability {
|
|
9
|
+
readonly path: typeof FETCH_PATH;
|
|
10
|
+
readonly mode: 'extracted_content';
|
|
11
|
+
readonly content_format: 'markdown';
|
|
12
|
+
readonly max_url_characters: number;
|
|
13
|
+
readonly max_body_characters: number;
|
|
14
|
+
readonly character_unit: 'unicode_code_point';
|
|
15
|
+
readonly max_provider_response_bytes: number;
|
|
16
|
+
readonly timeout_ms: number;
|
|
17
|
+
readonly allowed_ports: readonly number[];
|
|
18
|
+
readonly security_scope: typeof SECURITY_SCOPE;
|
|
19
|
+
}
|
|
20
|
+
/** Safe diagnostics: gatewayStatus is never the target webpage's status. */
|
|
21
|
+
export interface GatewayFetchErrorDetails {
|
|
22
|
+
readonly gatewayStatus?: number;
|
|
23
|
+
readonly category?: string;
|
|
24
|
+
readonly retryable?: boolean;
|
|
25
|
+
readonly safeToRetry?: boolean;
|
|
26
|
+
readonly requestId?: string;
|
|
27
|
+
readonly retryAfterMs?: number;
|
|
28
|
+
readonly field?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Refusals retain safe facts through the existing tool error-text projection. */
|
|
31
|
+
export declare class GatewayFetchError extends WebError {
|
|
32
|
+
readonly details: GatewayFetchErrorDetails;
|
|
33
|
+
constructor(message: string, code: string, details?: GatewayFetchErrorDetails);
|
|
34
|
+
}
|
|
35
|
+
/** Decode only the fixed advertised Fetch V1 lane; absence is not a request to probe an endpoint. */
|
|
36
|
+
export declare function readGatewayFetchCapability(payload: unknown): GatewayFetchCapability | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* One extraction result in the official `WebFetchResult` types. The gateway observes neither the target's final URL
|
|
39
|
+
* nor its status, so `url` repeats the requested URL and `statusCode` is 200 for usable content, both marked
|
|
40
|
+
* `contentSource: 'extracted'`; VibeDev hosts present them as unknown. The `gateway` receipt is SDK-only, and its
|
|
41
|
+
* requestId is not a durable operation or idempotency key.
|
|
42
|
+
*/
|
|
43
|
+
export interface GatewayExtractionResult extends WebFetchResult {
|
|
44
|
+
readonly requestedUrl: string;
|
|
45
|
+
readonly url: string;
|
|
46
|
+
readonly statusCode: 200;
|
|
47
|
+
readonly title?: string;
|
|
48
|
+
readonly body: {
|
|
49
|
+
readonly kind: 'text';
|
|
50
|
+
readonly content: string;
|
|
51
|
+
};
|
|
52
|
+
readonly bodyFormat: 'markdown';
|
|
53
|
+
readonly sourceCompleteness: 'unknown';
|
|
54
|
+
readonly contentSource: 'extracted';
|
|
55
|
+
readonly gateway: {
|
|
56
|
+
readonly cached: boolean;
|
|
57
|
+
readonly requestId?: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** Decode extraction facts without claiming an observed target status, final address or completeness. */
|
|
61
|
+
export declare function decodeGatewayFetchResponse(payload: unknown, requestedUrl: string, maxBodyCharacters: number): GatewayExtractionResult;
|
|
62
|
+
/** Host-only auth and client budgets. No supplier key, arbitrary endpoint or hidden retry option exists. */
|
|
63
|
+
export interface GatewayFetchOptions {
|
|
64
|
+
readonly origin: string;
|
|
65
|
+
readonly userAgent: string;
|
|
66
|
+
readonly capability: GatewayFetchCapability;
|
|
67
|
+
readonly requestTimeoutMs: number;
|
|
68
|
+
readonly maxResponseBytes: number;
|
|
69
|
+
readonly maxBodyCharacters: number;
|
|
70
|
+
/** Resolve a VibeDev credential for exactly this origin; never return a supplier Key. */
|
|
71
|
+
readonly resolveCredential: () => Promise<GatewayCredential | undefined>;
|
|
72
|
+
/**
|
|
73
|
+
* The operation's deadline and cancellation, supplied by the composition owner. When present it replaces this
|
|
74
|
+
* provider's own timer, so a stage entered later in the same operation never restarts the budget.
|
|
75
|
+
*/
|
|
76
|
+
readonly signal?: AbortSignal;
|
|
77
|
+
/** Rechecked after the credential is resolved and immediately before the POST; a rejection sends nothing. */
|
|
78
|
+
readonly beforeSend?: () => Promise<void>;
|
|
79
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The error a client wait that stopped early ends with: `WEB_FETCH_TIMEOUT` when the operation's own deadline expired,
|
|
83
|
+
* `WEB_ABORTED` when the caller cancelled.
|
|
84
|
+
* @param signal - the aborted signal; its reason distinguishes the deadline from a cancellation.
|
|
85
|
+
* @returns the sanitized client error; the supplier outcome is never promised.
|
|
86
|
+
*/
|
|
87
|
+
export declare function cancellationError(signal: AbortSignal): GatewayFetchError;
|
|
88
|
+
/**
|
|
89
|
+
* Race one stage against the operation signal, so even a dependency that ignores the signal ends the client wait.
|
|
90
|
+
* @param operation - the stage to wait for; it keeps running after an abort, and its outcome is discarded.
|
|
91
|
+
* @param signal - the operation's deadline and cancellation.
|
|
92
|
+
* @returns the stage's value.
|
|
93
|
+
*/
|
|
94
|
+
export declare function waitForAbort<T>(operation: Promise<T>, signal: AbortSignal): Promise<T>;
|
|
95
|
+
/** One explicitly selected extraction operation. It never retries, refreshes login or falls back. */
|
|
96
|
+
export declare class GatewayFetchProvider {
|
|
97
|
+
private readonly options;
|
|
98
|
+
readonly id = "vibedev-gateway";
|
|
99
|
+
private readonly origin;
|
|
100
|
+
constructor(options: GatewayFetchOptions);
|
|
101
|
+
available(): boolean;
|
|
102
|
+
fetch(request: WebFetchRequest, caller?: AbortSignal): Promise<GatewayExtractionResult>;
|
|
103
|
+
private fetchOnce;
|
|
104
|
+
}
|
|
105
|
+
/** Dependencies are supplied by the composition owner; this class is not registered by the account plugin. */
|
|
106
|
+
export interface NegotiatedGatewayFetchOptions {
|
|
107
|
+
readonly local: WebFetchProvider;
|
|
108
|
+
readonly gateway: Omit<GatewayFetchOptions, 'capability'>;
|
|
109
|
+
readonly entitlements: (signal?: AbortSignal) => Promise<unknown>;
|
|
110
|
+
/**
|
|
111
|
+
* The operation's deadline and cancellation, supplied by the composition owner. When present it bounds the whole
|
|
112
|
+
* negotiation—capability read, gateway stage and local fallback—and no stage creates its own budget.
|
|
113
|
+
*/
|
|
114
|
+
readonly signal?: AbortSignal;
|
|
115
|
+
}
|
|
116
|
+
/** Capability absence preserves local HTTP; advertised errors never silently switch providers. */
|
|
117
|
+
export declare class NegotiatedGatewayFetchProvider {
|
|
118
|
+
private readonly options;
|
|
119
|
+
readonly id = "vibedev-negotiated-fetch";
|
|
120
|
+
constructor(options: NegotiatedGatewayFetchOptions);
|
|
121
|
+
available(): boolean;
|
|
122
|
+
fetch(request: WebFetchRequest, caller?: AbortSignal): Promise<WebFetchResult | GatewayExtractionResult>;
|
|
123
|
+
private negotiate;
|
|
124
|
+
}
|
|
125
|
+
export {};
|