@eum-agent/file-explorer 1.1.0 → 1.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.
package/dist/schema.js CHANGED
@@ -1,27 +1,17 @@
1
1
  import { z } from "zod";
2
2
  //#region src/schema.ts
3
- /** The provider's sole wire declarations; browser and server infer types from these schemas. */
4
- /** A literal safe host filename or explicit identity segment. */
5
3
  const SegmentSchema = z.string().min(1).max(1024).refine((value) => value !== "." && value !== ".." && [...value].every((character) => character !== "/" && character !== "\\" && character.charCodeAt(0) > 31 && character.charCodeAt(0) !== 127), "Invalid segment");
6
- /** Existing workspace/session identifiers are nonempty independent segments. */
7
4
  const IdentitySchema = SegmentSchema;
8
- /** Canonical lower-case Gateway UUID. */
9
5
  const GatewayIdSchema = z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
10
- /** Stable root/file IDs retain the full lowercase SHA-256 digest. */
11
6
  const DigestSchema = z.string().regex(/^[0-9a-f]{64}$/);
12
- /** A literal relative path; the root has an empty path. */
13
7
  const PathSchema = z.string().max(4096).refine((value) => value === "" || value.split("/").every((segment) => SegmentSchema.safeParse(segment).success), "Invalid relative path");
14
- /** Explicit workspace root selection; never defaults to a current chat or home. */
15
8
  const FileTargetSchema = z.object({
16
9
  workspaceId: IdentitySchema,
17
10
  rootId: DigestSchema,
18
11
  path: PathSchema
19
12
  }).strict();
20
- /** Root discovery always names an existing workspace. */
21
13
  const RootsParamsSchema = z.object({ workspaceId: IdentitySchema }).strict();
22
- /** Stat always names one explicit current root-relative selection. */
23
14
  const StatParamsSchema = z.object({ target: FileTargetSchema }).strict();
