dsh-reference-anything 0.4.3 → 0.5.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 (122) hide show
  1. package/NOTICE.md +58 -0
  2. package/README.md +159 -70
  3. package/cordis.patch.yml +17 -15
  4. package/images/agents/LICENSE +22 -0
  5. package/images/agents/README.md +3 -0
  6. package/images/agents/antigravity.svg +1 -0
  7. package/images/agents/chatgpt.svg +1 -0
  8. package/images/agents/claude.svg +1 -0
  9. package/images/agents/cline.svg +1 -0
  10. package/images/agents/codex.svg +1 -0
  11. package/images/agents/continue.svg +1 -0
  12. package/images/agents/crush.svg +1 -0
  13. package/images/agents/cursor.svg +1 -0
  14. package/images/agents/dsh.svg +1 -0
  15. package/images/agents/gemini.svg +1 -0
  16. package/images/agents/goose.svg +1 -0
  17. package/images/agents/grokbuild.svg +1 -0
  18. package/images/agents/hermes.svg +1 -0
  19. package/images/agents/kilocode.svg +1 -0
  20. package/images/agents/kimi.svg +1 -0
  21. package/images/agents/mimocode.svg +1 -0
  22. package/images/agents/openclaw.svg +1 -0
  23. package/images/agents/opencode.svg +1 -0
  24. package/images/agents/pi.svg +1 -0
  25. package/images/agents/qoder.svg +1 -0
  26. package/images/agents/qwen.svg +1 -0
  27. package/images/agents/reasonix.svg +6 -0
  28. package/images/agents/teleagent.svg +1 -0
  29. package/images/agents/trae.svg +1 -0
  30. package/images/agents/vibe.svg +1 -0
  31. package/images/agents/workbuddy.svg +37 -0
  32. package/images/agents/zcode.svg +1 -0
  33. package/images/agents/zed.svg +1 -0
  34. package/lib/agent-scan-cache.d.ts +13 -0
  35. package/lib/agent-scan-cache.js +43 -0
  36. package/lib/chat-import-compatibility.d.ts +18 -0
  37. package/lib/chat-import-compatibility.js +87 -0
  38. package/lib/chat-import-discovery.d.ts +32 -0
  39. package/lib/chat-import-discovery.js +17 -0
  40. package/lib/chat-import-reader.d.ts +27 -0
  41. package/lib/chat-import-reader.js +111 -0
  42. package/lib/chat-import-runtime.d.ts +4 -0
  43. package/lib/chat-import-runtime.js +4 -0
  44. package/lib/client/index.d.ts +5 -0
  45. package/lib/client.js +4 -33741
  46. package/lib/contract.d.ts +65 -4
  47. package/lib/contract.js +24 -4
  48. package/lib/conversation-availability.d.ts +13 -0
  49. package/lib/conversation-availability.js +76 -0
  50. package/lib/errors.d.ts +2 -2
  51. package/lib/host.d.ts +104 -11
  52. package/lib/host.js +202 -14
  53. package/lib/index.d.ts +3 -1
  54. package/lib/index.js +31 -3
  55. package/lib/local-conversation-reader.d.ts +3 -0
  56. package/lib/local-conversation-reader.js +81 -0
  57. package/lib/local-conversation-scanner.d.ts +18 -0
  58. package/lib/local-conversation-scanner.js +55 -0
  59. package/lib/local-locator.d.ts +14 -0
  60. package/lib/local-locator.js +34 -0
  61. package/lib/local-plugins.d.ts +6 -0
  62. package/lib/local-plugins.js +119 -0
  63. package/lib/local-reference-tools.d.ts +4 -0
  64. package/lib/local-reference-tools.js +195 -0
  65. package/lib/local-reference.d.ts +118 -0
  66. package/lib/local-reference.js +289 -0
  67. package/lib/opencli.d.ts +5 -2
  68. package/lib/opencli.js +88 -64
  69. package/lib/reference.d.ts +5 -3
  70. package/lib/reference.js +167 -72
  71. package/lib/render.d.ts +1 -1
  72. package/lib/render.js +4 -4
  73. package/lib/retain.d.ts +14 -0
  74. package/lib/retain.js +1 -1
  75. package/lib/serialize.d.ts +1 -1
  76. package/lib/serialize.js +2 -2
  77. package/lib/sources/local-agent/index.d.ts +23 -16
  78. package/lib/sources/local-agent/index.js +101 -15
  79. package/lib/store/spec.d.ts +104 -7
  80. package/lib/sync/index.js +4 -0
  81. package/lib/tool.d.ts +2 -0
  82. package/lib/tool.js +36 -41
  83. package/lib/typert.js +3 -0
  84. package/lib/types.d.ts +2 -0
  85. package/lib/update.d.ts +2 -0
  86. package/lib/update.js +12 -0
  87. package/lib/uri-codec.d.ts +1 -0
  88. package/lib/uri-codec.js +64 -3
  89. package/lib/uri.d.ts +1 -10
  90. package/lib/uri.js +16 -5
  91. package/lib/web.js +3 -1
  92. package/lib/wire.d.ts +200 -0
  93. package/lib/wire.js +38 -13
  94. package/opencli-plugin/common.js +5 -3
  95. package/opencli-plugin/opencli-plugin.json +1 -1
  96. package/opencli-plugin/package.json +1 -1
  97. package/package.json +30 -4
  98. package/release-notes/0.4.4/commands.png +0 -0
  99. package/release-notes/0.4.4/demos/agent-import.gif +0 -0
  100. package/release-notes/0.4.4/demos/chat-import-upgrade.gif +0 -0
  101. package/release-notes/0.4.4/demos/folders.gif +0 -0
  102. package/release-notes/0.4.4/demos/local-plugins.gif +0 -0
  103. package/release-notes/0.4.4/demos/shortcuts.gif +0 -0
  104. package/release-notes/0.4.4/features.json +36 -0
  105. package/release-notes/0.4.4/files.png +0 -0
  106. package/release-notes/0.5.0/demos/agent-import.gif +0 -0
  107. package/release-notes/0.5.0/demos/chat-import-upgrade.gif +0 -0
  108. package/release-notes/0.5.0/demos/folders.gif +0 -0
  109. package/release-notes/0.5.0/demos/local-plugins.gif +0 -0
  110. package/release-notes/0.5.0/demos/local-references.gif +0 -0
  111. package/release-notes/0.5.0/demos/shortcuts.gif +0 -0
  112. package/release-notes/0.5.0/features.json +65 -0
  113. package/release-notes/README.md +36 -0
  114. package/vendor/chat-import-reader/LICENSE +22 -0
  115. package/vendor/chat-import-reader/LICENSE.fzstd +21 -0
  116. package/vendor/chat-import-reader/README.md +48 -0
  117. package/vendor/chat-import-reader/availability-worker.mjs +114 -0
  118. package/vendor/chat-import-reader/parsers.d.mts +6 -0
  119. package/vendor/chat-import-reader/parsers.mjs +11168 -0
  120. package/vendor/chat-import-reader/scan-worker.mjs +7 -0
  121. package/vendor/chat-import-reader/scanners.mjs +4286 -0
  122. package/vendor/chat-import-reader/upstream-sha256.json +101 -0
