@telorun/sdk 0.11.1 → 0.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  # SUSTAINABLE USE LICENSE (Fair-code)
2
2
 
3
- Copyright (c) 2026 DiglyAI
3
+ Copyright (c) 2026 CodeNet Sp. z o.o.
4
4
 
5
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
6
 
@@ -14,4 +14,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
14
14
 
15
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
16
 
17
- For commercial licensing, managed hosting exemptions, or enterprise inquiries, please contact DiglyAI.
17
+ For commercial licensing, managed hosting exemptions, or enterprise inquiries, please contact <contact@codenet.pl>.
package/README.md CHANGED
@@ -8,10 +8,6 @@ The Node.js SDK provides the authoring surface for Telo modules. It defines the
8
8
  - **Context types** for accessing the kernel, registry, and events.
9
9
  - **Shared primitives** used by Telo modules and tooling.
10
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
11
  ## When to Use It
16
12
 
17
13
  Use the SDK when building or extending Telo modules. It is not the kernel itself; it is the contract layer that keeps module behavior consistent and predictable.
@@ -69,9 +65,3 @@ throws:
69
65
  ```
70
66
 
71
67
  `inherit` is driven by the analyzer's dataflow pass over `x-telo-step-context` arrays; future composers opt in by declaring both the annotation and `inherit: true`. See [modules/run/docs/structured-errors.md](../../modules/run/docs/structured-errors.md) for the end-to-end flow.
72
-
73
- ## Related Docs
74
-
75
- - Kernel overview: [kernel/README.md](../../kernel/README.md)
76
- - Built‑in modules: [modules/](../../modules/)
77
- - SDKs index: [sdk/README.md](../README.md)
@@ -1,4 +1,4 @@
1
- export interface Provider {
2
- init(): Promise<void>;
1
+ export interface Provider<TOutput = unknown> {
2
+ provide(): Promise<TOutput>;
3
3
  }
4
4
  //# sourceMappingURL=provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/capabilities/provider.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/capabilities/provider.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ,CAAC,OAAO,GAAG,OAAO;IACzC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7B"}
@@ -0,0 +1,8 @@
1
+ import type { CapabilityDefinition } from "./types.js";
2
+ /**
3
+ * Factory that wires the declarative `expand` config on a CapabilityDefinition
4
+ * into the `onManifest` and `onInvoke` lifecycle hooks. The kernel only ever
5
+ * calls these hooks — it has no knowledge of the `expand` config.
6
+ */
7
+ export declare function createCapability(def: CapabilityDefinition): CapabilityDefinition;
8
+ //# sourceMappingURL=capability-definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-definition.d.ts","sourceRoot":"","sources":["../src/capability-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,oBAAoB,GAAG,oBAAoB,CAwBhF"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Factory that wires the declarative `expand` config on a CapabilityDefinition
3
+ * into the `onManifest` and `onInvoke` lifecycle hooks. The kernel only ever
4
+ * calls these hooks — it has no knowledge of the `expand` config.
5
+ */
6
+ export function createCapability(def) {
7
+ const compile = def.expand?.compile ?? [];
8
+ const runtime = def.expand?.runtime ?? [];
9
+ return {
10
+ ...def,
11
+ onManifest: compile.length
12
+ ? (manifest, ctx) => ctx.expandPaths(manifest, compile, runtime)
13
+ : def.onManifest,
14
+ onInvoke: runtime.length
15
+ ? async (instance, inputs, ctx) => {
16
+ const expanded = ctx.moduleContext.expandPaths(inputs, runtime);
17
+ return instance.invoke(expanded);
18
+ }
19
+ : def.onInvoke,
20
+ };
21
+ }
@@ -0,0 +1,3 @@
1
+ import { Environment } from "@marcbachmann/cel-js";
2
+ export declare const celEnvironment: Environment;
3
+ //# sourceMappingURL=cel-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cel-environment.d.ts","sourceRoot":"","sources":["../src/cel-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,eAAO,MAAM,cAAc,aAWvB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Environment } from "@marcbachmann/cel-js";
2
+ export const celEnvironment = new Environment({ unlistedVariablesAreDyn: true })
3
+ .registerFunction("join(list, string): string", (list, sep) => list.map(String).join(sep))
4
+ .registerFunction("keys(map): list", (map) => {
5
+ if (map instanceof Map)
6
+ return [...map.keys()];
7
+ return Object.keys(map);
8
+ })
9
+ .registerFunction("values(map): list", (map) => {
10
+ if (map instanceof Map)
11
+ return [...map.values()];
12
+ return Object.values(map);
13
+ });
@@ -0,0 +1,13 @@
1
+ import { EvaluationContext } from "./evaluation-context.js";
2
+ import { ModuleContext } from "./module-context.js";
3
+ /**
4
+ * The ephemeral, per-trigger context layer. Merges a ModuleContext with
5
+ * arbitrary execution-time properties (e.g. { request, inputs } for HTTP;
6
+ * any shape is valid — determined by the trigger type).
7
+ *
8
+ * Execution props overlay the module namespaces on key conflict.
9
+ */
10
+ export declare class ExecutionContext extends EvaluationContext {
11
+ constructor(moduleCtx: ModuleContext, execProps: Record<string, unknown>);
12
+ }
13
+ //# sourceMappingURL=execution-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-context.d.ts","sourceRoot":"","sources":["../src/execution-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB;gBACzC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CASzE"}
@@ -0,0 +1,13 @@
1
+ import { EvaluationContext } from "./evaluation-context.js";
2
+ /**
3
+ * The ephemeral, per-trigger context layer. Merges a ModuleContext with
4
+ * arbitrary execution-time properties (e.g. { request, inputs } for HTTP;
5
+ * any shape is valid — determined by the trigger type).
6
+ *
7
+ * Execution props overlay the module namespaces on key conflict.
8
+ */
9
+ export class ExecutionContext extends EvaluationContext {
10
+ constructor(moduleCtx, execProps) {
11
+ super(moduleCtx.source, Object.assign(Object.create(null), moduleCtx.context, execProps), moduleCtx.createInstance, moduleCtx.secretValues, moduleCtx.emit);
12
+ }
13
+ }
@@ -1,7 +1,8 @@
1
1
  import type { Invocable } from "./capabilities/invokable.js";
2
+ import type { Provider } from "./capabilities/provider.js";
2
3
  import type { Runnable } from "./capabilities/runnable.js";
3
4
  import type { ResourceContext } from "./resource-context.js";
4
- export type ResourceInstance<TInput = Record<string, any>, TOutput = any> = Partial<Invocable<TInput, TOutput>> & Partial<Runnable> & {
5
+ export type ResourceInstance<TInput = Record<string, any>, TOutput = any> = Partial<Invocable<TInput, TOutput>> & Partial<Runnable> & Partial<Provider<TOutput>> & {
5
6
  init?(ctx?: ResourceContext): Promise<void>;
6
7
  teardown?(): void | Promise<void>;
7
8
  snapshot?(): Record<string, any> | Promise<Record<string, any>>;
@@ -1 +1 @@
1
- {"version":3,"file":"resource-instance.d.ts","sourceRoot":"","sources":["../src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,OAAO,CAAC,CAAC,GAAG;IAC3B,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,QAAQ,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,QAAQ,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CACjE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/sdk",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "Telo SDK - Public API for Telo module authors.",
5
5
  "keywords": [
6
6
  "telo",
@@ -1,3 +1,3 @@
1
- export interface Provider {
2
- init(): Promise<void>;
1
+ export interface Provider<TOutput = unknown> {
2
+ provide(): Promise<TOutput>;
3
3
  }
@@ -1,11 +1,13 @@
1
1
  import type { Invocable } from "./capabilities/invokable.js";
2
+ import type { Provider } from "./capabilities/provider.js";
2
3
  import type { Runnable } from "./capabilities/runnable.js";
3
4
  import type { ResourceContext } from "./resource-context.js";
4
5
 
5
6
  export type ResourceInstance<TInput = Record<string, any>, TOutput = any> = Partial<
6
7
  Invocable<TInput, TOutput>
7
8
  > &
8
- Partial<Runnable> & {
9
+ Partial<Runnable> &
10
+ Partial<Provider<TOutput>> & {
9
11
  init?(ctx?: ResourceContext): Promise<void>;
10
12
  teardown?(): void | Promise<void>;
11
13
  snapshot?(): Record<string, any> | Promise<Record<string, any>>;