@zvada/agent-server 0.3.26 → 0.3.28

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 (262) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +7 -5
  3. package/dist/client/client.js +27 -11
  4. package/dist/client/connection.js +35 -3
  5. package/dist/core/agents/acp/account.js +111 -0
  6. package/dist/core/agents/acp/acp-agent.js +247 -158
  7. package/dist/core/agents/acp/adapter.js +103 -34
  8. package/dist/core/agents/acp/client.js +169 -42
  9. package/dist/core/agents/acp/known-agents.js +12 -5
  10. package/dist/core/agents/acp/mappings.js +84 -20
  11. package/dist/core/agents/acp/models.js +59 -0
  12. package/dist/core/agents/acp/profile.js +36 -0
  13. package/dist/core/agents/acp/prompts.js +248 -0
  14. package/dist/core/agents/acp/requests.js +4 -4
  15. package/dist/core/agents/claude-code/approvals.js +1 -1
  16. package/dist/core/agents/claude-code/login.js +4 -1
  17. package/dist/core/agents/claude-code/session.js +38 -10
  18. package/dist/core/agents/claude-code/spawn.js +0 -26
  19. package/dist/core/agents/codex-app-server/client.js +12 -13
  20. package/dist/core/agents/codex-app-server/login.js +4 -1
  21. package/dist/core/agents/codex-app-server/plan-approval.js +1 -1
  22. package/dist/core/agents/gemini/failures.js +133 -0
  23. package/dist/core/agents/gemini/login.js +173 -0
  24. package/dist/core/agents/gemini/profile.js +137 -0
  25. package/dist/core/agents/gemini/tools.js +91 -0
  26. package/dist/core/agents/login.js +8 -6
  27. package/dist/core/agents/scripted/scripted-agent.js +30 -3
  28. package/dist/core/agents/stderr-tail.js +5 -2
  29. package/dist/core/presets.js +17 -1
  30. package/dist/core/processes/native-processes.js +23 -1
  31. package/dist/core/provision/install-build.js +70 -26
  32. package/dist/core/provision/pins.js +5 -0
  33. package/dist/core/provision/provisioner.js +39 -16
  34. package/dist/core/provision/releases.js +39 -1
  35. package/dist/core/provision/tools.js +87 -28
  36. package/dist/core/runtime/agent-runtime.js +15 -5
  37. package/dist/core/runtime/event-processor.js +13 -8
  38. package/dist/core/runtime/origin-line.js +42 -0
  39. package/dist/core/runtime/request-broker.js +2 -1
  40. package/dist/core/runtime/steering.js +4 -3
  41. package/dist/core/runtime/turn.js +6 -4
  42. package/dist/operator/errors.js +97 -0
  43. package/dist/operator/index.js +10 -5
  44. package/dist/operator/mcp.js +7 -12
  45. package/dist/operator/operator.js +1431 -378
  46. package/dist/operator/refs.js +59 -0
  47. package/dist/operator/render.js +199 -94
  48. package/dist/operator/session-tools.js +88 -0
  49. package/dist/operator/types.js +30 -0
  50. package/dist/operator/view.js +82 -27
  51. package/dist/protocol/account.js +5 -1
  52. package/dist/protocol/auth.js +5 -1
  53. package/dist/protocol/config.js +12 -5
  54. package/dist/protocol/conversation.js +3 -0
  55. package/dist/protocol/credentials.js +9 -1
  56. package/dist/protocol/harness.js +9 -1
  57. package/dist/protocol/history.js +2 -1
  58. package/dist/protocol/index.js +1 -0
  59. package/dist/protocol/lifecycle.js +19 -0
  60. package/dist/protocol/origin.js +39 -0
  61. package/dist/protocol/reduce.js +2 -0
  62. package/dist/protocol/wire.js +17 -0
  63. package/dist/server/bin.js +22 -7
  64. package/dist/server/install.js +6 -4
  65. package/dist/server/routes.js +15 -5
  66. package/dist/types/client/client.d.ts.map +1 -1
  67. package/dist/types/client/connection.d.ts +14 -2
  68. package/dist/types/client/connection.d.ts.map +1 -1
  69. package/dist/types/client/turns.d.ts +2 -2
  70. package/dist/types/client/turns.d.ts.map +1 -1
  71. package/dist/types/core/agents/acp/account.d.ts +55 -0
  72. package/dist/types/core/agents/acp/account.d.ts.map +1 -0
  73. package/dist/types/core/agents/acp/acp-agent.d.ts +65 -36
  74. package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
  75. package/dist/types/core/agents/acp/adapter.d.ts +28 -3
  76. package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
  77. package/dist/types/core/agents/acp/client.d.ts +66 -4
  78. package/dist/types/core/agents/acp/client.d.ts.map +1 -1
  79. package/dist/types/core/agents/acp/known-agents.d.ts +4 -2
  80. package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -1
  81. package/dist/types/core/agents/acp/mappings.d.ts +53 -7
  82. package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
  83. package/dist/types/core/agents/acp/models.d.ts +22 -0
  84. package/dist/types/core/agents/acp/models.d.ts.map +1 -0
  85. package/dist/types/core/agents/acp/profile.d.ts +92 -0
  86. package/dist/types/core/agents/acp/profile.d.ts.map +1 -0
  87. package/dist/types/core/agents/acp/prompts.d.ts +108 -0
  88. package/dist/types/core/agents/acp/prompts.d.ts.map +1 -0
  89. package/dist/types/core/agents/acp/requests.d.ts +7 -1
  90. package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
  91. package/dist/types/core/agents/base.d.ts +2 -0
  92. package/dist/types/core/agents/base.d.ts.map +1 -1
  93. package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
  94. package/dist/types/core/agents/claude-code/session.d.ts +3 -0
  95. package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
  96. package/dist/types/core/agents/claude-code/spawn.d.ts +0 -8
  97. package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -1
  98. package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
  99. package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
  100. package/dist/types/core/agents/gemini/failures.d.ts +25 -0
  101. package/dist/types/core/agents/gemini/failures.d.ts.map +1 -0
  102. package/dist/types/core/agents/gemini/login.d.ts +28 -0
  103. package/dist/types/core/agents/gemini/login.d.ts.map +1 -0
  104. package/dist/types/core/agents/gemini/profile.d.ts +30 -0
  105. package/dist/types/core/agents/gemini/profile.d.ts.map +1 -0
  106. package/dist/types/core/agents/gemini/tools.d.ts +18 -0
  107. package/dist/types/core/agents/gemini/tools.d.ts.map +1 -0
  108. package/dist/types/core/agents/login.d.ts +15 -5
  109. package/dist/types/core/agents/login.d.ts.map +1 -1
  110. package/dist/types/core/agents/scripted/scripted-agent.d.ts +14 -1
  111. package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -1
  112. package/dist/types/core/agents/stderr-tail.d.ts +1 -1
  113. package/dist/types/core/agents/stderr-tail.d.ts.map +1 -1
  114. package/dist/types/core/presets.d.ts +2 -2
  115. package/dist/types/core/presets.d.ts.map +1 -1
  116. package/dist/types/core/processes/native-processes.d.ts +6 -0
  117. package/dist/types/core/processes/native-processes.d.ts.map +1 -1
  118. package/dist/types/core/provision/checksums.d.ts +7 -1
  119. package/dist/types/core/provision/checksums.d.ts.map +1 -1
  120. package/dist/types/core/provision/install-build.d.ts +32 -6
  121. package/dist/types/core/provision/install-build.d.ts.map +1 -1
  122. package/dist/types/core/provision/pins.d.ts +4 -0
  123. package/dist/types/core/provision/pins.d.ts.map +1 -1
  124. package/dist/types/core/provision/provisioner.d.ts +18 -7
  125. package/dist/types/core/provision/provisioner.d.ts.map +1 -1
  126. package/dist/types/core/provision/releases.d.ts +2 -1
  127. package/dist/types/core/provision/releases.d.ts.map +1 -1
  128. package/dist/types/core/provision/tools.d.ts +36 -7
  129. package/dist/types/core/provision/tools.d.ts.map +1 -1
  130. package/dist/types/core/runtime/agent-runtime.d.ts +4 -2
  131. package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
  132. package/dist/types/core/runtime/event-processor.d.ts +2 -2
  133. package/dist/types/core/runtime/event-processor.d.ts.map +1 -1
  134. package/dist/types/core/runtime/origin-line.d.ts +15 -0
  135. package/dist/types/core/runtime/origin-line.d.ts.map +1 -0
  136. package/dist/types/core/runtime/request-broker.d.ts +1 -1
  137. package/dist/types/core/runtime/request-broker.d.ts.map +1 -1
  138. package/dist/types/core/runtime/steering.d.ts +7 -4
  139. package/dist/types/core/runtime/steering.d.ts.map +1 -1
  140. package/dist/types/core/runtime/turn.d.ts.map +1 -1
  141. package/dist/types/operator/errors.d.ts +87 -0
  142. package/dist/types/operator/errors.d.ts.map +1 -0
  143. package/dist/types/operator/index.d.ts +10 -5
  144. package/dist/types/operator/index.d.ts.map +1 -1
  145. package/dist/types/operator/mcp.d.ts +1 -1
  146. package/dist/types/operator/mcp.d.ts.map +1 -1
  147. package/dist/types/operator/operator.d.ts +15 -197
  148. package/dist/types/operator/operator.d.ts.map +1 -1
  149. package/dist/types/operator/refs.d.ts +25 -0
  150. package/dist/types/operator/refs.d.ts.map +1 -0
  151. package/dist/types/operator/render.d.ts +67 -22
  152. package/dist/types/operator/render.d.ts.map +1 -1
  153. package/dist/types/operator/session-tools.d.ts +61 -0
  154. package/dist/types/operator/session-tools.d.ts.map +1 -0
  155. package/dist/types/operator/types.d.ts +442 -0
  156. package/dist/types/operator/types.d.ts.map +1 -0
  157. package/dist/types/operator/view.d.ts +19 -29
  158. package/dist/types/operator/view.d.ts.map +1 -1
  159. package/dist/types/protocol/account.d.ts +4 -2
  160. package/dist/types/protocol/account.d.ts.map +1 -1
  161. package/dist/types/protocol/auth.d.ts +10 -7
  162. package/dist/types/protocol/auth.d.ts.map +1 -1
  163. package/dist/types/protocol/clis.d.ts +4 -3
  164. package/dist/types/protocol/clis.d.ts.map +1 -1
  165. package/dist/types/protocol/config.d.ts +22 -5
  166. package/dist/types/protocol/config.d.ts.map +1 -1
  167. package/dist/types/protocol/conversation.d.ts +47 -6
  168. package/dist/types/protocol/conversation.d.ts.map +1 -1
  169. package/dist/types/protocol/credentials.d.ts +8 -0
  170. package/dist/types/protocol/credentials.d.ts.map +1 -1
  171. package/dist/types/protocol/execution.d.ts +1 -1
  172. package/dist/types/protocol/harness.d.ts +5 -2
  173. package/dist/types/protocol/harness.d.ts.map +1 -1
  174. package/dist/types/protocol/history.d.ts +1 -1
  175. package/dist/types/protocol/history.d.ts.map +1 -1
  176. package/dist/types/protocol/index.d.ts +1 -0
  177. package/dist/types/protocol/index.d.ts.map +1 -1
  178. package/dist/types/protocol/lifecycle.d.ts +48 -10
  179. package/dist/types/protocol/lifecycle.d.ts.map +1 -1
  180. package/dist/types/protocol/models.d.ts +3 -0
  181. package/dist/types/protocol/models.d.ts.map +1 -1
  182. package/dist/types/protocol/origin.d.ts +49 -0
  183. package/dist/types/protocol/origin.d.ts.map +1 -0
  184. package/dist/types/protocol/reduce.d.ts.map +1 -1
  185. package/dist/types/protocol/wire-api.d.ts +78 -30
  186. package/dist/types/protocol/wire-api.d.ts.map +1 -1
  187. package/dist/types/protocol/wire.d.ts +78 -12
  188. package/dist/types/protocol/wire.d.ts.map +1 -1
  189. package/dist/types/server/install.d.ts +2 -1
  190. package/dist/types/server/install.d.ts.map +1 -1
  191. package/dist/types/server/routes.d.ts.map +1 -1
  192. package/docs/consuming.md +62 -121
  193. package/docs/deploy.md +17 -8
  194. package/docs/harnesses.md +166 -44
  195. package/docs/sync-history.md +2 -1
  196. package/package.json +1 -1
  197. package/src/client/client.ts +36 -9
  198. package/src/client/connection.ts +31 -1
  199. package/src/client/turns.ts +2 -1
  200. package/src/core/agents/acp/account.ts +158 -0
  201. package/src/core/agents/acp/acp-agent.ts +288 -178
  202. package/src/core/agents/acp/adapter.ts +126 -35
  203. package/src/core/agents/acp/client.ts +196 -49
  204. package/src/core/agents/acp/known-agents.ts +14 -5
  205. package/src/core/agents/acp/mappings.ts +112 -21
  206. package/src/core/agents/acp/models.ts +72 -0
  207. package/src/core/agents/acp/profile.ts +127 -0
  208. package/src/core/agents/acp/prompts.ts +287 -0
  209. package/src/core/agents/acp/requests.ts +16 -9
  210. package/src/core/agents/base.ts +2 -0
  211. package/src/core/agents/claude-code/approvals.ts +2 -2
  212. package/src/core/agents/claude-code/login.ts +4 -1
  213. package/src/core/agents/claude-code/session.ts +38 -8
  214. package/src/core/agents/claude-code/spawn.ts +0 -26
  215. package/src/core/agents/codex-app-server/client.ts +11 -18
  216. package/src/core/agents/codex-app-server/login.ts +4 -5
  217. package/src/core/agents/codex-app-server/plan-approval.ts +1 -1
  218. package/src/core/agents/gemini/failures.ts +148 -0
  219. package/src/core/agents/gemini/login.ts +188 -0
  220. package/src/core/agents/gemini/profile.ts +162 -0
  221. package/src/core/agents/gemini/tools.ts +99 -0
  222. package/src/core/agents/login.ts +14 -8
  223. package/src/core/agents/scripted/scripted-agent.ts +42 -3
  224. package/src/core/agents/stderr-tail.ts +5 -2
  225. package/src/core/presets.ts +19 -3
  226. package/src/core/processes/native-processes.ts +32 -1
  227. package/src/core/provision/checksums.ts +12 -2
  228. package/src/core/provision/install-build.ts +122 -55
  229. package/src/core/provision/pins.ts +5 -0
  230. package/src/core/provision/provisioner.ts +62 -27
  231. package/src/core/provision/releases.ts +47 -1
  232. package/src/core/provision/tools.ts +124 -31
  233. package/src/core/runtime/agent-runtime.ts +31 -7
  234. package/src/core/runtime/event-processor.ts +13 -6
  235. package/src/core/runtime/origin-line.ts +43 -0
  236. package/src/core/runtime/request-broker.ts +2 -0
  237. package/src/core/runtime/steering.ts +8 -4
  238. package/src/core/runtime/turn.ts +11 -4
  239. package/src/operator/errors.ts +221 -0
  240. package/src/operator/index.ts +18 -23
  241. package/src/operator/mcp.ts +7 -16
  242. package/src/operator/operator.ts +1684 -610
  243. package/src/operator/refs.ts +75 -0
  244. package/src/operator/render.ts +260 -118
  245. package/src/operator/session-tools.ts +127 -0
  246. package/src/operator/types.ts +506 -0
  247. package/src/operator/view.ts +93 -42
  248. package/src/protocol/account.ts +5 -2
  249. package/src/protocol/auth.ts +5 -1
  250. package/src/protocol/config.ts +14 -6
  251. package/src/protocol/conversation.ts +3 -0
  252. package/src/protocol/credentials.ts +11 -2
  253. package/src/protocol/harness.ts +9 -1
  254. package/src/protocol/history.ts +2 -1
  255. package/src/protocol/index.ts +1 -0
  256. package/src/protocol/lifecycle.ts +21 -0
  257. package/src/protocol/origin.ts +47 -0
  258. package/src/protocol/reduce.ts +4 -0
  259. package/src/protocol/wire.ts +18 -0
  260. package/src/server/bin.ts +20 -6
  261. package/src/server/install.ts +6 -3
  262. package/src/server/routes.ts +16 -5
