@jxsuite/studio 4.0.0 → 4.1.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 (86) hide show
  1. package/dist/chunks/{2020-xp8vnwma.js → 2020-n6tfwnda.js} +2 -2
  2. package/dist/chunks/{Overlay.dev-723bv0df.js → Overlay.dev-etqjwyf9.js} +4 -4
  3. package/dist/chunks/cf-account-picker-en86v7x7.js +163 -0
  4. package/dist/chunks/{content-source-t88vb2dr.js → content-source-48xg86wj.js} +17 -17
  5. package/dist/chunks/{convert-to-repeater-dhw1nrz9.js → convert-to-repeater-43tfn7cs.js} +24 -24
  6. package/dist/chunks/{entry-commands-6z6bhxg0.js → entry-commands-e63f1xc0.js} +20 -20
  7. package/dist/chunks/{extension-sections-3ydgjbdy.js → extension-sections-txv08xxg.js} +23 -23
  8. package/dist/chunks/{file-ops-rskmhxyq.js → file-ops-wbh4hhsx.js} +16 -16
  9. package/dist/chunks/{files-0cratsr0.js → files-3kfkwhk4.js} +25 -24
  10. package/dist/chunks/{focus-trap.esm-ggawf1hy.js → focus-trap.esm-9t2drp0g.js} +6 -5
  11. package/dist/chunks/{format-host-tgcmfs4p.js → format-host-w16q81tf.js} +2 -2
  12. package/dist/chunks/fs-events-hrrg328g.js +1 -1
  13. package/dist/chunks/{git-panel-0yywyk76.js → git-panel-532whr1y.js} +16 -15
  14. package/dist/chunks/{index-nj44jpzj.js → index-wcnt3r9g.js} +2 -2
  15. package/dist/chunks/{jx-validate-8q2g05x1.js → jx-validate-8er6gbxy.js} +3 -3
  16. package/dist/chunks/{layers-panel-z3tqe5cd.js → layers-panel-07hm7g5j.js} +19 -19
  17. package/dist/chunks/{monaco-setup-rws7k4br.js → monaco-setup-vx9bhp1d.js} +2 -2
  18. package/dist/chunks/{publish-panel-54jvhskq.js → publish-panel-v9st96ja.js} +11 -10
  19. package/dist/chunks/{quick-search-cgfmjwq5.js → quick-search-zccjp6gv.js} +26 -25
  20. package/dist/chunks/{right-panel-cqp8bc4v.js → right-panel-vm3b6kwy.js} +17 -17
  21. package/dist/chunks/{sp-overlay.dev-yztmtrs1.js → sp-overlay.dev-qgvhnxf4.js} +5 -5
  22. package/dist/chunks/{sp-tooltip.dev-xcvpnqr0.js → sp-tooltip.dev-4sastdnw.js} +3 -3
  23. package/dist/chunks/{studio-txwkm6p9.js → studio-0bq6eh7v.js} +2 -2
  24. package/dist/chunks/studio-1ngbejft.js +181 -0
  25. package/dist/chunks/{studio-gv8vvshc.js → studio-1wagb550.js} +3 -3
  26. package/dist/chunks/{studio-kjjsjak4.js → studio-2b946z26.js} +58 -57
  27. package/dist/chunks/{studio-4pqqxbrt.js → studio-3bqpr0zh.js} +16 -16
  28. package/dist/chunks/{studio-v38hmvx1.js → studio-4b5z1x43.js} +42 -8
  29. package/dist/chunks/{studio-9c4k4vhv.js → studio-4n2b5gzb.js} +4 -4
  30. package/dist/chunks/{studio-p8j86wag.js → studio-4r1pv6zf.js} +2 -2
  31. package/dist/chunks/{studio-mmv72a27.js → studio-5fx3g9jg.js} +29 -48
  32. package/dist/chunks/{studio-5rywrkxz.js → studio-5myknm0a.js} +42 -42
  33. package/dist/chunks/{studio-sf7zjgv1.js → studio-6yw4y3my.js} +3 -3
  34. package/dist/chunks/{studio-pdfjntbk.js → studio-950k0dx6.js} +35 -35
  35. package/dist/chunks/{studio-eenfkt4e.js → studio-ahn3pdgx.js} +5 -5
  36. package/dist/chunks/{studio-eesa1myv.js → studio-b55y6ewx.js} +9 -9
  37. package/dist/chunks/{studio-cb12yz9w.js → studio-cmb03bg5.js} +99 -1264
  38. package/dist/chunks/studio-dm19q43r.js +195 -0
  39. package/dist/chunks/{studio-ahjfdy6e.js → studio-ef49pnzx.js} +6 -6
  40. package/dist/chunks/{studio-wx5609xd.js → studio-ew0djmhg.js} +10 -10
  41. package/dist/chunks/{studio-9r6j5ev1.js → studio-f3wqjtk5.js} +4 -3
  42. package/dist/chunks/{studio-8swrjbny.js → studio-fbf92ckf.js} +14 -14
  43. package/dist/chunks/{studio-4q0wznzf.js → studio-gcye7qka.js} +442 -126
  44. package/dist/chunks/{studio-ex8zyp98.js → studio-gfgb8pe6.js} +23 -184
  45. package/dist/chunks/{studio-r1r7afxx.js → studio-jc994dnr.js} +24 -24
  46. package/dist/chunks/{studio-yxrkyv8a.js → studio-jkftxyvz.js} +52 -3416
  47. package/dist/chunks/{studio-hbtp0eh1.js → studio-msd847zn.js} +13 -13
  48. package/dist/chunks/{studio-kyk2v92a.js → studio-mtfnaqs9.js} +14 -14
  49. package/dist/chunks/{studio-vadzgkrz.js → studio-n6j9t10q.js} +2 -2
  50. package/dist/chunks/{studio-68n67094.js → studio-q9jd1a60.js} +4 -4
  51. package/dist/chunks/studio-qcy05dp8.js +1743 -0
  52. package/dist/chunks/{studio-htsf0w6m.js → studio-qjy2z9bv.js} +12 -30
  53. package/dist/chunks/{studio-2zkz8evn.js → studio-trxrabqf.js} +12 -12
  54. package/dist/chunks/{studio-5q69gfag.js → studio-x4qkdat5.js} +12 -11
  55. package/dist/chunks/studio-x813zp48.js +195 -0
  56. package/dist/chunks/{studio-1hbqnt19.js → studio-zqazsct2.js} +29 -29
  57. package/dist/chunks/{workspace-xpres40v.js → workspace-fjx52ryv.js} +4 -4
  58. package/dist/iframe-entry.js +34 -33
  59. package/dist/manifest.json +7 -0
  60. package/dist/studio.js +534 -546
  61. package/favicon.ico +0 -0
  62. package/index.html +1 -0
  63. package/package.json +15 -14
  64. package/src/about/about-modal.ts +4 -3
  65. package/src/files/files.ts +6 -4
  66. package/src/files/media-paths.ts +13 -42
  67. package/src/files/media-usage.ts +41 -131
  68. package/src/hosting/document.ts +2 -0
  69. package/src/hosting/layout.ts +8 -0
  70. package/src/new-project/import-tab.ts +37 -15
  71. package/src/new-project/location-fields.ts +8 -5
  72. package/src/panels/ai-chat/composer.ts +10 -0
  73. package/src/platforms/cloud.ts +241 -70
  74. package/src/publish/publish-panel.ts +62 -2
  75. package/src/services/ai-import-tools.ts +50 -12
  76. package/src/services/ai-models.ts +108 -1
  77. package/src/services/context-manager.ts +12 -1
  78. package/src/services/tool-executor.ts +11 -0
  79. package/src/settings/preferences-accounts.ts +193 -12
  80. package/src/settings/preferences-dialog.ts +75 -18
  81. package/src/types.ts +27 -3
  82. package/src/ui/ai-managed-connect.ts +62 -13
  83. package/src/ui/ai-model-picker.ts +29 -2
  84. package/src/ui/cf-account-picker.ts +200 -0
  85. package/styles/shell.css +36 -0
  86. package/dist/chunks/studio-bw5dz6km.js +0 -608
