dsh-reference-anything 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 (66) hide show
  1. package/LICENSE +22 -0
  2. package/NOTICE.md +54 -0
  3. package/README.md +228 -0
  4. package/cordis.patch.yml +63 -0
  5. package/images/logo.png +0 -0
  6. package/lib/client/index.d.ts +3 -0
  7. package/lib/client.js +18151 -0
  8. package/lib/contract.d.ts +300 -0
  9. package/lib/contract.js +102 -0
  10. package/lib/errors.d.ts +56 -0
  11. package/lib/errors.js +21 -0
  12. package/lib/host.d.ts +102 -0
  13. package/lib/host.js +55 -0
  14. package/lib/index.d.ts +83 -0
  15. package/lib/index.js +153 -0
  16. package/lib/opencli.d.ts +116 -0
  17. package/lib/opencli.js +356 -0
  18. package/lib/reference.d.ts +49 -0
  19. package/lib/reference.js +228 -0
  20. package/lib/render.d.ts +101 -0
  21. package/lib/render.js +250 -0
  22. package/lib/retain.d.ts +35 -0
  23. package/lib/retain.js +116 -0
  24. package/lib/search.d.ts +75 -0
  25. package/lib/search.js +126 -0
  26. package/lib/serialize.d.ts +22 -0
  27. package/lib/serialize.js +24 -0
  28. package/lib/sources/file.d.ts +100 -0
  29. package/lib/sources/file.js +236 -0
  30. package/lib/sources/web-chat/index.d.ts +114 -0
  31. package/lib/sources/web-chat/index.js +359 -0
  32. package/lib/store/spec.d.ts +312 -0
  33. package/lib/store/spec.js +94 -0
  34. package/lib/store/store.d.ts +189 -0
  35. package/lib/store/store.js +638 -0
  36. package/lib/sync/index.d.ts +91 -0
  37. package/lib/sync/index.js +425 -0
  38. package/lib/tool.d.ts +62 -0
  39. package/lib/tool.js +364 -0
  40. package/lib/typert.d.ts +2 -0
  41. package/lib/typert.js +34 -0
  42. package/lib/types.d.ts +215 -0
  43. package/lib/types.js +12 -0
  44. package/lib/uri-codec.d.ts +5 -0
  45. package/lib/uri-codec.js +39 -0
  46. package/lib/uri.d.ts +59 -0
  47. package/lib/uri.js +86 -0
  48. package/lib/web.d.ts +4 -0
  49. package/lib/web.js +11 -0
  50. package/lib/window.d.ts +23 -0
  51. package/lib/window.js +35 -0
  52. package/lib/wire.d.ts +117 -0
  53. package/lib/wire.js +49 -0
  54. package/lib/workspace.d.ts +18 -0
  55. package/lib/workspace.js +81 -0
  56. package/opencli-plugin/chatgpt.js +125 -0
  57. package/opencli-plugin/claude.js +134 -0
  58. package/opencli-plugin/common.js +307 -0
  59. package/opencli-plugin/deepseek.js +152 -0
  60. package/opencli-plugin/gemini.js +165 -0
  61. package/opencli-plugin/grok.js +123 -0
  62. package/opencli-plugin/kimi.js +123 -0
  63. package/opencli-plugin/opencli-plugin.json +6 -0
  64. package/opencli-plugin/package.json +8 -0
  65. package/opencli-plugin/since-guard.js +45 -0
  66. package/package.json +180 -0
