@dawn-ai/core 0.1.7 → 0.2.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 +1 -1
- package/README.md +2 -2
- package/dist/capabilities/built-in/agents-md.d.ts +9 -0
- package/dist/capabilities/built-in/agents-md.d.ts.map +1 -0
- package/dist/capabilities/built-in/agents-md.js +54 -0
- package/dist/capabilities/built-in/frontmatter.d.ts +17 -0
- package/dist/capabilities/built-in/frontmatter.d.ts.map +1 -0
- package/dist/capabilities/built-in/frontmatter.js +47 -0
- package/dist/capabilities/built-in/plan-md-parser.d.ts +6 -0
- package/dist/capabilities/built-in/plan-md-parser.d.ts.map +1 -0
- package/dist/capabilities/built-in/plan-md-parser.js +18 -0
- package/dist/capabilities/built-in/planning.d.ts +7 -0
- package/dist/capabilities/built-in/planning.d.ts.map +1 -0
- package/dist/capabilities/built-in/planning.js +125 -0
- package/dist/capabilities/built-in/skills.d.ts +3 -0
- package/dist/capabilities/built-in/skills.d.ts.map +1 -0
- package/dist/capabilities/built-in/skills.js +114 -0
- package/dist/capabilities/built-in/subagents.d.ts +3 -0
- package/dist/capabilities/built-in/subagents.d.ts.map +1 -0
- package/dist/capabilities/built-in/subagents.js +99 -0
- package/dist/capabilities/built-in/workspace.d.ts +3 -0
- package/dist/capabilities/built-in/workspace.d.ts.map +1 -0
- package/dist/capabilities/built-in/workspace.js +187 -0
- package/dist/capabilities/registry.d.ts +21 -0
- package/dist/capabilities/registry.d.ts.map +1 -0
- package/dist/capabilities/registry.js +35 -0
- package/dist/capabilities/types.d.ts +56 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capabilities/types.js +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -214
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/typegen/extract-tool-schema.js +58 -3
- package/dist/typegen/extract-tool-types.js +2 -2
- package/dist/types.d.ts +24 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -3
|
@@ -98,12 +98,15 @@ export async function extractToolSchemasForRoute(options) {
|
|
|
98
98
|
results.sort((a, b) => a.name.localeCompare(b.name));
|
|
99
99
|
return results;
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
const MAX_SCHEMA_DEPTH = 8;
|
|
102
|
+
function tsTypeToJsonSchema(type, checker, depth = 0) {
|
|
103
|
+
if (depth > MAX_SCHEMA_DEPTH)
|
|
104
|
+
return { type: "string" };
|
|
102
105
|
// Strip undefined from unions (optional properties resolve as T | undefined)
|
|
103
106
|
if (type.isUnion()) {
|
|
104
107
|
const nonUndefined = type.types.filter((t) => !(t.flags & ts.TypeFlags.Undefined));
|
|
105
108
|
if (nonUndefined.length === 1 && nonUndefined[0]) {
|
|
106
|
-
return tsTypeToJsonSchema(nonUndefined[0], checker);
|
|
109
|
+
return tsTypeToJsonSchema(nonUndefined[0], checker, depth);
|
|
107
110
|
}
|
|
108
111
|
// String literal union → enum
|
|
109
112
|
const allStringLiterals = nonUndefined.every((t) => t.isStringLiteral());
|
|
@@ -111,12 +114,28 @@ function tsTypeToJsonSchema(type, checker) {
|
|
|
111
114
|
const enumValues = nonUndefined.map((t) => t.value);
|
|
112
115
|
return { type: "string", enum: enumValues };
|
|
113
116
|
}
|
|
117
|
+
// Union of object shapes → anyOf. Require a genuine object type
|
|
118
|
+
// (ts.TypeFlags.Object) so intrinsic unions like `boolean` (modeled as
|
|
119
|
+
// `true | false` BooleanLiteral members that carry Boolean.prototype
|
|
120
|
+
// props) fall through to the primitive checks below instead of becoming
|
|
121
|
+
// a bogus anyOf.
|
|
122
|
+
if (nonUndefined.length > 1) {
|
|
123
|
+
const allObjects = nonUndefined.every((t) => (t.flags & ts.TypeFlags.Object) !== 0 &&
|
|
124
|
+
(t.getProperties().length > 0 || checker.getIndexTypeOfType(t, ts.IndexKind.String)));
|
|
125
|
+
if (allObjects) {
|
|
126
|
+
return {
|
|
127
|
+
anyOf: nonUndefined.map((t) => tsTypeToJsonSchema(t, checker, depth + 1)),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
114
131
|
}
|
|
115
132
|
// Array type
|
|
116
133
|
if (checker.isArrayType(type)) {
|
|
117
134
|
const typeArgs = type.typeArguments;
|
|
118
135
|
const elementType = typeArgs && typeArgs.length > 0 && typeArgs[0];
|
|
119
|
-
const items = elementType
|
|
136
|
+
const items = elementType
|
|
137
|
+
? tsTypeToJsonSchema(elementType, checker, depth + 1)
|
|
138
|
+
: { type: "string" };
|
|
120
139
|
return { type: "array", items };
|
|
121
140
|
}
|
|
122
141
|
const typeString = checker.typeToString(type);
|
|
@@ -126,9 +145,45 @@ function tsTypeToJsonSchema(type, checker) {
|
|
|
126
145
|
return { type: "number" };
|
|
127
146
|
if (typeString === "boolean")
|
|
128
147
|
return { type: "boolean" };
|
|
148
|
+
// Try nested object
|
|
149
|
+
const objSchema = tryObjectSchema(type, checker, depth);
|
|
150
|
+
if (objSchema !== undefined)
|
|
151
|
+
return objSchema;
|
|
129
152
|
// Fallback to string for unknown types
|
|
130
153
|
return { type: "string" };
|
|
131
154
|
}
|
|
155
|
+
function tryObjectSchema(type, checker, depth) {
|
|
156
|
+
const props = type.getProperties();
|
|
157
|
+
const indexType = checker.getIndexTypeOfType(type, ts.IndexKind.String);
|
|
158
|
+
// Record<string, T>: no named properties, string index signature present.
|
|
159
|
+
if (props.length === 0 && indexType) {
|
|
160
|
+
return {
|
|
161
|
+
type: "object",
|
|
162
|
+
properties: {},
|
|
163
|
+
required: [],
|
|
164
|
+
additionalProperties: tsTypeToJsonSchema(indexType, checker, depth + 1),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
if (props.length === 0)
|
|
168
|
+
return undefined;
|
|
169
|
+
const properties = {};
|
|
170
|
+
const required = [];
|
|
171
|
+
for (const prop of props) {
|
|
172
|
+
const propType = checker.getTypeOfSymbolAtLocation(prop, prop.valueDeclaration ?? prop.declarations?.[0] ?? {});
|
|
173
|
+
const schema = tsTypeToJsonSchema(propType, checker, depth + 1);
|
|
174
|
+
const propDoc = ts.displayPartsToString(prop.getDocumentationComment(checker));
|
|
175
|
+
if (propDoc)
|
|
176
|
+
schema.description = propDoc;
|
|
177
|
+
properties[prop.getName()] = schema;
|
|
178
|
+
const declarations = prop.getDeclarations();
|
|
179
|
+
const isOptional = declarations !== undefined &&
|
|
180
|
+
declarations.length > 0 &&
|
|
181
|
+
declarations.some((d) => ts.isPropertySignature(d) && d.questionToken !== undefined);
|
|
182
|
+
if (!isOptional)
|
|
183
|
+
required.push(prop.getName());
|
|
184
|
+
}
|
|
185
|
+
return { type: "object", properties, required, additionalProperties: false };
|
|
186
|
+
}
|
|
132
187
|
function discoverToolFiles(toolsDir) {
|
|
133
188
|
const files = new Map();
|
|
134
189
|
if (!existsSync(toolsDir))
|
|
@@ -53,7 +53,7 @@ export async function extractToolTypesForRoute(options) {
|
|
|
53
53
|
if (!firstParam)
|
|
54
54
|
continue;
|
|
55
55
|
const paramType = checker.getTypeOfSymbolAtLocation(firstParam, sourceFile);
|
|
56
|
-
inputType = checker.typeToString(paramType);
|
|
56
|
+
inputType = checker.typeToString(paramType, undefined, ts.TypeFormatFlags.NoTruncation);
|
|
57
57
|
}
|
|
58
58
|
const returnType = checker.getReturnTypeOfSignature(signature);
|
|
59
59
|
const outputType = unwrapPromise(returnType);
|
|
@@ -62,7 +62,7 @@ export async function extractToolTypesForRoute(options) {
|
|
|
62
62
|
description,
|
|
63
63
|
name,
|
|
64
64
|
inputType,
|
|
65
|
-
outputType: checker.typeToString(outputType),
|
|
65
|
+
outputType: checker.typeToString(outputType, undefined, ts.TypeFormatFlags.NoTruncation),
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
results.sort((a, b) => a.name.localeCompare(b.name));
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
|
+
import type { PermissionMode } from "@dawn-ai/permissions";
|
|
1
2
|
import type { RouteKind } from "@dawn-ai/sdk";
|
|
3
|
+
import type { ThreadsStore } from "@dawn-ai/sqlite-storage";
|
|
4
|
+
import type { ExecBackend, FilesystemBackend } from "@dawn-ai/workspace";
|
|
5
|
+
import type { BaseCheckpointSaver } from "@langchain/langgraph-checkpoint";
|
|
2
6
|
export type { RouteKind };
|
|
3
7
|
export interface DawnConfig {
|
|
4
8
|
readonly appDir?: string;
|
|
9
|
+
readonly backends?: {
|
|
10
|
+
readonly filesystem?: FilesystemBackend;
|
|
11
|
+
readonly exec?: ExecBackend;
|
|
12
|
+
};
|
|
13
|
+
readonly permissions?: {
|
|
14
|
+
readonly mode?: PermissionMode;
|
|
15
|
+
readonly allow?: Readonly<Record<string, readonly string[]>>;
|
|
16
|
+
readonly deny?: Readonly<Record<string, readonly string[]>>;
|
|
17
|
+
};
|
|
18
|
+
readonly checkpointer?: BaseCheckpointSaver;
|
|
19
|
+
readonly threadsStore?: ThreadsStore;
|
|
20
|
+
/**
|
|
21
|
+
* Path to the env file loaded for local `dawn dev` / `dawn verify`,
|
|
22
|
+
* relative to the app root. Defaults to "./.env". Does NOT affect the
|
|
23
|
+
* deploy artifact (langgraph.json env is detected separately).
|
|
24
|
+
*/
|
|
25
|
+
readonly env?: string;
|
|
5
26
|
}
|
|
6
27
|
export type RouteSegment = {
|
|
7
28
|
readonly kind: "static";
|
|
@@ -61,12 +82,13 @@ export interface RouteToolTypes {
|
|
|
61
82
|
readonly tools: readonly ExtractedToolType[];
|
|
62
83
|
}
|
|
63
84
|
export interface JsonSchemaProperty {
|
|
64
|
-
readonly type
|
|
85
|
+
readonly type?: string;
|
|
65
86
|
readonly description?: string;
|
|
66
87
|
readonly items?: JsonSchemaProperty;
|
|
67
88
|
readonly properties?: Record<string, JsonSchemaProperty>;
|
|
68
89
|
readonly required?: readonly string[];
|
|
69
|
-
readonly additionalProperties?: boolean;
|
|
90
|
+
readonly additionalProperties?: boolean | JsonSchemaProperty;
|
|
91
|
+
readonly anyOf?: readonly JsonSchemaProperty[];
|
|
70
92
|
readonly enum?: readonly string[];
|
|
71
93
|
}
|
|
72
94
|
export interface ExtractedToolSchema {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAE1E,YAAY,EAAE,SAAS,EAAE,CAAA;AAEzB,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAA;QACvC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;KAC5B,CAAA;IACD,QAAQ,CAAC,WAAW,CAAC,EAAE;QACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,CAAA;QAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAA;QAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAA;KAC5D,CAAA;IACD,QAAQ,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"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@langchain/langgraph": "^1.3.0",
|
|
33
34
|
"tsx": "^4.8.1",
|
|
34
35
|
"typescript": "5.8.3",
|
|
35
|
-
"
|
|
36
|
+
"zod": "^4.4.3",
|
|
37
|
+
"@dawn-ai/sqlite-storage": "0.2.0",
|
|
38
|
+
"@dawn-ai/permissions": "0.1.8",
|
|
39
|
+
"@dawn-ai/workspace": "0.1.8",
|
|
40
|
+
"@dawn-ai/sdk": "0.2.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@langchain/langgraph-checkpoint": "^1.0.2"
|
|
36
44
|
},
|
|
37
45
|
"devDependencies": {
|
|
46
|
+
"@langchain/langgraph-checkpoint": "^1.0.2",
|
|
38
47
|
"@types/node": "25.6.0",
|
|
39
|
-
"@dawn-ai/config-typescript": "0.
|
|
48
|
+
"@dawn-ai/config-typescript": "0.2.0",
|
|
49
|
+
"@dawn-ai/sqlite-storage": "0.2.0"
|
|
40
50
|
},
|
|
41
51
|
"scripts": {
|
|
42
52
|
"build": "tsc -b tsconfig.json",
|