@@ -0,0 +1,442 @@
1
+ /**
2
+ * The operator's public types (LLP 0019): who calls, what a session is as the
3
+ * tools report it, the host the product implements, and the refusals.
4
+ * `Origin` is the protocol's (it rides `turn/start` and `turn/steer`).
5
+ */
6
+ import type { z } from "zod";
7
+ import type { ReportedPermissionMode } from "../protocol/config.ts";
8
+ import type { AgentHarness } from "../protocol/harness.ts";
9
+ import type { Origin } from "../protocol/origin.ts";
10
+ import type { ThinkingLevel } from "../protocol/thinking.ts";
11
+ import type { Answer } from "./render.ts";
12
+ import type { DecisionRequest, QuestionRequest, ViewMessage } from "./view.ts";
13
+ export type { Origin };
14
+ /**
15
+ * A session's own agent calling the tools. Filled by the engine's delivery
16
+ * of the tools to the session, never by the model.
17
+ */
18
+ export interface SessionCaller {
19
+ kind: "session";
20
+ sessionId: string;
21
+ /** The turn the call is made in: a tool call always happens inside one. */
22
+ turnId: string;
23
+ harness: AgentHarness;
24
+ /** The session's mode live at the call, not the turn's start config: `plan` may only read. */
25
+ permissionMode: ReportedPermissionMode;
26
+ /** Aborts when the agent gives the call up: a held wait answers at once. */
27
+ signal?: AbortSignal;
28
+ }
29
+ /**
30
+ * Anyone outside a session: an assistant, a paired device, the product's
31
+ * own window. `Auth` is the host's (its token, its access row): the package
32
+ * passes it through to the host and reads nothing of it.
33
+ */
34
+ export interface ExternalCaller<Auth = unknown> {
35
+ kind: "external";
36
+ /** Stable per caller; with the kind, keys repeats and rates. */
37
+ id: string;
38
+ /** Whose words its messages are: the person's own window or device, or an assistant's. */
39
+ speaksAs: "person" | "assistant";
40
+ /** How the host shows it ("ChatGPT"); an assistant's origin carries it. */
41
+ name?: string;
42
+ /** Epoch ms its connection ends: no call waits past it (less a margin). */
43
+ endsAt?: number;
44
+ /** Aborts when the caller gives the call up (its request closed): a held wait answers at once. */
45
+ signal?: AbortSignal;
46
+ auth: Auth;
47
+ }
48
+ export type Caller<Auth = unknown> = SessionCaller | ExternalCaller<Auth>;
49
+ /** `session:<id>` or `external:<id>`: every map the package keeps is keyed by it. */
50
+ export type CallerKey = `session:${string}` | `external:${string}`;
51
+ /**
52
+ * - `setting_up`: its workspace is being prepared; no turn can run yet.
53
+ * - `idle`: no turn runs; the last one finished (or none ran).
54
+ * - `working`: a turn runs.
55
+ * - `needs_input`: a turn waits on a question, a plan or a permission.
56
+ * - `stopped`: the last turn was cancelled, and nothing ran since.
57
+ * - `error`: the last turn failed, or the workspace could not be set up.
58
+ * - `archived`: put away; read only.
59
+ */
60
+ export type SessionStatus = "setting_up" | "idle" | "working" | "needs_input" | "stopped" | "error" | "archived";
61
+ /** `list_sessions`'s `started_by` filter, from the caller's side. */
62
+ export type StartedByFilter = "me" | "agents" | "person" | "any";
63
+ export interface ProjectRef {
64
+ id: string;
65
+ /** Unique among the caller's projects, case-insensitively. May hold `/` (`owner/name`). */
66
+ name: string;
67
+ }
68
+ export interface WorkspaceRef {
69
+ id: string;
70
+ /** Unique in its project, case-insensitively; holds neither `/` nor `:`. */
71
+ name: string;
72
+ }
73
+ /** One session as the host lists it. */
74
+ export interface Entry {
75
+ /**
76
+ * The engine's `sessionId`, minted when the session is asked for, before
77
+ * its workspace is set up: one identity for the session's whole life.
78
+ */
79
+ id: string;
80
+ project?: ProjectRef;
81
+ /** A host with no workspaces gives each session one of its own. */
82
+ workspace: WorkspaceRef;
83
+ /** Its number in its workspace, from 1, never reused. Absent: the tools print its id. */
84
+ chat?: number;
85
+ /** The chat a bare workspace name means. */
86
+ current: boolean;
87
+ status: SessionStatus;
88
+ title?: string;
89
+ harness?: AgentHarness;
90
+ model?: string;
91
+ /**
92
+ * Who started it: the start's origin, kept by the host. An external caller
93
+ * speaking as the person starts as the person, at account scope.
94
+ */
95
+ startedBy: Origin;
96
+ startedAt?: number;
97
+ lastActivityAt?: number;
98
+ /** Why `error`, when setup failed (a failed turn's error is the view's). */
99
+ error?: string;
100
+ /** A few words the host adds to the row (lines changed, a pull request). */
101
+ note?: string;
102
+ /** Paths in this session's tool lines are shown relative to this folder. */
103
+ root?: string;
104
+ }
105
+ /** A place in a session's conversation, minted by the host; the package never reads it. */
106
+ export type Cursor = string & {
107
+ readonly __operatorCursor: true;
108
+ };
109
+ export type TurnOutcome = "running" | "done" | "cancelled" | "failed";
110
+ export interface ViewTurn {
111
+ turnId: string;
112
+ outcome: TurnOutcome;
113
+ /** Who stopped it, when the host knows (`cancelled`). */
114
+ cancelledBy?: Origin;
115
+ /** Why it failed (`failed`). */
116
+ error?: string;
117
+ /** Each user message carries its own sender (`ViewMessage.origin`): a turn can mix them. */
118
+ messages: readonly ViewMessage[];
119
+ startedAt?: number;
120
+ endedAt?: number;
121
+ }
122
+ /**
123
+ * What a session waits on, with the kind the engine's broker said explicitly
124
+ * (`permission.requested`'s `purpose`): a plan only when it says `plan`. A
125
+ * model names one by the broker's own `requestId`.
126
+ */
127
+ export type Waiting = {
128
+ kind: "question";
129
+ request: QuestionRequest;
130
+ } | {
131
+ kind: "plan" | "permission";
132
+ request: DecisionRequest;
133
+ };
134
+ /** How a turn ended, by its id, whatever page of the transcript is read. */
135
+ export interface TurnEnded {
136
+ turnId: string;
137
+ outcome: "done" | "cancelled" | "failed";
138
+ /** Who stopped it, when the host knows. */
139
+ cancelledBy?: Origin;
140
+ }
141
+ /** One turn, looked up by id. */
142
+ export type TurnFact = {
143
+ state: "running";
144
+ } | ({
145
+ state: "ended";
146
+ } & Omit<TurnEnded, "turnId">) | {
147
+ state: "unknown";
148
+ };
149
+ export interface SessionView {
150
+ status: SessionStatus;
151
+ /** The running turn's id, if one runs: independent of `turns`' page. */
152
+ running?: string;
153
+ /** The last turn that ended, and how: independent of `turns`' page. */
154
+ lastEnded?: TurnEnded;
155
+ /** Oldest first; after `after`, only what followed it (a turn still running may repeat). */
156
+ turns: readonly ViewTurn[];
157
+ waiting: readonly Waiting[];
158
+ /** The host holds earlier turns than these. */
159
+ older?: boolean;
160
+ /** Where this read ended: the next read's `after`. Absent: the host has no cursors. */
161
+ cursor?: Cursor;
162
+ }
163
+ export interface ViewOptions {
164
+ /** The most recent messages wanted. A host may give more; the package cuts. */
165
+ last?: number;
166
+ /** Only what came after this place. A cursor the host cannot read is `stale_cursor`. */
167
+ after?: Cursor;
168
+ }
169
+ export interface ListFilter {
170
+ project?: ProjectRef;
171
+ workspace?: WorkspaceRef;
172
+ status?: readonly SessionStatus[];
173
+ /** Archived ones too: name resolution asks for the complete set. */
174
+ includeArchived?: boolean;
175
+ }
176
+ export interface StartInput {
177
+ /** The first task's turn id, minted by the package: deliver the first message as this turn. */
178
+ turnId: string;
179
+ project: ProjectRef;
180
+ /** A new chat in this workspace; absent: a new workspace. */
181
+ workspace?: WorkspaceRef;
182
+ harness?: AgentHarness;
183
+ model?: string;
184
+ thinkingLevel?: ThinkingLevel;
185
+ title?: string;
186
+ /** The first message: the host delivers it as the session's first turn, at once or once set up. */
187
+ message: string;
188
+ origin: Origin;
189
+ }
190
+ export interface SendInput {
191
+ /** Minted by the package; a retry after no answer uses it again, and the engine converges on it. */
192
+ turnId: string;
193
+ message: string;
194
+ origin: Origin;
195
+ }
196
+ /**
197
+ * What a cancel did: the turn stopped (it has ended: a host whose stop is
198
+ * asynchronous waits for the end, briefly, before saying so), there was none,
199
+ * the stop is asked and its end not yet seen (`unconfirmed`: an archive then
200
+ * archives nothing), or (a session being set up) its first task was dropped.
201
+ */
202
+ export type CancelOutcome = "stopped" | "not_running" | "unconfirmed" | "first_task_dropped";
203
+ export type ArchiveTarget = {
204
+ kind: "session";
205
+ id: string;
206
+ } | {
207
+ kind: "workspace";
208
+ id: string;
209
+ };
210
+ export interface ModelEntry {
211
+ harness: AgentHarness;
212
+ id: string;
213
+ label: string;
214
+ thinkingLevels: readonly ThinkingLevel[];
215
+ defaultThinkingLevel?: ThinkingLevel;
216
+ /** The model a new session on this harness starts on. */
217
+ default?: boolean;
218
+ /** The harness a new session starts on when none is named. */
219
+ defaultHarness?: boolean;
220
+ }
221
+ /** Every refusal the tools give, and nothing else (LLP 0019, Errors). */
222
+ export declare const OPERATOR_ERROR_CODES: readonly ["invalid_input", "not_found", "ambiguous", "archived", "self", "read_only", "access", "not_yours", "has_children", "busy", "not_waiting", "person_only", "setup_failed", "limit_depth", "limit_sessions", "limit_setting_up", "limit_rate", "limit_resources", "stale_cursor", "unsupported", "failed"];
223
+ export type OperatorErrorCode = (typeof OPERATOR_ERROR_CODES)[number];
224
+ /** A refusal as the host gives one (`authorize`, `admit`, or thrown from a method as `Refused`). */
225
+ export interface Refusal {
226
+ code: OperatorErrorCode;
227
+ /** The sessions it is about, by id (a busy member, the children not archived). */
228
+ sessions?: readonly string[];
229
+ /** The state the host saw at its commit (`busy`): the words follow it, not the preflight read. */
230
+ state?: SessionStatus;
231
+ /** The host's words, one line, trusted: said after the code's sentence. */
232
+ detail?: string;
233
+ /** Seconds after which the same call may succeed. */
234
+ retryAfter?: number;
235
+ }
236
+ /**
237
+ * What a tool does, for the rules, declared honestly: anything that changes
238
+ * something or posts outside is `write`. `read` runs in plan mode.
239
+ */
240
+ export type Effect = "read" | "write" | "destructive";
241
+ /**
242
+ * Limits, each a host may change. The defaults are LLP 0019's.
243
+ * `depth` and `sessionsPerStarter` bind session callers only. A cap across
244
+ * the host (workspaces being set up, disk, memory) is the host's, enforced
245
+ * inside its own `start`: one starter's lock cannot hold it.
246
+ */
247
+ export interface Limits {
248
+ /** A session started by a chain this long may start no more. Default 3. */
249
+ depth: number;
250
+ /** Sessions one session started that are not archived. Default 12. */
251
+ sessionsPerStarter: number;
252
+ /** Starts per caller in any 60 seconds. Default 10. */
253
+ startsPerMinute: number;
254
+ }
255
+ /** How long a held call may wait, by caller kind: a default and a cap, in seconds. */
256
+ export interface WaitCaps {
257
+ /** Default 120 and 240 (Codex cuts a tool call at 300 s unless told otherwise). */
258
+ session: {
259
+ default: number;
260
+ max: number;
261
+ };
262
+ /** Default 60 and 90; never past `endsAt` less 5 s. */
263
+ external: {
264
+ default: number;
265
+ max: number;
266
+ };
267
+ }
268
+ /** What `admit` is asked before a start: the host's resource probes. */
269
+ export interface AdmitRequest {
270
+ kind: "start";
271
+ project: ProjectRef;
272
+ /** Absent: a new workspace would be set up. */
273
+ workspace?: WorkspaceRef;
274
+ origin: Origin;
275
+ }
276
+ /**
277
+ * The facts the rules and limits rest on, authoritative, not filtered by
278
+ * what a caller may see. Required of a host that enables session callers.
279
+ */
280
+ export interface PolicyFacts {
281
+ /** The sessions this session started, not archived. */
282
+ startedBy(sessionId: string): Promise<Entry[]>;
283
+ /** Who started this session, and who started that one, nearest first. */
284
+ lineage(sessionId: string): Promise<Origin[]>;
285
+ /** Every session in the workspace with its status, archived ones excluded. */
286
+ inWorkspace(workspaceId: string): Promise<Entry[]>;
287
+ }
288
+ /**
289
+ * The product, to the package. `list`, `view`, `send` and `onChange` are
290
+ * required; every other method is a capability, and a tool that needs one
291
+ * the host lacks is not listed. The host keeps its own check at each
292
+ * mutation; the package's rules are in addition.
293
+ */
294
+ export interface OperatorHost<Auth = unknown> {
295
+ /** The sessions this caller may see, filtered as asked (the package filters again). */
296
+ list(caller: Caller<Auth>, filter: ListFilter): Promise<Entry[]>;
297
+ view(caller: Caller<Auth>, sessionId: string, options: ViewOptions): Promise<SessionView>;
298
+ /**
299
+ * Start the turn `input.turnId` now, carrying `origin` to the wire. The
300
+ * same turn id again converges on the first (the engine's rule). A host
301
+ * that finds the session busy refuses `busy` (an `OperatorError`, or
302
+ * `Refused`), any other definite refusal is one of those too, and a
303
+ * failure whose outcome is unknown throws a plain error: the package tries
304
+ * again with the same turn id.
305
+ */
306
+ send(caller: Caller<Auth>, sessionId: string, input: SendInput): Promise<void>;
307
+ /** One turn by id: running, ended (how, and by whom when stopped), or unknown. */
308
+ turn(caller: Caller<Auth>, sessionId: string, turnId: string): Promise<TurnFact>;
309
+ /**
310
+ * Call `listener` with the sessions that may have changed, for as long as
311
+ * the returned function is not called. Waits rest on it.
312
+ */
313
+ onChange(listener: (sessionIds: readonly string[]) => void): () => void;
314
+ /** One entry by session id or workspace id (its current chat), archived ones included. */
315
+ entry?(caller: Caller<Auth>, id: string): Promise<Entry | undefined>;
316
+ /** Every project this caller could start in, those with no session included. */
317
+ projects?(caller: Caller<Auth>): Promise<ProjectRef[]>;
318
+ /**
319
+ * Make the session (and its workspace, when none is named) and return its
320
+ * entry at once, its session id minted now: `idle`, or `setting_up` while
321
+ * its workspace is prepared. Keep `input.origin` as its `startedBy`. The
322
+ * host OWNS delivering `input.message` as its first turn (`input.turnId`),
323
+ * at once or once set up, and reports what became of it through the
324
+ * session's status (an `error` with why when it could not be delivered).
325
+ * The package's checks are preflight; the host enforces, atomically at
326
+ * its commit, by throwing `Refused`: no start into an archived workspace
327
+ * or by an archived starter (`archived`), and its caps across starters
328
+ * (`limit_setting_up` or `limit_resources`, with `retryAfter`). Enables
329
+ * `start_session`.
330
+ */
331
+ start?(caller: Caller<Auth>, input: StartInput): Promise<Entry>;
332
+ /**
333
+ * Stop this turn, and only it; with no turn (a session being set up), drop
334
+ * the first task the host holds for it. Enables `stop_sessions` and
335
+ * `when: interrupt`.
336
+ */
337
+ cancel?(caller: Caller<Auth>, sessionId: string, turnId?: string): Promise<CancelOutcome>;
338
+ /** Answer exactly this request; `accepted: false` when it no longer waits. Enables `answer_request`. */
339
+ respond?(caller: Caller<Auth>, sessionId: string, answer: Answer): Promise<{
340
+ accepted: boolean;
341
+ }>;
342
+ /**
343
+ * Archive one target. The package's checks are preflight; the host
344
+ * enforces eligibility atomically at its commit, throwing `Refused` with
345
+ * the sessions concerned and the state it saw: a member being set up
346
+ * (`busy`, `state: "setting_up"`), a member still working or waiting, the
347
+ * caller's own included, since a stop must be confirmed first (`busy`; a
348
+ * member the caller did not start, `not_yours`), a member that started
349
+ * sessions not archived, lineage included (`has_children`).
350
+ * Check every condition a stop cannot change before answering `busy`.
351
+ * Enables `archive`.
352
+ */
353
+ archive?(caller: Caller<Auth>, target: ArchiveTarget): Promise<{
354
+ note?: string;
355
+ }>;
356
+ /** The models a new session can run. Enables `list_models`. */
357
+ models?(caller: Caller<Auth>): Promise<ModelEntry[]>;
358
+ /**
359
+ * Whether this outside caller may run this tool now, read from the host's
360
+ * store at the call: asked before every tool and again just before every
361
+ * write the package makes (each send, cancel, answer, start, archive). The tool's
362
+ * name lets a host allow one write tool to a low-access caller.
363
+ */
364
+ authorize?(caller: ExternalCaller<Auth>, call: {
365
+ effect: Effect;
366
+ tool: string;
367
+ }): Refusal | undefined | Promise<Refusal | undefined>;
368
+ /** Required with session callers: the facts the rules and limits rest on. */
369
+ policy?: PolicyFacts;
370
+ /** Resource probes before a start (disk, memory): a `limit_resources` refusal, or none. */
371
+ admit?(caller: Caller<Auth>, request: AdmitRequest): Promise<Refusal | undefined>;
372
+ /** One line of host facts once a turn settles ("changes: a.ts (+4 -0)"). */
373
+ outcome?(caller: Caller<Auth>, entry: Entry): Promise<string | undefined>;
374
+ /** One line `whoami` adds for this caller ("access: read"). */
375
+ describe?(caller: Caller<Auth>): Promise<string | undefined>;
376
+ }
377
+ /**
378
+ * A tool the host adds beside the package's. It declares only its effect;
379
+ * the package applies plan mode and `authorize` (with its name) to it and
380
+ * nothing else. It may not change sessions: that is the package's tools'.
381
+ */
382
+ export interface ExtraTool<Auth = unknown> {
383
+ name: string;
384
+ title: string;
385
+ description: string;
386
+ input: z.ZodObject;
387
+ effect: Effect;
388
+ /** It reaches past this host (sends something elsewhere): MCP's `openWorldHint`. */
389
+ openWorld?: boolean;
390
+ /** `call`: the call's deadline (epoch ms) and its caller's signal, so a long run answers in time. */
391
+ run(args: never, caller: Caller<Auth>, call: CallScope): Promise<string>;
392
+ }
393
+ /**
394
+ * A call's time, as a host's own tool sees it: the deadline the package's
395
+ * waits keep (the caller's wait, capped, never past its connection) and the
396
+ * caller's signal.
397
+ */
398
+ export interface CallScope {
399
+ deadline: number;
400
+ signal?: AbortSignal;
401
+ }
402
+ /** A tool as any transport lists it. */
403
+ export interface ToolInfo {
404
+ name: string;
405
+ title: string;
406
+ description: string;
407
+ /** JSON Schema of the arguments (an object). */
408
+ inputSchema: unknown;
409
+ readOnly: boolean;
410
+ /** It reaches past this host: MCP's `openWorldHint`. */
411
+ openWorld?: boolean;
412
+ /** It may undo or lose work: MCP's `destructiveHint`. */
413
+ destructive?: boolean;
414
+ }
415
+ /** Time, for the waits and the limits. Tests pass their own; the default is the wall clock. */
416
+ export interface OperatorClock {
417
+ now(): number;
418
+ /** Resolve after `ms`, or as soon as `signal` aborts. */
419
+ pause(ms: number, signal: AbortSignal): Promise<void>;
420
+ }
421
+ export interface OperatorOptions<Auth = unknown> {
422
+ limits?: Partial<Limits>;
423
+ waits?: Partial<WaitCaps>;
424
+ extra?: ExtraTool<Auth>[];
425
+ clock?: OperatorClock;
426
+ /**
427
+ * Shown each unexpected failure a call answers without (a `refused (failed)`,
428
+ * an outcome that could not be read), once, with the tool and the caller:
429
+ * for the host's reports. Never a refusal. It cannot change the answer,
430
+ * and a throw inside it is swallowed.
431
+ */
432
+ onError?: (error: unknown, tool: string, caller: Caller<Auth>) => void;
433
+ }
434
+ export interface Operator<Auth = unknown> {
435
+ /** The same for every caller: an assistant keeps the list it got when it connected. */
436
+ tools(): ToolInfo[];
437
+ /** Run one tool and answer in text. Refusals are `OperatorError`s. */
438
+ call(name: string, args: unknown, caller: Caller<Auth>): Promise<string>;
439
+ /** The entry a reference names (LLP 0019, References). */
440
+ find(caller: Caller<Auth>, ref: string): Promise<Entry>;
441
+ }
442
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/operator/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;A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aAAa;IAC7B,GAAG,IAAI,MAAM,CAAC;IACd,yDAAyD;IACzD,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,eAAe,CAAC,IAAI,GAAG,OAAO;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,QAAQ,CAAC,IAAI,GAAG,OAAO;IACvC,uFAAuF;IACvF,KAAK,IAAI,QAAQ,EAAE,CAAC;IACpB,sEAAsE;IACtE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzE,0DAA0D;IAC1D,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CACxD"}
@@ -1,44 +1,34 @@
1
1
  /**
2
- * What an operator needs to know about one session, however its host keeps it.
3
- *
4
- * A host that holds a folded `ConversationState` gets this with `viewOf`. A host
5
- * that keeps its own rows (messages with their parts, a status column) builds
6
- * the same shape directly. Nothing here knows about projects, workspaces,
7
- * accounts or storage: those are the host's.
2
+ * What the operator needs to know about one session, however its host keeps
3
+ * it. A host that holds a folded `ConversationState` gets it with `viewOf`; a
4
+ * host that keeps its own rows builds the same shape. Nothing here knows about
5
+ * projects, workspaces, accounts or storage: those are the host's.
8
6
  */
