setup-agent 0.0.2 → 0.0.4

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.
@@ -1,272 +1,271 @@
1
- //#region src/protocol.d.ts
2
- declare namespace Checkout {
3
- type StepStatus = "pending" | "active" | "done" | "skipped" | "blocked";
4
- /** A unit of install work the agent declared; the catalog seeds none. */
5
- type Step = {
6
- id: string;
7
- title: string;
8
- detail?: string;
9
- status: StepStatus;
10
- note?: string;
11
- /** The product this step belongs to, when the agent said. */
12
- product?: string;
13
- createdAt: number;
14
- };
15
- type Product = {
16
- slug: string;
17
- name: string;
18
- /** The install reference the agent fetches while planning. */
19
- guide?: string;
20
- };
21
- type InputStatus = "open" | "answered" | "dismissed";
22
- /**
23
- * product: the agent proposes adding a product to this checkout, such as one
24
- * another product depends on. The browser owns the catalog, so it answers
25
- * with `checkout/add-product`; dismissing the input declines.
26
- */
27
- type InputKind = "text" | "choice" | "model" | "product";
28
- type ChoiceVariant = {
29
- id: string;
30
- label: string;
31
- };
32
- type ChoiceOption = {
33
- id: string;
34
- label: string;
35
- description?: string;
36
- /** A name from OPTION_ICONS, or the key of a brand mark on a preset option; unknown keys render without one. */
37
- icon?: string;
38
- /** A second pick under this option, such as the language of a framework. */
39
- variants?: ChoiceVariant[];
40
- };
41
- /** A short nudge for users who need help choosing, with a longer guide to link to. */
42
- type InputHelp = {
43
- summary: string;
44
- href?: string;
45
- };
46
- /**
47
- * The answer to a model input, stored as JSON text. The API key itself is
48
- * never part of it: the browser deposits it with the checkout and the
49
- * agent's `env` command writes it straight to a file.
50
- */
51
- type ModelAnswer = {
52
- provider: string;
53
- model: string;
54
- reasoningEffort?: "low" | "medium" | "high";
55
- };
56
- /**
57
- * A choice answer is an option id, `<option>:<variant>` when the option has
58
- * variants, or the user's own text when none of the options fit; a multiple
59
- * choice answers a JSON array of those. A model answer is a JSON-encoded
60
- * ModelAnswer whose provider is one of the options.
61
- */
62
- type Input = {
63
- phase: Status;
64
- id: string;
65
- kind: InputKind;
66
- /** The standard input this was built from, when it was. */
67
- preset?: string;
68
- prompt: string;
69
- placeholder?: string;
70
- options?: ChoiceOption[];
71
- /** The user may pick any number of options; the answer is a JSON array. */
72
- multiple?: true;
73
- /** The slug a product input proposes. */
74
- product?: string;
75
- default?: string;
76
- help?: InputHelp;
77
- optional: boolean;
78
- status: InputStatus;
79
- answer?: string;
80
- /** A remark the user attached to the answer. */
81
- note?: string;
82
- stepId?: string;
83
- createdAt: number;
84
- answeredAt?: number;
85
- };
86
- type LogEntry = {
87
- phase: Status;
88
- id: string;
89
- role: "agent" | "user";
90
- acknowledgedAt?: number;
91
- at: number;
92
- text: string;
93
- /** The step that was active when the line was posted; none while planning. */
94
- stepId?: string;
95
- };
96
- type PlanStatus = "proposed" | "approved" | "changes-requested";
97
- /** One revision of the agent's plan. Markdown the browser renders. */
98
- type Plan = {
99
- revision: number;
100
- markdown: string;
101
- status: PlanStatus;
102
- submittedAt: number;
103
- decidedAt?: number;
104
- /** What the user asked to change, when they did. */
105
- feedback?: string;
106
- };
107
- /**
108
- * waiting: no agent has joined. planning: the agent investigates and
109
- * proposes a plan. installing: the plan is approved and steps run.
110
- */
111
- type Status = "waiting" | "planning" | "installing" | "done" | "cancelled";
112
- /**
113
- * The agent's proposal to close the checkout. Only the user closes it, and
114
- * they may keep messaging the agent instead; a later `done` renews it.
115
- * `preview` is the loopback URL of a dev server the agent left running for
116
- * the user to try before they close.
117
- */
118
- type Completion = {
119
- proposedAt: number;
120
- preview?: string;
121
- };
122
- type State = {
123
- version: 2;
124
- /** The id the browser gave the current checkout; a create with another id replaces it on the same link. */
125
- id: string | null;
126
- status: Status;
127
- completion?: Completion;
128
- createdAt: number | null;
129
- products: Product[];
130
- instructions: string;
131
- agent: {
132
- lastSeenAt: number | null;
133
- /** False once the agent's stream said goodbye; heartbeats set it again. */
134
- connected: boolean;
135
- cwd: string | null;
136
- /** The coding agent that ran the command, as the CLI detected it from its environment. */
137
- kind: string | null;
138
- /** When the command was first run against this checkout, before the agent joined the stream. */
139
- introducedAt: number | null;
1
+ export declare namespace Checkout {
2
+ type StepStatus = "pending" | "active" | "done" | "skipped" | "blocked";
3
+ /** A unit of install work the agent declared; the catalog seeds none. */
4
+ type Step = {
5
+ id: string;
6
+ title: string;
7
+ detail?: string;
8
+ status: StepStatus;
9
+ note?: string;
10
+ /** The product this step belongs to, when the agent said. */
11
+ product?: string;
12
+ createdAt: number;
140
13
  };
141
- /** Every revision in order; the last one is current. */
142
- plans: Plan[];
143
- steps: Step[];
144
- inputs: Input[];
145
- log: LogEntry[];
146
- };
147
- type ProductSeed = {
148
- slug: string;
149
- name: string;
150
- guide?: string;
151
- };
152
- type InputSeed = {
153
- kind?: InputKind;
154
- preset?: string;
155
- prompt: string;
156
- placeholder?: string;
157
- options?: ChoiceOption[];
158
- multiple?: true;
159
- product?: string;
160
- default?: string;
161
- help?: InputHelp;
162
- optional?: boolean;
163
- };
164
- type PlanDecision = {
165
- decision: "approve";
166
- } | {
167
- decision: "revise";
168
- feedback: string;
169
- };
170
- type Commands = {
171
- "checkout/create": (params: {
172
- id: string;
173
- products: ProductSeed[];
174
- instructions?: string;
175
- }) => void;
176
- "checkout/begin-plan": () => void;
177
- "checkout/answer": (params: {
178
- inputId: string;
179
- answer: string;
180
- note?: string;
181
- }) => void;
182
- "checkout/add-product": (params: {
183
- inputId: string;
184
- product: ProductSeed;
185
- }) => void;
186
- "checkout/message": (params: {
187
- text: string;
188
- }) => void;
189
- "agent/ack": (params: {
190
- messageId: string;
191
- }) => void;
192
- "checkout/dismiss": (params: {
193
- inputId: string;
194
- }) => void;
195
- "checkout/plan": (params: PlanDecision) => void;
196
- "checkout/cancel": () => void;
197
- "checkout/finish": () => void;
198
- "agent/intro": (params: {
199
- kind?: string;
200
- }) => void;
201
- "agent/hello": (params: {
202
- cwd?: string;
203
- kind?: string;
204
- }) => void;
205
- "agent/heartbeat": () => void;
206
- "agent/bye": () => void;
207
- "agent/plan": (params: {
208
- markdown: string;
209
- }) => {
210
- revision: number;
14
+ type Product = {
15
+ slug: string;
16
+ name: string;
17
+ /** The install reference the agent fetches while planning. */
18
+ guide?: string;
211
19
  };
212
- "agent/add-step": (params: {
213
- title: string;
214
- detail?: string;
215
- product?: string;
216
- /** Start the step in the same call. */
217
- active?: boolean;
218
- }) => {
219
- stepId: string;
20
+ type InputStatus = "open" | "answered" | "dismissed";
21
+ /**
22
+ * product: the agent proposes adding a product to this checkout, such as one
23
+ * another product depends on. The browser owns the catalog, so it answers
24
+ * with `checkout/add-product`; dismissing the input declines.
25
+ */
26
+ type InputKind = "text" | "choice" | "model" | "product";
27
+ type ChoiceVariant = {
28
+ id: string;
29
+ label: string;
220
30
  };
221
- "agent/step": (params: {
222
- stepId: string;
223
- status: StepStatus;
224
- note?: string;
225
- }) => void;
226
- "agent/ask": (params: InputSeed & {
227
- stepId?: string;
228
- }) => {
229
- inputId: string;
31
+ type ChoiceOption = {
32
+ id: string;
33
+ label: string;
34
+ description?: string;
35
+ /** A name from OPTION_ICONS, or the key of a brand mark on a preset option; unknown keys render without one. */
36
+ icon?: string;
37
+ /** A second pick under this option, such as the language of a framework. */
38
+ variants?: ChoiceVariant[];
230
39
  };
231
- "agent/log": (params: {
232
- text: string;
233
- }) => void;
234
- "agent/done": (params?: {
235
- summary?: string;
236
- preview?: string;
237
- }) => void;
238
- };
239
- type RejectionReason = "already-created" | "not-created" | "closed" | "planning-not-started" | "plan-required" | "no-plan" | "plan-decided" | "finish-not-proposed" | "feedback-required" | "empty-plan" | "unknown-step" | "unknown-product" | "unknown-input" | "input-closed" | "invalid-input" | "invalid-answer" | "invalid-preview" | "empty-message" | "unknown-message";
40
+ /** A short nudge for users who need help choosing, with a longer guide to link to. */
41
+ type InputHelp = {
42
+ summary: string;
43
+ href?: string;
44
+ };
45
+ /**
46
+ * The answer to a model input, stored as JSON text. The API key itself is
47
+ * never part of it: the browser deposits it with the checkout and the
48
+ * agent's `env` command writes it straight to a file.
49
+ */
50
+ type ModelAnswer = {
51
+ provider: string;
52
+ model: string;
53
+ reasoningEffort?: "low" | "medium" | "high";
54
+ };
55
+ /**
56
+ * A choice answer is an option id, `<option>:<variant>` when the option has
57
+ * variants, or the user's own text when none of the options fit; a multiple
58
+ * choice answers a JSON array of those. A model answer is a JSON-encoded
59
+ * ModelAnswer whose provider is one of the options.
60
+ */
61
+ type Input = {
62
+ phase: Status;
63
+ id: string;
64
+ kind: InputKind;
65
+ /** The standard input this was built from, when it was. */
66
+ preset?: string;
67
+ prompt: string;
68
+ placeholder?: string;
69
+ options?: ChoiceOption[];
70
+ /** The user may pick any number of options; the answer is a JSON array. */
71
+ multiple?: true;
72
+ /** The slug a product input proposes. */
73
+ product?: string;
74
+ default?: string;
75
+ help?: InputHelp;
76
+ optional: boolean;
77
+ status: InputStatus;
78
+ answer?: string;
79
+ /** A remark the user attached to the answer. */
80
+ note?: string;
81
+ stepId?: string;
82
+ createdAt: number;
83
+ answeredAt?: number;
84
+ };
85
+ type LogEntry = {
86
+ phase: Status;
87
+ id: string;
88
+ role: "agent" | "user";
89
+ acknowledgedAt?: number;
90
+ at: number;
91
+ text: string;
92
+ /** The step that was active when the line was posted; none while planning. */
93
+ stepId?: string;
94
+ };
95
+ type PlanStatus = "proposed" | "approved" | "changes-requested";
96
+ /** One revision of the agent's plan. Markdown the browser renders. */
97
+ type Plan = {
98
+ revision: number;
99
+ markdown: string;
100
+ status: PlanStatus;
101
+ submittedAt: number;
102
+ decidedAt?: number;
103
+ /** What the user asked to change, when they did. */
104
+ feedback?: string;
105
+ };
106
+ /**
107
+ * waiting: no agent has joined. planning: the agent investigates and
108
+ * proposes a plan. installing: the plan is approved and steps run.
109
+ */
110
+ type Status = "waiting" | "planning" | "installing" | "done" | "cancelled";
111
+ /**
112
+ * The agent's proposal to close the checkout. Only the user closes it, and
113
+ * they may keep messaging the agent instead; a later `done` renews it.
114
+ * `preview` is the loopback URL of a dev server the agent left running for
115
+ * the user to try before they close.
116
+ */
117
+ type Completion = {
118
+ proposedAt: number;
119
+ preview?: string;
120
+ };
121
+ type State = {
122
+ version: 2;
123
+ /** The id the browser gave the current checkout; a create with another id replaces it on the same link. */
124
+ id: string | null;
125
+ status: Status;
126
+ completion?: Completion;
127
+ createdAt: number | null;
128
+ products: Product[];
129
+ instructions: string;
130
+ agent: {
131
+ lastSeenAt: number | null;
132
+ /** False once the agent's stream said goodbye; heartbeats set it again. */
133
+ connected: boolean;
134
+ cwd: string | null;
135
+ /** The coding agent that ran the command, as the CLI detected it from its environment. */
136
+ kind: string | null;
137
+ /** When the command was first run against this checkout, before the agent joined the stream. */
138
+ introducedAt: number | null;
139
+ };
140
+ /** Every revision in order; the last one is current. */
141
+ plans: Plan[];
142
+ steps: Step[];
143
+ inputs: Input[];
144
+ log: LogEntry[];
145
+ };
146
+ type ProductSeed = {
147
+ slug: string;
148
+ name: string;
149
+ guide?: string;
150
+ };
151
+ type InputSeed = {
152
+ kind?: InputKind;
153
+ preset?: string;
154
+ prompt: string;
155
+ placeholder?: string;
156
+ options?: ChoiceOption[];
157
+ multiple?: true;
158
+ product?: string;
159
+ default?: string;
160
+ help?: InputHelp;
161
+ optional?: boolean;
162
+ };
163
+ type PlanDecision = {
164
+ decision: "approve";
165
+ } | {
166
+ decision: "revise";
167
+ feedback: string;
168
+ };
169
+ type Commands = {
170
+ "checkout/create": (params: {
171
+ id: string;
172
+ products: ProductSeed[];
173
+ instructions?: string;
174
+ }) => void;
175
+ "checkout/begin-plan": () => void;
176
+ "checkout/answer": (params: {
177
+ inputId: string;
178
+ answer: string;
179
+ note?: string;
180
+ }) => void;
181
+ "checkout/add-product": (params: {
182
+ inputId: string;
183
+ product: ProductSeed;
184
+ }) => void;
185
+ "checkout/message": (params: {
186
+ text: string;
187
+ }) => void;
188
+ "agent/ack": (params: {
189
+ messageId: string;
190
+ }) => void;
191
+ "checkout/dismiss": (params: {
192
+ inputId: string;
193
+ }) => void;
194
+ "checkout/plan": (params: PlanDecision) => void;
195
+ "checkout/cancel": () => void;
196
+ "checkout/finish": () => void;
197
+ "agent/intro": (params: {
198
+ kind?: string;
199
+ }) => void;
200
+ "agent/hello": (params: {
201
+ cwd?: string;
202
+ kind?: string;
203
+ }) => void;
204
+ "agent/heartbeat": () => void;
205
+ "agent/bye": () => void;
206
+ "agent/plan": (params: {
207
+ markdown: string;
208
+ }) => {
209
+ revision: number;
210
+ };
211
+ "agent/add-step": (params: {
212
+ title: string;
213
+ detail?: string;
214
+ product?: string;
215
+ /** Start the step in the same call. */
216
+ active?: boolean;
217
+ }) => {
218
+ stepId: string;
219
+ };
220
+ "agent/step": (params: {
221
+ stepId: string;
222
+ status: StepStatus;
223
+ note?: string;
224
+ }) => void;
225
+ "agent/ask": (params: InputSeed & {
226
+ stepId?: string;
227
+ }) => {
228
+ inputId: string;
229
+ };
230
+ "agent/log": (params: {
231
+ text: string;
232
+ }) => void;
233
+ "agent/done": (params?: {
234
+ summary?: string;
235
+ preview?: string;
236
+ }) => void;
237
+ };
238
+ type RejectionReason = "already-created" | "not-created" | "closed" | "planning-not-started" | "plan-required" | "no-plan" | "plan-decided" | "finish-not-proposed" | "feedback-required" | "empty-plan" | "unknown-step" | "unknown-product" | "unknown-input" | "input-closed" | "invalid-input" | "invalid-answer" | "invalid-preview" | "empty-message" | "unknown-message";
240
239
  }
241
- declare const AGENT_PRESENCE_MS = 15000;
242
- declare const AGENT_HEARTBEAT_MS = 5000;
243
- declare const initialCheckoutState: () => Checkout.State;
244
- declare const isAgentPresent: (state: Checkout.State, now?: number) => boolean;
245
- declare const isClosed: (state: Checkout.State) => boolean;
240
+ export declare const AGENT_PRESENCE_MS = 15000;
241
+ export declare const AGENT_HEARTBEAT_MS = 5000;
242
+ export declare const initialCheckoutState: () => Checkout.State;
243
+ export declare const isAgentPresent: (state: Checkout.State, now?: number) => boolean;
244
+ export declare const isClosed: (state: Checkout.State) => boolean;
246
245
  /** True while the agent's proposal to close waits for the user. */
247
- declare const finishProposed: (state: Checkout.State) => boolean;
248
- /** True when the user messaged the agent after it last proposed to close. */
249
- declare const followedUpSinceProposal: (state: Checkout.State) => boolean;
246
+ export declare const finishProposed: (state: Checkout.State) => boolean;
247
+ /** True while a message the user sent after the agent proposed to close still waits for the agent. */
248
+ export declare const followedUpSinceProposal: (state: Checkout.State) => boolean;
250
249
  /**
251
250
  * The URL a preview names, or `undefined` unless it is an http(s) URL on this
252
251
  * machine's loopback interface. The browser opens it, so nothing else passes.
253
252
  */
254
- declare const parsePreviewUrl: (value: string | undefined) => URL | undefined;
255
- declare const openInputs: (state: Checkout.State) => Checkout.Input[];
253
+ export declare const parsePreviewUrl: (value: string | undefined) => URL | undefined;
254
+ export declare const openInputs: (state: Checkout.State) => Checkout.Input[];
256
255
  /** The current plan revision, or `undefined` before the agent proposed one. */
257
- declare const currentPlan: (state: Checkout.State) => Checkout.Plan | undefined;
256
+ export declare const currentPlan: (state: Checkout.State) => Checkout.Plan | undefined;
258
257
  /** True while a proposed plan waits for the user's decision. */
259
- declare const planNeedsReview: (state: Checkout.State) => boolean;
258
+ export declare const planNeedsReview: (state: Checkout.State) => boolean;
260
259
  /** The icons an agent can put on its own options, by name. */
261
- declare const OPTION_ICONS: readonly ["code", "terminal", "braces", "git-branch", "package", "database", "server", "cloud", "globe", "monitor", "smartphone", "key", "lock", "shield", "brain", "sparkles", "bot", "workflow", "file", "folder", "book", "table", "image", "video", "mic", "speech", "paperclip", "message", "mail", "bell", "calendar", "clock", "user", "users", "settings", "wrench", "plug", "link", "palette", "search", "zap", "check", "question"];
262
- type OptionIcon = (typeof OPTION_ICONS)[number];
263
- declare const isOptionIcon: (value: string) => value is OptionIcon;
264
- declare const parseChoiceAnswer: (answer: string) => {
265
- variant?: string;
266
- option: string;
260
+ export declare const OPTION_ICONS: readonly ["code", "terminal", "braces", "git-branch", "package", "database", "server", "cloud", "globe", "monitor", "smartphone", "key", "lock", "shield", "brain", "sparkles", "bot", "workflow", "file", "folder", "book", "table", "image", "video", "mic", "speech", "paperclip", "message", "mail", "bell", "calendar", "clock", "user", "users", "settings", "wrench", "plug", "link", "palette", "search", "zap", "check", "question"];
261
+ export type OptionIcon = (typeof OPTION_ICONS)[number];
262
+ export declare const isOptionIcon: (value: string) => value is OptionIcon;
263
+ export declare const parseChoiceAnswer: (answer: string) => {
264
+ variant?: string;
265
+ option: string;
267
266
  };
268
267
  /** The entries of a multiple choice answer, or `undefined` when the text is not a JSON array of strings. */
269
- declare const parseMultipleAnswer: (answer: string) => string[] | undefined;
268
+ export declare const parseMultipleAnswer: (answer: string) => string[] | undefined;
270
269
  type ChoiceAnswerKind = "option" | "custom" | "invalid";
271
270
  /**
272
271
  * "option" when `answer` names one of the input's options (with a variant
@@ -275,15 +274,14 @@ type ChoiceAnswerKind = "option" | "custom" | "invalid";
275
274
  * multiple choice is classified entry by entry: "invalid" when any entry is
276
275
  * or the array is empty, "custom" when any entry is the user's own text.
277
276
  */
278
- declare const classifyChoiceAnswer: (input: Checkout.Input, answer: string) => ChoiceAnswerKind;
277
+ export declare const classifyChoiceAnswer: (input: Checkout.Input, answer: string) => ChoiceAnswerKind;
279
278
  /** The model answer an input holds, or `undefined` when the text is not one. */
280
- declare const parseModelAnswer: (answer: string) => Checkout.ModelAnswer | undefined;
279
+ export declare const parseModelAnswer: (answer: string) => Checkout.ModelAnswer | undefined;
281
280
  /** Whether `answer` is a model answer naming one of the input's providers. */
282
- declare const isValidModelAnswer: (input: Checkout.Input, answer: string) => boolean;
283
- declare const stepProgress: (state: Checkout.State) => {
284
- total: number;
285
- done: number;
281
+ export declare const isValidModelAnswer: (input: Checkout.Input, answer: string) => boolean;
282
+ export declare const stepProgress: (state: Checkout.State) => {
283
+ total: number;
284
+ done: number;
286
285
  };
287
- //#endregion
288
- export { AGENT_HEARTBEAT_MS, AGENT_PRESENCE_MS, Checkout, OPTION_ICONS, OptionIcon, classifyChoiceAnswer, currentPlan, finishProposed, followedUpSinceProposal, initialCheckoutState, isAgentPresent, isClosed, isOptionIcon, isValidModelAnswer, openInputs, parseChoiceAnswer, parseModelAnswer, parseMultipleAnswer, parsePreviewUrl, planNeedsReview, stepProgress };
286
+ export {};
289
287
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","names":[],"sources":["../src/protocol.ts"],"mappings":";kBAAiB;OACH;;OAQA;IACV;IACA;IACA;IACA,QAAQ;IACR;;IAEA;IACA;;OAGU;IACV;IACA;;IAEA;;OAGU;;;;;;OAOA;OAEA;IAAkB;IAAY;;OAE9B;IACV;IACA;IACA;;IAEA;;IAEA,WAAW;;;OAID;IAAc;IAAiB;;;;;;;OAO/B;IACV;IACA;IACA;;;;;;;;OASU;IACV,OAAO;IACP;IACA,MAAM;;IAEN;IACA;IACA;IACA,UAAU;;IAEV;;IAEA;IACA;IACA,OAAO;IACP;IACA,QAAQ;IACR;;IAEA;IACA;IACA;IACA;;OAGU;IACV,OAAO;IACP;IACA;IACA;IACA;IACA;;IAEA;;OAGU;;OAGA;IACV;IACA;IACA,QAAQ;IACR;IACA;;IAEA;;;;;;OAOU;;;;;;;OAaA;IAAe;IAAoB;;OAEnC;IACV;;IAEA;IACA,QAAQ;IACR,aAAa;IACb;IACA,UAAU;IACV;IACA;MACE;;MAEA;MACA;;MAEA;;MAEA;;;IAGF,OAAO;IACP,OAAO;IACP,QAAQ;IACR,KAAK;;OAGK;IAAgB;IAAc;IAAc;;OAE5C;IACV,OAAO;IACP;IACA;IACA;IACA,UAAU;IACV;IACA;IACA;IACA,OAAO;IACP;;OAGU;IACN;;IACA;IAAoB;;OAEd;IACV,oBAAoB;MAClB;MACA,UAAU;MACV;;IAEF;IACA,oBAAoB;MAClB;MACA;MACA;;IAEF,yBAAyB;MACvB;MACA,SAAS;;IAEX,qBAAqB;MAAU;;IAC/B,cAAc;MAAU;;IACxB,qBAAqB;MAAU;;IAC/B,kBAAkB,QAAQ;IAC1B;IACA;IACA,gBAAgB;MAAU;;IAC1B,gBAAgB;MAAU;MAAc;;IACxC;IACA;IACA,eAAe;M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AG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAiBxD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,QAAQ,CAAC,KAAK,EACrB,QAAQ,MAAM,KACb,gBAOF,CAAC;AASF,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,MAAM,KACb,QAAQ,CAAC,WAAW,GAAG,SAoBzB,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,GAAI,OAAO,QAAQ,CAAC,KAAK,EAAE,QAAQ,MAAM,YAMvE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,QAAQ,CAAC,KAAK;;;CAKhD,CAAC"}
package/dist/protocol.js CHANGED
@@ -24,10 +24,10 @@ const isAgentPresent = (state, now = Date.now()) => state.agent.connected && sta
24
24
  const isClosed = (state) => state.status === "done" || state.status === "cancelled";
25
25
  /** True while the agent's proposal to close waits for the user. */
26
26
  const finishProposed = (state) => !isClosed(state) && state.completion !== void 0;
27
- /** True when the user messaged the agent after it last proposed to close. */
27
+ /** True while a message the user sent after the agent proposed to close still waits for the agent. */
28
28
  const followedUpSinceProposal = (state) => {
29
29
  const proposedAt = state.completion?.proposedAt;
30
- return proposedAt !== void 0 && state.log.some((entry) => entry.role === "user" && entry.at > proposedAt);
30
+ return proposedAt !== void 0 && state.log.some((entry) => entry.role === "user" && entry.at > proposedAt && entry.acknowledgedAt === void 0);
31
31
  };
32
32
  const LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
33
33
  "localhost",
@@ -103,7 +103,9 @@ const OPTION_ICONS = [
103
103
  ];
104
104
  const isOptionIcon = (value) => OPTION_ICONS.includes(value);
105
105
  const parseChoiceAnswer = (answer) => {
106
- const [option = "", variant] = answer.split(":", 2);
106
+ const parts = answer.split(":");
107
+ if (parts.length > 2) return { option: answer };
108
+ const [option = "", variant] = parts;
107
109
  return {
108
110
  option,
109
111
  ...variant !== void 0 && { variant }