@eddyskywalker/dsh-chatgpt-subscription 0.94.1 → 0.95.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.
Files changed (28) hide show
  1. package/lib/client.js +203 -11
  2. package/lib/client.js.map +1 -1
  3. package/lib/codemode.js +1 -1
  4. package/lib/index.js +402 -71
  5. package/lib/{preset-sync-gvhSzmlr.js → preset-sync-6QI9tVA0.js} +1 -1
  6. package/lib/types/client/features/advisor/AdvisorModelOption.d.ts.map +1 -1
  7. package/lib/types/client/features/advisor/skin-effort-card.d.ts +65 -0
  8. package/lib/types/client/features/advisor/skin-effort-card.d.ts.map +1 -0
  9. package/lib/types/client/features/advisor/styles.d.ts.map +1 -1
  10. package/lib/types/compat.d.ts +1 -1
  11. package/lib/types/host/providers/claude-api/mapper.d.ts.map +1 -1
  12. package/lib/types/host/runtime/advisor/index.d.ts.map +1 -1
  13. package/lib/types/host/runtime/advisor/request.d.ts.map +1 -1
  14. package/lib/types/host/runtime/advisor/selection-store.d.ts +37 -6
  15. package/lib/types/host/runtime/advisor/selection-store.d.ts.map +1 -1
  16. package/lib/types/host/runtime/presets/agent-preset.d.ts +38 -0
  17. package/lib/types/host/runtime/presets/agent-preset.d.ts.map +1 -1
  18. package/lib/types/host/runtime/presets/preset-sync.d.ts.map +1 -1
  19. package/lib/types/host/runtime/presets/team-board-sweep.d.ts +50 -0
  20. package/lib/types/host/runtime/presets/team-board-sweep.d.ts.map +1 -0
  21. package/lib/types/index.d.ts.map +1 -1
  22. package/lib/types/shared/advisor-contracts.d.ts +1 -1
  23. package/lib/types/shared/advisor-contracts.d.ts.map +1 -1
  24. package/package.json +19 -19
  25. package/presets/dispatch/agent.cordis.yml +1 -0
  26. package/presets/team/README.md +68 -0
  27. package/presets/team/agent.cordis.yml +422 -0
  28. package/presets/team/preset.yml +3 -0
