@ultrst-armada/kloks 2.0.1 → 2.0.2

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.
Files changed (31) hide show
  1. package/package.json +1 -1
  2. package/packages/backend/dist/api/index.js +1 -1
  3. package/packages/backend/dist/api/middleware.test.d.ts +1 -0
  4. package/packages/backend/dist/{chunk-WC6EPW3A.js → chunk-POLVHTHJ.js} +16 -6
  5. package/packages/backend/dist/index.js +1 -1
  6. package/packages/backend/dist/node.js +1 -1
  7. package/packages/client/dist/auth.js +1 -1
  8. package/packages/client/dist/{chunk-5JMYSB7L.js → chunk-ATLIA7AJ.js} +11 -1
  9. package/packages/client/dist/index.js +1 -1
  10. package/packages/functions/dist/async.d.ts +36 -0
  11. package/packages/functions/dist/base.d.ts +31 -1
  12. package/packages/functions/dist/cache.d.ts +27 -0
  13. package/packages/functions/dist/env-node.d.ts +8 -0
  14. package/packages/functions/dist/env.d.ts +19 -0
  15. package/packages/functions/dist/events.d.ts +32 -0
  16. package/packages/functions/dist/fileCache.d.ts +9 -0
  17. package/packages/functions/dist/fs-lock.d.ts +9 -0
  18. package/packages/functions/dist/fs.d.ts +35 -0
  19. package/packages/functions/dist/http.d.ts +36 -0
  20. package/packages/functions/dist/index.d.ts +14 -16
  21. package/packages/functions/dist/node.d.ts +7 -110
  22. package/packages/functions/dist/object.d.ts +32 -0
  23. package/packages/functions/dist/portable.d.ts +12 -206
  24. package/packages/functions/dist/shell.d.ts +37 -0
  25. package/packages/functions/dist/string.d.ts +14 -0
  26. package/packages/functions/dist/types.d.ts +31 -0
  27. package/packages/functions/package.json +1 -1
  28. package/packages/state-graph/dist/browser.js +16 -16
  29. package/packages/state-graph/dist/index.js +16 -16
  30. package/packages/functions/dist/base-DDYO-DzM.d.ts +0 -64
  31. package/packages/state-graph/dist/{chunk-UKTICGGV.js → chunk-YUJC367F.js} +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultrst-armada/kloks",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -3,7 +3,7 @@ import {
3
3
  createSSEResponse,
4
4
  withAuth,
5
5
  withCors
