@haven_ai/cli 0.0.0-dev.202609251338.80a72cc → 0.0.0-dev.202609251409.98ed67a
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/dist/cli.cjs +6 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +6 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -199,11 +199,12 @@ var CliApiError = class extends Error {
|
|
|
199
199
|
this.body = body;
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
|
-
function createCliApi({ baseUrl, token, fetchImpl = fetch }) {
|
|
202
|
+
function createCliApi({ baseUrl, token, fetchImpl = fetch, clientIdentity }) {
|
|
203
203
|
const root = baseUrl.replace(/\/+$/, "");
|
|
204
204
|
async function request(method, path, body) {
|
|
205
205
|
const headers = { Accept: "application/json" };
|
|
206
206
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
207
|
+
if (clientIdentity) headers["X-Haven-Client"] = clientIdentity;
|
|
207
208
|
if (body !== void 0) headers["Content-Type"] = "application/json";
|
|
208
209
|
let res;
|
|
209
210
|
try {
|
|
@@ -232,6 +233,7 @@ function createCliApi({ baseUrl, token, fetchImpl = fetch }) {
|
|
|
232
233
|
async function requestText(path) {
|
|
233
234
|
const headers = { Accept: "text/plain" };
|
|
234
235
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
236
|
+
if (clientIdentity) headers["X-Haven-Client"] = clientIdentity;
|
|
235
237
|
let res;
|
|
236
238
|
try {
|
|
237
239
|
res = await fetchImpl(`${root}${path}`, { method: "GET", headers });
|
|
@@ -603,7 +605,8 @@ async function runConnector(connectorCommand, spawner, onStderr) {
|
|
|
603
605
|
|
|
604
606
|
// src/commands.ts
|
|
605
607
|
var DEFAULT_API = "https://havenbackend-production-8a00.up.railway.app";
|
|
606
|
-
var CLI_VERSION = "0.0.0-dev.
|
|
608
|
+
var CLI_VERSION = "0.0.0-dev.202609251409.98ed67a";
|
|
609
|
+
var CLI_CLIENT_IDENTITY = `@haven_ai/cli/${CLI_VERSION}`;
|
|
607
610
|
function accountAddressOf(s) {
|
|
608
611
|
return s.account_address ?? "";
|
|
609
612
|
}
|
|
@@ -616,7 +619,7 @@ async function run(argv, deps = {}) {
|
|
|
616
619
|
const o = createOutput(json, out, err);
|
|
617
620
|
const d = {
|
|
618
621
|
sessionStore: deps.sessionStore ?? createSessionStore(),
|
|
619
|
-
makeApi: deps.makeApi ?? ((baseUrl, token) => createCliApi({ baseUrl, token })),
|
|
622
|
+
makeApi: deps.makeApi ?? ((baseUrl, token) => createCliApi({ baseUrl, token, clientIdentity: CLI_CLIENT_IDENTITY })),
|
|
620
623
|
promptPassword: deps.promptPassword ?? (() => Promise.reject(new Error("No password input available"))),
|
|
621
624
|
sleep: deps.sleep ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms))),
|
|
622
625
|
spawner: deps.spawner ?? nodeSpawner,
|