package/lib/client.js CHANGED
@@ -72130,6 +72130,92 @@ window.__ModuleLoader__.load({
72130
72130
  //#region src/shared/advisor-contracts.ts
72131
72131
  const ADVISOR_STATE_PATH = "/advisor/state";
72132
72132
  //#endregion
72133
+ //#region src/client/features/advisor/skin-effort-card.ts
72134
+ const CONTROL_ID = "effort-card";
72135
+ /**
72136
+ * Write the disabled marks the skin documents for this control: `data-disabled`
72137
+ * on the slider root and `aria-disabled` on its track. The skin's slider has no
72138
+ * button of its own to disable, so the caller owns both the marks and the guard
72139
+ * that actually drops a pick (AdvisorModelOption's onPick).
72140
+ */
72141
+ function setSkinEffortDisabled(card, disabled) {
72142
+ const root = card.querySelector(".dsh-claude-effort");
72143
+ if (root === null) return;
72144
+ const track = root.querySelector("[role=\"slider\"]");
72145
+ if (disabled) {
72146
+ root.setAttribute("data-disabled", "");
72147
+ track?.setAttribute("aria-disabled", "true");
72148
+ return;
72149
+ }
72150
+ root.removeAttribute("data-disabled");
72151
+ track?.removeAttribute("aria-disabled");
72152
+ }
72153
+ function controls() {
72154
+ if (typeof window === "undefined") return null;
72155
+ const api = window.__DSH_CLAUDE_STYLE_CONTROLS__;
72156
+ return api !== void 0 && typeof api.has === "function" && typeof api.mount === "function" ? api : null;
72157
+ }
72158
+ /**
72159
+ * Whether the page carries a skin that can host this control. Read at render
72160
+ * time: the skin and this plugin load in either order, and the seat re-renders
72161
+ * when the card opens, so a skin that arrived after the first paint is seen.
72162
+ */
72163
+ function canMountSkinEffortCard() {
72164
+ const api = controls();
72165
+ if (api === null) return false;
72166
+ try {
72167
+ return api.has(CONTROL_ID);
72168
+ } catch {
72169
+ return false;
72170
+ }
72171
+ }
72172
+ /**
72173
+ * Mount the skin's effort card into a card this plugin holds.
72174
+ *
72175
+ * The skin paints its own accent tint on the element it builds, so the marks
72176
+ * this plugin owns are re-applied after every repaint rather than once at
72177
+ * mount: the level changes under an open card whenever a pick lands.
72178
+ *
72179
+ * @returns the teardown, or null when the page carries no such skin.
72180
+ */
72181
+ function mountSkinEffortCard(options) {
72182
+ const api = controls();
72183
+ if (api === null || !canMountSkinEffortCard()) return null;
72184
+ const tint = () => {
72185
+ const root = options.card.querySelector(".dsh-claude-effort");
72186
+ if (root === null) return;
72187
+ const value = options.tint?.() ?? null;
72188
+ if (value === null) root.removeAttribute("data-tint");
72189
+ else {
72190
+ root.setAttribute("data-tint", "");
72191
+ root.style.setProperty("--dsh-claude-effort-tint", String(value));
72192
+ }
72193
+ };
72194
+ let mount;
72195
+ try {
72196
+ mount = api.mount(CONTROL_ID, {
72197
+ ...options,
72198
+ onReady: (drive) => {
72199
+ tint();
72200
+ options.onReady?.({
72201
+ measure: () => drive.measure(),
72202
+ wake: () => drive.wake(),
72203
+ update: () => {
72204
+ drive.update();
72205
+ tint();
72206
+ }
72207
+ });
72208
+ }
72209
+ });
72210
+ } catch {
72211
+ options.card.replaceChildren();
72212
+ return null;
72213
+ }
72214
+ return () => {
72215
+ mount();
72216
+ };
72217
+ }
72218
+ //#endregion
72133
72219
  //#region src/client/features/advisor/AdvisorModelOption.tsx
72134
72220
  function AdvisorReasoningSlider({ selection, directory, pending, locked, update, t }) {
72135
72221
  const model = (0, react.useSyncExternalStore)((cb) => directory.subscribe(cb), () => directory.getSnapshot()).groups.find((group) => group.id === selection.provider)?.models.find((item) => item.id === selection.model);
@@ -72466,12 +72552,36 @@ window.__ModuleLoader__.load({
72466
72552
  ]
72467
72553
  }), document.body)] });
72468
72554
  }
72555
+ /**
72556
+ * The resting rung's place on the skin's accent ramp (0-100), or null while the
72557
+ * seat rests in its own ink. Mirrors the skin's own ladder rule: the switch-off
72558
+ * levels carry no strength, so they take no colour.
72559
+ */
72560
+ function restingTint(efforts, id) {
72561
+ if (id === void 0 || id === "none" || id === "off") return null;
72562
+ const at = efforts.findIndex((effort) => effort.id === id);
72563
+ if (at < 0 || efforts.length < 2) return null;
72564
+ return Math.round(at / (efforts.length - 1) * 100);
72565
+ }
72469
72566
  /** Reasoning seat: the same effort ladder as the main model, for the advisor model. */
72470
72567
  function AdvisorEffortTrigger(props) {
72471
72568
  const { sessionId, locked, reportFailure, t } = props;
72472
72569
  const api = props.api ?? advisorApi;
72473
72570
  const { anchor, open, style, openPanel, close, cancelClose, scheduleClose } = usePanelMotion();
72474
72571
  const { state, pending, update } = useAdvisorState(sessionId, api, reportFailure, t);
72572
+ /** Whether the skin's own effort card can host this seat (skin-effort-card.ts). */
72573
+ const [skinFailed, setSkinFailed] = (0, react.useState)(false);
72574
+ const skin = !skinFailed && canMountSkinEffortCard();
72575
+ const cardRef = (0, react.useRef)(null);
72576
+ const driveRef = (0, react.useRef)(null);
72577
+ const sourceRef = (0, react.useRef)(null);
72578
+ const pickRef = (0, react.useRef)(() => void 0);
72579
+ const tintRef = (0, react.useRef)(null);
72580
+ /** The seat's own gate: the skin's slider takes no disabled state of its own. */
72581
+ const lockedRef = (0, react.useRef)(locked);
72582
+ const pendingRef = (0, react.useRef)(pending);
72583
+ lockedRef.current = locked;
72584
+ pendingRef.current = pending;
72475
72585
  (0, react.useEffect)(() => {
72476
72586
  props.load();
72477
72587
  }, [props.load]);
@@ -72493,6 +72603,51 @@ window.__ModuleLoader__.load({
72493
72603
  };
72494
72604
  }, [open]);
