dsh-connect-workbuddy 5.4.0 → 5.5.1

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.
@@ -1784,6 +1784,16 @@ const GLOBAL_CONFIG_PATH = "/v3/config";
1784
1784
  * host- and identity-insensitive on the CN side (measured 2026-10-21 on all
1785
1785
  * three CN hosts, under both the CLI and the app user agent: byte-identical),
1786
1786
  * so it is asked as the chat channel's own identity.
1787
+ *
1788
+ * IT DOES NOT EXIST ON THE GLOBAL GATEWAY. Measured 2026-10-22: this exact POST
1789
+ * against `www.workbuddy.ai` answers 404 `Route Not Found` (as do the four
1790
+ * neighbouring spellings tried under both POST and GET), while the same
1791
+ * credential reads that gateway's `/v3/config` normally and finds no load field
1792
+ * on any model. {@link WorkBuddyUpstreamClient.fetchModelBusy} is therefore
1793
+ * expected to THROW for that region — `withBusyLevels` in `src/index.ts` catches
1794
+ * it and ships the roster without levels. Kept as-is rather than region-gated:
1795
+ * the day upstream adds it, this needs no change, and the cost today is one
1796
+ * 404 per refresh that never blocks anything.
1787
1797
  */
1788
1798
  const MODEL_BUSY_PATH = "/v2/chat/busy";
1789
1799
  /**
@@ -5956,7 +5966,7 @@ function generationOf(version) {
5956
5966
  //#endregion
5957
5967
  //#region src/version.ts
5958
5968
  /** The npm package version this build was produced from. */
5959
- const WORKBUDDY_CONNECT_VERSION = "5.4.0";
5969
+ const WORKBUDDY_CONNECT_VERSION = "5.5.1";
5960
5970
  //#endregion
5961
5971
  //#region src/host-heartbeat.ts
5962
5972
  /**
package/lib/index.d.ts CHANGED
@@ -792,6 +792,22 @@ interface WorkBuddyPromo {
792
792
  * `/v3/config`, this endpoint is not channel-sensitive, so the plugin asks it as
793
793
  * the CLI agent it already is on the chat path — no product identity needed.
794
794
  *
795
+ * THE GLOBAL GATEWAY DOES NOT HAVE IT (measured 2026-10-22, and the reason the
796
+ * README says "CN only"). `www.workbuddy.ai` answers that same POST with
797
+ * `404 {"error_msg":"404 Route Not Found"}`, and so do `/v3/chat/busy`,
798
+ * `/v2/models/busy`, `/v2/chat/model/busy` and `/v1/chat/busy` under both POST
799
+ * and GET — twelve path/method pairs, twelve 404s. The credential is fine: the
800
+ * SAME token reads that gateway's `/v3/config` (200, 28 models), and none of
801
+ * those models carries a field whose name mentions busy / load / queue / wait /
802
+ * level / pressure. So this is not a wrong path, a wrong identity or a
803
+ * permission problem — upstream never published the fact for that region. The
804
+ * probe therefore fails there on every refresh; it is caught (see
805
+ * `withBusyLevels` in `src/index.ts`), logged once, and the roster ships with
806
+ * no levels, which the card renders as no badge. Deliberately NOT "fixed" by
807
+ * inferring a level from latency or credits: a made-up load badge is worse than
808
+ * no badge, and the plugin's whole rule here is to never state a fact the
809
+ * upstream did not state.
810
+ *
795
811
  * THE LEVELS ARE THE APP'S OWN ENUM, and anything outside it is `unknown`:
796
812
  * `idle` / `normal` / `busy` / `congested` / `unavailable`. The app's own words
797
813
  * (from its `im-channels` bundle, `chatInput.modelSelector.busy.*`) are
@@ -1597,6 +1613,7 @@ interface CliBridgeSettings {
1597
1613
  allowUnattended?: boolean;
1598
1614
  maxReplyChars?: number;
1599
1615
  injectResult?: boolean;
1616
+ sessionContinuity?: string;
1600
1617
  maxTurnsPerSessionHour?: number;
1601
1618
  maxTurnsPerHour?: number;
1602
1619
  }
@@ -2894,6 +2911,57 @@ declare function withWorkBuddyRegion(path: string, region: WorkBuddyWebRegion):
2894
2911
  * answer 400 instead of guessing.
2895
2912
  */
2896
2913
  declare function regionOfStatusUrl(url: string): WorkBuddyWebRegion | undefined;
