@kjerneverk/agentic 1.0.5-dev.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.
- package/.kodrdriv-test-cache.json +6 -0
- package/LICENSE +18 -0
- package/README.md +167 -0
- package/SECURITY.md +94 -0
- package/dist/index.d.ts +770 -0
- package/dist/index.js +1822 -0
- package/dist/index.js.map +1 -0
- package/output/kodrdriv/260110-1207-commit-message.md +1 -0
- package/output/kodrdriv/260110-1208-commit-message.md +1 -0
- package/output/kodrdriv/260110-1210-release-notes.md +27 -0
- package/output/kodrdriv/260110-1232-commit-message.md +1 -0
- package/output/kodrdriv/260110-1234-release-notes.md +46 -0
- package/output/kodrdriv/260110-1308-release-notes.md +20 -0
- package/output/kodrdriv/260112-2155-commit-message.md +1 -0
- package/output/kodrdriv/260112-2156-release-notes.md +33 -0
- package/output/kodrdriv/260112-2340-commit-message.md +1 -0
- package/output/kodrdriv/260113-0017-commit-message.md +1 -0
- package/output/kodrdriv/260113-0017-release-notes.md +53 -0
- package/output/kodrdriv/260115-0616-commit-message.md +4 -0
- package/output/kodrdriv/260115-0739-commit-message.md +1 -0
- package/output/kodrdriv/260115-0746-commit-message.md +1 -0
- package/output/kodrdriv/260115-0747-release-notes.md +91 -0
- package/output/kodrdriv/260126-0851-commit-message.md +1 -0
- package/output/kodrdriv/260128-0900-commit-message.md +1 -0
- package/output/kodrdriv/260128-0900-release-notes.md +29 -0
- package/output/kodrdriv/260128-0905-commit-message.md +1 -0
- package/output/kodrdriv/260128-0913-commit-message.md +1 -0
- package/output/kodrdriv/260128-0913-release-notes.md +23 -0
- package/output/kodrdriv/260128-0919-commit-message.md +1 -0
- package/output/kodrdriv/260128-0919-release-notes.md +21 -0
- package/output/kodrdriv/260130-1642-commit-message.md +1 -0
- package/output/kodrdriv/260130-1642-release-notes.md +29 -0
- package/output/kodrdriv/RELEASE_NOTES.md +27 -0
- package/output/kodrdriv/RELEASE_TITLE.md +1 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-10T19-18-11-913Z.md +187 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-10T20-03-27-409Z.md +121 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-10T20-07-27-813Z.md +114 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-10T20-08-06-279Z.md +97 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-10T20-32-25-791Z.md +114 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-13T05-55-30-733Z.md +97 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-13T07-40-28-878Z.md +97 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-13T08-17-22-230Z.md +114 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-14T14-55-10-122Z.md +177 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-15T14-16-05-605Z.md +100 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-15T15-39-32-200Z.md +97 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-15T15-46-32-840Z.md +114 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-26T16-51-00-446Z.md +152 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-31T00-38-59-868Z.md +236 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-31T00-42-31-993Z.md +152 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-10T20-10-49-531Z.md +329 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-10T20-34-32-038Z.md +319 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-10T21-08-36-314Z.md +168 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-13T05-56-04-802Z.md +264 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-13T08-17-56-556Z.md +255 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-15T15-47-32-509Z.md +460 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-31T00-42-59-683Z.md +400 -0
- package/package.json +59 -0
- package/package.json~ +58 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/@fjell/logging/dist/index.js","../src/logger.ts","../src/tools.ts","../src/tool-guard.ts","../src/tool-sandbox.ts","../__vite-browser-external","../src/context-manager.ts","../src/index.ts"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\n\n// src/LogFormat.ts\nvar LogFormat_exports = {};\n__export(LogFormat_exports, {\n LogFormats: () => LogFormats,\n STRUCTURED: () => STRUCTURED,\n TEXT: () => TEXT,\n getConfig: () => getConfig\n});\nvar TEXT = {\n name: \"TEXT\",\n description: \"Text format\"\n};\nvar STRUCTURED = {\n name: \"STRUCTURED\",\n description: \"Structured format\"\n};\nvar LogFormats = [\n TEXT,\n STRUCTURED\n];\nvar getConfig = (name) => {\n const config = LogFormats.find((config2) => config2.name === name);\n if (!config) {\n throw new Error(`Invalid Log Format Supplied to Logging Configuration '${name}'`);\n }\n return config;\n};\n\n// src/LogLevel.ts\nvar LogLevel_exports = {};\n__export(LogLevel_exports, {\n ALERT: () => ALERT,\n CRITICAL: () => CRITICAL,\n DEBUG: () => DEBUG,\n DEFAULT: () => DEFAULT,\n EMERGENCY: () => EMERGENCY,\n ERROR: () => ERROR,\n INFO: () => INFO,\n LogLevels: () => LogLevels,\n NOTICE: () => NOTICE,\n TRACE: () => TRACE,\n WARNING: () => WARNING,\n getConfig: () => getConfig2\n});\nvar EMERGENCY = {\n name: \"EMERGENCY\",\n value: 0\n};\nvar ALERT = {\n name: \"ALERT\",\n value: 1\n};\nvar CRITICAL = {\n name: \"CRITICAL\",\n value: 2\n};\nvar ERROR = {\n name: \"ERROR\",\n value: 3\n};\nvar WARNING = {\n name: \"WARNING\",\n value: 4\n};\nvar NOTICE = {\n name: \"NOTICE\",\n value: 5\n};\nvar INFO = {\n name: \"INFO\",\n value: 6\n};\nvar DEBUG = {\n name: \"DEBUG\",\n value: 7\n};\nvar TRACE = {\n name: \"TRACE\",\n value: 8\n};\nvar DEFAULT = {\n name: \"DEFAULT\",\n value: 9\n};\nvar LogLevels = [\n EMERGENCY,\n ALERT,\n CRITICAL,\n ERROR,\n WARNING,\n NOTICE,\n INFO,\n DEBUG,\n TRACE,\n DEFAULT\n];\nvar getConfig2 = (name) => {\n const config = LogLevels.find((config2) => config2.name === name);\n if (!config) {\n throw new Error(`Invalid Log Level Supplied to Logging Configuration '${name}'`);\n }\n return config;\n};\n\n// src/utils/maskSensitive.ts\nvar PRIVATE_KEY_PATTERNS = [\n /-----BEGIN\\s+(?:RSA\\s+)?PRIVATE\\s+KEY-----\\s*[\\s\\S]*?-----END\\s+(?:RSA\\s+)?PRIVATE\\s+KEY-----/gi,\n /-----BEGIN\\s+EC\\s+PRIVATE\\s+KEY-----\\s*[\\s\\S]*?-----END\\s+EC\\s+PRIVATE\\s+KEY-----/gi,\n /-----BEGIN\\s+DSA\\s+PRIVATE\\s+KEY-----\\s*[\\s\\S]*?-----END\\s+DSA\\s+PRIVATE\\s+KEY-----/gi\n];\nvar BASE64_BLOB_PATTERN = /[A-Za-z0-9+/=]{200,}/g;\nvar JWT_PATTERN = /^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$/;\nvar EMAIL_PATTERN = /\\b[A-Za-z0-9][A-Za-z0-9._%+-]{0,63}@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*\\.[A-Za-z]{2,}\\b/g;\nvar SSN_PATTERN = /\\b\\d{3}-\\d{2}-\\d{4}\\b|\\b\\d{9}\\b/g;\nvar API_KEY_PATTERNS = [\n // OpenAI\n /sk-[a-zA-Z0-9]{20,}/g,\n /sk-proj-[a-zA-Z0-9_-]+/g,\n // Anthropic\n /sk-ant-[a-zA-Z0-9_-]+/g,\n // AWS Access Keys\n /AKIA[0-9A-Z]{16}/g,\n // GitHub tokens\n /ghp_[a-zA-Z0-9]{36}/g,\n /gho_[a-zA-Z0-9]{36}/g,\n /ghs_[a-zA-Z0-9]{36}/g,\n /ghu_[a-zA-Z0-9]{36}/g,\n // GitLab tokens\n /glpat-[a-zA-Z0-9_-]{20}/g,\n // Slack tokens\n /xox[baprs]-[a-zA-Z0-9-]+/g,\n // Google Cloud API keys\n /AIza[0-9A-Za-z_-]{35}/g\n];\nvar BEARER_TOKEN_PATTERN = /Bearer\\s+[\\w.-]+/gi;\nvar PASSWORD_PATTERNS = [\n /password[\\s:=\"']+[^\\s\"']+/gi\n];\nvar GENERIC_SECRET_PATTERNS = [\n /api[_-]?key[\\s:=\"']+[\\w-]+/gi,\n /secret[\\s:=\"']+[^\\s\"']+/gi,\n /token[\\s:=\"']+[^\\s\"']+/gi\n];\nvar MAX_STRING_LENGTH = 1e5;\nfunction maskString(input) {\n if (typeof input !== \"string\" || input.length === 0) {\n return input;\n }\n if (input.length > MAX_STRING_LENGTH) {\n return \"****\";\n }\n let masked = input;\n for (const pattern of PRIVATE_KEY_PATTERNS) {\n masked = masked.replace(pattern, \"****\");\n }\n masked = masked.replace(BASE64_BLOB_PATTERN, \"****\");\n if (JWT_PATTERN.test(masked)) {\n const segments = masked.split(\".\");\n if (segments.length === 3) {\n const [, middle, third] = segments;\n if (middle.length > 100 || third.length > 100) {\n masked = \"****\";\n }\n }\n }\n masked = masked.replace(EMAIL_PATTERN, \"****\");\n masked = masked.replace(SSN_PATTERN, \"****\");\n for (const pattern of API_KEY_PATTERNS) {\n masked = masked.replace(pattern, \"****\");\n }\n masked = masked.replace(BEARER_TOKEN_PATTERN, \"****\");\n for (const pattern of PASSWORD_PATTERNS) {\n masked = masked.replace(pattern, \"****\");\n }\n for (const pattern of GENERIC_SECRET_PATTERNS) {\n masked = masked.replace(pattern, \"****\");\n }\n return masked;\n}\nfunction maskObject(obj, maxDepth = 8, currentDepth = 0) {\n if (currentDepth >= maxDepth) {\n return obj;\n }\n if (obj === null || obj === void 0) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return maskString(obj);\n }\n if (typeof obj !== \"object\") {\n return obj;\n }\n if (Array.isArray(obj)) {\n return obj.map((item) => maskObject(item, maxDepth, currentDepth + 1));\n }\n const maskedObj = {};\n for (const [key, value] of Object.entries(obj)) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n maskedObj[key] = maskObject(value, maxDepth, currentDepth + 1);\n }\n }\n return maskedObj;\n}\nvar defaultMaskingConfig = {\n enabled: false,\n maskEmails: true,\n maskSSNs: true,\n maskPrivateKeys: true,\n maskBase64Blobs: true,\n maskJWTs: true,\n maxDepth: 8,\n // New security-focused defaults (all true when masking is enabled)\n maskApiKeys: true,\n maskBearerTokens: true,\n maskPasswords: true,\n maskGenericSecrets: true\n};\nfunction maskWithConfig(input, config = defaultMaskingConfig) {\n if (!config.enabled) {\n return input;\n }\n const customMaskString = (str) => {\n if (typeof str !== \"string\" || str.length === 0) {\n return str;\n }\n if (str.length > MAX_STRING_LENGTH) {\n return \"****\";\n }\n let masked = str;\n if (config.maskPrivateKeys) {\n for (const pattern of PRIVATE_KEY_PATTERNS) {\n masked = masked.replace(pattern, \"****\");\n }\n }\n if (config.maskBase64Blobs) {\n masked = masked.replace(BASE64_BLOB_PATTERN, \"****\");\n }\n if (config.maskJWTs && JWT_PATTERN.test(masked)) {\n const segments = masked.split(\".\");\n if (segments.length === 3) {\n const [, middle, third] = segments;\n if (middle.length > 100 || third.length > 100) {\n masked = \"****\";\n }\n }\n }\n if (config.maskEmails) {\n masked = masked.replace(EMAIL_PATTERN, \"****\");\n }\n if (config.maskSSNs) {\n masked = masked.replace(SSN_PATTERN, \"****\");\n }\n if (config.maskApiKeys) {\n for (const pattern of API_KEY_PATTERNS) {\n masked = masked.replace(pattern, \"****\");\n }\n }\n if (config.maskBearerTokens) {\n masked = masked.replace(BEARER_TOKEN_PATTERN, \"****\");\n }\n if (config.maskPasswords) {\n for (const pattern of PASSWORD_PATTERNS) {\n masked = masked.replace(pattern, \"****\");\n }\n }\n if (config.maskGenericSecrets) {\n for (const pattern of GENERIC_SECRET_PATTERNS) {\n masked = masked.replace(pattern, \"****\");\n }\n }\n return masked;\n };\n const customMaskObject = (obj, maxDepth = config.maxDepth, currentDepth = 0) => {\n if (currentDepth >= maxDepth) {\n return obj;\n }\n if (obj === null || obj === void 0) {\n return obj;\n }\n if (typeof obj === \"string\") {\n return customMaskString(obj);\n }\n if (typeof obj !== \"object\") {\n return obj;\n }\n if (Array.isArray(obj)) {\n return obj.map((item) => customMaskObject(item, maxDepth, currentDepth + 1));\n }\n const maskedObj = {};\n for (const [key, value] of Object.entries(obj)) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n maskedObj[key] = customMaskObject(value, maxDepth, currentDepth + 1);\n }\n }\n return maskedObj;\n };\n return customMaskObject(input);\n}\n\n// src/config.ts\nvar defaultLogLevel = INFO;\nvar defaultLogFormat = TEXT;\nvar defaultLoggingConfig = {\n logLevel: defaultLogLevel,\n logFormat: defaultLogFormat,\n overrides: {},\n floodControl: {\n enabled: false,\n threshold: 10,\n timeframe: 1e3\n // 1 second\n },\n masking: defaultMaskingConfig\n};\nvar convertComponentOverride = (override) => {\n const result = {\n logLevel: override.logLevel ? getConfig2(override.logLevel) : defaultLogLevel\n };\n if (override.components && typeof override.components === \"object\") {\n result.components = {};\n Object.entries(override.components).forEach(([componentName, componentOverride]) => {\n result.components[componentName] = convertComponentOverride(componentOverride);\n });\n }\n return result;\n};\nvar convertOverrides = (overrides) => {\n const convertedOverrides = {};\n if (overrides) {\n Object.entries(overrides).forEach(([key, value]) => {\n convertedOverrides[key] = convertComponentOverride(value);\n });\n }\n return convertedOverrides;\n};\nvar convertConfig = (config) => {\n return {\n logLevel: config.logLevel ? getConfig2(config.logLevel) : defaultLogLevel,\n logFormat: config.logFormat ? getConfig(config.logFormat) : defaultLogFormat,\n overrides: convertOverrides(config.overrides),\n floodControl: {\n ...defaultLoggingConfig.floodControl,\n ...config.floodControl || {}\n },\n masking: {\n ...defaultLoggingConfig.masking,\n ...config.masking || {}\n }\n };\n};\nvar resolveLogLevel = (config, category, components) => {\n let logLevel = config.logLevel;\n const overrides = config.overrides;\n if (!overrides || !overrides[category]) {\n return logLevel;\n }\n let currentOverride = overrides[category];\n logLevel = currentOverride.logLevel;\n for (const component of components) {\n if (!currentOverride.components || !currentOverride.components[component]) {\n break;\n }\n currentOverride = currentOverride.components[component];\n logLevel = currentOverride.logLevel;\n }\n return logLevel;\n};\nvar configureLogging = () => {\n let config = {};\n const loggingConfigEnv = process.env.LOGGING_CONFIG;\n const expoLoggingConfigEnv = process.env.EXPO_PUBLIC_LOGGING_CONFIG;\n const nextLoggingConfigEnv = process.env.NEXT_PUBLIC_LOGGING_CONFIG;\n let logLevelEnv = process.env.LOG_LEVEL;\n let logFormatEnv = process.env.LOG_FORMAT;\n if (loggingConfigEnv) {\n try {\n config = JSON.parse(loggingConfigEnv);\n } catch (error) {\n console.error(\"Invalid JSON in LOGGING_CONFIG environment variable:\", error);\n config = {};\n }\n } else if (expoLoggingConfigEnv) {\n try {\n config = JSON.parse(expoLoggingConfigEnv);\n } catch (error) {\n console.error(\"Invalid JSON in EXPO_PUBLIC_LOGGING_CONFIG environment variable:\", error);\n config = {};\n }\n } else if (nextLoggingConfigEnv) {\n try {\n config = JSON.parse(nextLoggingConfigEnv);\n } catch (error) {\n console.error(\"Invalid JSON in NEXT_PUBLIC_LOGGING_CONFIG environment variable:\", error);\n config = {};\n }\n }\n const convertedConfig = convertConfig(config);\n if (logLevelEnv) {\n logLevelEnv = logLevelEnv?.toUpperCase();\n const logLevelConfig = getConfig2(logLevelEnv);\n convertedConfig.logLevel = logLevelConfig;\n }\n if (logFormatEnv) {\n logFormatEnv = logFormatEnv.toUpperCase();\n const logFormatConfig = getConfig(logFormatEnv);\n convertedConfig.logFormat = logFormatConfig;\n }\n const finalConfig = { ...defaultLoggingConfig, ...convertedConfig };\n return finalConfig;\n};\n\n// src/Writer.ts\nvar createWriter = (formatter, logMethod, options = {}) => {\n const {\n respectInjectedMethod = false,\n errorMethod = console.error,\n warningMethod = console.warn,\n infoMethod = console.log\n } = options;\n return {\n write: (level, coordinates, payload) => {\n let finalLogMethod = logMethod;\n if (!respectInjectedMethod) {\n if (level.name === ERROR.name || level.name === CRITICAL.name || level.name === ALERT.name || level.name === EMERGENCY.name) {\n finalLogMethod = errorMethod;\n } else if (level.name === WARNING.name) {\n finalLogMethod = warningMethod;\n } else {\n finalLogMethod = infoMethod;\n }\n }\n finalLogMethod(formatter.formatLog(level, coordinates, payload));\n }\n };\n};\n\n// src/utils.ts\nvar stringifyJSON = function(obj, visited = /* @__PURE__ */ new Set()) {\n try {\n return stringifyJSONCustom(obj, visited);\n } catch (error) {\n console.error(\"[Fjell Logging] Critical error in stringifyJSON, using ultimate fallback:\", error);\n try {\n return `\"[Object: ${typeof obj}]\"`;\n } catch {\n return '\"[Object: unknown]\"';\n }\n }\n};\nvar STRINGIFY_CONFIG = {\n MAX_ARRAY_ELEMENTS: 100,\n MAX_OBJECT_PROPERTIES: 100,\n TRUNCATION_MESSAGE: \"...[truncated]\"\n};\nvar stringifyJSONCustom = function(obj, visited = /* @__PURE__ */ new Set()) {\n try {\n const arrOfKeyVals = [];\n const arrVals = [];\n let objKeys = [];\n if (typeof obj === \"number\" || typeof obj === \"boolean\" || obj === null)\n return \"\" + obj;\n else if (typeof obj === \"string\")\n return '\"' + obj + '\"';\n else if (typeof obj === \"symbol\")\n return \"\";\n else if (typeof obj === \"function\")\n return \"\";\n else if (obj instanceof Date)\n return \"{}\";\n else if (obj instanceof RegExp)\n return \"{}\";\n else if (obj instanceof Error)\n return \"{}\";\n else if (typeof obj === \"object\" && obj.constructor && obj.constructor.name === \"Buffer\") {\n const result = {};\n for (let i = 0; i < obj.length; i++) {\n result[i] = obj[i];\n }\n return stringifyJSONCustom(result, visited);\n }\n if (obj instanceof Object && visited.has(obj)) {\n return '\"(circular)\"';\n } else if (Array.isArray(obj)) {\n if (obj.length === 0)\n return \"[]\";\n else {\n visited.add(obj);\n try {\n const maxElements = STRINGIFY_CONFIG.MAX_ARRAY_ELEMENTS;\n const shouldTruncate = obj.length > maxElements;\n const elementsToProcess = shouldTruncate ? maxElements : obj.length;\n for (let i = 0; i < elementsToProcess; i++) {\n try {\n arrVals.push(stringifyJSONCustom(obj[i], visited));\n } catch {\n arrVals.push('\"[Error serializing array element]\"');\n }\n }\n if (shouldTruncate) {\n arrVals.push(`\"${STRINGIFY_CONFIG.TRUNCATION_MESSAGE} (${obj.length - maxElements} more items)\"`);\n }\n } finally {\n visited.delete(obj);\n }\n try {\n return \"[\" + arrVals.join(\",\") + \"]\";\n } catch {\n console.warn(\"[Fjell Logging] Array too large to serialize completely, using truncated representation\");\n return `[${arrVals.slice(0, 10).join(\",\")},${STRINGIFY_CONFIG.TRUNCATION_MESSAGE}]`;\n }\n }\n } else if (obj instanceof Object) {\n visited.add(obj);\n try {\n objKeys = Object.keys(obj);\n const maxProperties = STRINGIFY_CONFIG.MAX_OBJECT_PROPERTIES;\n const shouldTruncate = objKeys.length > maxProperties;\n const propertiesToProcess = shouldTruncate ? maxProperties : objKeys.length;\n for (let i = 0; i < propertiesToProcess; i++) {\n const key = objKeys[i];\n try {\n const keyOut = '\"' + key + '\":';\n const keyValOut = obj[key];\n if (keyValOut instanceof Function || typeof keyValOut === \"undefined\")\n continue;\n else if (typeof keyValOut === \"string\")\n arrOfKeyVals.push(keyOut + '\"' + keyValOut + '\"');\n else if (typeof keyValOut === \"boolean\" || typeof keyValOut === \"number\" || keyValOut === null)\n arrOfKeyVals.push(keyOut + keyValOut);\n else if (keyValOut instanceof Object) {\n arrOfKeyVals.push(keyOut + stringifyJSONCustom(keyValOut, visited));\n }\n } catch {\n arrOfKeyVals.push('\"' + key + '\":\"[Error serializing property]\"');\n }\n }\n if (shouldTruncate) {\n arrOfKeyVals.push(`\"${STRINGIFY_CONFIG.TRUNCATION_MESSAGE}\":\"(${objKeys.length - maxProperties} more properties)\"`);\n }\n } finally {\n visited.delete(obj);\n }\n try {\n return \"{\" + arrOfKeyVals.join(\",\") + \"}\";\n } catch {\n console.warn(\"[Fjell Logging] Object too large to serialize completely, using truncated representation\");\n return `{${arrOfKeyVals.slice(0, 10).join(\",\")},${STRINGIFY_CONFIG.TRUNCATION_MESSAGE}}`;\n }\n }\n return \"\";\n } catch (error) {\n console.error(\"[Fjell Logging] Error in stringifyJSONCustom, using fallback:\", error);\n return \"[Object: serialization failed]\";\n }\n};\nvar safeFormat = (message, ...args) => {\n let result = message;\n let argIndex = 0;\n result = result.replace(/%([sdjifoO%])/g, (match, specifier) => {\n if (specifier === \"%\") {\n return \"%\";\n }\n if (argIndex >= args.length) {\n return match;\n }\n const arg = args[argIndex++];\n switch (specifier) {\n case \"s\":\n return String(arg);\n case \"d\":\n return String(parseInt(arg, 10));\n case \"i\":\n return String(parseInt(arg, 10));\n case \"f\":\n return String(parseFloat(arg));\n case \"j\":\n try {\n return stringifyJSON(arg);\n } catch {\n return String(arg);\n }\n case \"o\":\n return stringifyJSON(arg);\n case \"O\":\n return stringifyJSON(arg);\n default:\n return String(arg);\n }\n });\n return result;\n};\nvar safeInspect = (obj) => {\n try {\n if (obj && typeof obj === \"object\" && obj.problematic && typeof obj.problematic === \"object\") {\n return \"[Object: object]\";\n }\n return stringifyJSON(obj);\n } catch {\n return `[Object: ${typeof obj}]`;\n }\n};\nvar safeJSONStringify = (obj) => {\n try {\n const seen = /* @__PURE__ */ new WeakSet();\n return JSON.stringify(obj, (key, value) => {\n try {\n if (typeof value === \"symbol\") {\n return String(value);\n }\n if (typeof value === \"function\") {\n return \"[Function]\";\n }\n if (typeof value === \"object\" && value !== null) {\n if (seen.has(value)) {\n return \"[Circular Reference]\";\n }\n seen.add(value);\n }\n if (value instanceof Error) {\n return {\n name: value.name,\n message: value.message,\n stack: value.stack\n };\n }\n if (value instanceof RegExp) {\n return value.toString();\n }\n if (value instanceof Date) {\n return value.toISOString();\n }\n return value;\n } catch (error) {\n console.error(\"[Fjell Logging] Error processing value in replacer:\", error);\n return \"[Error: unable to serialize value]\";\n }\n });\n } catch (error) {\n console.error(\"[Fjell Logging] CRITICAL: safeJSONStringify failed, returning fallback:\", error);\n try {\n const message = obj?.message || obj?.severity || \"Unknown\";\n return JSON.stringify({\n severity: \"ERROR\",\n message: \"[Fjell Logging] Failed to serialize log entry\",\n originalMessage: String(message),\n error: \"Circular reference or non-serializable object detected\"\n });\n } catch {\n return '{\"severity\":\"ERROR\",\"message\":\"[Fjell Logging] Critical serialization failure\"}';\n }\n }\n};\n\n// src/formatter.ts\nvar createFormatter = (logFormat) => {\n if (logFormat.name === \"TEXT\") {\n return getTextFormatter();\n } else if (logFormat.name === \"STRUCTURED\") {\n return getStructuredFormatter();\n }\n throw new Error(`Unknown log format: ${logFormat.name}`);\n};\nvar getTextFormatter = () => {\n const formatLog = (level, coordinates, payload) => {\n const hasSpecifiers = /%[sdjifoO%]/.test(payload.message);\n let logMessage;\n if (payload.data.length === 0) {\n logMessage = payload.message;\n } else if (hasSpecifiers) {\n logMessage = safeFormat(payload.message, ...payload.data);\n } else {\n logMessage = `${payload.message} ${safeInspect(payload.data)}`;\n }\n return `(${(/* @__PURE__ */ new Date()).valueOf()}) [${level.name}] - [${coordinates.category}] ${coordinates.components.map((c) => `[${c}]`)} ${logMessage}`;\n };\n const timerMessage = (level, coordinates, payload) => {\n const randomInt = Math.floor(Math.random() * 1e6);\n const timerMessage2 = `(${(/* @__PURE__ */ new Date()).valueOf()}) [${level.name}] - [${coordinates.category}] ${coordinates.components.map((c) => `[${c}]`)} ${safeFormat(payload.message, ...payload.data)} ${safeInspect(payload.data)} ${randomInt}`;\n return timerMessage2;\n };\n return { formatLog, timerMessage, getLogFormat: () => TEXT };\n};\nvar getStructuredFormatter = () => {\n const formatLog = (level, coordinates, payload) => {\n const severity = level.name;\n const hasSpecifiers = /%[sdjifoO%]/.test(payload.message);\n return safeJSONStringify({\n severity,\n message: hasSpecifiers ? safeFormat(payload.message, ...payload.data) : payload.message,\n \"logging.googleapis.com/labels\": {\n category: coordinates.category,\n components: `${coordinates.components.map((c) => `[${c}]`)}`\n },\n ...!hasSpecifiers && payload.data.length > 0 && { data: safeInspect(payload.data) }\n });\n };\n const timerMessage = (level, coordinates, payload) => {\n const severity = level.name;\n const randomInt = Math.floor(Math.random() * 1e6);\n return safeJSONStringify({\n severity,\n message: safeFormat(payload.message, ...payload.data),\n \"logging.googleapis.com/labels\": {\n category: coordinates.category,\n components: `${coordinates.components.map((c) => `[${c}]`)}`\n },\n data: safeInspect(payload.data),\n \"logging.googleapis.com/spanId\": String(randomInt)\n });\n };\n return { formatLog, timerMessage, getLogFormat: () => STRUCTURED };\n};\n\n// src/FloodControl.ts\nvar hash = (message, data) => {\n const dataString = data.map((item) => {\n try {\n return JSON.stringify(item);\n } catch {\n return stringifyJSON(item);\n }\n }).join(\"\");\n return `${message}${dataString}`;\n};\nvar FloodControl = class {\n config;\n history = /* @__PURE__ */ new Map();\n suppressed = /* @__PURE__ */ new Map();\n cleanupTimer = null;\n constructor(config) {\n this.config = config;\n if (this.config.enabled) {\n this.cleanupTimer = setInterval(() => this.cleanup(), this.config.timeframe * 2);\n }\n }\n destroy() {\n if (this.cleanupTimer) {\n clearInterval(this.cleanupTimer);\n this.cleanupTimer = null;\n }\n }\n cleanup() {\n const now = Date.now();\n for (const [hash2, timestamps] of this.history.entries()) {\n const recentTimestamps = timestamps.filter(\n (timestamp) => now - timestamp < this.config.timeframe\n );\n if (recentTimestamps.length > 0) {\n this.history.set(hash2, recentTimestamps);\n } else {\n this.history.delete(hash2);\n this.suppressed.delete(hash2);\n }\n }\n }\n check(message, data) {\n if (!this.config.enabled) {\n return \"log\";\n }\n const messageHash = hash(message, data);\n const now = Date.now();\n const timestamps = (this.history.get(messageHash) || []).filter(\n (timestamp) => now - timestamp < this.config.timeframe\n );\n timestamps.push(now);\n this.history.set(messageHash, timestamps);\n if (timestamps.length > this.config.threshold) {\n const suppressedInfo = this.suppressed.get(messageHash);\n if (suppressedInfo) {\n suppressedInfo.count++;\n return \"suppress\";\n } else {\n this.suppressed.set(messageHash, { count: 1, firstTimestamp: timestamps[0], summaryLogged: false });\n return \"suppress\";\n }\n } else {\n if (this.suppressed.has(messageHash)) {\n this.suppressed.delete(messageHash);\n return \"resume\";\n }\n }\n return \"log\";\n }\n getSuppressedCount(message, data) {\n const messageHash = hash(message, data);\n return this.suppressed.get(messageHash)?.count || 0;\n }\n};\n\n// src/Logger.ts\nvar createLogger = (logFormat, logLevel, coordinates, floodControlConfig, loggingConfig, writerOptions, options) => {\n const formatter = createFormatter(logFormat);\n const floodControl = floodControlConfig.enabled ? new FloodControl(floodControlConfig) : null;\n const logFunction = console.log;\n const writer = createWriter(formatter, logFunction, writerOptions);\n const asyncLogging = options?.asyncLogging !== false;\n const enableDebugBuffering = asyncLogging;\n const debugBuffer = [];\n const DEBUG_BUFFER_SIZE = 100;\n const DEBUG_FLUSH_INTERVAL = 100;\n let debugFlushTimer = null;\n const flushDebugBuffer = () => {\n if (debugBuffer.length === 0) return;\n try {\n const messagesToFlush = [...debugBuffer];\n debugBuffer.length = 0;\n messagesToFlush.forEach(({ level, coordinates: coordinates2, payload }) => {\n try {\n writer.write(level, coordinates2, payload);\n } catch (error) {\n console.error(\"[Fjell Logging] Error writing buffered log message:\", error);\n }\n });\n } catch (error) {\n console.error(\"[Fjell Logging] Error flushing debug buffer:\", error);\n } finally {\n if (debugFlushTimer) {\n clearTimeout(debugFlushTimer);\n debugFlushTimer = null;\n }\n }\n };\n const scheduleDebugFlush = () => {\n if (debugFlushTimer) return;\n try {\n debugFlushTimer = setTimeout(() => {\n try {\n flushDebugBuffer();\n } catch (error) {\n console.error(\"[Fjell Logging] Error in scheduled debug flush:\", error);\n }\n }, DEBUG_FLUSH_INTERVAL);\n } catch (error) {\n console.error(\"[Fjell Logging] Error scheduling debug flush:\", error);\n }\n };\n const writeImmediate = (level, coordinates2, payload) => {\n try {\n writer.write(level, coordinates2, payload);\n } catch (error) {\n console.error(\"[Fjell Logging] Error writing log message:\", error);\n }\n };\n const handleDebugBuffering = (level, coordinates2, payload) => {\n try {\n debugBuffer.push({ level, coordinates: coordinates2, payload });\n if (debugBuffer.length >= DEBUG_BUFFER_SIZE) {\n flushDebugBuffer();\n } else {\n scheduleDebugFlush();\n }\n } catch (error) {\n console.error(\"[Fjell Logging] Error buffering debug message, falling back to immediate write:\", error);\n writeImmediate(level, coordinates2, payload);\n }\n };\n const write = (level, message, data) => {\n if (logLevel.value < level.value) {\n return;\n }\n const check = floodControl ? floodControl.check(message, data) : \"log\";\n const payload = { message, data };\n const asyncWrite = () => {\n try {\n switch (check) {\n case \"log\":\n if (enableDebugBuffering && (level.name === \"TRACE\" || level.name === \"DEFAULT\" || level.name === \"DEBUG\")) {\n handleDebugBuffering(level, coordinates, payload);\n } else {\n writeImmediate(level, coordinates, payload);\n }\n break;\n case \"suppress\":\n if (floodControl && floodControl.getSuppressedCount(message, data) === 1) {\n try {\n const originalLevel = level;\n const newPayload = { message: `Started suppressing repeated log message`, data: [] };\n writer.write(originalLevel, coordinates, newPayload);\n } catch (error) {\n console.error(\"[Fjell Logging] Error writing suppress message:\", error);\n }\n }\n break;\n case \"resume\": {\n try {\n const count = floodControl ? floodControl.getSuppressedCount(message, data) : 0;\n const resumePayload = {\n message: `Stopped suppressing repeated log message. Suppressed ${count} times.`,\n data: []\n };\n writer.write(level, coordinates, resumePayload);\n writer.write(level, coordinates, payload);\n } catch (error) {\n console.error(\"[Fjell Logging] Error writing resume messages:\", error);\n }\n break;\n }\n }\n } catch (error) {\n console.error(\"[Fjell Logging] Error in async write operation:\", error);\n }\n };\n if (asyncLogging) {\n try {\n if (typeof setImmediate !== \"undefined\") {\n setImmediate(asyncWrite);\n } else {\n setTimeout(asyncWrite, 0);\n }\n } catch (error) {\n console.error(\"[Fjell Logging] Error scheduling async write, falling back to sync:\", error);\n try {\n asyncWrite();\n } catch (syncError) {\n console.error(\"[Fjell Logging] Error in synchronous fallback write:\", syncError);\n }\n }\n } else {\n asyncWrite();\n }\n };\n const startTimeLogger = (logLevel2, coordinates2, payload) => {\n const timerMessage = formatter.timerMessage(logLevel2, coordinates2, payload);\n logLevel2.value >= DEBUG.value && console.time(timerMessage);\n return {\n end: () => {\n logLevel2.value >= DEBUG.value && console.timeEnd(timerMessage);\n },\n log: (...data) => {\n logLevel2.value >= DEBUG.value && console.timeLog(timerMessage, ...data);\n }\n };\n };\n return {\n emergency: (message, ...data) => {\n write(EMERGENCY, message, data);\n },\n alert: (message, ...data) => {\n write(ALERT, message, data);\n },\n critical: (message, ...data) => {\n write(CRITICAL, message, data);\n },\n error: (message, ...data) => {\n write(ERROR, message, data);\n },\n warning: (message, ...data) => {\n write(WARNING, message, data);\n },\n notice: (message, ...data) => {\n write(NOTICE, message, data);\n },\n info: (message, ...data) => {\n write(INFO, message, data);\n },\n debug: (message, ...data) => {\n write(DEBUG, message, data);\n },\n trace: (message, ...data) => {\n write(TRACE, message, data);\n },\n default: (message, ...data) => {\n write(DEFAULT, message, data);\n },\n time: (message, ...data) => {\n const payload = { message, data };\n return startTimeLogger(logLevel, coordinates, payload);\n },\n get: (...additionalComponents) => {\n const newComponents = [...coordinates.components, ...additionalComponents];\n let childLogLevel = logLevel;\n if (loggingConfig) {\n childLogLevel = resolveLogLevel(loggingConfig, coordinates.category, newComponents);\n }\n return createLogger(logFormat, childLogLevel, {\n category: coordinates.category,\n components: newComponents\n }, floodControlConfig, loggingConfig, writerOptions, options);\n },\n destroy: () => {\n try {\n flushDebugBuffer();\n } catch (error) {\n console.error(\"[Fjell Logging] Error flushing debug buffer during destroy:\", error);\n }\n try {\n if (debugFlushTimer) {\n clearTimeout(debugFlushTimer);\n debugFlushTimer = null;\n }\n } catch (error) {\n console.error(\"[Fjell Logging] Error clearing debug flush timer during destroy:\", error);\n }\n try {\n if (floodControl) {\n floodControl.destroy();\n }\n } catch (error) {\n console.error(\"[Fjell Logging] Error destroying flood control during destroy:\", error);\n }\n }\n };\n};\n\n// src/logging.ts\nvar getLogger = (name) => {\n const config = configureLogging();\n const logger = createBaseLogger(name, config);\n return logger;\n};\nvar createBaseLogger = (name, config) => {\n const { logFormat, floodControl } = config;\n const coordinates = { category: name, components: [] };\n const logLevel = resolveLogLevel(config, name, []);\n const isTestEnvironment = true;\n return createLogger(logFormat, logLevel, coordinates, floodControl, config, void 0, {\n asyncLogging: !isTestEnvironment\n });\n};\n\n// src/middleware/maskMiddleware.ts\nfunction maskLogEntry(entry, config = defaultMaskingConfig) {\n if (!config.enabled) {\n return entry;\n }\n const maskedEntry = { ...entry };\n if (typeof maskedEntry.message === \"string\") {\n maskedEntry.message = maskWithConfig(maskedEntry.message, config);\n }\n if (maskedEntry.data !== void 0) {\n maskedEntry.data = maskWithConfig(maskedEntry.data, config);\n }\n if (maskedEntry.meta !== void 0) {\n maskedEntry.meta = maskWithConfig(maskedEntry.meta, config);\n }\n for (const [key, value] of Object.entries(maskedEntry)) {\n if (typeof value === \"string\" && key !== \"level\" && key !== \"timestamp\") {\n maskedEntry[key] = maskWithConfig(value, config);\n }\n }\n return maskedEntry;\n}\nfunction createMaskingMiddleware(config = defaultMaskingConfig) {\n return (entry) => maskLogEntry(entry, config);\n}\nfunction maskLogEntries(entries, config = defaultMaskingConfig) {\n if (!config.enabled) {\n return entries;\n }\n return entries.map((entry) => maskLogEntry(entry, config));\n}\n\n// src/correlation.ts\nfunction generateCorrelationId() {\n const timestamp = Date.now().toString(36);\n const random = Math.random().toString(36).substring(2, 8);\n return `${timestamp}-${random}`;\n}\nvar CorrelatedLogger = class _CorrelatedLogger {\n baseLogger;\n correlationId;\n /**\n * Create a new CorrelatedLogger\n * @param baseLogger - The underlying logger to wrap\n * @param correlationId - Optional correlation ID (generates one if not provided)\n */\n constructor(baseLogger, correlationId) {\n this.baseLogger = baseLogger;\n this.correlationId = correlationId || generateCorrelationId();\n }\n /**\n * Format a message with the correlation ID prefix\n */\n formatWithCorrelation(message) {\n return `[${this.correlationId}] ${message}`;\n }\n /**\n * Get the current correlation ID\n * @returns The correlation ID for this logger\n */\n getCorrelationId() {\n return this.correlationId;\n }\n /**\n * Create a new CorrelatedLogger with a different correlation ID\n * @param id - The new correlation ID to use\n * @returns A new CorrelatedLogger with the specified correlation ID\n */\n withCorrelationId(id) {\n return new _CorrelatedLogger(this.baseLogger, id);\n }\n // Implement Logger interface methods\n emergency(message, ...data) {\n this.baseLogger.emergency(this.formatWithCorrelation(message), ...data);\n }\n alert(message, ...data) {\n this.baseLogger.alert(this.formatWithCorrelation(message), ...data);\n }\n critical(message, ...data) {\n this.baseLogger.critical(this.formatWithCorrelation(message), ...data);\n }\n error(message, ...data) {\n this.baseLogger.error(this.formatWithCorrelation(message), ...data);\n }\n warning(message, ...data) {\n this.baseLogger.warning(this.formatWithCorrelation(message), ...data);\n }\n notice(message, ...data) {\n this.baseLogger.notice(this.formatWithCorrelation(message), ...data);\n }\n info(message, ...data) {\n this.baseLogger.info(this.formatWithCorrelation(message), ...data);\n }\n debug(message, ...data) {\n this.baseLogger.debug(this.formatWithCorrelation(message), ...data);\n }\n trace(message, ...data) {\n this.baseLogger.trace(this.formatWithCorrelation(message), ...data);\n }\n default(message, ...data) {\n this.baseLogger.default(this.formatWithCorrelation(message), ...data);\n }\n time(message, ...data) {\n return this.baseLogger.time(this.formatWithCorrelation(message), ...data);\n }\n get(...additionalComponents) {\n const childLogger = this.baseLogger.get(...additionalComponents);\n return new _CorrelatedLogger(childLogger, this.correlationId);\n }\n destroy() {\n this.baseLogger.destroy();\n }\n};\nfunction createCorrelatedLogger(logger, correlationId) {\n return new CorrelatedLogger(logger, correlationId);\n}\n\n// src/index.ts\nvar index_default = { getLogger };\nexport {\n CorrelatedLogger,\n LogFormat_exports as LogFormat,\n LogLevel_exports as LogLevel,\n createCorrelatedLogger,\n createMaskingMiddleware,\n index_default as default,\n defaultMaskingConfig,\n generateCorrelationId,\n getLogger,\n maskLogEntries,\n maskLogEntry,\n maskObject,\n maskString,\n maskWithConfig,\n resolveLogLevel,\n safeFormat,\n safeInspect,\n stringifyJSON\n};\n","/**\n * Agentic Package - Logger\n *\n * Shared logging infrastructure backed by @fjell/logging for\n * comprehensive sensitive data masking and structured logging.\n */\n\nimport Logging from '@fjell/logging';\n\nexport const LIBRARY_NAME = 'agentic';\n\n// Get the library-level logger from Fjell\nconst LibLogger = Logging.getLogger('@riotprompt/agentic');\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.AGENTIC_LOGGING === 'true' ||\n process.env.DEBUG?.includes('agentic') ||\n process.env.NODE_ENV === 'development';\n};\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/**\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),\n silly: (message: string, ...args: any[]) => fjellLogger.debug(message, ...args),\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 */\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 * - AGENTIC_LOGGING=true\n * - DEBUG=*agentic*\n * - NODE_ENV=development\n */\nexport const DEFAULT_LOGGER: Logger = isLoggingEnabled() ? FJELL_LOGGER : SILENT_LOGGER;\n\nexport function wrapLogger(toWrap: Logger, name?: string): Logger {\n const requiredMethods: (keyof Logger)[] = [\n 'debug',\n 'info',\n 'warn',\n 'error',\n 'verbose',\n 'silly',\n ];\n const missingMethods = requiredMethods.filter(\n (method) => typeof toWrap[method] !== 'function'\n );\n\n if (missingMethods.length > 0) {\n throw new Error(\n `Logger is missing required methods: ${missingMethods.join(', ')}`\n );\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[]) =>\n 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 * Agentic Package - Tool Registry\n *\n * Manages tool definitions and execution for agentic workflows.\n */\n\nimport { z, ZodSchema } from 'zod';\nimport { DEFAULT_LOGGER, wrapLogger, type Logger } from './logger';\nimport { ToolGuard } from './tool-guard';\nimport { ToolSandbox } from './tool-sandbox';\n\n// ===== TYPE DEFINITIONS =====\n\n/**\n * Parameter definition for a tool\n */\nexport interface ToolParameter {\n type: 'string' | 'number' | 'boolean' | 'array' | 'object';\n description: string;\n items?: ToolParameter;\n properties?: Record<string, ToolParameter>;\n required?: string[];\n enum?: string[];\n default?: any;\n}\n\n/**\n * Context provided to tool execution\n */\nexport interface ToolContext {\n workingDirectory?: string;\n storage?: any;\n logger?: Logger;\n conversationState?: any;\n [key: string]: any;\n}\n\n/**\n * Example usage of a tool\n */\nexport interface ToolExample {\n scenario: string;\n params: any;\n expectedResult: string;\n}\n\n/**\n * Cost hint for tool execution\n */\nexport type ToolCost = 'cheap' | 'moderate' | 'expensive';\n\n/**\n * Tool definition\n */\nexport interface Tool {\n name: string;\n description: string;\n parameters: {\n type: 'object';\n properties: Record<string, ToolParameter>;\n required?: string[];\n };\n execute: (params: any, context?: ToolContext) => Promise<any>;\n category?: string;\n cost?: ToolCost;\n examples?: ToolExample[];\n /** Optional Zod schema for parameter validation */\n schema?: ZodSchema<any>;\n}\n\n/**\n * OpenAI-compatible tool format\n */\nexport interface OpenAITool {\n type: 'function';\n function: {\n name: string;\n description: string;\n parameters: {\n type: 'object';\n properties: Record<string, any>;\n required?: string[];\n };\n };\n}\n\n/**\n * Anthropic-compatible tool format\n */\nexport interface AnthropicTool {\n name: string;\n description: string;\n input_schema: {\n type: 'object';\n properties: Record<string, any>;\n required?: string[];\n };\n}\n\n/**\n * Tool execution result\n */\nexport interface ToolExecutionResult {\n success: boolean;\n result?: any;\n error?: string;\n duration?: number;\n}\n\n/**\n * Usage statistics for a tool\n */\nexport interface ToolUsageStats {\n calls: number;\n failures: number;\n successRate: number;\n averageDuration?: number;\n}\n\n/**\n * Tool definition for export\n */\nexport interface ToolDefinition {\n name: string;\n description: string;\n parameters: Tool['parameters'];\n category?: string;\n cost?: ToolCost;\n examples?: ToolExample[];\n schema?: ZodSchema<any>;\n}\n\n// ===== VALIDATION SCHEMAS =====\n\nconst ToolSchema = z\n .object({\n name: z.string().min(1),\n description: z.string().min(1),\n parameters: z\n .object({\n type: z.literal('object'),\n properties: z.record(z.string(), z.any()).default({}),\n required: z.array(z.string()).optional(),\n })\n .passthrough(),\n execute: z.custom<(params: any, context?: any) => Promise<any>>(\n (val) => typeof val === 'function',\n { message: 'execute must be a function' }\n ),\n category: z.string().optional(),\n cost: z.enum(['cheap', 'moderate', 'expensive']).optional(),\n examples: z\n .array(\n z.object({\n scenario: z.string(),\n params: z.any(),\n expectedResult: z.string(),\n })\n )\n .optional(),\n })\n .passthrough();\n\n// ===== TOOL REGISTRY =====\n\n/**\n * ToolRegistry manages tool definitions and execution.\n */\nexport class ToolRegistry {\n private tools: Map<string, Tool>;\n private context: ToolContext;\n private logger: Logger;\n private usageStats: Map<\n string,\n { calls: number; failures: number; totalDuration: number }\n >;\n private toolGuard?: ToolGuard;\n private toolSandbox?: ToolSandbox;\n\n private constructor(context: ToolContext = {}, logger?: Logger) {\n this.tools = new Map();\n this.context = context;\n this.logger = wrapLogger(logger || DEFAULT_LOGGER, 'ToolRegistry');\n this.usageStats = new Map();\n\n this.logger.debug('Created ToolRegistry');\n }\n\n /**\n * Create a new ToolRegistry instance\n */\n static create(context?: ToolContext, logger?: Logger): ToolRegistry {\n return new ToolRegistry(context, logger);\n }\n\n /**\n * Configure security guard for tool execution\n */\n withSecurity(guard: ToolGuard): this {\n this.toolGuard = guard;\n this.logger.debug('Security guard configured');\n return this;\n }\n\n /**\n * Get the configured security guard\n */\n getSecurityGuard(): ToolGuard | undefined {\n return this.toolGuard;\n }\n\n /**\n * Configure sandbox for tool execution\n */\n withSandbox(sandbox: ToolSandbox): this {\n this.toolSandbox = sandbox;\n this.logger.debug('Sandbox configured');\n return this;\n }\n\n /**\n * Get the configured sandbox\n */\n getSandbox(): ToolSandbox | undefined {\n return this.toolSandbox;\n }\n\n /**\n * Register a single tool\n */\n register(tool: Tool): void {\n try {\n ToolSchema.parse(tool);\n } catch (error) {\n throw new Error(`Invalid tool definition for \"${tool.name}\": ${error}`);\n }\n\n if (this.tools.has(tool.name)) {\n this.logger.warn(`Tool \"${tool.name}\" already registered, overwriting`);\n }\n\n this.tools.set(tool.name, tool);\n this.usageStats.set(tool.name, { calls: 0, failures: 0, totalDuration: 0 });\n\n this.logger.debug('Registered tool', {\n name: tool.name,\n category: tool.category,\n });\n }\n\n /**\n * Register multiple tools at once\n */\n registerAll(tools: Tool[]): void {\n this.logger.debug('Registering multiple tools', { count: tools.length });\n tools.forEach((tool) => this.register(tool));\n }\n\n /**\n * Get a tool by name\n */\n get(name: string): Tool | undefined {\n return this.tools.get(name);\n }\n\n /**\n * Get all registered tools\n */\n getAll(): Tool[] {\n return Array.from(this.tools.values());\n }\n\n /**\n * Get tools by category\n */\n getByCategory(category: string): Tool[] {\n return this.getAll().filter((tool) => tool.category === category);\n }\n\n /**\n * Check if a tool is registered\n */\n has(name: string): boolean {\n return this.tools.has(name);\n }\n\n /**\n * Get number of registered tools\n */\n count(): number {\n return this.tools.size;\n }\n\n /**\n * Execute a tool by name\n */\n async execute(name: string, params: any): Promise<any> {\n const tool = this.tools.get(name);\n\n if (!tool) {\n throw new Error(`Tool \"${name}\" not found`);\n }\n\n // Security check: is tool allowed?\n if (this.toolGuard && !this.toolGuard.isToolAllowed(name)) {\n throw new Error(`Tool \"${name}\" is not allowed`);\n }\n\n // Security check: validate parameters if schema exists\n if (this.toolGuard && tool.schema) {\n const validation = this.toolGuard.validateParams(\n name,\n params,\n tool.schema\n );\n if (!validation.success) {\n throw new Error(`Tool \"${name}\": ${validation.error}`);\n }\n params = validation.data;\n }\n\n this.logger.debug('Executing tool', { name, params });\n\n const startTime = Date.now();\n const stats = this.usageStats.get(name)!;\n stats.calls++;\n\n try {\n let result;\n \n // Execute with sandbox if configured\n if (this.toolSandbox) {\n result = await this.toolSandbox.execute(\n tool,\n params,\n this.context\n );\n } else {\n result = await tool.execute(params, this.context);\n }\n\n const duration = Date.now() - startTime;\n stats.totalDuration += duration;\n\n this.logger.debug('Tool execution succeeded', { name, duration });\n\n return result;\n } catch (error) {\n stats.failures++;\n\n this.logger.error('Tool execution failed', { name, error });\n\n throw error;\n }\n }\n\n /**\n * Safely parse and execute a tool from JSON arguments\n */\n async executeFromJSON(name: string, jsonArgs: string): Promise<any> {\n if (this.toolGuard) {\n const parseResult = this.toolGuard.parseToolArguments(name, jsonArgs);\n if (!parseResult.success) {\n throw new Error(`Tool \"${name}\": ${parseResult.error}`);\n }\n return this.execute(name, parseResult.data);\n }\n\n // No guard, parse directly\n const params = JSON.parse(jsonArgs);\n return this.execute(name, params);\n }\n\n /**\n * Execute multiple tools in sequence\n */\n async executeBatch(\n calls: Array<{ name: string; params: any }>\n ): Promise<any[]> {\n this.logger.debug('Executing batch', { count: calls.length });\n\n const results: any[] = [];\n\n for (const call of calls) {\n try {\n const result = await this.execute(call.name, call.params);\n results.push(result);\n } catch (error) {\n results.push({ error: String(error) });\n }\n }\n\n return results;\n }\n\n /**\n * Export tools in OpenAI format\n */\n toOpenAIFormat(): OpenAITool[] {\n return this.getAll().map((tool) => ({\n type: 'function' as const,\n function: {\n name: tool.name,\n description: tool.description,\n parameters: {\n type: 'object' as const,\n properties: tool.parameters.properties,\n required: tool.parameters.required,\n },\n },\n }));\n }\n\n /**\n * Export tools in Anthropic format\n */\n toAnthropicFormat(): AnthropicTool[] {\n return this.getAll().map((tool) => ({\n name: tool.name,\n description: tool.description,\n input_schema: {\n type: 'object' as const,\n properties: tool.parameters.properties,\n required: tool.parameters.required,\n },\n }));\n }\n\n /**\n * Get tool definitions (without execute function)\n */\n getDefinitions(): ToolDefinition[] {\n return this.getAll().map((tool) => ({\n name: tool.name,\n description: tool.description,\n parameters: tool.parameters,\n category: tool.category,\n cost: tool.cost,\n examples: tool.examples,\n schema: tool.schema,\n }));\n }\n\n /**\n * Get usage statistics for all tools\n */\n getUsageStats(): Map<string, ToolUsageStats> {\n const stats = new Map<string, ToolUsageStats>();\n\n this.usageStats.forEach((rawStats, name) => {\n stats.set(name, {\n calls: rawStats.calls,\n failures: rawStats.failures,\n successRate:\n rawStats.calls > 0\n ? (rawStats.calls - rawStats.failures) / rawStats.calls\n : 0,\n averageDuration:\n rawStats.calls > 0\n ? rawStats.totalDuration / rawStats.calls\n : undefined,\n });\n });\n\n return stats;\n }\n\n /**\n * Get most frequently used tools\n */\n getMostUsed(limit: number = 5): Tool[] {\n const sorted = Array.from(this.usageStats.entries())\n .sort((a, b) => b[1].calls - a[1].calls)\n .slice(0, limit)\n .map(([name]) => this.tools.get(name)!)\n .filter((tool) => tool !== undefined);\n\n return sorted;\n }\n\n /**\n * Get list of all categories\n */\n getCategories(): string[] {\n const categories = new Set<string>();\n\n this.getAll().forEach((tool) => {\n if (tool.category) {\n categories.add(tool.category);\n }\n });\n\n return Array.from(categories).sort();\n }\n\n /**\n * Update execution context\n */\n updateContext(context: Partial<ToolContext>): void {\n this.context = { ...this.context, ...context };\n this.logger.debug('Updated context', { keys: Object.keys(context) });\n }\n\n /**\n * Get current context\n */\n getContext(): ToolContext {\n return { ...this.context };\n }\n\n /**\n * Clear all tools\n */\n clear(): void {\n this.logger.debug('Clearing all tools');\n this.tools.clear();\n this.usageStats.clear();\n }\n\n /**\n * Unregister a specific tool\n */\n unregister(name: string): boolean {\n if (this.tools.has(name)) {\n this.tools.delete(name);\n this.usageStats.delete(name);\n this.logger.debug('Unregistered tool', { name });\n return true;\n }\n\n return false;\n }\n\n /**\n * Reset usage statistics\n */\n resetStats(): void {\n this.logger.debug('Resetting usage statistics');\n\n this.usageStats.forEach((stats) => {\n stats.calls = 0;\n stats.failures = 0;\n stats.totalDuration = 0;\n });\n }\n}\n\nexport default ToolRegistry;\n\n","/**\n * Agentic Package - Tool Guard\n *\n * Security layer for tool parameter validation and access control.\n */\n\nimport { ZodSchema, ZodError } from 'zod';\nimport { DEFAULT_LOGGER, wrapLogger, type Logger } from './logger';\n\n/**\n * Configuration for tool security\n */\nexport interface ToolSecurityConfig {\n enabled: boolean;\n validateParams: boolean;\n sandboxExecution: boolean;\n maxExecutionTime: number;\n maxConcurrentCalls: number;\n deniedTools: string[];\n allowedTools?: string[];\n}\n\n/**\n * Result of tool parameter validation\n */\nexport interface ToolValidationResult<T> {\n success: boolean;\n data?: T;\n error?: string;\n violations?: string[];\n}\n\n/**\n * Event handlers for security events\n */\nexport interface ToolGuardEvents {\n onValidationFailed?: (toolName: string, message: string) => void;\n onExecutionBlocked?: (toolName: string, reason: string) => void;\n onPrototypePollution?: (toolName: string) => void;\n}\n\nconst DEFAULT_CONFIG: ToolSecurityConfig = {\n enabled: true,\n validateParams: true,\n sandboxExecution: false,\n maxExecutionTime: 30000,\n maxConcurrentCalls: 10,\n deniedTools: [],\n};\n\n/**\n * ToolGuard provides security validation for tool execution.\n *\n * Features:\n * - Schema-based parameter validation with Zod\n * - Prototype pollution detection\n * - Tool allow/deny lists\n * - Event callbacks for security monitoring\n *\n * @example\n * ```typescript\n * const guard = new ToolGuard({ deniedTools: ['dangerous_tool'] });\n *\n * // Validate parameters\n * const schema = z.object({ path: z.string() });\n * const result = guard.validateParams('read_file', { path: '/test' }, schema);\n *\n * // Check if tool is allowed\n * if (guard.isToolAllowed('my_tool')) {\n * // execute tool\n * }\n * ```\n */\nexport class ToolGuard {\n private config: ToolSecurityConfig;\n private logger: Logger;\n private events: ToolGuardEvents;\n\n constructor(\n config: Partial<ToolSecurityConfig> = {},\n logger?: Logger,\n events: ToolGuardEvents = {}\n ) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.logger = wrapLogger(logger || DEFAULT_LOGGER, 'ToolGuard');\n this.events = events;\n }\n\n /**\n * Validate tool parameters against a Zod schema\n */\n validateParams<T>(\n toolName: string,\n params: unknown,\n schema: ZodSchema<T>\n ): ToolValidationResult<T> {\n if (!this.config.enabled || !this.config.validateParams) {\n // Bypass validation if disabled\n return { success: true, data: params as T };\n }\n\n try {\n const data = schema.parse(params);\n return { success: true, data };\n } catch (error) {\n if (error instanceof ZodError) {\n // Zod 4 uses 'issues' instead of 'errors'\n const issues = error.issues || [];\n const violations = issues.map(\n (e) => `${e.path.join('.')}: ${e.message}`\n );\n const message = `Schema validation failed: ${violations.join('; ')}`;\n\n this.logger.warn(`Tool validation failed for \"${toolName}\"`, {\n violations,\n });\n this.events.onValidationFailed?.(toolName, message);\n\n return {\n success: false,\n error: 'Parameter validation failed',\n violations,\n };\n }\n throw error;\n }\n }\n\n /**\n * Safely parse JSON tool arguments\n */\n parseToolArguments(\n toolName: string,\n jsonString: string\n ): ToolValidationResult<Record<string, unknown>> {\n if (!this.config.enabled) {\n return { success: true, data: JSON.parse(jsonString) };\n }\n\n try {\n // First, try to parse as JSON\n const parsed = JSON.parse(jsonString);\n\n // Check for prototype pollution attempts\n if (this.hasPrototypePollution(parsed)) {\n this.logger.error(\n `Prototype pollution attempt detected for tool \"${toolName}\"`\n );\n this.events.onPrototypePollution?.(toolName);\n return {\n success: false,\n error: 'Invalid tool arguments: potentially malicious content detected',\n };\n }\n\n // Ensure it's an object\n if (\n typeof parsed !== 'object' ||\n parsed === null ||\n Array.isArray(parsed)\n ) {\n return {\n success: false,\n error: 'Tool arguments must be a JSON object',\n };\n }\n\n return { success: true, data: parsed };\n } catch (error) {\n const errorMsg =\n error instanceof Error ? error.message : 'Unknown error';\n this.logger.warn(`JSON parsing failed for tool \"${toolName}\"`, {\n error: errorMsg,\n });\n this.events.onValidationFailed?.(\n toolName,\n `JSON parsing failed: ${errorMsg}`\n );\n return {\n success: false,\n error: 'Invalid JSON in tool arguments',\n };\n }\n }\n\n /**\n * Check if a tool is allowed to execute\n */\n isToolAllowed(toolName: string): boolean {\n if (!this.config.enabled) return true;\n\n // Check deny list\n if (this.config.deniedTools.includes(toolName)) {\n this.logger.warn(`Tool \"${toolName}\" blocked by deny list`);\n this.events.onExecutionBlocked?.(toolName, 'Tool is in deny list');\n return false;\n }\n\n // Check allow list if specified\n if (\n this.config.allowedTools &&\n !this.config.allowedTools.includes(toolName)\n ) {\n this.logger.warn(`Tool \"${toolName}\" not in allow list`);\n this.events.onExecutionBlocked?.(\n toolName,\n 'Tool is not in allow list'\n );\n return false;\n }\n\n return true;\n }\n\n /**\n * Get current configuration\n */\n getConfig(): Readonly<ToolSecurityConfig> {\n return { ...this.config };\n }\n\n /**\n * Update configuration\n */\n updateConfig(config: Partial<ToolSecurityConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Add a tool to the deny list\n */\n denyTool(toolName: string): void {\n if (!this.config.deniedTools.includes(toolName)) {\n this.config.deniedTools.push(toolName);\n }\n }\n\n /**\n * Remove a tool from the deny list\n */\n allowTool(toolName: string): void {\n const index = this.config.deniedTools.indexOf(toolName);\n if (index !== -1) {\n this.config.deniedTools.splice(index, 1);\n }\n }\n\n /**\n * Check if security is enabled\n */\n isEnabled(): boolean {\n return this.config.enabled;\n }\n\n /**\n * Enable or disable security\n */\n setEnabled(enabled: boolean): void {\n this.config.enabled = enabled;\n }\n\n /**\n * Detect prototype pollution attempts\n */\n private hasPrototypePollution(obj: unknown, depth: number = 0): boolean {\n if (depth > 10) return false; // Prevent stack overflow\n if (typeof obj !== 'object' || obj === null) return false;\n\n const dangerousKeys = ['__proto__', 'constructor', 'prototype'];\n\n for (const key of Object.keys(obj)) {\n if (dangerousKeys.includes(key)) {\n return true;\n }\n\n if (typeof (obj as Record<string, unknown>)[key] === 'object') {\n if (\n this.hasPrototypePollution(\n (obj as Record<string, unknown>)[key],\n depth + 1\n )\n ) {\n return true;\n }\n }\n }\n\n return false;\n }\n}\n\nexport default ToolGuard;\n\n","/**\n * Agentic Package - Tool Sandbox\n *\n * Capability-based sandboxing for tool execution with timeout,\n * concurrency limits, and output size restrictions.\n */\n\nimport { ToolContext, Tool } from './tools';\nimport { ToolSecurityConfig, ToolGuard } from './tool-guard';\nimport { DEFAULT_LOGGER, wrapLogger, type Logger } from './logger';\n\n/**\n * Extended context with sandbox restrictions\n */\nexport interface SandboxedContext extends ToolContext {\n readonly sandbox: {\n allowedOperations: Set<string>;\n maxOutputSize: number;\n executionId: string;\n };\n}\n\n/**\n * Options for sandbox execution\n */\nexport interface SandboxOptions {\n maxExecutionTime: number;\n maxOutputSize: number;\n allowedOperations?: string[];\n onBeforeExecution?: (\n tool: Tool,\n params: unknown\n ) => void | Promise<void>;\n onAfterExecution?: (\n tool: Tool,\n result: unknown,\n error?: Error\n ) => void | Promise<void>;\n}\n\n/**\n * Event handlers for sandbox events\n */\nexport interface ToolSandboxEvents {\n onConcurrencyExceeded?: (toolName: string, activeCount: number) => void;\n onTimeout?: (toolName: string, timeoutMs: number) => void;\n onOutputSizeExceeded?: (\n toolName: string,\n size: number,\n maxSize: number\n ) => void;\n onCancelled?: (executionId: string) => void;\n}\n\n/**\n * ToolSandbox provides capability-based sandboxing for tool execution.\n *\n * Features:\n * - Execution timeout enforcement\n * - Concurrent execution limits\n * - Output size limits\n * - Pre/post execution hooks\n * - Cancellation support\n *\n * Note: This provides capability-based restrictions, not true process isolation.\n * For maximum security, consider running untrusted tools in separate processes.\n *\n * @example\n * ```typescript\n * const sandbox = new ToolSandbox({\n * maxExecutionTime: 5000,\n * maxConcurrentCalls: 5,\n * });\n *\n * const result = await sandbox.execute(tool, params, context);\n * ```\n */\nexport class ToolSandbox {\n private config: ToolSecurityConfig;\n private logger: Logger;\n private events: ToolSandboxEvents;\n private activeExecutions: Map<string, AbortController> = new Map();\n private executionCount: number = 0;\n\n constructor(\n config: Partial<ToolSecurityConfig> = {},\n logger?: Logger,\n events: ToolSandboxEvents = {}\n ) {\n this.config = {\n enabled: true,\n validateParams: true,\n sandboxExecution: true,\n maxExecutionTime: 30000,\n maxConcurrentCalls: 10,\n deniedTools: [],\n ...config,\n };\n this.logger = wrapLogger(logger || DEFAULT_LOGGER, 'ToolSandbox');\n this.events = events;\n }\n\n /**\n * Execute a tool with sandbox restrictions\n */\n async execute<T>(\n tool: Tool,\n params: unknown,\n baseContext: ToolContext,\n options: Partial<SandboxOptions> = {}\n ): Promise<T> {\n if (!this.config.enabled || !this.config.sandboxExecution) {\n // Bypass sandboxing if disabled\n return tool.execute(params, baseContext);\n }\n\n // Check concurrent execution limit\n if (this.activeExecutions.size >= this.config.maxConcurrentCalls) {\n this.logger.warn('Max concurrent executions reached', {\n toolName: tool.name,\n activeCount: this.activeExecutions.size,\n limit: this.config.maxConcurrentCalls,\n });\n this.events.onConcurrencyExceeded?.(\n tool.name,\n this.activeExecutions.size\n );\n throw new Error('Too many concurrent tool executions');\n }\n\n const executionId = `exec-${++this.executionCount}-${Date.now()}`;\n const controller = new AbortController();\n this.activeExecutions.set(executionId, controller);\n\n const sandboxedContext: SandboxedContext = {\n ...baseContext,\n sandbox: {\n allowedOperations: new Set(options.allowedOperations || []),\n maxOutputSize: options.maxOutputSize || 1024 * 1024, // 1MB default\n executionId,\n },\n };\n\n const timeout = options.maxExecutionTime || this.config.maxExecutionTime;\n\n try {\n // Pre-execution hook\n await options.onBeforeExecution?.(tool, params);\n\n // Execute with timeout\n const result = await this.executeWithTimeout(\n () => tool.execute(params, sandboxedContext),\n timeout,\n controller.signal,\n tool.name\n );\n\n // Check output size\n const outputSize = this.estimateSize(result);\n if (outputSize > sandboxedContext.sandbox.maxOutputSize) {\n this.logger.warn('Tool output exceeded max size', {\n toolName: tool.name,\n outputSize,\n maxSize: sandboxedContext.sandbox.maxOutputSize,\n });\n this.events.onOutputSizeExceeded?.(\n tool.name,\n outputSize,\n sandboxedContext.sandbox.maxOutputSize\n );\n throw new Error('Tool output exceeded maximum size limit');\n }\n\n // Post-execution hook\n await options.onAfterExecution?.(tool, result);\n\n return result as T;\n } catch (error) {\n await options.onAfterExecution?.(tool, undefined, error as Error);\n throw error;\n } finally {\n this.activeExecutions.delete(executionId);\n }\n }\n\n /**\n * Cancel all active executions\n */\n cancelAll(): void {\n for (const [id, controller] of this.activeExecutions) {\n controller.abort();\n this.logger.info('Execution cancelled', { executionId: id });\n this.events.onCancelled?.(id);\n }\n this.activeExecutions.clear();\n }\n\n /**\n * Cancel a specific execution by ID\n */\n cancel(executionId: string): boolean {\n const controller = this.activeExecutions.get(executionId);\n if (controller) {\n controller.abort();\n this.activeExecutions.delete(executionId);\n this.logger.info('Execution cancelled', { executionId });\n this.events.onCancelled?.(executionId);\n return true;\n }\n return false;\n }\n\n /**\n * Get active execution count\n */\n getActiveCount(): number {\n return this.activeExecutions.size;\n }\n\n /**\n * Get list of active execution IDs\n */\n getActiveExecutionIds(): string[] {\n return Array.from(this.activeExecutions.keys());\n }\n\n /**\n * Check if sandbox is enabled\n */\n isEnabled(): boolean {\n return this.config.enabled && this.config.sandboxExecution;\n }\n\n /**\n * Get current configuration\n */\n getConfig(): Readonly<ToolSecurityConfig> {\n return { ...this.config };\n }\n\n /**\n * Update configuration\n */\n updateConfig(config: Partial<ToolSecurityConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n private async executeWithTimeout<T>(\n fn: () => Promise<T>,\n timeoutMs: number,\n signal: AbortSignal,\n toolName: string\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n this.logger.warn('Tool execution timed out', {\n toolName,\n timeoutMs,\n });\n this.events.onTimeout?.(toolName, timeoutMs);\n reject(\n new Error(`Tool execution timed out after ${timeoutMs}ms`)\n );\n }, timeoutMs);\n\n const abortHandler = () => {\n clearTimeout(timeoutId);\n reject(new Error('Tool execution was cancelled'));\n };\n signal.addEventListener('abort', abortHandler, { once: true });\n\n fn()\n .then((result) => {\n clearTimeout(timeoutId);\n signal.removeEventListener('abort', abortHandler);\n resolve(result);\n })\n .catch((error) => {\n clearTimeout(timeoutId);\n signal.removeEventListener('abort', abortHandler);\n reject(error);\n });\n });\n }\n\n private estimateSize(value: unknown): number {\n if (value === null || value === undefined) return 0;\n if (typeof value === 'string') return value.length * 2; // UTF-16\n if (typeof value === 'number') return 8;\n if (typeof value === 'boolean') return 4;\n if (Buffer.isBuffer(value)) return value.length;\n try {\n return JSON.stringify(value).length * 2;\n } catch {\n return 0;\n }\n }\n}\n\n/**\n * Create a security-wrapped version of a tool\n */\nexport function createSecureTool(\n tool: Tool,\n sandbox: ToolSandbox,\n guard: ToolGuard\n): Tool {\n return {\n ...tool,\n execute: async (params, context) => {\n // Check if tool is allowed\n if (!guard.isToolAllowed(tool.name)) {\n throw new Error(`Tool \"${tool.name}\" is not allowed`);\n }\n\n // Validate params if schema exists\n if (tool.schema) {\n const validation = guard.validateParams(\n tool.name,\n params,\n tool.schema\n );\n if (!validation.success) {\n throw new Error(`Validation failed: ${validation.error}`);\n }\n params = validation.data;\n }\n\n // Execute in sandbox\n return sandbox.execute(tool, params, context || {});\n },\n };\n}\n\nexport default ToolSandbox;\n\n","export default {}","/**\n * Agentic Package - Context Manager\n *\n * Tracks and manages dynamically injected context in conversations.\n */\n\nimport crypto from 'crypto';\nimport { DEFAULT_LOGGER, wrapLogger, type Logger } from './logger';\nimport type { DynamicContentItem, TrackedContextItem } from './types';\n\n/**\n * Context statistics\n */\nexport interface ContextStats {\n totalItems: number;\n byCategory: Map<string, number>;\n byPriority: Map<string, number>;\n bySource: Map<string, number>;\n oldestTimestamp?: Date;\n newestTimestamp?: Date;\n}\n\n/**\n * ContextManager tracks and manages dynamically injected context.\n */\nexport class ContextManager {\n private items: Map<string, TrackedContextItem>;\n private hashes: Set<string>;\n private logger: Logger;\n\n constructor(logger?: Logger) {\n this.items = new Map();\n this.hashes = new Set();\n this.logger = wrapLogger(logger || DEFAULT_LOGGER, 'ContextManager');\n }\n\n /**\n * Track a context item\n */\n track(item: DynamicContentItem, position: number): void {\n const hash = this.hashContent(item.content);\n\n if (!item.id && this.hashes.has(hash)) {\n this.logger.debug('Skipping duplicate context item by hash', { hash });\n return;\n }\n\n const id = item.id || this.generateId();\n\n const trackedItem: TrackedContextItem = {\n ...item,\n id,\n hash,\n position,\n injectedAt: new Date(),\n timestamp: item.timestamp || new Date(),\n priority: item.priority || 'medium',\n };\n\n this.items.set(id, trackedItem);\n this.hashes.add(hash);\n\n this.logger.debug('Tracked context item', {\n id,\n category: item.category,\n position,\n });\n }\n\n /**\n * Check if context with given ID exists\n */\n hasContext(id: string): boolean {\n return this.items.has(id);\n }\n\n /**\n * Check if content with given hash exists\n */\n hasContentHash(content: string): boolean {\n const hash = this.hashContent(content);\n return this.hashes.has(hash);\n }\n\n /**\n * Check if similar content exists (fuzzy match)\n */\n hasSimilarContent(\n content: string,\n similarityThreshold: number = 0.9\n ): boolean {\n const MAX_ITEMS_WARNING = 1000;\n if (this.items.size > MAX_ITEMS_WARNING) {\n this.logger.warn(\n 'Large number of context items, similarity check may be slow',\n {\n count: this.items.size,\n threshold: MAX_ITEMS_WARNING,\n }\n );\n }\n\n const normalized = this.normalizeContent(content);\n\n for (const item of this.items.values()) {\n const itemNormalized = this.normalizeContent(item.content || '');\n\n if (normalized === itemNormalized) {\n return true;\n }\n\n const longer =\n normalized.length > itemNormalized.length\n ? normalized\n : itemNormalized;\n const shorter =\n normalized.length <= itemNormalized.length\n ? normalized\n : itemNormalized;\n\n const lengthRatio = shorter.length / longer.length;\n\n if (lengthRatio >= similarityThreshold) {\n if (longer.includes(shorter)) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Get context item by ID\n */\n get(id: string): TrackedContextItem | undefined {\n return this.items.get(id);\n }\n\n /**\n * Get all tracked context items\n */\n getAll(): TrackedContextItem[] {\n return Array.from(this.items.values());\n }\n\n /**\n * Get context items by category\n */\n getByCategory(category: string): TrackedContextItem[] {\n return this.getAll().filter((item) => item.category === category);\n }\n\n /**\n * Get context items by priority\n */\n getByPriority(priority: 'high' | 'medium' | 'low'): TrackedContextItem[] {\n return this.getAll().filter((item) => item.priority === priority);\n }\n\n /**\n * Get context items by source\n */\n getBySource(source: string): TrackedContextItem[] {\n return this.getAll().filter((item) => item.source === source);\n }\n\n /**\n * Get all categories\n */\n getCategories(): string[] {\n const categories = new Set<string>();\n this.items.forEach((item) => {\n if (item.category) {\n categories.add(item.category);\n }\n });\n return Array.from(categories).sort();\n }\n\n /**\n * Get context statistics\n */\n getStats(): ContextStats {\n const byCategory = new Map<string, number>();\n const byPriority = new Map<string, number>();\n const bySource = new Map<string, number>();\n let oldestTimestamp: Date | undefined;\n let newestTimestamp: Date | undefined;\n\n this.items.forEach((item) => {\n if (item.category) {\n byCategory.set(\n item.category,\n (byCategory.get(item.category) || 0) + 1\n );\n }\n\n const priority = item.priority || 'medium';\n byPriority.set(priority, (byPriority.get(priority) || 0) + 1);\n\n if (item.source) {\n bySource.set(item.source, (bySource.get(item.source) || 0) + 1);\n }\n\n if (item.timestamp) {\n if (!oldestTimestamp || item.timestamp < oldestTimestamp) {\n oldestTimestamp = item.timestamp;\n }\n if (!newestTimestamp || item.timestamp > newestTimestamp) {\n newestTimestamp = item.timestamp;\n }\n }\n });\n\n return {\n totalItems: this.items.size,\n byCategory,\n byPriority,\n bySource,\n oldestTimestamp,\n newestTimestamp,\n };\n }\n\n /**\n * Remove context item by ID\n */\n remove(id: string): boolean {\n const item = this.items.get(id);\n if (item) {\n this.items.delete(id);\n this.hashes.delete(item.hash);\n this.logger.debug('Removed context item', { id });\n return true;\n }\n return false;\n }\n\n /**\n * Clear all tracked context\n */\n clear(): void {\n this.items.clear();\n this.hashes.clear();\n this.logger.debug('Cleared all context');\n }\n\n private generateId(): string {\n return `ctx-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n }\n\n private hashContent(content: string): string {\n // Use 32 characters (128 bits) for sufficient collision resistance\n return crypto\n .createHash('sha256')\n .update(content)\n .digest('hex')\n .substring(0, 32);\n }\n\n private normalizeContent(content: string): string {\n return content.replace(/\\s+/g, ' ').trim().toLowerCase();\n }\n}\n\nexport default ContextManager;\n\n","/**\n * Agentic Package\n *\n * Components for building agentic AI workflows:\n * - Tool registry and execution\n * - Context management\n * - Conversation state tracking\n *\n * @packageDocumentation\n */\n\n// Types\nexport type {\n ConversationMessage,\n ToolCall,\n Model,\n ToolUsagePolicy,\n IterationAction,\n ToolCallAction,\n InjectOptions,\n DynamicContentItem,\n TrackedContextItem,\n LLMClient,\n StrategyState,\n Insight,\n ToolResult,\n PhaseResult,\n TokenUsage,\n CompressionStats,\n CompressionStrategy,\n TokenBudgetConfig,\n LogFormat,\n LogConfig,\n} from './types';\n\n// Logger\nexport type { Logger } from './logger';\nexport { DEFAULT_LOGGER, wrapLogger, LIBRARY_NAME } from './logger';\n\n// Tool Registry\nexport type {\n ToolParameter,\n ToolContext,\n ToolExample,\n ToolCost,\n Tool,\n OpenAITool,\n AnthropicTool,\n ToolExecutionResult,\n ToolUsageStats,\n ToolDefinition,\n} from './tools';\nexport { ToolRegistry } from './tools';\n\n// Tool Security\nexport type {\n ToolSecurityConfig,\n ToolValidationResult,\n ToolGuardEvents,\n} from './tool-guard';\nexport { ToolGuard } from './tool-guard';\n\n// Tool Sandboxing\nexport type {\n SandboxedContext,\n SandboxOptions,\n ToolSandboxEvents,\n} from './tool-sandbox';\nexport { ToolSandbox, createSecureTool } from './tool-sandbox';\n\n// Context Manager\nexport type { ContextStats } from './context-manager';\nexport { ContextManager } from './context-manager';\n\n/**\n * Package version\n */\nexport const VERSION = '0.0.1';\n"],"names":["Logging","hash"],"mappings":";AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,WAAW,CAAC,QAAQ,QAAQ;AAC9B,WAA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t/agentic 0.0.2 — Safer npm publishing (clean + prepublish build)
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
This release is primarily about making npm publishes more reliable by ensuring build artifacts are recreated automatically before publishing.
|
|
5
|
+
|
|
6
|
+
## Changes
|
|
7
|
+
### Reliable publish artifacts
|
|
8
|
+
- **Added `clean` script**: removes `dist/` (`rm -rf dist`).
|
|
9
|
+
- **Added `prepublishOnly` script**: runs `clean` and then `build` (`npm run clean && npm run build`).
|
|
10
|
+
|
|
11
|
+
**Why this matters:** the package entrypoints (`main`/`module`/`types`) point at files under `dist/`. With `prepublishOnly`, `npm publish` will consistently ship fresh compiled JS/CJS and type declarations, reducing the risk of publishing with missing or stale `dist` contents.
|
|
12
|
+
|
|
13
|
+
### Repo hygiene
|
|
14
|
+
- Updated `.gitignore` to ignore local/dev artifacts (notably `output/` and `kodrdriv` cache/config files), reducing accidental commits of tooling output.
|
|
15
|
+
|
|
16
|
+
### Dependency metadata
|
|
17
|
+
- Updated `package-lock.json` (no direct runtime dependency changes were introduced in `package.json`).
|
|
18
|
+
|
|
19
|
+
## Impact
|
|
20
|
+
- **Users installing from npm:** should see no API/runtime changes, but publishing should be more dependable (package is less likely to be missing compiled outputs).
|
|
21
|
+
- **Developers/maintainers publishing the package:** `npm publish` will now run a clean build automatically.
|
|
22
|
+
|
|
23
|
+
## Breaking changes
|
|
24
|
+
- **None expected.**
|
|
25
|
+
|
|
26
|
+
## Notes / considerations
|
|
27
|
+
- The `clean` script uses `rm -rf`, which assumes a POSIX-like shell. If you publish from Windows without a compatible shell, you may need to run publishing in an environment that supports it (or adjust the script).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chore(release): bump version to 0.0.3
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @riotprompt/agentic v0.0.3 — test/coverage workflow improvements + dependency updates
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
This release is primarily about improving the project’s test setup and CI ergonomics (separating tests from `src/`, generating coverage by default), plus routine dependency updates.
|
|
5
|
+
|
|
6
|
+
No production source files changed in this range; the runtime/public API is expected to be unchanged.
|
|
7
|
+
|
|
8
|
+
## What changed
|
|
9
|
+
### Testing & coverage
|
|
10
|
+
- **Tests moved out of `src/` into `tests/`**
|
|
11
|
+
- `src/context-manager.test.ts` → `tests/context-manager.test.ts`
|
|
12
|
+
- `src/tools.test.ts` → `tests/tools.test.ts`
|
|
13
|
+
- Imports were updated to reference `../src/...`.
|
|
14
|
+
- **Why it matters:** keeps the production source tree clean and avoids test files being treated like library source (e.g., during packaging/type generation).
|
|
15
|
+
|
|
16
|
+
- **Coverage is now generated by default when running tests**
|
|
17
|
+
- `npm test` now runs: `vitest run --coverage`
|
|
18
|
+
- Added explicit alias: `npm run test:coverage`
|
|
19
|
+
- Coverage reporting now includes **text, JSON, and HTML**.
|
|
20
|
+
- Coverage config excludes common non-source inputs (`dist/**`, config files, etc.) to reduce noise.
|
|
21
|
+
- **Why it matters:** makes it easier to enforce and consume coverage in CI and to inspect results locally.
|
|
22
|
+
|
|
23
|
+
### Developer workflow
|
|
24
|
+
- Added a `precommit` script:
|
|
25
|
+
- `npm run precommit` → runs `lint` then `test`
|
|
26
|
+
- **Note:** this adds a convenient entry point, but does not itself install a git hook (that would require additional tooling/config).
|
|
27
|
+
|
|
28
|
+
### Dependency updates
|
|
29
|
+
- **zod** upgraded from `^3.25.51` → `^4.3.5`
|
|
30
|
+
- **vitest** upgraded from `^3.2.4` → `^4.0.16`
|
|
31
|
+
- Added **@vitest/coverage-v8** `^4.0.16` to support v8 coverage reporting
|
|
32
|
+
- **globals** upgraded from `^16.2.0` → `^17.0.0`
|
|
33
|
+
- `package-lock.json` updated accordingly
|
|
34
|
+
|
|
35
|
+
## Impact
|
|
36
|
+
### For library consumers
|
|
37
|
+
- No expected behavior/API changes in the exported library surface.
|
|
38
|
+
- Indirect impact: the package now depends on **Zod v4**. Most consumers won’t notice, but if your tooling forces dependency deduping/resolutions, ensure your Zod constraints are compatible.
|
|
39
|
+
|
|
40
|
+
### For contributors/maintainers
|
|
41
|
+
- `npm test` is now **slower** (coverage collection is enabled by default) but produces coverage artifacts/reports.
|
|
42
|
+
- Tests must live under `tests/**/*.test.ts` to be picked up by the current Vitest config.
|
|
43
|
+
|
|
44
|
+
## Breaking changes
|
|
45
|
+
- No explicit breaking changes detected in code or exports.
|
|
46
|
+
- Potential workflow break for contributors: if you had tests under `src/**/*.test.ts`, they will **no longer run** unless moved under `tests/` (or the Vitest include pattern is adjusted).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Package metadata: add repository URL and resync lockfile
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
This release is primarily housekeeping: it adds the correct `repository` metadata to `package.json` and refreshes `package-lock.json` after syncing branches.
|
|
5
|
+
|
|
6
|
+
## Changes
|
|
7
|
+
- **Added `repository` metadata to `package.json`**
|
|
8
|
+
- `repository.type`: `git`
|
|
9
|
+
- `repository.url`: `https://github.com/kjerneverk/agentic`
|
|
10
|
+
- **Updated `package-lock.json`** to reflect the current merged dependency graph.
|
|
11
|
+
|
|
12
|
+
## Why this matters
|
|
13
|
+
- **Users**: npm and other tooling can now reliably surface links back to the source repository (e.g., “Repository” link on npmjs.com, `npm repo`, and related ecosystem tooling).
|
|
14
|
+
- **Developers/maintainers**: improves package discoverability and makes it easier to trace builds/issues back to the correct GitHub repo; lockfile refresh helps keep local installs reproducible.
|
|
15
|
+
|
|
16
|
+
## Breaking changes
|
|
17
|
+
- **None.** No runtime code, public API, exports, or dependency declarations changed (only metadata and lockfile normalization).
|
|
18
|
+
|
|
19
|
+
## Notes
|
|
20
|
+
- If you develop from the repo, run `npm ci` (or `npm install`) to pick up the lockfile refresh.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chore(release): bump version to 0.0.4
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @riotprompt/agentic 0.0.4 — CI moves to Node 24; install workflow updates
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
This release is primarily a tooling/CI update. There are no library API/runtime changes in this diff; the main impact is on contributors and release automation.
|
|
5
|
+
|
|
6
|
+
## Changes
|
|
7
|
+
### CI and publishing now run on Node.js 24
|
|
8
|
+
- GitHub Actions workflows (`test` and `npm-publish`) were updated from **Node 22 → Node 24**.
|
|
9
|
+
- This aligns CI with newer tooling expectations and reduces failures when dependencies require newer Node versions.
|
|
10
|
+
|
|
11
|
+
**Impact (developers):** if you run the same toolchain locally (lint/build/test), you should use **Node 24** to match CI.
|
|
12
|
+
|
|
13
|
+
### Switch from `npm ci` to `npm install` in GitHub Actions
|
|
14
|
+
- Both workflows now use `npm install` instead of `npm ci`.
|
|
15
|
+
|
|
16
|
+
**Why it matters:** `npm ci` requires a committed lockfile. The repo changes in this range indicate the lockfile is no longer expected to be present in the repository, so CI needed to switch to an install mode that works without it.
|
|
17
|
+
|
|
18
|
+
**Impact (developers/maintainers):** installs may be less “bit-for-bit” reproducible than `npm ci` unless you manage lockfiles in another way.
|
|
19
|
+
|
|
20
|
+
### Lockfile is no longer tracked
|
|
21
|
+
- `package-lock.json` is now ignored via `.gitignore`.
|
|
22
|
+
|
|
23
|
+
**Impact (contributors):** don’t commit `package-lock.json` changes going forward; local installs will still generate a lockfile, but it’s intentionally not tracked.
|
|
24
|
+
|
|
25
|
+
### Version bump
|
|
26
|
+
- `package.json` version: **0.0.3 → 0.0.4**.
|
|
27
|
+
|
|
28
|
+
## Breaking changes
|
|
29
|
+
- **No user-facing API breaking changes detected.**
|
|
30
|
+
- **Potential developer-facing breaking change:** CI standardizes on **Node 24**. If you were using Node 22 for local development/tests, you may need to upgrade to keep parity with CI.
|
|
31
|
+
|
|
32
|
+
## Notes for maintainers
|
|
33
|
+
- Release and test workflows now rely on `npm install`; ensure your release process does not assume a committed lockfile.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chore(build): ship ESM-only bundle and target Node 24 / ES2024
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chore(release): bump version to 0.0.5
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @riotprompt/agentic v0.0.5 — ESM-only distribution, Node 24+ / ES2024 target
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This release is primarily a packaging/build update. The library now ships **ESM-only** output and raises the runtime baseline to **Node.js 24+** while targeting **ES2024**.
|
|
5
|
+
|
|
6
|
+
There are **no source/API changes** in this release range—changes are limited to `package.json`, `vite.config.ts`, and `tsconfig.json`.
|
|
7
|
+
|
|
8
|
+
## Breaking changes
|
|
9
|
+
### ESM-only distribution (CommonJS removed)
|
|
10
|
+
- The package no longer builds or publishes a CommonJS bundle (`dist/index.cjs`).
|
|
11
|
+
- `package.json` no longer provides an `exports["."].require` entry.
|
|
12
|
+
|
|
13
|
+
**Impact:**
|
|
14
|
+
- Consumers using `require("@riotprompt/agentic")` will fail.
|
|
15
|
+
|
|
16
|
+
**Migration:**
|
|
17
|
+
- Use ESM import:
|
|
18
|
+
```js
|
|
19
|
+
import { ... } from "@riotprompt/agentic";
|
|
20
|
+
```
|
|
21
|
+
- If you are in a CommonJS codebase, use dynamic import:
|
|
22
|
+
```js
|
|
23
|
+
const mod = await import("@riotprompt/agentic");
|
|
24
|
+
```
|
|
25
|
+
(or convert the consuming project/package to ESM).
|
|
26
|
+
|
|
27
|
+
### Node engine requirement raised to >= 24
|
|
28
|
+
- `package.json` now declares:
|
|
29
|
+
- `engines.node: ">=24.0.0"`
|
|
30
|
+
|
|
31
|
+
**Impact:**
|
|
32
|
+
- npm/yarn/pnpm may block installation (or warn, depending on configuration) on Node versions older than 24.
|
|
33
|
+
|
|
34
|
+
## Build & distribution changes
|
|
35
|
+
- **Entry points simplified to ESM:**
|
|
36
|
+
- `main` now points to `./dist/index.js` (previously `./dist/index.cjs`).
|
|
37
|
+
- `exports["."].import` remains `./dist/index.js`.
|
|
38
|
+
- **Vite library build now outputs only ES format:**
|
|
39
|
+
- `formats: ["es"]`
|
|
40
|
+
- `fileName: () => "index.js"`
|
|
41
|
+
- **TypeScript target updated to ES2024:**
|
|
42
|
+
- `compilerOptions.target: "ES2024"`
|
|
43
|
+
- `compilerOptions.lib: ["ES2024"]`
|
|
44
|
+
|
|
45
|
+
## Why this matters
|
|
46
|
+
- Removes the complexity and ambiguity of dual ESM/CJS publishing.
|
|
47
|
+
- Aligns the build output with modern Node runtimes and ES2024 language/library features.
|
|
48
|
+
- Makes consumption consistent for ESM-first projects.
|
|
49
|
+
|
|
50
|
+
## Upgrade checklist
|
|
51
|
+
- Ensure CI/runtime is running **Node 24+**.
|
|
52
|
+
- Update any CommonJS usage (`require`) to ESM `import` or dynamic `import()`.
|
|
53
|
+
- If you had tooling that expected `dist/index.cjs`, update it to reference `dist/index.js` and ESM semantics.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chore(git-hooks): run build in precommit script
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chore(release): bump version to 1.0.0
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# v1.0.0: Tool execution security (ToolGuard/ToolSandbox), safer defaults, and improved tool invocation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This release focuses on making tool execution safer and more controllable in agentic workflows. It introduces opt-in security and sandboxing layers for tools, changes the default logging behavior to reduce accidental information disclosure, and adds safer JSON argument handling for tool calls.
|
|
5
|
+
|
|
6
|
+
## Highlights
|
|
7
|
+
|
|
8
|
+
### Tool execution security (new)
|
|
9
|
+
You can now add a security layer to tool execution via **ToolGuard**:
|
|
10
|
+
|
|
11
|
+
- **Allow/deny lists** for tools (`allowedTools`, `deniedTools`)
|
|
12
|
+
- **Zod-based parameter validation** (when a tool provides a `schema`)
|
|
13
|
+
- **Safe JSON argument parsing** with **prototype pollution detection** (`__proto__`, `constructor`, `prototype`)
|
|
14
|
+
- **Security event hooks** for monitoring/telemetry (validation failures, blocked execution, prototype pollution attempts)
|
|
15
|
+
|
|
16
|
+
New/updated APIs:
|
|
17
|
+
- `ToolRegistry.withSecurity(guard)`
|
|
18
|
+
- `ToolRegistry.getSecurityGuard()`
|
|
19
|
+
- `ToolRegistry.executeFromJSON(name, jsonArgs)` (uses `ToolGuard` parsing when configured)
|
|
20
|
+
- `Tool` and `ToolDefinition` now support an optional `schema?: ZodSchema<any>`
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
```ts
|
|
24
|
+
import { ToolRegistry, ToolGuard } from '@riotprompt/agentic';
|
|
25
|
+
import { z } from 'zod';
|
|
26
|
+
|
|
27
|
+
const registry = ToolRegistry.create();
|
|
28
|
+
const guard = new ToolGuard({ deniedTools: ['rm_rf'] });
|
|
29
|
+
|
|
30
|
+
registry.withSecurity(guard);
|
|
31
|
+
|
|
32
|
+
registry.register({
|
|
33
|
+
name: 'read_file',
|
|
34
|
+
description: 'Read a file',
|
|
35
|
+
parameters: { type: 'object', properties: { path: { type: 'string', description: 'Path' } } },
|
|
36
|
+
schema: z.object({ path: z.string().min(1) }),
|
|
37
|
+
execute: async ({ path }) => path,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
await registry.executeFromJSON('read_file', '{"path":"./README.md"}');
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Tool sandboxing (new)
|
|
44
|
+
You can now enforce runtime constraints on tool execution via **ToolSandbox**:
|
|
45
|
+
|
|
46
|
+
- **Timeout enforcement** (`maxExecutionTime`)
|
|
47
|
+
- **Concurrency limits** (`maxConcurrentCalls`)
|
|
48
|
+
- **Output size limits** (per-execution `maxOutputSize`)
|
|
49
|
+
- **Cancellation support** (`cancel(executionId)`, `cancelAll()`)
|
|
50
|
+
- Tools receive an extended `context.sandbox` object (execution id, limits, allowed operations set)
|
|
51
|
+
|
|
52
|
+
New/updated APIs:
|
|
53
|
+
- `ToolRegistry.withSandbox(sandbox)`
|
|
54
|
+
- `ToolRegistry.getSandbox()`
|
|
55
|
+
- `ToolSandbox.execute(tool, params, context, options?)`
|
|
56
|
+
- `createSecureTool(tool, sandbox, guard)` helper to wrap individual tools
|
|
57
|
+
|
|
58
|
+
## Behavior changes / improvements
|
|
59
|
+
|
|
60
|
+
### Logging is now silent by default
|
|
61
|
+
The logging system is now backed by `@fjell/logging`, and the library’s **default logger does not emit logs unless explicitly enabled**. This reduces the risk of sensitive data leaking via logs.
|
|
62
|
+
|
|
63
|
+
To enable logging:
|
|
64
|
+
- `AGENTIC_LOGGING=true`, or
|
|
65
|
+
- `DEBUG=*agentic*`, or
|
|
66
|
+
- `NODE_ENV=development`
|
|
67
|
+
|
|
68
|
+
### Context deduplication hash strengthened
|
|
69
|
+
`ContextManager` now uses **32 hex characters (128 bits)** of the SHA-256 digest (previously shorter). This reduces the likelihood of collisions when deduplicating context content.
|
|
70
|
+
|
|
71
|
+
## Documentation
|
|
72
|
+
- Added `SECURITY.md` describing tool execution security concepts and recommended operational practices.
|
|
73
|
+
- Added a `<!-- v1.0.0 -->` marker comment to `README.md`.
|
|
74
|
+
|
|
75
|
+
## Developer experience
|
|
76
|
+
- `precommit` now runs `build` before lint and tests: `npm run build && npm run lint && npm run test`.
|
|
77
|
+
- Build/test config files were reformatted (no functional behavior intended beyond configuration maintenance).
|
|
78
|
+
|
|
79
|
+
## Dependencies
|
|
80
|
+
- Added runtime dependency: `@fjell/logging`.
|
|
81
|
+
|
|
82
|
+
## Breaking changes / upgrade notes
|
|
83
|
+
- **Version bump to 1.0.0**: this is a major release.
|
|
84
|
+
- **Default logging behavior change**: if you relied on logs being emitted by default, you must now explicitly enable logging (see “Logging is now silent by default”).
|
|
85
|
+
- **Context hashing change**: if you persist or compare `ContextManager` content hashes externally, the hash values will differ going forward.
|
|
86
|
+
|
|
87
|
+
## Full change categories
|
|
88
|
+
- **Security**: ToolGuard + ToolSandbox, schema validation, safer JSON parsing, runtime limits.
|
|
89
|
+
- **Core**: ToolRegistry security/sandbox integration and JSON execution helper.
|
|
90
|
+
- **Operational**: safer default logging with `@fjell/logging`.
|
|
91
|
+
- **Maintenance**: precommit now builds; docs and config updates.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chore(gitignore): ignore output/ and kodrdriv-generated files
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
No changes detected in the current working tree.
|