@sidequest-007/dsh-atlas 1.0.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 (58) hide show
  1. package/CHANGELOG.md +269 -0
  2. package/CONTRIBUTING.md +50 -0
  3. package/LICENSE +21 -0
  4. package/LICENSE-ORIGINAL +21 -0
  5. package/NOTICE +29 -0
  6. package/README.md +297 -0
  7. package/README.zh.md +289 -0
  8. package/assets/diagrams/atlas-overview.svg +53 -0
  9. package/assets/diagrams/atlas-seam.svg +32 -0
  10. package/assets/screenshots/file-mention-composer.png +0 -0
  11. package/assets/screenshots/file-mention-settings.png +0 -0
  12. package/assets/screenshots/menu-mixed.png +0 -0
  13. package/cordis.patch.yml +14 -0
  14. package/dsh.plugin.json +12 -0
  15. package/lib/client.js +20615 -0
  16. package/lib/index.js +17458 -0
  17. package/lib/invariant.js +13 -0
  18. package/lib/types/abort.d.ts +22 -0
  19. package/lib/types/atlas.d.ts +181 -0
  20. package/lib/types/client/DraftLinks.d.ts +21 -0
  21. package/lib/types/client/FilesDock.d.ts +75 -0
  22. package/lib/types/client/FolderPicker.d.ts +66 -0
  23. package/lib/types/client/FolderTab.d.ts +50 -0
  24. package/lib/types/client/MentionNavigator.d.ts +96 -0
  25. package/lib/types/client/MenuIcons.d.ts +16 -0
  26. package/lib/types/client/ReferenceLinks.d.ts +85 -0
  27. package/lib/types/client/SettingsSection.d.ts +31 -0
  28. package/lib/types/client/draft-links.d.ts +205 -0
  29. package/lib/types/client/draft-scope.d.ts +22 -0
  30. package/lib/types/client/git-provider.d.ts +45 -0
  31. package/lib/types/client/icons.d.ts +48 -0
  32. package/lib/types/client/index.d.ts +8 -0
  33. package/lib/types/client/locales.d.ts +267 -0
  34. package/lib/types/client/model.d.ts +38 -0
  35. package/lib/types/client/reference-links.d.ts +100 -0
  36. package/lib/types/client/remote.d.ts +54 -0
  37. package/lib/types/client/search.d.ts +9 -0
  38. package/lib/types/client/source.d.ts +325 -0
  39. package/lib/types/client/styles.d.ts +15 -0
  40. package/lib/types/contract.d.ts +512 -0
  41. package/lib/types/defaults.d.ts +115 -0
  42. package/lib/types/external.d.ts +58 -0
  43. package/lib/types/files.d.ts +76 -0
  44. package/lib/types/git.d.ts +44 -0
  45. package/lib/types/index.d.ts +88 -0
  46. package/lib/types/invariant.d.ts +15 -0
  47. package/lib/types/mention.d.ts +80 -0
  48. package/lib/types/paste.d.ts +13 -0
  49. package/lib/types/reference.d.ts +16 -0
  50. package/lib/types/references.d.ts +126 -0
  51. package/lib/types/runtime-info.d.ts +30 -0
  52. package/lib/types/runtime.d.ts +180 -0
  53. package/lib/types/settings.d.ts +25 -0
  54. package/lib/types/tokens.d.ts +35 -0
  55. package/lib/types/tools.d.ts +94 -0
  56. package/lib/types/typert.d.ts +13 -0
  57. package/lib/types/types.d.ts +12 -0
  58. package/package.json +208 -0
