@ultrst-armada/kloks 1.11.0 → 1.12.0

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "packageName": "@ultrst-armada/kloks",
4
- "version": "1.11.0",
5
- "sourceCommit": "40311855e347e1e15506fb3050426448b1a25f76",
4
+ "version": "1.12.0",
5
+ "sourceCommit": "3b4fb17e13cd3afc36e9233d4cec9132d42f4633",
6
6
  "releaseWorkflow": "npm Release",
7
- "workflowRunId": "40323647247"
7
+ "workflowRunId": "40325400585"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultrst-armada/kloks",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -603,6 +603,11 @@ interface MonacoIdeSession {
603
603
  sessionId: string;
604
604
  document: MonacoDocument;
605
605
  options: MonacoEditorOptions;
606
+ workspaceContext?: MonacoWorkspaceContext;
607
+ languageConfiguration?: MonacoLanguageConfiguration;
608
+ completions?: MonacoCompletionItem[];
609
+ validation?: MonacoValidationResult;
610
+ importAnalysis?: MonacoImportAnalysis[];
606
611
  createdAt: number;
607
612
  updatedAt: number;
608
613
  }
@@ -660,6 +665,33 @@ interface MonacoValidationResult {
660
665
  checkedAt: number;
661
666
  }
662
667
  type MonacoCompletionProvider = (request: MonacoCompletionRequest) => Promise<MonacoCompletionItem[]>;
668
+ interface MonacoLanguageConfiguration {
669
+ language: string;
670
+ extensions?: string[];
671
+ aliases?: string[];
672
+ configuration: Record<string, unknown>;
673
+ }
674
+ interface MonacoSerializedSession {
675
+ schemaVersion: '1.0.0';
676
+ serializedAt: number;
677
+ session: MonacoIdeSession;
678
+ }
679
+ interface MonacoSetWorkspaceContextInput {
680
+ sessionId: string;
681
+ workspaceContext: MonacoWorkspaceContext;
682
+ }
683
+ interface MonacoSetCompletionsInput {
684
+ sessionId: string;
685
+ completions: MonacoCompletionItem[];
686
+ }
687
+ interface MonacoSetValidationResultInput {
688
+ sessionId: string;
689
+ validation: MonacoValidationResult;
690
+ }
691
+ interface MonacoSetImportAnalysisInput {
692
+ sessionId: string;
693
+ imports: MonacoImportAnalysis[];
694
+ }
663
695
 
664
696
  type UIAuthoringContext = 'service' | 'general-component' | 'application';
665
697
  type UIAuthoringNodeKind = 'page' | 'section' | 'component';
@@ -763,4 +795,4 @@ declare const KLOKS_CANONICAL_CONTRACT: {
763
795
  validateCompatibility: (consumerSymbols?: string[]) => CompatibilityCheckResult;
764
796
  };
765
797
 