package/lib/contract.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { InvocationDescriptor } from '@deepseek-ai/dsh-typert-protocol';
3
3
  /**
4
4
  * One local-agent transcript as the `@` menu sees it.
5
5
  *
6
- * `id` is the source-scoped `kind:relPath`, not a `dsh-ref:` URI — the client
6
+ * `id` is a source-scoped `kind:relPath` or an opaque import-only selection, not a `dsh-ref:` URI — the client
7
7
  * wraps it, the way it does for web chats, so the `'local-agent'` source string
8
8
  * stays hardcoded in exactly one place. Deliberately carries no `origin`: the
9
9
  * absolute path adds nothing a menu row can use and everything a screen-share
@@ -15,9 +15,19 @@ export declare const agentCandidateSchema: z.ZodReadonly<z.ZodObject<{
15
15
  label: z.ZodString;
16
16
  provider: z.ZodString;
17
17
  updatedAt: z.ZodOptional<z.ZodNumber>;
18
+ referenceId: z.ZodOptional<z.ZodString>;
19
+ importOnly: z.ZodOptional<z.ZodBoolean>;
20
+ importStatus: z.ZodOptional<z.ZodEnum<{
21
+ imported: "imported";
22
+ partial: "partial";
23
+ "not-imported": "not-imported";
24
+ archived: "archived";
25
+ }>>;
26
+ warning: z.ZodOptional<z.ZodString>;
18
27
  }, z.core.$strip>>;
19
28
  export declare const agentStatsSchema: z.ZodReadonly<z.ZodObject<{
20
29
  agent: z.ZodEnum<{
30
+ chatgpt: "chatgpt";
21
31
  kimi: "kimi";
22
32
  "claude-code": "claude-code";
23
33
  codex: "codex";
@@ -32,8 +42,26 @@ export declare const agentStatsSchema: z.ZodReadonly<z.ZodObject<{
32
42
  opencode: "opencode";
33
43
  mimocode: "mimocode";
34
44
  zcode: "zcode";
45
+ antigravity: "antigravity";
46
+ kilocode: "kilocode";
47
+ workbuddy: "workbuddy";
48
+ qwen: "qwen";
49
+ continue: "continue";
50
+ cline: "cline";
51
+ goose: "goose";
52
+ dsh4: "dsh4";
53
+ zed: "zed";
54
+ crush: "crush";
55
+ teleagent: "teleagent";
56
+ trae: "trae";
57
+ vibe: "vibe";
58
+ dsh: "dsh";
35
59
  }>;
36
60
  conversations: z.ZodNumber;
61
+ error: z.ZodOptional<z.ZodString>;
62
+ unavailable: z.ZodOptional<z.ZodBoolean>;
63
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
+ readable: z.ZodOptional<z.ZodBoolean>;
37
65
  }, z.core.$strip>>;
38
66
  export declare const driveCandidateSchema: z.ZodReadonly<z.ZodObject<{
39
67
  id: z.ZodString;
@@ -44,6 +72,20 @@ export declare const driveCandidateSchema: z.ZodReadonly<z.ZodObject<{
44
72
  searchIncomplete: z.ZodOptional<z.ZodBoolean>;
45
73
  isDirectory: z.ZodOptional<z.ZodBoolean>;
46
74
  }, z.core.$strict>>;
75
+ export declare const localPluginCandidateSchema: z.ZodReadonly<z.ZodObject<{
76
+ id: z.ZodString;
77
+ name: z.ZodString;
78
+ label: z.ZodString;
79
+ version: z.ZodOptional<z.ZodString>;
80
+ status: z.ZodEnum<{
81
+ live: "live";
82
+ disabled: "disabled";
83
+ inert: "inert";
84
+ }>;
85
+ type: z.ZodOptional<z.ZodString>;
86
+ directory: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strict>>;
88
+ export type LocalPluginCandidate = z.infer<typeof localPluginCandidateSchema>;
47
89
  export declare const searchInputSchema: z.ZodReadonly<z.ZodObject<{
48
90
  query: z.ZodString;
49
91
  provider: z.ZodOptional<z.ZodEnum<{
@@ -57,8 +99,8 @@ export declare const searchInputSchema: z.ZodReadonly<z.ZodObject<{
57
99
  limit: z.ZodNumber;
58
100
  }, z.core.$strip>>;
59
101
  export declare const matchedViaSchema: z.ZodEnum<{
60
- recent: "recent";
61
102
  title: "title";
103
+ recent: "recent";
62
104
  content: "content";
63
105
  }>;
64
106
  export declare const searchResultSchema: z.ZodReadonly<z.ZodObject<{
@@ -78,8 +120,8 @@ export declare const searchResultSchema: z.ZodReadonly<z.ZodObject<{
78
120
  partial: z.ZodBoolean;
79
121
  syncedAt: z.ZodString;
80
122
  matchedVia: z.ZodEnum<{
81
- recent: "recent";
82
123
  title: "title";
124
+ recent: "recent";
83
125
  content: "content";
84
126
  }>;
85
127
  snippet: z.ZodOptional<z.ZodString>;
@@ -106,6 +148,9 @@ export declare const healthSchema: z.ZodReadonly<z.ZodObject<{
106
148
  }>;
107
149
  extensionVersion: z.ZodOptional<z.ZodString>;
108
150
  profileCount: z.ZodOptional<z.ZodNumber>;
151
+ latestExtensionVersion: z.ZodOptional<z.ZodString>;
152
+ extensionUpdateAvailable: z.ZodOptional<z.ZodBoolean>;
153
+ extensionCompatible: z.ZodOptional<z.ZodBoolean>;
109
154
  opencliCompatible: z.ZodBoolean;
110
155
  daemonVersion: z.ZodOptional<z.ZodString>;
111
156
  daemonStale: z.ZodBoolean;
@@ -141,6 +186,8 @@ export declare const packageUpdateStatusSchema: z.ZodReadonly<z.ZodObject<{
141
186
  releaseNotes: z.ZodOptional<z.ZodString>;
142
187
  releaseUrl: z.ZodOptional<z.ZodString>;
143
188
  error: z.ZodOptional<z.ZodString>;
189
+ currentReleaseNotes: z.ZodOptional<z.ZodString>;
190
+ currentReleaseUrl: z.ZodOptional<z.ZodString>;
144
191
  }, z.core.$strip>>;
145
192
  export declare const packageUpdateResultSchema: z.ZodReadonly<z.ZodObject<{
146
193
  version: z.ZodString;
@@ -412,8 +459,8 @@ export declare const openListMountSchema: z.ZodReadonly<z.ZodObject<{
412
459
  enabled: z.ZodBoolean;
413
460
  status: z.ZodOptional<z.ZodEnum<{
414
461
  error: "error";
415
- ready: "ready";
416
462
  disabled: "disabled";
463
+ ready: "ready";
417
464
  }>>;
418
465
  error: z.ZodOptional<z.ZodString>;
419
466
  capacityUsed: z.ZodOptional<z.ZodNumber>;
@@ -451,4 +498,18 @@ export declare const openListDisableMountSchema: z.ZodReadonly<z.ZodObject<{
451
498
  export declare const openListUpgradeInputSchema: z.ZodReadonly<z.ZodObject<{
452
499
  rollback: z.ZodOptional<z.ZodBoolean>;
453
500
  }, z.core.$strict>>;
501
+ export declare const chatImportCompatibilitySchema: z.ZodReadonly<z.ZodObject<{
502
+ state: z.ZodEnum<{
503
+ unavailable: "unavailable";
504
+ disabled: "disabled";
505
+ ready: "ready";
506
+ incompatible: "incompatible";
507
+ installing: "installing";
508
+ "restart-required": "restart-required";
509
+ }>;
510
+ version: z.ZodString;
511
+ missing: z.ZodArray<z.ZodString>;
512
+ canUpgrade: z.ZodBoolean;
513
+ error: z.ZodOptional<z.ZodString>;
514
+ }, z.core.$strict>>;
454
515
  export declare const REFERENCE_ANYTHING_INVOCATIONS: readonly InvocationDescriptor[];
package/lib/contract.js CHANGED
@@ -3,14 +3,14 @@ import { localAgentSchema, providerSchema, settingsRecordSchema } from "./wire.j
3
3
  /**
4
4
  * One local-agent transcript as the `@` menu sees it.
5
5
  *
6
- * `id` is the source-scoped `kind:relPath`, not a `dsh-ref:` URI — the client
6
+ * `id` is a source-scoped `kind:relPath` or an opaque import-only selection, not a `dsh-ref:` URI — the client
7
7
  * wraps it, the way it does for web chats, so the `'local-agent'` source string
8
8
  * stays hardcoded in exactly one place. Deliberately carries no `origin`: the
9
9
  * absolute path adds nothing a menu row can use and everything a screen-share
10
10
  * leaks.
11
11
  */
