@maincode-ai/matilda-code 0.21.10 → 0.21.11-nightly.20261019.07ef6f6a1

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 (138) hide show
  1. package/bundled/mainy/docs/configuration/settings.md +10 -1
  2. package/bundled/mainy/docs/matilda-serve.md +6 -6
  3. package/chunks/agent-PXBLXFNY.js +3 -0
  4. package/chunks/agent-headless-YWSSHHJ2.js +3 -0
  5. package/chunks/{anthropicContentGenerator-SFJGSZHT.js → anthropicContentGenerator-IYZILRDW.js} +1 -1
  6. package/chunks/{askUserQuestion-MJ4FTAOQ.js → askUserQuestion-XWHJY3DM.js} +1 -1
  7. package/chunks/{ca-H4HPSGTI.js → ca-EUJBUYX5.js} +1 -1
  8. package/chunks/{chunk-B3NVKOSU.js → chunk-25NCTG5H.js} +63 -54
  9. package/chunks/{chunk-INAZKGGR.js → chunk-2HQMJ2IU.js} +1 -1
  10. package/chunks/chunk-46MIUE6Z.js +113 -0
  11. package/chunks/{todoWrite-7BZMVNBC.js → chunk-4CSSDBOS.js} +2 -2
  12. package/chunks/{chunk-5PMMY47S.js → chunk-4FVBPNTZ.js} +1 -1
  13. package/chunks/{chunk-LSDMWVW6.js → chunk-5427BPR2.js} +2 -2
  14. package/chunks/{chunk-GC2F575A.js → chunk-6GBNB5Z2.js} +1 -1
  15. package/chunks/chunk-6OM7PU5M.js +2627 -0
  16. package/chunks/{chunk-EXIO3QHE.js → chunk-7Y4YWLWT.js} +9 -9
  17. package/chunks/{chunk-32PTAACU.js → chunk-ELH4YHJR.js} +1 -1
  18. package/chunks/{chunk-3HUM74NZ.js → chunk-EQGA7LH7.js} +2 -2
  19. package/chunks/{chunk-FWIVFCKF.js → chunk-FFFZ2QMG.js} +1 -1
  20. package/chunks/chunk-GHBKFIHC.js +35 -0
  21. package/chunks/{chunk-EQEQPZLQ.js → chunk-GO2GA2GY.js} +1 -1
  22. package/chunks/{chunk-QHA3ZBRO.js → chunk-GUFIMKF5.js} +1 -1
  23. package/chunks/{chunk-DJSOHDUB.js → chunk-H44J3WCU.js} +1 -1
  24. package/chunks/{chunk-RJX7DK4Y.js → chunk-HWOQNYAO.js} +1 -1
  25. package/chunks/{chunk-K3ELACN2.js → chunk-HXXKWC4R.js} +17 -17
  26. package/chunks/chunk-HYVP4472.js +8 -0
  27. package/chunks/chunk-I2UAZHXP.js +39 -0
  28. package/chunks/{chunk-VWWEEU4V.js → chunk-JXUDKX6D.js} +1 -1
  29. package/chunks/chunk-M53RP3YP.js +31 -0
  30. package/chunks/{chunk-VLYRNOD3.js → chunk-MH2P4YXC.js} +10 -10
  31. package/chunks/{chunk-VYTYYCBR.js → chunk-NYEWHSBL.js} +1 -1
  32. package/chunks/{chunk-C62LTEOV.js → chunk-O3X6OM5U.js} +2 -2
  33. package/chunks/{chunk-LIWYWWOK.js → chunk-ODZOYHIC.js} +1 -1
  34. package/chunks/{chunk-Q2I3ARPJ.js → chunk-QH7736R5.js} +1 -1
  35. package/chunks/chunk-QN6WSWMM.js +9 -0
  36. package/chunks/chunk-SNLH42QJ.js +10 -0
  37. package/chunks/chunk-SPW5DXX4.js +35 -0
  38. package/chunks/{chunk-S7G6QPEP.js → chunk-SUH3UUWZ.js} +1 -1
  39. package/chunks/chunk-T2T2UEPY.js +4 -0
  40. package/chunks/{chunk-6B5BDE7S.js → chunk-T4P4KEDW.js} +8 -8
  41. package/chunks/chunk-VI74YQQO.js +8 -0
  42. package/chunks/{chunk-DCQKJTAX.js → chunk-W5CGKUM4.js} +8 -3
  43. package/chunks/{chunk-32T6RWWT.js → chunk-WHG6N5X2.js} +1 -1
  44. package/chunks/{chunk-XCJYORZX.js → chunk-XCFLI3OC.js} +1 -1
  45. package/chunks/{chunk-3ZAMYREW.js → chunk-YMIF2DMT.js} +1 -1
  46. package/chunks/{computer-use-DJV6HTND.js → computer-use-6HSNUCLB.js} +7 -7
  47. package/chunks/contextCommand-BZEFZB7M.js +3 -0
  48. package/chunks/{cron-create-BTTPO3JC.js → cron-create-2UI4AT4Q.js} +1 -1
  49. package/chunks/{cron-delete-U55RHRID.js → cron-delete-ZB6BOTFF.js} +1 -1
  50. package/chunks/{cron-list-J4HRR46K.js → cron-list-YYAXNHB6.js} +1 -1
  51. package/chunks/{de-S7F37S4F.js → de-DNEPG7S7.js} +1 -1
  52. package/chunks/{dist-SVKXQXJX.js → dist-ME6647DQ.js} +1 -1
  53. package/chunks/{dist-SCXU6QWY.js → dist-P6SLWL5V.js} +1 -1
  54. package/chunks/{dist-PVENOVGI.js → dist-VG3ZDJ2A.js} +1 -1
  55. package/chunks/{dist-N66KF4KX.js → dist-YTCHM57U.js} +1 -1
  56. package/chunks/{edit-7XEZHXE4.js → edit-QHKHGKM2.js} +1 -1
  57. package/chunks/{en-S6DMCJQZ.js → en-NOD6KQNM.js} +1 -1
  58. package/chunks/{enter-worktree-MR64QLS4.js → enter-worktree-PTUIG373.js} +1 -1
  59. package/chunks/{enterPlanMode-UNWCEVYY.js → enterPlanMode-2A37Q5OW.js} +1 -1
  60. package/chunks/{exit-worktree-D4BMN6LH.js → exit-worktree-LV2XJ634.js} +1 -1
  61. package/chunks/{exitPlanMode-AKLFFYT2.js → exitPlanMode-AU7EQHXM.js} +1 -1
  62. package/chunks/{fr-RFJP3KVL.js → fr-2OE5WLJ4.js} +1 -1
  63. package/chunks/{geminiContentGenerator-JBASUS2T.js → geminiContentGenerator-QXWIMCG7.js} +1 -1
  64. package/chunks/glob-XFSH2QKT.js +22 -0
  65. package/chunks/goal-tools-6QTC3UI7.js +12 -0
  66. package/chunks/grep-HYFLZADN.js +22 -0
  67. package/chunks/{ja-UTJHPL3M.js → ja-3B6V5KS7.js} +1 -1
  68. package/chunks/{keychain-token-storage-HAFQQIXL.js → keychain-token-storage-54BNK6VH.js} +1 -1
  69. package/chunks/{ls-CLDNF3YS.js → ls-YWZU3FYL.js} +1 -1
  70. package/chunks/{lsp-7SKRKR5Q.js → lsp-4CJDKEEC.js} +1 -1
  71. package/chunks/{matildaAgentContentGenerator-GMDJPWES.js → matildaAgentContentGenerator-VOOMYECL.js} +1 -1
  72. package/chunks/matildaContentGenerator-4NSKMBCF.js +8 -0
  73. package/chunks/{matildaOAuth2-W2DQO2NK.js → matildaOAuth2-WOY7ZS43.js} +1 -1
  74. package/chunks/monitor-F3MMAOV2.js +32 -0
  75. package/chunks/notebook-edit-3N72EDYF.js +17 -0
  76. package/chunks/{openaiContentGenerator-XDOQRO4G.js → openaiContentGenerator-TIRPXHM2.js} +1 -1
  77. package/chunks/{pt-KXMOTADP.js → pt-KP2JCPUY.js} +1 -1
  78. package/chunks/read-file-6EAPS2KG.js +3 -0
  79. package/chunks/ripGrep-7L45WKPK.js +3 -0
  80. package/chunks/{ru-EWGWZPQH.js → ru-K7IQQKHC.js} +1 -1
  81. package/chunks/scheduler-SZNVJELW.js +8 -0
  82. package/chunks/{send-message-XXRROIL7.js → send-message-OO2HAKCC.js} +1 -1
  83. package/chunks/{serve-4MDSDWP7.js → serve-2KBVIHAA.js} +31 -31
  84. package/chunks/shell-JNI7BDC3.js +3 -0
  85. package/chunks/{skill-JIISRKQN.js → skill-LOWNP4W4.js} +1 -1
  86. package/chunks/src-O5Z62OHH.js +3 -0
  87. package/chunks/{symbol-search-3MVTK4KV.js → symbol-search-ALYOX5JN.js} +1 -1
  88. package/chunks/{syntheticOutput-QEUQIVQJ.js → syntheticOutput-UASKABJH.js} +1 -1
  89. package/chunks/task-create-EBJD55TB.js +3 -0
  90. package/chunks/task-detach-I67ZE5MX.js +9 -0
  91. package/chunks/{task-list-ZEJTNZ2O.js → task-list-5BGX4G5N.js} +1 -1
  92. package/chunks/{task-stop-JO3CXG2K.js → task-stop-ERI5X4AO.js} +1 -1
  93. package/chunks/{task-update-3YY37VFN.js → task-update-CD3W556L.js} +1 -1
  94. package/chunks/{team-create-GMI5DIH7.js → team-create-IGCB4YJX.js} +1 -1
  95. package/chunks/{team-delete-4YYLUV23.js → team-delete-5U3GBFKJ.js} +1 -1
  96. package/chunks/todoWrite-YGG6AZ3A.js +3 -0
  97. package/chunks/{tool-search-OWJC3UTX.js → tool-search-JFCD5W5M.js} +1 -1
  98. package/chunks/{web-fetch-K575OWZ7.js → web-fetch-REWGIRWQ.js} +1 -1
  99. package/chunks/{web-search-F6JRBXFV.js → web-search-OX2DPEVN.js} +1 -1
  100. package/chunks/{workflow-H5DWTI5W.js → workflow-6N3FGOUE.js} +2 -2
  101. package/chunks/write-file-WJUMYRVH.js +15 -0
  102. package/cli.js +480 -475
  103. package/locales/ca.js +8 -2
  104. package/locales/de.js +9 -2
  105. package/locales/en.js +15 -8
  106. package/locales/fr.js +9 -2
  107. package/locales/ja.js +8 -2
  108. package/locales/pt.js +8 -2
  109. package/locales/ru.js +9 -2
  110. package/package.json +2 -2
  111. package/sandbox-macos-restrictive-closed.sb +4 -0
  112. package/sandbox-macos-restrictive-open.sb +4 -0
  113. package/sandbox-macos-restrictive-proxied.sb +4 -0
  114. package/chunks/agent-2ZM5WMHY.js +0 -3
  115. package/chunks/agent-headless-PX4INULZ.js +0 -3
  116. package/chunks/chunk-2UDXLDSZ.js +0 -34
  117. package/chunks/chunk-34DXSYJZ.js +0 -34
  118. package/chunks/chunk-ESSYHTAZ.js +0 -8
  119. package/chunks/chunk-FRL6KOLY.js +0 -35
  120. package/chunks/chunk-I7TAYS6D.js +0 -108
  121. package/chunks/chunk-JSFA3NEP.js +0 -5
  122. package/chunks/chunk-ROETRE5J.js +0 -9
  123. package/chunks/chunk-RYLWDCCN.js +0 -2594
  124. package/chunks/chunk-TZIDSCTF.js +0 -31
  125. package/chunks/contextCommand-TAFFF6V7.js +0 -3
  126. package/chunks/glob-3QKPKP7Z.js +0 -22
  127. package/chunks/grep-6CL6HJ5Y.js +0 -22
  128. package/chunks/matildaContentGenerator-EFK4QDRS.js +0 -8
  129. package/chunks/monitor-6W2R25LH.js +0 -32
  130. package/chunks/notebook-edit-WL6MZ6AW.js +0 -17
  131. package/chunks/read-file-J5UBJYDO.js +0 -3
  132. package/chunks/ripGrep-2AMYRBCZ.js +0 -3
  133. package/chunks/scheduler-LFSCKDU6.js +0 -8
  134. package/chunks/shell-SMTFAOAE.js +0 -3
  135. package/chunks/src-OF7NIVIL.js +0 -3
  136. package/chunks/task-create-AEJQ73GE.js +0 -3
  137. package/chunks/update-goal-CF6G57J7.js +0 -16
  138. package/chunks/write-file-RUHYPLKF.js +0 -15