72495
72605
  const snapshot = (0, react.useSyncExternalStore)((cb) => props.directory.subscribe(cb), () => props.directory.getSnapshot());
72606
+ (0, react.useEffect)(() => {
72607
+ if (!open || !skin) return;
72608
+ const card = cardRef.current;
72609
+ if (card === null) return;
72610
+ const stop = mountSkinEffortCard({
72611
+ card,
72612
+ read: () => sourceRef.current,
72613
+ onPick: (levelId) => {
72614
+ pickRef.current(levelId);
72615
+ },
72616
+ disabled: locked || pending,
72617
+ tint: () => tintRef.current,
72618
+ onReady: (drive) => {
72619
+ driveRef.current = drive;
72620
+ drive.update();
72621
+ drive.wake();
72622
+ }
72623
+ });
72624
+ if (stop === null) {
72625
+ setSkinFailed(true);
72626
+ return;
72627
+ }
72628
+ return () => {
72629
+ driveRef.current = null;
72630
+ stop();
72631
+ };
72632
+ }, [
72633
+ open,
72634
+ skin,
72635
+ sessionId
72636
+ ]);
72637
+ (0, react.useEffect)(() => {
72638
+ if (!open || !skin) return;
72639
+ driveRef.current?.update();
72640
+ driveRef.current?.wake();
72641
+ const card = cardRef.current;
72642
+ if (card !== null) setSkinEffortDisabled(card, locked || pending);
72643
+ }, [
72644
+ open,
72645
+ skin,
72646
+ snapshot,
72647
+ state?.selection,
72648
+ locked,
72649
+ pending
72650
+ ]);
72496
72651
  if (state === null || state.sessionId !== sessionId || !state.enabled || state.selection === null) return null;
72497
72652
  const selected = state.selection;
72498
72653
  const model = snapshot.groups.find((group) => group.id === selected.provider)?.models.find((item) => item.id === selected.model);
@@ -72500,31 +72655,59 @@ window.__ModuleLoader__.load({
72500
72655
  if (efforts.length === 0) return null;
72501
72656
  const currentId = selected.reasoningEffort ?? model?.reasoning?.defaultEffort ?? efforts[0].id;
72502
72657
  const currentEffort = efforts.find((effort) => effort.id === currentId) ?? efforts[0];
72658
+ const tint = restingTint(efforts, currentId);
72659
+ sourceRef.current = {
72660
+ reasoning: {
72661
+ defaultEffort: model?.reasoning?.defaultEffort,
72662
+ efforts: efforts.map((effort) => ({
72663
+ id: effort.id,
72664
+ name: effort.name
72665
+ }))
72666
+ },
72667
+ effective: currentId,
72668
+ label: currentEffort.name
72669
+ };
72670
+ pickRef.current = (levelId) => {
72671
+ if (lockedRef.current || pendingRef.current) return;
72672
+ if (levelId === selected.reasoningEffort) return;
72673
+ update({ selection: {
72674
+ ...selected,
72675
+ reasoningEffort: levelId
72676
+ } });
72677
+ };
72678
+ tintRef.current = tint;
72679
+ const width = skin ? 264 : 232;
72503
72680
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
72504
72681
  ref: anchor,
72505
72682
  type: "button",
72506
72683
  className: "dshadv-effort-trigger",
72684
+ "data-tint": tint === null ? void 0 : "",
72685
+ style: tint === null ? void 0 : { "--dshadv-effort-tint": String(tint) },
72507
72686
  "aria-haspopup": "dialog",
72508
72687
  "aria-expanded": open,
72509
72688
  "aria-label": `${t("reasoning")} ${currentEffort.name}`,
72510
72689
  disabled: locked,
72511
- onPointerEnter: (event) => openPanel(event.currentTarget, 232),
72512
- onMouseEnter: (event) => openPanel(event.currentTarget, 232),
72513
- onFocus: (event) => openPanel(event.currentTarget, 232),
72514
- onClick: (event) => openPanel(event.currentTarget, 232),
72690
+ onPointerEnter: (event) => openPanel(event.currentTarget, width),
72691
+ onMouseEnter: (event) => openPanel(event.currentTarget, width),
72692
+ onFocus: (event) => openPanel(event.currentTarget, width),
72693
+ onClick: (event) => openPanel(event.currentTarget, width),
72515
72694
  onPointerLeave: scheduleClose,
72516
72695
  children: currentEffort.name
72517
72696
  }), open && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