24
- /** Display metadata for one current filesystem object. */
25
15
  const FileEntrySchema = z.object({
26
16
  name: z.string(),
27
17
  path: PathSchema,
@@ -38,7 +28,6 @@ const FileEntrySchema = z.object({
38
28
  referenceKind: z.literal("current"),
39
29
  mutable: z.boolean()
40
30
  }).strict();
41
- /** Validated bounded business context; no arbitrary error object crosses the wire. */
42
31
  const ErrorDetailsSchema = z.object({
43
32
  existing: FileEntrySchema.optional(),
44
33
  destinationCommitted: z.boolean().optional(),
@@ -47,13 +36,11 @@ const ErrorDetailsSchema = z.object({
47
36
  contentLength: z.number().int().nonnegative().optional(),
48
37
  operationId: z.uuid().optional()
49
38
  }).strict();
50
- /** Safe business error result. */
51
39
  const AccessErrorSchema = z.object({
52
40
  code: z.string().max(64),
53
41
  message: z.string().max(256),
54
42
  details: ErrorDetailsSchema.optional()
55
43
  }).strict();
56
- /** A retained execution fact or an explicit unknown query result. */
57
44
  const OperationResultSchema = z.object({
58
45
  operationId: z.uuid(),
59
46
  instanceId: GatewayIdSchema,
@@ -66,13 +53,11 @@ const OperationResultSchema = z.object({
66
53
  entry: FileEntrySchema.optional(),
67
54
  error: AccessErrorSchema.optional()
68
55
  }).strict();
69
- /** Untrusted upload source metadata, not an authorization or server fingerprint. */
70
56
  const FileSourceObservationSchema = z.object({
71
57
  clientName: SegmentSchema,
72
58
  size: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
73
59
  modifiedAt: z.number().min(-864e13).max(864e13)
74
60
  }).strict();
75
- /** File resource business parameters; PUT additionally requires operationId and source. */
76
61
  const FileBytesParamsSchema = z.object({
77
62
  target: FileTargetSchema,
78
63
  expectedFingerprint: DigestSchema.optional(),
@@ -81,38 +66,34 @@ const FileBytesParamsSchema = z.object({
81
66
  replace: z.boolean().optional(),
82
67
  targetFingerprint: DigestSchema.optional()
83
68
  }).strict();
84
- /** List RPC selection and opaque next-page cursor. */
85
69
  const ListParamsSchema = z.object({
86
70
  target: FileTargetSchema,
87
- cursor: z.string().max(128).optional()
71
+ cursor: z.string().max(128).optional(),
72
+ ignored: z.enum(["hide", "show"]).optional()
88
73
  }).strict();
89
- /** One immutable listing generation, with current external-change diagnostics. */
90
74
  const ListResultSchema = z.object({
91
- entries: z.array(FileEntrySchema).max(200),
75
+ entries: z.array(FileEntrySchema.extend({ ignored: z.boolean() })).max(200),
92
76
  nextCursor: z.string().optional(),
93
77
  fingerprint: DigestSchema,
94
78
  listingId: z.uuid(),
95
79
  snapshotAt: z.number(),
96
- stale: z.boolean()
80
+ stale: z.boolean(),
81
+ ignoreDegraded: z.boolean()
97
82
  }).strict();
98
- /** Public root display projection. */
99
83
  const RootsResultSchema = z.object({ roots: z.array(z.object({
100
84
  id: DigestSchema,
101
85
  kind: z.enum(["own", "directory"]),
102
86
  name: z.string(),
103
87
  path: z.string()
104
88
  }).strict()) }).strict();
105
- /** A complete current-file observation and confirmed host display path. */
106
89
  const StatResultSchema = z.object({
107
90
  entry: FileEntrySchema,
108
91
  realPath: z.string()
109
92
  }).strict();
110
- /** Explicit exclusive creation. */
111
93
  const MkdirParamsSchema = z.object({
112
94
  target: FileTargetSchema,
113
95
  operationId: z.uuid()
114
96
  }).strict();
115
- /** Same-root rename with optional observed replacement. */
116
97
  const RenameParamsSchema = z.object({
117
98
  source: FileTargetSchema,
118
99
  name: SegmentSchema,
@@ -121,7 +102,6 @@ const RenameParamsSchema = z.object({
121
102
  replace: z.boolean().optional(),
122
103
  targetFingerprint: DigestSchema.optional()
123
104
  }).strict();
124
- /** Same-workspace move to an explicit final target path. */
125
105
  const MoveParamsSchema = z.object({
126
106
  source: FileTargetSchema,
127
107
  destination: FileTargetSchema,
@@ -130,14 +110,12 @@ const MoveParamsSchema = z.object({
130
110
  replace: z.boolean().optional(),
131
111
  targetFingerprint: DigestSchema.optional()
132
112
  }).strict();
133
- /** Removal requires the selected revision and an explicit recursive choice. */
134
113
  const RemoveParamsSchema = z.object({
135
114
  target: FileTargetSchema,
136
115
  fingerprint: DigestSchema,
137
116
  recursive: z.boolean(),
138
117
  operationId: z.uuid()
139
118
  }).strict();
140
- /** Query retained facts without executing an operation. */
141
119
  const OperationStatusParamsSchema = z.object({
142
120
  instanceId: GatewayIdSchema,
143
121
  operationId: z.uuid()
@@ -147,25 +125,21 @@ const budget = {
147
125
  maxItemBytes: z.number().int().min(1).max(8388608).default(262144),
148
126
  maxTotalBytes: z.number().int().min(1).max(8388608).default(8388608)
149
127
  };
150
- /** Rejects input and declared normalized response costs before any filesystem work. */
151
128
  function admit(input, targets, memberBytes, totalBytes, ctx) {
152
129
  if (encoded(input) * 2 > 8388608 || targets.length * memberBytes + 8192 > totalBytes || targets.some((target) => encoded(target) + 4096 > memberBytes)) ctx.addIssue({
153
130
  code: "custom",
154
131
  message: "File collection exceeds its byte budget"
155
132
  });
156
133
  }
157
- /** Complete file observations with independent encoded response budgets. */
158
134
  const StatsParamsSchema = z.object({
159
135
  targets: z.array(FileTargetSchema).min(1).max(64),
160
136
  ...budget
161
137
  }).strict().superRefine((p, ctx) => admit(p, p.targets, p.maxItemBytes, p.maxTotalBytes, ctx));
162
- /** Retained operation queries never execute work, including unknown identities. */
163
138
  const OperationStatusesParamsSchema = z.object({
164
139
  instanceId: GatewayIdSchema,
165
140
  operationIds: z.array(z.uuid()).min(1).max(64),
166
141
  ...budget
167
142
  }).strict().superRefine((p, ctx) => admit(p, p.operationIds, p.maxItemBytes, p.maxTotalBytes, ctx));
168
- /** Validates complete mutation members and refuses conflicting reuse before any member starts. */
169
143
  function mutations(schema) {
170
144
  return z.object({ items: z.array(schema).min(1).max(64) }).strict().superRefine((p, ctx) => {
171
145
  if (encoded(p) * 2 > 8388608) ctx.addIssue({
@@ -183,13 +157,9 @@ function mutations(schema) {
183
157
  }
184
158
  });
185
159
  }
186
- /** Each move retains its own complete operation identity and physical outcome. */
187
160
  const MoveFilesParamsSchema = mutations(MoveParamsSchema);
188
- /** Each removal retains its own selected fingerprint and recursive decision. */
189
161
  const RemoveFilesParamsSchema = mutations(RemoveParamsSchema);
190
- /** One notification lists all workspaces physically changed by this collection. */
191
162
  const FilesChangedSchema = z.object({ workspaces: z.array(IdentitySchema).min(1).max(64) }).strict();
192
- /** Complete successful members and bounded safe refusals retain their original order. */
193
163
  function collectionResult(target, value) {
194
164
  return z.object({ results: z.array(z.discriminatedUnion("ok", [z.object({
195
165
  index: z.number().int().min(0).max(63),
@@ -203,13 +173,9 @@ function collectionResult(target, value) {
203
173
  error: AccessErrorSchema
204
174
  }).strict()])).min(1).max(64) }).strict();
205
175
  }
206
- /** Ordered explicit file observations. */
207
176
  const StatsResultSchema = collectionResult(FileTargetSchema, StatResultSchema);
208
- /** Ordered retained operation facts. */
209
177
  const OperationStatusesResultSchema = collectionResult(z.uuid(), OperationResultSchema);
210
- /** Ordered move results keep complete immutable operation members as their safe target. */
211
178
  const MoveFilesResultSchema = collectionResult(MoveParamsSchema, OperationResultSchema);
212
- /** Ordered removal results keep complete immutable operation members as their safe target. */
213
179
  const RemoveFilesResultSchema = collectionResult(RemoveParamsSchema, OperationResultSchema);
214
180
  //#endregion
215
181
  export { AccessErrorSchema, DigestSchema, ErrorDetailsSchema, FileBytesParamsSchema, FileEntrySchema, FileSourceObservationSchema, FileTargetSchema, FilesChangedSchema, GatewayIdSchema, IdentitySchema, ListParamsSchema, ListResultSchema, MkdirParamsSchema, MoveFilesParamsSchema, MoveFilesResultSchema, MoveParamsSchema, OperationResultSchema, OperationStatusParamsSchema, OperationStatusesParamsSchema, OperationStatusesResultSchema, PathSchema, RemoveFilesParamsSchema, RemoveFilesResultSchema, RemoveParamsSchema, RenameParamsSchema, RootsParamsSchema, RootsResultSchema, SegmentSchema, StatParamsSchema, StatResultSchema, StatsParamsSchema, StatsResultSchema, collectionResult };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "en-US": "Workspace Files",
5
5
  "zh-CN": "工作空间文件"
6
6
  },
7
- "version": "1.1.0",
7
+ "version": "1.2.0",
8
8
  "type": "module",
9
9
  "description": "Sessionless workspace file browsing, transfers and private references",
10
10
  "license": "MIT",
@@ -21,33 +21,60 @@
21
21
  "ui"
22
22
  ],
23
23
  "dependencies": {
24
- "zod": "^4.4.3"
24
+ "zod": "^4.4.3",
25
+ "ignore": "7.0.13"
25
26
  },
26
27
  "devDependencies": {
27
- "@eum-agent/plugin": "1.1.0",
28
+ "@eum-agent/plugin": "1.2.0",
28
29
  "@eum-agent/protocol": "1.0.0",
29
30
  "react": "^19.2.0",
30
31
  "react-dom": "^19.2.0",
31
32
  "@types/react": "^19.2.18",
32
33
  "@types/react-dom": "^19.2.5",
33
34
  "vite": "^8.2.2",
34
- "@eum-agent/infra-local": "1.0.1"
35
+ "@eum-agent/infra-local": "1.2.0",
36
+ "@eum-agent/kernel": "1.0.0",
37
+ "@types/ws": "^8.18.1",
38
+ "@testing-library/react": "^16.3.3",
39
+ "@testing-library/user-event": "^14.6.6",
40
+ "zustand": "^5.0.15",
41
+ "react-i18next": "^17.0.13",
42
+ "lucide-react": "^1.40.0",
43
+ "@types/semver": "7.8.0",
44
+ "i18next": "^26.4.1",
45
+ "@eum-agent/storage-sqlite": "1.2.0",
46
+ "@codemirror/state": "6.7.6",
47
+ "@codemirror/view": "6.43.14",
48
+ "@codemirror/language": "6.13.1",
49
+ "@codemirror/search": "6.7.2",
50
+ "@codemirror/lang-javascript": "6.2.5",
51
+ "@codemirror/lang-json": "6.0.2",
52
+ "@codemirror/lang-css": "6.3.1",
53
+ "@codemirror/lang-html": "6.4.12",
54
+ "@codemirror/lang-markdown": "6.5.2",
55
+ "@codemirror/lang-python": "6.2.1",
56
+ "@codemirror/lang-sql": "6.10.0",
57
+ "@codemirror/lang-rust": "6.0.2",
58
+ "@codemirror/lang-xml": "6.1.0",
59
+ "@codemirror/lang-java": "6.0.2",
60
+ "@codemirror/lang-cpp": "6.0.3",
61
+ "@codemirror/lang-go": "6.0.1",
62
+ "@codemirror/lang-yaml": "6.1.3",
63
+ "@lezer/highlight": "1.2.5"
35
64
  },
36
65
  "yaoguang": {
37
66
  "description": {
38
67
  "en-US": "Sessionless workspace file browsing, transfers and private references",
39
68
  "zh-CN": "独立的工作区文件浏览、传输与私有引用"
40
69
  },
41
- "dependencies": {
42
- "@eum-agent/file-references": "1.1.0"
43
- },
70
+ "dependencies": {},
44
71
  "kind": "extension",
45
72
  "foundationDependencies": {
46
- "@eum-agent/infra-local": "1.0.1"
73
+ "@eum-agent/infra-local": "1.2.0"
47
74
  }
48
75
  },
49
76
  "scripts": {
50
- "build": "tsdown && vite build",
77
+ "build": "tsdown && vite build && vite build --config vite.assets.config.ts",
51
78
  "test": "vitest run",
52
79
  "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.ui.json"
53
80
  }