strapi-plugin-ai-sdk 0.7.7 → 0.8.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.
Files changed (32) hide show
  1. package/dist/_chunks/{App-joEmdpxi.js → App-DTbAnq7K.js} +710 -51
  2. package/dist/_chunks/{App-DMdQymB3.mjs → App-DZVBmpvs.mjs} +712 -53
  3. package/dist/_chunks/{index-B7qLITWV.js → index-C3xn2IND.js} +1 -1
  4. package/dist/_chunks/{index-DrLcqX__.mjs → index-Ca2F2wBp.mjs} +1 -1
  5. package/dist/admin/index.js +1 -1
  6. package/dist/admin/index.mjs +1 -1
  7. package/dist/admin/src/components/NotePanel.d.ts +15 -0
  8. package/dist/admin/src/hooks/useNotes.d.ts +22 -0
  9. package/dist/admin/src/pages/NoteStorePage.d.ts +2 -0
  10. package/dist/admin/src/utils/notes-api.d.ts +28 -0
  11. package/dist/server/index.js +536 -121
  12. package/dist/server/index.mjs +536 -121
  13. package/dist/server/src/content-types/index.d.ts +46 -0
  14. package/dist/server/src/content-types/note/index.d.ts +47 -0
  15. package/dist/server/src/controllers/index.d.ts +9 -0
  16. package/dist/server/src/controllers/note.d.ts +12 -0
  17. package/dist/server/src/index.d.ts +55 -0
  18. package/dist/server/src/lib/trim-messages.d.ts +11 -0
  19. package/dist/server/src/mcp/resources/tool-guide.d.ts +5 -0
  20. package/dist/server/src/tool-logic/aggregate-content.d.ts +1 -1
  21. package/dist/server/src/tool-logic/create-content.d.ts +1 -1
  22. package/dist/server/src/tool-logic/find-one-content.d.ts +1 -1
  23. package/dist/server/src/tool-logic/index.d.ts +4 -0
  24. package/dist/server/src/tool-logic/list-content-types.d.ts +1 -1
  25. package/dist/server/src/tool-logic/manage-task.d.ts +1 -1
  26. package/dist/server/src/tool-logic/recall-notes.d.ts +22 -0
  27. package/dist/server/src/tool-logic/save-note.d.ts +17 -0
  28. package/dist/server/src/tool-logic/update-content.d.ts +1 -1
  29. package/dist/server/src/tool-logic/upload-media.d.ts +1 -1
  30. package/dist/server/src/tools/definitions/recall-notes.d.ts +2 -0
  31. package/dist/server/src/tools/definitions/save-note.d.ts +2 -0
  32. package/package.json +1 -1
@@ -168,5 +168,51 @@ declare const _default: {
168
168
  };
169
169
  };
170
170
  };
171
+ note: {
172
+ schema: {
173
+ kind: string;
174
+ collectionName: string;
175
+ info: {
176
+ singularName: string;
177
+ pluralName: string;
178
+ displayName: string;
179
+ };
180
+ options: {
181
+ draftAndPublish: boolean;
182
+ };
183
+ pluginOptions: {
184
+ "content-manager": {
185
+ visible: boolean;
186
+ };
187
+ "content-type-builder": {
188
+ visible: boolean;
189
+ };
190
+ };
191
+ attributes: {
192
+ title: {
193
+ type: string;
194
+ };
195
+ content: {
196
+ type: string;
197
+ required: boolean;
198
+ };
199
+ category: {
200
+ type: string;
201
+ enum: string[];
202
+ default: string;
203
+ };
204
+ tags: {
205
+ type: string;
206
+ };
207
+ source: {
208
+ type: string;
209
+ };
210
+ adminUserId: {
211
+ type: string;
212
+ required: boolean;
213
+ };
214
+ };
215
+ };
216
+ };
171
217
  };
172
218
  export default _default;
@@ -0,0 +1,47 @@
1
+ declare const _default: {
2
+ schema: {
3
+ kind: string;
4
+ collectionName: string;
5
+ info: {
6
+ singularName: string;
7
+ pluralName: string;
8
+ displayName: string;
9
+ };
10
+ options: {
11
+ draftAndPublish: boolean;
12
+ };
13
+ pluginOptions: {
14
+ "content-manager": {
15
+ visible: boolean;
16
+ };
17
+ "content-type-builder": {
18
+ visible: boolean;
19
+ };
20
+ };
21
+ attributes: {
22
+ title: {
23
+ type: string;
24
+ };
25
+ content: {
26
+ type: string;
27
+ required: boolean;
28
+ };
29
+ category: {
30
+ type: string;
31
+ enum: string[];
32
+ default: string;
33
+ };
34
+ tags: {
35
+ type: string;
36
+ };
37
+ source: {
38
+ type: string;
39
+ };
40
+ adminUserId: {
41
+ type: string;
42
+ required: boolean;
43
+ };
44
+ };
45
+ };
46
+ };
47
+ export default _default;
@@ -48,5 +48,14 @@ declare const _default: {
48
48
  update(ctx: import("koa").Context): Promise<void>;
49
49
  delete(ctx: import("koa").Context): Promise<void>;
50
50
  };
