@haven_ai/cli 0.4.0-alpha.0 → 0.5.0-alpha.1

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 CHANGED
@@ -142,6 +142,7 @@ function helpText() {
142
142
  " budget show <agentId> --hashes Its delegation hashes \u2014 the second",
143
143
  " argument `budget revoke` takes, printed nowhere else",
144
144
  " activity list [--safe <id|address>] [--agent <id>] [--direction in|out] [--limit <n>] [--offset <n>]",
145
+ " Wallet-scoped history; --agent narrows it (--json rows carry scope, timestampSource)",
145
146
  " activity export [filters] Emit CSV to stdout (--format csv, default)",
146
147
  " activity export --format sie [--from <ISO>] [--to <ISO>] [--company <name>]",
147
148
  " Bookkeeping-ready SIE 4I (Fortnox/Visma/Bokio)",
@@ -200,11 +201,12 @@ var CliApiError = class extends Error {
200
201
  this.body = body;
201
202
  }
202
203
  };
203
- function createCliApi({ baseUrl, token, fetchImpl = fetch }) {
204
+ function createCliApi({ baseUrl, token, fetchImpl = fetch, clientIdentity }) {
204
205
  const root = baseUrl.replace(/\/+$/, "");
205
206
  async function request(method, path, body) {
206
207
  const headers = { Accept: "application/json" };
207
208
  if (token) headers.Authorization = `Bearer ${token}`;
209
+ if (clientIdentity) headers["X-Haven-Client"] = clientIdentity;
208
210
  if (body !== void 0) headers["Content-Type"] = "application/json";
209
211
  let res;
210
212
  try {
@@ -233,6 +235,7 @@ function createCliApi({ baseUrl, token, fetchImpl = fetch }) {
233
235
  async function requestText(path) {
234
236
  const headers = { Accept: "text/plain" };
235
237
  if (token) headers.Authorization = `Bearer ${token}`;
238
+ if (clientIdentity) headers["X-Haven-Client"] = clientIdentity;
236
239
  let res;
237
240
  try {
238
241
  res = await fetchImpl(`${root}${path}`, { method: "GET", headers });
@@ -604,7 +607,8 @@ async function runConnector(connectorCommand, spawner, onStderr) {
604
607
 
605
608
  // src/commands.ts
606
609
  var DEFAULT_API = "https://havenbackend-production-8a00.up.railway.app";
607
- var CLI_VERSION = "0.4.0-alpha.0";
610
+ var CLI_VERSION = "0.5.0-alpha.1";
611
+ var CLI_CLIENT_IDENTITY = `@haven_ai/cli/${CLI_VERSION}`;
608
612
  function accountAddressOf(s) {
609
613
  return s.account_address ?? "";
610
614
  }
@@ -617,7 +621,7 @@ async function run(argv, deps = {}) {
617
621
  const o = createOutput(json, out, err);
618
622
  const d = {
619
623
  sessionStore: deps.sessionStore ?? createSessionStore(),
620
- makeApi: deps.makeApi ?? ((baseUrl, token) => createCliApi({ baseUrl, token })),
624
+ makeApi: deps.makeApi ?? ((baseUrl, token) => createCliApi({ baseUrl, token, clientIdentity: CLI_CLIENT_IDENTITY })),
621
625
  promptPassword: deps.promptPassword ?? (() => Promise.reject(new Error("No password input available"))),
622
626
  sleep: deps.sleep ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms))),
623
627
  spawner: deps.spawner ?? nodeSpawner,