@chatpanel/gateway 0.6.8 → 0.6.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/gateway",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "Local privacy gateway — redacts PII out of OpenAI/Anthropic API traffic before it reaches a model, then restores it in the reply. Point opencode, codex, aider, Claude Code, etc. at it.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/log.js ADDED
@@ -0,0 +1,21 @@
1
+ // Timestamped console. Gateway logs (NER lifecycle, per-request redaction lines,
2
+ // entitlement refresh) are useless for debugging without a clock — prefix every
3
+ // console line with a local YYYY-MM-DD HH:MM:SS stamp. Call once at startup,
4
+ // before anything logs. Idempotent (won't double-wrap if called twice).
5
+
6
+ let installed = false;
7
+
8
+ function stamp(d = new Date()) {
9
+ const p = (n, w = 2) => String(n).padStart(w, '0');
10
+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} `
11
+ + `${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
12
+ }
13
+
14
+ export function installTimestampedConsole() {
15
+ if (installed) return;
16
+ installed = true;
17
+ for (const method of ['log', 'info', 'warn', 'error']) {
18
+ const orig = console[method].bind(console);
19
+ console[method] = (...args) => orig(`[${stamp()}]`, ...args);
20
+ }
21
+ }
package/src/server.js CHANGED
@@ -27,6 +27,7 @@ import { streamBridgeChat, readBridgeToken, openBridgeChat } from './bridge.js';
27
27
  import { createRelaySession, getRelaySession, endRelaySession, pumpBridgeStream, deliverToolResult, toolsToSpecs, parseToolCallId } from './toolrelay.js';
28
28
  import { shaperFor } from './shape.js';
29
29
  import { startNer } from './ner.js';
30
+ import { installTimestampedConsole } from './log.js';
30
31
  import * as nerEngine from './ner-engine.js';
31
32
  import { MODEL_CATALOG, isKnownModel } from './models.js';
32
33
  import { resolvePro, checkQuota, consume, usage } from './freegate.js';
@@ -36,7 +37,7 @@ import * as openai from './openai.js';
36
37
  import * as responses from './responses.js';
37
38
  import * as anthropic from './anthropic.js';
38
39
 
39
- export const VERSION = '0.6.8';
40
+ export const VERSION = '0.6.9';
40
41
 
41
42
  const KNOWN_AGENTS = new Set(['codex', 'claude', 'opencode', 'pi', 'kiro', 'antigravity']);
42
43
 
@@ -704,6 +705,7 @@ export function createGateway(cfg = loadConfig()) {
704
705
  }
705
706
 
706
707
  export function start(cfg = loadConfig()) {
708
+ installTimestampedConsole(); // every gateway log line gets a clock — before anything logs
707
709
  const server = createGateway(cfg);
708
710
  const ner = startNer(cfg); // may mutate cfg.redaction when it comes up
709
711
  // Re-validate the stored Pro entitlement online on an interval, so a refunded /