package/locales/ca.js CHANGED
@@ -449,8 +449,14 @@ export default {
449
449
  'Custom Witty Phrases': 'Frases enginyoses personalitzades',
450
450
  'Show Welcome Back Dialog': 'Mostrar el diàleg de benvinguda',
451
451
  'Enable User Feedback': 'Activar les valoracions dels usuaris',
452
- 'How is Matilda doing this session? (optional)':
453
- 'Com va Matilda en aquesta sessió? (opcional)',
452
+ 'How well is Matilda working for you?': 'Com et funciona Matilda?',
453
+ 'Give a rating from 1 to 5:': 'Dona una puntuació de l’1 al 5:',
454
+ 'Tell us more and/or give suggestions!':
455
+ 'Explica’ns més coses i/o fes suggeriments!',
456
+ '1–5 rate · ←→ adjust · enter next · esc dismiss':
457
+ '1–5 puntuar · ←→ ajustar · retorn següent · esc tancar',
458
+ 'enter submit · shift+enter newline · tab back · esc dismiss':
459
+ 'retorn enviar · maj+retorn línia nova · tab enrere · esc tancar',
454
460
  Bad: 'Malament',
455
461
  Fine: 'Bé',
456
462
  Good: 'Molt bé',
package/locales/de.js CHANGED
@@ -379,8 +379,15 @@ export default {
379
379
  'Custom Witty Phrases': 'Benutzerdefinierte Witzige Sprüche',
380
380
  'Show Welcome Back Dialog': 'Willkommen-zurück-Dialog anzeigen',
381
381
  'Enable User Feedback': 'Benutzerfeedback aktivieren',
382
- 'How is Matilda doing this session? (optional)':
383
- 'Wie macht sich Matilda in dieser Sitzung? (optional)',
382
+ 'How well is Matilda working for you?':
383
+ 'Wie gut funktioniert Matilda für dich?',
384
+ 'Give a rating from 1 to 5:': 'Gib eine Bewertung von 1 bis 5 ab:',
385
+ 'Tell us more and/or give suggestions!':
386
+ 'Erzähl uns mehr und/oder mach Vorschläge!',
387
+ '1–5 rate · ←→ adjust · enter next · esc dismiss':
388
+ '1–5 bewerten · ←→ anpassen · Eingabe weiter · Esc schließen',
389
+ 'enter submit · shift+enter newline · tab back · esc dismiss':
390
+ 'Eingabe senden · Umschalt+Eingabe neue Zeile · Tab zurück · Esc schließen',
384
391
  Bad: 'Schlecht',
385
392
  Fine: 'In Ordnung',
386
393
  Good: 'Gut',
package/locales/en.js CHANGED
@@ -480,8 +480,15 @@ export default {
480
480
  'Custom Witty Phrases': 'Custom Witty Phrases',
481
481
  'Show Welcome Back Dialog': 'Show Welcome Back Dialog',
482
482
  'Enable User Feedback': 'Enable User Feedback',
483
- 'How is Matilda doing this session? (optional)':
484
- 'How is Matilda doing this session? (optional)',
483
+ 'How well is Matilda working for you?':
484
+ 'How well is Matilda working for you?',
485
+ 'Give a rating from 1 to 5:': 'Give a rating from 1 to 5:',
486
+ 'Tell us more and/or give suggestions!':
487
+ 'Tell us more and/or give suggestions!',
488
+ '1–5 rate · ←→ adjust · enter next · esc dismiss':
489
+ '1–5 rate · ←→ adjust · enter next · esc dismiss',
490
+ 'enter submit · shift+enter newline · tab back · esc dismiss':
491
+ 'enter submit · shift+enter newline · tab back · esc dismiss',
485
492
  Bad: 'Bad',
486
493
  Fine: 'Fine',
487
494
  Good: 'Good',
@@ -1154,12 +1161,12 @@ export default {
1154
1161
  'Chat history compression did not reduce size. This may indicate issues with the compression prompt.',
1155
1162
  'Could not compress chat history due to a token counting error.':
1156
1163
  'Could not compress chat history due to a token counting error.',
1157
- 'Could not compress chat history — the summarizer timed out or failed. Try again, or continue chatting (auto-compact will retry).':
1158
- 'Could not compress chat history — the summarizer timed out or failed. Try again, or continue chatting (auto-compact will retry).',
1159
- 'Could not compress chat history — the summarizer returned an empty summary. Try again.':
1160
- 'Could not compress chat history — the summarizer returned an empty summary. Try again.',
1161
- 'Could not compress chat history — the summary hit the output length cap. Try again later or start a new session.':
1162
- 'Could not compress chat history — the summary hit the output length cap. Try again later or start a new session.',
1164
+ 'Could not compress chat history: the summarizer timed out or failed. Try again, or continue chatting (auto-compact will retry).':
1165
+ 'Could not compress chat history: the summarizer timed out or failed. Try again, or continue chatting (auto-compact will retry).',
1166
+ 'Could not compress chat history: the summarizer returned an empty summary. Try again.':
1167
+ 'Could not compress chat history: the summarizer returned an empty summary. Try again.',
1168
+ 'Could not compress chat history: the summary hit the output length cap. Try again later or start a new session.':
1169
+ 'Could not compress chat history: the summary hit the output length cap. Try again later or start a new session.',
1163
1170
  // ============================================================================
1164
1171
  // Commands - Directory
1165
1172
  // ============================================================================
package/locales/fr.js CHANGED
@@ -454,8 +454,15 @@ export default {
454
454
  'Custom Witty Phrases': 'Phrases personnalisées spirituelles',
455
455
  'Show Welcome Back Dialog': 'Afficher le dialogue de bienvenue',
456
456
  'Enable User Feedback': 'Activer les retours utilisateur',
457
- 'How is Matilda doing this session? (optional)':
458
- 'Comment se passe cette session avec Matilda ? (facultatif)',
457
+ 'How well is Matilda working for you?':
458
+ 'Matilda répond-elle bien à vos besoins ?',
459
+ 'Give a rating from 1 to 5:': 'Donnez une note de 1 à 5 :',
460
+ 'Tell us more and/or give suggestions!':
461
+ 'Dites-nous-en plus et/ou faites des suggestions !',
462
+ '1–5 rate · ←→ adjust · enter next · esc dismiss':
463
+ '1–5 noter · ←→ ajuster · entrée suivant · échap fermer',
464
+ 'enter submit · shift+enter newline · tab back · esc dismiss':
465
+ 'entrée envoyer · maj+entrée nouvelle ligne · tab retour · échap fermer',
459
466
  Bad: 'Mauvais',
460
467
  Fine: 'Correct',
461
468
  Good: 'Bien',
package/locales/ja.js CHANGED
@@ -1403,8 +1403,14 @@ export default {
1403
1403
  'Show Line Numbers in Code': 'コードの行番号を表示',
1404
1404
  'Show Welcome Back Dialog': 'おかえりダイアログを表示',
1405
1405
  'Enable User Feedback': 'ユーザーフィードバックを有効化',
1406
- 'How is Matilda doing this session? (optional)':
1407
- 'このセッションでの Matilda の調子はどうですか?(任意)',
1406
+ 'How well is Matilda working for you?': 'Matilda の使い心地はいかがですか?',
1407
+ 'Give a rating from 1 to 5:': '1〜5で評価してください:',
1408
+ 'Tell us more and/or give suggestions!':
1409
+ '詳しい感想やご提案をお聞かせください!',
1410
+ '1–5 rate · ←→ adjust · enter next · esc dismiss':
1411
+ '1–5 評価 · ←→ 調整 · enter 次へ · esc 閉じる',
1412
+ 'enter submit · shift+enter newline · tab back · esc dismiss':
1413
+ 'enter 送信 · shift+enter 改行 · tab 戻る · esc 閉じる',
1408
1414
  'Interactive Shell (PTY)': '対話型シェル (PTY)',
1409
1415
  'Select Editor': 'エディタを選択',
1410
1416
  'Editor Preference': 'エディタ設定',
package/locales/pt.js CHANGED
@@ -401,8 +401,14 @@ export default {
401
401
  'Custom Witty Phrases': 'Frases de Efeito Personalizadas',
402
402
  'Show Welcome Back Dialog': 'Mostrar Diálogo de Bem-vindo de Volta',
403
403
  'Enable User Feedback': 'Ativar Feedback do Usuário',
404
- 'How is Matilda doing this session? (optional)':
405
- 'Como o Matilda está se saindo nesta sessão? (opcional)',
404
+ 'How well is Matilda working for you?':
405
+ 'Como está sendo sua experiência com a Matilda?',
406
+ 'Give a rating from 1 to 5:': 'Dê uma nota de 1 a 5:',
407
+ 'Tell us more and/or give suggestions!': 'Conte-nos mais e/ou dê sugestões!',
408
+ '1–5 rate · ←→ adjust · enter next · esc dismiss':
409
+ '1–5 avaliar · ←→ ajustar · enter avançar · esc fechar',
410
+ 'enter submit · shift+enter newline · tab back · esc dismiss':
411
+ 'enter enviar · shift+enter nova linha · tab voltar · esc fechar',
406
412
  Bad: 'Ruim',
407
413
  Fine: 'Bom',
408
414
  Good: 'Ótimo',
package/locales/ru.js CHANGED
@@ -399,8 +399,15 @@ export default {
399
399
  'Custom Witty Phrases': 'Пользовательские остроумные фразы',
400
400
  'Show Welcome Back Dialog': 'Показывать диалог приветствия',
401
401
  'Enable User Feedback': 'Включить отзывы пользователей',
402
- 'How is Matilda doing this session? (optional)':
403
- 'Как дела у Matilda в этой сессии? (необязательно)',
402
+ 'How well is Matilda working for you?':
403
+ 'Насколько хорошо Matilda справляется с вашими задачами?',
404
+ 'Give a rating from 1 to 5:': 'Поставьте оценку от 1 до 5:',
405
+ 'Tell us more and/or give suggestions!':
406
+ 'Расскажите подробнее и/или поделитесь предложениями!',
407
+ '1–5 rate · ←→ adjust · enter next · esc dismiss':
408
+ '1–5 оценка · ←→ изменить · enter далее · esc закрыть',
409
+ 'enter submit · shift+enter newline · tab back · esc dismiss':
410
+ 'enter отправить · shift+enter новая строка · tab назад · esc закрыть',
404
411
  Bad: 'Плохо',
405
412
  Fine: 'Нормально',
406
413
  Good: 'Хорошо',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maincode-ai/matilda-code",
3
- "version": "0.21.10",
3
+ "version": "0.21.11-nightly.20261019.07ef6f6a1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "cli.js",
@@ -26,7 +26,7 @@
26
26
  "bundled"
27
27
  ],
28
28
  "config": {
29
- "sandboxImageUri": "ghcr.io/maincode/matilda-code:0.21.10"
29
+ "sandboxImageUri": "ghcr.io/maincode/matilda-code:0.21.11-nightly.20261019.07ef6f6a1"
30
30
  },
31
31
  "dependencies": {},
32
32
  "optionalDependencies": {
@@ -13,6 +13,10 @@
13
13
  ;; allow signals to self, e.g. SIGPIPE on write to closed pipe
14
14
  (allow signal (target self))
15
15
 
16
+ ;; allow stopping processes started inside this sandbox; cancel and task
17
+ ;; stop signal the command's process group
18
+ (allow signal (target same-sandbox))
19
+
16
20
  ;; allow read access to specific information about system
17
21
  ;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
18
22
  (allow sysctl-read
@@ -13,6 +13,10 @@
13
13
  ;; allow signals to self, e.g. SIGPIPE on write to closed pipe
14
14
  (allow signal (target self))
15
15
 
16
+ ;; allow stopping processes started inside this sandbox; cancel and task
17
+ ;; stop signal the command's process group
18
+ (allow signal (target same-sandbox))
19
+
16
20
  ;; allow read access to specific information about system
17
21
  ;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
18
22
  (allow sysctl-read
@@ -13,6 +13,10 @@
13
13
  ;; allow signals to self, e.g. SIGPIPE on write to closed pipe
14
14
  (allow signal (target self))
15
15
 
16
+ ;; allow stopping processes started inside this sandbox; cancel and task
17
+ ;; stop signal the command's process group
18
+ (allow signal (target same-sandbox))
19
+
16
20
  ;; allow read access to specific information about system
17
21
  ;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
18
22
  (allow sysctl-read
@@ -1,3 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{mg as a,ng as b,og as c,pg as d,qg as e,rg as f}from"./chunk-RYLWDCCN.js";import"./chunk-TZIDSCTF.js";import"./chunk-ROETRE5J.js";import"./chunk-INAZKGGR.js";import"./chunk-DCQKJTAX.js";import"./chunk-LSDMWVW6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-VYTYYCBR.js";import"./chunk-TISQNFB5.js";import"./chunk-34DXSYJZ.js";import"./chunk-47XR7IMP.js";import"./chunk-FWIVFCKF.js";import"./chunk-QKYGQLWC.js";import"./chunk-FRL6KOLY.js";import"./chunk-VWWEEU4V.js";import"./chunk-RNKDFE2S.js";import"./chunk-Q2I3ARPJ.js";import"./chunk-EXIO3QHE.js";import"./chunk-QHA3ZBRO.js";import"./chunk-I7TAYS6D.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-S7G6QPEP.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-B3NVKOSU.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-32PTAACU.js";import"./chunk-32T6RWWT.js";import"./chunk-6B5BDE7S.js";import"./chunk-RJX7DK4Y.js";import"./chunk-XCJYORZX.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-EQEQPZLQ.js";import"./chunk-VLYRNOD3.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{f as AgentTool,b as TOOL_REGISTRY_REBUILT,e as createApprovalModeOverride,c as hasRebuiltToolRegistry,d as rebuildToolRegistryOnOverride,a as resolveSubagentApprovalMode};
@@ -1,3 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{Nf as a,Of as b,Pf as c}from"./chunk-RYLWDCCN.js";import"./chunk-TZIDSCTF.js";import"./chunk-ROETRE5J.js";import"./chunk-INAZKGGR.js";import"./chunk-DCQKJTAX.js";import"./chunk-LSDMWVW6.js";import"./chunk-MTMU7JYZ.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-VYTYYCBR.js";import"./chunk-TISQNFB5.js";import"./chunk-34DXSYJZ.js";import"./chunk-47XR7IMP.js";import"./chunk-FWIVFCKF.js";import"./chunk-QKYGQLWC.js";import"./chunk-FRL6KOLY.js";import"./chunk-VWWEEU4V.js";import"./chunk-RNKDFE2S.js";import"./chunk-Q2I3ARPJ.js";import"./chunk-EXIO3QHE.js";import"./chunk-QHA3ZBRO.js";import"./chunk-I7TAYS6D.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-S7G6QPEP.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-B3NVKOSU.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-32PTAACU.js";import"./chunk-32T6RWWT.js";import"./chunk-6B5BDE7S.js";import"./chunk-RJX7DK4Y.js";import"./chunk-XCJYORZX.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-EQEQPZLQ.js";import"./chunk-VLYRNOD3.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{c as AgentHeadless,a as ContextState,b as templateString};
@@ -1,34 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{a as be}from"./chunk-LIWYWWOK.js";import{c as q,f as O}from"./chunk-QHA3ZBRO.js";import{M as pe,N as ce,O as k,Q as me,R as W,S as de,a as re,g as P,h as ie,la as ge}from"./chunk-I7TAYS6D.js";import{a as he}from"./chunk-DC7LAFZZ.js";import{a as oe,g as ae,k as se,l as D,o as ue,t as fe,v as Ce}from"./chunk-S7G6QPEP.js";import{e as ne}from"./chunk-4J6DC24J.js";import{b as H,c as N,f as le,n as j}from"./chunk-SDTWBD62.js";import{b as z}from"./chunk-ESSYHTAZ.js";import{a as U,aa as A,c as ee,q as J,s as te,t as K}from"./chunk-VLYRNOD3.js";import{b as p}from"./chunk-GZPNIYVZ.js";p();p();p();p();p();function Re(i){return i.toLowerCase().includes("matilda3")}function Ie(i){if(i.role!=="assistant")return i;let e=i;return typeof e.reasoning_content!="string"||e.reasoning_content.length===0||typeof e.reasoning=="string"?i:{...e,reasoning:e.reasoning_content}}var f=class{contentGeneratorConfig;cliConfig;constructor(e,t){this.cliConfig=t,this.contentGeneratorConfig=e}buildHeaders(){let t=`MatildaCode/${this.cliConfig.getCliVersion()||"unknown"} (${process.platform}; ${process.arch})`,{customHeaders:n}=this.contentGeneratorConfig,r={"User-Agent":t};for(let[o,a]of Object.entries(n??{}))le(o)||(r[o]=a);return r}buildClient(){let{apiKey:e,baseUrl:t,timeout:n=6e5,maxRetries:r=3}=this.contentGeneratorConfig,o=this.buildHeaders(),a=q("openai",this.cliConfig.getProxy());return new U({apiKey:e,baseURL:t,timeout:n,maxRetries:r,defaultHeaders:o,...a||{}})}buildRequest(e,t){let n=this.contentGeneratorConfig.extra_body,r=this.applyOutputTokenLimit(e),o=Re(e.model)?r.messages.map(Ie):r.messages;return{...r,messages:o,...n||{}}}getDefaultGenerationConfig(){return{}}applyOutputTokenLimit(e){if(this.contentGeneratorConfig.samplingParams!==void 0)return e;let t=e.max_tokens,n=Ce(e.model,"output"),r=fe(e.model),o;if(t!=null)r?o=Math.min(t,n):o=t;else{let a=process.env.MATILDA_CODE_MAX_OUTPUT_TOKENS,s=a?parseInt(a,10):NaN;!isNaN(s)&&s>0?o=r?Math.min(s,n):s:o=Math.min(n,8e3)}return{...e,max_tokens:o}}};var w=class extends f{static isModelScopeProvider(e){return!!e.baseUrl?.includes("modelscope")}buildRequest(e,t){let n=super.buildRequest(e,t);return n.stream||delete n.stream_options,n}};p();var Me=A("MatildaOpenAICompatibleProvider"),b=class i extends f{constructor(e,t){super(e,t)}static isMatildaCompatibleProvider(e){let{authType:t,baseUrl:n}=e;if(t==="matilda-oauth"||!n)return!0;let r=n.endsWith("/")?n.slice(0,-1):n,o=null;try{o=new URL(r).hostname.toLowerCase()}catch{o=null}let a=o!==null&&(o==="matilda.maincode.com"||o.endsWith(".matilda.maincode.com")||o==="localhost"||o==="127.0.0.1"||o.endsWith(".matilda")||o==="core-api.matilda"),s=D?.endsWith("/")?D.slice(0,-1):D,l=!!(s&&r.toLowerCase()===s.toLowerCase());return s&&!a&&!l&&Me.debug("MATILDA_COMPAT_PROXY_BASE_URL is configured but the request baseUrl does not match. Cache control helpers will be skipped."),a||l}buildHeaders(){let t=`MatildaCode/${this.cliConfig.getCliVersion()||"unknown"} (${process.platform}; ${process.arch})`,{customHeaders:n}=this.contentGeneratorConfig,r={"User-Agent":t};for(let[o,a]of Object.entries(n??{}))!ce(o)&&o.toLowerCase()!=="x-stainless-retry-count"&&(r[o]=a);return k(this.contentGeneratorConfig)&&Object.assign(r,pe(this.cliConfig)),r}buildClient(){let{apiKey:e,baseUrl:t=se,timeout:n=6e5,maxRetries:r=3}=this.contentGeneratorConfig,o=this.buildHeaders(),a=q("openai",this.cliConfig.getProxy()),s=a?.fetch??globalThis.fetch,l=k(this.contentGeneratorConfig)?async(c,m)=>{let d=new Headers(c instanceof Request?c.headers:void 0);new Headers(m?.headers).forEach((C,u)=>{d.set(u,C)});let g=d.has(H)||d.has(N),h=j(),y=g||Object.keys(h).length>0;if(y){d.delete(H),d.delete(N);for(let[u,G]of Object.entries(h))d.set(u,G);let C=d.get("x-stainless-retry-count");d.has(H)&&C!==null&&/^[1-9][0-9]*$/.test(C)&&d.set(N,"retry")}this.cliConfig.getChannel()===void 0&&me({authStage:"inference_started",authOutcome:"started"},{baseUrl:t,token:e}).catch(()=>{});try{let C=await s(c,y?{...m,headers:d}:m);return de({baseUrl:this.contentGeneratorConfig.baseUrl,token:this.contentGeneratorConfig.apiKey}).catch(()=>{}),C}catch(C){throw W(C,{cliConfig:this.cliConfig,proxyConfigured:!!this.cliConfig.getProxy()}),C}}:void 0;return new U({apiKey:e,baseURL:t,timeout:n,maxRetries:r,defaultHeaders:o,...a||{},...l?{fetch:l}:{}})}buildRequest(e,t){let n=e.messages,r=e.tools;if(this.shouldEnableCacheControl()){let{messages:s,tools:l}=this.addCacheControl(e,e.stream?"all":"system_only");n=s,r=l}let o=this.applyOutputTokenLimit(e),a=this.contentGeneratorConfig.extra_body;return this.isVisionModel(e.model)?{...o,messages:n,...r?{tools:r}:{},...this.buildMetadata(t)||{},vl_high_resolution_images:!0,...a||{}}:{...o,messages:n,...r?{tools:r}:{},...this.buildMetadata(t)||{},...a||{}}}buildMetadata(e){let t=this.cliConfig.getChannel?.();return{metadata:{sessionId:this.cliConfig.getSessionId?.(),promptId:e,...t?{channel:t}:{}}}}getDefaultGenerationConfig(){return{}}addCacheControl(e,t){let n=e.messages,r=n.findIndex(l=>l.role==="system"),o=n.length-1,a=n.length===0?n:n.map((l,c)=>!(c===r&&r!==-1||c===o&&t==="all")||!("content"in l)||l.content===null||l.content===void 0?l:{...l,content:this.addCacheControlToContent(l.content)}),s=t==="all"&&e.tools?.length?this.addCacheControlToTools(e.tools):e.tools;return{messages:a,tools:s}}addCacheControlToTools(e){if(e.length===0)return e;let t=[...e],n=e.length-1;return t[n]={...t[n],cache_control:{type:"ephemeral"}},t}addCacheControlToContent(e){let t=this.normalizeContentToArray(e);return this.addCacheControlToContentArray(t)}normalizeContentToArray(e){return typeof e=="string"?[{type:"text",text:e}]:[...e]}addCacheControlToContentArray(e){if(e.length===0)return e;let t=e[e.length-1];return e[e.length-1]={...t,cache_control:{type:"ephemeral"}},e}static VISION_MODEL_EXACT_MATCHES=new Set(["coder-model"]);static VISION_MODEL_PREFIX_PATTERNS=["matilda-vl","matilda3-vl-plus","matilda3.5-plus","matilda3.6-plus","matilda3.7-plus"];isVisionModel(e){if(!e)return!1;let t=e.toLowerCase();if(i.VISION_MODEL_EXACT_MATCHES.has(t))return!0;for(let n of i.VISION_MODEL_PREFIX_PATTERNS)if(t.startsWith(n))return!0;return!1}shouldEnableCacheControl(){return this.cliConfig.getContentGeneratorConfig()?.enableCacheControl!==!1}};p();p();function F(i){if(i.role!=="assistant")return i;let e=i;return typeof e.reasoning_content=="string"?i:{...e,reasoning_content:""}}function E(i){let e=i.baseUrl??"";if(!e)return!1;try{let t=new URL(e).hostname.toLowerCase();return t==="api.deepseek.com"||t.endsWith(".api.deepseek.com")}catch{return!1}}function Te(i){return E(i)?!0:(i.model??"").toLowerCase().includes("deepseek")}var R=class extends f{constructor(e,t){super(e,t)}static isDeepSeekProvider=Te;static isDeepSeekHostname=E;buildRequest(e,t){let n=super.buildRequest(e,t),r=E(this.contentGeneratorConfig)?ve(n):n;if(!r.messages?.length)return r;let o=r.messages.map(a=>{let s=xe(a);return F(s)});return{...r,messages:o}}getDefaultGenerationConfig(){return{temperature:0}}};function xe(i){if(!("content"in i))return i;let{content:e}=i;if(typeof e=="string"||e===null||e===void 0||!Array.isArray(e))return i;let t=e.map(n=>typeof n=="string"?n:n.type==="text"?n.text??"":`[Unsupported content type: ${n.type}]`).join(`
4
-
5
- `);return{...i,content:t}}function ve(i){let e=i,t=e.reasoning,n=t?.effort;if(typeof n!="string"||!n)return i;let r={...e};if(typeof r.reasoning_effort!="string"||!r.reasoning_effort){let o=n;o==="low"||o==="medium"?o="high":o==="xhigh"&&(o="max"),r.reasoning_effort=o}if(t&&Object.keys(t).length===1)delete r.reasoning;else if(t){let{effort:o,...a}=t;r.reasoning=a}return r}p();var I=class extends f{constructor(e,t){super(e,t)}static isOpenRouterProvider(e){return(e.baseUrl||"").includes("openrouter.ai")}buildHeaders(){return{...super.buildHeaders(),"HTTP-Referer":"https://github.com/MaincodeHQ/matilda-code.git","X-OpenRouter-Title":"Matilda"}}};p();var we=["api.minimaxi.com","api.minimax.io"],Ge=[".minimaxi.com",".minimax.io"],M=class extends f{static isMiniMaxProvider(e){if(!e.baseUrl)return!1;try{let t=new URL(e.baseUrl).hostname.toLowerCase();return we.includes(t)?!0:Ge.some(n=>t.endsWith(n))}catch{return!1}}getResponseParsingOptions(){return{taggedThinkingTags:!0}}};p();var ye="api.mistral.ai",ke=["mistral","mixtral","codestral","ministral","pixtral","magistral","devstral"];function Ee(i){let e=i.baseUrl??"";if(!e)return!1;try{let t=new URL(e).hostname.toLowerCase();return t===ye||t.endsWith(`.${ye}`)}catch{return!1}}function _e(i){if(Ee(i))return!0;let e=i.model?.toLowerCase()??"";return ke.some(t=>e.includes(t))}var T=class extends f{static isMistralProvider=_e;buildRequest(e,t){let n=super.buildRequest(e,t);return{...n,messages:n.messages.map(Se)}}};function Se(i){if(!("reasoning_content"in i))return i;let e={...i};return delete e.reasoning_content,e}p();function Le(i){let e=i.baseUrl??"";if(e)try{let n=new URL(e).hostname.toLowerCase();if(n==="xiaomimimo.com"||n.endsWith(".xiaomimimo.com"))return!0}catch{}return(i.model??"").toLowerCase().startsWith("mimo-")}var x=class extends f{constructor(e,t){super(e,t)}static isMiMoProvider=Le;buildRequest(e,t){let n=super.buildRequest(e,t);return n.messages?.length?{...n,messages:n.messages.map(F)}:n}getRequestContextOverrides(){return{splitToolMedia:this.contentGeneratorConfig.splitToolMedia??!0}}};p();p();var Ue=A("STREAMING_TOOL_CALL_PARSER"),V=class{buffers=new Map;depths=new Map;inStrings=new Map;escapes=new Map;toolCallMeta=new Map;idToIndexMap=new Map;nextAvailableIndex=0;addChunk(e,t,n,r){let o=e,a=!!(n&&this.idToIndexMap.has(n));if(n)if(this.idToIndexMap.has(n))o=this.idToIndexMap.get(n);else{if(this.buffers.has(e)){let u=this.buffers.get(e),G=this.depths.get(e),Z=this.toolCallMeta.get(e);if(u.trim()&&G===0&&Z?.id&&Z.id!==n)try{JSON.parse(u),o=this.findNextAvailableIndex()}catch{}}this.idToIndexMap.set(n,o)}else if(this.buffers.has(e)){let u=this.buffers.get(e);if(this.depths.get(e)>0||!u.trim())o=e;else try{JSON.parse(u),o=this.findMostRecentIncompleteIndex()}catch{o=e}}this.buffers.has(o)||(this.buffers.set(o,""),this.depths.set(o,0),this.inStrings.set(o,!1),this.escapes.set(o,!1),this.toolCallMeta.set(o,{}));let s=this.buffers.get(o),l=this.depths.get(o);if(a&&s.trim()&&l===0)try{return JSON.parse(s),Ue.debug(`Ignoring replay chunk for completed toolCall id=${n}`),{complete:!1}}catch{}let c=this.toolCallMeta.get(o);n&&(c.id=n),r&&(c.name=r);let m=this.inStrings.get(o),d=this.escapes.get(o),g=s+t;this.buffers.set(o,g);let h=l,y=m,C=d;for(let u of t)y||(u==="{"||u==="["?h++:(u==="}"||u==="]")&&h--),u==='"'&&!C&&(y=!y),C=u==="\\"&&!C;if(this.depths.set(o,h),this.inStrings.set(o,y),this.escapes.set(o,C),h===0&&g.trim().length>0)try{return{complete:!0,value:JSON.parse(g)}}catch(u){if(y)try{return{complete:!0,value:JSON.parse(g+'"'),repaired:!0}}catch{}return{complete:!1,error:u instanceof Error?u:new Error(String(u))}}return{complete:!1}}getToolCallMeta(e){return this.toolCallMeta.get(e)||{}}getCompletedToolCalls(){return this.collectCompletedToolCalls({allowJsonRepair:!0})}getStrictCompletedToolCalls(){return this.collectCompletedToolCalls({allowJsonRepair:!1})}collectCompletedToolCalls({allowJsonRepair:e}){let t=[],n=new Set;for(let[r,o]of this.buffers.entries()){let a=this.toolCallMeta.get(r);if(a?.name){let s=this.depths.get(r)||0,l=this.inStrings.get(r)||!1;if(s>0||l)continue;if(a.id){if(n.has(a.id))continue;n.add(a.id)}let c;if(!o.trim())c={};else try{c=JSON.parse(o)}catch{if(!e)continue;let m=oe(o,null);if(!m||typeof m!="object")continue;c=m}t.push({id:a.id,name:a.name,args:c,index:r})}}return t}findNextAvailableIndex(){for(;this.buffers.has(this.nextAvailableIndex);){let e=this.buffers.get(this.nextAvailableIndex),t=this.depths.get(this.nextAvailableIndex),n=this.toolCallMeta.get(this.nextAvailableIndex);if(!e.trim()||t>0||!n?.id)return this.nextAvailableIndex;try{if(JSON.parse(e),t===0){this.nextAvailableIndex++;continue}}catch{return this.nextAvailableIndex}this.nextAvailableIndex++}return this.nextAvailableIndex++}findMostRecentIncompleteIndex(){let e=-1;for(let[t,n]of this.buffers.entries()){let r=this.depths.get(t);if(this.toolCallMeta.get(t)?.id&&(r>0||!n.trim()))e=Math.max(e,t);else if(n.trim())try{JSON.parse(n)}catch{e=Math.max(e,t)}}return e>=0?e:this.findNextAvailableIndex()}resetIndex(e){this.buffers.set(e,""),this.depths.set(e,0),this.inStrings.set(e,!1),this.escapes.set(e,!1),this.toolCallMeta.set(e,{})}reset(){this.buffers.clear(),this.depths.clear(),this.inStrings.clear(),this.escapes.clear(),this.toolCallMeta.clear(),this.idToIndexMap.clear(),this.nextAvailableIndex=0}getBuffer(e){return this.buffers.get(e)||""}getState(e){return{depth:this.depths.get(e)||0,inString:this.inStrings.get(e)||!1,escape:this.escapes.get(e)||!1}}hasIncompleteToolCalls(){for(let[e,t]of this.buffers.entries()){let n=this.toolCallMeta.get(e),r=this.depths.get(e)||0,o=this.inStrings.get(e)||!1;if(r>0||o)return!0;if(!n?.name&&t.trim())try{JSON.parse(t)}catch{return!0}}return!1}};var Ae=16e3,Pe=`[Earlier content omitted to fit Matilda Core external API limits]
6
- `,B=class extends Error{constructor(e){super(e),this.name="StreamContentError"}},_=class{constructor(e){this.config=e;this.contentGeneratorConfig=e.contentGeneratorConfig,this.client=this.config.provider.buildClient()}client;contentGeneratorConfig;async execute(e,t){return this.executeWithErrorHandling(e,t,!1,async(n,r)=>{let o=e.config?.abortSignal,a=o?z(o):void 0,s=this.reportedOperationHeaders();try{let l=await this.client.chat.completions.create(n,{signal:a?.signal,...s?{headers:s}:{}});return P.convertOpenAIResponseToGemini(l,r)}finally{a?.abort()}})}async executeStream(e,t){return this.executeWithErrorHandling(e,t,!0,async(n,r)=>{let o=e.config?.abortSignal,a=o?z(o):void 0,s=this.reportedOperationHeaders(),l;try{l=await this.client.chat.completions.create(n,{signal:a?.signal,...s?{headers:s}:{}})}catch(g){throw a?.abort(),g}if(!a)return this.processStreamWithLogging(l,r,e);let c=a,m=this.processStreamWithLogging(l,r,e);async function*d(){try{yield*m}finally{c.abort()}}return d()})}reportedOperationHeaders(){if(!k(this.contentGeneratorConfig))return;let e=j();return Object.keys(e).length>0?e:void 0}async*processStreamWithLogging(e,t,n){let r=[],o=null,a=!1;try{for await(let s of e){if(s.choices?.[0]?.finish_reason==="error_finish"){let m=s.choices?.[0]?.delta?.content?.trim()||"Unknown stream error";throw new B(m)}let l=P.convertOpenAIChunkToGemini(s,t);if(l.candidates?.[0]?.content?.parts?.length===0&&!l.candidates?.[0]?.finishReason&&!l.usageMetadata)continue;if(a){if(l.usageMetadata){let m=o;m&&(m.usageMetadata=l.usageMetadata)}r.push(l);continue}this.handleChunkMerging(l,r,m=>{o=m})&&(o?(yield o,a=!0):yield l)}if(!o&&!a){let s=P.flushOpenAIStreamToGemini(t);s&&(yield s,a=!0)}o&&!a&&(yield o)}catch(s){if(s instanceof B)throw O(s);await this.handleError(s,t,n)}}handleChunkMerging(e,t,n){let r=e.candidates?.[0]?.finishReason,o=t.length>0&&t[t.length-1].candidates?.[0]?.finishReason;if(r){if(o){let a=t[t.length-1];e.usageMetadata&&(a.usageMetadata=e.usageMetadata),n(a)}else t.push(e),n(e);return!1}else if(o){let a=t[t.length-1],s=new ne;return s.candidates=a.candidates,e.usageMetadata?s.usageMetadata=e.usageMetadata:s.usageMetadata=a.usageMetadata,s.responseId=e.responseId,s.createTime=e.createTime,s.modelVersion=e.modelVersion,s.promptFeedback=e.promptFeedback,t[t.length-1]=s,n(s),!0}return t.push(e),!0}async buildRequest(e,t,n,r){let o=P.convertGeminiRequestToOpenAI(e,n),a=this.shouldUseMatildaCoreRequestProfile(),s=a?this.toMatildaCoreUserMessages(o):o,l={model:n.model,messages:s,...this.buildGenerateContentConfig(e)};r?(l.stream=!0,l.stream_options={include_usage:!0}):l.stream=!1,!a&&e.config?.tools&&e.config.tools.length>0&&(l.tools=await P.convertGeminiToolsToOpenAI(e.config.tools,this.contentGeneratorConfig.schemaCompliance??"auto"));let c=this.config.provider.buildRequest(l,t);if(e.config?.thinkingConfig?.includeThoughts===!1||this.contentGeneratorConfig.reasoning===!1){let d=c,g=(n.model??"").toLowerCase();if(b.isMatildaCompatibleProvider(this.contentGeneratorConfig)&&(g.startsWith("matilda")||g==="coder-model")){d.enable_thinking=!1;let h=d.chat_template_kwargs;typeof h=="object"&&h!==null&&"enable_thinking"in h&&(d.chat_template_kwargs={...h,enable_thinking:!1})}"reasoning"in d&&delete d.reasoning,"reasoning_effort"in d&&delete d.reasoning_effort,E(this.contentGeneratorConfig)&&(d.thinking={type:"disabled"})}return c}toMatildaCoreUserMessages(e){let t=e.filter(n=>n.role==="user").map(n=>({role:"user",content:this.sanitizeMatildaUserContent(this.toPlainUserContent(n.content))})).filter(n=>n.content.trim().length>0);return t.length>0?t:[{role:"user",content:""}]}shouldUseMatildaCoreRequestProfile(){let e=this.contentGeneratorConfig.openAIRequestProfile,t=(this.contentGeneratorConfig.baseUrl??"").toLowerCase().replace(/\/+$/,"");if(e==="matilda-code"||t.endsWith("/api/v1/code"))return!1;if(e==="matilda-core")return!0;let n=this.contentGeneratorConfig.customHeaders??{};return Object.entries(n).some(([o,a])=>o.toLowerCase()==="x-matilda-client"&&a.toLowerCase()==="matilda-code")?!0:t==="https://matilda.maincode.com/api/v1"||t==="http://localhost:8080/api/v1"||t==="http://core-api.matilda:3001/api/v1"}toPlainUserContent(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>t.type==="text"?t.text:t.type==="image_url"?"[image omitted: Matilda Core OpenAI shim accepts text only]":"").filter(Boolean).join(`
7
- `):""}sanitizeMatildaUserContent(e){let n=e.replace(/<system-reminder>[\s\S]*?<\/system-reminder>\s*/g,"").trim();if(n.length<=Ae)return n;let r=Ae-Pe.length;return`${Pe}${n.slice(-r)}`}buildGenerateContentConfig(e){let t=this.config.provider.getDefaultGenerationConfig(),n=this.contentGeneratorConfig.samplingParams,r=(s,l)=>{let c=n?.[s],m=l?e.config?.[l]:void 0,d=l?t[l]:void 0;return c!==void 0?c:m!==void 0?m:d},o=(s,l,c)=>{let m=r(l,c);return m!==void 0?{[s]:m}:{}};if(n!==void 0){let s=e.config?.maxOutputTokens;return{...n,...s!==void 0&&n.max_tokens!==void 0?{max_tokens:s}:{}}}return{...o("temperature","temperature","temperature"),...o("top_p","top_p","topP"),...o("max_tokens","max_tokens","maxOutputTokens"),...o("top_k","top_k","topK"),...o("repetition_penalty","repetition_penalty"),...o("presence_penalty","presence_penalty","presencePenalty"),...o("frequency_penalty","frequency_penalty","frequencyPenalty"),...this.buildReasoningConfig(e)}}buildReasoningConfig(e){if(e.config?.thinkingConfig?.includeThoughts===!1)return{};let t=this.contentGeneratorConfig.reasoning;return t===!1||t===void 0?{}:{reasoning:t}}async executeWithErrorHandling(e,t,n,r){let o=this.createRequestContext(e,n);try{let a=await this.buildRequest(e,t,o,n);return ie.getStore()?.(a),ae.recordOpenAIWireRequest(a),await r(a,o)}catch(a){return await this.handleError(a,o,e)}}async handleError(e,t,n){this.config.errorHandler.handle(O(e),t,n)}createRequestContext(e,t){let n=e.model||this.contentGeneratorConfig.model,r=this.config.provider.getRequestContextOverrides?.()??{},o=t?new V:void 0,a=this.config.provider.getResponseParsingOptions?.(),s=t&&a?.taggedThinkingTags?new re:void 0;return{model:n,modalities:this.contentGeneratorConfig.modalities??{},startTime:Date.now(),splitToolMedia:r.splitToolMedia??this.contentGeneratorConfig.splitToolMedia??!0,...o?{toolCallParser:o}:{},...a?{responseParsingOptions:a}:{},...s?{taggedThinkingParser:s}:{}}}};p();var De=A("OPENAI_ERROR"),S=class{constructor(e=()=>!1){this.shouldSuppressLogging=e}handle(e,t,n){let r=O(e),o=this.isTimeoutError(r),a=this.buildErrorMessage(r,t,o);throw this.shouldSuppressErrorLogging(r,n)||De.error("OpenAI API Error:",a),o?new Error(`${a}
8
-
9
- ${this.getTimeoutTroubleshootingTips()}`):r}shouldSuppressErrorLogging(e,t){return this.shouldSuppressLogging(e,t)}isTimeoutError(e){if(!e)return!1;let t=e instanceof Error?e.message.toLowerCase():String(e).toLowerCase(),n=e?.code,r=e?.type;return t.includes("timeout")||t.includes("timed out")||t.includes("connection timeout")||t.includes("request timeout")||t.includes("read timeout")||t.includes("etimedout")||t.includes("esockettimedout")||n==="ETIMEDOUT"||n==="ESOCKETTIMEDOUT"||r==="timeout"||t.includes("request timed out")||t.includes("deadline exceeded")}buildErrorMessage(e,t,n){let r=Math.round((Date.now()-t.startTime)/1e3);return n?`Request timeout after ${r}s. Try reducing input length or increasing timeout in config.`:e instanceof Error?e.message:String(e)}getTimeoutTroubleshootingTips(){return`Troubleshooting tips:
10
- ${["- Reduce input length or complexity","- Increase timeout in config: contentGenerator.timeout","- Check network connectivity"].join(`
11
- `)}`}};var Oe=A("OPENAI"),v=class{pipeline;constructor(e,t,n){let r={cliConfig:t,provider:n,contentGeneratorConfig:e,errorHandler:new S((o,a)=>this.shouldSuppressErrorLogging(o,a))};this.pipeline=new _(r)}shouldSuppressErrorLogging(e,t){return!!(ee(e)&&t.config?.abortSignal?.aborted)}async generateContent(e,t){return this.pipeline.execute(e,t)}async generateContentStream(e,t){return this.pipeline.executeStream(e,t)}async countTokens(e){try{return{totalTokens:(await new be().calculateTokens(e)).totalTokens}}catch(t){Oe.warn("Failed to calculate tokens with new tokenizer, falling back to simple method:",t);let n=JSON.stringify(e.contents);return{totalTokens:Math.ceil(n.length/4)}}}async embedContent(e){let t="";Array.isArray(e.contents)?t=e.contents.map(n=>typeof n=="string"?n:"parts"in n&&n.parts?n.parts.map(r=>typeof r=="string"?r:"text"in r&&r.text||"").join(" "):"").join(" "):e.contents&&(typeof e.contents=="string"?t=e.contents:"parts"in e.contents&&e.contents.parts&&(t=e.contents.parts.map(n=>typeof n=="string"?n:"text"in n?n.text:"").join(" ")));try{return{embeddings:[{values:(await this.pipeline.client.embeddings.create({model:"text-embedding-ada-002",input:t})).data[0].embedding}]}}catch(n){let r=O(n);throw Oe.error("OpenAI API Embedding Error:",r),new Error(`OpenAI API error: ${r instanceof Error?r.message:String(r)}`)}}useSummarizedThinking(){return!1}};p();var L=class extends v{contentGeneratorConfig;cliConfig;channel;constructor(e,t,n){super(e,t,n),this.contentGeneratorConfig=e,this.cliConfig=t,this.channel=t.getChannel?.()}shouldSuppressErrorLogging(e,t){return X(e)?!0:super.shouldSuppressErrorLogging(e,t)}async generateContent(e,t){return this.withTokenRefresh(()=>super.generateContent(e,t))}async generateContentStream(e,t){let n=()=>super.generateContentStream(e,t),r=await this.withTokenRefresh(n);return this.iterateWithAuthRetry(r,n)}async*iterateWithAuthRetry(e,t){let n=!1;try{for await(let r of e)n||=(r.candidates??[]).some(o=>!!(o.finishReason||o.content?.parts?.length)),yield r;return}catch(r){if(!X(r))throw $(r);if(n)throw new J("Matilda session expired while the response was streaming. Run /auth to reconnect.");await this.applyValidToken({forceRefresh:!0});try{yield*await t()}catch(o){throw $(o)}}}async embedContent(e){return this.withTokenRefresh(()=>super.embedContent(e))}async applyValidToken(e){let t;try{t=await ge({baseUrl:this.contentGeneratorConfig.baseUrl,fallbackAccessToken:this.contentGeneratorConfig.apiKey,forceRefresh:e?.forceRefresh,channel:this.channel})}catch(n){throw W(n,{cliConfig:this.cliConfig,proxyConfigured:!!this.cliConfig.getProxy?.()}),n}t&&(this.contentGeneratorConfig.apiKey=t,this.pipeline.client.apiKey=t,process.env[he]=t)}async withTokenRefresh(e){await this.applyValidToken();try{return await e()}catch(t){if(!X(t))throw $(t);await this.applyValidToken({forceRefresh:!0});try{return await e()}catch(n){throw $(n)}}}};function $(i){return K(i)?new te:X(i)?new J("Matilda session expired and could not be refreshed. Run /auth to reconnect."):i}function X(i){if(!i||K(i))return!1;let e=i instanceof Error?i.message.toLowerCase():String(i).toLowerCase(),t=i,n=Number(t.status??t.statusCode??t.code);return n>=400&&n<600?n===401:e.includes("unauthorized")||e.includes("invalid api key")||e.includes("invalid access token")||e.includes("token expired")||e.includes("authentication")||e.includes("token")&&e.includes("expired")}function In(i,e){let t=He(i,e);return b.isMatildaCompatibleProvider(i)?new L(i,e,t):new v(i,e,t)}function He(i,e){let t=i||e.getContentGeneratorConfig();return b.isMatildaCompatibleProvider(t)?new b(i,e):R.isDeepSeekProvider(t)?new R(i,e):x.isMiMoProvider(t)?new x(i,e):I.isOpenRouterProvider(t)?new I(i,e):w.isModelScopeProvider(t)?new w(i,e):M.isMiniMaxProvider(t)?new M(i,e):T.isMistralProvider(t)?new T(i,e):new f(i,e)}export{b as a,R as b,I as c,M as d,T as e,x as f,_ as g,S as h,v as i,L as j,In as k,He as l};
12
- /**
13
- * @license
14
- * Copyright 2025 Matilda
15
- * SPDX-License-Identifier: Apache-2.0
16
- */
17
- /**
18
- * @license
19
- * Copyright 2026 Maincode
20
- * SPDX-License-Identifier: Apache-2.0
21
- *
22
- * OpenAI-compat Matilda Code path (settings selectedType=openai + MATILDA_API_KEY).
23
- *
24
- * Emulates Grok Build's automatic credential refresh
25
- * (docs: "Automatic Credential Refresh"):
26
- * 1. Before each request: ensure a fresh access token (re-read disk; refresh
27
- * when within the early-invalidation window / already expired).
28
- * 2. On 401 Unauthorized: force-refresh and retry the request once.
29
- * 3. When refresh fails (invalid_grant): surface re-auth; do not loop.
30
- *
31
- * Plain OpenAIContentGenerator only hydrated MATILDA_API_KEY once at
32
- * createContentGenerator time, so idle sessions past access-token expiry
33
- * failed every turn with `API Error: 401 "Unauthorized"` until restart//auth.
34
- */
@@ -1,34 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{b as I}from"./chunk-4J6DC24J.js";import{k as M}from"./chunk-SDTWBD62.js";import{aa as m}from"./chunk-VLYRNOD3.js";import{b as f}from"./chunk-GZPNIYVZ.js";f();var l=new Map;function me(e,t){return e===t?!0:!e||!t?!1:N(e)===N(t)}function N(e){let t={};for(let n of Object.keys(e).sort()){let o=e[n];o!==void 0&&(t[n]=o)}return JSON.stringify(t)}function S(e){return l.get(e)}function j(e,t){l.set(e,t)}function x(e){let t=l.get(e);return l.delete(e),t}function J(e,t){let n=l.get(e);if(!n)return;let o={...n,iterations:n.iterations+1,lastReason:t};return l.set(e,o),o}function H(e,t,n){let o=l.get(e);if(!o)return;let i={...o,status:t,statusNote:t==="active"?void 0:n?.trim()||o.statusNote};return t==="active"&&delete i.statusNote,l.set(e,i),i}function b(e){return e.status??"active"}function ye(){l.clear(),A.clear(),h.clear()}var A=new Map;function Ge(e,t){A.set(e,t)}function _(e){A.delete(e)}function P(e,t){z(e,t);let n=A.get(e);if(n)try{n(t)}catch{}}var h=new Map;function z(e,t){h.set(e,t)}function he(e){return h.get(e)}function ke(e,t){if(!t){h.delete(e);return}h.set(e,t)}f();f();var E=m("ERROR_REPORT");async function D(e,t,n,o="general"){let i;e instanceof Error?i={message:e.message,stack:e.stack}:typeof e=="object"&&e!==null&&"message"in e?i={message:String(e.message)}:i={message:String(e)};let r={error:i};n&&(r.context=n);let s=`${t} [${o}]`,c;try{c=JSON.stringify(r,null,2)}catch(u){E.error(`${s} Could not stringify report content (likely due to context):`,u,e);try{c=JSON.stringify({error:i},null,2),E.error(s,c)}catch(d){E.error(`${s} Failed to stringify minimal error report:`,d,e)}return}E.error(s,c)}var k=m("GOAL_JUDGE"),W=`You are evaluating a stop-condition hook in an autonomous coding agent.
4
- Read the conversation transcript above carefully, then judge whether the
5
- user-provided condition is satisfied.
6
-
7
- Your response MUST be a JSON object with one of these shapes:
8
- - {"ok": true, "reason": "<quote evidence from the transcript that satisfies the condition>"}
9
- - {"ok": false, "reason": "<quote what is missing or what blocks the condition>"}
10
- - {"ok": false, "impossible": true, "reason": "<explain why the condition can never be satisfied>"}
11
-
12
- Always include a "reason" field, quoting specific text from the transcript
13
- whenever possible. If the transcript does not contain clear evidence that the
14
- condition is satisfied, return {"ok": false, "reason": "insufficient evidence in transcript"}.
15
- Only use {"ok": false, "impossible": true} when the condition is genuinely
16
- unachievable in this session: for example, it is self-contradictory, depends on
17
- an unavailable resource or capability, or the assistant has exhausted reasonable
18
- approaches and the transcript confirms there is no path forward. The assistant
19
- claiming the goal is impossible is evidence, not proof; independently confirm
20
- the condition is genuinely unachievable rather than deferring to the assistant's
21
- self-assessment. Do not use it just because progress is slow or evidence is
22
- currently missing. When in doubt, return {"ok": false} without "impossible".`,X=e=>`Based on the conversation transcript above, has the following stopping condition been satisfied? Answer based on transcript evidence only.
23
- Condition JSON string: ${JSON.stringify(e)}`;var V={type:"OBJECT",properties:{ok:{type:"BOOLEAN"},reason:{type:"STRING"},impossible:{type:"BOOLEAN"}},required:["ok","reason"],additionalProperties:!1},y="Goal judge unavailable; continue working toward the goal and run `/goal clear` to stop early.",Q=240;function R(e,t){D(e,"Goal judge failed",{stage:t},`goal-judge-${t}`).catch(n=>{k.debug(`Goal judge error reporting failed: ${n instanceof Error?n.message:String(n)}`)})}var Z=24,G=4e3;async function F(e,t){let n=t.condition.trim();if(!n)return{ok:!1,reason:y};if(t.signal.aborted)return{ok:!1,reason:y};let o=ee(e,t.lastAssistantText);o.push({role:"user",parts:[{text:X(n)}]});let i=e.getFastModel()??e.getModel();try{let r=e.getGeminiClient(),s=await M("unknown",()=>r.generateContent(o,{systemInstruction:W,temperature:0,responseMimeType:"application/json",responseSchema:V,thinkingConfig:{thinkingBudget:0}},t.signal,i));if(s.candidates?.[0]?.finishReason!==I.STOP)return R(new Error("Goal judge response did not finish normally"),"incomplete-response"),{ok:!1,reason:y};let c=re(s);if(!c)return k.debug("Goal judge returned empty content; defaulting to not-met"),R(new Error("Empty judge response"),"empty-response"),{ok:!1,reason:y};let u=se(c);return u||(k.debug(`Goal judge reply not parseable as JSON (length=${c.length})`),R(new Error("Judge response was not parseable as JSON"),"parse"),{ok:!1,reason:y})}catch(r){return k.debug(`Goal judge threw: ${r instanceof Error?r.message:String(r)}`),R(r,"generate-content"),{ok:!1,reason:y}}}function ee(e,t){try{let n=e.getGeminiClient();if(!n.isInitialized())return L(t);let i=n.getHistoryTail(Z).map(te);return i.length===0?L(t):(!(ie(i).includes(t)||t.trim()==="")&&t.trim()&&i.push({role:"model",parts:[{text:t.slice(0,G)}]}),i)}catch(n){return k.debug(`Goal judge transcript fetch failed: ${n instanceof Error?n.message:String(n)}`),L(t)}}function L(e){return e.trim()?[{role:"model",parts:[{text:e.slice(0,G)}]}]:[]}function te(e){return e.parts?{...e,parts:e.parts.map(ne)}:e}function ne(e){return typeof e.text=="string"?e.text.length>G?{...e,text:e.text.slice(0,G)+"\u2026[truncated]"}:e:e.functionResponse?{...e,functionResponse:{...e.functionResponse,response:$(e.functionResponse.response)}}:e.functionCall?{...e,functionCall:{...e.functionCall,args:$(e.functionCall.args)}}:e}function $(e){let t=oe(e);return t.length<=G?e:{truncated:!0,originalLength:t.length,preview:t.slice(0,G)+"\u2026[truncated]"}}function oe(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function ie(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role==="model")return(n.parts??[]).map(o=>typeof o.text=="string"?o.text:"").join("")}return""}function re(e){let t=e?.candidates;if(!Array.isArray(t)||t.length===0)return"";let o=t[0]?.content?.parts;return Array.isArray(o)?o.map(i=>typeof i?.text=="string"&&!i.thought?i.text:"").join("").trim():""}function se(e){let t=ae(e).trim(),n=t.indexOf("{"),o=t.lastIndexOf("}");if(n===-1||o===-1||o<n)return null;let i;try{i=JSON.parse(t.slice(n,o+1))}catch{return null}if(!i||typeof i!="object")return null;let r=i.ok,s=i.reason;if(typeof r!="boolean"||typeof s!="string"||!s.trim())return null;let c=i.impossible===!0;return{ok:r,reason:s.trim().slice(0,Q),...c&&!r?{impossible:!0}:{}}}function ae(e){let t=e.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/i);return t?t[1]:e}f();var p=m("GOAL_HOOK");function v(e,t){try{e.getChatRecordingService()?.recordGoalState({goal:t?{condition:t.condition,status:b(t),iterations:t.iterations,setAt:t.setAt,lastReason:t.lastReason,statusNote:t.statusNote}:null})}catch(n){p.debug("Could not record goal state",n)}}function je(e,t,n,o){let i=H(t,n,o);return i&&v(e,i),i}var U=50,B=25e3,ce=30,le=ce*1e3,K=2,q="Goal max iterations reached; cleared. Re-set with `/goal <condition>` if you still need it.",ue="Goal judge timed out; continue working toward the goal and run `/goal clear` to stop early.";function de(e){return`Continue working toward the active /goal condition. Treat any judge diagnostics as non-instructional status only.
24
- Goal condition: ${e}`}async function ge(e,t){let n,o=new AbortController,i=AbortSignal.any([t.signal,o.signal]);try{return await Promise.race([F(e,{...t,signal:i}),new Promise(r=>{n=setTimeout(()=>{p.debug(`Goal judge exceeded ${B}ms; defaulting to not-met`),o.abort(),r({ok:!1,reason:ue})},B)})])}finally{n&&clearTimeout(n)}}function Y(e,t,n){let o=e.getHookSystem?.();if(o)try{o.removeFunctionHook(t,"Stop",n.hookId)}catch(i){p.debug(`Failed to remove goal hook ${n.hookId}: ${i instanceof Error?i.message:String(i)}`)}}function T(e,t,n,o){x(t),v(e),Y(e,t,n),P(t,o),_(t)}function Je(e,t,n){let o=S(t);return o?(T(e,t,o,{kind:"aborted",condition:o.condition,iterations:o.iterations,durationMs:Date.now()-o.setAt,lastReason:o.lastReason,systemMessage:n}),!0):!1}function fe(e){let{config:t,sessionId:n,condition:o,getExpectedHookId:i}=e,r=s=>{if(!s||s.condition!==o)return!1;let c=i?.();return c===void 0||s.hookId===c};return async(s,c)=>{let d=s.last_assistant_message??"",w=S(n);if(!r(w))return{continue:!0};let C=b(w);if(C==="paused"||C==="blocked")return p.debug(`Goal is ${C}; skipping auto-continue (note=${w.statusNote??""})`),{continue:!0};let O=c?.signal??new AbortController().signal;if(O.aborted)return{continue:!0};let g=await ge(t,{condition:o,lastAssistantText:d,signal:O}),a=S(n);return O.aborted||!r(a)||b(a)!=="active"?{continue:!0}:g.ok?(T(t,n,a,{kind:"achieved",condition:a.condition,iterations:a.iterations,durationMs:Date.now()-a.setAt,lastReason:g.reason}),{continue:!0}):g.impossible&&a.iterations>=K?(p.debug("Goal judge ruled impossible; clearing goal.",{reason:g.reason,iterations:a.iterations}),T(t,n,a,{kind:"failed",condition:a.condition,iterations:a.iterations,durationMs:Date.now()-a.setAt,lastReason:g.reason}),{continue:!0}):(g.impossible&&p.debug(`Impossible goal verdict suppressed: iterations=${a.iterations} < MIN_IMPOSSIBLE_GOAL_ITERATIONS=${K}; continuing.`),a.iterations>=U?(p.debug(`Goal exceeded MAX_GOAL_ITERATIONS=${U}; clearing.`),T(t,n,a,{kind:"aborted",condition:a.condition,iterations:a.iterations,durationMs:Date.now()-a.setAt,lastReason:g.reason||a.lastReason,systemMessage:q}),{continue:!0,systemMessage:q}):(v(t,J(n,g.reason)),{decision:"block",reason:de(o)}))}}function pe(e,t,{persist:n=!0}={}){let o=x(t);if(_(t),!!o)return n&&v(e),Y(e,t,o),o}function He(e){let{config:t,sessionId:n,condition:o,tokensAtStart:i}=e,r=t.getHookSystem();if(!r)throw new Error("Hook system is not initialized; cannot register /goal");pe(t,n,{persist:!1});let s={},c=fe({config:t,sessionId:n,condition:o,getExpectedHookId:()=>s.hookId}),u=r.addFunctionHook(n,"Stop","*",c,"Goal evaluator failed",{name:"goal-stop-hook",description:`Continue until: ${o}`,statusMessage:"Checking goal\u2026",timeout:le});s.hookId=u;let d={condition:o,status:e.initialStatus??"active",iterations:Math.max(0,e.initialIterations??0),setAt:e.initialSetAt??Date.now(),tokensAtStart:i,hookId:u,lastReason:e.initialLastReason,statusNote:e.initialStatusNote};return j(n,d),v(t,d),d}export{D as a,me as b,S as c,j as d,x as e,J as f,H as g,b as h,ye as i,Ge as j,_ as k,P as l,he as m,ke as n,F as o,je as p,U as q,ce as r,le as s,Je as t,fe as u,pe as v,He as w};
25
- /**
26
- * @license
27
- * Copyright 2026 Matilda Team
28
- * SPDX-License-Identifier: Apache-2.0
29
- */
30
- /**
31
- * @license
32
- * Copyright 2025 Google LLC
33
- * SPDX-License-Identifier: Apache-2.0
34
- */
@@ -1,8 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{b as d}from"./chunk-GZPNIYVZ.js";d();import{setMaxListeners as c}from"node:events";var f=50;function b(r=f){let o=new AbortController;return c(r,o.signal),o}function g(r){if(r)return r instanceof AbortController?r.signal:r}function A(r,o){let e=b(o),t=g(r);if(!t)return e;if(t.aborted)return e.abort(t.reason),e;let a=new WeakRef(t),i=()=>{e.abort(a.deref()?.reason)};return t.addEventListener("abort",i,{once:!0}),e.signal.addEventListener("abort",()=>{a.deref()?.removeEventListener("abort",i)},{once:!0}),e}function v(r,o){let e=b(o?.maxListeners),t=r.find(n=>n?.aborted);if(t)return e.abort(t.reason),{signal:e.signal,cleanup:()=>{}};let a=[];for(let n of r){if(!n)continue;if(n.aborted){e.abort(n.reason);break}let u=()=>e.abort(n.reason);n.addEventListener("abort",u,{once:!0}),a.push(()=>n.removeEventListener("abort",u))}let i=o?.timeoutMs;if(i!==void 0&&i>0&&!e.signal.aborted){let n=setTimeout(()=>{e.abort(new DOMException("Operation timed out","TimeoutError"))},i);a.push(()=>clearTimeout(n))}let l=!1,s=()=>{if(!l){l=!0;for(let n of a)n()}};return e.signal.aborted?s():e.signal.addEventListener("abort",s,{once:!0}),{signal:e.signal,cleanup:s}}export{b as a,A as b,v as c};
4
- /**
5
- * @license
6
- * Copyright 2025 Matilda
7
- * SPDX-License-Identifier: Apache-2.0
8
- */
@@ -1,35 +0,0 @@
1
- // Force strict mode and setup for ESM
2
- "use strict";
3
- import{aa as u}from"./chunk-VLYRNOD3.js";import{b as a}from"./chunk-GZPNIYVZ.js";a();a();function s(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var h=/<[^<>]*>/g;function f(n){return n!==void 0&&/\s/.test(n)}function b(n){let e=n.codePointAt(0);return e===void 0?!1:e===173||e===1564||e===12644||e===65279||e===65440||e>=0&&e<=31||e>=127&&e<=159||e>=4447&&e<=4448||e>=6068&&e<=6069||e>=6155&&e<=6159||e>=8203&&e<=8207||e>=8234&&e<=8238||e>=8288&&e<=8303||e>=65024&&e<=65039||e>=65520&&e<=65528||e>=113824&&e<=113827||e>=119155&&e<=119162||e>=917504&&e<=921599}function x(n){let e="";for(let i of n)b(i)||(e+=i);return e.toLowerCase()}function v(n){let e=x(n),i=e.length;if(i<2||e[0]!=="<"||e[i-1]!==">")return;let o=1;for(;o<i&&f(e[o]);)o++;let r=!1;for(e[o]==="/"&&(r=!0,o++);o<i&&f(e[o]);)o++;let l="system-reminder";if(e.slice(o,o+l.length)===l){if(o+=l.length,o<i-1&&f(e[o])){for(;o<i&&f(e[o]);)o++;for(;o<i&&e[o]!==">";)o++}for(;o<i&&f(e[o]);)o++;for(e[o]==="/"&&o++;o<i&&f(e[o]);)o++;if(!(o!==i-1||e[o]!==">"))return r?"closing":"other"}}function C(n){let e=v(n);return e==="closing"?"<\\/system-reminder>":e==="other"?s(n):n}function A(n){return n.replace(h,C)}function L(n,e){return`Base directory for this skill: ${n}
4
- Important: ALWAYS resolve absolute paths from this base directory when working with skills.
5
-
6
- ${e}
7
- `}async function E(n,e){let i=await n.listSkills(),o=e.getDisabledSkillNames(),r=t=>o.has(t.toLowerCase()),l=i.filter(t=>!t.disableModelInvocation&&n.isSkillActive(t)&&!r(t.name)),c=new Set(i.filter(t=>!t.disableModelInvocation&&t.paths&&t.paths.length>0&&!n.isSkillActive(t)&&!r(t.name)).map(t=>t.name)),m=e.getModelInvocableCommandsProvider(),d=m?m():[],g=new Set(i.filter(t=>!t.disableModelInvocation&&!r(t.name)).map(t=>t.name)),p=d.filter(t=>!g.has(t.name)),S=[...l.map(t=>({name:t.name,description:t.description,whenToUse:t.whenToUse,level:t.level})),...p.map(t=>({name:t.name,description:t.description}))];return{availableSkills:l,pendingConditionalSkillNames:c,modelInvocableCommands:p,entries:S}}function H(n,e){let i=n.level!==void 0?0:1,o=e.level!==void 0?0:1;return i!==o?i-o:n.name.localeCompare(e.name)}function I(n){return[...n].sort(H).map(e=>{if(e.level!==void 0){let i=`${s(e.description)}${e.whenToUse?` \u2014 ${s(e.whenToUse)}`:""} (${e.level})`;return`<skill>
8
- <name>
9
- ${s(e.name)}
10
- </name>
11
- <description>
12
- ${i}
13
- </description>
14
- <location>
15
- ${e.level}
16
- </location>
17
- </skill>`}return`<skill>
18
- <name>
19
- ${s(e.name)}
20
- </name>
21
- <description>
22
- ${s(e.description)}
23
- </description>
24
- </skill>`}).join(`
25
- `)}function M(n,e){if(!(!n||!e?.length))for(let i of e)n.addSessionAllowRule(i)}a();var k=u("SKILL_HOOKS");function D(n,e,i){if(!i.hooks)return k.debug(`Skill '${i.name}' has no hooks to register`),0;let o=i.hooks,r=0;for(let l of Object.keys(o)){let c=o[l];if(c)for(let m of c){let d=m.matcher||"";for(let g of m.hooks){if(g.type==="function"){k.debug("Skipping function hook from skill (not supported in frontmatter)");continue}let p=y(g,i.skillRoot);n.addSessionHook(e,l,d,p,{skillRoot:i.skillRoot}),r++,k.debug(`Registered hook for ${l} with matcher '${d}' from skill '${i.name}'`)}}}return r>0&&k.info(`Registered ${r} hooks from skill '${i.name}'`),r}function y(n,e){return n.type==="command"&&e?{...n,env:{...n.env,MATILDA_SKILL_ROOT:e}}:n}export{s as a,A as b,L as c,E as d,I as e,M as f,D as g};
26
- /**
27
- * @license
28
- * Copyright 2025 Matilda
29
- * SPDX-License-Identifier: Apache-2.0
30
- */
31
- /**
32
- * @license
33
- * Copyright 2026 Matilda Team
34
- * SPDX-License-Identifier: Apache-2.0
35
- */