@character-foundry/character-foundry 0.4.2-dev.1765997746 → 0.4.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.
Files changed (57) hide show
  1. package/dist/charx.cjs +36 -15
  2. package/dist/charx.cjs.map +1 -1
  3. package/dist/charx.d.cts +9 -18
  4. package/dist/charx.d.ts +9 -18
  5. package/dist/charx.js +36 -15
  6. package/dist/charx.js.map +1 -1
  7. package/dist/exporter.cjs +38 -34
  8. package/dist/exporter.cjs.map +1 -1
  9. package/dist/exporter.d.cts +9 -18
  10. package/dist/exporter.d.ts +9 -18
  11. package/dist/exporter.js +38 -34
  12. package/dist/exporter.js.map +1 -1
  13. package/dist/federation.cjs +36 -104
  14. package/dist/federation.cjs.map +1 -1
  15. package/dist/federation.d.cts +9 -53
  16. package/dist/federation.d.ts +9 -53
  17. package/dist/federation.js +36 -104
  18. package/dist/federation.js.map +1 -1
  19. package/dist/index.cjs +38 -34
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +21 -42
  22. package/dist/index.d.ts +21 -42
  23. package/dist/index.js +38 -34
  24. package/dist/index.js.map +1 -1
  25. package/dist/loader.cjs +15 -101
  26. package/dist/loader.cjs.map +1 -1
  27. package/dist/loader.d.cts +14 -42
  28. package/dist/loader.d.ts +14 -42
  29. package/dist/loader.js +15 -101
  30. package/dist/loader.js.map +1 -1
  31. package/dist/lorebook.d.cts +17 -34
  32. package/dist/lorebook.d.ts +17 -34
  33. package/dist/normalizer.cjs +2 -2
  34. package/dist/normalizer.cjs.map +1 -1
  35. package/dist/normalizer.d.cts +30 -60
  36. package/dist/normalizer.d.ts +30 -60
  37. package/dist/normalizer.js +2 -2
  38. package/dist/normalizer.js.map +1 -1
  39. package/dist/png.cjs +2 -2
  40. package/dist/png.cjs.map +1 -1
  41. package/dist/png.d.cts +16 -32
  42. package/dist/png.d.ts +16 -32
  43. package/dist/png.js +2 -2
  44. package/dist/png.js.map +1 -1
  45. package/dist/schemas.cjs +7 -7
  46. package/dist/schemas.cjs.map +1 -1
  47. package/dist/schemas.d.cts +48 -96
  48. package/dist/schemas.d.ts +48 -96
  49. package/dist/schemas.js +7 -7
  50. package/dist/schemas.js.map +1 -1
  51. package/dist/voxta.cjs +4 -21
  52. package/dist/voxta.cjs.map +1 -1
  53. package/dist/voxta.d.cts +14 -28
  54. package/dist/voxta.d.ts +14 -28
  55. package/dist/voxta.js +4 -21
  56. package/dist/voxta.js.map +1 -1
  57. package/package.json +6 -6
