@telorun/sdk 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ # SUSTAINABLE USE LICENSE (Fair-code)
2
+
3
+ Copyright (c) 2026 DiglyAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy, modify, and distribute the Software for any purpose—including commercial purposes—subject to the following conditions:
6
+
7
+ 1. ANTI-COMPETITION RESTRICTION: The Software may not be provided to third parties as a managed service, commercial SaaS (Software-as-a-Service), PaaS (Platform-as-a-Service), BaaS (Backend-as-a-Service), or similar offering where the primary value provided to the user is the functionality of the Software itself, without a separate commercial license from the copyright holder.
8
+
9
+ 2. PERMITTED COMMERCIAL USE: You are free to use the Software to build, host, and monetize your own commercial applications, products, and services, provided such use does not violate Clause 1.
10
+
11
+ 3. ATTRIBUTION: This copyright notice and license must be included in all copies or substantial portions of the Software.
12
+
13
+ 4. CONTRIBUTIONS: Contributions to the Software are welcome and encouraged. By contributing, you agree that your contributions may be incorporated into the Software and distributed under this license.
14
+
15
+ 5. DISCLAIMER: The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.
16
+
17
+ For commercial licensing, managed hosting exemptions, or enterprise inquiries, please contact DiglyAI.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Telo SDK (Node.js)
2
+
3
+ The Node.js SDK provides the authoring surface for Telo modules. It defines the shared contracts (types and lifecycle interfaces) that modules use to plug into the runtime, so module code stays consistent across implementations.
4
+
5
+ ## What It Provides
6
+
7
+ - **Module interfaces** for registering resources and handling execution.
8
+ - **Context types** for accessing the kernel, registry, and events.
9
+ - **Shared primitives** used by Telo modules and tooling.
10
+
11
+ ## Status
12
+
13
+ Early prototype. APIs and contracts are still evolving. The API surface - including YAML shapes - may change at any time without notice.
14
+
15
+ ## When to Use It
16
+
17
+ Use the SDK when building or extending Telo modules. It is not the runtime itself; it is the contract layer that keeps module behavior consistent and predictable.
18
+
19
+ ## Related Docs
20
+
21
+ - Runtime overview: `runtime/README.md`
22
+ - Built‑in modules: `modiles/`
23
+ - SDKs index: `sdk/README.md`
@@ -0,0 +1,11 @@
1
+ import { RuntimeEvent } from './runtime-event.js';
2
+ export interface ControllerContext {
3
+ on(event: string, handler: (event: RuntimeEvent) => void | Promise<void>): void;
4
+ once(event: string, handler: (event: RuntimeEvent) => void | Promise<void>): void;
5
+ off(event: string, handler: (event: RuntimeEvent) => void | Promise<void>): void;
6
+ emit(event: string, payload?: any, metadata?: Record<string, any>): void;
7
+ acquireHold(reason?: string): () => void;
8
+ requestExit(code: number): void;
9
+ evaluateCel(expression: string, context: Record<string, any>): unknown;
10
+ expandValue(value: any, context: Record<string, any>): any;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export * from './controller-context.js';
2
+ export * from './resource-context.js';
3
+ export * from './resource-instance.js';
4
+ export * from './resource-manifest.js';
5
+ export * from './runtime-error.js';
6
+ export * from './runtime-event.js';
7
+ export * from './runtime-resource.js';
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from './controller-context.js';
2
+ export * from './resource-context.js';
3
+ export * from './resource-instance.js';
4
+ export * from './resource-manifest.js';
5
+ export * from './runtime-error.js';
6
+ export * from './runtime-event.js';
7
+ export * from './runtime-resource.js';
@@ -0,0 +1,22 @@
1
+ import { ControllerContext } from "./controller-context.js";
2
+ import { RuntimeResource } from "./runtime-resource.js";
3
+ export interface DataValidator {
4
+ validate(data: any): void;
5
+ isValid(data: any): boolean;
6
+ }
7
+ export declare class NoopValidator implements DataValidator {
8
+ isValid(): boolean;
9
+ validate(): void;
10
+ }
11
+ export interface ResourceContext extends ControllerContext {
12
+ acquireHold(reason?: string): () => void;
13
+ emitEvent(event: string, payload?: any): Promise<void>;
14
+ invoke(kind: string, name: string, ...args: any[]): Promise<any>;
15
+ getResources(kind: string): RuntimeResource[];
16
+ getResourcesByName(kind: string, name: string): RuntimeResource | null;
17
+ registerManifest(resource: any): void;
18
+ validateSchema(value: any, schema: any): void;
19
+ createSchemaValidator(schema: any): DataValidator;
20
+ registerController(moduleName: string, resourceKind: string, controllerInstance: any): Promise<void>;
21
+ registerDefinition(definition: any): void;
22
+ }
@@ -0,0 +1,8 @@
1
+ export class NoopValidator {
2
+ isValid() {
3
+ return true;
4
+ }
5
+ validate() {
6
+ // noop
7
+ }
8
+ }
@@ -0,0 +1,13 @@
1
+ import { ResourceContext } from "./resource-context.js";
2
+ export type ResourceInstance = {
3
+ init?(ctx?: ResourceContext): Promise<void>;
4
+ run?(): void | Promise<void>;
5
+ invoke?(input: any): any | Promise<any>;
6
+ teardown?(): void | Promise<void>;
7
+ /**
8
+ * Optional method for debugging/snapshots
9
+ * Called when taking runtime state snapshots
10
+ * Should return serializable state data specific to this resource
11
+ */
12
+ snapshot?(): Record<string, any> | Promise<Record<string, any>>;
13
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Type for resource manifest defined in YAML files
3
+ */
4
+ export interface ResourceManifest {
5
+ kind: string;
6
+ metadata: {
7
+ name: string;
8
+ module: string;
9
+ [key: string]: any;
10
+ };
11
+ [key: string]: any;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type RuntimeErrorCode = 'ERR_RESOURCE_NOT_FOUND' | 'ERR_CONTROLLER_NOT_FOUND' | 'ERR_CONTROLLER_INVALID' | 'ERR_RESOURCE_NOT_INVOKABLE' | 'ERR_DUPLICATE_RESOURCE' | 'ERR_EXECUTION_FAILED' | 'ERR_INVALID_VALUE';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export type RuntimeEvent = {
2
+ name: string;
3
+ payload?: any;
4
+ metadata?: Record<string, any>;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface RuntimeResource {
2
+ kind: string;
3
+ metadata: {
4
+ name: string;
5
+ module: string;
6
+ [key: string]: any;
7
+ };
8
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@telorun/sdk",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "bun": "./src/index.ts",
10
+ "import": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "devDependencies": {
18
+ "@types/node": "^20.0.0",
19
+ "typescript": "^5.0.0"
20
+ },
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.lib.json"
23
+ }
24
+ }