mindwire 0.1.43 → 0.1.45

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/run.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Http } from "./http.js";
2
- import type { Event, ResultInfo, RespondInput, RunSnapshot, Run as RunData } from "./types.js";
2
+ import type { Attachment, Event, ResultInfo, RespondInput, RunSnapshot, Run as RunData } from "./types.js";
3
3
  export interface StreamOptions {
4
4
  signal?: AbortSignal;
5
5
  /** Resume after a snapshot/event cursor without replaying earlier output. */
@@ -64,7 +64,10 @@ export declare class Run {
64
64
  * Steer a follow-up message into the running turn without cancelling it. Requires the agent's
65
65
  * `input` capability.
66
66
  */
67
- sendInput(text: string): Promise<void>;
67
+ sendInput(text: string, options?: {
68
+ requestId?: string;
69
+ attachments?: Attachment[];
70
+ }): Promise<void>;
68
71
  /**
69
72
  * Soft-stop the running turn (ask the agent to halt current work) without the hard process kill
70
73
  * {@link Run.cancel} does — the turn stays open for a follow-up via {@link Run.sendInput}.
package/dist/types.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * escape hatch so a newer daemon adding a variant does not break older SDK builds.
10
10
  */
11
11
  /** One kind of unified streaming event. Every adapter normalizes native output into these. */
12
- export type EventType = "session" | "text" | "thinking" | "tool_use" | "tool_result" | "result" | "error" | "status" | "interaction" | "compaction" | "continuation";
12
+ export type EventType = "session" | "text" | "thinking" | "tool_use" | "tool_result" | "result" | "error" | "status" | "input" | "interaction" | "compaction" | "continuation";
13
13
  export interface ToolEvent {
14
14
  id?: string;
15
15
  name?: string;
@@ -152,6 +152,7 @@ export interface Event {
152
152
  compaction?: CompactionInfo;
153
153
  /** Populated on a `continuation` event (resolve mode). */
154
154
  continuation?: ContinuationInfo;
155
+ input?: UserInput;
155
156
  error?: string;
156
157
  meta?: Record<string, unknown>;
157
158
  /** RFC3339 timestamp. */
@@ -286,6 +287,7 @@ export interface Capabilities {
286
287
  /** User-in-loop ingress — each gates its route: answer an interaction, inject a follow-up, soft-stop. */
287
288
  respond: boolean;
288
289
  input: boolean;
290
+ queuedInput?: boolean;
289
291
  interrupt: boolean;
290
292
  /** Runtime control — switch the model / permission mode of a live turn (persistent transport only). */
291
293
  setModel: boolean;
@@ -667,8 +669,18 @@ export interface Part {
667
669
  interaction?: Interaction;
668
670
  /** Set on a `compaction` part — a conversation boundary in the reloaded transcript. */
669
671
  compaction?: CompactionInfo;
672
+ input?: UserInput;
670
673
  at?: string;
671
674
  }
675
+ /** Durable follow-up; queued messages belong to the daemon, including while a client is disconnected. */
676
+ export interface UserInput {
677
+ id: string;
678
+ text: string;
679
+ attachments?: Attachment[];
680
+ createdAt: string;
681
+ status: "queued" | "accepted" | "failed" | "cancelled" | (string & {});
682
+ error?: string;
683
+ }
672
684
  export interface Message {
673
685
  id: string;
674
686
  chatId: string;
@@ -760,6 +772,9 @@ export interface ResolveOptions {
760
772
  * Inline image content blocks require the persistent transport and are a follow-on.
761
773
  */
762
774
  export interface Attachment {
775
+ /** Completed upload belonging to this conversation. No inline bytes are needed. */
776
+ artifactId?: string;
777
+ bytes?: number;
763
778
  /** Display/file name shown to the agent when the file is referenced. */
764
779
  name?: string;
765
780
  /** Absolute path to a file already on disk (preferred). */
@@ -793,6 +808,8 @@ export interface Run {
793
808
  stopReason?: "done" | "capped" | "error" | "cancelled" | (string & {});
794
809
  /** Parent-only: how many child turns the resolve loop ran. */
795
810
  iterations?: number;
811
+ inputs?: UserInput[];
812
+ messageIds?: string[];
796
813
  }
797
814
  /** The daemon's view of a chat, for a sessions list. */
798
815
  export interface ChatSummary {
@@ -1036,9 +1053,11 @@ export interface Health {
1036
1053
  workspaceExecutionVersion?: number;
1037
1054
  terminalProtocolVersion?: number;
1038
1055
  turnRequestVersion?: number;
1056
+ queuedInputVersion?: number;
1039
1057
  chatForkVersion?: number;
1040
1058
  /** Image-only input and image attachments retained in message history. */
1041
1059
  imageAttachmentsVersion?: number;
1060
+ attachmentUploadVersion?: number;
1042
1061
  computerConnectionVersion?: number;
1043
1062
  workspaceIsolation?: "direct" | "container";
1044
1063
  }
@@ -1110,3 +1129,22 @@ export interface ProcessFrame {
1110
1129
  export interface ApiErrorBody {
1111
1130
  error: string;
1112
1131
  }
1132
+ /** One resumable 384 KiB chunk. The SHA-256 covers the complete file. */
1133
+ export interface AttachmentUploadChunk {
1134
+ name: string;
1135
+ mime: string;
1136
+ bytes: number;
1137
+ sha256: string;
1138
+ offset: number;
1139
+ data: string;
1140
+ }
1141
+ export interface AttachmentUploadState {
1142
+ id: string;
1143
+ chatId: string;
1144
+ name: string;
1145
+ mime: string;
1146
+ bytes: number;
1147
+ sha256: string;
1148
+ offset: number;
1149
+ complete: boolean;
1150
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindwire",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "bin": {
@@ -1,51 +0,0 @@
1
- import { MindwireError } from './chunk-T6TD76UA.js';
2
-
3
- // src/binary-cache.ts
4
- async function binaryCacheDirectory(platform = process.platform) {
5
- const path = await import('path');
6
- const { homedir } = await import('os');
7
- const homeDirectory = homedir();
8
- return platform === "darwin" ? path.join(homeDirectory, "Library", "Caches", "mindwire") : platform === "win32" ? path.join(process.env.LOCALAPPDATA ?? homeDirectory, "mindwire", "Cache") : path.join(process.env.XDG_CACHE_HOME ?? path.join(homeDirectory, ".cache"), "mindwire");
9
- }
10
- async function executableChecksum(bytes) {
11
- const { createHash } = await import('crypto');
12
- return createHash("sha256").update(bytes).digest("hex");
13
- }
14
- async function verifyReleaseBytes(bytes, expected, name) {
15
- if (!/^[a-f0-9]{64}$/i.test(expected) || await executableChecksum(bytes) !== expected.toLowerCase()) {
16
- throw new MindwireError(`mindwire: checksum verification failed for ${name}`);
17
- }
18
- }
19
- async function cachedExecutable(bin) {
20
- const fs = await import('fs/promises');
21
- try {
22
- const [bytes, checksum] = await Promise.all([fs.readFile(bin), fs.readFile(`${bin}.sha256`, "utf8")]);
23
- await verifyReleaseBytes(bytes, checksum.trim(), bin);
24
- return bin;
25
- } catch {
26
- return void 0;
27
- }
28
- }
29
- async function cacheExecutable(bin, bytes, expected) {
30
- await verifyReleaseBytes(bytes, expected, bin);
31
- const fs = await import('fs/promises');
32
- const { dirname } = await import('path');
33
- const { randomUUID } = await import('crypto');
34
- await fs.mkdir(dirname(bin), { recursive: true, mode: 448 });
35
- const temp = `${bin}.${randomUUID()}.tmp`;
36
- try {
37
- await fs.writeFile(temp, bytes, { mode: 493, flag: "wx" });
38
- await fs.writeFile(`${temp}.sha256`, `${expected.toLowerCase()}
39
- `, { mode: 384, flag: "wx" });
40
- await fs.rename(temp, bin);
41
- await fs.rename(`${temp}.sha256`, `${bin}.sha256`);
42
- return bin;
43
- } finally {
44
- await fs.rm(temp, { force: true });
45
- await fs.rm(`${temp}.sha256`, { force: true });
46
- }
47
- }
48
-
49
- export { binaryCacheDirectory, cacheExecutable, cachedExecutable, executableChecksum, verifyReleaseBytes };
50
- //# sourceMappingURL=binary-cache-ZTEYICUF.js.map
51
- //# sourceMappingURL=binary-cache-ZTEYICUF.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/binary-cache.ts"],"names":[],"mappings":";;;AAIA,eAAsB,oBAAA,CAAqB,QAAA,GAAW,OAAA,CAAQ,QAAA,EAA2B;AACvF,EAAA,MAAM,IAAA,GAAO,MAAM,OAAO,MAAW,CAAA;AACrC,EAAA,MAAM,EAAE,OAAA,EAAQ,GAAI,MAAM,OAAO,IAAS,CAAA;AAC1C,EAAA,MAAM,gBAAgB,OAAA,EAAQ;AAC9B,EAAA,OAAO,QAAA,KAAa,QAAA,GAAW,IAAA,CAAK,IAAA,CAAK,aAAA,EAAe,SAAA,EAAW,QAAA,EAAU,UAAU,CAAA,GACnF,QAAA,KAAa,OAAA,GAAU,IAAA,CAAK,KAAK,OAAA,CAAQ,GAAA,CAAI,Y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UF.js","sourcesContent":["// 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"]}