open-multi-agent-kit 0.94.0 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +100 -646
  3. package/dist/core/agent-session.d.ts.map +1 -1
  4. package/dist/core/agent-session.js +11 -11
  5. package/dist/core/agent-session.js.map +1 -1
  6. package/dist/core/auth-storage.d.ts +27 -2
  7. package/dist/core/auth-storage.d.ts.map +1 -1
  8. package/dist/core/auth-storage.js +239 -56
  9. package/dist/core/auth-storage.js.map +1 -1
  10. package/dist/core/context-budget-v2-cache-invalidation.d.ts.map +1 -1
  11. package/dist/core/context-budget-v2-cache-invalidation.js +1 -1
  12. package/dist/core/context-budget-v2-cache-invalidation.js.map +1 -1
  13. package/dist/core/context-budget-v2-cache-provider.d.ts +5 -1
  14. package/dist/core/context-budget-v2-cache-provider.d.ts.map +1 -1
  15. package/dist/core/context-budget-v2-cache-provider.js +37 -7
  16. package/dist/core/context-budget-v2-cache-provider.js.map +1 -1
  17. package/dist/core/context-budget-v2-cache-telemetry.d.ts +1 -1
  18. package/dist/core/context-budget-v2-cache-telemetry.d.ts.map +1 -1
  19. package/dist/core/context-budget-v2-cache-telemetry.js +2 -1
  20. package/dist/core/context-budget-v2-cache-telemetry.js.map +1 -1
  21. package/dist/core/context-budget-v2-cache.d.ts.map +1 -1
  22. package/dist/core/context-budget-v2-cache.js +3 -0
  23. package/dist/core/context-budget-v2-cache.js.map +1 -1
  24. package/dist/core/context-budget-v2-representation-cache.d.ts.map +1 -1
  25. package/dist/core/context-budget-v2-representation-cache.js +4 -3
  26. package/dist/core/context-budget-v2-representation-cache.js.map +1 -1
  27. package/dist/core/context-budget-v2-selection.d.ts.map +1 -1
  28. package/dist/core/context-budget-v2-selection.js +4 -0
  29. package/dist/core/context-budget-v2-selection.js.map +1 -1
  30. package/dist/core/context-budget-v2-types.d.ts +3 -0
  31. package/dist/core/context-budget-v2-types.d.ts.map +1 -1
  32. package/dist/core/context-budget-v2-types.js.map +1 -1
  33. package/dist/core/extensions/types.d.ts +2 -0
  34. package/dist/core/extensions/types.d.ts.map +1 -1
  35. package/dist/core/extensions/types.js.map +1 -1
  36. package/dist/core/github-repository.d.ts +3 -0
  37. package/dist/core/github-repository.d.ts.map +1 -0
  38. package/dist/core/github-repository.js +3 -0
  39. package/dist/core/github-repository.js.map +1 -0
  40. package/dist/core/model-registry.d.ts +3 -3
  41. package/dist/core/model-registry.d.ts.map +1 -1
  42. package/dist/core/model-registry.js +9 -8
  43. package/dist/core/model-registry.js.map +1 -1
  44. package/dist/core/provider-usage.d.ts +48 -0
  45. package/dist/core/provider-usage.d.ts.map +1 -0
  46. package/dist/core/provider-usage.js +780 -0
  47. package/dist/core/provider-usage.js.map +1 -0
  48. package/dist/core/sdk.d.ts.map +1 -1
  49. package/dist/core/sdk.js +10 -0
  50. package/dist/core/sdk.js.map +1 -1
  51. package/dist/core/session-termination.d.ts.map +1 -1
  52. package/dist/core/session-termination.js +8 -1
  53. package/dist/core/session-termination.js.map +1 -1
  54. package/dist/core/settings-manager.d.ts +1 -0
  55. package/dist/core/settings-manager.d.ts.map +1 -1
  56. package/dist/core/settings-manager.js +15 -8
  57. package/dist/core/settings-manager.js.map +1 -1
  58. package/dist/core/skills-catalog-cache.d.ts +1 -0
  59. package/dist/core/skills-catalog-cache.d.ts.map +1 -1
  60. package/dist/core/skills-catalog-cache.js +42 -11
  61. package/dist/core/skills-catalog-cache.js.map +1 -1
  62. package/dist/core/slash-commands.d.ts.map +1 -1
  63. package/dist/core/slash-commands.js +1 -0
  64. package/dist/core/slash-commands.js.map +1 -1
  65. package/dist/core/tools/read.d.ts +1 -1
  66. package/dist/core/tools/read.d.ts.map +1 -1
  67. package/dist/core/tools/read.js.map +1 -1
  68. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  69. package/dist/modes/interactive/components/footer.js.map +1 -1
  70. package/dist/modes/interactive/components/index.d.ts +1 -0
  71. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  72. package/dist/modes/interactive/components/index.js +1 -0
  73. package/dist/modes/interactive/components/index.js.map +1 -1
  74. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  75. package/dist/modes/interactive/components/model-selector.js +5 -3
  76. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  77. package/dist/modes/interactive/components/oauth-account-selector.d.ts +16 -0
  78. package/dist/modes/interactive/components/oauth-account-selector.d.ts.map +1 -0
  79. package/dist/modes/interactive/components/oauth-account-selector.js +61 -0
  80. package/dist/modes/interactive/components/oauth-account-selector.js.map +1 -0
  81. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  82. package/dist/modes/interactive/components/oauth-selector.js +25 -4
  83. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  84. package/dist/modes/interactive/components/status-sidebar.d.ts +21 -1
  85. package/dist/modes/interactive/components/status-sidebar.d.ts.map +1 -1
  86. package/dist/modes/interactive/components/status-sidebar.js +165 -6
  87. package/dist/modes/interactive/components/status-sidebar.js.map +1 -1
  88. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  89. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  90. package/dist/modes/interactive/interactive-mode.js +99 -15
  91. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  92. package/dist/utils/image-resize-core.d.ts.map +1 -1
  93. package/dist/utils/image-resize-core.js +2 -2
  94. package/dist/utils/image-resize-core.js.map +1 -1
  95. package/docs/development.md +3 -2
  96. package/docs/providers.md +19 -4
  97. package/docs/settings.md +9 -9
  98. package/docs/usage.md +10 -9
  99. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  100. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  101. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  102. package/examples/extensions/gondolin/package-lock.json +2 -2
  103. package/examples/extensions/gondolin/package.json +1 -1
  104. package/examples/extensions/sandbox/package-lock.json +2 -2
  105. package/examples/extensions/sandbox/package.json +1 -1
  106. package/examples/extensions/with-deps/package-lock.json +2 -2
  107. package/examples/extensions/with-deps/package.json +1 -1
  108. package/npm-shrinkwrap.json +24 -24
  109. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"image-resize-core.d.ts","sourceRoot":"","sources":["../../src/utils/image-resize-core.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACpB;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CACzC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAqG9B","sourcesContent":["import { applyExifOrientation } from \"./exif-orientation.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\nexport interface ImageResizeOptions {\n\tmaxWidth?: number; // Default: 2000\n\tmaxHeight?: number; // Default: 2000\n\tmaxBytes?: number; // Default: 4.5MB of base64 payload (below Anthropic's 5MB limit)\n\tjpegQuality?: number; // Default: 80\n}\n\nexport interface ResizedImage {\n\tdata: string; // base64\n\tmimeType: string;\n\toriginalWidth: number;\n\toriginalHeight: number;\n\twidth: number;\n\theight: number;\n\twasResized: boolean;\n}\n\n// 4.5MB of base64 payload. Provides headroom below Anthropic's 5MB limit.\nconst DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;\n\nconst DEFAULT_OPTIONS: Required<ImageResizeOptions> = {\n\tmaxWidth: 2000,\n\tmaxHeight: 2000,\n\tmaxBytes: DEFAULT_MAX_BYTES,\n\tjpegQuality: 80,\n};\n\ninterface EncodedCandidate {\n\tdata: string;\n\tencodedSize: number;\n\tmimeType: string;\n}\n\nfunction encodeCandidate(buffer: Uint8Array, mimeType: string): EncodedCandidate {\n\tconst data = Buffer.from(buffer).toString(\"base64\");\n\treturn {\n\t\tdata,\n\t\tencodedSize: Buffer.byteLength(data, \"utf-8\"),\n\t\tmimeType,\n\t};\n}\n\n/**\n * Resize an image to fit within the specified max dimensions and encoded file size.\n * Returns null if the image cannot be resized below maxBytes.\n *\n * Uses Photon (Rust/WASM) for image processing. If Photon is not available,\n * returns null.\n *\n * Strategy for staying under maxBytes:\n * 1. First resize to maxWidth/maxHeight\n * 2. Try both PNG and JPEG formats, pick the smaller one\n * 3. If still too large, try JPEG with decreasing quality\n * 4. If still too large, progressively reduce dimensions until 1x1\n */\nexport async function resizeImageInProcess(\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst opts = { ...DEFAULT_OPTIONS, ...options };\n\tconst inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4;\n\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\treturn null;\n\t}\n\n\tlet image: ReturnType<typeof photon.PhotonImage.new_from_byteslice> | undefined;\n\ttry {\n\t\tconst rawImage = photon.PhotonImage.new_from_byteslice(inputBytes);\n\t\timage = applyExifOrientation(photon, rawImage, inputBytes);\n\t\tif (image !== rawImage) rawImage.free();\n\n\t\tconst originalWidth = image.get_width();\n\t\tconst originalHeight = image.get_height();\n\t\tconst format = mimeType.split(\"/\")[1] ?? \"png\";\n\n\t\t// Check if already within all limits (dimensions AND encoded size)\n\t\tif (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(inputBytes).toString(\"base64\"),\n\t\t\t\tmimeType: mimeType || `image/${format}`,\n\t\t\t\toriginalWidth,\n\t\t\t\toriginalHeight,\n\t\t\t\twidth: originalWidth,\n\t\t\t\theight: originalHeight,\n\t\t\t\twasResized: false,\n\t\t\t};\n\t\t}\n\n\t\t// Calculate initial dimensions respecting max limits\n\t\tlet targetWidth = originalWidth;\n\t\tlet targetHeight = originalHeight;\n\n\t\tif (targetWidth > opts.maxWidth) {\n\t\t\ttargetHeight = Math.round((targetHeight * opts.maxWidth) / targetWidth);\n\t\t\ttargetWidth = opts.maxWidth;\n\t\t}\n\t\tif (targetHeight > opts.maxHeight) {\n\t\t\ttargetWidth = Math.round((targetWidth * opts.maxHeight) / targetHeight);\n\t\t\ttargetHeight = opts.maxHeight;\n\t\t}\n\n\t\tfunction tryEncodings(width: number, height: number, jpegQualities: number[]): EncodedCandidate[] {\n\t\t\tconst resized = photon!.resize(image!, width, height, photon!.SamplingFilter.Lanczos3);\n\n\t\t\ttry {\n\t\t\t\tconst candidates: EncodedCandidate[] = [encodeCandidate(resized.get_bytes(), \"image/png\")];\n\t\t\t\tfor (const quality of jpegQualities) {\n\t\t\t\t\tcandidates.push(encodeCandidate(resized.get_bytes_jpeg(quality), \"image/jpeg\"));\n\t\t\t\t}\n\t\t\t\treturn candidates;\n\t\t\t} finally {\n\t\t\t\tresized.free();\n\t\t\t}\n\t\t}\n\n\t\tconst qualitySteps = Array.from(new Set([opts.jpegQuality, 85, 70, 55, 40]));\n\t\tlet currentWidth = targetWidth;\n\t\tlet currentHeight = targetHeight;\n\n\t\twhile (true) {\n\t\t\tconst candidates = tryEncodings(currentWidth, currentHeight, qualitySteps);\n\t\t\tfor (const candidate of candidates) {\n\t\t\t\tif (candidate.encodedSize < opts.maxBytes) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: candidate.data,\n\t\t\t\t\t\tmimeType: candidate.mimeType,\n\t\t\t\t\t\toriginalWidth,\n\t\t\t\t\t\toriginalHeight,\n\t\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\t\theight: currentHeight,\n\t\t\t\t\t\twasResized: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentWidth === 1 && currentHeight === 1) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));\n\t\t\tconst nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));\n\t\t\tif (nextWidth === currentWidth && nextHeight === currentHeight) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentWidth = nextWidth;\n\t\t\tcurrentHeight = nextHeight;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t} finally {\n\t\tif (image) {\n\t\t\timage.free();\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"image-resize-core.d.ts","sourceRoot":"","sources":["../../src/utils/image-resize-core.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACpB;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CACzC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAqG9B","sourcesContent":["import { applyExifOrientation } from \"./exif-orientation.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\nexport interface ImageResizeOptions {\n\tmaxWidth?: number; // Default: 1900 (margin below Anthropic's 2000px many-image limit)\n\tmaxHeight?: number; // Default: 1900\n\tmaxBytes?: number; // Default: 4.5MB of base64 payload (below Anthropic's 5MB limit)\n\tjpegQuality?: number; // Default: 80\n}\n\nexport interface ResizedImage {\n\tdata: string; // base64\n\tmimeType: string;\n\toriginalWidth: number;\n\toriginalHeight: number;\n\twidth: number;\n\theight: number;\n\twasResized: boolean;\n}\n\n// 4.5MB of base64 payload. Provides headroom below Anthropic's 5MB limit.\nconst DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;\n\nconst DEFAULT_OPTIONS: Required<ImageResizeOptions> = {\n\tmaxWidth: 1900,\n\tmaxHeight: 1900,\n\tmaxBytes: DEFAULT_MAX_BYTES,\n\tjpegQuality: 80,\n};\n\ninterface EncodedCandidate {\n\tdata: string;\n\tencodedSize: number;\n\tmimeType: string;\n}\n\nfunction encodeCandidate(buffer: Uint8Array, mimeType: string): EncodedCandidate {\n\tconst data = Buffer.from(buffer).toString(\"base64\");\n\treturn {\n\t\tdata,\n\t\tencodedSize: Buffer.byteLength(data, \"utf-8\"),\n\t\tmimeType,\n\t};\n}\n\n/**\n * Resize an image to fit within the specified max dimensions and encoded file size.\n * Returns null if the image cannot be resized below maxBytes.\n *\n * Uses Photon (Rust/WASM) for image processing. If Photon is not available,\n * returns null.\n *\n * Strategy for staying under maxBytes:\n * 1. First resize to maxWidth/maxHeight\n * 2. Try both PNG and JPEG formats, pick the smaller one\n * 3. If still too large, try JPEG with decreasing quality\n * 4. If still too large, progressively reduce dimensions until 1x1\n */\nexport async function resizeImageInProcess(\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst opts = { ...DEFAULT_OPTIONS, ...options };\n\tconst inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4;\n\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\treturn null;\n\t}\n\n\tlet image: ReturnType<typeof photon.PhotonImage.new_from_byteslice> | undefined;\n\ttry {\n\t\tconst rawImage = photon.PhotonImage.new_from_byteslice(inputBytes);\n\t\timage = applyExifOrientation(photon, rawImage, inputBytes);\n\t\tif (image !== rawImage) rawImage.free();\n\n\t\tconst originalWidth = image.get_width();\n\t\tconst originalHeight = image.get_height();\n\t\tconst format = mimeType.split(\"/\")[1] ?? \"png\";\n\n\t\t// Check if already within all limits (dimensions AND encoded size)\n\t\tif (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(inputBytes).toString(\"base64\"),\n\t\t\t\tmimeType: mimeType || `image/${format}`,\n\t\t\t\toriginalWidth,\n\t\t\t\toriginalHeight,\n\t\t\t\twidth: originalWidth,\n\t\t\t\theight: originalHeight,\n\t\t\t\twasResized: false,\n\t\t\t};\n\t\t}\n\n\t\t// Calculate initial dimensions respecting max limits\n\t\tlet targetWidth = originalWidth;\n\t\tlet targetHeight = originalHeight;\n\n\t\tif (targetWidth > opts.maxWidth) {\n\t\t\ttargetHeight = Math.round((targetHeight * opts.maxWidth) / targetWidth);\n\t\t\ttargetWidth = opts.maxWidth;\n\t\t}\n\t\tif (targetHeight > opts.maxHeight) {\n\t\t\ttargetWidth = Math.round((targetWidth * opts.maxHeight) / targetHeight);\n\t\t\ttargetHeight = opts.maxHeight;\n\t\t}\n\n\t\tfunction tryEncodings(width: number, height: number, jpegQualities: number[]): EncodedCandidate[] {\n\t\t\tconst resized = photon!.resize(image!, width, height, photon!.SamplingFilter.Lanczos3);\n\n\t\t\ttry {\n\t\t\t\tconst candidates: EncodedCandidate[] = [encodeCandidate(resized.get_bytes(), \"image/png\")];\n\t\t\t\tfor (const quality of jpegQualities) {\n\t\t\t\t\tcandidates.push(encodeCandidate(resized.get_bytes_jpeg(quality), \"image/jpeg\"));\n\t\t\t\t}\n\t\t\t\treturn candidates;\n\t\t\t} finally {\n\t\t\t\tresized.free();\n\t\t\t}\n\t\t}\n\n\t\tconst qualitySteps = Array.from(new Set([opts.jpegQuality, 85, 70, 55, 40]));\n\t\tlet currentWidth = targetWidth;\n\t\tlet currentHeight = targetHeight;\n\n\t\twhile (true) {\n\t\t\tconst candidates = tryEncodings(currentWidth, currentHeight, qualitySteps);\n\t\t\tfor (const candidate of candidates) {\n\t\t\t\tif (candidate.encodedSize < opts.maxBytes) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: candidate.data,\n\t\t\t\t\t\tmimeType: candidate.mimeType,\n\t\t\t\t\t\toriginalWidth,\n\t\t\t\t\t\toriginalHeight,\n\t\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\t\theight: currentHeight,\n\t\t\t\t\t\twasResized: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentWidth === 1 && currentHeight === 1) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));\n\t\t\tconst nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));\n\t\t\tif (nextWidth === currentWidth && nextHeight === currentHeight) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentWidth = nextWidth;\n\t\t\tcurrentHeight = nextHeight;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t} finally {\n\t\tif (image) {\n\t\t\timage.free();\n\t\t}\n\t}\n}\n"]}
