@apteva/web-sdk 0.6.0 → 0.8.0
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 +18 -0
- package/README.md +128 -8
- package/dist/auth-session.d.ts +73 -0
- package/dist/auth-session.d.ts.map +1 -0
- package/dist/auth-session.js +249 -0
- package/dist/auth-session.js.map +1 -0
- package/dist/client.d.ts +10 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +84 -14
- package/dist/client.js.map +1 -1
- package/dist/components.d.ts +2 -1
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +2 -1
- package/dist/components.js.map +1 -1
- package/dist/frontend.d.ts +40 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +120 -0
- package/dist/frontend.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
+
## 0.8.0
|
|
2
|
+
|
|
3
|
+
- Add unified Auth app login/signup, user lookup, session metadata, automatic
|
|
4
|
+
platform-token renewal and logout through `AptevaClient({ auth })`.
|
|
5
|
+
- Coordinate Auth refresh rotation and platform renewal, preserve rotated Auth
|
|
6
|
+
credentials during mint outages, and ignore late results after session changes.
|
|
7
|
+
- Keep app-user credentials isolated from API keys/cookies; reconnect managed
|
|
8
|
+
streams at expiry and close them on logout. Existing SDK auth mode is unchanged.
|
|
9
|
+
- Requires Auth v0.12.0 with explicit role bindings and platform policy lifetimes
|
|
10
|
+
of at most 60 seconds. Sessions are memory-only; reloads require login.
|
|
11
|
+
|
|
1
12
|
# Changelog
|
|
2
13
|
|
|
14
|
+
## 0.7.0 — 2026-09-07
|
|
15
|
+
|
|
16
|
+
- Load app-owned frontend bundles from installed apps with `client.apps.load`; no per-app npm package is required.
|
|
17
|
+
- Share authenticated scoped requests, verify asset hashes, check versions/React compatibility, and create fresh app clients and UI contexts.
|
|
18
|
+
- Reference-count scoped styles and expose cancellation and disposal.
|
|
19
|
+
- Preserve local extension/registry APIs and existing chat transports.
|
|
20
|
+
|
|
3
21
|
## 0.6.0 — 2026-09-07
|
|
4
22
|
|
|
5
23
|
- Add typed app-owned extensions through `defineAppExtension` and `client.use`.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @apteva/web-sdk
|
|
2
2
|
|
|
3
|
-
Browser SDK for calling [apteva-server](https://github.com/apteva/server). Framework-agnostic.
|
|
3
|
+
Browser SDK for calling [apteva-server](https://github.com/apteva/server). Framework-agnostic.
|
|
4
4
|
|
|
5
5
|
- **Auth transport** — session cookies, private API keys, and opaque application-user access tokens. The SDK does not depend on a particular token issuer.
|
|
6
6
|
- **App data** — `client.app("crm").get("/contacts")` reverse-proxies through `/api/apps/<name>/*`.
|
|
@@ -39,6 +39,58 @@ const { leads } = await apteva.app("flexylead").tool<{ leads: Lead[] }>(
|
|
|
39
39
|
);
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
## Load an installed app without its npm package
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import * as React from "react";
|
|
46
|
+
import { AptevaClient } from "@apteva/web-sdk";
|
|
47
|
+
|
|
48
|
+
const client = new AptevaClient({ baseURL, accessToken });
|
|
49
|
+
const loaded = await client.apps.load("conversations", {
|
|
50
|
+
projectId, installId, react: React,
|
|
51
|
+
});
|
|
52
|
+
const Chat = loaded.components["conversation-chat"];
|
|
53
|
+
// In JavaScript/JSX; TypeScript hosts can supply their component/client types
|
|
54
|
+
// through apps.load<ClientContract, React.ComponentType<HostProps>>(...).
|
|
55
|
+
<Chat conversations={loaded.client} agentId={agentId} />
|
|
56
|
+
// After unmounting all consumers:
|
|
57
|
+
loaded.dispose();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Only the shared SDK and the host's React are installed. The selected app serves
|
|
61
|
+
`/ui/frontend.json`, a headless client module, a UI factory and scoped styles as
|
|
62
|
+
part of its regular app release. Omit `react` for headless loading. Every load
|
|
63
|
+
creates a new client; retain it across renders and replace it when identity or
|
|
64
|
+
scope changes. `clientOptions` passes app-specific options to the client factory.
|
|
65
|
+
|
|
66
|
+
The loader requires explicit project/install selection. Asset fetches use the
|
|
67
|
+
SDK's current authentication, with no tokens in URLs, reject redirects and verify
|
|
68
|
+
SHA-256 hashes before execution. Metadata is fetched fresh; client/UI/styles download in parallel and immutable
|
|
69
|
+
asset URLs reuse the browser cache on later visits. Code caches contain
|
|
70
|
+
no credentials or app client instances. `expectedVersion` can reject unexpected
|
|
71
|
+
app upgrades. UI factories receive the host's React (major version checked), so
|
|
72
|
+
no import map or separate React copy is needed. Styles are reference counted and
|
|
73
|
+
removed by `dispose()`. Pass `signal` to cancel a pending load.
|
|
74
|
+
|
|
75
|
+
Explicit loading executes trusted installed-app code in the host page. HTTPS or
|
|
76
|
+
localhost is required for integrity checks, and CSP must permit `script-src blob:`
|
|
77
|
+
and the loader's inline styles. It does not sandbox app code or grant API access.
|
|
78
|
+
No component URLs from user messages are accepted as loader entry points.
|
|
79
|
+
|
|
80
|
+
### App frontend contract
|
|
81
|
+
|
|
82
|
+
Ship `/ui/frontend.json` with schema `apteva-app-frontend/v1`, `app`, `version`,
|
|
83
|
+
and `client: { path, sha256 }`. The optional `ui` asset also declares `reactMajor`
|
|
84
|
+
and a `components` name array; `styles` is an optional CSS asset. Paths stay under
|
|
85
|
+
`/ui/`, contain no queries or traversal, and use lowercase SHA-256 hex hashes.
|
|
86
|
+
Content-addressed filenames keep an update from mixing incompatible assets.
|
|
87
|
+
|
|
88
|
+
The client module exports `createClient({ app }, options)` and the UI module
|
|
89
|
+
exports `createFrontend({ react })`, returning `{ components }`. Each module must
|
|
90
|
+
be self-contained, without external imports, relative chunks or runtime require.
|
|
91
|
+
The UI module should instantiate its contexts inside the factory. CSS should be
|
|
92
|
+
scoped to the app. See Conversations' `frontend/build-app.ts` for the implementation.
|
|
93
|
+
|
|
42
94
|
## Authentication carriers
|
|
43
95
|
|
|
44
96
|
With no bearer credential, the SDK sends `credentials: "include"` so an
|
|
@@ -95,12 +147,11 @@ For lower-level usage, `client.callTool(appName, toolName, args)` and the standa
|
|
|
95
147
|
|
|
96
148
|
## App-owned extensions and web components
|
|
97
149
|
|
|
98
|
-
Apps can
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
and requests again.
|
|
150
|
+
Apps can serve their client and components with the normal app release through
|
|
151
|
+
`apps.load`, or supply local modules to `client.use` and the component registry.
|
|
152
|
+
The core SDK has no React dependency; a host that loads React UI supplies its own
|
|
153
|
+
React instance. Dashboard wrappers and external hosts share component source and
|
|
154
|
+
an authenticated app handle. A per-app npm package is optional.
|
|
104
155
|
|
|
105
156
|
### Typed extensions
|
|
106
157
|
|
|
@@ -433,7 +484,7 @@ and `conversationKey` atomically resumes the same conversation.
|
|
|
433
484
|
`client.delegatedUsers.create(...)` remains available for older trusted-backend
|
|
434
485
|
integrations, but is deprecated and is no longer the recommended website flow.
|
|
435
486
|
|
|
436
|
-
**Rendering note:** `ChatMessage.components[]` carries the agent's `respond(components=…)` attachments. Use `AppComponentRegistry` to resolve these references against app-owned frontend exports, then render them in your host framework.
|
|
487
|
+
**Rendering note:** `ChatMessage.components[]` carries the agent's `respond(components=…)` attachments. Use `AppComponentRegistry` to resolve these references against app-owned frontend exports, then render them in your host framework. Use `apps.load` to explicitly load a trusted installed app’s frontend before registering its components.
|
|
437
488
|
|
|
438
489
|
A complete reference chat UI (message list, composer, streaming bubbles, optimistic send) lives in [`examples/dashboard/src/components/ChatCard.tsx`](./examples/dashboard/src/components/ChatCard.tsx).
|
|
439
490
|
|
|
@@ -505,3 +556,72 @@ bun run serve
|
|
|
505
556
|
## License
|
|
506
557
|
|
|
507
558
|
MIT
|
|
559
|
+
|
|
560
|
+
## One client for Auth app sessions (v0.8.0)
|
|
561
|
+
|
|
562
|
+
With Auth app v0.12.0 or newer, configure `auth` and use the same client for
|
|
563
|
+
login, app requests, agents and logout:
|
|
564
|
+
|
|
565
|
+
```ts
|
|
566
|
+
const apteva = new AptevaClient({
|
|
567
|
+
baseURL: "https://agents.example.com",
|
|
568
|
+
projectId: "YOUR_PROJECT",
|
|
569
|
+
auth: {
|
|
570
|
+
clientId: "YOUR_PUBLIC_AUTH_CLIENT",
|
|
571
|
+
// installId: 209, // when explicit install routing is needed
|
|
572
|
+
// organizationSlug: "default",// for a multi-organization Auth client
|
|
573
|
+
// profile: "commercial", // requested role policy; checked by Auth
|
|
574
|
+
onSessionChange: session => renderUser(session?.user),
|
|
575
|
+
},
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
const user = await apteva.auth.login({ email, password });
|
|
579
|
+
await apteva.app("conversations").get("/chats");
|
|
580
|
+
await apteva.auth.logout();
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
`auth.register({ email, password, displayName? })` also supports signup. When
|
|
584
|
+
email verification is required, it returns `verification_required: true` and
|
|
585
|
+
does not establish a session. `auth.me()` reads the current Auth user;
|
|
586
|
+
`auth.getSession()` returns a local copy of user, authorization and expiry
|
|
587
|
+
metadata without credentials. `auth.status()` reports local session presence.
|
|
588
|
+
`auth.refresh()` explicitly requests a fresh platform credential when needed.
|
|
589
|
+
|
|
590
|
+
Auth owns identity and authorization. Configure its trusted role bindings and
|
|
591
|
+
matching platform policies with `token_ttl_seconds: 60` before enabling protected
|
|
592
|
+
app access. Login can succeed without app permissions; app calls then fail closed
|
|
593
|
+
until an authorized policy can mint a token. A requested profile never grants a
|
|
594
|
+
role. The SDK does not infer permissions or mint credentials itself.
|
|
595
|
+
|
|
596
|
+
The SDK privately maintains the normal Auth session plus its short-lived
|
|
597
|
+
platform token. Before an app request it renews a platform token that is within
|
|
598
|
+
ten seconds of expiry. Expired/stale Auth credentials use the normal refresh
|
|
599
|
+
flow. Concurrent operations share renewal and refresh-token rotation; no custom
|
|
600
|
+
refresh callback or application token endpoint is required. Both the returned
|
|
601
|
+
absolute expiry and remaining lifetime limit credential use. Fetch streams
|
|
602
|
+
reconnect at token expiry and close on local logout. SDK stream reconnection is
|
|
603
|
+
not server-side revocation: already-admitted work or a modified client may outlive
|
|
604
|
+
token expiry unless the receiving app enforces its own lifetime.
|
|
605
|
+
|
|
606
|
+
Sessions are kept **in memory**, not written to localStorage, sessionStorage or
|
|
607
|
+
cookies. Reuse one client per application session. Reloads/new tabs require
|
|
608
|
+
login and do not implicitly share a rotating refresh credential. Do not copy
|
|
609
|
+
refresh tokens between clients/tabs. This release deliberately does not provide
|
|
610
|
+
persistent/shared browser sessions.
|
|
611
|
+
|
|
612
|
+
`auth` mode cannot be combined with `apiKey`, `accessToken` or
|
|
613
|
+
`refreshAccessToken`; `setApiKey` and `setAccessToken` are unavailable in this
|
|
614
|
+
mode. User requests omit cookies and never fall back to a kiosk or administrator
|
|
615
|
+
credential. Platform administrator operations such as `auth.listKeys()` are
|
|
616
|
+
rejected in app Auth mode. Without `auth` configuration, existing platform
|
|
617
|
+
login and opaque-token APIs retain their original behavior.
|
|
618
|
+
|
|
619
|
+
A temporary mint failure preserves the normal Auth session and blocks protected
|
|
620
|
+
app requests. A rejected Auth refresh clears the session. Local logout clears
|
|
621
|
+
credentials and streams immediately; a failed network logout still throws so the
|
|
622
|
+
host can report that server-side revocation could not be confirmed. A late
|
|
623
|
+
renewal cannot restore a logged-out session. HTTP writes are never automatically
|
|
624
|
+
replayed after a 401; successful renewal prepares subsequent calls. Unlike legacy
|
|
625
|
+
transport mode, a successfully recovered platform 401 does not trigger the
|
|
626
|
+
`onUnauthorized` callback in managed Auth mode, although the original call still
|
|
627
|
+
rejects. Reconcile a write's outcome before retrying it.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { User } from "./types.js";
|
|
2
|
+
export interface AuthLoginInput {
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AuthSignupInput extends AuthLoginInput {
|
|
7
|
+
displayName?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AuthUser extends User {
|
|
10
|
+
id: number;
|
|
11
|
+
display_name?: string;
|
|
12
|
+
status?: string;
|
|
13
|
+
organization_id?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface AuthAuthorization {
|
|
16
|
+
roles: string[];
|
|
17
|
+
permissions: string[];
|
|
18
|
+
authorization_version: number;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface AuthSessionInfo {
|
|
22
|
+
user: AuthUser;
|
|
23
|
+
authorization?: AuthAuthorization;
|
|
24
|
+
expiresAt: string;
|
|
25
|
+
platformExpiresAt?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface AppAuthOptions {
|
|
28
|
+
/** Public Auth app OAuth client identifier; never a private client secret. */
|
|
29
|
+
clientId: string;
|
|
30
|
+
installId?: number;
|
|
31
|
+
organizationSlug?: string;
|
|
32
|
+
/** Requested Auth policy profile. Auth independently checks current roles. */
|
|
33
|
+
profile?: string;
|
|
34
|
+
/** Receives user/session metadata, never credentials. Sessions are memory-only. */
|
|
35
|
+
onSessionChange?: (session: AuthSessionInfo | undefined) => void;
|
|
36
|
+
}
|
|
37
|
+
/** Internal issuer-specific session lifecycle. AptevaClient is the public API. */
|
|
38
|
+
export declare class AuthSession {
|
|
39
|
+
private readonly baseURL;
|
|
40
|
+
private readonly projectId;
|
|
41
|
+
private readonly options;
|
|
42
|
+
private readonly fetchImpl;
|
|
43
|
+
private readonly changed;
|
|
44
|
+
private state?;
|
|
45
|
+
private epoch;
|
|
46
|
+
private pending?;
|
|
47
|
+
private pendingAuth?;
|
|
48
|
+
private controllers;
|
|
49
|
+
private listeners;
|
|
50
|
+
constructor(baseURL: string, projectId: string, options: AppAuthOptions, fetchImpl: typeof fetch, changed: (token: string | undefined) => void);
|
|
51
|
+
info(): AuthSessionInfo | undefined;
|
|
52
|
+
onClear(listener: () => void): () => void;
|
|
53
|
+
private notify;
|
|
54
|
+
clear(): void;
|
|
55
|
+
private assertEpoch;
|
|
56
|
+
private call;
|
|
57
|
+
private input;
|
|
58
|
+
private platform;
|
|
59
|
+
private accept;
|
|
60
|
+
login(input: AuthLoginInput): Promise<AuthUser>;
|
|
61
|
+
register(input: AuthSignupInput): Promise<{
|
|
62
|
+
user: AuthUser;
|
|
63
|
+
verification_required?: boolean;
|
|
64
|
+
}>;
|
|
65
|
+
logout(): Promise<void>;
|
|
66
|
+
private refreshAuth;
|
|
67
|
+
private performAuthRefresh;
|
|
68
|
+
private renew;
|
|
69
|
+
token(force?: boolean): Promise<string>;
|
|
70
|
+
me(): Promise<AuthUser>;
|
|
71
|
+
platformDeadline(): number;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=auth-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-session.d.ts","sourceRoot":"","sources":["../src/auth-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,cAAc;IAAG,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AACnE,MAAM,WAAW,eAAgB,SAAQ,cAAc;IAAG,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE;AAChF,MAAM,WAAW,QAAS,SAAQ,IAAI;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AACD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AACD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;YAGL,IAAI;IAelB,OAAO,CAAC,KAAK;IAGb,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,MAAM;IAcR,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAK/C,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAO9F,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YAKf,WAAW;YAMX,kBAAkB;YAWlB,KAAK;IAyBb,KAAK,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAcrC,EAAE,IAAI,OAAO,CAAC,QAAQ,CAAC;IAmB7B,gBAAgB,IAAI,MAAM;CAC3B"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { AptevaError } from "./errors.js";
|
|
2
|
+
const margin = 10_000;
|
|
3
|
+
/** Internal issuer-specific session lifecycle. AptevaClient is the public API. */
|
|
4
|
+
export class AuthSession {
|
|
5
|
+
baseURL;
|
|
6
|
+
projectId;
|
|
7
|
+
options;
|
|
8
|
+
fetchImpl;
|
|
9
|
+
changed;
|
|
10
|
+
state;
|
|
11
|
+
epoch = 0;
|
|
12
|
+
pending;
|
|
13
|
+
pendingAuth;
|
|
14
|
+
controllers = new Set();
|
|
15
|
+
listeners = new Set();
|
|
16
|
+
constructor(baseURL, projectId, options, fetchImpl, changed) {
|
|
17
|
+
this.baseURL = baseURL;
|
|
18
|
+
this.projectId = projectId;
|
|
19
|
+
this.options = options;
|
|
20
|
+
this.fetchImpl = fetchImpl;
|
|
21
|
+
this.changed = changed;
|
|
22
|
+
if (!projectId || !options.clientId?.trim())
|
|
23
|
+
throw new Error("Auth requires projectId and auth.clientId");
|
|
24
|
+
if (options.installId !== undefined && (!Number.isSafeInteger(options.installId) || options.installId < 1))
|
|
25
|
+
throw new Error("Invalid Auth installId");
|
|
26
|
+
}
|
|
27
|
+
info() {
|
|
28
|
+
const s = this.state;
|
|
29
|
+
return s ? structuredClone({ user: s.response.user, authorization: s.response.authorization,
|
|
30
|
+
expiresAt: new Date(s.expiresAt).toISOString(),
|
|
31
|
+
platformExpiresAt: s.platformExpiresAt ? new Date(s.platformExpiresAt).toISOString() : undefined }) : undefined;
|
|
32
|
+
}
|
|
33
|
+
onClear(listener) { this.listeners.add(listener); return () => this.listeners.delete(listener); }
|
|
34
|
+
notify() {
|
|
35
|
+
try {
|
|
36
|
+
this.options.onSessionChange?.(this.info());
|
|
37
|
+
}
|
|
38
|
+
catch { /* Observers cannot roll back credential rotation. */ }
|
|
39
|
+
}
|
|
40
|
+
clear() {
|
|
41
|
+
this.epoch++;
|
|
42
|
+
this.state = undefined;
|
|
43
|
+
this.pending = undefined;
|
|
44
|
+
this.pendingAuth = undefined;
|
|
45
|
+
for (const controller of this.controllers)
|
|
46
|
+
controller.abort();
|
|
47
|
+
this.controllers.clear();
|
|
48
|
+
this.changed(undefined);
|
|
49
|
+
for (const listener of this.listeners)
|
|
50
|
+
listener();
|
|
51
|
+
this.notify();
|
|
52
|
+
}
|
|
53
|
+
assertEpoch(epoch) {
|
|
54
|
+
if (this.epoch !== epoch)
|
|
55
|
+
throw new AptevaError(401, "Auth session changed");
|
|
56
|
+
}
|
|
57
|
+
async call(path, body, token, method = "POST") {
|
|
58
|
+
const url = new URL(this.baseURL + "/api/apps/auth" + path, globalThis.location?.origin || "http://localhost");
|
|
59
|
+
url.searchParams.set("project_id", this.projectId);
|
|
60
|
+
if (this.options.installId)
|
|
61
|
+
url.searchParams.set("install_id", String(this.options.installId));
|
|
62
|
+
if (this.options.profile)
|
|
63
|
+
url.searchParams.set("delegated_profile", this.options.profile);
|
|
64
|
+
const controller = new AbortController();
|
|
65
|
+
if (path !== "/logout")
|
|
66
|
+
this.controllers.add(controller);
|
|
67
|
+
const timer = setTimeout(() => controller.abort(), 15_000);
|
|
68
|
+
try {
|
|
69
|
+
const response = await this.fetchImpl(url.toString(), { method, credentials: "omit", cache: "no-store", redirect: "error",
|
|
70
|
+
headers: { "Content-Type": "application/json", ...(token ? { Authorization: `Bearer ${token}` } : {}) },
|
|
71
|
+
body: body === undefined ? undefined : JSON.stringify(body), signal: controller.signal });
|
|
72
|
+
if (!response.ok)
|
|
73
|
+
throw new AptevaError(response.status, path + " failed");
|
|
74
|
+
return response.status === 204 ? undefined : await response.json();
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
clearTimeout(timer);
|
|
78
|
+
this.controllers.delete(controller);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
input(body) {
|
|
82
|
+
return { ...body, client_id: this.options.clientId, organization_slug: this.options.organizationSlug };
|
|
83
|
+
}
|
|
84
|
+
platform(response) {
|
|
85
|
+
if (!response.apteva_access_token && response.apteva_expires_at === undefined && response.apteva_expires_in === undefined)
|
|
86
|
+
return { expiresAt: 0 };
|
|
87
|
+
const expiresAt = Date.parse(response.apteva_expires_at || "");
|
|
88
|
+
const seconds = response.apteva_expires_in;
|
|
89
|
+
// expires_in is measured conservatively from receipt; it also tolerates a
|
|
90
|
+
// client clock offset without ever extending a token beyond 60 seconds.
|
|
91
|
+
if (typeof response.apteva_access_token !== "string" || !response.apteva_access_token || !Number.isFinite(expiresAt) || expiresAt > Date.now() + 61_000 || typeof seconds !== "number" || !Number.isFinite(seconds) || seconds <= 0 || seconds > 60)
|
|
92
|
+
throw new AptevaError(502, "Invalid Auth platform credential expiry");
|
|
93
|
+
return { token: response.apteva_access_token, expiresAt: Math.min(expiresAt, Date.now() + seconds * 1000) };
|
|
94
|
+
}
|
|
95
|
+
accept(response, epoch, receivedAt) {
|
|
96
|
+
this.assertEpoch(epoch);
|
|
97
|
+
if (!response.user || !Number.isSafeInteger(response.user.id) || typeof response.access_token !== "string" || !response.access_token || typeof response.refresh_token !== "string" || !response.refresh_token || !Number.isFinite(response.expires_in) || response.expires_in <= 0 || response.expires_in > 86400)
|
|
98
|
+
throw new AptevaError(502, "Invalid Auth session response");
|
|
99
|
+
// Save a rotated refresh token before processing the optional platform
|
|
100
|
+
// credential, so a platform outage can never strand the Auth session.
|
|
101
|
+
this.state = { response: { ...response, apteva_access_token: undefined, apteva_expires_at: undefined, apteva_expires_in: undefined }, expiresAt: receivedAt + response.expires_in * 1000, platformExpiresAt: 0 };
|
|
102
|
+
this.changed(undefined);
|
|
103
|
+
try {
|
|
104
|
+
const platform = this.platform(response);
|
|
105
|
+
this.state.response.apteva_access_token = platform.token;
|
|
106
|
+
this.state.platformExpiresAt = platform.expiresAt;
|
|
107
|
+
this.changed(platform.token);
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
this.notify();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async login(input) {
|
|
114
|
+
this.clear();
|
|
115
|
+
const epoch = this.epoch;
|
|
116
|
+
const response = await this.call("/login", this.input(input));
|
|
117
|
+
this.accept(response, epoch, Date.now());
|
|
118
|
+
return response.user;
|
|
119
|
+
}
|
|
120
|
+
async register(input) {
|
|
121
|
+
this.clear();
|
|
122
|
+
const epoch = this.epoch;
|
|
123
|
+
const response = await this.call("/signup", this.input({ email: input.email, password: input.password, display_name: input.displayName }));
|
|
124
|
+
this.assertEpoch(epoch);
|
|
125
|
+
if (!response.verification_required)
|
|
126
|
+
this.accept(response, epoch, Date.now());
|
|
127
|
+
return { user: response.user, verification_required: response.verification_required };
|
|
128
|
+
}
|
|
129
|
+
async logout() {
|
|
130
|
+
const refresh = this.state?.response.refresh_token;
|
|
131
|
+
this.clear();
|
|
132
|
+
if (refresh)
|
|
133
|
+
await this.call("/logout", this.input({ refresh_token: refresh }));
|
|
134
|
+
}
|
|
135
|
+
async refreshAuth(epoch) {
|
|
136
|
+
if (this.pendingAuth)
|
|
137
|
+
return this.pendingAuth;
|
|
138
|
+
const pending = this.performAuthRefresh(epoch);
|
|
139
|
+
this.pendingAuth = pending;
|
|
140
|
+
try {
|
|
141
|
+
await pending;
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
if (this.pendingAuth === pending)
|
|
145
|
+
this.pendingAuth = undefined;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async performAuthRefresh(epoch) {
|
|
149
|
+
const refresh = this.state?.response.refresh_token;
|
|
150
|
+
if (!refresh)
|
|
151
|
+
throw new AptevaError(401, "Login required");
|
|
152
|
+
try {
|
|
153
|
+
const response = await this.call("/refresh", this.input({ refresh_token: refresh }));
|
|
154
|
+
this.accept(response, epoch, Date.now());
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
if (this.epoch === epoch && error instanceof AptevaError && error.status === 401)
|
|
158
|
+
this.clear();
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async renew(epoch, force) {
|
|
163
|
+
this.assertEpoch(epoch);
|
|
164
|
+
if (!this.state)
|
|
165
|
+
throw new AptevaError(401, "Login required");
|
|
166
|
+
if (this.state.expiresAt <= Date.now() + margin)
|
|
167
|
+
await this.refreshAuth(epoch);
|
|
168
|
+
this.assertEpoch(epoch);
|
|
169
|
+
if (!force && this.state.response.apteva_access_token && this.state.platformExpiresAt > Date.now() + margin)
|
|
170
|
+
return this.state.response.apteva_access_token;
|
|
171
|
+
let result;
|
|
172
|
+
try {
|
|
173
|
+
result = await this.call("/delegated-token", {}, this.state.response.access_token);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
this.assertEpoch(epoch);
|
|
177
|
+
if (!(error instanceof AptevaError) || error.status !== 401)
|
|
178
|
+
throw error;
|
|
179
|
+
// Stale Auth roles or an expired Auth access token require normal refresh.
|
|
180
|
+
await this.refreshAuth(epoch);
|
|
181
|
+
this.assertEpoch(epoch);
|
|
182
|
+
if (this.state.response.apteva_access_token && this.state.platformExpiresAt > Date.now() + margin)
|
|
183
|
+
return this.state.response.apteva_access_token;
|
|
184
|
+
result = await this.call("/delegated-token", {}, this.state.response.access_token);
|
|
185
|
+
}
|
|
186
|
+
this.assertEpoch(epoch);
|
|
187
|
+
const platform = this.platform(result);
|
|
188
|
+
if (!platform.token || platform.expiresAt <= Date.now())
|
|
189
|
+
throw new AptevaError(502, "Missing or expired platform credential");
|
|
190
|
+
this.state.response.apteva_access_token = platform.token;
|
|
191
|
+
this.state.platformExpiresAt = platform.expiresAt;
|
|
192
|
+
this.changed(platform.token);
|
|
193
|
+
this.notify();
|
|
194
|
+
return platform.token;
|
|
195
|
+
}
|
|
196
|
+
async token(force = false) {
|
|
197
|
+
if (this.pending)
|
|
198
|
+
return this.pending;
|
|
199
|
+
if (!force && this.state?.response.apteva_access_token && this.state.platformExpiresAt > Date.now() + margin)
|
|
200
|
+
return this.state.response.apteva_access_token;
|
|
201
|
+
if (this.pending)
|
|
202
|
+
return this.pending;
|
|
203
|
+
const epoch = this.epoch;
|
|
204
|
+
const pending = this.renew(epoch, force).catch(error => {
|
|
205
|
+
if (this.epoch === epoch && this.state) {
|
|
206
|
+
this.state.response.apteva_access_token = undefined;
|
|
207
|
+
this.state.platformExpiresAt = 0;
|
|
208
|
+
this.changed(undefined);
|
|
209
|
+
this.notify();
|
|
210
|
+
}
|
|
211
|
+
throw error;
|
|
212
|
+
});
|
|
213
|
+
this.pending = pending;
|
|
214
|
+
try {
|
|
215
|
+
return await pending;
|
|
216
|
+
}
|
|
217
|
+
finally {
|
|
218
|
+
if (this.pending === pending)
|
|
219
|
+
this.pending = undefined;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
async me() {
|
|
223
|
+
if (!this.state)
|
|
224
|
+
throw new AptevaError(401, "Login required");
|
|
225
|
+
const epoch = this.epoch;
|
|
226
|
+
if (this.state.expiresAt <= Date.now() + margin)
|
|
227
|
+
await this.refreshAuth(epoch);
|
|
228
|
+
this.assertEpoch(epoch);
|
|
229
|
+
let response;
|
|
230
|
+
try {
|
|
231
|
+
response = await this.call("/me", undefined, this.state.response.access_token, "GET");
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
this.assertEpoch(epoch);
|
|
235
|
+
if (!(error instanceof AptevaError) || error.status !== 401)
|
|
236
|
+
throw error;
|
|
237
|
+
await this.refreshAuth(epoch);
|
|
238
|
+
this.assertEpoch(epoch);
|
|
239
|
+
response = await this.call("/me", undefined, this.state.response.access_token, "GET");
|
|
240
|
+
}
|
|
241
|
+
this.assertEpoch(epoch);
|
|
242
|
+
this.state.response.user = response.user;
|
|
243
|
+
this.state.response.authorization = response.authorization;
|
|
244
|
+
this.notify();
|
|
245
|
+
return response.user;
|
|
246
|
+
}
|
|
247
|
+
platformDeadline() { return this.state?.platformExpiresAt || 0; }
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=auth-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-session.js","sourceRoot":"","sources":["../src/auth-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA6C1C,MAAM,MAAM,GAAG,MAAM,CAAC;AAEtB,kFAAkF;AAClF,MAAM,OAAO,WAAW;IAQH;IACA;IACA;IACA;IACA;IAXX,KAAK,CAAS;IACd,KAAK,GAAG,CAAC,CAAC;IACV,OAAO,CAAmB;IAC1B,WAAW,CAAiB;IAC5B,WAAW,GAAG,IAAI,GAAG,EAAmB,CAAC;IACzC,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;IAC1C,YACmB,OAAe,EACf,SAAiB,EACjB,OAAuB,EACvB,SAAuB,EACvB,OAA4C;QAJ5C,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAgB;QACvB,cAAS,GAAT,SAAS,CAAc;QACvB,YAAO,GAAP,OAAO,CAAqC;QAE7D,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC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,KAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAC1G,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,CAAC,KAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAAC,IAAI,CAAC,KAAM,CAAC,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC;QACvG,IAAI,CAAC,MAAM,EAAE,CAAC;QAAC,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtC,CAAC;IACD,gBAAgB,KAAa,OAAO,IAAI,CAAC,KAAK,EAAE,iBAAiB,IAAI,CAAC,CAAC,CAAC,CAAC;CAC1E"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { AuthLoginInput, AuthSignupInput } from "./auth-session.js";
|
|
2
|
+
import { type LoadAppOptions, type LoadedAppFrontend } from "./frontend.js";
|
|
1
3
|
import type { AppExtension, AppScope } from "./extensions.js";
|
|
2
4
|
import type { InstalledApp } from "./apps.js";
|
|
3
5
|
import type { Agent, AgentConfig, AgentCoreEvent, AgentCreateInput, AgentCreateResult, AgentDeleteResult, AgentPauseResult, AgentRestartResult, AgentStatus, AgentSystemMCPResult, AgentUpdateInput, AptevaClientOptions, AuthStatus, ChannelInfo, Chat, CreateChatOptions, CreateOrResumeChatOptions, ChatCreateResult, CreateDelegatedUserInput, DelegatedUserToken, ChatHistoryMessage, ChatMessage, ChatMessagesQuery, ChatSendInput, ChatSendOptions, ChatStreamOptions, MCPCallResponse, Project, StreamHandle, SubscribeOptions, SSEEventMetadata, TelemetryEvent, TelemetryPeriod, TelemetryQuery, TelemetryStats, Thread, TimelineBucket, UpdateChatOptions, User } from "./types.js";
|
|
4
6
|
export declare class AptevaClient {
|
|
5
7
|
private readonly baseURL;
|
|
6
8
|
private apiKey?;
|
|
9
|
+
private readonly appAuth?;
|
|
7
10
|
private accessToken?;
|
|
8
11
|
private readonly projectId?;
|
|
9
12
|
private readonly fetchImpl;
|
|
@@ -22,12 +25,15 @@ export declare class AptevaClient {
|
|
|
22
25
|
refreshAccessToken(): Promise<boolean>;
|
|
23
26
|
private renewAfterUnauthorized;
|
|
24
27
|
readonly auth: {
|
|
25
|
-
register: (email: string, password
|
|
28
|
+
register: (email: string | AuthSignupInput, password?: string, name?: string) => Promise<{
|
|
26
29
|
user: User;
|
|
30
|
+
verification_required?: boolean;
|
|
27
31
|
}>;
|
|
28
|
-
login: (email: string, password
|
|
32
|
+
login: (email: string | AuthLoginInput, password?: string) => Promise<User>;
|
|
29
33
|
logout: () => Promise<void>;
|
|
30
34
|
me: () => Promise<User>;
|
|
35
|
+
getSession: () => import("./auth-session.js").AuthSessionInfo | undefined;
|
|
36
|
+
refresh: () => Promise<import("./auth-session.js").AuthSessionInfo | undefined>;
|
|
31
37
|
status: () => Promise<AuthStatus>;
|
|
32
38
|
changePassword: (current: string, next: string) => Promise<void>;
|
|
33
39
|
listKeys: () => Promise<{
|
|
@@ -98,6 +104,8 @@ export declare class AptevaClient {
|
|
|
98
104
|
/** Create an extension instance. Retain it in the host; use() does not cache. */
|
|
99
105
|
use<T>(extension: AppExtension<T>, scope?: AppScope): T;
|
|
100
106
|
readonly apps: {
|
|
107
|
+
/** Load an installed app’s bundled client and optional React UI. */
|
|
108
|
+
load: <TClient = unknown, TComponent = unknown>(name: string, options: LoadAppOptions) => Promise<LoadedAppFrontend<TClient, TComponent>>;
|
|
101
109
|
/** Requires the platform's existing app-list permission. No auth bypass. */
|
|
102
110
|
list: (scope?: Pick<AppScope, "projectId">, init?: RequestInit) => Promise<InstalledApp[]>;
|
|
103
111
|
};
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAi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