mindwire 0.1.25 → 0.1.26

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/dist/types.d.ts CHANGED
@@ -1000,6 +1000,7 @@ export interface Health {
1000
1000
  workspaceIsolationVersion?: number;
1001
1001
  workspaceExecutionVersion?: number;
1002
1002
  terminalProtocolVersion?: number;
1003
+ turnRequestVersion?: number;
1003
1004
  computerConnectionVersion?: number;
1004
1005
  workspaceIsolation?: "direct" | "container";
1005
1006
  }
@@ -165,8 +165,12 @@ export interface WorkspaceChat extends WorkspaceRecord {
165
165
  agentId: string;
166
166
  projectId: string;
167
167
  title: string;
168
+ /** Cached native title beneath an optional user rename. Owned by the daemon. */
169
+ nativeTitle?: string;
168
170
  titleIsUserSet?: boolean;
169
171
  sessionId?: string;
172
+ /** Native harness activity, retained across app restarts. Not the last app-open time. */
173
+ updatedAt?: string;
170
174
  /** Mutes this chat. False clears its own mute but never overrides a muted parent profile. Omit to preserve. */
171
175
  notificationsMuted?: boolean;
172
176
  }
@@ -200,6 +204,12 @@ export interface WorkspaceSnapshot {
200
204
  id: string;
201
205
  revision: number;
202
206
  }[];
207
+ /** Cached chats are retained when a harness's native list could not be refreshed. */
208
+ sessionDiscoveryIssues?: {
209
+ projectId: string;
210
+ agent: string;
211
+ message: string;
212
+ }[];
203
213
  }
