@appsolutely-io/waypoint 0.0.0-stage → 0.1.1-next.1

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 (161) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +297 -2
  3. package/dist/block-reply-r8u-DNmZ.d.cts +181 -0
  4. package/dist/block-reply-z8El20nD.d.ts +181 -0
  5. package/dist/blocks-2ABWECKG.js +1 -0
  6. package/dist/blocks-7453YTYJ.cjs +1 -0
  7. package/dist/chunk-3KV7TDDR.cjs +3 -0
  8. package/dist/chunk-4BWV3SEL.cjs +1 -0
  9. package/dist/chunk-5Q3INHKA.js +1 -0
  10. package/dist/chunk-5TBO732O.js +1 -0
  11. package/dist/chunk-6OZSKCPT.cjs +1 -0
  12. package/dist/chunk-A3YOSFLE.cjs +1 -0
  13. package/dist/chunk-BRUQ75G3.cjs +1 -0
  14. package/dist/chunk-C3VS33WJ.js +1 -0
  15. package/dist/chunk-D2EGPBCX.cjs +1 -0
  16. package/dist/chunk-D4Q46KWA.js +1 -0
  17. package/dist/chunk-FBADWFRR.cjs +1 -0
  18. package/dist/chunk-FQSWQLRW.js +1 -0
  19. package/dist/chunk-GT6PI4CT.cjs +1 -0
  20. package/dist/chunk-II26UWZM.cjs +1 -0
  21. package/dist/chunk-IPI4O4LP.js +1 -0
  22. package/dist/chunk-JFMVVGGB.js +1 -0
  23. package/dist/chunk-K73VV7KA.js +1 -0
  24. package/dist/chunk-L4PFFRDE.js +3 -0
  25. package/dist/chunk-LLPGVQUT.cjs +1 -0
  26. package/dist/chunk-M63QOANE.js +1 -0
  27. package/dist/chunk-MEKDQDSV.js +1 -0
  28. package/dist/chunk-OEPKPDLD.js +1 -0
  29. package/dist/chunk-OWT55N6J.js +3 -0
  30. package/dist/chunk-PFR2J5BV.js +1 -0
  31. package/dist/chunk-Q7BULGQG.cjs +1 -0
  32. package/dist/chunk-QFBAOEPD.js +1 -0
  33. package/dist/chunk-QS3MKZOY.cjs +3 -0
  34. package/dist/chunk-RZ3AGK3U.cjs +1 -0
  35. package/dist/chunk-RZZDQWC2.js +1 -0
  36. package/dist/chunk-S73WZWDP.js +1 -0
  37. package/dist/chunk-T5XF2R74.js +1 -0
  38. package/dist/chunk-TCFCSGQ3.js +1 -0
  39. package/dist/chunk-TODYQ3SG.cjs +1 -0
  40. package/dist/chunk-TVSQHTK2.cjs +1 -0
  41. package/dist/chunk-VGGJGRNK.cjs +1 -0
  42. package/dist/chunk-XSHOLIC7.cjs +1 -0
  43. package/dist/chunk-XTKUDSDK.cjs +1 -0
  44. package/dist/chunk-XWDB2LS3.cjs +1 -0
  45. package/dist/cli.js +3 -0
  46. package/dist/confirmation-view-5BZ2PP7J.cjs +1 -0
  47. package/dist/confirmation-view-Z5JHY2F5.js +1 -0
  48. package/dist/conformance.cjs +1 -0
  49. package/dist/conformance.d.cts +10 -0
  50. package/dist/conformance.d.ts +10 -0
  51. package/dist/conformance.js +1 -0
  52. package/dist/flow-parser.cjs +1 -0
  53. package/dist/flow-parser.d.cts +3 -0
  54. package/dist/flow-parser.d.ts +3 -0
  55. package/dist/flow-parser.js +1 -0
  56. package/dist/flows-panel-2SCPYZ3X.js +1 -0
  57. package/dist/flows-panel-HQYJMOP4.cjs +1 -0
  58. package/dist/form-extras-RNMBCYV7.cjs +1 -0
  59. package/dist/form-extras-X3B3JCMH.js +1 -0
  60. package/dist/form-fill-C32AHxSr.d.cts +653 -0
  61. package/dist/form-fill-Dp3ut1_Y.d.ts +653 -0
  62. package/dist/form-session.cjs +1 -0
  63. package/dist/form-session.d.cts +7 -0
  64. package/dist/form-session.d.ts +7 -0
  65. package/dist/form-session.js +1 -0
  66. package/dist/frame-decoder.cjs +3 -0
  67. package/dist/frame-decoder.d.cts +5 -0
  68. package/dist/frame-decoder.d.ts +5 -0
  69. package/dist/frame-decoder.js +3 -0
  70. package/dist/generated-C9tbjwK0.d.cts +797 -0
  71. package/dist/generated-C9tbjwK0.d.ts +797 -0
  72. package/dist/hooks/index.cjs +1 -0
  73. package/dist/hooks/index.d.cts +48 -0
  74. package/dist/hooks/index.d.ts +48 -0
  75. package/dist/hooks/index.js +1 -0
  76. package/dist/i18n-WC9f-h_q.d.cts +151 -0
  77. package/dist/i18n-WC9f-h_q.d.ts +151 -0
  78. package/dist/index-B5idIFTx.d.cts +34 -0
  79. package/dist/index-DPzoKXCK.d.ts +34 -0
  80. package/dist/index.cjs +3 -0
  81. package/dist/index.d.cts +38 -0
  82. package/dist/index.d.ts +38 -0
  83. package/dist/index.js +3 -0
  84. package/dist/intent-BQPPows1.d.cts +154 -0
  85. package/dist/intent-BuvqEU3Q.d.ts +154 -0
  86. package/dist/intent.cjs +1 -0
  87. package/dist/intent.d.cts +2 -0
  88. package/dist/intent.d.ts +2 -0
  89. package/dist/intent.js +1 -0
  90. package/dist/markdown-5NUOCOGY.js +23 -0
  91. package/dist/markdown-CG7NXI7X.cjs +23 -0
  92. package/dist/message-actions-ORBVYGNE.cjs +1 -0
  93. package/dist/message-actions-XNBBFHGW.js +1 -0
  94. package/dist/messages/en/index.cjs +1 -0
  95. package/dist/messages/en/index.d.cts +3 -0
  96. package/dist/messages/en/index.d.ts +3 -0
  97. package/dist/messages/en/index.js +1 -0
  98. package/dist/messages/index.cjs +1 -0
  99. package/dist/messages/index.d.cts +14 -0
  100. package/dist/messages/index.d.ts +14 -0
  101. package/dist/messages/index.js +1 -0
  102. package/dist/messages/zh-Hans/index.cjs +1 -0
  103. package/dist/messages/zh-Hans/index.d.cts +3 -0
  104. package/dist/messages/zh-Hans/index.d.ts +3 -0
  105. package/dist/messages/zh-Hans/index.js +1 -0
  106. package/dist/on-demand.cjs +1 -0
  107. package/dist/on-demand.d.cts +56 -0
  108. package/dist/on-demand.d.ts +56 -0
  109. package/dist/on-demand.js +1 -0
  110. package/dist/problem-messages-THONMXFZ.cjs +1 -0
  111. package/dist/problem-messages-Z5QGO6RE.js +1 -0
  112. package/dist/react/index.cjs +1 -0
  113. package/dist/react/index.d.cts +421 -0
  114. package/dist/react/index.d.ts +421 -0
  115. package/dist/react/index.js +1 -0
  116. package/dist/reads-Bk84x_rt.d.ts +38 -0
  117. package/dist/reads-DlpCt8dE.d.cts +38 -0
  118. package/dist/recovery-panel-6EBUMANX.js +3 -0
  119. package/dist/recovery-panel-EQIIV7TT.cjs +3 -0
  120. package/dist/reply-controls-HUYHUO3W.js +1 -0
  121. package/dist/reply-controls-LGY2RKRJ.cjs +1 -0
  122. package/dist/run-XBABOEXK.js +1 -0
  123. package/dist/schema.json +2900 -0
  124. package/dist/skin-antd/index.cjs +1 -0
  125. package/dist/skin-antd/index.d.cts +30 -0
  126. package/dist/skin-antd/index.d.ts +30 -0
  127. package/dist/skin-antd/index.js +1 -0
  128. package/dist/skin-default/index.cjs +1 -0
  129. package/dist/skin-default/index.d.cts +42 -0
  130. package/dist/skin-default/index.d.ts +42 -0
  131. package/dist/skin-default/index.js +1 -0
  132. package/dist/step-name-BlgVvshf.d.ts +19 -0
  133. package/dist/step-name-CB3d3kkP.d.cts +19 -0
  134. package/dist/storage-commit.cjs +1 -0
  135. package/dist/storage-commit.d.cts +17 -0
  136. package/dist/storage-commit.d.ts +17 -0
  137. package/dist/storage-commit.js +1 -0
  138. package/dist/stream-reads.cjs +1 -0
  139. package/dist/stream-reads.d.cts +22 -0
  140. package/dist/stream-reads.d.ts +22 -0
  141. package/dist/stream-reads.js +1 -0
  142. package/dist/styles.css +811 -0
  143. package/dist/testing/index.cjs +1 -0
  144. package/dist/testing/index.d.cts +57 -0
  145. package/dist/testing/index.d.ts +57 -0
  146. package/dist/testing/index.js +1 -0
  147. package/docs/examples/message-versions.tsx +74 -0
  148. package/docs/form-fill-protocol.md +83 -0
  149. package/docs/message-versions.md +64 -0
  150. package/docs/plan-protocol.md +83 -0
  151. package/docs/reply-protocol.md +75 -0
  152. package/etc/hooks.api.md +2394 -0
  153. package/etc/index.api.md +2159 -0
  154. package/etc/messages-en.api.md +13 -0
  155. package/etc/messages-zh-Hans.api.md +13 -0
  156. package/etc/messages.api.md +186 -0
  157. package/etc/react.api.md +2977 -0
  158. package/etc/skin-antd.api.md +2998 -0
  159. package/etc/skin-default.api.md +61 -0
  160. package/etc/testing.api.md +3043 -0
  161. package/package.json +169 -4