6
- } from "../chunk-WC6EPW3A.js";
6
+ } from "../chunk-POLVHTHJ.js";
7
7
  export {
8
8
  BaseApiRoute,
9
9
  createSSEResponse,
@@ -0,0 +1 @@
1
+ export {};
@@ -23,22 +23,32 @@ var BaseApiRoute = class extends SkipoBase {
23
23
  // src/api/middleware.ts
24
24
  function withAuth(verifyToken) {
25
25
  return async (req) => {
26
- const authHeader = req.headers.get("Authorization");
27
- if (!authHeader || !authHeader.startsWith("Bearer ")) {
26
+ const authHeader = req.headers.get("authorization") ?? req.headers.get("Authorization");
27
+ if (!authHeader) {
28
28
  return new Response(JSON.stringify({ error: "Unauthorized", status: 401 }), { status: 401 });
29
29
  }
30
- const token = authHeader.split(" ")[1];
31
- const isValid = await verifyToken(token);
32
- if (!isValid) {
30
+ const trimmed = authHeader.trim();
31
+ const parts = trimmed.split(/\s+/);
32
+ if (parts.length !== 2 || parts[0].toLowerCase() !== "bearer" || !parts[1]) {
33
33
  return new Response(JSON.stringify({ error: "Unauthorized", status: 401 }), { status: 401 });
34
34
  }
35
- return null;
35
+ const token = parts[1];
36
+ try {
37
+ const isValid = await verifyToken(token);
38
+ if (!isValid) {
39
+ return new Response(JSON.stringify({ error: "Unauthorized", status: 401 }), { status: 401 });
40
+ }
41
+ return null;
42
+ } catch {
43
+ return new Response(JSON.stringify({ error: "Service Unavailable", status: 503 }), { status: 503 });
44
+ }
36
45
  };
37
46
  }
38
47
  function withCors(allowedOrigin = "*") {
39
48
  return async (req) => {
40
49
  if (req.method === "OPTIONS") {
41
50
  return new Response(null, {
51
+ status: 204,
42
52
  headers: {
43
53
  "Access-Control-Allow-Origin": allowedOrigin,
44
54
  "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
@@ -9,7 +9,7 @@ import {
9
9
  createSSEResponse,
10
10
  withAuth,
11
11
  withCors
12
- } from "./chunk-WC6EPW3A.js";
12
+ } from "./chunk-POLVHTHJ.js";
13
13
  import {
14
14
  LuthAuthClient,
15
15
  LuthAuthClient2,
@@ -74,7 +74,7 @@ import {
74
74
  createSSEResponse,
75
75
  withAuth,
76
76
  withCors
77
- } from "./chunk-WC6EPW3A.js";
77
+ } from "./chunk-POLVHTHJ.js";
78
78
  import {
79
79
  LuthAuthClient,
80
80
  LuthAuthClient2,
@@ -13,7 +13,7 @@ import {
13
13
  resolveClientEnvironment,
14
14
  resolveClientOrigin,
15
15
  verifyLuthRequest
16
- } from "./chunk-5JMYSB7L.js";
16
+ } from "./chunk-ATLIA7AJ.js";
17
17
  export {
18
18
  CANONICAL_PUBLIC_ROUTES,
19
19
  LuthAuthClient2 as CanonicalAuthClient,
@@ -103,7 +103,17 @@ async function verifyLuthRequest(request, options) {
103
103
  // src/auth.ts
104
104
  function createUniversalAuthFetch(authClient) {
105
105
  return async function universalAuthFetch(input, init = {}) {
106
- const headers = new Headers(init.headers);
106
+ const headers = new Headers();
107
+ if (typeof input === "object" && input !== null && "headers" in input && input.headers) {
108
+ new Headers(input.headers).forEach((value, key) => {
109
+ headers.set(key, value);
110
+ });
111
+ }
112
+ if (init.headers) {
113
+ new Headers(init.headers).forEach((value, key) => {
114
+ headers.set(key, value);
115
+ });
116
+ }
107
117
  new Headers(authClient.getAuthHeaders()).forEach((value, key) => {
108
118
  if (!headers.has(key)) headers.set(key, value);
109
119
  });
@@ -13,7 +13,7 @@ import {
13
13
  resolveClientEnvironment,
14
14
  resolveClientOrigin,
15
15
  verifyLuthRequest
16
- } from "./chunk-5JMYSB7L.js";
16
+ } from "./chunk-ATLIA7AJ.js";
17
17
 
18
18
  // src/browserExecutionClient.ts
19
19
  var BrowserExecutionClient = class {
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @file async.ts
3
+ * @description sleep, withTimeout, retry, pLimit, debounce, throttle, once, and memoize primitives.
4
+ */
5
+ /**
6
+ * Classic sleep/delay.
7
+ */
8
+ export declare function sleep(ms: number): Promise<void>;
9
+ /**
10
+ * Rejects if the task does not finish within ms.
11
+ */
12
+ export declare function withTimeout<T>(promise: Promise<T>, ms: number, label?: string): Promise<T>;
13
+ /**
14
+ * Retries an async execution up to maxAttempts times.
15
+ */
16
+ export declare function retry<T>(fn: () => Promise<T>, maxAttempts: number, delayMs?: number): Promise<T>;
17
+ /**
18
+ * Limits concurrent async task execution.
19
+ */
20
+ export declare function pLimit<T>(tasks: (() => Promise<T>)[], concurrency: number): Promise<T[]>;
21
+ /**
22
+ * Debounces a function.
23
+ */
24
+ export declare function debounce<T extends (...args: any[]) => any>(fn: T, ms: number): (...args: Parameters<T>) => void;
25
+ /**
26
+ * Throttles a function.
27
+ */
28
+ export declare function throttle<T extends (...args: any[]) => any>(fn: T, ms: number): (...args: Parameters<T>) => void;
29
+ /**
30
+ * Wraps a function to run only once and cache its outcome.
31
+ */
32
+ export declare function once<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
33
+ /**
34
+ * Computational memoization cache helper.
35
+ */
36
+ export declare function memoize<T extends (...args: any[]) => any>(fn: T, keyFn?: (...args: Parameters<T>) => string): (...args: Parameters<T>) => ReturnType<T>;
@@ -1 +1,31 @@
1
- export { S as SkipoBase } from './base-DDYO-DzM.js';
1
+ import type { Disposable, Logger, SkipoConfig } from './types.js';
2
+ /**
3
+ * SkipoBase — Abstract foundation class for all Skipo components.
4
+ * Provides lifecycle management, logging, and unique identification.
5
+ * All @skipo/* classes should extend this.
6
+ */
7
+ export declare abstract class SkipoBase implements Disposable {
8
+ /** Unique instance identifier */
9
+ readonly instanceId: string;
10
+ /** Human-readable component name */
11
+ readonly name: string;
12
+ /** Logger instance */
13
+ protected readonly logger: Logger;
14
+ /** Whether this component has been initialized */
15
+ protected initialized: boolean;
16
+ /** Whether this component has been disposed */
17
+ protected disposed: boolean;
18
+ constructor(config?: SkipoConfig);
19
+ /** Initialize the component. Call before use. */
20
+ initialize(): Promise<void>;
21
+ /** Override to add custom initialization logic */
22
+ protected onInitialize(): Promise<void>;
23
+ /** Dispose the component and release resources */
24
+ dispose(): Promise<void>;
25
+ /** Override to add custom cleanup logic */
26
+ protected onDispose(): Promise<void>;
27
+ /** Guard: throws if not initialized */
28
+ protected ensureInitialized(): void;
29
+ /** Guard: throws if already disposed */
30
+ protected ensureNotDisposed(): void;
31
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @file cache.ts
3
+ * @description Portable LRU cache, TTL cache, and Stale-While-Revalidate utilities.
4
+ */
5
+ export declare class LRUCache<K, V> {
6
+ private maxSize;
7
+ private cache;
8
+ constructor(maxSize: number);
9
+ get(key: K): V | undefined;
10
+ set(key: K, value: V): void;
11
+ delete(key: K): boolean;
12
+ clear(): void;
13
+ size(): number;
14
+ }
15
+ export declare class TTLCache<K, V> {
16
+ private ttlMs;
17
+ private cache;
18
+ constructor(ttlMs: number);
19
+ get(key: K): V | null;
20
+ set(key: K, value: V): void;
21
+ delete(key: K): boolean;
22
+ clear(): void;
23
+ }
24
+ /**
25
+ * Stale-While-Revalidate utility.
26
+ */
27
+ export declare function swr<K, V>(cache: TTLCache<K, V>, key: K, fetchFn: () => Promise<V>): Promise<V>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @file env-node.ts
3
+ * @description Node-only .env file loading.
4
+ */
5
+ /**
6
+ * Loads a .env file and injects variables into process.env.
7
+ */
8
+ export declare function loadEnv(filePath?: string): void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @file env.ts
3
+ * @description Runtime-neutral environment value parsing and validation.
4
+ */
5
+ import type { ZodTypeAny } from 'zod';
6
+ export type EnvironmentValues = Record<string, string | undefined>;
7
+ /**
8
+ * Reads an environment value with type coercion and defaults.
9
+ * Worker and browser callers should pass their environment bindings explicitly.
10
+ */
11
+ export declare function getEnv<T>(key: string, defaultValue?: T, env?: EnvironmentValues): T;
12
+ /** Asserts an environment value is set and returns its string value. */
13
+ export declare function requireEnv(key: string, env?: EnvironmentValues): string;
14
+ /** Validates an environment object using a Zod schema. */
15
+ export declare function validateEnvSchema<T extends ZodTypeAny>(zodSchema: T, env?: EnvironmentValues): T['_output'];
16
+ /** Checks if a connection string is a placeholder or template value. */
17
+ export declare function isPlaceholderConnection(url?: string): boolean;
18
+ /** Sanitizes a database URL, returning undefined if it is empty or a placeholder. */
19
+ export declare function sanitizeDatabaseUrl(url?: string): string | undefined;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file events.ts
3
+ * @description Skipo Universal Real-Time Event Bus. Facilitates real-time event broadcasting and streaming.
4
+ */
5
+ export interface RealtimeWorkspaceEvent {
6
+ id: string;
7
+ timestamp: number;
8
+ userId?: string;
9
+ workspaceId?: string;
10
+ source: 'api' | 'ui';
11
+ method?: string;
12
+ endpoint?: string;
13
+ action: 'DOCUMENT_CREATED' | 'DOCUMENT_UPDATED' | 'DOCUMENT_DELETED' | 'CATEGORY_CREATED' | 'CATEGORY_UPDATED' | 'CATEGORY_DELETED' | 'GRAPH_UPDATED' | 'BIOME_CHANGED' | 'WORKSPACE_UPDATED' | 'WORKSPACE_SWITCHED' | 'GENERIC_ACTION' | string;
14
+ details?: string;
15
+ payload?: any;
16
+ }
17
+ export type EventListener = (event: RealtimeWorkspaceEvent) => void;
18
+ /**
19
+ * Publish a new event to all active real-time subscribers and store in buffer.
20
+ */
21
+ export declare function publishRealtimeEvent(eventInput: Omit<RealtimeWorkspaceEvent, 'id' | 'timestamp'> & {
22
+ id?: string;
23
+ timestamp?: number;
24
+ }): RealtimeWorkspaceEvent;
25
+ /**
26
+ * Subscribe to real-time events. Returns an unsubscribe function.
27
+ */
28
+ export declare function subscribeRealtimeEvents(listener: EventListener): () => void;
29
+ /**
30
+ * Retrieve recent events since a specified timestamp, optionally filtered by workspaceId or userId.
31
+ */
32
+ export declare function getRecentEvents(sinceTimestamp?: number, workspaceId?: string, userId?: string): RealtimeWorkspaceEvent[];
@@ -0,0 +1,9 @@
1
+ export declare class FileCache<T> {
2
+ private cacheDir;
3
+ constructor(cacheDir: string);
4
+ private getFilePath;
5
+ get(key: string): T | null;
6
+ set(key: string, value: T): void;
7
+ delete(key: string): void;
8
+ clear(): void;
9
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @file fs-lock.ts
3
+ * @description File locking primitive for atomic file operations.
4
+ */
5
+ export type ReleaseFn = () => void;
6
+ export declare class FileLock {
7
+ private static locks;
8
+ static acquire(filePath: string): Promise<ReleaseFn>;
9
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @file fs.ts
3
+ * @description Robust cross-platform filesystem abstraction layer.
4
+ */
5
+ import fs from "fs";
6
+ export declare function readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
7
+ export declare function writeFile(filePath: string, content: string | Buffer): Promise<void>;
8
+ /**
9
+ * Atomic file writing via temp files.
10
+ */
11
+ export declare function writeFileAtomic(filePath: string, content: string | Buffer): Promise<void>;
12
+ export declare function appendFile(filePath: string, content: string | Buffer): Promise<void>;
13
+ export declare function deleteFile(filePath: string): Promise<void>;
14
+ export declare function fileExists(filePath: string): Promise<boolean>;
15
+ export declare function getFileStat(filePath: string): Promise<{
16
+ size: number;
17
+ createdAt: Date;
18
+ modifiedAt: Date;
19
+ isDir: boolean;
20
+ }>;
21
+ export declare function readJSON<T>(filePath: string): Promise<T | null>;
22
+ export declare function writeJSON(filePath: string, data: unknown, indent?: number): Promise<void>;
23
+ export declare function updateJSON<T>(filePath: string, patch: Partial<T>): Promise<T>;
24
+ export declare function ensureDir(dirPath: string): Promise<void>;
25
+ export declare function deleteDir(dirPath: string, recursive?: boolean): Promise<void>;
26
+ export declare function listDir(dirPath: string): Promise<string[]>;
27
+ export declare function walkDir(dirPath: string, filter?: (file: string) => boolean): AsyncIterable<string>;
28
+ export declare function dirExists(dirPath: string): Promise<boolean>;
29
+ export declare function copyDir(src: string, dest: string): Promise<void>;
30
+ export declare function firstExisting(candidates: string[]): Promise<string | null>;
31
+ export declare function watchFile(filePath: string, handler: (event: string) => void, debounceMs?: number): fs.FSWatcher;
32
+ export declare function watchDir(dirPath: string, handler: (event: string, filename: string | null) => void, debounceMs?: number): fs.FSWatcher;
33
+ export declare function createTempFile(prefix?: string): string;
34
+ export declare function createTempDir(prefix?: string): string;
35
+ export declare function withTempDir<T>(fn: (tempDir: string) => Promise<T>, prefix?: string): Promise<T>;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @file http.ts
3
+ * @description Safe, type-safe HTTP client wrapper.
4
+ */
5
+ export interface SkipoHTTPOptions extends RequestInit {
6
+ timeout?: number;
7
+ retries?: number;
8
+ }
9
+ export interface SkipoHTTPResult<T> {
10
+ status: "success" | "error";
11
+ data?: T;
12
+ message?: string;
13
+ code?: number;
14
+ }
15
+ /**
16
+ * Helper to perform fetch with timeout and retries.
17
+ */
18
+ export declare function requestRaw(url: string, opts?: SkipoHTTPOptions): Promise<Response>;
19
+ export declare function request<T>(url: string, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
20
+ export declare function get<T>(url: string, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
21
+ export declare function post<T>(url: string, body: any, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
22
+ export declare function put<T>(url: string, body: any, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
23
+ export declare function del<T>(url: string, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
24
+ /**
25
+ * Creates a client instance.
26
+ */
27
+ export declare function createClient(baseUrl: string, defaultHeaders?: Record<string, string>): {
28
+ get: <T>(path: string, opts?: SkipoHTTPOptions) => Promise<SkipoHTTPResult<T>>;
29
+ post: <T>(path: string, body: any, opts?: SkipoHTTPOptions) => Promise<SkipoHTTPResult<T>>;
30
+ put: <T>(path: string, body: any, opts?: SkipoHTTPOptions) => Promise<SkipoHTTPResult<T>>;
31
+ del: <T>(path: string, opts?: SkipoHTTPOptions) => Promise<SkipoHTTPResult<T>>;
32
+ };
33
+ /**
34
+ * Streaming SSE / Chunk response.
35
+ */
36
+ export declare function streamResponse(url: string, opts?: SkipoHTTPOptions): AsyncIterable<string>;
@@ -1,32 +1,30 @@
1
- import * as _ultrst_armada_krnl from '@ultrst-armada/krnl';
2
- import { ServiceDefinition } from '@ultrst-armada/krnl';
3
- export { D as Disposable, L as Logger, P as Provider, R as Result, S as SkipoBase, a as SkipoConfig } from './base-DDYO-DzM.js';
4
- export { EnvironmentValues, EventListener, LRUCache, RealtimeWorkspaceEvent, SkipoHTTPOptions, SkipoHTTPResult, TTLCache, createClient, debounce, deepClone, deepEqual, deepMerge, del, get, getEnv, getPath, getRecentEvents, interpolate, isPlaceholderConnection, memoize, objectDiff, once, pLimit, post, prefixedId, publishRealtimeEvent, put, request, requestRaw, requireEnv, retry, sanitizeDatabaseUrl, setPath, shortId, sleep, streamResponse, subscribeRealtimeEvents, swr, throttle, toCamelCase, toKebabCase, toPascalCase, toScreamingSnake, toSlug, toSnakeCase, uuid, validateEnvSchema, withTimeout } from './portable.js';
5
- import 'zod';
6
-
7
- declare const FunctionsServiceDefinition: ServiceDefinition;
8
- declare const FunctionsServiceFacade: {
1
+ /**
2
+ * @file index.ts
3
+ * @description KrnlTS FunctionsServiceFacade plus the portable function library.
4
+ */
5
+ import { type ServiceDefinition } from '@ultrst-armada/krnl';
6
+ export * from './portable.js';
7
+ export declare const FunctionsServiceDefinition: ServiceDefinition;
8
+ export declare const FunctionsServiceFacade: {
9
9
  id: string;
10
10
  name: string;
11
11
  version: string;
12
12
  runtime: "server";
13
13
  deployment: "local";
14
14
  definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
15
- readonly telemetry: _ultrst_armada_krnl.TelemetryController;
16
- createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
15
+ readonly telemetry: import("@ultrst-armada/krnl").TelemetryController;
16
+ createInstance: () => import("@ultrst-armada/krnl").ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
17
17
  execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
18
18
  };
19
- declare const krnlFunctionsServiceDefinition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
20
- declare const krnlFunctionsServiceFacade: {
19
+ export declare const krnlFunctionsServiceDefinition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
20
+ export declare const krnlFunctionsServiceFacade: {
21
21
  id: string;
22
22
  name: string;
23
23
  version: string;
24
24
  runtime: "server";
25
25
  deployment: "local";
26
26
  definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
27
- readonly telemetry: _ultrst_armada_krnl.TelemetryController;
28
- createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
27
+ readonly telemetry: import("@ultrst-armada/krnl").TelemetryController;
28
+ createInstance: () => import("@ultrst-armada/krnl").ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
29
29
  execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
30
30
  };
31
-
32
- export { FunctionsServiceDefinition, FunctionsServiceFacade, krnlFunctionsServiceDefinition, krnlFunctionsServiceFacade };
@@ -1,110 +1,7 @@
1
- export { D as Disposable, L as Logger, P as Provider, R as Result, S as SkipoBase, a as SkipoConfig } from './base-DDYO-DzM.js';
2
- export { EnvironmentValues, EventListener, LRUCache, RealtimeWorkspaceEvent, SkipoHTTPOptions, SkipoHTTPResult, TTLCache, createClient, debounce, deepClone, deepEqual, deepMerge, del, get, getEnv, getPath, getRecentEvents, interpolate, isPlaceholderConnection, memoize, objectDiff, once, pLimit, post, prefixedId, publishRealtimeEvent, put, request, requestRaw, requireEnv, retry, sanitizeDatabaseUrl, setPath, shortId, sleep, streamResponse, subscribeRealtimeEvents, swr, throttle, toCamelCase, toKebabCase, toPascalCase, toScreamingSnake, toSlug, toSnakeCase, uuid, validateEnvSchema, withTimeout } from './portable.js';
3
- import fs from 'fs';
4
- import { ExecOptions, SpawnOptions } from 'child_process';
5
- import 'zod';
6
-
7
- /**
8
- * @file fs-lock.ts
9
- * @description File locking primitive for atomic file operations.
10
- */
11
- type ReleaseFn = () => void;
12
- declare class FileLock {
13
- private static locks;
14
- static acquire(filePath: string): Promise<ReleaseFn>;
15
- }
16
-
17
- /**
18
- * @file fs.ts
19
- * @description Robust cross-platform filesystem abstraction layer.
20
- */
21
-
22
- declare function readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
23
- declare function writeFile(filePath: string, content: string | Buffer): Promise<void>;
24
- /**
25
- * Atomic file writing via temp files.
26
- */
27
- declare function writeFileAtomic(filePath: string, content: string | Buffer): Promise<void>;
28
- declare function appendFile(filePath: string, content: string | Buffer): Promise<void>;
29
- declare function deleteFile(filePath: string): Promise<void>;
30
- declare function fileExists(filePath: string): Promise<boolean>;
31
- declare function getFileStat(filePath: string): Promise<{
32
- size: number;
33
- createdAt: Date;
34
- modifiedAt: Date;
35
- isDir: boolean;
36
- }>;
37
- declare function readJSON<T>(filePath: string): Promise<T | null>;
38
- declare function writeJSON(filePath: string, data: unknown, indent?: number): Promise<void>;
39
- declare function updateJSON<T>(filePath: string, patch: Partial<T>): Promise<T>;
40
- declare function ensureDir(dirPath: string): Promise<void>;
41
- declare function deleteDir(dirPath: string, recursive?: boolean): Promise<void>;
42
- declare function listDir(dirPath: string): Promise<string[]>;
43
- declare function walkDir(dirPath: string, filter?: (file: string) => boolean): AsyncIterable<string>;
44
- declare function dirExists(dirPath: string): Promise<boolean>;
45
- declare function copyDir(src: string, dest: string): Promise<void>;
46
- declare function firstExisting(candidates: string[]): Promise<string | null>;
47
- declare function watchFile(filePath: string, handler: (event: string) => void, debounceMs?: number): fs.FSWatcher;
48
- declare function watchDir(dirPath: string, handler: (event: string, filename: string | null) => void, debounceMs?: number): fs.FSWatcher;
49
- declare function createTempFile(prefix?: string): string;
50
- declare function createTempDir(prefix?: string): string;
51
- declare function withTempDir<T>(fn: (tempDir: string) => Promise<T>, prefix?: string): Promise<T>;
52
-
53
- /**
54
- * @file shell.ts
55
- * @description Safe promise-based exec and spawn wrappers with cross-platform command routing.
56
- */
57
-
58
- interface SpawnHandle {
59
- pid?: number;
60
- kill: (signal?: NodeJS.Signals | number) => boolean;
61
- promise: Promise<{
62
- code: number | null;
63
- signal: NodeJS.Signals | null;
64
- }>;
65
- }
66
- /**
67
- * Promisified command execution.
68
- */
69
- declare function execCmd(cmd: string, opts?: ExecOptions & {
70
- timeout?: number;
71
- }): Promise<{
72
- stdout: string;
73
- stderr: string;
74
- }>;
75
- /**
76
- * Streaming command execution.
77
- */
78
- declare function spawnCmd(cmd: string, args: string[], opts?: SpawnOptions): SpawnHandle;
79
- /**
80
- * Defines posix vs win32 specific commands.
81
- */
82
- declare function platform<T>(routing: {
83
- posix: T;
84
- win32: T;
85
- }): T;
86
- /**
87
- * Resolves the full path of a binary.
88
- */
89
- declare function which(cmd: string): string | null;
90
-
91
- declare class FileCache<T> {
92
- private cacheDir;
93
- constructor(cacheDir: string);
94
- private getFilePath;
95
- get(key: string): T | null;
96
- set(key: string, value: T): void;
97
- delete(key: string): void;
98
- clear(): void;
99
- }
100
-
101
- /**
102
- * @file env-node.ts
103
- * @description Node-only .env file loading.
104
- */
105
- /**
106
- * Loads a .env file and injects variables into process.env.
107
- */
108
- declare function loadEnv(filePath?: string): void;
109
-
110
- export { FileCache, FileLock, type ReleaseFn, type SpawnHandle, appendFile, copyDir, createTempDir, createTempFile, deleteDir, deleteFile, dirExists, ensureDir, execCmd, fileExists, firstExisting, getFileStat, listDir, loadEnv, platform, readFile, readJSON, spawnCmd, updateJSON, walkDir, watchDir, watchFile, which, withTempDir, writeFile, writeFileAtomic, writeJSON };
1
+ /** Node-only filesystem and process utilities for @ultrst-armada/kloks/functions. */
2
+ export * from './portable.js';
3
+ export * from './fs-lock.js';
4
+ export * from './fs.js';
5
+ export * from './shell.js';
6
+ export * from './fileCache.js';
7
+ export * from './env-node.js';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file object.ts
3
+ * @description Deep clone, deep merge, deep equal, object diffing, and dot-notation in-memory path accessor tools.
4
+ */
5
+ /**
6
+ * Structurally deep clones an object with circular dependency check.
7
+ */
8
+ export declare function deepClone<T>(obj: T, seen?: Map<any, any>): T;
9
+ /**
10
+ * Recursively deep merges override objects into a base.
11
+ */
12
+ export declare function deepMerge(base: any, ...overrides: any[]): any;
13
+ /**
14
+ * Performs a strict structural equality check.
15
+ */
16
+ export declare function deepEqual(a: any, b: any): boolean;
17
+ /**
18
+ * Performs an object diff between before and after states.
19
+ */
20
+ export declare function objectDiff(before: any, after: any): {
21
+ added: any;
22
+ removed: any;
23
+ changed: any;
24
+ };
25
+ /**
26
+ * Accesses an in-memory object by dot-notation.
27
+ */
28
+ export declare function getPath(obj: any, path: string, defaultValue?: any): any;
29
+ /**
30
+ * Mutates or sets an in-memory object by dot-notation.
31
+ */
32
+ export declare function setPath(obj: any, path: string, value: any): any;
@@ -1,207 +1,13 @@
1
- export { D as Disposable, L as Logger, P as Provider, R as Result, S as SkipoBase, a as SkipoConfig } from './base-DDYO-DzM.js';
2
- import { ZodTypeAny } from 'zod';
3
-
4
1
  /**
5
- * @file string.ts
6
- * @description String case conversions, UUID & ShortID generators, and minimal template interpolation.
7
- */
8
- declare function toCamelCase(str: string): string;
9
- declare function toPascalCase(str: string): string;
10
- declare function toSnakeCase(str: string): string;
11
- declare function toKebabCase(str: string): string;
12
- declare function toScreamingSnake(str: string): string;
13
- declare function toSlug(str: string): string;
14
- declare function uuid(): string;
15
- declare function shortId(length?: number): string;
16
- declare function prefixedId(prefix: string, length?: number): string;
17
- declare function interpolate(tmpl: string, data: Record<string, any>): string;
18
-
19
- /**
20
- * @file async.ts
21
- * @description sleep, withTimeout, retry, pLimit, debounce, throttle, once, and memoize primitives.
22
- */
23
- /**
24
- * Classic sleep/delay.
25
- */
26
- declare function sleep(ms: number): Promise<void>;
27
- /**
28
- * Rejects if the task does not finish within ms.
29
- */
30
- declare function withTimeout<T>(promise: Promise<T>, ms: number, label?: string): Promise<T>;
31
- /**
32
- * Retries an async execution up to maxAttempts times.
33
- */
34
- declare function retry<T>(fn: () => Promise<T>, maxAttempts: number, delayMs?: number): Promise<T>;
35
- /**
36
- * Limits concurrent async task execution.
37
- */
38
- declare function pLimit<T>(tasks: (() => Promise<T>)[], concurrency: number): Promise<T[]>;
39
- /**
40
- * Debounces a function.
41
- */
42
- declare function debounce<T extends (...args: any[]) => any>(fn: T, ms: number): (...args: Parameters<T>) => void;
43
- /**
44
- * Throttles a function.
45
- */
46
- declare function throttle<T extends (...args: any[]) => any>(fn: T, ms: number): (...args: Parameters<T>) => void;
47
- /**
48
- * Wraps a function to run only once and cache its outcome.
49
- */
50
- declare function once<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
51
- /**
52
- * Computational memoization cache helper.
53
- */
54
- declare function memoize<T extends (...args: any[]) => any>(fn: T, keyFn?: (...args: Parameters<T>) => string): (...args: Parameters<T>) => ReturnType<T>;
55
-
56
- /**
57
- * @file object.ts
58
- * @description Deep clone, deep merge, deep equal, object diffing, and dot-notation in-memory path accessor tools.
59
- */
60
- /**
61
- * Structurally deep clones an object with circular dependency check.
62
- */
63
- declare function deepClone<T>(obj: T, seen?: Map<any, any>): T;
64
- /**
65
- * Recursively deep merges override objects into a base.
66
- */
67
- declare function deepMerge(base: any, ...overrides: any[]): any;
68
- /**
69
- * Performs a strict structural equality check.
70
- */
71
- declare function deepEqual(a: any, b: any): boolean;
72
- /**
73
- * Performs an object diff between before and after states.
74
- */
75
- declare function objectDiff(before: any, after: any): {
76
- added: any;
77
- removed: any;
78
- changed: any;
79
- };
80
- /**
81
- * Accesses an in-memory object by dot-notation.
82
- */
83
- declare function getPath(obj: any, path: string, defaultValue?: any): any;
84
- /**
85
- * Mutates or sets an in-memory object by dot-notation.
86
- */
87
- declare function setPath(obj: any, path: string, value: any): any;
88
-
89
- /**
90
- * @file cache.ts
91
- * @description Portable LRU cache, TTL cache, and Stale-While-Revalidate utilities.
92
- */
93
- declare class LRUCache<K, V> {
94
- private maxSize;
95
- private cache;
96
- constructor(maxSize: number);
97
- get(key: K): V | undefined;
98
- set(key: K, value: V): void;
99
- delete(key: K): boolean;
100
- clear(): void;
101
- size(): number;
102
- }
103
- declare class TTLCache<K, V> {
104
- private ttlMs;
105
- private cache;
106
- constructor(ttlMs: number);
107
- get(key: K): V | null;
108
- set(key: K, value: V): void;
109
- delete(key: K): boolean;
110
- clear(): void;
111
- }
112
- /**
113
- * Stale-While-Revalidate utility.
114
- */
115
- declare function swr<K, V>(cache: TTLCache<K, V>, key: K, fetchFn: () => Promise<V>): Promise<V>;
116
-
117
- /**
118
- * @file env.ts
119
- * @description Runtime-neutral environment value parsing and validation.
120
- */
121
-
122
- type EnvironmentValues = Record<string, string | undefined>;
123
- /**
124
- * Reads an environment value with type coercion and defaults.
125
- * Worker and browser callers should pass their environment bindings explicitly.
126
- */
127
- declare function getEnv<T>(key: string, defaultValue?: T, env?: EnvironmentValues): T;
128
- /** Asserts an environment value is set and returns its string value. */
129
- declare function requireEnv(key: string, env?: EnvironmentValues): string;
130
- /** Validates an environment object using a Zod schema. */
131
- declare function validateEnvSchema<T extends ZodTypeAny>(zodSchema: T, env?: EnvironmentValues): T['_output'];
132
- /** Checks if a connection string is a placeholder or template value. */
133
- declare function isPlaceholderConnection(url?: string): boolean;
134
- /** Sanitizes a database URL, returning undefined if it is empty or a placeholder. */
135
- declare function sanitizeDatabaseUrl(url?: string): string | undefined;
136
-
137
- /**
138
- * @file http.ts
139
- * @description Safe, type-safe HTTP client wrapper.
140
- */
141
- interface SkipoHTTPOptions extends RequestInit {
142
- timeout?: number;
143
- retries?: number;
144
- }
145
- interface SkipoHTTPResult<T> {
146
- status: "success" | "error";
147
- data?: T;
148
- message?: string;
149
- code?: number;
150
- }
151
- /**
152
- * Helper to perform fetch with timeout and retries.
153
- */
154
- declare function requestRaw(url: string, opts?: SkipoHTTPOptions): Promise<Response>;
155
- declare function request<T>(url: string, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
156
- declare function get<T>(url: string, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
157
- declare function post<T>(url: string, body: any, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
158
- declare function put<T>(url: string, body: any, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
159
- declare function del<T>(url: string, opts?: SkipoHTTPOptions): Promise<SkipoHTTPResult<T>>;
160
- /**
161
- * Creates a client instance.
162
- */
163
- declare function createClient(baseUrl: string, defaultHeaders?: Record<string, string>): {
164
- get: <T>(path: string, opts?: SkipoHTTPOptions) => Promise<SkipoHTTPResult<T>>;
165
- post: <T>(path: string, body: any, opts?: SkipoHTTPOptions) => Promise<SkipoHTTPResult<T>>;
166
- put: <T>(path: string, body: any, opts?: SkipoHTTPOptions) => Promise<SkipoHTTPResult<T>>;
167
- del: <T>(path: string, opts?: SkipoHTTPOptions) => Promise<SkipoHTTPResult<T>>;
168
- };
169
- /**
170
- * Streaming SSE / Chunk response.
171
- */
172
- declare function streamResponse(url: string, opts?: SkipoHTTPOptions): AsyncIterable<string>;
173
-
174
- /**
175
- * @file events.ts
176
- * @description Skipo Universal Real-Time Event Bus. Facilitates real-time event broadcasting and streaming.
177
- */
178
- interface RealtimeWorkspaceEvent {
179
- id: string;
180
- timestamp: number;
181
- userId?: string;
182
- workspaceId?: string;
183
- source: 'api' | 'ui';
184
- method?: string;
185
- endpoint?: string;
186
- action: 'DOCUMENT_CREATED' | 'DOCUMENT_UPDATED' | 'DOCUMENT_DELETED' | 'CATEGORY_CREATED' | 'CATEGORY_UPDATED' | 'CATEGORY_DELETED' | 'GRAPH_UPDATED' | 'BIOME_CHANGED' | 'WORKSPACE_UPDATED' | 'WORKSPACE_SWITCHED' | 'GENERIC_ACTION' | string;
187
- details?: string;
188
- payload?: any;
189
- }
190
- type EventListener = (event: RealtimeWorkspaceEvent) => void;
191
- /**
192
- * Publish a new event to all active real-time subscribers and store in buffer.
193
- */
194
- declare function publishRealtimeEvent(eventInput: Omit<RealtimeWorkspaceEvent, 'id' | 'timestamp'> & {
195
- id?: string;
196
- timestamp?: number;
197
- }): RealtimeWorkspaceEvent;
198
- /**
199
- * Subscribe to real-time events. Returns an unsubscribe function.
200
- */
201
- declare function subscribeRealtimeEvents(listener: EventListener): () => void;
202
- /**
203
- * Retrieve recent events since a specified timestamp, optionally filtered by workspaceId or userId.
204
- */
205
- declare function getRecentEvents(sinceTimestamp?: number, workspaceId?: string, userId?: string): RealtimeWorkspaceEvent[];
206
-
207
- export { type EnvironmentValues, type EventListener, LRUCache, type RealtimeWorkspaceEvent, type SkipoHTTPOptions, type SkipoHTTPResult, TTLCache, createClient, debounce, deepClone, deepEqual, deepMerge, del, get, getEnv, getPath, getRecentEvents, interpolate, isPlaceholderConnection, memoize, objectDiff, once, pLimit, post, prefixedId, publishRealtimeEvent, put, request, requestRaw, requireEnv, retry, sanitizeDatabaseUrl, setPath, shortId, sleep, streamResponse, subscribeRealtimeEvents, swr, throttle, toCamelCase, toKebabCase, toPascalCase, toScreamingSnake, toSlug, toSnakeCase, uuid, validateEnvSchema, withTimeout };
2
+ * @file portable.ts
3
+ * @description Runtime-neutral functions with no Node built-ins or KrnlTS dependency.
4
+ */
5
+ export * from './types.js';
6
+ export * from './base.js';
7
+ export * from './string.js';
8
+ export * from './async.js';
9
+ export * from './object.js';
10
+ export * from './cache.js';
11
+ export * from './env.js';
12
+ export * from './http.js';
13
+ export * from './events.js';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @file shell.ts
3
+ * @description Safe promise-based exec and spawn wrappers with cross-platform command routing.
4
+ */
5
+ import type { ExecOptions, SpawnOptions } from "child_process";
6
+ export interface SpawnHandle {
7
+ pid?: number;
8
+ kill: (signal?: NodeJS.Signals | number) => boolean;
9
+ promise: Promise<{
10
+ code: number | null;
11
+ signal: NodeJS.Signals | null;
12
+ }>;
13
+ }
14
+ /**
15
+ * Promisified command execution.
16
+ */
17
+ export declare function execCmd(cmd: string, opts?: ExecOptions & {
18
+ timeout?: number;
19
+ }): Promise<{
20
+ stdout: string;
21
+ stderr: string;
22
+ }>;
23
+ /**
24
+ * Streaming command execution.
25
+ */
26
+ export declare function spawnCmd(cmd: string, args: string[], opts?: SpawnOptions): SpawnHandle;
27
+ /**
28
+ * Defines posix vs win32 specific commands.
29
+ */
30
+ export declare function platform<T>(routing: {
31
+ posix: T;
32
+ win32: T;
33
+ }): T;
34
+ /**
35
+ * Resolves the full path of a binary.
36
+ */
37
+ export declare function which(cmd: string): string | null;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @file string.ts
3
+ * @description String case conversions, UUID & ShortID generators, and minimal template interpolation.
4
+ */
5
+ export declare function toCamelCase(str: string): string;
6
+ export declare function toPascalCase(str: string): string;
7
+ export declare function toSnakeCase(str: string): string;
8
+ export declare function toKebabCase(str: string): string;
9
+ export declare function toScreamingSnake(str: string): string;
10
+ export declare function toSlug(str: string): string;
11
+ export declare function uuid(): string;
12
+ export declare function shortId(length?: number): string;
13
+ export declare function prefixedId(prefix: string, length?: number): string;
14
+ export declare function interpolate(tmpl: string, data: Record<string, any>): string;
@@ -0,0 +1,31 @@
1
+ /** Standard result type for operations that can fail */
2
+ export type Result<T, E = Error> = {
3
+ ok: true;
4
+ value: T;
5
+ } | {
6
+ ok: false;
7
+ error: E;
8
+ };
9
+ /** Standard logger interface */
10
+ export interface Logger {
11
+ log(message: string, ...args: unknown[]): void;
12
+ warn(message: string, ...args: unknown[]): void;
13
+ error(message: string, ...args: unknown[]): void;
14
+ debug?(message: string, ...args: unknown[]): void;
15
+ }
16
+ /** Disposable resource interface */
17
+ export interface Disposable {
18
+ dispose(): Promise<void>;
19
+ }
20
+ /** Generic provider interface */
21
+ export interface Provider<_T = unknown> {
22
+ initialize(): Promise<void>;
23
+ dispose(): Promise<void>;
24
+ isInitialized(): boolean;
25
+ }
26
+ /** Configuration for any Skipo component */
27
+ export interface SkipoConfig {
28
+ name: string;
29
+ logger?: Logger;
30
+ [key: string]: unknown;
31
+ }
@@ -34,7 +34,7 @@
34
34
  }
35
35
  },
36
36
  "scripts": {
37
- "build": "tsup src/index.ts src/base.ts src/portable.ts src/node.ts --format esm --dts --clean --external zod --external ws --external @ultrst-armada/krnl",
37
+ "build": "tsup src/index.ts src/base.ts src/portable.ts src/node.ts --format esm --clean --external zod --external ws --external @ultrst-armada/krnl && tsc --emitDeclarationOnly --declaration --project tsconfig.json",
38
38
  "typecheck": "tsc --noEmit",
39
39
  "clean": "rm -rf dist"
40
40
  },
@@ -252,7 +252,7 @@ import {
252
252
  validateProjectGraph,
253
253
  validateUniversalConnection,
254
254
  zoomAtPoint
255
- } from "./chunk-UKTICGGV.js";
255
+ } from "./chunk-YUJC367F.js";
256
256
  import {
257
257
  BaseHandle,
258
258
  DataHandle,
@@ -262,6 +262,21 @@ import {
262
262
  instantiateSubgraph
263
263
  } from "./chunk-OXUDG6HE.js";
264
264
  import "./chunk-RHRXPY2U.js";
265
+ import {
266
+ AttractionEngine,
267
+ GhostInferenceEngine,
268
+ GhostLayoutResolver,
269
+ GhostTracePathBuilder,
270
+ calculateSocketCoordinates,
271
+ getBeamPoints,
272
+ useMagneticTraces
273
+ } from "./chunk-JXDJZSFW.js";
274
+ import {
275
+ ConnectionRuleStore,
276
+ HandleTypeRegistry,
277
+ WireTypeRegistry,
278
+ initializeDefaultGraphRules
279
+ } from "./chunk-TZOL3RN7.js";
265
280
  import {
266
281
  LifecycleCycleError,
267
282
  LifecycleGraph,
@@ -285,21 +300,6 @@ import {
285
300
  CustomViewWindow,
286
301
  DEFAULT_GRAPH_SETTINGS
287
302
  } from "./chunk-5KP74NMF.js";
288
- import {
289
- AttractionEngine,
290
- GhostInferenceEngine,
291
- GhostLayoutResolver,
292
- GhostTracePathBuilder,
293
- calculateSocketCoordinates,
294
- getBeamPoints,
295
- useMagneticTraces
296
- } from "./chunk-JXDJZSFW.js";
297
- import {
298
- ConnectionRuleStore,
299
- HandleTypeRegistry,
300
- WireTypeRegistry,
301
- initializeDefaultGraphRules
302
- } from "./chunk-TZOL3RN7.js";
303
303
  import {
304
304
  AutoSolidify,
305
305
  SpatialEngine,
@@ -252,7 +252,7 @@ import {
252
252
  validateProjectGraph,
253
253
  validateUniversalConnection,
254
254
  zoomAtPoint
255
- } from "./chunk-UKTICGGV.js";
255
+ } from "./chunk-YUJC367F.js";
256
256
  import {
257
257
  BaseHandle,
258
258
  DataHandle,
@@ -262,6 +262,21 @@ import {
262
262
  instantiateSubgraph
263
263
  } from "./chunk-OXUDG6HE.js";
264
264
  import "./chunk-RHRXPY2U.js";
265
+ import {
266
+ AttractionEngine,
267
+ GhostInferenceEngine,
268
+ GhostLayoutResolver,
269
+ GhostTracePathBuilder,
270
+ calculateSocketCoordinates,
271
+ getBeamPoints,
272
+ useMagneticTraces
273
+ } from "./chunk-JXDJZSFW.js";
274
+ import {
275
+ ConnectionRuleStore,
276
+ HandleTypeRegistry,
277
+ WireTypeRegistry,
278
+ initializeDefaultGraphRules
279
+ } from "./chunk-TZOL3RN7.js";
265
280
  import {
266
281
  LifecycleCycleError,
267
282
  LifecycleGraph,
@@ -285,21 +300,6 @@ import {
285
300
  CustomViewWindow,
286
301
  DEFAULT_GRAPH_SETTINGS
287
302
  } from "./chunk-5KP74NMF.js";
288
- import {
289
- AttractionEngine,
290
- GhostInferenceEngine,
291
- GhostLayoutResolver,
292
- GhostTracePathBuilder,
293
- calculateSocketCoordinates,
294
- getBeamPoints,
295
- useMagneticTraces
296
- } from "./chunk-JXDJZSFW.js";
297
- import {
298
- ConnectionRuleStore,
299
- HandleTypeRegistry,
300
- WireTypeRegistry,
301
- initializeDefaultGraphRules
302
- } from "./chunk-TZOL3RN7.js";
303
303
  import {
304
304
  AutoSolidify,
305
305
  SpatialEngine,
@@ -1,64 +0,0 @@
1
- /** Standard result type for operations that can fail */
2
- type Result<T, E = Error> = {
3
- ok: true;
4
- value: T;
5
- } | {
6
- ok: false;
7
- error: E;
8
- };
9
- /** Standard logger interface */
10
- interface Logger {
11
- log(message: string, ...args: unknown[]): void;
12
- warn(message: string, ...args: unknown[]): void;
13
- error(message: string, ...args: unknown[]): void;
14
- debug?(message: string, ...args: unknown[]): void;
15
- }
16
- /** Disposable resource interface */
17
- interface Disposable {
18
- dispose(): Promise<void>;
19
- }
20
- /** Generic provider interface */
21
- interface Provider<_T = unknown> {
22
- initialize(): Promise<void>;
23
- dispose(): Promise<void>;
24
- isInitialized(): boolean;
25
- }
26
- /** Configuration for any Skipo component */
27
- interface SkipoConfig {
28
- name: string;
29
- logger?: Logger;
30
- [key: string]: unknown;
31
- }
32
-
33
- /**
34
- * SkipoBase — Abstract foundation class for all Skipo components.
35
- * Provides lifecycle management, logging, and unique identification.
36
- * All @skipo/* classes should extend this.
37
- */
38
- declare abstract class SkipoBase implements Disposable {
39
- /** Unique instance identifier */
40
- readonly instanceId: string;
41
- /** Human-readable component name */
42
- readonly name: string;
43
- /** Logger instance */
44
- protected readonly logger: Logger;
45
- /** Whether this component has been initialized */
46
- protected initialized: boolean;
47
- /** Whether this component has been disposed */
48
- protected disposed: boolean;
49
- constructor(config?: SkipoConfig);
50
- /** Initialize the component. Call before use. */
51
- initialize(): Promise<void>;
52
- /** Override to add custom initialization logic */
53
- protected onInitialize(): Promise<void>;
54
- /** Dispose the component and release resources */
55
- dispose(): Promise<void>;
56
- /** Override to add custom cleanup logic */
57
- protected onDispose(): Promise<void>;
58
- /** Guard: throws if not initialized */
59
- protected ensureInitialized(): void;
60
- /** Guard: throws if already disposed */
61
- protected ensureNotDisposed(): void;
62
- }
63
-
64
- export { type Disposable as D, type Logger as L, type Provider as P, type Result as R, SkipoBase as S, type SkipoConfig as a };
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  DataHandle
3
3
  } from "./chunk-OXUDG6HE.js";
4
- import {
5
- BaseNode
6
- } from "./chunk-5KP74NMF.js";
7
4
  import {
8
5
  AttractionEngine
9
6
  } from "./chunk-JXDJZSFW.js";
@@ -11,6 +8,9 @@ import {
11
8
  HandleTypeRegistry,
12
9
  WireTypeRegistry
13
10
  } from "./chunk-TZOL3RN7.js";
11
+ import {
12
+ BaseNode
13
+ } from "./chunk-5KP74NMF.js";
14
14
  import {
15
15
  AutoSolidify,
16
16
  TraceEngine