@hasna/files 0.1.5 → 0.2.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 (56) hide show
  1. package/README.md +19 -117
  2. package/dashboard/dist/assets/{index-DBpbr5zm.css → index-CUqmYYsM.css} +1 -1
  3. package/dashboard/dist/index.html +2 -2
  4. package/dist/cli/index.js +6963 -15042
  5. package/dist/index.d.ts +156 -16
  6. package/dist/index.js +10698 -18592
  7. package/dist/mcp/index.js +47238 -42238
  8. package/dist/server/index.js +7084 -14988
  9. package/package.json +5 -5
  10. package/dist/cli/index.d.ts +0 -3
  11. package/dist/cli/index.d.ts.map +0 -1
  12. package/dist/db/collections.d.ts +0 -8
  13. package/dist/db/collections.d.ts.map +0 -1
  14. package/dist/db/database.d.ts +0 -5
  15. package/dist/db/database.d.ts.map +0 -1
  16. package/dist/db/files.d.ts +0 -12
  17. package/dist/db/files.d.ts.map +0 -1
  18. package/dist/db/machines.d.ts +0 -6
  19. package/dist/db/machines.d.ts.map +0 -1
  20. package/dist/db/peers.d.ts +0 -15
  21. package/dist/db/peers.d.ts.map +0 -1
  22. package/dist/db/pg-migrations.d.ts +0 -4
  23. package/dist/db/projects.d.ts +0 -8
  24. package/dist/db/projects.d.ts.map +0 -1
  25. package/dist/db/resolve.d.ts +0 -9
  26. package/dist/db/resolve.d.ts.map +0 -1
  27. package/dist/db/search.d.ts +0 -6
  28. package/dist/db/search.d.ts.map +0 -1
  29. package/dist/db/sources.d.ts +0 -17
  30. package/dist/db/sources.d.ts.map +0 -1
  31. package/dist/db/tags.d.ts +0 -8
  32. package/dist/db/tags.d.ts.map +0 -1
  33. package/dist/index.d.ts.map +0 -1
  34. package/dist/lib/config.d.ts +0 -13
  35. package/dist/lib/config.d.ts.map +0 -1
  36. package/dist/lib/hasher.d.ts +0 -3
  37. package/dist/lib/hasher.d.ts.map +0 -1
  38. package/dist/lib/ignore.d.ts +0 -11
  39. package/dist/lib/ignore.d.ts.map +0 -1
  40. package/dist/lib/indexer.d.ts +0 -3
  41. package/dist/lib/indexer.d.ts.map +0 -1
  42. package/dist/lib/s3.d.ts +0 -12
  43. package/dist/lib/s3.d.ts.map +0 -1
  44. package/dist/lib/sync.d.ts +0 -19
  45. package/dist/lib/sync.d.ts.map +0 -1
  46. package/dist/lib/watcher.d.ts +0 -5
  47. package/dist/lib/watcher.d.ts.map +0 -1
  48. package/dist/mcp/index.d.ts +0 -3
  49. package/dist/mcp/index.d.ts.map +0 -1
  50. package/dist/server/index.d.ts +0 -3
  51. package/dist/server/index.d.ts.map +0 -1
  52. package/dist/server/serve.d.ts +0 -2
  53. package/dist/server/serve.d.ts.map +0 -1
  54. package/dist/types/index.d.ts +0 -104
  55. package/dist/types/index.d.ts.map +0 -1
  56. /package/dashboard/dist/assets/{index-zazl9Rbx.js → index-D-sjqzQL.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,16 +1,156 @@
1
- export { getDb, DB_PATH } from "./db/database.js";
2
- export { PG_MIGRATIONS } from "./db/pg-migrations.js";
3
- export { getCurrentMachine, listMachines, getMachine, upsertMachine } from "./db/machines.js";
4
- export { createSource, getSource, listSources, updateSource, deleteSource, markSourceIndexed } from "./db/sources.js";
5
- export { upsertFile, getFile, listFiles, searchFiles as searchFilesDb, markFileDeleted, deleteFile, getFileByPath, refreshAllFts } from "./db/files.js";
6
- export { listTags, getOrCreateTag, deleteTag, tagFile, untagFile, getFileTags } from "./db/tags.js";
7
- export { createCollection, listCollections, getCollection, deleteCollection, addToCollection, removeFromCollection } from "./db/collections.js";
8
- export { createProject, listProjects, getProject, deleteProject, addToProject, removeFromProject } from "./db/projects.js";
9
- export { searchFiles } from "./db/search.js";
10
- export { indexLocalSource } from "./lib/indexer.js";
11
- export { indexS3Source, downloadFromS3, uploadToS3, deleteFromS3, headS3Object } from "./lib/s3.js";
12
- export { watchSource, unwatchSource, stopAllWatchers } from "./lib/watcher.js";
13
- export { hashFile, hashBuffer } from "./lib/hasher.js";
14
- export { syncWithPeer, syncWithPeers } from "./lib/sync.js";
15
- export type { Machine, Source, FileRecord, FileWithTags, Tag, Collection, Project, SearchResult, ListFilesOptions, IndexStats, SourceType, FileStatus, S3Config, } from "./types/index.js";
16
- //# sourceMappingURL=index.d.ts.map
1
+ export type SourceType = "local" | "s3";
2
+ export type FileStatus = "active" | "deleted" | "moved";
3
+
4
+ export interface Machine {
5
+ id: string;
6
+ name: string;
7
+ hostname: string;
8
+ platform: string;
9
+ arch: string;
10
+ is_current: boolean;
11
+ last_seen: string;
12
+ created_at: string;
13
+ }
14
+
15
+ export interface S3Config {
16
+ accessKeyId?: string;
17
+ secretAccessKey?: string;
18
+ sessionToken?: string;
19
+ endpoint?: string;
20
+ }
21
+
22
+ export interface Source {
23
+ id: string;
24
+ name: string;
25
+ type: SourceType;
26
+ path?: string;
27
+ bucket?: string;
28
+ prefix?: string;
29
+ region?: string;
30
+ config: S3Config;
31
+ machine_id: string;
32
+ enabled: boolean;
33
+ last_indexed_at?: string;
34
+ file_count: number;
35
+ created_at: string;
36
+ updated_at: string;
37
+ }
38
+
39
+ export interface FileRecord {
40
+ id: string;
41
+ source_id: string;
42
+ machine_id: string;
43
+ path: string;
44
+ name: string;
45
+ original_name?: string;
46
+ canonical_name?: string;
47
+ ext: string;
48
+ size: number;
49
+ mime: string;
50
+ description?: string;
51
+ hash?: string;
52
+ status: FileStatus;
53
+ indexed_at: string;
54
+ modified_at?: string;
55
+ created_at: string;
56
+ }
57
+
58
+ export interface FileWithTags extends FileRecord {
59
+ tags: string[];
60
+ }
61
+
62
+ export interface Tag {
63
+ id: string;
64
+ name: string;
65
+ color: string;
66
+ created_at: string;
67
+ }
68
+
69
+ export interface AutoRules {
70
+ ext?: string[];
71
+ tags?: string[];
72
+ name_pattern?: string;
73
+ source_id?: string;
74
+ }
75
+
76
+ export interface Collection {
77
+ id: string;
78
+ name: string;
79
+ description: string;
80
+ parent_id?: string;
81
+ auto_rules?: AutoRules;
82
+ metadata?: Record<string, unknown>;
83
+ created_at: string;
84
+ updated_at: string;
85
+ }
86
+
87
+ export type ProjectStatus = "active" | "archived" | "completed";
88
+
89
+ export interface Project {
90
+ id: string;
91
+ name: string;
92
+ description: string;
93
+ status?: ProjectStatus;
94
+ metadata?: Record<string, unknown>;
95
+ created_at: string;
96
+ updated_at: string;
97
+ }
98
+
99
+ export interface SearchResult extends FileWithTags {
100
+ source_name?: string;
101
+ machine_name?: string;
102
+ rank?: number;
103
+ }
104
+
105
+ export interface ListFilesOptions {
106
+ source_id?: string;
107
+ machine_id?: string;
108
+ tag?: string;
109
+ collection_id?: string;
110
+ project_id?: string;
111
+ ext?: string;
112
+ status?: FileStatus;
113
+ limit?: number;
114
+ offset?: number;
115
+ query?: string;
116
+ after?: string; // ISO date string, filters on modified_at or indexed_at
117
+ before?: string; // ISO date string
118
+ min_size?: number; // bytes
119
+ max_size?: number; // bytes
120
+ sort?: "name" | "size" | "date";
121
+ sort_dir?: "asc" | "desc";
122
+ }
123
+
124
+ export type ActionType =
125
+ | "upload" | "download" | "tag" | "untag" | "move"
126
+ | "delete" | "read" | "create" | "index" | "search"
127
+ | "annotate" | "import" | "copy" | "rename" | "restore";
128
+
129
+ export interface Agent {
130
+ id: string;
131
+ name: string;
132
+ session_id?: string;
133
+ project_id?: string;
134
+ last_seen_at: string;
135
+ created_at: string;
136
+ }
137
+
138
+ export interface AgentActivity {
139
+ id: string;
140
+ agent_id: string;
141
+ action: ActionType;
142
+ file_id?: string;
143
+ source_id?: string;
144
+ session_id?: string;
145
+ metadata: Record<string, unknown>;
146
+ created_at: string;
147
+ }
148
+
149
+ export interface IndexStats {
150
+ source_id: string;
151
+ added: number;
152
+ updated: number;
153
+ deleted: number;
154
+ errors: number;
155
+ duration_ms: number;
156
+ }