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