72518
72697
  id: "dshadv-effort-popover",
72519
- className: "dshadv-popover dshadv-effort-popover",
72520
72698
  role: "dialog",
72521
72699
  "aria-label": t("reasoning"),
72522
72700
  style,
72701
+ "data-open": skin ? "true" : void 0,
72702
+ className: skin ? "dshadv-popover dshadv-effort-popover dsh-claude-popover-card dsh-claude-effort-popover" : "dshadv-popover dshadv-effort-popover",
72523
72703
  onPointerEnter: cancelClose,
72524
72704
  onMouseEnter: cancelClose,
72525
72705
  onPointerLeave: scheduleClose,
72526
72706
  onMouseLeave: scheduleClose,
72527
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AdvisorReasoningSlider, {
72707
+ children: skin ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
72708
+ ref: cardRef,
72709
+ className: "dshadv-skin-effort"
72710
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AdvisorReasoningSlider, {
72528
72711
  selection: selected,
72529
72712
  directory: props.directory,
72530
72713
  pending,
@@ -72610,12 +72793,21 @@ window.__ModuleLoader__.load({
72610
72793
  //#endregion
72611
72794
  //#region src/client/features/advisor/styles.ts
72612
72795
  const CSS$2 = `
72613
- .dshadv-trigger{align-items:center;background:transparent;border:0;border-radius:14px;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer;display:inline-flex;font:inherit;font-size:13px;gap:0;height:28px;max-width:200px;padding:0 4px;white-space:nowrap}
72614
- .dshadv-trigger:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.18));color:var(--dsw-alias-label-primary,#e8e8e8)}
72615
- .dshadv-trigger:disabled{cursor:default;opacity:.5}
72796
+ /* One type for the composer's bottom line, shared with the seats beside it:
72797
+ 13px at the page's own interface scale, weight 500, the primary ink receded
72798
+ through the skin's footer strength when a skin supplies one. The advisor's
72799
+ two seats are the model seat and the level seat drawn again, so they read
72800
+ from the same numbers rather than a look of their own. */
72801
+ .dshadv-trigger,.dshadv-effort-trigger{align-items:center;background:transparent;border:0;border-radius:6px;box-sizing:border-box;color:var(--dsw-alias-label-primary,#e8e8e8);cursor:pointer;display:inline-flex;font:inherit;font-family:var(--dsw-font-family,inherit);font-size:calc(13px * var(--dsh-claude-interface-font-scale,1));font-weight:500;gap:0;height:var(--dsh-claude-footer-control-height,28px);letter-spacing:normal;line-height:20px;max-width:200px;opacity:var(--dsh-claude-footer-ink-opacity,1);padding:0 4px;transition:background 120ms ease,color 120ms ease,opacity 120ms ease;white-space:nowrap}
72802
+ .dshadv-trigger:hover,.dshadv-effort-trigger:hover{background:var(--dsh-claude-hover-bg,var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.18)));color:var(--dsw-alias-label-primary,#e8e8e8);opacity:var(--dsh-claude-footer-ink-hover-opacity,1)}
72803
+ .dshadv-trigger:disabled,.dshadv-effort-trigger:disabled{cursor:default;opacity:.5}
72616
72804
  .dshadv-trigger-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
72617
- .dshadv-trigger[data-enabled=true]{color:var(--dsw-alias-brand-primary,#397ee8)}
72618
- .dshadv-effort-trigger{background:transparent;border:0;border-radius:14px;color:var(--dsw-alias-label-secondary,#b8b8b8);cursor:pointer;font:inherit;font-size:13px;height:28px;padding:0 4px;white-space:nowrap}.dshadv-effort-trigger:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.18));color:var(--dsw-alias-label-primary,#e8e8e8)}.dshadv-effort-trigger:disabled{cursor:default;opacity:.5}.dshadv-effort-popover{padding:8px 6px 6px}.dshadv-popover{background:var(--dsw-alias-bg-overlay,#242422);border:1px solid var(--dsw-alias-border-secondary,rgba(127,127,127,.28));border-radius:10px;box-shadow:0 12px 36px rgba(0,0,0,.32);box-sizing:border-box;display:flex;flex-direction:column;overflow:hidden;transform-origin:bottom right;z-index:2147482000;animation:dshadv-pop-in 160ms cubic-bezier(.22,.61,.36,1)}@keyframes dshadv-pop-in{from{opacity:0;transform:scale(.96) translateY(4px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.dshadv-effort-fill,.dshadv-effort-knob{transition:none}.dshadv-popover{animation:none}}
72805
+ /* Advisor off: the seat keeps its shape and recedes to the secondary ink. */
72806
+ .dshadv-trigger[data-enabled=false]{color:var(--dsw-alias-label-secondary,#b8b8b8)}
72807
+ /* The level's rung takes the skin's effort ramp on its own trigger, the same
72808
+ two marks the skin writes on the composer's level seat: no skin, no tint. */
72809
+ body[data-dsh-claude-style][data-dsh-claude-effort-accent] .dshadv-effort-trigger[data-tint]{--dshadv-seat-ramp:color-mix(in oklch,var(--dsh-claude-effort-low,var(--dsw-alias-brand-primary,#397ee8)),var(--dsh-claude-effort-high,var(--dsw-alias-brand-primary,#397ee8)) calc(var(--dshadv-effort-tint,0)*1%));color:hsl(from var(--dshadv-seat-ramp) calc(h + (359 * clamp(0,(h - 180)*1000,1) - h) * var(--dshadv-effort-tint,0) * 0.0025) s l)}
72810
+ .dshadv-effort-popover{padding:8px 6px 6px}.dshadv-skin-effort{display:block}.dshadv-skin-effort [data-disabled]{opacity:.55;pointer-events:none}.dshadv-popover{background:var(--dsw-alias-bg-overlay,#242422);border:1px solid var(--dsw-alias-border-secondary,rgba(127,127,127,.28));border-radius:10px;box-shadow:0 12px 36px rgba(0,0,0,.32);box-sizing:border-box;display:flex;flex-direction:column;overflow:hidden;transform-origin:bottom right;z-index:2147482000;animation:dshadv-pop-in 160ms cubic-bezier(.22,.61,.36,1)}@keyframes dshadv-pop-in{from{opacity:0;transform:scale(.96) translateY(4px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.dshadv-effort-fill,.dshadv-effort-knob{transition:none}.dshadv-popover{animation:none}}
72619
72811
  .dshadv-off-hint{color:var(--dsw-alias-label-tertiary,#9a9a9a);font-size:12px;margin:10px 12px;text-align:center}.dshadv-popover-head{align-items:center;border-bottom:1px solid var(--dsw-alias-border-secondary,rgba(127,127,127,.18));display:flex;flex:none;gap:8px;justify-content:space-between;padding:9px 12px}
72620
72812
  .dshadv-popover-title{color:var(--dsw-alias-label-primary,#e8e8e8);font-size:13px;font-weight:500}
72621
72813
  .dshadv-popover-foot{border-top:1px solid var(--dsw-alias-border-secondary,rgba(127,127,127,.18));flex:none;padding:2px 4px 8px}