@lunnoa/client 2.0.0 → 2.2.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/README.md +15 -41
- package/dist/cli.js +71 -8
- package/dist/index.cjs +24 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -35
- package/dist/index.d.ts +130 -35
- package/dist/index.js +24 -5
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +24 -5
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +86 -26
- package/dist/react.d.ts +86 -26
- package/dist/react.js +24 -5
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/skills/lunnoa-client/SKILL.md +52 -36
- package/skills/lunnoa-solution-design/SKILL.md +29 -15
package/dist/react.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { UIMessage, UIMessageChunk } from 'ai';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Pluggable storage for
|
|
6
|
+
* Pluggable storage for Lunnoa user JWTs.
|
|
7
7
|
* The SDK never uses httpOnly cookies: Automate auth is bearer JWT based.
|
|
8
8
|
*/
|
|
9
9
|
interface TokenStore {
|
|
@@ -24,20 +24,20 @@ interface LunnoaClientOptions {
|
|
|
24
24
|
*/
|
|
25
25
|
baseUrl: string;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
* the constructor throws if one is supplied while `window` exists.
|
|
27
|
+
* Machine credential (`lna_...`) for the CLI and operator scripts, not for app login.
|
|
28
|
+
* Never usable in browsers: the constructor throws if one is supplied while `window` exists.
|
|
29
29
|
*/
|
|
30
30
|
apiKey?: string;
|
|
31
31
|
/**
|
|
32
32
|
* User JWT obtained from login / SSO. The supported credential for browser
|
|
33
33
|
* applications. May be a function so refreshed tokens are picked up per request.
|
|
34
34
|
*
|
|
35
|
-
* Prefer {@link tokenStore}
|
|
35
|
+
* Prefer {@link tokenStore} so login/refresh can persist tokens
|
|
36
36
|
* and optionally auto-refresh on 401.
|
|
37
37
|
*/
|
|
38
38
|
accessToken?: string | (() => string | Promise<string>);
|
|
39
39
|
/**
|
|
40
|
-
* Optional JWT store for
|
|
40
|
+
* Optional JWT store for a signed-in Lunnoa user. When set, authenticated requests read
|
|
41
41
|
* the access token from the store. Login / refresh helpers write back into it.
|
|
42
42
|
*/
|
|
43
43
|
tokenStore?: TokenStore;
|
|
@@ -107,7 +107,10 @@ declare class HttpClient {
|
|
|
107
107
|
|
|
108
108
|
type ChatMode = 'builder' | 'preview';
|
|
109
109
|
interface StreamMessageOptions {
|
|
110
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* Agent chat mode. Defaults to `preview` (10 model rounds, a normal agent run).
|
|
112
|
+
* `builder` is the agent-editor interview and stops after 4 rounds.
|
|
113
|
+
*/
|
|
111
114
|
chatMode?: ChatMode;
|
|
112
115
|
/** Optional image attachment forwarded with this turn. */
|
|
113
116
|
data?: {
|
|
@@ -937,7 +940,7 @@ interface components {
|
|
|
937
940
|
description?: string;
|
|
938
941
|
/** @description System instructions / prompt for the agent. */
|
|
939
942
|
instructions: string;
|
|
940
|
-
/** @description
|
|
943
|
+
/** @description Catalogue model id enabled on the AI connection. Example: `deepseek-ai/DeepSeek-V4-Pro`. Discover ids with GET /api/ai-connections. */
|
|
941
944
|
model: string;
|
|
942
945
|
/** @description AiProviderConnection UUID. When omitted, platform AI defaults apply. */
|
|
943
946
|
aiConnectionId?: string;
|
|
@@ -2074,6 +2077,32 @@ interface components {
|
|
|
2074
2077
|
/** Format: date-time */
|
|
2075
2078
|
updatedAt: string;
|
|
2076
2079
|
};
|
|
2080
|
+
PublicAiModelResponseDto: {
|
|
2081
|
+
/** @description Catalogue model id passed to agent deploy as `model`. Example: `deepseek-ai/DeepSeek-V4-Pro`. */
|
|
2082
|
+
id: string;
|
|
2083
|
+
/** @description Display name. */
|
|
2084
|
+
name: string;
|
|
2085
|
+
/** @description True when this is the model used if an agent deploy omits `model` on this connection. */
|
|
2086
|
+
isDefault: boolean;
|
|
2087
|
+
/** @description Whether the model can call tools. */
|
|
2088
|
+
supportsTools: boolean;
|
|
2089
|
+
/** @description Whether the model accepts image input. */
|
|
2090
|
+
supportsVision: boolean;
|
|
2091
|
+
/** @description Whether the model exposes a reasoning mode. */
|
|
2092
|
+
supportsReasoning: boolean;
|
|
2093
|
+
};
|
|
2094
|
+
PublicAiConnectionResponseDto: {
|
|
2095
|
+
/** @description AiProviderConnection UUID. Pass as `aiConnectionId` / `defineAiConnection({ id })` when this connection is not the default. */
|
|
2096
|
+
id: string;
|
|
2097
|
+
/** @description Connection display name. Example: `Lunnoa LLMs`. */
|
|
2098
|
+
name: string;
|
|
2099
|
+
/** @description Provider slug. Example: `featherless` or `openai`. */
|
|
2100
|
+
provider: string;
|
|
2101
|
+
/** @description True for the connection used when an agent deploy omits `aiConnectionId`. */
|
|
2102
|
+
isDefault: boolean;
|
|
2103
|
+
/** @description Models this connection accepts. Inactive models are omitted. */
|
|
2104
|
+
models: components["schemas"]["PublicAiModelResponseDto"][];
|
|
2105
|
+
};
|
|
2077
2106
|
ConnectionWorkspaceDto: {
|
|
2078
2107
|
/** @description Workspace ID. */
|
|
2079
2108
|
id: string;
|
|
@@ -2682,7 +2711,10 @@ interface AgentDefinition {
|
|
|
2682
2711
|
slug: string;
|
|
2683
2712
|
name?: string;
|
|
2684
2713
|
description?: string;
|
|
2685
|
-
/**
|
|
2714
|
+
/**
|
|
2715
|
+
* Catalogue model id from `ai-connections list` (`models[].id`).
|
|
2716
|
+
* Example on Lunnoa LLMs: `deepseek-ai/DeepSeek-V4-Pro`.
|
|
2717
|
+
*/
|
|
2686
2718
|
model: string;
|
|
2687
2719
|
instructions: string;
|
|
2688
2720
|
aiConnection?: AiConnectionDefinition;
|
|
@@ -2796,7 +2828,7 @@ interface CurrentUser {
|
|
|
2796
2828
|
}
|
|
2797
2829
|
|
|
2798
2830
|
/**
|
|
2799
|
-
* Login, refresh, SSO discovery, and session helpers for
|
|
2831
|
+
* Login, refresh, SSO discovery, and session helpers for Lunnoa users.
|
|
2800
2832
|
*
|
|
2801
2833
|
* Password login, token exchange, refresh, and SSO provider listing are
|
|
2802
2834
|
* **public** endpoints (no Bearer). `me()` requires a user JWT.
|
|
@@ -2885,6 +2917,36 @@ declare class SsoAuthResource {
|
|
|
2885
2917
|
getLoginUrl(providerId: string): string;
|
|
2886
2918
|
}
|
|
2887
2919
|
|
|
2920
|
+
interface AiConnectionModel {
|
|
2921
|
+
/** Catalogue id for `defineAgent({ model })`. */
|
|
2922
|
+
id: string;
|
|
2923
|
+
name: string;
|
|
2924
|
+
isDefault: boolean;
|
|
2925
|
+
supportsTools: boolean;
|
|
2926
|
+
supportsVision: boolean;
|
|
2927
|
+
supportsReasoning: boolean;
|
|
2928
|
+
}
|
|
2929
|
+
interface AiConnection {
|
|
2930
|
+
/** AiProviderConnection UUID for `defineAiConnection({ id })`. */
|
|
2931
|
+
id: string;
|
|
2932
|
+
name: string;
|
|
2933
|
+
/** Provider slug, for example `featherless` or `openai`. */
|
|
2934
|
+
provider: string;
|
|
2935
|
+
/** True when agent deploy uses this connection if `aiConnection` is omitted. */
|
|
2936
|
+
isDefault: boolean;
|
|
2937
|
+
models: AiConnectionModel[];
|
|
2938
|
+
}
|
|
2939
|
+
declare class AiConnectionsResource {
|
|
2940
|
+
private readonly http;
|
|
2941
|
+
constructor(http: HttpClient);
|
|
2942
|
+
/**
|
|
2943
|
+
* Lists AI connections the caller can assign to an agent, with the model
|
|
2944
|
+
* ids each connection accepts. Credentials are never included.
|
|
2945
|
+
* Requires `agents:create` (the same permission as agent deploy).
|
|
2946
|
+
*/
|
|
2947
|
+
list(): Promise<AiConnection[]>;
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2888
2950
|
declare class ConnectionsResource {
|
|
2889
2951
|
private readonly http;
|
|
2890
2952
|
constructor(http: HttpClient);
|
|
@@ -3453,28 +3515,21 @@ declare class WorkflowsResource {
|
|
|
3453
3515
|
/**
|
|
3454
3516
|
* Typed client for the Lunnoa Automate Public API.
|
|
3455
3517
|
*
|
|
3456
|
-
*
|
|
3457
|
-
* ```ts
|
|
3458
|
-
* const lunnoa = new LunnoaClient({
|
|
3459
|
-
* baseUrl: 'https://lunnoa.acme.example',
|
|
3460
|
-
* apiKey: process.env.LUNNOA_API_KEY, // lna_...
|
|
3461
|
-
* });
|
|
3462
|
-
* ```
|
|
3463
|
-
*
|
|
3464
|
-
* Browser (Pattern B — the end user is a Lunnoa user):
|
|
3518
|
+
* Apps sign people in as Lunnoa users:
|
|
3465
3519
|
* ```ts
|
|
3466
3520
|
* import { createBrowserClient } from '@lunnoa/client';
|
|
3467
3521
|
* const lunnoa = createBrowserClient({ baseUrl: 'https://lunnoa.acme.example' });
|
|
3468
3522
|
* await lunnoa.auth.login({ email, password });
|
|
3469
3523
|
* ```
|
|
3470
3524
|
*
|
|
3471
|
-
*
|
|
3472
|
-
*
|
|
3525
|
+
* `apiKey` (`lna_...`) is for the CLI and operator scripts (codegen, discovery,
|
|
3526
|
+
* deploy). It is not an app login. Passing one while `window` exists throws:
|
|
3527
|
+
* a leaked key acts as that service account across its whole workspace.
|
|
3473
3528
|
*/
|
|
3474
3529
|
declare class LunnoaClient {
|
|
3475
3530
|
/** The underlying HTTP layer, exposed for advanced/escape-hatch requests. */
|
|
3476
3531
|
readonly http: HttpClient;
|
|
3477
|
-
/** Login, refresh, SSO discovery, and session helpers
|
|
3532
|
+
/** Login, refresh, SSO discovery, and session helpers for Lunnoa users. */
|
|
3478
3533
|
readonly auth: AuthResource;
|
|
3479
3534
|
readonly agents: AgentsResource;
|
|
3480
3535
|
readonly tasks: TasksResource;
|
|
@@ -3501,6 +3556,8 @@ declare class LunnoaClient {
|
|
|
3501
3556
|
readonly variables: VariablesResource;
|
|
3502
3557
|
readonly scorecards: ScorecardsResource;
|
|
3503
3558
|
readonly connections: ConnectionsResource;
|
|
3559
|
+
/** AI provider connections and the model ids each one accepts. */
|
|
3560
|
+
readonly aiConnections: AiConnectionsResource;
|
|
3504
3561
|
readonly workflowApps: WorkflowAppsResource;
|
|
3505
3562
|
readonly discovery: DiscoveryResource;
|
|
3506
3563
|
constructor(options: LunnoaClientOptions);
|
|
@@ -3525,7 +3582,7 @@ interface CreateBrowserClientOptions {
|
|
|
3525
3582
|
|
|
3526
3583
|
type AuthStatus = 'loading' | 'authenticated' | 'unauthenticated';
|
|
3527
3584
|
interface LunnoaAuthContextValue {
|
|
3528
|
-
/** Shared Lunnoa client (
|
|
3585
|
+
/** Shared Lunnoa client (user JWT token store). */
|
|
3529
3586
|
client: LunnoaClient;
|
|
3530
3587
|
/** Current user from `GET /api/users/me`, or null when signed out. */
|
|
3531
3588
|
user: CurrentUser | null;
|
|
@@ -3567,7 +3624,7 @@ interface LunnoaAuthContextValue {
|
|
|
3567
3624
|
getAccessToken: () => Promise<string | null>;
|
|
3568
3625
|
}
|
|
3569
3626
|
type LunnoaAuthProviderProps = {
|
|
3570
|
-
/** Existing
|
|
3627
|
+
/** Existing browser client (from `createBrowserClient`). */
|
|
3571
3628
|
client: LunnoaClient;
|
|
3572
3629
|
children: ReactNode;
|
|
3573
3630
|
} | (CreateBrowserClientOptions & {
|
|
@@ -3575,7 +3632,7 @@ type LunnoaAuthProviderProps = {
|
|
|
3575
3632
|
children: ReactNode;
|
|
3576
3633
|
});
|
|
3577
3634
|
/**
|
|
3578
|
-
* Provides a
|
|
3635
|
+
* Provides a Lunnoa user client and session helpers to React trees.
|
|
3579
3636
|
*
|
|
3580
3637
|
* ```tsx
|
|
3581
3638
|
* <LunnoaAuthProvider baseUrl={import.meta.env.VITE_LUNNOA_URL}>
|
|
@@ -3584,7 +3641,7 @@ type LunnoaAuthProviderProps = {
|
|
|
3584
3641
|
* ```
|
|
3585
3642
|
*/
|
|
3586
3643
|
declare function LunnoaAuthProvider(props: LunnoaAuthProviderProps): react.FunctionComponentElement<react.ProviderProps<LunnoaAuthContextValue | null>>;
|
|
3587
|
-
/** Full auth session API for
|
|
3644
|
+
/** Full auth session API for React apps whose users sign in to Lunnoa. */
|
|
3588
3645
|
declare function useLunnoaAuth(): LunnoaAuthContextValue;
|
|
3589
3646
|
/** The Lunnoa client from the nearest {@link LunnoaAuthProvider}. */
|
|
3590
3647
|
declare function useLunnoaClient(): LunnoaClient;
|
|
@@ -3652,7 +3709,10 @@ interface UseNeedsInputResult {
|
|
|
3652
3709
|
declare function useNeedsInput(source: NeedsInputSource, options?: UseNeedsInputOptions): UseNeedsInputResult;
|
|
3653
3710
|
|
|
3654
3711
|
interface UseAgentChatOptions {
|
|
3655
|
-
/**
|
|
3712
|
+
/**
|
|
3713
|
+
* Agent chat mode forwarded in the request body.
|
|
3714
|
+
* Defaults to `preview` (10 model rounds). `builder` stops after 4 rounds.
|
|
3715
|
+
*/
|
|
3656
3716
|
chatMode?: 'builder' | 'preview';
|
|
3657
3717
|
}
|
|
3658
3718
|
interface UseAgentChatResult {
|
package/dist/react.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { UIMessage, UIMessageChunk } from 'ai';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Pluggable storage for
|
|
6
|
+
* Pluggable storage for Lunnoa user JWTs.
|
|
7
7
|
* The SDK never uses httpOnly cookies: Automate auth is bearer JWT based.
|
|
8
8
|
*/
|
|
9
9
|
interface TokenStore {
|
|
@@ -24,20 +24,20 @@ interface LunnoaClientOptions {
|
|
|
24
24
|
*/
|
|
25
25
|
baseUrl: string;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
* the constructor throws if one is supplied while `window` exists.
|
|
27
|
+
* Machine credential (`lna_...`) for the CLI and operator scripts, not for app login.
|
|
28
|
+
* Never usable in browsers: the constructor throws if one is supplied while `window` exists.
|
|
29
29
|
*/
|
|
30
30
|
apiKey?: string;
|
|
31
31
|
/**
|
|
32
32
|
* User JWT obtained from login / SSO. The supported credential for browser
|
|
33
33
|
* applications. May be a function so refreshed tokens are picked up per request.
|
|
34
34
|
*
|
|
35
|
-
* Prefer {@link tokenStore}
|
|
35
|
+
* Prefer {@link tokenStore} so login/refresh can persist tokens
|
|
36
36
|
* and optionally auto-refresh on 401.
|
|
37
37
|
*/
|
|
38
38
|
accessToken?: string | (() => string | Promise<string>);
|
|
39
39
|
/**
|
|
40
|
-
* Optional JWT store for
|
|
40
|
+
* Optional JWT store for a signed-in Lunnoa user. When set, authenticated requests read
|
|
41
41
|
* the access token from the store. Login / refresh helpers write back into it.
|
|
42
42
|
*/
|
|
43
43
|
tokenStore?: TokenStore;
|
|
@@ -107,7 +107,10 @@ declare class HttpClient {
|
|
|
107
107
|
|
|
108
108
|
type ChatMode = 'builder' | 'preview';
|
|
109
109
|
interface StreamMessageOptions {
|
|
110
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* Agent chat mode. Defaults to `preview` (10 model rounds, a normal agent run).
|
|
112
|
+
* `builder` is the agent-editor interview and stops after 4 rounds.
|
|
113
|
+
*/
|
|
111
114
|
chatMode?: ChatMode;
|
|
112
115
|
/** Optional image attachment forwarded with this turn. */
|
|
113
116
|
data?: {
|
|
@@ -937,7 +940,7 @@ interface components {
|
|
|
937
940
|
description?: string;
|
|
938
941
|
/** @description System instructions / prompt for the agent. */
|
|
939
942
|
instructions: string;
|
|
940
|
-
/** @description
|
|
943
|
+
/** @description Catalogue model id enabled on the AI connection. Example: `deepseek-ai/DeepSeek-V4-Pro`. Discover ids with GET /api/ai-connections. */
|
|
941
944
|
model: string;
|
|
942
945
|
/** @description AiProviderConnection UUID. When omitted, platform AI defaults apply. */
|
|
943
946
|
aiConnectionId?: string;
|
|
@@ -2074,6 +2077,32 @@ interface components {
|
|
|
2074
2077
|
/** Format: date-time */
|
|
2075
2078
|
updatedAt: string;
|
|
2076
2079
|
};
|
|
2080
|
+
PublicAiModelResponseDto: {
|
|
2081
|
+
/** @description Catalogue model id passed to agent deploy as `model`. Example: `deepseek-ai/DeepSeek-V4-Pro`. */
|
|
2082
|
+
id: string;
|
|
2083
|
+
/** @description Display name. */
|
|
2084
|
+
name: string;
|
|
2085
|
+
/** @description True when this is the model used if an agent deploy omits `model` on this connection. */
|
|
2086
|
+
isDefault: boolean;
|
|
2087
|
+
/** @description Whether the model can call tools. */
|
|
2088
|
+
supportsTools: boolean;
|
|
2089
|
+
/** @description Whether the model accepts image input. */
|
|
2090
|
+
supportsVision: boolean;
|
|
2091
|
+
/** @description Whether the model exposes a reasoning mode. */
|
|
2092
|
+
supportsReasoning: boolean;
|
|
2093
|
+
};
|
|
2094
|
+
PublicAiConnectionResponseDto: {
|
|
2095
|
+
/** @description AiProviderConnection UUID. Pass as `aiConnectionId` / `defineAiConnection({ id })` when this connection is not the default. */
|
|
2096
|
+
id: string;
|
|
2097
|
+
/** @description Connection display name. Example: `Lunnoa LLMs`. */
|
|
2098
|
+
name: string;
|
|
2099
|
+
/** @description Provider slug. Example: `featherless` or `openai`. */
|
|
2100
|
+
provider: string;
|
|
2101
|
+
/** @description True for the connection used when an agent deploy omits `aiConnectionId`. */
|
|
2102
|
+
isDefault: boolean;
|
|
2103
|
+
/** @description Models this connection accepts. Inactive models are omitted. */
|
|
2104
|
+
models: components["schemas"]["PublicAiModelResponseDto"][];
|
|
2105
|
+
};
|
|
2077
2106
|
ConnectionWorkspaceDto: {
|
|
2078
2107
|
/** @description Workspace ID. */
|
|
2079
2108
|
id: string;
|
|
@@ -2682,7 +2711,10 @@ interface AgentDefinition {
|
|
|
2682
2711
|
slug: string;
|
|
2683
2712
|
name?: string;
|
|
2684
2713
|
description?: string;
|
|
2685
|
-
/**
|
|
2714
|
+
/**
|
|
2715
|
+
* Catalogue model id from `ai-connections list` (`models[].id`).
|
|
2716
|
+
* Example on Lunnoa LLMs: `deepseek-ai/DeepSeek-V4-Pro`.
|
|
2717
|
+
*/
|
|
2686
2718
|
model: string;
|
|
2687
2719
|
instructions: string;
|
|
2688
2720
|
aiConnection?: AiConnectionDefinition;
|
|
@@ -2796,7 +2828,7 @@ interface CurrentUser {
|
|
|
2796
2828
|
}
|
|
2797
2829
|
|
|
2798
2830
|
/**
|
|
2799
|
-
* Login, refresh, SSO discovery, and session helpers for
|
|
2831
|
+
* Login, refresh, SSO discovery, and session helpers for Lunnoa users.
|
|
2800
2832
|
*
|
|
2801
2833
|
* Password login, token exchange, refresh, and SSO provider listing are
|
|
2802
2834
|
* **public** endpoints (no Bearer). `me()` requires a user JWT.
|
|
@@ -2885,6 +2917,36 @@ declare class SsoAuthResource {
|
|
|
2885
2917
|
getLoginUrl(providerId: string): string;
|
|
2886
2918
|
}
|
|
2887
2919
|
|
|
2920
|
+
interface AiConnectionModel {
|
|
2921
|
+
/** Catalogue id for `defineAgent({ model })`. */
|
|
2922
|
+
id: string;
|
|
2923
|
+
name: string;
|
|
2924
|
+
isDefault: boolean;
|
|
2925
|
+
supportsTools: boolean;
|
|
2926
|
+
supportsVision: boolean;
|
|
2927
|
+
supportsReasoning: boolean;
|
|
2928
|
+
}
|
|
2929
|
+
interface AiConnection {
|
|
2930
|
+
/** AiProviderConnection UUID for `defineAiConnection({ id })`. */
|
|
2931
|
+
id: string;
|
|
2932
|
+
name: string;
|
|
2933
|
+
/** Provider slug, for example `featherless` or `openai`. */
|
|
2934
|
+
provider: string;
|
|
2935
|
+
/** True when agent deploy uses this connection if `aiConnection` is omitted. */
|
|
2936
|
+
isDefault: boolean;
|
|
2937
|
+
models: AiConnectionModel[];
|
|
2938
|
+
}
|
|
2939
|
+
declare class AiConnectionsResource {
|
|
2940
|
+
private readonly http;
|
|
2941
|
+
constructor(http: HttpClient);
|
|
2942
|
+
/**
|
|
2943
|
+
* Lists AI connections the caller can assign to an agent, with the model
|
|
2944
|
+
* ids each connection accepts. Credentials are never included.
|
|
2945
|
+
* Requires `agents:create` (the same permission as agent deploy).
|
|
2946
|
+
*/
|
|
2947
|
+
list(): Promise<AiConnection[]>;
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2888
2950
|
declare class ConnectionsResource {
|
|
2889
2951
|
private readonly http;
|
|
2890
2952
|
constructor(http: HttpClient);
|
|
@@ -3453,28 +3515,21 @@ declare class WorkflowsResource {
|
|
|
3453
3515
|
/**
|
|
3454
3516
|
* Typed client for the Lunnoa Automate Public API.
|
|
3455
3517
|
*
|
|
3456
|
-
*
|
|
3457
|
-
* ```ts
|
|
3458
|
-
* const lunnoa = new LunnoaClient({
|
|
3459
|
-
* baseUrl: 'https://lunnoa.acme.example',
|
|
3460
|
-
* apiKey: process.env.LUNNOA_API_KEY, // lna_...
|
|
3461
|
-
* });
|
|
3462
|
-
* ```
|
|
3463
|
-
*
|
|
3464
|
-
* Browser (Pattern B — the end user is a Lunnoa user):
|
|
3518
|
+
* Apps sign people in as Lunnoa users:
|
|
3465
3519
|
* ```ts
|
|
3466
3520
|
* import { createBrowserClient } from '@lunnoa/client';
|
|
3467
3521
|
* const lunnoa = createBrowserClient({ baseUrl: 'https://lunnoa.acme.example' });
|
|
3468
3522
|
* await lunnoa.auth.login({ email, password });
|
|
3469
3523
|
* ```
|
|
3470
3524
|
*
|
|
3471
|
-
*
|
|
3472
|
-
*
|
|
3525
|
+
* `apiKey` (`lna_...`) is for the CLI and operator scripts (codegen, discovery,
|
|
3526
|
+
* deploy). It is not an app login. Passing one while `window` exists throws:
|
|
3527
|
+
* a leaked key acts as that service account across its whole workspace.
|
|
3473
3528
|
*/
|
|
3474
3529
|
declare class LunnoaClient {
|
|
3475
3530
|
/** The underlying HTTP layer, exposed for advanced/escape-hatch requests. */
|
|
3476
3531
|
readonly http: HttpClient;
|
|
3477
|
-
/** Login, refresh, SSO discovery, and session helpers
|
|
3532
|
+
/** Login, refresh, SSO discovery, and session helpers for Lunnoa users. */
|
|
3478
3533
|
readonly auth: AuthResource;
|
|
3479
3534
|
readonly agents: AgentsResource;
|
|
3480
3535
|
readonly tasks: TasksResource;
|
|
@@ -3501,6 +3556,8 @@ declare class LunnoaClient {
|
|
|
3501
3556
|
readonly variables: VariablesResource;
|
|
3502
3557
|
readonly scorecards: ScorecardsResource;
|
|
3503
3558
|
readonly connections: ConnectionsResource;
|
|
3559
|
+
/** AI provider connections and the model ids each one accepts. */
|
|
3560
|
+
readonly aiConnections: AiConnectionsResource;
|
|
3504
3561
|
readonly workflowApps: WorkflowAppsResource;
|
|
3505
3562
|
readonly discovery: DiscoveryResource;
|
|
3506
3563
|
constructor(options: LunnoaClientOptions);
|
|
@@ -3525,7 +3582,7 @@ interface CreateBrowserClientOptions {
|
|
|
3525
3582
|
|
|
3526
3583
|
type AuthStatus = 'loading' | 'authenticated' | 'unauthenticated';
|
|
3527
3584
|
interface LunnoaAuthContextValue {
|
|
3528
|
-
/** Shared Lunnoa client (
|
|
3585
|
+
/** Shared Lunnoa client (user JWT token store). */
|
|
3529
3586
|
client: LunnoaClient;
|
|
3530
3587
|
/** Current user from `GET /api/users/me`, or null when signed out. */
|
|
3531
3588
|
user: CurrentUser | null;
|
|
@@ -3567,7 +3624,7 @@ interface LunnoaAuthContextValue {
|
|
|
3567
3624
|
getAccessToken: () => Promise<string | null>;
|
|
3568
3625
|
}
|
|
3569
3626
|
type LunnoaAuthProviderProps = {
|
|
3570
|
-
/** Existing
|
|
3627
|
+
/** Existing browser client (from `createBrowserClient`). */
|
|
3571
3628
|
client: LunnoaClient;
|
|
3572
3629
|
children: ReactNode;
|
|
3573
3630
|
} | (CreateBrowserClientOptions & {
|
|
@@ -3575,7 +3632,7 @@ type LunnoaAuthProviderProps = {
|
|
|
3575
3632
|
children: ReactNode;
|
|
3576
3633
|
});
|
|
3577
3634
|
/**
|
|
3578
|
-
* Provides a
|
|
3635
|
+
* Provides a Lunnoa user client and session helpers to React trees.
|
|
3579
3636
|
*
|
|
3580
3637
|
* ```tsx
|
|
3581
3638
|
* <LunnoaAuthProvider baseUrl={import.meta.env.VITE_LUNNOA_URL}>
|
|
@@ -3584,7 +3641,7 @@ type LunnoaAuthProviderProps = {
|
|
|
3584
3641
|
* ```
|
|
3585
3642
|
*/
|
|
3586
3643
|
declare function LunnoaAuthProvider(props: LunnoaAuthProviderProps): react.FunctionComponentElement<react.ProviderProps<LunnoaAuthContextValue | null>>;
|
|
3587
|
-
/** Full auth session API for
|
|
3644
|
+
/** Full auth session API for React apps whose users sign in to Lunnoa. */
|
|
3588
3645
|
declare function useLunnoaAuth(): LunnoaAuthContextValue;
|
|
3589
3646
|
/** The Lunnoa client from the nearest {@link LunnoaAuthProvider}. */
|
|
3590
3647
|
declare function useLunnoaClient(): LunnoaClient;
|
|
@@ -3652,7 +3709,10 @@ interface UseNeedsInputResult {
|
|
|
3652
3709
|
declare function useNeedsInput(source: NeedsInputSource, options?: UseNeedsInputOptions): UseNeedsInputResult;
|
|
3653
3710
|
|
|
3654
3711
|
interface UseAgentChatOptions {
|
|
3655
|
-
/**
|
|
3712
|
+
/**
|
|
3713
|
+
* Agent chat mode forwarded in the request body.
|
|
3714
|
+
* Defaults to `preview` (10 model rounds). `builder` stops after 4 rounds.
|
|
3715
|
+
*/
|
|
3656
3716
|
chatMode?: 'builder' | 'preview';
|
|
3657
3717
|
}
|
|
3658
3718
|
interface UseAgentChatResult {
|
package/dist/react.js
CHANGED
|
@@ -56,7 +56,7 @@ function isBrowserEnvironment() {
|
|
|
56
56
|
function assertApiKeyAllowedInEnvironment(apiKey) {
|
|
57
57
|
if (isBrowserEnvironment()) {
|
|
58
58
|
throw new Error(
|
|
59
|
-
"Refusing to use a Lunnoa API key (lna_...) in a browser environment. API keys are
|
|
59
|
+
"Refusing to use a Lunnoa API key (lna_...) in a browser environment. API keys are for the CLI and operator scripts, not for app login. Anyone opening dev tools could read the key and act as the service account across its whole workspace. Sign the end user in with lunnoa.auth.login and pass their JWT as `accessToken`."
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
if (!apiKey.startsWith(API_KEY_PREFIX)) {
|
|
@@ -138,7 +138,7 @@ var HttpClient = class {
|
|
|
138
138
|
}
|
|
139
139
|
if (!options.apiKey && !options.accessToken && !options.tokenStore) {
|
|
140
140
|
throw new Error(
|
|
141
|
-
"LunnoaClient requires an
|
|
141
|
+
"LunnoaClient requires an accessToken or tokenStore (Lunnoa user JWT), or an apiKey for operator scripts."
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
144
|
if (options.apiKey) {
|
|
@@ -516,7 +516,7 @@ var AgentChatClient = class {
|
|
|
516
516
|
function messageTaskBody(message, options = {}) {
|
|
517
517
|
return {
|
|
518
518
|
messages: [message],
|
|
519
|
-
|
|
519
|
+
chatMode: options.chatMode ?? "preview",
|
|
520
520
|
...options.data ? { data: options.data } : {},
|
|
521
521
|
...options.piiResolution ? { piiResolution: options.piiResolution } : {}
|
|
522
522
|
};
|
|
@@ -891,6 +891,22 @@ var SsoAuthResource = class {
|
|
|
891
891
|
}
|
|
892
892
|
};
|
|
893
893
|
|
|
894
|
+
// src/resources/ai-connections.ts
|
|
895
|
+
var AiConnectionsResource = class {
|
|
896
|
+
constructor(http) {
|
|
897
|
+
this.http = http;
|
|
898
|
+
}
|
|
899
|
+
http;
|
|
900
|
+
/**
|
|
901
|
+
* Lists AI connections the caller can assign to an agent, with the model
|
|
902
|
+
* ids each connection accepts. Credentials are never included.
|
|
903
|
+
* Requires `agents:create` (the same permission as agent deploy).
|
|
904
|
+
*/
|
|
905
|
+
list() {
|
|
906
|
+
return this.http.get("/api/ai-connections");
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
|
|
894
910
|
// src/resources/connections.ts
|
|
895
911
|
var ConnectionsResource = class {
|
|
896
912
|
constructor(http) {
|
|
@@ -2089,7 +2105,7 @@ var WorkflowsResource = class {
|
|
|
2089
2105
|
var LunnoaClient = class {
|
|
2090
2106
|
/** The underlying HTTP layer, exposed for advanced/escape-hatch requests. */
|
|
2091
2107
|
http;
|
|
2092
|
-
/** Login, refresh, SSO discovery, and session helpers
|
|
2108
|
+
/** Login, refresh, SSO discovery, and session helpers for Lunnoa users. */
|
|
2093
2109
|
auth;
|
|
2094
2110
|
agents;
|
|
2095
2111
|
tasks;
|
|
@@ -2116,6 +2132,8 @@ var LunnoaClient = class {
|
|
|
2116
2132
|
variables;
|
|
2117
2133
|
scorecards;
|
|
2118
2134
|
connections;
|
|
2135
|
+
/** AI provider connections and the model ids each one accepts. */
|
|
2136
|
+
aiConnections;
|
|
2119
2137
|
workflowApps;
|
|
2120
2138
|
discovery;
|
|
2121
2139
|
constructor(options) {
|
|
@@ -2139,6 +2157,7 @@ var LunnoaClient = class {
|
|
|
2139
2157
|
this.variables = new VariablesResource(this.http);
|
|
2140
2158
|
this.scorecards = new ScorecardsResource(this.http);
|
|
2141
2159
|
this.connections = new ConnectionsResource(this.http);
|
|
2160
|
+
this.aiConnections = new AiConnectionsResource(this.http);
|
|
2142
2161
|
this.discovery = new DiscoveryResource(this.http);
|
|
2143
2162
|
}
|
|
2144
2163
|
};
|
|
@@ -2540,7 +2559,7 @@ function useAgentChat(agentId, taskId, options = {}) {
|
|
|
2540
2559
|
if (!token) return {};
|
|
2541
2560
|
return { Authorization: `Bearer ${token}` };
|
|
2542
2561
|
},
|
|
2543
|
-
body:
|
|
2562
|
+
body: { chatMode: chatMode ?? "preview" },
|
|
2544
2563
|
prepareReconnectToStreamRequest: ({ headers, credentials }) => ({
|
|
2545
2564
|
api,
|
|
2546
2565
|
headers,
|