@sidecar-ai/compiler 0.1.0-alpha.0 → 0.1.0-alpha.1

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/index.js CHANGED
@@ -1560,7 +1560,6 @@ function hasProperty(definition, propertyName) {
1560
1560
  // packages/compiler/src/diagnostics.ts
1561
1561
  import { existsSync as existsSync3 } from "fs";
1562
1562
  import { readFile as readFile2 } from "fs/promises";
1563
- import { createRequire } from "module";
1564
1563
  import path6 from "path";
1565
1564
  async function collectProjectDiagnostics(rootDir, input) {
1566
1565
  const diagnostics = [];
@@ -1569,7 +1568,6 @@ async function collectProjectDiagnostics(rootDir, input) {
1569
1568
  const prompts = Array.isArray(input) ? [] : input.prompts ?? [];
1570
1569
  const config = Array.isArray(input) ? void 0 : input.config;
1571
1570
  const hasAuthConfig = existsSync3(path6.join(rootDir, "auth.ts"));
1572
- const hasOpenAiAppsSdkUi = canResolveOpenAiAppsSdkUi(rootDir);
1573
1571
  for (const entry of tools) {
1574
1572
  const toolPath = path6.join(rootDir, entry.sourceFile);
1575
1573
  const toolSource = await readFile2(toolPath, "utf8");
@@ -1577,7 +1575,7 @@ async function collectProjectDiagnostics(rootDir, input) {
1577
1575
  if (entry.widget) {
1578
1576
  const widgetPath = path6.join(rootDir, entry.widget.sourceFile);
1579
1577
  const widgetSource = await readFile2(widgetPath, "utf8");
1580
- diagnostics.push(...diagnoseWidgetSource(rootDir, entry, widgetSource, hasOpenAiAppsSdkUi));
1578
+ diagnostics.push(...diagnoseWidgetSource(rootDir, entry, widgetSource));
1581
1579
  }
1582
1580
  }
1583
1581
  for (const entry of resources) {
@@ -1678,7 +1676,7 @@ function diagnoseToolSource(rootDir, entry, source, hasAuthConfig) {
1678
1676
  }
1679
1677
  return diagnostics.filter((diagnostic) => !isIgnored(source, diagnostic.code));
1680
1678
  }
1681
- function diagnoseWidgetSource(_rootDir, entry, source, hasOpenAiAppsSdkUi) {
1679
+ function diagnoseWidgetSource(_rootDir, entry, source) {
1682
1680
  const diagnostics = [];
1683
1681
  const widgetFile = entry.widget?.sourceFile;
1684
1682
  if (!widgetFile) {
@@ -1714,16 +1712,6 @@ function diagnoseWidgetSource(_rootDir, entry, source, hasOpenAiAppsSdkUi) {
1714
1712
  hint: "Use @sidecar-ai/native for portable primitives. Keep @sidecar-ai/openai/components for widgets intentionally targeted to ChatGPT."
1715
1713
  });
1716
1714
  }
1717
- if (/@sidecar-ai\/openai\/components/.test(source) && !hasOpenAiAppsSdkUi && !isIgnored(source, "SIDECAR_OPENAI_UI_SDK_MISSING")) {
1718
- diagnostics.push({
1719
- severity: "error",
1720
- code: "SIDECAR_OPENAI_UI_SDK_MISSING",
1721
- message: `Widget for "${entry.id}" imports @sidecar-ai/openai/components but @openai/apps-sdk-ui is not installed.`,
1722
- filePath: widgetFile,
1723
- ...locate(source, "@sidecar-ai/openai/components"),
1724
- hint: "Install it with: npm install @openai/apps-sdk-ui"
1725
- });
1726
- }
1727
1715
  if (entry.widget?.variant !== "anthropic" && /@sidecar-ai\/anthropic\/components/.test(source) && !isIgnored(source, "SIDECAR_ANTHROPIC_COMPONENT_CROSS_HOST")) {
1728
1716
  diagnostics.push({
1729
1717
  severity: "warning",
@@ -1813,14 +1801,6 @@ function hasCompanyKnowledgeShape(schema) {
1813
1801
  const id = properties.id;
1814
1802
  return query?.type === "string" || url?.type === "string" || id?.type === "string";
1815
1803
  }
1816
- function canResolveOpenAiAppsSdkUi(rootDir) {
1817
- try {
1818
- createRequire(path6.join(rootDir, "package.json")).resolve("@openai/apps-sdk-ui/css");
1819
- return true;
1820
- } catch {
1821
- return false;
1822
- }
1823
- }
1824
1804
  function locate(source, needle) {
1825
1805
  const index = Math.max(0, source.indexOf(needle));
1826
1806
  const prefix = source.slice(0, index);