@possibl/rcrt-sdk 0.1.1 → 0.1.3

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 (87) hide show
  1. package/CHANGELOG.md +23 -67
  2. package/LICENSE +21 -0
  3. package/README.md +2 -20
  4. package/dist/auth.d.ts +45 -0
  5. package/dist/auth.d.ts.map +1 -0
  6. package/{src/auth.ts → dist/auth.js} +9 -24
  7. package/dist/auth.js.map +1 -0
  8. package/dist/authn.d.ts +84 -0
  9. package/dist/authn.d.ts.map +1 -0
  10. package/dist/authn.js +75 -0
  11. package/dist/authn.js.map +1 -0
  12. package/dist/breadcrumbs.d.ts +32 -0
  13. package/dist/breadcrumbs.d.ts.map +1 -0
  14. package/dist/breadcrumbs.js +96 -0
  15. package/dist/breadcrumbs.js.map +1 -0
  16. package/dist/cards.d.ts +28 -0
  17. package/dist/cards.d.ts.map +1 -0
  18. package/dist/cards.js +106 -0
  19. package/dist/cards.js.map +1 -0
  20. package/dist/chat.d.ts +50 -0
  21. package/dist/chat.d.ts.map +1 -0
  22. package/dist/chat.js +58 -0
  23. package/dist/chat.js.map +1 -0
  24. package/dist/client.d.ts +45 -0
  25. package/dist/client.d.ts.map +1 -0
  26. package/dist/client.js +69 -0
  27. package/dist/client.js.map +1 -0
  28. package/dist/errors.d.ts +32 -0
  29. package/dist/errors.d.ts.map +1 -0
  30. package/dist/errors.js +76 -0
  31. package/dist/errors.js.map +1 -0
  32. package/dist/generated/conformance.d.ts +48 -0
  33. package/dist/generated/conformance.d.ts.map +1 -0
  34. package/dist/generated/conformance.js +24 -0
  35. package/dist/generated/conformance.js.map +1 -0
  36. package/dist/generated/index.d.ts +34 -0
  37. package/dist/generated/index.d.ts.map +1 -0
  38. package/dist/generated/index.js +34 -0
  39. package/dist/generated/index.js.map +1 -0
  40. package/dist/generated/openapi.d.ts +3900 -0
  41. package/dist/generated/openapi.d.ts.map +1 -0
  42. package/dist/generated/openapi.js +6 -0
  43. package/dist/generated/openapi.js.map +1 -0
  44. package/dist/grants.d.ts +41 -0
  45. package/dist/grants.d.ts.map +1 -0
  46. package/dist/grants.js +50 -0
  47. package/dist/grants.js.map +1 -0
  48. package/dist/index.d.ts +23 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +18 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/internal/fetch.d.ts +41 -0
  53. package/dist/internal/fetch.d.ts.map +1 -0
  54. package/dist/internal/fetch.js +106 -0
  55. package/dist/internal/fetch.js.map +1 -0
  56. package/dist/internal/sse.d.ts +82 -0
  57. package/dist/internal/sse.d.ts.map +1 -0
  58. package/dist/internal/sse.js +161 -0
  59. package/dist/internal/sse.js.map +1 -0
  60. package/dist/types/breadcrumb.d.ts +70 -0
  61. package/dist/types/breadcrumb.d.ts.map +1 -0
  62. package/dist/types/breadcrumb.js +8 -0
  63. package/dist/types/breadcrumb.js.map +1 -0
  64. package/dist/types/card.d.ts +251 -0
  65. package/dist/types/card.d.ts.map +1 -0
  66. package/dist/types/card.js +10 -0
  67. package/dist/types/card.js.map +1 -0
  68. package/dist/types/index.d.ts +3 -0
  69. package/dist/types/index.d.ts.map +1 -0
  70. package/{src/types/index.ts → dist/types/index.js} +1 -0
  71. package/dist/types/index.js.map +1 -0
  72. package/package.json +35 -6
  73. package/src/authn.ts +0 -159
  74. package/src/breadcrumbs.ts +0 -111
  75. package/src/capabilities.ts +0 -93
  76. package/src/cards.ts +0 -109
  77. package/src/chat.ts +0 -83
  78. package/src/client.ts +0 -97
  79. package/src/errors.ts +0 -101
  80. package/src/files.ts +0 -135
  81. package/src/grants.ts +0 -99
  82. package/src/index.ts +0 -103
  83. package/src/internal/fetch.ts +0 -133
  84. package/src/internal/sse.ts +0 -236
  85. package/src/sessions.ts +0 -110
  86. package/src/types/breadcrumb.ts +0 -77
  87. package/src/types/card.ts +0 -298
