@superblocksteam/cli 2.0.3-next.159 → 2.0.3-next.161

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.159 linux-x64 node-v20.19.0
17
+ @superblocksteam/cli/2.0.3-next.161 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.159",
331440
+ version: "2.0.3-next.161",
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.159",
331471
- "@superblocksteam/vite-plugin-file-sync": "2.0.3-next.159",
331470
+ "@superblocksteam/util": "2.0.3-next.161",
331471
+ "@superblocksteam/vite-plugin-file-sync": "2.0.3-next.161",
331472
331472
  "@vitejs/plugin-react": "^4.3.4",
331473
331473
  axios: "^1.4.0",
331474
331474
  chokidar: "^4.0.3",
@@ -372301,6 +372301,12 @@ var SocketManager = class extends EventEmitter8 {
372301
372301
  await syncService?.commitLocalDraftChanges();
372302
372302
  await aiService?.handleUserAcceptedDraft(peer);
372303
372303
  }
372304
+ ],
372305
+ aiCancel: [
372306
+ async () => {
372307
+ await syncService?.discardLocalDraftChanges();
372308
+ await aiService?.handleUserCanceled();
372309
+ }
372304
372310
  ]
372305
372311
  }
372306
372312
  }), [], void 0, void 0));
@@ -376155,7 +376161,7 @@ async function startVite({ app, httpServer: httpServer2, root: root2, mode, port
376155
376161
  };
376156
376162
  const isCustomBuildEnabled2 = await isCustomComponentsEnabled();
376157
376163
  const customFolder = path21.join(root2, "custom");
376158
- const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.3-next.159";
376164
+ const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.3-next.161";
376159
376165
  const env3 = loadEnv(mode, root2, "");
376160
376166
  const hmrPort = await getFreePort();
376161
376167
  const hmrOptions = {
@@ -382348,7 +382354,7 @@ var AppShell = class {
382348
382354
  })));
382349
382355
  });
382350
382356
  }
