@neosh/api 0.1.0 → 0.3.0

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.
Files changed (186) hide show
  1. package/package.json +4 -2
  2. package/src/generated/AccountKind.ts +0 -0
  3. package/src/generated/Activity.ts +0 -0
  4. package/src/generated/AgentCommand.ts +0 -0
  5. package/src/generated/AgentState.ts +0 -0
  6. package/src/generated/AgentSummary.ts +0 -0
  7. package/src/generated/Anchor.ts +0 -0
  8. package/src/generated/Animation.ts +0 -0
  9. package/src/generated/ApiCall.ts +17 -0
  10. package/src/generated/ApiError.ts +0 -0
  11. package/src/generated/ApiOk.ts +5 -1
  12. package/src/generated/ApiResponse.ts +0 -0
  13. package/src/generated/AscpMessage.ts +0 -0
  14. package/src/generated/AttachmentInfo.ts +0 -0
  15. package/src/generated/Attrs.ts +0 -0
  16. package/src/generated/AuthRef.ts +0 -0
  17. package/src/generated/BackgroundTask.ts +0 -0
  18. package/src/generated/BlockStartKind.ts +0 -0
  19. package/src/generated/BorderStyle.ts +0 -0
  20. package/src/generated/BranchInfo.ts +0 -0
  21. package/src/generated/Brand.ts +0 -0
  22. package/src/generated/BufferId.ts +0 -0
  23. package/src/generated/BuildId.ts +0 -0
  24. package/src/generated/Capability.ts +0 -0
  25. package/src/generated/ClientMessage.ts +37 -2
  26. package/src/generated/Color.ts +0 -0
  27. package/src/generated/CommandEntry.ts +0 -0
  28. package/src/generated/CommitInfo.ts +0 -0
  29. package/src/generated/ContentBlock.ts +0 -0
  30. package/src/generated/Contribution.ts +0 -0
  31. package/src/generated/CostBasis.ts +0 -0
  32. package/src/generated/CredentialInfo.ts +0 -0
  33. package/src/generated/CredentialSource.ts +0 -0
  34. package/src/generated/CursorMotion.ts +0 -0
  35. package/src/generated/CursorShape.ts +0 -0
  36. package/src/generated/DetachReason.ts +0 -0
  37. package/src/generated/DiffTarget.ts +0 -0
  38. package/src/generated/Dock.ts +0 -0
  39. package/src/generated/DriverCommand.ts +0 -0
  40. package/src/generated/DriverKind.ts +0 -0
  41. package/src/generated/Extent.ts +0 -0
  42. package/src/generated/ExtmarkId.ts +0 -0
  43. package/src/generated/ExtmarkInfo.ts +0 -0
  44. package/src/generated/ExtmarkOpts.ts +0 -0
  45. package/src/generated/ExtmarkRender.ts +0 -0
  46. package/src/generated/FileChange.ts +0 -0
  47. package/src/generated/FileState.ts +0 -0
  48. package/src/generated/FloatConfig.ts +0 -0
  49. package/src/generated/FrameSet.ts +0 -0
  50. package/src/generated/Gravity.ts +0 -0
  51. package/src/generated/HighlightDef.ts +0 -0
  52. package/src/generated/HighlightEntry.ts +0 -0
  53. package/src/generated/HighlightSpec.ts +0 -0
  54. package/src/generated/Hint.ts +0 -0
  55. package/src/generated/HlTarget.ts +0 -0
  56. package/src/generated/HookInvocation.ts +0 -0
  57. package/src/generated/HookName.ts +0 -0
  58. package/src/generated/HookOutcome.ts +0 -0
  59. package/src/generated/HookPayload.ts +0 -0
  60. package/src/generated/InputEvent.ts +21 -1
  61. package/src/generated/InstallMethod.ts +15 -0
  62. package/src/generated/InstanceConfig.ts +0 -0
  63. package/src/generated/InstanceId.ts +0 -0
  64. package/src/generated/KeyCode.ts +0 -0
  65. package/src/generated/KeyContext.ts +0 -0
  66. package/src/generated/KeyMods.ts +0 -0
  67. package/src/generated/KeyPress.ts +0 -0
  68. package/src/generated/KeymapEntry.ts +0 -0
  69. package/src/generated/KeymapScope.ts +0 -0
  70. package/src/generated/LineDraw.ts +0 -0
  71. package/src/generated/LineRender.ts +0 -0
  72. package/src/generated/LinkState.ts +5 -4
  73. package/src/generated/MarkDraw.ts +0 -0
  74. package/src/generated/Message.ts +0 -0
  75. package/src/generated/MessageLevel.ts +0 -0
  76. package/src/generated/Mode.ts +0 -0
  77. package/src/generated/ModelCapabilities.ts +0 -0
  78. package/src/generated/ModelEntry.ts +0 -0
  79. package/src/generated/ModelId.ts +0 -0
  80. package/src/generated/ModelInfo.ts +0 -0
  81. package/src/generated/ModelSelection.ts +0 -0
  82. package/src/generated/ModelTier.ts +0 -0
  83. package/src/generated/NamespaceId.ts +0 -0
  84. package/src/generated/NodeCapabilities.ts +0 -0
  85. package/src/generated/NodeId.ts +0 -0
  86. package/src/generated/NodeInfo.ts +0 -0
  87. package/src/generated/NoticeKind.ts +0 -0
  88. package/src/generated/Offset.ts +0 -0
  89. package/src/generated/OnDelete.ts +0 -0
  90. package/src/generated/OptionChoice.ts +0 -0
  91. package/src/generated/OptionEntry.ts +0 -0
  92. package/src/generated/OptionSelection.ts +0 -0
  93. package/src/generated/OptionSpec.ts +0 -0
  94. package/src/generated/OptionType.ts +0 -0
  95. package/src/generated/OptionValue.ts +0 -0
  96. package/src/generated/PermissionDecision.ts +0 -0
  97. package/src/generated/PermissionMode.ts +0 -0
  98. package/src/generated/PermissionOption.ts +0 -0
  99. package/src/generated/PermissionOptionKind.ts +0 -0
  100. package/src/generated/PlanState.ts +0 -0
  101. package/src/generated/PlanStep.ts +0 -0
  102. package/src/generated/PluginActivation.ts +0 -0
  103. package/src/generated/PluginEvent.ts +0 -0
  104. package/src/generated/PluginId.ts +0 -0
  105. package/src/generated/PluginInbound.ts +0 -0
  106. package/src/generated/PluginInfo.ts +0 -0
  107. package/src/generated/PluginManifest.ts +0 -0
  108. package/src/generated/PluginOutbound.ts +0 -0
  109. package/src/generated/PluginPermission.ts +0 -0
  110. package/src/generated/PluginProvides.ts +0 -0
  111. package/src/generated/PluginRequest.ts +0 -0
  112. package/src/generated/PluginResponse.ts +0 -0
  113. package/src/generated/PointInfo.ts +0 -0
  114. package/src/generated/Pricing.ts +0 -0
  115. package/src/generated/ProjectKey.ts +0 -0
  116. package/src/generated/ProviderEmit.ts +0 -0
  117. package/src/generated/ProviderEvent.ts +0 -0
  118. package/src/generated/ProviderOptionDescriptor.ts +0 -0
  119. package/src/generated/ProviderOptionValue.ts +0 -0
  120. package/src/generated/QuestionAnswer.ts +0 -0
  121. package/src/generated/QuestionOption.ts +0 -0
  122. package/src/generated/QuotaCredits.ts +0 -0
  123. package/src/generated/QuotaSample.ts +0 -0
  124. package/src/generated/QuotaSeverity.ts +0 -0
  125. package/src/generated/QuotaSnapshot.ts +0 -0
  126. package/src/generated/QuotaSource.ts +0 -0
  127. package/src/generated/QuotaWindow.ts +0 -0
  128. package/src/generated/Rect.ts +0 -0
  129. package/src/generated/Refusal.ts +0 -0
  130. package/src/generated/RemoteProject.ts +0 -0
  131. package/src/generated/RepoInfo.ts +0 -0
  132. package/src/generated/RepoStatus.ts +0 -0
  133. package/src/generated/RequestId.ts +0 -0
  134. package/src/generated/RestartRefusal.ts +12 -0
  135. package/src/generated/Role.ts +0 -0
  136. package/src/generated/RunningTurn.ts +0 -0
  137. package/src/generated/SelectShape.ts +0 -0
  138. package/src/generated/ServerMessage.ts +5 -1
  139. package/src/generated/SessionId.ts +0 -0
  140. package/src/generated/SessionInfo.ts +0 -0
  141. package/src/generated/StatusAlign.ts +0 -0
  142. package/src/generated/StatusSegment.ts +0 -0
  143. package/src/generated/StopReason.ts +0 -0
  144. package/src/generated/StreamEvent.ts +0 -0
  145. package/src/generated/StreamId.ts +0 -0
  146. package/src/generated/SurfaceCell.ts +0 -0
  147. package/src/generated/SurfaceId.ts +0 -0
  148. package/src/generated/SwarmAgent.ts +0 -0
  149. package/src/generated/SwarmNode.ts +0 -0
  150. package/src/generated/SwarmStranger.ts +0 -0
  151. package/src/generated/TaskId.ts +0 -0
  152. package/src/generated/TaskStatus.ts +0 -0
  153. package/src/generated/TextEdit.ts +0 -0
  154. package/src/generated/ToolCall.ts +0 -0
  155. package/src/generated/ToolCallId.ts +0 -0
  156. package/src/generated/ToolDef.ts +0 -0
  157. package/src/generated/ToolInvocation.ts +0 -0
  158. package/src/generated/ToolResult.ts +0 -0
  159. package/src/generated/ToolSource.ts +0 -0
  160. package/src/generated/TurnId.ts +0 -0
  161. package/src/generated/TurnRequest.ts +0 -0
  162. package/src/generated/UiEvent.ts +0 -0
  163. package/src/generated/UpdateOutcome.ts +20 -0
  164. package/src/generated/UpdateStatus.ts +39 -0
  165. package/src/generated/Usage.ts +0 -0
  166. package/src/generated/UsageBucket.ts +0 -0
  167. package/src/generated/UsageHistory.ts +0 -0
  168. package/src/generated/UsageResolution.ts +0 -0
  169. package/src/generated/UsageScanSource.ts +0 -0
  170. package/src/generated/UsageScanStatus.ts +0 -0
  171. package/src/generated/UserQuestion.ts +0 -0
  172. package/src/generated/VarScope.ts +0 -0
  173. package/src/generated/ViewId.ts +0 -0
  174. package/src/generated/ViewInfo.ts +0 -0
  175. package/src/generated/Viewport.ts +0 -0
  176. package/src/generated/VirtChunk.ts +0 -0
  177. package/src/generated/VirtTextPos.ts +0 -0
  178. package/src/generated/WindowId.ts +0 -0
  179. package/src/generated/WindowInfo.ts +0 -0
  180. package/src/generated/WindowLayout.ts +0 -0
  181. package/src/generated/WorkspaceStatus.ts +0 -0
  182. package/src/generated/WorktreeInfo.ts +0 -0
  183. package/src/globals.d.ts +0 -0
  184. package/src/index.ts +70 -0
  185. package/src/ui.ts +0 -0
  186. package/tsconfig.json +0 -0
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@neosh/api",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "The neosh plugin API. Types are generated from the Rust side and drift-checked in CI.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "types": "src/index.ts",
8
- "exports": { ".": "./src/index.ts" },
8
+ "exports": {
9
+ ".": "./src/index.ts"
10
+ },
9
11
  "keywords": [
10
12
  "neosh",
11
13
  "neosh-plugin",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -366,6 +366,7 @@ export type ApiCall =
366
366
  | { "call": "swarm_probe"; addr: string }
367
367
  | { "call": "swarm_pair"; node: NodeId; name: string; addr?: string | null }
368
368
  | { "call": "swarm_unpair"; node: NodeId }
369
+ | { "call": "swarm_rename"; node: NodeId; name?: string | null }
369
370
  | { "call": "swarm_reconnect"; node: NodeId }
370
371
  | { "call": "swarm_disconnect"; node: NodeId }
371
372
  | { "call": "swarm_strangers" }
@@ -517,4 +518,20 @@ export type ApiCall =
517
518
  * conversation is about the workspace, and is never on screen by definition.
518
519
  */
519
520
  session?: SessionId | null;
521
+ }
522
+ | {
523
+ "call": "update_check";
524
+ /**
525
+ * Ask the network again rather than answering from the last check.
526
+ */
527
+ force: boolean;
528
+ }
529
+ | { "call": "update_apply" }
530
+ | {
531
+ "call": "update_restart";
532
+ /**
533
+ * Restart even with turns running. Never a default; a caller sets it only after saying
534
+ * out loud what would be lost.
535
+ */
536
+ force: boolean;
520
537
  };
