@keystrokehq/cli 0.0.57 → 0.0.58

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 (25) hide show
  1. package/dist/{cat-TSFMZVYS-BSq-M9Nu.mjs → cat-TSFMZVYS-DMyNBPKf.mjs} +2 -2
  2. package/dist/{cat-TSFMZVYS-BSq-M9Nu.mjs.map → cat-TSFMZVYS-DMyNBPKf.mjs.map} +1 -1
  3. package/dist/{cut-OKARJCCV-Bjgnubzp.mjs → cut-OKARJCCV-fEDHIoOh.mjs} +2 -2
  4. package/dist/{cut-OKARJCCV-Bjgnubzp.mjs.map → cut-OKARJCCV-fEDHIoOh.mjs.map} +1 -1
  5. package/dist/{du-572XNP42-ih_3WEGs.mjs → du-572XNP42-DV9yLYm5.mjs} +2 -2
  6. package/dist/{du-572XNP42-ih_3WEGs.mjs.map → du-572XNP42-DV9yLYm5.mjs.map} +1 -1
  7. package/dist/{emit-route-manifest-DRcNXHCP-eJhHqklH.mjs → emit-route-manifest-DRcNXHCP-CODGDvJO.mjs} +16 -12
  8. package/dist/{emit-route-manifest-DRcNXHCP-eJhHqklH.mjs.map → emit-route-manifest-DRcNXHCP-CODGDvJO.mjs.map} +1 -1
  9. package/dist/index.mjs +461 -15
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/{jq-4XLYLOS5-C1mIBs8j.mjs → jq-4XLYLOS5-Cdcdnd8o.mjs} +2 -2
  12. package/dist/{jq-4XLYLOS5-C1mIBs8j.mjs.map → jq-4XLYLOS5-Cdcdnd8o.mjs.map} +1 -1
  13. package/dist/{ls-ZJGQER7M-CQ7yr-Xv.mjs → ls-ZJGQER7M-CDMDL-zO.mjs} +2 -2
  14. package/dist/{ls-ZJGQER7M-CQ7yr-Xv.mjs.map → ls-ZJGQER7M-CDMDL-zO.mjs.map} +1 -1
  15. package/dist/{sort-SW2YEO5B-CmIKAxyP.mjs → sort-SW2YEO5B-qcRJMgfW.mjs} +2 -2
  16. package/dist/{sort-SW2YEO5B-CmIKAxyP.mjs.map → sort-SW2YEO5B-qcRJMgfW.mjs.map} +1 -1
  17. package/dist/{tree-YLD52CNT-CtbVKs_1.mjs → tree-YLD52CNT-su3r52mb.mjs} +2 -2
  18. package/dist/{tree-YLD52CNT-CtbVKs_1.mjs.map → tree-YLD52CNT-su3r52mb.mjs.map} +1 -1
  19. package/dist/{uniq-XSIZR6PB-BSEs-xvr.mjs → uniq-XSIZR6PB-DrCTZpP2.mjs} +2 -2
  20. package/dist/{uniq-XSIZR6PB-BSEs-xvr.mjs.map → uniq-XSIZR6PB-DrCTZpP2.mjs.map} +1 -1
  21. package/dist/{wc-LF7NU4LA-CwnpLOMn.mjs → wc-LF7NU4LA-Bsb9SxJK.mjs} +2 -2
  22. package/dist/{wc-LF7NU4LA-CwnpLOMn.mjs.map → wc-LF7NU4LA-Bsb9SxJK.mjs.map} +1 -1
  23. package/dist/{xan-Y6WF3IRG-3yQmNc-C.mjs → xan-Y6WF3IRG-DiOaB-_6.mjs} +2 -2
  24. package/dist/{xan-Y6WF3IRG-3yQmNc-C.mjs.map → xan-Y6WF3IRG-DiOaB-_6.mjs.map} +1 -1
  25. package/package.json +12 -12
package/dist/index.mjs CHANGED
@@ -7900,6 +7900,15 @@ function createHealthResource(http) {
7900
7900
  }
7901
7901
  } };
7902
7902
  }
