@agentvault/agentvault 0.13.0 → 0.13.2

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.
@@ -0,0 +1,33 @@
1
+ export interface HttpCallReport {
2
+ method: string;
3
+ url: string;
4
+ statusCode: number;
5
+ latencyMs: number;
6
+ traceId?: string;
7
+ parentSpanId?: string;
8
+ }
9
+ export interface TraceContext {
10
+ traceId: string;
11
+ parentSpanId: string;
12
+ }
13
+ export interface FetchInterceptorOptions {
14
+ onHttpCall: (report: HttpCallReport) => void;
15
+ skipPatterns?: RegExp[];
16
+ }
17
+ /**
18
+ * Replace globalThis.fetch with an intercepting wrapper.
19
+ * Idempotent: calling twice with different options updates the options
20
+ * but does not double-patch.
21
+ */
22
+ export declare function installFetchInterceptor(opts: FetchInterceptorOptions): void;
23
+ /**
24
+ * Restore the original globalThis.fetch. Safe to call even if not installed.
25
+ */
26
+ export declare function uninstallFetchInterceptor(): void;
27
+ /**
28
+ * Run an async function with trace context attached via AsyncLocalStorage.
29
+ * Any fetch calls made within `fn` will include traceId/parentSpanId in
30
+ * their HttpCallReport.
31
+ */
32
+ export declare function runWithTraceContext<T>(ctx: TraceContext, fn: () => T | Promise<T>): Promise<T>;
33
+ //# sourceMappingURL=fetch-interceptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-interceptor.d.ts","sourceRoot":"","sources":["../src/fetch-interceptor.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAmBD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,uBAAuB,GAAG,IAAI,CA8E3E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAMhD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,GAAG,EAAE,YAAY,EACjB,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC,CAEZ"}
package/dist/index.js CHANGED
@@ -45728,6 +45728,22 @@ var SecureChannel = class _SecureChannel extends EventEmitter {
45728
45728
  );
45729
45729
  }
45730
45730
  }
45731
+ /**
45732
+ * Send an activity span to all owner devices via WS.
45733
+ * Ephemeral (unencrypted metadata, like typing), no ratchet advancement.
45734
+ */
45735
+ sendActivitySpan(spanData) {
45736
+ if (!this._ws || this._ws.readyState !== WebSocket.OPEN) return;
45737
+ this._ws.send(
45738
+ JSON.stringify({
45739
+ event: "activity_span",
45740
+ data: {
45741
+ ...spanData,
45742
+ agent_name: this.config.agentName ?? "Agent"
45743
+ }
45744
+ })
45745
+ );
45746
+ }
45731
45747
  /**
45732
45748
  * Send a decision request to the owner.
45733
45749
  * Builds a structured envelope with decision metadata and sends it