51
+ note: ({ strapi }: {
52
+ strapi: import("@strapi/types/dist/core").Strapi;
53
+ }) => {
54
+ find(ctx: import("koa").Context): Promise<void>;
55
+ create(ctx: import("koa").Context): Promise<void>;
56
+ update(ctx: import("koa").Context): Promise<void>;
57
+ delete(ctx: import("koa").Context): Promise<void>;
58
+ clearAll(ctx: import("koa").Context): Promise<void>;
59
+ };
51
60
  };
52
61
  export default _default;
@@ -0,0 +1,12 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ import type { Context } from 'koa';
3
+ declare const noteController: ({ strapi }: {
4
+ strapi: Core.Strapi;
5
+ }) => {
6
+ find(ctx: Context): Promise<void>;
7
+ create(ctx: Context): Promise<void>;
8
+ update(ctx: Context): Promise<void>;
9
+ delete(ctx: Context): Promise<void>;
10
+ clearAll(ctx: Context): Promise<void>;
11
+ };
12
+ export default noteController;
@@ -86,6 +86,15 @@ declare const _default: {
86
86
  update(ctx: import("koa").Context): Promise<void>;
87
87
  delete(ctx: import("koa").Context): Promise<void>;
88
88
  };
89
+ note: ({ strapi }: {
90
+ strapi: import("@strapi/types/dist/core").Strapi;
91
+ }) => {
92
+ find(ctx: import("koa").Context): Promise<void>;
93
+ create(ctx: import("koa").Context): Promise<void>;
94
+ update(ctx: import("koa").Context): Promise<void>;
95
+ delete(ctx: import("koa").Context): Promise<void>;
96
+ clearAll(ctx: import("koa").Context): Promise<void>;
97
+ };
89
98
  };
90
99
  routes: {
91
100
  'content-api': {
@@ -323,6 +332,52 @@ declare const _default: {
323
332
  };
324
333
  };
325
334
  };
335
+ note: {
336
+ schema: {
337
+ kind: string;
338
+ collectionName: string;
339
+ info: {
340
+ singularName: string;
341
+ pluralName: string;
342
+ displayName: string;
343
+ };
344
+ options: {
345
+ draftAndPublish: boolean;
346
+ };
347
+ pluginOptions: {
348
+ "content-manager": {
349
+ visible: boolean;
350
+ };
351
+ "content-type-builder": {
352
+ visible: boolean;
353
+ };
354
+ };
355
+ attributes: {
356
+ title: {
357
+ type: string;
358
+ };
359
+ content: {
360
+ type: string;
361
+ required: boolean;
362
+ };
363
+ category: {
364
+ type: string;
365
+ enum: string[];
366
+ default: string;
367
+ };
368
+ tags: {
369
+ type: string;
370
+ };
371
+ source: {
372
+ type: string;
373
+ };
374
+ adminUserId: {
375
+ type: string;
376
+ required: boolean;
377
+ };
378
+ };
379
+ };
380
+ };
326
381
  };
327
382
  policies: {};
328
383
  middlewares: {
@@ -0,0 +1,11 @@
1
+ import type { UIMessage } from 'ai';
2
+ /**
3
+ * Trim messages to a max count while keeping tool call/result pairs intact.
4
+ *
5
+ * When slicing from the end, the first remaining message might be an assistant
6
+ * message with tool invocations whose results lived in earlier (now-dropped)
7
+ * messages. The AI SDK throws MissingToolResultsError if it encounters an
8
+ * unmatched tool call. This function drops leading assistant messages that
9
+ * contain tool invocations to prevent that.
10
+ */
11
+ export declare function trimMessages(messages: UIMessage[], max: number): UIMessage[];
@@ -0,0 +1,5 @@
1
+ import type { ToolRegistry } from '../../lib/tool-registry';
2
+ /**
3
+ * Generate the complete tool guide markdown from the registry.
4
+ */
5
+ export declare function generateToolGuide(registry: ToolRegistry): string;
@@ -23,7 +23,7 @@ export declare const aggregateContentSchema: z.ZodObject<{
23
23
  }>>;
24
24
  locale: z.ZodOptional<z.ZodString>;
25
25
  }, z.core.$strip>;