@@ -3,8 +3,8 @@ import { loadPhoton } from "./photon.js";
3
3
  // 4.5MB of base64 payload. Provides headroom below Anthropic's 5MB limit.
4
4
  const DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;
5
5
  const DEFAULT_OPTIONS = {
6
- maxWidth: 2000,
7
- maxHeight: 2000,
6
+ maxWidth: 1900,
7
+ maxHeight: 1900,
8
8
  maxBytes: DEFAULT_MAX_BYTES,
9
9
  jpegQuality: 80,
10
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"image-resize-core.js","sourceRoot":"","sources":["../../src/utils/image-resize-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAmBzC,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,eAAe,GAAiC;IACrD,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,iBAAiB;IAC3B,WAAW,EAAE,EAAE;CACf,CAAC;AAQF,SAAS,eAAe,CAAC,MAAkB,EAAE,QAAgB,EAAoB;IAChF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACpD,OAAO;QACN,IAAI;QACJ,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC;QAC7C,QAAQ;KACR,CAAC;AAAA,CACF;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,UAAsB,EACtB,QAAgB,EAChB,OAA4B,EACG;IAC/B,MAAM,IAAI,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC;IAChD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAEjE,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI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3C,OAAO;wBACN,IAAI,EAAE,SAAS,CAAC,IAAI;wBACpB,QAAQ,EAAE,SAAS,CAAC,QAAQ;wBAC5B,aAAa;wBACb,cAAc;wBACd,KAAK,EAAE,YAAY;wBACnB,MAAM,EAAE,aAAa;wBACrB,UAAU,EAAE,IAAI;qBAChB,CAAC;gBACH,CAAC;YACF,CAAC;YAED,IAAI,YAAY,KAAK,CAAC,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;gBAC/C,MAAM;YACP,CAAC;YAED,MAAM,SAAS,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;YACxF,MAAM,UAAU,GAAG,aAAa,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC;YAC3F,IAAI,SAAS,KAAK,YAAY,IAAI,UAAU,KAAK,aAAa,EAAE,CAAC;gBAChE,MAAM;YACP,CAAC;YAED,YAAY,GAAG,SAAS,CAAC;YACzB,aAAa,GAAG,UAAU,CAAC;QAC5B,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;YAAS,CAAC;QACV,IAAI,KAAK,EAAE,CAAC;YACX,KAAK,CAAC,IAAI,EAAE,CAAC;QACd,CAAC;IACF,CAAC;AAAA,CACD","sourcesContent":["import { applyExifOrientation } from \"./exif-orientation.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\nexport interface ImageResizeOptions {\n\tmaxWidth?: number; // Default: 2000\n\tmaxHeight?: number; // Default: 2000\n\tmaxBytes?: number; // Default: 4.5MB of base64 payload (below Anthropic's 5MB limit)\n\tjpegQuality?: number; // Default: 80\n}\n\nexport interface ResizedImage {\n\tdata: string; // base64\n\tmimeType: string;\n\toriginalWidth: number;\n\toriginalHeight: number;\n\twidth: number;\n\theight: number;\n\twasResized: boolean;\n}\n\n// 4.5MB of base64 payload. Provides headroom below Anthropic's 5MB limit.\nconst DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;\n\nconst DEFAULT_OPTIONS: Required<ImageResizeOptions> = {\n\tmaxWidth: 2000,\n\tmaxHeight: 2000,\n\tmaxBytes: DEFAULT_MAX_BYTES,\n\tjpegQuality: 80,\n};\n\ninterface EncodedCandidate {\n\tdata: string;\n\tencodedSize: number;\n\tmimeType: string;\n}\n\nfunction encodeCandidate(buffer: Uint8Array, mimeType: string): EncodedCandidate {\n\tconst data = Buffer.from(buffer).toString(\"base64\");\n\treturn {\n\t\tdata,\n\t\tencodedSize: Buffer.byteLength(data, \"utf-8\"),\n\t\tmimeType,\n\t};\n}\n\n/**\n * Resize an image to fit within the specified max dimensions and encoded file size.\n * Returns null if the image cannot be resized below maxBytes.\n *\n * Uses Photon (Rust/WASM) for image processing. If Photon is not available,\n * returns null.\n *\n * Strategy for staying under maxBytes:\n * 1. First resize to maxWidth/maxHeight\n * 2. Try both PNG and JPEG formats, pick the smaller one\n * 3. If still too large, try JPEG with decreasing quality\n * 4. If still too large, progressively reduce dimensions until 1x1\n */\nexport async function resizeImageInProcess(\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst opts = { ...DEFAULT_OPTIONS, ...options };\n\tconst inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4;\n\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\treturn null;\n\t}\n\n\tlet image: ReturnType<typeof photon.PhotonImage.new_from_byteslice> | undefined;\n\ttry {\n\t\tconst rawImage = photon.PhotonImage.new_from_byteslice(inputBytes);\n\t\timage = applyExifOrientation(photon, rawImage, inputBytes);\n\t\tif (image !== rawImage) rawImage.free();\n\n\t\tconst originalWidth = image.get_width();\n\t\tconst originalHeight = image.get_height();\n\t\tconst format = mimeType.split(\"/\")[1] ?? \"png\";\n\n\t\t// Check if already within all limits (dimensions AND encoded size)\n\t\tif (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(inputBytes).toString(\"base64\"),\n\t\t\t\tmimeType: mimeType || `image/${format}`,\n\t\t\t\toriginalWidth,\n\t\t\t\toriginalHeight,\n\t\t\t\twidth: originalWidth,\n\t\t\t\theight: originalHeight,\n\t\t\t\twasResized: false,\n\t\t\t};\n\t\t}\n\n\t\t// Calculate initial dimensions respecting max limits\n\t\tlet targetWidth = originalWidth;\n\t\tlet targetHeight = originalHeight;\n\n\t\tif (targetWidth > opts.maxWidth) {\n\t\t\ttargetHeight = Math.round((targetHeight * opts.maxWidth) / targetWidth);\n\t\t\ttargetWidth = opts.maxWidth;\n\t\t}\n\t\tif (targetHeight > opts.maxHeight) {\n\t\t\ttargetWidth = Math.round((targetWidth * opts.maxHeight) / targetHeight);\n\t\t\ttargetHeight = opts.maxHeight;\n\t\t}\n\n\t\tfunction tryEncodings(width: number, height: number, jpegQualities: number[]): EncodedCandidate[] {\n\t\t\tconst resized = photon!.resize(image!, width, height, photon!.SamplingFilter.Lanczos3);\n\n\t\t\ttry {\n\t\t\t\tconst candidates: EncodedCandidate[] = [encodeCandidate(resized.get_bytes(), \"image/png\")];\n\t\t\t\tfor (const quality of jpegQualities) {\n\t\t\t\t\tcandidates.push(encodeCandidate(resized.get_bytes_jpeg(quality), \"image/jpeg\"));\n\t\t\t\t}\n\t\t\t\treturn candidates;\n\t\t\t} finally {\n\t\t\t\tresized.free();\n\t\t\t}\n\t\t}\n\n\t\tconst qualitySteps = Array.from(new Set([opts.jpegQuality, 85, 70, 55, 40]));\n\t\tlet currentWidth = targetWidth;\n\t\tlet currentHeight = targetHeight;\n\n\t\twhile (true) {\n\t\t\tconst candidates = tryEncodings(currentWidth, currentHeight, qualitySteps);\n\t\t\tfor (const candidate of candidates) {\n\t\t\t\tif (candidate.encodedSize < opts.maxBytes) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: candidate.data,\n\t\t\t\t\t\tmimeType: candidate.mimeType,\n\t\t\t\t\t\toriginalWidth,\n\t\t\t\t\t\toriginalHeight,\n\t\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\t\theight: currentHeight,\n\t\t\t\t\t\twasResized: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentWidth === 1 && currentHeight === 1) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));\n\t\t\tconst nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));\n\t\t\tif (nextWidth === currentWidth && nextHeight === currentHeight) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentWidth = nextWidth;\n\t\t\tcurrentHeight = nextHeight;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t} finally {\n\t\tif (image) {\n\t\t\timage.free();\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"image-resize-core.js","sourceRoot":"","sources":["../../src/utils/image-resize-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAmBzC,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,eAAe,GAAiC;IACrD,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,iBAAiB;IAC3B,WAAW,EAAE,EAAE;CACf,CAAC;AAQF,SAAS,eAAe,CAAC,MAAkB,EAAE,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AAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC;YAC3F,IAAI,SAAS,KAAK,YAAY,IAAI,UAAU,KAAK,aAAa,EAAE,CAAC;gBAChE,MAAM;YACP,CAAC;YAED,YAAY,GAAG,SAAS,CAAC;YACzB,aAAa,GAAG,UAAU,CAAC;QAC5B,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;YAAS,CAAC;QACV,IAAI,KAAK,EAAE,CAAC;YACX,KAAK,CAAC,IAAI,EAAE,CAAC;QACd,CAAC;IACF,CAAC;AAAA,CACD","sourcesContent":["import { applyExifOrientation } from \"./exif-orientation.ts\";\nimport { loadPhoton } from \"./photon.ts\";\n\nexport interface ImageResizeOptions {\n\tmaxWidth?: number; // Default: 1900 (margin below Anthropic's 2000px many-image limit)\n\tmaxHeight?: number; // Default: 1900\n\tmaxBytes?: number; // Default: 4.5MB of base64 payload (below Anthropic's 5MB limit)\n\tjpegQuality?: number; // Default: 80\n}\n\nexport interface ResizedImage {\n\tdata: string; // base64\n\tmimeType: string;\n\toriginalWidth: number;\n\toriginalHeight: number;\n\twidth: number;\n\theight: number;\n\twasResized: boolean;\n}\n\n// 4.5MB of base64 payload. Provides headroom below Anthropic's 5MB limit.\nconst DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;\n\nconst DEFAULT_OPTIONS: Required<ImageResizeOptions> = {\n\tmaxWidth: 1900,\n\tmaxHeight: 1900,\n\tmaxBytes: DEFAULT_MAX_BYTES,\n\tjpegQuality: 80,\n};\n\ninterface EncodedCandidate {\n\tdata: string;\n\tencodedSize: number;\n\tmimeType: string;\n}\n\nfunction encodeCandidate(buffer: Uint8Array, mimeType: string): EncodedCandidate {\n\tconst data = Buffer.from(buffer).toString(\"base64\");\n\treturn {\n\t\tdata,\n\t\tencodedSize: Buffer.byteLength(data, \"utf-8\"),\n\t\tmimeType,\n\t};\n}\n\n/**\n * Resize an image to fit within the specified max dimensions and encoded file size.\n * Returns null if the image cannot be resized below maxBytes.\n *\n * Uses Photon (Rust/WASM) for image processing. If Photon is not available,\n * returns null.\n *\n * Strategy for staying under maxBytes:\n * 1. First resize to maxWidth/maxHeight\n * 2. Try both PNG and JPEG formats, pick the smaller one\n * 3. If still too large, try JPEG with decreasing quality\n * 4. If still too large, progressively reduce dimensions until 1x1\n */\nexport async function resizeImageInProcess(\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst opts = { ...DEFAULT_OPTIONS, ...options };\n\tconst inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4;\n\n\tconst photon = await loadPhoton();\n\tif (!photon) {\n\t\treturn null;\n\t}\n\n\tlet image: ReturnType<typeof photon.PhotonImage.new_from_byteslice> | undefined;\n\ttry {\n\t\tconst rawImage = photon.PhotonImage.new_from_byteslice(inputBytes);\n\t\timage = applyExifOrientation(photon, rawImage, inputBytes);\n\t\tif (image !== rawImage) rawImage.free();\n\n\t\tconst originalWidth = image.get_width();\n\t\tconst originalHeight = image.get_height();\n\t\tconst format = mimeType.split(\"/\")[1] ?? \"png\";\n\n\t\t// Check if already within all limits (dimensions AND encoded size)\n\t\tif (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(inputBytes).toString(\"base64\"),\n\t\t\t\tmimeType: mimeType || `image/${format}`,\n\t\t\t\toriginalWidth,\n\t\t\t\toriginalHeight,\n\t\t\t\twidth: originalWidth,\n\t\t\t\theight: originalHeight,\n\t\t\t\twasResized: false,\n\t\t\t};\n\t\t}\n\n\t\t// Calculate initial dimensions respecting max limits\n\t\tlet targetWidth = originalWidth;\n\t\tlet targetHeight = originalHeight;\n\n\t\tif (targetWidth > opts.maxWidth) {\n\t\t\ttargetHeight = Math.round((targetHeight * opts.maxWidth) / targetWidth);\n\t\t\ttargetWidth = opts.maxWidth;\n\t\t}\n\t\tif (targetHeight > opts.maxHeight) {\n\t\t\ttargetWidth = Math.round((targetWidth * opts.maxHeight) / targetHeight);\n\t\t\ttargetHeight = opts.maxHeight;\n\t\t}\n\n\t\tfunction tryEncodings(width: number, height: number, jpegQualities: number[]): EncodedCandidate[] {\n\t\t\tconst resized = photon!.resize(image!, width, height, photon!.SamplingFilter.Lanczos3);\n\n\t\t\ttry {\n\t\t\t\tconst candidates: EncodedCandidate[] = [encodeCandidate(resized.get_bytes(), \"image/png\")];\n\t\t\t\tfor (const quality of jpegQualities) {\n\t\t\t\t\tcandidates.push(encodeCandidate(resized.get_bytes_jpeg(quality), \"image/jpeg\"));\n\t\t\t\t}\n\t\t\t\treturn candidates;\n\t\t\t} finally {\n\t\t\t\tresized.free();\n\t\t\t}\n\t\t}\n\n\t\tconst qualitySteps = Array.from(new Set([opts.jpegQuality, 85, 70, 55, 40]));\n\t\tlet currentWidth = targetWidth;\n\t\tlet currentHeight = targetHeight;\n\n\t\twhile (true) {\n\t\t\tconst candidates = tryEncodings(currentWidth, currentHeight, qualitySteps);\n\t\t\tfor (const candidate of candidates) {\n\t\t\t\tif (candidate.encodedSize < opts.maxBytes) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: candidate.data,\n\t\t\t\t\t\tmimeType: candidate.mimeType,\n\t\t\t\t\t\toriginalWidth,\n\t\t\t\t\t\toriginalHeight,\n\t\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\t\theight: currentHeight,\n\t\t\t\t\t\twasResized: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentWidth === 1 && currentHeight === 1) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));\n\t\t\tconst nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));\n\t\t\tif (nextWidth === currentWidth && nextHeight === currentHeight) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentWidth = nextWidth;\n\t\t\tcurrentHeight = nextHeight;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t} finally {\n\t\tif (image) {\n\t\t\timage.free();\n\t\t}\n\t}\n}\n"]}
@@ -6,7 +6,7 @@ See [AGENTS.md](https://github.com/dmae97/omk/blob/main/AGENTS.md) for additiona
6
6
 
7
7
  ```bash
8
8
  git clone https://github.com/dmae97/omk
9
- cd omk-mono
9
+ cd omk
10
10
  npm install
11
11
  npm run build
12
12
  ```
@@ -14,7 +14,7 @@ npm run build
14
14
  Run from source:
15
15
 
16
16
  ```bash
17
- /path/to/omk-mono/omk-test.sh
17
+ /path/to/omk/omk-test.sh
18
18
  ```
19
19
 
20
20
  The script can be run from any directory. OMK keeps the caller's current working directory.
@@ -49,6 +49,7 @@ Never use `__dirname` directly for package assets.
49
49
  ## Debug Command
50
50
 
51
51
  `/debug` (hidden) writes to `~/.omk/agent/omk-debug.log`:
52
+
52
53
  - Rendered TUI lines with ANSI codes
53
54
  - Last messages sent to the LLM
54
55
 
package/docs/providers.md CHANGED
@@ -19,7 +19,15 @@ Use `/login` in interactive mode, then select a provider:
19
19
  - Claude Pro/Max
20
20
  - GitHub Copilot
21
21
 
22
- Use `/logout` to clear credentials. Tokens are stored in `~/.omk/agent/auth.json` and auto-refresh when expired.
22
+ Run `/login` and choose a configured subscription provider to open its account picker. Select an existing account by its ChatGPT, Claude, or Google email when available, or choose **Add another account** to sign in with a new one. OMK keeps and refreshes each account independently, pins the provider to the account you select, and does not silently fail over to another subscription. `/model` remains dedicated to model selection.
23
+
24
+ Use `/logout` to clear all stored accounts for a provider. Tokens are stored in `~/.omk/agent/auth.json` and auto-refresh when expired.
25
+
26
+ When the status sidebar is pinned, its **USAGE** section lists every configured subscription provider, with the active provider first. OMK reads quota windows from fixed provider endpoints for Codex, Claude, Kimi Code, and GLM/ZAI Coding Plan, caches the result, and displays each percentage and reset countdown separately. Claude also passively merges the official `anthropic-ratelimit-unified-*` response headers used by Claude Code. If Anthropic's usage endpoint is rate limited and no complete recent snapshot exists, OMK mirrors Claude Code's own startup quota check with one fixed-endpoint Haiku request capped at one output token, no more than once per OAuth credential per hour. This fallback consumes a small amount of Claude plan quota.
27
+
28
+ Codex streaming passively merges `x-codex-primary-*`, `x-codex-secondary-*`, and `codex.rate_limits` signals through the non-blocking `StreamOptions.onRateLimit` observer. These signals supplement missing polling windows only when the Codex service returns them; OMK does not infer a missing 5-hour value from a 7-day value.
29
+
30
+ Alibaba Model Studio Token Plan is recognized as **QWEN TOKEN PLAN** but shows `console-only quota`. Its [official usage page](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=plan&commonbuy=1&orderType=buy#/efm/subscription/token-plan) obtains `per5HourPercentage`, `per5HourResetTime`, `per1WeekPercentage`, and `per1WeekResetTime` through an authenticated Alibaba Cloud console gateway. The plan-specific `sk-sp-*` key does not authorize that console endpoint, and compatible-mode model responses expose token counts but no quota headers. OMK therefore does not copy browser cookies or estimate quota from token counts. Qwen OAuth and Grok remain explicit `quota API unavailable`.
23
31
 
24
32
  ### OpenAI Codex
25
33
 
@@ -57,7 +65,7 @@ omk
57
65
  ```
58
66
 
59
67
  | Provider | Environment Variable | `auth.json` key |
60
- |----------|----------------------|------------------|
68
+ | ---------- | ---------------------- | ------------------ |
61
69
  | Anthropic | `ANTHROPIC_API_KEY` | `anthropic` |
62
70
  | Ant Ling | `ANT_LING_API_KEY` | `ant-ling` |
63
71
  | Azure OpenAI Responses | `AZURE_OPENAI_API_KEY` | `azure-openai-responses` |
@@ -131,28 +139,35 @@ The file is created with `0600` permissions (user read/write only). Auth file cr
131
139
  The `key` field supports command execution, environment interpolation, and literals:
132
140
 
133
141
  - **Shell command:** `"!command"` at the start executes the whole value as a command and uses stdout (cached for process lifetime)
142
+
134
143
  ```json
135
144
  { "type": "api_key", "key": "!security find-generic-password -ws 'anthropic'" }
136
145
  { "type": "api_key", "key": "!op read 'op://vault/item/credential'" }
137
146
  ```
147
+
138
148
  - **Environment interpolation:** `"$ENV_VAR"` or `"${ENV_VAR}"` uses the value of the named variable. Interpolation works inside larger literals.
149
+
139
150
  ```json
140
151
  { "type": "api_key", "key": "$MY_ANTHROPIC_KEY" }
141
152
  { "type": "api_key", "key": "${KEY_PREFIX}_${KEY_SUFFIX}" }
142
153
  ```
154
+
143
155
  `$FOO_BAR` is the variable `FOO_BAR`; use `${FOO}_BAR` when `BAR` is literal text. Missing environment variables make the value unresolved.
144
156
  - **Escapes:** `"$$"` emits a literal `"$"`; `"$!"` emits a literal `"!"` without triggering command execution.
157
+
145
158
  ```json
146
159
  { "type": "api_key", "key": "$$literal-dollar-prefix" }
147
160
  { "type": "api_key", "key": "$!literal-bang-prefix" }
148
161
  ```
162
+
149
163
  - **Literal value:** Used directly
164
+
150
165
  ```json
151
166
  { "type": "api_key", "key": "sk-ant-..." }
152
167
  { "type": "api_key", "key": "public" }
153
168
  ```
154
169
 
155
- Legacy uppercase env-var-like values such as `MY_API_KEY` are migrated to `$MY_API_KEY` on startup. OAuth credentials are also stored here after `/login` and managed automatically.
170
+ Legacy uppercase env-var-like values such as `MY_API_KEY` are migrated to `$MY_API_KEY` on startup. OAuth credentials are also stored here after `/login`; multi-account lists, selected-account state, and token refresh are managed automatically.
156
171
 
157
172
  ## Cloud Providers
158
173
 
@@ -230,7 +245,7 @@ Routes to OpenAI, Anthropic, and Workers AI through Cloudflare AI Gateway. Worke
230
245
  AI Gateway authentication uses `CLOUDFLARE_API_KEY` as `cf-aig-authorization`. Upstream authentication can be one of:
231
246
 
232
247
  | Mode | Request auth | Upstream auth |
233
- |------|--------------|---------------|
248
+ | ------ | -------------- | --------------- |
234
249
  | Workers AI | Cloudflare token only | Cloudflare-native |
235
250
  | Unified billing | Cloudflare token only | Cloudflare handles upstream auth and deducts credits |
236
251
  | Stored BYOK | Cloudflare token only | Cloudflare injects provider keys stored in the AI Gateway dashboard |
package/docs/settings.md CHANGED
@@ -14,7 +14,7 @@ Edit directly or use `/settings` for common options.
14
14
  ### Model & Thinking
15
15
 
16
16
  | Setting | Type | Default | Description |
17
- |---------|------|---------|-------------|
17
+ | --------- | ------ | --------- | ------------- |
18
18
  | `defaultProvider` | string | - | Default provider (e.g., `"anthropic"`, `"openai"`) |
19
19
  | `defaultModel` | string | - | Default model ID |
20
20
  | `defaultThinkingLevel` | string | - | `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"` |
@@ -67,7 +67,7 @@ Advisory-only hint source for the v4 auto thinking-level resolver. Read from the
67
67
  ### UI & Display
68
68
 
69
69
  | Setting | Type | Default | Description |
70
- |---------|------|---------|-------------|
70
+ | --------- | ------ | --------- | ------------- |
71
71
  | `theme` | string | `"dark"` | Theme name (`"dark"`, `"light"`, or custom) |
72
72
  | `quietStartup` | boolean | `false` | Hide startup header |
73
73
  | `collapseChangelog` | boolean | `false` | Show condensed changelog after updates |
@@ -102,7 +102,7 @@ Set `OMK_SKIP_VERSION_CHECK=1` to disable the OMK version update check. Use `--o
102
102
  ### Compaction
103
103
 
104
104
  | Setting | Type | Default | Description |
105
- |---------|------|---------|-------------|
105
+ | --------- | ------ | --------- | ------------- |
106
106
  | `compaction.enabled` | boolean | `true` | Enable auto-compaction |
107
107
  | `compaction.model` | string | session model | Authenticated canonical `provider/model` used only for compaction |
108
108
  | `compaction.reserveTokens` | number | `16384` | Legacy/default output reserve (tokens reserved for the LLM response) |
@@ -150,7 +150,7 @@ This setting is global-only: `.omk/settings.json` cannot enable or disable it. U
150
150
  ### Agent Tool Execution
151
151
 
152
152
  | Setting | Type | Default | Description |
153
- |---------|------|---------|-------------|
153
+ | --------- | ------ | --------- | ------------- |
154
154
  | `agent.toolScheduler` | string | `"dag-v2"` | Deterministic resource-claim scheduler. Use `"waves-v1"` for compatibility rollback |
155
155
  | `agent.maxToolConcurrency` | number | `4` | Maximum calls in one DAG level; `0` removes the cap |
156
156
  | `agent.toolTimeoutMs` | number | `0` | Fallback tool execution timeout in milliseconds; `0` disables the fallback timer |
@@ -189,7 +189,7 @@ The DAG preserves source-order result artifacts. `bash`, unknown tools, and exte
189
189
  ### Retry
190
190
 
191
191
  | Setting | Type | Default | Description |
192
- |---------|------|---------|-------------|
192
+ | --------- | ------ | --------- | ------------- |
193
193
  | `retry.enabled` | boolean | `true` | Enable automatic agent-level retry on transient errors |
194
194
  | `retry.maxRetries` | number | `3` | Maximum agent-level retry attempts |
195
195
  | `retry.baseDelayMs` | number | `2000` | Base delay for agent-level exponential backoff (2s, 4s, 8s) |
@@ -219,7 +219,7 @@ Keep `retry.provider.maxRetries` at `0` unless provider-level retries are explic
219
219
  ### Message Delivery
220
220
 
221
221
  | Setting | Type | Default | Description |
222
- |---------|------|---------|-------------|
222
+ | --------- | ------ | --------- | ------------- |
223
223
  | `steeringMode` | string | `"one-at-a-time"` | How steering messages are sent: `"all"` or `"one-at-a-time"` |
224
224
  | `followUpMode` | string | `"one-at-a-time"` | How follow-up messages are sent: `"all"` or `"one-at-a-time"` |
225
225
  | `transport` | string | `"auto"` | Preferred transport for providers that support multiple transports: `"sse"`, `"websocket"`, `"websocket-cached"`, or `"auto"` |
@@ -229,7 +229,7 @@ Keep `retry.provider.maxRetries` at `0` unless provider-level retries are explic
229
229
  ### Terminal & Images
230
230
 
231
231
  | Setting | Type | Default | Description |
232
- |---------|------|---------|-------------|
232
+ | --------- | ------ | --------- | ------------- |
233
233
  | `terminal.showImages` | boolean | `true` | Show images in terminal (if supported) |
234
234
  | `terminal.imageWidthCells` | number | `60` | Preferred inline image width in terminal cells |
235
235
  | `terminal.clearOnShrink` | boolean | `false` | Clear empty rows when content shrinks (can cause flicker) |
@@ -239,7 +239,7 @@ Keep `retry.provider.maxRetries` at `0` unless provider-level retries are explic
239
239
  ### Shell
240
240
 
241
241
  | Setting | Type | Default | Description |
242
- |---------|------|---------|-------------|
242
+ | --------- | ------ | --------- | ------------- |
243
243
  | `shellPath` | string | - | Custom shell path (e.g., for Cygwin on Windows) |
244
244
  | `shellCommandPrefix` | string | - | Prefix for every bash command (e.g., `"shopt -s expand_aliases"`) |
245
245
  | `npmCommand` | string[] | - | Command argv used for npm package lookup/install operations (e.g., `["mise", "exec", "node@20", "--", "npm"]`) |
@@ -289,7 +289,7 @@ These settings define where to load extensions, skills, prompts, and themes from
289
289
  Paths in `~/.omk/agent/settings.json` resolve relative to `~/.omk/agent`. Paths in `.omk/settings.json` resolve relative to `.omk`. Absolute paths and `~` are supported.
290
290
 
291
291
  | Setting | Type | Default | Description |
292
- |---------|------|---------|-------------|
292
+ | --------- | ------ | --------- | ------------- |
293
293
  | `packages` | array | `[]` | npm/git packages to load resources from |
294
294
  | `extensions` | string[] | `[]` | Local extension file paths or directories |
295
295
  | `skills` | string[] | `[]` | Local skill file paths or directories |
package/docs/usage.md CHANGED
@@ -18,7 +18,7 @@ The editor can be replaced temporarily by built-in UI such as `/settings` or by
18
18
  ### Editor Features
19
19
 
20
20
  | Feature | How |
21
- |---------|-----|
21
+ | --------- | ----- |
22
22
  | File reference | Type `@` to fuzzy-search project files |
23
23
  | Path completion | Press Tab to complete paths |
24
24
  | Multi-line input | Shift+Enter, or Ctrl+Enter on Windows Terminal |
@@ -35,7 +35,7 @@ See [Keybindings](keybindings.md) for all shortcuts and customization.
35
35
  Type `/` in the editor to open command completion. Extensions can register custom commands, skills are available as `/skill:name`, `!skill:name`, or `!name` for known skills, `!omk <role-or-request>` selects an OMK role hub such as frontend, backend, loop, or plan, and prompt templates expand via `/templatename`.
36
36
 
37
37
  | Command | Description |
38
- |---------|-------------|
38
+ | --------- | ------------- |
39
39
  | `/login`, `/logout` | Manage OAuth or API-key credentials |
40
40
  | `/model` | Switch models, then choose thinking level |
41
41
  | `/think` | Choose thinking level, or `auto` to route per task through v4 |
@@ -55,6 +55,7 @@ Type `/` in the editor to open command completion. Extensions can register custo
55
55
  | `/reload` | Reload keybindings, extensions, skills, prompts, and context files |
56
56
  | `/hotkeys` | Show all keyboard shortcuts |
57
57
  | `/changelog` | Display version history |
58
+ | `/star` | Open the OMK GitHub repository |
58
59
  | `/quit` | Quit omk |
59
60
 
60
61
  ## Automatic Thinking Level Routing
@@ -221,7 +222,7 @@ Config sources, highest precedence first: `models.json`, `KIMI_BASE_URL`/`KIMI_M
221
222
  ### Modes
222
223
 
223
224
  | Flag | Description |
224
- |------|-------------|
225
+ | ------ | ------------- |
225
226
  | default | Interactive mode |
226
227
  | `-p`, `--print` | Print response and exit |
227
228
  | `--mode json` | Output all events as JSON lines; see [JSON mode](json.md) |
@@ -237,7 +238,7 @@ cat README.md | omk -p "Summarize this text"
237
238
  ### Model Options
238
239
 
239
240
  | Option | Description |
240
- |--------|-------------|
241
+ | -------- | ------------- |
241
242
  | `--provider <name>` | Provider, such as `anthropic`, `openai`, or `google` |
242
243
  | `--model <pattern>` | Model pattern or ID; supports `provider/id` and optional `:<thinking>` |
243
244
  | `--api-key <key>` | API key, overriding environment variables |
@@ -248,7 +249,7 @@ cat README.md | omk -p "Summarize this text"
248
249
  ### Session Options
249
250
 
250
251
  | Option | Description |
251
- |--------|-------------|
252
+ | -------- | ------------- |
252
253
  | `-c`, `--continue` | Continue the most recent session |
253
254
  | `-r`, `--resume` | Browse and select a session |
254
255
  | `--session <path\|id>` | Use a specific session file or partial UUID |
@@ -260,7 +261,7 @@ cat README.md | omk -p "Summarize this text"
260
261
  ### Tool Options
261
262
 
262
263
  | Option | Description |
263
- |--------|-------------|
264
+ | -------- | ------------- |
264
265
  | `--tools <list>`, `-t <list>` | Allowlist specific built-in, extension, and custom tools |
265
266
  | `--exclude-tools <list>`, `-xt <list>` | Disable specific built-in, extension, and custom tools |
266
267
  | `--no-builtin-tools`, `-nbt` | Disable built-in tools but keep extension/custom tools enabled |
@@ -271,7 +272,7 @@ Built-in tools: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`.
271
272
  ### Resource Options
272
273
 
273
274
  | Option | Description |
274
- |--------|-------------|
275
+ | -------- | ------------- |
275
276
  | `-e`, `--extension <source>` | Load an extension from path, npm, or git; repeatable |
276
277
  | `--no-extensions` | Disable extension discovery |
277
278
  | `--skill <path>` | Load a skill; repeatable |
@@ -291,7 +292,7 @@ omk --no-extensions -e ./my-extension.ts
291
292
  ### Other Options
292
293
 
293
294
  | Option | Description |
294
- |--------|-------------|
295
+ | -------- | ------------- |
295
296
  | `--system-prompt <text>` | Replace default prompt; context files and skills are still appended |
296
297
  | `--append-system-prompt <text>` | Append to system prompt |
297
298
  | `--verbose` | Force verbose startup |
@@ -345,7 +346,7 @@ omk --exclude-tools ask_question
345
346
  ### Environment Variables
346
347
 
347
348
  | Variable | Description |
348
- |----------|-------------|
349
+ | ---------- | ------------- |
349
350
  | `OMK_CODING_AGENT_DIR` | Override config directory; default is `~/.omk/agent` |
350
351
  | `OMK_CODING_AGENT_SESSION_DIR` | Override session storage directory; overridden by `--session-dir` |
351
352
  | `OMK_PACKAGE_DIR` | Override package directory, useful for Nix/Guix store paths |
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omk-extension-custom-provider-anthropic",
3
- "version": "0.94.0",
3
+ "version": "0.95.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omk-extension-custom-provider-anthropic",
9
- "version": "0.94.0",
9
+ "version": "0.95.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.94.0",
4
+ "version": "0.95.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.94.0",
4
+ "version": "0.95.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omk-extension-gondolin",
3
- "version": "0.94.0",
3
+ "version": "0.95.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omk-extension-gondolin",
9
- "version": "0.94.0",
9
+ "version": "0.95.0",
10
10
  "dependencies": {
11
11
  "@earendil-works/gondolin": "0.12.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-gondolin",
3
3
  "private": true,
4
- "version": "0.94.0",
4
+ "version": "0.95.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omk-extension-sandbox",
3
- "version": "0.94.0",
3
+ "version": "0.95.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omk-extension-sandbox",
9
- "version": "0.94.0",
9
+ "version": "0.95.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "0.0.26"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.94.0",
4
+ "version": "0.95.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omk-extension-with-deps",
3
- "version": "0.94.0",
3
+ "version": "0.95.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omk-extension-with-deps",
9
- "version": "0.94.0",
9
+ "version": "0.95.0",
10
10
  "dependencies": {
11
11
  "ms": "2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "omk-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.94.0",
4
+ "version": "0.95.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "open-multi-agent-kit",
3
- "version": "0.94.0",
3
+ "version": "0.95.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "open-multi-agent-kit",
9
- "version": "0.94.0",
9
+ "version": "0.95.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "omk-agent-core": "^0.94.0",
13
- "omk-ai": "^0.94.0",
14
- "omk-tui": "^0.94.0",
12
+ "omk-agent-core": "^0.95.0",
13
+ "omk-ai": "^0.95.0",
14
+ "omk-tui": "^0.95.0",
15
15
  "@silvia-odwyer/photon-node": "0.3.4",
16
16
  "chalk": "5.6.2",
17
17
  "cross-spawn": "7.0.6",
@@ -21,12 +21,12 @@
21
21
  "hosted-git-info": "9.0.3",
22
22
  "ignore": "7.0.5",
23
23
  "jiti": "2.7.0",
24
- "minimatch": "10.2.5",
24
+ "minimatch": "10.2.6",
25
25
  "proper-lockfile": "4.1.2",
26
26
  "typebox": "1.1.38",
27
27
  "undici": "8.5.0",
28
28
  "yaml": "2.9.0",
29
- "omk-adaptorch-wpl": "^0.94.0"
29
+ "omk-adaptorch-wpl": "^0.95.0"
30
30
  },
31
31
  "optionalDependencies": {
32
32
  "@mariozechner/clipboard": "0.3.9"
@@ -960,15 +960,15 @@
960
960
  "license": "MIT"
961
961
  },
962
962
  "node_modules/brace-expansion": {
963
- "version": "5.0.7",
964
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.7.tgz",
965
- "integrity": "sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA==",
963
+ "version": "5.0.8",
964
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz",
965
+ "integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==",
966
966
  "license": "MIT",
967
967
  "dependencies": {
968
968
  "balanced-match": "^4.0.2"
969
969
  },
970
970
  "engines": {
971
- "node": "18 || 20 || >=22"
971
+ "node": "20 || >=22"
972
972
  }
973
973
  },
974
974
  "node_modules/buffer-equal-constant-time": {
@@ -1356,12 +1356,12 @@
1356
1356
  }
1357
1357
  },
1358
1358
  "node_modules/minimatch": {
1359
- "version": "10.2.5",
1360
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
1361
- "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
1359
+ "version": "10.2.6",
1360
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
1361
+ "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
1362
1362
  "license": "BlueOak-1.0.0",
1363
1363
  "dependencies": {
1364
- "brace-expansion": "^5.0.5"
1364
+ "brace-expansion": "^5.0.8"
1365
1365
  },
1366
1366
  "engines": {
1367
1367
  "node": "18 || 20 || >=22"
@@ -1424,19 +1424,19 @@
1424
1424
  }
1425
1425
  },
1426
1426
  "node_modules/omk-adaptorch-wpl": {
1427
- "version": "0.94.0",
1428
- "resolved": "https://registry.npmjs.org/omk-adaptorch-wpl/-/omk-adaptorch-wpl-0.94.0.tgz",
1427
+ "version": "0.95.0",
1428
+ "resolved": "https://registry.npmjs.org/omk-adaptorch-wpl/-/omk-adaptorch-wpl-0.95.0.tgz",
1429
1429
  "license": "MIT",
1430
1430
  "engines": {
1431
1431
  "node": ">=22.19.0"
1432
1432
  }
1433
1433
  },
1434
1434
  "node_modules/omk-agent-core": {
1435
- "version": "0.94.0",
1436
- "resolved": "https://registry.npmjs.org/omk-agent-core/-/omk-agent-core-0.94.0.tgz",
1435
+ "version": "0.95.0",
1436
+ "resolved": "https://registry.npmjs.org/omk-agent-core/-/omk-agent-core-0.95.0.tgz",
1437
1437
  "license": "MIT",
1438
1438
  "dependencies": {
1439
- "omk-ai": "^0.94.0",
1439
+ "omk-ai": "^0.95.0",
1440
1440
  "ignore": "7.0.5",
1441
1441
  "typebox": "1.1.38",
1442
1442
  "yaml": "2.9.0"
@@ -1446,8 +1446,8 @@
1446
1446
  }
1447
1447
  },
1448
1448
  "node_modules/omk-ai": {
1449
- "version": "0.94.0",
1450
- "resolved": "https://registry.npmjs.org/omk-ai/-/omk-ai-0.94.0.tgz",
1449
+ "version": "0.95.0",
1450
+ "resolved": "https://registry.npmjs.org/omk-ai/-/omk-ai-0.95.0.tgz",
1451
1451
  "license": "MIT",
1452
1452
  "dependencies": {
1453
1453
  "@anthropic-ai/sdk": "0.91.1",
@@ -1469,8 +1469,8 @@
1469
1469
  }
1470
1470
  },
1471
1471
  "node_modules/omk-tui": {
1472
- "version": "0.94.0",
1473
- "resolved": "https://registry.npmjs.org/omk-tui/-/omk-tui-0.94.0.tgz",
1472
+ "version": "0.95.0",
1473
+ "resolved": "https://registry.npmjs.org/omk-tui/-/omk-tui-0.95.0.tgz",
1474
1474
  "license": "MIT",
1475
1475
  "dependencies": {
1476
1476
  "get-east-asian-width": "1.6.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-multi-agent-kit",
3
- "version": "0.94.0",
3
+ "version": "0.95.0",
4
4
  "description": "OMK (Open Multi-Agent Kit) coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "omkConfig": {
@@ -44,9 +44,9 @@
44
44
  "postinstall": "node ./scripts/link-workspace-deps.mjs"
45
45
  },
46
46
  "dependencies": {
47
- "omk-agent-core": "^0.94.0",
48
- "omk-ai": "^0.94.0",
49
- "omk-tui": "^0.94.0",
47
+ "omk-agent-core": "^0.95.0",
48
+ "omk-ai": "^0.95.0",
49
+ "omk-tui": "^0.95.0",
50
50
  "@silvia-odwyer/photon-node": "0.3.4",
51
51
  "chalk": "5.6.2",
52
52
  "cross-spawn": "7.0.6",
@@ -56,12 +56,12 @@
56
56
  "hosted-git-info": "9.0.3",
57
57
  "ignore": "7.0.5",
58
58
  "jiti": "2.7.0",
59
- "minimatch": "10.2.5",
59
+ "minimatch": "10.2.6",
60
60
  "proper-lockfile": "4.1.2",
61
61
  "typebox": "1.1.38",
62
62
  "undici": "8.5.0",
63
63
  "yaml": "2.9.0",
64
- "omk-adaptorch-wpl": "^0.94.0"
64
+ "omk-adaptorch-wpl": "^0.95.0"
65
65
  },
66
66
  "overrides": {
67
67
  "rimraf": "6.1.2",