Skip to content

Commit e6249da

Browse files
use refs for config instead of functor
1 parent 9f4a075 commit e6249da

28 files changed

+1203
-1251
lines changed
404 KB
Binary file not shown.

.serena/project.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# language of the project (csharp, python, rust, java, typescript, go, cpp, or ruby)
2+
# * For C, use cpp
3+
# * For JavaScript, use typescript
4+
# Special requirements:
5+
# * csharp: Requires the presence of a .sln file in the project folder.
6+
language: ocaml
7+
8+
# whether to use the project's gitignore file to ignore files
9+
# Added on 2025-04-07
10+
ignore_all_files_in_gitignore: true
11+
# list of additional paths to ignore
12+
# same syntax as gitignore, so you can use * and **
13+
# Was previously called `ignored_dirs`, please update your config if you are using that.
14+
# Added (renamed) on 2025-04-07
15+
ignored_paths: []
16+
17+
# whether the project is in read-only mode
18+
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
19+
# Added on 2025-04-18
20+
read_only: false
21+
22+
23+
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
24+
# Below is the complete list of tools for convenience.
25+
# To make sure you have the latest list of tools, and to view their descriptions,
26+
# execute `uv run scripts/print_tool_overview.py`.
27+
#
28+
# * `activate_project`: Activates a project by name.
29+
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
30+
# * `create_text_file`: Creates/overwrites a file in the project directory.
31+
# * `delete_lines`: Deletes a range of lines within a file.
32+
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
33+
# * `execute_shell_command`: Executes a shell command.
34+
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
35+
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
36+
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
37+
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
38+
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
39+
# * `initial_instructions`: Gets the initial instructions for the current project.
40+
# Should only be used in settings where the system prompt cannot be set,
41+
# e.g. in clients you have no control over, like Claude Desktop.
42+
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
43+
# * `insert_at_line`: Inserts content at a given line in a file.
44+
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
45+
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
46+
# * `list_memories`: Lists memories in Serena's project-specific memory store.
47+
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
48+
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
49+
# * `read_file`: Reads a file within the project directory.
50+
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
51+
# * `remove_project`: Removes a project from the Serena configuration.
52+
# * `replace_lines`: Replaces a range of lines within a file with new content.
53+
# * `replace_symbol_body`: Replaces the full definition of a symbol.
54+
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
55+
# * `search_for_pattern`: Performs a search for a pattern in the project.
56+
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
57+
# * `switch_modes`: Activates modes by providing a list of their names
58+
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
59+
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
60+
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
61+
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
62+
excluded_tools: []
63+
64+
# initial prompt for the project. It will always be given to the LLM upon activating the project
65+
# (contrary to the memories, which are loaded on demand).
66+
initial_prompt: ""
67+
68+
project_name: "passage"

bin/comment_input.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
open Passage.Make (Passage.Default_config)
1+
open Passage
22
open Validation
33
open Prompt
44

bin/main.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,13 @@ module Get = struct
294294
| Some m -> Qrc_fmt.pp_utf_8_half ~invert:true Format.std_formatter m
295295

296296
let save_to_clipboard_exn ~secret =
297-
let read_clipboard () = Shell.xclip_read_clipboard Config.x_selection in
297+
let read_clipboard () = Shell.xclip_read_clipboard !Config.x_selection in
298298
let copy_to_clipboard s =
299-
try Shell.xclip_copy_to_clipboard s ~x_selection:Config.x_selection
299+
try Shell.xclip_copy_to_clipboard s ~x_selection:!Config.x_selection
300300
with exn -> Exn.fail ~exn "E: could not copy data to the clipboard"
301301
in
302302
let restore_clipboard original_content =
303-
let () = Unix.sleep Config.clip_time in
303+
let () = Unix.sleep !Config.clip_time in
304304
let current_content = read_clipboard () in
305305
(* It might be nice to programatically check to see if klipper exists,
306306
as well as checking for other common clipboard managers. But for now,
@@ -338,7 +338,7 @@ module Get = struct
338338
match save_to_clipboard_exn ~secret with
339339
| `Child -> ()
340340
| `Forked _ ->
341-
Devkit.eprintfn "Copied %s to clipboard. Will clear in %d seconds." (show_name secret_name) Config.clip_time
341+
Devkit.eprintfn "Copied %s to clipboard. Will clear in %d seconds." (show_name secret_name) !Config.clip_time
342342
with exn -> Shell.die ~exn "E: failed to save to clipboard! Check if you have an X server running."
343343
end
344344

@@ -688,11 +688,11 @@ module Rm = struct
688688
let rm_result ~path ~force =
689689
let is_directory = Path.is_directory (Path.abs path) in
690690
let string_path = show_path path in
691-
if force then Commands.Storage.Secrets.rm ~is_directory path
691+
if force then Storage.Secrets.rm ~is_directory path
692692
else (
693693
match yesno_tty_check (sprintf "Are you sure you want to delete %s?" string_path) with
694-
| NoTTY | TTY true -> Commands.Storage.Secrets.rm ~is_directory path
695-
| TTY false -> Commands.Storage.Secrets.Skipped)
694+
| NoTTY | TTY true -> Storage.Secrets.rm ~is_directory path
695+
| TTY false -> Storage.Secrets.Skipped)
696696
in
697697
try Commands.Rm.rm_secrets ~verbose ~paths ~force ~f:rm_result with Failure s -> Shell.die "%s" s
698698