12
- export const agentCandidateSchema = z.object({ id: z.string(), kind: z.string(), label: z.string(), provider: z.string(), updatedAt: z.number().optional() }).readonly();
13
- export const agentStatsSchema = z.object({ agent: localAgentSchema, conversations: z.number().int().nonnegative() }).readonly();
12
+ export const agentCandidateSchema = z.object({ id: z.string(), kind: z.string(), label: z.string(), provider: z.string(), updatedAt: z.number().optional(), referenceId: z.string().optional(), importOnly: z.boolean().optional(), importStatus: z.enum(['imported', 'partial', 'not-imported', 'archived']).optional(), warning: z.string().optional() }).readonly();
13
+ export const agentStatsSchema = z.object({ agent: localAgentSchema, conversations: z.number().int().nonnegative(), error: z.string().optional(), unavailable: z.boolean().optional(), paths: z.array(z.string()).optional(), readable: z.boolean().optional() }).readonly();
14
14
  // `origin` is the drive's own display path, shown under the candidate. It is
15
15
  // never a download URL: those are signed with the account's credential and
16
16
  // must not cross this wire.
@@ -19,6 +19,15 @@ export const driveCandidateSchema = z.object({
19
19
  origin: z.string().optional(), updatedAt: z.number().optional(),
20
20
  searchIncomplete: z.boolean().optional(), isDirectory: z.boolean().optional(),
21
21
  }).strict().readonly();
