@wix/ditto-codegen-public 1.0.244 → 1.0.246

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/out.js CHANGED
@@ -45320,36 +45320,22 @@ var require_executor = __commonJS({
45320
45320
  var prompt_builder_1 = require_prompt_builder();
45321
45321
  var task_tracker_1 = require_task_tracker();
45322
45322
  var process_manager_1 = require_process_manager();
45323
- var result_builder_1 = require_result_builder();
45324
45323
  var process_handlers_1 = require_process_handlers();
45325
45324
  var MAX_RETRIES = 5;
45326
45325
  async function executeOpenCode(options) {
45327
45326
  let lastResult = null;
45328
45327
  let accumulatedStdout = "";
45329
45328
  let accumulatedUsage = (0, parser_1.createEmptyUsageStats)();
45329
+ let currentPrompt = options.prompt;
45330
45330
  for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
45331
45331
  if (attempt > 1) {
45332
- console.log(`[OpenCode] Retry attempt ${attempt}/${MAX_RETRIES} - resuming last session with --continue`);
45332
+ console.log(`[OpenCode] Retry attempt ${attempt}/${MAX_RETRIES} - starting fresh session with recovery context`);
45333
+ const filesChanged = (0, parser_1.parseFilesChanged)(accumulatedStdout);
45334
+ currentPrompt = (0, prompt_builder_1.buildRecoveryPrompt)(options.prompt, filesChanged, lastResult?.error?.message || lastResult?.stderr || "Process timed out");
45333
45335
  }
45334
- const result = await executeOpenCodeOnce(options, attempt);
45336
+ const result = await executeOpenCodeOnce({ ...options, prompt: currentPrompt }, attempt);
45335
45337
  accumulatedStdout += result.stdout;
45336
45338
  accumulatedUsage = (0, parser_1.mergeUsageStats)(accumulatedUsage, result.usage);
45337
- if (attempt > 1 && (0, result_builder_1.isCorruptedSessionError)(result)) {
45338
- console.log(`[OpenCode] Corrupted session detected on --continue attempt ${attempt}. Starting fresh session with recovery context.`);
45339
- const filesChanged = (0, parser_1.parseFilesChanged)(accumulatedStdout);
45340
- const recoveryPrompt = (0, prompt_builder_1.buildRecoveryPrompt)(options.prompt, filesChanged, result.error?.message || result.stderr);
45341
- const recoveryResult = await executeOpenCodeOnce({ ...options, prompt: recoveryPrompt }, 1);
45342
- accumulatedStdout += recoveryResult.stdout;
45343
- accumulatedUsage = (0, parser_1.mergeUsageStats)(accumulatedUsage, recoveryResult.usage);
45344
- const finalResult2 = {
45345
- ...recoveryResult,
45346
- filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
45347
- usage: accumulatedUsage
45348
- };
45349
- console.log(`
45350
- ${(0, parser_1.formatUsageStats)(finalResult2.usage)}`);
45351
- return finalResult2;
45352
- }
45353
45339
  const errorMsg = result.error?.message.toLowerCase() ?? "";
45354
45340
  const isRetryableFailure = !result.success && errorMsg.includes("idle timeout");
45355
45341
  if (result.success || !isRetryableFailure) {
@@ -45363,7 +45349,7 @@ ${(0, parser_1.formatUsageStats)(finalResult2.usage)}`);
45363
45349
  return finalResult2;
45364
45350
  }
45365
45351
  lastResult = result;
45366
- console.log(`[OpenCode] Attempt ${attempt}/${MAX_RETRIES} failed due to idle timeout \u2014 will retry with --continue in a fresh process`);
45352
+ console.log(`[OpenCode] Attempt ${attempt}/${MAX_RETRIES} failed due to idle timeout \u2014 will retry with recovery prompt`);
45367
45353
  }
45368
45354
  console.log(`[OpenCode] All ${MAX_RETRIES} retry attempts exhausted`);
45369
45355
  const finalResult = {
@@ -45375,16 +45361,7 @@ ${(0, parser_1.formatUsageStats)(finalResult2.usage)}`);
45375
45361
  ${(0, parser_1.formatUsageStats)(finalResult.usage)}`);
45376
45362
  return finalResult;
45377
45363
  }
45378
- function buildArgs(attempt, prompt) {
45379
- if (attempt > 1) {
45380
- return [
45381
- "run",
45382
- "--continue",
45383
- "--format",
45384
- "json",
45385
- "Continue from where you left off. The previous attempt may have been interrupted."
45386
- ];
45387
- }
45364
+ function buildArgs(prompt) {
45388
45365
  return ["run", "--format", "json", prompt];
45389
45366
  }
45390
45367
  async function executeOpenCodeOnce(options, attempt) {
@@ -45424,8 +45401,8 @@ ${(0, parser_1.formatUsageStats)(finalResult.usage)}`);
45424
45401
  finalize: finalize2
45425
45402
  };
45426
45403
  try {
45427
- const args = buildArgs(attempt, prompt);
45428
- console.log(`[OpenCode] Executing (attempt ${attempt}/${MAX_RETRIES}): opencode run ${attempt > 1 ? "--continue " : ""}--format json <prompt>`);
45404
+ const args = buildArgs(prompt);
45405
+ console.log(`[OpenCode] Executing (attempt ${attempt}/${MAX_RETRIES}): opencode run --format json <prompt>`);
45429
45406
  console.log(`[OpenCode] Working directory: ${outputPath}`);
45430
45407
  ctx.child = (0, child_process_1.spawn)("opencode", args, {
45431
45408
  cwd: outputPath,
@@ -89010,11 +88987,6 @@ var require_load_examples = __commonJS({
89010
88987
  path: "coupon-popup",
89011
88988
  description: "A marketing app that displays a configurable coupon popup in the shopping cart, with a dashboard interface for managing popup settings and an embedded script to show the popup on the site",
89012
88989
  files: {
89013
- [types_1.ExtensionType.DASHBOARD_PAGE]: [
89014
- "coupon-popup/src/dashboard/pages/cart-popup-manager/page.tsx",
89015
- "coupon-popup/src/dashboard/withProviders.tsx",
89016
- "coupon-popup/src/components/cart-popup-settings.tsx"
89017
- ],
89018
88990
  [types_1.ExtensionType.EMBEDDED_SCRIPT]: [
89019
88991
  "coupon-popup/src/site/embedded-scripts/cart-coupon-popup/embedded.html"
89020
88992
  ]
@@ -89024,7 +88996,6 @@ var require_load_examples = __commonJS({
89024
88996
  var examples = {
89025
88997
  [types_1.ExtensionType.DASHBOARD_PAGE]: [
89026
88998
  appsExamples.SurveyManager,
89027
- appsExamples.CouponPopup,
89028
88999
  appsExamples.AIChatbot
89029
89000
  ],
89030
89001
  [types_1.ExtensionType.EMBEDDED_SCRIPT]: [appsExamples.CouponPopup],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.244",
3
+ "version": "1.0.246",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -28,5 +28,5 @@
28
28
  "@wix/ditto-codegen": "1.0.0",
29
29
  "esbuild": "^0.27.2"
30
30
  },
31
- "falconPackageHash": "f3a7bc6add37fc8ef0ae08938af025a72a9a94852775e989518c4895"
31
+ "falconPackageHash": "54aee6086f8c14810a73a32f78183ca7213e34d07eb7301d1aa17b45"
32
32
  }
@@ -1,135 +0,0 @@
1
- import { type FC } from 'react';
2
- import {
3
- Input,
4
- InputArea,
5
- Card,
6
- FormField,
7
- ToggleSwitch,
8
- NumberInput,
9
- Box,
10
- type FormFieldProps,
11
- } from '@wix/design-system';
12
- import type { CartPopupOptions } from '../dashboard/pages/cart-popup-manager/page';
13
-
14
- interface Props {
15
- options: CartPopupOptions;
16
- onChange: (options: CartPopupOptions) => void;
17
- }
18
-
19
- export const CartPopupSettings: FC<Props> = ({ options, onChange }) => {
20
- const getFieldStatus = (
21
- field: keyof CartPopupOptions,
22
- required: boolean = false
23
- ): Partial<FormFieldProps> => {
24
- return required && !options[field]
25
- ? {
26
- status: 'error',
27
- statusMessage: 'Required.',
28
- }
29
- : {};
30
- };
31
-
32
- return (
33
- <Box direction="vertical" gap="24px">
34
- <Card>
35
- <Card.Header
36
- title="Popup Content"
37
- subtitle="Configure the text and coupon code displayed in the popup"
38
- />
39
- <Card.Divider />
40
- <Card.Content>
41
- <Box gap="18px" direction="vertical">
42
- <FormField
43
- label="Coupon Code"
44
- required
45
- {...getFieldStatus('couponCode', true)}
46
- >
47
- <Input
48
- placeholder="SAVE20"
49
- value={options.couponCode}
50
- onChange={(e) =>
51
- onChange({
52
- ...options,
53
- couponCode: e.currentTarget.value,
54
- })
55
- }
56
- />
57
- </FormField>
58
-
59
- <FormField
60
- label="Popup Headline"
61
- required
62
- {...getFieldStatus('popupHeadline', true)}
63
- >
64
- <Input
65
- placeholder="Special Offer!"
66
- value={options.popupHeadline}
67
- onChange={(e) =>
68
- onChange({
69
- ...options,
70
- popupHeadline: e.currentTarget.value,
71
- })
72
- }
73
- />
74
- </FormField>
75
-
76
- <FormField
77
- label="Popup Description"
78
- required
79
- {...getFieldStatus('popupDescription', true)}
80
- >
81
- <InputArea
82
- placeholder="Apply this coupon to get a discount on your cart!"
83
- value={options.popupDescription}
84
- onChange={(e) =>
85
- onChange({
86
- ...options,
87
- popupDescription: e.currentTarget.value,
88
- })
89
- }
90
- rows={3}
91
- />
92
- </FormField>
93
- </Box>
94
- </Card.Content>
95
- </Card>
96
-
97
- <Card>
98
- <Card.Header
99
- title="Display Settings"
100
- subtitle="Configure when and how the popup appears"
101
- />
102
- <Card.Divider />
103
- <Card.Content>
104
- <Box gap="18px" direction="vertical">
105
- <FormField label="Enable Popup">
106
- <ToggleSwitch
107
- checked={options.enablePopup}
108
- onChange={() =>
109
- onChange({
110
- ...options,
111
- enablePopup: !options.enablePopup,
112
- })
113
- }
114
- />
115
- </FormField>
116
-
117
- <FormField label="Minimum Cart Value">
118
- <NumberInput
119
- value={options.minimumCartValue}
120
- onChange={(value) =>
121
- onChange({
122
- ...options,
123
- minimumCartValue: value || 0,
124
- })
125
- }
126
- min={0}
127
- prefix="$"
128
- />
129
- </FormField>
130
- </Box>
131
- </Card.Content>
132
- </Card>
133
- </Box>
134
- );
135
- };
@@ -1,7 +0,0 @@
1
- import { extensions } from '@wix/astro/builders';
2
- export const dashboardpagecartPopupManager = extensions.dashboardPage({
3
- "id": "3304e8b7-4d5c-4719-86bb-68f6235a4bc5",
4
- "title": "Cart Popup Manager",
5
- "routePath": "cart-popup-manager",
6
- "component": "./dashboard/pages/cart-popup-manager/page.tsx"
7
- })
@@ -1,133 +0,0 @@
1
- import { useEffect, useState, type FC } from 'react';
2
- import { dashboard } from '@wix/dashboard';
3
- import { embeddedScripts } from '@wix/app-management';
4
- import {
5
- Button,
6
- Page,
7
- Layout,
8
- Cell,
9
- Loader,
10
- Box,
11
- } from '@wix/design-system';
12
- import '@wix/design-system/styles.global.css';
13
- import withProviders from '../../withProviders';
14
- import { CartPopupSettings } from '../../../components/cart-popup-settings';
15
-
16
- export type CartPopupOptions = {
17
- couponCode: string;
18
- popupHeadline: string;
19
- popupDescription: string;
20
- minimumCartValue: number;
21
- enablePopup: boolean;
22
- };
23
-
24
- const cartPopupDefaultOptions: CartPopupOptions = {
25
- couponCode: '',
26
- popupHeadline: 'Special Offer!',
27
- popupDescription: 'Apply this coupon to get a discount on your cart!',
28
- minimumCartValue: 0,
29
- enablePopup: true,
30
- };
31
-
32
- const CartPopupManagerPage: FC = () => {
33
- const [options, setOptions] = useState<CartPopupOptions>(cartPopupDefaultOptions);
34
- const [isLoading, setIsLoading] = useState(true);
35
- const [isSaving, setIsSaving] = useState(false);
36
-
37
- useEffect(() => {
38
- const loadSettings = async () => {
39
- try {
40
- const embeddedScript = await embeddedScripts.getEmbeddedScript();
41
- const data = embeddedScript.parameters as Partial<Record<keyof CartPopupOptions, string>> || {};
42
-
43
- setOptions((prev) => ({
44
- ...prev,
45
- couponCode: data?.couponCode || prev.couponCode,
46
- popupHeadline: data?.popupHeadline || prev.popupHeadline,
47
- popupDescription: data?.popupDescription || prev.popupDescription,
48
- minimumCartValue: Number(data?.minimumCartValue) || prev.minimumCartValue,
49
- enablePopup: data?.enablePopup === 'true' ? true : data?.enablePopup === 'false' ? false : prev.enablePopup,
50
- }));
51
- } catch (error) {
52
- console.error('Failed to load settings:', error);
53
- } finally {
54
- setIsLoading(false);
55
- }
56
- };
57
-
58
- loadSettings();
59
- }, []);
60
-
61
- const handleSave = async () => {
62
- if (!options.couponCode || !options.popupHeadline || !options.popupDescription) {
63
- dashboard.showToast({
64
- message: 'Please fill in all required fields',
65
- type: 'error',
66
- });
67
- return;
68
- }
69
-
70
- setIsSaving(true);
71
- try {
72
- // Convert all values to strings for embedded script parameters
73
- await embeddedScripts.embedScript({
74
- parameters: {
75
- couponCode: options.couponCode,
76
- popupHeadline: options.popupHeadline,
77
- popupDescription: options.popupDescription,
78
- minimumCartValue: String(options.minimumCartValue),
79
- enablePopup: String(options.enablePopup),
80
- },
81
- });
82
-
83
- dashboard.showToast({
84
- message: 'Cart popup settings saved successfully!',
85
- type: 'success',
86
- });
87
- } catch (error) {
88
- console.error('Failed to save settings:', error);
89
- dashboard.showToast({
90
- message: 'Failed to save settings. Please try again.',
91
- type: 'error',
92
- });
93
- } finally {
94
- setIsSaving(false);
95
- }
96
- };
97
-
98
- return (
99
- <Page height="100vh">
100
- <Page.Header
101
- title="Cart Popup Manager"
102
- subtitle="Configure your cart popup's content, coupon code, and display rules"
103
- actionsBar={
104
- <Button
105
- skin="inverted"
106
- disabled={!options.couponCode || !options.popupHeadline || !options.popupDescription || isSaving}
107
- onClick={handleSave}
108
- >
109
- {isSaving ? 'Saving...' : 'Save'}
110
- </Button>
111
- }
112
- />
113
- <Page.Content>
114
- {isLoading ? (
115
- <Box align="center" verticalAlign="middle" height="50vh">
116
- <Loader text="Loading cart popup settings..." />
117
- </Box>
118
- ) : (
119
- <Layout gap="24px">
120
- <Cell span={12}>
121
- <CartPopupSettings
122
- options={options}
123
- onChange={setOptions}
124
- />
125
- </Cell>
126
- </Layout>
127
- )}
128
- </Page.Content>
129
- </Page>
130
- );
131
- };
132
-
133
- export default withProviders(CartPopupManagerPage);
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { WixDesignSystemProvider } from '@wix/design-system';
3
- import { i18n } from '@wix/essentials';
4
-
5
- export default function withProviders<P extends {} = {}>(Component: React.FC<P>) {
6
- return function DashboardProviders(props: P) {
7
- const locale = i18n.getLocale();
8
- return (
9
- <WixDesignSystemProvider locale={locale} features={{ newColorsBranding: true }}>
10
- <Component {...props} />
11
- </WixDesignSystemProvider>
12
- );
13
- };
14
- }
15
-
16
- export { withProviders };