@@ -1177,6 +1177,10 @@ TEST(client_adapter_pi_emits_parameters_and_execute) {
11771177 /* TypeBox parameters schema is embedded with Type.Object syntax. */
11781178 ASSERT_NOT_NULL (strstr (js , "Type.Object(" ));
11791179 ASSERT_NOT_NULL (strstr (js , "Type.String(" ));
1180+ /* #2787: String enums must use Type.String({ enum: [...] }) without anyOf/const */
1181+ ASSERT_NOT_NULL (strstr (js , "Type.String({ enum: [" ));
1182+ ASSERT_NULL (strstr (js , "Type.Union([Type.Literal" ));
1183+ ASSERT_NULL (strstr (js , "Type.Literal(" ));
11801184 /* A numeric registry property must remain numeric in the generated schema. */
11811185 ASSERT_NOT_NULL (strstr (js , "depth: Type.Optional(Type.Integer(" ));
11821186 /* TypeBox import should be present. */
@@ -1244,6 +1248,23 @@ TEST(client_adapter_pi_wraps_result_and_honors_abort) {
12441248 PASS ();
12451249}
12461250
1251+ /* #2787: Pi extension must emit string enums as Type.String({ enum: [...] })
1252+ * rather than Type.Union([Type.Literal(...)]) which TypeBox serializes as
1253+ * anyOf/const, breaking Gemini / Antigravity function declaration validation. */
1254+ TEST (client_adapter_pi_emits_string_enum_issue2787 ) {
1255+ char * js = cbm_client_adapter_pi ("/usr/local/bin/codebase-memory-mcp" );
1256+ ASSERT_NOT_NULL (js );
1257+ ASSERT_NULL (strstr (js , "Type.Union([Type.Literal" ));
1258+ ASSERT_NULL (strstr (js , "Type.Literal(" ));
1259+ ASSERT_NOT_NULL (strstr (js , "Type.String({ enum: [" ));
1260+ ASSERT_NOT_NULL (strstr (js , "'full'" ));
1261+ ASSERT_NOT_NULL (strstr (js , "'moderate'" ));
1262+ ASSERT_NOT_NULL (strstr (js , "'fast'" ));
1263+ ASSERT_NOT_NULL (strstr (js , "'cross-repo-intelligence'" ));
1264+ free (js );
1265+ PASS ();
1266+ }
1267+
12471268/* #616 rejected `"` in its path template but not `\`, so a Windows home like
12481269 * C:\Users\urs\bin produced `\u` — an invalid unicode escape — and the whole
12491270 * auto-loaded plugin failed to parse. A broken plugin in an auto-load directory
@@ -1405,6 +1426,7 @@ SUITE(agent_clients) {
14051426 RUN_TEST (client_adapter_pi_emits_parameters_and_execute );
14061427 RUN_TEST (client_adapter_pi_sends_arguments_over_stdin_issue1834 );
14071428 RUN_TEST (client_adapter_pi_wraps_result_and_honors_abort );
1429+ RUN_TEST (client_adapter_pi_emits_string_enum_issue2787 );
14081430 RUN_TEST (client_adapter_escapes_windows_paths_and_quotes );
14091431 RUN_TEST (client_adapter_opencode_sends_the_required_hook_event );
14101432 RUN_TEST (client_adapter_opencode_covers_lifecycle_read_and_compaction );
0 commit comments