@project-ajax/create 0.0.15 → 0.0.17
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 +1 -1
- package/template/.examples/sync-example.ts +34 -0
- package/template/.examples/tool-example.ts +52 -0
- package/template/README.md +91 -317
- package/template/package-lock.json +1656 -0
- package/template/package.json +1 -1
- package/template/src/index.ts +1 -184
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as Builder from "@project-ajax/sdk/builder";
|
|
2
|
+
import * as Schema from "@project-ajax/sdk/schema";
|
|
3
|
+
import { sync } from "@project-ajax/sdk/sync";
|
|
4
|
+
|
|
5
|
+
export const mySync = sync({
|
|
6
|
+
// Which field to use in each object as the primary key. Must be unique.
|
|
7
|
+
primaryKeyProperty: "ID",
|
|
8
|
+
// The schema of the collection to create in Notion.
|
|
9
|
+
schema: {
|
|
10
|
+
// Name of the collection to create in Notion.
|
|
11
|
+
dataSourceTitle: "My Data",
|
|
12
|
+
properties: {
|
|
13
|
+
// See `Schema` for the full list of possible column types.
|
|
14
|
+
Title: Schema.title(),
|
|
15
|
+
ID: Schema.richText(),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
execute: async () => {
|
|
19
|
+
// Fetch and return data
|
|
20
|
+
return {
|
|
21
|
+
objects: [
|
|
22
|
+
// Each object must match the shape of `properties` above.
|
|
23
|
+
{
|
|
24
|
+
key: "1",
|
|
25
|
+
properties: {
|
|
26
|
+
Title: Builder.title("Item 1"),
|
|
27
|
+
ID: Builder.richText("1"),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
done: true,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { tool } from "@project-ajax/sdk";
|
|
2
|
+
|
|
3
|
+
export const myTool = tool<
|
|
4
|
+
{ query?: string | null; limit?: number | null },
|
|
5
|
+
{ results: string[] }
|
|
6
|
+
>({
|
|
7
|
+
title: "My Tool",
|
|
8
|
+
// Description of what this tool does - shown to the AI agent
|
|
9
|
+
description: "Search for items by keyword or ID",
|
|
10
|
+
// JSON Schema for the input the tool accepts
|
|
11
|
+
schema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
query: {
|
|
15
|
+
type: "string",
|
|
16
|
+
nullable: true,
|
|
17
|
+
description: "The search query",
|
|
18
|
+
},
|
|
19
|
+
limit: {
|
|
20
|
+
type: "number",
|
|
21
|
+
nullable: true,
|
|
22
|
+
description: "Maximum number of results",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: [],
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
},
|
|
28
|
+
// Optional: JSON Schema for the output the tool returns
|
|
29
|
+
outputSchema: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
results: {
|
|
33
|
+
type: "array",
|
|
34
|
+
items: { type: "string" },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
required: ["results"],
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
},
|
|
40
|
+
// The function that executes when the tool is called
|
|
41
|
+
execute: async (input) => {
|
|
42
|
+
// Destructure input with default values
|
|
43
|
+
const { query: _query, limit: _limit = 10 } = input;
|
|
44
|
+
|
|
45
|
+
// Perform your logic here
|
|
46
|
+
// Example: search your data source using the query and limit
|
|
47
|
+
const results: string[] = [];
|
|
48
|
+
|
|
49
|
+
// Return data matching your outputSchema (if provided)
|
|
50
|
+
return { results };
|
|
51
|
+
},
|
|
52
|
+
});
|