@@ -41,8 +41,7 @@ declare const CCv3DataSchema: z.ZodObject<{
41
41
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
42
42
  z.ZodEnum<[
43
43
  "before_char",
44
- "after_char",
45
- "in_chat"
44
+ "after_char"
46
45
  ]>,
47
46
  z.ZodNumber,
48
47
  z.ZodLiteral<"">
@@ -85,8 +84,7 @@ declare const CCv3DataSchema: z.ZodObject<{
85
84
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
86
85
  z.ZodEnum<[
87
86
  "before_char",
88
- "after_char",
89
- "in_chat"
87
+ "after_char"
90
88
  ]>,
91
89
  z.ZodNumber,
92
90
  z.ZodLiteral<"">
@@ -129,8 +127,7 @@ declare const CCv3DataSchema: z.ZodObject<{
129
127
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
130
128
  z.ZodEnum<[
131
129
  "before_char",
132
- "after_char",
133
- "in_chat"
130
+ "after_char"
134
131
  ]>,
135
132
  z.ZodNumber,
136
133
  z.ZodLiteral<"">
@@ -175,8 +172,7 @@ declare const CCv3DataSchema: z.ZodObject<{
175
172
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
176
173
  z.ZodEnum<[
177
174
  "before_char",
178
- "after_char",
179
- "in_chat"
175
+ "after_char"
180
176
  ]>,
181
177
  z.ZodNumber,
182
178
  z.ZodLiteral<"">
@@ -227,8 +223,7 @@ declare const CCv3DataSchema: z.ZodObject<{
227
223
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
228
224
  z.ZodEnum<[
229
225
  "before_char",
230
- "after_char",
231
- "in_chat"
226
+ "after_char"
232
227
  ]>,
233
228
  z.ZodNumber,
234
229
  z.ZodLiteral<"">
@@ -327,8 +322,7 @@ declare const CCv3DataSchema: z.ZodObject<{
327
322
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
328
323
  z.ZodEnum<[
329
324
  "before_char",
330
- "after_char",
331
- "in_chat"
325
+ "after_char"
332
326
  ]>,
333
327
  z.ZodNumber,
334
328
  z.ZodLiteral<"">
@@ -403,8 +397,7 @@ declare const CCv3DataSchema: z.ZodObject<{
403
397
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
404
398
  z.ZodEnum<[
405
399
  "before_char",
406
- "after_char",
407
- "in_chat"
400
+ "after_char"
408
401
  ]>,
409
402
  z.ZodNumber,
410
403
  z.ZodLiteral<"">
@@ -489,8 +482,7 @@ declare const CCv3DataSchema: z.ZodObject<{
489
482
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
490
483
  z.ZodEnum<[
491
484
  "before_char",
492
- "after_char",
493
- "in_chat"
485
+ "after_char"
494
486
  ]>,
495
487
  z.ZodNumber,
496
488
  z.ZodLiteral<"">
@@ -569,8 +561,7 @@ declare const CCv3DataSchema: z.ZodObject<{
569
561
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
570
562
  z.ZodEnum<[
571
563
  "before_char",
572
- "after_char",
573
- "in_chat"
564
+ "after_char"
574
565
  ]>,
575
566
  z.ZodNumber,
576
567
  z.ZodLiteral<"">
@@ -628,23 +619,6 @@ declare const CCv3DataSchema: z.ZodObject<{
628
619
  * Character Card v3 full structure
629
620
  */
630
621
  export type CCv3Data = z.infer<typeof CCv3DataSchema>;
631
- /**
632
- * Federation Logger
633
- *
634
- * Lightweight logger with configurable verbosity and a safe default (warn).
635
- * No external dependencies.
636
- */
637
- export type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
638
- export interface Logger {
639
- debug: (...args: unknown[]) => void;
640
- info: (...args: unknown[]) => void;
641
- warn: (...args: unknown[]) => void;
642
- error: (...args: unknown[]) => void;
643
- }
644
- export declare function createConsoleLogger(level?: LogLevel): Logger;
645
- declare function getLogger(): Logger;
646
- declare function setLogger(logger: Logger): void;
647
- declare function setLogLevel(level: LogLevel): void;
648
622
  /**
649
623
  * Federation Types
650
624
  *
@@ -1004,17 +978,6 @@ export interface InboxHandlerOptions {
1004
978
  strictMode?: boolean;
1005
979
  /** Maximum age for signatures in seconds (default 300) */
1006
980
  maxAge?: number;
1007
- /**
1008
- * Optional shared network key for internal-only federation.
1009
- *
1010
- * When set, incoming requests must include a matching network key header.
1011
- * In strictMode, the header must also be included in the signed header list.
1012
- */
1013
- networkKey?: string;
1014
- /**
1015
- * Header name for the shared network key (default: X-Foundry-Network-Key)
1016
- */
1017
- networkKeyHeader?: string;
1018
981
  }
1019
982
  /**
1020
983
  * ActivityPub Utilities
@@ -3135,10 +3098,6 @@ export declare class RateLimiter {
3135
3098
  */
3136
3099
  export declare function enableFederation(options?: {
3137
3100
  skipEnvCheck?: boolean;
3138
- /** Optional logger override */
3139
- logger?: Logger;
3140
- /** Optional log level (used when logger is not provided). Default: warn */
3141
- logLevel?: LogLevel;
3142
3101
  }): void;
3143
3102
  /**
3144
3103
  * Check if federation is enabled
@@ -3154,9 +3113,6 @@ export declare function isFederationEnabled(): boolean;
3154
3113
  export declare function assertFederationEnabled(feature: string): void;
3155
3114
 
3156
3115
  export {
3157
- getLogger as getFederationLogger,
3158
- setLogLevel as setFederationLogLevel,
3159
- setLogger as setFederationLogger,
3160
3116
  validateActivitySignature as validateHttpSignature,
3161
3117
  validateBlockActivity as validateBlockActivityFields,
3162
3118
  validateFlagActivity as validateFlagActivityFields,
@@ -41,8 +41,7 @@ declare const CCv3DataSchema: z.ZodObject<{
41
41
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
42
42
  z.ZodEnum<[
43
43
  "before_char",
44
- "after_char",
45
- "in_chat"
44
+ "after_char"
46
45
  ]>,
47
46
  z.ZodNumber,
48
47
  z.ZodLiteral<"">
@@ -85,8 +84,7 @@ declare const CCv3DataSchema: z.ZodObject<{
85
84
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
86
85
  z.ZodEnum<[
87
86
  "before_char",
88
- "after_char",
89
- "in_chat"
87
+ "after_char"
90
88
  ]>,
91
89
  z.ZodNumber,
92
90
  z.ZodLiteral<"">
@@ -129,8 +127,7 @@ declare const CCv3DataSchema: z.ZodObject<{
129
127
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
130
128
  z.ZodEnum<[
131
129
  "before_char",
132
- "after_char",
133
- "in_chat"
130
+ "after_char"
134
131
  ]>,
135
132
  z.ZodNumber,
136
133
  z.ZodLiteral<"">
@@ -175,8 +172,7 @@ declare const CCv3DataSchema: z.ZodObject<{
175
172
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
176
173
  z.ZodEnum<[
177
174
  "before_char",
178
- "after_char",
179
- "in_chat"
175
+ "after_char"
180
176
  ]>,
181
177
  z.ZodNumber,
182
178
  z.ZodLiteral<"">
@@ -227,8 +223,7 @@ declare const CCv3DataSchema: z.ZodObject<{
227
223
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
228
224
  z.ZodEnum<[
229
225
  "before_char",
230
- "after_char",
231
- "in_chat"
226
+ "after_char"
232
227
  ]>,
233
228
  z.ZodNumber,
234
229
  z.ZodLiteral<"">
@@ -327,8 +322,7 @@ declare const CCv3DataSchema: z.ZodObject<{
327
322
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
328
323
  z.ZodEnum<[
329
324
  "before_char",
330
- "after_char",
331
- "in_chat"
325
+ "after_char"
332
326
  ]>,
333
327
  z.ZodNumber,
334
328
  z.ZodLiteral<"">
@@ -403,8 +397,7 @@ declare const CCv3DataSchema: z.ZodObject<{
403
397
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
404
398
  z.ZodEnum<[
405
399
  "before_char",
406
- "after_char",
407
- "in_chat"
400
+ "after_char"
408
401
  ]>,
409
402
  z.ZodNumber,
410
403
  z.ZodLiteral<"">
@@ -489,8 +482,7 @@ declare const CCv3DataSchema: z.ZodObject<{
489
482
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
490
483
  z.ZodEnum<[
491
484
  "before_char",
492
- "after_char",
493
- "in_chat"
485
+ "after_char"
494
486
  ]>,
495
487
  z.ZodNumber,
496
488
  z.ZodLiteral<"">
@@ -569,8 +561,7 @@ declare const CCv3DataSchema: z.ZodObject<{
569
561
  position: z.ZodOptional<z.ZodNullable<z.ZodUnion<[
570
562
  z.ZodEnum<[
571
563
  "before_char",
572
- "after_char",
573
- "in_chat"
564
+ "after_char"
574
565
  ]>,
575
566
  z.ZodNumber,
576
567
  z.ZodLiteral<"">
@@ -628,23 +619,6 @@ declare const CCv3DataSchema: z.ZodObject<{
628
619
  * Character Card v3 full structure
629
620
  */
630
621
  export type CCv3Data = z.infer<typeof CCv3DataSchema>;
631
- /**
632
- * Federation Logger
633
- *
634
- * Lightweight logger with configurable verbosity and a safe default (warn).
635
- * No external dependencies.
636
- */
637
- export type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
638
- export interface Logger {
639
- debug: (...args: unknown[]) => void;
640
- info: (...args: unknown[]) => void;
641
- warn: (...args: unknown[]) => void;
642
- error: (...args: unknown[]) => void;
643
- }
644
- export declare function createConsoleLogger(level?: LogLevel): Logger;
645
- declare function getLogger(): Logger;
646
- declare function setLogger(logger: Logger): void;
647
- declare function setLogLevel(level: LogLevel): void;
648
622
  /**
649
623
  * Federation Types
650
624
  *
@@ -1004,17 +978,6 @@ export interface InboxHandlerOptions {
1004
978
  strictMode?: boolean;
1005
979
  /** Maximum age for signatures in seconds (default 300) */
1006
980
  maxAge?: number;
1007
- /**
1008
- * Optional shared network key for internal-only federation.
1009
- *
1010
- * When set, incoming requests must include a matching network key header.
1011
- * In strictMode, the header must also be included in the signed header list.
1012
- */
1013
- networkKey?: string;
1014
- /**
1015
- * Header name for the shared network key (default: X-Foundry-Network-Key)
1016
- */
1017
- networkKeyHeader?: string;
1018
981
  }
1019
982
  /**
1020
983
  * ActivityPub Utilities
@@ -3135,10 +3098,6 @@ export declare class RateLimiter {
3135
3098
  */
3136
3099
  export declare function enableFederation(options?: {
3137
3100
  skipEnvCheck?: boolean;
3138
- /** Optional logger override */
3139
- logger?: Logger;
3140
- /** Optional log level (used when logger is not provided). Default: warn */
3141
- logLevel?: LogLevel;
3142
3101
  }): void;
3143
3102
  /**
3144
3103
  * Check if federation is enabled
@@ -3154,9 +3113,6 @@ export declare function isFederationEnabled(): boolean;
3154
3113
  export declare function assertFederationEnabled(feature: string): void;
3155
3114
 
3156
3115
  export {
3157
- getLogger as getFederationLogger,
3158
- setLogLevel as setFederationLogLevel,
3159
- setLogger as setFederationLogger,
3160
3116
  validateActivitySignature as validateHttpSignature,
3161
3117
  validateBlockActivity as validateBlockActivityFields,
3162
3118
  validateFlagActivity as validateFlagActivityFields,
@@ -44,50 +44,6 @@ function generateUUID() {
44
44
  }
45
45
 
46
46
  // ../federation/dist/index.js
47
- var LEVELS = {
48
- silent: 0,
49
- error: 1,
50
- warn: 2,
51
- info: 3,
52
- debug: 4
53
- };
54
- var noop = () => {
55
- };
56
- function createConsoleLogger(level = "warn") {
57
- const severity = LEVELS[level] ?? LEVELS.warn;
58
- const hasConsole = typeof console !== "undefined";
59
- const c = hasConsole ? console : void 0;
60
- const debugImpl = c?.debug ? c.debug.bind(c) : c?.log ? c.log.bind(c) : noop;
61
- const infoImpl = c?.info ? c.info.bind(c) : c?.log ? c.log.bind(c) : noop;
62
- const warnImpl = c?.warn ? c.warn.bind(c) : c?.log ? c.log.bind(c) : noop;
63
- const errorImpl = c?.error ? c.error.bind(c) : c?.log ? c.log.bind(c) : noop;
64
- return {
65
- debug: severity >= LEVELS.debug ? debugImpl : noop,
66
- info: severity >= LEVELS.info ? infoImpl : noop,
67
- warn: severity >= LEVELS.warn ? warnImpl : noop,
68
- error: severity >= LEVELS.error ? errorImpl : noop
69
- };
70
- }
71
- var federationLogger = createConsoleLogger("warn");
72
- function getLogger() {
73
- return federationLogger;
74
- }
75
- function setLogger(logger) {
76
- federationLogger = logger;
77
- }
78
- function setLogLevel(level) {
79
- federationLogger = createConsoleLogger(level);
80
- }
81
- function configureLogger(options) {
82
- if (!options) return;
83
- if (options.logger) {
84
- setLogger(options.logger);
85
- return;
86
- }
87
- if (options.logLevel) {
88
- setLogLevel(options.logLevel);
89
- }
90
- }
91
47
  var ACTIVITY_CONTEXT = [
92
48
  "https://www.w3.org/ns/activitystreams",
93
49
  {
@@ -446,7 +402,7 @@ var SyncEngine = class {
446
402
  try {
447
403
  listener(event);
448
404
  } catch (err) {
449
- getLogger().error("[federation] Event listener error:", err);
405
+ console.error(`Event listener error:`, err);
450
406
  }
451
407
  }
452
408
  }
@@ -1575,7 +1531,7 @@ var HttpPlatformAdapter = class extends BasePlatformAdapter {
1575
1531
  const data = await response.json();
1576
1532
  return this.config.transformers?.get ? this.config.transformers.get(data) : data;
1577
1533
  } catch (err) {
1578
- getLogger().error(`[federation] Failed to get card ${localId}:`, err);
1534
+ console.error(`Failed to get card ${localId}:`, err);
1579
1535
  return null;
1580
1536
  }
1581
1537
  }
@@ -2127,14 +2083,27 @@ function parseSignatureHeader(header) {
2127
2083
  return {
2128
2084
  keyId: params.keyId,
2129
2085
  algorithm: params.algorithm || "rsa-sha256",
2130
- headers: (params.headers || "(request-target) host date").trim().split(/\s+/).filter(Boolean).map((h) => h.toLowerCase()),
2086
+ headers: (params.headers || "(request-target) host date").split(" "),
2131
2087
  signature: params.signature
2132
2088
  };
2133
2089
  }
2134
2090
  function buildSigningString(method, path, headers, headerNames) {
2135
2091
  const result = buildSigningStringStrict(method, path, headers, headerNames);
2136
2092
  if (!result.success) {
2137
- throw new Error(result.error);
2093
+ console.warn(`[federation] Signature verification may fail: ${result.error}`);
2094
+ const lines = [];
2095
+ for (const name of headerNames) {
2096
+ if (name === "(request-target)") {
2097
+ lines.push(`(request-target): ${method.toLowerCase()} ${path}`);
2098
+ } else if (name === "(created)" || name === "(expires)") {
2099
+ } else {
2100
+ const value = headers.get(name);
2101
+ if (value !== null) {
2102
+ lines.push(`${name.toLowerCase()}: ${value}`);
2103
+ }
2104
+ }
2105
+ }
2106
+ return lines.join("\n");
2138
2107
  }
2139
2108
  return result.signingString;
2140
2109
  }
@@ -2143,17 +2112,16 @@ function buildSigningStringStrict(method, path, headers, headerNames) {
2143
2112
  const missingHeaders = [];
2144
2113
  const syntheticHeaders = /* @__PURE__ */ new Set(["(request-target)", "(created)", "(expires)"]);
2145
2114
  for (const name of headerNames) {
2146
- const normalizedName = name.toLowerCase();
2147
- if (normalizedName === "(request-target)") {
2115
+ if (name === "(request-target)") {
2148
2116
  lines.push(`(request-target): ${method.toLowerCase()} ${path}`);
2149
- } else if (normalizedName === "(created)") {
2150
- } else if (normalizedName === "(expires)") {
2117
+ } else if (name === "(created)") {
2118
+ } else if (name === "(expires)") {
2151
2119
  } else {
2152
- const value = headers.get(normalizedName);
2120
+ const value = headers.get(name);
2153
2121
  if (value !== null) {
2154
- lines.push(`${normalizedName}: ${value}`);
2155
- } else if (!syntheticHeaders.has(normalizedName)) {
2156
- missingHeaders.push(normalizedName);
2122
+ lines.push(`${name.toLowerCase()}: ${value}`);
2123
+ } else if (!syntheticHeaders.has(name)) {
2124
+ missingHeaders.push(name);
2157
2125
  }
2158
2126
  }
2159
2127
  }
@@ -2174,7 +2142,7 @@ async function verifyHttpSignature(parsed, publicKeyPem, method, path, headers,
2174
2142
  if (options.strictHeaders) {
2175
2143
  const strictResult = buildSigningStringStrict(method, path, headers, parsed.headers);
2176
2144
  if (!strictResult.success) {
2177
- getLogger().warn(`[federation] Strict header verification failed: ${strictResult.error}`);
2145
+ console.warn(`[federation] Strict header verification failed: ${strictResult.error}`);
2178
2146
  return false;
2179
2147
  }
2180
2148
  }
@@ -2194,7 +2162,7 @@ async function verifyHttpSignature(parsed, publicKeyPem, method, path, headers,
2194
2162
  data
2195
2163
  );
2196
2164
  } catch (error) {
2197
- getLogger().error("[federation] Signature verification failed:", error);
2165
+ console.error("Signature verification failed:", error);
2198
2166
  return false;
2199
2167
  }
2200
2168
  }
@@ -2332,7 +2300,7 @@ async function importPublicKey(pem) {
2332
2300
  ["verify"]
2333
2301
  );
2334
2302
  } catch (error) {
2335
- getLogger().error("[federation] Failed to import public key:", error);
2303
+ console.error("Failed to import public key:", error);
2336
2304
  return null;
2337
2305
  }
2338
2306
  }
@@ -2348,7 +2316,7 @@ async function importPrivateKey(pem) {
2348
2316
  ["sign"]
2349
2317
  );
2350
2318
  } catch (error) {
2351
- getLogger().error("[federation] Failed to import private key:", error);
2319
+ console.error("Failed to import private key:", error);
2352
2320
  return null;
2353
2321
  }
2354
2322
  }
@@ -2377,31 +2345,9 @@ function extractHostFromActorId(actorId) {
2377
2345
  return null;
2378
2346
  }
2379
2347
  }
2380
- function timingSafeEqualString(a, b) {
2381
- let mismatch = a.length === b.length ? 0 : 1;
2382
- const maxLen = Math.max(a.length, b.length);
2383
- for (let i = 0; i < maxLen; i++) {
2384
- const aCode = a.charCodeAt(i) || 0;
2385
- const bCode = b.charCodeAt(i) || 0;
2386
- mismatch |= aCode ^ bCode;
2387
- }
2388
- return mismatch === 0;
2389
- }
2390
2348
  async function handleInbox(body, headers, options) {
2391
2349
  assertFederationEnabled("handleInbox");
2392
2350
  try {
2393
- const normalizedHeaders = headers instanceof Headers ? headers : new Headers(headers);
2394
- const networkKey = typeof options.networkKey === "string" ? options.networkKey : void 0;
2395
- const networkKeyHeader = options.networkKeyHeader ?? "X-Foundry-Network-Key";
2396
- if (networkKey && networkKey.length > 0) {
2397
- const provided = normalizedHeaders.get(networkKeyHeader);
2398
- if (!provided || !timingSafeEqualString(provided, networkKey)) {
2399
- return {
2400
- accepted: false,
2401
- error: "Unauthorized: invalid or missing network key"
2402
- };
2403
- }
2404
- }
2405
2351
  if (options.moderationStore) {
2406
2352
  const actorId = typeof body === "object" && body !== null && "actor" in body ? String(body.actor) : null;
2407
2353
  if (actorId) {
@@ -2424,7 +2370,7 @@ async function handleInbox(body, headers, options) {
2424
2370
  };
2425
2371
  }
2426
2372
  if (options.strictMode) {
2427
- const signatureHeader = normalizedHeaders.get("signature");
2373
+ const signatureHeader = headers instanceof Headers ? headers.get("signature") : headers["signature"] || headers["Signature"];
2428
2374
  if (!signatureHeader) {
2429
2375
  return {
2430
2376
  accepted: false,
@@ -2438,15 +2384,6 @@ async function handleInbox(body, headers, options) {
2438
2384
  error: "Invalid Signature header format"
2439
2385
  };
2440
2386
  }
2441
- if (networkKey && networkKey.length > 0) {
2442
- const requiredSigned = networkKeyHeader.toLowerCase();
2443
- if (!parsedSig.headers.includes(requiredSigned)) {
2444
- return {
2445
- accepted: false,
2446
- error: `Strict mode: signature missing required header: ${requiredSigned}`
2447
- };
2448
- }
2449
- }
2450
2387
  const missingSignedHeaders = REQUIRED_SIGNED_HEADERS.filter(
2451
2388
  (h) => !parsedSig.headers.includes(h)
2452
2389
  );
@@ -2456,14 +2393,14 @@ async function handleInbox(body, headers, options) {
2456
2393
  error: `Strict mode: signature missing required headers: ${missingSignedHeaders.join(", ")}`
2457
2394
  };
2458
2395
  }
2459
- const dateHeader = normalizedHeaders.get("date");
2396
+ const dateHeader = headers instanceof Headers ? headers.get("date") : headers["date"] || headers["Date"];
2460
2397
  if (!dateHeader) {
2461
2398
  return {
2462
2399
  accepted: false,
2463
2400
  error: "Strict mode: Date header required"
2464
2401
  };
2465
2402
  }
2466
- const hostHeader = normalizedHeaders.get("host");
2403
+ const hostHeader = headers instanceof Headers ? headers.get("host") : headers["host"] || headers["Host"];
2467
2404
  if (!hostHeader) {
2468
2405
  return {
2469
2406
  accepted: false,
@@ -2506,7 +2443,7 @@ async function handleInbox(body, headers, options) {
2506
2443
  error: `Invalid key ID or actor URL`
2507
2444
  };
2508
2445
  }
2509
- const digestHeader = normalizedHeaders.get("digest");
2446
+ const digestHeader = headers instanceof Headers ? headers.get("digest") : headers["digest"] || headers["Digest"];
2510
2447
  if (digestHeader) {
2511
2448
  if (!options.rawBody) {
2512
2449
  return {
@@ -2537,13 +2474,13 @@ async function handleInbox(body, headers, options) {
2537
2474
  }
2538
2475
  const method = options.method || "POST";
2539
2476
  const path = options.path || "/inbox";
2477
+ const normalizedHeaders = headers instanceof Headers ? headers : new Headers(headers);
2540
2478
  const isValid = await verifyHttpSignature(
2541
2479
  parsedSig,
2542
2480
  actor.publicKey.publicKeyPem,
2543
2481
  method,
2544
2482
  path,
2545
- normalizedHeaders,
2546
- { strictHeaders: true }
2483
+ normalizedHeaders
2547
2484
  );
2548
2485
  if (!isValid) {
2549
2486
  return {
@@ -3622,7 +3559,7 @@ var PolicyEngine = class {
3622
3559
  if (!regex) {
3623
3560
  const safetyWarning = checkRegexSafety(rule.pattern);
3624
3561
  if (safetyWarning) {
3625
- getLogger().warn(`[moderation] Rule "${rule.name}": ${safetyWarning}`);
3562
+ console.warn(`[moderation] Rule "${rule.name}": ${safetyWarning}`);
3626
3563
  }
3627
3564
  try {
3628
3565
  regex = new RegExp(rule.pattern, "i");
@@ -3862,12 +3799,11 @@ function getEnvVar(name) {
3862
3799
  return void 0;
3863
3800
  }
3864
3801
  function enableFederation(options) {
3865
- configureLogger(options);
3866
3802
  explicitlyEnabled = true;
3867
3803
  envCheckSkipped = options?.skipEnvCheck ?? false;
3868
3804
  const nodeEnv = getEnvVar("NODE_ENV");
3869
3805
  if (nodeEnv === "development" || nodeEnv === "test") {
3870
- getLogger().warn(
3806
+ console.warn(
3871
3807
  "[character-foundry/federation] Federation enabled. WARNING: Verify HTTP signatures in production. Do NOT use in production with untrusted inputs without signature validation."
3872
3808
  );
3873
3809
  }
@@ -3931,7 +3867,6 @@ export {
3931
3867
  createAnnounceActivity,
3932
3868
  createArchiveAdapter,
3933
3869
  createBlockActivity,
3934
- createConsoleLogger,
3935
3870
  createCreateActivity,
3936
3871
  createDeleteActivity,
3937
3872
  createFlagActivity,
@@ -3946,7 +3881,6 @@ export {
3946
3881
  enableFederation,
3947
3882
  generateActivityId,
3948
3883
  generateCardId,
3949
- getLogger as getFederationLogger,
3950
3884
  handleActor,
3951
3885
  handleInbox,
3952
3886
  handleNodeInfo,
@@ -3959,8 +3893,6 @@ export {
3959
3893
  parseForkActivity,
3960
3894
  parseInstallActivity,
3961
3895
  parseSignatureHeader,
3962
- setLogLevel as setFederationLogLevel,
3963
- setLogger as setFederationLogger,
3964
3896
  signRequest,
3965
3897
  stCharacterToCCv3,
3966
3898
  validateBlockActivity as validateBlockActivityFields,