Skip to content

Commit 9ed8770

Browse files
refactor(session): remove dead obsidian mirror path (anomalyco#1210)
1 parent 96dacb1 commit 9ed8770

5 files changed

Lines changed: 2 additions & 1039 deletions

File tree

‎apps/app/src/app/lib/openwork-server.ts‎

Lines changed: 0 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -158,85 +158,6 @@ export type OpenworkWorkspaceFileWriteResult = {
158158
revision?: string;
159159
};
160160

161-
export type OpenworkFileSession = {
162-
id: string;
163-
workspaceId: string;
164-
createdAt: number;
165-
expiresAt: number;
166-
ttlMs: number;
167-
canWrite: boolean;
168-
};
169-
170-
export type OpenworkFileCatalogEntry = {
171-
path: string;
172-
kind: "file" | "dir";
173-
size: number;
174-
mtimeMs: number;
175-
revision: string;
176-
};
177-
178-
export type OpenworkFileSessionEvent = {
179-
id: string;
180-
seq: number;
181-
workspaceId: string;
182-
type: "write" | "delete" | "rename" | "mkdir";
183-
path: string;
184-
toPath?: string;
185-
revision?: string;
186-
timestamp: number;
187-
};
188-
189-
export type OpenworkFileReadBatchResult = {
190-
items: Array<
191-
| {
192-
ok: true;
193-
path: string;
194-
kind: "file";
195-
bytes: number;
196-
updatedAt: number;
197-
revision: string;
198-
contentBase64: string;
199-
}
200-
| {
201-
ok: false;
202-
path: string;
203-
code: string;
204-
message: string;
205-
maxBytes?: number;
206-
size?: number;
207-
}
208-
>;
209-
};
210-
211-
export type OpenworkFileWriteBatchResult = {
212-
items: Array<
213-
| {
214-
ok: true;
215-
path: string;
216-
bytes: number;
217-
updatedAt: number;
218-
revision: string;
219-
previousRevision?: string | null;
220-
}
221-
| {
222-
ok: false;
223-
path: string;
224-
code: string;
225-
message: string;
226-
expectedRevision?: string;
227-
currentRevision?: string | null;
228-
maxBytes?: number;
229-
size?: number;
230-
}
231-
>;
232-
cursor: number;
233-
};
234-
235-
export type OpenworkFileOpsBatchResult = {
236-
items: Array<Record<string, unknown>>;
237-
cursor: number;
238-
};
239-
240161
export type OpenworkCommandItem = {
241162
name: string;
242163
description?: string;
@@ -1781,103 +1702,6 @@ export function createOpenworkServerClient(options: { baseUrl: string; token?: s
17811702
{ token, hostToken, timeoutMs: timeouts.binary },
17821703
),
17831704

1784-
createFileSession: (workspaceId: string, options?: { ttlSeconds?: number; write?: boolean }) =>
1785-
requestJson<{ session: OpenworkFileSession }>(baseUrl, `/workspace/${encodeURIComponent(workspaceId)}/files/sessions`, {
1786-
token,
1787-
hostToken,
1788-
method: "POST",
1789-
body: {
1790-
...(typeof options?.ttlSeconds === "number" ? { ttlSeconds: options.ttlSeconds } : {}),
1791-
...(typeof options?.write === "boolean" ? { write: options.write } : {}),
1792-
},
1793-
}),
1794-
1795-
renewFileSession: (sessionId: string, options?: { ttlSeconds?: number }) =>
1796-
requestJson<{ session: OpenworkFileSession }>(baseUrl, `/files/sessions/${encodeURIComponent(sessionId)}/renew`, {
1797-
token,
1798-
hostToken,
1799-
method: "POST",
1800-
body: {
1801-
...(typeof options?.ttlSeconds === "number" ? { ttlSeconds: options.ttlSeconds } : {}),
1802-
},
1803-
}),
1804-
1805-
closeFileSession: (sessionId: string) =>
1806-
requestJson<{ ok: boolean }>(baseUrl, `/files/sessions/${encodeURIComponent(sessionId)}`, {
1807-
token,
1808-
hostToken,
1809-
method: "DELETE",
1810-
}),
1811-
1812-
getFileCatalogSnapshot: (
1813-
sessionId: string,
1814-
options?: { prefix?: string; after?: string; includeDirs?: boolean; limit?: number },
1815-
) => {
1816-
const params = new URLSearchParams();
1817-
if (options?.prefix?.trim()) params.set("prefix", options.prefix.trim());
1818-
if (options?.after?.trim()) params.set("after", options.after.trim());
1819-
if (typeof options?.includeDirs === "boolean") params.set("includeDirs", options.includeDirs ? "true" : "false");
1820-
if (typeof options?.limit === "number") params.set("limit", String(options.limit));
1821-
const query = params.toString();
1822-
return requestJson<{
1823-
sessionId: string;
1824-
workspaceId: string;
1825-
generatedAt: number;
1826-
cursor: number;
1827-
total: number;
1828-
truncated: boolean;
1829-
nextAfter?: string;
1830-
items: OpenworkFileCatalogEntry[];
1831-
}>(
1832-
baseUrl,
1833-
`/files/sessions/${encodeURIComponent(sessionId)}/catalog/snapshot${query ? `?${query}` : ""}`,
1834-
{ token, hostToken },
1835-
);
1836-
},
1837-
1838-
listFileSessionEvents: (sessionId: string, options?: { since?: number }) => {
1839-
const query = typeof options?.since === "number" ? `?since=${encodeURIComponent(String(options.since))}` : "";
1840-
return requestJson<{ items: OpenworkFileSessionEvent[]; cursor: number }>(
1841-
baseUrl,
1842-
`/files/sessions/${encodeURIComponent(sessionId)}/catalog/events${query}`,
1843-
{ token, hostToken },
1844-
);
1845-
},
1846-
1847-
readFileBatch: (sessionId: string, paths: string[]) =>
1848-
requestJson<OpenworkFileReadBatchResult>(baseUrl, `/files/sessions/${encodeURIComponent(sessionId)}/read-batch`, {
1849-
token,
1850-
hostToken,
1851-
method: "POST",
1852-
body: { paths },
1853-
}),
1854-
1855-
writeFileBatch: (
1856-
sessionId: string,
1857-
writes: Array<{ path: string; contentBase64: string; ifMatchRevision?: string; force?: boolean }>,
1858-
) =>
1859-
requestJson<OpenworkFileWriteBatchResult>(baseUrl, `/files/sessions/${encodeURIComponent(sessionId)}/write-batch`, {
1860-
token,
1861-
hostToken,
1862-
method: "POST",
1863-
body: { writes },
1864-
}),
1865-
1866-
runFileBatchOps: (
1867-
sessionId: string,
1868-
operations: Array<
1869-
| { type: "mkdir"; path: string }
1870-
| { type: "delete"; path: string; recursive?: boolean }
1871-
| { type: "rename"; from: string; to: string }
1872-
>,
1873-
) =>
1874-
requestJson<OpenworkFileOpsBatchResult>(baseUrl, `/files/sessions/${encodeURIComponent(sessionId)}/ops`, {
1875-
token,
1876-
hostToken,
1877-
method: "POST",
1878-
body: { operations },
1879-
}),
1880-
18811705
readWorkspaceFile: (workspaceId: string, path: string) =>
18821706
requestJson<OpenworkWorkspaceFileContent>(
18831707
baseUrl,

‎apps/app/src/app/lib/tauri.ts‎

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -762,63 +762,6 @@ export async function resetOpencodeCache(): Promise<CacheResetResult> {
762762
return invoke<CacheResetResult>("reset_opencode_cache");
763763
}
764764

765-
export async function obsidianIsAvailable(): Promise<boolean> {
766-
return invoke<boolean>("obsidian_is_available");
767-
}
768-
769-
export async function openInObsidian(filePath: string): Promise<void> {
770-
const safePath = filePath.trim();
771-
if (!safePath) {
772-
throw new Error("filePath is required");
773-
}
774-
return invoke<void>("open_in_obsidian", { filePath: safePath });
775-
}
776-
777-
export async function writeObsidianMirrorFile(
778-
workspaceId: string,
779-
filePath: string,
780-
content: string,
781-
): Promise<string> {
782-
const safeWorkspaceId = workspaceId.trim();
783-
const safePath = filePath.trim();
784-
if (!safeWorkspaceId) {
785-
throw new Error("workspaceId is required");
786-
}
787-
if (!safePath) {
788-
throw new Error("filePath is required");
789-
}
790-
return invoke<string>("write_obsidian_mirror_file", {
791-
workspaceId: safeWorkspaceId,
792-
filePath: safePath,
793-
content,
794-
});
795-
}
796-
797-
export type ObsidianMirrorFileContent = {
798-
exists: boolean;
799-
path: string;
800-
content: string | null;
801-
updatedAtMs: number | null;
802-
};
803-
804-
export async function readObsidianMirrorFile(
805-
workspaceId: string,
806-
filePath: string,
807-
): Promise<ObsidianMirrorFileContent> {
808-
const safeWorkspaceId = workspaceId.trim();
809-
const safePath = filePath.trim();
810-
if (!safeWorkspaceId) {
811-
throw new Error("workspaceId is required");
812-
}
813-
if (!safePath) {
814-
throw new Error("filePath is required");
815-
}
816-
return invoke<ObsidianMirrorFileContent>("read_obsidian_mirror_file", {
817-
workspaceId: safeWorkspaceId,
818-
filePath: safePath,
819-
});
820-
}
821-
822765
export async function schedulerListJobs(scopeRoot?: string): Promise<ScheduledJob[]> {
823766
return invoke<ScheduledJob[]>("scheduler_list_jobs", { scopeRoot });
824767
}

0 commit comments

Comments
 (0)