@@ -0,0 +1,195 @@
1
+ import {
2
+ SETTINGS,
3
+ clearSettings,
4
+ hasSetting,
5
+ onSettingsChanged,
6
+ readStoredSetting,
7
+ setSetting,
8
+ setSettings
9
+ } from "./studio-92ab2jqe.js";
10
+ import {
11
+ getPlatform
12
+ } from "./studio-9ab8gqsm.js";
13
+
14
+ // src/services/ai-settings.ts
15
+ function getOpenAiKey() {
16
+ return readStoredSetting(SETTINGS.aiOpenAiKey);
17
+ }
18
+ function setOpenAiKey(key) {
19
+ setSetting(SETTINGS.aiOpenAiKey, key || "");
20
+ }
21
+ function hasOpenAiKey() {
22
+ return hasSetting(SETTINGS.aiOpenAiKey);
23
+ }
24
+ function getBaseUrl() {
25
+ return readStoredSetting(SETTINGS.aiBaseUrl);
26
+ }
27
+ function storedModel() {
28
+ return readStoredSetting(SETTINGS.aiModel);
29
+ }
30
+ function setModel(modelId) {
31
+ setSetting(SETTINGS.aiModel, modelId || "");
32
+ }
33
+ function saveAiProvider(provider) {
34
+ setSettings([
35
+ [SETTINGS.aiOpenAiKey, provider.apiKey],
36
+ [SETTINGS.aiBaseUrl, provider.baseUrl],
37
+ [SETTINGS.aiModel, provider.model]
38
+ ]);
39
+ }
40
+ function clearAiProvider() {
41
+ clearSettings([SETTINGS.aiOpenAiKey, SETTINGS.aiBaseUrl, SETTINGS.aiModel]);
42
+ }
43
+
44
+ // src/services/ai-models.ts
45
+ function aiConnection() {
46
+ return { apiKey: getOpenAiKey(), baseUrl: getBaseUrl() };
47
+ }
48
+ function fingerprint(credentials) {
49
+ return `${credentials.apiKey}\x00${credentials.baseUrl}`;
50
+ }
51
+ var cache = null;
52
+ var cacheKey = "";
53
+ var proxyConfigured = false;
54
+ var proxyManaged = false;
55
+ var proxyDefaultModel = "";
56
+ var proxyCode;
57
+ var proxyProbe = null;
58
+ var probeListeners = new Set;
59
+ var PROBE_STALE_MS = 600000;
60
+ var probeSettledAt = 0;
61
+ var probeRefreshInstalled = false;
62
+ function resetModelCache() {
63
+ cache = null;
64
+ cacheKey = "";
65
+ proxyConfigured = false;
66
+ proxyManaged = false;
67
+ proxyDefaultModel = "";
68
+ proxyCode = undefined;
69
+ proxyProbe = null;
70
+ probeSettledAt = 0;
71
+ }
72
+ var CONNECTION_KEYS = new Set([
73
+ SETTINGS.aiOpenAiKey.key,
74
+ SETTINGS.aiBaseUrl.key,
75
+ SETTINGS.cfToken.key,
76
+ SETTINGS.cfAccountId.key
77
+ ]);
78
+ onSettingsChanged((keys) => {
79
+ if (keys.some((key) => CONNECTION_KEYS.has(key))) {
80
+ resetModelCache();
81
+ }
82
+ });
83
+ function cachedModels(credentials) {
84
+ return cache && cacheKey === fingerprint(credentials) ? cache : null;
85
+ }
86
+ function cachedModel(id) {
87
+ return cache?.find((model) => model.id === id);
88
+ }
89
+ function modelToolSupport(id) {
90
+ return cachedModel(id)?.toolSupport;
91
+ }
92
+ function modelContextWindow(id) {
93
+ return cachedModel(id)?.contextWindow;
94
+ }
95
+ function ensureProxyProbe(onSettled) {
96
+ if (onSettled) {
97
+ probeListeners.add(onSettled);
98
+ }
99
+ proxyProbe ??= fetchAvailableModels({ force: true }).catch(() => {}).then(() => {
100
+ probeSettledAt = Date.now();
101
+ for (const notify of probeListeners) {
102
+ notify();
103
+ }
104
+ });
105
+ }
106
+ function refreshStaleProbe() {
107
+ if (!proxyManaged || probeSettledAt === 0 || Date.now() - probeSettledAt < PROBE_STALE_MS) {
108
+ return false;
109
+ }
110
+ proxyProbe = null;
111
+ probeSettledAt = 0;
112
+ ensureProxyProbe();
113
+ return true;
114
+ }
115
+ function installProbeRefresh() {
116
+ if (typeof window === "undefined" || probeRefreshInstalled) {
117
+ return;
118
+ }
119
+ probeRefreshInstalled = true;
120
+ window.addEventListener("focus", () => {
121
+ refreshStaleProbe();
122
+ });
123
+ }
124
+ installProbeRefresh();
125
+ function hasAiCredentials() {
126
+ return hasOpenAiKey() || isProxyConfigured();
127
+ }
128
+ function isProxyConfigured() {
129
+ return proxyConfigured;
130
+ }
131
+ function isManagedProxy() {
132
+ return proxyManaged;
133
+ }
134
+ function proxyStateCode() {
135
+ return proxyCode;
136
+ }
137
+ function getProxyDefaultModel() {
138
+ return proxyDefaultModel;
139
+ }
140
+ function preferredModel() {
141
+ return storedModel() || getProxyDefaultModel() || SETTINGS.aiModel.default;
142
+ }
143
+ function siblingRoute(chatUrl, segment) {
144
+ let url;
145
+ try {
146
+ url = new URL(chatUrl, "http://jx.invalid");
147
+ } catch {
148
+ return chatUrl;
149
+ }
150
+ url.pathname = url.pathname.replace(/[^/]*$/, segment);
151
+ return /^https?:/i.test(chatUrl) ? url.href : `${url.pathname}${url.search}`;
152
+ }
153
+ async function fetchAvailableModels(opts = {}) {
154
+ const credentials = opts.credentials ?? aiConnection();
155
+ const key = fingerprint(credentials);
156
+ if (cache && cacheKey === key && !opts.force) {
157
+ return cache;
158
+ }
159
+ const plat = getPlatform();
160
+ const chatUrl = await Promise.resolve(plat.aiChatUrl());
161
+ const modelsUrl = siblingRoute(chatUrl, "models");
162
+ const headers = {};
163
+ if (credentials.apiKey) {
164
+ headers["X-Api-Key"] = credentials.apiKey;
165
+ }
166
+ if (credentials.baseUrl) {
167
+ headers["X-Api-Base-URL"] = credentials.baseUrl;
168
+ }
169
+ const resp = await fetch(modelsUrl, { headers });
170
+ if (!resp.ok) {
171
+ throw new Error(`HTTP ${resp.status}`);
172
+ }
173
+ const data = await resp.json();
174
+ proxyConfigured = data.configured === true;
175
+ proxyManaged = data.managed === true;
176
+ proxyDefaultModel = data.defaultModel ?? "";
177
+ proxyCode = data.code;
178
+ cache = (data.models || []).map((m) => {
179
+ const model = { id: m.id, name: m.name || m.id };
180
+ if (typeof m.contextWindow === "number") {
181
+ model.contextWindow = m.contextWindow;
182
+ }
183
+ if (typeof m.toolSupport === "boolean") {
184
+ model.toolSupport = m.toolSupport;
185
+ }
186
+ return model;
187
+ });
188
+ cacheKey = key;
189
+ return cache;
190
+ }
191
+
192
+ export { getOpenAiKey, setOpenAiKey, hasOpenAiKey, getBaseUrl, storedModel, setModel, saveAiProvider, clearAiProvider, aiConnection, resetModelCache, cachedModels, modelToolSupport, modelContextWindow, ensureProxyProbe, hasAiCredentials, isProxyConfigured, isManagedProxy, proxyStateCode, preferredModel, fetchAvailableModels };
193
+
194
+ //# debugId=B5FEB391B6B9721764756E2164756E21
195
+ //# sourceMappingURL=studio-dm19q43r.js.map
@@ -1,7 +1,10 @@
1
1
  import {
2
2
  shell,
3
3
  updateSiteConfig
4
- } from "./studio-hbtp0eh1.js";
4
+ } from "./studio-msd847zn.js";
5
+ import {
6
+ projectState
7
+ } from "./studio-p4ngc046.js";
5
8
  import {
6
9
  activeRegistry
7
10
  } from "./studio-t7qb9db8.js";
