tarsk 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/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tarsk",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "author": "WebNative LLC",
5
5
  "description": "Tarsk is a AI tool available at https://tarsk.io",
6
6
  "license": "MIT",
@@ -1,16 +0,0 @@
1
- /**
2
- * Searches for books in the Project Gutenberg library based on provided search terms
3
- * @param @array @required searchTerms - List of search terms to find books in the Gutenberg library (e.g. ['dickens', 'great'] to search for books by Dickens with 'great' in the title)
4
- * @returns {Promise<Book[]>} A promise that resolves to an array of books matching the search terms
5
- */
6
- export async function searchGutenbergBooks(searchTerms ) {
7
- const searchQuery = searchTerms.join(' ');
8
- const url = 'https://gutendex.com/books';
9
- const response = await fetch(`${url}?search=${searchQuery}`);
10
- const data = await response.json();
11
- return data.results.map((book ) => ({
12
- id: book.id,
13
- title: book.title,
14
- authors: book.authors,
15
- }));
16
- }
@@ -1,24 +0,0 @@
1
- [
2
- {
3
- "type": "function",
4
- "function": {
5
- "name": "searchGutenbergBooks",
6
- "description": "Searches for books in the Project Gutenberg library based on provided search terms",
7
- "parameters": {
8
- "type": "object",
9
- "properties": {
10
- "searchTerms": {
11
- "type": "array",
12
- "description": "List of search terms to find books in the Gutenberg library (e.g. ['dickens', 'great'] to search for books by Dickens with 'great' in the title)",
13
- "items": {
14
- "type": "string"
15
- }
16
- }
17
- },
18
- "required": [
19
- "searchTerms"
20
- ]
21
- }
22
- }
23
- }
24
- ]
@@ -1,11 +0,0 @@
1
- import {searchGutenbergBooks} from "./books.js";
2
-
3
- // ToDo - run all functions regardles of if its called test
4
- // ToDO - dynamically load properly
5
-
6
- // You need a function called test
7
- export async function test() {
8
- const books = await searchGutenbergBooks(['beast']);
9
- return books;
10
- }
11
-
@@ -1,38 +0,0 @@
1
- /**
2
- * Searches for theme camps at a regional burn.
3
- * @param burnId - An identifier for the burn found by searching for the burn
4
- * @param campName - An optional name to search the camp list for
5
- * @returns {Promise<Burn[]>} A promise that resolves to an array of theme camps.
6
- */
7
- export async function camps(burnId , campName ) {
8
- const url = 'https://api.dust.events/data/festivals.json';
9
- const response = await fetch(`${url}`);
10
- let burns = await response.json();
11
- let burn = burns.find(b => b.title.toLowerCase() == burnId.toLowerCase());
12
- if (!burn) {
13
- console.error(`Unable to find burn ${burnId} (${campName})`);
14
- } else {
15
- burns = [burn];
16
- }
17
- const result = [];
18
- let found = false;
19
- for (const burn of burns.filter(b => b.active)) {
20
- const campUrl = `https://data.dust.events/${burn.id}/camps.json`;
21
- const response2 = await fetch(`${campUrl}`);
22
- const camps = await response2.json();
23
- if (campName) {
24
- console.log(`Camp Search for "${campName}" at ${burn.name}`);
25
- const camp = camps.find(c => c.name.toLowerCase().includes(campName.toLowerCase()));
26
- if (camp) {
27
- console.log(`Found camp ${camp.name}`);
28
- found = true;
29
- result.push(camp);
30
- }
31
- } else {
32
- if (!found) {
33
- result.push(...camps);
34
- }
35
- }
36
- }
37
- return result;
38
- }
@@ -1,25 +0,0 @@
1
- [
2
- {
3
- "type": "function",
4
- "function": {
5
- "name": "camps",
6
- "description": "Searches for theme camps at a regional burn.",
7
- "parameters": {
8
- "type": "object",
9
- "properties": {
10
- "burnId": {
11
- "type": "string",
12
- "description": "An identifier for the burn found by searching for the burn"
13
- },
14
- "campName": {
15
- "type": "string",
16
- "description": "An optional name to search the camp list for"
17
- }
18
- },
19
- "required": [
20
- "burnId"
21
- ]
22
- }
23
- }
24
- }
25
- ]
@@ -1 +0,0 @@
1
- console.log('heelo');
@@ -1,54 +0,0 @@
1
- /**
2
- * Searches for burns based on provided search terms.
3
- * @param {string[]} searchTerms - List of search terms to find burns.
4
- * @returns {Promise<Burn[]>} A promise that resolves with an array of Burn objects.
5
- */
6
- export async function searchBurns(searchTerms ) {
7
- const searchQuery = searchTerms.join(' ');
8
- const url = 'https://api.dust.events/data/festivals.json';
9
- const response = await fetch(`${url}`);
10
- let data = await response.json();
11
- data = data.filter((b) => b.active);
12
- return data.map((burn ) => ({
13
- name: burn.name,
14
- title: burn.title,
15
- year: burn.year,
16
- startDate: burn.start,
17
- endDate: burn.end,
18
- lat: burn.lat,
19
- long: burn.long,
20
- timeZone: burn.timeZone,
21
- region: burn.region,
22
- website: burn.website
23
- }));
24
- }
25
-
26
- ;
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
@@ -1,24 +0,0 @@
1
- [
2
- {
3
- "type": "function",
4
- "function": {
5
- "name": "searchBurns",
6
- "description": "Searches for burns based on provided search terms.",
7
- "parameters": {
8
- "type": "object",
9
- "properties": {
10
- "searchTerms": {
11
- "type": "array",
12
- "description": "",
13
- "items": {
14
- "type": "string"
15
- }
16
- }
17
- },
18
- "required": [
19
- "searchTerms"
20
- ]
21
- }
22
- }
23
- }
24
- ]
@@ -1,7 +0,0 @@
1
- import { searchBurns } from './dust.js';
2
-
3
- export async function test() {
4
- const burns = await searchBurns(['']);
5
-
6
- return burns;
7
- }
@@ -1 +0,0 @@
1
- UEJLV1N2Msau6bKtaSCHJw==:Vi1PEZSNN2pIEPBibIg9zlC98ER4F/SIUPKAZQmzCuepmmlVi98dMKRZXj9fVFD1ZaHVFUQFrok5cRJv9qAtQw8QmF71wCxr6olwvSn7Dp4fRE4ETySxSVB3DpglkOpmXisSs2OXISMQXhG0I6vaDGB5WNkKOll4NPErJhmhd/7cfS9W4UuAiT+VjfrmveVvA1+TdJMCJWFeyNMqBHfsM4bUKZdj5J7i9HTLEaeiov3055rGVAlCnp4lEQ5OoS30S6hepwwGC6lBpGeLAHLGXQ==
@@ -1,5 +0,0 @@
1
- {
2
- "title": "Books",
3
- "name": "books",
4
- "revision": 2
5
- }
@@ -1,11 +0,0 @@
1
- import {searchGutenbergBooks} from "./books.js";
2
-
3
- // ToDo - run all functions regardles of if its called test
4
- // ToDO - dynamically load properly
5
-
6
- // You need a function called test
7
- export async function test() {
8
- const books = await searchGutenbergBooks(['beast']);
9
- return books;
10
- }
11
-
@@ -1,16 +0,0 @@
1
- /**
2
- * Searches for books in the Project Gutenberg library based on provided search terms
3
- * @param @array @required searchTerms - List of search terms to find books in the Gutenberg library (e.g. ['dickens', 'great'] to search for books by Dickens with 'great' in the title)
4
- * @returns {Promise<Book[]>} A promise that resolves to an array of books matching the search terms
5
- */
6
- export async function searchGutenbergBooks(searchTerms: string[]): Promise<Book[]> {
7
- const searchQuery = searchTerms.join(' ');
8
- const url = 'https://gutendex.com/books';
9
- const response = await fetch(`${url}?search=${searchQuery}`);
10
- const data = await response.json();
11
- return data.results.map((book: any) => ({
12
- id: book.id,
13
- title: book.title,
14
- authors: book.authors,
15
- }));
16
- }
@@ -1,5 +0,0 @@
1
- {
2
- "title": "Camps",
3
- "name": "camps",
4
- "revision": 5
5
- }
@@ -1 +0,0 @@
1
- console.log('heelo');
@@ -1,38 +0,0 @@
1
- /**
2
- * Searches for theme camps at a regional burn.
3
- * @param burnId - An identifier for the burn found by searching for the burn
4
- * @param campName - An optional name to search the camp list for
5
- * @returns {Promise<Burn[]>} A promise that resolves to an array of theme camps.
6
- */
7
- export async function camps(burnId: string, campName?: string): Promise<any> {
8
- const url = 'https://api.dust.events/data/festivals.json';
9
- const response = await fetch(`${url}`);
10
- let burns = await response.json();
11
- let burn = burns.find(b => b.title.toLowerCase() == burnId.toLowerCase());
12
- if (!burn) {
13
- console.error(`Unable to find burn ${burnId} (${campName})`);
14
- } else {
15
- burns = [burn];
16
- }
17
- const result = [];
18
- let found = false;
19
- for (const burn of burns.filter(b => b.active)) {
20
- const campUrl = `https://data.dust.events/${burn.id}/camps.json`;
21
- const response2 = await fetch(`${campUrl}`);
22
- const camps = await response2.json();
23
- if (campName) {
24
- console.log(`Camp Search for "${campName}" at ${burn.name}`);
25
- const camp = camps.find(c => c.name.toLowerCase().includes(campName.toLowerCase()));
26
- if (camp) {
27
- console.log(`Found camp ${camp.name}`);
28
- found = true;
29
- result.push(camp);
30
- }
31
- } else {
32
- if (!found) {
33
- result.push(...camps);
34
- }
35
- }
36
- }
37
- return result;
38
- }
@@ -1,5 +0,0 @@
1
- {
2
- "title": "Dust",
3
- "name": "dust",
4
- "revision": 2
5
- }
@@ -1,7 +0,0 @@
1
- import { searchBurns } from './dust.js';
2
-
3
- export async function test() {
4
- const burns = await searchBurns(['']);
5
-
6
- return burns;
7
- }
@@ -1,54 +0,0 @@
1
- /**
2
- * Searches for burns based on provided search terms.
3
- * @param {string[]} searchTerms - List of search terms to find burns.
4
- * @returns {Promise<Burn[]>} A promise that resolves with an array of Burn objects.
5
- */
6
- export async function searchBurns(searchTerms: string[]): Promise<Burn[]> {
7
- const searchQuery = searchTerms.join(' ');
8
- const url = 'https://api.dust.events/data/festivals.json';
9
- const response = await fetch(`${url}`);
10
- let data = await response.json();
11
- data = data.filter((b) => b.active);
12
- return data.map((burn: any) => ({
13
- name: burn.name,
14
- title: burn.title,
15
- year: burn.year,
16
- startDate: burn.start,
17
- endDate: burn.end,
18
- lat: burn.lat,
19
- long: burn.long,
20
- timeZone: burn.timeZone,
21
- region: burn.region,
22
- website: burn.website
23
- }));
24
- }
25
-
26
- export interface Burn {
27
- name: string
28
- title: string
29
- year: string
30
- active: boolean
31
- id: string
32
- uid: number
33
- start: string
34
- end: string
35
- lat: any
36
- long: any
37
- imageUrl?: string
38
- timeZone: string
39
- mapDirection: number
40
- mastodonHandle: string
41
- rssFeed: string
42
- inboxEmail: string
43
- region: string
44
- website: string
45
- unknownDates: boolean
46
- volunteeripateSubdomain: string
47
- volunteeripateIdentifier: string
48
- pin_size_multiplier: number
49
- camp_registration: boolean
50
- event_registration: boolean
51
- pin: string
52
- directions?: string
53
- }
54
-
@@ -1,77 +0,0 @@
1
- import { logWrite, logEnd, logError, logStart } from "../log/log.js";
2
- const weakModules = new WeakMap();
3
- async function importWeak(modulePath, keyObject) {
4
- if (weakModules.has(keyObject)) {
5
- return weakModules.get(keyObject);
6
- }
7
- const module = await import(modulePath);
8
- weakModules.set(keyObject, module);
9
- return module;
10
- }
11
- export async function loadTools(modulePaths) {
12
- const tools = [];
13
- logWrite({
14
- type: "load_tools",
15
- args: modulePaths,
16
- }, `modulePaths is "${modulePaths.join(", ")}"`);
17
- for (const modulePath of modulePaths) {
18
- logWrite({ type: "getTool", args: modulePath });
19
- if (modulePath == "") {
20
- logError({ type: "getTool", args: "Empty modulePath" });
21
- continue;
22
- }
23
- else {
24
- const tool = await getTool(modulePath);
25
- tools.push(tool);
26
- }
27
- }
28
- return tools;
29
- }
30
- // async function importFromMemory(moduleCode: string) {
31
- // const module = new Function(
32
- // "exports",
33
- // "module",
34
- // "require",
35
- // "__filename",
36
- // "__dirname",
37
- // moduleCode
38
- // );
39
- // const exports = {};
40
- // const moduleObj = { exports: exports };
41
- // module(exports, moduleObj, require, null, null);
42
- // return moduleObj.exports;
43
- // }
44
- // async function importModule(code: string) {
45
- // const myModule = await importFromMemory(code);
46
- // //console.log(myModule.hello()); // Output: Hello from memory!
47
- // }
48
- // eg modulePath = './tools/books.js'
49
- async function getTool(modulePath) {
50
- const result = {
51
- key: {},
52
- toolMap: undefined,
53
- definition: undefined,
54
- };
55
- // When 'key' is no longer referenced and garbage collected,
56
- // the module './myModule.js' associated with it in 'weakModules'
57
- // will also be eligible for garbage collection.
58
- logStart({ type: "load_tool", args: { modulePath } }, `The modulePath is "${modulePath}"`);
59
- try {
60
- const myModule = await importWeak(modulePath, result.key);
61
- try {
62
- result.toolMap = myModule.toolMap;
63
- result.definition = myModule.default();
64
- return result;
65
- }
66
- catch (e) {
67
- throw new Error(`Error loading tool from ${modulePath}: ${e}`);
68
- }
69
- }
70
- catch (e) {
71
- logError({ type: "load_tool_error", args: e });
72
- }
73
- finally {
74
- logEnd("load_tool");
75
- }
76
- throw new Error(`Error loading tool from ${modulePath}`);
77
- }
package/dist/api/run.js DELETED
@@ -1,11 +0,0 @@
1
- // Cannot use eval here as it is dangerous. On cloud we need to sandbox with riza or cloudflare for platforms
2
- export {};
3
- // export function runAndGetOutput(codeString: string) {
4
- // try {
5
- // const result = eval(codeString);
6
- // console.log('eval result', result);
7
- // return String(result);
8
- // } catch (error) {
9
- // return `Error: ${error}`;;
10
- // }
11
- // }