@48nauts/tools-crud 0.1.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 +25 -0
- package/README.md +5 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/notes/index.d.ts +2 -0
- package/dist/notes/index.d.ts.map +1 -0
- package/dist/notes/index.js +2 -0
- package/dist/notes/index.js.map +1 -0
- package/dist/notes/save-note.d.ts +9 -0
- package/dist/notes/save-note.d.ts.map +1 -0
- package/dist/notes/save-note.js +23 -0
- package/dist/notes/save-note.js.map +1 -0
- package/dist/projects/find-project.d.ts +8 -0
- package/dist/projects/find-project.d.ts.map +1 -0
- package/dist/projects/find-project.js +24 -0
- package/dist/projects/find-project.js.map +1 -0
- package/dist/projects/index.d.ts +3 -0
- package/dist/projects/index.d.ts.map +1 -0
- package/dist/projects/index.js +3 -0
- package/dist/projects/index.js.map +1 -0
- package/dist/projects/list-projects.d.ts +5 -0
- package/dist/projects/list-projects.d.ts.map +1 -0
- package/dist/projects/list-projects.js +15 -0
- package/dist/projects/list-projects.js.map +1 -0
- package/dist/tasks/create-task.d.ts +12 -0
- package/dist/tasks/create-task.d.ts.map +1 -0
- package/dist/tasks/create-task.js +40 -0
- package/dist/tasks/create-task.js.map +1 -0
- package/dist/tasks/index.d.ts +4 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +4 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/list-project-tasks.d.ts +8 -0
- package/dist/tasks/list-project-tasks.d.ts.map +1 -0
- package/dist/tasks/list-project-tasks.js +24 -0
- package/dist/tasks/list-project-tasks.js.map +1 -0
- package/dist/tasks/update-task-status.d.ts +8 -0
- package/dist/tasks/update-task-status.d.ts.map +1 -0
- package/dist/tasks/update-task-status.js +24 -0
- package/dist/tasks/update-task-status.js.map +1 -0
- package/package.json +32 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
@48nauts/agent-core (NautCore)
|
|
4
|
+
Copyright (C) 2026 48Nauts (Andre / hello@48nauts.com)
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Affero General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
NOTE: This file is the SPDX header + short notice. Before this repo is made
|
|
22
|
+
public, replace the section below with the full AGPL-3.0 license text from
|
|
23
|
+
https://www.gnu.org/licenses/agpl-3.0.txt (or run `curl -o LICENSE.full https://www.gnu.org/licenses/agpl-3.0.txt`).
|
|
24
|
+
The SPDX header above is the legally-binding identifier; the long text is the
|
|
25
|
+
canonical reference required for public distribution.
|
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @48nauts/tools-crud
|
|
2
|
+
|
|
3
|
+
Tools that read/write the product DB through a `DbAdapter`. The same tool shape works against Drizzle, Prisma, or any future adapter.
|
|
4
|
+
|
|
5
|
+
Sprint 01 target: lift project/task/note CRUD tools from AgenticKMU, swap direct schema calls for adapter calls.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const VERSION = "0.0.1";
|
|
2
|
+
export { listProjectsTool, findProjectTool } from './projects/index.js';
|
|
3
|
+
export { listProjectTasksTool, createTaskTool, updateTaskStatusTool } from './tasks/index.js';
|
|
4
|
+
export { saveNoteTool } from './notes/index.js';
|
|
5
|
+
import type { AnyToolDef } from '@48nauts/agent-core';
|
|
6
|
+
/**
|
|
7
|
+
* Convenience: every CRUD tool in this package. Pass to the host adapter:
|
|
8
|
+
*
|
|
9
|
+
* import { allCrudTools } from '@48nauts/tools-crud'
|
|
10
|
+
* import { toOpenAiFunctions, runOpenAiTool } from '@48nauts/agent-core'
|
|
11
|
+
*
|
|
12
|
+
* const openaiTools = toOpenAiFunctions(allCrudTools)
|
|
13
|
+
* // ... later, when the model calls one:
|
|
14
|
+
* await runOpenAiTool(allCrudTools, name, args, { extras: { db } })
|
|
15
|
+
*/
|
|
16
|
+
export declare const allCrudTools: AnyToolDef[];
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAA;AAE9B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAKrD;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,EAAE,UAAU,EAOpC,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const VERSION = '0.0.1';
|
|
2
|
+
export { listProjectsTool, findProjectTool } from './projects/index.js';
|
|
3
|
+
export { listProjectTasksTool, createTaskTool, updateTaskStatusTool } from './tasks/index.js';
|
|
4
|
+
export { saveNoteTool } from './notes/index.js';
|
|
5
|
+
import { listProjectsTool, findProjectTool } from './projects/index.js';
|
|
6
|
+
import { listProjectTasksTool, createTaskTool, updateTaskStatusTool } from './tasks/index.js';
|
|
7
|
+
import { saveNoteTool } from './notes/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Convenience: every CRUD tool in this package. Pass to the host adapter:
|
|
10
|
+
*
|
|
11
|
+
* import { allCrudTools } from '@48nauts/tools-crud'
|
|
12
|
+
* import { toOpenAiFunctions, runOpenAiTool } from '@48nauts/agent-core'
|
|
13
|
+
*
|
|
14
|
+
* const openaiTools = toOpenAiFunctions(allCrudTools)
|
|
15
|
+
* // ... later, when the model calls one:
|
|
16
|
+
* await runOpenAiTool(allCrudTools, name, args, { extras: { db } })
|
|
17
|
+
*/
|
|
18
|
+
export const allCrudTools = [
|
|
19
|
+
listProjectsTool,
|
|
20
|
+
findProjectTool,
|
|
21
|
+
listProjectTasksTool,
|
|
22
|
+
createTaskTool,
|
|
23
|
+
updateTaskStatusTool,
|
|
24
|
+
saveNoteTool,
|
|
25
|
+
];
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA;AAE9B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAG/C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,gBAAgB;IAChB,eAAe;IACf,oBAAoB;IACpB,cAAc;IACd,oBAAoB;IACpB,YAAY;CACb,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ToolDef } from '@48nauts/agent-core';
|
|
2
|
+
declare const SaveNoteParams: import("@sinclair/typebox").TObject<{
|
|
3
|
+
projectId: import("@sinclair/typebox").TString;
|
|
4
|
+
title: import("@sinclair/typebox").TString;
|
|
5
|
+
content: import("@sinclair/typebox").TString;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const saveNoteTool: ToolDef<typeof SaveNoteParams>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=save-note.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-note.d.ts","sourceRoot":"","sources":["../../src/notes/save-note.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAG7D,QAAA,MAAM,cAAc;;;;EAIlB,CAAA;AAEF,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,OAAO,cAAc,CAevD,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { requireDb } from '@48nauts/agent-core';
|
|
2
|
+
import { Type } from '@sinclair/typebox';
|
|
3
|
+
const SaveNoteParams = Type.Object({
|
|
4
|
+
projectId: Type.String({ description: 'UUID of the project to attach the note to.' }),
|
|
5
|
+
title: Type.String({ description: 'Short note title.' }),
|
|
6
|
+
content: Type.String({ description: 'Note body (plain text or markdown).' }),
|
|
7
|
+
});
|
|
8
|
+
export const saveNoteTool = {
|
|
9
|
+
name: 'save_note',
|
|
10
|
+
label: 'Save Note',
|
|
11
|
+
description: 'Persist a note against a project. Use when the user wants something remembered: a decision, a call summary, a research finding.',
|
|
12
|
+
params: SaveNoteParams,
|
|
13
|
+
tags: ['crud', 'notes', 'write'],
|
|
14
|
+
async execute(params, ctx) {
|
|
15
|
+
const db = requireDb(ctx);
|
|
16
|
+
return db.notes.create({
|
|
17
|
+
projectId: params.projectId,
|
|
18
|
+
title: params.title,
|
|
19
|
+
content: params.content,
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=save-note.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-note.js","sourceRoot":"","sources":["../../src/notes/save-note.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;IACrF,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACxD,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;CAC7E,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,YAAY,GAAmC;IAC1D,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,WAAW;IAClB,WAAW,EACT,iIAAiI;IACnI,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;IAChC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QACzB,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ToolDef } from '@48nauts/agent-core';
|
|
2
|
+
declare const FindProjectParams: import("@sinclair/typebox").TObject<{
|
|
3
|
+
query: import("@sinclair/typebox").TString;
|
|
4
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const findProjectTool: ToolDef<typeof FindProjectParams>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=find-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-project.d.ts","sourceRoot":"","sources":["../../src/projects/find-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAG7D,QAAA,MAAM,iBAAiB;;;EAWrB,CAAA;AAEF,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,OAAO,iBAAiB,CAW7D,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { requireDb } from '@48nauts/agent-core';
|
|
2
|
+
import { Type } from '@sinclair/typebox';
|
|
3
|
+
const FindProjectParams = Type.Object({
|
|
4
|
+
query: Type.String({
|
|
5
|
+
description: "A name fragment to search for, e.g. 'Stablecoin' or 'Müller'.",
|
|
6
|
+
}),
|
|
7
|
+
limit: Type.Optional(Type.Integer({
|
|
8
|
+
description: 'Max number of matches to return. Defaults to 5.',
|
|
9
|
+
minimum: 1,
|
|
10
|
+
maximum: 50,
|
|
11
|
+
})),
|
|
12
|
+
});
|
|
13
|
+
export const findProjectTool = {
|
|
14
|
+
name: 'find_project',
|
|
15
|
+
label: 'Find Project',
|
|
16
|
+
description: 'Fuzzy-search projects by name. Use when the user mentions a specific project, mandate, client, or matter by name. Returns up to 5 matches with id, name, description.',
|
|
17
|
+
params: FindProjectParams,
|
|
18
|
+
tags: ['crud', 'projects'],
|
|
19
|
+
async execute(params, ctx) {
|
|
20
|
+
const db = requireDb(ctx);
|
|
21
|
+
return db.projects.search(params.query, params.limit ?? 5);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=find-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-project.js","sourceRoot":"","sources":["../../src/projects/find-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,+DAA+D;KAC7E,CAAC;IACF,KAAK,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,OAAO,CAAC;QACX,WAAW,EAAE,iDAAiD;QAC9D,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,EAAE;KACZ,CAAC,CACH;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAsC;IAChE,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,cAAc;IACrB,WAAW,EACT,uKAAuK;IACzK,MAAM,EAAE,iBAAiB;IACzB,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;IAC1B,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QACzB,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,CAAA;IAC5D,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/projects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/projects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-projects.d.ts","sourceRoot":"","sources":["../../src/projects/list-projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAG7D,QAAA,MAAM,kBAAkB,yCAAkB,CAAA;AAE1C,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,OAAO,kBAAkB,CAW/D,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { requireDb } from '@48nauts/agent-core';
|
|
2
|
+
import { Type } from '@sinclair/typebox';
|
|
3
|
+
const ListProjectsParams = Type.Object({});
|
|
4
|
+
export const listProjectsTool = {
|
|
5
|
+
name: 'list_projects',
|
|
6
|
+
label: 'List Projects',
|
|
7
|
+
description: "List all projects. Use when the user asks about their workload, which projects exist, or anything overview-level. Returns id, name, description, timestamps for each. Cheap — call freely.",
|
|
8
|
+
params: ListProjectsParams,
|
|
9
|
+
tags: ['crud', 'projects'],
|
|
10
|
+
async execute(_params, ctx) {
|
|
11
|
+
const db = requireDb(ctx);
|
|
12
|
+
return db.projects.list();
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=list-projects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-projects.js","sourceRoot":"","sources":["../../src/projects/list-projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAuC;IAClE,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,4LAA4L;IAC9L,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;IAC1B,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG;QACxB,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QACzB,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC3B,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ToolDef } from '@48nauts/agent-core';
|
|
2
|
+
declare const CreateTaskParams: import("@sinclair/typebox").TObject<{
|
|
3
|
+
projectId: import("@sinclair/typebox").TString;
|
|
4
|
+
title: import("@sinclair/typebox").TString;
|
|
5
|
+
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
|
+
status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"todo">, import("@sinclair/typebox").TLiteral<"in_progress">, import("@sinclair/typebox").TLiteral<"blocked">, import("@sinclair/typebox").TLiteral<"done">]>>;
|
|
7
|
+
priority: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"low">, import("@sinclair/typebox").TLiteral<"medium">, import("@sinclair/typebox").TLiteral<"high">]>>;
|
|
8
|
+
dueDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const createTaskTool: ToolDef<typeof CreateTaskParams>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=create-task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-task.d.ts","sourceRoot":"","sources":["../../src/tasks/create-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAgB7D,QAAA,MAAM,gBAAgB;;;;;;;EAWpB,CAAA;AAEF,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,OAAO,gBAAgB,CAkB3D,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { requireDb } from '@48nauts/agent-core';
|
|
2
|
+
import { Type } from '@sinclair/typebox';
|
|
3
|
+
const TaskStatusSchema = Type.Union([
|
|
4
|
+
Type.Literal('todo'),
|
|
5
|
+
Type.Literal('in_progress'),
|
|
6
|
+
Type.Literal('blocked'),
|
|
7
|
+
Type.Literal('done'),
|
|
8
|
+
]);
|
|
9
|
+
const TaskPrioritySchema = Type.Union([
|
|
10
|
+
Type.Literal('low'),
|
|
11
|
+
Type.Literal('medium'),
|
|
12
|
+
Type.Literal('high'),
|
|
13
|
+
]);
|
|
14
|
+
const CreateTaskParams = Type.Object({
|
|
15
|
+
projectId: Type.String({ description: 'UUID of the parent project.' }),
|
|
16
|
+
title: Type.String({ description: 'Short imperative task title.' }),
|
|
17
|
+
description: Type.Optional(Type.String({ description: 'Longer description / acceptance criteria.' })),
|
|
18
|
+
status: Type.Optional(TaskStatusSchema),
|
|
19
|
+
priority: Type.Optional(TaskPrioritySchema),
|
|
20
|
+
dueDate: Type.Optional(Type.String({ description: 'ISO date (YYYY-MM-DD) when the task is due.' })),
|
|
21
|
+
});
|
|
22
|
+
export const createTaskTool = {
|
|
23
|
+
name: 'create_task',
|
|
24
|
+
label: 'Create Task',
|
|
25
|
+
description: 'Create a new task on a project. Use when the user asks to add a to-do, follow-up, or action item. Always tie to a projectId — call find_project first if the user named the project.',
|
|
26
|
+
params: CreateTaskParams,
|
|
27
|
+
tags: ['crud', 'tasks', 'write'],
|
|
28
|
+
async execute(params, ctx) {
|
|
29
|
+
const db = requireDb(ctx);
|
|
30
|
+
return db.tasks.create({
|
|
31
|
+
projectId: params.projectId,
|
|
32
|
+
title: params.title,
|
|
33
|
+
description: params.description ?? '',
|
|
34
|
+
status: params.status ?? 'todo',
|
|
35
|
+
priority: params.priority ?? 'medium',
|
|
36
|
+
dueDate: params.dueDate,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=create-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-task.js","sourceRoot":"","sources":["../../src/tasks/create-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC;IAClC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACpB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IAC3B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;CACrB,CAAC,CAAA;AAEF,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IACnB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACtB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;CACrB,CAAC,CAAA;AAEF,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IACtE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IACnE,WAAW,EAAE,IAAI,CAAC,QAAQ,CACxB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,2CAA2C,EAAE,CAAC,CAC1E;IACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAC3C,OAAO,EAAE,IAAI,CAAC,QAAQ,CACpB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC,CAC5E;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,cAAc,GAAqC;IAC9D,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,aAAa;IACpB,WAAW,EACT,sLAAsL;IACxL,MAAM,EAAE,gBAAgB;IACxB,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;IAChC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QACzB,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,MAAM;YAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,QAAQ;YACrC,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ToolDef } from '@48nauts/agent-core';
|
|
2
|
+
declare const ListProjectTasksParams: import("@sinclair/typebox").TObject<{
|
|
3
|
+
projectId: import("@sinclair/typebox").TString;
|
|
4
|
+
status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"todo">, import("@sinclair/typebox").TLiteral<"in_progress">, import("@sinclair/typebox").TLiteral<"blocked">, import("@sinclair/typebox").TLiteral<"done">]>>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const listProjectTasksTool: ToolDef<typeof ListProjectTasksParams>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=list-project-tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-project-tasks.d.ts","sourceRoot":"","sources":["../../src/tasks/list-project-tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAU7D,QAAA,MAAM,sBAAsB;;;EAG1B,CAAA;AAEF,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,OAAO,sBAAsB,CAcvE,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { requireDb } from '@48nauts/agent-core';
|
|
2
|
+
import { Type } from '@sinclair/typebox';
|
|
3
|
+
const TaskStatusSchema = Type.Union([
|
|
4
|
+
Type.Literal('todo'),
|
|
5
|
+
Type.Literal('in_progress'),
|
|
6
|
+
Type.Literal('blocked'),
|
|
7
|
+
Type.Literal('done'),
|
|
8
|
+
]);
|
|
9
|
+
const ListProjectTasksParams = Type.Object({
|
|
10
|
+
projectId: Type.String({ description: 'UUID of the project to list tasks for.' }),
|
|
11
|
+
status: Type.Optional(TaskStatusSchema),
|
|
12
|
+
});
|
|
13
|
+
export const listProjectTasksTool = {
|
|
14
|
+
name: 'list_project_tasks',
|
|
15
|
+
label: 'List Project Tasks',
|
|
16
|
+
description: "List tasks for a project, optionally filtered by status. Use when the user asks 'what's on the to-do list' or 'what's still open' for a mandate.",
|
|
17
|
+
params: ListProjectTasksParams,
|
|
18
|
+
tags: ['crud', 'tasks'],
|
|
19
|
+
async execute(params, ctx) {
|
|
20
|
+
const db = requireDb(ctx);
|
|
21
|
+
return db.tasks.listByProject(params.projectId, params.status ? { status: params.status } : undefined);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=list-project-tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-project-tasks.js","sourceRoot":"","sources":["../../src/tasks/list-project-tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC;IAClC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACpB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IAC3B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;CACrB,CAAC,CAAA;AAEF,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IACjF,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;CACxC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAA2C;IAC1E,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,kJAAkJ;IACpJ,MAAM,EAAE,sBAAsB;IAC9B,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QACzB,OAAO,EAAE,CAAC,KAAK,CAAC,aAAa,CAC3B,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CACtD,CAAA;IACH,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ToolDef } from '@48nauts/agent-core';
|
|
2
|
+
declare const UpdateTaskStatusParams: import("@sinclair/typebox").TObject<{
|
|
3
|
+
taskId: import("@sinclair/typebox").TString;
|
|
4
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"todo">, import("@sinclair/typebox").TLiteral<"in_progress">, import("@sinclair/typebox").TLiteral<"blocked">, import("@sinclair/typebox").TLiteral<"done">]>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const updateTaskStatusTool: ToolDef<typeof UpdateTaskStatusParams>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=update-task-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-task-status.d.ts","sourceRoot":"","sources":["../../src/tasks/update-task-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAU7D,QAAA,MAAM,sBAAsB;;;EAG1B,CAAA;AAEF,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,OAAO,sBAAsB,CAWvE,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { requireDb } from '@48nauts/agent-core';
|
|
2
|
+
import { Type } from '@sinclair/typebox';
|
|
3
|
+
const TaskStatusSchema = Type.Union([
|
|
4
|
+
Type.Literal('todo'),
|
|
5
|
+
Type.Literal('in_progress'),
|
|
6
|
+
Type.Literal('blocked'),
|
|
7
|
+
Type.Literal('done'),
|
|
8
|
+
]);
|
|
9
|
+
const UpdateTaskStatusParams = Type.Object({
|
|
10
|
+
taskId: Type.String({ description: 'UUID of the task to update.' }),
|
|
11
|
+
status: TaskStatusSchema,
|
|
12
|
+
});
|
|
13
|
+
export const updateTaskStatusTool = {
|
|
14
|
+
name: 'update_task_status',
|
|
15
|
+
label: 'Update Task Status',
|
|
16
|
+
description: "Change a task's status. Use when the user says they finished, started, or got blocked on a task.",
|
|
17
|
+
params: UpdateTaskStatusParams,
|
|
18
|
+
tags: ['crud', 'tasks', 'write'],
|
|
19
|
+
async execute(params, ctx) {
|
|
20
|
+
const db = requireDb(ctx);
|
|
21
|
+
return db.tasks.update(params.taskId, { status: params.status });
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=update-task-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-task-status.js","sourceRoot":"","sources":["../../src/tasks/update-task-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC;IAClC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACpB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IAC3B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;CACrB,CAAC,CAAA;AAEF,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IACnE,MAAM,EAAE,gBAAgB;CACzB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAA2C;IAC1E,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,kGAAkG;IACpG,MAAM,EAAE,sBAAsB;IAC9B,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;IAChC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QACzB,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;IAClE,CAAC;CACF,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@48nauts/tools-crud",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "DB-tier CRUD tools (projects, tasks, notes) as neutral ToolDefs. Parameterized by DbAdapter.",
|
|
5
|
+
"license": "AGPL-3.0-or-later",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@sinclair/typebox": "^0.34.0",
|
|
17
|
+
"@48nauts/agent-core": "0.1.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.5.0"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"build": "tsc"
|
|
31
|
+
}
|
|
32
|
+
}
|