204
214
  export declare class WorkspaceCollection<T extends WorkspaceRecord> {
205
215
  private readonly mw;
@@ -221,7 +231,9 @@ export declare class WorkspaceApi {
221
231
  readonly projects: WorkspaceCollection<WorkspaceProject>;
222
232
  readonly chats: WorkspaceCollection<WorkspaceChat>;
223
233
  constructor(mw: Mindwire);
224
- snapshot(): Promise<WorkspaceSnapshot>;
234
+ snapshot(options?: {
235
+ refresh?: boolean;
236
+ }): Promise<WorkspaceSnapshot>;
225
237
  /** Start an operation owned by the daemon. The same ID/payload returns the existing operation. */
226
238
  createProject(request: ProjectRequest): Promise<ProjectOperation>;
227
239
  /** Permanently remove the confirmed project's directory and membership.
@@ -231,7 +243,9 @@ export declare class WorkspaceApi {
231
243
  /** Incremental reconciliation. Pass the previous identity to detect a replaced/restored workspace.
232
244
  * A 409 requires fetching snapshot() again; never apply a delta to a different registry.
233
245
  */
234
- changes(since: number, workspaceId: string): Promise<WorkspaceSnapshot>;
246
+ changes(since: number, workspaceId: string, options?: {
247
+ refresh?: boolean;
248
+ }): Promise<WorkspaceSnapshot>;
235
249
  /** Import legacy metadata before replacing a local cache. Safe to repeat after interruption. */
236
250
  import(records: WorkspaceImport): Promise<WorkspaceSnapshot>;
237
251
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindwire",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "bin": { "mindwire": "./dist/cli.js" },
@@ -1,3 +0,0 @@
1
- export { binaryCacheDirectory, cacheExecutable, cachedExecutable, executableChecksum, verifyReleaseBytes } from './chunk-PFYKJ6LX.js';
2
- //# sourceMappingURL=binary-cache-CG52TXCZ.js.map
3
- //# sourceMappingURL=binary-cache-CG52TXCZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/errors.ts","../src/binary-cache.ts"],"names":[],"mappings":";AACO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,WAAA,CAAY,SAAiB,OAAA,EAA+B;AAC1D,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF;AAMO,IAAM,QAAA,GAAN,MAAM,SAAA,SAAiB,aAAA,CAAc;AAAA,EACjC,MAAA;AAAA,EACA,GAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EAET,YAAY,IAAA,EAAsE;AAChF,IAAA,KAAA,CAAM,SAAA,CAAS,UAAA,CAAW,IAAI,CAAC,CAAA;AAC/B,IAAA,IAAA,CAAK,IAA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AG,EAAE,SAAA,EAAW,IAAA,EAAM,IAAA,EAAM,GAAA,EAAO,CAAA;AAE7D,EAAA,MAAM,IAAA,GAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,YAAY,CAAA,IAAA,CAAA;AACnC,EAAA,IAAI;AACF,IAAA,MAAM,EAAA,CAAG,UAAU,IAAA,EAAM,KAAA,EAAO,EAAE,IAAA,EAAM,GAAA,EAAO,IAAA,EAAM,IAAA,EAAM,CAAA;AAC3D,IAAA,MAAM,EAAA,CAAG,UAAU,CAAA,EAAG,IAAI,WAAW,CAAA,EAAG,QAAA,CAAS,aAAa;AAAA,CAAA,EAAM,EAAE,IAAA,EAAM,GAAA,EAAO,IAAA,EAAM,MAAM,CAAA;AAC/F,IAAA,MAAM,EAAA,CAAG,MAAA,CAAO,IAAA,EAAM,GAAG,CAAA;AACzB,IAAA,MAAM,GAAG,MAAA,CAAO,CAAA,EAAG,IAAI,CAAA,OAAA,CAAA,EAAW,CAAA,EAAG,GAAG,CAAA,OAAA,CAAS,CAAA;AACjD,IAAA,OAAO,GAAA;AAAA,EACT,CAAA,SAAE;AACA,IAAA,MAAM,GAAG,EAAA,CAAG,IAAA,EAAM,EAAE,KAAA,EAAO,MAAM,CAAA;AACjC,IAAA,MAAM,EAAA,CAAG,GAAG,CAAA,EAAG,IAAI,WAAW,EAAE,KAAA,EAAO,MAAM,CAAA;AAAA,EAC/C;AACF","file":"chunk-PFYKJ6LX.js","sourcesContent":["/** Base class for every error thrown by the SDK. */\nexport class MindwireError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n this.name = \"MindwireError\";\n }\n}\n\n/**\n * A non-2xx HTTP response from the daemon. `body` is the parsed JSON error payload when the\n * daemon returned one (it uses `{ \"error\": \"...\" }`), otherwise the raw text.\n */\nexport class ApiError extends MindwireError {\n readonly status: number;\n readonly url: string;\n readonly method: string;\n readonly body: unknown;\n\n constructor(args: { status: number; url: string; method: string; body: unknown }) {\n super(ApiError.messageFor(args));\n this.name = \"ApiError\";\n this.status = args.status;\n this.url = args.url;\n this.method = args.method;\n this.body = args.body;\n }\n\n private static messageFor({\n status,\n method,\n url,\n body,\n }: {\n status: number;\n method: string;\n url: string;\n body: unknown;\n }): string {\n const detail =\n body && typeof body === \"object\" && \"error\" in body && typeof body.error === \"string\"\n ? body.error\n : typeof body === \"string\" && body.trim() !== \"\"\n ? body.trim()\n : \"\";\n const base = `${method} ${url} failed with ${status}`;\n return detail ? `${base}: ${detail}` : base;\n }\n}\n\n/**\n * Thrown by {@link import(\"./run.js\").Run.wait} when a run ends in a non-success terminal state\n * (`error`/`cancelled`), or when the event stream ends before the run reaches any terminal state —\n * a dropped/truncated stream. The `status` is whatever the run was in when `wait()` gave up, so a\n * truncated stream surfaces as e.g. `run <id> running: event stream ended …` rather than silently\n * returning a success-shaped result.\n */\nexport class RunFailedError extends MindwireError {\n readonly status: string;\n readonly runId: string;\n\n constructor(runId: string, status: string, detail?: string) {\n super(detail ? `run ${runId} ${status}: ${detail}` : `run ${runId} ${status}`);\n this.name = \"RunFailedError\";\n this.runId = runId;\n this.status = status;\n }\n}\n\n/**\n * Thrown when a unary request exceeds the client's `requestTimeoutMs` deadline. A hung daemon or a\n * dead tunnel would otherwise block the caller forever; this bounds every non-streaming call. SSE\n * streams are long-lived and are never subject to this timeout.\n */\nexport class TimeoutError extends MindwireError {\n readonly method: string;\n readonly path: string;\n readonly timeoutMs: number;\n\n constructor(method: string, path: string, timeoutMs: number) {\n super(`mindwire: ${method} ${path} timed out after ${timeoutMs}ms`);\n this.name = \"TimeoutError\";\n this.method = method;\n this.path = path;\n this.timeoutMs = timeoutMs;\n }\n}\n","// Shared verified executable cache for the daemon and optional connection helpers.\n// Node modules stay lazy so importing the SDK in a browser remains supported.\nimport { MindwireError } from \"./errors.js\";\n\nexport async function binaryCacheDirectory(platform = process.platform): Promise<string> {\n const path = await import(\"node:path\");\n const { homedir } = await import(\"node:os\");\n const homeDirectory = homedir();\n return platform === \"darwin\" ? path.join(homeDirectory, \"Library\", \"Caches\", \"mindwire\")\n : platform === \"win32\" ? path.join(process.env.LOCALAPPDATA ?? homeDirectory, \"mindwire\", \"Cache\")\n : path.join(process.env.XDG_CACHE_HOME ?? path.join(homeDirectory, \".cache\"), \"mindwire\");\n}\n\nexport async function executableChecksum(bytes: Uint8Array): Promise<string> {\n const { createHash } = await import(\"node:crypto\");\n return createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\nexport async function verifyReleaseBytes(bytes: Uint8Array, expected: string, name: string): Promise<void> {\n if (!/^[a-f0-9]{64}$/i.test(expected) || await executableChecksum(bytes) !== expected.toLowerCase()) {\n throw new MindwireError(`mindwire: checksum verification failed for ${name}`);\n }\n}\n\nexport async function cachedExecutable(bin: string): Promise<string | undefined> {\n const fs = await import(\"node:fs/promises\");\n try {\n const [bytes, checksum] = await Promise.all([fs.readFile(bin), fs.readFile(`${bin}.sha256`, \"utf8\")]);\n await verifyReleaseBytes(bytes, checksum.trim(), bin);\n return bin;\n } catch { return undefined; }\n}\n\nexport async function cacheExecutable(bin: string, bytes: Uint8Array, expected: string): Promise<string> {\n await verifyReleaseBytes(bytes, expected, bin);\n const fs = await import(\"node:fs/promises\");\n const { dirname } = await import(\"node:path\");\n const { randomUUID } = await import(\"node:crypto\");\n await fs.mkdir(dirname(bin), { recursive: true, mode: 0o700 });\n // Unique temporary names also cover concurrent acquisitions in the same process.\n const temp = `${bin}.${randomUUID()}.tmp`;\n try {\n await fs.writeFile(temp, bytes, { mode: 0o755, flag: \"wx\" });\n await fs.writeFile(`${temp}.sha256`, `${expected.toLowerCase()}\\n`, { mode: 0o600, flag: \"wx\" });\n await fs.rename(temp, bin);\n await fs.rename(`${temp}.sha256`, `${bin}.sha256`);\n return bin;\n } finally {\n await fs.rm(temp, { force: true });\n await fs.rm(`${temp}.sha256`, { force: true });\n }\n}\n"]}