9
7
  import { type ConversationElicitation, type ConversationPermission, type ConversationState } from "../protocol/conversation.ts";
8
+ import type { ReportedOrigin } from "../protocol/origin.ts";
10
9
  import type { Part, UnknownPart } from "../protocol/parts.ts";
10
+ import type { SessionStatus, SessionView, TurnFact, Waiting } from "./types.ts";
11
11
  export interface ViewMessage {
12
12
  role: "user" | "assistant";
13
13
  parts: readonly (Part | UnknownPart)[];
14
14
  /** A sub-agent's output: shown nested, never as the agent's reply. */
15
15
  nested?: boolean;
16
+ /** A user message's sender when it is not the person (LLP 0019). */
17
+ origin?: ReportedOrigin;
16
18
  }
17
19
  /** A question the agent asked, as the engine's `elicitation.requested` carries it. */
18
20
  export type QuestionRequest = Pick<ConversationElicitation, "requestId" | "mode" | "message" | "questions" | "url">;
19
21
  /** A decision the agent waits on (a tool's approval, or a plan), as `permission.requested` carries it. */
20
- export type DecisionRequest = Pick<ConversationPermission, "requestId" | "title" | "toolCall" | "options">;
21
- export type Waiting = {
22
- kind: "question";
23
- request: QuestionRequest;
24
- } | {
25
- kind: "decision";
26
- request: DecisionRequest;
27
- };
28
- export interface SessionView {
29
- /** Whether a turn is running. "Waiting on a person" is `waiting`, not a status. */
30
- status: "idle" | "working" | "error";
31
- messages: readonly ViewMessage[];
32
- waiting: readonly Waiting[];
33
- error?: string;
34
- /** The host holds earlier messages than the ones given here. */
35
- older?: boolean;
36
- }
37
- /** What a person would call the session's state. Waiting on them is not "finished". */
38
- export type Phase = "idle" | "working" | "needs_input" | "error";
39
- export declare function phaseOf(view: Pick<SessionView, "status" | "waiting">): Phase;
40
- /** A plan's approval is a decision whose options include "keep planning" (`PLAN_OPTIONS`). */
41
- export declare function isPlan(request: DecisionRequest): boolean;
42
- /** The view of a session whose events were folded with the engine's reducer. */
22
+ export type DecisionRequest = Pick<ConversationPermission, "requestId" | "title" | "toolCall" | "options" | "purpose">;
23
+ /** A decision's kind, from its `purpose`: `plan` when it says so, else a permission. */
24
+ export declare function waitingOf(request: DecisionRequest): Waiting;
25
+ /** Whether a status needs no more waiting: a wait returns it. */
26
+ export declare const settledStatus: (status: SessionStatus) => boolean;
27
+ /**
28
+ * The view of a session whose events were folded with the engine's reducer,
29
+ * with its turn facts (`running`, `lastEnded`) from every turn, not a page.
30
+ */
43
31
  export declare function viewOf(state: ConversationState): SessionView;
