@superblocksteam/cli 2.0.3-next.160 → 2.0.3-next.162

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/README.md CHANGED
@@ -14,7 +14,7 @@ $ npm install -g @superblocksteam/cli
14
14
  $ superblocks COMMAND
15
15
  running command...
16
16
  $ superblocks (--version)
17
- @superblocksteam/cli/2.0.3-next.160 linux-x64 node-v20.19.0
17
+ @superblocksteam/cli/2.0.3-next.162 linux-x64 node-v20.19.0
18
18
  $ superblocks --help [COMMAND]
19
19
  USAGE
20
20
  $ superblocks COMMAND
@@ -32,7 +32,7 @@ var content2 = '### Rules for using Superblocks components:\n\n- ENSURE THAT ALL
32
32
 
33
33
  // ../../../vite-plugin-file-sync/dist/ai-service/prompts/generated/subprompts/superblocks-custom-components.js
34
34
  init_cjs_shims();
35
- var content3 = '# Custom Components\n\n- ULTRA CRITICAL: NEVER use Superblocks components in a custom component.\n\n- CRITICAL: Use custom components sparingly.\n\n- CRITICAL: ONLY when all else fails and a component is not available in the Superblocks library, you may construct it out of external component libraries by installing them.\n\nIn order to hook it up correctly, the platform needs to know what props the component exposes, their types, default values, and how they should be displayed to users.\n\nTo do this, you use the **`Prop` API** and **`registerComponent`** function.\n\n## Key Concepts\n\n- All custom components should live within the `components/` folder.\n- **`Prop`**: Defines a single editable property for your component.\n - Can specify the data type (`string`, `number`, `boolean`, `event`, etc.).\n - Can define a **default value**, **label** for the properties panel, and other validations.\n- **`registerComponent`**: Connects your React component with its editable schema (`properties`) so it appears correctly in the visual editor.\n- **`useUpdateProperties`**: A hook that lets your component programmatically update its properties during runtime (e.g., when a user interacts with it).\n\n---\n\n## Basic Example\n\n```tsx\nimport { Rate } from "antd";\nimport {\n CustomComponentProps,\n Prop,\n registerComponent,\n useUpdateProperties,\n} from "@superblocksteam/library";\n\n// 1. Define editable properties\nconst properties = {\n value: Prop.number()\n .default(3) // Default to 3 stars\n .propertiesPanel({ label: "Default value" }), // Editor label\n onChange: Prop.event().propertiesPanel({ label: "On change" }), // Editor label for event\n};\n\n// 2. Create typed props for your component\ntype ComponentProps = CustomComponentProps<typeof properties>;\n\n// 3. Build your React component\nconst Rating = ({ value, onChange }: ComponentProps) => {\n const updateProperties = useUpdateProperties(); // Hook to update properties dynamically\n\n return (\n <div style={{ display: "flex" }}>\n <Rate\n value={value}\n defaultValue={value}\n onChange={(newValue) => {\n updateProperties({ value: newValue }); // Update visual editor\n onChange?.(); // Trigger custom event\n }}\n />\n </div>\n );\n};\n\n// 4. Register your component to make it available in the visual editor\nexport default registerComponent("Rating", properties, Rating);\n```\n\n---\n\n## How `Prop` Works\n\nYou can define different types of props:\n\n- **`string`**: `Prop.string()`\n- **`number`**: `Prop.number()`\n- **`boolean`**: `Prop.boolean()`\n- **`event`**: `Prop.event()` (for user interactions like clicks)\n- **`any`**: `Prop.any()` (for any type)\n- **`composite`**: `Prop.composite({ x: Prop.number(), y: Prop.number() })` (for nested objects)\n- **`record`**: `Prop.record({...})` (for key-value maps)\n- **`union`**: `Prop.union({...})` (for multiple variants)\n\nYou can chain additional methods:\n\n- `.default(value)` \u2014 Sets a default value.\n- `.propertiesPanel({ label: "Your Label" })` \u2014 Controls how the prop appears in the editor.\n- `.validate(fn)` \u2014 Adds custom validation logic.\n- `.readable()`, `.writable()` \u2014 Control read/write capabilities.\n\n---\n\n## Typical Flow\n\n1. **Define** the **editable schema** (`properties`) with `Prop`.\n2. **Type** your component\'s props using `CustomComponentProps`.\n3. **Use** `useUpdateProperties` to sync UI interactions back to the editor.\n4. **Register** the component using `registerComponent`.\n\n---# Tips\n\n- All `registeredComponent`s automatically support width and height using the `Dim` object.\n ```\n <CustomSlider\n width={Dim.fill(2)} // Fill available space with a weight of 2\n height={Dim.px(100)} // Fixed height of 100 pixels\n />\n ```\n\n## When not to use custom components\n\n- If a user asks for something by name, like showing "metrics", and you do not find a "metrics" component in the Superblocks library, do not immediately assume you need to use a custom component. Instead consider using one of the pre-designed templates built from existing Superblocks components.\n\n## Pre-designed templates to use instead of custom components\n\n### Rules for using pre-designed templates\n\n- Use the pre-designed templates as a base to work from. You can make changes to the content, but generally you do not need to change the layout or styling. Example: below there are width and height properties set on the icons and you should NOT change these or you will break the layout.\n\n### Metrics template\n\nThis template is a row of three large numerical metrics with icons and annotation text.\n\nTemplate code below and a few notes to help explain usage:\n\n- We use the SbContainer component to layout the metrics in a row\n- We use the SbText component to show the numerical values and how we use the textStyle prop variant to make the text a big heading\n- We use the SbIcon component to show nice icons that make sense for the metric\n- We create a little "badge" using the SbContainer component to show small annotation text. Prefer this over using brackets in the main heading text. Example: Rather than "32 (2m)" we use "32" in the main heading text and then a badge with the "2m" text\n- Keep the icon sizing you see in this template unless you are explicitly asked to change it\n\n```tsx\nimport {\n SbIcon,\n SbText,\n SbContainer,\n sbComputed,\n Dim,\n Global,\n Theme,\n Embed,\n Env,\n} from "@superblocksteam/library";\n\n<SbContainer\n layout="horizontal"\n width={Dim.fill()}\n height={Dim.fit()}\n variant="none"\n spacing={Dim.px(12)}\n>\n {/* First card */}\n <SbContainer\n layout="vertical"\n width={Dim.fill()}\n height={Dim.fit()}\n variant="card"\n spacing={Dim.px(6)}\n >\n <SbContainer\n layout="horizontal"\n width={Dim.fill()}\n height={Dim.fit()}\n variant="none"\n horizontalAlign="space-between"\n spacing={Dim.px(6)}\n >\n <SbText\n text="Avg delivery time (min)"\n textStyle={{\n variant: "body2",\n textColor: {\n default: sbComputed(() => Theme.colors.neutral500),\n },\n }}\n />\n <SbIcon icon="route" height={Dim.px(24)} width={Dim.fit()} />\n </SbContainer>\n <SbContainer\n layout="horizontal"\n width={Dim.fill()}\n height={Dim.fit()}\n variant="none"\n horizontalAlign="left"\n spacing={Dim.px(6)}\n >\n <SbText\n text="32"\n textStyle={{\n variant: "heading1",\n }}\n />\n {/* Smaller annotation badge, showing change. Container background color is green because the value change is considered "good" (lower delivery time is better) */}\n <SbContainer\n layout="horizontal"\n width={Dim.fit()}\n height={Dim.fit()}\n variant="none"\n spacing={Dim.px(2)}\n horizontalAlign="center"\n verticalAlign="center"\n backgroundColor="#c4e1af"\n padding={{\n top: Dim.px(3),\n right: Dim.px(6),\n bottom: Dim.px(3),\n left: Dim.px(6),\n }}\n borderRadius={{\n topLeft: Dim.px(20),\n topRight: Dim.px(20),\n bottomRight: Dim.px(20),\n bottomLeft: Dim.px(20),\n }}\n >\n <SbIcon\n icon="arrow_downward_alt"\n height={Dim.px(24)}\n width={Dim.fit()}\n />\n <SbText\n text="2m"\n width={Dim.fit()}\n textStyle={{\n variant: "body2",\n }}\n />\n </SbContainer>\n </SbContainer>\n </SbContainer>\n</SbContainer>;\n```\n';
35
+ var content3 = '# Custom Components\n\n- ULTRA CRITICAL: NEVER use Superblocks components in a custom component.\n\n- CRITICAL: Use custom components sparingly.\n\n- CRITICAL: ONLY when all else fails and a component is not available in the Superblocks library, you may construct it out of external component libraries by installing them.\n\n- CRITICAL: ALWAYS import React using a namespace import: `import * as React from \'react\'`.\n\nIn order to hook it up correctly, the platform needs to know what props the component exposes, their types, default values, and how they should be displayed to users.\n\nTo do this, you use the **`Prop` API** and **`registerComponent`** function.\n\n## Key Concepts\n\n- All custom components should live within the `components/` folder.\n- **`Prop`**: Defines a single editable property for your component.\n - Can specify the data type (`string`, `number`, `boolean`, `event`, etc.).\n - Can define a **default value**, **label** for the properties panel, and other validations.\n- **`registerComponent`**: Connects your React component with its editable schema (`properties`) so it appears correctly in the visual editor.\n- **`useUpdateProperties`**: A hook that lets your component programmatically update its properties during runtime (e.g., when a user interacts with it).\n\n---\n\n## Basic Example\n\n```tsx\nimport { Rate } from "antd";\nimport {\n CustomComponentProps,\n Prop,\n registerComponent,\n useUpdateProperties,\n} from "@superblocksteam/library";\n\n// 1. Define editable properties\nconst properties = {\n value: Prop.number()\n .default(3) // Default to 3 stars\n .propertiesPanel({ label: "Default value" }), // Editor label\n onChange: Prop.event().propertiesPanel({ label: "On change" }), // Editor label for event\n};\n\n// 2. Create typed props for your component\ntype ComponentProps = CustomComponentProps<typeof properties>;\n\n// 3. Build your React component\nconst Rating = ({ value, onChange }: ComponentProps) => {\n const updateProperties = useUpdateProperties(); // Hook to update properties dynamically\n\n return (\n <div style={{ display: "flex" }}>\n <Rate\n value={value}\n defaultValue={value}\n onChange={(newValue) => {\n updateProperties({ value: newValue }); // Update visual editor\n onChange?.(); // Trigger custom event\n }}\n />\n </div>\n );\n};\n\n// 4. Register your component to make it available in the visual editor\nexport default registerComponent("Rating", properties, Rating);\n```\n\n---\n\n## How `Prop` Works\n\nYou can define different types of props:\n\n- **`string`**: `Prop.string()`\n- **`number`**: `Prop.number()`\n- **`boolean`**: `Prop.boolean()`\n- **`event`**: `Prop.event()` (for user interactions like clicks)\n- **`any`**: `Prop.any()` (for any type)\n- **`composite`**: `Prop.composite({ x: Prop.number(), y: Prop.number() })` (for nested objects)\n- **`record`**: `Prop.record({...})` (for key-value maps)\n- **`union`**: `Prop.union({...})` (for multiple variants)\n\nYou can chain additional methods:\n\n- `.default(value)` \u2014 Sets a default value.\n- `.propertiesPanel({ label: "Your Label" })` \u2014 Controls how the prop appears in the editor.\n- `.validate(fn)` \u2014 Adds custom validation logic.\n- `.readable()`, `.writable()` \u2014 Control read/write capabilities.\n\n---\n\n## Typical Flow\n\n1. **Define** the **editable schema** (`properties`) with `Prop`.\n2. **Type** your component\'s props using `CustomComponentProps`.\n3. **Use** `useUpdateProperties` to sync UI interactions back to the editor.\n4. **Register** the component using `registerComponent`.\n\n---# Tips\n\n- All `registeredComponent`s automatically support width and height using the `Dim` object.\n ```\n <CustomSlider\n width={Dim.fill(2)} // Fill available space with a weight of 2\n height={Dim.px(100)} // Fixed height of 100 pixels\n />\n ```\n\n## When not to use custom components\n\n- If a user asks for something by name, like showing "metrics", and you do not find a "metrics" component in the Superblocks library, do not immediately assume you need to use a custom component. Instead consider using one of the pre-designed templates built from existing Superblocks components.\n\n## Pre-designed templates to use instead of custom components\n\n### Rules for using pre-designed templates\n\n- Use the pre-designed templates as a base to work from. You can make changes to the content, but generally you do not need to change the layout or styling. Example: below there are width and height properties set on the icons and you should NOT change these or you will break the layout.\n\n### Metrics template\n\nThis template is a row of three large numerical metrics with icons and annotation text.\n\nTemplate code below and a few notes to help explain usage:\n\n- We use the SbContainer component to layout the metrics in a row\n- We use the SbText component to show the numerical values and how we use the textStyle prop variant to make the text a big heading\n- We use the SbIcon component to show nice icons that make sense for the metric\n- We create a little "badge" using the SbContainer component to show small annotation text. Prefer this over using brackets in the main heading text. Example: Rather than "32 (2m)" we use "32" in the main heading text and then a badge with the "2m" text\n- Keep the icon sizing you see in this template unless you are explicitly asked to change it\n\n```tsx\nimport {\n SbIcon,\n SbText,\n SbContainer,\n sbComputed,\n Dim,\n Global,\n Theme,\n Embed,\n Env,\n} from "@superblocksteam/library";\n\n<SbContainer\n layout="horizontal"\n width={Dim.fill()}\n height={Dim.fit()}\n variant="none"\n spacing={Dim.px(12)}\n>\n {/* First card */}\n <SbContainer\n layout="vertical"\n width={Dim.fill()}\n height={Dim.fit()}\n variant="card"\n spacing={Dim.px(6)}\n >\n <SbContainer\n layout="horizontal"\n width={Dim.fill()}\n height={Dim.fit()}\n variant="none"\n horizontalAlign="space-between"\n spacing={Dim.px(6)}\n >\n <SbText\n text="Avg delivery time (min)"\n textStyle={{\n variant: "body2",\n textColor: {\n default: sbComputed(() => Theme.colors.neutral500),\n },\n }}\n />\n <SbIcon icon="route" height={Dim.px(24)} width={Dim.fit()} />\n </SbContainer>\n <SbContainer\n layout="horizontal"\n width={Dim.fill()}\n height={Dim.fit()}\n variant="none"\n horizontalAlign="left"\n spacing={Dim.px(6)}\n >\n <SbText\n text="32"\n textStyle={{\n variant: "heading1",\n }}\n />\n {/* Smaller annotation badge, showing change. Container background color is green because the value change is considered "good" (lower delivery time is better) */}\n <SbContainer\n layout="horizontal"\n width={Dim.fit()}\n height={Dim.fit()}\n variant="none"\n spacing={Dim.px(2)}\n horizontalAlign="center"\n verticalAlign="center"\n backgroundColor="#c4e1af"\n padding={{\n top: Dim.px(3),\n right: Dim.px(6),\n bottom: Dim.px(3),\n left: Dim.px(6),\n }}\n borderRadius={{\n topLeft: Dim.px(20),\n topRight: Dim.px(20),\n bottomRight: Dim.px(20),\n bottomLeft: Dim.px(20),\n }}\n >\n <SbIcon\n icon="arrow_downward_alt"\n height={Dim.px(24)}\n width={Dim.fit()}\n />\n <SbText\n text="2m"\n width={Dim.fit()}\n textStyle={{\n variant: "body2",\n }}\n />\n </SbContainer>\n </SbContainer>\n </SbContainer>\n</SbContainer>;\n```\n';
36
36
 