766
- export { type AssetRef, type AudioBusConfig, AudioBusConfigSchema, type AudioHardwareState, AudioHardwareStateSchema, type BackendOperation, BackendOperationSchema, type CompatibilityCheckResult, type ComponentDescriptor, type ContractDiffResult, type ContractSnapshot, ContractSnapshotSchema, type ExportSymbolEntry, type GraphEntityMetadata, GraphEntityMetadataSchema, KLOKS_CANONICAL_CONTRACT, KLOKS_PUBLIC_SURFACE, type MidiCommandType, MidiCommandTypeSchema, type MidiEventPayload, MidiEventPayloadSchema, type MonacoCompletionItem, type MonacoCompletionProvider, type MonacoCompletionRequest, type MonacoCreateSessionInput, type MonacoDiagnostic, type MonacoDiagnosticSeverity, type MonacoDocument, type MonacoEditorOptions, type MonacoIdeSession, type MonacoImportAnalysis, type MonacoUpdateDocumentInput, type MonacoValidationResult, type MonacoWorkspaceContext, type NodeDimensions2D, NodeDimensions2DSchema, type NodeHeaderStyle, NodeHeaderStyleSchema, type NodeScreenRect2D, NodeScreenRect2DSchema, type OperationBinding, type PageDescriptor, type PublicContractDefinition, PublicContractDefinitionSchema, QWNSR_REQUIRED_SURFACE, type SectionDescriptor, type ServiceUISchema, type SocketDirection, SocketDirectionSchema, type SocketGeometryConfig, SocketGeometryConfigSchema, type SocketPosition2D, SocketPosition2DSchema, type SocketStyleConfig, SocketStyleConfigSchema, type UIAuthoringBinding, type UIAuthoringContext, type UIAuthoringCreateInput, type UIAuthoringNode, type UIAuthoringNodeKind, type UIAuthoringOperation, type UIAuthoringSession, type UIAuthoringValidation, type UIComponentArtifact, type UIComponentPromotion, type UIComponentPurpose, type UIRequirementMode, UI_AUTHORING_SCHEMA_VERSION, type WireAnimationConfig, WireAnimationConfigSchema, type WireCurveStyle, WireCurveStyleSchema, type WireEndpoint2D, WireEndpoint2DSchema, type WireVisualConfig, WireVisualConfigSchema, buildServiceUISchema, buildUIComponentArtifact, createKloksSnapshot, diffContractSnapshots, getUIComponentPromotion, getUIComponentPurpose, suggestUIComponent, validateConsumerSurfaceCompatibility };
798
+ export { type AssetRef, type AudioBusConfig, AudioBusConfigSchema, type AudioHardwareState, AudioHardwareStateSchema, type BackendOperation, BackendOperationSchema, type CompatibilityCheckResult, type ComponentDescriptor, type ContractDiffResult, type ContractSnapshot, ContractSnapshotSchema, type ExportSymbolEntry, type GraphEntityMetadata, GraphEntityMetadataSchema, KLOKS_CANONICAL_CONTRACT, KLOKS_PUBLIC_SURFACE, type MidiCommandType, MidiCommandTypeSchema, type MidiEventPayload, MidiEventPayloadSchema, type MonacoCompletionItem, type MonacoCompletionProvider, type MonacoCompletionRequest, type MonacoCreateSessionInput, type MonacoDiagnostic, type MonacoDiagnosticSeverity, type MonacoDocument, type MonacoEditorOptions, type MonacoIdeSession, type MonacoImportAnalysis, type MonacoLanguageConfiguration, type MonacoSerializedSession, type MonacoSetCompletionsInput, type MonacoSetImportAnalysisInput, type MonacoSetValidationResultInput, type MonacoSetWorkspaceContextInput, type MonacoUpdateDocumentInput, type MonacoValidationResult, type MonacoWorkspaceContext, type NodeDimensions2D, NodeDimensions2DSchema, type NodeHeaderStyle, NodeHeaderStyleSchema, type NodeScreenRect2D, NodeScreenRect2DSchema, type OperationBinding, type PageDescriptor, type PublicContractDefinition, PublicContractDefinitionSchema, QWNSR_REQUIRED_SURFACE, type SectionDescriptor, type ServiceUISchema, type SocketDirection, SocketDirectionSchema, type SocketGeometryConfig, SocketGeometryConfigSchema, type SocketPosition2D, SocketPosition2DSchema, type SocketStyleConfig, SocketStyleConfigSchema, type UIAuthoringBinding, type UIAuthoringContext, type UIAuthoringCreateInput, type UIAuthoringNode, type UIAuthoringNodeKind, type UIAuthoringOperation, type UIAuthoringSession, type UIAuthoringValidation, type UIComponentArtifact, type UIComponentPromotion, type UIComponentPurpose, type UIRequirementMode, UI_AUTHORING_SCHEMA_VERSION, type WireAnimationConfig, WireAnimationConfigSchema, type WireCurveStyle, WireCurveStyleSchema, type WireEndpoint2D, WireEndpoint2DSchema, type WireVisualConfig, WireVisualConfigSchema, buildServiceUISchema, buildUIComponentArtifact, createKloksSnapshot, diffContractSnapshots, getUIComponentPromotion, getUIComponentPurpose, suggestUIComponent, validateConsumerSurfaceCompatibility };
@@ -3,7 +3,7 @@ import { ServiceDefinition, IService, EndpointDescriptor, ProtocolAdapter } from
3
3
  import { AdminDatabaseClusterConfig, DatabaseConnectionEntry, UserStorageConnection, AuthState, UserAccount, UserRole, UserWorkspaceRecord } from '@ultrst-armada/kloks/state-graph';
