dsh-connect-workbuddy 5.25.2 → 5.30.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.
- package/CHANGELOG.md +229 -0
- package/lib/bin.js +1 -1
- package/lib/client.js +222 -31
- package/lib/{host-heartbeat-BDwQzVNn.js → host-heartbeat-BzYVKa0r.js} +109 -2
- package/lib/index.d.ts +130 -3
- package/lib/index.js +812 -96
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1446,6 +1446,31 @@ interface WorkBuddyCheckinClaim {
|
|
|
1446
1446
|
streakDays: number;
|
|
1447
1447
|
isStreakDay: boolean;
|
|
1448
1448
|
}
|
|
1449
|
+
/** Today's heatmap cell: whether the account was active and its score. */
|
|
1450
|
+
interface WorkBuddyGrowthToday {
|
|
1451
|
+
date: string;
|
|
1452
|
+
isActive: boolean;
|
|
1453
|
+
score: number;
|
|
1454
|
+
statusText?: string;
|
|
1455
|
+
}
|
|
1456
|
+
/** Streak + redemption snapshot, reduced to what the card and runner need. */
|
|
1457
|
+
interface WorkBuddyGrowthStreak {
|
|
1458
|
+
days: number;
|
|
1459
|
+
monthTotalDays: number;
|
|
1460
|
+
monthConsumedDays: number;
|
|
1461
|
+
nextTier?: string;
|
|
1462
|
+
nextTierRemaining: number;
|
|
1463
|
+
/** Tier ids (`7d`/`14d`/`28d`) the gateway says are claimable NOW. */
|
|
1464
|
+
availableTiers: readonly string[];
|
|
1465
|
+
makeupCardBalance: number;
|
|
1466
|
+
}
|
|
1467
|
+
/** Result of redeeming one tier. */
|
|
1468
|
+
interface WorkBuddyGrowthRedeemResult {
|
|
1469
|
+
tier: string;
|
|
1470
|
+
credit: number;
|
|
1471
|
+
energy?: number;
|
|
1472
|
+
alreadyClaimed?: boolean;
|
|
1473
|
+
}
|
|
1449
1474
|
/**
|
|
1450
1475
|
* One promotional benefit the account may or may not still be entitled to.
|
|
1451
1476
|
*
|
|
@@ -2174,6 +2199,27 @@ declare class WorkBuddyUpstreamClient {
|
|
|
2174
2199
|
claimBenefit(credential: WorkBuddyCredential, kind: WorkBuddyBenefit['kind']): Promise<void>;
|
|
2175
2200
|
/** Claim today's check-in reward. The browser route guards this mutation. */
|
|
2176
2201
|
claimDailyCheckin(credential: WorkBuddyCredential): Promise<WorkBuddyCheckinClaim>;
|
|
2202
|
+
/**
|
|
2203
|
+
* GET one growth-center path, trying `/v2` then the bare form.
|
|
2204
|
+
*
|
|
2205
|
+
* The attachment disagrees with itself on whether growth paths carry `/v2`
|
|
2206
|
+
* (see the endpoint note above). Rather than pin one spelling and be wrong on
|
|
2207
|
+
* half the deployments, a 404 on the first form retries the second. Only a
|
|
2208
|
+
* clean `code: 0` envelope is accepted; a business error is returned as-is.
|
|
2209
|
+
* Returns `undefined` when NEITHER shape answered successfully.
|
|
2210
|
+
*/
|
|
2211
|
+
private readGrowthData;
|
|
2212
|
+
/** Today's heatmap cell, or undefined when the gateway gave no usable answer. */
|
|
2213
|
+
fetchGrowthToday(credential: WorkBuddyCredential): Promise<WorkBuddyGrowthToday | undefined>;
|
|
2214
|
+
/** Streak + redemption snapshot, or undefined when unreadable. */
|
|
2215
|
+
fetchGrowthStreak(credential: WorkBuddyCredential): Promise<WorkBuddyGrowthStreak | undefined>;
|
|
2216
|
+
/**
|
|
2217
|
+
* Redeem one streak tier. The CALLER must only pass a tier the gateway marked
|
|
2218
|
+
* `available`; this method does not re-check, so the decision stays in the
|
|
2219
|
+
* batch runner where it can be reported and tested. The browser/host route
|
|
2220
|
+
* guards this mutation with POST + loopback like every other write.
|
|
2221
|
+
*/
|
|
2222
|
+
redeemGrowthTier(credential: WorkBuddyCredential, tier: string): Promise<WorkBuddyGrowthRedeemResult>;
|
|
2177
2223
|
/**
|
|
2178
2224
|
* The ENTERPRISE credit table (issue #124).
|
|
2179
2225
|
*
|
|
@@ -4400,6 +4446,17 @@ type WorkBuddyWebUsage =
|
|
|
4400
4446
|
message?: string;
|
|
4401
4447
|
/** The persisted account id matches no local account. */
|
|
4402
4448
|
selectionLost?: boolean;
|
|
4449
|
+
/**
|
|
4450
|
+
* The upstream refused the credential that `resolve()` tried to refresh
|
|
4451
|
+
* (issue #285). Distinct from a genuinely signed-out machine: local accounts
|
|
4452
|
+
* ARE present (`accounts` is populated and the export dialog can see them),
|
|
4453
|
+
* but the selected token was rejected. Without this marker the card fell
|
|
4454
|
+
* into the generic signed-out branch, hid every account, and told the user
|
|
4455
|
+
* "未登录" in both the settings card and the model picker.
|
|
4456
|
+
*/
|
|
4457
|
+
credentialRejected?: boolean;
|
|
4458
|
+
/** Present only alongside {@link credentialRejected}. */
|
|
4459
|
+
recovery?: WorkBuddyWebRecovery;
|
|
4403
4460
|
/**
|
|
4404
4461
|
* The vault directory exists but could not be READ (issue #199).
|
|
4405
4462
|
*
|
|
@@ -4876,6 +4933,16 @@ interface WorkBuddyWebPoolAccount {
|
|
|
4876
4933
|
* result the user just watched succeed.
|
|
4877
4934
|
*/
|
|
4878
4935
|
checkedInToday?: boolean;
|
|
4936
|
+
/**
|
|
4937
|
+
* Whether this account's streak tiers were redeemed/settled today (issue #286).
|
|
4938
|
+
* ABSENT means the growth job has not covered this account today.
|
|
4939
|
+
*/
|
|
4940
|
+
growthRedeemedToday?: boolean;
|
|
4941
|
+
/**
|
|
4942
|
+
* Whether this account was lit "active today" by the job (issue #286).
|
|
4943
|
+
* ABSENT means the growth job has not covered this account today.
|
|
4944
|
+
*/
|
|
4945
|
+
growthActiveToday?: boolean;
|
|
4879
4946
|
/**
|
|
4880
4947
|
* Promotional benefits this account can STILL claim (issue #79).
|
|
4881
4948
|
*
|
|
@@ -4925,6 +4992,20 @@ interface WorkBuddyWebAutoCheckinToday {
|
|
|
4925
4992
|
/** Why the last attempt failed, when it did. */
|
|
4926
4993
|
lastError?: string;
|
|
4927
4994
|
}
|
|
4995
|
+
/**
|
|
4996
|
+
* Today's progress for one growth background job (issue #286).
|
|
4997
|
+
*
|
|
4998
|
+
* Deliberately NOT the check-in shape: growth has no retry/backoff semantics.
|
|
4999
|
+
* An account attempted today is settled whether it redeemed, was already done,
|
|
5000
|
+
* or was unreachable, so there is no `pending`/`lastError` to show — just a
|
|
5001
|
+
* stable "已兑换 / 已点亮 X / Y" count the user asked for.
|
|
5002
|
+
*/
|
|
5003
|
+
interface WorkBuddyWebGrowthToday {
|
|
5004
|
+
/** Accounts settled today (attempted, redeemed, or already done). */
|
|
5005
|
+
done: number;
|
|
5006
|
+
/** Accounts in scope today — the real pool member count. */
|
|
5007
|
+
total: number;
|
|
5008
|
+
}
|
|
4928
5009
|
interface WorkBuddyWebPool {
|
|
4929
5010
|
enabled: boolean;
|
|
4930
5011
|
/**
|
|
@@ -4943,6 +5024,10 @@ interface WorkBuddyWebPool {
|
|
|
4943
5024
|
* runner happens to be doing with the previous value.
|
|
4944
5025
|
*/
|
|
4945
5026
|
autoCheckin?: boolean;
|
|
5027
|
+
/** Auto-redeem claimable growth-tiers (issue #286). Absent means OFF. */
|
|
5028
|
+
growthRedeem?: boolean;
|
|
5029
|
+
/** Auto-light "active today" via ACP (issue #286). Absent means OFF. */
|
|
5030
|
+
growthActivity?: boolean;
|
|
4946
5031
|
/**
|
|
4947
5032
|
* What the automatic check-in has done today, when it is switched on.
|
|
4948
5033
|
*
|
|
@@ -4953,6 +5038,10 @@ interface WorkBuddyWebPool {
|
|
|
4953
5038
|
* settled, and asking it to guess is how the count would drift from the truth.
|
|
4954
5039
|
*/
|
|
4955
5040
|
autoCheckinToday?: WorkBuddyWebAutoCheckinToday;
|
|
5041
|
+
/** Today's streak-redeem progress, when that switch is on and the job ran. */
|
|
5042
|
+
growthRedeemToday?: WorkBuddyWebGrowthToday;
|
|
5043
|
+
/** Today's active-today progress, when that switch is on and the job ran. */
|
|
5044
|
+
growthActivityToday?: WorkBuddyWebGrowthToday;
|
|
4956
5045
|
/** The model a test would use right now; absent when none can be resolved. */
|
|
4957
5046
|
targetModelId?: string;
|
|
4958
5047
|
/**
|
|
@@ -5565,6 +5654,10 @@ interface WorkBuddyPoolDeps {
|
|
|
5565
5654
|
* profile until someone ticks it.
|
|
5566
5655
|
*/
|
|
5567
5656
|
autoCheckin?: boolean;
|
|
5657
|
+
/** Auto-redeem claimable streak tiers (issue #286, opt-in, both regions). */
|
|
5658
|
+
growthRedeem?: boolean;
|
|
5659
|
+
/** Auto-light "active today" via ACP (issue #286, opt-in, both regions). */
|
|
5660
|
+
growthActivity?: boolean;
|
|
5568
5661
|
};
|
|
5569
5662
|
/** One region's CHECKED accounts, plus their credits and last measurements. */
|
|
5570
5663
|
members(region: WorkBuddyRegion): Promise<readonly WorkBuddyPoolMember[]>;
|
|
@@ -5636,12 +5729,18 @@ interface WorkBuddyPoolDeps {
|
|
|
5636
5729
|
* Today's check-in state, from the cells already measured this process.
|
|
5637
5730
|
*
|
|
5638
5731
|
* The first-paint counterpart of {@link checkedInToday}: reads the Host's
|
|
5639
|
-
*
|
|
5640
|
-
* upstream request per account. An account it has not measured is simply
|
|
5732
|
+
* local done-today memory and nothing else, so a first paint never waits on
|
|
5733
|
+
* one upstream request per account. An account it has not measured is simply
|
|
5641
5734
|
* absent, which the card renders as unknown — the same meaning as a failed
|
|
5642
5735
|
* per-account read in the full document.
|
|
5643
5736
|
*/
|
|
5644
|
-
cachedCheckedInToday?(region: WorkBuddyRegion): Readonly<Record<string, boolean>>;
|
|
5737
|
+
cachedCheckedInToday?(region: WorkBuddyRegion): Promise<Readonly<Record<string, boolean>>> | Readonly<Record<string, boolean>>;
|
|
5738
|
+
/**
|
|
5739
|
+
* Per-account growth completion for today (issue #286), from the runner's own
|
|
5740
|
+
* day state — no upstream read. `true` only for accounts the job settled today;
|
|
5741
|
+
* absent for accounts it has not covered. Drives the per-row 已兑换/已点亮 stamp.
|
|
5742
|
+
*/
|
|
5743
|
+
growthDoneAccountIds?(region: WorkBuddyRegion, cap: 'growth-redeem' | 'growth-activity'): Promise<Readonly<Record<string, boolean>>> | Readonly<Record<string, boolean>>;
|
|
5645
5744
|
/**
|
|
5646
5745
|
* Claimable promotional benefits per account id (issue #79).
|
|
5647
5746
|
*
|
|
@@ -5702,6 +5801,13 @@ interface WorkBuddyPoolDeps {
|
|
|
5702
5801
|
* reports "unavailable" instead of appearing to succeed.
|
|
5703
5802
|
*/
|
|
5704
5803
|
checkin?(region: WorkBuddyRegion): Promise<readonly WorkBuddyPoolCheckinRow[]>;
|
|
5804
|
+
/**
|
|
5805
|
+
* Manually run one growth job for every pooled account (issue #286). These are
|
|
5806
|
+
* the on-demand equivalents of the two opt-in background switches. Absent
|
|
5807
|
+
* means the action answers 503. The row shape is shared with the check-in
|
|
5808
|
+
* batch (`done`/`skipped`/`failed` plus a message).
|
|
5809
|
+
*/
|
|
5810
|
+
growthRun?(region: WorkBuddyRegion, action: 'growth-redeem' | 'growth-activity'): Promise<readonly WorkBuddyPoolCheckinRow[]>;
|
|
5705
5811
|
/**
|
|
5706
5812
|
* What the automatic check-in has settled today, when it is switched on
|
|
5707
5813
|
* (issue #191).
|
|
@@ -5716,6 +5822,10 @@ interface WorkBuddyPoolDeps {
|
|
|
5716
5822
|
* happened.
|
|
5717
5823
|
*/
|
|
5718
5824
|
autoCheckinToday?(region: WorkBuddyRegion): WorkBuddyWebAutoCheckinToday | undefined;
|
|
5825
|
+
/** Today's streak-redeem progress (issue #286), from the runner's own state. */
|
|
5826
|
+
growthRedeemToday?(region: WorkBuddyRegion): WorkBuddyWebGrowthToday | undefined;
|
|
5827
|
+
/** Today's active-today progress (issue #286), from the runner's own state. */
|
|
5828
|
+
growthActivityToday?(region: WorkBuddyRegion): WorkBuddyWebGrowthToday | undefined;
|
|
5719
5829
|
/**
|
|
5720
5830
|
* Test every account of one region against the resolved target model.
|
|
5721
5831
|
*
|
|
@@ -6059,6 +6169,23 @@ interface WorkBuddyPoolPreferences {
|
|
|
6059
6169
|
* and the runner refuses to start there.
|
|
6060
6170
|
*/
|
|
6061
6171
|
autoCheckin?: boolean;
|
|
6172
|
+
/**
|
|
6173
|
+
* Whether the plugin redeems claimable streak tiers automatically (issue #286).
|
|
6174
|
+
*
|
|
6175
|
+
* OFF by default, like `autoCheckin`: a redeem is a real WRITE on the account.
|
|
6176
|
+
* Unlike check-in it is available in BOTH regions — the growth-streak endpoint
|
|
6177
|
+
* answers `code 0` in each. Only tiers the gateway marks `available` are ever
|
|
6178
|
+
* redeemed, so a repeat run writes nothing.
|
|
6179
|
+
*/
|
|
6180
|
+
growthRedeem?: boolean;
|
|
6181
|
+
/**
|
|
6182
|
+
* Whether the plugin lights up "active today" through a console ACP session
|
|
6183
|
+
* (issue #286). OFF by default: one short model turn is sent PER account per
|
|
6184
|
+
* day, which spends a little credit. Idempotent — an already-active account
|
|
6185
|
+
* gets no session. Available in BOTH regions; it is the only growth reward the
|
|
6186
|
+
* international gateway still offers.
|
|
6187
|
+
*/
|
|
6188
|
+
growthActivity?: boolean;
|
|
6062
6189
|
}
|
|
6063
6190
|
/** Plugin configuration. */
|
|
6064
6191
|
interface Config {
|