@@ -0,0 +1,512 @@
1
+ /**
2
+ * The dsh-atlas wire contracts, shared verbatim by the host manifests
3
+ * (`ctx.typert.register` in typert.ts) and the client contributions
4
+ * (`ctx.remote.$mount` in client/remote.ts). The `atFile` namespace keeps
5
+ * workspace index search and plugin-owned settings access; the `atMention`
6
+ * namespace serves the category pickers (skills, past chats, plugins).
7
+ * File bytes never cross this boundary; the Host only marks validated
8
+ * references at `agent/pre-step`.
9
+ */
10
+ import { z } from 'zod';
11
+ import type { InvocationDescriptor } from '@deepseek-ai/dsh-typert-protocol';
12
+ /** One indexed workspace entry (a file or a directory), with its display path. */
13
+ export interface FileEntry {
14
+ readonly path: string;
15
+ readonly relative: string;
16
+ readonly kind: 'file' | 'dir';
17
+ }
18
+ /** Skill management tier (mirrors the sidebar Skill Manager grouping). */
19
+ export type SkillTier = 'system' | 'user' | 'project' | 'custom' | 'plugin';
20
+ /** One discoverable skill for the @skill mention picker. */
21
+ export interface SkillCandidate {
22
+ readonly name: string;
23
+ readonly description: string;
24
+ /** Grouping tier (system/user/project/custom/plugin). */
25
+ readonly tier: SkillTier;
26
+ }
27
+ /** One discoverable past session for the @chat mention picker. */
28
+ export interface ChatCandidate {
29
+ readonly sessionId: string;
30
+ readonly label: string;
31
+ /** Host-built `dsh-session:<...>` mention URI (the browser never encodes it). */
32
+ readonly uri: string;
33
+ readonly cwd?: string;
34
+ readonly createdAt: number;
35
+ }
36
+ /** One installed plugin entry for the @plugin mention picker. */
37
+ export interface PluginCandidate {
38
+ readonly entryId: string;
39
+ readonly moduleName: string;
40
+ readonly enabled: boolean;
41
+ }
42
+ /** One changed workspace path, as the built-in `@git` provider reports it. */
43
+ export interface GitChange {
44
+ /** Repository-relative path; also the item id that travels in `@git/…`. */
45
+ readonly path: string;
46
+ /** Porcelain status: `M`, `A`, `D`, `R`, `??`, … */
47
+ readonly status: string;
48
+ /** Lines added against HEAD when Git could count them (absent for binaries). */
49
+ readonly added?: number;
50
+ readonly removed?: number;
51
+ }
52
+ /**
53
+ * Read-only facts about one referenced workspace path. `size` comes from the
54
+ * directory entry; the Host never opens the file to compute it, which is what
55
+ * lets the dock price a reference without breaking "paths only, never content".
56
+ */
57
+ export interface ReferenceInfo {
58
+ /** The workspace-relative path as requested (no leading `@`, no line range). */
59
+ readonly relative: string;
60
+ /** Whether the path resolves inside the workspace to an existing entry. */
61
+ readonly exists: boolean;
62
+ /** Entry kind; present only when the path exists. */
63
+ readonly kind?: 'file' | 'dir';
64
+ /** Byte size of a file entry (directory-entry metadata only). */
65
+ readonly size?: number;
66
+ /**
67
+ * True when `relative` is an out-of-workspace path this session is allowed to
68
+ * reference (`src/external.ts`). The dock marks those rows so an external
69
+ * reference is never mistaken for a workspace one.
70
+ */
71
+ readonly outside?: true;
72
+ }
73
+ /**
74
+ * One out-of-workspace path the user has actually referenced, kept so the menu
75
+ * can offer it again without searching anything.
76
+ *
77
+ * Only the path and its usage metadata are stored — never file content, and
78
+ * never a directory listing.
79
+ */
80
+ export interface ExternalRef {
81
+ /** Canonical absolute path with forward slashes. */
82
+ readonly path: string;
83
+ /** What it was referenced as; only directories can become search roots. */
84
+ readonly kind: 'file' | 'dir';
85
+ /** How many times it has been referenced. */
86
+ readonly count: number;
87
+ /** Epoch milliseconds of the last reference. */
88
+ readonly lastUsedAt: number;
89
+ /** Workspaces it was referenced from, most recent first (bounded). */
90
+ readonly workspaces?: readonly string[];
91
+ }
92
+ /**
93
+ * What one session may do with out-of-workspace paths, plus the folder rows
94
+ * `@folder:` may offer. Computed by the Host (settings + the resolved sandbox
95
+ * policy), never by the browser.
96
+ */
97
+ export interface ExternalAccessScope {
98
+ /** Whether this session may reference paths the ledger does not know yet. */
99
+ readonly canDiscover: boolean;
100
+ /** Ledger directories this session may reference into (canonical paths). */
101
+ readonly roots: readonly string[];
102
+ /** Folder rows to offer, each an absolute path outside the workspace. */
103
+ readonly folders: readonly string[];
104
+ }
105
+ /** One row of a one-level directory listing. */
106
+ export interface DirectoryEntry {
107
+ readonly name: string;
108
+ readonly kind: 'file' | 'dir';
109
+ }
110
+ /** Why a directory could not be listed (the browser says which, in its own words). */
111
+ export type DirectoryRefusal = 'outside' | 'missing' | 'notDirectory';
112
+ /**
113
+ * One bounded, one-level directory listing.
114
+ *
115
+ * `path` is the canonical spelling of the listed directory (forward slashes); it
116
+ * carries a trailing separator ONLY when it is a drive root (`E:/`), so a child is
117
+ * always `${path}/${name}` and nobody has to remember which case they are in.
118
+ * `parent` is absent exactly at a drive root, where `drives` takes its place —
119
+ * which is how a browser leaves the drive it started on.
120
+ */
121
+ export interface DirectoryListing {
122
+ readonly path: string;
123
+ readonly parent?: string;
124
+ readonly entries: readonly DirectoryEntry[];
125
+ readonly truncated?: true;
126
+ readonly drives?: readonly string[];
127
+ readonly error?: DirectoryRefusal;
128
+ }
129
+ /** One file filter. Legacy string values remain accepted as exact, insensitive rules. */
130
+ export interface FileIgnoreRule {
131
+ readonly kind: 'exact' | 'regex';
132
+ readonly pattern: string;
133
+ readonly caseSensitive: boolean;
134
+ }
135
+ /** Durable and wire-compatible input for one file filter. */
136
+ export type FileIgnoreRuleInput = string | FileIgnoreRule;
137
+ /** File-name filters attached to one canonical workspace path. */
138
+ export interface WorkspaceIgnoreFiles {
139
+ /** Canonical workspace directory path supplied by the Harness. */
140
+ readonly workspace: string;
141
+ /** Additional basenames ignored only inside this workspace. */
142
+ readonly ignoreFiles: FileIgnoreRuleInput[];
143
+ }
144
+ /** Recently referenced relative paths for one canonical workspace path. */
145
+ export interface WorkspaceRecentFiles {
146
+ /** Canonical workspace directory path supplied by the Harness. */
147
+ readonly workspace: string;
148
+ /** Relative paths, most recent first, capped at the plugin maximum. */
149
+ readonly files: readonly string[];
150
+ }
151
+ /**
152
+ * One cross-category usage counter. The key is `${kind}:${value}`, the same
153
+ * mention-kind vocabulary the picker and the dock already share, so a category
154
+ * added later is counted without a schema change.
155
+ */
156
+ export interface UsageEntry {
157
+ /** `${mentionKind}:${value}`, e.g. `file:src/a.ts`, `skill:blender`, `plugin:dsh-atlas`. */
158
+ readonly key: string;
159
+ /** How many times the user picked this reference. */
160
+ readonly count: number;
161
+ /** Last pick time (epoch ms); the tie-breaker when counts are equal. */
162
+ readonly at: number;
163
+ }
164
+ /** The `at-file` settings namespace's durable shape (host and client share it). */
165
+ export interface AtFileSettings {
166
+ /** Whether the @file surface is enabled; false hides picker, dock, and reference injection. */
167
+ readonly enabled: boolean;
168
+ /** Global Exact and Regex basename filters; legacy strings are insensitive Exact rules. */
169
+ readonly ignoreFiles: FileIgnoreRuleInput[];
170
+ /** Workspace-specific filters added to the global filters. */
171
+ readonly workspaceIgnoreFiles: WorkspaceIgnoreFiles[];
172
+ /** Per-workspace recently referenced paths (most recent first). */
173
+ readonly recentFiles?: WorkspaceRecentFiles[];
174
+ /** Whether @ tokens inserted through paste stay ordinary text. */
175
+ readonly ignorePastedMentions?: boolean;
176
+ /** Whether the @skill picker and reference injection are enabled. */
177
+ readonly enableSkills?: boolean;
178
+ /** Whether the @past-chats picker and snapshot injection are enabled. */
179
+ readonly enableChats?: boolean;
180
+ /** Whether the @plugin picker and reference injection are enabled. */
181
+ readonly enablePlugins?: boolean;
182
+ /** Maximum candidate rows returned by the past-chats picker. */
183
+ readonly candidateLimit?: number;
184
+ /** Cross-category pick counters, highest count first (bounded by the plugin). */
185
+ readonly usage?: readonly UsageEntry[];
186
+ /** Out-of-workspace paths the user has referenced, most recent first (bounded). */
187
+ readonly externalRefs?: readonly ExternalRef[];
188
+ /**
189
+ * What clicking a FOLDER reference does: open the right Sidebar, the OS file
190
+ * manager, or both. Absent means `both` — the sidebar is the newer half and
191
+ * the local opener is the behaviour that came first.
192
+ */
193
+ readonly folderOpen?: FolderOpenTarget;
194
+ }
195
+ /** How a folder reference opens when it is clicked. */
196
+ export type FolderOpenTarget = 'both' | 'sidebar' | 'native';
197
+ /** One field update sent through the plugin-owned settings Remote. */
198
+ export type AtFileSettingsUpdate = {
199
+ readonly field: 'enabled';
200
+ readonly value: boolean;
201
+ } | {
202
+ readonly field: 'ignoreFiles';
203
+ readonly value: FileIgnoreRuleInput[];
204
+ } | {
205
+ readonly field: 'workspaceIgnoreFiles';
206
+ readonly value: WorkspaceIgnoreFiles[];
207
+ } | {
208
+ readonly field: 'ignorePastedMentions';
209
+ readonly value: boolean;
210
+ } | {
211
+ readonly field: 'enableSkills';
212
+ readonly value: boolean;
213
+ } | {
214
+ readonly field: 'enableChats';
215
+ readonly value: boolean;
216
+ } | {
217
+ readonly field: 'enablePlugins';
218
+ readonly value: boolean;
219
+ } | {
220
+ readonly field: 'candidateLimit';
221
+ readonly value: number;
222
+ } | {
223
+ readonly field: 'recentFiles';
224
+ readonly value: WorkspaceRecentFiles[];
225
+ } | {
226
+ readonly field: 'usage';
227
+ readonly value: UsageEntry[];
228
+ } | {
229
+ readonly field: 'externalRefs';
230
+ readonly value: ExternalRef[];
231
+ } | {
232
+ readonly field: 'folderOpen';
233
+ readonly value: FolderOpenTarget;
234
+ };
235
+ /** Wire codec: one session identity (branded string on the wire). */
236
+ export declare const sessionIdSchema: z.ZodString;
237
+ /** Wire codec: one workspace entry (file or directory). */
238
+ export declare const fileEntrySchema: z.ZodReadonly<z.ZodObject<{
239
+ path: z.ZodString;
240
+ relative: z.ZodString;
241
+ kind: z.ZodEnum<{
242
+ file: "file";
243
+ dir: "dir";
244
+ }>;
245
+ }, z.core.$strip>>;
246
+ /** Wire codec: one discoverable skill row. */
247
+ export declare const skillCandidateSchema: z.ZodReadonly<z.ZodObject<{
248
+ name: z.ZodString;
249
+ description: z.ZodString;
250
+ tier: z.ZodEnum<{
251
+ system: "system";
252
+ user: "user";
253
+ project: "project";
254
+ custom: "custom";
255
+ plugin: "plugin";
256
+ }>;
257
+ }, z.core.$strip>>;
258
+ /** Wire codec: one past-session candidate row. */
259
+ export declare const chatCandidateSchema: z.ZodReadonly<z.ZodObject<{
260
+ sessionId: z.ZodString;
261
+ label: z.ZodString;
262
+ uri: z.ZodString;
263
+ cwd: z.ZodOptional<z.ZodString>;
264
+ createdAt: z.ZodNumber;
265
+ }, z.core.$strip>>;
266
+ /** Wire codec: one plugin inventory row. */
267
+ export declare const pluginCandidateSchema: z.ZodReadonly<z.ZodObject<{
268
+ entryId: z.ZodString;
269
+ moduleName: z.ZodString;
270
+ enabled: z.ZodBoolean;
271
+ }, z.core.$strip>>;
272
+ /** Wire schema of one reference inspection row. */
273
+ export declare const referenceInfoSchema: z.ZodReadonly<z.ZodObject<{
274
+ relative: z.ZodString;
275
+ exists: z.ZodBoolean;
276
+ kind: z.ZodOptional<z.ZodEnum<{
277
+ file: "file";
278
+ dir: "dir";
279
+ }>>;
280
+ size: z.ZodOptional<z.ZodNumber>;
281
+ outside: z.ZodOptional<z.ZodLiteral<true>>;
282
+ }, z.core.$strip>>;
283
+ /** Wire schema of one ledger row for an out-of-workspace reference. */
284
+ export declare const externalRefSchema: z.ZodReadonly<z.ZodObject<{
285
+ path: z.ZodString;
286
+ kind: z.ZodEnum<{
287
+ file: "file";
288
+ dir: "dir";
289
+ }>;
290
+ count: z.ZodNumber;
291
+ lastUsedAt: z.ZodNumber;
292
+ workspaces: z.ZodOptional<z.ZodArray<z.ZodString>>;
293
+ }, z.core.$strip>>;
294
+ /** Wire schema of one session's out-of-workspace scope. */
295
+ export declare const externalAccessScopeSchema: z.ZodReadonly<z.ZodObject<{
296
+ canDiscover: z.ZodBoolean;
297
+ roots: z.ZodArray<z.ZodString>;
298
+ folders: z.ZodArray<z.ZodString>;
299
+ }, z.core.$strip>>;
300
+ /** Wire schema of one directory-listing row. */
301
+ export declare const directoryEntrySchema: z.ZodReadonly<z.ZodObject<{
302
+ name: z.ZodString;
303
+ kind: z.ZodEnum<{
304
+ file: "file";
305
+ dir: "dir";
306
+ }>;
307
+ }, z.core.$strip>>;
308
+ /** Wire schema of one one-level directory listing. */
309
+ export declare const directoryListingSchema: z.ZodReadonly<z.ZodObject<{
310
+ path: z.ZodString;
311
+ parent: z.ZodOptional<z.ZodString>;
312
+ entries: z.ZodArray<z.ZodReadonly<z.ZodObject<{
313
+ name: z.ZodString;
314
+ kind: z.ZodEnum<{
315
+ file: "file";
316
+ dir: "dir";
317
+ }>;
318
+ }, z.core.$strip>>>;
319
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
320
+ drives: z.ZodOptional<z.ZodArray<z.ZodString>>;
321
+ error: z.ZodOptional<z.ZodEnum<{
322
+ outside: "outside";
323
+ missing: "missing";
324
+ notDirectory: "notDirectory";
325
+ }>>;
326
+ }, z.core.$strip>>;
327
+ /** Wire schema of one directory target (`''` means the session workspace root). */
328
+ export declare const directoryTargetSchema: z.ZodString;
329
+ /** Strict wire codec for one structured file filter. */
330
+ export declare const fileIgnoreRuleSchema: z.ZodReadonly<z.ZodObject<{
331
+ kind: z.ZodEnum<{
332
+ exact: "exact";
333
+ regex: "regex";
334
+ }>;
335
+ pattern: z.ZodString;
336
+ caseSensitive: z.ZodBoolean;
337
+ }, z.core.$strip>>;
338
+ /** Strict wire codec accepting both legacy strings and structured filters. */
339
+ export declare const fileIgnoreRuleInputSchema: z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
340
+ kind: z.ZodEnum<{
341
+ exact: "exact";
342
+ regex: "regex";
343
+ }>;
344
+ pattern: z.ZodString;
345
+ caseSensitive: z.ZodBoolean;
346
+ }, z.core.$strip>>]>;
347
+ /** Strict wire codec for one workspace-specific filter row. */
348
+ export declare const workspaceIgnoreFilesSchema: z.ZodReadonly<z.ZodObject<{
349
+ workspace: z.ZodString;
350
+ ignoreFiles: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
351
+ kind: z.ZodEnum<{
352
+ exact: "exact";
353
+ regex: "regex";
354
+ }>;
355
+ pattern: z.ZodString;
356
+ caseSensitive: z.ZodBoolean;
357
+ }, z.core.$strip>>]>>;
358
+ }, z.core.$strip>>;
359
+ /** Strict wire codec for one workspace's recent-file list. */
360
+ export declare const workspaceRecentFilesSchema: z.ZodReadonly<z.ZodObject<{
361
+ workspace: z.ZodString;
362
+ files: z.ZodArray<z.ZodString>;
363
+ }, z.core.$strip>>;
364
+ /** Strict wire codec for one cross-category usage counter. */
365
+ export declare const usageEntrySchema: z.ZodReadonly<z.ZodObject<{
366
+ key: z.ZodString;
367
+ count: z.ZodNumber;
368
+ at: z.ZodNumber;
369
+ }, z.core.$strip>>;
370
+ /** Strict wire codec for the running Harness facts the atlas seam gates on. */
371
+ export declare const atlasRuntimeSchema: z.ZodReadonly<z.ZodObject<{
372
+ dshVersion: z.ZodOptional<z.ZodString>;
373
+ }, z.core.$strip>>;
374
+ /** Strict wire codec for the resolved at-file settings section. */
375
+ export declare const atFileSettingsSchema: z.ZodReadonly<z.ZodObject<{
376
+ enabled: z.ZodBoolean;
377
+ ignoreFiles: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
378
+ kind: z.ZodEnum<{
379
+ exact: "exact";
380
+ regex: "regex";
381
+ }>;
382
+ pattern: z.ZodString;
383
+ caseSensitive: z.ZodBoolean;
384
+ }, z.core.$strip>>]>>;
385
+ workspaceIgnoreFiles: z.ZodArray<z.ZodReadonly<z.ZodObject<{
386
+ workspace: z.ZodString;
387
+ ignoreFiles: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
388
+ kind: z.ZodEnum<{
389
+ exact: "exact";
390
+ regex: "regex";
391
+ }>;
392
+ pattern: z.ZodString;
393
+ caseSensitive: z.ZodBoolean;
394
+ }, z.core.$strip>>]>>;
395
+ }, z.core.$strip>>>;
396
+ ignorePastedMentions: z.ZodDefault<z.ZodBoolean>;
397
+ enableSkills: z.ZodDefault<z.ZodBoolean>;
398
+ enableChats: z.ZodDefault<z.ZodBoolean>;
399
+ enablePlugins: z.ZodDefault<z.ZodBoolean>;
400
+ candidateLimit: z.ZodDefault<z.ZodNumber>;
401
+ recentFiles: z.ZodDefault<z.ZodArray<z.ZodReadonly<z.ZodObject<{
402
+ workspace: z.ZodString;
403
+ files: z.ZodArray<z.ZodString>;
404
+ }, z.core.$strip>>>>;
405
+ usage: z.ZodDefault<z.ZodArray<z.ZodReadonly<z.ZodObject<{
406
+ key: z.ZodString;
407
+ count: z.ZodNumber;
408
+ at: z.ZodNumber;
409
+ }, z.core.$strip>>>>;
410
+ folderOpen: z.ZodDefault<z.ZodEnum<{
411
+ both: "both";
412
+ sidebar: "sidebar";
413
+ native: "native";
414
+ }>>;
415
+ }, z.core.$strip>>;
416
+ /** Strict wire codec for one field update. */
417
+ export declare const atFileSettingsUpdateSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
418
+ field: z.ZodLiteral<"enabled">;
419
+ value: z.ZodBoolean;
420
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
421
+ field: z.ZodLiteral<"ignoreFiles">;
422
+ value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
423
+ kind: z.ZodEnum<{
424
+ exact: "exact";
425
+ regex: "regex";
426
+ }>;
427
+ pattern: z.ZodString;
428
+ caseSensitive: z.ZodBoolean;
429
+ }, z.core.$strip>>]>>;
430
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
431
+ field: z.ZodLiteral<"workspaceIgnoreFiles">;
432
+ value: z.ZodArray<z.ZodReadonly<z.ZodObject<{
433
+ workspace: z.ZodString;
434
+ ignoreFiles: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodObject<{
435
+ kind: z.ZodEnum<{
436
+ exact: "exact";
437
+ regex: "regex";
438
+ }>;
439
+ pattern: z.ZodString;
440
+ caseSensitive: z.ZodBoolean;
441
+ }, z.core.$strip>>]>>;
442
+ }, z.core.$strip>>>;
443
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
444
+ field: z.ZodLiteral<"ignorePastedMentions">;
445
+ value: z.ZodBoolean;
446
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
447
+ field: z.ZodLiteral<"enableSkills">;
448
+ value: z.ZodBoolean;
449
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
450
+ field: z.ZodLiteral<"enableChats">;
451
+ value: z.ZodBoolean;
452
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
453
+ field: z.ZodLiteral<"enablePlugins">;
454
+ value: z.ZodBoolean;
455
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
456
+ field: z.ZodLiteral<"candidateLimit">;
457
+ value: z.ZodNumber;
458
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
459
+ field: z.ZodLiteral<"recentFiles">;
460
+ value: z.ZodArray<z.ZodReadonly<z.ZodObject<{
461
+ workspace: z.ZodString;
462
+ files: z.ZodArray<z.ZodString>;
463
+ }, z.core.$strip>>>;
464
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
465
+ field: z.ZodLiteral<"usage">;
466
+ value: z.ZodArray<z.ZodReadonly<z.ZodObject<{
467
+ key: z.ZodString;
468
+ count: z.ZodNumber;
469
+ at: z.ZodNumber;
470
+ }, z.core.$strip>>>;
471
+ }, z.core.$strip>>, z.ZodReadonly<z.ZodObject<{
472
+ field: z.ZodLiteral<"folderOpen">;
473
+ value: z.ZodEnum<{
474
+ both: "both";
475
+ sidebar: "sidebar";
476
+ native: "native";
477
+ }>;
478
+ }, z.core.$strip>>], "field">;
479
+ /**
480
+ * The built-in `@git` provider's shared facts.
481
+ *
482
+ * Both halves declare them: the browser half because the registry demands a
483
+ * governance declaration for every registration, the Host half because it
484
+ * answers `resolve`. Keeping one copy means a provider cannot end up with two
485
+ * different `testedOn` claims depending on which half speaks first.
486
+ */
487
+ export declare const GIT_PROVIDER_ID = "git";
488
+ /** What the built-in @git source reaches for: the git process, and no file read. */
489
+ export declare const GIT_SCOPES: readonly string[];
490
+ /**
491
+ * The DSH builds this plugin's built-in providers have actually been exercised
492
+ * on. The seam compares it for equality, so bumping it is part of the release
493
+ * checklist — an unlisted build is reported as unverified, never as verified.
494
+ */
495
+ export declare const BUILTIN_TESTED_ON: readonly string[];
496
+ /** Strict wire codec for one changed workspace path (the built-in `@git` source). */
497
+ export declare const gitChangeSchema: z.ZodReadonly<z.ZodObject<{
498
+ path: z.ZodString;
499
+ status: z.ZodString;
500
+ added: z.ZodOptional<z.ZodNumber>;
501
+ removed: z.ZodOptional<z.ZodNumber>;
502
+ }, z.core.$strip>>;
503
+ /** The atFile Remote namespace's strict invocation descriptors. */
504
+ export declare const AT_FILE_INVOCATIONS: readonly InvocationDescriptor[];
505
+ /** The atMention Remote namespace's strict invocation descriptors. */
506
+ export declare const AT_MENTION_INVOCATIONS: readonly InvocationDescriptor[];
507
+ /**
508
+ * The atlas seam's own invocations — the Host half of the @ data-source seam.
509
+ * `runtime` reports the facts a provider's `testedOn` claim is judged against;
510
+ * the Host-half provider registry lands here as the seam grows.
511
+ */
512
+ export declare const ATLAS_INVOCATIONS: readonly InvocationDescriptor[];
@@ -0,0 +1,115 @@
1
+ import type { AtFileSettings, ExternalRef, FileIgnoreRule, FileIgnoreRuleInput, WorkspaceIgnoreFiles, WorkspaceRecentFiles } from './contract.ts';
2
+ /** Directory basenames omitted from the picker unless the profile supplies its own list. */
3
+ export declare const DEFAULT_IGNORE_DIRS: readonly [".git", ".hg", ".svn", ".idea", ".vs", ".vscode", ".fleet", ".history", ".metadata", ".settings", "node_modules", "bower_components", "vendor", "Pods", ".gradle", ".kotlin", ".cxx", ".externalNativeBuild", ".dart_tool", ".swiftpm", ".build", ".cache", ".parcel-cache", ".turbo", ".nx", "__pycache__", ".pytest_cache", ".mypy_cache", ".ruff_cache", ".tox", ".venv", "venv", ".next", ".nuxt", ".output", ".svelte-kit", ".angular", "build", "bin", "dist", "out", "target", "obj", "coverage", "DerivedData", "xcuserdata", "CMakeFiles", "cmake-build-debug", "cmake-build-release", "cmake-build-relwithdebinfo", "cmake-build-minsizerel", "_deps", ".godot", "Library", "Temp", "Logs", "Binaries", "Intermediate", "Saved", "DerivedDataCache"];
4
+ /** File basenames omitted from the picker unless the Web setting replaces the list. */
5
+ export declare const DEFAULT_IGNORE_FILES: readonly ["desktop.ini", "Thumbs.db", ".DS_Store"];
6
+ /** Fresh settings defaults for Host and browser initialization. */
7
+ export declare function defaultAtFileSettings(): AtFileSettings;
8
+ /** Trim rules and remove empty entries or duplicates with identical matching semantics. */
9
+ export declare function normalizeIgnoreFiles(values: readonly FileIgnoreRuleInput[]): FileIgnoreRuleInput[];
10
+ /** Convert one legacy or structured setting value into its canonical rule. */
11
+ export declare function normalizeIgnoreRule(value: FileIgnoreRuleInput): FileIgnoreRule | undefined;
12
+ /** Stable identity for one rule, including matching semantics. */
13
+ export declare function ignoreRuleKey(value: FileIgnoreRuleInput): string;
14
+ /** Compile rules once for a bounded directory walk. */
15
+ export declare function compileIgnoreRules(values: readonly FileIgnoreRuleInput[]): readonly FileIgnoreRule[];
16
+ /** Stable comparison key for one canonical workspace path. */
17
+ export declare function workspacePathKey(value: string): string;
18
+ /** Merge duplicate workspace rows and normalize every file-name list. */
19
+ export declare function normalizeWorkspaceIgnoreFiles(entries: readonly WorkspaceIgnoreFiles[]): WorkspaceIgnoreFiles[];
20
+ /** Workspace-local file-name filters for one canonical cwd. */
21
+ export declare function workspaceIgnoreFilesFor(entries: readonly WorkspaceIgnoreFiles[], workspace: string): FileIgnoreRuleInput[];
22
+ /** Effective file-name filters for one workspace: global rules plus local additions. */
23
+ export declare function effectiveIgnoreFiles(settings: AtFileSettings, workspace: string): FileIgnoreRuleInput[];
24
+ /** Stable cache key covering every file-name filter setting. */
25
+ export declare function ignoreFilesSettingsKey(settings: AtFileSettings): string;
26
+ /** Maximum recently referenced files kept per workspace. */
27
+ export declare const MAX_RECENT_FILES = 20;
28
+ /**
29
+ * Normalize the durable recent-file rows: deduplicate workspaces, drop empty
30
+ * lists, trim whitespace, and keep files most-recent-first.
31
+ */
32
+ export declare function normalizeWorkspaceRecentFiles(values: readonly WorkspaceRecentFiles[]): WorkspaceRecentFiles[];
33
+ /** The recent-file list for one workspace (most recent first). */
34
+ export declare function recentFilesFor(settings: AtFileSettings, workspace: string): readonly string[];
35
+ /**
36
+ * Record one referenced relative path in the workspace's recent list (moves
37
+ * it to the front). Returns the next durable `recentFiles` value.
38
+ */
39
+ export declare function recordRecentFile(settings: AtFileSettings, workspace: string, relative: string): WorkspaceRecentFiles[];
40
+ /** Cross-category usage rows as stored in settings. */
41
+ type UsageRows = NonNullable<AtFileSettings['usage']>;
42
+ /** One cross-category usage row. */
43
+ type UsageRow = UsageRows[number];
44
+ /** Maximum out-of-workspace references kept in the durable ledger. */
45
+ export declare const MAX_EXTERNAL_REFS = 100;
46
+ /** How many workspaces one ledger row remembers (most recent first). */
47
+ export declare const MAX_EXTERNAL_WORKSPACES = 8;
48
+ /**
49
+ * Normalize the durable out-of-workspace ledger: drop empty paths, deduplicate
50
+ * by canonical path key (keeping the highest count and the newest use), and sort
51
+ * most-recently-used first.
52
+ * @param values - raw ledger rows from settings.
53
+ * @returns the normalized ledger, bounded by the plugin maximum.
54
+ */
55
+ export declare function normalizeExternalRefs(values: readonly ExternalRef[] | undefined): ExternalRef[];
56
+ /**
57
+ * Record one out-of-workspace reference into the ledger (moves it to the front
58
+ * and counts the use). Callers pass the already-normalized ledger.
59
+ * @param settings - live settings.
60
+ * @param path - canonical absolute path with forward slashes.
61
+ * @param kind - what the path is.
62
+ * @param workspace - the workspace it was referenced from.
63
+ * @param now - epoch milliseconds of this use.
64
+ * @returns the next durable `externalRefs` value.
65
+ */
66
+ export declare function recordExternalRef(settings: AtFileSettings, path: string, kind: 'file' | 'dir', workspace: string, now: number): ExternalRef[];
67
+ /**
68
+ * The ledger directories a session may reference into while it may not discover
69
+ * new external paths: directories referenced from this workspace first, then the
70
+ * rest of the ledger (so a path used in another workspace still works).
71
+ * @param settings - live settings.
72
+ * @param workspace - the session workspace root.
73
+ * @returns candidate root directories, most relevant first.
74
+ */
75
+ export declare function externalRootsFor(settings: AtFileSettings, workspace: string): readonly string[];
76
+ /**
77
+ * Every ledger path a narrow session may reference EXACTLY (files included),
78
+ * this workspace's entries first.
79
+ * @param settings - live settings.
80
+ * @param workspace - the session workspace root.
81
+ * @returns ledger paths, most relevant first.
82
+ */
83
+ export declare function externalKnownFor(settings: AtFileSettings, workspace: string): readonly string[];
84
+ /**
85
+ * Split the ledger into the two things the access gate needs: directories that
86
+ * may be referenced INTO, and every path that may be referenced EXACTLY.
87
+ * Entries referenced from this workspace come first in both lists.
88
+ * @param settings - live settings.
89
+ * @param workspace - the session workspace root.
90
+ * @returns the roots and the known paths for this workspace.
91
+ */
92
+ export declare function externalLedgerFor(settings: AtFileSettings, workspace: string): {
93
+ roots: readonly string[];
94
+ known: readonly string[];
95
+ };
96
+ /** Maximum cross-category usage counters kept (the most-picked win). */
97
+ export declare const MAX_USAGE_ENTRIES = 200;
98
+ /**
99
+ * Normalize the durable usage rows: drop blanks, collapse duplicate keys to the
100
+ * highest count, and order by count then recency.
101
+ * @param values - the stored rows.
102
+ * @returns the bounded rows, most-picked first.
103
+ */
104
+ export declare function normalizeUsage(values: UsageRows): UsageRow[];
105
+ /**
106
+ * Record one pick in the cross-category usage counters: the key is
107
+ * `${mentionKind}:${value}`, so every category the picker understands counts
108
+ * through the same path.
109
+ * @param settings - the live settings value.
110
+ * @param key - the `${kind}:${value}` pick key.
111
+ * @param now - the pick time (epoch ms); injectable for deterministic tests.
112
+ * @returns the next durable `usage` value, most-picked first.
113
+ */
114
+ export declare function recordUsage(settings: AtFileSettings, key: string, now?: number): UsageRow[];
115
+ export {};