@riotprompt/riotprompt 0.0.21 → 1.0.0

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 (69) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/MIGRATION.md +235 -0
  3. package/README.md +2 -0
  4. package/SECURITY.md +132 -0
  5. package/dist/builder.js +6 -0
  6. package/dist/builder.js.map +1 -1
  7. package/dist/cli.js +481 -22
  8. package/dist/context-manager.js +1 -1
  9. package/dist/conversation-logger.d.ts +17 -1
  10. package/dist/conversation-logger.js +21 -17
  11. package/dist/conversation-logger.js.map +1 -1
  12. package/dist/conversation.js +1 -1
  13. package/dist/error-handling.d.ts +52 -0
  14. package/dist/error-handling.js +132 -0
  15. package/dist/error-handling.js.map +1 -0
  16. package/dist/formatter.js +1 -1
  17. package/dist/iteration-strategy.js +1 -1
  18. package/dist/loader.js +60 -12
  19. package/dist/loader.js.map +1 -1
  20. package/dist/logger.d.ts +52 -0
  21. package/dist/logger.js +114 -14
  22. package/dist/logger.js.map +1 -1
  23. package/dist/logging-config.d.ts +84 -0
  24. package/dist/logging-config.js +116 -0
  25. package/dist/logging-config.js.map +1 -0
  26. package/dist/message-builder.js +1 -1
  27. package/dist/model-config.js +1 -1
  28. package/dist/override.js +10 -4
  29. package/dist/override.js.map +1 -1
  30. package/dist/recipes.js +6 -0
  31. package/dist/recipes.js.map +1 -1
  32. package/dist/reflection.js +1 -1
  33. package/dist/riotprompt.d.ts +9 -0
  34. package/dist/riotprompt.js +8 -0
  35. package/dist/riotprompt.js.map +1 -1
  36. package/dist/security/audit-logger.d.ts +61 -0
  37. package/dist/security/audit-logger.js +281 -0
  38. package/dist/security/audit-logger.js.map +1 -0
  39. package/dist/security/cli-security.d.ts +143 -0
  40. package/dist/security/cli-security.js +302 -0
  41. package/dist/security/cli-security.js.map +1 -0
  42. package/dist/security/defaults.d.ts +31 -0
  43. package/dist/security/defaults.js +72 -0
  44. package/dist/security/defaults.js.map +1 -0
  45. package/dist/security/events.d.ts +8 -0
  46. package/dist/security/index.d.ts +27 -0
  47. package/dist/security/index.js +22 -0
  48. package/dist/security/index.js.map +1 -0
  49. package/dist/security/path-guard.d.ts +161 -0
  50. package/dist/security/path-guard.js +327 -0
  51. package/dist/security/path-guard.js.map +1 -0
  52. package/dist/security/rate-limiter.d.ts +117 -0
  53. package/dist/security/rate-limiter.js +165 -0
  54. package/dist/security/rate-limiter.js.map +1 -0
  55. package/dist/security/serialization-schemas.d.ts +183 -0
  56. package/dist/security/serialization-schemas.js +174 -0
  57. package/dist/security/serialization-schemas.js.map +1 -0
  58. package/dist/security/timeout-guard.d.ts +123 -0
  59. package/dist/security/timeout-guard.js +223 -0
  60. package/dist/security/timeout-guard.js.map +1 -0
  61. package/dist/security/types.d.ts +86 -0
  62. package/dist/security/types.js +80 -0
  63. package/dist/security/types.js.map +1 -0
  64. package/dist/token-budget.js +1 -1
  65. package/dist/tools.js +1 -1
  66. package/guide/index.md +2 -0
  67. package/guide/integration.md +1109 -0
  68. package/guide/security.md +237 -0
  69. package/package.json +17 -11