4
4
  export { AuthState, UserAccount, UserRole, UserSession, UserStorageConnection, UserWorkspaceRecord } from '@ultrst-armada/kloks/state-graph';
5
5
  import * as _kloks_contracts from '@ultrst-armada/kloks/contracts';
6
- import { ServiceUISchema, MonacoIdeSession, UIAuthoringSession } from '@ultrst-armada/kloks/contracts';
6
+ import { ServiceUISchema, MonacoIdeSession, MonacoLanguageConfiguration, UIAuthoringSession } from '@ultrst-armada/kloks/contracts';
7
7
 
8
8
  interface SystemEnvironmentStatus {
9
9
  databaseUrlConfigured: boolean;
@@ -278,6 +278,8 @@ declare const SystemDbServiceUISchema: ServiceUISchema;
278
278
 
279
279
  interface MonacoState extends Record<string, unknown> {
280
280
  sessions: Record<string, MonacoIdeSession>;
281
+ workspaces: Record<string, _kloks_contracts.MonacoWorkspaceContext>;
282
+ languageConfigurations: Record<string, MonacoLanguageConfiguration>;
281
283
  }
282
284
  declare const MonacoIdeServiceDefinition: ServiceDefinition<MonacoState, Record<string, unknown>>;
283
285
  declare function createMonacoIdeService(): IService<MonacoState>;
@@ -1658,7 +1658,7 @@ function buildMonacoIdeServiceDefinition(getService) {
1658
1658
  id: "kloks.service.monacoIde",
1659
1659
  name: "MonacoIdeService",
1660
1660
  version: "1.0.0",
1661
- state: { initial: { sessions: {} } },
1661
+ state: { initial: { sessions: {}, workspaces: {}, languageConfigurations: {} } },
1662
1662
  operations: {
1663
1663
  createSession: {
1664
1664
  id: "MonacoIdeService.createSession",
@@ -1673,7 +1673,7 @@ function buildMonacoIdeServiceDefinition(getService) {
1673
1673
  createdAt: now,
1674
1674
  updatedAt: now
1675
1675
  };
1676
- getService().setState({ sessions: { ...getService().getState().sessions, [sessionId]: session } });
1676
+ getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [sessionId]: session } });
1677
1677
  return session;
1678
1678
  }
1679
1679
  },
@@ -1690,7 +1690,7 @@ function buildMonacoIdeServiceDefinition(getService) {
1690
1690
  version: current.document.version + 1
1691
1691
  };
1692
1692
  const session = { ...current, document, updatedAt: Date.now() };
1693
- getService().setState({ sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
1693
+ getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
1694
1694
  return session;
1695
1695
  }
1696
1696
  },
@@ -1705,7 +1705,7 @@ function buildMonacoIdeServiceDefinition(getService) {
1705
1705
  document: { ...current.document, diagnostics: input.diagnostics },
1706
1706
  updatedAt: Date.now()
1707
1707
  };
1708
- getService().setState({ sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
1708
+ getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
1709
1709
  return session;
1710
1710
  }
1711
1711
  },
@@ -1716,7 +1716,7 @@ function buildMonacoIdeServiceDefinition(getService) {
1716
1716
  const current = getService().getState().sessions[input.sessionId];
1717
1717
  if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
1718
1718
  const session = { ...current, options: { ...current.options, ...input.options }, updatedAt: Date.now() };
1719
- getService().setState({ sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
1719
+ getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [session.sessionId]: session } });
1720
1720
  return session;
1721
1721
  }
1722
1722
  },