26
- export declare const aggregateContentDescription = "Aggregate and count content entries. Use for analytics questions like \"how many articles per category\", \"content trends by month\", or total counts with filters. Prefer this over searchContent for counting and grouping.";
26
+ export declare const aggregateContentDescription = "Count and group content entries for analytics. Answers questions like \"how many articles?\", \"posts per category\", \"content published by month\". Three operations: count (total), countByField (group by a field), countByDateRange (bucket by day/week/month). Prefer this over searchContent when you need counts or distributions, not the documents themselves.";
27
27
  export interface AggregateContentParams {
28
28
  contentType: string;
29
29
  operation: 'count' | 'countByField' | 'countByDateRange';
@@ -9,7 +9,7 @@ export declare const createContentSchema: z.ZodObject<{
9
9
  }>>;
10
10
  locale: z.ZodOptional<z.ZodString>;
11
11
  }, z.core.$strip>;
12
- export declare const createContentDescription = "Create a new document in any Strapi content type (articles, blog posts, pages, etc.). Use listContentTypes first to discover available content types and their fields.";
12
+ export declare const createContentDescription = "Create a new document in any Strapi content type. Requires contentType (UID) and data (field values). Call listContentTypes first to discover UIDs and required fields. To attach media, upload it first with uploadMedia, then pass the file ID in data. Returns the created document with all fields populated.";
13
13
  export interface CreateContentParams {
14
14
  contentType: string;
15
15
  data: Record<string, unknown>;
@@ -11,7 +11,7 @@ export declare const findOneContentSchema: z.ZodObject<{
11
11
  }>>;
12
12
  locale: z.ZodOptional<z.ZodString>;
13
13
  }, z.core.$strip>;
