@kweaver-ai/kweaver-sdk 0.6.3 → 0.6.5
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 +29 -4
- package/README.zh.md +7 -3
- package/dist/api/dataflow.d.ts +1 -1
- package/dist/api/dataflow.js +4 -1
- package/dist/api/toolboxes.d.ts +47 -0
- package/dist/api/toolboxes.js +90 -0
- package/dist/auth/oauth.d.ts +69 -0
- package/dist/auth/oauth.js +647 -1
- package/dist/cli.js +20 -1
- package/dist/commands/auth.js +145 -18
- package/dist/commands/bkn-ops.d.ts +1 -0
- package/dist/commands/bkn-ops.js +8 -1
- package/dist/commands/call.d.ts +10 -0
- package/dist/commands/call.js +61 -5
- package/dist/commands/config.js +19 -9
- package/dist/commands/context-loader.js +8 -2
- package/dist/commands/ds.d.ts +1 -0
- package/dist/commands/ds.js +11 -11
- package/dist/commands/import-csv.d.ts +1 -1
- package/dist/commands/import-csv.js +3 -1
- package/dist/commands/tool.d.ts +16 -0
- package/dist/commands/tool.js +208 -0
- package/dist/commands/toolbox.d.ts +14 -0
- package/dist/commands/toolbox.js +256 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,8 @@ export KWEAVER_BASE_URL=https://your-kweaver-instance.com
|
|
|
31
31
|
export KWEAVER_TOKEN=your-token
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
With both set, API commands use that token even if you never ran `auth login`. You can also run **`kweaver auth status`**, **`kweaver auth whoami`** (supports `--json`), and **`kweaver config show`** when there is **no** current platform in `~/.kweaver/` — the CLI decodes the token locally (JWT only). If the token is opaque, identity fields are omitted and a short hint is printed.
|
|
35
|
+
|
|
34
36
|
### Business domain (platform)
|
|
35
37
|
|
|
36
38
|
Set or verify **before** calling list/query APIs that scope by tenant. DIP deployments often need a UUID, not only `bd_public`.
|
|
@@ -151,11 +153,13 @@ const skillMd = await client.skills.fetchContent("skill-id");
|
|
|
151
153
|
## CLI Reference
|
|
152
154
|
|
|
153
155
|
```
|
|
154
|
-
kweaver auth login <url> [--alias name] [--no-auth] [--no-browser] [-u user] [-p pass] [--playwright] [--insecure|-k]
|
|
156
|
+
kweaver auth login <url> [--alias name] [--no-auth] [--no-browser] [-u user] [-p pass] [--http-signin] [--playwright] [--insecure|-k]
|
|
157
|
+
# -u/-p: tries HTTP /oauth2/signin first (refresh_token). If studioweb is missing: falls back to Playwright when installed, else prints install hint. --http-signin: HTTP only. --playwright: force browser automation.
|
|
155
158
|
kweaver auth login <url> --client-id ID --client-secret S --refresh-token T (headless login)
|
|
156
159
|
kweaver auth export [url|alias] [--json] (export command to run on a headless host)
|
|
157
|
-
kweaver auth status/
|
|
158
|
-
kweaver
|
|
160
|
+
kweaver auth status / whoami [url|alias] [--json] # whoami: --json; with KWEAVER_BASE_URL+KWEAVER_TOKEN when no ~/.kweaver/ platform
|
|
161
|
+
kweaver auth list/use/delete/logout
|
|
162
|
+
kweaver config show / list-bd / set-bd <value> # platform business domain — show/list-bd work with KWEAVER_BASE_URL (+ KWEAVER_TOKEN for list-bd)
|
|
159
163
|
kweaver token
|
|
160
164
|
kweaver ds list/get/delete/tables/connect
|
|
161
165
|
kweaver ds import-csv <ds_id> --files <glob> [--table-prefix <p>] [--batch-size 500] [--recreate]
|
|
@@ -176,7 +180,9 @@ kweaver skill list/market/get/register/status/delete/content/read-file/download/
|
|
|
176
180
|
kweaver vega health/stats/inspect/sql/catalog/resource/connector-type
|
|
177
181
|
kweaver context-loader config set/use/list/show
|
|
178
182
|
kweaver context-loader kn-search/query-object-instance/...
|
|
179
|
-
kweaver
|
|
183
|
+
kweaver toolbox create/list/publish/unpublish/delete
|
|
184
|
+
kweaver tool upload/list/enable/disable
|
|
185
|
+
kweaver call <path> [-X METHOD] [-d BODY] [-H header] [-F key=value]
|
|
180
186
|
```
|
|
181
187
|
|
|
182
188
|
### Dataflow CLI examples
|
|
@@ -207,6 +213,25 @@ kweaver vega sql -d '{"resource_type":"mysql","query":"SELECT * FROM {{res-1}} L
|
|
|
207
213
|
|
|
208
214
|
If both `-d` and `--query` / `--resource-type` are present, **only `-d` is used**.
|
|
209
215
|
|
|
216
|
+
### Register an Agent toolbox
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# 1. Create a toolbox pointing at your service
|
|
220
|
+
kweaver toolbox create \
|
|
221
|
+
--name my_actions \
|
|
222
|
+
--service-url http://my-svc:8080 \
|
|
223
|
+
--description "Demo action backend"
|
|
224
|
+
# → {"box_id":"<BOX_ID>"}
|
|
225
|
+
|
|
226
|
+
# 2. Upload an OpenAPI spec as a tool
|
|
227
|
+
kweaver tool upload --toolbox <BOX_ID> ./openapi.json
|
|
228
|
+
# → {"success_ids":["<TOOL_ID>"]}
|
|
229
|
+
|
|
230
|
+
# 3. Publish the toolbox and enable the tool
|
|
231
|
+
kweaver toolbox publish <BOX_ID>
|
|
232
|
+
kweaver tool enable --toolbox <BOX_ID> <TOOL_ID>
|
|
233
|
+
```
|
|
234
|
+
|
|
210
235
|
**No-auth platforms:** If OAuth is not enabled, use `kweaver auth <url> --no-auth` (or run a normal `auth login`; a **404** on `POST /oauth2/clients` switches to no-auth automatically). Credentials are still saved under `~/.kweaver/` and work with `auth use` / `auth list`. Optional: `KWEAVER_NO_AUTH=1` with `KWEAVER_BASE_URL` when no token env is set. SDK: `new KWeaverClient({ baseUrl, auth: false })` or `kweaver.configure({ baseUrl, auth: false })`.
|
|
211
236
|
|
|
212
237
|
## Environment Variables
|
package/README.zh.md
CHANGED
|
@@ -31,6 +31,8 @@ export KWEAVER_BASE_URL=https://your-kweaver-instance.com
|
|
|
31
31
|
export KWEAVER_TOKEN=your-token
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
两者同时设置时,即使未执行 `auth login`,业务命令也会使用该 token。若 **`~/.kweaver/` 无当前平台**,仍可使用 **`kweaver auth status`**、**`kweaver auth whoami`**(支持 `--json`)、**`kweaver config show`**:CLI 会在本地解 JWT 展示身份;若 token 为 opaque,则省略身份字段并给出简短提示。
|
|
35
|
+
|
|
34
36
|
### 业务域(平台配置)
|
|
35
37
|
|
|
36
38
|
在调用依赖租户范围的接口前,应先确认业务域;DIP 环境通常使用 **UUID**,不能长期只依赖默认 `bd_public`。
|
|
@@ -144,11 +146,13 @@ const skillMd = await client.skills.fetchContent("skill-id");
|
|
|
144
146
|
## 命令速查
|
|
145
147
|
|
|
146
148
|
```
|
|
147
|
-
kweaver auth login <url> [--alias name] [--no-auth] [--no-browser] [-u user] [-p pass] [--playwright] [--insecure|-k]
|
|
149
|
+
kweaver auth login <url> [--alias name] [--no-auth] [--no-browser] [-u user] [-p pass] [--http-signin] [--playwright] [--insecure|-k]
|
|
150
|
+
# -u/-p:默认先试 HTTP /oauth2/signin(可拿 refresh_token);无 studioweb 时:已装 Playwright 则回退无头浏览器,否则提示安装 Playwright;--http-signin 仅 HTTP;--playwright 强制浏览器
|
|
148
151
|
kweaver auth login <url> --client-id ID --client-secret S --refresh-token T (无浏览器登录)
|
|
149
152
|
kweaver auth export [url|alias] [--json] (导出在无浏览器机器上运行的命令)
|
|
150
|
-
kweaver auth status/
|
|
151
|
-
kweaver
|
|
153
|
+
kweaver auth status / whoami [url|alias] [--json] # whoami 支持 --json;无 ~/.kweaver/ 当前平台时可配 KWEAVER_BASE_URL+KWEAVER_TOKEN
|
|
154
|
+
kweaver auth list/use/delete/logout
|
|
155
|
+
kweaver config show / list-bd / set-bd <value> # 业务域;show/list-bd 在无已保存平台时可与 env 配对
|
|
152
156
|
kweaver token
|
|
153
157
|
kweaver ds list/get/delete/tables/connect
|
|
154
158
|
kweaver dataflow list/run/runs/logs
|
package/dist/api/dataflow.d.ts
CHANGED
package/dist/api/dataflow.js
CHANGED
|
@@ -82,7 +82,10 @@ export async function pollDataflowResults(options) {
|
|
|
82
82
|
return latest;
|
|
83
83
|
}
|
|
84
84
|
if (latest.status === "failed" || latest.status === "error") {
|
|
85
|
-
const
|
|
85
|
+
const reasonVal = latest.reason;
|
|
86
|
+
const reason = reasonVal
|
|
87
|
+
? `: ${typeof reasonVal === "string" ? reasonVal : JSON.stringify(reasonVal)}`
|
|
88
|
+
: "";
|
|
86
89
|
throw new Error(`Dataflow run ${latest.status}${reason}`);
|
|
87
90
|
}
|
|
88
91
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
interface BaseOpts {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
accessToken: string;
|
|
4
|
+
businessDomain?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CreateToolboxOptions extends BaseOpts {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
serviceUrl: string;
|
|
10
|
+
metadataType?: "openapi";
|
|
11
|
+
source?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function createToolbox(opts: CreateToolboxOptions): Promise<string>;
|
|
14
|
+
export interface DeleteToolboxOptions extends BaseOpts {
|
|
15
|
+
boxId: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function deleteToolbox(opts: DeleteToolboxOptions): Promise<void>;
|
|
18
|
+
export interface SetToolboxStatusOptions extends BaseOpts {
|
|
19
|
+
boxId: string;
|
|
20
|
+
status: "published" | "draft";
|
|
21
|
+
}
|
|
22
|
+
export declare function setToolboxStatus(opts: SetToolboxStatusOptions): Promise<void>;
|
|
23
|
+
export interface UploadToolOptions extends BaseOpts {
|
|
24
|
+
boxId: string;
|
|
25
|
+
filePath: string;
|
|
26
|
+
metadataType?: "openapi";
|
|
27
|
+
}
|
|
28
|
+
export declare function uploadTool(opts: UploadToolOptions): Promise<string>;
|
|
29
|
+
export interface SetToolStatusesOptions extends BaseOpts {
|
|
30
|
+
boxId: string;
|
|
31
|
+
updates: Array<{
|
|
32
|
+
toolId: string;
|
|
33
|
+
status: "enabled" | "disabled";
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
export declare function setToolStatuses(opts: SetToolStatusesOptions): Promise<void>;
|
|
37
|
+
export interface ListToolboxesOptions extends BaseOpts {
|
|
38
|
+
keyword?: string;
|
|
39
|
+
limit?: number;
|
|
40
|
+
offset?: number;
|
|
41
|
+
}
|
|
42
|
+
export declare function listToolboxes(opts: ListToolboxesOptions): Promise<string>;
|
|
43
|
+
export interface ListToolsOptions extends BaseOpts {
|
|
44
|
+
boxId: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function listTools(opts: ListToolsOptions): Promise<string>;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import { fetchTextOrThrow } from "../utils/http.js";
|
|
4
|
+
import { buildHeaders } from "./headers.js";
|
|
5
|
+
// Backend endpoints under /api/agent-operator-integration/v1/tool-box.
|
|
6
|
+
//
|
|
7
|
+
// Verified against kweaver/examples/03-action-lifecycle/run.sh (lines 78–197):
|
|
8
|
+
// POST /tool-box create
|
|
9
|
+
// DELETE /tool-box/{id} delete
|
|
10
|
+
// POST /tool-box/{id}/status publish/draft
|
|
11
|
+
// POST /tool-box/{id}/tool upload tool (multipart)
|
|
12
|
+
// POST /tool-box/{id}/tools/status enable/disable (batch)
|
|
13
|
+
//
|
|
14
|
+
// Verified during Task 8 e2e against the live backend (2026-04-18):
|
|
15
|
+
// GET /tool-box?keyword=&limit=&offset= list toolboxes
|
|
16
|
+
// GET /tool-box/{id}/tool list tools
|
|
17
|
+
const PATH = "/api/agent-operator-integration/v1/tool-box";
|
|
18
|
+
function url(base, suffix = "") {
|
|
19
|
+
return `${base.replace(/\/+$/, "")}${PATH}${suffix}`;
|
|
20
|
+
}
|
|
21
|
+
export async function createToolbox(opts) {
|
|
22
|
+
const body = JSON.stringify({
|
|
23
|
+
metadata_type: opts.metadataType ?? "openapi",
|
|
24
|
+
box_name: opts.name,
|
|
25
|
+
box_desc: opts.description,
|
|
26
|
+
box_svc_url: opts.serviceUrl,
|
|
27
|
+
source: opts.source ?? "custom",
|
|
28
|
+
});
|
|
29
|
+
const { body: text } = await fetchTextOrThrow(url(opts.baseUrl), {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: { ...buildHeaders(opts.accessToken, opts.businessDomain ?? "bd_public"), "content-type": "application/json" },
|
|
32
|
+
body,
|
|
33
|
+
});
|
|
34
|
+
return text;
|
|
35
|
+
}
|
|
36
|
+
export async function deleteToolbox(opts) {
|
|
37
|
+
await fetchTextOrThrow(url(opts.baseUrl, `/${encodeURIComponent(opts.boxId)}`), {
|
|
38
|
+
method: "DELETE",
|
|
39
|
+
headers: buildHeaders(opts.accessToken, opts.businessDomain ?? "bd_public"),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export async function setToolboxStatus(opts) {
|
|
43
|
+
await fetchTextOrThrow(url(opts.baseUrl, `/${encodeURIComponent(opts.boxId)}/status`), {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: { ...buildHeaders(opts.accessToken, opts.businessDomain ?? "bd_public"), "content-type": "application/json" },
|
|
46
|
+
body: JSON.stringify({ status: opts.status }),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export async function uploadTool(opts) {
|
|
50
|
+
const buf = await readFile(opts.filePath);
|
|
51
|
+
const form = new FormData();
|
|
52
|
+
form.append("metadata_type", opts.metadataType ?? "openapi");
|
|
53
|
+
form.append("data", new Blob([buf]), basename(opts.filePath));
|
|
54
|
+
const { body: text } = await fetchTextOrThrow(url(opts.baseUrl, `/${encodeURIComponent(opts.boxId)}/tool`), {
|
|
55
|
+
method: "POST",
|
|
56
|
+
headers: buildHeaders(opts.accessToken, opts.businessDomain ?? "bd_public"),
|
|
57
|
+
body: form,
|
|
58
|
+
});
|
|
59
|
+
return text;
|
|
60
|
+
}
|
|
61
|
+
export async function setToolStatuses(opts) {
|
|
62
|
+
const body = JSON.stringify(opts.updates.map((u) => ({ tool_id: u.toolId, status: u.status })));
|
|
63
|
+
await fetchTextOrThrow(url(opts.baseUrl, `/${encodeURIComponent(opts.boxId)}/tools/status`), {
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers: { ...buildHeaders(opts.accessToken, opts.businessDomain ?? "bd_public"), "content-type": "application/json" },
|
|
66
|
+
body,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export async function listToolboxes(opts) {
|
|
70
|
+
const qp = new URLSearchParams();
|
|
71
|
+
if (opts.keyword !== undefined)
|
|
72
|
+
qp.set("keyword", opts.keyword);
|
|
73
|
+
if (opts.limit !== undefined)
|
|
74
|
+
qp.set("limit", String(opts.limit));
|
|
75
|
+
if (opts.offset !== undefined)
|
|
76
|
+
qp.set("offset", String(opts.offset));
|
|
77
|
+
const suffix = qp.toString() ? `?${qp}` : "";
|
|
78
|
+
const { body } = await fetchTextOrThrow(url(opts.baseUrl, suffix), {
|
|
79
|
+
method: "GET",
|
|
80
|
+
headers: buildHeaders(opts.accessToken, opts.businessDomain ?? "bd_public"),
|
|
81
|
+
});
|
|
82
|
+
return body;
|
|
83
|
+
}
|
|
84
|
+
export async function listTools(opts) {
|
|
85
|
+
const { body } = await fetchTextOrThrow(url(opts.baseUrl, `/${encodeURIComponent(opts.boxId)}/tool`), {
|
|
86
|
+
method: "GET",
|
|
87
|
+
headers: buildHeaders(opts.accessToken, opts.businessDomain ?? "bd_public"),
|
|
88
|
+
});
|
|
89
|
+
return body;
|
|
90
|
+
}
|
package/dist/auth/oauth.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { type TokenConfig } from "../config/store.js";
|
|
2
|
+
/**
|
|
3
|
+
* Studioweb hardcoded LOGIN public key (PEM) — the single key used for HTTP `/oauth2/signin`.
|
|
4
|
+
* Source: kweaver-ai/kweaver `deploy/auto_cofig/auto_config.sh` `LOGIN_PUBLIC_KEY`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const STUDIOWEB_LOGIN_PUBLIC_KEY_PEM = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyOstgbYuubBi2PUqeVj\nGKlkwVUY6w1Y8d4k116dI2SkZI8fxcjHALv77kItO4jYLVplk9gO4HAtsisnNE2o\nwlYIqdmyEPMwupaeFFFcg751oiTXJiYbtX7ABzU5KQYPjRSEjMq6i5qu/mL67XTk\nhvKwrC83zme66qaKApmKupDODPb0RRkutK/zHfd1zL7sciBQ6psnNadh8pE24w8O\n2XVy1v2bgSNkGHABgncR7seyIg81JQ3c/Axxd6GsTztjLnlvGAlmT1TphE84mi99\nfUaGD2A1u1qdIuNc+XuisFeNcUW6fct0+x97eS2eEGRr/7qxWmO/P20sFVzXc2bF\n1QIDAQAB\n-----END PUBLIC KEY-----";
|
|
7
|
+
/**
|
|
8
|
+
* Default RSA modulus (hex) for `/oauth2/signin` when `__NEXT_DATA__` has no `publicKey` / `modulus`.
|
|
9
|
+
* DIP / EACP / AnyShare-style deployments use the ISFWeb `core/auth` PUBLIC_KEY (1024-bit, exp 65537).
|
|
10
|
+
* Prefer key material from the sign-in page when present.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_SIGNIN_RSA_MODULUS_HEX = "C1D9F84B95AF6B331FBA2D64D76A39CAD7529DA79DB4B3543E4DF3DF21723FEC6F7E2F6602E11037339AE0462DF6B39F94150FC256A505A8CA95BB3699E25C3FB84764D6A1DC3F483A2C1DC4F70925D85725151D0CFBF1EB5A6C4FA0E37ED32FED150C717CD82C528745CDB761D17635AC855421B3CBBEE7D405B2CA5C70CFA7";
|
|
13
|
+
/**
|
|
14
|
+
* Build an SPKI PEM from an RSA modulus (hex) and public exponent (default 65537 / 0x10001).
|
|
15
|
+
*/
|
|
16
|
+
export declare function rsaModulusHexToSpkiPem(modulusHex: string, exponent?: number): string;
|
|
2
17
|
/** POSIX shell single-quote escaping for copy-paste commands. */
|
|
3
18
|
export declare function shellQuoteForShell(value: string): string;
|
|
4
19
|
/**
|
|
@@ -11,6 +26,12 @@ export declare function buildCopyCommand(baseUrl: string, clientId: string, clie
|
|
|
11
26
|
*/
|
|
12
27
|
export declare function buildCallbackHtml(copyCommand: string): string;
|
|
13
28
|
export declare function normalizeBaseUrl(value: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Temporarily disable TLS certificate verification for Node `fetch` (sets
|
|
31
|
+
* NODE_TLS_REJECT_UNAUTHORIZED). Used for `--insecure` login and token refresh.
|
|
32
|
+
*/
|
|
33
|
+
/** @internal Exported for CLI env-only identity resolution (`env-snapshot.ts`). */
|
|
34
|
+
export declare function runWithTlsInsecure<T>(tlsInsecure: boolean | undefined, fn: () => Promise<T>): Promise<T>;
|
|
14
35
|
/**
|
|
15
36
|
* OAuth2 Authorization Code login flow.
|
|
16
37
|
* 1. Register client (if not already registered), OR use a provided client ID
|
|
@@ -50,6 +71,54 @@ export declare function playwrightLogin(baseUrl: string, options?: {
|
|
|
50
71
|
scope?: string;
|
|
51
72
|
tlsInsecure?: boolean;
|
|
52
73
|
}): Promise<TokenConfig>;
|
|
74
|
+
/**
|
|
75
|
+
* Parse Next.js `__NEXT_DATA__` from the OAuth2 sign-in HTML shell (CSRF + optional challenge/remember for POST /oauth2/signin).
|
|
76
|
+
* Hydra `login_challenge` may appear only in the sign-in URL; use that when `pageProps.challenge` is absent.
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseSigninPageHtmlProps(html: string): {
|
|
79
|
+
challenge?: string;
|
|
80
|
+
csrftoken: string;
|
|
81
|
+
remember?: boolean;
|
|
82
|
+
/** Hex modulus, PEM, or Base64 SPKI from page (nested search + HTML regex fallback). */
|
|
83
|
+
rsaPublicKeyMaterial?: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* True when {@link oauth2PasswordSigninLogin} failed because the Studio web sign-in shell
|
|
87
|
+
* (`/interface/studioweb/login`) is missing or unreachable — callers may fall back to Playwright.
|
|
88
|
+
*/
|
|
89
|
+
export declare function isStudiowebShellUnavailableError(err: unknown): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* OAuth2 Authorization Code login using HTTP **only**: `GET /oauth2/signin` (Next.js shell) and
|
|
92
|
+
* `POST /oauth2/signin` with an RSA PKCS#1 v1.5–encrypted password (same as the browser `rsa.min` / Studio
|
|
93
|
+
* `core/mediator/auth` path).
|
|
94
|
+
*
|
|
95
|
+
* `/oauth2/auth` uses `product` `adp` by default (KWeaver Studio shell); set `oauthProduct` or `KWEAVER_OAUTH_PRODUCT` for DIP (`dip`).
|
|
96
|
+
* Password ciphertext defaults to **single-line base64** (PyCrypto-style); set `KWEAVER_SIGNIN_PASSWORD_B64_RSA_MIN=1` for rsa.min-style wrapped lines.
|
|
97
|
+
*/
|
|
98
|
+
export declare function oauth2PasswordSigninLogin(baseUrl: string, options: {
|
|
99
|
+
username: string;
|
|
100
|
+
password: string;
|
|
101
|
+
port?: number;
|
|
102
|
+
scope?: string;
|
|
103
|
+
clientId?: string;
|
|
104
|
+
clientSecret?: string;
|
|
105
|
+
tlsInsecure?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* `product` query for `/oauth2/auth` (must match deployment). Default `adp`; DIP deployments often use `dip`.
|
|
108
|
+
* @default KWEAVER_OAUTH_PRODUCT env or `adp`
|
|
109
|
+
*/
|
|
110
|
+
oauthProduct?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Password ciphertext: `rsa.min` uses newline every 64 chars; PyCrypto / some gateways expect a single base64 line.
|
|
113
|
+
* @default false (single-line base64, matches kweaver-core EACP-style encryption)
|
|
114
|
+
*/
|
|
115
|
+
signinPasswordBase64Plain?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* PEM / hex / Base64-SPKI file path — overrides key from the sign-in HTML.
|
|
118
|
+
* Env: `KWEAVER_SIGNIN_RSA_PUBLIC_KEY` (same path semantics as CLI `--signin-public-key-file`).
|
|
119
|
+
*/
|
|
120
|
+
signinPublicKeyPemPath?: string;
|
|
121
|
+
}): Promise<TokenConfig>;
|
|
53
122
|
/**
|
|
54
123
|
* Log in on a headless machine using OAuth2 client credentials and a refresh token (no browser).
|
|
55
124
|
* Exchanges the refresh token for a new access token and persists ~/.kweaver/ state.
|