@sellable/mcp 0.1.943 → 0.1.944-wip.genflags.20260929.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-tool-names.d.ts +2 -2
- package/dist/agent-tool-names.js +3 -0
- package/dist/server.js +7 -0
- package/dist/tools/agent-generation-routing.d.ts +103 -0
- package/dist/tools/agent-generation-routing.js +147 -0
- package/dist/tools/registry.d.ts +34 -0
- package/dist/tools/registry.js +2 -0
- package/package.json +1 -1
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* manifests. Keep this free of tool implementation imports so Next can bundle
|
|
4
4
|
* it; registry parity is enforced in sellable-agent-tool-policy.test.ts.
|
|
5
5
|
*/
|
|
6
|
-
export declare const SELLABLE_MCP_TOOL_NAMES: readonly ["add_column", "add_on_demand_leads", "add_rubric_item", "add_teammate", "add_to_comment_campaign", "add_to_connection_campaign", "add_to_inmail_campaign", "add_to_post_campaign", "archive_campaign", "attach_recommended_sequence", "attach_sequence", "bootstrap_create_campaign", "bootstrap_engage", "bootstrap_engage_multi", "bootstrap_find_leads", "bulk_enrich_with_prospeo", "calculate_linkedin_hook_preview", "cancel_campaign_message_preparation", "cancel_find_leads", "cancel_lead_import", "capture_post_idea", "check_inbox_reply_eligibility", "check_rubric", "commit_blueprint", "complete_sender_research", "confirm_harvest_job_companies", "confirm_lead_list", "confirm_prospeo_company_accounts", "copy_sender_config", "create_campaign", "create_on_demand_campaign", "create_on_demand_table", "create_table", "create_workflow_table", "create_workspace", "customer_program", "decide_agent_endpoint_proposal", "delete_column", "delete_rubric_item", "draft_rubrics", "duplicate_campaign", "enrich_with_prospeo", "export_table_csv", "export_workspace_csv", "fetch_company", "fetch_company_posts", "fetch_linkedin_posts", "fetch_linkedin_profile", "fetch_post_engagers", "fill_campaign_horizon", "get_active_workspace", "get_agent_endpoint_run", "get_agent_soul", "get_auth_status", "get_campaign", "get_campaign_context", "get_campaign_framework", "get_campaign_message_preparation_status", "get_campaign_messages_preview", "get_campaign_navigation_state", "get_campaign_refill_state", "get_campaign_table_schema", "get_campaign_waterfall", "get_campaigns", "get_column_schema", "get_company_info", "get_engage_memory", "get_engage_state", "get_engaged_posts", "get_find_leads_run", "get_inbox_thread", "get_integration_connection_status", "get_linkedin_profile", "get_or_create_direct_campaign_table", "get_post_draft", "get_post_find_leads_scout_registry", "get_post_idea", "get_prospeo_credits", "get_provider_prompt", "get_published_post", "get_refill_target_plan", "get_rows", "get_rows_minimal", "get_runtime_identity", "get_scheduler_fill_capacity", "get_sender", "get_sender_routing", "get_source_scout_registry", "get_subskill_asset", "get_subskill_prompt", "get_table_rows", "get_user_posts", "get_workspace", "import_leads", "init_on_demand_sequence", "integrations_call_tool", "integrations_describe_tool", "integrations_list_tools", "list_agent_endpoint_runs", "list_agent_endpoints", "list_column_types", "list_dnc_entries", "list_post_draft_iterations", "list_post_drafts", "list_post_ideas", "list_published_posts", "list_senders", "list_subskill_prompts", "list_tables", "list_workspaces", "load_csv_dnc_entries", "load_csv_domains", "load_csv_linkedin_leads", "lookup_sales_nav_filter", "mark_post_published", "migrate_flat_configs", "opportunity_sequence_enroll", "opportunity_sequence_next_page", "opportunity_sequence_record", "pause_campaign", "pause_direct_campaign", "pause_on_demand_campaign", "preflight_find_leads_provider", "prepare_campaign_ab_test", "publish_agent_endpoint", "queue_campaign_cells", "queue_cells", "record_campaign_review_batch", "record_engage_proven_search", "refill_sends", "refill_v3_advance", "refill_v3_continue", "refill_v3_edit_selected_campaign", "refill_v3_fill_ready", "refill_v3_world_state", "refresh_paid_inmail_credits", "refresh_sender_engagement", "reissue_find_leads_watch_link", "render_linkedin_post_preview", "reorder_columns", "resolve_campaign_fill_route", "revise_message_template_and_rerun", "rotate_agent_endpoint_key", "run_scheduler_sweep", "save_domain_filters", "save_hook_research", "save_post_draft", "save_rubrics", "search_apollo", "search_available_integrations", "search_engagement_posts", "search_harvest_jobs", "search_inbox_threads", "search_prospeo", "search_prospeo_companies", "search_sales_nav", "search_signals", "search_subskill_prompts", "select_campaign_cells", "select_necessary_rubrics", "select_promising_posts", "send_inbox_draft", "send_inbox_manual_reply", "set_active_workspace", "set_campaign_waterfall_order", "set_company_info", "set_engage_state", "set_engage_style_guide", "set_headline_icp_criteria", "set_sender_calendar_link", "set_sender_routing", "setup_evergreen_campaigns", "start_campaign", "start_campaign_message_preparation", "start_cli_login", "start_direct_campaign", "start_integration_connection", "start_on_demand_campaign", "stop_agent_endpoint_run", "update_agent_soul", "update_campaign", "update_campaign_brief", "update_cell", "update_column", "update_find_leads_run", "update_inbox_draft", "update_post_draft", "update_published_post_metrics", "update_rubric_item", "upsert_engage_tracked_person", "upsert_rubric", "validate_campaign1_kickoff_handoff", "verify_table_row", "wait_for_campaign_processing", "wait_for_campaign_table_ready", "wait_for_cli_login", "wait_for_find_leads_run", "wait_for_lead_list_ready", "wait_for_rubric_results"];
|
|
6
|
+
export declare const SELLABLE_MCP_TOOL_NAMES: readonly ["add_column", "add_on_demand_leads", "add_rubric_item", "add_teammate", "add_to_comment_campaign", "add_to_connection_campaign", "add_to_inmail_campaign", "add_to_post_campaign", "archive_campaign", "attach_recommended_sequence", "attach_sequence", "bootstrap_create_campaign", "bootstrap_engage", "bootstrap_engage_multi", "bootstrap_find_leads", "bulk_enrich_with_prospeo", "calculate_linkedin_hook_preview", "cancel_campaign_message_preparation", "cancel_find_leads", "cancel_lead_import", "capture_post_idea", "check_inbox_reply_eligibility", "check_rubric", "commit_blueprint", "complete_sender_research", "confirm_harvest_job_companies", "confirm_lead_list", "confirm_prospeo_company_accounts", "copy_sender_config", "create_campaign", "create_on_demand_campaign", "create_on_demand_table", "create_table", "create_workflow_table", "create_workspace", "customer_program", "decide_agent_endpoint_proposal", "delete_column", "delete_rubric_item", "draft_rubrics", "duplicate_campaign", "enrich_with_prospeo", "export_table_csv", "export_workspace_csv", "fetch_company", "fetch_company_posts", "fetch_linkedin_posts", "fetch_linkedin_profile", "fetch_post_engagers", "fill_campaign_horizon", "get_active_workspace", "get_agent_endpoint_run", "get_agent_generation_routing", "get_agent_soul", "get_auth_status", "get_campaign", "get_campaign_context", "get_campaign_framework", "get_campaign_message_preparation_status", "get_campaign_messages_preview", "get_campaign_navigation_state", "get_campaign_refill_state", "get_campaign_table_schema", "get_campaign_waterfall", "get_campaigns", "get_column_schema", "get_company_info", "get_engage_memory", "get_engage_state", "get_engaged_posts", "get_find_leads_run", "get_inbox_thread", "get_integration_connection_status", "get_linkedin_profile", "get_or_create_direct_campaign_table", "get_post_draft", "get_post_find_leads_scout_registry", "get_post_idea", "get_prospeo_credits", "get_provider_prompt", "get_published_post", "get_refill_target_plan", "get_rows", "get_rows_minimal", "get_runtime_identity", "get_scheduler_fill_capacity", "get_sender", "get_sender_routing", "get_source_scout_registry", "get_subskill_asset", "get_subskill_prompt", "get_table_rows", "get_user_posts", "get_workspace", "import_leads", "init_on_demand_sequence", "integrations_call_tool", "integrations_describe_tool", "integrations_list_tools", "list_agent_endpoint_runs", "list_agent_endpoints", "list_column_types", "list_dnc_entries", "list_post_draft_iterations", "list_post_drafts", "list_post_ideas", "list_published_posts", "list_senders", "list_subskill_prompts", "list_tables", "list_workspaces", "load_csv_dnc_entries", "load_csv_domains", "load_csv_linkedin_leads", "lookup_sales_nav_filter", "mark_post_published", "migrate_flat_configs", "opportunity_sequence_enroll", "opportunity_sequence_next_page", "opportunity_sequence_record", "pause_campaign", "pause_direct_campaign", "pause_on_demand_campaign", "preflight_find_leads_provider", "prepare_campaign_ab_test", "publish_agent_endpoint", "queue_campaign_cells", "queue_cells", "record_campaign_review_batch", "record_engage_proven_search", "refill_sends", "refill_v3_advance", "refill_v3_continue", "refill_v3_edit_selected_campaign", "refill_v3_fill_ready", "refill_v3_world_state", "refresh_paid_inmail_credits", "refresh_sender_engagement", "reissue_find_leads_watch_link", "render_linkedin_post_preview", "reorder_columns", "resolve_campaign_fill_route", "revise_message_template_and_rerun", "rotate_agent_endpoint_key", "run_scheduler_sweep", "save_domain_filters", "save_hook_research", "save_post_draft", "save_rubrics", "search_apollo", "search_available_integrations", "search_engagement_posts", "search_harvest_jobs", "search_inbox_threads", "search_prospeo", "search_prospeo_companies", "search_sales_nav", "search_signals", "search_subskill_prompts", "select_campaign_cells", "select_necessary_rubrics", "select_promising_posts", "send_inbox_draft", "send_inbox_manual_reply", "set_active_workspace", "set_agent_generation_flags", "set_campaign_waterfall_order", "set_company_info", "set_engage_state", "set_engage_style_guide", "set_headline_icp_criteria", "set_sender_calendar_link", "set_sender_routing", "setup_evergreen_campaigns", "start_campaign", "start_campaign_message_preparation", "start_cli_login", "start_direct_campaign", "start_integration_connection", "start_on_demand_campaign", "stop_agent_endpoint_run", "update_agent_soul", "update_campaign", "update_campaign_brief", "update_cell", "update_column", "update_find_leads_run", "update_inbox_draft", "update_post_draft", "update_published_post_metrics", "update_rubric_item", "upsert_engage_tracked_person", "upsert_rubric", "validate_campaign1_kickoff_handoff", "verify_table_row", "wait_for_campaign_processing", "wait_for_campaign_table_ready", "wait_for_cli_login", "wait_for_find_leads_run", "wait_for_lead_list_ready", "wait_for_rubric_results"];
|
|
7
7
|
/**
|
|
8
8
|
* Explicit mutation classification lives beside (but outside) the flat tool
|
|
9
9
|
* registry. Neither this list nor `isMutatingTool` is an input to
|
|
10
10
|
* `compileAgentToolPolicy`, so editing it cannot move the fleet-pinned
|
|
11
11
|
* `policyHash`.
|
|
12
12
|
*/
|
|
13
|
-
export declare const MUTATING_TOOL_NAMES: readonly ["create_table", "publish_agent_endpoint", "rotate_agent_endpoint_key", "decide_agent_endpoint_proposal", "stop_agent_endpoint_run", "pause_campaign", "archive_campaign", "update_campaign", "fill_campaign_horizon", "set_campaign_waterfall_order", "set_sender_routing", "send_inbox_draft", "send_inbox_manual_reply", "load_csv_dnc_entries", "update_cell", "queue_cells", "check_rubric", "queue_campaign_cells", "start_campaign_message_preparation", "opportunity_sequence_enroll", "opportunity_sequence_record", "refill_v3_fill_ready", "refill_v3_edit_selected_campaign", "refill_v3_advance", "refill_v3_continue"];
|
|
13
|
+
export declare const MUTATING_TOOL_NAMES: readonly ["create_table", "publish_agent_endpoint", "rotate_agent_endpoint_key", "decide_agent_endpoint_proposal", "stop_agent_endpoint_run", "pause_campaign", "archive_campaign", "update_campaign", "fill_campaign_horizon", "set_campaign_waterfall_order", "set_sender_routing", "set_agent_generation_flags", "send_inbox_draft", "send_inbox_manual_reply", "load_csv_dnc_entries", "update_cell", "queue_cells", "check_rubric", "queue_campaign_cells", "start_campaign_message_preparation", "opportunity_sequence_enroll", "opportunity_sequence_record", "refill_v3_fill_ready", "refill_v3_edit_selected_campaign", "refill_v3_advance", "refill_v3_continue"];
|
|
14
14
|
export declare function isMutatingTool(name: string): boolean;
|
|
15
15
|
export declare const CROSS_WORKSPACE_EXPLICIT_WORKSPACE_REQUIRED: {
|
|
16
16
|
readonly code: "cross_workspace_explicit_workspace_required";
|
package/dist/agent-tool-names.js
CHANGED
|
@@ -56,6 +56,7 @@ export const SELLABLE_MCP_TOOL_NAMES = [
|
|
|
56
56
|
"fill_campaign_horizon",
|
|
57
57
|
"get_active_workspace",
|
|
58
58
|
"get_agent_endpoint_run",
|
|
59
|
+
"get_agent_generation_routing",
|
|
59
60
|
"get_agent_soul",
|
|
60
61
|
"get_auth_status",
|
|
61
62
|
"get_campaign",
|
|
@@ -168,6 +169,7 @@ export const SELLABLE_MCP_TOOL_NAMES = [
|
|
|
168
169
|
"send_inbox_draft",
|
|
169
170
|
"send_inbox_manual_reply",
|
|
170
171
|
"set_active_workspace",
|
|
172
|
+
"set_agent_generation_flags",
|
|
171
173
|
"set_campaign_waterfall_order",
|
|
172
174
|
"set_company_info",
|
|
173
175
|
"set_engage_state",
|
|
@@ -225,6 +227,7 @@ export const MUTATING_TOOL_NAMES = [
|
|
|
225
227
|
"fill_campaign_horizon",
|
|
226
228
|
"set_campaign_waterfall_order",
|
|
227
229
|
"set_sender_routing",
|
|
230
|
+
"set_agent_generation_flags",
|
|
228
231
|
"send_inbox_draft",
|
|
229
232
|
"send_inbox_manual_reply",
|
|
230
233
|
"load_csv_dnc_entries",
|
package/dist/server.js
CHANGED
|
@@ -15,6 +15,7 @@ import { MCP_RUNTIME_IDENTITY } from "./runtime-identity.js";
|
|
|
15
15
|
import { getSkillByName, listSkills } from "./skills.js";
|
|
16
16
|
import { toMcpToolResult } from "./tool-result-envelope.js";
|
|
17
17
|
import { decideAgentEndpointProposal, getAgentEndpointRun, listAgentEndpointRuns, listAgentEndpoints, publishAgentEndpoint, rotateAgentEndpointKey, stopAgentEndpointRun, } from "./tools/agent-endpoints.js";
|
|
18
|
+
import { getAgentGenerationRoutingTool, setAgentGenerationFlagsTool, } from "./tools/agent-generation-routing.js";
|
|
18
19
|
import { getAgentSoulTool, updateAgentSoulTool } from "./tools/agent-soul.js";
|
|
19
20
|
import { getAuthStatus } from "./tools/auth.js";
|
|
20
21
|
import { handleAddColumn, handleCommitBlueprint, } from "./tools/blueprint-commit.js";
|
|
@@ -797,6 +798,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
797
798
|
case "set_sender_routing":
|
|
798
799
|
result = await setSenderRoutingTool(args);
|
|
799
800
|
break;
|
|
801
|
+
case "get_agent_generation_routing":
|
|
802
|
+
result = await getAgentGenerationRoutingTool(args);
|
|
803
|
+
break;
|
|
804
|
+
case "set_agent_generation_flags":
|
|
805
|
+
result = await setAgentGenerationFlagsTool(args);
|
|
806
|
+
break;
|
|
800
807
|
// Plan 141-06 owns these three `case` labels ONLY. The fail-closed actor
|
|
801
808
|
// guard above is plan 141-04 T2's and is keyed on the tool-name SET, so it
|
|
802
809
|
// already ran before this switch and `integrationActor.context` is verified.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
type GenerationFlags = {
|
|
2
|
+
openerEnabled: boolean;
|
|
3
|
+
replyEnabled: boolean;
|
|
4
|
+
followUpEnabled: boolean;
|
|
5
|
+
};
|
|
6
|
+
type GenerationRouting = {
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
agentId: string;
|
|
9
|
+
generation: number;
|
|
10
|
+
endpointId: string;
|
|
11
|
+
openerEndpointId: string | null;
|
|
12
|
+
currentPublishedRevisionId: string | null;
|
|
13
|
+
flags: GenerationFlags;
|
|
14
|
+
};
|
|
15
|
+
type SetFlagsInput = {
|
|
16
|
+
expectedGeneration?: unknown;
|
|
17
|
+
openerEnabled?: unknown;
|
|
18
|
+
replyEnabled?: unknown;
|
|
19
|
+
followUpEnabled?: unknown;
|
|
20
|
+
workspaceId?: unknown;
|
|
21
|
+
};
|
|
22
|
+
export declare const agentGenerationRoutingToolDefinitions: ({
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
inputSchema: {
|
|
26
|
+
type: string;
|
|
27
|
+
properties: {
|
|
28
|
+
workspaceId: {
|
|
29
|
+
type: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
expectedGeneration?: undefined;
|
|
33
|
+
openerEnabled?: undefined;
|
|
34
|
+
replyEnabled?: undefined;
|
|
35
|
+
followUpEnabled?: undefined;
|
|
36
|
+
};
|
|
37
|
+
required: never[];
|
|
38
|
+
additionalProperties: boolean;
|
|
39
|
+
};
|
|
40
|
+
annotations?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: string;
|
|
46
|
+
properties: {
|
|
47
|
+
expectedGeneration: {
|
|
48
|
+
type: string;
|
|
49
|
+
minimum: number;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
openerEnabled: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
replyEnabled: {
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
followUpEnabled: {
|
|
59
|
+
type: string;
|
|
60
|
+
};
|
|
61
|
+
workspaceId: {
|
|
62
|
+
type: string;
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
required: string[];
|
|
67
|
+
additionalProperties: boolean;
|
|
68
|
+
};
|
|
69
|
+
annotations: {
|
|
70
|
+
readOnlyHint: boolean;
|
|
71
|
+
destructiveHint: boolean;
|
|
72
|
+
idempotentHint: boolean;
|
|
73
|
+
openWorldHint: boolean;
|
|
74
|
+
};
|
|
75
|
+
})[];
|
|
76
|
+
export declare function getAgentGenerationRoutingTool(input?: {
|
|
77
|
+
workspaceId?: string;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
ok: false;
|
|
80
|
+
code: string;
|
|
81
|
+
message: string;
|
|
82
|
+
} | {
|
|
83
|
+
ok: true;
|
|
84
|
+
routing: GenerationRouting;
|
|
85
|
+
}>;
|
|
86
|
+
export declare function setAgentGenerationFlagsTool(input?: SetFlagsInput): Promise<{
|
|
87
|
+
ok: false;
|
|
88
|
+
code: string;
|
|
89
|
+
message: string;
|
|
90
|
+
} | {
|
|
91
|
+
ok: true;
|
|
92
|
+
before: {
|
|
93
|
+
generation: number;
|
|
94
|
+
flags: GenerationFlags;
|
|
95
|
+
};
|
|
96
|
+
after: {
|
|
97
|
+
generation: number;
|
|
98
|
+
flags: GenerationFlags;
|
|
99
|
+
};
|
|
100
|
+
routing: GenerationRouting;
|
|
101
|
+
note: string;
|
|
102
|
+
}>;
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { getApi, SellableApiError } from "../api.js";
|
|
2
|
+
import { workspaceRequestOptions } from "./workspace-context.js";
|
|
3
|
+
const ROUTE = "/api/v3/sellable-agent/product-generation";
|
|
4
|
+
const FLAG_KEYS = ["openerEnabled", "replyEnabled", "followUpEnabled"];
|
|
5
|
+
export const agentGenerationRoutingToolDefinitions = [
|
|
6
|
+
{
|
|
7
|
+
name: "get_agent_generation_routing",
|
|
8
|
+
description: "Read the workspace Sellable Agent's message-generation routing: the opener, reply, and follow-up flags plus the current generation number and endpoint ids. Read this before set_agent_generation_flags and pass its generation as expectedGeneration.",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
workspaceId: {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "Explicit request-scoped workspace id.",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
required: [],
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "set_agent_generation_flags",
|
|
23
|
+
description: "Turn the workspace Sellable Agent's opener, reply, or follow-up generation on or off. Only the flags you pass change; the others and the endpoint ids are preserved. Requires expectedGeneration from get_agent_generation_routing (compare-before-write). Turning openerEnabled off stops NEW campaigns from defaulting to the Agent opener. Existing campaigns keep their per-column messageGenerator setting until that Generate Message column is switched to STANDARD.",
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: "object",
|
|
26
|
+
properties: {
|
|
27
|
+
expectedGeneration: {
|
|
28
|
+
type: "integer",
|
|
29
|
+
minimum: 0,
|
|
30
|
+
description: "The generation returned by get_agent_generation_routing.",
|
|
31
|
+
},
|
|
32
|
+
openerEnabled: { type: "boolean" },
|
|
33
|
+
replyEnabled: { type: "boolean" },
|
|
34
|
+
followUpEnabled: { type: "boolean" },
|
|
35
|
+
workspaceId: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Explicit target workspace id.",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
required: ["expectedGeneration"],
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
},
|
|
43
|
+
annotations: {
|
|
44
|
+
readOnlyHint: false,
|
|
45
|
+
destructiveHint: false,
|
|
46
|
+
idempotentHint: true,
|
|
47
|
+
openWorldHint: false,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
function isRouting(value) {
|
|
52
|
+
const routing = value;
|
|
53
|
+
return (!!routing &&
|
|
54
|
+
typeof routing.generation === "number" &&
|
|
55
|
+
typeof routing.endpointId === "string" &&
|
|
56
|
+
!!routing.flags &&
|
|
57
|
+
FLAG_KEYS.every((key) => typeof routing.flags[key] === "boolean"));
|
|
58
|
+
}
|
|
59
|
+
function failure(code, message, extra = {}) {
|
|
60
|
+
return { ok: false, code, message, ...extra };
|
|
61
|
+
}
|
|
62
|
+
function describeError(error) {
|
|
63
|
+
if (error instanceof SellableApiError) {
|
|
64
|
+
let code = `http_${error.status}`;
|
|
65
|
+
try {
|
|
66
|
+
const parsed = JSON.parse(error.body);
|
|
67
|
+
if (typeof parsed.error === "string" && /^[a-z0-9_]+$/.test(parsed.error))
|
|
68
|
+
code = parsed.error;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Keep the HTTP status code.
|
|
72
|
+
}
|
|
73
|
+
return failure(code, error.isAuthError
|
|
74
|
+
? "Sellable authentication or authorization failed. OWNER or ADMIN access to the workspace is required."
|
|
75
|
+
: `The routing request failed (${error.status}).`, { status: error.status, uncertain: error.status >= 500 });
|
|
76
|
+
}
|
|
77
|
+
return failure("request_failed", error instanceof Error ? error.message : "The routing request failed.");
|
|
78
|
+
}
|
|
79
|
+
export async function getAgentGenerationRoutingTool(input = {}) {
|
|
80
|
+
try {
|
|
81
|
+
const response = await getApi().get(ROUTE, workspaceRequestOptions(input.workspaceId));
|
|
82
|
+
if (!isRouting(response?.routing)) {
|
|
83
|
+
return failure("malformed_routing_response", "The routing response was incomplete.");
|
|
84
|
+
}
|
|
85
|
+
return { ok: true, routing: response.routing };
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return describeError(error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export async function setAgentGenerationFlagsTool(input = {}) {
|
|
92
|
+
const changes = {};
|
|
93
|
+
for (const key of FLAG_KEYS) {
|
|
94
|
+
const value = input[key];
|
|
95
|
+
if (value === undefined)
|
|
96
|
+
continue;
|
|
97
|
+
if (typeof value !== "boolean") {
|
|
98
|
+
return failure("invalid_arguments", `${key} must be a boolean.`);
|
|
99
|
+
}
|
|
100
|
+
changes[key] = value;
|
|
101
|
+
}
|
|
102
|
+
if (typeof input.expectedGeneration !== "number" ||
|
|
103
|
+
!Number.isInteger(input.expectedGeneration) ||
|
|
104
|
+
input.expectedGeneration < 0) {
|
|
105
|
+
return failure("invalid_arguments", "expectedGeneration is required. Read it from get_agent_generation_routing.");
|
|
106
|
+
}
|
|
107
|
+
if (Object.keys(changes).length === 0) {
|
|
108
|
+
return failure("invalid_arguments", "Pass at least one of openerEnabled, replyEnabled, or followUpEnabled.");
|
|
109
|
+
}
|
|
110
|
+
const workspaceId = typeof input.workspaceId === "string" ? input.workspaceId : undefined;
|
|
111
|
+
const current = await getAgentGenerationRoutingTool({ workspaceId });
|
|
112
|
+
if (!current.ok)
|
|
113
|
+
return current;
|
|
114
|
+
const before = current.routing;
|
|
115
|
+
if (before.generation !== input.expectedGeneration) {
|
|
116
|
+
return failure("generation_conflict", "The routing changed after it was read. Reread it and retry with the current generation.", { currentGeneration: before.generation, flags: before.flags });
|
|
117
|
+
}
|
|
118
|
+
const flags = { ...before.flags, ...changes };
|
|
119
|
+
try {
|
|
120
|
+
const response = await getApi().put(ROUTE, {
|
|
121
|
+
expectedGeneration: before.generation,
|
|
122
|
+
endpointId: before.endpointId,
|
|
123
|
+
...(before.openerEndpointId
|
|
124
|
+
? { openerEndpointId: before.openerEndpointId }
|
|
125
|
+
: {}),
|
|
126
|
+
flags,
|
|
127
|
+
}, workspaceRequestOptions(workspaceId));
|
|
128
|
+
if (!isRouting(response?.routing)) {
|
|
129
|
+
return failure("malformed_routing_response", "The update returned an incomplete receipt, so the final state is uncertain. Reread get_agent_generation_routing before retrying.", { uncertain: true });
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
ok: true,
|
|
133
|
+
before: { generation: before.generation, flags: before.flags },
|
|
134
|
+
after: {
|
|
135
|
+
generation: response.routing.generation,
|
|
136
|
+
flags: response.routing.flags,
|
|
137
|
+
},
|
|
138
|
+
routing: response.routing,
|
|
139
|
+
note: flags.openerEnabled
|
|
140
|
+
? "Agent openers are on for new campaigns."
|
|
141
|
+
: "New campaigns will use the standard template generator. Existing campaigns keep their own Generate Message setting.",
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
return describeError(error);
|
|
146
|
+
}
|
|
147
|
+
}
|
package/dist/tools/registry.d.ts
CHANGED
|
@@ -786,6 +786,40 @@ export declare const allTools: ({
|
|
|
786
786
|
readonly idempotentHint: false;
|
|
787
787
|
readonly openWorldHint: false;
|
|
788
788
|
};
|
|
789
|
+
} | {
|
|
790
|
+
name: string;
|
|
791
|
+
description: string;
|
|
792
|
+
inputSchema: {
|
|
793
|
+
type: string;
|
|
794
|
+
properties: {
|
|
795
|
+
expectedGeneration: {
|
|
796
|
+
type: string;
|
|
797
|
+
minimum: number;
|
|
798
|
+
description: string;
|
|
799
|
+
};
|
|
800
|
+
openerEnabled: {
|
|
801
|
+
type: string;
|
|
802
|
+
};
|
|
803
|
+
replyEnabled: {
|
|
804
|
+
type: string;
|
|
805
|
+
};
|
|
806
|
+
followUpEnabled: {
|
|
807
|
+
type: string;
|
|
808
|
+
};
|
|
809
|
+
workspaceId: {
|
|
810
|
+
type: string;
|
|
811
|
+
description: string;
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
required: string[];
|
|
815
|
+
additionalProperties: boolean;
|
|
816
|
+
};
|
|
817
|
+
annotations: {
|
|
818
|
+
readOnlyHint: boolean;
|
|
819
|
+
destructiveHint: boolean;
|
|
820
|
+
idempotentHint: boolean;
|
|
821
|
+
openWorldHint: boolean;
|
|
822
|
+
};
|
|
789
823
|
} | {
|
|
790
824
|
readonly name: "get_agent_soul";
|
|
791
825
|
readonly description: "Read and prove the SOUL.md used by this live Sellable Agent runtime. This tool is runtime-bound and has no target selector.";
|
package/dist/tools/registry.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { agentEndpointToolDefinitions } from "./agent-endpoints.js";
|
|
2
|
+
import { agentGenerationRoutingToolDefinitions } from "./agent-generation-routing.js";
|
|
2
3
|
import { agentSoulToolDefinitions } from "./agent-soul.js";
|
|
3
4
|
import { authToolDefinitions } from "./auth.js";
|
|
4
5
|
import { blueprintCommitToolDefinitions } from "./blueprint-commit.js";
|
|
@@ -124,6 +125,7 @@ export const allTools = [
|
|
|
124
125
|
...companyInfoToolDefinitions,
|
|
125
126
|
...customerProgramToolDefinitions,
|
|
126
127
|
...senderRoutingToolDefinitions,
|
|
128
|
+
...agentGenerationRoutingToolDefinitions,
|
|
127
129
|
...senderToolDefinitions,
|
|
128
130
|
...engageStateToolDefinitions,
|
|
129
131
|
...engageMemoryToolDefinitions,
|
package/package.json
CHANGED