14
- export declare const findOneContentDescription = "Fetch a single document by its documentId from any Strapi content type. Returns the full document with all fields and populated relations. Use searchContent first to discover document IDs.";
14
+ export declare const findOneContentDescription = "Fetch a single document by its exact documentId. Use this when you already have a documentId and need full details with populated relations. If you need to find documents by title, field values, or full-text search, use searchContent instead. Requires contentType and documentId.";
15
15
  export interface FindOneContentParams {
16
16
  contentType: string;
17
17
  documentId: string;
@@ -22,5 +22,9 @@ export { aggregateContent, aggregateContentSchema, aggregateContentDescription }
22
22
  export type { AggregateContentParams, AggregateContentResult } from './aggregate-content';
23
23
  export { manageTask, manageTaskSchema, manageTaskDescription } from './manage-task';
24
24
  export type { ManageTaskParams, ManageTaskResult } from './manage-task';
25
+ export { saveNote, saveNoteSchema, saveNoteDescription } from './save-note';
26
+ export type { SaveNoteParams, SaveNoteResult } from './save-note';
27
+ export { recallNotes, recallNotesSchema, recallNotesDescription } from './recall-notes';
28
+ export type { RecallNotesParams, RecallNotesResult } from './recall-notes';
25
29
  export { resolveFieldPath, getDisplayField, isRelation, getRelationTarget, getSchema } from './schema-utils';
26
30
  export type { ResolvedField } from './schema-utils';
@@ -1,7 +1,7 @@
1
1
  import type { Core } from '@strapi/strapi';
2
2
  import { z } from 'zod';
3
3
  export declare const listContentTypesSchema: z.ZodObject<{}, z.core.$strip>;
4
- export declare const listContentTypesDescription = "List all Strapi content types and components with their fields, relations, and structure.";
4
+ export declare const listContentTypesDescription = "List all Strapi content types and components with their fields, relations, and structure. This is the starting point for any content operation \u2014 call it first to discover content type UIDs (e.g. \"api::article.article\"), field names, relation targets, and components. No parameters required. Results are cached.";
5
5
  export interface RelationSummary {
6
6
  field: string;
7
7
  type: string;
@@ -25,7 +25,7 @@ export declare const manageTaskSchema: z.ZodObject<{
25
25
  done: z.ZodOptional<z.ZodBoolean>;
26
26
  filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
27
  }, z.core.$strip>;
28
- export declare const manageTaskDescription = "Manage the user's task list. Create, update, complete, list, or summarize tasks. Tasks are scored by consequence \u00D7 impact to help prioritize what matters most.";
28
+ export declare const manageTaskDescription = "Manage the user's task list. Actions: create (new task), update (modify fields), complete (mark done), list (open tasks sorted by priority score), summary (overview with overdue/urgent counts). Tasks are scored by consequence \u00D7 impact to prioritize what matters most. For create: title is required; consequence and impact are collected via UI form if omitted.";
29
29
  export type ManageTaskParams = z.infer<typeof manageTaskSchema>;
30
30
  export interface ManageTaskResult {
31
31
  success: boolean;
@@ -0,0 +1,22 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ import { z } from 'zod';
3
+ import type { ToolContext } from '../lib/tool-registry';
4
+ export declare const recallNotesSchema: z.ZodObject<{
5
+ query: z.ZodOptional<z.ZodString>;
6
+ category: z.ZodOptional<z.ZodString>;
7
+ tag: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$strip>;
9
+ export declare const recallNotesDescription = "Recall saved research notes, snippets, ideas, and references. Use this to look up previously saved notes. Without parameters, returns all notes.";
10
+ export type RecallNotesParams = z.infer<typeof recallNotesSchema>;
11
+ export interface RecallNotesResult {
12
+ success: boolean;
13
+ notes: {
14
+ title: string;
15
+ content: string;
16
+ category: string;
17
+ tags: string;
18
+ source: string;
19
+ }[];
20
+ count: number;
21
+ }
22
+ export declare function recallNotes(strapi: Core.Strapi, params: RecallNotesParams, context?: ToolContext): Promise<RecallNotesResult>;
@@ -0,0 +1,17 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ import { z } from 'zod';
3
+ import type { ToolContext } from '../lib/tool-registry';
4
+ export declare const saveNoteSchema: z.ZodObject<{
5
+ title: z.ZodOptional<z.ZodString>;
6
+ content: z.ZodString;
7
+ category: z.ZodOptional<z.ZodString>;
8
+ tags: z.ZodOptional<z.ZodString>;
9
+ source: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$strip>;
11
+ export declare const saveNoteDescription = "Save a research note, code snippet, idea, or reference for the user. Use this when the user wants to save part of a conversation, research findings, code examples, or any content they may want to use later for writing blog posts or articles. Content is saved as markdown.";
12
+ export type SaveNoteParams = z.infer<typeof saveNoteSchema>;
13
+ export interface SaveNoteResult {
14
+ success: boolean;
15
+ message: string;
16
+ }
17
+ export declare function saveNote(strapi: Core.Strapi, params: SaveNoteParams, context?: ToolContext): Promise<SaveNoteResult>;
@@ -10,7 +10,7 @@ export declare const updateContentSchema: z.ZodObject<{
10
10
  }>>;
11
11
  locale: z.ZodOptional<z.ZodString>;
12
12
  }, z.core.$strip>;
13
- export declare const updateContentDescription = "Update an existing document in any Strapi content type. Use searchContent to find the document ID first.";
13
+ export declare const updateContentDescription = "Update an existing document in any Strapi content type. Requires contentType, documentId, and data (fields to change \u2014 only include fields you want to modify). Typical workflow: searchContent to find the documentId, then updateContent to modify it. Returns the updated document.";
14
14
  export interface UpdateContentParams {
15
15
  contentType: string;
16
16
  documentId: string;
@@ -6,7 +6,7 @@ export declare const uploadMediaSchema: z.ZodObject<{
6
6
  caption: z.ZodOptional<z.ZodString>;
7
7
  alternativeText: z.ZodOptional<z.ZodString>;
8
8
  }, z.core.$strip>;
9
- export declare const uploadMediaDescription = "Upload a media file from a URL to the Strapi media library. Returns the uploaded file data. To link media to a content type field, use createContent or updateContent with the file ID.";
9
+ export declare const uploadMediaDescription = "Upload a media file from a URL to the Strapi media library. This is step 1 of a two-step process: (1) upload the file with this tool to get a file ID, then (2) link it to a content entry using createContent or updateContent with { fieldName: fileId }. Requires url. Optional: name, caption, alternativeText.";
10
10
  export interface UploadMediaParams {
11
11
  url: string;
12
12
  name?: string;
@@ -0,0 +1,2 @@
1
+ import type { ToolDefinition } from '../../lib/tool-registry';
2
+ export declare const recallNotesTool: ToolDefinition;
@@ -0,0 +1,2 @@
1
+ import type { ToolDefinition } from '../../lib/tool-registry';
2
+ export declare const saveNoteTool: ToolDefinition;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.7",
2
+ "version": "0.8.0",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",