22
+ export const localPluginCandidateSchema = z.object({
23
+ id: z.string(),
24
+ name: z.string(),
25
+ label: z.string(),
26
+ version: z.string().optional(),
27
+ status: z.enum(['live', 'disabled', 'inert']),
28
+ type: z.string().optional(),
29
+ directory: z.string().optional(),
30
+ }).strict().readonly();
22
31
  /**
23
32
  * Binds the calling session to the invocation, so the Host can scope a search
24
33
  * to the session's cwd. Reintroduced here after 0.3.0 handed file and session
@@ -40,6 +49,7 @@ export const healthSchema = z.object({
40
49
  version: z.string(), daemon: z.string(), pluginInstalled: z.boolean(),
41
50
  daemonRunning: z.boolean(), extensionConnected: z.boolean(), extensionState: extensionStateSchema,
42
51
  extensionVersion: z.string().optional(), profileCount: z.number().int().nonnegative().optional(),
52
+ latestExtensionVersion: z.string().optional(), extensionUpdateAvailable: z.boolean().optional(), extensionCompatible: z.boolean().optional(),
43
53
  opencliCompatible: z.boolean(), daemonVersion: z.string().optional(), daemonStale: z.boolean(),
44
54
  connectivityOk: z.boolean(), connectivityChecked: z.boolean(), pluginVersion: z.string().optional(), adapterCommandsReady: z.boolean(), adapterCompatible: z.boolean(), latestVersion: z.string().optional(), updateAvailable: z.boolean(),
45
55
  versionError: z.string().optional(), daemonError: z.string().optional(), pluginError: z.string().optional(), doctorError: z.string().optional(),
@@ -51,6 +61,7 @@ export const openCliDiscoverySchema = z.object({
51
61
  export const packageUpdateStatusSchema = z.object({
52
62
  currentVersion: z.string(), latestVersion: z.string(), updateAvailable: z.boolean(),
53
63
  checkedAt: z.number().int().nonnegative(), releaseNotes: z.string().max(12_000).optional(), releaseUrl: z.string().url().optional(), error: z.string().optional(),
64
+ currentReleaseNotes: z.string().max(12_000).optional(), currentReleaseUrl: z.string().url().optional(),
54
65
  }).readonly();
55
66
  export const packageUpdateResultSchema = z.object({
56
67
  version: z.string(), restartRequired: z.boolean(),
@@ -116,8 +127,16 @@ export const openListMountCreateSchema = z.object({ id: z.string().min(1).option
116
127
  export const openListMountInputSchema = z.object({ id: z.string().min(1) }).strict().readonly();
117
128
  export const openListDisableMountSchema = z.object({ id: z.string().min(1), disabled: z.boolean().optional() }).strict().readonly();
118
129
  export const openListUpgradeInputSchema = z.object({ rollback: z.boolean().optional() }).strict().readonly();
130
+ export const chatImportCompatibilitySchema = z.object({
131
+ state: z.enum(['ready', 'incompatible', 'unavailable', 'disabled', 'installing', 'restart-required']),
132
+ version: z.string(), missing: z.array(z.string()), canUpgrade: z.boolean(), error: z.string().optional(),
133
+ }).strict().readonly();
119
134
  export const REFERENCE_ANYTHING_INVOCATIONS = [
120
- descriptor('agentSearch', [agentLookup, { name: 'input', wire: 'input', source: 'json', codec: strict('AgentSearchInput', z.object({ query: z.string(), limit: z.number().int().min(1).max(100) }).readonly()) }], strict('AgentCandidate[]', z.array(agentCandidateSchema)), true),
135
+ descriptor('chatImportStatus', [], strict('ChatImportCompatibility', chatImportCompatibilitySchema)),
136
+ descriptor('chatImportUpgradeInstall', [], strict('ChatImportCompatibility', chatImportCompatibilitySchema), true),
137
+ descriptor('agentResume', [agentLookup, { name: 'input', wire: 'input', source: 'json', codec: strict('AgentResumeInput', z.object({ id: z.string().min(1) }).strict().readonly()) }], strict('ResumeSummary', z.string().min(1)), true),
138
+ descriptor('agentImport', [agentLookup, { name: 'input', wire: 'input', source: 'json', codec: strict('AgentImportInput', z.object({ id: z.string().min(1) }).strict().readonly()) }], strict('ImportedSessionId', z.string().min(1)), true),
139
+ descriptor('agentSearch', [agentLookup, { name: 'input', wire: 'input', source: 'json', codec: strict('AgentSearchInput', z.object({ query: z.string(), limit: z.number().int().min(1).max(100), kind: localAgentSchema.optional() }).readonly()) }], strict('AgentCandidate[]', z.array(agentCandidateSchema)), true),
121
140
  descriptor('agentStats', [], strict('AgentStats[]', z.array(agentStatsSchema)), true),
122
141
  // No session lookup, unlike `agentSearch`: a drive is the same drive from
123
142
  // every workspace, so there is nothing to scope the query to.
@@ -158,6 +177,7 @@ export const REFERENCE_ANYTHING_INVOCATIONS = [
158
177
  descriptor('openListDisableMount', [{ name: 'input', wire: 'input', source: 'json', codec: strict('OpenListDisableMountInput', openListDisableMountSchema) }], strict('Boolean', z.boolean()), true),
159
178
  descriptor('openListRemoveMount', [{ name: 'input', wire: 'input', source: 'json', codec: strict('OpenListMountInput', openListMountInputSchema) }], strict('Boolean', z.boolean()), true),
160
179
  descriptor('openListReindex', [{ name: 'input', wire: 'input', source: 'json', codec: strict('OpenListMountInput', openListMountInputSchema) }], strict('OpenListReindex', z.object({ supported: z.boolean(), reason: z.string().optional() }).readonly()), true),
180
+ descriptor('localPlugins', [], strict('LocalPluginCandidate[]', z.array(localPluginCandidateSchema)), true),
161
181
  ];
162
182
  function strict(type, schema) {
163
183
  return { mode: 'strict', typeSymbol: `dsh-reference-anything#${type}`, schema, create: () => schema };
@@ -0,0 +1,13 @@
1
+ import type { ChatImportTarget } from './chat-import-reader.ts';
2
+ /** Unknown/error rows stay visible. One background parser never delays discovery. */
3
+ export declare class ConversationAvailability {
4
+ private cache;
5
+ private queued;
6
+ private worker?;
7
+ private active?;
8
+ private timer?;
9
+ visible(target: ChatImportTarget): Promise<boolean>;
10
+ private next;
11
+ private failed;
12
+ dispose(): void;
13
+ }
@@ -0,0 +1,76 @@
1
+ import { stat } from 'node:fs/promises';
2
+ import { spawn } from 'node:child_process';
3
+ import { fileURLToPath } from 'node:url';
4
+ /** Unknown/error rows stay visible. One background parser never delays discovery. */
5
+ export class ConversationAvailability {
6
+ cache = new Map();
7
+ queued = new Map();
8
+ worker;
9
+ active;
10
+ timer;
11
+ async visible(target) {
12
+ const key = JSON.stringify(target);
13
+ const entry = this.cache.get(key);
14
+ if (entry) {
15
+ const unchanged = (await Promise.all(entry.dependencies.map(async ([path, version]) => {
16
+ try {
17
+ const s = await stat(path);
18
+ return version === `${s.size}:${s.mtimeMs}:${s.ctimeMs}`;
19
+ }
20
+ catch (error) {
21
+ return error.code === 'ENOENT' && version === 'missing';
22
+ }
23
+ }))).every(Boolean);
24
+ if (unchanged && (entry.state !== 'unknown' || Date.now() - entry.checked < 300_000))
25
+ return entry.state !== 'empty';
26
+ this.cache.delete(key);
27
+ }
28
+ if (this.active !== key && this.queued.size < 128)
29
+ this.queued.set(key, target);
30
+ this.next();
31
+ return true;
32
+ }
33
+ next() {
34
+ if (this.active || !this.queued.size)
35
+ return;
36
+ const [id, target] = this.queued.entries().next().value;
37
+ this.queued.delete(id);
38
+ this.active = id;
39
+ if (!this.worker) {
40
+ // Native parser failures and V8 OOM must not terminate the DSH host.
41
+ this.worker = spawn(process.execPath, ['--max-old-space-size=256', fileURLToPath(new URL('../vendor/chat-import-reader/availability-worker.mjs', import.meta.url))], {
42
+ windowsHide: true, stdio: ['ignore', 'ignore', 'ignore', 'ipc'],
43
+ });
44
+ this.worker.on('message', (result) => {
45
+ if (result.id !== this.active)
46
+ return;
47
+ clearTimeout(this.timer);
48
+ if (this.cache.size >= 2000)
49
+ this.cache.delete(this.cache.keys().next().value);
50
+ this.cache.set(result.id, { ...result, checked: Date.now() });
51
+ this.active = undefined;
52
+ this.next();
53
+ });
54
+ this.worker.on('error', () => this.failed());
55
+ this.worker.on('exit', () => this.failed());
56
+ this.worker.unref();
57
+ this.worker.channel?.unref();
58
+ }
59
+ this.timer = setTimeout(() => this.failed(), 15_000);
60
+ this.timer.unref();
61
+ this.worker.send({ id, target });
62
+ }
63
+ failed() {
64
+ if (this.active)
65
+ this.cache.set(this.active, { state: 'unknown', dependencies: [], checked: Date.now() });
66
+ this.dispose();
67
+ this.next();
68
+ }
69
+ dispose() {
70
+ clearTimeout(this.timer);
71
+ this.worker?.removeAllListeners();
72
+ this.worker?.kill();
73
+ this.worker = undefined;
74
+ this.active = undefined;
75
+ }
76
+ }
package/lib/errors.d.ts CHANGED
@@ -5,9 +5,9 @@
5
5
  */
