@elizaos/plugin-documents 2.0.11-beta.7

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -0
  3. package/package.json +83 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shaw Walters and elizaOS Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # @elizaos/plugin-documents
2
+
3
+ Adds a document management REST API to an elizaOS agent.
4
+
5
+ ## What it does
6
+
7
+ This plugin registers HTTP routes on the agent server that let clients (the dashboard UI, other agents, and external tools) upload, retrieve, search, edit, and delete documents from the agent's document store.
8
+
9
+ Documents are stored as memories in the runtime's `documents` table and chunked into fragments in the `document_fragments` table for vector/semantic search. The plugin handles:
10
+
11
+ - Uploading text files, markdown, JSON, CSV, images, and other content types
12
+ - Fetching and ingesting content from arbitrary URLs or YouTube transcripts
13
+ - Bulk uploading up to 100 documents in a single request
14
+ - Semantic, keyword, and hybrid search across document fragments
15
+ - Listing fragments for a document (ordered by position)
16
+ - Editing text-backed documents (replaces content and re-fragments)
17
+ - Deleting documents and their fragments
18
+ - Access control: `global`, `owner-private`, `user-private`, and `agent-private` document scopes
19
+
20
+ ## Routes
21
+
22
+ | Method | Path | Description |
23
+ |--------|------|-------------|
24
+ | GET | `/api/documents` | List documents; supports `scope`, `addedBy`, `tags`, `timeRangeStart/End`, `q` query, `limit`, `offset` |
25
+ | GET | `/api/documents/stats` | Document and fragment counts |
26
+ | GET | `/api/documents/search` | Semantic/keyword/hybrid search; params: `q`, `threshold`, `limit`, `searchMode` |
27
+ | GET | `/api/documents/:id` | Fetch a document with full content |
28
+ | GET | `/api/documents/:id/fragments` | List all text fragments ordered by position |
29
+ | POST | `/api/documents` | Upload a document: `{ content, filename, contentType?, metadata?, scope?, ... }` |
30
+ | POST | `/api/documents/bulk` | Upload up to 100 documents at once |
31
+ | POST | `/api/documents/url` | Ingest a URL or YouTube transcript: `{ url, scope?, metadata? }` |
32
+ | PATCH | `/api/documents/:id` | Update document text (only for non-bundled, non-character, text-backed documents) |
33
+ | DELETE | `/api/documents/:id` | Delete document and all its fragments |
34
+
35
+ ## Document scopes
36
+
37
+ | Scope | Who can read/write |
38
+ |-------|--------------------|
39
+ | `global` | Anyone; only OWNER/RUNTIME can write |
40
+ | `owner-private` | OWNER and RUNTIME only |
41
+ | `user-private` | Scoped to a specific user entity |
42
+ | `agent-private` | OWNER, AGENT, and RUNTIME |
43
+
44
+ The caller's role is resolved from the `x-eliza-entity-id` / `x-eliza-actor-entity-id` request headers and the `ELIZA_ADMIN_ENTITY_ID` runtime setting.
45
+
46
+ ## Configuration
47
+
48
+ No additional environment variables are required beyond those needed by the document storage service (`@elizaos/agent`). The plugin uses `ELIZA_ADMIN_ENTITY_ID` (read from the agent runtime settings) to identify the owner actor for access control decisions.
49
+
50
+ ## Enabling the plugin
51
+
52
+ Add `@elizaos/plugin-documents` to the agent's plugin list in the character configuration or register it programmatically:
53
+
54
+ ```typescript
55
+ import { documentsPlugin } from "@elizaos/plugin-documents";
56
+
57
+ const character = {
58
+ plugins: ["@elizaos/plugin-documents"],
59
+ // ...
60
+ };
61
+ ```
62
+
63
+ ## Limitations
64
+
65
+ - Image uploads are converted to text descriptions when `includeImageDescriptions: true` is set in metadata (requires a vision model). Without a generated description, the stored text explicitly records that text extraction or image description was unavailable.
66
+ - Bundled documents (seeded by the runtime) and character documents (from character source files) cannot be edited or deleted through this API.
67
+ - Bulk upload is capped at 100 documents per request; individual upload bodies are capped at 32 MB.
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@elizaos/plugin-documents",
3
+ "version": "2.0.11-beta.7",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "exports": {
7
+ "./package.json": "./package.json",
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "eliza-source": {
11
+ "types": "./src/index.ts",
12
+ "import": "./src/index.ts",
13
+ "default": "./src/index.ts"
14
+ },
15
+ "import": "./dist/index.js",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "./plugin": {
19
+ "types": "./dist/plugin.d.ts",
20
+ "import": "./dist/plugin.js",
21
+ "default": "./dist/plugin.js"
22
+ },
23
+ "./*.css": "./dist/*.css",
24
+ "./*": {
25
+ "types": "./dist/*.d.ts",
26
+ "eliza-source": {
27
+ "types": "./src/*.ts",
28
+ "import": "./src/*.ts",
29
+ "default": "./src/*.ts"
30
+ },
31
+ "import": "./dist/*.js",
32
+ "default": "./dist/*.js"
33
+ }
34
+ },
35
+ "dependencies": {
36
+ "@elizaos/agent": "2.0.11-beta.7",
37
+ "@elizaos/app-core": "2.0.11-beta.7",
38
+ "@elizaos/core": "2.0.11-beta.7",
39
+ "@elizaos/shared": "2.0.11-beta.7",
40
+ "@elizaos/ui": "2.0.11-beta.7",
41
+ "lucide-react": "^1.0.0"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "^19.0.0",
45
+ "react-dom": "^19.0.0"
46
+ },
47
+ "agentConfig": {
48
+ "pluginType": "elizaos:plugin:1.0.0",
49
+ "pluginParameters": {}
50
+ },
51
+ "elizaos": {
52
+ "app": {
53
+ "heroImage": "assets/hero.png"
54
+ }
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "types": "./dist/index.d.ts",
60
+ "scripts": {
61
+ "build": "bun run build:js && bun run build:views && bun run build:types",
62
+ "clean": "rm -rf dist",
63
+ "build:js": "tsup --config ../tsup.plugin-packages.shared.ts",
64
+ "build:views": "bunx --bun vite build --config vite.config.views.ts",
65
+ "build:types": "tsc --noCheck -p tsconfig.build.json",
66
+ "test": "vitest run --config ./vitest.config.ts",
67
+ "test:e2e:manual": "vitest run --config ../../vitest.config.ts test/*.live.e2e.test.ts"
68
+ },
69
+ "files": [
70
+ "dist"
71
+ ],
72
+ "devDependencies": {
73
+ "@types/node": "^25.0.6",
74
+ "@types/react": "^19.0.0",
75
+ "@types/react-dom": "^19.0.0",
76
+ "react": "^19.0.0",
77
+ "react-dom": "^19.0.0",
78
+ "tsup": "^8.5.1",
79
+ "typescript": "^6.0.3",
80
+ "vite": "^8.0.0"
81
+ },
82
+ "gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
83
+ }