@falkenslab/agent-kit 0.14.0 → 0.16.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 (70) hide show
  1. package/README.md +110 -110
  2. package/assets/knowledge-plugin/.claude-plugin/plugin.json +1 -1
  3. package/assets/knowledge-plugin/commands/ingest.md +1 -1
  4. package/assets/knowledge-plugin/commands/lint.md +1 -1
  5. package/assets/knowledge-plugin/skills/knowledge-ingest/SKILL.md +13 -19
  6. package/assets/knowledge-plugin/skills/knowledge-lint/SKILL.md +18 -14
  7. package/assets/knowledge-plugin/skills/knowledge-query/SKILL.md +5 -5
  8. package/assets/knowledge-plugin-files/.claude-plugin/plugin.json +4 -0
  9. package/assets/knowledge-plugin-files/commands/ingest.md +7 -0
  10. package/assets/knowledge-plugin-files/commands/lint.md +5 -0
  11. package/assets/knowledge-plugin-files/commands/query.md +5 -0
  12. package/assets/knowledge-plugin-files/skills/knowledge-ingest/SKILL.md +46 -0
  13. package/assets/knowledge-plugin-files/skills/knowledge-lint/SKILL.md +26 -0
  14. package/assets/knowledge-plugin-files/skills/knowledge-query/SKILL.md +14 -0
  15. package/dist/core/agentSpec.d.ts +27 -2
  16. package/dist/core/extractText.d.ts +13 -0
  17. package/dist/core/extractText.js +147 -0
  18. package/dist/core/fileKnowledgeStore.d.ts +10 -0
  19. package/dist/core/fileKnowledgeStore.js +378 -0
  20. package/dist/core/hooks/fileScopeGate.d.ts +8 -0
  21. package/dist/core/hooks/fileScopeGate.js +20 -0
  22. package/dist/core/hooks/humanInput.d.ts +18 -0
  23. package/dist/core/hooks/humanInput.js +30 -2
  24. package/dist/core/hooks/planGate.js +14 -5
  25. package/dist/core/hooks/stepGate.js +6 -0
  26. package/dist/core/interaction.d.ts +20 -0
  27. package/dist/core/knowledge.d.ts +14 -4
  28. package/dist/core/knowledge.js +36 -6
  29. package/dist/core/knowledgeStore.d.ts +134 -0
  30. package/dist/core/knowledgeStore.js +84 -0
  31. package/dist/core/messages/de.js +65 -0
  32. package/dist/core/messages/en.d.ts +41 -0
  33. package/dist/core/messages/en.js +65 -0
  34. package/dist/core/messages/es.js +65 -0
  35. package/dist/core/messages/fr.js +65 -0
  36. package/dist/core/modeControl.d.ts +36 -0
  37. package/dist/core/modeControl.js +61 -0
  38. package/dist/core/session.d.ts +6 -31
  39. package/dist/core/session.js +76 -71
  40. package/dist/core/sources.d.ts +122 -0
  41. package/dist/core/sources.js +312 -0
  42. package/dist/core/todos.d.ts +23 -0
  43. package/dist/core/todos.js +33 -0
  44. package/dist/core/toolLabels.d.ts +1 -1
  45. package/dist/core/toolLabels.js +42 -2
  46. package/dist/core/tools/humanApproval.d.ts +9 -5
  47. package/dist/core/tools/humanApproval.js +39 -7
  48. package/dist/core/tools/knowledgeTools.d.ts +16 -0
  49. package/dist/core/tools/knowledgeTools.js +161 -0
  50. package/dist/core/tools/saveToSources.d.ts +27 -8
  51. package/dist/core/tools/saveToSources.js +203 -55
  52. package/dist/core/tools/time.d.ts +29 -0
  53. package/dist/core/tools/time.js +129 -0
  54. package/dist/index.d.ts +7 -4
  55. package/dist/index.js +4 -1
  56. package/dist/tui/chatTui.js +14 -1
  57. package/dist/tui/consoleRenderer.js +16 -2
  58. package/dist/tui/ink/SessionView.js +72 -17
  59. package/dist/tui/ink/inkInteraction.d.ts +4 -2
  60. package/dist/tui/ink/inkInteraction.js +20 -2
  61. package/dist/tui/ink/progressView.d.ts +5 -1
  62. package/dist/tui/ink/runChatInk.d.ts +16 -1
  63. package/dist/tui/ink/runChatInk.js +7 -0
  64. package/dist/tui/ink/sessionModel.d.ts +10 -3
  65. package/dist/tui/ink/sessionModel.js +26 -4
  66. package/dist/tui/ink/toolGroup.d.ts +23 -2
  67. package/dist/tui/ink/toolGroup.js +17 -4
  68. package/dist/tui/terminalInteraction.js +2 -0
  69. package/package.json +31 -1
  70. /package/assets/{knowledge-plugin → knowledge-plugin-files}/skills/knowledge-pages/SKILL.md +0 -0