@@ -1731,9 +1731,136 @@ function buildMonacoIdeServiceDefinition(getService) {
1731
1731
  handler: async (input, ctx) => {
1732
1732
  const sessions = { ...getService().getState().sessions };
1733
1733
  delete sessions[input.sessionId];
1734
- getService().setState({ sessions });
1734
+ getService().setState({ ...getService().getState(), sessions });
1735
1735
  return { disposed: true, sessionId: input.sessionId };
1736
1736
  }
1737
+ },
1738
+ setWorkspaceContext: {
1739
+ id: "MonacoIdeService.setWorkspaceContext",
1740
+ name: "setWorkspaceContext",
1741
+ handler: async (input, ctx) => {
1742
+ const current = getService().getState().sessions[input.sessionId];
1743
+ if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
1744
+ const session = { ...current, workspaceContext: input.workspaceContext, updatedAt: Date.now() };
1745
+ const state = getService().getState();
1746
+ getService().setState({
1747
+ ...state,
1748
+ sessions: { ...state.sessions, [input.sessionId]: session },
1749
+ workspaces: { ...state.workspaces, [input.workspaceContext.workspaceId]: input.workspaceContext }
1750
+ });
1751
+ return session;
1752
+ }
1753
+ },
1754
+ setLanguageConfiguration: {
1755
+ id: "MonacoIdeService.setLanguageConfiguration",
1756
+ name: "setLanguageConfiguration",
1757
+ handler: async (input, ctx) => {
1758
+ const current = getService().getState().sessions[input.sessionId];
1759
+ if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
1760
+ const state = getService().getState();
1761
+ const session = { ...current, languageConfiguration: input.configuration, updatedAt: Date.now() };
1762
+ getService().setState({
1763
+ ...state,
1764
+ sessions: { ...state.sessions, [input.sessionId]: session },
1765
+ languageConfigurations: { ...state.languageConfigurations, [input.configuration.language]: input.configuration }
1766
+ });
1767
+ return session;
1768
+ }
1769
+ },
1770
+ setCompletions: {
1771
+ id: "MonacoIdeService.setCompletions",
1772
+ name: "setCompletions",
1773
+ handler: async (input, ctx) => {
1774
+ const current = getService().getState().sessions[input.sessionId];
1775
+ if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
1776
+ const session = { ...current, completions: input.completions, updatedAt: Date.now() };
1777
+ getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [input.sessionId]: session } });
1778
+ return session;
1779
+ }
1780
+ },
1781
+ setValidationResult: {
1782
+ id: "MonacoIdeService.setValidationResult",
1783
+ name: "setValidationResult",
1784
+ handler: async (input, ctx) => {
1785
+ const current = getService().getState().sessions[input.sessionId];
1786
+ if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
1787
+ const session = {
1788
+ ...current,
1789
+ validation: input.validation,
1790
+ document: { ...current.document, diagnostics: input.validation.diagnostics },
1791
+ updatedAt: Date.now()
1792
+ };
1793
+ getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [input.sessionId]: session } });
1794
+ return session;
1795
+ }
1796
+ },
1797
+ setImportAnalysis: {
1798
+ id: "MonacoIdeService.setImportAnalysis",
1799
+ name: "setImportAnalysis",
1800
+ handler: async (input, ctx) => {
1801
+ const current = getService().getState().sessions[input.sessionId];
1802
+ if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
1803
+ const session = { ...current, importAnalysis: input.imports, updatedAt: Date.now() };
1804
+ getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [input.sessionId]: session } });
1805
+ return session;
1806
+ }
1807
+ },
1808
+ analyzeImports: {
1809
+ id: "MonacoIdeService.analyzeImports",
1810
+ name: "analyzeImports",
1811
+ handler: async (input, ctx) => {
1812
+ const current = getService().getState().sessions[input.sessionId];
1813
+ if (!current) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
1814
+ const workspace = current.workspaceContext;
1815
+ const source = current.document.value;
1816
+ const pattern = /\bimport\s+(?:[^'"]*?\s+from\s*)?['"]([^'"]+)['"]|\bexport\s+[^'"]*?\s+from\s*['"]([^'"]+)['"]|\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
1817
+ const imports = [];
1818
+ for (const match of source.matchAll(pattern)) {
1819
+ const specifier = match[1] || match[2] || match[3];
1820
+ if (!specifier) continue;
1821
+ const lineNumber = source.slice(0, match.index || 0).split("\n").length;
1822
+ const normalizedSpecifier = specifier.replace(/^\.\//, "");
1823
+ const resolvedUri = workspace?.files.find(
1824
+ (file) => file.uri === specifier || file.uri.endsWith("/" + normalizedSpecifier) || file.uri.endsWith(normalizedSpecifier)
1825
+ )?.uri;
1826
+ imports.push({
1827
+ specifier,
1828
+ importedSymbols: [],
1829
+ lineNumber,
1830
+ resolvedUri,
1831
+ resolved: Boolean(resolvedUri || workspace?.dependencies?.[specifier])
1832
+ });
1833
+ }
1834
+ const session = { ...current, importAnalysis: imports, updatedAt: Date.now() };
1835
+ getService().setState({ ...getService().getState(), sessions: { ...getService().getState().sessions, [input.sessionId]: session } });
1836
+ return imports;
1837
+ }
1838
+ },
1839
+ serializeSession: {
1840
+ id: "MonacoIdeService.serializeSession",
1841
+ name: "serializeSession",
1842
+ handler: async (input, ctx) => {
1843
+ const session = getService().getState().sessions[input.sessionId];
1844
+ if (!session) throw new Error(`Unknown Monaco session: ${input.sessionId}`);
1845
+ return { schemaVersion: "1.0.0", serializedAt: Date.now(), session: structuredClone(session) };
1846
+ }
1847
+ },
1848
+ restoreSession: {
1849
+ id: "MonacoIdeService.restoreSession",
1850
+ name: "restoreSession",
1851
+ handler: async (input, ctx) => {
1852
+ if (input.serialized.schemaVersion !== "1.0.0") throw new Error("Unsupported Monaco session schema version.");
1853
+ const session = input.serialized.session;
1854
+ if (!session?.sessionId || !session.document?.uri) throw new Error("Invalid serialized Monaco session.");
1855
+ const state = getService().getState();
1856
+ getService().setState({ ...state, sessions: { ...state.sessions, [session.sessionId]: session } });
1857
+ return session;
1858
+ }
1859
+ },
1860
+ getLanguageConfiguration: {
1861
+ id: "MonacoIdeService.getLanguageConfiguration",
1862
+ name: "getLanguageConfiguration",
1863
+ handler: async (input, ctx) => getService().getState().languageConfigurations[input.language] || null
1737
1864
  }
1738
1865
  }
1739
1866
  });
