@dawn-ai/core 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dawn-ai/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,11 +32,11 @@
32
32
  "dependencies": {
33
33
  "tsx": "^4.8.1",
34
34
  "typescript": "5.8.3",
35
- "@dawn-ai/sdk": "0.1.2"
35
+ "@dawn-ai/sdk": "0.1.4"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "25.6.0",
39
- "@dawn-ai/config-typescript": "0.1.2"
39
+ "@dawn-ai/config-typescript": "0.1.4"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsc -b tsconfig.json",
@@ -1,9 +0,0 @@
1
- export interface ResolvedAuthoringRouteDefinition {
2
- readonly entry: "./graph.ts" | "./workflow.ts";
3
- readonly executableFile: string;
4
- readonly kind: "graph" | "workflow";
5
- readonly routeDefinitionFile: string;
6
- readonly routeDir: string;
7
- }
8
- export declare function loadAuthoringRouteDefinition(routeDefinitionFile: string): Promise<ResolvedAuthoringRouteDefinition | null>;
9
- //# sourceMappingURL=load-authoring-route-definition.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-authoring-route-definition.d.ts","sourceRoot":"","sources":["../../src/discovery/load-authoring-route-definition.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAAA;IAC9C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAAA;IACnC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED,wBAAsB,4BAA4B,CAChD,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,gCAAgC,GAAG,IAAI,CAAC,CAwDlD"}
@@ -1,57 +0,0 @@
1
- import { constants } from "node:fs";
2
- import { access } from "node:fs/promises";
3
- import { dirname, resolve } from "node:path";
4
- import { pathToFileURL } from "node:url";
5
- let loaderPromise;
6
- const TSX_MODULE = "tsx";
7
- export async function loadAuthoringRouteDefinition(routeDefinitionFile) {
8
- if (!(await fileExists(routeDefinitionFile))) {
9
- return null;
10
- }
11
- await registerTsxLoader();
12
- const routeModule = (await import(pathToFileURL(routeDefinitionFile).href));
13
- const definition = routeModule.route ?? routeModule.default;
14
- if (!isRecord(definition)) {
15
- throw new Error(`Route definition ${routeDefinitionFile} must export a Dawn route definition`);
16
- }
17
- const routeDir = dirname(routeDefinitionFile);
18
- const kind = definition.kind;
19
- const entry = definition.entry;
20
- if (kind !== "graph" && kind !== "workflow") {
21
- throw new Error(`Route definition ${routeDefinitionFile} must define kind as "graph" or "workflow"`);
22
- }
23
- if (entry !== "./graph.ts" && entry !== "./workflow.ts") {
24
- throw new Error(`Route definition ${routeDefinitionFile} kind "${kind}" must bind entry "./${kind}.ts", received ${JSON.stringify(entry)}`);
25
- }
26
- if ((kind === "graph" && entry !== "./graph.ts") ||
27
- (kind === "workflow" && entry !== "./workflow.ts")) {
28
- throw new Error(`Route definition ${routeDefinitionFile} kind "${kind}" must bind entry "./${kind}.ts", received ${JSON.stringify(entry)}`);
29
- }
30
- const executableFile = resolve(routeDir, entry.slice(2));
31
- if (!(await fileExists(executableFile))) {
32
- throw new Error(`Route definition ${routeDefinitionFile} binds to missing executable file: ${executableFile}`);
33
- }
34
- return {
35
- entry,
36
- executableFile,
37
- kind,
38
- routeDefinitionFile,
39
- routeDir,
40
- };
41
- }
42
- async function registerTsxLoader() {
43
- loaderPromise ??= import(TSX_MODULE).then(() => undefined);
44
- await loaderPromise;
45
- }
46
- async function fileExists(filePath) {
47
- try {
48
- await access(filePath, constants.F_OK);
49
- return true;
50
- }
51
- catch {
52
- return false;
53
- }
54
- }
55
- function isRecord(value) {
56
- return typeof value === "object" && value !== null;
57
- }