37
37
  // ../../../vite-plugin-file-sync/dist/ai-service/prompts/generated/subprompts/superblocks-event-flow.js
38
38
  init_cjs_shims();
package/dist/index.js CHANGED
@@ -331437,7 +331437,7 @@ var import_dd_trace = __toESM(require_dd_trace2(), 1);
331437
331437
  // ../sdk/package.json
331438
331438
  var package_default = {
331439
331439
  name: "@superblocksteam/sdk",
331440
- version: "2.0.3-next.160",
331440
+ version: "2.0.3-next.162",
331441
331441
  type: "module",
331442
331442
  description: "Superblocks JS SDK",
331443
331443
  homepage: "https://www.superblocks.com",
@@ -331467,8 +331467,8 @@ var package_default = {
331467
331467
  "@rollup/wasm-node": "^4.35.0",
331468
331468
  "@superblocksteam/bucketeer-sdk": "0.4.1",
331469
331469
  "@superblocksteam/shared": "0.9120.0",
331470
- "@superblocksteam/util": "2.0.3-next.160",
331471
- "@superblocksteam/vite-plugin-file-sync": "2.0.3-next.160",
331470
+ "@superblocksteam/util": "2.0.3-next.162",
331471
+ "@superblocksteam/vite-plugin-file-sync": "2.0.3-next.162",
331472
331472
  "@vitejs/plugin-react": "^4.3.4",
331473
331473
  axios: "^1.4.0",
331474
331474
  chokidar: "^4.0.3",
@@ -331629,6 +331629,9 @@ function isComputedPropertyInfo(value2) {
331629
331629
  return isPropertyInfo(value2) && value2.type === "COMPUTED";
331630
331630
  }
331631
331631
 
331632
+ // ../../../library-shared/dist/utils/source-id.js
331633
+ init_cjs_shims();
331634
+
331632
331635
  // ../../../library-shared/dist/utils/strings.js
331633
331636
  init_cjs_shims();
331634
331637
  function containsStringInterpolation(value2) {
@@ -371195,6 +371198,7 @@ export default registerPage(Page, { name: "${name17}" });
371195
371198
  this.emit("setProperties", payload);
371196
371199
  };
371197
371200
  handleDeleteProperties = async (payload, writeFile8 = true) => {
371201
+ this.trackTransaction(payload.transaction?.id);
371198
371202
  await this.sourceTracker?.deleteProperties({
371199
371203
  source: payload.element.source,
371200
371204
  properties: payload.properties
@@ -371202,6 +371206,7 @@ export default registerPage(Page, { name: "${name17}" });
371202
371206
  if (writeFile8) {
371203
371207
  const changes = await this.sourceTracker?.getAndFlushChanges() ?? [];
371204
371208
  await this.writeChanges(changes ?? []);
371209
+ this.flushTransactions();
371205
371210
  }
371206
371211
  this.emit("deleteProperties", payload);
371207
371212
  };
@@ -371226,6 +371231,9 @@ export default registerPage(Page, { name: "${name17}" });
371226
371231
  case "editor:deleteProperties":
371227
371232
  returnValues.push(await this.handleDeleteProperties(update.payload, false));
371228
371233
  break;
371234
+ case "editor:deleteComponents":
371235
+ returnValues.push(await this.handleDeleteComponents(update.payload, false));
371236
+ break;
371229
371237
  }
371230
371238
  }
371231
371239
  const changes = await this.sourceTracker?.getAndFlushChanges() ?? [];
@@ -372301,6 +372309,12 @@ var SocketManager = class extends EventEmitter8 {
372301
372309
  await syncService?.commitLocalDraftChanges();
372302
372310
  await aiService?.handleUserAcceptedDraft(peer);
372303
372311
  }
372312
+ ],
372313
+ aiCancel: [
372314
+ async () => {
372315
+ await syncService?.discardLocalDraftChanges();
372316
+ await aiService?.handleUserCanceled();
372317
+ }
372304
372318
  ]
372305
372319
  }