7903
+ const registry = /* @__PURE__ */ new Map();
7904
+ /**
7905
+ * Wraps a mock implementation, registering it in the manifest. The returned
7906
+ * function is the unchanged implementation — `mock()` only adds bookkeeping.
7907
+ */
7908
+ function mock(entry, impl) {
7909
+ registry.set(`${entry.domain}.${entry.method}`, entry);
7910
+ return impl;
7911
+ }
7903
7912
  function createOrganizationsResource(http, options = {}) {
7904
7913
  return {
7905
7914
  async list() {
@@ -7959,6 +7968,20 @@ function createOrganizationsResource(http, options = {}) {
7959
7968
  throw await toPlatformError(error);
7960
7969
  }
7961
7970
  },
7971
+ updateProfile: mock({
7972
+ domain: "organizations",
7973
+ method: "updateProfile",
7974
+ plannedEndpoint: "PATCH /api/organizations/active (name)"
7975
+ }, async (input) => {
7976
+ const name = input.name.trim();
7977
+ if (!name) throw new Error("Organization name is required");
7978
+ const organizationId = options.getActiveOrganizationId?.()?.trim();
7979
+ if (!organizationId) throw new Error("Active organization is required to update profile");
7980
+ return {
7981
+ id: organizationId,
7982
+ name
7983
+ };
7984
+ }),
7962
7985
  async checkSlug(slug, options = {}) {
7963
7986
  const searchParams = new URLSearchParams({ slug });
7964
7987
  if (options.excludeOrganizationId) searchParams.set("excludeOrganizationId", options.excludeOrganizationId);
@@ -7998,6 +8021,16 @@ function createProjectsResource(http) {
7998
8021
  throw await toPlatformError(error);
7999
8022
  }
8000
8023
  },
8024
+ update: mock({
8025
+ domain: "projects",
8026
+ method: "update",
8027
+ plannedEndpoint: "PATCH /api/projects/:id"
8028
+ }, async (projectId, patch) => {
8029
+ return {
8030
+ id: projectId,
8031
+ ...patch
8032
+ };
8033
+ }),
8001
8034
  async checkReachability(projectId) {
8002
8035
  try {
8003
8036
  const data = await http.get(`/api/projects/${encodeURIComponent(projectId)}/reachability`, { timeout: PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS }).json();
@@ -8008,14 +8041,87 @@ function createProjectsResource(http) {
8008
8041
  }
8009
8042
  };
8010
8043
  }
8011
- const registry = /* @__PURE__ */ new Map();
8012
- /**
8013
- * Wraps a mock implementation, registering it in the manifest. The returned
8014
- * function is the unchanged implementation — `mock()` only adds bookkeeping.
8015
- */
8016
- function mock(entry, impl) {
8017
- registry.set(`${entry.domain}.${entry.method}`, entry);
8018
- return impl;
8044
+ const DEFAULT_PROJECT_SETTINGS = {
8045
+ description: "",
8046
+ defaultRole: "editor",
8047
+ invitePermission: "admin"
8048
+ };
8049
+ const MOCK_STORAGE_KEY$3 = "keystroke:mock-project-settings:v1";
8050
+ function getBrowserLocalStorage$3() {
8051
+ if (typeof globalThis !== "object") return null;
8052
+ return globalThis.localStorage ?? null;
8053
+ }
8054
+ function normalizeDefaultRole(value) {
8055
+ return value === "admin" ? "admin" : "editor";
8056
+ }
8057
+ function normalizeInvitePermission(value) {
8058
+ return value === "all" ? "all" : "admin";
8059
+ }
8060
+ function normalizeProjectSettings(value) {
8061
+ if (!value || typeof value !== "object") return DEFAULT_PROJECT_SETTINGS;
8062
+ const settings = value;
8063
+ return {
8064
+ description: typeof settings.description === "string" ? settings.description : "",
8065
+ defaultRole: normalizeDefaultRole(settings.defaultRole),
8066
+ invitePermission: normalizeInvitePermission(settings.invitePermission)
8067
+ };
8068
+ }
8069
+ function mergeProjectSettings(current, patch) {
8070
+ return normalizeProjectSettings({
8071
+ ...current,
8072
+ ...patch
8073
+ });
8074
+ }
8075
+ function readSettingsStore() {
8076
+ const localStorage = getBrowserLocalStorage$3();
8077
+ if (!localStorage) return {};
8078
+ try {
8079
+ const raw = localStorage.getItem(MOCK_STORAGE_KEY$3);
8080
+ if (!raw) return {};
8081
+ const parsed = JSON.parse(raw);
8082
+ if (!parsed || typeof parsed !== "object") return {};
8083
+ return Object.fromEntries(Object.entries(parsed).map(([projectId, value]) => [projectId, normalizeProjectSettings(value)]));
8084
+ } catch {
8085
+ return {};
8086
+ }
8087
+ }
8088
+ function writeSettingsStore(store) {
8089
+ const localStorage = getBrowserLocalStorage$3();
8090
+ if (!localStorage) return;
8091
+ try {
8092
+ localStorage.setItem(MOCK_STORAGE_KEY$3, JSON.stringify(store));
8093
+ } catch {}
8094
+ }
8095
+ function requireProjectId(projectId) {
8096
+ const trimmed = projectId.trim();
8097
+ if (!trimmed) throw new Error("Project settings require a project id");
8098
+ return trimmed;
8099
+ }
8100
+ function createProjectSettingsResource() {
8101
+ return {
8102
+ get: mock({
8103
+ domain: "projectSettings",
8104
+ method: "get",
8105
+ plannedEndpoint: "GET /api/projects/:id/settings"
8106
+ }, async (projectId) => {
8107
+ const id = requireProjectId(projectId);
8108
+ return readSettingsStore()[id] ?? DEFAULT_PROJECT_SETTINGS;
8109
+ }),
8110
+ update: mock({
8111
+ domain: "projectSettings",
8112
+ method: "update",
8113
+ plannedEndpoint: "PATCH /api/projects/:id/settings"
8114
+ }, async (projectId, patch) => {
8115
+ const id = requireProjectId(projectId);
8116
+ const store = readSettingsStore();
8117
+ const next = mergeProjectSettings(store[id] ?? DEFAULT_PROJECT_SETTINGS, patch);
8118
+ writeSettingsStore({
8119
+ ...store,
8120
+ [id]: next
8121
+ });
8122
+ return next;
8123
+ })
8124
+ };
8019
8125
  }
8020
8126
  /**
8021
8127
  * The supported-app catalog shown in the "Connect an app" picker. Mirrors the
@@ -9246,7 +9352,7 @@ const apiKeySeed = [
9246
9352
  {
9247
9353
  id: "api-key-local-dev",
9248
9354
  name: "LOCAL_DEV_BLAKE",
9249
- keyPreview: "sk-******J7Pt",
9355
+ keyPreview: "******J7Pt",
9250
9356
  createdAt: "2026-04-20T15:44:00Z",
9251
9357
  createdBy: organizationMemberSeed[0],
9252
9358
  isCreatedByCurrentUser: true
@@ -9254,7 +9360,7 @@ const apiKeySeed = [
9254
9360
  {
9255
9361
  id: "api-key-ci-deploy",
9256
9362
  name: "CI deploy",
9257
- keyPreview: "sk-******TJb7",
9363
+ keyPreview: "******TJb7",
9258
9364
  createdAt: "2026-03-08T15:44:00Z",
9259
9365
  createdBy: organizationMemberSeed[1],
9260
9366
  isCreatedByCurrentUser: false
@@ -9262,7 +9368,7 @@ const apiKeySeed = [
9262
9368
  {
9263
9369
  id: "api-key-partner-webhooks",
9264
9370
  name: "partner_webhooks",
9265
- keyPreview: "sk-******9Qzc",
9371
+ keyPreview: "******9Qzc",
9266
9372
  createdAt: "2026-02-18T15:44:00Z",
9267
9373
  createdBy: organizationMemberSeed[2],
9268
9374
  isCreatedByCurrentUser: false
@@ -9296,6 +9402,13 @@ const recentResourceSeed = [
9296
9402
  }
9297
9403
  ];
9298
9404
  let credentialRecords = [...credentialSeed];
9405
+ function createMockApiKeySecret() {
9406
+ const secret = `sk_${`${Date.now().toString(36)}${Math.random().toString(36).slice(2, 10)}`}`;
9407
+ return {
9408
+ secret,
9409
+ keyPreview: `******${secret.slice(-4)}`
9410
+ };
9411
+ }
9299
9412
  function createAgentsResource() {
9300
9413
  return {
9301
9414
  list: mock({
@@ -9481,16 +9594,20 @@ function createApiKeysResource() {
9481
9594
  method: "create",
9482
9595
  plannedEndpoint: "POST /api/api-keys"
9483
9596
  }, async (input) => {
9597
+ const { secret, keyPreview } = createMockApiKeySecret();
9484
9598
  const created = {
9485
9599
  id: `api-key-${Date.now().toString(36)}`,
9486
9600
  name: input.name,
9487
- keyPreview: "sk-******mock",
9601
+ keyPreview,
9488
9602
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
9489
9603
  createdBy: organizationMemberSeed[0],
9490
9604
  isCreatedByCurrentUser: true
9491
9605
  };
9492
9606
  apiKeyRecords = [created, ...apiKeyRecords];
9493
- return created;
9607
+ return {
9608
+ ...created,
9609
+ secret
9610
+ };
9494
9611
  }),
9495
9612
  revoke: mock({
9496
9613
  domain: "apiKeys",
@@ -9508,6 +9625,328 @@ function createRecentsResource() {
9508
9625
  plannedEndpoint: "GET /api/recents"
9509
9626
  }, async () => recentResourceSeed) };
9510
9627
  }
9628
+ const MOCK_STORAGE_KEY$2 = "keystroke:mock-organization-sidebar-branding:v1";
9629
+ function getBrowserLocalStorage$2() {
9630
+ if (typeof globalThis !== "object") return null;
9631
+ return globalThis.localStorage ?? null;
9632
+ }
9633
+ const DEFAULT_ORGANIZATION_SIDEBAR_BRANDING = {
9634
+ customSidebarLogoEnabled: false,
9635
+ customSidebarLogoExplicitlyDisabled: false,
9636
+ sidebarLogoLightDataUrl: null,
9637
+ sidebarLogoDarkDataUrl: null,
9638
+ sidebarLogoHeightPx: 20
9639
+ };
9640
+ function normalizeSidebarLogoDataUrl(value) {
9641
+ if (typeof value !== "string" || !value.startsWith("data:image/")) return null;
9642
+ return value;
9643
+ }
9644
+ function normalizeCustomSidebarLogoEnabled(value, branding) {
9645
+ const hasCustomLogo = Boolean(normalizeSidebarLogoDataUrl(branding.sidebarLogoLightDataUrl) || normalizeSidebarLogoDataUrl(branding.sidebarLogoDarkDataUrl));
9646
+ if (branding.customSidebarLogoExplicitlyDisabled === true) return false;
9647
+ if (typeof value === "boolean") return value || hasCustomLogo;
9648
+ return hasCustomLogo;
9649
+ }
9650
+ function normalizeSidebarLogoHeightPx(value) {
9651
+ if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_ORGANIZATION_SIDEBAR_BRANDING.sidebarLogoHeightPx;
9652
+ return Math.min(32, Math.max(14, Math.round(value)));
9653
+ }
9654
+ function normalizeOrganizationSidebarBranding(value) {
9655
+ if (!value || typeof value !== "object") return DEFAULT_ORGANIZATION_SIDEBAR_BRANDING;
9656
+ const branding = value;
9657
+ return {
9658
+ customSidebarLogoEnabled: normalizeCustomSidebarLogoEnabled(branding.customSidebarLogoEnabled, branding),
9659
+ customSidebarLogoExplicitlyDisabled: branding.customSidebarLogoExplicitlyDisabled === true,
9660
+ sidebarLogoLightDataUrl: normalizeSidebarLogoDataUrl(branding.sidebarLogoLightDataUrl),
9661
+ sidebarLogoDarkDataUrl: normalizeSidebarLogoDataUrl(branding.sidebarLogoDarkDataUrl),
9662
+ sidebarLogoHeightPx: normalizeSidebarLogoHeightPx(branding.sidebarLogoHeightPx)
9663
+ };
9664
+ }
9665
+ function mergeOrganizationSidebarBranding(current, patch) {
9666
+ return normalizeOrganizationSidebarBranding({
9667
+ ...current,
9668
+ ...patch
9669
+ });
9670
+ }
9671
+ function readBrandingStore() {
9672
+ const localStorage = getBrowserLocalStorage$2();
9673
+ if (!localStorage) return {};
9674
+ try {
9675
+ const raw = localStorage.getItem(MOCK_STORAGE_KEY$2);
9676
+ if (!raw) return {};
9677
+ const parsed = JSON.parse(raw);
9678
+ if (!parsed || typeof parsed !== "object") return {};
9679
+ return Object.fromEntries(Object.entries(parsed).map(([organizationId, value]) => [organizationId, normalizeOrganizationSidebarBranding(value)]));
9680
+ } catch {
9681
+ return {};
9682
+ }
9683
+ }
9684
+ function writeBrandingStore(store) {
9685
+ const localStorage = getBrowserLocalStorage$2();
9686
+ if (!localStorage) return;
9687
+ try {
9688
+ localStorage.setItem(MOCK_STORAGE_KEY$2, JSON.stringify(store));
9689
+ } catch {}
9690
+ }
9691
+ function resolveOrganizationId(getActiveOrganizationId) {
9692
+ const organizationId = getActiveOrganizationId()?.trim();
9693
+ if (!organizationId) throw new Error("Organization sidebar branding requires an active organization");
9694
+ return organizationId;
9695
+ }
9696
+ function createOrganizationSidebarBrandingResource(options) {
9697
+ return {
9698
+ get: mock({
9699
+ domain: "organizationSidebarBranding",
9700
+ method: "get",
9701
+ plannedEndpoint: "GET /api/organizations/active/branding"
9702
+ }, async () => {
9703
+ const organizationId = resolveOrganizationId(options.getActiveOrganizationId ?? (() => null));
9704
+ return readBrandingStore()[organizationId] ?? DEFAULT_ORGANIZATION_SIDEBAR_BRANDING;
9705
+ }),
9706
+ update: mock({
9707
+ domain: "organizationSidebarBranding",
9708
+ method: "update",
9709
+ plannedEndpoint: "PATCH /api/organizations/active/branding"
9710
+ }, async (patch) => {
9711
+ const organizationId = resolveOrganizationId(options.getActiveOrganizationId ?? (() => null));
9712
+ const store = readBrandingStore();
9713
+ const next = mergeOrganizationSidebarBranding(store[organizationId] ?? DEFAULT_ORGANIZATION_SIDEBAR_BRANDING, patch);
9714
+ writeBrandingStore({
9715
+ ...store,
9716
+ [organizationId]: next
9717
+ });
9718
+ return next;
9719
+ })
9720
+ };
9721
+ }
9722
+ const MOCK_STORAGE_KEY$1 = "keystroke:mock-user-preferences:v1";
9723
+ function getBrowserLocalStorage$1() {
9724
+ if (typeof globalThis !== "object") return null;
9725
+ return globalThis.localStorage ?? null;
9726
+ }
9727
+ const DEFAULT_USER_SIDEBAR_PREFERENCES = {
9728
+ navIconVisibility: "visible",
9729
+ footerChatRowVisibility: "visible",
9730
+ hiddenNavItemIds: ["registry"],
9731
+ topNavItemOrderIds: [],
9732
+ workspaceNavItemOrderIds: []
9733
+ };
9734
+ const DEFAULT_USER_PREFERENCES = {
9735
+ interfaceTheme: "system",
9736
+ surfaceContrast: "on",
9737
+ layoutMode: "linear",
9738
+ fontSize: "default",
9739
+ sidebar: DEFAULT_USER_SIDEBAR_PREFERENCES,
9740
+ favorites: [],
9741
+ projectOrderIds: [],
9742
+ projectDotColors: {},
9743
+ onboardingTabVisible: true,
9744
+ lastSignInMethod: null
9745
+ };
9746
+ function normalizeInterfaceTheme(value) {
9747
+ if (value === "light" || value === "dark") return value;
9748
+ return "system";
9749
+ }
9750
+ function normalizeSurfaceContrast(value) {
9751
+ return value === "off" ? "off" : "on";
9752
+ }
9753
+ function normalizeLayoutMode(value) {
9754
+ return value === "default" ? "default" : "linear";
9755
+ }
9756
+ function normalizeFontSize(value) {
9757
+ return value === "large" ? "large" : "default";
9758
+ }
9759
+ function normalizeStringList(value) {
9760
+ if (!Array.isArray(value)) return [];
9761
+ return Array.from(new Set(value.filter((item) => typeof item === "string")));
9762
+ }
9763
+ function normalizeHiddenNavItemIds(value) {
9764
+ if (!Array.isArray(value)) return DEFAULT_USER_SIDEBAR_PREFERENCES.hiddenNavItemIds;
9765
+ return normalizeStringList(value);
9766
+ }
9767
+ function normalizeSidebarPreferences(value) {
9768
+ if (!value || typeof value !== "object") return DEFAULT_USER_SIDEBAR_PREFERENCES;
9769
+ const sidebar = value;
9770
+ return {
9771
+ navIconVisibility: sidebar.navIconVisibility === "visible" ? "visible" : "hidden",
9772
+ footerChatRowVisibility: sidebar.footerChatRowVisibility === "hidden" ? "hidden" : "visible",
9773
+ hiddenNavItemIds: normalizeHiddenNavItemIds(sidebar.hiddenNavItemIds),
9774
+ topNavItemOrderIds: normalizeStringList(sidebar.topNavItemOrderIds),
9775
+ workspaceNavItemOrderIds: normalizeStringList(sidebar.workspaceNavItemOrderIds)
9776
+ };
9777
+ }
9778
+ function isWorkspaceFavoriteKind(value) {
9779
+ return value === "agent" || value === "workflow" || value === "skill";
9780
+ }
9781
+ function normalizeFavorites(value) {
9782
+ if (!Array.isArray(value)) return [];
9783
+ const seenKeys = /* @__PURE__ */ new Set();
9784
+ const favorites = [];
9785
+ for (const item of value) {
9786
+ if (!item || typeof item !== "object") continue;
9787
+ const favorite = item;
9788
+ if (typeof favorite.kind !== "string" || !isWorkspaceFavoriteKind(favorite.kind) || typeof favorite.resourceId !== "string" || favorite.resourceId.length === 0) continue;
9789
+ const key = `${favorite.kind}:${favorite.resourceId}`;
9790
+ if (seenKeys.has(key)) continue;
9791
+ seenKeys.add(key);
9792
+ favorites.push({
9793
+ kind: favorite.kind,
9794
+ resourceId: favorite.resourceId
9795
+ });
9796
+ }
9797
+ return favorites;
9798
+ }
9799
+ function normalizeProjectDotColors(value) {
9800
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
9801
+ return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[0] === "string" && typeof entry[1] === "string"));
9802
+ }
9803
+ function normalizeOnboardingTabVisible(value) {
9804
+ return typeof value === "boolean" ? value : DEFAULT_USER_PREFERENCES.onboardingTabVisible;
9805
+ }
9806
+ function normalizeLastSignInMethod(value) {
9807
+ if (value === "google" || value === "github" || value === "email") return value;
9808
+ return null;
9809
+ }
9810
+ function normalizeUserPreferences(value) {
9811
+ if (!value || typeof value !== "object") return DEFAULT_USER_PREFERENCES;
9812
+ const preferences = value;
9813
+ return {
9814
+ interfaceTheme: normalizeInterfaceTheme(preferences.interfaceTheme),
9815
+ surfaceContrast: normalizeSurfaceContrast(preferences.surfaceContrast),
9816
+ layoutMode: normalizeLayoutMode(preferences.layoutMode),
9817
+ fontSize: normalizeFontSize(preferences.fontSize),
9818
+ sidebar: normalizeSidebarPreferences(preferences.sidebar),
9819
+ favorites: normalizeFavorites(preferences.favorites),
9820
+ projectOrderIds: normalizeStringList(preferences.projectOrderIds),
9821
+ projectDotColors: normalizeProjectDotColors(preferences.projectDotColors),
9822
+ onboardingTabVisible: normalizeOnboardingTabVisible(preferences.onboardingTabVisible),
9823
+ lastSignInMethod: normalizeLastSignInMethod(preferences.lastSignInMethod)
9824
+ };
9825
+ }
9826
+ function mergeUserPreferences(current, patch) {
9827
+ return normalizeUserPreferences({
9828
+ ...current,
9829
+ ...patch,
9830
+ sidebar: patch.sidebar ? {
9831
+ ...current.sidebar,
9832
+ ...patch.sidebar
9833
+ } : current.sidebar
9834
+ });
9835
+ }
9836
+ function readPreferencesStore() {
9837
+ const localStorage = getBrowserLocalStorage$1();
9838
+ if (!localStorage) return {};
9839
+ try {
9840
+ const raw = localStorage.getItem(MOCK_STORAGE_KEY$1);
9841
+ if (!raw) return {};
9842
+ const parsed = JSON.parse(raw);
9843
+ if (!parsed || typeof parsed !== "object") return {};
9844
+ const entries = Object.entries(parsed);
9845
+ return Object.fromEntries(entries.map(([userId, value]) => [userId, normalizeUserPreferences(value)]));
9846
+ } catch {
9847
+ return {};
9848
+ }
9849
+ }
9850
+ function writePreferencesStore(store) {
9851
+ const localStorage = getBrowserLocalStorage$1();
9852
+ if (!localStorage) return;
9853
+ try {
9854
+ localStorage.setItem(MOCK_STORAGE_KEY$1, JSON.stringify(store));
9855
+ } catch {}
9856
+ }
9857
+ function resolveUserId$1(getCurrentUserId) {
9858
+ const userId = getCurrentUserId()?.trim();
9859
+ if (!userId) throw new Error("User preferences require an authenticated user");
9860
+ return userId;
9861
+ }
9862
+ function createUserPreferencesResource(options) {
9863
+ return {
9864
+ get: mock({
9865
+ domain: "userPreferences",
9866
+ method: "get",
9867
+ plannedEndpoint: "GET /api/account/preferences"
9868
+ }, async () => {
9869
+ const userId = resolveUserId$1(options.getCurrentUserId ?? (() => null));
9870
+ return readPreferencesStore()[userId] ?? DEFAULT_USER_PREFERENCES;
9871
+ }),
9872
+ update: mock({
9873
+ domain: "userPreferences",
9874
+ method: "update",
9875
+ plannedEndpoint: "PATCH /api/account/preferences"
9876
+ }, async (patch) => {
9877
+ const userId = resolveUserId$1(options.getCurrentUserId ?? (() => null));
9878
+ const store = readPreferencesStore();
9879
+ const next = mergeUserPreferences(store[userId] ?? DEFAULT_USER_PREFERENCES, patch);
9880
+ writePreferencesStore({
9881
+ ...store,
9882
+ [userId]: next
9883
+ });
9884
+ return next;
9885
+ })
9886
+ };
9887
+ }
9888
+ const DEFAULT_USER_AVATAR = { dataUrl: null };
9889
+ const MOCK_STORAGE_KEY = "keystroke:mock-user-avatar:v1";
9890
+ function getBrowserLocalStorage() {
9891
+ if (typeof globalThis !== "object") return null;
9892
+ return globalThis.localStorage ?? null;
9893
+ }
9894
+ function normalizeUserAvatar(value) {
9895
+ if (!value || typeof value !== "object") return DEFAULT_USER_AVATAR;
9896
+ const dataUrl = value.dataUrl;
9897
+ return { dataUrl: typeof dataUrl === "string" && dataUrl.length > 0 ? dataUrl : null };
9898
+ }
9899
+ function readAvatarStore() {
9900
+ const localStorage = getBrowserLocalStorage();
9901
+ if (!localStorage) return {};
9902
+ try {
9903
+ const raw = localStorage.getItem(MOCK_STORAGE_KEY);
9904
+ if (!raw) return {};
9905
+ const parsed = JSON.parse(raw);
9906
+ if (!parsed || typeof parsed !== "object") return {};
9907
+ return Object.fromEntries(Object.entries(parsed).map(([userId, value]) => [userId, normalizeUserAvatar(value)]));
9908
+ } catch {
9909
+ return {};
9910
+ }
9911
+ }
9912
+ function writeAvatarStore(store) {
9913
+ const localStorage = getBrowserLocalStorage();
9914
+ if (!localStorage) return;
9915
+ try {
9916
+ localStorage.setItem(MOCK_STORAGE_KEY, JSON.stringify(store));
9917
+ } catch {}
9918
+ }
9919
+ function resolveUserId(getCurrentUserId) {
9920
+ const userId = getCurrentUserId()?.trim();
9921
+ if (!userId) throw new Error("User avatar requires an authenticated user");
9922
+ return userId;
9923
+ }
9924
+ function createUserAvatarResource(options) {
9925
+ return {
9926
+ get: mock({
9927
+ domain: "userAvatar",
9928
+ method: "get",
9929
+ plannedEndpoint: "GET /api/account/avatar"
9930
+ }, async () => {
9931
+ const userId = resolveUserId(options.getCurrentUserId ?? (() => null));
9932
+ return readAvatarStore()[userId] ?? DEFAULT_USER_AVATAR;
9933
+ }),
9934
+ update: mock({
9935
+ domain: "userAvatar",
9936
+ method: "update",
9937
+ plannedEndpoint: "PATCH /api/account/avatar"
9938
+ }, async (patch) => {
9939
+ const userId = resolveUserId(options.getCurrentUserId ?? (() => null));
9940
+ const store = readAvatarStore();
9941
+ const next = normalizeUserAvatar({ dataUrl: patch.dataUrl });
9942
+ writeAvatarStore({
9943
+ ...store,
9944
+ [userId]: next
9945
+ });
9946
+ return next;
9947
+ })
9948
+ };
9949
+ }
9511
9950
  function createPlatformClient(options) {
9512
9951
  const auth = options.auth ?? { type: "none" };
9513
9952
  const base = normalizeBaseUrl(options.baseUrl);
@@ -9528,9 +9967,13 @@ function createPlatformClient(options) {
9528
9967
  return {
9529
9968
  http,
9530
9969
  health: createHealthResource(http),
9531
- organizations: createOrganizationsResource(http, { onActiveOrganizationChange: setActiveOrganizationId }),
9970
+ organizations: createOrganizationsResource(http, {
9971
+ onActiveOrganizationChange: setActiveOrganizationId,
9972
+ getActiveOrganizationId: () => activeOrganizationId
9973
+ }),
9532
9974
  projects: createProjectsResource(http),
9533
9975
  artifacts: createArtifactsResource(http),
9976
+ projectSettings: createProjectSettingsResource(),
9534
9977
  agents: createAgentsResource(),
9535
9978
  workflows: createWorkflowsResource(),
9536
9979
  skills: createSkillsResource(),
@@ -9543,6 +9986,9 @@ function createPlatformClient(options) {
9543
9986
  members: createMembersResource(),
9544
9987
  apiKeys: createApiKeysResource(),
9545
9988
  recents: createRecentsResource(),
9989
+ userPreferences: createUserPreferencesResource({ getCurrentUserId: options.getCurrentUserId }),
9990
+ userAvatar: createUserAvatarResource({ getCurrentUserId: options.getCurrentUserId }),
9991
+ organizationSidebarBranding: createOrganizationSidebarBrandingResource({ getActiveOrganizationId: () => activeOrganizationId }),
9546
9992
  getActiveOrganizationId: () => activeOrganizationId,
9547
9993
  setActiveOrganizationId
9548
9994
  };
@@ -13915,7 +14361,7 @@ async function buildApp(options = {}) {
13915
14361
  root
13916
14362
  }));
13917
14363
  if (options.emitRouteManifest !== false) {
13918
- const { emitRouteManifest } = await import("./emit-route-manifest-DRcNXHCP-eJhHqklH.mjs");
14364
+ const { emitRouteManifest } = await import("./emit-route-manifest-DRcNXHCP-CODGDvJO.mjs");
13919
14365
  await emitRouteManifest(root);
13920
14366
  }
13921
14367
  } finally {