32
+ /** One turn of a folded state, by id: the host's `turn`, for a host that folds. */
33
+ export declare function turnOf(state: ConversationState, turnId: string): TurnFact;
44
34
  //# sourceMappingURL=view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/operator/view.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EAItB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAG9D,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,KAAK,EAAE,SAAS,CAAC,IAAI,GAAG,WAAW,CAAC,EAAE,CAAC;IACvC,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,sFAAsF;AACtF,MAAM,MAAM,eAAe,GAAG,IAAI,CACjC,uBAAuB,EACvB,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,KAAK,CACtD,CAAC;AACF,0GAA0G;AAC1G,MAAM,MAAM,eAAe,GAAG,IAAI,CACjC,sBAAsB,EACtB,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAC9C,CAAC;AAEF,MAAM,MAAM,OAAO,GAChB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OA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AAC,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,MAAM,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,sFAAsF;AACtF,MAAM,MAAM,eAAe,GAAG,IAAI,CACjC,uBAAuB,EACvB,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,KAAK,CACtD,CAAC;AACF,0GAA0G;AAC1G,MAAM,MAAM,eAAe,GAAG,IAAI,CACjC,sBAAsB,EACtB,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAC1D,CAAC;AAGF,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAE3D;AAED,iEAAiE;AACjE,eAAO,MAAM,aAAa,GAAI,QAAQ,aAAa,KAAG,OACN,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,WAAW,CAE5D;AAED,mFAAmF;AACnF,wBAAgB,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAQzE"}