package/src/types/card.ts DELETED
@@ -1,298 +0,0 @@
1
- /**
2
- * JIT UI Card contract.
3
- *
4
- * The universal structure every pending-action breadcrumb carries in
5
- * `content.card`. Mirrors the OpenAPI schemas under
6
- * `#/components/schemas/Card*`. See
7
- * `packages/docs/concepts/05-jit-ui.md` for the mental model.
8
- */
9
-
10
- export type CardLayout =
11
- | 'claim'
12
- | 'list-feed'
13
- | 'timeline'
14
- | 'stat'
15
- | 'chart'
16
- | 'compare'
17
- | 'draft'
18
- | 'decision'
19
- | 'rating'
20
- | 'input'
21
- | 'progress'
22
- | 'receipt'
23
- | 'connect'
24
- | 'info';
25
-
26
- export type ActionStyle = 'primary' | 'secondary' | 'ghost' | 'destructive';
27
-
28
- export interface CardAction {
29
- /**
30
- * PATCHed as `content.status` when the user taps. Canonical values:
31
- * `approved` / `rejected` / `dismissed` / `edited`. Custom ids are
32
- * allowed and land in `content.user_response.status`.
33
- */
34
- id: string;
35
- label: string;
36
- style?: ActionStyle;
37
- emoji?: string;
38
- /** Explicit result; default when absent is `{status: id}`. */
39
- result?: { status: string; user_response?: unknown };
40
- }
41
-
42
- export interface CardHeader {
43
- title: string;
44
- emoji?: string;
45
- /** Lucide icon name. Fallback when emoji isn't set. */
46
- icon?: string;
47
- subtitle?: string;
48
- /** Drives chart palette and home-feed placement. e.g. `health`, `finance`. */
49
- domain_tag?: string;
50
- }
51
-
52
- export interface CardFooter {
53
- actions?: CardAction[];
54
- dismissable?: boolean;
55
- }
56
-
57
- // ── Chart kinds ──────────────────────────────────────────────────
58
-
59
- export type TrendDirection = 'up' | 'down' | 'flat';
60
-
61
- export type ChartSpec =
62
- | {
63
- kind: 'spark';
64
- points: number[];
65
- trend?: TrendDirection;
66
- }
67
- | {
68
- kind: 'line';
69
- series: Array<{
70
- label?: string;
71
- points: Array<[string, number]>;
72
- }>;
73
- y_target?: number;
74
- y_unit?: string;
75
- }
76
- | {
77
- kind: 'bar';
78
- bars: Array<{ label: string; value: number; highlight?: boolean }>;
79
- orientation?: 'h' | 'v';
80
- y_unit?: string;
81
- }
82
- | {
83
- kind: 'area';
84
- points: Array<[string, number]>;
85
- y_target?: number;
86
- y_unit?: string;
87
- }
88
- | {
89
- kind: 'ring';
90
- value: number;
91
- max: number;
92
- label?: string;
93
- value_label?: string;
94
- }
95
- | {
96
- kind: 'heatmap';
97
- cells: number[][];
98
- x_labels?: string[];
99
- y_labels?: string[];
100
- }
101
- | {
102
- kind: 'histogram';
103
- buckets: Array<{ label: string; count: number }>;
104
- };
105
-
106
- // ── Rows (used by list-feed, timeline, decision, compare, claim) ──
107
-
108
- export interface TextRow {
109
- kind: 'text';
110
- text: string;
111
- badge?: string;
112
- }
113
-
114
- /**
115
- * Flexible text row shape. Agents frequently reach for natural field
116
- * names like `{label, detail, meta}` when listing email-ish items.
117
- * Renderers should accept either shape; this SDK re-exports the
118
- * strict `TextRow` as the canonical type and the loose shape as a
119
- * helper for consumers writing their own renderers.
120
- */
121
- export interface FlexibleTextRow {
122
- kind?: 'text';
123
- text?: string;
124
- label?: string;
125
- title?: string;
126
- name?: string;
127
- detail?: string;
128
- subtitle?: string;
129
- snippet?: string;
130
- description?: string;
131
- meta?: string;
132
- badge?: string;
133
- when?: string;
134
- value?: string | number;
135
- }
136
-
137
- export interface ClaimRow {
138
- kind: 'claim';
139
- claim: string;
140
- confidence?: 'low' | 'med' | 'high';
141
- /** Longer context shown when the user expands a "why" drawer. */
142
- why?: string;
143
- /** Breadcrumb id the claim derives from. */
144
- source_ref?: string;
145
- }
146
-
147
- export interface MetricRow {
148
- kind: 'metric';
149
- label: string;
150
- /** Formatted display value — "6h 45m", "$1,420", "42%". */
151
- value: string;
152
- trend?: TrendDirection;
153
- target?: string;
154
- spark?: ChartSpec;
155
- }
156
-
157
- export interface EventRow {
158
- kind: 'event';
159
- title: string;
160
- starts_at: string;
161
- duration_min?: number;
162
- location?: string;
163
- who?: string[];
164
- emoji?: string;
165
- }
166
-
167
- export interface PersonRow {
168
- kind: 'person';
169
- name: string;
170
- avatar_hint?: string;
171
- relationship?: string;
172
- last_touch?: string;
173
- spark?: ChartSpec;
174
- quick_actions?: CardAction[];
175
- }
176
-
177
- export interface PlaceRow {
178
- kind: 'place';
179
- label: string;
180
- address?: string;
181
- lat_lng?: [number, number];
182
- }
183
-
184
- export interface ToggleRow {
185
- kind: 'toggle';
186
- label: string;
187
- enabled: boolean;
188
- action_id: string;
189
- }
190
-
191
- export interface DraftPreviewRow {
192
- kind: 'draft-preview';
193
- lines: string[];
194
- body?: string;
195
- }
196
-
197
- export interface ChartRow {
198
- kind: 'chart';
199
- chart: ChartSpec;
200
- caption?: string;
201
- }
202
-
203
- export type Row =
204
- | TextRow
205
- | ClaimRow
206
- | MetricRow
207
- | EventRow
208
- | PersonRow
209
- | PlaceRow
210
- | ToggleRow
211
- | DraftPreviewRow
212
- | ChartRow;
213
-
214
- // ── Layout-specific body helpers ────────────────────────────────
215
-
216
- export interface DraftPreview {
217
- kind: 'email' | 'calendar-event' | 'message' | 'ritual' | 'task' | 'custom';
218
- subject?: string;
219
- to?: string[];
220
- from?: string;
221
- starts_at?: string;
222
- duration_min?: number;
223
- location?: string;
224
- body: string;
225
- }
226
-
227
- export type InputSpec = {
228
- id: string;
229
- label: string;
230
- placeholder?: string;
231
- kind?: 'text' | 'textarea' | 'email' | 'url' | 'number' | 'time' | 'date';
232
- default_value?: string;
233
- };
234
-
235
- export type RatingSpec =
236
- | { kind: 'scale'; min: number; max: number; step?: number; label?: string }
237
- | {
238
- kind: 'emoji';
239
- options: Array<{ id: string; emoji: string; label: string }>;
240
- };
241
-
242
- export interface ProgressState {
243
- /** 0..1, or `null` for indeterminate. */
244
- pct?: number | null;
245
- step?: string;
246
- }
247
-
248
- export interface ConnectDetails {
249
- service_id: string;
250
- scope_description?: string;
251
- account_label?: string;
252
- ask_label?: boolean;
253
- }
254
-
255
- export interface CompareColumn {
256
- title: string;
257
- subtitle?: string;
258
- rows: Row[];
259
- action_id?: string;
260
- }
261
-
262
- export interface CardBody {
263
- text?: string;
264
- rows?: Row[];
265
- metrics?: MetricRow[];
266
- chart?: ChartSpec;
267
- draft?: DraftPreview;
268
- inputs?: InputSpec[];
269
- rating?: RatingSpec;
270
- progress?: ProgressState;
271
- connect?: ConnectDetails;
272
- columns?: CompareColumn[];
273
- }
274
-
275
- export interface Card {
276
- layout: CardLayout;
277
- header: CardHeader;
278
- body?: CardBody;
279
- footer?: CardFooter;
280
- /** Default `chat`. `home` → goes on the Awaiting-you feed. */
281
- target?: 'chat' | 'home' | 'both';
282
- entity_refs?: string[];
283
- /**
284
- * Optional explicit dedupe key. Without one, the server applies an
285
- * implicit `(layout, service_id, title)` key for `connect` cards
286
- * and `(layout, title)` otherwise.
287
- */
288
- dedupe_key?: string;
289
- }
290
-
291
- // ── Resolution ───────────────────────────────────────────────────
292
-
293
- export type CanonicalStatus = 'pending' | 'approved' | 'rejected' | 'dismissed' | 'edited';
294
-
295
- export interface ResolveRequest {
296
- status: CanonicalStatus | string;
297
- user_response?: unknown;
298
- }