File without changes
@@ -35,6 +35,8 @@ import type { SwarmAgent } from "./SwarmAgent";
35
35
  import type { SwarmNode } from "./SwarmNode";
36
36
  import type { SwarmStranger } from "./SwarmStranger";
37
37
  import type { ToolDef } from "./ToolDef";
38
+ import type { UpdateOutcome } from "./UpdateOutcome";
39
+ import type { UpdateStatus } from "./UpdateStatus";
38
40
  import type { UsageHistory } from "./UsageHistory";
39
41
  import type { ViewInfo } from "./ViewInfo";
40
42
  import type { Viewport } from "./Viewport";
@@ -107,4 +109,6 @@ export type ApiOk =
107
109
  | { "ok": "swarm_strangers"; strangers: Array<SwarmStranger> }
108
110
  | { "ok": "quotas"; quotas: Array<QuotaSnapshot> }
109
111
  | { "ok": "quota_history"; samples: Array<QuotaSample> }
110
- | { "ok": "usage_history"; history: UsageHistory };
112
+ | { "ok": "usage_history"; history: UsageHistory }
113
+ | { "ok": "update"; update: UpdateStatus }
114
+ | { "ok": "update_applied"; outcome: UpdateOutcome };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,8 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { ApiCall } from "./ApiCall";
2
3
  import type { BuildId } from "./BuildId";
