mindwire 0.1.48 → 0.1.51

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.
@@ -0,0 +1,96 @@
1
+ import type { AgentScoped, Mindwire } from "./client.js";
2
+ import type { Attachment, Event, Part, RespondInput, UserInput } from "./types.js";
3
+ /** Per-session permissions. Discovery support alone does not imply control. */
4
+ export interface NativeSessionCapabilities {
5
+ status: boolean;
6
+ observe: boolean;
7
+ input: boolean;
8
+ interrupt: boolean;
9
+ respond: boolean;
10
+ }
11
+ export interface SessionActivity {
12
+ sessionId: string;
13
+ cwd: string;
14
+ owner: "native" | "none" | "unknown";
15
+ state: "running" | "waiting" | "idle" | "stopped" | "unavailable";
16
+ turnId?: string;
17
+ startedAt?: string;
18
+ reason?: string;
19
+ capabilities: NativeSessionCapabilities;
20
+ }
21
+ export interface NativeSessionSnapshot {
22
+ connectionId: string;
23
+ sequence: number;
24
+ turnId?: string;
25
+ activity: SessionActivity;
26
+ /** Recent native turn only. Use messages() for earlier history. */
27
+ parts: Part[] | null;
28
+ inputs: UserInput[] | null;
29
+ historyRequired?: boolean;
30
+ /** True when earlier or oversized items were omitted from this projection. */
31
+ partial?: boolean;
32
+ /** True only for a resume frame: retain your previous projection. */
33
+ replay?: boolean;
34
+ }
35
+ export interface NativeSessionEvent {
36
+ connectionId: string;
37
+ sequence: number;
38
+ turnId?: string;
39
+ activity?: SessionActivity;
40
+ event?: Event;
41
+ /** Starts a new live projection; older turns remain in native history. */
42
+ reset?: boolean;
43
+ historyChanged?: boolean;
44
+ partial?: boolean;
45
+ }
46
+ export type NativeSessionFrame = {
47
+ type: "snapshot" | "resume";
48
+ snapshot: NativeSessionSnapshot;
49
+ } | {
50
+ type: "update";
51
+ update: NativeSessionEvent;
52
+ };
53
+ export interface NativeSessionAction {
54
+ /** Attachment epoch from events(). Never substitute a new epoch when retrying. */
55
+ connectionId: string;
56
+ /** Caller-generated idempotency key; retain it on retry. */
57
+ requestId: string;
58
+ kind: "input" | "interrupt" | "response";
59
+ /** Required for Stop; optional for sending into a specific still-running turn. */
60
+ expectedTurnId?: string;
61
+ text?: string;
62
+ /** Uploaded artifact references, local images, or durable workspace file paths. */
63
+ attachments?: Attachment[];
64
+ response?: RespondInput;
65
+ }
66
+ export interface NativeSessionReceipt {
67
+ requestId: string;
68
+ /** A response is submitted until the native server broadcasts its resolution. */
69
+ status: "accepted" | "submitted";
70
+ turnId?: string;
71
+ }
72
+ export interface NativeSessionWatchOptions extends AgentScoped {
73
+ /** `${connectionId}:${sequence}`; use only when retaining the corresponding UI state. */
74
+ cursor?: string;
75
+ signal?: AbortSignal;
76
+ }
77
+ /** Observe and, when supported, control the CLI session already running on the host.
78
+ * All calls use the existing authenticated Mindwire transport. No extra public port. */
79
+ export declare class NativeSessionsApi {
80
+ private readonly client;
81
+ constructor(client: Mindwire);
82
+ private path;
83
+ /** A cheap, coalesced status lookup. Does not resume or launch a conversation. */
84
+ activity(chatId: string, options?: AgentScoped & {
85
+ signal?: AbortSignal;
86
+ }): Promise<SessionActivity>;
87
+ /** Breaking the loop detaches only this viewer. No automatic command resends.
88
+ * On a replacement snapshot, replace the live projection; on resume, retain it.
89
+ * Persist the cursor after applying each frame, then reuse it on reconnection. */
90
+ events(chatId: string, options?: NativeSessionWatchOptions): AsyncGenerator<NativeSessionFrame>;
91
+ /** Send, stop the exact turn, or answer a pending question. An unknown outcome
92
+ * requires checking the conversation; do not retry with a fresh requestId. */
93
+ action(chatId: string, action: NativeSessionAction, options?: AgentScoped & {
94
+ signal?: AbortSignal;
95
+ }): Promise<NativeSessionReceipt>;
96
+ }
package/dist/types.d.ts CHANGED
@@ -320,6 +320,8 @@ export interface CommandInvocation {
320
320
  }