2914
+ /**
2915
+ * Narrow a settings value to the `regions` map. Accepts EITHER the whole
2916
+ * settings section (the Host's resolved `Config`) OR the `regions` map itself,
2917
+ * and unwraps the former. This tolerance is deliberate: passing the whole
2918
+ * section where the map was expected was a real shipped bug in the sibling
2919
+ * project — the lookup then read `section['cn']` (absent), so the card's
2920
+ * checkbox reported `true` forever and clicking it appeared to do nothing even
2921
+ * though the write succeeded.
2922
+ *
2923
+ * The resolved section delivers `regions` as a `{get(): T}` LIVE reference, and
2924
+ * a live reference is `typeof === 'object'` and not an array — so it passes a
2925
+ * naive object check and gets returned as if it were the map. Every lookup on
2926
+ * it is then `undefined`: the enabled flag reads back as "on" forever (the very
2927
+ * symptom described above), and a merge that spreads this map silently drops
2928
+ * the region it was not editing. Unwrap before narrowing.
2929
+ *
2930
+ * THE HOP IS CONDITIONAL, and that is the whole point (a saved manual pool
2931
+ * order "disappearing"). "Has a `regions` key" is NOT sufficient evidence that
2932
+ * the caller passed the whole section: the `regions` MAP can legitimately carry
2933
+ * a `regions` key of its own, because an earlier build could write a sibling
2934
+ * field name into it — a live profile was found with `accounts`, `regions` and
2935
+ * `cliBridge` sitting beside `cn` / `global`. Hopping there means reading a
2936
+ * DIFFERENT, older copy of the same region: measured, the same document returned
2937
+ * `['c','a','b']` when read as a section and `[]` when read as a map. So a value
2938
+ * counts as the whole section only when it shows a key that is neither a region
2939
+ * id nor a known sibling — i.e. it looks like a settings document. A plain (or
2940
+ * dirty) `cn` / `global` map is returned as-is.
2941
+ *
2942
+ * THE RESULT IS HEALED, not merely narrowed — see {@link healedRegionsMap}.
2943
+ * Returning the map "as-is" is what let a corrupted document keep reading as
2944
+ * half-empty: the field held `cn` at level 0 and `global` only one level down,
2945
+ * so every `global` question answered "never configured" even though the file
2946
+ * still had the answer. Reads and writes both come through here, so healing
2947
+ * here fixes both halves at once (the Host's `regionStateOf`, the card's
2948
+ * `nextRegion*` write bases, and the catalog repair's write).
2949
+ */
2950
+ declare function regionsMapOf(value: unknown): Record<string, unknown>;
2951
+ /**
2952
+ * Whether the stored `regions` FIELD still carries the debris described at
2953
+ * {@link REGION_MAP_FOREIGN_KEYS}.
2954
+ *
2955
+ * Pass the field itself (`Config['regions']`), not the whole section: the
2956
+ * section legitimately has `accounts` / `cliBridge` beside `regions`, so asking
2957
+ * that question of a section would always answer "corrupt".
2958
+ *
2959
+ * The catalog repair uses it to write even when the model directory already
2960
+ * matches: without that, a profile whose directory is in agreement would never
2961
+ * be cleaned — the very shape that made the pool look unsaved would outlive the
2962
+ * fix that stops producing it.
2963
+ */
2964
+ declare function regionsFieldIsCorrupt(value: unknown): boolean;
2897
2965
  /**
2898
2966
  * Whether one region's provider is switched on. Opt-out semantics: only an
2899
2967
  * explicit `false` disables it, so a config written before this switch existed
@@ -3802,6 +3870,16 @@ interface WorkBuddyStatusRouteOptions {
3802
3870
  * probe.
3803
3871
  */
3804
3872
  accountUsable?(region: WorkBuddyRegion, account: WorkBuddyRecoveryCandidate): Promise<boolean>;
3873
+ /**
3874
+ * The CLI route's live turns, for the composer readout.
3875
+ *
3876
+ * A READ of the bridge's in-memory board, not a computation: the route exists
3877
+ * so a turn that is still running has somewhere to be observed from, and the
3878
+ * board is the only thing that knows. Absent (the bridge is switched off, or
3879
+ * this Host mounted the status routes without it) means "no live turns", which
3880
+ * the chip renders as nothing at all.
3881
+ */
3882
+ cliLive?(): unknown;
3805
3883
  /**
3806
3884
  * Why each of the region's accounts cannot serve right now, keyed by account
3807
3885
  * id. Absent key (or an absent dep) means "no reason known" — the composer
@@ -4419,4 +4497,4 @@ declare function legacyAttributionRegion(value: Config, accountsFor: (region: Wo
4419
4497
  */
4420
4498
  declare function apply(ctx: Context, config: Config): void;
4421
4499
  //#endregion