@@ -9,9 +12,6 @@ import {
9
12
  html,
10
13
  nothing
11
14
  } from "./studio-kryvsw6j.js";
12
- import {
13
- projectState
14
- } from "./studio-p4ngc046.js";
15
15
  import {
16
16
  getPlatform
17
17
  } from "./studio-9ab8gqsm.js";
@@ -383,5 +383,5 @@ function renderDeployChecklist() {
383
383
 
384
384
  export { platformSupportsPublish, listAccounts, latestDeployment, writeDeployConfig, connectDeploy, currentDeploy, noteDeployment, deployStatusItem, renderDeployChecklist };
385
385
 
386
- //# debugId=6D496EF6B2E92A5764756E2164756E21
387
- //# sourceMappingURL=studio-ahjfdy6e.js.map
386
+ //# debugId=0CDC7B7E4FF1BF6164756E2164756E21
387
+ //# sourceMappingURL=studio-ef49pnzx.js.map
@@ -1,19 +1,22 @@
1
1
  import {
2
2
  validateProjectConfig
3
- } from "./studio-68n67094.js";
3
+ } from "./studio-q9jd1a60.js";
4
4
  import {
5
5
  renderForm,
6
6
  resolveContextPointer
7
- } from "./studio-5q69gfag.js";
7
+ } from "./studio-x4qkdat5.js";
8
8
  import {
9
9
  deriveSecretEnvName
10
- } from "./studio-4pqqxbrt.js";
10
+ } from "./studio-3bqpr0zh.js";
11
11
  import {
12
12
  paneOfContainer
13
- } from "./studio-kjjsjak4.js";
13
+ } from "./studio-2b946z26.js";
14
14
  import {
15
15
  commitProjectConfig
16
- } from "./studio-hbtp0eh1.js";
16
+ } from "./studio-msd847zn.js";
17
+ import {
18
+ projectState
19
+ } from "./studio-p4ngc046.js";
17
20
  import {
18
21
  paneRegion
19
22
  } from "./studio-t7qb9db8.js";
