@@ -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. */
@@ -1239,7 +1243,23 @@ TEST(client_adapter_pi_wraps_result_and_honors_abort) {
12391243 ASSERT_NOT_NULL (
12401244 strstr (js , "[{ type: 'text', text: JSON.stringify(result ?? null, null, 2) }]" ));
12411245 ASSERT_NOT_NULL (strstr (js , "signal?.addEventListener('abort', onAbort, { once: true })" ));
1242- ASSERT_NOT_NULL (strstr (js , "if (!child.killed) child.kill();" ));
1246+ free (js );
1247+ PASS ();
1248+ }
1249+
1250+ /* #2787: Pi extension must emit string enums as Type.String({ enum: [...] })
1251+ * rather than Type.Union([Type.Literal(...)]) which TypeBox serializes as
1252+ * anyOf/const, breaking Gemini / Antigravity function declaration validation. */
1253+ TEST (client_adapter_pi_emits_string_enum_issue2787 ) {
1254+ char * js = cbm_client_adapter_pi ("/usr/local/bin/codebase-memory-mcp" );
1255+ ASSERT_NOT_NULL (js );
1256+ ASSERT_NULL (strstr (js , "Type.Union([Type.Literal" ));
1257+ ASSERT_NULL (strstr (js , "Type.Literal(" ));
1258+ ASSERT_NOT_NULL (strstr (js , "Type.String({ enum: [" ));
1259+ ASSERT_NOT_NULL (strstr (js , "'full'" ));
1260+ ASSERT_NOT_NULL (strstr (js , "'moderate'" ));
1261+ ASSERT_NOT_NULL (strstr (js , "'fast'" ));
1262+ ASSERT_NOT_NULL (strstr (js , "'cross-repo-intelligence'" ));
12431263 free (js );
12441264 PASS ();
12451265}
@@ -1405,6 +1425,7 @@ SUITE(agent_clients) {
14051425 RUN_TEST (client_adapter_pi_emits_parameters_and_execute );
14061426 RUN_TEST (client_adapter_pi_sends_arguments_over_stdin_issue1834 );
14071427 RUN_TEST (client_adapter_pi_wraps_result_and_honors_abort );
1428+ RUN_TEST (client_adapter_pi_emits_string_enum_issue2787 );
14081429 RUN_TEST (client_adapter_escapes_windows_paths_and_quotes );
14091430 RUN_TEST (client_adapter_opencode_sends_the_required_hook_event );
14101431 RUN_TEST (client_adapter_opencode_covers_lifecycle_read_and_compaction );
0 commit comments