@widgetic/creator 0.4.35 → 0.4.36
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/dist/CreatorApp.svelte
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
import type {
|
|
32
32
|
Middleware,
|
|
33
33
|
GenerateCodeRequest,
|
|
34
|
-
|
|
34
|
+
ListLlmModels200ResponseModelsInner
|
|
35
35
|
} from '@widgetic/api-sdk';
|
|
36
36
|
import { parseVersionPreviewError } from './utils/versionPreviewError.js';
|
|
37
37
|
import { widgetBuilderRequestInit } from './utils/widgetBuilderRequest.js';
|
|
@@ -769,7 +769,7 @@
|
|
|
769
769
|
// An account matter: a visitor of a partner has no trial and no balance of their own to show.
|
|
770
770
|
if (!usersClient || !mayShowAccountBilling()) return;
|
|
771
771
|
try {
|
|
772
|
-
const accepted = await usersClient.
|
|
772
|
+
const accepted = await usersClient.getPersonalBillingRaw();
|
|
773
773
|
const body = await accepted.raw.json();
|
|
774
774
|
const data = (body && typeof body === 'object' && 'data' in body ? body.data : body) as {
|
|
775
775
|
trialActive?: boolean;
|
|
@@ -5902,13 +5902,13 @@
|
|
|
5902
5902
|
try {
|
|
5903
5903
|
// Use AgentApi from SDK - no need for manual fetch
|
|
5904
5904
|
// Clients are initialized once via initializeAuthenticatedClients() after login
|
|
5905
|
-
const response = await agentClient.
|
|
5905
|
+
const response = await agentClient.listLlmModels();
|
|
5906
5906
|
// console.log('[WidgetCreator] Models API response:', response);
|
|
5907
5907
|
|
|
5908
5908
|
// SDK returns { success, models } directly (not nested under data)
|
|
5909
5909
|
if (response.success && Array.isArray(response.models)) {
|
|
5910
5910
|
// Transform API response to match our interface
|
|
5911
|
-
availableModels = response.models.map((m:
|
|
5911
|
+
availableModels = response.models.map((m: ListLlmModels200ResponseModelsInner) => ({
|
|
5912
5912
|
id: m.id ?? '',
|
|
5913
5913
|
name: m.displayName ?? '',
|
|
5914
5914
|
provider: (m.provider ?? '').charAt(0).toUpperCase() + (m.provider ?? '').slice(1), // Capitalize provider
|
|
@@ -6659,7 +6659,7 @@
|
|
|
6659
6659
|
try {
|
|
6660
6660
|
let snapshot: OperationSnapshot | null = null;
|
|
6661
6661
|
try {
|
|
6662
|
-
const answer = await client.
|
|
6662
|
+
const answer = await client.getOperationRaw({ id: operationId });
|
|
6663
6663
|
snapshot = readOperationBody(await answer.raw.json());
|
|
6664
6664
|
} catch (error) {
|
|
6665
6665
|
const httpStatus = httpStatusOfFailure(error);
|
|
@@ -8995,7 +8995,7 @@
|
|
|
8995
8995
|
async function fetchRepoHeadCommitSha(widgetId: string): Promise<string | null> {
|
|
8996
8996
|
if (!widgetId || !agentClient) return null;
|
|
8997
8997
|
try {
|
|
8998
|
-
const json = await agentClient.
|
|
8998
|
+
const json = await agentClient.getWidgetRepositoryHead({ widgetId });
|
|
8999
8999
|
const repoHeadEnvelope = json as unknown as {
|
|
9000
9000
|
data?: { repoHeadCommitSha?: string | null; repo_head_commit_sha?: string | null };
|
|
9001
9001
|
repoHeadCommitSha?: string | null;
|
|
@@ -9409,7 +9409,7 @@
|
|
|
9409
9409
|
try {
|
|
9410
9410
|
// The API wraps the operation in `{ success, data }`, which the generated client reads as an operation
|
|
9411
9411
|
// with every field empty (a poll could then never see the end): the raw answer is read instead.
|
|
9412
|
-
const answer = await operationsClient.
|
|
9412
|
+
const answer = await operationsClient.getOperationRaw(
|
|
9413
9413
|
{ id: operationId },
|
|
9414
9414
|
{ signal: pollAbortController.signal }
|
|
9415
9415
|
);
|
|
@@ -11054,7 +11054,7 @@ Requirements:
|
|
|
11054
11054
|
if (signal.aborted) return;
|
|
11055
11055
|
// The generated client types this call as void and drops the 202 body.
|
|
11056
11056
|
// Read the raw JSON so operationId and the intent-gate payload survive.
|
|
11057
|
-
const accepted = await agentClient.
|
|
11057
|
+
const accepted = await agentClient.generateCodeRaw({
|
|
11058
11058
|
generateCodeRequest: {
|
|
11059
11059
|
repositoryId: repoId,
|
|
11060
11060
|
prompt: options.promptForModel || prompt,
|
|
@@ -12201,14 +12201,14 @@ Requirements:
|
|
|
12201
12201
|
|
|
12202
12202
|
publishWidgetStatus = $t('creator.publish.publishingViaWidgetBuilder');
|
|
12203
12203
|
|
|
12204
|
-
const publishData = await agentClient.
|
|
12204
|
+
const publishData = await agentClient.publishBuiltWidget({
|
|
12205
12205
|
widgetId: capturedWidgetId,
|
|
12206
|
-
|
|
12206
|
+
publishBuiltWidgetRequest: {
|
|
12207
12207
|
commitSha: commitShaForPublish || undefined,
|
|
12208
12208
|
// Publishing a Draft the user chose: the server rebuilds from that
|
|
12209
12209
|
// version's commit and stamps it Live instead of minting a new one.
|
|
12210
12210
|
version: targetVersion ?? undefined
|
|
12211
|
-
} as unknown as Parameters<typeof agentClient.
|
|
12211
|
+
} as unknown as Parameters<typeof agentClient.publishBuiltWidget>[0]['publishBuiltWidgetRequest']
|
|
12212
12212
|
}, widgetBuilderRequestInit(widgetBuilderPreviewBaseUrl()));
|
|
12213
12213
|
// console.log('[Publish] Widget Builder publish completed:', publishData);
|
|
12214
12214
|
|
|
@@ -17800,8 +17800,8 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
17800
17800
|
// (Not in a partner's page: the gateway refuses a session this route, and the draft's name does as well.)
|
|
17801
17801
|
if (agentClient && maySuggestWidgetName() && (prompt.trim().length >= 2 || sketchForName)) {
|
|
17802
17802
|
authStatus = 'Naming widget...';
|
|
17803
|
-
const suggestedNameReply = await agentClient.
|
|
17804
|
-
|
|
17803
|
+
const suggestedNameReply = await agentClient.suggestWidgetName({
|
|
17804
|
+
suggestWidgetNameRequest: { prompt, ...(sketchForName ? { image: sketchForName } : {}) },
|
|
17805
17805
|
});
|
|
17806
17806
|
const suggestedName = typeof suggestedNameReply?.name === 'string' ? suggestedNameReply.name.trim() : '';
|
|
17807
17807
|
if (suggestedName) widgetName = suggestedName;
|
|
@@ -18160,7 +18160,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
18160
18160
|
if (existingRepoId && verifiedRepositoryIds.has(existingRepoId)) {
|
|
18161
18161
|
// Repo was verified earlier in the session; ping GET /repositories/{repoId}
|
|
18162
18162
|
// in the background so the backend's GitService file/diff caches are hot.
|
|
18163
|
-
void agentClient.
|
|
18163
|
+
void agentClient.getRepository({ repoId: existingRepoId }).catch(() => {});
|
|
18164
18164
|
} else {
|
|
18165
18165
|
await ensureWidgetRepository(widget, { silent: true });
|
|
18166
18166
|
}
|
|
@@ -18219,7 +18219,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
18219
18219
|
if (!repoId) return false;
|
|
18220
18220
|
try {
|
|
18221
18221
|
// get the repository details from the database
|
|
18222
|
-
const repoDetails = await agentClient.
|
|
18222
|
+
const repoDetails = await agentClient.getRepository({ repoId });
|
|
18223
18223
|
|
|
18224
18224
|
if (!repoDetails?.id) {
|
|
18225
18225
|
verifiedRepositoryIds.delete(repoId);
|
|
@@ -18265,7 +18265,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
18265
18265
|
});
|
|
18266
18266
|
applySiteSessionToCreator();
|
|
18267
18267
|
try {
|
|
18268
|
-
const retryDetails = await agentClient.
|
|
18268
|
+
const retryDetails = await agentClient.getRepository({ repoId });
|
|
18269
18269
|
if (retryDetails?.id) {
|
|
18270
18270
|
verifiedRepositoryIds.add(repoId);
|
|
18271
18271
|
return true;
|
|
@@ -18325,7 +18325,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
|
|
|
18325
18325
|
try {
|
|
18326
18326
|
// console.log('Widget Creator: Creating repository for widget:', widget);
|
|
18327
18327
|
const timestamp = new Date().toISOString().slice(0, 19).replace(/:/g, '-');
|
|
18328
|
-
const response = await agentClient.
|
|
18328
|
+
const response = await agentClient.createRepository({
|
|
18329
18329
|
initRepoRequest: {
|
|
18330
18330
|
name: `Widget Project ${timestamp}`,
|
|
18331
18331
|
widgetId: widget.id
|
|
@@ -1437,7 +1437,10 @@
|
|
|
1437
1437
|
return anyClient.agentWidgetBuilderBuildFromRepoWidgetIdPost({ widgetId }, widgetBuilderRequestInit(widgetBuilderPublicBaseUrl));
|
|
1438
1438
|
}
|
|
1439
1439
|
const cfg = anyClient.configuration || {};
|
|
1440
|
-
|
|
1440
|
+
// The SDK writes the widget builder paths relative to the address of the API, which already ends in the version
|
|
1441
|
+
// (`https://api.widgetic.com/v1`), so the address of the shared client is used as it is. (The paths used to spell
|
|
1442
|
+
// the version themselves, so this address had its `/v1` trimmed off to avoid calling `/v1/v1/...`.)
|
|
1443
|
+
const builderBasePath = String(cfg.basePath || '') || undefined;
|
|
1441
1444
|
const builder = new WidgetBuilderApi({
|
|
1442
1445
|
basePath: builderBasePath,
|
|
1443
1446
|
accessToken: cfg.accessToken,
|
|
@@ -1447,7 +1450,7 @@
|
|
|
1447
1450
|
// console.log('[WidgetDetails] buildWidgetFromRepo', {
|
|
1448
1451
|
// widgetId: widgetId.substring(0, 8),
|
|
1449
1452
|
// builderBasePath,
|
|
1450
|
-
// sdkPath: '/
|
|
1453
|
+
// sdkPath: '/agent/widget-builder/build-from-repo/{widgetId}',
|
|
1451
1454
|
// });
|
|
1452
1455
|
return builder.buildWidgetFromRepo({ widgetId }, widgetBuilderRequestInit(widgetBuilderPublicBaseUrl));
|
|
1453
1456
|
}
|
|
@@ -101,7 +101,7 @@ export type StopOutcome =
|
|
|
101
101
|
};
|
|
102
102
|
/** The part of the generated client that `requestOperationStop` uses. */
|
|
103
103
|
export interface OperationStopClient {
|
|
104
|
-
|
|
104
|
+
cancelOperationRaw: (requestParameters: {
|
|
105
105
|
id: string;
|
|
106
106
|
}) => Promise<{
|
|
107
107
|
raw: Response;
|
|
@@ -158,7 +158,7 @@ export async function requestOperationStop(client, operationId, options = {}) {
|
|
|
158
158
|
let lastError = null;
|
|
159
159
|
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
160
160
|
try {
|
|
161
|
-
const response = await client.
|
|
161
|
+
const response = await client.cancelOperationRaw({ id: operationId });
|
|
162
162
|
let body = null;
|
|
163
163
|
try {
|
|
164
164
|
body = await response.raw.json();
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widgetic/creator",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.36",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"@sveltejs/kit": "^2.20.0",
|
|
8
|
-
"@widgetic/api-sdk": "^
|
|
8
|
+
"@widgetic/api-sdk": "^2.0.0",
|
|
9
9
|
"@widgetic/cache-layer": "^0.1.2",
|
|
10
10
|
"@widgetic/canvas": "^0.5.27",
|
|
11
11
|
"@widgetic/chat": "^0.1.17",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@tailwindcss/postcss": "^4.1.4",
|
|
73
73
|
"@tailwindcss/typography": "^0.5.15",
|
|
74
74
|
"@types/node": "26.4.0",
|
|
75
|
-
"@widgetic/api-sdk": "^
|
|
75
|
+
"@widgetic/api-sdk": "^2.0.0",
|
|
76
76
|
"@widgetic/cache-layer": "^0.1.2",
|
|
77
77
|
"@widgetic/canvas": "^0.5.27",
|
|
78
78
|
"@widgetic/chat": "^0.1.17",
|