@@ -0,0 +1,300 @@
1
+ import { z } from 'zod';
2
+ import type { InvocationDescriptor } from '@deepseek-ai/dsh-typert-protocol';
3
+ export declare const workspaceEntrySchema: z.ZodReadonly<z.ZodObject<{
4
+ path: z.ZodString;
5
+ kind: z.ZodEnum<{
6
+ file: "file";
7
+ directory: "directory";
8
+ }>;
9
+ }, z.core.$strip>>;
10
+ export declare const sessionCandidateSchema: z.ZodReadonly<z.ZodObject<{
11
+ sessionId: z.ZodString;
12
+ label: z.ZodString;
13
+ cwd: z.ZodOptional<z.ZodString>;
14
+ createdAt: z.ZodNumber;
15
+ }, z.core.$strip>>;
16
+ export declare const searchInputSchema: z.ZodReadonly<z.ZodObject<{
17
+ query: z.ZodString;
18
+ provider: z.ZodOptional<z.ZodEnum<{
19
+ chatgpt: "chatgpt";
20
+ claude: "claude";
21
+ gemini: "gemini";
22
+ deepseek: "deepseek";
23
+ grok: "grok";
24
+ kimi: "kimi";
25
+ }>>;
26
+ limit: z.ZodNumber;
27
+ }, z.core.$strip>>;
28
+ export declare const matchedViaSchema: z.ZodEnum<{
29
+ recent: "recent";
30
+ title: "title";
31
+ content: "content";
32
+ }>;
33
+ export declare const searchResultSchema: z.ZodReadonly<z.ZodObject<{
34
+ uriId: z.ZodString;
35
+ provider: z.ZodEnum<{
36
+ chatgpt: "chatgpt";
37
+ claude: "claude";
38
+ gemini: "gemini";
39
+ deepseek: "deepseek";
40
+ grok: "grok";
41
+ kimi: "kimi";
42
+ }>;
43
+ title: z.ZodString;
44
+ url: z.ZodString;
45
+ updatedAt: z.ZodString;
46
+ turnCount: z.ZodNumber;
47
+ partial: z.ZodBoolean;
48
+ syncedAt: z.ZodString;
49
+ matchedVia: z.ZodEnum<{
50
+ recent: "recent";
51
+ title: "title";
52
+ content: "content";
53
+ }>;
54
+ snippet: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strip>>;
56
+ export declare const extensionStateSchema: z.ZodEnum<{
57
+ connected: "connected";
58
+ disconnected: "disconnected";
59
+ "profile-required": "profile-required";
60
+ "profile-disconnected": "profile-disconnected";
61
+ "daemon-offline": "daemon-offline";
62
+ }>;
63
+ export declare const healthSchema: z.ZodReadonly<z.ZodObject<{
64
+ version: z.ZodString;
65
+ daemon: z.ZodString;
66
+ pluginInstalled: z.ZodBoolean;
67
+ daemonRunning: z.ZodBoolean;
68
+ extensionConnected: z.ZodBoolean;
69
+ extensionState: z.ZodEnum<{
70
+ connected: "connected";
71
+ disconnected: "disconnected";
72
+ "profile-required": "profile-required";
73
+ "profile-disconnected": "profile-disconnected";
74
+ "daemon-offline": "daemon-offline";
75
+ }>;
76
+ extensionVersion: z.ZodOptional<z.ZodString>;
77
+ profileCount: z.ZodOptional<z.ZodNumber>;
78
+ opencliCompatible: z.ZodBoolean;
79
+ daemonVersion: z.ZodOptional<z.ZodString>;
80
+ daemonStale: z.ZodBoolean;
81
+ connectivityOk: z.ZodBoolean;
82
+ pluginVersion: z.ZodOptional<z.ZodString>;
83
+ adapterCommandsReady: z.ZodBoolean;
84
+ adapterCompatible: z.ZodBoolean;
85
+ versionError: z.ZodOptional<z.ZodString>;
86
+ daemonError: z.ZodOptional<z.ZodString>;
87
+ pluginError: z.ZodOptional<z.ZodString>;
88
+ doctorError: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strip>>;
90
+ export declare const browserProfileSchema: z.ZodReadonly<z.ZodObject<{
91
+ id: z.ZodString;
92
+ alias: z.ZodOptional<z.ZodString>;
93
+ connected: z.ZodBoolean;
94
+ isDefault: z.ZodBoolean;
95
+ }, z.core.$strip>>;
96
+ export declare const openCliDiscoverySchema: z.ZodReadonly<z.ZodObject<{
97
+ found: z.ZodBoolean;
98
+ executable: z.ZodString;
99
+ version: z.ZodString;
100
+ error: z.ZodOptional<z.ZodString>;
101
+ }, z.core.$strip>>;
102
+ export declare const providerStatsSchema: z.ZodReadonly<z.ZodObject<{
103
+ provider: z.ZodEnum<{
104
+ chatgpt: "chatgpt";
105
+ claude: "claude";
106
+ gemini: "gemini";
107
+ deepseek: "deepseek";
108
+ grok: "grok";
109
+ kimi: "kimi";
110
+ }>;
111
+ conversations: z.ZodNumber;
112
+ lastSyncedAt: z.ZodString;
113
+ status: z.ZodEnum<{
114
+ error: "error";
115
+ ready: "ready";
116
+ syncing: "syncing";
117
+ empty: "empty";
118
+ }>;
119
+ error: z.ZodOptional<z.ZodString>;
120
+ }, z.core.$strip>>;
121
+ export declare const syncStartSchema: z.ZodReadonly<z.ZodObject<{
122
+ providers: z.ZodArray<z.ZodEnum<{
123
+ chatgpt: "chatgpt";
124
+ claude: "claude";
125
+ gemini: "gemini";
126
+ deepseek: "deepseek";
127
+ grok: "grok";
128
+ kimi: "kimi";
129
+ }>>;
130
+ mode: z.ZodEnum<{
131
+ incremental: "incremental";
132
+ full: "full";
133
+ }>;
134
+ }, z.core.$strip>>;
135
+ export declare const providerSyncProgressSchema: z.ZodReadonly<z.ZodObject<{
136
+ provider: z.ZodEnum<{
137
+ chatgpt: "chatgpt";
138
+ claude: "claude";
139
+ gemini: "gemini";
140
+ deepseek: "deepseek";
141
+ grok: "grok";
142
+ kimi: "kimi";
143
+ }>;
144
+ phase: z.ZodEnum<{
145
+ syncing: "syncing";
146
+ listing: "listing";
147
+ complete: "complete";
148
+ failed: "failed";
149
+ cancelled: "cancelled";
150
+ }>;
151
+ completed: z.ZodNumber;
152
+ total: z.ZodNumber;
153
+ error: z.ZodOptional<z.ZodString>;
154
+ }, z.core.$strip>>;
155
+ export declare const syncStatusSchema: z.ZodReadonly<z.ZodObject<{
156
+ jobId: z.ZodString;
157
+ status: z.ZodEnum<{
158
+ partial: "partial";
159
+ complete: "complete";
160
+ failed: "failed";
161
+ cancelled: "cancelled";
162
+ running: "running";
163
+ }>;
164
+ providers: z.ZodArray<z.ZodEnum<{
165
+ chatgpt: "chatgpt";
166
+ claude: "claude";
167
+ gemini: "gemini";
168
+ deepseek: "deepseek";
169
+ grok: "grok";
170
+ kimi: "kimi";
171
+ }>>;
172
+ provider: z.ZodOptional<z.ZodEnum<{
173
+ chatgpt: "chatgpt";
174
+ claude: "claude";
175
+ gemini: "gemini";
176
+ deepseek: "deepseek";
177
+ grok: "grok";
178
+ kimi: "kimi";
179
+ }>>;
180
+ completed: z.ZodNumber;
181
+ total: z.ZodNumber;
182
+ providerProgress: z.ZodArray<z.ZodReadonly<z.ZodObject<{
183
+ provider: z.ZodEnum<{
184
+ chatgpt: "chatgpt";
185
+ claude: "claude";
186
+ gemini: "gemini";
187
+ deepseek: "deepseek";
188
+ grok: "grok";
189
+ kimi: "kimi";
190
+ }>;
191
+ phase: z.ZodEnum<{
192
+ syncing: "syncing";
193
+ listing: "listing";
194
+ complete: "complete";
195
+ failed: "failed";
196
+ cancelled: "cancelled";
197
+ }>;
198
+ completed: z.ZodNumber;
199
+ total: z.ZodNumber;
200
+ error: z.ZodOptional<z.ZodString>;
201
+ }, z.core.$strip>>>;
202
+ error: z.ZodOptional<z.ZodString>;
203
+ }, z.core.$strip>>;
204
+ export declare const jobInputSchema: z.ZodReadonly<z.ZodObject<{
205
+ jobId: z.ZodString;
206
+ }, z.core.$strip>>;
207
+ export declare const browseInputSchema: z.ZodReadonly<z.ZodObject<{
208
+ query: z.ZodString;
209
+ provider: z.ZodOptional<z.ZodEnum<{
210
+ chatgpt: "chatgpt";
211
+ claude: "claude";
212
+ gemini: "gemini";
213
+ deepseek: "deepseek";
214
+ grok: "grok";
215
+ kimi: "kimi";
216
+ }>>;
217
+ limit: z.ZodNumber;
218
+ offset: z.ZodNumber;
219
+ }, z.core.$strip>>;
220
+ export declare const managedConversationSchema: z.ZodReadonly<z.ZodObject<{
221
+ uriId: z.ZodString;
222
+ provider: z.ZodEnum<{
223
+ chatgpt: "chatgpt";
224
+ claude: "claude";
225
+ gemini: "gemini";
226
+ deepseek: "deepseek";
227
+ grok: "grok";
228
+ kimi: "kimi";
229
+ }>;
230
+ title: z.ZodString;
231
+ url: z.ZodString;
232
+ updatedAt: z.ZodString;
233
+ turnCount: z.ZodNumber;
234
+ partial: z.ZodBoolean;
235
+ syncedAt: z.ZodString;
236
+ remoteMissing: z.ZodBoolean;
237
+ }, z.core.$strip>>;
238
+ export declare const browsePageSchema: z.ZodReadonly<z.ZodObject<{
239
+ items: z.ZodArray<z.ZodReadonly<z.ZodObject<{
240
+ uriId: z.ZodString;
241
+ provider: z.ZodEnum<{
242
+ chatgpt: "chatgpt";
243
+ claude: "claude";
244
+ gemini: "gemini";
245
+ deepseek: "deepseek";
246
+ grok: "grok";
247
+ kimi: "kimi";
248
+ }>;
249
+ title: z.ZodString;
250
+ url: z.ZodString;
251
+ updatedAt: z.ZodString;
252
+ turnCount: z.ZodNumber;
253
+ partial: z.ZodBoolean;
254
+ syncedAt: z.ZodString;
255
+ remoteMissing: z.ZodBoolean;
256
+ }, z.core.$strip>>>;
257
+ total: z.ZodNumber;
258
+ }, z.core.$strip>>;
259
+ export declare const deleteInputSchema: z.ZodReadonly<z.ZodObject<{
260
+ uriId: z.ZodString;
261
+ }, z.core.$strip>>;
262
+ export declare const storageStatsSchema: z.ZodReadonly<z.ZodObject<{
263
+ bytes: z.ZodNumber;
264
+ conversations: z.ZodNumber;
265
+ remoteMissing: z.ZodDefault<z.ZodNumber>;
266
+ oldAccountConversations: z.ZodDefault<z.ZodNumber>;
267
+ }, z.core.$strip>>;
268
+ export declare const clearProviderInputSchema: z.ZodReadonly<z.ZodObject<{
269
+ provider: z.ZodEnum<{
270
+ chatgpt: "chatgpt";
271
+ claude: "claude";
272
+ gemini: "gemini";
273
+ deepseek: "deepseek";
274
+ grok: "grok";
275
+ kimi: "kimi";
276
+ }>;
277
+ }, z.core.$strip>>;
278
+ export declare const clearOlderInputSchema: z.ZodReadonly<z.ZodObject<{
279
+ days: z.ZodNumber;
280
+ }, z.core.$strip>>;
281
+ export declare const providerSyncStateSchema: z.ZodReadonly<z.ZodObject<{
282
+ provider: z.ZodEnum<{
283
+ chatgpt: "chatgpt";
284
+ claude: "claude";
285
+ gemini: "gemini";
286
+ deepseek: "deepseek";
287
+ grok: "grok";
288
+ kimi: "kimi";
289
+ }>;
290
+ status: z.ZodEnum<{
291
+ failed: "failed";
292
+ cancelled: "cancelled";
293
+ running: "running";
294
+ idle: "idle";
295
+ }>;
296
+ lastSyncAt: z.ZodString;
297
+ lastCompleteScanAt: z.ZodString;
298
+ error: z.ZodString;
299
+ }, z.core.$strip>>;
300
+ export declare const REFERENCE_ANYTHING_INVOCATIONS: readonly InvocationDescriptor[];
@@ -0,0 +1,102 @@
1
+ import { z } from 'zod';
2
+ import { providerSchema, settingsRecordSchema } from "./wire.js";
3
+ export const workspaceEntrySchema = z.object({ path: z.string(), kind: z.enum(['file', 'directory']) }).readonly();
4
+ export const sessionCandidateSchema = z.object({ sessionId: z.string(), label: z.string(), cwd: z.string().optional(), createdAt: z.number() }).readonly();
5
+ const agentLookup = { name: 'agent', wire: 'agentId', source: 'lookup', lookup: 'agent',
6
+ codec: { mode: 'strict', typeSymbol: '@deepseek-ai/dsh-session/types#SessionId', schema: z.string().min(1) } };
7
+ export const searchInputSchema = z.object({
8
+ query: z.string(), provider: providerSchema.optional(), limit: z.number().int().min(1).max(100),
9
+ }).readonly();
10
+ export const matchedViaSchema = z.enum(['recent', 'title', 'content']);
11
+ export const searchResultSchema = z.object({
12
+ uriId: z.string(), provider: providerSchema, title: z.string(), url: z.string(), updatedAt: z.string(),
13
+ turnCount: z.number().int().nonnegative(), partial: z.boolean(), syncedAt: z.string(),
14
+ matchedVia: matchedViaSchema, snippet: z.string().optional(),
15
+ }).readonly();
16
+ export const extensionStateSchema = z.enum(['connected', 'disconnected', 'profile-required', 'profile-disconnected', 'daemon-offline']);
17
+ export const healthSchema = z.object({
18
+ version: z.string(), daemon: z.string(), pluginInstalled: z.boolean(),
19
+ daemonRunning: z.boolean(), extensionConnected: z.boolean(), extensionState: extensionStateSchema,
20
+ extensionVersion: z.string().optional(), profileCount: z.number().int().nonnegative().optional(),
21
+ opencliCompatible: z.boolean(), daemonVersion: z.string().optional(), daemonStale: z.boolean(),
22
+ connectivityOk: z.boolean(), pluginVersion: z.string().optional(), adapterCommandsReady: z.boolean(), adapterCompatible: z.boolean(),
23
+ versionError: z.string().optional(), daemonError: z.string().optional(), pluginError: z.string().optional(), doctorError: z.string().optional(),
24
+ }).readonly();
25
+ export const browserProfileSchema = z.object({ id: z.string(), alias: z.string().optional(), connected: z.boolean(), isDefault: z.boolean() }).readonly();
26
+ export const openCliDiscoverySchema = z.object({
27
+ found: z.boolean(), executable: z.string(), version: z.string(), error: z.string().optional(),
28
+ }).readonly();
29
+ export const providerStatsSchema = z.object({
30
+ provider: providerSchema, conversations: z.number().int().nonnegative(), lastSyncedAt: z.string(),
31
+ status: z.enum(['ready', 'syncing', 'error', 'empty']), error: z.string().optional(),
32
+ }).readonly();
33
+ export const syncStartSchema = z.object({ providers: z.array(providerSchema).min(1), mode: z.enum(['incremental', 'full']) }).readonly();
34
+ export const providerSyncProgressSchema = z.object({
35
+ provider: providerSchema,
36
+ phase: z.enum(['listing', 'syncing', 'complete', 'failed', 'cancelled']),
37
+ completed: z.number().int().nonnegative(), total: z.number().int().nonnegative(), error: z.string().optional(),
38
+ }).readonly();
39
+ export const syncStatusSchema = z.object({
40
+ jobId: z.string(), status: z.enum(['running', 'complete', 'partial', 'cancelled', 'failed']),
41
+ providers: z.array(providerSchema), provider: providerSchema.optional(), completed: z.number(), total: z.number(),
42
+ providerProgress: z.array(providerSyncProgressSchema), error: z.string().optional(),
43
+ }).readonly();
44
+ export const jobInputSchema = z.object({ jobId: z.string().min(1) }).readonly();
45
+ export const browseInputSchema = z.object({
46
+ query: z.string(), provider: providerSchema.optional(),
47
+ limit: z.number().int().min(1).max(100), offset: z.number().int().nonnegative(),
48
+ }).readonly();
49
+ export const managedConversationSchema = z.object({
50
+ uriId: z.string(), provider: providerSchema, title: z.string(), url: z.string(), updatedAt: z.string(),
51
+ turnCount: z.number().int().nonnegative(), partial: z.boolean(), syncedAt: z.string(), remoteMissing: z.boolean(),
52
+ }).readonly();
53
+ export const browsePageSchema = z.object({
54
+ items: z.array(managedConversationSchema), total: z.number().int().nonnegative(),
55
+ }).readonly();
56
+ export const deleteInputSchema = z.object({ uriId: z.string().min(1) }).readonly();
57
+ export const storageStatsSchema = z.object({
58
+ bytes: z.number().int().nonnegative(), conversations: z.number().int().nonnegative(),
59
+ remoteMissing: z.number().int().nonnegative().default(0), oldAccountConversations: z.number().int().nonnegative().default(0),
60
+ }).readonly();
61
+ export const clearProviderInputSchema = z.object({ provider: providerSchema }).readonly();
62
+ export const clearOlderInputSchema = z.object({ days: z.number().int().min(1).max(36500) }).readonly();
63
+ export const providerSyncStateSchema = z.object({
64
+ provider: providerSchema, status: z.enum(['idle', 'running', 'cancelled', 'failed']),
65
+ lastSyncAt: z.string(), lastCompleteScanAt: z.string(), error: z.string(),
66
+ }).readonly();
67
+ export const REFERENCE_ANYTHING_INVOCATIONS = [
68
+ descriptor('workspaceSearch', [agentLookup], strict('WorkspaceEntry[]', z.array(workspaceEntrySchema)), true),
69
+ descriptor('sessionSearch', [agentLookup, { name: 'input', wire: 'input', source: 'json', codec: strict('SessionSearchInput', z.object({ query: z.string(), limit: z.number().int().min(1).max(100) }).readonly()) }], strict('SessionCandidate[]', z.array(sessionCandidateSchema)), true),
70
+ descriptor('search', [{ name: 'input', wire: 'input', source: 'json', codec: strict('SearchInput', searchInputSchema) }], strict('SearchResult[]', z.array(searchResultSchema)), true),
71
+ descriptor('health', [], strict('Health', healthSchema), true),
72
+ descriptor('profiles', [], strict('BrowserProfile[]', z.array(browserProfileSchema)), true),
73
+ descriptor('discoverOpenCli', [], strict('OpenCliDiscovery', openCliDiscoverySchema), true),
74
+ descriptor('installOpenCli', [], strict('OpenCliDiscovery', openCliDiscoverySchema), true),
75
+ descriptor('installAdapter', [], strict('Boolean', z.boolean()), true),
76
+ descriptor('restartDaemon', [], strict('Boolean', z.boolean()), true),
77
+ descriptor('stats', [], strict('ProviderStats[]', z.array(providerStatsSchema))),
78
+ descriptor('syncStart', [{ name: 'input', wire: 'input', source: 'json', codec: strict('SyncStart', syncStartSchema) }], strict('JobId', z.string())),
79
+ descriptor('syncStatus', [{ name: 'input', wire: 'input', source: 'json', codec: strict('JobInput', jobInputSchema) }], strict('SyncStatus?', syncStatusSchema.optional())),
80
+ descriptor('syncCancel', [{ name: 'input', wire: 'input', source: 'json', codec: strict('JobInput', jobInputSchema) }], strict('Boolean', z.boolean())),
81
+ descriptor('settingsGet', [], strict('Settings', settingsRecordSchema)),
82
+ descriptor('settingsUpdate', [{ name: 'settings', wire: 'settings', source: 'json', codec: strict('Settings', settingsRecordSchema) }], strict('Settings', settingsRecordSchema)),
83
+ descriptor('browse', [{ name: 'input', wire: 'input', source: 'json', codec: strict('BrowseInput', browseInputSchema) }], strict('BrowsePage', browsePageSchema), true),
84
+ descriptor('deleteConversation', [{ name: 'input', wire: 'input', source: 'json', codec: strict('DeleteInput', deleteInputSchema) }], strict('Boolean', z.boolean()), true),
85
+ descriptor('storageStats', [], strict('StorageStats', storageStatsSchema)),
86
+ descriptor('clearProvider', [{ name: 'input', wire: 'input', source: 'json', codec: strict('ClearProviderInput', clearProviderInputSchema) }], strict('Count', z.number().int().nonnegative()), true),
87
+ descriptor('clearOlder', [{ name: 'input', wire: 'input', source: 'json', codec: strict('ClearOlderInput', clearOlderInputSchema) }], strict('Count', z.number().int().nonnegative()), true),
88
+ descriptor('clearRemoteMissing', [], strict('Count', z.number().int().nonnegative()), true),
89
+ descriptor('clearOldAccounts', [], strict('Count', z.number().int().nonnegative()), true),
90
+ descriptor('syncStates', [], strict('ProviderSyncState[]', z.array(providerSyncStateSchema))),
91
+ ];
92
+ function strict(type, schema) {
93
+ return { mode: 'strict', typeSymbol: `dsh-reference-anything#${type}`, schema };
94
+ }
95
+ function descriptor(method, parameters, result, cancelled = false) {
96
+ return {
97
+ id: `dsh-reference-anything#referenceAnything/${method}`,
98
+ service: 'referenceAnything', namespace: 'referenceAnything', method,
99
+ invocation: { kind: 'direct' }, parameters,
100
+ ...(cancelled ? { cancellation: { parameter: 'signal' } } : {}), result,
101
+ };
102
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Failure classes for reference lookup, decoding, and budgeting.
3
+ *
4
+ * @module dsh-reference-anything/errors
5
+ */
6
+ import { HarnessError } from '@deepseek-ai/dsh-llm';
7
+ /** Stable, machine-routable failure classes; route on these, never on message text. */
8
+ export type ReferenceErrorCode =
9
+ /** Two sources claimed the same registry id. */
10
+ 'SOURCE_DUPLICATE'
11
+ /** A reference named a source that is not registered. */
12
+ | 'SOURCE_UNKNOWN'
13
+ /** The owning source is registered but reported itself unusable. */
14
+ | 'SOURCE_UNAVAILABLE'
15
+ /** The source is usable but holds no item with that id. */
16
+ | 'REFERENCE_NOT_FOUND'
17
+ /** A live browser read targeted a conversation owned by another account. */
18
+ | 'REFERENCE_ACCOUNT_MISMATCH'
19
+ /** The source failed while reading; its own error is the `cause`. */
20
+ | 'REFERENCE_READ_FAILED'
21
+ /** The caller cancelled before the read settled. */
22
+ | 'REFERENCE_CANCELLED'
23
+ /** A `dsh-ref:` URI was malformed, non-canonical, or not a reference at all. */
24
+ | 'REFERENCE_INVALID_URI'
25
+ /** A continuation token is malformed or belongs to another reference. */
26
+ | 'REFERENCE_INVALID_CURSOR'
27
+ /** The immutable revision pinned by a cursor aged out of retention. */
28
+ | 'REFERENCE_CURSOR_EXPIRED'
29
+ /** The current task did not mention or discover this conversation. */
30
+ | 'CONVERSATION_REFERENCE_NOT_GRANTED'
31
+ /** A provider cannot materialize this attachment from a stable locator. */
32
+ | 'ATTACHMENT_UNAVAILABLE'
33
+ /** Provider bytes exceeded the attachment cap. */
34
+ | 'ATTACHMENT_TOO_LARGE'
35
+ /** One message named more distinct references than the configured limit allows. */
36
+ | 'REFERENCE_TOO_MANY'
37
+ /** A reference's fixed fields alone exceed its byte budget, so no honest partial exists. */
38
+ | 'REFERENCE_BUDGET_EXCEEDED'
39
+ /** A plugin config value was outside its documented domain. */
40
+ | 'REFERENCE_INVALID_CONFIG'
41
+ /** A management action conflicts with a sync job currently in flight. */
42
+ | 'REFERENCE_SYNC_IN_PROGRESS';
43
+ /**
44
+ * Named distinctly from the global `ReferenceError` — these describe this
45
+ * package's references, not JavaScript bindings, and shadowing the built-in in
46
+ * a file that also does ordinary work would be a trap.
47
+ */
48
+ export declare class ReferenceAnythingError extends HarnessError {
49
+ readonly code: ReferenceErrorCode;
50
+ /**
51
+ * @param message - human-readable diagnostic.
52
+ * @param code - stable failure class.
53
+ * @param options - standard error options, carrying the underlying `cause` where one exists.
54
+ */
55
+ constructor(message: string, code: ReferenceErrorCode, options?: ErrorOptions);
56
+ }
package/lib/errors.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Failure classes for reference lookup, decoding, and budgeting.
3
+ *
4
+ * @module dsh-reference-anything/errors
5
+ */
6
+ import { HarnessError } from '@deepseek-ai/dsh-llm';
7
+ /**
8
+ * Named distinctly from the global `ReferenceError` — these describe this
9
+ * package's references, not JavaScript bindings, and shadowing the built-in in
10
+ * a file that also does ordinary work would be a trap.
11
+ */
12
+ export class ReferenceAnythingError extends HarnessError {
13
+ /**
14
+ * @param message - human-readable diagnostic.
15
+ * @param code - stable failure class.
16
+ * @param options - standard error options, carrying the underlying `cause` where one exists.
17
+ */
18
+ constructor(message, code, options) {
19
+ super(message, code, options);
20
+ }
21
+ }
package/lib/host.d.ts ADDED
@@ -0,0 +1,102 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
3
+ import type { ChatProvider, SettingsRecord } from './store/spec.ts';
4
+ import type { SyncMode } from './sync/index.ts';
5
+ import type { Agent } from '@deepseek-ai/dsh-agent';
6
+ export declare class ReferenceAnythingRemote extends TypertRemoteService {
7
+ constructor(ctx: Context);
8
+ workspaceSearch(agent: Agent, signal: AbortSignal): Promise<import("./workspace.ts").WorkspaceEntry[]>;
9
+ sessionSearch(agent: Agent, input: {
10
+ query: string;
11
+ limit: number;
12
+ }, signal: AbortSignal): Promise<{
13
+ sessionId: string;
14
+ label: string;
15
+ cwd?: string;
16
+ createdAt: number;
17
+ }[]>;
18
+ search(input: {
19
+ query: string;
20
+ provider?: ChatProvider;
21
+ limit: number;
22
+ }, signal: AbortSignal): Promise<import("./sources/web-chat/index.ts").ConversationSearchResult[]>;
23
+ health(signal: AbortSignal): Promise<import("./opencli.ts").OpenCliHealth>;
24
+ profiles(signal: AbortSignal): Promise<import("./opencli.ts").BrowserProfile[]>;
25
+ discoverOpenCli(signal: AbortSignal): Promise<import("./opencli.ts").OpenCliDiscovery>;
26
+ installOpenCli(signal: AbortSignal): Promise<import("./opencli.ts").OpenCliDiscovery>;
27
+ installAdapter(signal: AbortSignal): Promise<boolean>;
28
+ restartDaemon(signal: AbortSignal): Promise<boolean>;
29
+ stats(): import("./store/store.ts").ProviderStats[];
30
+ syncStart(input: {
31
+ providers: ChatProvider[];
32
+ mode: SyncMode;
33
+ }): string;
34
+ syncStatus(input: {
35
+ jobId: string;
36
+ }): import("./sync/index.ts").SyncJobStatus | undefined;
37
+ syncCancel(input: {
38
+ jobId: string;
39
+ }): boolean;
40
+ settingsGet(): SettingsRecord;
41
+ settingsUpdate(settings: SettingsRecord): Promise<{
42
+ opencliPath: string;
43
+ profile: string;
44
+ detailConcurrency: number;
45
+ autoSync: boolean;
46
+ syncOnStartup: boolean;
47
+ autoSyncMinutes: number;
48
+ historyMode: "metadata-only" | "offline-mirror";
49
+ enabledProviders: ("chatgpt" | "claude" | "gemini" | "deepseek" | "grok" | "kimi")[];
50
+ maxReadTurns: number;
51
+ inputRenderMode: "pill" | "raw-text";
52
+ picker?: {
53
+ commands: {
54
+ enabled: boolean;
55
+ order: number;
56
+ limit: number;
57
+ };
58
+ skills: {
59
+ enabled: boolean;
60
+ order: number;
61
+ limit: number;
62
+ };
63
+ files: {
64
+ enabled: boolean;
65
+ order: number;
66
+ limit: number;
67
+ };
68
+ sessions: {
69
+ enabled: boolean;
70
+ order: number;
71
+ limit: number;
72
+ };
73
+ conversations: {
74
+ enabled: boolean;
75
+ order: number;
76
+ limit: number;
77
+ };
78
+ } | undefined;
79
+ }>;
80
+ browse(input: {
81
+ query: string;
82
+ provider?: ChatProvider;
83
+ limit: number;
84
+ offset: number;
85
+ }, signal: AbortSignal): {
86
+ items: import("./sources/web-chat/index.ts").ManagedConversation[];
87
+ total: number;
88
+ };
89
+ deleteConversation(input: {
90
+ uriId: string;
91
+ }, signal: AbortSignal): Promise<boolean>;
92
+ storageStats(): import("./store/store.ts").StorageStats;
93
+ clearProvider(input: {
94
+ provider: ChatProvider;
95
+ }, signal: AbortSignal): Promise<number>;
96
+ clearOlder(input: {
97
+ days: number;
98
+ }, signal: AbortSignal): Promise<number>;
99
+ clearRemoteMissing(signal: AbortSignal): Promise<number>;
100
+ clearOldAccounts(signal: AbortSignal): Promise<number>;
101
+ syncStates(): import("./store/store.ts").ProviderSyncState[];
102
+ }
package/lib/host.js ADDED
@@ -0,0 +1,55 @@
1
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
2
+ import { encodeSessionReferenceUri } from '@deepseek-ai/dsh-session-reference';
3
+ import { indexWorkspace } from "./workspace.js";
4
+ export class ReferenceAnythingRemote extends TypertRemoteService {
5
+ constructor(ctx) { super(ctx, 'referenceAnything'); }
6
+ workspaceSearch(agent, signal) { return indexWorkspace(agent, signal); }
7
+ async sessionSearch(agent, input, signal) {
8
+ const rows = await this.ctx.sessionReferenceResolver.listCandidates(agent, input.query, input.limit, signal);
9
+ return rows.map(row => ({ ...row, sessionId: encodeSessionReferenceUri(row.sessionId) }));
10
+ }
11
+ search(input, signal) {
12
+ signal.throwIfAborted();
13
+ return this.ctx.referenceChatHistory.search(input.query, input.provider, input.limit, signal);
14
+ }
15
+ health(signal) { return this.ctx.referenceChatHistory.health(signal); }
16
+ profiles(signal) { return this.ctx.referenceChatHistory.profiles(signal); }
17
+ discoverOpenCli(signal) { return this.ctx.referenceChatHistory.discoverOpenCli(signal); }
18
+ installOpenCli(signal) { return this.ctx.referenceChatHistory.installOpenCli(signal); }
19
+ installAdapter(signal) { return this.ctx.referenceChatHistory.installAdapter(signal); }
20
+ restartDaemon(signal) { return this.ctx.referenceChatHistory.restartDaemon(signal); }
21
+ stats() { return this.ctx.referenceChatHistory.stats(); }
22
+ syncStart(input) {
23
+ return this.ctx.referenceChatHistory.sync.start(input.providers, input.mode);
24
+ }
25
+ syncStatus(input) { return this.ctx.referenceChatHistory.sync.status(input.jobId); }
26
+ syncCancel(input) { return this.ctx.referenceChatHistory.sync.cancel(input.jobId); }
27
+ settingsGet() { return this.ctx.referenceChatHistory.getSettings(); }
28
+ settingsUpdate(settings) { return this.ctx.referenceChatHistory.updateSettings(settings); }
29
+ browse(input, signal) {
30
+ signal.throwIfAborted();
31
+ return this.ctx.referenceChatHistory.browse(input.query, input.provider, input.limit, input.offset);
32
+ }
33
+ deleteConversation(input, signal) {
34
+ signal.throwIfAborted();
35
+ return this.ctx.referenceChatHistory.remove(input.uriId);
36
+ }
37
+ storageStats() { return this.ctx.referenceChatHistory.storageStats(); }
38
+ clearProvider(input, signal) {
39
+ signal.throwIfAborted();
40
+ return this.ctx.referenceChatHistory.removeProvider(input.provider);
41
+ }
42
+ clearOlder(input, signal) {
43
+ signal.throwIfAborted();
44
+ return this.ctx.referenceChatHistory.removeOlderThan(input.days);
45
+ }
46
+ clearRemoteMissing(signal) {
47
+ signal.throwIfAborted();
48
+ return this.ctx.referenceChatHistory.removeRemoteMissing();
49
+ }
50
+ clearOldAccounts(signal) {
51
+ signal.throwIfAborted();
52
+ return this.ctx.referenceChatHistory.removeOldAccounts();
53
+ }
54
+ syncStates() { return this.ctx.referenceChatHistory.syncStates(); }
55
+ }