4422
- export { CREDENTIAL_REJECTED_CODE, Config, DEFAULT_PROBE_INPUT_TOKENS, ENCRYPTED_CREDENTIAL_CODE, FALLBACK_WORKBUDDY_MODELS, FALLBACK_WORKBUDDY_MODELS_GLOBAL, NATIVE_MODALITY_BY_MODEL_ID, PROBE_INPUT_TOKEN_CHOICES, PROBE_MAX_TOKENS, PROBE_SYSTEM_PROMPT, REFUSES_OFF_MODEL_IDS, type UpstreamErrorKind, WORKBUDDY_ACCOUNTS_REFRESH_PATH, WORKBUDDY_APP_EXECUTABLE_ENV, WORKBUDDY_AUTH_FILENAME, WORKBUDDY_AUTH_FILE_ENV, WORKBUDDY_CHECKIN_PATH, WORKBUDDY_CONNECT_VERSION, WORKBUDDY_GLOBAL_PROVIDER, WORKBUDDY_HOST_HEARTBEAT_FILENAME, WORKBUDDY_MODELS_REFRESH_PATH, WORKBUDDY_PROBE_PATH, WORKBUDDY_PROVIDER, WORKBUDDY_PROVIDERS, WORKBUDDY_PROVIDER_DISPLAY_NAMES, WORKBUDDY_REGIONS, WORKBUDDY_REGION_PARAM, WORKBUDDY_SETTINGS_NS, WORKBUDDY_STREAM_IDLE_TIMEOUT_MS, WORKBUDDY_TPS_PATH, WORKBUDDY_USAGE_PATH, type WorkBuddyAccountChoice, type WorkBuddyAdapter, type WorkBuddyAuthStatus, type WorkBuddyCandidateFailure, WorkBuddyCatalog, type WorkBuddyChatResult, type WorkBuddyCredential, type WorkBuddyCredentialRecovery, WorkBuddyCredentialRejectedError, WorkBuddyCredentialStore, type WorkBuddyCreditPackage, type WorkBuddyCredits, WorkBuddyEncryptedCredentialError, type WorkBuddyEncryptedField, type WorkBuddyHostHeartbeat, type WorkBuddyModelInfo, type WorkBuddyNativeModality, WorkBuddyPoolPreferences, type WorkBuddyProbeClient, type WorkBuddyProbeOutcome, type WorkBuddyProbeResult, type WorkBuddyProbeStore, type WorkBuddyReasoning, type WorkBuddyRecoveryCandidate, type WorkBuddyRefreshOutcome, WorkBuddyRegionState, type WorkBuddyShim, type WorkBuddyStatusRouteOptions, type WorkBuddyStoreOptions, WorkBuddyUpstreamClient, type WorkBuddyUpstreamModel, type WorkBuddyUsabilityProbeOptions, apply, asVolatile, authFileName, classifyUpstreamError, clearAtRestKeyCache, clearHostHeartbeat, cooldownOf, createAccountUsabilityProbe, createWorkBuddyAdapter, createWorkBuddyShim, creditOfStream, defaultDesktopAuthCandidates, defaultDesktopAuthDirs, defaultDesktopAuthPath, defaultOffModelIds, deriveAtRestKey, deriveAtRestKeyId, deriveCatalog, fallbackModelsFor, fetchAtRestKeyPayload, findWorkbuddyAppExecutable, hasEncryptedCredentialFields, imageDefaultFor, inject, isCredentialRejectedError, isEncryptedCredentialError, isEncryptedFieldWrapper, isHeartbeatProcessAlive, isWorkbuddyBundle, knownRegionOf, legacyAttributionRegion, legacyWorkbuddyOwnAuthPath, macosBundleExecutable, macosNestedAppBundles, modelIdOfBody, name, nativeModalityOf, nextRegionEnabled, nextRegionSlots, offDefaultFor, openEncryptedField, outcomeOfFailure, parseCreditMultiplier, parseReasoning, parseRetryAfter, parseUpstreamModel, parseWorkBuddyAuth, prepareChatBody, probeModel, probeRequestBody, probeSucceeded, processStartTimeMs, readAtRestKey, readHostHeartbeat, regionCleared, regionEnabled, regionEnabledOf, regionOf, regionOfProvider, regionOfStatusUrl, regionStateOf, registerWorkBuddyStatusRoute, resolveCredentialRecovery, selectAccountFor, settingsNamespaceOf, toPersistedWorkBuddyModel, unwrapVolatileDeep, withEffectiveOff, withWorkBuddyRegion, workBuddyDisplayName, workBuddyModelInput, workBuddyThinkingLevelMap, workBuddyWebStatus, workbuddyAccountId, workbuddyAppExecutableCandidates, workbuddyHostHeartbeatPath, workbuddyOwnAuthPath, writeHostHeartbeat };
4500
+ export { CREDENTIAL_REJECTED_CODE, Config, DEFAULT_PROBE_INPUT_TOKENS, ENCRYPTED_CREDENTIAL_CODE, FALLBACK_WORKBUDDY_MODELS, FALLBACK_WORKBUDDY_MODELS_GLOBAL, NATIVE_MODALITY_BY_MODEL_ID, PROBE_INPUT_TOKEN_CHOICES, PROBE_MAX_TOKENS, PROBE_SYSTEM_PROMPT, REFUSES_OFF_MODEL_IDS, type UpstreamErrorKind, WORKBUDDY_ACCOUNTS_REFRESH_PATH, WORKBUDDY_APP_EXECUTABLE_ENV, WORKBUDDY_AUTH_FILENAME, WORKBUDDY_AUTH_FILE_ENV, WORKBUDDY_CHECKIN_PATH, WORKBUDDY_CONNECT_VERSION, WORKBUDDY_GLOBAL_PROVIDER, WORKBUDDY_HOST_HEARTBEAT_FILENAME, WORKBUDDY_MODELS_REFRESH_PATH, WORKBUDDY_PROBE_PATH, WORKBUDDY_PROVIDER, WORKBUDDY_PROVIDERS, WORKBUDDY_PROVIDER_DISPLAY_NAMES, WORKBUDDY_REGIONS, WORKBUDDY_REGION_PARAM, WORKBUDDY_SETTINGS_NS, WORKBUDDY_STREAM_IDLE_TIMEOUT_MS, WORKBUDDY_TPS_PATH, WORKBUDDY_USAGE_PATH, type WorkBuddyAccountChoice, type WorkBuddyAdapter, type WorkBuddyAuthStatus, type WorkBuddyCandidateFailure, WorkBuddyCatalog, type WorkBuddyChatResult, type WorkBuddyCredential, type WorkBuddyCredentialRecovery, WorkBuddyCredentialRejectedError, WorkBuddyCredentialStore, type WorkBuddyCreditPackage, type WorkBuddyCredits, WorkBuddyEncryptedCredentialError, type WorkBuddyEncryptedField, type WorkBuddyHostHeartbeat, type WorkBuddyModelInfo, type WorkBuddyNativeModality, WorkBuddyPoolPreferences, type WorkBuddyProbeClient, type WorkBuddyProbeOutcome, type WorkBuddyProbeResult, type WorkBuddyProbeStore, type WorkBuddyReasoning, type WorkBuddyRecoveryCandidate, type WorkBuddyRefreshOutcome, WorkBuddyRegionState, type WorkBuddyShim, type WorkBuddyStatusRouteOptions, type WorkBuddyStoreOptions, WorkBuddyUpstreamClient, type WorkBuddyUpstreamModel, type WorkBuddyUsabilityProbeOptions, apply, asVolatile, authFileName, classifyUpstreamError, clearAtRestKeyCache, clearHostHeartbeat, cooldownOf, createAccountUsabilityProbe, createWorkBuddyAdapter, createWorkBuddyShim, creditOfStream, defaultDesktopAuthCandidates, defaultDesktopAuthDirs, defaultDesktopAuthPath, defaultOffModelIds, deriveAtRestKey, deriveAtRestKeyId, deriveCatalog, fallbackModelsFor, fetchAtRestKeyPayload, findWorkbuddyAppExecutable, hasEncryptedCredentialFields, imageDefaultFor, inject, isCredentialRejectedError, isEncryptedCredentialError, isEncryptedFieldWrapper, isHeartbeatProcessAlive, isWorkbuddyBundle, knownRegionOf, legacyAttributionRegion, legacyWorkbuddyOwnAuthPath, macosBundleExecutable, macosNestedAppBundles, modelIdOfBody, name, nativeModalityOf, nextRegionEnabled, nextRegionSlots, offDefaultFor, openEncryptedField, outcomeOfFailure, parseCreditMultiplier, parseReasoning, parseRetryAfter, parseUpstreamModel, parseWorkBuddyAuth, prepareChatBody, probeModel, probeRequestBody, probeSucceeded, processStartTimeMs, readAtRestKey, readHostHeartbeat, regionCleared, regionEnabled, regionEnabledOf, regionOf, regionOfProvider, regionOfStatusUrl, regionStateOf, regionsFieldIsCorrupt, regionsMapOf, registerWorkBuddyStatusRoute, resolveCredentialRecovery, selectAccountFor, settingsNamespaceOf, toPersistedWorkBuddyModel, unwrapVolatileDeep, withEffectiveOff, withWorkBuddyRegion, workBuddyDisplayName, workBuddyModelInput, workBuddyThinkingLevelMap, workBuddyWebStatus, workbuddyAccountId, workbuddyAppExecutableCandidates, workbuddyHostHeartbeatPath, workbuddyOwnAuthPath, writeHostHeartbeat };