@@ -53,6 +53,29 @@ export const en = {
53
53
  parametersLine: (parameters) => `Parameters: ${parameters}`,
54
54
  approvalTitle: "Human confirmation required before publishing",
55
55
  summaryLine: (summary) => `Summary: ${summary}`,
56
+ noAnswer: "(no answer)",
57
+ textAnswerHint: "type the answer",
58
+ textAnswerKeys: "Enter to send · Esc for no answer",
59
+ fileRequestTitle: "The agent asks for a file",
60
+ fileRequestQuestion: "Path of the file (drag it here), or Enter if you don't have it: ",
61
+ retireTitle: "Retire a source?",
62
+ retirePageTitle: "Retire a knowledge base page?",
63
+ choiceQuestion: (multiple) => (multiple ? "Numbers separated by commas, or your own answer: " : "Number, or your own answer: "),
64
+ otherOption: "Other (type your own answer)",
65
+ choiceKeys: (multiple) => (multiple ? "Space to mark · Enter to send" : "↑/↓ choose · Enter to send"),
66
+ questionTitle: "The agent asks",
67
+ planTitle: "The plan, for your approval",
68
+ runPlan: "Run it",
69
+ keepPlanning: "Keep planning",
70
+ cancelPlan: "Cancel",
71
+ planCommentQuestion: "What should change? (Enter to skip): ",
72
+ retireLines: (source, why, reason, replacedBy) => [
73
+ `Source: ${source}`,
74
+ why === "wrong" ? "Why: it's wrong; its summary will be retired" : "Why: it's replaced; its summary will be marked superseded",
75
+ `Reason: ${reason}`,
76
+ ...(replacedBy ? [`Replaced by: ${replacedBy}`] : []),
77
+ "It's moved to sources/.agent-kit/retired/, not deleted.",
78
+ ],
56
79
  toolPhrases: {
57
80
  Read: ["read {n} file", "read {n} files"],
58
81
  Write: ["wrote {n} file", "wrote {n} files"],
@@ -65,16 +88,40 @@ export const en = {
65
88
  Skill: ["used {n} skill", "used {n} skills"],
66
89
  Agent: ["ran {n} subagent", "ran {n} subagents"],
67
90
  Task: ["ran {n} subagent", "ran {n} subagents"],
91
+ mcp__time__current_time: ["checked the time", "checked the time {n} times"],
92
+ mcp__time__date_math: ["calculated dates", "calculated dates {n} times"],
93
+ mcp__sourceFiles__list_sources: ["listed the sources", "listed the sources {n} times"],
94
+ mcp__sourceFiles__extract_text: ["read {n} document", "read {n} documents"],
95
+ mcp__sourceFiles__save_to_sources: ["saved {n} source", "saved {n} sources"],
96
+ mcp__sourceFiles__download_to_sources: ["downloaded {n} source", "downloaded {n} sources"],
97
+ mcp__sourceFiles__request_file: ["asked for {n} file", "asked for {n} files"],
98
+ mcp__sourceFiles__retire_source: ["retired {n} source", "retired {n} sources"],
99
+ mcp__knowledge__knowledge_index: ["read the index", "read the index {n} times"],
100
+ mcp__knowledge__knowledge_search: ["searched the knowledge base", "searched the knowledge base {n} times"],
101
+ mcp__knowledge__knowledge_read: ["read {n} page", "read {n} pages"],
102
+ mcp__knowledge__knowledge_create: ["created {n} page", "created {n} pages"],
103
+ mcp__knowledge__knowledge_edit: ["edited {n} page", "edited {n} pages"],
104
+ mcp__knowledge__knowledge_rewrite: ["rewrote {n} page", "rewrote {n} pages"],
105
+ mcp__knowledge__knowledge_supersede: ["superseded {n} page", "superseded {n} pages"],
106
+ mcp__knowledge__knowledge_retire: ["retired {n} page", "retired {n} pages"],
107
+ mcp__knowledge__knowledge_log: ["updated the log", "updated the log {n} times"],
108
+ mcp__knowledge__knowledge_check: ["checked the knowledge base", "checked the knowledge base {n} times"],
109
+ mcp__approvals__ask_human: ["asked {n} question", "asked {n} questions"],
110
+ mcp__approvals__present_plan: ["presented the plan", "presented the plan {n} times"],
68
111
  },
69
112
  otherTools: ["used {n} tool", "used {n} tools"],
70
113
  noOutput: "(no output)",
71
114
  error: "error",
115
+ toolFailed: "Couldn't complete it",
72
116
  moreResultLines: (count) => `(+${count} ${plural(count, "line", "lines")})`,
73
117
  earlierCalls: (count) => `… ${count} earlier`,
118
+ moreTodos: (count) => `… ${count} more ${plural(count, "task", "tasks")}`,
74
119
  labels: {
75
120
  askingApproval: (summary) => `Asking for human approval: ${summary}`,
76
121
  waitingManual: "Waiting for a human to intervene manually",
77
122
  savingToSources: (destination) => `Saving a file to sources/${destination}`,
123
+ checkingTime: "Checking the date and time",
124
+ calculatingDates: "Calculating dates",
78
125
  reading: (file) => `Reading ${file}`,
79
126
  writing: (file) => `Writing to ${file}`,
80
127
  editing: (file) => `Editing ${file}`,
@@ -90,6 +137,24 @@ export const en = {
90
137
  searchingWeb: (query) => `Searching the web for "${query}"`,
91
138
  applyingSkill: (skill) => `Applying the "${skill}" skill`,
92
139
  aSkill: "a skill",
140
+ updatingTasks: "Updating the task list",
141
+ listingSources: "Listing the sources",
142
+ extractingText: (source) => `Reading ${source}`,
143
+ downloading: (url) => `Downloading ${url} to the sources`,
144
+ requestingFile: (description) => `Asking for a file: ${description}`,
145
+ retiringSource: (source) => `Retiring the source ${source}`,
146
+ knowledgeIndex: "Reading the knowledge base's index",
147
+ knowledgeSearch: (query) => `Searching the knowledge base for "${query}"`,
148
+ knowledgeRead: (page) => `Reading ${page}`,
149
+ knowledgeCreate: (page) => `Creating ${page}`,
150
+ knowledgeEdit: (page) => `Editing ${page}`,
151
+ knowledgeRewrite: (page) => `Rewriting ${page}`,
152
+ knowledgeSupersede: (page) => `Marking ${page} superseded`,
153
+ knowledgeRetire: (page) => `Retiring ${page}`,
154
+ knowledgeLog: "Updating the knowledge base's log",
155
+ knowledgeCheck: "Checking the knowledge base",
156
+ askingHuman: (question) => `Asking: ${question}`,
157
+ presentingPlan: "Presenting the plan",
93
158
  },
94
159
  auth: {
95
160
  noToken: "No Claude authentication token was found",
@@ -54,6 +54,29 @@ export const es = {
54
54
  parametersLine: (parameters) => `Parámetros: ${parameters}`,
55
55
  approvalTitle: "Hace falta confirmación humana antes de publicar",
56
56
  summaryLine: (summary) => `Resumen: ${summary}`,
57
+ noAnswer: "(sin respuesta)",
58
+ textAnswerHint: "escribe la respuesta",
59
+ textAnswerKeys: "Enter para enviar · Esc para no responder",
60
+ fileRequestTitle: "El agente pide un fichero",
61
+ fileRequestQuestion: "Ruta del fichero (arrástralo aquí), o Enter si no lo tienes: ",
62
+ retireTitle: "¿Retirar una fuente?",
63
+ retirePageTitle: "¿Retirar una página de la base de conocimiento?",
64
+ choiceQuestion: (multiple) => (multiple ? "Números separados por comas, o tu propia respuesta: " : "Número, o tu propia respuesta: "),
65
+ otherOption: "Otra (escribe tu respuesta)",
66
+ choiceKeys: (multiple) => (multiple ? "Espacio para marcar · Enter para enviar" : "↑/↓ elegir · Enter para enviar"),
67
+ questionTitle: "El agente pregunta",
68
+ planTitle: "El plan, para tu aprobación",
69
+ runPlan: "Ejecutarlo",
70
+ keepPlanning: "Seguir planificando",
71
+ cancelPlan: "Cancelar",
72
+ planCommentQuestion: "¿Qué debería cambiar? (Enter para omitir): ",
73
+ retireLines: (source, why, reason, replacedBy) => [
74
+ `Fuente: ${source}`,
75
+ why === "wrong" ? "Motivo: es errónea; su resumen se retirará" : "Motivo: se sustituye; su resumen se marcará como sustituido",
76
+ `Razón: ${reason}`,
77
+ ...(replacedBy ? [`Sustituida por: ${replacedBy}`] : []),
78
+ "Se mueve a sources/.agent-kit/retired/, no se borra.",
79
+ ],
57
80
  toolPhrases: {
58
81
  Read: ["leyó {n} fichero", "leyó {n} ficheros"],
59
82
  Write: ["escribió {n} fichero", "escribió {n} ficheros"],
@@ -66,16 +89,40 @@ export const es = {
66
89
  Skill: ["usó {n} skill", "usó {n} skills"],
67
90
  Agent: ["lanzó {n} subagente", "lanzó {n} subagentes"],
68
91
  Task: ["lanzó {n} subagente", "lanzó {n} subagentes"],
92
+ mcp__time__current_time: ["consultó la hora", "consultó la hora {n} veces"],
93
+ mcp__time__date_math: ["calculó fechas", "calculó fechas {n} veces"],
94
+ mcp__sourceFiles__list_sources: ["revisó las fuentes", "revisó las fuentes {n} veces"],
95
+ mcp__sourceFiles__extract_text: ["leyó {n} documento", "leyó {n} documentos"],
96
+ mcp__sourceFiles__save_to_sources: ["guardó {n} fuente", "guardó {n} fuentes"],
97
+ mcp__sourceFiles__download_to_sources: ["descargó {n} fuente", "descargó {n} fuentes"],
98
+ mcp__sourceFiles__request_file: ["pidió {n} fichero", "pidió {n} ficheros"],
99
+ mcp__sourceFiles__retire_source: ["retiró {n} fuente", "retiró {n} fuentes"],
100
+ mcp__knowledge__knowledge_index: ["leyó el índice", "leyó el índice {n} veces"],
101
+ mcp__knowledge__knowledge_search: ["buscó en la base de conocimiento", "buscó en la base de conocimiento {n} veces"],
102
+ mcp__knowledge__knowledge_read: ["leyó {n} página", "leyó {n} páginas"],
103
+ mcp__knowledge__knowledge_create: ["creó {n} página", "creó {n} páginas"],
104
+ mcp__knowledge__knowledge_edit: ["editó {n} página", "editó {n} páginas"],
105
+ mcp__knowledge__knowledge_rewrite: ["reescribió {n} página", "reescribió {n} páginas"],
106
+ mcp__knowledge__knowledge_supersede: ["sustituyó {n} página", "sustituyó {n} páginas"],
107
+ mcp__knowledge__knowledge_retire: ["retiró {n} página", "retiró {n} páginas"],
108
+ mcp__knowledge__knowledge_log: ["actualizó el registro", "actualizó el registro {n} veces"],
109
+ mcp__knowledge__knowledge_check: ["revisó la base de conocimiento", "revisó la base de conocimiento {n} veces"],
110
+ mcp__approvals__ask_human: ["hizo {n} pregunta", "hizo {n} preguntas"],
111
+ mcp__approvals__present_plan: ["presentó el plan", "presentó el plan {n} veces"],
69
112
  },
70
113
  otherTools: ["usó {n} herramienta", "usó {n} herramientas"],
71
114
  noOutput: "(sin salida)",
72
115
  error: "error",
116
+ toolFailed: "No se pudo completar",
73
117
  moreResultLines: (count) => `(+${count} ${plural(count, "línea", "líneas")})`,
74
118
  earlierCalls: (count) => `… ${count} ${plural(count, "anterior", "anteriores")}`,
119
+ moreTodos: (count) => `… ${count} ${plural(count, "tarea", "tareas")} más`,
75
120
  labels: {
76
121
  askingApproval: (summary) => `Pidiendo aprobación humana: ${summary}`,
77
122
  waitingManual: "Esperando a que una persona intervenga a mano",
78
123
  savingToSources: (destination) => `Guardando un fichero en sources/${destination}`,
124
+ checkingTime: "Consultando la fecha y la hora",
125
+ calculatingDates: "Calculando fechas",
79
126
  reading: (file) => `Leyendo ${file}`,
80
127
  writing: (file) => `Escribiendo en ${file}`,
81
128
  editing: (file) => `Editando ${file}`,
@@ -91,6 +138,24 @@ export const es = {
91
138
  searchingWeb: (query) => `Buscando en la web "${query}"`,
92
139
  applyingSkill: (skill) => `Aplicando la skill "${skill}"`,
93
140
  aSkill: "una skill",
141
+ updatingTasks: "Actualizando la lista de tareas",
142
+ listingSources: "Revisando las fuentes",
143
+ extractingText: (source) => `Leyendo ${source}`,
144
+ downloading: (url) => `Descargando ${url} a las fuentes`,
145
+ requestingFile: (description) => `Pidiendo un fichero: ${description}`,
146
+ retiringSource: (source) => `Retirando la fuente ${source}`,
147
+ knowledgeIndex: "Leyendo el índice de la base de conocimiento",
148
+ knowledgeSearch: (query) => `Buscando "${query}" en la base de conocimiento`,
149
+ knowledgeRead: (page) => `Leyendo ${page}`,
150
+ knowledgeCreate: (page) => `Creando ${page}`,
151
+ knowledgeEdit: (page) => `Editando ${page}`,
152
+ knowledgeRewrite: (page) => `Reescribiendo ${page}`,
153
+ knowledgeSupersede: (page) => `Marcando ${page} como sustituida`,
154
+ knowledgeRetire: (page) => `Retirando ${page}`,
155
+ knowledgeLog: "Actualizando el registro de la base de conocimiento",
156
+ knowledgeCheck: "Revisando la base de conocimiento",
157
+ askingHuman: (question) => `Preguntando: ${question}`,
158
+ presentingPlan: "Presentando el plan",
94
159
  },
95
160
  auth: {
96
161
  noToken: "No se ha encontrado ningún token de autenticación de Claude",
@@ -54,6 +54,29 @@ export const fr = {
54
54
  parametersLine: (parameters) => `Paramètres : ${parameters}`,
55
55
  approvalTitle: "Confirmation humaine requise avant de publier",
56
56
  summaryLine: (summary) => `Résumé : ${summary}`,
57
+ noAnswer: "(pas de réponse)",
58
+ textAnswerHint: "tapez la réponse",
59
+ textAnswerKeys: "Entrée pour envoyer · Échap pour ne pas répondre",
60
+ fileRequestTitle: "L'agent demande un fichier",
61
+ fileRequestQuestion: "Chemin du fichier (glissez-le ici), ou Entrée si vous ne l'avez pas : ",
62
+ retireTitle: "Retirer une source ?",
63
+ retirePageTitle: "Retirer une page de la base de connaissances ?",
64
+ choiceQuestion: (multiple) => (multiple ? "Numéros séparés par des virgules, ou votre propre réponse : " : "Numéro, ou votre propre réponse : "),
65
+ otherOption: "Autre (tapez votre réponse)",
66
+ choiceKeys: (multiple) => (multiple ? "Espace pour cocher · Entrée pour envoyer" : "↑/↓ choisir · Entrée pour envoyer"),
67
+ questionTitle: "L'agent demande",
68
+ planTitle: "Le plan, pour votre approbation",
69
+ runPlan: "L'exécuter",
70
+ keepPlanning: "Continuer à planifier",
71
+ cancelPlan: "Annuler",
72
+ planCommentQuestion: "Que faut-il changer ? (Entrée pour passer) : ",
73
+ retireLines: (source, why, reason, replacedBy) => [
74
+ `Source : ${source}`,
75
+ why === "wrong" ? "Motif : elle est erronée ; son résumé sera retiré" : "Motif : elle est remplacée ; son résumé sera marqué comme remplacé",
76
+ `Raison : ${reason}`,
77
+ ...(replacedBy ? [`Remplacée par : ${replacedBy}`] : []),
78
+ "Elle est déplacée dans sources/.agent-kit/retired/, pas supprimée.",
79
+ ],
57
80
  toolPhrases: {
58
81
  Read: ["a lu {n} fichier", "a lu {n} fichiers"],
59
82
  Write: ["a écrit {n} fichier", "a écrit {n} fichiers"],
@@ -66,16 +89,40 @@ export const fr = {
66
89
  Skill: ["a utilisé {n} skill", "a utilisé {n} skills"],
67
90
  Agent: ["a lancé {n} sous-agent", "a lancé {n} sous-agents"],
68
91
  Task: ["a lancé {n} sous-agent", "a lancé {n} sous-agents"],
92
+ mcp__time__current_time: ["a consulté l'heure", "a consulté l'heure {n} fois"],
93
+ mcp__time__date_math: ["a calculé des dates", "a calculé des dates {n} fois"],
94
+ mcp__sourceFiles__list_sources: ["a examiné les sources", "a examiné les sources {n} fois"],
95
+ mcp__sourceFiles__extract_text: ["a lu {n} document", "a lu {n} documents"],
96
+ mcp__sourceFiles__save_to_sources: ["a enregistré {n} source", "a enregistré {n} sources"],
97
+ mcp__sourceFiles__download_to_sources: ["a téléchargé {n} source", "a téléchargé {n} sources"],
98
+ mcp__sourceFiles__request_file: ["a demandé {n} fichier", "a demandé {n} fichiers"],
99
+ mcp__sourceFiles__retire_source: ["a retiré {n} source", "a retiré {n} sources"],
100
+ mcp__knowledge__knowledge_index: ["a lu l'index", "a lu l'index {n} fois"],
101
+ mcp__knowledge__knowledge_search: ["a cherché dans la base", "a cherché dans la base {n} fois"],
102
+ mcp__knowledge__knowledge_read: ["a lu {n} page", "a lu {n} pages"],
103
+ mcp__knowledge__knowledge_create: ["a créé {n} page", "a créé {n} pages"],
104
+ mcp__knowledge__knowledge_edit: ["a modifié {n} page", "a modifié {n} pages"],
105
+ mcp__knowledge__knowledge_rewrite: ["a réécrit {n} page", "a réécrit {n} pages"],
106
+ mcp__knowledge__knowledge_supersede: ["a remplacé {n} page", "a remplacé {n} pages"],
107
+ mcp__knowledge__knowledge_retire: ["a retiré {n} page", "a retiré {n} pages"],
108
+ mcp__knowledge__knowledge_log: ["a mis à jour le journal", "a mis à jour le journal {n} fois"],
109
+ mcp__knowledge__knowledge_check: ["a vérifié la base", "a vérifié la base {n} fois"],
110
+ mcp__approvals__ask_human: ["a posé {n} question", "a posé {n} questions"],
111
+ mcp__approvals__present_plan: ["a présenté le plan", "a présenté le plan {n} fois"],
69
112
  },
70
113
  otherTools: ["a utilisé {n} outil", "a utilisé {n} outils"],
71
114
  noOutput: "(aucune sortie)",
72
115
  error: "erreur",
116
+ toolFailed: "Impossible de terminer",
73
117
  moreResultLines: (count) => `(+${count} ${plural(count, "ligne", "lignes")})`,
74
118
  earlierCalls: (count) => `… ${count} ${plural(count, "précédent", "précédents")}`,
119
+ moreTodos: (count) => `… ${count} ${plural(count, "tâche", "tâches")} de plus`,
75
120
  labels: {
76
121
  askingApproval: (summary) => `Demande d'approbation humaine : ${summary}`,
77
122
  waitingManual: "En attente d'une intervention manuelle",
78
123
  savingToSources: (destination) => `Enregistrement d'un fichier dans sources/${destination}`,
124
+ checkingTime: "Consultation de la date et de l'heure",
125
+ calculatingDates: "Calcul de dates",
79
126
  reading: (file) => `Lecture de ${file}`,
80
127
  writing: (file) => `Écriture dans ${file}`,
81
128
  editing: (file) => `Modification de ${file}`,
@@ -91,6 +138,24 @@ export const fr = {
91
138
  searchingWeb: (query) => `Recherche sur le web de "${query}"`,
92
139
  applyingSkill: (skill) => `Application de la skill "${skill}"`,
93
140
  aSkill: "une skill",
141
+ updatingTasks: "Mise à jour de la liste des tâches",
142
+ listingSources: "Examen des sources",
143
+ extractingText: (source) => `Lecture de ${source}`,
144
+ downloading: (url) => `Téléchargement de ${url} dans les sources`,
145
+ requestingFile: (description) => `Demande d'un fichier : ${description}`,
146
+ retiringSource: (source) => `Retrait de la source ${source}`,
147
+ knowledgeIndex: "Lecture de l'index de la base de connaissances",
148
+ knowledgeSearch: (query) => `Recherche de "${query}" dans la base de connaissances`,
149
+ knowledgeRead: (page) => `Lecture de ${page}`,
150
+ knowledgeCreate: (page) => `Création de ${page}`,
151
+ knowledgeEdit: (page) => `Modification de ${page}`,
152
+ knowledgeRewrite: (page) => `Réécriture de ${page}`,
153
+ knowledgeSupersede: (page) => `${page} marquée comme remplacée`,
154
+ knowledgeRetire: (page) => `Retrait de ${page}`,
155
+ knowledgeLog: "Mise à jour du journal de la base de connaissances",
156
+ knowledgeCheck: "Vérification de la base de connaissances",
157
+ askingHuman: (question) => `Question : ${question}`,
158
+ presentingPlan: "Présentation du plan",
94
159
  },
95
160
  auth: {
96
161
  noToken: "Aucun jeton d'authentification Claude n'a été trouvé",
@@ -0,0 +1,36 @@
1
+ import type { Mode } from "./agentSpec.js";
2
+ /**
3
+ * The supervision mode of a running session. "guided", "interactive" and "plan" switch into
4
+ * one another: they share the same tools (the approval tool), and the step gate and the plan
5
+ * gate are registered in all three, deciding only in their own mode. "autonomous" has no
6
+ * approval tool at all, and a tool can't appear or vanish mid-session, so a session that
7
+ * starts autonomous stays autonomous, and one that doesn't can't become autonomous. The
8
+ * system prompt keeps the mode it was built with, so entering or leaving plan mode is told
9
+ * to the model with the next message instead (`takeNotice()`).
10
+ */
11
+ export interface ModeControl {
12
+ readonly mode: Mode;
13
+ /** The modes this session can be in, in Shift+Tab's order; fewer than two means it can't switch. */
14
+ readonly switchable: readonly Mode[];
15
+ /** Switches to `next` if this session allows it; returns whether it did. */
16
+ set(next: Mode): boolean;
17
+ /**
18
+ * The note telling the model it entered or left plan mode, once per change it hasn't been
19
+ * told about yet; `undefined` otherwise. `createInputQueue({ modeControl })` puts it before
20
+ * the next message; a caller with its own queue prepends it itself.
21
+ */
22
+ takeNotice?(): string | undefined;
23
+ /**
24
+ * Calls `listener` with the new mode whenever it changes (Shift+Tab, `/plan`, or the agent
25
+ * leaving plan mode through `present_plan`), so a UI can show it; returns the unsubscribe.
26
+ */
27
+ subscribe?(listener: (mode: Mode) => void): () => void;
28
+ }
29
+ /** A `ModeControl` starting at `initial` (`buildSessionOptions()` returns one for its session). */
30
+ export declare function createModeControl(initial: Mode): ModeControl;
31
+ /**
32
+ * What the chats' `/plan` does: switches `control` into plan mode, or, when it's already
33
+ * there, back to the mode it was entered from ("guided" if it started in plan mode). Returns
34
+ * the new mode, or `null` when this session can't be in plan mode (an autonomous one).
35
+ */
36
+ export declare function togglePlanMode(control: ModeControl): Mode | null;
@@ -0,0 +1,61 @@
1
+ /** A `ModeControl` starting at `initial` (`buildSessionOptions()` returns one for its session). */
2
+ export function createModeControl(initial) {
3
+ let current = initial;
4
+ // The mode the model was last told about: a session starting in plan mode tells it with
5
+ // the first message, since the system prompt doesn't say.
6
+ let told = initial === "plan" ? undefined : initial;
7
+ const switchable = initial === "autonomous" ? ["autonomous"] : ["guided", "interactive", "plan"];
8
+ const listeners = new Set();
9
+ return {
10
+ get mode() {
11
+ return current;
12
+ },
13
+ switchable,
14
+ set(next) {
15
+ if (!switchable.includes(next))
16
+ return false;
17
+ const changed = next !== current;
18
+ current = next;
19
+ if (changed)
20
+ for (const listener of listeners)
21
+ listener(next);
22
+ return true;
23
+ },
24
+ takeNotice() {
25
+ const before = told;
26
+ told = current;
27
+ if (current === "plan" && before !== "plan")
28
+ return PLAN_MODE_ENTERED;
29
+ if (current !== "plan" && before === "plan")
30
+ return PLAN_MODE_LEFT;
31
+ return undefined;
32
+ },
33
+ subscribe(listener) {
34
+ listeners.add(listener);
35
+ return () => listeners.delete(listener);
36
+ },
37
+ };
38
+ }
39
+ // The mode each session was in when `/plan` took it into plan mode, to go back to.
40
+ const modeBeforePlan = new WeakMap();
41
+ /**
42
+ * What the chats' `/plan` does: switches `control` into plan mode, or, when it's already
43
+ * there, back to the mode it was entered from ("guided" if it started in plan mode). Returns
44
+ * the new mode, or `null` when this session can't be in plan mode (an autonomous one).
45
+ */
46
+ export function togglePlanMode(control) {
47
+ if (!control.switchable.includes("plan"))
48
+ return null;
49
+ if (control.mode === "plan") {
50
+ const back = modeBeforePlan.get(control) ?? "guided";
51
+ control.set(back);
52
+ return back;
53
+ }
54
+ modeBeforePlan.set(control, control.mode);
55
+ control.set("plan");
56
+ return "plan";
57
+ }
58
+ // What the model reads on a plan-mode switch, in English like the rest of what it reads
59
+ // (ADR-019); tagged so a resumed conversation doesn't show it as the human's words (runs.ts).
60
+ const PLAN_MODE_ENTERED = "<system-reminder>The user switched to plan mode. Only read, research and plan: nothing can be changed (files, tools that modify something) until they switch out of it. When the plan is ready, present it and wait for them.</system-reminder>";
61
+ const PLAN_MODE_LEFT = "<system-reminder>The user left plan mode: you can carry out the plan now.</system-reminder>";
@@ -1,6 +1,8 @@
1
1
  import type { Options, SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
2
2
  import { type TranscriptLogger } from "./hooks/transcriptLogger.js";
3
- import type { AgentSpec, BaseSessionConfig, Mode } from "./agentSpec.js";
3
+ import { type ModeControl } from "./modeControl.js";
4
+ import type { KnowledgeStore } from "./knowledgeStore.js";
5
+ import type { AgentSpec, BaseSessionConfig } from "./agentSpec.js";
4
6
  import { type Language } from "./language.js";
5
7
  import { type RunFolder } from "./runs.js";
6
8
  /**
@@ -31,37 +33,10 @@ export declare function buildSessionOptions<TConfig extends BaseSessionConfig>(c
31
33
  transcriptPath: string;
32
34
  modeControl: ModeControl;
33
35
  language: Language;
36
+ /** The knowledge base's store, when the agent reaches it through the `knowledge_*` tools. */
37
+ knowledgeStore?: KnowledgeStore;
34
38
  }>;
35
- /**
36
- * The supervision mode of a running session. "guided", "interactive" and "plan" switch into
37
- * one another: they share the same tools (the approval tool), and the step gate and the plan
38
- * gate are registered in all three, deciding only in their own mode. "autonomous" has no
39
- * approval tool at all, and a tool can't appear or vanish mid-session, so a session that
40
- * starts autonomous stays autonomous, and one that doesn't can't become autonomous. The
41
- * system prompt keeps the mode it was built with, so entering or leaving plan mode is told
42
- * to the model with the next message instead (`takeNotice()`).
43
- */
44
- export interface ModeControl {
45
- readonly mode: Mode;
46
- /** The modes this session can be in, in Shift+Tab's order; fewer than two means it can't switch. */
47
- readonly switchable: readonly Mode[];
48
- /** Switches to `next` if this session allows it; returns whether it did. */
49
- set(next: Mode): boolean;
50
- /**
51
- * The note telling the model it entered or left plan mode, once per change it hasn't been
52
- * told about yet; `undefined` otherwise. `createInputQueue({ modeControl })` puts it before
53
- * the next message; a caller with its own queue prepends it itself.
54
- */
55
- takeNotice?(): string | undefined;
56
- }
57
- /** A `ModeControl` starting at `initial` (`buildSessionOptions()` returns one for its session). */
58
- export declare function createModeControl(initial: Mode): ModeControl;
59
- /**
60
- * What the chats' `/plan` does: switches `control` into plan mode, or, when it's already
61
- * there, back to the mode it was entered from ("guided" if it started in plan mode). Returns
62
- * the new mode, or `null` when this session can't be in plan mode (an autonomous one).
63
- */
64
- export declare function togglePlanMode(control: ModeControl): Mode | null;
39
+ export { createModeControl, togglePlanMode, type ModeControl } from "./modeControl.js";
65
40
  /**
66
41
  * User message queue backed by a single long-lived generator, for any multi-turn
67
42
  * (chat-shaped) caller of `query()`.