372306
372320
  }), [], void 0, void 0));
@@ -376155,7 +376169,7 @@ async function startVite({ app, httpServer: httpServer2, root: root2, mode, port
376155
376169
  };
376156
376170
  const isCustomBuildEnabled2 = await isCustomComponentsEnabled();
376157
376171
  const customFolder = path21.join(root2, "custom");
376158
- const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.3-next.160";
376172
+ const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.3-next.162";
376159
376173
  const env3 = loadEnv(mode, root2, "");
376160
376174
  const hmrPort = await getFreePort();
376161
376175
  const hmrOptions = {
@@ -382348,7 +382362,7 @@ var AppShell = class {
382348
382362
  })));
382349
382363
  });
382350
382364
  }
382351
- async runTypecheck() {
382365
+ async runTypecheck(abortSignal) {
382352
382366
  const checkForErrors = new Promise((resolve8) => {
382353
382367
  exec([
382354
382368
  "npx tsc",
@@ -382361,7 +382375,8 @@ var AppShell = class {
382361
382375
  "--tsBuildInfoFile .superblocks/app.tsbuildinfo"
382362
382376
  ].join(" "), {
382363
382377
  cwd: this.appRootDirPath,
382364
- encoding: "utf-8"
382378
+ encoding: "utf-8",
382379
+ signal: abortSignal
382365
382380
  }, (_error, stdout, stderr) => {
382366
382381
  resolve8(stdout || stderr);
382367
382382
  });
@@ -382380,7 +382395,7 @@ var AppShell = class {
382380
382395
  }, {});
382381
382396
  return Object.keys(parsed).length > 0 ? parsed : null;
382382
382397
  }
382383
- async runNpmInstall() {
382398
+ async runNpmInstall(abortSignal) {
382384
382399
  return await new Promise((resolve8, reject) => {
382385
382400
  const command = (
382386
382401
  // if we're running in csb mock server, we need to avoid conflicts with the workspace
@@ -382388,7 +382403,8 @@ var AppShell = class {
382388
382403
  );
382389
382404
  exec(command, {
382390
382405
  cwd: this.appRootDirPath,
382391
- timeout: 3e4
382406
+ timeout: 3e4,
382407
+ signal: abortSignal
382392
382408
  }, (error, _stdout, stderr) => {
382393
382409
  if (error) {
382394
382410
  return reject(new NpmInstallError(stderr));
@@ -382564,6 +382580,7 @@ var ClarkStateNames = $;
382564
382580
  var USER_SENT_PROMPT = "userSentPrompt";
382565
382581
  var USER_ACCEPTED_DRAFT = "userAcceptedDraft";
382566
382582
  var USER_REJECTED_DRAFT = "userRejectedDraft";
382583
+ var USER_CANCELED = "userCanceled";
382567
382584
  var AGENT_PLANNED = "agentPlanned";
382568
382585
  var AGENT_NEEDS_USER_INPUT = "agentNeedsUserInput";
382569
382586
  var AGENT_GAVE_UP = "agentGaveUp";
@@ -382586,29 +382603,34 @@ var transitions = {
382586
382603
  [$.AgentPlanning]: {
382587
382604
  [AGENT_PLANNED]: $.LLMGenerating,
382588
382605
  [AGENT_NEEDS_USER_INPUT]: $.AwaitingUser,
382589
- [AGENT_GAVE_UP]: $.Dead
382606
+ [AGENT_GAVE_UP]: $.Dead,
382607
+ [USER_CANCELED]: $.Idle
382590
382608
  },
382591
382609
  [$.LLMGenerating]: {
382592
382610
  [LLM_FINISHED]: $.PostProcessing,
382593
382611
  [LLM_ERRORED]: $.AgentPlanning,
382594
382612
  [LLM_FINISHED_UNEXPECTEDLY]: $.AgentPlanning,
382595
382613
  [LLM_REQUESTED_CONTEXT]: $.AgentPlanning,
382596
- [APP_RUNTIME_UPDATED_WITHOUT_EDITS]: $.Idle
382614
+ [APP_RUNTIME_UPDATED_WITHOUT_EDITS]: $.Idle,
382615
+ [USER_CANCELED]: $.Idle
382597
382616
  },
382598
382617
  [$.PostProcessing]: {
382599
382618
  [POST_PROCESSING_FINISHED]: $.RuntimeReviewing,
382600
- [POST_PROCESSING_ERRORED]: $.AgentPlanning
382619
+ [POST_PROCESSING_ERRORED]: $.AgentPlanning,
382620
+ [USER_CANCELED]: $.Idle
382601
382621
  },
382602
382622
  [$.RuntimeReviewing]: {
382603
382623
  [RUNTIME_REVIEW_ERRORED]: $.AgentPlanning,
382604
382624
  [BUILD_SYSTEM_ERRORED]: $.AgentPlanning,
382605
382625
  [RUNTIME_REVIEW_FINISHED]: $.AwaitingUser,
382606
- [APP_RUNTIME_UPDATED_WITHOUT_EDITS]: $.Idle
382626
+ [APP_RUNTIME_UPDATED_WITHOUT_EDITS]: $.Idle,
382627
+ [USER_CANCELED]: $.Idle
382607
382628
  },
382608
382629
  [$.AwaitingUser]: {
382609
382630
  [USER_ACCEPTED_DRAFT]: $.Idle,
382610
382631
  [USER_REJECTED_DRAFT]: $.RuntimeReviewing,
382611
- [USER_SENT_PROMPT]: $.AgentPlanning
382632
+ [USER_SENT_PROMPT]: $.AgentPlanning,
382633
+ [USER_CANCELED]: $.Idle
382612
382634
  },
382613
382635
  [$.Dead]: {}
382614
382636
  };
@@ -382870,7 +382892,7 @@ init_cjs_shims();
382870
382892
  init_cjs_shims();
382871
382893
  var generated = {};
382872
382894
  try {
382873
- generated = await import("./generated-FORH4H64.js");
382895
+ generated = await import("./generated-PNY22F3P.js");
382874
382896
  } catch (_error) {
382875
382897
  getLogger().warn("[ai-service] Generated markdown modules not found. Run `pnpm generate:markdown` first.");
382876
382898
  }
@@ -383327,6 +383349,9 @@ var sendUserCompletionChannel = (clark) => async (payload) => {
383327
383349
  init_cjs_shims();
383328
383350
  var transitionFrom = (clark) => {
383329
383351
  return (event) => {
383352
+ if (clark.context.abortController?.signal.aborted && event.type !== USER_CANCELED) {
383353
+ return clark.send({ type: USER_CANCELED });
383354
+ }
383330
383355
  return clark.send(event);
383331
383356
  };
383332
383357
  };
@@ -383376,9 +383401,11 @@ Address the errors and return the fixed code.`;
383376
383401
  switch (event.type) {
383377
383402
  case USER_SENT_PROMPT: {
383378
383403
  const { request, peer } = event;
383379
- clark.updateContext({
383404
+ clark.updateContext((context3) => ({
383405
+ ...context3,
383406
+ abortController: context3.abortController ?? new AbortController(),
383380
383407
  peer
383381
- });
383408
+ }));
383382
383409
  if (clark.context.hasSuggestions) {
383383
383410
  const meta2 = getMeta();
383384
383411
  const previousPrompts = meta2?.promptsForCurrentDraft ?? [];
@@ -383599,12 +383626,18 @@ var doAwaitingUser = (clark, { signals }) => {
383599
383626
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/handlers/idle.js
383600
383627
  init_cjs_shims();
383601
383628
  var doIdle = (clark) => {
383629
+ const sendUserMessage = sendUserMessageChannel(clark);
383602
383630
  return async ({ event }) => {
383603
383631
  switch (event.type) {
383604
383632
  case USER_ACCEPTED_DRAFT:
383605
383633
  break;
383606
383634
  case APP_RUNTIME_UPDATED_WITHOUT_EDITS:
383607
383635
  break;
383636
+ case USER_CANCELED:
383637
+ void sendUserMessage({
383638
+ text: "Canceled."
383639
+ });
383640
+ break;
383608
383641
  default:
383609
383642
  throw new Error(`Unhandled event: ${event}`);
383610
383643
  }
@@ -389755,12 +389788,14 @@ var doLLMGenerating = (clark, { anthropicProvider, artifactProcessor }) => {
389755
389788
  switch (event.type) {
389756
389789
  case AGENT_PLANNED: {
389757
389790
  const { systemPrompt, userPrompt, debugging } = event;
389791
+ const { abortController } = clark.context;
389758
389792
  const { fullStream } = streamText({
389759
389793
  model: anthropicProvider("claude-4-sonnet-20250514"),
389760
389794
  system: systemPrompt,
389761
389795
  prompt: userPrompt,
389762
389796
  experimental_transform: smoothStream(),
389763
- maxTokens: 32e3
389797
+ maxTokens: 32e3,
389798
+ abortSignal: abortController?.signal
389764
389799
  });
389765
389800
  let pendingArtifacts = false;
389766
389801
  let artifactChunk = null;
@@ -390112,7 +390147,7 @@ var doPostProcessing = (clark, { applicationId, organizationId, draftInterface,
390112
390147
  text: "Installing dependencies\u2026"
390113
390148
  });
390114
390149
  await createDraftFiles([packageJson]);
390115
- await appShell.runNpmInstall();
390150
+ await appShell.runNpmInstall(clark.context.abortController?.signal);
390116
390151
  }
390117
390152
  await createDraftFiles(scopes);
390118
390153
  await createDraftFiles(apiYamls);
@@ -390154,7 +390189,7 @@ var doRuntimeReviewing = (clark, params) => {
390154
390189
  ...context3,
390155
390190
  hasSuggestions: context3.hasSuggestions || files.length > 0
390156
390191
  }));
390157
- const tsErrorsByPath = await params.appShell.runTypecheck();
390192
+ const tsErrorsByPath = await params.appShell.runTypecheck(clark.context.abortController?.signal);
390158
390193
  if (tsErrorsByPath) {
390159
390194
  transitionTo({
390160
390195
  type: RUNTIME_REVIEW_ERRORED,
@@ -390198,7 +390233,7 @@ var AiService = class extends EventEmitter10 {
390198
390233
  this.clark = new FSM({
390199
390234
  transitions,
390200
390235
  initialState: ClarkStateNames.Idle,
390201
- initialContext: {},
390236
+ initialContext: { abortController: new AbortController() },
390202
390237
  createTransitionHandler: this.createClarkTransitionHandler()
390203
390238
  });
390204
390239
  this.config.draftInterface.hasLocalDraftChanges().then((hasDraft) => {
@@ -390281,6 +390316,12 @@ var AiService = class extends EventEmitter10 {
390281
390316
  const transitionTo = transitionFrom(this.clark);
390282
390317
  transitionTo({ type: USER_REJECTED_DRAFT });
390283
390318
  }
390319
+ async handleUserCanceled() {
390320
+ if (!this.isBusy()) {
390321
+ return;
390322
+ }
390323
+ this.clark.context.abortController?.abort();
390324
+ }
390284
390325
  handleBuildSystemError(error) {
390285
390326
  if (this.clark.state !== ClarkStateNames.RuntimeReviewing) {
390286
390327
  getLogger().warn("[ai-service] Build system error occurred but AI service is not in runtime reviewing state", getErrorMeta(error));
@@ -509,5 +509,5 @@
509
509
  "strict": true
510
510
  }
511
511
  },
512
- "version": "2.0.3-next.160"
512
+ "version": "2.0.3-next.162"
513
513
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/cli",
3
- "version": "2.0.3-next.160",
3
+ "version": "2.0.3-next.162",
4
4
  "type": "module",
5
5
  "description": "Official Superblocks CLI",
6
6
  "homepage": "https://www.superblocks.com",
@@ -42,9 +42,9 @@
42
42
  "devDependencies": {
43
43
  "@eslint/js": "^9.16.0",
44
44
  "@oclif/test": "^4.1.11",
45
- "@superblocksteam/sdk": "2.0.3-next.160",
45
+ "@superblocksteam/sdk": "2.0.3-next.162",
46
46
  "@superblocksteam/shared": "0.9120.0",
47
- "@superblocksteam/util": "2.0.3-next.160",
47
+ "@superblocksteam/util": "2.0.3-next.162",
48
48
  "@types/babel__core": "^7.20.0",
49
49
  "@types/chai": "^4",
50
50
  "@types/fs-extra": "^11.0.1",