dsh-qoder-connect 0.1.5 → 0.1.9
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.en.md +7 -2
- package/README.md +7 -2
- package/lib/bin.js +1 -1
- package/lib/client.js +696 -30
- package/lib/index.d.ts +58 -4
- package/lib/index.js +1056 -188
- package/lib/{variants-BEiQve5M.js → variants-C8ezztjV.js} +46 -4
- package/package.json +120 -116
package/lib/index.d.ts
CHANGED
|
@@ -141,11 +141,13 @@ interface QoderProbeAction {
|
|
|
141
141
|
* All are writes, which is why they share this route's in-process key
|
|
142
142
|
* and loopback guards rather than the read-only status GET.
|
|
143
143
|
*/
|
|
144
|
-
action: 'probe' | 'clear' | 'refresh' | 'set-maximum-context-window' | 'clear-checkin-logs' | 'checkin';
|
|
144
|
+
action: 'probe' | 'clear' | 'refresh' | 'set-maximum-context-window' | 'clear-checkin-logs' | 'checkin' | 'set-models-enabled';
|
|
145
145
|
/** Target model id; required for `probe`. */
|
|
146
146
|
model?: string;
|
|
147
|
-
/** Requested value for `set-maximum-context-window`. */
|
|
147
|
+
/** Requested value for `set-maximum-context-window` or `set-models-enabled`. */
|
|
148
148
|
enabled?: boolean;
|
|
149
|
+
/** Target model ids for `set-models-enabled` (supports single, batch, or all). */
|
|
150
|
+
models?: readonly string[];
|
|
149
151
|
}
|
|
150
152
|
/**
|
|
151
153
|
* Where the models a card is currently showing came from.
|
|
@@ -246,6 +248,8 @@ type QoderWebStatus = {
|
|
|
246
248
|
probe?: QoderWebProbeSection;
|
|
247
249
|
/** Card preference selecting larger declared context windows. */
|
|
248
250
|
useMaximumContextWindow?: boolean;
|
|
251
|
+
/** Disabled model IDs (blacklist) for this variant. */
|
|
252
|
+
disabledModels?: readonly string[];
|
|
249
253
|
/**
|
|
250
254
|
* The last automatic job-token refresh the self-heal performed, epoch ms.
|
|
251
255
|
* Absent when no refresh has happened in this process. The card renders
|
|
@@ -268,6 +272,14 @@ type QoderWebStatus = {
|
|
|
268
272
|
status: 'claimed' | 'already-claimed' | 'no-campaign' | 'error';
|
|
269
273
|
amount?: number | undefined;
|
|
270
274
|
message?: string | undefined;
|
|
275
|
+
/**
|
|
276
|
+
* When the scheduler's timer is next due, epoch ms.
|
|
277
|
+
*
|
|
278
|
+
* A day already claimed goes deliberately quiet, so without this the
|
|
279
|
+
* card cannot tell "scheduled and waiting" from "no timer at all" —
|
|
280
|
+
* which is exactly the doubt a missing timer created.
|
|
281
|
+
*/
|
|
282
|
+
nextRunAt?: number | undefined;
|
|
271
283
|
logs?: readonly {
|
|
272
284
|
id: string;
|
|
273
285
|
date: string;
|
|
@@ -537,9 +549,13 @@ declare class QoderCatalog {
|
|
|
537
549
|
private useMaximumContextWindow;
|
|
538
550
|
/** Per-model window overrides (model id → tokens); an override wins over the preference. */
|
|
539
551
|
private modelContextWindows;
|
|
552
|
+
/** Disabled model IDs (blacklist); disabled models are filtered out from current(). */
|
|
553
|
+
private disabledModels;
|
|
540
554
|
constructor(initial?: readonly QoderModelInfo[]);
|
|
541
|
-
/** Current entries; empty while the variant has no usable credential. */
|
|
555
|
+
/** Current entries; empty while the variant has no usable credential, excluding disabled models. */
|
|
542
556
|
current(): readonly QoderModelInfo[];
|
|
557
|
+
/** All configured entries including disabled ones; empty while the variant has no usable credential. */
|
|
558
|
+
all(): readonly QoderModelInfo[];
|
|
543
559
|
/** Replace the list; callers invalidate their adapter snapshot after this. */
|
|
544
560
|
set(models: readonly QoderModelInfo[]): void;
|
|
545
561
|
/** Whether this variant's models are exposed at all. */
|
|
@@ -556,6 +572,13 @@ declare class QoderCatalog {
|
|
|
556
572
|
* changed, so the caller can skip an invalidation over an identical write.
|
|
557
573
|
*/
|
|
558
574
|
setModelContextWindows(modelContextWindows: Readonly<Record<string, number>>): boolean;
|
|
575
|
+
/**
|
|
576
|
+
* Replace the disabled model IDs wholesale. Returns whether the set
|
|
577
|
+
* changed, so the caller can skip an invalidation over an identical write.
|
|
578
|
+
*/
|
|
579
|
+
setDisabledModels(disabledModels: readonly string[]): boolean;
|
|
580
|
+
/** Current disabled model IDs. */
|
|
581
|
+
getDisabledModels(): readonly string[];
|
|
559
582
|
/**
|
|
560
583
|
* Models to fall back to when the upstream fetch fails; ignores
|
|
561
584
|
* visibility, because the caller asking for the fallback already knows the
|
|
@@ -666,6 +689,14 @@ interface QoderQuota {
|
|
|
666
689
|
interface QoderQuotaUsage {
|
|
667
690
|
userQuota?: QoderQuota | undefined;
|
|
668
691
|
orgResourcePackage?: QoderQuota | undefined;
|
|
692
|
+
/**
|
|
693
|
+
* Credits granted on top of the plan — the daily campaign's 100, for one.
|
|
694
|
+
*
|
|
695
|
+
* A separate bucket upstream reports beside `userQuota`; it carries its own
|
|
696
|
+
* total and remaining, so leaving it out made the card show fewer packages
|
|
697
|
+
* than the account actually holds (two on the web, one here).
|
|
698
|
+
*/
|
|
699
|
+
addOnQuota?: QoderQuota | undefined;
|
|
669
700
|
totalUsagePercentage?: number | undefined;
|
|
670
701
|
isQuotaExceeded?: boolean | undefined;
|
|
671
702
|
expiresAt?: string | undefined;
|
|
@@ -1376,6 +1407,10 @@ interface Config {
|
|
|
1376
1407
|
modelContextWindows?: Record<string, number>;
|
|
1377
1408
|
/** The China variant's per-model overrides; see {@link Config.modelContextWindows}. */
|
|
1378
1409
|
modelContextWindowsCN?: Record<string, number>;
|
|
1410
|
+
/** Models disabled for the global variant (blacklist). */
|
|
1411
|
+
disabledModels?: string[];
|
|
1412
|
+
/** Models disabled for the China variant (blacklist). */
|
|
1413
|
+
disabledModelsCN?: string[];
|
|
1379
1414
|
/** Show the China variant's sidebar quota card. */
|
|
1380
1415
|
sidebarQuotaCN?: boolean;
|
|
1381
1416
|
/** Show the global variant's sidebar quota card. */
|
|
@@ -1384,6 +1419,10 @@ interface Config {
|
|
|
1384
1419
|
autoCheckInCN?: boolean;
|
|
1385
1420
|
/** Automatically check in daily at 10:00 (UTC+8) to claim credits for Global variant. */
|
|
1386
1421
|
autoCheckInGlobal?: boolean;
|
|
1422
|
+
/** When the China variant checks in, as minutes past midnight in UTC+8 (600 = 10:00). */
|
|
1423
|
+
checkInMinuteCN?: number;
|
|
1424
|
+
/** When the Global variant checks in, as minutes past midnight in UTC+8 (600 = 10:00). */
|
|
1425
|
+
checkInMinuteGlobal?: number;
|
|
1387
1426
|
/**
|
|
1388
1427
|
* Sidebar quota refresh interval in milliseconds. One shared value (both
|
|
1389
1428
|
* cards poll on it) because the two widgets hit the same rate-limited
|
|
@@ -1402,6 +1441,21 @@ interface Config {
|
|
|
1402
1441
|
declare const QUOTA_POLL_DEFAULT_MS = 300000;
|
|
1403
1442
|
declare const QUOTA_POLL_MIN_MS = 60000;
|
|
1404
1443
|
declare const Config: z<Config>;
|
|
1444
|
+
/**
|
|
1445
|
+
* Every field each settings section owns, and therefore every field the live
|
|
1446
|
+
* configuration has to carry through.
|
|
1447
|
+
*
|
|
1448
|
+
* One list per section, shared by the merge and by the test that pins it to
|
|
1449
|
+
* the schema. Writing the merge out by hand is what broke auto check-in: the
|
|
1450
|
+
* `qoder-quota` section grew four fields (`autoCheckInCN`, `autoCheckInGlobal`,
|
|
1451
|
+
* `checkInMinuteCN`, `checkInMinuteGlobal`) while the merge kept copying only
|
|
1452
|
+
* the three that predated them, so `current().autoCheckInCN` read `undefined`
|
|
1453
|
+
* forever and the scheduler saw the toggle as permanently off. The card saved
|
|
1454
|
+
* it, the file held it, and nothing ever acted on it.
|
|
1455
|
+
*/
|
|
1456
|
+
declare const CN_SECTION_KEYS: readonly ["probeConsent", "useMaximumContextWindowCN", "modelContextWindowsCN", "disabledModelsCN"];
|
|
1457
|
+
declare const GLOBAL_SECTION_KEYS: readonly ["useMaximumContextWindow", "modelContextWindows", "disabledModels"];
|
|
1458
|
+
declare const QUOTA_SECTION_KEYS: readonly ["sidebarQuotaCN", "sidebarQuotaGlobal", "autoCheckInCN", "autoCheckInGlobal", "checkInMinuteCN", "checkInMinuteGlobal", "quotaPollMs"];
|
|
1405
1459
|
/**
|
|
1406
1460
|
* Start both variants: their loopback endpoints, the `qoder` and
|
|
1407
1461
|
* `qoder-global` providers, their configuration cards, and their
|
|
@@ -1414,4 +1468,4 @@ declare const Config: z<Config>;
|
|
|
1414
1468
|
*/
|
|
1415
1469
|
declare function apply(ctx: Context, config: Config): void;
|
|
1416
1470
|
//#endregion
|
|
1417
|
-
export { CHINA_VARIANT, Config, FALLBACK_QODER_MODELS, GLOBAL_VARIANT, KIND_STATUS, PROBE_EFFORT_CANDIDATES, type ProbeAttempt, type ProbeOutcome, type ProbeSender, QODER_AUTH_FILENAME, QODER_AUTH_PATH, QODER_DATA_DIR_ENV, QODER_DATA_DIR_NAME, QODER_GLOBAL_AUTH_PATH, QODER_GLOBAL_PROBE_PATH, QODER_GLOBAL_SETTINGS_NS, QODER_GLOBAL_STATUS_PATH, QODER_HOST_HEARTBEAT_FILENAME, QODER_PAT_ENV_CN, QODER_PAT_ENV_GLOBAL, QODER_PROBE_FILENAME, QODER_PROBE_PATH, QODER_PROVIDER, QODER_QUOTA_SETTINGS_NS, QODER_SETTINGS_NS, QODER_STATUS_PATH, QODER_STREAM_IDLE_TIMEOUT_MS, QODER_VARIANTS, QUOTA_POLL_DEFAULT_MS, QUOTA_POLL_MIN_MS, type QoderAdapter, type QoderAuthRequest, type QoderAuthRouteOptions, type QoderAuthSaveResult, type QoderAuthStatus, QoderCatalog, type QoderCatalogFetch, type QoderCatalogModelSnapshot, QoderCatalogStore, type QoderCatalogStoreOptions, type QoderChatResult, type QoderCredential, QoderCredentialStore, type QoderCreditAccount, type QoderCredits, type QoderEffort, type QoderHostHeartbeat, type QoderModelBilling, type QoderModelInfo, type QoderModelReasoning, type QoderPatSummary, type QoderProbeAction, type QoderProbeRecord, QoderProbeService, type QoderProbeStatus, QoderProbeStore, type QoderProbeValidation, type QoderShim, QoderUpstreamClient, type QoderVariant, type QoderVariantId, type QoderWebCatalog, type QoderWebCreditAccount, type QoderWebCredits, type QoderWebProbeModel, type QoderWebProbeSection, type QoderWebStatus, type ShimLogger, type UpstreamErrorKind, apply, classifyUpstreamError, clearHostHeartbeat, createAuthKey, createQoderAdapter, createQoderShim, fingerprintModel, inject, isHeartbeatProcessAlive, kindFromQoderFailure, modelInfoOf, name, normalizeCredits, patTail, probeModel, processStartTimeMs, qoderAuthHandler, qoderCatalogPath, qoderCredentialIdentity, qoderHostHeartbeatPath, qoderOwnAuthPath, qoderPluginDataDir, qoderProbePath, randomSentinel, readHostHeartbeat, registerQoderAuthRoute, variantFor };
|
|
1471
|
+
export { CHINA_VARIANT, CN_SECTION_KEYS, Config, FALLBACK_QODER_MODELS, GLOBAL_SECTION_KEYS, GLOBAL_VARIANT, KIND_STATUS, PROBE_EFFORT_CANDIDATES, type ProbeAttempt, type ProbeOutcome, type ProbeSender, QODER_AUTH_FILENAME, QODER_AUTH_PATH, QODER_DATA_DIR_ENV, QODER_DATA_DIR_NAME, QODER_GLOBAL_AUTH_PATH, QODER_GLOBAL_PROBE_PATH, QODER_GLOBAL_SETTINGS_NS, QODER_GLOBAL_STATUS_PATH, QODER_HOST_HEARTBEAT_FILENAME, QODER_PAT_ENV_CN, QODER_PAT_ENV_GLOBAL, QODER_PROBE_FILENAME, QODER_PROBE_PATH, QODER_PROVIDER, QODER_QUOTA_SETTINGS_NS, QODER_SETTINGS_NS, QODER_STATUS_PATH, QODER_STREAM_IDLE_TIMEOUT_MS, QODER_VARIANTS, QUOTA_POLL_DEFAULT_MS, QUOTA_POLL_MIN_MS, QUOTA_SECTION_KEYS, type QoderAdapter, type QoderAuthRequest, type QoderAuthRouteOptions, type QoderAuthSaveResult, type QoderAuthStatus, QoderCatalog, type QoderCatalogFetch, type QoderCatalogModelSnapshot, QoderCatalogStore, type QoderCatalogStoreOptions, type QoderChatResult, type QoderCredential, QoderCredentialStore, type QoderCreditAccount, type QoderCredits, type QoderEffort, type QoderHostHeartbeat, type QoderModelBilling, type QoderModelInfo, type QoderModelReasoning, type QoderPatSummary, type QoderProbeAction, type QoderProbeRecord, QoderProbeService, type QoderProbeStatus, QoderProbeStore, type QoderProbeValidation, type QoderShim, QoderUpstreamClient, type QoderVariant, type QoderVariantId, type QoderWebCatalog, type QoderWebCreditAccount, type QoderWebCredits, type QoderWebProbeModel, type QoderWebProbeSection, type QoderWebStatus, type ShimLogger, type UpstreamErrorKind, apply, classifyUpstreamError, clearHostHeartbeat, createAuthKey, createQoderAdapter, createQoderShim, fingerprintModel, inject, isHeartbeatProcessAlive, kindFromQoderFailure, modelInfoOf, name, normalizeCredits, patTail, probeModel, processStartTimeMs, qoderAuthHandler, qoderCatalogPath, qoderCredentialIdentity, qoderHostHeartbeatPath, qoderOwnAuthPath, qoderPluginDataDir, qoderProbePath, randomSentinel, readHostHeartbeat, registerQoderAuthRoute, variantFor };
|