382351
- async runTypecheck() {
382357
+ async runTypecheck(abortSignal) {
382352
382358
  const checkForErrors = new Promise((resolve8) => {
382353
382359
  exec([
382354
382360
  "npx tsc",
@@ -382361,7 +382367,8 @@ var AppShell = class {
382361
382367
  "--tsBuildInfoFile .superblocks/app.tsbuildinfo"
382362
382368
  ].join(" "), {
382363
382369
  cwd: this.appRootDirPath,
382364
- encoding: "utf-8"
382370
+ encoding: "utf-8",
382371
+ signal: abortSignal
382365
382372
  }, (_error, stdout, stderr) => {
382366
382373
  resolve8(stdout || stderr);
382367
382374
  });
@@ -382380,7 +382387,7 @@ var AppShell = class {
382380
382387
  }, {});
382381
382388
  return Object.keys(parsed).length > 0 ? parsed : null;
382382
382389
  }
382383
- async runNpmInstall() {
382390
+ async runNpmInstall(abortSignal) {
382384
382391
  return await new Promise((resolve8, reject) => {
382385
382392
  const command = (
382386
382393
  // if we're running in csb mock server, we need to avoid conflicts with the workspace
@@ -382388,7 +382395,8 @@ var AppShell = class {
382388
382395
  );
382389
382396
  exec(command, {
382390
382397
  cwd: this.appRootDirPath,
382391
- timeout: 3e4
382398
+ timeout: 3e4,
382399
+ signal: abortSignal
382392
382400
  }, (error, _stdout, stderr) => {
382393
382401
  if (error) {
382394
382402
  return reject(new NpmInstallError(stderr));
@@ -382564,6 +382572,7 @@ var ClarkStateNames = $;
382564
382572
  var USER_SENT_PROMPT = "userSentPrompt";
382565
382573
  var USER_ACCEPTED_DRAFT = "userAcceptedDraft";
382566
382574
  var USER_REJECTED_DRAFT = "userRejectedDraft";
382575
+ var USER_CANCELED = "userCanceled";
382567
382576
  var AGENT_PLANNED = "agentPlanned";
382568
382577
  var AGENT_NEEDS_USER_INPUT = "agentNeedsUserInput";
382569
382578
  var AGENT_GAVE_UP = "agentGaveUp";
@@ -382586,29 +382595,34 @@ var transitions = {
382586
382595
  [$.AgentPlanning]: {
382587
382596
  [AGENT_PLANNED]: $.LLMGenerating,
382588
382597
  [AGENT_NEEDS_USER_INPUT]: $.AwaitingUser,
382589
- [AGENT_GAVE_UP]: $.Dead
382598
+ [AGENT_GAVE_UP]: $.Dead,
382599
+ [USER_CANCELED]: $.Idle
382590
382600
  },
382591
382601
  [$.LLMGenerating]: {
382592
382602
  [LLM_FINISHED]: $.PostProcessing,
382593
382603
  [LLM_ERRORED]: $.AgentPlanning,
382594
382604
  [LLM_FINISHED_UNEXPECTEDLY]: $.AgentPlanning,
382595
382605
  [LLM_REQUESTED_CONTEXT]: $.AgentPlanning,
382596
- [APP_RUNTIME_UPDATED_WITHOUT_EDITS]: $.Idle
382606
+ [APP_RUNTIME_UPDATED_WITHOUT_EDITS]: $.Idle,
382607
+ [USER_CANCELED]: $.Idle
382597
382608
  },
382598
382609
  [$.PostProcessing]: {
382599
382610
  [POST_PROCESSING_FINISHED]: $.RuntimeReviewing,
382600
- [POST_PROCESSING_ERRORED]: $.AgentPlanning
382611
+ [POST_PROCESSING_ERRORED]: $.AgentPlanning,
382612
+ [USER_CANCELED]: $.Idle
382601
382613
  },
382602
382614
  [$.RuntimeReviewing]: {
382603
382615
  [RUNTIME_REVIEW_ERRORED]: $.AgentPlanning,
382604
382616
  [BUILD_SYSTEM_ERRORED]: $.AgentPlanning,
382605
382617
  [RUNTIME_REVIEW_FINISHED]: $.AwaitingUser,
382606
- [APP_RUNTIME_UPDATED_WITHOUT_EDITS]: $.Idle
382618
+ [APP_RUNTIME_UPDATED_WITHOUT_EDITS]: $.Idle,
382619
+ [USER_CANCELED]: $.Idle
382607
382620
  },
382608
382621
  [$.AwaitingUser]: {
382609
382622
  [USER_ACCEPTED_DRAFT]: $.Idle,
382610
382623
  [USER_REJECTED_DRAFT]: $.RuntimeReviewing,
382611
- [USER_SENT_PROMPT]: $.AgentPlanning
382624
+ [USER_SENT_PROMPT]: $.AgentPlanning,
382625
+ [USER_CANCELED]: $.Idle
382612
382626
  },
382613
382627
  [$.Dead]: {}
382614
382628
  };
@@ -382870,7 +382884,7 @@ init_cjs_shims();
382870
382884
  init_cjs_shims();
382871
382885
  var generated = {};
382872
382886
  try {
382873
- generated = await import("./generated-FORH4H64.js");
382887
+ generated = await import("./generated-PNY22F3P.js");
382874
382888
  } catch (_error) {
382875
382889
  getLogger().warn("[ai-service] Generated markdown modules not found. Run `pnpm generate:markdown` first.");
382876
382890
  }
@@ -383327,6 +383341,9 @@ var sendUserCompletionChannel = (clark) => async (payload) => {
383327
383341
  init_cjs_shims();
383328
383342
  var transitionFrom = (clark) => {
383329
383343
  return (event) => {
383344
+ if (clark.context.abortController?.signal.aborted && event.type !== USER_CANCELED) {
383345
+ return clark.send({ type: USER_CANCELED });
383346
+ }
383330
383347
  return clark.send(event);
383331
383348
  };
383332
383349
  };
@@ -383376,9 +383393,11 @@ Address the errors and return the fixed code.`;
383376
383393
  switch (event.type) {
383377
383394
  case USER_SENT_PROMPT: {
383378
383395
  const { request, peer } = event;
383379
- clark.updateContext({
383396
+ clark.updateContext((context3) => ({
383397
+ ...context3,
383398
+ abortController: context3.abortController ?? new AbortController(),
383380
383399
  peer
383381
- });
383400
+ }));
383382
383401
  if (clark.context.hasSuggestions) {
383383
383402
  const meta2 = getMeta();
383384
383403
  const previousPrompts = meta2?.promptsForCurrentDraft ?? [];
@@ -383599,12 +383618,18 @@ var doAwaitingUser = (clark, { signals }) => {
383599
383618
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/handlers/idle.js
383600
383619
  init_cjs_shims();
383601
383620
  var doIdle = (clark) => {
383621
+ const sendUserMessage = sendUserMessageChannel(clark);
383602
383622
  return async ({ event }) => {
383603
383623
  switch (event.type) {
383604
383624
  case USER_ACCEPTED_DRAFT:
383605
383625
  break;
383606
383626
  case APP_RUNTIME_UPDATED_WITHOUT_EDITS:
383607
383627
  break;
383628
+ case USER_CANCELED:
383629
+ void sendUserMessage({
383630
+ text: "Canceled."
383631
+ });
383632
+ break;
383608
383633
  default:
383609
383634
  throw new Error(`Unhandled event: ${event}`);
383610
383635
  }
@@ -389755,12 +389780,14 @@ var doLLMGenerating = (clark, { anthropicProvider, artifactProcessor }) => {
389755
389780
  switch (event.type) {
389756
389781
  case AGENT_PLANNED: {
389757
389782
  const { systemPrompt, userPrompt, debugging } = event;
389783
+ const { abortController } = clark.context;
389758
389784
  const { fullStream } = streamText({
389759
389785
  model: anthropicProvider("claude-4-sonnet-20250514"),
389760
389786
  system: systemPrompt,
389761
389787
  prompt: userPrompt,
389762
389788
  experimental_transform: smoothStream(),
389763
- maxTokens: 32e3
389789
+ maxTokens: 32e3,
389790
+ abortSignal: abortController?.signal
389764
389791
  });
389765
389792
  let pendingArtifacts = false;
389766
389793
  let artifactChunk = null;
@@ -390112,7 +390139,7 @@ var doPostProcessing = (clark, { applicationId, organizationId, draftInterface,
390112
390139
  text: "Installing dependencies\u2026"
390113
390140
  });
390114
390141
  await createDraftFiles([packageJson]);
390115
- await appShell.runNpmInstall();
390142
+ await appShell.runNpmInstall(clark.context.abortController?.signal);
390116
390143
  }
390117
390144
  await createDraftFiles(scopes);
390118
390145
  await createDraftFiles(apiYamls);
@@ -390154,7 +390181,7 @@ var doRuntimeReviewing = (clark, params) => {
390154
390181
  ...context3,
390155
390182
  hasSuggestions: context3.hasSuggestions || files.length > 0
390156
390183
  }));
390157
- const tsErrorsByPath = await params.appShell.runTypecheck();
390184
+ const tsErrorsByPath = await params.appShell.runTypecheck(clark.context.abortController?.signal);
390158
390185
  if (tsErrorsByPath) {
390159
390186
  transitionTo({
390160
390187
  type: RUNTIME_REVIEW_ERRORED,
@@ -390198,7 +390225,7 @@ var AiService = class extends EventEmitter10 {
390198
390225
  this.clark = new FSM({
390199
390226
  transitions,
390200
390227
  initialState: ClarkStateNames.Idle,
390201
- initialContext: {},
390228
+ initialContext: { abortController: new AbortController() },
390202
390229
  createTransitionHandler: this.createClarkTransitionHandler()
390203
390230
  });
390204
390231
  this.config.draftInterface.hasLocalDraftChanges().then((hasDraft) => {
@@ -390281,6 +390308,12 @@ var AiService = class extends EventEmitter10 {
390281
390308
  const transitionTo = transitionFrom(this.clark);
390282
390309
  transitionTo({ type: USER_REJECTED_DRAFT });
390283
390310
  }
390311
+ async handleUserCanceled() {
390312
+ if (!this.isBusy()) {
390313
+ return;
390314
+ }
390315
+ this.clark.context.abortController?.abort();
390316
+ }
390284
390317
  handleBuildSystemError(error) {
390285
390318
  if (this.clark.state !== ClarkStateNames.RuntimeReviewing) {
390286
390319
  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.159"
512
+ "version": "2.0.3-next.161"
513
513
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/cli",
3
- "version": "2.0.3-next.159",
3
+ "version": "2.0.3-next.161",
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.159",
45
+ "@superblocksteam/sdk": "2.0.3-next.161",
46
46
  "@superblocksteam/shared": "0.9120.0",
47
- "@superblocksteam/util": "2.0.3-next.159",
47
+ "@superblocksteam/util": "2.0.3-next.161",
48
48
  "@types/babel__core": "^7.20.0",
49
49
  "@types/chai": "^4",
50
50
  "@types/fs-extra": "^11.0.1",