6
6
  import { HarnessError } from '@deepseek-ai/dsh-llm';
7
7
  /** Stable, machine-routable failure classes; route on these, never on message text. */
8
- export type ReferenceErrorCode =
8
+ export type ReferenceErrorCode = 'INVALID_ARGUMENT' | 'SOURCE_DISABLED' | 'ACCESS_DENIED' | 'NOT_FOUND' | 'REVISION_REQUIRED' | 'REVISION_CHANGED' | 'UNSUPPORTED_PART' | 'IMAGE_UNAVAILABLE' | 'IMAGE_TOO_LARGE' | 'BUDGET_TOO_SMALL' | 'READ_FAILED' | 'TIMEOUT' | 'CANCELLED'
9
9
  /** Two sources claimed the same registry id. */
10
- 'SOURCE_DUPLICATE'
10
+ | 'SOURCE_DUPLICATE'
11
11
  /** A reference named a source that is not registered. */
12
12
  | 'SOURCE_UNKNOWN'
13
13
  /** The owning source is registered but reported itself unusable. */
package/lib/host.d.ts CHANGED
@@ -3,8 +3,50 @@ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
3
3
  import type { ChatProvider, SettingsRecord } from './store/spec.ts';
4
4
  import type { SyncMode } from './sync/index.ts';
