diff --git a/apis/libai.lua b/apis/libai.lua index 811eaab..e1f6eae 100644 --- a/apis/libai.lua +++ b/apis/libai.lua @@ -1,6 +1,6 @@ local PING_PROMPT = 'reply with exactly: pong'; -local DEFAULT_TIMEOUT_SECONDS = 60; +local DEFAULT_TIMEOUT_SECONDS = 120; local MAX_TIMEOUT_SECONDS = 120; local DEFAULT_POLL_TIMEOUT_SECONDS = 600; local DEFAULT_POLL_INTERVAL_SECONDS = 2; diff --git a/packages/index.json b/packages/index.json index aaa931a..408428f 100644 --- a/packages/index.json +++ b/packages/index.json @@ -5,7 +5,7 @@ "trapos-boot": "0.3.2", "trapos-net": "0.3.0", "trapos-ui": "0.2.2", - "trapos-ai": "0.6.9", + "trapos-ai": "0.6.10", "trapos-sandbox": "0.2.2", "trapos": "0.8.11" } diff --git a/packages/trapos-ai/ccpm.json b/packages/trapos-ai/ccpm.json index 747684e..6a72548 100644 --- a/packages/trapos-ai/ccpm.json +++ b/packages/trapos-ai/ccpm.json @@ -1,6 +1,6 @@ { "name": "trapos-ai", - "version": "0.6.9", + "version": "0.6.10", "description": "TrapOS AI client for opencode serve", "dependencies": ["trapos-core"], "files": [ diff --git a/tests/ai.lua b/tests/ai.lua index b4dc25f..fdc7e92 100644 --- a/tests/ai.lua +++ b/tests/ai.lua @@ -847,6 +847,21 @@ testlib.test('ask polling default timeout allows ten minute replies', function() testlib.assertEquals(#httpStub.getCalls, 3); end); +testlib.test('ask uses two minute HTTP timeout by default', function() + local httpStub = fakeHttp( + { sessionResp('ses_1'), messageResp('reply') }, + {} + ); + local settingsStub = fakeSettings({ ['opencc.server_url'] = 'http://host' }); + local ai = createAi({ http = httpStub, settings = settingsStub }); + + local ok = ai.ask('hello'); + + testlib.assertTrue(ok); + testlib.assertEquals(httpStub.postCalls[1].timeout, 120); + testlib.assertEquals(httpStub.postCalls[2].timeout, 120); +end); + testlib.test('ask caps per-call HTTP timeout at two minutes', function() local httpStub = fakeHttp( { sessionResp('ses_1'), messageResp('reply') },