@signaliz/sdk 1.0.4 → 1.0.6
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/{chunk-EVZZQTWE.mjs → chunk-GRVV37LD.mjs} +88 -30
- package/dist/cli.js +88 -30
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +88 -30
- package/dist/index.mjs +1 -1
- package/dist/mcp-config.js +88 -30
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
|
@@ -284,7 +284,7 @@ function unwrapMcpResponse(data) {
|
|
|
284
284
|
function unwrapMcpPayload(payload) {
|
|
285
285
|
if (isRecord(payload)) {
|
|
286
286
|
if (payload.ok === true && Object.prototype.hasOwnProperty.call(payload, "result")) {
|
|
287
|
-
return payload.result;
|
|
287
|
+
return unwrapMcpPayload(payload.result);
|
|
288
288
|
}
|
|
289
289
|
if (payload.ok === false) {
|
|
290
290
|
const first = firstPayloadError(payload);
|
|
@@ -805,15 +805,17 @@ var Campaigns = class {
|
|
|
805
805
|
args.idempotency_key = options.idempotencyKey;
|
|
806
806
|
}
|
|
807
807
|
const data = await this.callMcp("build_campaign", args);
|
|
808
|
+
const isDryRun = request.dryRun === true || data.dry_run === true || data.status === "dry_run";
|
|
809
|
+
const message = data.message ?? data.summary ?? (isDryRun && data.planned_target_count !== void 0 && data.estimated_credits !== void 0 && data.estimated_duration_seconds !== void 0 ? `Dry-run plan: ${data.planned_target_count} fresh leads. ~${data.estimated_credits} credits, ~${data.estimated_duration_seconds}s.` : "");
|
|
808
810
|
return {
|
|
809
811
|
campaignBuildId: data.campaign_build_id ?? null,
|
|
810
812
|
campaignId: data.campaign_id ?? null,
|
|
811
813
|
campaignObject: data.campaign_object ?? null,
|
|
812
|
-
status:
|
|
813
|
-
currentPhase:
|
|
814
|
+
status: isDryRun ? "dry_run" : data.status ?? "queued",
|
|
815
|
+
currentPhase: isDryRun ? "plan" : data.current_phase ?? "acquisition",
|
|
814
816
|
nextPollAfterSeconds: data.next_poll_after_seconds ?? 10,
|
|
815
|
-
message
|
|
816
|
-
dryRun:
|
|
817
|
+
message,
|
|
818
|
+
dryRun: isDryRun,
|
|
817
819
|
requestedTargetCount: data.requested_target_count,
|
|
818
820
|
plannedTargetCount: data.planned_target_count,
|
|
819
821
|
estimatedCredits: data.estimated_credits,
|
|
@@ -927,11 +929,11 @@ function mapStatus(data) {
|
|
|
927
929
|
recordsProcessed: data.records_processed ?? 0,
|
|
928
930
|
recordsSucceeded: data.records_succeeded ?? 0,
|
|
929
931
|
recordsFailed: data.records_failed ?? 0,
|
|
930
|
-
warnings: data.warnings
|
|
931
|
-
errors: data.errors
|
|
932
|
+
warnings: diagnosticMessages(data.warnings),
|
|
933
|
+
errors: diagnosticMessages(data.errors),
|
|
932
934
|
artifactCount: data.artifact_count ?? 0,
|
|
933
935
|
providerRoute: mapProviderRoute(data),
|
|
934
|
-
nextAction: data.next_action
|
|
936
|
+
nextAction: formatNextAction(data.next_action),
|
|
935
937
|
createdAt: data.created_at,
|
|
936
938
|
updatedAt: data.updated_at,
|
|
937
939
|
completedAt: data.completed_at
|
|
@@ -963,6 +965,27 @@ function recordOrNull(value) {
|
|
|
963
965
|
function stringArray(value) {
|
|
964
966
|
return Array.isArray(value) ? value.map((item) => String(item || "").trim()).filter(Boolean) : [];
|
|
965
967
|
}
|
|
968
|
+
function diagnosticMessages(value) {
|
|
969
|
+
if (!Array.isArray(value)) return [];
|
|
970
|
+
return value.map((item) => {
|
|
971
|
+
if (typeof item === "string") return item;
|
|
972
|
+
const record = recordOrNull(item);
|
|
973
|
+
return typeof record?.message === "string" ? record.message : null;
|
|
974
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
975
|
+
}
|
|
976
|
+
function formatNextAction(value) {
|
|
977
|
+
if (!value) return "";
|
|
978
|
+
if (typeof value === "string") return value;
|
|
979
|
+
const record = recordOrNull(value);
|
|
980
|
+
if (!record) return "";
|
|
981
|
+
const tool = typeof record.tool === "string" ? record.tool : void 0;
|
|
982
|
+
const type = typeof record.type === "string" ? record.type : void 0;
|
|
983
|
+
const reason = typeof record.reason === "string" ? record.reason : void 0;
|
|
984
|
+
const args = recordOrNull(record.arguments);
|
|
985
|
+
const argText = args && Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : "";
|
|
986
|
+
const action = tool ? `${tool}${argText}` : type || "";
|
|
987
|
+
return [action, reason].filter(Boolean).join(" \u2014 ");
|
|
988
|
+
}
|
|
966
989
|
function booleanOrNull(value) {
|
|
967
990
|
return typeof value === "boolean" ? value : null;
|
|
968
991
|
}
|
|
@@ -2290,22 +2313,22 @@ function queryFieldFor(kind) {
|
|
|
2290
2313
|
function statusCommandFor(kind, id) {
|
|
2291
2314
|
switch (kind) {
|
|
2292
2315
|
case "op":
|
|
2293
|
-
return `signaliz status ${id}`;
|
|
2316
|
+
return `signaliz ops status ${id}`;
|
|
2294
2317
|
case "trigger_run":
|
|
2295
2318
|
case "dataplane_run":
|
|
2296
2319
|
case "replay_run":
|
|
2297
|
-
return `signaliz
|
|
2320
|
+
return `signaliz ops run-status ${id} --watch`;
|
|
2298
2321
|
case "queue_job":
|
|
2299
|
-
return `signaliz queue --job-id ${id}`;
|
|
2322
|
+
return `signaliz ops queue --job-id ${id}`;
|
|
2300
2323
|
case "routine":
|
|
2301
|
-
return `signaliz routine ${id}`;
|
|
2324
|
+
return `signaliz ops routine ${id}`;
|
|
2302
2325
|
default:
|
|
2303
2326
|
return void 0;
|
|
2304
2327
|
}
|
|
2305
2328
|
}
|
|
2306
2329
|
function replayCommandFor(kind, id) {
|
|
2307
2330
|
if (kind !== "execution_event") return void 0;
|
|
2308
|
-
return `signaliz replay ${id}`;
|
|
2331
|
+
return `signaliz ops replay ${id}`;
|
|
2309
2332
|
}
|
|
2310
2333
|
|
|
2311
2334
|
// src/resources/ops.ts
|
|
@@ -3842,6 +3865,25 @@ var GtmKernel = class {
|
|
|
3842
3865
|
write_routine_outcomes: input.writeRoutineOutcomes
|
|
3843
3866
|
});
|
|
3844
3867
|
}
|
|
3868
|
+
/** Run a read-only Campaign Audit and persist workspace-scoped failure findings. */
|
|
3869
|
+
async runCampaignAudit(input) {
|
|
3870
|
+
return this.callMcp("gtm_campaign_audit_run", {
|
|
3871
|
+
provider: input.provider,
|
|
3872
|
+
provider_campaign_id: input.providerCampaignId,
|
|
3873
|
+
campaign_id: input.campaignId,
|
|
3874
|
+
campaign_name: input.campaignName,
|
|
3875
|
+
lookback_days: input.lookbackDays,
|
|
3876
|
+
limit_findings: input.limitFindings
|
|
3877
|
+
});
|
|
3878
|
+
}
|
|
3879
|
+
/** Read a persisted Campaign Audit by audit id or campaign id. */
|
|
3880
|
+
async getCampaignAudit(options) {
|
|
3881
|
+
return this.callMcp("gtm_campaign_audit_get", {
|
|
3882
|
+
audit_id: options.auditId,
|
|
3883
|
+
campaign_id: options.campaignId,
|
|
3884
|
+
limit_findings: options.limitFindings
|
|
3885
|
+
});
|
|
3886
|
+
}
|
|
3845
3887
|
/** Normalize Instantly webhook/pull payloads and ingest row-level feedback through the GTM Kernel. */
|
|
3846
3888
|
async syncInstantlyFeedback(input) {
|
|
3847
3889
|
return this.callMcp("gtm_instantly_feedback_sync", {
|
|
@@ -4586,6 +4628,29 @@ function inferMcpToolCategory(toolName) {
|
|
|
4586
4628
|
if (toolName.includes("agent") || toolName.includes("platform_health") || toolName === "discover_capabilities") return "observability";
|
|
4587
4629
|
return void 0;
|
|
4588
4630
|
}
|
|
4631
|
+
function mapMcpToolInfo(t) {
|
|
4632
|
+
const annotations = asRecord3(t.annotations);
|
|
4633
|
+
const execution = asRecord3(t.execution);
|
|
4634
|
+
const schemas = asRecord3(t.schemas);
|
|
4635
|
+
const name = typeof t.name === "string" ? t.name : typeof t.id === "string" ? t.id : "";
|
|
4636
|
+
return {
|
|
4637
|
+
name,
|
|
4638
|
+
description: String(t.description ?? t.short_description ?? "").slice(0, 120),
|
|
4639
|
+
category: typeof t.category === "string" ? t.category : typeof annotations?.category === "string" ? annotations.category : inferMcpToolCategory(name),
|
|
4640
|
+
costCredits: typeof (execution?.cost_credits ?? annotations?.cost_credits) === "number" ? execution?.cost_credits ?? annotations?.cost_credits : void 0,
|
|
4641
|
+
contractVersion: typeof t.contract_version === "string" ? t.contract_version : typeof (annotations?.contract_version ?? annotations?.contract?.contract_version) === "string" ? annotations?.contract_version ?? annotations?.contract?.contract_version : void 0,
|
|
4642
|
+
permissionLevel: typeof (execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level) === "string" ? execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level : void 0,
|
|
4643
|
+
authScopes: asStringArray(execution?.auth_scopes ?? annotations?.auth_scopes ?? annotations?.contract?.auth_scopes),
|
|
4644
|
+
idempotent: typeof (execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent) === "boolean" ? execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent : void 0,
|
|
4645
|
+
destructive: typeof (execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive) === "boolean" ? execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive : void 0,
|
|
4646
|
+
retryable: typeof (execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable) === "boolean" ? execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable : void 0,
|
|
4647
|
+
rateLimitKey: typeof (execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key) === "string" ? execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key : void 0,
|
|
4648
|
+
observability: asRecord3(annotations?.observability ?? annotations?.contract?.observability),
|
|
4649
|
+
inputSchema: asObjectSchema(schemas?.input ?? t.inputSchema ?? t.input_schema ?? annotations?.contract?.input_schema),
|
|
4650
|
+
outputSchema: asObjectSchema(schemas?.output ?? t.outputSchema ?? t.output_schema ?? annotations?.contract?.output_schema),
|
|
4651
|
+
annotations
|
|
4652
|
+
};
|
|
4653
|
+
}
|
|
4589
4654
|
function asRecord3(value) {
|
|
4590
4655
|
return value && typeof value === "object" ? value : void 0;
|
|
4591
4656
|
}
|
|
@@ -4650,25 +4715,18 @@ var Signaliz = class {
|
|
|
4650
4715
|
}
|
|
4651
4716
|
/** List all available MCP tools */
|
|
4652
4717
|
async listTools() {
|
|
4718
|
+
try {
|
|
4719
|
+
const manifest = await this.client.mcp("tools/call", {
|
|
4720
|
+
name: "get_tool_manifest",
|
|
4721
|
+
arguments: { include_schemas: true }
|
|
4722
|
+
});
|
|
4723
|
+
const tools2 = manifest?.tools ?? manifest ?? [];
|
|
4724
|
+
if (Array.isArray(tools2)) return tools2.map(mapMcpToolInfo);
|
|
4725
|
+
} catch (_err) {
|
|
4726
|
+
}
|
|
4653
4727
|
const data = await this.client.mcp("tools/list", {});
|
|
4654
4728
|
const tools = data?.tools ?? data ?? [];
|
|
4655
|
-
return tools.map(
|
|
4656
|
-
name: typeof t.name === "string" ? t.name : "",
|
|
4657
|
-
description: String(t.description ?? "").slice(0, 120),
|
|
4658
|
-
category: typeof t.annotations?.category === "string" ? t.annotations.category : inferMcpToolCategory(t.name),
|
|
4659
|
-
costCredits: typeof t.annotations?.cost_credits === "number" ? t.annotations.cost_credits : void 0,
|
|
4660
|
-
contractVersion: typeof (t.annotations?.contract_version ?? t.annotations?.contract?.contract_version) === "string" ? t.annotations?.contract_version ?? t.annotations?.contract?.contract_version : void 0,
|
|
4661
|
-
permissionLevel: typeof (t.annotations?.permission_level ?? t.annotations?.contract?.permission_level) === "string" ? t.annotations?.permission_level ?? t.annotations?.contract?.permission_level : void 0,
|
|
4662
|
-
authScopes: asStringArray(t.annotations?.auth_scopes ?? t.annotations?.contract?.auth_scopes),
|
|
4663
|
-
idempotent: typeof (t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent) === "boolean" ? t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent : void 0,
|
|
4664
|
-
destructive: typeof (t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive) === "boolean" ? t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive : void 0,
|
|
4665
|
-
retryable: typeof (t.annotations?.retryable ?? t.annotations?.contract?.retryable) === "boolean" ? t.annotations?.retryable ?? t.annotations?.contract?.retryable : void 0,
|
|
4666
|
-
rateLimitKey: typeof (t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key) === "string" ? t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key : void 0,
|
|
4667
|
-
observability: asRecord3(t.annotations?.observability ?? t.annotations?.contract?.observability),
|
|
4668
|
-
inputSchema: asObjectSchema(t.inputSchema ?? t.input_schema ?? t.annotations?.contract?.input_schema),
|
|
4669
|
-
outputSchema: asObjectSchema(t.outputSchema ?? t.output_schema ?? t.annotations?.contract?.output_schema),
|
|
4670
|
-
annotations: asRecord3(t.annotations)
|
|
4671
|
-
}));
|
|
4729
|
+
return tools.map(mapMcpToolInfo);
|
|
4672
4730
|
}
|
|
4673
4731
|
/** Discover tools by natural language query */
|
|
4674
4732
|
async discover(query, category) {
|
package/dist/cli.js
CHANGED
|
@@ -287,7 +287,7 @@ function unwrapMcpResponse(data) {
|
|
|
287
287
|
function unwrapMcpPayload(payload) {
|
|
288
288
|
if (isRecord(payload)) {
|
|
289
289
|
if (payload.ok === true && Object.prototype.hasOwnProperty.call(payload, "result")) {
|
|
290
|
-
return payload.result;
|
|
290
|
+
return unwrapMcpPayload(payload.result);
|
|
291
291
|
}
|
|
292
292
|
if (payload.ok === false) {
|
|
293
293
|
const first = firstPayloadError(payload);
|
|
@@ -808,15 +808,17 @@ var Campaigns = class {
|
|
|
808
808
|
args.idempotency_key = options.idempotencyKey;
|
|
809
809
|
}
|
|
810
810
|
const data = await this.callMcp("build_campaign", args);
|
|
811
|
+
const isDryRun = request.dryRun === true || data.dry_run === true || data.status === "dry_run";
|
|
812
|
+
const message = data.message ?? data.summary ?? (isDryRun && data.planned_target_count !== void 0 && data.estimated_credits !== void 0 && data.estimated_duration_seconds !== void 0 ? `Dry-run plan: ${data.planned_target_count} fresh leads. ~${data.estimated_credits} credits, ~${data.estimated_duration_seconds}s.` : "");
|
|
811
813
|
return {
|
|
812
814
|
campaignBuildId: data.campaign_build_id ?? null,
|
|
813
815
|
campaignId: data.campaign_id ?? null,
|
|
814
816
|
campaignObject: data.campaign_object ?? null,
|
|
815
|
-
status:
|
|
816
|
-
currentPhase:
|
|
817
|
+
status: isDryRun ? "dry_run" : data.status ?? "queued",
|
|
818
|
+
currentPhase: isDryRun ? "plan" : data.current_phase ?? "acquisition",
|
|
817
819
|
nextPollAfterSeconds: data.next_poll_after_seconds ?? 10,
|
|
818
|
-
message
|
|
819
|
-
dryRun:
|
|
820
|
+
message,
|
|
821
|
+
dryRun: isDryRun,
|
|
820
822
|
requestedTargetCount: data.requested_target_count,
|
|
821
823
|
plannedTargetCount: data.planned_target_count,
|
|
822
824
|
estimatedCredits: data.estimated_credits,
|
|
@@ -930,11 +932,11 @@ function mapStatus(data) {
|
|
|
930
932
|
recordsProcessed: data.records_processed ?? 0,
|
|
931
933
|
recordsSucceeded: data.records_succeeded ?? 0,
|
|
932
934
|
recordsFailed: data.records_failed ?? 0,
|
|
933
|
-
warnings: data.warnings
|
|
934
|
-
errors: data.errors
|
|
935
|
+
warnings: diagnosticMessages(data.warnings),
|
|
936
|
+
errors: diagnosticMessages(data.errors),
|
|
935
937
|
artifactCount: data.artifact_count ?? 0,
|
|
936
938
|
providerRoute: mapProviderRoute(data),
|
|
937
|
-
nextAction: data.next_action
|
|
939
|
+
nextAction: formatNextAction(data.next_action),
|
|
938
940
|
createdAt: data.created_at,
|
|
939
941
|
updatedAt: data.updated_at,
|
|
940
942
|
completedAt: data.completed_at
|
|
@@ -966,6 +968,27 @@ function recordOrNull(value) {
|
|
|
966
968
|
function stringArray(value) {
|
|
967
969
|
return Array.isArray(value) ? value.map((item) => String(item || "").trim()).filter(Boolean) : [];
|
|
968
970
|
}
|
|
971
|
+
function diagnosticMessages(value) {
|
|
972
|
+
if (!Array.isArray(value)) return [];
|
|
973
|
+
return value.map((item) => {
|
|
974
|
+
if (typeof item === "string") return item;
|
|
975
|
+
const record = recordOrNull(item);
|
|
976
|
+
return typeof record?.message === "string" ? record.message : null;
|
|
977
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
978
|
+
}
|
|
979
|
+
function formatNextAction(value) {
|
|
980
|
+
if (!value) return "";
|
|
981
|
+
if (typeof value === "string") return value;
|
|
982
|
+
const record = recordOrNull(value);
|
|
983
|
+
if (!record) return "";
|
|
984
|
+
const tool = typeof record.tool === "string" ? record.tool : void 0;
|
|
985
|
+
const type = typeof record.type === "string" ? record.type : void 0;
|
|
986
|
+
const reason = typeof record.reason === "string" ? record.reason : void 0;
|
|
987
|
+
const args = recordOrNull(record.arguments);
|
|
988
|
+
const argText = args && Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : "";
|
|
989
|
+
const action = tool ? `${tool}${argText}` : type || "";
|
|
990
|
+
return [action, reason].filter(Boolean).join(" \u2014 ");
|
|
991
|
+
}
|
|
969
992
|
function booleanOrNull(value) {
|
|
970
993
|
return typeof value === "boolean" ? value : null;
|
|
971
994
|
}
|
|
@@ -2286,22 +2309,22 @@ function queryFieldFor(kind) {
|
|
|
2286
2309
|
function statusCommandFor(kind, id) {
|
|
2287
2310
|
switch (kind) {
|
|
2288
2311
|
case "op":
|
|
2289
|
-
return `signaliz status ${id}`;
|
|
2312
|
+
return `signaliz ops status ${id}`;
|
|
2290
2313
|
case "trigger_run":
|
|
2291
2314
|
case "dataplane_run":
|
|
2292
2315
|
case "replay_run":
|
|
2293
|
-
return `signaliz
|
|
2316
|
+
return `signaliz ops run-status ${id} --watch`;
|
|
2294
2317
|
case "queue_job":
|
|
2295
|
-
return `signaliz queue --job-id ${id}`;
|
|
2318
|
+
return `signaliz ops queue --job-id ${id}`;
|
|
2296
2319
|
case "routine":
|
|
2297
|
-
return `signaliz routine ${id}`;
|
|
2320
|
+
return `signaliz ops routine ${id}`;
|
|
2298
2321
|
default:
|
|
2299
2322
|
return void 0;
|
|
2300
2323
|
}
|
|
2301
2324
|
}
|
|
2302
2325
|
function replayCommandFor(kind, id) {
|
|
2303
2326
|
if (kind !== "execution_event") return void 0;
|
|
2304
|
-
return `signaliz replay ${id}`;
|
|
2327
|
+
return `signaliz ops replay ${id}`;
|
|
2305
2328
|
}
|
|
2306
2329
|
|
|
2307
2330
|
// src/resources/ops.ts
|
|
@@ -3838,6 +3861,25 @@ var GtmKernel = class {
|
|
|
3838
3861
|
write_routine_outcomes: input.writeRoutineOutcomes
|
|
3839
3862
|
});
|
|
3840
3863
|
}
|
|
3864
|
+
/** Run a read-only Campaign Audit and persist workspace-scoped failure findings. */
|
|
3865
|
+
async runCampaignAudit(input) {
|
|
3866
|
+
return this.callMcp("gtm_campaign_audit_run", {
|
|
3867
|
+
provider: input.provider,
|
|
3868
|
+
provider_campaign_id: input.providerCampaignId,
|
|
3869
|
+
campaign_id: input.campaignId,
|
|
3870
|
+
campaign_name: input.campaignName,
|
|
3871
|
+
lookback_days: input.lookbackDays,
|
|
3872
|
+
limit_findings: input.limitFindings
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
3875
|
+
/** Read a persisted Campaign Audit by audit id or campaign id. */
|
|
3876
|
+
async getCampaignAudit(options) {
|
|
3877
|
+
return this.callMcp("gtm_campaign_audit_get", {
|
|
3878
|
+
audit_id: options.auditId,
|
|
3879
|
+
campaign_id: options.campaignId,
|
|
3880
|
+
limit_findings: options.limitFindings
|
|
3881
|
+
});
|
|
3882
|
+
}
|
|
3841
3883
|
/** Normalize Instantly webhook/pull payloads and ingest row-level feedback through the GTM Kernel. */
|
|
3842
3884
|
async syncInstantlyFeedback(input) {
|
|
3843
3885
|
return this.callMcp("gtm_instantly_feedback_sync", {
|
|
@@ -4582,6 +4624,29 @@ function inferMcpToolCategory(toolName) {
|
|
|
4582
4624
|
if (toolName.includes("agent") || toolName.includes("platform_health") || toolName === "discover_capabilities") return "observability";
|
|
4583
4625
|
return void 0;
|
|
4584
4626
|
}
|
|
4627
|
+
function mapMcpToolInfo(t) {
|
|
4628
|
+
const annotations = asRecord3(t.annotations);
|
|
4629
|
+
const execution = asRecord3(t.execution);
|
|
4630
|
+
const schemas = asRecord3(t.schemas);
|
|
4631
|
+
const name = typeof t.name === "string" ? t.name : typeof t.id === "string" ? t.id : "";
|
|
4632
|
+
return {
|
|
4633
|
+
name,
|
|
4634
|
+
description: String(t.description ?? t.short_description ?? "").slice(0, 120),
|
|
4635
|
+
category: typeof t.category === "string" ? t.category : typeof annotations?.category === "string" ? annotations.category : inferMcpToolCategory(name),
|
|
4636
|
+
costCredits: typeof (execution?.cost_credits ?? annotations?.cost_credits) === "number" ? execution?.cost_credits ?? annotations?.cost_credits : void 0,
|
|
4637
|
+
contractVersion: typeof t.contract_version === "string" ? t.contract_version : typeof (annotations?.contract_version ?? annotations?.contract?.contract_version) === "string" ? annotations?.contract_version ?? annotations?.contract?.contract_version : void 0,
|
|
4638
|
+
permissionLevel: typeof (execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level) === "string" ? execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level : void 0,
|
|
4639
|
+
authScopes: asStringArray(execution?.auth_scopes ?? annotations?.auth_scopes ?? annotations?.contract?.auth_scopes),
|
|
4640
|
+
idempotent: typeof (execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent) === "boolean" ? execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent : void 0,
|
|
4641
|
+
destructive: typeof (execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive) === "boolean" ? execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive : void 0,
|
|
4642
|
+
retryable: typeof (execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable) === "boolean" ? execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable : void 0,
|
|
4643
|
+
rateLimitKey: typeof (execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key) === "string" ? execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key : void 0,
|
|
4644
|
+
observability: asRecord3(annotations?.observability ?? annotations?.contract?.observability),
|
|
4645
|
+
inputSchema: asObjectSchema(schemas?.input ?? t.inputSchema ?? t.input_schema ?? annotations?.contract?.input_schema),
|
|
4646
|
+
outputSchema: asObjectSchema(schemas?.output ?? t.outputSchema ?? t.output_schema ?? annotations?.contract?.output_schema),
|
|
4647
|
+
annotations
|
|
4648
|
+
};
|
|
4649
|
+
}
|
|
4585
4650
|
function asRecord3(value) {
|
|
4586
4651
|
return value && typeof value === "object" ? value : void 0;
|
|
4587
4652
|
}
|
|
@@ -4646,25 +4711,18 @@ var Signaliz = class {
|
|
|
4646
4711
|
}
|
|
4647
4712
|
/** List all available MCP tools */
|
|
4648
4713
|
async listTools() {
|
|
4714
|
+
try {
|
|
4715
|
+
const manifest = await this.client.mcp("tools/call", {
|
|
4716
|
+
name: "get_tool_manifest",
|
|
4717
|
+
arguments: { include_schemas: true }
|
|
4718
|
+
});
|
|
4719
|
+
const tools2 = manifest?.tools ?? manifest ?? [];
|
|
4720
|
+
if (Array.isArray(tools2)) return tools2.map(mapMcpToolInfo);
|
|
4721
|
+
} catch (_err) {
|
|
4722
|
+
}
|
|
4649
4723
|
const data = await this.client.mcp("tools/list", {});
|
|
4650
4724
|
const tools = data?.tools ?? data ?? [];
|
|
4651
|
-
return tools.map(
|
|
4652
|
-
name: typeof t.name === "string" ? t.name : "",
|
|
4653
|
-
description: String(t.description ?? "").slice(0, 120),
|
|
4654
|
-
category: typeof t.annotations?.category === "string" ? t.annotations.category : inferMcpToolCategory(t.name),
|
|
4655
|
-
costCredits: typeof t.annotations?.cost_credits === "number" ? t.annotations.cost_credits : void 0,
|
|
4656
|
-
contractVersion: typeof (t.annotations?.contract_version ?? t.annotations?.contract?.contract_version) === "string" ? t.annotations?.contract_version ?? t.annotations?.contract?.contract_version : void 0,
|
|
4657
|
-
permissionLevel: typeof (t.annotations?.permission_level ?? t.annotations?.contract?.permission_level) === "string" ? t.annotations?.permission_level ?? t.annotations?.contract?.permission_level : void 0,
|
|
4658
|
-
authScopes: asStringArray(t.annotations?.auth_scopes ?? t.annotations?.contract?.auth_scopes),
|
|
4659
|
-
idempotent: typeof (t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent) === "boolean" ? t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent : void 0,
|
|
4660
|
-
destructive: typeof (t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive) === "boolean" ? t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive : void 0,
|
|
4661
|
-
retryable: typeof (t.annotations?.retryable ?? t.annotations?.contract?.retryable) === "boolean" ? t.annotations?.retryable ?? t.annotations?.contract?.retryable : void 0,
|
|
4662
|
-
rateLimitKey: typeof (t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key) === "string" ? t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key : void 0,
|
|
4663
|
-
observability: asRecord3(t.annotations?.observability ?? t.annotations?.contract?.observability),
|
|
4664
|
-
inputSchema: asObjectSchema(t.inputSchema ?? t.input_schema ?? t.annotations?.contract?.input_schema),
|
|
4665
|
-
outputSchema: asObjectSchema(t.outputSchema ?? t.output_schema ?? t.annotations?.contract?.output_schema),
|
|
4666
|
-
annotations: asRecord3(t.annotations)
|
|
4667
|
-
}));
|
|
4725
|
+
return tools.map(mapMcpToolInfo);
|
|
4668
4726
|
}
|
|
4669
4727
|
/** Discover tools by natural language query */
|
|
4670
4728
|
async discover(query, category) {
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -2408,6 +2408,19 @@ interface GtmFeedbackIngestInput {
|
|
|
2408
2408
|
createMemory?: boolean;
|
|
2409
2409
|
writeRoutineOutcomes?: boolean;
|
|
2410
2410
|
}
|
|
2411
|
+
interface GtmCampaignAuditRunInput {
|
|
2412
|
+
provider: 'instantly' | 'heyreach' | 'smartlead' | 'custom';
|
|
2413
|
+
providerCampaignId?: string;
|
|
2414
|
+
campaignId?: string;
|
|
2415
|
+
campaignName?: string;
|
|
2416
|
+
lookbackDays?: number;
|
|
2417
|
+
limitFindings?: number;
|
|
2418
|
+
}
|
|
2419
|
+
interface GtmCampaignAuditGetOptions {
|
|
2420
|
+
auditId?: string;
|
|
2421
|
+
campaignId?: string;
|
|
2422
|
+
limitFindings?: number;
|
|
2423
|
+
}
|
|
2411
2424
|
interface GtmInstantlyFeedbackSyncInput {
|
|
2412
2425
|
campaignId?: string;
|
|
2413
2426
|
campaignBuildId?: string;
|
|
@@ -3002,6 +3015,10 @@ declare class GtmKernel {
|
|
|
3002
3015
|
logCampaign(campaignId: string, input: Omit<GtmCampaignLogInput, 'campaignId'>): Promise<any>;
|
|
3003
3016
|
/** Ingest provider-neutral feedback from Instantly, Smartlead, HeyReach, webhook, or a custom MCP. */
|
|
3004
3017
|
ingestFeedback(input: GtmFeedbackIngestInput): Promise<any>;
|
|
3018
|
+
/** Run a read-only Campaign Audit and persist workspace-scoped failure findings. */
|
|
3019
|
+
runCampaignAudit(input: GtmCampaignAuditRunInput): Promise<any>;
|
|
3020
|
+
/** Read a persisted Campaign Audit by audit id or campaign id. */
|
|
3021
|
+
getCampaignAudit(options: GtmCampaignAuditGetOptions): Promise<any>;
|
|
3005
3022
|
/** Normalize Instantly webhook/pull payloads and ingest row-level feedback through the GTM Kernel. */
|
|
3006
3023
|
syncInstantlyFeedback(input: GtmInstantlyFeedbackSyncInput): Promise<any>;
|
|
3007
3024
|
/** Start a background Instantly webhook-events pull and route results into the GTM feedback loop. */
|
package/dist/index.d.ts
CHANGED
|
@@ -2408,6 +2408,19 @@ interface GtmFeedbackIngestInput {
|
|
|
2408
2408
|
createMemory?: boolean;
|
|
2409
2409
|
writeRoutineOutcomes?: boolean;
|
|
2410
2410
|
}
|
|
2411
|
+
interface GtmCampaignAuditRunInput {
|
|
2412
|
+
provider: 'instantly' | 'heyreach' | 'smartlead' | 'custom';
|
|
2413
|
+
providerCampaignId?: string;
|
|
2414
|
+
campaignId?: string;
|
|
2415
|
+
campaignName?: string;
|
|
2416
|
+
lookbackDays?: number;
|
|
2417
|
+
limitFindings?: number;
|
|
2418
|
+
}
|
|
2419
|
+
interface GtmCampaignAuditGetOptions {
|
|
2420
|
+
auditId?: string;
|
|
2421
|
+
campaignId?: string;
|
|
2422
|
+
limitFindings?: number;
|
|
2423
|
+
}
|
|
2411
2424
|
interface GtmInstantlyFeedbackSyncInput {
|
|
2412
2425
|
campaignId?: string;
|
|
2413
2426
|
campaignBuildId?: string;
|
|
@@ -3002,6 +3015,10 @@ declare class GtmKernel {
|
|
|
3002
3015
|
logCampaign(campaignId: string, input: Omit<GtmCampaignLogInput, 'campaignId'>): Promise<any>;
|
|
3003
3016
|
/** Ingest provider-neutral feedback from Instantly, Smartlead, HeyReach, webhook, or a custom MCP. */
|
|
3004
3017
|
ingestFeedback(input: GtmFeedbackIngestInput): Promise<any>;
|
|
3018
|
+
/** Run a read-only Campaign Audit and persist workspace-scoped failure findings. */
|
|
3019
|
+
runCampaignAudit(input: GtmCampaignAuditRunInput): Promise<any>;
|
|
3020
|
+
/** Read a persisted Campaign Audit by audit id or campaign id. */
|
|
3021
|
+
getCampaignAudit(options: GtmCampaignAuditGetOptions): Promise<any>;
|
|
3005
3022
|
/** Normalize Instantly webhook/pull payloads and ingest row-level feedback through the GTM Kernel. */
|
|
3006
3023
|
syncInstantlyFeedback(input: GtmInstantlyFeedbackSyncInput): Promise<any>;
|
|
3007
3024
|
/** Start a background Instantly webhook-events pull and route results into the GTM feedback loop. */
|
package/dist/index.js
CHANGED
|
@@ -323,7 +323,7 @@ function unwrapMcpResponse(data) {
|
|
|
323
323
|
function unwrapMcpPayload(payload) {
|
|
324
324
|
if (isRecord(payload)) {
|
|
325
325
|
if (payload.ok === true && Object.prototype.hasOwnProperty.call(payload, "result")) {
|
|
326
|
-
return payload.result;
|
|
326
|
+
return unwrapMcpPayload(payload.result);
|
|
327
327
|
}
|
|
328
328
|
if (payload.ok === false) {
|
|
329
329
|
const first = firstPayloadError(payload);
|
|
@@ -844,15 +844,17 @@ var Campaigns = class {
|
|
|
844
844
|
args.idempotency_key = options.idempotencyKey;
|
|
845
845
|
}
|
|
846
846
|
const data = await this.callMcp("build_campaign", args);
|
|
847
|
+
const isDryRun = request.dryRun === true || data.dry_run === true || data.status === "dry_run";
|
|
848
|
+
const message = data.message ?? data.summary ?? (isDryRun && data.planned_target_count !== void 0 && data.estimated_credits !== void 0 && data.estimated_duration_seconds !== void 0 ? `Dry-run plan: ${data.planned_target_count} fresh leads. ~${data.estimated_credits} credits, ~${data.estimated_duration_seconds}s.` : "");
|
|
847
849
|
return {
|
|
848
850
|
campaignBuildId: data.campaign_build_id ?? null,
|
|
849
851
|
campaignId: data.campaign_id ?? null,
|
|
850
852
|
campaignObject: data.campaign_object ?? null,
|
|
851
|
-
status:
|
|
852
|
-
currentPhase:
|
|
853
|
+
status: isDryRun ? "dry_run" : data.status ?? "queued",
|
|
854
|
+
currentPhase: isDryRun ? "plan" : data.current_phase ?? "acquisition",
|
|
853
855
|
nextPollAfterSeconds: data.next_poll_after_seconds ?? 10,
|
|
854
|
-
message
|
|
855
|
-
dryRun:
|
|
856
|
+
message,
|
|
857
|
+
dryRun: isDryRun,
|
|
856
858
|
requestedTargetCount: data.requested_target_count,
|
|
857
859
|
plannedTargetCount: data.planned_target_count,
|
|
858
860
|
estimatedCredits: data.estimated_credits,
|
|
@@ -966,11 +968,11 @@ function mapStatus(data) {
|
|
|
966
968
|
recordsProcessed: data.records_processed ?? 0,
|
|
967
969
|
recordsSucceeded: data.records_succeeded ?? 0,
|
|
968
970
|
recordsFailed: data.records_failed ?? 0,
|
|
969
|
-
warnings: data.warnings
|
|
970
|
-
errors: data.errors
|
|
971
|
+
warnings: diagnosticMessages(data.warnings),
|
|
972
|
+
errors: diagnosticMessages(data.errors),
|
|
971
973
|
artifactCount: data.artifact_count ?? 0,
|
|
972
974
|
providerRoute: mapProviderRoute(data),
|
|
973
|
-
nextAction: data.next_action
|
|
975
|
+
nextAction: formatNextAction(data.next_action),
|
|
974
976
|
createdAt: data.created_at,
|
|
975
977
|
updatedAt: data.updated_at,
|
|
976
978
|
completedAt: data.completed_at
|
|
@@ -1002,6 +1004,27 @@ function recordOrNull(value) {
|
|
|
1002
1004
|
function stringArray(value) {
|
|
1003
1005
|
return Array.isArray(value) ? value.map((item) => String(item || "").trim()).filter(Boolean) : [];
|
|
1004
1006
|
}
|
|
1007
|
+
function diagnosticMessages(value) {
|
|
1008
|
+
if (!Array.isArray(value)) return [];
|
|
1009
|
+
return value.map((item) => {
|
|
1010
|
+
if (typeof item === "string") return item;
|
|
1011
|
+
const record = recordOrNull(item);
|
|
1012
|
+
return typeof record?.message === "string" ? record.message : null;
|
|
1013
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
1014
|
+
}
|
|
1015
|
+
function formatNextAction(value) {
|
|
1016
|
+
if (!value) return "";
|
|
1017
|
+
if (typeof value === "string") return value;
|
|
1018
|
+
const record = recordOrNull(value);
|
|
1019
|
+
if (!record) return "";
|
|
1020
|
+
const tool = typeof record.tool === "string" ? record.tool : void 0;
|
|
1021
|
+
const type = typeof record.type === "string" ? record.type : void 0;
|
|
1022
|
+
const reason = typeof record.reason === "string" ? record.reason : void 0;
|
|
1023
|
+
const args = recordOrNull(record.arguments);
|
|
1024
|
+
const argText = args && Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : "";
|
|
1025
|
+
const action = tool ? `${tool}${argText}` : type || "";
|
|
1026
|
+
return [action, reason].filter(Boolean).join(" \u2014 ");
|
|
1027
|
+
}
|
|
1005
1028
|
function booleanOrNull(value) {
|
|
1006
1029
|
return typeof value === "boolean" ? value : null;
|
|
1007
1030
|
}
|
|
@@ -2329,22 +2352,22 @@ function queryFieldFor(kind) {
|
|
|
2329
2352
|
function statusCommandFor(kind, id) {
|
|
2330
2353
|
switch (kind) {
|
|
2331
2354
|
case "op":
|
|
2332
|
-
return `signaliz status ${id}`;
|
|
2355
|
+
return `signaliz ops status ${id}`;
|
|
2333
2356
|
case "trigger_run":
|
|
2334
2357
|
case "dataplane_run":
|
|
2335
2358
|
case "replay_run":
|
|
2336
|
-
return `signaliz
|
|
2359
|
+
return `signaliz ops run-status ${id} --watch`;
|
|
2337
2360
|
case "queue_job":
|
|
2338
|
-
return `signaliz queue --job-id ${id}`;
|
|
2361
|
+
return `signaliz ops queue --job-id ${id}`;
|
|
2339
2362
|
case "routine":
|
|
2340
|
-
return `signaliz routine ${id}`;
|
|
2363
|
+
return `signaliz ops routine ${id}`;
|
|
2341
2364
|
default:
|
|
2342
2365
|
return void 0;
|
|
2343
2366
|
}
|
|
2344
2367
|
}
|
|
2345
2368
|
function replayCommandFor(kind, id) {
|
|
2346
2369
|
if (kind !== "execution_event") return void 0;
|
|
2347
|
-
return `signaliz replay ${id}`;
|
|
2370
|
+
return `signaliz ops replay ${id}`;
|
|
2348
2371
|
}
|
|
2349
2372
|
|
|
2350
2373
|
// src/resources/ops.ts
|
|
@@ -3881,6 +3904,25 @@ var GtmKernel = class {
|
|
|
3881
3904
|
write_routine_outcomes: input.writeRoutineOutcomes
|
|
3882
3905
|
});
|
|
3883
3906
|
}
|
|
3907
|
+
/** Run a read-only Campaign Audit and persist workspace-scoped failure findings. */
|
|
3908
|
+
async runCampaignAudit(input) {
|
|
3909
|
+
return this.callMcp("gtm_campaign_audit_run", {
|
|
3910
|
+
provider: input.provider,
|
|
3911
|
+
provider_campaign_id: input.providerCampaignId,
|
|
3912
|
+
campaign_id: input.campaignId,
|
|
3913
|
+
campaign_name: input.campaignName,
|
|
3914
|
+
lookback_days: input.lookbackDays,
|
|
3915
|
+
limit_findings: input.limitFindings
|
|
3916
|
+
});
|
|
3917
|
+
}
|
|
3918
|
+
/** Read a persisted Campaign Audit by audit id or campaign id. */
|
|
3919
|
+
async getCampaignAudit(options) {
|
|
3920
|
+
return this.callMcp("gtm_campaign_audit_get", {
|
|
3921
|
+
audit_id: options.auditId,
|
|
3922
|
+
campaign_id: options.campaignId,
|
|
3923
|
+
limit_findings: options.limitFindings
|
|
3924
|
+
});
|
|
3925
|
+
}
|
|
3884
3926
|
/** Normalize Instantly webhook/pull payloads and ingest row-level feedback through the GTM Kernel. */
|
|
3885
3927
|
async syncInstantlyFeedback(input) {
|
|
3886
3928
|
return this.callMcp("gtm_instantly_feedback_sync", {
|
|
@@ -4625,6 +4667,29 @@ function inferMcpToolCategory(toolName) {
|
|
|
4625
4667
|
if (toolName.includes("agent") || toolName.includes("platform_health") || toolName === "discover_capabilities") return "observability";
|
|
4626
4668
|
return void 0;
|
|
4627
4669
|
}
|
|
4670
|
+
function mapMcpToolInfo(t) {
|
|
4671
|
+
const annotations = asRecord3(t.annotations);
|
|
4672
|
+
const execution = asRecord3(t.execution);
|
|
4673
|
+
const schemas = asRecord3(t.schemas);
|
|
4674
|
+
const name = typeof t.name === "string" ? t.name : typeof t.id === "string" ? t.id : "";
|
|
4675
|
+
return {
|
|
4676
|
+
name,
|
|
4677
|
+
description: String(t.description ?? t.short_description ?? "").slice(0, 120),
|
|
4678
|
+
category: typeof t.category === "string" ? t.category : typeof annotations?.category === "string" ? annotations.category : inferMcpToolCategory(name),
|
|
4679
|
+
costCredits: typeof (execution?.cost_credits ?? annotations?.cost_credits) === "number" ? execution?.cost_credits ?? annotations?.cost_credits : void 0,
|
|
4680
|
+
contractVersion: typeof t.contract_version === "string" ? t.contract_version : typeof (annotations?.contract_version ?? annotations?.contract?.contract_version) === "string" ? annotations?.contract_version ?? annotations?.contract?.contract_version : void 0,
|
|
4681
|
+
permissionLevel: typeof (execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level) === "string" ? execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level : void 0,
|
|
4682
|
+
authScopes: asStringArray(execution?.auth_scopes ?? annotations?.auth_scopes ?? annotations?.contract?.auth_scopes),
|
|
4683
|
+
idempotent: typeof (execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent) === "boolean" ? execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent : void 0,
|
|
4684
|
+
destructive: typeof (execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive) === "boolean" ? execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive : void 0,
|
|
4685
|
+
retryable: typeof (execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable) === "boolean" ? execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable : void 0,
|
|
4686
|
+
rateLimitKey: typeof (execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key) === "string" ? execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key : void 0,
|
|
4687
|
+
observability: asRecord3(annotations?.observability ?? annotations?.contract?.observability),
|
|
4688
|
+
inputSchema: asObjectSchema(schemas?.input ?? t.inputSchema ?? t.input_schema ?? annotations?.contract?.input_schema),
|
|
4689
|
+
outputSchema: asObjectSchema(schemas?.output ?? t.outputSchema ?? t.output_schema ?? annotations?.contract?.output_schema),
|
|
4690
|
+
annotations
|
|
4691
|
+
};
|
|
4692
|
+
}
|
|
4628
4693
|
function asRecord3(value) {
|
|
4629
4694
|
return value && typeof value === "object" ? value : void 0;
|
|
4630
4695
|
}
|
|
@@ -4689,25 +4754,18 @@ var Signaliz = class {
|
|
|
4689
4754
|
}
|
|
4690
4755
|
/** List all available MCP tools */
|
|
4691
4756
|
async listTools() {
|
|
4757
|
+
try {
|
|
4758
|
+
const manifest = await this.client.mcp("tools/call", {
|
|
4759
|
+
name: "get_tool_manifest",
|
|
4760
|
+
arguments: { include_schemas: true }
|
|
4761
|
+
});
|
|
4762
|
+
const tools2 = manifest?.tools ?? manifest ?? [];
|
|
4763
|
+
if (Array.isArray(tools2)) return tools2.map(mapMcpToolInfo);
|
|
4764
|
+
} catch (_err) {
|
|
4765
|
+
}
|
|
4692
4766
|
const data = await this.client.mcp("tools/list", {});
|
|
4693
4767
|
const tools = data?.tools ?? data ?? [];
|
|
4694
|
-
return tools.map(
|
|
4695
|
-
name: typeof t.name === "string" ? t.name : "",
|
|
4696
|
-
description: String(t.description ?? "").slice(0, 120),
|
|
4697
|
-
category: typeof t.annotations?.category === "string" ? t.annotations.category : inferMcpToolCategory(t.name),
|
|
4698
|
-
costCredits: typeof t.annotations?.cost_credits === "number" ? t.annotations.cost_credits : void 0,
|
|
4699
|
-
contractVersion: typeof (t.annotations?.contract_version ?? t.annotations?.contract?.contract_version) === "string" ? t.annotations?.contract_version ?? t.annotations?.contract?.contract_version : void 0,
|
|
4700
|
-
permissionLevel: typeof (t.annotations?.permission_level ?? t.annotations?.contract?.permission_level) === "string" ? t.annotations?.permission_level ?? t.annotations?.contract?.permission_level : void 0,
|
|
4701
|
-
authScopes: asStringArray(t.annotations?.auth_scopes ?? t.annotations?.contract?.auth_scopes),
|
|
4702
|
-
idempotent: typeof (t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent) === "boolean" ? t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent : void 0,
|
|
4703
|
-
destructive: typeof (t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive) === "boolean" ? t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive : void 0,
|
|
4704
|
-
retryable: typeof (t.annotations?.retryable ?? t.annotations?.contract?.retryable) === "boolean" ? t.annotations?.retryable ?? t.annotations?.contract?.retryable : void 0,
|
|
4705
|
-
rateLimitKey: typeof (t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key) === "string" ? t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key : void 0,
|
|
4706
|
-
observability: asRecord3(t.annotations?.observability ?? t.annotations?.contract?.observability),
|
|
4707
|
-
inputSchema: asObjectSchema(t.inputSchema ?? t.input_schema ?? t.annotations?.contract?.input_schema),
|
|
4708
|
-
outputSchema: asObjectSchema(t.outputSchema ?? t.output_schema ?? t.annotations?.contract?.output_schema),
|
|
4709
|
-
annotations: asRecord3(t.annotations)
|
|
4710
|
-
}));
|
|
4768
|
+
return tools.map(mapMcpToolInfo);
|
|
4711
4769
|
}
|
|
4712
4770
|
/** Discover tools by natural language query */
|
|
4713
4771
|
async discover(query, category) {
|
package/dist/index.mjs
CHANGED
package/dist/mcp-config.js
CHANGED
|
@@ -315,7 +315,7 @@ function unwrapMcpResponse(data) {
|
|
|
315
315
|
function unwrapMcpPayload(payload) {
|
|
316
316
|
if (isRecord(payload)) {
|
|
317
317
|
if (payload.ok === true && Object.prototype.hasOwnProperty.call(payload, "result")) {
|
|
318
|
-
return payload.result;
|
|
318
|
+
return unwrapMcpPayload(payload.result);
|
|
319
319
|
}
|
|
320
320
|
if (payload.ok === false) {
|
|
321
321
|
const first = firstPayloadError(payload);
|
|
@@ -836,15 +836,17 @@ var Campaigns = class {
|
|
|
836
836
|
args.idempotency_key = options.idempotencyKey;
|
|
837
837
|
}
|
|
838
838
|
const data = await this.callMcp("build_campaign", args);
|
|
839
|
+
const isDryRun = request.dryRun === true || data.dry_run === true || data.status === "dry_run";
|
|
840
|
+
const message = data.message ?? data.summary ?? (isDryRun && data.planned_target_count !== void 0 && data.estimated_credits !== void 0 && data.estimated_duration_seconds !== void 0 ? `Dry-run plan: ${data.planned_target_count} fresh leads. ~${data.estimated_credits} credits, ~${data.estimated_duration_seconds}s.` : "");
|
|
839
841
|
return {
|
|
840
842
|
campaignBuildId: data.campaign_build_id ?? null,
|
|
841
843
|
campaignId: data.campaign_id ?? null,
|
|
842
844
|
campaignObject: data.campaign_object ?? null,
|
|
843
|
-
status:
|
|
844
|
-
currentPhase:
|
|
845
|
+
status: isDryRun ? "dry_run" : data.status ?? "queued",
|
|
846
|
+
currentPhase: isDryRun ? "plan" : data.current_phase ?? "acquisition",
|
|
845
847
|
nextPollAfterSeconds: data.next_poll_after_seconds ?? 10,
|
|
846
|
-
message
|
|
847
|
-
dryRun:
|
|
848
|
+
message,
|
|
849
|
+
dryRun: isDryRun,
|
|
848
850
|
requestedTargetCount: data.requested_target_count,
|
|
849
851
|
plannedTargetCount: data.planned_target_count,
|
|
850
852
|
estimatedCredits: data.estimated_credits,
|
|
@@ -958,11 +960,11 @@ function mapStatus(data) {
|
|
|
958
960
|
recordsProcessed: data.records_processed ?? 0,
|
|
959
961
|
recordsSucceeded: data.records_succeeded ?? 0,
|
|
960
962
|
recordsFailed: data.records_failed ?? 0,
|
|
961
|
-
warnings: data.warnings
|
|
962
|
-
errors: data.errors
|
|
963
|
+
warnings: diagnosticMessages(data.warnings),
|
|
964
|
+
errors: diagnosticMessages(data.errors),
|
|
963
965
|
artifactCount: data.artifact_count ?? 0,
|
|
964
966
|
providerRoute: mapProviderRoute(data),
|
|
965
|
-
nextAction: data.next_action
|
|
967
|
+
nextAction: formatNextAction(data.next_action),
|
|
966
968
|
createdAt: data.created_at,
|
|
967
969
|
updatedAt: data.updated_at,
|
|
968
970
|
completedAt: data.completed_at
|
|
@@ -994,6 +996,27 @@ function recordOrNull(value) {
|
|
|
994
996
|
function stringArray(value) {
|
|
995
997
|
return Array.isArray(value) ? value.map((item) => String(item || "").trim()).filter(Boolean) : [];
|
|
996
998
|
}
|
|
999
|
+
function diagnosticMessages(value) {
|
|
1000
|
+
if (!Array.isArray(value)) return [];
|
|
1001
|
+
return value.map((item) => {
|
|
1002
|
+
if (typeof item === "string") return item;
|
|
1003
|
+
const record = recordOrNull(item);
|
|
1004
|
+
return typeof record?.message === "string" ? record.message : null;
|
|
1005
|
+
}).filter((item) => typeof item === "string" && item.length > 0);
|
|
1006
|
+
}
|
|
1007
|
+
function formatNextAction(value) {
|
|
1008
|
+
if (!value) return "";
|
|
1009
|
+
if (typeof value === "string") return value;
|
|
1010
|
+
const record = recordOrNull(value);
|
|
1011
|
+
if (!record) return "";
|
|
1012
|
+
const tool = typeof record.tool === "string" ? record.tool : void 0;
|
|
1013
|
+
const type = typeof record.type === "string" ? record.type : void 0;
|
|
1014
|
+
const reason = typeof record.reason === "string" ? record.reason : void 0;
|
|
1015
|
+
const args = recordOrNull(record.arguments);
|
|
1016
|
+
const argText = args && Object.keys(args).length > 0 ? ` ${JSON.stringify(args)}` : "";
|
|
1017
|
+
const action = tool ? `${tool}${argText}` : type || "";
|
|
1018
|
+
return [action, reason].filter(Boolean).join(" \u2014 ");
|
|
1019
|
+
}
|
|
997
1020
|
function booleanOrNull(value) {
|
|
998
1021
|
return typeof value === "boolean" ? value : null;
|
|
999
1022
|
}
|
|
@@ -2314,22 +2337,22 @@ function queryFieldFor(kind) {
|
|
|
2314
2337
|
function statusCommandFor(kind, id) {
|
|
2315
2338
|
switch (kind) {
|
|
2316
2339
|
case "op":
|
|
2317
|
-
return `signaliz status ${id}`;
|
|
2340
|
+
return `signaliz ops status ${id}`;
|
|
2318
2341
|
case "trigger_run":
|
|
2319
2342
|
case "dataplane_run":
|
|
2320
2343
|
case "replay_run":
|
|
2321
|
-
return `signaliz
|
|
2344
|
+
return `signaliz ops run-status ${id} --watch`;
|
|
2322
2345
|
case "queue_job":
|
|
2323
|
-
return `signaliz queue --job-id ${id}`;
|
|
2346
|
+
return `signaliz ops queue --job-id ${id}`;
|
|
2324
2347
|
case "routine":
|
|
2325
|
-
return `signaliz routine ${id}`;
|
|
2348
|
+
return `signaliz ops routine ${id}`;
|
|
2326
2349
|
default:
|
|
2327
2350
|
return void 0;
|
|
2328
2351
|
}
|
|
2329
2352
|
}
|
|
2330
2353
|
function replayCommandFor(kind, id) {
|
|
2331
2354
|
if (kind !== "execution_event") return void 0;
|
|
2332
|
-
return `signaliz replay ${id}`;
|
|
2355
|
+
return `signaliz ops replay ${id}`;
|
|
2333
2356
|
}
|
|
2334
2357
|
|
|
2335
2358
|
// src/resources/ops.ts
|
|
@@ -3866,6 +3889,25 @@ var GtmKernel = class {
|
|
|
3866
3889
|
write_routine_outcomes: input.writeRoutineOutcomes
|
|
3867
3890
|
});
|
|
3868
3891
|
}
|
|
3892
|
+
/** Run a read-only Campaign Audit and persist workspace-scoped failure findings. */
|
|
3893
|
+
async runCampaignAudit(input) {
|
|
3894
|
+
return this.callMcp("gtm_campaign_audit_run", {
|
|
3895
|
+
provider: input.provider,
|
|
3896
|
+
provider_campaign_id: input.providerCampaignId,
|
|
3897
|
+
campaign_id: input.campaignId,
|
|
3898
|
+
campaign_name: input.campaignName,
|
|
3899
|
+
lookback_days: input.lookbackDays,
|
|
3900
|
+
limit_findings: input.limitFindings
|
|
3901
|
+
});
|
|
3902
|
+
}
|
|
3903
|
+
/** Read a persisted Campaign Audit by audit id or campaign id. */
|
|
3904
|
+
async getCampaignAudit(options) {
|
|
3905
|
+
return this.callMcp("gtm_campaign_audit_get", {
|
|
3906
|
+
audit_id: options.auditId,
|
|
3907
|
+
campaign_id: options.campaignId,
|
|
3908
|
+
limit_findings: options.limitFindings
|
|
3909
|
+
});
|
|
3910
|
+
}
|
|
3869
3911
|
/** Normalize Instantly webhook/pull payloads and ingest row-level feedback through the GTM Kernel. */
|
|
3870
3912
|
async syncInstantlyFeedback(input) {
|
|
3871
3913
|
return this.callMcp("gtm_instantly_feedback_sync", {
|
|
@@ -4610,6 +4652,29 @@ function inferMcpToolCategory(toolName) {
|
|
|
4610
4652
|
if (toolName.includes("agent") || toolName.includes("platform_health") || toolName === "discover_capabilities") return "observability";
|
|
4611
4653
|
return void 0;
|
|
4612
4654
|
}
|
|
4655
|
+
function mapMcpToolInfo(t) {
|
|
4656
|
+
const annotations = asRecord3(t.annotations);
|
|
4657
|
+
const execution = asRecord3(t.execution);
|
|
4658
|
+
const schemas = asRecord3(t.schemas);
|
|
4659
|
+
const name = typeof t.name === "string" ? t.name : typeof t.id === "string" ? t.id : "";
|
|
4660
|
+
return {
|
|
4661
|
+
name,
|
|
4662
|
+
description: String(t.description ?? t.short_description ?? "").slice(0, 120),
|
|
4663
|
+
category: typeof t.category === "string" ? t.category : typeof annotations?.category === "string" ? annotations.category : inferMcpToolCategory(name),
|
|
4664
|
+
costCredits: typeof (execution?.cost_credits ?? annotations?.cost_credits) === "number" ? execution?.cost_credits ?? annotations?.cost_credits : void 0,
|
|
4665
|
+
contractVersion: typeof t.contract_version === "string" ? t.contract_version : typeof (annotations?.contract_version ?? annotations?.contract?.contract_version) === "string" ? annotations?.contract_version ?? annotations?.contract?.contract_version : void 0,
|
|
4666
|
+
permissionLevel: typeof (execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level) === "string" ? execution?.permission_level ?? annotations?.permission_level ?? annotations?.contract?.permission_level : void 0,
|
|
4667
|
+
authScopes: asStringArray(execution?.auth_scopes ?? annotations?.auth_scopes ?? annotations?.contract?.auth_scopes),
|
|
4668
|
+
idempotent: typeof (execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent) === "boolean" ? execution?.idempotent ?? annotations?.idempotentHint ?? annotations?.idempotent ?? annotations?.contract?.idempotent : void 0,
|
|
4669
|
+
destructive: typeof (execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive) === "boolean" ? execution?.destructive ?? annotations?.destructiveHint ?? annotations?.destructive ?? annotations?.contract?.destructive : void 0,
|
|
4670
|
+
retryable: typeof (execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable) === "boolean" ? execution?.retryable ?? annotations?.retryable ?? annotations?.contract?.retryable : void 0,
|
|
4671
|
+
rateLimitKey: typeof (execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key) === "string" ? execution?.rate_limit_key ?? annotations?.rate_limit_key ?? annotations?.contract?.rate_limit_key : void 0,
|
|
4672
|
+
observability: asRecord3(annotations?.observability ?? annotations?.contract?.observability),
|
|
4673
|
+
inputSchema: asObjectSchema(schemas?.input ?? t.inputSchema ?? t.input_schema ?? annotations?.contract?.input_schema),
|
|
4674
|
+
outputSchema: asObjectSchema(schemas?.output ?? t.outputSchema ?? t.output_schema ?? annotations?.contract?.output_schema),
|
|
4675
|
+
annotations
|
|
4676
|
+
};
|
|
4677
|
+
}
|
|
4613
4678
|
function asRecord3(value) {
|
|
4614
4679
|
return value && typeof value === "object" ? value : void 0;
|
|
4615
4680
|
}
|
|
@@ -4674,25 +4739,18 @@ var Signaliz = class {
|
|
|
4674
4739
|
}
|
|
4675
4740
|
/** List all available MCP tools */
|
|
4676
4741
|
async listTools() {
|
|
4742
|
+
try {
|
|
4743
|
+
const manifest = await this.client.mcp("tools/call", {
|
|
4744
|
+
name: "get_tool_manifest",
|
|
4745
|
+
arguments: { include_schemas: true }
|
|
4746
|
+
});
|
|
4747
|
+
const tools2 = manifest?.tools ?? manifest ?? [];
|
|
4748
|
+
if (Array.isArray(tools2)) return tools2.map(mapMcpToolInfo);
|
|
4749
|
+
} catch (_err) {
|
|
4750
|
+
}
|
|
4677
4751
|
const data = await this.client.mcp("tools/list", {});
|
|
4678
4752
|
const tools = data?.tools ?? data ?? [];
|
|
4679
|
-
return tools.map(
|
|
4680
|
-
name: typeof t.name === "string" ? t.name : "",
|
|
4681
|
-
description: String(t.description ?? "").slice(0, 120),
|
|
4682
|
-
category: typeof t.annotations?.category === "string" ? t.annotations.category : inferMcpToolCategory(t.name),
|
|
4683
|
-
costCredits: typeof t.annotations?.cost_credits === "number" ? t.annotations.cost_credits : void 0,
|
|
4684
|
-
contractVersion: typeof (t.annotations?.contract_version ?? t.annotations?.contract?.contract_version) === "string" ? t.annotations?.contract_version ?? t.annotations?.contract?.contract_version : void 0,
|
|
4685
|
-
permissionLevel: typeof (t.annotations?.permission_level ?? t.annotations?.contract?.permission_level) === "string" ? t.annotations?.permission_level ?? t.annotations?.contract?.permission_level : void 0,
|
|
4686
|
-
authScopes: asStringArray(t.annotations?.auth_scopes ?? t.annotations?.contract?.auth_scopes),
|
|
4687
|
-
idempotent: typeof (t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent) === "boolean" ? t.annotations?.idempotentHint ?? t.annotations?.idempotent ?? t.annotations?.contract?.idempotent : void 0,
|
|
4688
|
-
destructive: typeof (t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive) === "boolean" ? t.annotations?.destructiveHint ?? t.annotations?.destructive ?? t.annotations?.contract?.destructive : void 0,
|
|
4689
|
-
retryable: typeof (t.annotations?.retryable ?? t.annotations?.contract?.retryable) === "boolean" ? t.annotations?.retryable ?? t.annotations?.contract?.retryable : void 0,
|
|
4690
|
-
rateLimitKey: typeof (t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key) === "string" ? t.annotations?.rate_limit_key ?? t.annotations?.contract?.rate_limit_key : void 0,
|
|
4691
|
-
observability: asRecord3(t.annotations?.observability ?? t.annotations?.contract?.observability),
|
|
4692
|
-
inputSchema: asObjectSchema(t.inputSchema ?? t.input_schema ?? t.annotations?.contract?.input_schema),
|
|
4693
|
-
outputSchema: asObjectSchema(t.outputSchema ?? t.output_schema ?? t.annotations?.contract?.output_schema),
|
|
4694
|
-
annotations: asRecord3(t.annotations)
|
|
4695
|
-
}));
|
|
4753
|
+
return tools.map(mapMcpToolInfo);
|
|
4696
4754
|
}
|
|
4697
4755
|
/** Discover tools by natural language query */
|
|
4698
4756
|
async discover(query, category) {
|
package/dist/mcp-config.mjs
CHANGED