dsh-reference-anything 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/contract.d.ts CHANGED
@@ -98,19 +98,6 @@ export declare const packageUpdateResultSchema: z.ZodReadonly<z.ZodObject<{
98
98
  version: z.ZodString;
99
99
  restartRequired: z.ZodBoolean;
100
100
  }, z.core.$strip>>;
101
- export declare const referenceUiModeInputSchema: z.ZodReadonly<z.ZodObject<{
102
- mode: z.ZodEnum<{
103
- plugin: "plugin";
104
- official: "official";
105
- }>;
106
- }, z.core.$strip>>;
107
- export declare const referenceUiSwitchResultSchema: z.ZodReadonly<z.ZodObject<{
108
- mode: z.ZodEnum<{
109
- plugin: "plugin";
110
- official: "official";
111
- }>;
112
- restartRequired: z.ZodLiteral<false>;
113
- }, z.core.$strip>>;
114
101
  export declare const providerStatsSchema: z.ZodReadonly<z.ZodObject<{
115
102
  provider: z.ZodEnum<{
116
103
  chatgpt: "chatgpt";
package/lib/contract.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { providerSchema, referenceUiModeSchema, settingsRecordSchema } from "./wire.js";
2
+ import { providerSchema, settingsRecordSchema } from "./wire.js";
3
3
  export const searchInputSchema = z.object({
4
4
  query: z.string(), provider: providerSchema.optional(), limit: z.number().int().min(1).max(100),
5
5
  }).readonly();
@@ -29,8 +29,6 @@ export const packageUpdateStatusSchema = z.object({
29
29
  export const packageUpdateResultSchema = z.object({
30
30
  version: z.string(), restartRequired: z.boolean(),
31
31
  }).readonly();
32
- export const referenceUiModeInputSchema = z.object({ mode: referenceUiModeSchema }).readonly();
33
- export const referenceUiSwitchResultSchema = z.object({ mode: referenceUiModeSchema, restartRequired: z.literal(false) }).readonly();
34
32
  export const providerStatsSchema = z.object({
35
33
  provider: providerSchema, conversations: z.number().int().nonnegative(), lastSyncedAt: z.string(),
36
34
  status: z.enum(['ready', 'syncing', 'error', 'empty']), error: z.string().optional(),
@@ -81,7 +79,6 @@ export const REFERENCE_ANYTHING_INVOCATIONS = [
81
79
  descriptor('updateStatus', [], strict('PackageUpdateStatus', packageUpdateStatusSchema), true),
82
80
  descriptor('checkUpdate', [], strict('PackageUpdateStatus', packageUpdateStatusSchema), true),
83
81
  descriptor('installUpdate', [], strict('PackageUpdateResult', packageUpdateResultSchema), true),
84
- descriptor('switchReferenceUiMode', [{ name: 'input', wire: 'input', source: 'json', codec: strict('ReferenceUiModeInput', referenceUiModeInputSchema) }], strict('ReferenceUiSwitchResult', referenceUiSwitchResultSchema), true),
85
82
  descriptor('stats', [], strict('ProviderStats[]', z.array(providerStatsSchema))),
86
83
  descriptor('syncStart', [{ name: 'input', wire: 'input', source: 'json', codec: strict('SyncStart', syncStartSchema) }], strict('JobId', z.string())),
87
84
  descriptor('syncStatus', [{ name: 'input', wire: 'input', source: 'json', codec: strict('JobInput', jobInputSchema) }], strict('SyncStatus?', syncStatusSchema.optional())),
package/lib/host.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
3
3
  import type { ChatProvider, SettingsRecord } from './store/spec.ts';
4
- import type { ReferenceUiMode } from './wire.ts';
5
4
  import type { SyncMode } from './sync/index.ts';
6
5
  export declare class ReferenceAnythingRemote extends TypertRemoteService {
7
6
  constructor(ctx: Context);
@@ -20,9 +19,6 @@ export declare class ReferenceAnythingRemote extends TypertRemoteService {
20
19
  updateStatus(signal: AbortSignal): Promise<import("./update.ts").PackageUpdateStatus>;
21
20
  checkUpdate(signal: AbortSignal): Promise<import("./update.ts").PackageUpdateStatus>;
22
21
  installUpdate(signal: AbortSignal): Promise<import("./update.ts").PackageUpdateResult>;
23
- switchReferenceUiMode(input: {
24
- mode: ReferenceUiMode;
25
- }, signal: AbortSignal): Promise<import("./profile-mode.ts").ReferenceUiSwitchResult>;
26
22
  stats(): import("./store/store.ts").ProviderStats[];
27
23
  syncStart(input: {
28
24
  providers: ChatProvider[];
@@ -46,7 +42,6 @@ export declare class ReferenceAnythingRemote extends TypertRemoteService {
46
42
  enabledProviders: ("chatgpt" | "claude" | "gemini" | "deepseek" | "grok" | "kimi")[];
47
43
  maxReadTurns: number;
48
44
  inputRenderMode: "pill" | "raw-text";
49
- referenceUiMode?: "plugin" | "official" | undefined;
50
45
  picker?: {
51
46
  displayMode: "collapse" | "native-scroll";
52
47
  commands: {
package/lib/host.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
2
- import { switchReferenceUiMode as switchProfileReferenceUiMode } from "./profile-mode.js";
3
2
  export class ReferenceAnythingRemote extends TypertRemoteService {
4
3
  constructor(ctx) { super(ctx, 'referenceAnything'); }
5
4
  search(input, signal) {
@@ -16,19 +15,6 @@ export class ReferenceAnythingRemote extends TypertRemoteService {
16
15
  updateStatus(signal) { return this.ctx.referenceChatHistory.updateStatus(signal); }
17
16
  checkUpdate(signal) { return this.ctx.referenceChatHistory.checkUpdate(signal); }
18
17
  installUpdate(signal) { return this.ctx.referenceChatHistory.installUpdate(signal); }
19
- async switchReferenceUiMode(input, signal) {
20
- const settings = this.ctx.referenceChatHistory.getSettings();
21
- const previousMode = settings.referenceUiMode ?? 'plugin';
22
- const result = await switchProfileReferenceUiMode({ mode: input.mode, signal });
23
- try {
24
- await this.ctx.referenceChatHistory.updateSettings({ ...settings, referenceUiMode: input.mode });
25
- }
26
- catch (error) {
27
- await switchProfileReferenceUiMode({ mode: previousMode }).catch(() => undefined);
28
- throw error;
29
- }
30
- return result;
31
- }
32
18
  stats() { return this.ctx.referenceChatHistory.stats(); }
33
19
  syncStart(input) {
34
20
  return this.ctx.referenceChatHistory.sync.start(input.providers, input.mode);
@@ -192,10 +192,6 @@ export declare const referenceAnythingDomainSpec: {
192
192
  pill: "pill";
193
193
  "raw-text": "raw-text";
194
194
  }>>;
195
- referenceUiMode: z.ZodOptional<z.ZodEnum<{
196
- plugin: "plugin";
197
- official: "official";
198
- }>>;
199
195
  picker: z.ZodOptional<z.ZodObject<{
200
196
  displayMode: z.ZodDefault<z.ZodEnum<{
201
197
  collapse: "collapse";
package/lib/typert.js CHANGED
@@ -16,7 +16,6 @@ export const TYPERT_MANIFEST = {
16
16
  { kind: 'method', name: 'updateStatus', signature: 'updateStatus(signal: AbortSignal): Promise<PackageUpdateStatus>' },
17
17
  { kind: 'method', name: 'checkUpdate', signature: 'checkUpdate(signal: AbortSignal): Promise<PackageUpdateStatus>' },
18
18
  { kind: 'method', name: 'installUpdate', signature: 'installUpdate(signal: AbortSignal): Promise<PackageUpdateResult>' },
19
- { kind: 'method', name: 'switchReferenceUiMode', signature: 'switchReferenceUiMode(input: ReferenceUiModeInput, signal: AbortSignal): Promise<ReferenceUiSwitchResult>' },
20
19
  { kind: 'method', name: 'stats', signature: 'stats(): ProviderStats[]' },
21
20
  { kind: 'method', name: 'syncStart', signature: 'syncStart(input: SyncStart): string' },
22
21
  { kind: 'method', name: 'syncStatus', signature: 'syncStatus(input: JobInput): SyncStatus | undefined' },
package/lib/wire.d.ts CHANGED
@@ -68,11 +68,6 @@ export declare const inputRenderModeSchema: z.ZodEnum<{
68
68
  "raw-text": "raw-text";
69
69
  }>;
70
70
  export type InputRenderMode = z.infer<typeof inputRenderModeSchema>;
71
- export declare const referenceUiModeSchema: z.ZodEnum<{
72
- plugin: "plugin";
73
- official: "official";
74
- }>;
75
- export type ReferenceUiMode = z.infer<typeof referenceUiModeSchema>;
76
71
  /** Defaults used before the user saves the General section. */
77
72
  export declare function defaultPickerSettings(): PickerSettings;
78
73
  /** Picker settings have a fixed schema, so explicit comparison is cheap and stable. */
@@ -101,10 +96,6 @@ export declare const settingsRecordSchema: z.ZodObject<{
101
96
  pill: "pill";
102
97
  "raw-text": "raw-text";
103
98
  }>>;
104
- referenceUiMode: z.ZodOptional<z.ZodEnum<{
105
- plugin: "plugin";
106
- official: "official";
107
- }>>;
108
99
  picker: z.ZodOptional<z.ZodObject<{
109
100
  displayMode: z.ZodDefault<z.ZodEnum<{
110
101
  collapse: "collapse";
package/lib/wire.js CHANGED
@@ -18,7 +18,6 @@ export const pickerSettingsSchema = z.object({
18
18
  conversations: pickerSourceSettingsSchema,
19
19
  });
20
20
  export const inputRenderModeSchema = z.enum(['pill', 'raw-text']);
21
- export const referenceUiModeSchema = z.enum(['plugin', 'official']);
22
21
  /** Defaults used before the user saves the General section. */
23
22
  export function defaultPickerSettings() {
24
23
  return {
@@ -50,8 +49,6 @@ export const settingsRecordSchema = z.object({
50
49
  enabledProviders: z.array(providerSchema).default([...ALL_PROVIDERS]),
51
50
  maxReadTurns: z.number().int().min(1).max(100).default(10),
52
51
  inputRenderMode: inputRenderModeSchema.default('pill'),
53
- // Optional keeps settings written by earlier plugin versions readable.
54
- referenceUiMode: referenceUiModeSchema.optional(),
55
52
  // Optional keeps existing on-disk settings forward-compatible. The client
56
53
  // uses defaultPickerSettings() until the user saves the General section.
57
54
  picker: pickerSettingsSchema.optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-reference-anything",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Reference locally mirrored ChatGPT, Claude, Gemini, DeepSeek, Grok, and Kimi conversations from DeepSeek Harness",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -85,34 +85,34 @@
85
85
  "peerDependencies": {
86
86
  "@deepseek-ai/cordis": ">=4.0.1",
87
87
  "@deepseek-ai/dsh-agent": ">=0.1.0-rc.6",
88
- "@deepseek-ai/dsh-api-remotes": ">=0.1.0-rc.8",
88
+ "@deepseek-ai/dsh-api-remotes": ">=0.1.0-rc.8",
89
89
  "@deepseek-ai/dsh-attachment": ">=0.1.0-rc.6",
90
- "@deepseek-ai/dsh-client-connection": ">=0.1.0-rc.8",
91
- "@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.8",
92
- "@deepseek-ai/dsh-client-runtime": ">=0.1.0-rc.8",
93
- "@deepseek-ai/dsh-client-ui-conversation": ">=0.1.0-rc.8",
94
- "@deepseek-ai/dsh-client-ui-input-trigger": ">=0.1.0-rc.8",
95
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.0-rc.8",
96
- "@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.8",
97
- "@deepseek-ai/dsh-file-reference": ">=0.1.0-rc.8",
90
+ "@deepseek-ai/dsh-client-connection": ">=0.1.0-rc.8",
91
+ "@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.8",
92
+ "@deepseek-ai/dsh-client-runtime": ">=0.1.0-rc.8",
93
+ "@deepseek-ai/dsh-client-ui-conversation": ">=0.1.0-rc.8",
94
+ "@deepseek-ai/dsh-client-ui-input-trigger": ">=0.1.0-rc.8",
95
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.0-rc.8",
96
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.8",
97
+ "@deepseek-ai/dsh-file-reference": ">=0.1.0-rc.8",
98
98
  "@deepseek-ai/dsh-llm": ">=0.1.0-rc.6",
99
99
  "@deepseek-ai/dsh-output-retention": ">=0.1.0-rc.6",
100
100
  "@deepseek-ai/dsh-session": ">=0.1.0-rc.6",
101
101
  "@deepseek-ai/dsh-session-reference": ">=0.1.0-rc.6",
102
- "@deepseek-ai/dsh-settings": ">=0.1.0-rc.8",
103
- "@deepseek-ai/dsh-storage-domain": ">=0.1.0-rc.8",
102
+ "@deepseek-ai/dsh-settings": ">=0.1.0-rc.8",
103
+ "@deepseek-ai/dsh-storage-domain": ">=0.1.0-rc.8",
104
104
  "@deepseek-ai/dsh-tools": ">=0.1.0-rc.6",
105
105
  "@deepseek-ai/dsh-typert-protocol": ">=0.1.0-rc.6",
106
- "@deepseek-ai/dsh-typert-registry": ">=0.1.0-rc.8",
106
+ "@deepseek-ai/dsh-typert-registry": ">=0.1.0-rc.8",
107
107
  "react": "^18.2.0"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
- "@deepseek-ai/dsh-session-reference": {
111
- "optional": true
112
- },
113
- "@deepseek-ai/dsh-file-reference": {
114
- "optional": true
115
- },
110
+ "@deepseek-ai/dsh-session-reference": {
111
+ "optional": true
112
+ },
113
+ "@deepseek-ai/dsh-file-reference": {
114
+ "optional": true
115
+ },
116
116
  "@deepseek-ai/dsh-client-runtime": {
117
117
  "optional": true
118
118
  },
@@ -160,8 +160,8 @@
160
160
  "@deepseek-ai/dsh-client-ui-conversation": "link:../deepseek-harness/packages/client/ui-conversation",
161
161
  "@deepseek-ai/dsh-client-ui-input-trigger": "link:../deepseek-harness/packages/client/ui-input-trigger",
162
162
  "@deepseek-ai/dsh-client-ui-settings": "link:../deepseek-harness/packages/client/ui-settings",
163
- "@deepseek-ai/dsh-client-ui-slots": "link:../deepseek-harness/packages/client/ui-slots",
164
- "@deepseek-ai/dsh-file-reference": "link:../deepseek-harness/packages/context/file-reference",
163
+ "@deepseek-ai/dsh-client-ui-slots": "link:../deepseek-harness/packages/client/ui-slots",
164
+ "@deepseek-ai/dsh-file-reference": "link:../deepseek-harness/packages/context/file-reference",
165
165
  "@deepseek-ai/dsh-llm": "link:../deepseek-harness/packages/llm/llm",
166
166
  "@deepseek-ai/dsh-output-retention": "link:../deepseek-harness/packages/util/output-retention",
167
167
  "@deepseek-ai/dsh-session": "link:../deepseek-harness/packages/core/session",
@@ -1,30 +0,0 @@
1
- import type { ReferenceUiMode } from './wire.ts';
2
- export declare const OFFICIAL_REFERENCE_PATCH_BEGIN = "# BEGIN dsh-reference-anything managed official-reference override";
3
- export declare const OFFICIAL_REFERENCE_PATCH_END = "# END dsh-reference-anything managed official-reference override";
4
- export interface ReferenceUiSwitchResult {
5
- mode: ReferenceUiMode;
6
- restartRequired: false;
7
- }
8
- interface SwitchReferenceUiModeOptions {
9
- mode: ReferenceUiMode;
10
- packageRoot?: string;
11
- dshHome?: string;
12
- signal?: AbortSignal;
13
- }
14
- /**
15
- * Switch only the visible @ implementation while keeping this package alive.
16
- *
17
- * The bundle patch remains untouched so updating or reinstalling the package
18
- * cannot erase the user's choice. The plugin Host and settings entry remain
19
- * active in both modes; the client separately registers or disposes its own
20
- * picker sources.
21
- */
22
- export declare function switchReferenceUiMode(options: SwitchReferenceUiModeOptions): Promise<ReferenceUiSwitchResult>;
23
- /** Write the managed override without exposing a partially-written YAML file. */
24
- export declare function writeReferenceUiModeOverride(path: string, mode: ReferenceUiMode, signal?: AbortSignal): Promise<void>;
25
- /**
26
- * Preserve every user-owned row and append one idempotent block at the end,
27
- * where Cordis' ordered patch semantics make it the effective override.
28
- */
29
- export declare function withReferenceUiModeOverride(source: string, mode: ReferenceUiMode): string;
30
- export {};
@@ -1,90 +0,0 @@
1
- import { readFile, rename, rm, writeFile } from 'node:fs/promises';
2
- import { dirname, join } from 'node:path';
3
- import { findOwningProfileDir } from "./update.js";
4
- export const OFFICIAL_REFERENCE_PATCH_BEGIN = '# BEGIN dsh-reference-anything managed official-reference override';
5
- export const OFFICIAL_REFERENCE_PATCH_END = '# END dsh-reference-anything managed official-reference override';
6
- /**
7
- * Switch only the visible @ implementation while keeping this package alive.
8
- *
9
- * The bundle patch remains untouched so updating or reinstalling the package
10
- * cannot erase the user's choice. The plugin Host and settings entry remain
11
- * active in both modes; the client separately registers or disposes its own
12
- * picker sources.
13
- */
14
- export async function switchReferenceUiMode(options) {
15
- options.signal?.throwIfAborted();
16
- const profileDir = await findOwningProfileDir(options.packageRoot, options.dshHome);
17
- await writeReferenceUiModeOverride(join(profileDir, 'cordis.patch.yml'), options.mode, options.signal);
18
- return { mode: options.mode, restartRequired: false };
19
- }
20
- /** Write the managed override without exposing a partially-written YAML file. */
21
- export async function writeReferenceUiModeOverride(path, mode, signal) {
22
- signal?.throwIfAborted();
23
- let source = '';
24
- try {
25
- source = await readFile(path, { encoding: 'utf8', signal });
26
- }
27
- catch (error) {
28
- const code = error.code;
29
- if (code !== 'ENOENT')
30
- throw error;
31
- }
32
- const next = withReferenceUiModeOverride(source, mode);
33
- if (next === source)
34
- return;
35
- const temporary = join(dirname(path), `.cordis.patch.yml.dsh-reference-anything-${String(process.pid)}-${String(Date.now())}.tmp`);
36
- try {
37
- await writeFile(temporary, next, { encoding: 'utf8', signal });
38
- signal?.throwIfAborted();
39
- await rename(temporary, path);
40
- }
41
- catch (error) {
42
- await rm(temporary, { force: true }).catch(() => undefined);
43
- throw error;
44
- }
45
- }
46
- /**
47
- * Preserve every user-owned row and append one idempotent block at the end,
48
- * where Cordis' ordered patch semantics make it the effective override.
49
- */
50
- export function withReferenceUiModeOverride(source, mode) {
51
- const eol = source.includes('\r\n') ? '\r\n' : '\n';
52
- const lines = source.split(/\r?\n/);
53
- const beginRows = markerRows(lines, OFFICIAL_REFERENCE_PATCH_BEGIN);
54
- const endRows = markerRows(lines, OFFICIAL_REFERENCE_PATCH_END);
55
- if (beginRows.length > 1 || endRows.length > 1 || beginRows.length !== endRows.length) {
56
- throw new Error('the managed official-reference block in cordis.patch.yml is malformed');
57
- }
58
- if (beginRows.length === 1) {
59
- const begin = beginRows[0];
60
- const end = endRows[0];
61
- if (end < begin)
62
- throw new Error('the managed official-reference block in cordis.patch.yml is malformed');
63
- lines.splice(begin, end - begin + 1);
64
- }
65
- removeEmptyArrayDocument(lines);
66
- while (lines.length > 0 && lines.at(-1)?.trim() === '')
67
- lines.pop();
68
- const block = [
69
- OFFICIAL_REFERENCE_PATCH_BEGIN,
70
- '# Switch only the visible @ implementation; Reference Anything stays loaded.',
71
- '- id: ui-reference',
72
- ` disabled: ${mode === 'official' ? 'false' : 'true'}`,
73
- OFFICIAL_REFERENCE_PATCH_END,
74
- ];
75
- return [...lines, ...(lines.length > 0 ? [''] : []), ...block, ''].join(eol);
76
- }
77
- function markerRows(lines, marker) {
78
- const rows = [];
79
- lines.forEach((line, index) => { if (line.trim() === marker)
80
- rows.push(index); });
81
- return rows;
82
- }
83
- /** `[]` is the valid empty profile document, but cannot precede list rows. */
84
- function removeEmptyArrayDocument(lines) {
85
- const meaningful = lines
86
- .map((line, index) => ({ index, text: line.trim() }))
87
- .filter(row => row.text !== '' && !row.text.startsWith('#'));
88
- if (meaningful.length === 1 && meaningful[0]?.text === '[]')
89
- lines.splice(meaningful[0].index, 1);
90
- }