@@ -28,9 +31,6 @@ import {
28
31
  nothing,
29
32
  render
30
33
  } from "./studio-kryvsw6j.js";
31
- import {
32
- projectState
33
- } from "./studio-p4ngc046.js";
34
34
  import {
35
35
  getPlatform
36
36
  } from "./studio-9ab8gqsm.js";
@@ -337,5 +337,5 @@ function renderMapLayout(contribution, opts, rerender, paneId) {
337
337
 
338
338
  export { selectContributedEntry, renderContributedSection };
339
339
 
340
- //# debugId=1F1C350DE28120E764756E2164756E21
341
- //# sourceMappingURL=studio-wx5609xd.js.map
340
+ //# debugId=4A4373631E35B2FD64756E2164756E21
341
+ //# sourceMappingURL=studio-ew0djmhg.js.map
@@ -563,7 +563,7 @@ var schema_default = {
563
563
  type: "object"
564
564
  },
565
565
  ClassMethodDef: {
566
- description: "A class method or accessor definition. Capability roles (parse, serialize, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",
566
+ description: "A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",
567
567
  properties: {
568
568
  $prototype: {
569
569
  const: "Function",
@@ -633,6 +633,7 @@ var schema_default = {
633
633
  "accessor",
634
634
  "parse",
635
635
  "serialize",
636
+ "rewrite",
636
637
  "discover",
637
638
  "load",
638
639
  "projectData",
@@ -24292,5 +24293,5 @@ var project_schema_default = {
24292
24293
 
24293
24294
  export { schema_default, project_schema_default };
24294
24295
 
24295
- //# debugId=F6573EA50C013C9D64756E2164756E21
24296
- //# sourceMappingURL=studio-9r6j5ev1.js.map
24296
+ //# debugId=1B8D337EFC897DC464756E2164756E21
24297
+ //# sourceMappingURL=studio-f3wqjtk5.js.map
@@ -1,27 +1,34 @@
1
1
  import {
2
2
  parseMediaEntries,
3
3
  schemeOfQuery
4
- } from "./studio-pdfjntbk.js";
4
+ } from "./studio-950k0dx6.js";
5
5
  import {
6
6
  mediaDisplayName,
7
7
  mountStylebookCanvas,
8
8
  panToStylebookTag,
9
9
  serializeJxPath,
10
10
  tabOfPane
11
- } from "./studio-kjjsjak4.js";
11
+ } from "./studio-2b946z26.js";
12
12
  import {
13
13
  getEffectiveMedia,
14
14
  getEffectiveStyle,
15
15
  shell
16
- } from "./studio-hbtp0eh1.js";
16
+ } from "./studio-msd847zn.js";
17
17
  import {
18
18
  activeTab,
19
19
  isSpliceablePath,
20
20
  varDisplayName
21
- } from "./studio-2zkz8evn.js";
21
+ } from "./studio-trxrabqf.js";
22
22
  import {
23
23
  classMap
24
24
  } from "./studio-m3hwn7y1.js";
25
+ import {
26
+ componentRegistry
27
+ } from "./studio-bgxt93ga.js";
28
+ import {
29
+ projectState,
30
+ updateSession
31
+ } from "./studio-p4ngc046.js";
25
32
  import {
26
33
  live,
27
34
  ref,
@@ -31,13 +38,6 @@ import {
31
38
  html,
32
39
  render
33
40
  } from "./studio-kryvsw6j.js";
34
- import {
35
- componentRegistry
36
- } from "./studio-bgxt93ga.js";
37
- import {
38
- projectState,
39
- updateSession
40
- } from "./studio-p4ngc046.js";
41
41
  import {
42
42
  __require
43
43
  } from "./studio-a0tswy0w.js";
@@ -873,7 +873,7 @@ function defaultCommands(deps) {
873
873
  description: "Turn the selected element into a repeater template, rendering it once per item of a " + "data collection the author picks in the dialog this opens."
874
874
  },
875
875
  run: () => {
876
- import("./convert-to-repeater-dhw1nrz9.js").then(({ convertToRepeater }) => convertToRepeater());
876
+ import("./convert-to-repeater-43tfn7cs.js").then(({ convertToRepeater }) => convertToRepeater());
877
877
  }
878
878
  },
879
879
  {
@@ -1077,5 +1077,5 @@ function inspectorFocusCommands(deps) {
1077
1077
 
1078
1078
  export { transposeStylebookStyle, PROJECT_STYLES_TITLE, PROJECT_STYLES_VIEW, tokenLabel, groupTokens, listTokenContexts, readTokenOverride, writeTokenOverride, addableContexts, stylebook_meta_default, renderStylebookMode, selectStylebookTag, INSPECTOR_TABS, noopCommandDeps, defaultCommands };
1079
1079
 
1080
- //# debugId=1C28C0702015039E64756E2164756E21
1081
- //# sourceMappingURL=studio-8swrjbny.js.map
1080
+ //# debugId=3813E2C630DE133B64756E2164756E21
1081
+ //# sourceMappingURL=studio-fbf92ckf.js.map