@@ -15,9 +15,11 @@ export type AccountInfo = z.infer<typeof AccountInfoSchema>;
15
15
  /**
16
16
  * What to call a login, the same wherever it lives: `Claude Max`, `ChatGPT
17
17
  * Pro`, `Claude subscription` (plan unknown), `OpenAI API key`, `Amazon
18
- * Bedrock`. A plan this table does not know shows as the provider names it.
18
+ * Bedrock`. A subscription whose login names its own plan (`label`) is
19
+ * called that; otherwise the name is made from its plan, and a plan this
20
+ * table does not know shows as the provider names it.
19
21
  */
20
- export declare function accountLabel(harness: string, login: Pick<HarnessAuth, "credential" | "plan" | "provider">): string | undefined;
22
+ export declare function accountLabel(harness: string, login: Pick<HarnessAuth, "credential" | "plan" | "provider" | "label">): string | undefined;
21
23
  /**
22
24
  * A login the product holds, as `auth/status` says one, without its secret:
23
25
  * a product shows both kinds with one view.
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/protocol/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;iBAQ5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAgC5D;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM,GAAG,UAAU,CAAC,GAC1D,MAAM,GAAG,SAAS,CASpB;AAQD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,eAAe,GAAG,WAAW,CAuB7D"}
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/protocol/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;iBAQ5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAgC5D;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,GACpE,MAAM,GAAG,SAAS,CAUpB;AAQD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,eAAe,GAAG,WAAW,CAuB7D"}
@@ -60,7 +60,7 @@ export type AuthMethod = z.infer<typeof AuthMethodSchema>;
60
60
  */