@@ -16,6 +16,20 @@ import {
16
16
  useSkipoBind,
17
17
  useSkipoState
18
18
  } from "./chunk-EW4ACSZB.js";
19
+ import {
20
+ CommandApi,
21
+ GhostStore,
22
+ GraphStore
23
+ } from "./chunk-4UVGXFEM.js";
24
+ import {
25
+ BaseGraph,
26
+ BaseNode,
27
+ BaseViewWindow,
28
+ CustomGraph,
29
+ CustomNode,
30
+ CustomViewWindow,
31
+ DEFAULT_GRAPH_SETTINGS
32
+ } from "./chunk-KG6QYS26.js";
19
33
  import {
20
34
  AttractionEngine,
21
35
  GhostInferenceEngine,
@@ -31,20 +45,6 @@ import {
31
45
  WireTypeRegistry,
32
46
  initializeDefaultGraphRules
33
47
  } from "./chunk-TZOL3RN7.js";
34
- import {
35
- CommandApi,
36
- GhostStore,
37
- GraphStore
38
- } from "./chunk-4UVGXFEM.js";
39
- import {
40
- BaseGraph,
41
- BaseNode,
42
- BaseViewWindow,
43
- CustomGraph,
44
- CustomNode,
45
- CustomViewWindow,
46
- DEFAULT_GRAPH_SETTINGS
47
- } from "./chunk-KG6QYS26.js";
48
48
  import {
49
49
  AutoSolidify,
50
50
  SpatialEngine,