@prettier-ai/dsh-client-ui-settings-plugins 0.1.2-alpha.1 → 0.1.2-alpha.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/lib/client.js CHANGED
@@ -516,7 +516,7 @@ window.__ModuleLoader__.load({
516
516
  }
517
517
  //#endregion
518
518
  //#region \0dsh-css:/home/runner/work/dsh-publisher/dsh-publisher/upstream/packages/client/ui-settings-plugins/src/client/SubagentModelSelectionCard.module.css.mjs
519
- const css = ".zWjHyq_permission{gap:6px;padding:12px 0;display:grid}.zWjHyq_toggleRow{color:var(--dsw-alias-label-secondary);justify-content:space-between;align-items:flex-start;gap:16px;font-size:13px;line-height:1.5;display:flex}.zWjHyq_toggleLabel{flex:1;min-width:0}.zWjHyq_switch{box-sizing:border-box;background:var(--dsw-alias-border-l3);cursor:pointer;border:0;border-radius:10px;flex:none;width:36px;height:20px;padding:2px;position:relative}.zWjHyq_switchOn{background:var(--dsw-alias-brand-primary)}.zWjHyq_switch:disabled{cursor:default;opacity:.5}.zWjHyq_switch:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.zWjHyq_thumb{background:var(--dsw-alias-label-primary-foreground);border-radius:50%;width:16px;height:16px;transition:transform .12s;display:block}.zWjHyq_switchOn .zWjHyq_thumb{transform:translate(16px)}.zWjHyq_selection{gap:10px;display:grid}.zWjHyq_hint,.zWjHyq_notice,.zWjHyq_invalid,.zWjHyq_conflict{margin:0;font-size:12px;line-height:1.5}.zWjHyq_hint,.zWjHyq_notice{color:var(--dsw-alias-label-tertiary)}.zWjHyq_invalid,.zWjHyq_conflict{color:var(--dsw-alias-label-error)}.zWjHyq_catalogError{color:var(--dsw-alias-label-error);justify-content:space-between;align-items:center;gap:12px;font-size:12px;display:flex}.zWjHyq_catalogError button{color:var(--dsw-alias-brand-primary);cursor:pointer;background:0 0;border:0;padding:0}.zWjHyq_models{border:1px solid var(--dsw-alias-border-l2);border-radius:8px;gap:6px;min-width:0;max-height:280px;margin:0;padding:10px;display:grid;overflow:auto}.zWjHyq_models legend{color:var(--dsw-alias-label-secondary);padding:0 4px;font-size:12px}.zWjHyq_modelGroup{gap:6px;display:grid}.zWjHyq_modelGroup+.zWjHyq_modelGroup{border-top:1px solid var(--dsw-alias-border-l3);margin-top:4px;padding-top:10px}.zWjHyq_providerName{color:var(--dsw-alias-label-tertiary);padding:0 6px;font-size:11px;font-weight:500}.zWjHyq_model{cursor:pointer;border-radius:6px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;min-width:0;padding:6px;display:grid}.zWjHyq_model:hover{background:var(--dsw-alias-bg-layer-4)}.zWjHyq_modelName,.zWjHyq_route{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.zWjHyq_modelName{color:var(--dsw-alias-label-primary);font-size:13px}.zWjHyq_route{color:var(--dsw-alias-label-tertiary);margin-top:2px;font-size:11px}.zWjHyq_unavailable{color:var(--dsw-alias-label-tertiary);font-size:11px}";
519
+ const css = ".zWjHyq_permission{gap:6px;padding:12px 0;display:grid}.zWjHyq_toggleRow{color:var(--dsw-alias-label-primary);justify-content:space-between;align-items:flex-start;gap:16px;font-size:13px;line-height:1.5;display:flex}.zWjHyq_toggleLabel{flex:1;min-width:0}.zWjHyq_switch{box-sizing:border-box;background:var(--dsw-alias-border-l3);cursor:pointer;border:0;border-radius:10px;flex:none;width:36px;height:20px;padding:2px;position:relative}.zWjHyq_switchOn{background:var(--dsw-alias-brand-primary)}.zWjHyq_switch:disabled{cursor:default;opacity:.5}.zWjHyq_switch:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}.zWjHyq_thumb{background:var(--dsw-alias-label-primary-foreground);border-radius:50%;width:16px;height:16px;transition:transform .12s;display:block}.zWjHyq_switchOn .zWjHyq_thumb{transform:translate(16px)}.zWjHyq_selection{gap:10px;display:grid}.zWjHyq_hint,.zWjHyq_notice,.zWjHyq_invalid,.zWjHyq_conflict{margin:0;font-size:12px;line-height:1.5}.zWjHyq_hint,.zWjHyq_notice{color:var(--dsw-alias-label-tertiary)}.zWjHyq_invalid,.zWjHyq_conflict{color:var(--dsw-alias-label-error)}.zWjHyq_catalogError{color:var(--dsw-alias-label-error);justify-content:space-between;align-items:center;gap:12px;font-size:12px;display:flex}.zWjHyq_catalogError button{color:var(--dsw-alias-brand-primary);cursor:pointer;background:0 0;border:0;padding:0}.zWjHyq_models{border:1px solid var(--dsw-alias-border-l2);border-radius:8px;gap:6px;min-width:0;max-height:280px;margin:0;padding:10px;display:grid;overflow:auto}.zWjHyq_models legend{color:var(--dsw-alias-label-secondary);padding:0 4px;font-size:12px}.zWjHyq_modelGroup{gap:6px;display:grid}.zWjHyq_modelGroup+.zWjHyq_modelGroup{border-top:1px solid var(--dsw-alias-border-l3);margin-top:4px;padding-top:10px}.zWjHyq_providerName{color:var(--dsw-alias-label-tertiary);padding:0 6px;font-size:11px;font-weight:500}.zWjHyq_model{cursor:pointer;border-radius:6px;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;min-width:0;padding:6px;display:grid}.zWjHyq_model:hover{background:var(--dsw-alias-bg-layer-4)}.zWjHyq_modelName,.zWjHyq_route{text-overflow:ellipsis;white-space:nowrap;display:block;overflow:hidden}.zWjHyq_modelName{color:var(--dsw-alias-label-primary);font-size:13px}.zWjHyq_route{color:var(--dsw-alias-label-tertiary);margin-top:2px;font-size:11px}.zWjHyq_unavailable{color:var(--dsw-alias-label-tertiary);font-size:11px}";
520
520
  const tagId = "@prettier-ai/dsh-client-ui-settings-plugins/SubagentModelSelectionCard.module.css";
521
521
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
522
522
  const tag = document.createElement("style");
@@ -1218,7 +1218,7 @@ window.__ModuleLoader__.load({
1218
1218
  /** Bridges one settings scope and the live adapter directory onto a staged card. */
1219
1219
  var SubagentModelSelectionCardController = class {
1220
1220
  scope;
1221
- session;
1221
+ ctx;
1222
1222
  catalogGroups = [];
1223
1223
  catalogPartial = false;
1224
1224
  catalogStatus = "idle";
@@ -1235,11 +1235,12 @@ window.__ModuleLoader__.load({
1235
1235
  unsubscribe;
1236
1236
  /**
1237
1237
  * @param scope - bound `subagent-model-selection` settings scope.
1238
- * @param session - Host Session model-catalog face.
1238
+ * @param ctx - the card plugin's context, whose `remote.session` namespace
1239
+ * answers the Host model catalog.
1239
1240
  */
1240
- constructor(scope, session) {
1241
+ constructor(scope, ctx) {
1241
1242
  this.scope = scope;
1242
- this.session = session;
1243
+ this.ctx = ctx;
1243
1244
  this.store = (0, _prettier_ai_dsh_client_store.createSnapshotStore)(this.projection());
1244
1245
  this.unsubscribe = scope.subscribe(() => {
1245
1246
  if (!this.saving && this.draftRoutes !== void 0 && this.scope.getSnapshot().revision !== this.draftRevision) if (this.currentEnabled() === this.enabled() && sameRoutes(this.currentRoutes(), this.desiredRoutes())) this.clearDraft();
@@ -1401,17 +1402,13 @@ window.__ModuleLoader__.load({
1401
1402
  this.catalogStatus = "loading";
1402
1403
  this.catalogPartial = false;
1403
1404
  this.publish();
1404
- try {
1405
- const response = await this.session.modelCatalog();
1406
- if (generation !== this.catalogGeneration) return;
1407
- if (!response.ok) throw new Error(response.error.message);
1405
+ const response = await this.ctx.remote.session.modelCatalog();
1406
+ if (generation !== this.catalogGeneration) return;
1407
+ if (response.ok) {
1408
1408
  this.catalogGroups = response.value.groups;
1409
1409
  this.catalogPartial = response.value.failures.length > 0;
1410
1410
  this.catalogStatus = "ready";
1411
- } catch {
1412
- if (generation !== this.catalogGeneration) return;
1413
- this.catalogStatus = "error";
1414
- }
1411
+ } else this.catalogStatus = "error";
1415
1412
  this.publish();
1416
1413
  }
1417
1414
  projection() {
@@ -1461,7 +1458,7 @@ window.__ModuleLoader__.load({
1461
1458
  /** Bridges the `web-search-deepseek` scope and the credentials domain onto the card. */
1462
1459
  var WebSearchCardController = class {
1463
1460
  scope;
1464
- credentials;
1461
+ ctx;
1465
1462
  form;
1466
1463
  store;
1467
1464
  credential = {
@@ -1471,11 +1468,12 @@ window.__ModuleLoader__.load({
1471
1468
  };
1472
1469
  /**
1473
1470
  * @param scope - the bound settings scope for the `web-search-deepseek` namespace.
1474
- * @param credentials - Remote face used for the credential the section references.
1471
+ * @param ctx - the card plugin's context, whose `remote.credentials` namespace
1472
+ * answers for the credential the section references.
1475
1473
  */
1476
- constructor(scope, credentials) {
1474
+ constructor(scope, ctx) {
1477
1475
  this.scope = scope;
1478
- this.credentials = credentials;
1476
+ this.ctx = ctx;
1479
1477
  this.form = new CardForm(scope, [textField("baseURL"), numberField("maxUses")], [{
1480
1478
  field: API_KEY_FIELD,
1481
1479
  write: (text) => this.writeKey(text)
@@ -1514,12 +1512,7 @@ window.__ModuleLoader__.load({
1514
1512
  };
1515
1513
  this.store.set(this.projection());
1516
1514
  }
1517
- let response;
1518
- try {
1519
- response = await this.credentials.describe([ref]);
1520
- } catch (_credentialReadFailure) {
1521
- return;
1522
- }
1515
+ const response = await this.ctx.remote.credentials.describe([ref]);
1523
1516
  if (!response.ok || ref !== refOf(this.scope.getSnapshot())) return;
1524
1517
  const view = response.value[ref];
1525
1518
  const next = {
@@ -1559,9 +1552,7 @@ window.__ModuleLoader__.load({
1559
1552
  * @returns whether the Host reports a configured credential afterwards.
1560
1553
  */
1561
1554
  async writeKey(value) {
1562
- try {
1563
- await this.credentials.set(refOf(this.scope.getSnapshot()), value);
1564
- } catch (_credentialWriteFailure) {}
1555
+ await this.ctx.remote.credentials.set(refOf(this.scope.getSnapshot()), value);
1565
1556
  await this.readCredential();
1566
1557
  return this.credential.configured;
1567
1558
  }
@@ -1706,7 +1697,6 @@ window.__ModuleLoader__.load({
1706
1697
  const inject = [
1707
1698
  "slots",
1708
1699
  "locale",
1709
- "connection",
1710
1700
  "remote",
1711
1701
  "remote.credentials",
1712
1702
  "remote.session",
@@ -1724,8 +1714,8 @@ window.__ModuleLoader__.load({
1724
1714
  }), "ui-settings-plugins: section dictionaries");
1725
1715
  const bash = new BashCardController(ctx.settingsScope.bind({ namespace: SHELL_NS }));
1726
1716
  const agentLoop = new AgentLoopCardController(ctx.settingsScope.bind({ namespace: AGENT_LOOP_NS }));
1727
- const webSearch = new WebSearchCardController(ctx.settingsScope.bind({ namespace: WEB_SEARCH_NS }), ctx.remote.credentials);
1728
- const subagentModelSelection = new SubagentModelSelectionCardController(ctx.settingsScope.bind({ namespace: SUBAGENT_MODEL_SELECTION_NS }), ctx.remote.session);
1717
+ const webSearch = new WebSearchCardController(ctx.settingsScope.bind({ namespace: WEB_SEARCH_NS }), ctx);
1718
+ const subagentModelSelection = new SubagentModelSelectionCardController(ctx.settingsScope.bind({ namespace: SUBAGENT_MODEL_SELECTION_NS }), ctx);
1729
1719
  ctx.effect(() => ctx.remote.$on("credentials/reference-updated", (ref) => {
1730
1720
  webSearch.refreshCredential(ref);
1731
1721
  }), "ui-settings-plugins: credential invalidations");
@@ -1,5 +1,6 @@
1
1
  /** Staged editor for the Host-owned subagent model allowlist. */
2
- import type { ClientRemote, ModelProviderGroup } from '@prettier-ai/dsh-api-remotes/client';
2
+ import type { Context as ClientContext } from '@prettier-ai/cordis';
3
+ import type { ModelProviderGroup } from '@prettier-ai/dsh-api-remotes/client';
3
4
  import { type SnapshotStore } from '@prettier-ai/dsh-client-store';
4
5
  import type { SettingsScope } from '@prettier-ai/dsh-client-ui-settings/client';
5
6
  import type { CardShell } from './card-form.ts';
@@ -77,7 +78,7 @@ export declare function subagentModelCandidates(groups: readonly ModelProviderGr
77
78
  /** Bridges one settings scope and the live adapter directory onto a staged card. */
78
79
  export declare class SubagentModelSelectionCardController {
79
80
  private readonly scope;
80
- private readonly session;
81
+ private readonly ctx;
81
82
  private catalogGroups;
82
83
  private catalogPartial;
83
84
  private catalogStatus;
@@ -94,9 +95,10 @@ export declare class SubagentModelSelectionCardController {
94
95
  private readonly unsubscribe;
95
96
  /**
96
97
  * @param scope - bound `subagent-model-selection` settings scope.
97
- * @param session - Host Session model-catalog face.
98
+ * @param ctx - the card plugin's context, whose `remote.session` namespace
99
+ * answers the Host model catalog.
98
100
  */
99
- constructor(scope: SettingsScope<SubagentModelSelectionSettings>, session: Pick<ClientRemote['session'], 'modelCatalog'>);
101
+ constructor(scope: SettingsScope<SubagentModelSelectionSettings>, ctx: ClientContext);
100
102
  /** Stop observing settings and suppress late directory/write settlements. */
101
103
  dispose(): void;
102
104
  /**
@@ -8,7 +8,7 @@
8
8
  * section names. It is still staged with the rest of the form, so one save
9
9
  * covers everything the card shows.
10
10
  */
11
- import type { ClientRemote } from '@prettier-ai/dsh-api-remotes/client';
11
+ import type { Context as ClientContext } from '@prettier-ai/cordis';
12
12
  import type { SnapshotStore } from '@prettier-ai/dsh-client-store';
13
13
  import type { SettingsScope } from '@prettier-ai/dsh-client-ui-settings/client';
14
14
  import { type CardActions, type CardFieldState, type CardShell } from './card-form.ts';
@@ -26,8 +26,6 @@ export interface WebSearchSettings {
26
26
  /** Maximum searches served within one request. */
27
27
  maxUses?: number;
28
28
  }
29
- /** The credentials Remote methods this card reads and writes through. */
30
- export type WebSearchCredentials = Pick<ClientRemote['credentials'], 'describe' | 'set'>;
31
29
  /** What the web-search card renders. */
32
30
  export interface WebSearchCardState extends CardShell {
33
31
  /** Provider endpoint. */
@@ -51,15 +49,16 @@ export interface WebSearchCardFace extends CardActions {
51
49
  /** Bridges the `web-search-deepseek` scope and the credentials domain onto the card. */
52
50
  export declare class WebSearchCardController {
53
51
  private readonly scope;
54
- private readonly credentials;
52
+ private readonly ctx;
55
53
  private readonly form;
56
54
  private readonly store;
57
55
  private credential;
58
56
  /**
59
57
  * @param scope - the bound settings scope for the `web-search-deepseek` namespace.
60
- * @param credentials - Remote face used for the credential the section references.
58
+ * @param ctx - the card plugin's context, whose `remote.credentials` namespace
59
+ * answers for the credential the section references.
61
60
  */
62
- constructor(scope: SettingsScope<WebSearchSettings>, credentials: WebSearchCredentials);
61
+ constructor(scope: SettingsScope<WebSearchSettings>, ctx: ClientContext);
63
62
  private projection;
64
63
  /**
65
64
  * Ask the credentials domain about the reference the section currently names.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prettier-ai/dsh-client-ui-settings-plugins",
3
3
  "description": "Plugins settings section with feature-owned tabs and configurable host-plane plugin cards",
4
- "version": "0.1.2-alpha.1",
4
+ "version": "0.1.2-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -32,7 +32,6 @@
32
32
  "dsh": {
33
33
  "client": {
34
34
  "inject": [
35
- "@prettier-ai/dsh-client-connection",
36
35
  "@prettier-ai/dsh-client-locale",
37
36
  "@prettier-ai/dsh-client-ui-settings",
38
37
  "@prettier-ai/dsh-api-remotes"
@@ -42,28 +41,21 @@
42
41
  },
43
42
  "license": "MIT",
44
43
  "peerDependencies": {
45
- "@prettier-ai/cordis": "^4.0.1",
46
- "@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.1",
47
- "@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
48
- "@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
49
- "@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
50
- "@prettier-ai/dsh-client-ui-settings": "^0.1.2-alpha.1",
51
- "@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1"
44
+ "@prettier-ai/cordis": "^4.0.2"
52
45
  },
53
46
  "devDependencies": {
54
47
  "@types/react": "~18.3.1",
55
48
  "react": "^18.2.0",
56
- "@prettier-ai/cordis": "^4.0.1",
57
- "@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
58
- "@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.1",
59
- "@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
60
- "@prettier-ai/dsh-client-store": "^0.1.2-alpha.1",
61
- "@prettier-ai/dsh-client-test-runtime": "^0.1.2-alpha.1",
62
- "@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.1",
63
- "@prettier-ai/dsh-client-ui-settings": "^0.1.2-alpha.1",
64
- "@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
65
- "@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1",
66
- "@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.1"
49
+ "@prettier-ai/cordis": "^4.0.2",
50
+ "@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.2",
51
+ "@prettier-ai/dsh-client-locale": "^0.1.2-alpha.2",
52
+ "@prettier-ai/dsh-client-store": "^0.1.2-alpha.2",
53
+ "@prettier-ai/dsh-client-test-runtime": "^0.1.2-alpha.2",
54
+ "@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.2",
55
+ "@prettier-ai/dsh-client-ui-settings": "^0.1.2-alpha.2",
56
+ "@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.2",
57
+ "@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.2",
58
+ "@prettier-ai/dsh-invariants": "^0.1.2-alpha.2"
67
59
  },
68
60
  "files": [
69
61
  "lib/index.js",