@possibl/rcrt-sdk 0.1.2 → 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.
- package/CHANGELOG.md +23 -73
- package/LICENSE +21 -0
- package/README.md +3 -20
- package/dist/auth.d.ts +45 -0
- package/dist/auth.d.ts.map +1 -0
- package/{src/auth.ts → dist/auth.js} +9 -24
- package/dist/auth.js.map +1 -0
- package/dist/authn.d.ts +84 -0
- package/dist/authn.d.ts.map +1 -0
- package/dist/authn.js +75 -0
- package/dist/authn.js.map +1 -0
- package/dist/breadcrumbs.d.ts +32 -0
- package/dist/breadcrumbs.d.ts.map +1 -0
- package/dist/breadcrumbs.js +96 -0
- package/dist/breadcrumbs.js.map +1 -0
- package/dist/cards.d.ts +28 -0
- package/dist/cards.d.ts.map +1 -0
- package/dist/cards.js +106 -0
- package/dist/cards.js.map +1 -0
- package/dist/chat.d.ts +50 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +58 -0
- package/dist/chat.js.map +1 -0
- package/dist/client.d.ts +45 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +69 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +32 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +76 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/conformance.d.ts +48 -0
- package/dist/generated/conformance.d.ts.map +1 -0
- package/dist/generated/conformance.js +24 -0
- package/dist/generated/conformance.js.map +1 -0
- package/dist/generated/index.d.ts +34 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +34 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/openapi.d.ts +3900 -0
- package/dist/generated/openapi.d.ts.map +1 -0
- package/dist/generated/openapi.js +6 -0
- package/dist/generated/openapi.js.map +1 -0
- package/dist/grants.d.ts +41 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +50 -0
- package/dist/grants.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/fetch.d.ts +41 -0
- package/dist/internal/fetch.d.ts.map +1 -0
- package/dist/internal/fetch.js +106 -0
- package/dist/internal/fetch.js.map +1 -0
- package/dist/internal/sse.d.ts +82 -0
- package/dist/internal/sse.d.ts.map +1 -0
- package/dist/internal/sse.js +161 -0
- package/dist/internal/sse.js.map +1 -0
- package/dist/types/breadcrumb.d.ts +70 -0
- package/dist/types/breadcrumb.d.ts.map +1 -0
- package/dist/types/breadcrumb.js +8 -0
- package/dist/types/breadcrumb.js.map +1 -0
- package/dist/types/card.d.ts +251 -0
- package/dist/types/card.d.ts.map +1 -0
- package/dist/types/card.js +10 -0
- package/dist/types/card.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/{src/types/index.ts → dist/types/index.js} +1 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +35 -6
- package/src/authn.ts +0 -159
- package/src/breadcrumbs.ts +0 -111
- package/src/capabilities.ts +0 -93
- package/src/cards.ts +0 -109
- package/src/chat.ts +0 -83
- package/src/client.ts +0 -97
- package/src/errors.ts +0 -101
- package/src/files.ts +0 -135
- package/src/grants.ts +0 -99
- package/src/index.ts +0 -103
- package/src/internal/fetch.ts +0 -133
- package/src/internal/sse.ts +0 -236
- package/src/sessions.ts +0 -110
- package/src/types/breadcrumb.ts +0 -77
- package/src/types/card.ts +0 -298
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSE client with automatic reconnection + typed event dispatch.
|
|
3
|
+
*
|
|
4
|
+
* Works in three environments:
|
|
5
|
+
* - Browsers: uses the built-in `EventSource`. Auth goes via query
|
|
6
|
+
* params because `EventSource` can't set custom headers.
|
|
7
|
+
* - Node 18+: uses the built-in `EventSource` (Node 22+) or a
|
|
8
|
+
* pluggable polyfill (see `config.eventSource`).
|
|
9
|
+
* - React Native: install `react-native-sse` and pass its
|
|
10
|
+
* constructor as `config.eventSource`. Custom headers work there.
|
|
11
|
+
*
|
|
12
|
+
* Subscribers get typed events. Streams auto-reconnect with
|
|
13
|
+
* exponential backoff unless `close()` was called explicitly.
|
|
14
|
+
*/
|
|
15
|
+
export function connect(config, handlers) {
|
|
16
|
+
const maxBackoff = config.maxBackoffMs ?? 30_000;
|
|
17
|
+
let backoff = 1_000;
|
|
18
|
+
let closed = false;
|
|
19
|
+
let es = null;
|
|
20
|
+
let state = 'connecting';
|
|
21
|
+
let reconnectTimer = null;
|
|
22
|
+
async function open() {
|
|
23
|
+
if (closed)
|
|
24
|
+
return;
|
|
25
|
+
const token = await config.getToken();
|
|
26
|
+
const u = new URL(config.apiUrl.replace(/\/$/, '') + config.path);
|
|
27
|
+
if (config.query) {
|
|
28
|
+
for (const [k, v] of Object.entries(config.query)) {
|
|
29
|
+
u.searchParams.set(k, v);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const EventSourceCtor = (config.eventSource
|
|
33
|
+
?? globalThis.EventSource);
|
|
34
|
+
if (!EventSourceCtor) {
|
|
35
|
+
handlers.onError?.({ message: 'No EventSource implementation available. Pass config.eventSource for React Native.', fatal: true }, true);
|
|
36
|
+
closed = true;
|
|
37
|
+
state = 'closed';
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// Prefer header auth when the EventSource impl supports it (React
|
|
41
|
+
// Native with `react-native-sse`, Node 22+, any custom
|
|
42
|
+
// `config.eventSource` that accepts a `headers` init). The browser's
|
|
43
|
+
// built-in EventSource constructor has NO support for custom
|
|
44
|
+
// headers — there's no proposal in the WHATWG spec to change that —
|
|
45
|
+
// so when we're stuck with it we fall back to passing the bearer
|
|
46
|
+
// token and tenant ID as query params.
|
|
47
|
+
//
|
|
48
|
+
// Security note (Sonar hotspot review): tokens in URLs are a
|
|
49
|
+
// documented smell — they can leak via proxy logs, HTTP Referer
|
|
50
|
+
// headers, and browser history. We mitigate:
|
|
51
|
+
// * TLS is assumed (RCRT's api-gateway rejects plaintext HTTP).
|
|
52
|
+
// * Firebase ID tokens are short-lived (60 min) and auto-rotated.
|
|
53
|
+
// A leaked token in a server log expires fast; it can't be used
|
|
54
|
+
// to escalate outside the scope Firebase already granted.
|
|
55
|
+
// * `tk_*` workspace API keys are long-lived and should NEVER be
|
|
56
|
+
// passed through this path. Callers holding a tk_ key are
|
|
57
|
+
// server-side and must set `useHeaderAuth: true`. The SDK docs
|
|
58
|
+
// and the TokenProvider interface make this explicit.
|
|
59
|
+
// * This fallback only triggers for SSE subscriptions. The regular
|
|
60
|
+
// fetch-based surface (`src/internal/fetch.ts`) always uses the
|
|
61
|
+
// Authorization header.
|
|
62
|
+
// Without this fallback the SDK cannot open SSE connections from a
|
|
63
|
+
// browser at all, which would break every chat UI built on RCRT.
|
|
64
|
+
const init = {};
|
|
65
|
+
if (config.useHeaderAuth) {
|
|
66
|
+
init.headers = {
|
|
67
|
+
Authorization: `Bearer ${token}`,
|
|
68
|
+
...(config.tenantId ? { 'X-Tenant-ID': config.tenantId } : {}),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
u.searchParams.set('token', token); // NOSONAR - required for browser EventSource; see block comment above
|
|
73
|
+
if (config.tenantId)
|
|
74
|
+
u.searchParams.set('tenant_id', config.tenantId);
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
es = new EventSourceCtor(u.toString(), init);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
handlers.onError?.({ message: err.message, fatal: true }, true);
|
|
81
|
+
scheduleReconnect();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
es.onopen = () => {
|
|
85
|
+
backoff = 1_000;
|
|
86
|
+
state = 'open';
|
|
87
|
+
handlers.onOpen?.();
|
|
88
|
+
};
|
|
89
|
+
es.addEventListener('connected', (e) => {
|
|
90
|
+
const data = tryJson(e.data);
|
|
91
|
+
handlers.onConnected?.(data);
|
|
92
|
+
});
|
|
93
|
+
es.addEventListener('delta', (e) => {
|
|
94
|
+
const data = tryJson(e.data);
|
|
95
|
+
if (data)
|
|
96
|
+
handlers.onDelta?.(data);
|
|
97
|
+
});
|
|
98
|
+
es.addEventListener('message', (e) => {
|
|
99
|
+
const data = tryJson(e.data);
|
|
100
|
+
if (data)
|
|
101
|
+
handlers.onMessage?.(data);
|
|
102
|
+
});
|
|
103
|
+
es.addEventListener('thought', (e) => {
|
|
104
|
+
const data = tryJson(e.data);
|
|
105
|
+
if (data)
|
|
106
|
+
handlers.onThought?.(data);
|
|
107
|
+
});
|
|
108
|
+
es.addEventListener('action', (e) => {
|
|
109
|
+
const data = tryJson(e.data);
|
|
110
|
+
if (data)
|
|
111
|
+
handlers.onAction?.(data);
|
|
112
|
+
});
|
|
113
|
+
es.addEventListener('error', (e) => {
|
|
114
|
+
const data = tryJson(e?.data ?? '');
|
|
115
|
+
handlers.onError?.(data ?? { message: 'stream error' }, false);
|
|
116
|
+
});
|
|
117
|
+
es.onerror = () => {
|
|
118
|
+
state = 'closed';
|
|
119
|
+
handlers.onClose?.();
|
|
120
|
+
es?.close();
|
|
121
|
+
es = null;
|
|
122
|
+
scheduleReconnect();
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function scheduleReconnect() {
|
|
126
|
+
if (closed)
|
|
127
|
+
return;
|
|
128
|
+
state = 'connecting';
|
|
129
|
+
const delay = backoff + Math.floor(Math.random() * 500);
|
|
130
|
+
backoff = Math.min(maxBackoff, backoff * 2);
|
|
131
|
+
reconnectTimer = setTimeout(() => {
|
|
132
|
+
reconnectTimer = null;
|
|
133
|
+
void open();
|
|
134
|
+
}, delay);
|
|
135
|
+
}
|
|
136
|
+
void open();
|
|
137
|
+
return {
|
|
138
|
+
close() {
|
|
139
|
+
closed = true;
|
|
140
|
+
state = 'closed';
|
|
141
|
+
if (reconnectTimer)
|
|
142
|
+
clearTimeout(reconnectTimer);
|
|
143
|
+
es?.close();
|
|
144
|
+
es = null;
|
|
145
|
+
},
|
|
146
|
+
get state() {
|
|
147
|
+
return state;
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function tryJson(raw) {
|
|
152
|
+
if (typeof raw !== 'string' || !raw)
|
|
153
|
+
return undefined;
|
|
154
|
+
try {
|
|
155
|
+
return JSON.parse(raw);
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=sse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.js","sourceRoot":"","sources":["../../src/internal/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwEH,MAAM,UAAU,OAAO,CAAC,MAAwB,EAAE,QAAqB;IACrE,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC;IACjD,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,EAAE,GAA2B,IAAI,CAAC;IACtC,IAAI,KAAK,GAAqC,YAAY,CAAC;IAC3D,IAAI,cAAc,GAAyC,IAAI,CAAC;IAEhE,KAAK,UAAU,IAAI;QACjB,IAAI,MAAM;YAAE,OAAO;QAEnB,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAClE,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClD,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,CA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AAU,CAAC,GAAG,EAAE;YAC/B,cAAc,GAAG,IAAI,CAAC;YACtB,KAAK,IAAI,EAAE,CAAC;QACd,CAAC,EAAE,KAAK,CAAC,CAAC;IACZ,CAAC;IAED,KAAK,IAAI,EAAE,CAAC;IAEZ,OAAO;QACL,KAAK;YACH,MAAM,GAAG,IAAI,CAAC;YACd,KAAK,GAAG,QAAQ,CAAC;YACjB,IAAI,cAAc;gBAAE,YAAY,CAAC,cAAc,CAAC,CAAC;YACjD,EAAE,EAAE,KAAK,EAAE,CAAC;YACZ,EAAE,GAAG,IAAI,CAAC;QACZ,CAAC;QACD,IAAI,KAAK;YACP,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAc,GAAY;IACxC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IACtD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAM,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breadcrumb — the fundamental record of RCRT.
|
|
3
|
+
*
|
|
4
|
+
* Every meaningful state change in the system is a breadcrumb. See
|
|
5
|
+
* `packages/docs/concepts/02-primitives.md` for the mental model.
|
|
6
|
+
*/
|
|
7
|
+
export type ActorType = 'user' | 'agent' | 'tool' | 'system';
|
|
8
|
+
export interface Actor {
|
|
9
|
+
type: ActorType;
|
|
10
|
+
/** For users: the user UUID. For agents: the agent id. For tools: the tool name. */
|
|
11
|
+
id: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Breadcrumb {
|
|
14
|
+
id: string;
|
|
15
|
+
tenant_id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
title: string;
|
|
18
|
+
content: Record<string, unknown>;
|
|
19
|
+
/** AND-semantics when queried. Prefix conventions: `interpret:*`, `service:*`, `session:*`, `user:*`, etc. */
|
|
20
|
+
tags: string[];
|
|
21
|
+
/** Breadcrumbs this derived from (SAPL provenance chain). */
|
|
22
|
+
parent_ids: string[];
|
|
23
|
+
/** Optimistic locking. PATCH must include the current value. */
|
|
24
|
+
version: number;
|
|
25
|
+
created_by: Actor;
|
|
26
|
+
created_at: string;
|
|
27
|
+
updated_at: string;
|
|
28
|
+
deleted_at: string | null;
|
|
29
|
+
/** Optional embedding for semantic search. */
|
|
30
|
+
embedding?: number[];
|
|
31
|
+
/** Relative TTL — e.g. "24h", "30d". */
|
|
32
|
+
ttl?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface CreateBreadcrumbRequest {
|
|
35
|
+
name?: string;
|
|
36
|
+
title: string;
|
|
37
|
+
content: Record<string, unknown>;
|
|
38
|
+
tags?: string[];
|
|
39
|
+
parent_ids?: string[];
|
|
40
|
+
created_by?: Actor;
|
|
41
|
+
ttl?: string;
|
|
42
|
+
/** If a breadcrumb with the same name + tags exists, update it rather than inserting a new row. */
|
|
43
|
+
upsert?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface UpdateBreadcrumbRequest {
|
|
46
|
+
/** Required. Optimistic locking fails with 409 Conflict otherwise. */
|
|
47
|
+
version: number;
|
|
48
|
+
title?: string;
|
|
49
|
+
content?: Record<string, unknown>;
|
|
50
|
+
tags?: string[];
|
|
51
|
+
parent_ids?: string[];
|
|
52
|
+
ttl?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface BreadcrumbResponse {
|
|
55
|
+
breadcrumb: Breadcrumb;
|
|
56
|
+
action?: 'created' | 'updated';
|
|
57
|
+
}
|
|
58
|
+
export interface QueryByTagsOptions {
|
|
59
|
+
/** Max rows to return. Server max is 200. */
|
|
60
|
+
limit?: number;
|
|
61
|
+
offset?: number;
|
|
62
|
+
/** Exact name match. */
|
|
63
|
+
name?: string;
|
|
64
|
+
order?: 'newest' | 'oldest';
|
|
65
|
+
}
|
|
66
|
+
export interface SemanticSearchOptions {
|
|
67
|
+
limit?: number;
|
|
68
|
+
tags?: string[];
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=breadcrumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/types/breadcrumb.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,8GAA8G;IAC9G,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,6DAA6D;IAC7D,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,KAAK,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mGAAmG;IACnG,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","sourceRoot":"","sources":["../../src/types/breadcrumb.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,251 @@
|
|
|
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
|
+
export type CardLayout = 'claim' | 'list-feed' | 'timeline' | 'stat' | 'chart' | 'compare' | 'draft' | 'decision' | 'rating' | 'input' | 'progress' | 'receipt' | 'connect' | 'info';
|
|
10
|
+
export type ActionStyle = 'primary' | 'secondary' | 'ghost' | 'destructive';
|
|
11
|
+
export interface CardAction {
|
|
12
|
+
/**
|
|
13
|
+
* PATCHed as `content.status` when the user taps. Canonical values:
|
|
14
|
+
* `approved` / `rejected` / `dismissed` / `edited`. Custom ids are
|
|
15
|
+
* allowed and land in `content.user_response.status`.
|
|
16
|
+
*/
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
style?: ActionStyle;
|
|
20
|
+
emoji?: string;
|
|
21
|
+
/** Explicit result; default when absent is `{status: id}`. */
|
|
22
|
+
result?: {
|
|
23
|
+
status: string;
|
|
24
|
+
user_response?: unknown;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface CardHeader {
|
|
28
|
+
title: string;
|
|
29
|
+
emoji?: string;
|
|
30
|
+
/** Lucide icon name. Fallback when emoji isn't set. */
|
|
31
|
+
icon?: string;
|
|
32
|
+
subtitle?: string;
|
|
33
|
+
/** Drives chart palette and home-feed placement. e.g. `health`, `finance`. */
|
|
34
|
+
domain_tag?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CardFooter {
|
|
37
|
+
actions?: CardAction[];
|
|
38
|
+
dismissable?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export type TrendDirection = 'up' | 'down' | 'flat';
|
|
41
|
+
export type ChartSpec = {
|
|
42
|
+
kind: 'spark';
|
|
43
|
+
points: number[];
|
|
44
|
+
trend?: TrendDirection;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'line';
|
|
47
|
+
series: Array<{
|
|
48
|
+
label?: string;
|
|
49
|
+
points: Array<[string, number]>;
|
|
50
|
+
}>;
|
|
51
|
+
y_target?: number;
|
|
52
|
+
y_unit?: string;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'bar';
|
|
55
|
+
bars: Array<{
|
|
56
|
+
label: string;
|
|
57
|
+
value: number;
|
|
58
|
+
highlight?: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
orientation?: 'h' | 'v';
|
|
61
|
+
y_unit?: string;
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'area';
|
|
64
|
+
points: Array<[string, number]>;
|
|
65
|
+
y_target?: number;
|
|
66
|
+
y_unit?: string;
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'ring';
|
|
69
|
+
value: number;
|
|
70
|
+
max: number;
|
|
71
|
+
label?: string;
|
|
72
|
+
value_label?: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'heatmap';
|
|
75
|
+
cells: number[][];
|
|
76
|
+
x_labels?: string[];
|
|
77
|
+
y_labels?: string[];
|
|
78
|
+
} | {
|
|
79
|
+
kind: 'histogram';
|
|
80
|
+
buckets: Array<{
|
|
81
|
+
label: string;
|
|
82
|
+
count: number;
|
|
83
|
+
}>;
|
|
84
|
+
};
|
|
85
|
+
export interface TextRow {
|
|
86
|
+
kind: 'text';
|
|
87
|
+
text: string;
|
|
88
|
+
badge?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Flexible text row shape. Agents frequently reach for natural field
|
|
92
|
+
* names like `{label, detail, meta}` when listing email-ish items.
|
|
93
|
+
* Renderers should accept either shape; this SDK re-exports the
|
|
94
|
+
* strict `TextRow` as the canonical type and the loose shape as a
|
|
95
|
+
* helper for consumers writing their own renderers.
|
|
96
|
+
*/
|
|
97
|
+
export interface FlexibleTextRow {
|
|
98
|
+
kind?: 'text';
|
|
99
|
+
text?: string;
|
|
100
|
+
label?: string;
|
|
101
|
+
title?: string;
|
|
102
|
+
name?: string;
|
|
103
|
+
detail?: string;
|
|
104
|
+
subtitle?: string;
|
|
105
|
+
snippet?: string;
|
|
106
|
+
description?: string;
|
|
107
|
+
meta?: string;
|
|
108
|
+
badge?: string;
|
|
109
|
+
when?: string;
|
|
110
|
+
value?: string | number;
|
|
111
|
+
}
|
|
112
|
+
export interface ClaimRow {
|
|
113
|
+
kind: 'claim';
|
|
114
|
+
claim: string;
|
|
115
|
+
confidence?: 'low' | 'med' | 'high';
|
|
116
|
+
/** Longer context shown when the user expands a "why" drawer. */
|
|
117
|
+
why?: string;
|
|
118
|
+
/** Breadcrumb id the claim derives from. */
|
|
119
|
+
source_ref?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface MetricRow {
|
|
122
|
+
kind: 'metric';
|
|
123
|
+
label: string;
|
|
124
|
+
/** Formatted display value — "6h 45m", "$1,420", "42%". */
|
|
125
|
+
value: string;
|
|
126
|
+
trend?: TrendDirection;
|
|
127
|
+
target?: string;
|
|
128
|
+
spark?: ChartSpec;
|
|
129
|
+
}
|
|
130
|
+
export interface EventRow {
|
|
131
|
+
kind: 'event';
|
|
132
|
+
title: string;
|
|
133
|
+
starts_at: string;
|
|
134
|
+
duration_min?: number;
|
|
135
|
+
location?: string;
|
|
136
|
+
who?: string[];
|
|
137
|
+
emoji?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface PersonRow {
|
|
140
|
+
kind: 'person';
|
|
141
|
+
name: string;
|
|
142
|
+
avatar_hint?: string;
|
|
143
|
+
relationship?: string;
|
|
144
|
+
last_touch?: string;
|
|
145
|
+
spark?: ChartSpec;
|
|
146
|
+
quick_actions?: CardAction[];
|
|
147
|
+
}
|
|
148
|
+
export interface PlaceRow {
|
|
149
|
+
kind: 'place';
|
|
150
|
+
label: string;
|
|
151
|
+
address?: string;
|
|
152
|
+
lat_lng?: [number, number];
|
|
153
|
+
}
|
|
154
|
+
export interface ToggleRow {
|
|
155
|
+
kind: 'toggle';
|
|
156
|
+
label: string;
|
|
157
|
+
enabled: boolean;
|
|
158
|
+
action_id: string;
|
|
159
|
+
}
|
|
160
|
+
export interface DraftPreviewRow {
|
|
161
|
+
kind: 'draft-preview';
|
|
162
|
+
lines: string[];
|
|
163
|
+
body?: string;
|
|
164
|
+
}
|
|
165
|
+
export interface ChartRow {
|
|
166
|
+
kind: 'chart';
|
|
167
|
+
chart: ChartSpec;
|
|
168
|
+
caption?: string;
|
|
169
|
+
}
|
|
170
|
+
export type Row = TextRow | ClaimRow | MetricRow | EventRow | PersonRow | PlaceRow | ToggleRow | DraftPreviewRow | ChartRow;
|
|
171
|
+
export interface DraftPreview {
|
|
172
|
+
kind: 'email' | 'calendar-event' | 'message' | 'ritual' | 'task' | 'custom';
|
|
173
|
+
subject?: string;
|
|
174
|
+
to?: string[];
|
|
175
|
+
from?: string;
|
|
176
|
+
starts_at?: string;
|
|
177
|
+
duration_min?: number;
|
|
178
|
+
location?: string;
|
|
179
|
+
body: string;
|
|
180
|
+
}
|
|
181
|
+
export type InputSpec = {
|
|
182
|
+
id: string;
|
|
183
|
+
label: string;
|
|
184
|
+
placeholder?: string;
|
|
185
|
+
kind?: 'text' | 'textarea' | 'email' | 'url' | 'number' | 'time' | 'date';
|
|
186
|
+
default_value?: string;
|
|
187
|
+
};
|
|
188
|
+
export type RatingSpec = {
|
|
189
|
+
kind: 'scale';
|
|
190
|
+
min: number;
|
|
191
|
+
max: number;
|
|
192
|
+
step?: number;
|
|
193
|
+
label?: string;
|
|
194
|
+
} | {
|
|
195
|
+
kind: 'emoji';
|
|
196
|
+
options: Array<{
|
|
197
|
+
id: string;
|
|
198
|
+
emoji: string;
|
|
199
|
+
label: string;
|
|
200
|
+
}>;
|
|
201
|
+
};
|
|
202
|
+
export interface ProgressState {
|
|
203
|
+
/** 0..1, or `null` for indeterminate. */
|
|
204
|
+
pct?: number | null;
|
|
205
|
+
step?: string;
|
|
206
|
+
}
|
|
207
|
+
export interface ConnectDetails {
|
|
208
|
+
service_id: string;
|
|
209
|
+
scope_description?: string;
|
|
210
|
+
account_label?: string;
|
|
211
|
+
ask_label?: boolean;
|
|
212
|
+
}
|
|
213
|
+
export interface CompareColumn {
|
|
214
|
+
title: string;
|
|
215
|
+
subtitle?: string;
|
|
216
|
+
rows: Row[];
|
|
217
|
+
action_id?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface CardBody {
|
|
220
|
+
text?: string;
|
|
221
|
+
rows?: Row[];
|
|
222
|
+
metrics?: MetricRow[];
|
|
223
|
+
chart?: ChartSpec;
|
|
224
|
+
draft?: DraftPreview;
|
|
225
|
+
inputs?: InputSpec[];
|
|
226
|
+
rating?: RatingSpec;
|
|
227
|
+
progress?: ProgressState;
|
|
228
|
+
connect?: ConnectDetails;
|
|
229
|
+
columns?: CompareColumn[];
|
|
230
|
+
}
|
|
231
|
+
export interface Card {
|
|
232
|
+
layout: CardLayout;
|
|
233
|
+
header: CardHeader;
|
|
234
|
+
body?: CardBody;
|
|
235
|
+
footer?: CardFooter;
|
|
236
|
+
/** Default `chat`. `home` → goes on the Awaiting-you feed. */
|
|
237
|
+
target?: 'chat' | 'home' | 'both';
|
|
238
|
+
entity_refs?: string[];
|
|
239
|
+
/**
|
|
240
|
+
* Optional explicit dedupe key. Without one, the server applies an
|
|
241
|
+
* implicit `(layout, service_id, title)` key for `connect` cards
|
|
242
|
+
* and `(layout, title)` otherwise.
|
|
243
|
+
*/
|
|
244
|
+
dedupe_key?: string;
|
|
245
|
+
}
|
|
246
|
+
export type CanonicalStatus = 'pending' | 'approved' | 'rejected' | 'dismissed' | 'edited';
|
|
247
|
+
export interface ResolveRequest {
|
|
248
|
+
status: CanonicalStatus | string;
|
|
249
|
+
user_response?: unknown;
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/types/card.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,WAAW,GACX,UAAU,GACV,MAAM,GACN,OAAO,GACP,SAAS,GACT,OAAO,GACP,UAAU,GACV,QAAQ,GACR,OAAO,GACP,UAAU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EAAE,CAAC;IACb,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE3F,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../src/types/card.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@possibl/rcrt-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "TypeScript SDK for the RCRT multi-tenant AI BaaS — isomorphic (web + node + React Native)",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"//": "In-repo consumers (tests, dashboard) see raw src/*.ts via `main`/`exports`. publishConfig overrides these at publish time to point at compiled dist/ so npm installs are clean JS + .d.ts.",
|
|
6
7
|
"main": "./src/index.ts",
|
|
7
8
|
"types": "./src/index.ts",
|
|
8
9
|
"exports": {
|
|
@@ -13,12 +14,36 @@
|
|
|
13
14
|
"./types": {
|
|
14
15
|
"types": "./src/types/index.ts",
|
|
15
16
|
"default": "./src/types/index.ts"
|
|
17
|
+
},
|
|
18
|
+
"./generated": {
|
|
19
|
+
"types": "./src/generated/index.ts",
|
|
20
|
+
"default": "./src/generated/index.ts"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./types": {
|
|
33
|
+
"types": "./dist/types/index.d.ts",
|
|
34
|
+
"default": "./dist/types/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./generated": {
|
|
37
|
+
"types": "./dist/generated/index.d.ts",
|
|
38
|
+
"default": "./dist/generated/index.js"
|
|
39
|
+
}
|
|
16
40
|
}
|
|
17
41
|
},
|
|
18
42
|
"files": [
|
|
19
|
-
"
|
|
43
|
+
"dist",
|
|
20
44
|
"README.md",
|
|
21
|
-
"CHANGELOG.md"
|
|
45
|
+
"CHANGELOG.md",
|
|
46
|
+
"LICENSE"
|
|
22
47
|
],
|
|
23
48
|
"keywords": [
|
|
24
49
|
"rcrt",
|
|
@@ -33,7 +58,7 @@
|
|
|
33
58
|
"license": "MIT",
|
|
34
59
|
"repository": {
|
|
35
60
|
"type": "git",
|
|
36
|
-
"url": "
|
|
61
|
+
"url": "https://github.com/possibl-ai/rcrt-v2",
|
|
37
62
|
"directory": "packages/rcrt-sdk"
|
|
38
63
|
},
|
|
39
64
|
"homepage": "https://github.com/possibl-ai/rcrt-v2/tree/development/packages/docs",
|
|
@@ -43,11 +68,15 @@
|
|
|
43
68
|
},
|
|
44
69
|
"scripts": {
|
|
45
70
|
"type-check": "tsc --noEmit && tsc --noEmit -p tsconfig.tests.json",
|
|
46
|
-
"build": "tsc",
|
|
47
|
-
"test": "tsx --test tests/*.test.ts"
|
|
71
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
72
|
+
"test": "tsx --test tests/*.test.ts",
|
|
73
|
+
"codegen": "openapi-typescript ../docs/openapi/v1.yaml -o ./src/generated/openapi.ts",
|
|
74
|
+
"codegen:check": "openapi-typescript ../docs/openapi/v1.yaml -o /tmp/rcrt-openapi-check.ts && diff -q ./src/generated/openapi.ts /tmp/rcrt-openapi-check.ts",
|
|
75
|
+
"prepack": "pnpm run build"
|
|
48
76
|
},
|
|
49
77
|
"devDependencies": {
|
|
50
78
|
"@types/node": "^20.0.0",
|
|
79
|
+
"openapi-typescript": "^7.13.0",
|
|
51
80
|
"tsx": "^4.19.2",
|
|
52
81
|
"typescript": "~5.6.0"
|
|
53
82
|
}
|