61
61
  export declare const AuthLoginSchema: z.ZodObject<{
62
62
  loginId: z.ZodString;
63
- harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown>>;
63
+ harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown>>;
64
64
  method: z.ZodString;
65
65
  url: z.ZodOptional<z.ZodString>;
66
66
  codeUrl: z.ZodOptional<z.ZodString>;
@@ -78,7 +78,7 @@ export declare const HarnessAuthSchema: z.ZodObject<{
78
78
  email: z.ZodOptional<z.ZodString>;
79
79
  organization: z.ZodOptional<z.ZodString>;
80
80
  plan: z.ZodOptional<z.ZodString>;
81
- harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown>>;
81
+ harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown>>;
82
82
  state: z.ZodType<"unknown" | (string & {}) | "signed_in" | "signed_out", unknown, z.core.$ZodTypeInternals<"unknown" | (string & {}) | "signed_in" | "signed_out", unknown>>;
83
83
  credential: z.ZodOptional<z.ZodType<(string & {}) | "subscription" | "api_key" | "cloud", unknown, z.core.$ZodTypeInternals<(string & {}) | "subscription" | "api_key" | "cloud", unknown>>>;
84
84
  source: z.ZodOptional<z.ZodType<(string & {}) | "login" | "environment" | "settings" | "product", unknown, z.core.$ZodTypeInternals<(string & {}) | "login" | "environment" | "settings" | "product", unknown>>>;
@@ -95,7 +95,7 @@ export declare const HarnessAuthSchema: z.ZodObject<{
95
95
  error: z.ZodOptional<z.ZodString>;
96
96
  loginUnderWay: z.ZodOptional<z.ZodObject<{
97
97
  loginId: z.ZodString;
98
- harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown>>;
98
+ harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown>>;
99
99
  method: z.ZodString;
100
100
  url: z.ZodOptional<z.ZodString>;
101
101
  codeUrl: z.ZodOptional<z.ZodString>;
@@ -116,6 +116,7 @@ export declare const AuthStatusParamsSchema: z.ZodObject<{
116
116
  harnesses: z.ZodOptional<z.ZodArray<z.ZodEnum<{
117
117
  "claude-code": "claude-code";
118
118
  "codex-app-server": "codex-app-server";
119
+ gemini: "gemini";
119
120
  acp: "acp";
120
121
  scripted: "scripted";
121
122
  }>>>;
@@ -128,7 +129,7 @@ export declare const AuthStatusResultSchema: z.ZodObject<{
128
129
  email: z.ZodOptional<z.ZodString>;
129
130
  organization: z.ZodOptional<z.ZodString>;
130
131
  plan: z.ZodOptional<z.ZodString>;
131
- harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown>>;
132
+ harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown>>;
132
133
  state: z.ZodType<"unknown" | (string & {}) | "signed_in" | "signed_out", unknown, z.core.$ZodTypeInternals<"unknown" | (string & {}) | "signed_in" | "signed_out", unknown>>;
133
134
  credential: z.ZodOptional<z.ZodType<(string & {}) | "subscription" | "api_key" | "cloud", unknown, z.core.$ZodTypeInternals<(string & {}) | "subscription" | "api_key" | "cloud", unknown>>>;
134
135
  source: z.ZodOptional<z.ZodType<(string & {}) | "login" | "environment" | "settings" | "product", unknown, z.core.$ZodTypeInternals<(string & {}) | "login" | "environment" | "settings" | "product", unknown>>>;
@@ -145,7 +146,7 @@ export declare const AuthStatusResultSchema: z.ZodObject<{
145
146
  error: z.ZodOptional<z.ZodString>;
146
147
  loginUnderWay: z.ZodOptional<z.ZodObject<{
147
148
  loginId: z.ZodString;
148
- harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown>>;
149
+ harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown>>;
149
150
  method: z.ZodString;
150
151
  url: z.ZodOptional<z.ZodString>;
151
152
  codeUrl: z.ZodOptional<z.ZodString>;
@@ -163,6 +164,7 @@ export declare const AuthLoginParamsSchema: z.ZodObject<{
163
164
  harness: z.ZodEnum<{
164
165
  "claude-code": "claude-code";
165
166
  "codex-app-server": "codex-app-server";
167
+ gemini: "gemini";
166
168
  acp: "acp";
167
169
  scripted: "scripted";
168
170
  }>;
@@ -200,7 +202,7 @@ export declare const AuthUpdatedSchema: z.ZodObject<{
200
202
  email: z.ZodOptional<z.ZodString>;
201
203
  organization: z.ZodOptional<z.ZodString>;
202
204
  plan: z.ZodOptional<z.ZodString>;
203
- harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown>>;
205
+ harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown>>;
204
206
  state: z.ZodType<"unknown" | (string & {}) | "signed_in" | "signed_out", unknown, z.core.$ZodTypeInternals<"unknown" | (string & {}) | "signed_in" | "signed_out", unknown>>;
205
207
  credential: z.ZodOptional<z.ZodType<(string & {}) | "subscription" | "api_key" | "cloud", unknown, z.core.$ZodTypeInternals<(string & {}) | "subscription" | "api_key" | "cloud", unknown>>>;
206
208
  source: z.ZodOptional<z.ZodType<(string & {}) | "login" | "environment" | "settings" | "product", unknown, z.core.$ZodTypeInternals<(string & {}) | "login" | "environment" | "settings" | "product", unknown>>>;
@@ -217,7 +219,7 @@ export declare const AuthUpdatedSchema: z.ZodObject<{
217
219
  error: z.ZodOptional<z.ZodString>;
218
220
  loginUnderWay: z.ZodOptional<z.ZodObject<{
219
221
  loginId: z.ZodString;
220
- harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "acp" | "scripted", unknown>>;
222
+ harness: z.ZodType<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown, z.core.$ZodTypeInternals<(string & {}) | "claude-code" | "codex-app-server" | "gemini" | "acp" | "scripted", unknown>>;
221
223
  method: z.ZodString;
222
224
  url: z.ZodOptional<z.ZodString>;
223
225
  codeUrl: z.ZodOptional<z.ZodString>;
@@ -249,6 +251,7 @@ export declare const AuthLogoutParamsSchema: z.ZodObject<{
249
251
  harness: z.ZodEnum<{
250
252
  "claude-code": "claude-code";
251
253
  "codex-app-server": "codex-app-server";
254
+ gemini: "gemini";
252
255
  acp: "acp";
253
256
  scripted: "scripted";
254
257
  }>;