bin/prompt.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(** User prompt and input utilities *)
2-
open Passage.Make (Passage.Default_config)
2+
open Passage
33

44
open Util.Show
55

bin/retry.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(** Retry utilities for operations that may fail *)
2-
open Passage.Make (Passage.Default_config)
2+
open Passage
33

44
(** Generic retry function for any operation *)
55
let rec retry_with_prompt ~operation ~error_message ~prompt_message =

lib/age.ml

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,34 @@
1-
module StringFresh = Devkit.Fresh (String) ()
1+
module Key = struct
2+
include Devkit.Fresh (String) ()
23

3-
module With_config (Config : Types.Config) = struct
4-
module Shell = Shell.With_config (Config)
5-
module Key = struct
6-
include StringFresh
7-
8-
let from_identity_file f = inject @@ Shell.age_get_recipient_key_from_identity_file f
9-
end
10-
11-
type recipient = {
12-
name : string;
13-
keys : Key.t list;
14-
}
4+
let from_identity_file f = inject @@ Shell.age_get_recipient_key_from_identity_file f
5+
end
156

16-
let ext = "age"
7+
type recipient = {
8+
name : string;
9+
keys : Key.t list;
10+
}
1711

18-
let recipient_compare a b = String.compare a.name b.name
12+
let ext = "age"
1913

20-
let is_group_recipient r = String.starts_with ~prefix:"@" r
14+
let recipient_compare a b = String.compare a.name b.name
2115

22-
let get_recipients_keys recipients = List.concat_map (fun r -> r.keys) recipients
16+
let is_group_recipient r = String.starts_with ~prefix:"@" r
2317

24-
let decrypt_string ~identity_file ~silence_stderr ciphertext =
25-
let stdin = Bos.OS.Cmd.in_string ciphertext in
26-
let stdout = Bos.OS.Cmd.out_string ~trim:false in
27-
let raw_command = Printf.sprintf "age --decrypt --identity %s" (Filename.quote identity_file) in
28-
Shell.run_cmd ~stdin ~stdout ~silence_stderr raw_command
18+
let get_recipients_keys recipients = List.concat_map (fun r -> r.keys) recipients
2919

30-
let encrypt_string ~recipients plaintext =
31-
let stdin = Bos.OS.Cmd.in_string plaintext in
32-
let stdout = Bos.OS.Cmd.out_string in
33-
let recipient_keys = get_recipients_keys recipients |> Key.project_list in
34-
let recipients_arg =
35-
List.map (fun key -> Printf.sprintf "--recipient %s" (Filename.quote key)) recipient_keys |> String.concat " "
36-
in
37-
let raw_command = Printf.sprintf "age --encrypt --armor %s" recipients_arg in
38-
Shell.run_cmd ~stdin ~stdout raw_command
39-
end
20+
let decrypt_string ~identity_file ~silence_stderr ciphertext =
21+
let stdin = Bos.OS.Cmd.in_string ciphertext in
22+
let stdout = Bos.OS.Cmd.out_string ~trim:false in
23+
let raw_command = Printf.sprintf "age --decrypt --identity %s" (Filename.quote identity_file) in
24+
Shell.run_cmd ~stdin ~stdout ~silence_stderr raw_command
4025

41-
include With_config (Default_config)
26+
let encrypt_string ~recipients plaintext =
27+
let stdin = Bos.OS.Cmd.in_string plaintext in
28+
let stdout = Bos.OS.Cmd.out_string in
29+
let recipient_keys = get_recipients_keys recipients |> Key.project_list in
30+
let recipients_arg =
31+
List.map (fun key -> Printf.sprintf "--recipient %s" (Filename.quote key)) recipient_keys |> String.concat " "
32+
in
33+
let raw_command = Printf.sprintf "age --encrypt --armor %s" recipients_arg in
34+
Shell.run_cmd ~stdin ~stdout raw_command

0 commit comments

Comments
 (0)