package/dist/logger.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ /**
2
+ * RiotPrompt - Logger
3
+ *
4
+ * Provides logging infrastructure backed by @fjell/logging for
5
+ * comprehensive sensitive data masking and structured logging.
6
+ */
7
+ /**
8
+ * Logger interface compatible with @fjell/logging
9
+ */
1
10
  export interface Logger {
2
11
  name: string;
3
12
  debug: (message: string, ...args: any[]) => void;
@@ -6,6 +15,49 @@ export interface Logger {
6
15
  error: (message: string, ...args: any[]) => void;
7
16
  verbose: (message: string, ...args: any[]) => void;
8
17
  silly: (message: string, ...args: any[]) => void;
18
+ /** Get a child logger for a component */
19
+ get?: (...components: string[]) => Logger;
9
20
  }
21
+ /**
22
+ * Silent logger that discards all output
23
+ * Use this as default to prevent accidental information disclosure
24
+ */
25
+ export declare const SILENT_LOGGER: Logger;
26
+ /**
27
+ * Default logger - silent by default to prevent information disclosure
28
+ *
29
+ * Enable logging by setting one of:
30
+ * - RIOTPROMPT_LOGGING=true
31
+ * - DEBUG=*riotprompt*
32
+ * - NODE_ENV=development
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * import { DEFAULT_LOGGER } from '@theunwalked/riotprompt';
37
+ *
38
+ * const logger = DEFAULT_LOGGER.get?.('MyComponent') ?? DEFAULT_LOGGER;
39
+ * logger.info('Processing request', { userId: 123 });
40
+ * ```
41
+ */
10
42
  export declare const DEFAULT_LOGGER: Logger;
43
+ /**
44
+ * Wrap an existing logger with library prefix
45
+ *
46
+ * @param toWrap - Logger to wrap
47
+ * @param name - Optional component name
48
+ * @returns Wrapped logger with library prefix
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const myLogger = wrapLogger(customLogger, 'MyComponent');
53
+ * myLogger.info('Hello'); // [riotprompt] [MyComponent]: Hello
54
+ * ```
55
+ */
11
56
  export declare const wrapLogger: (toWrap: Logger, name?: string) => Logger;
57
+ /**
58
+ * Create a console-based fallback logger (for environments without Fjell config)
59
+ *
60
+ * @param name - Logger name
61
+ * @returns Console-based logger
62
+ */
63
+ export declare function createConsoleLogger(name?: string): Logger;
package/dist/logger.js CHANGED
@@ -1,17 +1,99 @@
1
+ import Logging from '@fjell/logging';
1
2
  import { LIBRARY_NAME } from './constants.js';
2
3
 
3
- const DEFAULT_LOGGER = {
4
- name: 'default',
5
- debug: (message, ...args)=>console.debug(message, ...args),
6
- info: (message, ...args)=>console.info(message, ...args),
7
- warn: (message, ...args)=>console.warn(message, ...args),
8
- error: (message, ...args)=>console.error(message, ...args),
9
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
- verbose: (message, ...args)=>{},
11
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
- silly: (message, ...args)=>{}
4
+ // Get the library-level logger from Fjell
5
+ const LibLogger = Logging.getLogger('@theunwalked/riotprompt');
6
+ /**
7
+ * Create a silent logger with the given name
8
+ */ function createSilentLogger(name) {
9
+ return {
10
+ name,
11
+ debug: ()=>{},
12
+ info: ()=>{},
13
+ warn: ()=>{},
14
+ error: ()=>{},
15
+ verbose: ()=>{},
16
+ silly: ()=>{},
17
+ get: (...components)=>createSilentLogger(`${name}:${components.join(':')}`)
18
+ };
19
+ }
20
+ /**
21
+ * Silent logger that discards all output
22
+ * Use this as default to prevent accidental information disclosure
23
+ */ const SILENT_LOGGER = createSilentLogger('silent');
24
+ /**
25
+ * Check if logging is explicitly enabled via environment variable
26
+ */ const isLoggingEnabled = ()=>{
27
+ var _process_env_DEBUG;
28
+ return process.env.RIOTPROMPT_LOGGING === 'true' || ((_process_env_DEBUG = process.env.DEBUG) === null || _process_env_DEBUG === void 0 ? void 0 : _process_env_DEBUG.includes('riotprompt')) || process.env.NODE_ENV === 'development';
29
+ };
30
+ /**
31
+ * Create a Logger from a Fjell logger instance
32
+ */ function createLoggerFromFjell(fjellLogger, name) {
33
+ return {
34
+ name,
35
+ debug: (message, ...args)=>fjellLogger.debug(message, ...args),
36
+ info: (message, ...args)=>fjellLogger.info(message, ...args),
37
+ warn: (message, ...args)=>fjellLogger.warning(message, ...args),
38
+ error: (message, ...args)=>fjellLogger.error(message, ...args),
39
+ verbose: (message, ...args)=>fjellLogger.debug(message, ...args),
40
+ silly: (message, ...args)=>fjellLogger.debug(message, ...args),
41
+ get: (...components)=>{
42
+ const childLogger = fjellLogger.get(...components);
43
+ return createLoggerFromFjell(childLogger, `${name}:${components.join(':')}`);
44
+ }
45
+ };
46
+ }
47
+ /**
48
+ * Fjell-backed logger with sensitive data masking
49
+ *
50
+ * Features:
51
+ * - Automatic sensitive data masking (API keys, passwords, etc.)
52
+ * - Circular reference protection
53
+ * - Hierarchical component logging
54
+ * - Correlation ID support
55
+ */ const FJELL_LOGGER = {
56
+ name: 'fjell',
57
+ debug: (message, ...args)=>LibLogger.debug(message, ...args),
58
+ info: (message, ...args)=>LibLogger.info(message, ...args),
59
+ warn: (message, ...args)=>LibLogger.warning(message, ...args),
60
+ error: (message, ...args)=>LibLogger.error(message, ...args),
61
+ verbose: (message, ...args)=>LibLogger.debug(message, ...args),
62
+ silly: (message, ...args)=>LibLogger.debug(message, ...args),
63
+ get: (...components)=>{
64
+ const childLogger = LibLogger.get(...components);
65
+ return createLoggerFromFjell(childLogger, components.join(':'));
66
+ }
13
67
  };
14
- const wrapLogger = (toWrap, name)=>{
68
+ /**
69
+ * Default logger - silent by default to prevent information disclosure
70
+ *
71
+ * Enable logging by setting one of:
72
+ * - RIOTPROMPT_LOGGING=true
73
+ * - DEBUG=*riotprompt*
74
+ * - NODE_ENV=development
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * import { DEFAULT_LOGGER } from '@theunwalked/riotprompt';
79
+ *
80
+ * const logger = DEFAULT_LOGGER.get?.('MyComponent') ?? DEFAULT_LOGGER;
81
+ * logger.info('Processing request', { userId: 123 });
82
+ * ```
83
+ */ const DEFAULT_LOGGER = isLoggingEnabled() ? FJELL_LOGGER : SILENT_LOGGER;
84
+ /**
85
+ * Wrap an existing logger with library prefix
86
+ *
87
+ * @param toWrap - Logger to wrap
88
+ * @param name - Optional component name
89
+ * @returns Wrapped logger with library prefix
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * const myLogger = wrapLogger(customLogger, 'MyComponent');
94
+ * myLogger.info('Hello'); // [riotprompt] [MyComponent]: Hello
95
+ * ```
96
+ */ const wrapLogger = (toWrap, name)=>{
15
97
  const requiredMethods = [
16
98
  'debug',
17
99
  'info',
@@ -34,15 +116,33 @@ const wrapLogger = (toWrap, name)=>{
34
116
  else if (level === 'silly') toWrap.silly(message, ...args);
35
117
  };
36
118
  return {
37
- name: 'wrapped',
119
+ name: name || 'wrapped',
38
120
  debug: (message, ...args)=>log('debug', message, ...args),
39
121
  info: (message, ...args)=>log('info', message, ...args),
40
122
  warn: (message, ...args)=>log('warn', message, ...args),
41
123
  error: (message, ...args)=>log('error', message, ...args),
42
124
  verbose: (message, ...args)=>log('verbose', message, ...args),
43
- silly: (message, ...args)=>log('silly', message, ...args)
125
+ silly: (message, ...args)=>log('silly', message, ...args),
126
+ get: (...components)=>wrapLogger(toWrap, name ? `${name}:${components.join(':')}` : components.join(':'))
44
127
  };
45
128
  };
129
+ /**
130
+ * Create a console-based fallback logger (for environments without Fjell config)
131
+ *
132
+ * @param name - Logger name
133
+ * @returns Console-based logger
134
+ */ function createConsoleLogger(name = 'console') {
135
+ return {
136
+ name,
137
+ debug: (message, ...args)=>console.debug(`[DEBUG] [${name}]`, message, ...args),
138
+ info: (message, ...args)=>console.info(`[INFO] [${name}]`, message, ...args),
139
+ warn: (message, ...args)=>console.warn(`[WARN] [${name}]`, message, ...args),
140
+ error: (message, ...args)=>console.error(`[ERROR] [${name}]`, message, ...args),
141
+ verbose: ()=>{},
142
+ silly: ()=>{},
143
+ get: (...components)=>createConsoleLogger(`${name}:${components.join(':')}`)
144
+ };
145
+ }
46
146
 
47
- export { DEFAULT_LOGGER, wrapLogger };
147
+ export { DEFAULT_LOGGER, SILENT_LOGGER, createConsoleLogger, wrapLogger };
48
148
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sources":["../src/logger.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { LIBRARY_NAME } from \"./constants\";\n\nexport interface Logger {\n name: string;\n debug: (message: string, ...args: any[]) => void;\n info: (message: string, ...args: any[]) => void;\n warn: (message: string, ...args: any[]) => void;\n error: (message: string, ...args: any[]) => void;\n verbose: (message: string, ...args: any[]) => void;\n silly: (message: string, ...args: any[]) => void;\n}\n\nexport const DEFAULT_LOGGER: Logger = {\n name: 'default',\n debug: (message: string, ...args: any[]) => console.debug(message, ...args),\n info: (message: string, ...args: any[]) => console.info(message, ...args),\n warn: (message: string, ...args: any[]) => console.warn(message, ...args),\n error: (message: string, ...args: any[]) => console.error(message, ...args),\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n verbose: (message: string, ...args: any[]) => { },\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n silly: (message: string, ...args: any[]) => { },\n}\n\nexport const wrapLogger = (toWrap: Logger, name?: string): Logger => {\n\n const requiredMethods: (keyof Logger)[] = ['debug', 'info', 'warn', 'error', 'verbose', 'silly'];\n const missingMethods = requiredMethods.filter(method => typeof toWrap[method] !== 'function');\n\n if (missingMethods.length > 0) {\n throw new Error(`Logger is missing required methods: ${missingMethods.join(', ')}`);\n }\n\n const log = (level: keyof Logger, message: string, ...args: any[]) => {\n message = `[${LIBRARY_NAME}] ${name ? `[${name}]` : ''}: ${message}`;\n\n if (level === 'debug') toWrap.debug(message, ...args);\n else if (level === 'info') toWrap.info(message, ...args);\n else if (level === 'warn') toWrap.warn(message, ...args);\n else if (level === 'error') toWrap.error(message, ...args);\n else if (level === 'verbose') toWrap.verbose(message, ...args);\n else if (level === 'silly') toWrap.silly(message, ...args);\n }\n\n return {\n name: 'wrapped',\n debug: (message: string, ...args: any[]) => log('debug', message, ...args),\n info: (message: string, ...args: any[]) => log('info', message, ...args),\n warn: (message: string, ...args: any[]) => log('warn', message, ...args),\n error: (message: string, ...args: any[]) => log('error', message, ...args),\n verbose: (message: string, ...args: any[]) => log('verbose', message, ...args),\n silly: (message: string, ...args: any[]) => log('silly', message, ...args),\n }\n}"],"names":["DEFAULT_LOGGER","name","debug","message","args","console","info","warn","error","verbose","silly","wrapLogger","toWrap","requiredMethods","missingMethods","filter","method","length","Error","join","log","level","LIBRARY_NAME"],"mappings":";;MAaaA,cAAAA,GAAyB;IAClCC,IAAAA,EAAM,SAAA;AACNC,IAAAA,KAAAA,EAAO,CAACC,OAAAA,EAAiB,GAAGC,OAAgBC,OAAAA,CAAQH,KAAK,CAACC,OAAAA,EAAAA,GAAYC,IAAAA,CAAAA;AACtEE,IAAAA,IAAAA,EAAM,CAACH,OAAAA,EAAiB,GAAGC,OAAgBC,OAAAA,CAAQC,IAAI,CAACH,OAAAA,EAAAA,GAAYC,IAAAA,CAAAA;AACpEG,IAAAA,IAAAA,EAAM,CAACJ,OAAAA,EAAiB,GAAGC,OAAgBC,OAA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,IAAAA,CAAAA;AACzEM,QAAAA,KAAAA,EAAO,CAACP,OAAAA,EAAiB,GAAGC,IAAAA,GAAgBgB,GAAAA,CAAI,SAASjB,OAAAA,EAAAA,GAAYC,IAAAA;AACzE,KAAA;AACJ;;;;"}
1
+ {"version":3,"file":"logger.js","sources":["../src/logger.ts"],"sourcesContent":["/* eslint-disable no-console */\n/**\n * RiotPrompt - Logger\n * \n * Provides logging infrastructure backed by @fjell/logging for\n * comprehensive sensitive data masking and structured logging.\n */\n\nimport Logging from '@fjell/logging';\nimport { LIBRARY_NAME } from \"./constants\";\n\n/**\n * Logger interface compatible with @fjell/logging\n */\nexport interface Logger {\n name: string;\n debug: (message: string, ...args: any[]) => void;\n info: (message: string, ...args: any[]) => void;\n warn: (message: string, ...args: any[]) => void;\n error: (message: string, ...args: any[]) => void;\n verbose: (message: string, ...args: any[]) => void;\n silly: (message: string, ...args: any[]) => void;\n /** Get a child logger for a component */\n get?: (...components: string[]) => Logger;\n}\n\n// Get the library-level logger from Fjell\nconst LibLogger = Logging.getLogger('@theunwalked/riotprompt');\n\n/**\n * Create a silent logger with the given name\n */\nfunction createSilentLogger(name: string): Logger {\n return {\n name,\n debug: () => {},\n info: () => {},\n warn: () => {},\n error: () => {},\n verbose: () => {},\n silly: () => {},\n get: (...components: string[]) => createSilentLogger(`${name}:${components.join(':')}`),\n };\n}\n\n/**\n * Silent logger that discards all output\n * Use this as default to prevent accidental information disclosure\n */\nexport const SILENT_LOGGER: Logger = createSilentLogger('silent');\n\n/**\n * Check if logging is explicitly enabled via environment variable\n */\nconst isLoggingEnabled = (): boolean => {\n return process.env.RIOTPROMPT_LOGGING === 'true' ||\n process.env.DEBUG?.includes('riotprompt') ||\n process.env.NODE_ENV === 'development';\n};\n\n/**\n * Create a Logger from a Fjell logger instance\n */\nfunction createLoggerFromFjell(fjellLogger: ReturnType<typeof LibLogger.get>, name: string): Logger {\n return {\n name,\n debug: (message: string, ...args: any[]) => fjellLogger.debug(message, ...args),\n info: (message: string, ...args: any[]) => fjellLogger.info(message, ...args),\n warn: (message: string, ...args: any[]) => fjellLogger.warning(message, ...args),\n error: (message: string, ...args: any[]) => fjellLogger.error(message, ...args),\n verbose: (message: string, ...args: any[]) => fjellLogger.debug(message, ...args), // Map to debug\n silly: (message: string, ...args: any[]) => fjellLogger.debug(message, ...args), // Map to debug\n get: (...components: string[]) => {\n const childLogger = fjellLogger.get(...components);\n return createLoggerFromFjell(childLogger, `${name}:${components.join(':')}`);\n },\n };\n}\n\n/**\n * Fjell-backed logger with sensitive data masking\n * \n * Features:\n * - Automatic sensitive data masking (API keys, passwords, etc.)\n * - Circular reference protection\n * - Hierarchical component logging\n * - Correlation ID support\n */\nconst FJELL_LOGGER: Logger = {\n name: 'fjell',\n debug: (message: string, ...args: any[]) => LibLogger.debug(message, ...args),\n info: (message: string, ...args: any[]) => LibLogger.info(message, ...args),\n warn: (message: string, ...args: any[]) => LibLogger.warning(message, ...args),\n error: (message: string, ...args: any[]) => LibLogger.error(message, ...args),\n verbose: (message: string, ...args: any[]) => LibLogger.debug(message, ...args),\n silly: (message: string, ...args: any[]) => LibLogger.debug(message, ...args),\n get: (...components: string[]) => {\n const childLogger = LibLogger.get(...components);\n return createLoggerFromFjell(childLogger, components.join(':'));\n },\n};\n\n/**\n * Default logger - silent by default to prevent information disclosure\n * \n * Enable logging by setting one of:\n * - RIOTPROMPT_LOGGING=true\n * - DEBUG=*riotprompt*\n * - NODE_ENV=development\n * \n * @example\n * ```typescript\n * import { DEFAULT_LOGGER } from '@theunwalked/riotprompt';\n * \n * const logger = DEFAULT_LOGGER.get?.('MyComponent') ?? DEFAULT_LOGGER;\n * logger.info('Processing request', { userId: 123 });\n * ```\n */\nexport const DEFAULT_LOGGER: Logger = isLoggingEnabled() ? FJELL_LOGGER : SILENT_LOGGER;\n\n/**\n * Wrap an existing logger with library prefix\n * \n * @param toWrap - Logger to wrap\n * @param name - Optional component name\n * @returns Wrapped logger with library prefix\n * \n * @example\n * ```typescript\n * const myLogger = wrapLogger(customLogger, 'MyComponent');\n * myLogger.info('Hello'); // [riotprompt] [MyComponent]: Hello\n * ```\n */\nexport const wrapLogger = (toWrap: Logger, name?: string): Logger => {\n const requiredMethods: (keyof Logger)[] = ['debug', 'info', 'warn', 'error', 'verbose', 'silly'];\n const missingMethods = requiredMethods.filter(method => typeof toWrap[method] !== 'function');\n\n if (missingMethods.length > 0) {\n throw new Error(`Logger is missing required methods: ${missingMethods.join(', ')}`);\n }\n\n const log = (level: keyof Logger, message: string, ...args: any[]) => {\n message = `[${LIBRARY_NAME}] ${name ? `[${name}]` : ''}: ${message}`;\n\n if (level === 'debug') toWrap.debug(message, ...args);\n else if (level === 'info') toWrap.info(message, ...args);\n else if (level === 'warn') toWrap.warn(message, ...args);\n else if (level === 'error') toWrap.error(message, ...args);\n else if (level === 'verbose') toWrap.verbose(message, ...args);\n else if (level === 'silly') toWrap.silly(message, ...args);\n };\n\n return {\n name: name || 'wrapped',\n debug: (message: string, ...args: any[]) => log('debug', message, ...args),\n info: (message: string, ...args: any[]) => log('info', message, ...args),\n warn: (message: string, ...args: any[]) => log('warn', message, ...args),\n error: (message: string, ...args: any[]) => log('error', message, ...args),\n verbose: (message: string, ...args: any[]) => log('verbose', message, ...args),\n silly: (message: string, ...args: any[]) => log('silly', message, ...args),\n get: (...components: string[]) => wrapLogger(toWrap, name ? `${name}:${components.join(':')}` : components.join(':')),\n };\n};\n\n/**\n * Create a console-based fallback logger (for environments without Fjell config)\n * \n * @param name - Logger name\n * @returns Console-based logger\n */\nexport function createConsoleLogger(name: string = 'console'): Logger {\n return {\n name,\n debug: (message: string, ...args: any[]) => console.debug(`[DEBUG] [${name}]`, message, ...args),\n info: (message: string, ...args: any[]) => console.info(`[INFO] [${name}]`, message, ...args),\n warn: (message: string, ...args: any[]) => console.warn(`[WARN] [${name}]`, message, ...args),\n error: (message: string, ...args: any[]) => console.error(`[ERROR] [${name}]`, message, ...args),\n verbose: () => {},\n silly: () => {},\n get: (...components: string[]) => createConsoleLogger(`${name}:${components.join(':')}`),\n };\n}\n"],"names":["LibLogger","Logging","getLogger","createSilentLogger","name","debug","info","warn","error","verbose","silly","get","components","join","SILENT_LOGGER","isLoggingEnabled","process","env","RIOTPROMPT_LOGGING","DEBUG","includes","NODE_ENV","createLoggerFromFjell","fjellLogger","message","args","warning","childLogger","FJELL_LOGGER","DEFAULT_LOGGER","wrapLogger","toWrap","requiredMethods","missingMethods","filter","method","length","Error","log","level","LIBRARY_NAME","createConsoleLogger","console"],"mappings":";;;AA0BA;AACA,MAAMA,SAAAA,GAAYC,OAAAA,CAAQC,SAAS,CAAC,yBAAA,CAAA;AAEpC;;IAGA,SAASC,mBAAmBC,IAAY,EAAA;IACpC,OAAO;AACHA,QAAAA,IAAAA;AACAC,QAAAA,KAAAA,EAAO,IAAA,CAAO,CAAA;AACdC,QAAAA,IAAAA,EAAM,IAAA,CAAO,CAAA;AACbC,QAAAA,IAAAA,EAAM,IAAA,CAAO,CAAA;AACbC,QAAAA,KAAAA,EAAO,IAAA,CAAO,CAAA;AACdC,QAAAA,OAAAA,EAAS,IAAA,CAAO,CAAA;AAChBC,QAAAA,KAAAA,EAAO,IAAA,CAAO,CAAA;QACdC,GAAAA,EAAK,CAAC,GAAGC,UAAAA,GAAyBT,kBAAAA,CAAmB,CAAA,EAAGC,IAAAA,CAAK,CAAC,EAAEQ,UAAAA,CAAWC,IAAI,CAAC,GAAA,CAAA,CAAA,CAAM;AAC1F,KAAA;AACJ;AAEA;;;AAGC,IACM,MAAMC,aAAAA,GAAwBX,kBAAAA,CAAmB,QAAA;AAExD;;AAEC,IACD,MAAMY,gBAAAA,GAAmB,IAAA;AAEdC,IAAAA,IAAAA,kBAAAA;IADP,OAAOA,OAAAA,CAAQC,GAAG,CAACC,kBAAkB,KAAK,MAAA,KAAA,CACnCF,kBAAAA,GAAAA,QAAQC,GAAG,CAACE,KAAK,MAAA,IAAA,IAAjBH,kBAAAA,KAAAA,MAAAA,GAAAA,MAAAA,GAAA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 import { MaskingConfig } from '@fjell/logging';
2
+ import { Logger } from './logger';
3
+ export declare const RiotPromptLogger: import('@fjell/logging').Logger;
4
+ /**
5
+ * Secure logging configuration options
6
+ */
7
+ export interface SecureLoggingOptions {
8
+ /** Enable masking (defaults to true in production) */
9
+ enabled?: boolean;
10
+ /** Mask API keys (OpenAI, Anthropic, AWS, etc.) */
11
+ maskApiKeys?: boolean;
12
+ /** Mask passwords and secrets */
13
+ maskPasswords?: boolean;
14
+ /** Mask email addresses */
15
+ maskEmails?: boolean;
16
+ /** Mask Social Security Numbers */
17
+ maskSSNs?: boolean;
18
+ /** Mask private keys */
19
+ maskPrivateKeys?: boolean;
20
+ /** Mask JWT tokens */
21
+ maskJWTs?: boolean;
22
+ /** Mask large base64 blobs */
23
+ maskBase64Blobs?: boolean;
24
+ /** Maximum object depth for masking */
25
+ maxDepth?: number;
26
+ }
27
+ /**
28
+ * Configure secure logging defaults for RiotPrompt
29
+ *
30
+ * @param options - Configuration options
31
+ * @returns MaskingConfig for use with maskWithConfig
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const config = configureSecureLogging({ maskEmails: false });
36
+ * const masked = maskWithConfig(content, config);
37
+ * ```
38
+ */
39
+ export declare function configureSecureLogging(options?: SecureLoggingOptions): MaskingConfig;
40
+ /**
41
+ * Default masking configuration with all protections enabled
42
+ */
43
+ export declare const DEFAULT_MASKING_CONFIG: MaskingConfig;
44
+ /**
45
+ * Permissive masking configuration for development/debugging
46
+ */
47
+ export declare const DEVELOPMENT_MASKING_CONFIG: MaskingConfig;
48
+ /**
49
+ * Mask a string with default secure settings
50
+ *
51
+ * @param content - Content to mask
52
+ * @param config - Optional custom masking config
53
+ * @returns Masked content
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const masked = maskSensitive('API key: sk-abc123xyz');
58
+ * // Output: "API key: ****"
59
+ * ```
60
+ */
61
+ export declare function maskSensitive(content: string, config?: MaskingConfig): string;
62
+ /**
63
+ * Execute a function with a correlated logger for request tracking
64
+ *
65
+ * @param fn - Function to execute with correlated logger
66
+ * @param baseLogger - Base logger to correlate
67
+ * @returns Promise with result and correlation ID
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * const { result, correlationId } = await executeWithCorrelation(
72
+ * async (logger) => {
73
+ * logger.info('Processing request');
74
+ * return processData();
75
+ * },
76
+ * myLogger
77
+ * );
78
+ * ```
79
+ */
80
+ export declare function executeWithCorrelation<T>(fn: (logger: Logger, correlationId: string) => Promise<T>, baseLogger: Logger): Promise<{
81
+ result: T;
82
+ correlationId: string;
83
+ }>;
84
+ export { maskWithConfig, createCorrelatedLogger, generateCorrelationId, type MaskingConfig } from '@fjell/logging';
@@ -0,0 +1,116 @@
1
+ import Logging, { generateCorrelationId, maskWithConfig } from '@fjell/logging';
2
+ export { createCorrelatedLogger, generateCorrelationId, maskWithConfig } from '@fjell/logging';
3
+
4
+ // Get library logger
5
+ const RiotPromptLogger = Logging.getLogger('@theunwalked/riotprompt');
6
+ /**
7
+ * Configure secure logging defaults for RiotPrompt
8
+ *
9
+ * @param options - Configuration options
10
+ * @returns MaskingConfig for use with maskWithConfig
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const config = configureSecureLogging({ maskEmails: false });
15
+ * const masked = maskWithConfig(content, config);
16
+ * ```
17
+ */ function configureSecureLogging(options = {}) {
18
+ var _options_enabled, _options_maskApiKeys, _options_maskPasswords, _options_maskEmails, _options_maskSSNs, _options_maskPrivateKeys, _options_maskJWTs, _options_maskBase64Blobs, _options_maxDepth;
19
+ const isProduction = process.env.NODE_ENV === 'production';
20
+ return {
21
+ enabled: (_options_enabled = options.enabled) !== null && _options_enabled !== void 0 ? _options_enabled : isProduction,
22
+ maskApiKeys: (_options_maskApiKeys = options.maskApiKeys) !== null && _options_maskApiKeys !== void 0 ? _options_maskApiKeys : true,
23
+ maskPasswords: (_options_maskPasswords = options.maskPasswords) !== null && _options_maskPasswords !== void 0 ? _options_maskPasswords : true,
24
+ maskEmails: (_options_maskEmails = options.maskEmails) !== null && _options_maskEmails !== void 0 ? _options_maskEmails : true,
25
+ maskSSNs: (_options_maskSSNs = options.maskSSNs) !== null && _options_maskSSNs !== void 0 ? _options_maskSSNs : true,
26
+ maskPrivateKeys: (_options_maskPrivateKeys = options.maskPrivateKeys) !== null && _options_maskPrivateKeys !== void 0 ? _options_maskPrivateKeys : true,
27
+ maskJWTs: (_options_maskJWTs = options.maskJWTs) !== null && _options_maskJWTs !== void 0 ? _options_maskJWTs : true,
28
+ maskBase64Blobs: (_options_maskBase64Blobs = options.maskBase64Blobs) !== null && _options_maskBase64Blobs !== void 0 ? _options_maskBase64Blobs : true,
29
+ maskBearerTokens: true,
30
+ maskGenericSecrets: true,
31
+ maxDepth: (_options_maxDepth = options.maxDepth) !== null && _options_maxDepth !== void 0 ? _options_maxDepth : 8
32
+ };
33
+ }
34
+ /**
35
+ * Default masking configuration with all protections enabled
36
+ */ const DEFAULT_MASKING_CONFIG = {
37
+ enabled: true,
38
+ maskApiKeys: true,
39
+ maskPasswords: true,
40
+ maskEmails: true,
41
+ maskSSNs: true,
42
+ maskPrivateKeys: true,
43
+ maskJWTs: true,
44
+ maskBase64Blobs: true,
45
+ maskBearerTokens: true,
46
+ maskGenericSecrets: true,
47
+ maxDepth: 8
48
+ };
49
+ /**
50
+ * Permissive masking configuration for development/debugging
51
+ */ const DEVELOPMENT_MASKING_CONFIG = {
52
+ enabled: false,
53
+ maskApiKeys: false,
54
+ maskPasswords: false,
55
+ maskEmails: false,
56
+ maskSSNs: false,
57
+ maskPrivateKeys: false,
58
+ maskJWTs: false,
59
+ maskBase64Blobs: false,
60
+ maskBearerTokens: false,
61
+ maskGenericSecrets: false,
62
+ maxDepth: 8
63
+ };
64
+ /**
65
+ * Mask a string with default secure settings
66
+ *
67
+ * @param content - Content to mask
68
+ * @param config - Optional custom masking config
69
+ * @returns Masked content
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const masked = maskSensitive('API key: sk-abc123xyz');
74
+ * // Output: "API key: ****"
75
+ * ```
76
+ */ function maskSensitive(content, config) {
77
+ return maskWithConfig(content, config !== null && config !== void 0 ? config : DEFAULT_MASKING_CONFIG);
78
+ }
79
+ /**
80
+ * Execute a function with a correlated logger for request tracking
81
+ *
82
+ * @param fn - Function to execute with correlated logger
83
+ * @param baseLogger - Base logger to correlate
84
+ * @returns Promise with result and correlation ID
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const { result, correlationId } = await executeWithCorrelation(
89
+ * async (logger) => {
90
+ * logger.info('Processing request');
91
+ * return processData();
92
+ * },
93
+ * myLogger
94
+ * );
95
+ * ```
96
+ */ async function executeWithCorrelation(fn, baseLogger) {
97
+ const correlationId = generateCorrelationId();
98
+ // Create a correlated wrapper that matches our Logger interface
99
+ const correlatedLogger = {
100
+ name: `${baseLogger.name}:${correlationId}`,
101
+ debug: (msg, ...args)=>baseLogger.debug(`[${correlationId}] ${msg}`, ...args),
102
+ info: (msg, ...args)=>baseLogger.info(`[${correlationId}] ${msg}`, ...args),
103
+ warn: (msg, ...args)=>baseLogger.warn(`[${correlationId}] ${msg}`, ...args),
104
+ error: (msg, ...args)=>baseLogger.error(`[${correlationId}] ${msg}`, ...args),
105
+ verbose: (msg, ...args)=>baseLogger.verbose(`[${correlationId}] ${msg}`, ...args),
106
+ silly: (msg, ...args)=>baseLogger.silly(`[${correlationId}] ${msg}`, ...args)
107
+ };
108
+ const result = await fn(correlatedLogger, correlationId);
109
+ return {
110
+ result,
111
+ correlationId
112
+ };
113
+ }
114
+
115
+ export { DEFAULT_MASKING_CONFIG, DEVELOPMENT_MASKING_CONFIG, RiotPromptLogger, configureSecureLogging, executeWithCorrelation, maskSensitive };
116
+ //# sourceMappingURL=logging-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging-config.js","sources":["../src/logging-config.ts"],"sourcesContent":["/**\n * RiotPrompt - Secure Logging Configuration\n * \n * Integrates @fjell/logging for comprehensive sensitive data masking\n * and structured logging across the library.\n */\n\nimport Logging, { \n maskWithConfig, \n type MaskingConfig,\n generateCorrelationId \n} from '@fjell/logging';\nimport type { Logger } from './logger';\n\n// Get library logger\nexport const RiotPromptLogger = Logging.getLogger('@theunwalked/riotprompt');\n\n/**\n * Secure logging configuration options\n */\nexport interface SecureLoggingOptions {\n /** Enable masking (defaults to true in production) */\n enabled?: boolean;\n /** Mask API keys (OpenAI, Anthropic, AWS, etc.) */\n maskApiKeys?: boolean;\n /** Mask passwords and secrets */\n maskPasswords?: boolean;\n /** Mask email addresses */\n maskEmails?: boolean;\n /** Mask Social Security Numbers */\n maskSSNs?: boolean;\n /** Mask private keys */\n maskPrivateKeys?: boolean;\n /** Mask JWT tokens */\n maskJWTs?: boolean;\n /** Mask large base64 blobs */\n maskBase64Blobs?: boolean;\n /** Maximum object depth for masking */\n maxDepth?: number;\n}\n\n/**\n * Configure secure logging defaults for RiotPrompt\n * \n * @param options - Configuration options\n * @returns MaskingConfig for use with maskWithConfig\n * \n * @example\n * ```typescript\n * const config = configureSecureLogging({ maskEmails: false });\n * const masked = maskWithConfig(content, config);\n * ```\n */\nexport function configureSecureLogging(options: SecureLoggingOptions = {}): MaskingConfig {\n const isProduction = process.env.NODE_ENV === 'production';\n\n return {\n enabled: options.enabled ?? isProduction,\n maskApiKeys: options.maskApiKeys ?? true,\n maskPasswords: options.maskPasswords ?? true,\n maskEmails: options.maskEmails ?? true,\n maskSSNs: options.maskSSNs ?? true,\n maskPrivateKeys: options.maskPrivateKeys ?? true,\n maskJWTs: options.maskJWTs ?? true,\n maskBase64Blobs: options.maskBase64Blobs ?? true,\n maskBearerTokens: true,\n maskGenericSecrets: true,\n maxDepth: options.maxDepth ?? 8,\n };\n}\n\n/**\n * Default masking configuration with all protections enabled\n */\nexport const DEFAULT_MASKING_CONFIG: MaskingConfig = {\n enabled: true,\n maskApiKeys: true,\n maskPasswords: true,\n maskEmails: true,\n maskSSNs: true,\n maskPrivateKeys: true,\n maskJWTs: true,\n maskBase64Blobs: true,\n maskBearerTokens: true,\n maskGenericSecrets: true,\n maxDepth: 8,\n};\n\n/**\n * Permissive masking configuration for development/debugging\n */\nexport const DEVELOPMENT_MASKING_CONFIG: MaskingConfig = {\n enabled: false,\n maskApiKeys: false,\n maskPasswords: false,\n maskEmails: false,\n maskSSNs: false,\n maskPrivateKeys: false,\n maskJWTs: false,\n maskBase64Blobs: false,\n maskBearerTokens: false,\n maskGenericSecrets: false,\n maxDepth: 8,\n};\n\n/**\n * Mask a string with default secure settings\n * \n * @param content - Content to mask\n * @param config - Optional custom masking config\n * @returns Masked content\n * \n * @example\n * ```typescript\n * const masked = maskSensitive('API key: sk-abc123xyz');\n * // Output: \"API key: ****\"\n * ```\n */\nexport function maskSensitive(content: string, config?: MaskingConfig): string {\n return maskWithConfig(content, config ?? DEFAULT_MASKING_CONFIG);\n}\n\n/**\n * Execute a function with a correlated logger for request tracking\n * \n * @param fn - Function to execute with correlated logger\n * @param baseLogger - Base logger to correlate\n * @returns Promise with result and correlation ID\n * \n * @example\n * ```typescript\n * const { result, correlationId } = await executeWithCorrelation(\n * async (logger) => {\n * logger.info('Processing request');\n * return processData();\n * },\n * myLogger\n * );\n * ```\n */\nexport async function executeWithCorrelation<T>(\n fn: (logger: Logger, correlationId: string) => Promise<T>,\n baseLogger: Logger,\n): Promise<{ result: T; correlationId: string }> {\n const correlationId = generateCorrelationId();\n \n // Create a correlated wrapper that matches our Logger interface\n const correlatedLogger: Logger = {\n name: `${baseLogger.name}:${correlationId}`,\n debug: (msg, ...args) => baseLogger.debug(`[${correlationId}] ${msg}`, ...args),\n info: (msg, ...args) => baseLogger.info(`[${correlationId}] ${msg}`, ...args),\n warn: (msg, ...args) => baseLogger.warn(`[${correlationId}] ${msg}`, ...args),\n error: (msg, ...args) => baseLogger.error(`[${correlationId}] ${msg}`, ...args),\n verbose: (msg, ...args) => baseLogger.verbose(`[${correlationId}] ${msg}`, ...args),\n silly: (msg, ...args) => baseLogger.silly(`[${correlationId}] ${msg}`, ...args),\n };\n\n const result = await fn(correlatedLogger, correlationId);\n return { result, correlationId };\n}\n\n// Re-export useful Fjell utilities\nexport { \n maskWithConfig, \n createCorrelatedLogger, \n generateCorrelationId,\n type MaskingConfig \n} from '@fjell/logging';\n\n"],"names":["RiotPromptLogger","Logging","getLogger","configureSecureLogging","options","isProduction","process","env","NODE_ENV","enabled","maskApiKeys","maskPasswords","maskEmails","maskSSNs","maskPrivateKeys","maskJWTs","maskBase64Blobs","maskBearerTokens","maskGenericSecrets","maxDepth","DEFAULT_MASKING_CONFIG","DEVELOPMENT_MASKING_CONFIG","maskSensitive","content","config","maskWithConfig","executeWithCorrelation","fn","baseLogger","correlationId","generateCorrelationId","correlatedLogger","name","debug","msg","args","info","warn","error","verbose","silly","result"],"mappings":";;;AAcA;AACO,MAAMA,gBAAAA,GAAmBC,OAAAA,CAAQC,SAAS,CAAC,yBAAA;AA0BlD;;;;;;;;;;;AAWC,IACM,SAASC,sBAAAA,CAAuBC,OAAAA,GAAgC,EAAE,EAAA;AAIxDA,IAAAA,IAAAA,gBAAAA,EACIA,sBACEA,sBAAAA,EACHA,mBAAAA,EACFA,iBAAAA,EACOA,wBAAAA,EACPA,mBACOA,wBAAAA,EAGPA,iBAAAA;AAbd,IAAA,MAAMC,YAAAA,GAAeC,OAAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,YAAA;IAE9C,OAAO;AACHC,QAAAA,OAAO,GAAEL,gBAAAA,GAAAA,OAAAA,CAAQK,OAAO,MAAA,IAAA,IAAfL,8BAAAA,gBAAAA,GAAmBC,YAAAA;AAC5BK,QAAAA,WAAW,GAAEN,oBAAAA,GAAAA,OAAAA,CAAQM,WAAW,MAAA,IAAA,IAAnBN,kCAAAA,oBAAAA,GAAuB,IAAA;AACpCO,QAAAA,aAAa,GAAEP,sBAAAA,GAAAA,OAAAA,CAAQO,aAAa,MAAA,IAAA,IAArBP,oCAAAA,sBAAAA,GAAyB,IAAA;AACxCQ,QAAAA,UAAU,GAAER,mBAAAA,GAAAA,OAAAA,CAAQQ,UAA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EAAE,EAAEK,KAAK,EAAA,GAAKC,IAAAA,CAAAA;AAC1EI,QAAAA,OAAAA,EAAS,CAACL,GAAAA,EAAK,GAAGC,IAAAA,GAASP,WAAWW,OAAO,CAAC,CAAC,CAAC,EAAEV,aAAAA,CAAc,EAAE,EAAEK,KAAK,EAAA,GAAKC,IAAAA,CAAAA;AAC9EK,QAAAA,KAAAA,EAAO,CAACN,GAAAA,EAAK,GAAGC,IAAAA,GAASP,WAAWY,KAAK,CAAC,CAAC,CAAC,EAAEX,aAAAA,CAAc,EAAE,EAAEK,KAAK,EAAA,GAAKC,IAAAA;AAC9E,KAAA;IAEA,MAAMM,MAAAA,GAAS,MAAMd,EAAAA,CAAGI,gBAAAA,EAAkBF,aAAAA,CAAAA;IAC1C,OAAO;AAAEY,QAAAA,MAAAA;AAAQZ,QAAAA;AAAc,KAAA;AACnC;;;;"}
@@ -252,5 +252,5 @@ function _define_property(obj, key, value) {
252
252
  }
253
253
  };
254
254
 
255
- export { MessageBuilder, MessageTemplates, MessageBuilder as default };
255
+ export { MessageBuilder, MessageTemplates };
256
256
  //# sourceMappingURL=message-builder.js.map
@@ -202,5 +202,5 @@ function getModelFamily(model) {
202
202
  getModelRegistry().register(config);
203
203
  }
204
204
 
205
- export { ModelRegistry, configureModel, ModelRegistry as default, getEncoding, getModelFamily, getModelRegistry, getPersonaRole, resetModelRegistry, supportsToolCalls };
205
+ export { ModelRegistry, configureModel, getEncoding, getModelFamily, getModelRegistry, getPersonaRole, resetModelRegistry, supportsToolCalls };
206
206
  //# sourceMappingURL=model-config.js.map
package/dist/override.js CHANGED
@@ -4,18 +4,24 @@ import { ParametersSchema } from './items/parameters.js';
4
4
  import { SectionOptionsSchema } from './items/section.js';
5
5
  import { DEFAULT_LOGGER, wrapLogger } from './logger.js';
6
6
  import './items/weighted.js';
7
- import { create as create$1 } from './formatter.js';
7
+ import { create as create$2 } from './formatter.js';
8
8
  import { create as create$3 } from './parser.js';
9
9
  import './loader.js';
10
10
  import './builder.js';
11
11
  import './recipes.js';
12
12
  import './conversation.js';
13
13
  import 'tiktoken';
14
+ import './logging-config.js';
14
15
  import './tools.js';
15
16
  import 'openai';
16
17
  import '@anthropic-ai/sdk';
17
18
  import '@google/generative-ai';
18
- import { create as create$2 } from './util/storage.js';
19
+ import './security/types.js';
20
+ import './security/defaults.js';
21
+ import './security/serialization-schemas.js';
22
+ import '@theunwalked/pressurelid';
23
+ import '@theunwalked/spotclean';
24
+ import { create as create$1 } from './util/storage.js';
19
25
 
20
26
  const OptionsSchema = z.object({
21
27
  logger: z.any().optional().default(DEFAULT_LOGGER),
@@ -29,7 +35,7 @@ const create = (overrideOptions = {})=>{
29
35
  const options = OptionsSchema.parse(overrideOptions);
30
36
  const parameters = options.parameters;
31
37
  const logger = wrapLogger(options === null || options === void 0 ? void 0 : options.logger, 'Override');
32
- const storage = create$2({
38
+ const storage = create$1({
33
39
  log: logger.debug
34
40
  });
35
41
  const loadOptions = (sectionOptions = {})=>{
@@ -116,7 +122,7 @@ const create = (overrideOptions = {})=>{
116
122
  logger.silly('Append found, adding to content from file %s', append);
117
123
  finalSection = finalSection.append(append);
118
124
  }
119
- const formatter$1 = create$1({
125
+ const formatter$1 = create$2({
120
126
  logger
121
127
  });
122
128
  logger.silly('Final section %s:\n\n%s\n\n', logger.name, formatter$1.format(finalSection));
@@ -1 +1 @@
1
- {"version":3,"file":"override.js","sources":["../src/override.ts"],"sourcesContent":["import path from 'path';\nimport { z } from 'zod';\nimport { ParametersSchema } from './items/parameters';\nimport { SectionOptions, SectionOptionsSchema } from './items/section';\nimport { DEFAULT_LOGGER, wrapLogger } from './logger';\nimport { Formatter, Parser, Section, Weighted } from './riotprompt';\nimport * as Storage from './util/storage';\n\nconst OptionsSchema = z.object({\n logger: z.any().optional().default(DEFAULT_LOGGER),\n configDirs: z.array(z.string()).default(['./overrides']),\n overrides: z.boolean().default(false),\n parameters: ParametersSchema.optional().default({}),\n});\n\nexport type Options = z.infer<typeof OptionsSchema>;\n\nexport type OptionsParam = Partial<Options>;\n\nexport interface Instance {\n customize: <T extends Weighted>(overrideFile: string, section: Section<T>, sectionOptions?: SectionOptions) => Promise<Section<T>>;\n override: <T extends Weighted>(overrideFile: string, section: Section<T>, sectionOptions?: SectionOptions) =>\n Promise<{ override?: Section<T>, prepends: Section<T>[], appends: Section<T>[] }>;\n}\n\nexport const create = (overrideOptions: OptionsParam = {}): Instance => {\n const options: Required<Options> = OptionsSchema.parse(overrideOptions) as Required<Options>;\n\n const parameters = options.parameters;\n\n const logger = wrapLogger(options?.logger, 'Override');\n const storage = Storage.create({ log: logger.debug });\n\n const loadOptions = (sectionOptions: Partial<SectionOptions> = {}): SectionOptions => {\n const currentOptions = SectionOptionsSchema.parse(sectionOptions);\n return {\n ...currentOptions,\n parameters: {\n ...parameters,\n ...currentOptions.parameters\n }\n }\n }\n\n const override = async <T extends Weighted>(\n overrideFile: string,\n section: Section<T>,\n sectionOptions: Partial<SectionOptions> = {}\n ): Promise<{ override?: Section<T>, prepends: Section<T>[], appends: Section<T>[] }> => {\n const currentSectionOptions = loadOptions(sectionOptions);\n\n const response: { override?: Section<T>, prepends: Section<T>[], appends: Section<T>[] } = {\n prepends: [],\n appends: []\n };\n\n // Process directories in order (closest to furthest)\n for (let i = 0; i < options.configDirs.length; i++) {\n const configDir = options.configDirs[i];\n const baseFile = path.join(configDir, overrideFile);\n const preFile = baseFile.replace('.md', '-pre.md');\n const postFile = baseFile.replace('.md', '-post.md');\n\n // Check for prepend files (-pre.md)\n if (await storage.exists(preFile)) {\n logger.silly('Found pre file %s (layer %d)', preFile, i + 1);\n const parser = Parser.create({ logger });\n const prependSection = await parser.parseFile<T>(preFile, currentSectionOptions);\n response.prepends.push(prependSection);\n }\n\n // Check for append files (-post.md)\n if (await storage.exists(postFile)) {\n logger.silly('Found post file %s (layer %d)', postFile, i + 1);\n const parser = Parser.create({ logger });\n const appendSection = await parser.parseFile<T>(postFile, currentSectionOptions);\n response.appends.push(appendSection);\n }\n\n // Check for complete override files - use the first (closest) one found\n if (!response.override && await storage.exists(baseFile)) {\n logger.silly('Found base file %s (layer %d)', baseFile, i + 1);\n if (options.overrides) {\n logger.warn('WARNING: Core directives are being overwritten by custom configuration at layer %d', i + 1);\n const parser = Parser.create({ logger });\n response.override = await parser.parseFile<T>(baseFile, currentSectionOptions);\n } else {\n logger.error('ERROR: Core directives are being overwritten by custom configuration');\n throw new Error('Core directives are being overwritten by custom configuration, but overrides are not enabled. Please enable --overrides to use this feature.');\n }\n }\n }\n\n return response;\n }\n\n const customize = async <T extends Weighted>(\n overrideFile: string,\n section: Section<T>,\n sectionOptions: Partial<SectionOptions> = {}\n ): Promise<Section<T>> => {\n const currentSectionOptions = loadOptions(sectionOptions);\n\n const { override: overrideContent, prepends, appends }: { override?: Section<T>, prepends: Section<T>[], appends: Section<T>[] } = await override(overrideFile, section, currentSectionOptions);\n let finalSection: Section<T> = section;\n\n if (overrideContent) {\n if (options.overrides) {\n logger.warn('Override found, replacing content from file %s', overrideContent);\n finalSection = overrideContent;\n } else {\n logger.error('ERROR: Core directives are being overwritten by custom configuration');\n throw new Error('Core directives are being overwritten by custom configuration, but overrides are not enabled. Please enable --overrides to use this feature.');\n }\n }\n\n // Apply prepends in order (closest layer first)\n for (const prepend of prepends) {\n logger.silly('Prepend found, adding to content from file %s', prepend);\n finalSection = finalSection.prepend(prepend);\n }\n\n // Apply appends in reverse order (furthest layers first, then closest)\n // Create a copy to avoid mutating the original array\n const reversedAppends = [...appends].reverse();\n for (const append of reversedAppends) {\n logger.silly('Append found, adding to content from file %s', append);\n finalSection = finalSection.append(append);\n }\n\n const formatter = Formatter.create({ logger });\n logger.silly('Final section %s:\\n\\n%s\\n\\n', logger.name, formatter.format(finalSection));\n\n return finalSection;\n }\n\n return {\n override,\n customize,\n }\n}\n"],"names":["OptionsSchema","z","object","logger","any","optional","default","DEFAULT_LOGGER","configDirs","array","string","overrides","boolean","parameters","ParametersSchema","create","overrideOptions","options","parse","wrapLogger","storage","Storage","log","debug","loadOptions","sectionOptions","currentOptions","SectionOptionsSchema","override","overrideFile","section","currentSectionOptions","response","prepends","appends","i","length","configDir","baseFile","path","join","preFile","replace","postFile","exists","silly","parser","Parser","prependSection","parseFile","push","appendSection","warn","error","Error","customize","overrideContent","finalSection","prepend","reversedAppends","reverse","append","formatter","Formatter","name","format"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA,MAAMA,aAAAA,GAAgBC,CAAAA,CAAEC,MAAM,CAAC;AAC3BC,IAAAA,MAAAA,EAAQF,EAAEG,GAAG,EAAA,CAAGC,QAAQ,EAAA,CAAGC,OAAO,CAACC,cAAAA,CAAAA;AACnCC,IAAAA,UAAAA,EAAYP,EAAEQ,KAAK,CAACR,EAAES,MAAM,EAAA,CAAA,CAAIJ,OAAO,CAAC;AAAC,QAAA;AAAc,KAAA,CAAA;AACvDK,IAAAA,SAAAA,EAAWV,CAAAA,CAAEW,OAAO,EAAA,CAAGN,OAAO,CAAC,KAAA,CAAA;AAC/BO,IAAAA,UAAAA,EAAYC,gBAAAA,CAAiBT,QAAQ,EAAA,CAAGC,OAAO,CAAC,EAAC;AACrD,CAAA,CAAA;AAYO,MAAMS,MAAAA,GAAS,CAACC,eAAAA,GAAgC,EAAE,GAAA;IACrD,MAAMC,OAAAA,GAA6BjB,aAAAA,CAAckB,KAAK,CAACF,eAAAA,CAAAA;IAEvD,MAAMH,UAAAA,GAAaI,QAAQJ,UAAU;AAErC,IAAA,MAAMV,SAASgB,UAAAA,CAAWF,OAAAA,KAAAA,IAAAA,IAAAA,OAAAA,KAAAA,MAAAA,GAAAA,MAAAA,GAAAA,OAAAA,CAASd,MAAM,EAAE,UAAA,CAAA;IAC3C,MAAMiB,OAAAA,GAAUC,QAAc,CAAC;AAAEC,QAAAA,GAAAA,EAAKnB,OAAOoB;AAAM,KAAA,CAAA;AAEnD,IAAA,MAAMC,WAAAA,GAAc,CAACC,cAAAA,GAA0C,EAAE,GAAA;QAC7D,MAAMC,cAAAA,GAAiBC,oBAAA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+B1C,MAAAA,CAAO6D,IAAI,EAAEF,WAAAA,CAAUG,MAAM,CAACR,YAAAA,CAAAA,CAAAA;QAE1E,OAAOA,YAAAA;AACX,IAAA,CAAA;IAEA,OAAO;AACH7B,QAAAA,QAAAA;AACA2B,QAAAA;AACJ,KAAA;AACJ;;;;"}
1
+ {"version":3,"file":"override.js","sources":["../src/override.ts"],"sourcesContent":["import path from 'path';\nimport { z } from 'zod';\nimport { ParametersSchema } from './items/parameters';\nimport { SectionOptions, SectionOptionsSchema } from './items/section';\nimport { DEFAULT_LOGGER, wrapLogger } from './logger';\nimport { Formatter, Parser, Section, Weighted } from './riotprompt';\nimport * as Storage from './util/storage';\n\nconst OptionsSchema = z.object({\n logger: z.any().optional().default(DEFAULT_LOGGER),\n configDirs: z.array(z.string()).default(['./overrides']),\n overrides: z.boolean().default(false),\n parameters: ParametersSchema.optional().default({}),\n});\n\nexport type Options = z.infer<typeof OptionsSchema>;\n\nexport type OptionsParam = Partial<Options>;\n\nexport interface Instance {\n customize: <T extends Weighted>(overrideFile: string, section: Section<T>, sectionOptions?: SectionOptions) => Promise<Section<T>>;\n override: <T extends Weighted>(overrideFile: string, section: Section<T>, sectionOptions?: SectionOptions) =>\n Promise<{ override?: Section<T>, prepends: Section<T>[], appends: Section<T>[] }>;\n}\n\nexport const create = (overrideOptions: OptionsParam = {}): Instance => {\n const options: Required<Options> = OptionsSchema.parse(overrideOptions) as Required<Options>;\n\n const parameters = options.parameters;\n\n const logger = wrapLogger(options?.logger, 'Override');\n const storage = Storage.create({ log: logger.debug });\n\n const loadOptions = (sectionOptions: Partial<SectionOptions> = {}): SectionOptions => {\n const currentOptions = SectionOptionsSchema.parse(sectionOptions);\n return {\n ...currentOptions,\n parameters: {\n ...parameters,\n ...currentOptions.parameters\n }\n }\n }\n\n const override = async <T extends Weighted>(\n overrideFile: string,\n section: Section<T>,\n sectionOptions: Partial<SectionOptions> = {}\n ): Promise<{ override?: Section<T>, prepends: Section<T>[], appends: Section<T>[] }> => {\n const currentSectionOptions = loadOptions(sectionOptions);\n\n const response: { override?: Section<T>, prepends: Section<T>[], appends: Section<T>[] } = {\n prepends: [],\n appends: []\n };\n\n // Process directories in order (closest to furthest)\n for (let i = 0; i < options.configDirs.length; i++) {\n const configDir = options.configDirs[i];\n const baseFile = path.join(configDir, overrideFile);\n const preFile = baseFile.replace('.md', '-pre.md');\n const postFile = baseFile.replace('.md', '-post.md');\n\n // Check for prepend files (-pre.md)\n if (await storage.exists(preFile)) {\n logger.silly('Found pre file %s (layer %d)', preFile, i + 1);\n const parser = Parser.create({ logger });\n const prependSection = await parser.parseFile<T>(preFile, currentSectionOptions);\n response.prepends.push(prependSection);\n }\n\n // Check for append files (-post.md)\n if (await storage.exists(postFile)) {\n logger.silly('Found post file %s (layer %d)', postFile, i + 1);\n const parser = Parser.create({ logger });\n const appendSection = await parser.parseFile<T>(postFile, currentSectionOptions);\n response.appends.push(appendSection);\n }\n\n // Check for complete override files - use the first (closest) one found\n if (!response.override && await storage.exists(baseFile)) {\n logger.silly('Found base file %s (layer %d)', baseFile, i + 1);\n if (options.overrides) {\n logger.warn('WARNING: Core directives are being overwritten by custom configuration at layer %d', i + 1);\n const parser = Parser.create({ logger });\n response.override = await parser.parseFile<T>(baseFile, currentSectionOptions);\n } else {\n logger.error('ERROR: Core directives are being overwritten by custom configuration');\n throw new Error('Core directives are being overwritten by custom configuration, but overrides are not enabled. Please enable --overrides to use this feature.');\n }\n }\n }\n\n return response;\n }\n\n const customize = async <T extends Weighted>(\n overrideFile: string,\n section: Section<T>,\n sectionOptions: Partial<SectionOptions> = {}\n ): Promise<Section<T>> => {\n const currentSectionOptions = loadOptions(sectionOptions);\n\n const { override: overrideContent, prepends, appends }: { override?: Section<T>, prepends: Section<T>[], appends: Section<T>[] } = await override(overrideFile, section, currentSectionOptions);\n let finalSection: Section<T> = section;\n\n if (overrideContent) {\n if (options.overrides) {\n logger.warn('Override found, replacing content from file %s', overrideContent);\n finalSection = overrideContent;\n } else {\n logger.error('ERROR: Core directives are being overwritten by custom configuration');\n throw new Error('Core directives are being overwritten by custom configuration, but overrides are not enabled. Please enable --overrides to use this feature.');\n }\n }\n\n // Apply prepends in order (closest layer first)\n for (const prepend of prepends) {\n logger.silly('Prepend found, adding to content from file %s', prepend);\n finalSection = finalSection.prepend(prepend);\n }\n\n // Apply appends in reverse order (furthest layers first, then closest)\n // Create a copy to avoid mutating the original array\n const reversedAppends = [...appends].reverse();\n for (const append of reversedAppends) {\n logger.silly('Append found, adding to content from file %s', append);\n finalSection = finalSection.append(append);\n }\n\n const formatter = Formatter.create({ logger });\n logger.silly('Final section %s:\\n\\n%s\\n\\n', logger.name, formatter.format(finalSection));\n\n return finalSection;\n }\n\n return {\n override,\n customize,\n }\n}\n"],"names":["OptionsSchema","z","object","logger","any","optional","default","DEFAULT_LOGGER","configDirs","array","string","overrides","boolean","parameters","ParametersSchema","create","overrideOptions","options","parse","wrapLogger","storage","Storage","log","debug","loadOptions","sectionOptions","currentOptions","SectionOptionsSchema","override","overrideFile","section","currentSectionOptions","response","prepends","appends","i","length","configDir","baseFile","path","join","preFile","replace","postFile","exists","silly","parser","Parser","prependSection","parseFile","push","appendSection","warn","error","Error","customize","overrideContent","finalSection","prepend","reversedAppends","reverse","append","formatter","Formatter","name","format"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAMA,aAAAA,GAAgBC,CAAAA,CAAEC,MAAM,CAAC;AAC3BC,IAAAA,MAAAA,EAAQF,EAAEG,GAAG,EAAA,CAAGC,QAAQ,EAAA,CAAGC,OAAO,CAACC,cAAAA,CAAAA;AACnCC,IAAAA,UAAAA,EAAYP,EAAEQ,KAAK,CAACR,EAAES,MAAM,EAAA,CAAA,CAAIJ,OAAO,CAAC;AAAC,QAAA;AAAc,KAAA,CAAA;AACvDK,IAAAA,SAAAA,EAAWV,CAAAA,CAAEW,OAAO,EAAA,CAAGN,OAAO,CAAC,KAAA,CAAA;AAC/BO,IAAAA,UAAAA,EAAYC,g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ACJ,QAAA;;QAGA,KAAK,MAAMI,WAAWzB,QAAAA,CAAU;YAC5B9B,MAAAA,CAAO0C,KAAK,CAAC,+CAAA,EAAiDa,OAAAA,CAAAA;YAC9DD,YAAAA,GAAeA,YAAAA,CAAaC,OAAO,CAACA,OAAAA,CAAAA;AACxC,QAAA;;;AAIA,QAAA,MAAMC,eAAAA,GAAkB;AAAIzB,YAAAA,GAAAA;AAAQ,SAAA,CAAC0B,OAAO,EAAA;QAC5C,KAAK,MAAMC,UAAUF,eAAAA,CAAiB;YAClCxD,MAAAA,CAAO0C,KAAK,CAAC,8CAAA,EAAgDgB,MAAAA,CAAAA;YAC7DJ,YAAAA,GAAeA,YAAAA,CAAaI,MAAM,CAACA,MAAAA,CAAAA;AACvC,QAAA;QAEA,MAAMC,WAAAA,GAAYC,QAAgB,CAAC;AAAE5D,YAAAA;AAAO,SAAA,CAAA;QAC5CA,MAAAA,CAAO0C,KAAK,CAAC,6BAAA,EAA+B1C,MAAAA,CAAO6D,IAAI,EAAEF,WAAAA,CAAUG,MAAM,CAACR,YAAAA,CAAAA,CAAAA;QAE1E,OAAOA,YAAAA;AACX,IAAA,CAAA;IAEA,OAAO;AACH7B,QAAAA,QAAAA;AACA2B,QAAAA;AACJ,KAAA;AACJ;;;;"}
package/dist/recipes.js CHANGED
@@ -14,11 +14,17 @@ import { create as create$2 } from './loader.js';
14
14
  import { create as create$1 } from './override.js';
15
15
  import './builder.js';
16
16
  import 'tiktoken';
17
+ import './logging-config.js';
17
18
  import { ToolRegistry } from './tools.js';
18
19
  import { StrategyExecutor } from './iteration-strategy.js';
19
20
  import 'openai';
20
21
  import '@anthropic-ai/sdk';
21
22
  import '@google/generative-ai';
23
+ import './security/types.js';
24
+ import './security/defaults.js';
25
+ import './security/serialization-schemas.js';
26
+ import '@theunwalked/pressurelid';
27
+ import '@theunwalked/spotclean';
22
28
 
23
29
  // ===== CONFIGURATION SCHEMAS =====
24
30
  const ContentItemSchema = z.union([