@@ -0,0 +1,653 @@
1
+ import { ac as PlanRecord, C as CanonicalRequest, E as ExecutionAcceptance, Y as IntentCause, _ as IntentRequest, ab as PlanIntentReply, ad as PlanState, M as ManifestEntry, T as ToolCall, R as ReadTemplate, s as Conversation, ag as Reply, F as Frame, a as Flow, P as Problem, a2 as LeaveAcknowledgment, q as ConfirmationRecord, a3 as Message, G as FormValidation, y as FormFillRequest, A as FormSubject, t as CreateConversation } from './generated-C9tbjwK0.js';
2
+ import { a as ScopeSignal, d as IntentOverlay, c as IntentNotice, I as IntentAlert } from './intent-BuvqEU3Q.js';
3
+
4
+ interface StepContext {
5
+ planId: string;
6
+ stepId: string;
7
+ headers: Record<string, string>;
8
+ stepUpCode?: string;
9
+ /**
10
+ * Aborted when the run is retired, stopped by dispose or interrupted; an
11
+ * adapter may pass it to its request. It is a standard AbortSignal.
12
+ */
13
+ signal?: ScopeSignal;
14
+ }
15
+ interface RunnerPorts {
16
+ /** `context` carries the client's current agreement when one exists. */
17
+ read(id: string, context?: ReaderRequestContext): Promise<PlanRecord>;
18
+ request(request: CanonicalRequest, context: StepContext): Promise<void>;
19
+ /** `acceptance` is the accepted execution's identity, when one exists. */
20
+ heartbeat(id: string, acceptance?: ExecutionAcceptance): Promise<void>;
21
+ /**
22
+ * @deprecated The runner never asks the host to stop or undo a plan: a
23
+ * stopped or interrupted run only stops dispatching and reads its facts.
24
+ */
25
+ stop?(id: string): Promise<PlanRecord>;
26
+ /**
27
+ * Called once when a run is interrupted by a failure, with its cause,
28
+ * before the runner reads every step again. A client submits its Stop
29
+ * intent here; legacy runs leave it unset.
30
+ */
31
+ interrupted?(id: string, cause: IntentCause): Promise<void>;
32
+ /**
33
+ * Delivers a terminal intent (Stop or Cancel) for a protected plan through
34
+ * the host's safety-control route. A client offers `plan-recovery` only
35
+ * when this is present.
36
+ */
37
+ intent?(request: IntentRequest): Promise<PlanIntentReply>;
38
+ stepUp?(planId: string, stepId: string): Promise<string | null>;
39
+ clock?: PlatformPorts["clock"];
40
+ /** Aborting it disposes the runner, as `dispose()` does. */
41
+ signal?: ScopeSignal;
42
+ heartbeatMs?: number;
43
+ onRecord?(record: PlanRecord): void;
44
+ }
45
+ interface PlanRunner {
46
+ run(id: string, confirmedDigest: string, acceptance?: ExecutionAcceptance): Promise<void>;
47
+ stop(id?: string): void;
48
+ /**
49
+ * Retires the active invocation locally: it dispatches nothing more and
50
+ * keeps no step-up code, and no remote stop or undo is requested. A later
51
+ * explicit run starts a fresh invocation.
52
+ */
53
+ interrupt?(): void;
54
+ dispose(): void;
55
+ }
56
+ /**
57
+ * Thrown by a plan port's read when the client's record gate refused the
58
+ * record; the run ends as an interruption with cause `plan-changed`.
59
+ */
60
+ declare class PlanReadRefused extends Error {
61
+ constructor();
62
+ }
63
+ declare function canTransition(from: PlanState, to: PlanState): boolean;
64
+ declare function createPlanRunner(ports: RunnerPorts): PlanRunner;
65
+
66
+ declare const SUPPORTED_PROTOCOLS: readonly ["1.1", "1.0"];
67
+ declare const CAPABILITIES: readonly ["plans", "flows", "widgets", "step-up", "scheduled", "form-fill", "plan-recovery", "plan-leave", "plan-keep", "reply-stop"];
68
+ type Capability = (typeof CAPABILITIES)[number];
69
+ /** Drops a capability whose prerequisite is not also in `chosen`. */
70
+ declare function withPrerequisites(chosen: Capability[]): Capability[];
71
+ /** What a client offers when it negotiates: the capabilities it implements. */
72
+ interface NegotiationOffer {
73
+ capabilities: readonly string[];
74
+ }
75
+ /**
76
+ * Picks the protocol and capabilities for a negotiation. A host that passes
77
+ * the client's `offer` gets only capabilities both sides support; a host that
78
+ * passes two arguments keeps the legacy server-only list and issues no
79
+ * agreement.
80
+ */
81
+ declare function negotiate(supported: readonly string[], capabilities?: readonly string[], offer?: NegotiationOffer): {
82
+ protocol: string;
83
+ capabilities: Capability[];
84
+ };
85
+ declare function blockFallback(block: {
86
+ type: string;
87
+ id?: string;
88
+ fallback: string;
89
+ }): {
90
+ text: string;
91
+ disabled: true;
92
+ update: true;
93
+ };
94
+
95
+ type MaybePromise<T> = T | Promise<T>;
96
+ type KeepDisabledReason = "loading" | "intentUnavailable" | "capabilityMissing" | "keepNoDecision" | "sealed" | "keepBlockedActive" | "keepBlockedUnknown";
97
+ interface KeepChangesReview {
98
+ review: "forward-only" | "end-retention";
99
+ remaining: number;
100
+ acknowledgment: LeaveAcknowledgment;
101
+ }
102
+ type KeepChangesReviewResult = KeepChangesReview | {
103
+ disabled: KeepDisabledReason;
104
+ };
105
+ interface StoragePort {
106
+ get(key: string): MaybePromise<string | null>;
107
+ set(key: string, value: string): MaybePromise<void>;
108
+ remove(key: string): MaybePromise<void>;
109
+ /**
110
+ * Optional atomic commit: writes `value` only if the stored value is still
111
+ * `expected` (null for absent), and reports whether it wrote. Stores shared
112
+ * by several runtimes should implement it; see `commitRecord`.
113
+ */
114
+ compareAndSet?(key: string, expected: string | null, value: string): MaybePromise<boolean>;
115
+ }
116
+ interface PlatformPorts {
117
+ clock: {
118
+ now(): number;
119
+ setTimeout(fn: () => void, ms: number): unknown;
120
+ clearTimeout(handle: unknown): void;
121
+ };
122
+ online(): boolean;
123
+ visibility(): boolean;
124
+ ids(): string;
125
+ /**
126
+ * Optional notification of connectivity changes. The client retries a failed
127
+ * startup when it reports `true`, and unsubscribes on dispose. Without it the
128
+ * client falls back to its retry timer and the `online()` boolean.
129
+ */
130
+ subscribeOnline?(listener: (online: boolean) => void): () => void;
131
+ /**
132
+ * Optional notification of visibility changes. The client retries a failed
133
+ * startup when the view becomes visible, and unsubscribes on dispose.
134
+ */
135
+ subscribeVisibility?(listener: (visible: boolean) => void): () => void;
136
+ }
137
+ /**
138
+ * The binding a client sends with each request once the host issued an
139
+ * agreement. It identifies the negotiated answer; it is never authority.
140
+ */
141
+ interface ReaderRequestContext {
142
+ agreementId: string;
143
+ }
144
+ /**
145
+ * What a host returns for a delivered reply. A first accepting confirmation
146
+ * of a protected plan also carries the private acceptance, which only the
147
+ * runner receives; public `reply` stays a boolean.
148
+ */
149
+ interface ReplyDelivery {
150
+ id: string;
151
+ acceptance?: ExecutionAcceptance;
152
+ }
153
+ interface TransportPort {
154
+ /**
155
+ * Negotiates without storing any binding: each client owns its answer, even
156
+ * when several clients share one transport.
157
+ */
158
+ negotiate(supported: readonly string[], offer?: NegotiationOffer): Promise<{
159
+ protocol: string;
160
+ capabilities: string[];
161
+ agreementId?: string;
162
+ }>;
163
+ read(conversationId: string, context?: ReaderRequestContext): Promise<Conversation>;
164
+ send(reply: Reply & {
165
+ extensions?: Record<string, unknown>;
166
+ }, conversationId: string, context?: ReaderRequestContext): Promise<ReplyDelivery>;
167
+ subscribe(conversationId: string, listener: (event: TransportEvent) => void, context?: ReaderRequestContext): () => void;
168
+ }
169
+ type TransportEvent = {
170
+ type: "status";
171
+ status: "connecting" | "open" | "reconnecting" | "unavailable";
172
+ } | {
173
+ type: "frame";
174
+ frame: Frame;
175
+ }
176
+ /** A hint that the conversation changed; it is never applied as content. */
177
+ | {
178
+ type: "invalidate";
179
+ };
180
+ type WaypointEvent = {
181
+ type: "send" | "reply";
182
+ conversationId: string;
183
+ replyId: string;
184
+ } | {
185
+ type: "plan.state";
186
+ planId: string;
187
+ } | {
188
+ type: "problem";
189
+ problemId: string;
190
+ } | {
191
+ type: "transport.status";
192
+ conversationId: string;
193
+ };
194
+ interface ComposerContribution {
195
+ id: string;
196
+ evaluate(context: {
197
+ draft: string;
198
+ conversationId: string;
199
+ }): MaybePromise<{
200
+ hold?: string;
201
+ hint?: string;
202
+ payload?: unknown;
203
+ }>;
204
+ }
205
+ interface MessageVersionInput {
206
+ conversationId: string;
207
+ messageId: string;
208
+ clientReplyId: string;
209
+ }
210
+ interface MessageVersionPort {
211
+ edit(input: MessageVersionInput & {
212
+ content: string;
213
+ }): MaybePromise<void>;
214
+ regenerate(input: MessageVersionInput): MaybePromise<void>;
215
+ select(input: MessageVersionInput & {
216
+ index: number;
217
+ }): MaybePromise<void>;
218
+ }
219
+ /** The user's rating of a reply, with the reply it rates. */
220
+ interface FeedbackInput extends MessageVersionInput {
221
+ /** Good response (`positive`) or Bad response (`negative`). */
222
+ rating: "positive" | "negative";
223
+ }
224
+ /** Where a host takes the user's rating of a reply. */
225
+ interface FeedbackPort {
226
+ /**
227
+ * Records a rating. The same rating of the same reply is not sent again
228
+ * while one is in flight, and each call has a new `clientReplyId`; a
229
+ * throw is reported as the press's problem.
230
+ */
231
+ send(input: FeedbackInput): MaybePromise<void>;
232
+ }
233
+ interface FlowSource {
234
+ load?(id: string): MaybePromise<Flow>;
235
+ list(tab: FlowTab): MaybePromise<FlowSummary[]>;
236
+ setFavourite(id: string, favourite: boolean): MaybePromise<void>;
237
+ run(id: string, values: Record<string, unknown>, document?: Flow): MaybePromise<{
238
+ conversationId: string;
239
+ plan?: PlanRecord;
240
+ }>;
241
+ }
242
+ type BuiltinFlowTab = "favourites" | "most-used" | "recent" | "presets";
243
+ type FlowTab = BuiltinFlowTab | {
244
+ id: string;
245
+ labelKey: string;
246
+ };
247
+ declare const DEFAULT_FLOW_TABS: readonly BuiltinFlowTab[];
248
+ declare function flowTabId(tab: FlowTab): string;
249
+ interface FlowSummary {
250
+ id: string;
251
+ title: string;
252
+ favourite?: boolean;
253
+ runCount?: number;
254
+ lastRunAt?: number;
255
+ }
256
+ interface PendingSend {
257
+ id: string;
258
+ content: string;
259
+ failure: Problem | null;
260
+ extensions?: Record<string, unknown>;
261
+ }
262
+ type ReplyState = "none" | "writing" | "unavailable" | "failed" | "overdue";
263
+ interface ClientSnapshot {
264
+ protocol: string | null;
265
+ replyState: ReplyState;
266
+ conversationId: string;
267
+ conversation: Conversation | null;
268
+ conversationUnavailable: boolean;
269
+ draft: string;
270
+ pending: readonly PendingSend[];
271
+ problem: Problem | null;
272
+ announcement: number;
273
+ observerFailures: number;
274
+ capabilities: readonly Capability[];
275
+ status: string;
276
+ plan: PlanRecord | null;
277
+ flows: Partial<Record<string, FlowSummary[]>>;
278
+ flowTab: string;
279
+ flowTabs: readonly FlowTab[];
280
+ hints: readonly string[];
281
+ sending: boolean;
282
+ /** The stream gave up after its bounded reopen attempts; `refresh()` retries. */
283
+ streamUnavailable: boolean;
284
+ /**
285
+ * The latest confirmation attempt that was not accepted: its token and its
286
+ * reply id. The current problem is that attempt's refusal only when its
287
+ * id is this reply id.
288
+ */
289
+ confirmationRefusal?: {
290
+ token: string;
291
+ problemId: string;
292
+ };
293
+ /** Queued messages whose withdrawal is waiting for its commit. */
294
+ withdrawing: readonly string[];
295
+ /**
296
+ * The reads the host asked for since the user's last message, in order,
297
+ * each running, done or failed.
298
+ */
299
+ toolSteps: readonly ToolStep[];
300
+ /** Withdrawn messages, kept apart from the draft until discarded. */
301
+ restored: readonly RestoredMessage[];
302
+ /** Pending terminal intents of protected plans, by plan id. */
303
+ intentOverlays: Readonly<Record<string, IntentOverlay>>;
304
+ /** The facts of the last resolved intent, as its reply gave them. */
305
+ intentNotice: IntentNotice | null;
306
+ intentAlert: IntentAlert | null;
307
+ /**
308
+ * The shown plan is protected but this client cannot control it now (a
309
+ * profile, phase or agreement it lacks, or a fresh read still due after
310
+ * a new agreement): it is shown, and nothing can be done with it here.
311
+ */
312
+ planReadOnly?: boolean;
313
+ }
314
+ /** A read the host asked for while writing a reply, as the user sees it. */
315
+ interface ToolStep {
316
+ id: string;
317
+ /** The host's plain words for it (`ToolCall.label`), when it gave any. */
318
+ label?: string;
319
+ status: "running" | "done" | "failed";
320
+ }
321
+ interface RestoredMessage {
322
+ id: string;
323
+ content: string;
324
+ }
325
+ interface ReadPorts {
326
+ manifest: readonly ManifestEntry[];
327
+ request(call: ToolCall): Promise<unknown>;
328
+ planning?: {
329
+ template(planId: string, stepId: string): MaybePromise<ReadTemplate | null>;
330
+ request(template: ReadTemplate): Promise<{
331
+ rows: Record<string, unknown>;
332
+ versions: Record<string, string>;
333
+ }>;
334
+ };
335
+ }
336
+ interface ClientConfig {
337
+ formSession?: FormSession;
338
+ reads?: ReadPorts;
339
+ versions?: MessageVersionPort;
340
+ feedback?: FeedbackPort;
341
+ plans?: RunnerPorts & {
342
+ resume?(id: string): Promise<PlanRecord>;
343
+ retryUndo?(id: string): Promise<PlanRecord>;
344
+ };
345
+ accountId: string;
346
+ conversationId: string;
347
+ platform: PlatformPorts;
348
+ transport: TransportPort;
349
+ storage?: StoragePort;
350
+ beforeSend?: (reply: Reply) => MaybePromise<Reply | false | void>;
351
+ contributions?: readonly ComposerContribution[];
352
+ flowSource?: FlowSource;
353
+ flowOperations?: readonly string[];
354
+ tabs?: readonly FlowTab[];
355
+ }
356
+ type ReplyInput = Reply extends infer R ? R extends {
357
+ protocol: string;
358
+ } ? Omit<R, "protocol"> & {
359
+ protocol?: string;
360
+ } : never : never;
361
+ /** How a reply ended: accepted, or not, and why when something was sent. */
362
+ type ReplyOutcome = {
363
+ accepted: true;
364
+ } | {
365
+ accepted: false;
366
+ problem?: Problem;
367
+ };
368
+ declare class ConversationReadError extends Error {
369
+ readonly conversationId: string;
370
+ readonly status: number;
371
+ /** A validated typed problem from the response, without any raw body. */
372
+ readonly problem?: Problem;
373
+ constructor(conversationId: string, status: number, problem?: unknown);
374
+ }
375
+ type ConversationReadResult = {
376
+ kind: "loaded";
377
+ conversationId: string;
378
+ conversation: Conversation;
379
+ } | {
380
+ kind: "missing";
381
+ conversationId: string;
382
+ status: 404 | 410;
383
+ } | {
384
+ kind: "unavailable" | "superseded";
385
+ conversationId: string;
386
+ };
387
+ interface WaypointClient {
388
+ ready: Promise<void>;
389
+ getSnapshot(): ClientSnapshot;
390
+ subscribe(listener: () => void): () => void;
391
+ on(listener: (event: WaypointEvent) => void): () => void;
392
+ setDraft(value: string): Promise<void>;
393
+ editMessage(messageId: string, content: string): Promise<void>;
394
+ regenerate(messageId: string): Promise<void>;
395
+ selectVersion(messageId: string, index: number): Promise<void>;
396
+ /** Whether a `versions` port can edit, regenerate and select versions. */
397
+ canChangeVersions(): boolean;
398
+ /** Whether a `feedback` port takes ratings of replies. */
399
+ canSendFeedback(): boolean;
400
+ /**
401
+ * Rates a finished reply through the `feedback` port, once per rating
402
+ * while it is in flight, and resolves with whether the port took it.
403
+ */
404
+ sendFeedback(messageId: string, rating: FeedbackInput["rating"]): Promise<boolean>;
405
+ send(): Promise<void>;
406
+ retry(id: string): Promise<void>;
407
+ withdraw(id: string): Promise<void>;
408
+ /** Appends a withdrawn message's content to the draft; the item stays. */
409
+ editRestored(id: string): Promise<void>;
410
+ /** Deletes a withdrawn message. */
411
+ discardRestored(id: string): Promise<void>;
412
+ dismiss(id: string): Promise<void>;
413
+ reply(reply: ReplyInput): Promise<boolean>;
414
+ /**
415
+ * Sends a reply and says how it ended: accepted, or not, with the problem
416
+ * the host or the network gave (none when nothing was sent). Resolves
417
+ * after the conversation was read again, so a card shows what the host
418
+ * holds.
419
+ */
420
+ replyOutcome(reply: ReplyInput): Promise<ReplyOutcome>;
421
+ refresh(): Promise<ConversationReadResult>;
422
+ switchConversation(id: string): Promise<ConversationReadResult>;
423
+ report(problem: Problem): void;
424
+ setPlan(plan: PlanRecord): void;
425
+ confirmPlan(): Promise<void>;
426
+ runPlan(id: string, confirmedDigest: string): Promise<void>;
427
+ stopPlan(id?: string): void;
428
+ /**
429
+ * Declines a protected plan's initial review: an initial Cancel through
430
+ * the intent port, never the normal replies route.
431
+ */
432
+ declinePlan(): Promise<void>;
433
+ /**
434
+ * Leaves a protected plan's decision: a Leave through the intent port,
435
+ * acknowledging the evidence and versions of the adopted record.
436
+ */
437
+ leavePlan(id?: string): Promise<void>;
438
+ /**
439
+ * Redelivers a protected plan's pending intent exactly as it was first
440
+ * built (status and Retry are one action): the host returns the stored
441
+ * outcome if it applied, or applies it once.
442
+ */
443
+ checkIntentStatus(id?: string): Promise<void>;
444
+ /** The same action as `checkIntentStatus`, named for Leave. */
445
+ checkSavedChoice(id?: string): Promise<void>;
446
+ /** The same action as `checkIntentStatus`, named for Keep. */
447
+ checkKeepStatus(id?: string): Promise<void>;
448
+ retryIntent(id?: string): Promise<void>;
449
+ /**
450
+ * What "Keep these changes" would confirm for a protected plan, read
451
+ * synchronously from the adopted record, or why it is not possible.
452
+ */
453
+ keepChangesReview(id?: string): KeepChangesReviewResult;
454
+ canKeepChanges(id?: string): boolean;
455
+ /** Sends exactly the Keep a review returned by `keepChangesReview`. */
456
+ keepChanges(review: KeepChangesReviewResult): Promise<void>;
457
+ resumePlan(): Promise<void>;
458
+ retryUndo(): Promise<void>;
459
+ /** Reads the plan's record from the host again and shows it. */
460
+ readPlan(id?: string): Promise<void>;
461
+ loadFlows(): Promise<void>;
462
+ selectFlowTab(tab: FlowTab): void;
463
+ setFavourite(id: string, favourite: boolean): Promise<void>;
464
+ /**
465
+ * Runs a flow; resolves with the conversation this run opened when its
466
+ * own navigation succeeded and is still shown, otherwise with nothing.
467
+ */
468
+ runFlow(id: string, values: Record<string, unknown>): Promise<string | void>;
469
+ /** Whether `prepareFlow` can read a flow's document (the source has `load`). */
470
+ canPrepareFlow(): boolean;
471
+ /** Whether the reply being written can be stopped (`reply-stop`). */
472
+ canStopReply(): boolean;
473
+ /**
474
+ * Stops the reply being written: its text so far stays, marked
475
+ * `stopped` at once, and the host is asked once to stop writing it. Text
476
+ * that still arrives for it is dropped. Does nothing without `reply-stop`.
477
+ */
478
+ stopReply(): Promise<void>;
479
+ /**
480
+ * Waits again for an overdue reply: the reply row says `writing` and
481
+ * turns overdue again only after another 15 seconds without progress.
482
+ */
483
+ keepWaiting(): void;
484
+ /**
485
+ * Waits again and reads the conversation again (`refresh()`). A failed
486
+ * reply is asked for again instead (`regenerate`) when a `versions` port
487
+ * is given: a new version, with the failed one kept. A reply the host
488
+ * ended as `failed` or `unavailable` is only ever asked for again: without
489
+ * a `versions` port a read would show it unchanged, so this does nothing
490
+ * (see `canRetryReply()`).
491
+ */
492
+ retryReply(): Promise<void>;
493
+ /**
494
+ * Whether `retryReply()` can do anything for the reply row's state: false
495
+ * only for a reply the host ended as `failed` or `unavailable` when no
496
+ * `versions` port is given.
497
+ */
498
+ canRetryReply(): boolean;
499
+ /**
500
+ * Loads and validates a flow's document, to ask for its parameters, and
501
+ * keeps it for the next `runFlow` of that flow in this conversation (a
502
+ * failed run keeps it for a retry); without an id, forgets it. Resolves
503
+ * with nothing when the source cannot load documents or without an id
504
+ * (also when the client actions' code cannot load, which reports the
505
+ * retryable `on-demand-load` problem). Rejects with what `load` or the
506
+ * document's validation threw, and with `{ code: "refused", id:
507
+ * "flow-prepare" }` when the conversation changed or a later
508
+ * preparation (or forgetting) superseded this one: nothing is kept then.
509
+ */
510
+ prepareFlow(id?: string): Promise<Flow | void>;
511
+ dispose(): void;
512
+ }
513
+ declare function createMemoryStorage(asynchronous?: boolean): StoragePort;
514
+ declare function createWaypointClient(config: ClientConfig): WaypointClient;
515
+ declare function asProblem(error: unknown, id: string): Problem;
516
+ /** A failed read's problem: a host's whole-second wait makes it a rate limit. */
517
+ declare function readProblem(error: unknown, id: string): Problem;
518
+ /**
519
+ * The plan's confirmation record, when it is bound to this plan, this
520
+ * conversation and the plan's host revision. A record without a whole
521
+ * revision is never a match; a legacy plan record has no revision of its
522
+ * own to compare, so its host refuses a stale token.
523
+ */
524
+ declare function confirmationOf(plan: PlanRecord | null | undefined, conversationId: string | undefined): ConfirmationRecord | undefined;
525
+ declare function replyRow(input: {
526
+ messages: readonly Message[];
527
+ pending: readonly PendingSend[];
528
+ now: number;
529
+ askedAt?: number;
530
+ overdueAt?: number;
531
+ heldUntil?: number;
532
+ unavailable?: boolean;
533
+ failed?: boolean;
534
+ /** The stream that would carry the rest of the reply gave up. */
535
+ streamLost?: boolean;
536
+ /**
537
+ * When the reply being written last made progress, on the caller's clock.
538
+ * Without it the stall is not measured: the reply stays `writing`.
539
+ */
540
+ activityAt?: number;
541
+ }): ReplyState;
542
+ declare function versionWalk(message: {
543
+ versionIndex?: number | null;
544
+ versionCount?: number | null;
545
+ }): {
546
+ index: number;
547
+ count: number;
548
+ previous: number | null;
549
+ next: number | null;
550
+ } | null;
551
+ interface AttachmentPort {
552
+ upload(data: Uint8Array, context: {
553
+ conversationId: string;
554
+ fileName: string;
555
+ contentType: string;
556
+ }): MaybePromise<{
557
+ id: string;
558
+ }>;
559
+ remove(id: string): MaybePromise<void>;
560
+ }
561
+
562
+ interface FormField {
563
+ name: string;
564
+ label: string;
565
+ tier: "low" | "sensitive" | "human-only";
566
+ value: unknown;
567
+ }
568
+ interface FormDraft {
569
+ label: string;
570
+ value: unknown;
571
+ revision: number;
572
+ edited: boolean;
573
+ validation?: FormValidation;
574
+ replacement?: {
575
+ value: unknown;
576
+ validation: FormValidation;
577
+ revision: number;
578
+ /** The fill that suggested it. */
579
+ fill?: string;
580
+ };
581
+ /**
582
+ * The user's entry does not parse as the field's type yet (`localText`
583
+ * holds it); `value` is still the last valid one. A host's own submit
584
+ * should refuse while it is set.
585
+ */
586
+ localInvalid?: true;
587
+ localText?: string;
588
+ }
589
+ interface FormSnapshot {
590
+ pending: boolean;
591
+ fields: Readonly<Record<string, FormDraft>>;
592
+ /** Applied fills that still own at least one field, oldest first. */
593
+ fills?: readonly {
594
+ id: string;
595
+ fields: readonly string[];
596
+ }[];
597
+ }
598
+ interface FormSession {
599
+ getSnapshot(): FormSnapshot;
600
+ subscribe(listener: () => void): () => void;
601
+ begin(material: FormMaterial): FormFillRequest;
602
+ receive(body: unknown): boolean;
603
+ edit(field: string, value: unknown): void;
604
+ replace(field: string, revision: number): boolean;
605
+ cancelReplacement(field: string): void;
606
+ /** Records an entry that does not parse yet: an edit that keeps `value`. */
607
+ markEdited(field: string, text: string): void;
608
+ /**
609
+ * Takes back a fill: each field it still owns gets its value and
610
+ * validation from before the fill, and its suggestions are withdrawn.
611
+ * Refused while a request is pending.
612
+ */
613
+ revert(fill: string): boolean;
614
+ /** Ends the pending request when its draft cannot be used. */
615
+ failRequest(requestId: string): void;
616
+ cancel(): void;
617
+ dispose(): void;
618
+ }
619
+ interface FormMaterial {
620
+ text: string;
621
+ references?: string[];
622
+ attachments?: string[];
623
+ field?: string;
624
+ }
625
+ interface ConversationSource {
626
+ list(subjectKey?: string): MaybePromise<ConversationSummary[]>;
627
+ create(input: CreateConversation): MaybePromise<Conversation>;
628
+ }
629
+ interface ConversationSummary {
630
+ id: string;
631
+ title: string;
632
+ mode?: "form-fill";
633
+ subject?: FormSubject;
634
+ parentConversationId?: string;
635
+ field?: string;
636
+ }
637
+ interface FormSessionConfig {
638
+ fields: readonly FormField[];
639
+ ids(): string;
640
+ }
641
+ /** The problem a failed load of the form session code rejects with. */
642
+ declare const FORM_SESSION_UNAVAILABLE: {
643
+ readonly code: "retryable";
644
+ readonly id: "form-session-load";
645
+ };
646
+ /**
647
+ * Creates a form session. Its code is loaded on first use, outside the core
648
+ * bundle. If loading fails the promise rejects with
649
+ * `FORM_SESSION_UNAVAILABLE`, nothing is kept, and calling again retries.
650
+ */
651
+ declare function loadFormSession(config: FormSessionConfig): Promise<FormSession>;
652
+
653
+ export { createMemoryStorage as $, type AttachmentPort as A, type BuiltinFlowTab as B, type ClientConfig as C, DEFAULT_FLOW_TABS as D, type MessageVersionPort as E, type FormSessionConfig as F, PlanReadRefused as G, type PlanRunner as H, type PlatformPorts as I, type ReaderRequestContext as J, type KeepChangesReview as K, type ReplyOutcome as L, type MaybePromise as M, type NegotiationOffer as N, type RestoredMessage as O, type PendingSend as P, type RunnerPorts as Q, type ReplyInput as R, type StepContext as S, type StoragePort as T, type ToolStep as U, type TransportEvent as V, type WaypointClient as W, type TransportPort as X, asProblem as Y, canTransition as Z, confirmationOf as _, type FormSession as a, createPlanRunner as a0, createWaypointClient as a1, flowTabId as a2, loadFormSession as a3, readProblem as a4, replyRow as a5, versionWalk as a6, SUPPORTED_PROTOCOLS as a7, blockFallback as a8, negotiate as a9, withPrerequisites as aa, type ClientSnapshot as b, type WaypointEvent as c, type ConversationReadResult as d, type ReplyDelivery as e, type ReadPorts as f, type ReplyState as g, CAPABILITIES as h, type Capability as i, type ComposerContribution as j, ConversationReadError as k, type ConversationSource as l, type ConversationSummary as m, FORM_SESSION_UNAVAILABLE as n, type FeedbackInput as o, type FeedbackPort as p, type FlowSource as q, type FlowSummary as r, type FlowTab as s, type FormDraft as t, type FormField as u, type FormMaterial as v, type FormSnapshot as w, type KeepChangesReviewResult as x, type KeepDisabledReason as y, type MessageVersionInput as z };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLLPGVQUTcjs = require('./chunk-LLPGVQUT.cjs');require('./chunk-II26UWZM.cjs');exports.createFormSession = _chunkLLPGVQUTcjs.a;
@@ -0,0 +1,7 @@
1
+ import { F as FormSessionConfig, a as FormSession } from './form-fill-C32AHxSr.cjs';
2
+ import './generated-C9tbjwK0.cjs';
3
+ import './intent-BQPPows1.cjs';
4
+
5
+ declare function createFormSession(config: FormSessionConfig): FormSession;
6
+
7
+ export { createFormSession };
@@ -0,0 +1,7 @@
1
+ import { F as FormSessionConfig, a as FormSession } from './form-fill-Dp3ut1_Y.js';
2
+ import './generated-C9tbjwK0.js';
3
+ import './intent-BuvqEU3Q.js';
4
+
5
+ declare function createFormSession(config: FormSessionConfig): FormSession;
6
+
7
+ export { createFormSession };
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-TCFCSGQ3.js";import"./chunk-5TBO732O.js";export{a as createFormSession};
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-II26UWZM.cjs');async function*f(l,o){let r="",a=[],i=n=>{if(!n.trim())return null;let e=JSON.parse(n);if(typeof e!="object"||e===null||typeof e.protocol!="string"||!Number.isInteger(e.sequence)||typeof e.type!="string")throw new Error("Invalid frame");return e};for await(let n of l){r+=n;let e;for(;(e=r.indexOf(`
2
+ `))>=0;){let s=r.slice(0,e).replace(/\r$/,"");if(r=r.slice(e+1),o==="ndjson"){let t=i(s);t&&(yield t)}else if(s===""){let t=i(a.join(`
3
+ `));a=[],t&&(yield t)}else s.startsWith("data:")&&a.push(s.slice(5).replace(/^ /,""))}}if(o==="ndjson"){let n=i(r);n&&(yield n)}}exports.decodeFrames = f;
@@ -0,0 +1,5 @@
1
+ import { F as Frame } from './generated-C9tbjwK0.cjs';
2
+
3
+ declare function decodeFrames(chunks: AsyncIterable<string>, format: "sse" | "ndjson"): AsyncGenerator<Frame>;
4
+
5
+ export { decodeFrames };