diff options
| author | tanaka takashi <isazaka@gmail.com> | 2026-06-29 02:36:40 +0900 |
|---|---|---|
| committer | tanaka takashi <isazaka@gmail.com> | 2026-06-29 02:36:40 +0900 |
| commit | 4c6a831aa2a57e2bcc20aa3fc2f1b7172f5be285 (patch) | |
| tree | 074021381abf57cad434430f25027115b681b8a9 /src/app | |
| parent | 8d38b06f11c713e547d70468340242f23322152c (diff) | |
feat: 会話メモリのプロトタイプを実装
- 6種類のMCPツールと入力検証を追加
- バイナリログ、スナップショット、復旧、圧縮処理を実装
- Unicode n-gram検索とドメインモデルを追加
- 単体テストと統合テストを追加
- アーキテクチャと実装状況を文書化
- Cコードの記述スタイルを統一
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/main.c | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/src/app/main.c b/src/app/main.c index ab8688f..ce43b61 100644 --- a/src/app/main.c +++ b/src/app/main.c @@ -1,15 +1,57 @@ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + #include <stdio.h> +#include <stdlib.h> +#include <wchar.h> #include "mcp/server.h" +#include "storage/store.h" + +static void +usage(FILE *stream) +{ + fwprintf(stream, L"Usage: tiny-convmem-mcp --data-dir <path>\n"); +} int -main(void) +wmain(int argc, wchar_t **argv) { - const int result = tiny_convmem_server_run(stdin, stdout); + wchar_t *absolute = NULL; + DWORD required; + tiny_store_t *store = NULL; + tiny_store_status_t status; + int result; + if (argc == 2 && wcscmp(argv[1], L"--help") == 0) + { + usage(stdout); + return 0; + } + if (argc != 3 || wcscmp(argv[1], L"--data-dir") != 0 || argv[2][0] == L'\0') + { + usage(stderr); + return 2; + } + required = GetFullPathNameW(argv[2], 0, NULL, NULL); + if (required == 0 || (absolute = malloc((size_t)required * sizeof(wchar_t))) == NULL + || GetFullPathNameW(argv[2], required, absolute, NULL) == 0) + { + fprintf(stderr, "unable to resolve --data-dir\n"); + free(absolute); + return 2; + } + status = tiny_store_open(&store, absolute); + free(absolute); + if (status != TINY_STORE_OK) + { + fprintf(stderr, "unable to open conversation store: %s\n", tiny_store_status_name(status)); + return status == TINY_STORE_BUSY ? 3 : 1; + } + result = tiny_convmem_server_run(stdin, stdout, store); + tiny_store_close(store); if (result != 0) { fprintf(stderr, "tiny-convmem-mcp stopped with error code %d\n", result); } return result; } - |
