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