@adcp/sdk 14.0.0-beta.5 → 14.0.0-beta.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/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/AgentClient.js +26 -10
- package/dist/lib/core/AgentClient.js.map +1 -1
- package/dist/lib/core/AgentClient.mjs +26 -10
- package/dist/lib/core/AgentClient.mjs.map +1 -1
- package/dist/lib/core/AsyncHandler.d.mts +4 -2
- package/dist/lib/core/AsyncHandler.d.ts +4 -2
- package/dist/lib/core/AsyncHandler.d.ts.map +1 -1
- package/dist/lib/core/AsyncHandler.js +15 -1
- package/dist/lib/core/AsyncHandler.js.map +1 -1
- package/dist/lib/core/AsyncHandler.mjs +15 -1
- package/dist/lib/core/AsyncHandler.mjs.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +3 -1
- package/dist/lib/core/SingleAgentClient.d.ts +3 -1
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +158 -39
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/core/SingleAgentClient.mjs +167 -40
- package/dist/lib/core/SingleAgentClient.mjs.map +1 -1
- package/dist/lib/core/TaskExecutor.d.mts +57 -2
- package/dist/lib/core/TaskExecutor.d.ts +57 -2
- package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
- package/dist/lib/core/TaskExecutor.js +382 -44
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/core/TaskExecutor.mjs +382 -45
- package/dist/lib/core/TaskExecutor.mjs.map +1 -1
- package/dist/lib/core/request-proposals-guard.d.mts +11 -0
- package/dist/lib/core/request-proposals-guard.d.ts +12 -0
- package/dist/lib/core/request-proposals-guard.d.ts.map +1 -0
- package/dist/lib/core/request-proposals-guard.js +65 -0
- package/dist/lib/core/request-proposals-guard.js.map +1 -0
- package/dist/lib/core/request-proposals-guard.mjs +39 -0
- package/dist/lib/core/request-proposals-guard.mjs.map +1 -0
- package/dist/lib/core/webhook-registration.d.mts +5 -0
- package/dist/lib/core/webhook-registration.d.ts +5 -0
- package/dist/lib/core/webhook-registration.d.ts.map +1 -1
- package/dist/lib/core/webhook-registration.js +13 -0
- package/dist/lib/core/webhook-registration.js.map +1 -1
- package/dist/lib/core/webhook-registration.mjs +13 -0
- package/dist/lib/core/webhook-registration.mjs.map +1 -1
- package/dist/lib/media-buy/compatibility.d.mts +45 -10
- package/dist/lib/media-buy/compatibility.d.ts +45 -10
- package/dist/lib/media-buy/compatibility.d.ts.map +1 -1
- package/dist/lib/media-buy/compatibility.js +295 -113
- package/dist/lib/media-buy/compatibility.js.map +1 -1
- package/dist/lib/media-buy/compatibility.mjs +295 -113
- package/dist/lib/media-buy/compatibility.mjs.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/types/core.generated.d.mts +334 -85
- package/dist/lib/types/core.generated.d.ts +334 -85
- package/dist/lib/types/core.generated.d.ts.map +1 -1
- package/dist/lib/types/core.generated.js.map +1 -1
- package/dist/lib/types/decline-proposals.d.ts +0 -5
- package/dist/lib/types/index.d.mts +2 -0
- package/dist/lib/types/index.d.ts +2 -0
- package/dist/lib/types/index.d.ts.map +1 -1
- package/dist/lib/types/index.js.map +1 -1
- package/dist/lib/types/index.mjs.map +1 -1
- package/dist/lib/types/request-proposals.d.ts +254 -36
- package/dist/lib/types/schemas.generated.d.ts +3123 -835
- package/dist/lib/types/schemas.generated.d.ts.map +1 -1
- package/dist/lib/types/schemas.generated.js +192 -85
- package/dist/lib/types/schemas.generated.js.map +1 -1
- package/dist/lib/types/schemas.generated.mjs +192 -85
- package/dist/lib/types/schemas.generated.mjs.map +1 -1
- package/dist/lib/types/tools.generated.d.mts +1 -121
- package/dist/lib/types/tools.generated.d.ts +1 -121
- package/dist/lib/types/tools.generated.d.ts.map +1 -1
- package/dist/lib/types/tools.generated.js.map +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.js.map +1 -1
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/version.mjs.map +1 -1
- package/docs/guides/MEDIA-BUY-3.2-COMPATIBILITY.md +28 -14
- package/docs/llms.txt +1 -1
- package/package.json +1 -1
|
@@ -13,8 +13,17 @@ import { isExternalSchemaRootActive, schemaAllowsTopLevelField } from "../valida
|
|
|
13
13
|
import { generateIdempotencyKey, requestUsesIdempotency } from "../utils/idempotency.mjs";
|
|
14
14
|
import { A2AClient as A2AClientImpl } from "@a2a-js/sdk/client";
|
|
15
15
|
const A2AClient = A2AClientImpl;
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
TaskExecutor,
|
|
18
|
+
AfterProtocolDispatchHookError,
|
|
19
|
+
BeforeProtocolDispatchHookError
|
|
20
|
+
} from "./TaskExecutor.mjs";
|
|
17
21
|
import { attachMatch } from "./match.mjs";
|
|
22
|
+
import {
|
|
23
|
+
assertNativeRequestProposalsResult,
|
|
24
|
+
assertNativeRequestProposalsTask,
|
|
25
|
+
guardNativeRequestProposalsCompletion
|
|
26
|
+
} from "./request-proposals-guard.mjs";
|
|
18
27
|
import { withTaskDeadline } from "./task-deadline.mjs";
|
|
19
28
|
import { createMCPRequestHeaders } from "../auth/index.mjs";
|
|
20
29
|
import { isAbortOrTimeoutError } from "../protocols/abort.mjs";
|
|
@@ -170,6 +179,26 @@ const CANONICAL_CREATIVE_ACTIVITY_TASKS = /* @__PURE__ */ new Set([
|
|
|
170
179
|
"get_media_buy_delivery",
|
|
171
180
|
"get_creative_delivery"
|
|
172
181
|
]);
|
|
182
|
+
const RECORDLESS_HMAC_READ_ONLY_TASKS = /* @__PURE__ */ new Set([
|
|
183
|
+
"get_adcp_capabilities",
|
|
184
|
+
"list_products",
|
|
185
|
+
"list_creative_formats",
|
|
186
|
+
"preview_creative",
|
|
187
|
+
"list_transformers",
|
|
188
|
+
"list_creatives",
|
|
189
|
+
"get_media_buys",
|
|
190
|
+
"get_media_buy_delivery",
|
|
191
|
+
"media_buy_delivery",
|
|
192
|
+
"get_creative_delivery",
|
|
193
|
+
"get_signals",
|
|
194
|
+
"list_accounts",
|
|
195
|
+
"get_property_list",
|
|
196
|
+
"list_property_lists",
|
|
197
|
+
"list_content_standards",
|
|
198
|
+
"get_content_standards",
|
|
199
|
+
"si_get_offering",
|
|
200
|
+
"get_plan_audit_logs"
|
|
201
|
+
]);
|
|
173
202
|
const TASK_SCOPED_STATE_LIMIT = 1e4;
|
|
174
203
|
const CANONICAL_PACKAGE_ROUTE_TASKS = /* @__PURE__ */ new Set(["create_media_buy", "update_media_buy", "get_media_buys"]);
|
|
175
204
|
const canonicalCreativeRoutingSnapshots = /* @__PURE__ */ new WeakSet();
|
|
@@ -637,6 +666,8 @@ class SingleAgentClient {
|
|
|
637
666
|
agentId: agent.id,
|
|
638
667
|
webhookSecret: config.webhookSecret,
|
|
639
668
|
onWebhookRegistration: (registration) => this.persistWebhookRegistration(registration),
|
|
669
|
+
onDurableSettlementRequired: (operationId) => this.markWebhookDurableSettlementRequired(operationId),
|
|
670
|
+
externalTaskSettlementRetentionMs: registrationTtl * 1e3,
|
|
640
671
|
strictSchemaValidation: config.validation?.strictSchemaValidation !== false,
|
|
641
672
|
// Default: true
|
|
642
673
|
logSchemaViolations: config.validation?.logSchemaViolations !== false,
|
|
@@ -704,10 +735,14 @@ class SingleAgentClient {
|
|
|
704
735
|
this.canonicalCreativeTaskAssociations.delete(args.operationId);
|
|
705
736
|
}
|
|
706
737
|
}
|
|
738
|
+
const persistedAgentUrl = new URL(args.agent.agent_uri);
|
|
739
|
+
persistedAgentUrl.username = "";
|
|
740
|
+
persistedAgentUrl.password = "";
|
|
741
|
+
persistedAgentUrl.hash = "";
|
|
707
742
|
try {
|
|
708
743
|
await this.webhookRegistrationStore.putIfAbsent({
|
|
709
744
|
agentId: args.agent.id,
|
|
710
|
-
agentUrl:
|
|
745
|
+
agentUrl: persistedAgentUrl.toString(),
|
|
711
746
|
protocol: args.agent.protocol,
|
|
712
747
|
operationId: args.operationId,
|
|
713
748
|
taskType: args.taskType,
|
|
@@ -722,6 +757,15 @@ class SingleAgentClient {
|
|
|
722
757
|
if (args.mode === "rfc9421") throw cause;
|
|
723
758
|
}
|
|
724
759
|
}
|
|
760
|
+
async markWebhookDurableSettlementRequired(operationId) {
|
|
761
|
+
const mark = this.webhookRegistrationStore.markRequiresDurableSettlement;
|
|
762
|
+
if (!mark) {
|
|
763
|
+
throw new ConfigurationError(
|
|
764
|
+
"A custom webhookRegistrationStore must implement markRequiresDurableSettlement for durable mutation callbacks."
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
await mark.call(this.webhookRegistrationStore, this.agent.id, operationId);
|
|
768
|
+
}
|
|
725
769
|
webhookJwksFor(registration) {
|
|
726
770
|
const configured = this.config.webhookVerification?.jwks;
|
|
727
771
|
if (configured) return configured;
|
|
@@ -1446,7 +1490,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
1446
1490
|
try {
|
|
1447
1491
|
registration = await this.webhookRegistrationStore.get(this.agent.id, trustedOperationId);
|
|
1448
1492
|
} catch (cause) {
|
|
1449
|
-
|
|
1493
|
+
const routedTaskType2 = options.taskType && options.taskType !== "unknown" ? options.taskType : void 0;
|
|
1494
|
+
if (!this.config.webhookSecret || routedTaskType2 === void 0 || !RECORDLESS_HMAC_READ_ONLY_TASKS.has(routedTaskType2)) {
|
|
1450
1495
|
return {
|
|
1451
1496
|
ok: false,
|
|
1452
1497
|
code: "webhook_registration_store_unavailable",
|
|
@@ -1472,8 +1517,29 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
1472
1517
|
message: "Webhook registration state contains invalid timestamps."
|
|
1473
1518
|
};
|
|
1474
1519
|
}
|
|
1520
|
+
try {
|
|
1521
|
+
const registeredAgentUrl = new URL(registration.agentUrl);
|
|
1522
|
+
if (registeredAgentUrl.username || registeredAgentUrl.password) {
|
|
1523
|
+
throw new TypeError("Webhook registration seller URL contains userinfo.");
|
|
1524
|
+
}
|
|
1525
|
+
} catch (cause) {
|
|
1526
|
+
return {
|
|
1527
|
+
ok: false,
|
|
1528
|
+
code: "webhook_registration_store_unavailable",
|
|
1529
|
+
message: "Webhook registration state contains an invalid seller URL.",
|
|
1530
|
+
cause
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1475
1533
|
if (registration.expiresAt <= nowMs) registration = void 0;
|
|
1476
1534
|
}
|
|
1535
|
+
const trustedRouteTaskType = options.taskType && options.taskType !== "unknown" ? options.taskType : void 0;
|
|
1536
|
+
if (!registration && this.config.webhookSecret && (trustedRouteTaskType === void 0 || !RECORDLESS_HMAC_READ_ONLY_TASKS.has(trustedRouteTaskType))) {
|
|
1537
|
+
return {
|
|
1538
|
+
ok: false,
|
|
1539
|
+
code: "webhook_registration_store_unavailable",
|
|
1540
|
+
message: "A trusted webhook registration is required for this task type."
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1477
1543
|
if (authHeaders.hasRfc9421 && !trustedOperationId) {
|
|
1478
1544
|
return {
|
|
1479
1545
|
ok: false,
|
|
@@ -1728,7 +1794,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
1728
1794
|
message: canonicalMessage,
|
|
1729
1795
|
previewHandler,
|
|
1730
1796
|
timestamp: normalizedPayload.timestamp,
|
|
1731
|
-
idempotencyKey: normalizedPayload.idempotency_key
|
|
1797
|
+
idempotencyKey: normalizedPayload.idempotency_key,
|
|
1798
|
+
requiresDurableSettlement: registration?.requiresDurableSettlement
|
|
1732
1799
|
}
|
|
1733
1800
|
};
|
|
1734
1801
|
} catch (error) {
|
|
@@ -1793,8 +1860,52 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
1793
1860
|
canonicalResult,
|
|
1794
1861
|
metadata
|
|
1795
1862
|
);
|
|
1796
|
-
|
|
1863
|
+
let webhookResult = policyDispatch.result;
|
|
1797
1864
|
metadata = policyDispatch.metadata;
|
|
1865
|
+
if (metadata.task_type === "request_proposals") {
|
|
1866
|
+
assertNativeRequestProposalsResult(webhookResult);
|
|
1867
|
+
}
|
|
1868
|
+
if (parsed.metadata.requiresDurableSettlement === true && !this.executor.hasExternalTaskSettlementRoute(metadata.operation_id)) {
|
|
1869
|
+
throw new WebhookDispatchError(
|
|
1870
|
+
"webhook_durable_settlement_unavailable",
|
|
1871
|
+
"The callback requires durable mutation settlement, but no recoverable settlement route is available."
|
|
1872
|
+
);
|
|
1873
|
+
}
|
|
1874
|
+
const externalStatus = await this.executor.observeExternalTaskStatus(
|
|
1875
|
+
metadata.operation_id,
|
|
1876
|
+
metadata.status,
|
|
1877
|
+
webhookResult,
|
|
1878
|
+
{ serverTaskId: metadata.task_id, taskType: metadata.task_type }
|
|
1879
|
+
);
|
|
1880
|
+
if (externalStatus.duplicate) {
|
|
1881
|
+
metadata = {
|
|
1882
|
+
...metadata,
|
|
1883
|
+
status: externalStatus.status ?? metadata.status,
|
|
1884
|
+
...externalStatus.error !== void 0 && { message: externalStatus.error }
|
|
1885
|
+
};
|
|
1886
|
+
const duplicateActivity = {
|
|
1887
|
+
type: "webhook_duplicate",
|
|
1888
|
+
operation_id: metadata.operation_id,
|
|
1889
|
+
agent_id: metadata.agent_id,
|
|
1890
|
+
context_id: metadata.context_id,
|
|
1891
|
+
task_id: metadata.task_id,
|
|
1892
|
+
task_type: metadata.task_type,
|
|
1893
|
+
status: metadata.status,
|
|
1894
|
+
idempotency_key: metadata.idempotency_key,
|
|
1895
|
+
timestamp: metadata.timestamp
|
|
1896
|
+
};
|
|
1897
|
+
await this.config.onActivity?.(canonicalCreativeActivity(duplicateActivity));
|
|
1898
|
+
await this.asyncHandler?.handleDurableSettlementDuplicate(metadata);
|
|
1899
|
+
return true;
|
|
1900
|
+
}
|
|
1901
|
+
if (externalStatus.settled) {
|
|
1902
|
+
webhookResult = externalStatus.result;
|
|
1903
|
+
metadata = {
|
|
1904
|
+
...metadata,
|
|
1905
|
+
status: externalStatus.status ?? metadata.status,
|
|
1906
|
+
...externalStatus.error !== void 0 && { message: externalStatus.error }
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1798
1909
|
await this.config.onActivity?.(
|
|
1799
1910
|
canonicalCreativeActivity({
|
|
1800
1911
|
type: "webhook_received",
|
|
@@ -1804,7 +1915,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
1804
1915
|
task_id: metadata.task_id,
|
|
1805
1916
|
task_type: metadata.task_type,
|
|
1806
1917
|
status: metadata.status,
|
|
1807
|
-
payload:
|
|
1918
|
+
payload: webhookResult,
|
|
1808
1919
|
timestamp: metadata.timestamp
|
|
1809
1920
|
})
|
|
1810
1921
|
);
|
|
@@ -1819,11 +1930,6 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
1819
1930
|
}
|
|
1820
1931
|
return false;
|
|
1821
1932
|
} finally {
|
|
1822
|
-
this.executor.observeExternalTaskStatus(
|
|
1823
|
-
metadata.operation_id,
|
|
1824
|
-
metadata.status,
|
|
1825
|
-
metadata.rawHTTPPayload
|
|
1826
|
-
);
|
|
1827
1933
|
this.forgetProductPolicyRequestParams(metadata);
|
|
1828
1934
|
}
|
|
1829
1935
|
}
|
|
@@ -2080,7 +2186,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
2080
2186
|
res.end(JSON.stringify({ status: "accepted", received: handled }));
|
|
2081
2187
|
}
|
|
2082
2188
|
} catch (error) {
|
|
2083
|
-
const errorMessage = error instanceof
|
|
2189
|
+
const errorMessage = error instanceof WebhookDispatchError ? error.message : "Webhook could not be processed.";
|
|
2084
2190
|
const statusCode = webhookErrorHttpStatus(error);
|
|
2085
2191
|
if (res.json) {
|
|
2086
2192
|
res.status(statusCode).json({ error: errorMessage });
|
|
@@ -3299,9 +3405,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3299
3405
|
}
|
|
3300
3406
|
/** @internal Run deterministic legacy-create preflight before the caller atomically claims its mutation. */
|
|
3301
3407
|
async createMediaBuyLegacyWithPreDispatch(params, beforeDispatch, inputHandler, options) {
|
|
3408
|
+
const requestSnapshot = structuredClone(params);
|
|
3302
3409
|
return this.executeTaskUnprojected(
|
|
3303
3410
|
"create_media_buy",
|
|
3304
|
-
|
|
3411
|
+
requestSnapshot,
|
|
3305
3412
|
inputHandler,
|
|
3306
3413
|
options,
|
|
3307
3414
|
"onCreateMediaBuyStatusChange",
|
|
@@ -3991,6 +4098,10 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3991
4098
|
return this.getMediaBuyDelivery(params, inputHandler, options);
|
|
3992
4099
|
case "get_creative_delivery":
|
|
3993
4100
|
return this.getCreativeDelivery(params, inputHandler, options);
|
|
4101
|
+
case "request_proposals":
|
|
4102
|
+
return guardNativeRequestProposalsCompletion(
|
|
4103
|
+
await this.executeTaskUnprojected(taskName, params, inputHandler, options)
|
|
4104
|
+
);
|
|
3994
4105
|
}
|
|
3995
4106
|
return this.executeTaskUnprojected(taskName, params, inputHandler, options);
|
|
3996
4107
|
}
|
|
@@ -4096,7 +4207,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4096
4207
|
result = await this.applyProductPropertyPolicy(result, taskName, normalizedParams);
|
|
4097
4208
|
return result;
|
|
4098
4209
|
} catch (error) {
|
|
4099
|
-
if (error instanceof BeforeProtocolDispatchHookError
|
|
4210
|
+
if (error instanceof BeforeProtocolDispatchHookError || error instanceof AfterProtocolDispatchHookError) {
|
|
4211
|
+
throw error.original;
|
|
4212
|
+
}
|
|
4100
4213
|
if (error instanceof AuthenticationRequiredError || error instanceof TaskTimeoutError || error instanceof VersionUnsupportedError || error instanceof FeatureUnsupportedError || isAbortOrTimeoutError(error)) {
|
|
4101
4214
|
throw error;
|
|
4102
4215
|
}
|
|
@@ -4364,6 +4477,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4364
4477
|
*/
|
|
4365
4478
|
getActiveTasks() {
|
|
4366
4479
|
return this.executor.getActiveTasks().filter((task) => task.agent.id === this.agent.id).map((task) => {
|
|
4480
|
+
assertNativeRequestProposalsTask(task);
|
|
4367
4481
|
if (!CANONICAL_CREATIVE_ACTIVITY_TASKS.has(task.taskName)) return task;
|
|
4368
4482
|
const converter = this.resolveLegacyFormatConverter(
|
|
4369
4483
|
this.canonicalCreativeTaskAssociation(task.taskId)?.legacyFormatConverter
|
|
@@ -4398,12 +4512,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4398
4512
|
async listTasks() {
|
|
4399
4513
|
const tasks = await this.executor.getTaskList(this.agent.id);
|
|
4400
4514
|
return tasks.map(
|
|
4401
|
-
(task) =>
|
|
4402
|
-
task
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4515
|
+
(task) => assertNativeRequestProposalsTask(
|
|
4516
|
+
CANONICAL_CREATIVE_ACTIVITY_TASKS.has(task.taskType) ? this.canonicalizeCreativeTaskInfo(
|
|
4517
|
+
task,
|
|
4518
|
+
task.taskType,
|
|
4519
|
+
void 0,
|
|
4520
|
+
this.resolveLegacyFormatConverter(
|
|
4521
|
+
this.canonicalCreativeTaskAssociation(task.taskId)?.legacyFormatConverter
|
|
4522
|
+
)
|
|
4523
|
+
) : task
|
|
4524
|
+
)
|
|
4407
4525
|
);
|
|
4408
4526
|
}
|
|
4409
4527
|
/**
|
|
@@ -4414,12 +4532,15 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4414
4532
|
*/
|
|
4415
4533
|
async getTaskInfo(taskId) {
|
|
4416
4534
|
const task = await this.executor.getTaskInfo(taskId);
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
task.taskType
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4535
|
+
if (!task) return null;
|
|
4536
|
+
return assertNativeRequestProposalsTask(
|
|
4537
|
+
CANONICAL_CREATIVE_ACTIVITY_TASKS.has(task.taskType) ? this.canonicalizeCreativeTaskInfo(
|
|
4538
|
+
task,
|
|
4539
|
+
task.taskType,
|
|
4540
|
+
void 0,
|
|
4541
|
+
this.resolveLegacyFormatConverter(this.canonicalCreativeTaskAssociation(task.taskId)?.legacyFormatConverter)
|
|
4542
|
+
) : task
|
|
4543
|
+
);
|
|
4423
4544
|
}
|
|
4424
4545
|
/**
|
|
4425
4546
|
* Subscribe to task notifications for this agent
|
|
@@ -4444,14 +4565,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4444
4565
|
return this.executor.onTaskUpdate(
|
|
4445
4566
|
this.agent.id,
|
|
4446
4567
|
(task) => callback(
|
|
4447
|
-
|
|
4448
|
-
task
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
this.
|
|
4453
|
-
|
|
4454
|
-
|
|
4568
|
+
assertNativeRequestProposalsTask(
|
|
4569
|
+
CANONICAL_CREATIVE_ACTIVITY_TASKS.has(task.taskType) ? this.canonicalizeCreativeTaskInfo(
|
|
4570
|
+
task,
|
|
4571
|
+
task.taskType,
|
|
4572
|
+
void 0,
|
|
4573
|
+
this.resolveLegacyFormatConverter(
|
|
4574
|
+
this.canonicalCreativeTaskAssociation(task.taskId)?.legacyFormatConverter
|
|
4575
|
+
)
|
|
4576
|
+
) : task
|
|
4577
|
+
)
|
|
4455
4578
|
)
|
|
4456
4579
|
);
|
|
4457
4580
|
}
|
|
@@ -4462,12 +4585,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4462
4585
|
* @returns Unsubscribe function
|
|
4463
4586
|
*/
|
|
4464
4587
|
onTaskEvents(callbacks) {
|
|
4465
|
-
const safe = (task) =>
|
|
4466
|
-
task
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4588
|
+
const safe = (task) => assertNativeRequestProposalsTask(
|
|
4589
|
+
CANONICAL_CREATIVE_ACTIVITY_TASKS.has(task.taskType) ? this.canonicalizeCreativeTaskInfo(
|
|
4590
|
+
task,
|
|
4591
|
+
task.taskType,
|
|
4592
|
+
void 0,
|
|
4593
|
+
this.resolveLegacyFormatConverter(
|
|
4594
|
+
this.canonicalCreativeTaskAssociation(task.taskId)?.legacyFormatConverter
|
|
4595
|
+
)
|
|
4596
|
+
) : task
|
|
4597
|
+
);
|
|
4471
4598
|
return this.executor.onTaskEvents(this.agent.id, {
|
|
4472
4599
|
...callbacks.onTaskCreated && { onTaskCreated: (task) => callbacks.onTaskCreated(safe(task)) },
|
|
4473
4600
|
...callbacks.onTaskUpdated && { onTaskUpdated: (task) => callbacks.onTaskUpdated(safe(task)) },
|