5
5
  import type { Agent } from '@deepseek-ai/dsh-agent';
6
+ import { type LocalAgent } from './wire.ts';
7
+ import type { AgentCandidate } from './client/remote.ts';
8
+ declare module '@deepseek-ai/cordis' {
9
+ interface Context {
10
+ chatImport: {
11
+ readConversation?(input: {
12
+ format: string;
13
+ path: string;
14
+ sessionId?: string;
15
+ limit?: number;
16
+ before?: number;
17
+ revision?: string;
18
+ detail?: 'summary' | 'full';
19
+ }, signal?: AbortSignal): Promise<unknown>;
20
+ discoveryRoots?(): Record<string, string | string[] | null>;
21
+ scanDiscover(input: {
22
+ format?: string;
23
+ path?: string;
24
+ query?: string;
25
+ }, signal?: AbortSignal): Promise<unknown>;
26
+ importPath(input: {
27
+ format: string;
28
+ path: string;
29
+ sessionIds?: string[];
30
+ }, signal?: AbortSignal): Promise<unknown>;
31
+ resumeSummary(input: {
32
+ format: 'claude' | 'codex';
33
+ path: string;
34
+ }, signal?: AbortSignal): Promise<unknown>;
35
+ };
36
+ }
37
+ }
6
38
  export declare class ReferenceAnythingRemote extends TypertRemoteService {
39
+ chatImportStatus(): Promise<import("./chat-import-compatibility.ts").ChatImportCompatibility>;
40
+ chatImportUpgradeInstall(signal: AbortSignal): Promise<import("./chat-import-compatibility.ts").ChatImportCompatibility>;
41
+ private readonly agentScans;
42
+ private readonly scannedTargets;
7
43
  constructor(ctx: Context);
44
+ agentResume(_agent: Agent, input: {
45
+ id: string;
46
+ }, signal: AbortSignal): Promise<string>;
47
+ agentImport(_agent: Agent, input: {
48
+ id: string;
49
+ }, signal: AbortSignal): Promise<string>;
8
50
  /**
9
51
  * Discovery for the `@` menu's local-agent group.
10
52
  *
@@ -17,18 +59,17 @@ export declare class ReferenceAnythingRemote extends TypertRemoteService {
17
59
  agentSearch(agent: Agent, input: {
18
60
  query: string;
19
61
  limit: number;
20
- }, signal: AbortSignal): Promise<{
21
- searchIncomplete?: boolean | undefined;
22
- updatedAt?: number | undefined;
23
- id: string;
24
- kind: string;
25
- label: string;
26
- provider: string;
27
- }[]>;
62
+ kind?: LocalAgent;
63
+ }, signal: AbortSignal): Promise<AgentCandidate[]>;
28
64
  agentStats(signal: AbortSignal): Promise<{
29
- agent: import("./sources/local-agent/types.ts").AgentKind;
65
+ readable: boolean;
66
+ paths?: string[];
67
+ agent: LocalAgent;
30
68
  conversations: number;
69
+ error?: string;
70
+ unavailable?: boolean;
31
71
  }[]>;
72
+ private assertScannedSelection;
32
73
  /**
33
74
  * Discovery for the `@` menu's cloud-drive group.
34
75
  *
@@ -86,10 +127,10 @@ export declare class ReferenceAnythingRemote extends TypertRemoteService {
86
127
  historyMode: "metadata-only" | "offline-mirror";
87
128
  syncHistoryDays: number | null;
88
129
  enabledProviders: ("chatgpt" | "claude" | "gemini" | "deepseek" | "grok" | "kimi")[];
89
- enabledAgents: ("kimi" | "claude-code" | "codex" | "cursor" | "qoder" | "reasonix" | "openclaw" | "grokbuild" | "hermes" | "gemini-cli" | "pi" | "opencode" | "mimocode" | "zcode")[];
130
+ enabledAgents: ("chatgpt" | "kimi" | "claude-code" | "codex" | "cursor" | "qoder" | "reasonix" | "openclaw" | "grokbuild" | "hermes" | "gemini-cli" | "pi" | "opencode" | "mimocode" | "zcode" | "antigravity" | "kilocode" | "workbuddy" | "qwen" | "continue" | "cline" | "goose" | "dsh4" | "zed" | "crush" | "teleagent" | "trae" | "vibe" | "dsh")[];
90
131
  maxReadTurns: number;
91
132
  inputRenderMode: "pill" | "raw-text";
92
- agentDirectories?: Partial<Record<"kimi" | "claude-code" | "codex" | "cursor" | "qoder" | "reasonix" | "openclaw" | "grokbuild" | "hermes" | "gemini-cli" | "pi" | "opencode" | "mimocode" | "zcode", string>> | undefined;
133
+ agentDirectories?: Partial<Record<"chatgpt" | "kimi" | "claude-code" | "codex" | "cursor" | "qoder" | "reasonix" | "openclaw" | "grokbuild" | "hermes" | "gemini-cli" | "pi" | "opencode" | "mimocode" | "zcode" | "antigravity" | "kilocode" | "workbuddy" | "qwen" | "continue" | "cline" | "goose" | "dsh4" | "zed" | "crush" | "teleagent" | "trae" | "vibe" | "dsh", string>> | undefined;
93
134
  enabledDriveMounts?: string[] | undefined;
94
135
  picker?: {
95
136
  displayMode: "collapse" | "native-scroll";
@@ -98,42 +139,85 @@ export declare class ReferenceAnythingRemote extends TypertRemoteService {
98
139
  order: number;
99
140
  limit: number;
100
141
  maxCandidates: number;
142
+ sort: "name" | "updated";
143
+ shortcut: string;
144
+ aliases?: string[] | undefined;
145
+ sourceAliases?: Record<string, string[]> | undefined;
101
146
  };
102
147
  skills: {
103
148
  enabled: boolean;
104
149
  order: number;
105
150
  limit: number;
106
151
  maxCandidates: number;
152
+ sort: "name" | "updated";
153
+ shortcut: string;
154
+ aliases?: string[] | undefined;
155
+ sourceAliases?: Record<string, string[]> | undefined;
107
156
  };
108
157
  files: {
109
158
  enabled: boolean;
110
159
  order: number;
111
160
  limit: number;
112
161
  maxCandidates: number;
162
+ sort: "name" | "updated";
163
+ shortcut: string;
164
+ aliases?: string[] | undefined;
165
+ sourceAliases?: Record<string, string[]> | undefined;
113
166
  };
114
167
  sessions: {
115
168
  enabled: boolean;
116
169
  order: number;
117
170
  limit: number;
118
171
  maxCandidates: number;
172
+ sort: "name" | "updated";
173
+ shortcut: string;
174
+ aliases?: string[] | undefined;
175
+ sourceAliases?: Record<string, string[]> | undefined;
119
176
  };
120
177
  agents: {
121
178
  enabled: boolean;
122
179
  order: number;
123
180
  limit: number;
124
181
  maxCandidates: number;
182
+ sort: "name" | "updated";
183
+ shortcut: string;
184
+ showImport: boolean;
185
+ showSummary: boolean;
186
+ skipConfirmation: boolean;
187
+ aliases?: string[] | undefined;
188
+ sourceAliases?: Record<string, string[]> | undefined;
125
189
  };
126
190
  conversations: {
127
191
  enabled: boolean;
128
192
  order: number;
129
193
  limit: number;
130
194
  maxCandidates: number;
195
+ sort: "name" | "updated";
196
+ shortcut: string;
197
+ aliases?: string[] | undefined;
198
+ sourceAliases?: Record<string, string[]> | undefined;
131
199
  };
132
200
  drives: {
133
201
  enabled: boolean;
134
202
  order: number;
135
203
  limit: number;
136
204
  maxCandidates: number;
205
+ sort: "name" | "updated";
206
+ shortcut: string;
207
+ aliases?: string[] | undefined;
208
+ sourceAliases?: Record<string, string[]> | undefined;
209
+ };
210
+ plugins: {
211
+ enabled: boolean;
212
+ order: number;
213
+ limit: number;
214
+ maxCandidates: number;
215
+ sort: "name" | "updated";
216
+ shortcut: string;
217
+ onlyLive: boolean;
218
+ showDeepSeek: boolean;
219
+ aliases?: string[] | undefined;
220
+ sourceAliases?: Record<string, string[]> | undefined;
137
221
  };
138
222
  } | undefined;
139
223
  }>;
@@ -197,4 +281,13 @@ export declare class ReferenceAnythingRemote extends TypertRemoteService {
197
281
  }, signal: AbortSignal): Promise<{
198
282
  supported: true;
199
283
  }>;
284
+ localPlugins(signal: AbortSignal): Promise<readonly Readonly<{
285
+ id: string;
286
+ name: string;
287
+ label: string;
288
+ status: "live" | "disabled" | "inert";
289
+ version?: string | undefined;
290
+ type?: string | undefined;
291
+ directory?: string | undefined;
292
+ }>[]>;
200
293
  }