3
4
  import type { KeyPress } from "./KeyPress";
5
+ import type { SessionId } from "./SessionId";
4
6
  import type { WindowId } from "./WindowId";
5
7
 
6
8
  /**
@@ -32,15 +34,38 @@ export type ClientMessage =
32
34
  * from the workspace anyway, and refusing it would be a worse answer than saying nothing.
33
35
  */
34
36
  build: BuildId;
37
+ /**
38
+ * Open in this conversation. See [`InputEvent::Attached::session`].
39
+ */
40
+ session?: SessionId | null;
35
41
  }
36
42
  | { "kind": "input" }
37
43
  & (
38
44
  | { "type": "ready"; width: number; height: number }
39
- | { "type": "attached"; width: number; height: number }
45
+ | {
46
+ "type": "attached";
47
+ width: number;
48
+ height: number;
49
+ /**
50
+ * Which conversation this terminal would like to open in.
51
+ *
52
+ * `None` — every attach until `neosh "a prompt"` existed — is the ordinary placement: the
53
+ * most recent conversation nobody else is reading, or the screen a workspace nobody was
54
+ * watching kept for whoever came back. That second case is why this cannot be left to
55
+ * "the newest conversation wins": a terminal starting one and then attaching would be
56
+ * handed the abandoned screen instead, and the conversation it had just started would be
57
+ * running somewhere nothing on that screen mentions.
58
+ *
59
+ * A request rather than an instruction: a conversation deleted between the ask and the
60
+ * arrival gets the ordinary placement rather than an error nobody can act on.
61
+ */
62
+ session?: SessionId | null;
63
+ }
40
64
  | { "type": "detached" }
41
65
  | { "type": "key"; key: KeyPress }
42
66
  | { "type": "paste"; text: string }
43
67
  | { "type": "resize"; width: number; height: number }
68
+ | { "type": "scroll"; rows: number }
44
69
  | {
45
70
  "type": "viewport_changed";
46
71
  win: WindowId;
@@ -64,4 +89,14 @@ export type ClientMessage =
64
89
  )
65
90
  | { "kind": "detach" }
66
91
  | { "kind": "stop" }
67
- | { "kind": "status" };
92
+ | { "kind": "status" }
93
+ | {
94
+ "kind": "call";
95
+ /**
96
+ * Echoed on [`ServerMessage::Called`]. Any string the caller likes — several may be in
97
+ * flight at once, which is the point of it being here rather than implied by order.
98
+ */
99
+ id: string;
100
+ call: ApiCall;
101
+ }
102
+ | { "kind": "subscribe" };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,14 +1,34 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
2
  import type { KeyPress } from "./KeyPress";
3
+ import type { SessionId } from "./SessionId";
3
4
  import type { WindowId } from "./WindowId";
4
5
 
5
6
  export type InputEvent =
6
7
  | { "type": "ready"; width: number; height: number }
7
- | { "type": "attached"; width: number; height: number }
8
+ | {
9
+ "type": "attached";
10
+ width: number;
11
+ height: number;
12
+ /**
13
+ * Which conversation this terminal would like to open in.
14
+ *
15
+ * `None` — every attach until `neosh "a prompt"` existed — is the ordinary placement: the
16
+ * most recent conversation nobody else is reading, or the screen a workspace nobody was
17
+ * watching kept for whoever came back. That second case is why this cannot be left to
18
+ * "the newest conversation wins": a terminal starting one and then attaching would be
19
+ * handed the abandoned screen instead, and the conversation it had just started would be
20
+ * running somewhere nothing on that screen mentions.
21
+ *
22
+ * A request rather than an instruction: a conversation deleted between the ask and the
23
+ * arrival gets the ordinary placement rather than an error nobody can act on.
24
+ */
25
+ session?: SessionId | null;
26
+ }
8
27
  | { "type": "detached" }
9
28
  | { "type": "key"; key: KeyPress }
10
29
  | { "type": "paste"; text: string }
11
30
  | { "type": "resize"; width: number; height: number }
31
+ | { "type": "scroll"; rows: number }
12
32
  | {
13
33
  "type": "viewport_changed";
14
34
  win: WindowId;
@@ -0,0 +1,15 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ /**
4
+ * How this neosh got onto the machine, which is what decides how it may be replaced.
5
+ *
6
+ * Detected from the path of the running executable and never configured: a setting would be a
7
+ * thing to get wrong, and getting it wrong means writing over a file some other program believes
8
+ * it owns.
9
+ */
10
+ export type InstallMethod =
11
+ | "homebrew"
12
+ | "npm"
13
+ | "cargo"
14
+ | "standalone"
15
+ | "development";
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -3,14 +3,15 @@
3
3
  /**
4
4
  * How the connection to a peer stands, beyond the fact of it being up or not.
5
5
  *
6
- * `up` is the summary and this is the story, because "not connected" is three different rows on a
6
+ * `up` is the summary and this is the story, because "not connected" is four different rows on a
7
7
  * board: a machine being dialled that has never answered, one that was here and is being dialled
8
- * again, and one nothing is dialling at all — it reached us last time, or it was told to stop.
9
- * `attempt` counts dials since the last success, so a panel can say `try 4` instead of drawing a
10
- * spinner that has been spinning since Tuesday.
8
+ * again, one nothing is dialling at all — it reached us last time, or it was told to stop — and
9
+ * one that answered and is waiting on a person. `attempt` counts dials since the last success, so
10
+ * a panel can say `try 4` instead of drawing a spinner that has been spinning since Tuesday.
11
11
  */
12
12
  export type LinkState =
13
13
  | { "state": "connecting"; attempt: number }
14
14
  | { "state": "up" }
15
+ | { "state": "waiting" }
15
16
  | { "state": "retrying"; attempt: number }
16
17
  | { "state": "down" };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,12 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ /**
4
+ * What a refused [`ApiCall::UpdateRestart`] was refused for.
5
+ */
6
+ export type RestartRefusal = {
7
+ /**
8
+ * The conversations with a turn in flight, workspace-wide — not just the ones this view can
9
+ * see, because a restart ends every one of them.
10
+ */
11
+ running: Array<string>;
12
+ };
File without changes
File without changes
File without changes
@@ -1,6 +1,8 @@
1
1
  // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { ApiResponse } from "./ApiResponse";
2
3
  import type { BuildId } from "./BuildId";
3
4
  import type { DetachReason } from "./DetachReason";
5
+ import type { PluginEvent } from "./PluginEvent";
4
6
  import type { UiEvent } from "./UiEvent";
5
7
  import type { WorkspaceStatus } from "./WorkspaceStatus";
6
8
 
@@ -12,4 +14,6 @@ export type ServerMessage =
12
14
  | { "kind": "refused"; reason: string; protocol_version: number }
13
15
  | { "kind": "events"; batch: Array<UiEvent> }
14
16
  | { "kind": "detached"; reason: DetachReason }
15
- | { "kind": "status"; status: WorkspaceStatus };
17
+ | { "kind": "status"; status: WorkspaceStatus }
18
+ | { "kind": "called"; id: string; response: ApiResponse }
19
+ | { "kind": "event"; event: PluginEvent };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,20 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { InstallMethod } from "./InstallMethod";
3
+
4
+ /**
5
+ * What [`ApiCall::UpdateApply`] did.
6
+ */
7
+ export type UpdateOutcome = { "outcome": "up_to_date"; version: string } | {
8
+ "outcome": "applied";
9
+ version: string;
10
+ /**
11
+ * Always true today, and a field rather than an assumption: a workspace holds running
12
+ * turns, so what happens next is a question for whoever pressed the key.
13
+ */
14
+ restart_required: boolean;
15
+ } | {
16
+ "outcome": "delegated";
17
+ version: string;
18
+ command: string;
19
+ method: InstallMethod;
20
+ } | { "outcome": "failed"; reason: string };
@@ -0,0 +1,39 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { InstallMethod } from "./InstallMethod";
3
+
4
+ /**
5
+ * What an update would be, if there is one.
6
+ */
7
+ export type UpdateStatus = {
8
+ /**
9
+ * The version running now.
10
+ */
11
+ current: string;
12
+ /**
13
+ * The newest published version, or `None` when the check has not run or could not reach the
14
+ * network. Absent is *unknown* rather than up to date — a failed check that reads as "you are
15
+ * current" is a machine that never updates and never says why.
16
+ */
17
+ latest?: string | null;
18
+ /**
19
+ * Whether `latest` is newer than `current`.
20
+ */
21
+ behind: boolean;
22
+ method: InstallMethod;
23
+ /**
24
+ * Whether [`ApiCall::UpdateApply`] would replace the binary, rather than name a command.
25
+ */
26
+ self_updatable: boolean;
27
+ /**
28
+ * The command to run by hand, when neosh will not do it itself.
29
+ */
30
+ upgrade_command?: string | null;
31
+ /**
32
+ * Why the last check failed, when it did. Kept so the UI can say *unknown, and here is why*.
33
+ */
34
+ error?: string | null;
35
+ /**
36
+ * Whether an update has been downloaded and is waiting for a restart.
37
+ */
38
+ restart_pending: boolean;
39
+ };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/globals.d.ts CHANGED
File without changes
package/src/index.ts CHANGED
@@ -82,6 +82,9 @@ import type { QuotaCredits } from "./generated/QuotaCredits";
82
82
  import type { QuotaSample } from "./generated/QuotaSample";
83
83
  import type { QuotaSeverity } from "./generated/QuotaSeverity";
84
84
  import type { QuotaSnapshot } from "./generated/QuotaSnapshot";
85
+ import type { InstallMethod } from "./generated/InstallMethod";
86
+ import type { UpdateOutcome } from "./generated/UpdateOutcome";
87
+ import type { UpdateStatus } from "./generated/UpdateStatus";
85
88
  import type { QuotaSource } from "./generated/QuotaSource";
86
89
  import type { QuotaWindow } from "./generated/QuotaWindow";
87
90
  import type { UsageBucket } from "./generated/UsageBucket";
@@ -143,6 +146,7 @@ export type {
143
146
  Message, PermissionDecision, PermissionMode, PermissionOption, PermissionOptionKind, PluginEvent, PluginInfo, PluginManifest, PointInfo, Pricing, ProviderEvent, ProviderOptionDescriptor,
144
147
  QuestionAnswer, QuestionOption, UserQuestion,
145
148
  CostBasis, QuotaCredits, QuotaSample, QuotaSeverity, QuotaSnapshot, QuotaSource, QuotaWindow,
149
+ InstallMethod, UpdateOutcome, UpdateStatus,
146
150
  UsageBucket, UsageHistory, UsageResolution, UsageScanSource,
147
151
  Rect, RepoInfo, RepoStatus, SelectShape, SessionId, SessionInfo, StatusAlign, StatusSegment, StopReason,
148
152
  SurfaceCell, SurfaceId, TextEdit, ToolCall, ToolDef, ToolResult, TurnRequest, Usage,
@@ -406,6 +410,8 @@ export interface Neosh {
406
410
  readonly event: EventApi;
407
411
  readonly swarm: SwarmApi;
408
412
  readonly quota: QuotaApi;
413
+ /** Whether there is a newer neosh, and becoming it. */
414
+ readonly update: UpdateApi;
409
415
  readonly rtp: RuntimePathApi;
410
416
  readonly path: PathApi;
411
417
  readonly timer: TimerApi;
@@ -1482,6 +1488,45 @@ export interface EventApi {
1482
1488
  * Everything here is data. Nothing in this API draws, which is what makes the bundled strip
1483
1489
  * replaceable by a panel of your own that reads exactly the same calls.
1484
1490
  */
1491
+ /**
1492
+ * Finding out there is a newer neosh, and becoming it.
1493
+ *
1494
+ * The half that decides everything is not *is there something newer* but *may I replace this file*.
1495
+ * A binary under a Homebrew prefix belongs to Homebrew, and writing over it leaves `brew` describing
1496
+ * a version that is not on disk. So {@link UpdateStatus.method} is read off the running executable's
1497
+ * path, and only a `standalone` install is ever overwritten — everything else is handed the command
1498
+ * that would do it, for a person to run.
1499
+ */
1500
+ export interface UpdateApi {
1501
+ /**
1502
+ * What is running, what is published, and what updating would mean on this machine.
1503
+ *
1504
+ * Answers from the last check unless `force`, so a panel row asking on every redraw costs
1505
+ * nothing. `latest` absent is *unknown* rather than up to date — a failed check that reads as
1506
+ * "you are current" is a machine that never updates and never says why, so draw
1507
+ * {@link UpdateStatus.error} when it is there.
1508
+ */
1509
+ check(force?: boolean): Promise<UpdateStatus>;
1510
+ /**
1511
+ * Update, by whichever route this install takes.
1512
+ *
1513
+ * Never runs somebody's package manager for them: a managed install comes back as
1514
+ * `delegated` with the command on it. A `standalone` one is downloaded, checked against the
1515
+ * published sha256 and swapped in with a rename — which is atomic and is allowed while the old
1516
+ * binary is still executing, and is why the answer carries `restart_required` rather than the
1517
+ * new version simply being live.
1518
+ */
1519
+ apply(): Promise<UpdateOutcome>;
1520
+ /**
1521
+ * Restart the workspace so a downloaded update takes effect.
1522
+ *
1523
+ * Rejects with `Busy`, naming them, while any turn is in flight in *any* conversation — a
1524
+ * restart ends turns belonging to terminals the caller cannot see. `force` goes ahead anyway,
1525
+ * and is for a caller that has said out loud what would be lost.
1526
+ */
1527
+ restart(force?: boolean): Promise<void>;
1528
+ }
1529
+
1485
1530
  export interface QuotaApi {
1486
1531
  /**
1487
1532
  * The latest snapshot for every instance that has one, freshest observation first.
@@ -1596,6 +1641,17 @@ export interface SwarmApi {
1596
1641
  pair(node: NodeId, opts?: { name?: string; addr?: string }): Promise<void>;
1597
1642
  /** Withdraw authorisation and stop connecting. Refuses for a machine your config declared. */
1598
1643
  unpair(node: NodeId): Promise<void>;
1644
+ /**
1645
+ * Call a machine something else — an SSH `Host` alias, and for the same reasons.
1646
+ *
1647
+ * A hostname is chosen by whoever set the machine up, is often `Mac` or `ubuntu` on every box
1648
+ * somebody owns, and is not what its owner calls it. This wins over the announced name
1649
+ * everywhere a `SwarmNode` is read, so every panel agrees; `null` gives the announced name back.
1650
+ *
1651
+ * Refuses for a machine your `config.toml` declared, naming the `name` field to change instead —
1652
+ * an alias stored beside a config peer would be reverted by the next reload.
1653
+ */
1654
+ rename(node: NodeId, name: string | null): Promise<void>;
1599
1655
  /**
1600
1656
  * Dial a down peer again now, rather than waiting out its retry delay.
1601
1657
  *
@@ -2008,6 +2064,9 @@ function build(
2008
2064
  async unpair(node) {
2009
2065
  await c({ call: "swarm_unpair", node });
2010
2066
  },
2067
+ async rename(node, name) {
2068
+ await c({ call: "swarm_rename", node, name });
2069
+ },
2011
2070
  async reconnect(node) {
2012
2071
  await c({ call: "swarm_reconnect", node });
2013
2072
  },
@@ -2036,6 +2095,17 @@ function build(
2036
2095
  return listener(r.swarmStreamListeners, cb);
2037
2096
  },
2038
2097
  },
2098
+ update: {
2099
+ async check(force) {
2100
+ return expect(await c({ call: "update_check", force: force ?? false }), "update").update;
2101
+ },
2102
+ async apply() {
2103
+ return expect(await c({ call: "update_apply" }), "update_applied").outcome;
2104
+ },
2105
+ async restart(force) {
2106
+ await c({ call: "update_restart", force: force ?? false });
2107
+ },
2108
+ },
2039
2109
  quota: {
2040
2110
  async list() {
2041
2111
  return expect(await c({ call: "quota_list" }), "quotas").quotas;
package/src/ui.ts CHANGED
File without changes
package/tsconfig.json CHANGED
File without changes