From 4c6a831aa2a57e2bcc20aa3fc2f1b7172f5be285 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Mon, 29 Jun 2026 02:36:40 +0900 Subject: feat: 会話メモリのプロトタイプを実装 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 6種類のMCPツールと入力検証を追加 - バイナリログ、スナップショット、復旧、圧縮処理を実装 - Unicode n-gram検索とドメインモデルを追加 - 単体テストと統合テストを追加 - アーキテクチャと実装状況を文書化 - Cコードの記述スタイルを統一 --- src/app/main.c | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'src/app/main.c') 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 + #include +#include +#include #include "mcp/server.h" +#include "storage/store.h" + +static void +usage(FILE *stream) +{ + fwprintf(stream, L"Usage: tiny-convmem-mcp --data-dir \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; } - -- cgit v1.2.3