321
321
  /** Per-agent feature matrix. The core switches on some fields; the client reads the rest as UI hints. */
322
322
  export interface Capabilities {
323
+ /** Static harness hint; check nativeSessions.activity() for this session's controls. */
324
+ nativeSession?: import("./native-sessions.js").NativeSessionCapabilities;
323
325
  protocol: Protocol;
324
326
  output: OutputMode;
325
327
  history: Support;
@@ -747,6 +749,8 @@ export interface UserInput {
747
749
  error?: string;
748
750
  }
749
751
  export interface Message {
752
+ /** Native turn identity for reconciling history with a native-session snapshot. */
753
+ nativeTurnId?: string;
750
754
  /** Explicit command selected by the user, when the native transcript or receipt identifies it. */
751
755
  command?: CommandInvocation;
752
756
  id: string;
@@ -1133,6 +1137,8 @@ export interface Health {
1133
1137
  terminalProtocolVersion?: number;
1134
1138
  turnRequestVersion?: number;
1135
1139
  queuedInputVersion?: number;
1140
+ /** Live attachment to a native CLI owner without a competing harness process. */
1141
+ nativeSessionVersion?: number;
1136
1142
  chatForkVersion?: number;
1137
1143
  /** Image-only input and image attachments retained in message history. */
1138
1144
  imageAttachmentsVersion?: number;
@@ -82,7 +82,8 @@ export interface GitOperationRequest {
82
82
  expectedHead?: string;
83
83
  /** restore_commit only: observed local branch name; omit for detached HEAD. */
84
84
  expectedBranch?: string;
85
- /** Write-only, for network operations only. Never part of an operation snapshot. */
85
+ /** Write-only, for network operations and commit hooks (gitOperationsVersion >= 6).
86
+ * Never part of an operation snapshot; ordinary commits require no GitHub login. */
86
87
  auth?: ProjectAuth;
87
88
  }
88
89
  export interface GitOperation extends Omit<GitOperationRequest, "auth"> {
@@ -92,8 +93,9 @@ export interface GitOperation extends Omit<GitOperationRequest, "auth"> {
92
93
  status: "queued" | "running" | "cancelling" | "succeeded" | "failed" | "cancelled" | "interrupted";
93
94
  output?: string;
94
95
  error?: string;
95
- /** git_identity_required asks the client to collect a name/email before a new commit intent. */
96
- errorCode?: "git_identity_required" | "git_restore_dirty" | "git_restore_changed" | "git_branch_changed" | "git_branch_in_use" | "git_branch_unmerged" | "git_restore_in_progress" | "git_restore_commit_unavailable" | "git_restore_local_files" | (string & {});
96
+ /** git_auth_required asks for GitHub access; refresh status before an explicit retry.
97
+ * git_identity_required asks for a name/email before a new commit intent. */
98
+ errorCode?: "git_auth_required" | "git_identity_required" | "git_restore_dirty" | "git_restore_changed" | "git_branch_changed" | "git_branch_in_use" | "git_branch_unmerged" | "git_restore_in_progress" | "git_restore_commit_unavailable" | "git_restore_local_files" | (string & {});
97
99
  createdAt: string;
98
100
  updatedAt: string;
99
101
  sequence: number;
@@ -345,7 +347,7 @@ export declare class GitAccessApi {
345
347
  run(projectId: string, operation: "fetch" | "pull" | "push", auth?: ProjectAuth): Promise<{
346
348
  output: string;
347
349
  }>;
348
- /** Requires health.gitOperationsVersion >= 1 (>= 2 for switch/create, >= 4 for restore_commit, >= 5 for rename/delete). Acceptance persists before Git runs;
350
+ /** Requires health.gitOperationsVersion >= 1 (>= 2 for switch/create, >= 4 for restore_commit, >= 5 for rename/delete, >= 6 for commit auth). Acceptance persists before Git runs;
349
351
  * disconnecting only detaches the client. The same ID/intent never runs twice.
350
352
  */
351
353
  start(projectId: string, request: GitOperationRequest): Promise<GitOperation>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindwire",
3
- "version": "0.1.48",
3
+ "version": "0.1.51",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "bin": {