@agent-native/core 0.122.2 → 0.122.3
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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +6 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/run-loop-with-resume.ts +12 -0
- package/corpus/core/src/integrations/a2a-continuation-processor.ts +182 -0
- package/corpus/core/src/integrations/a2a-continuations-store.ts +122 -12
- package/corpus/core/src/integrations/integration-campaign-recovery.ts +127 -0
- package/corpus/core/src/integrations/integration-campaigns-store.ts +1039 -0
- package/corpus/core/src/integrations/integration-durable-dispatch.ts +28 -3
- package/corpus/core/src/integrations/pending-tasks-retry-job.ts +8 -0
- package/corpus/core/src/integrations/plugin.ts +453 -35
- package/corpus/core/src/integrations/webhook-handler.ts +469 -11
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +7 -3
- package/corpus/templates/content/app/components/editor/body-hydration.ts +10 -0
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +1 -0
- package/corpus/templates/content/app/root.tsx +12 -1
- package/corpus/templates/content/changelog/2026-07-23-new-pages-open-immediately-while-slow-network-work-continues.md +6 -0
- package/corpus/templates/content/changelog/2026-07-25-database-preview-actions-open-reliably.md +6 -0
- package/corpus/templates/content/e2e/playwright.config.ts +1 -1
- package/dist/agent/run-loop-with-resume.d.ts +7 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +7 -0
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/integrations/a2a-continuation-processor.d.ts +14 -0
- package/dist/integrations/a2a-continuation-processor.d.ts.map +1 -1
- package/dist/integrations/a2a-continuation-processor.js +134 -1
- package/dist/integrations/a2a-continuation-processor.js.map +1 -1
- package/dist/integrations/a2a-continuations-store.d.ts +23 -0
- package/dist/integrations/a2a-continuations-store.d.ts.map +1 -1
- package/dist/integrations/a2a-continuations-store.js +99 -13
- package/dist/integrations/a2a-continuations-store.js.map +1 -1
- package/dist/integrations/integration-campaign-recovery.d.ts +16 -0
- package/dist/integrations/integration-campaign-recovery.d.ts.map +1 -0
- package/dist/integrations/integration-campaign-recovery.js +94 -0
- package/dist/integrations/integration-campaign-recovery.js.map +1 -0
- package/dist/integrations/integration-campaigns-store.d.ts +121 -0
- package/dist/integrations/integration-campaigns-store.d.ts.map +1 -0
- package/dist/integrations/integration-campaigns-store.js +784 -0
- package/dist/integrations/integration-campaigns-store.js.map +1 -0
- package/dist/integrations/integration-durable-dispatch.d.ts +3 -0
- package/dist/integrations/integration-durable-dispatch.d.ts.map +1 -1
- package/dist/integrations/integration-durable-dispatch.js +22 -3
- package/dist/integrations/integration-durable-dispatch.js.map +1 -1
- package/dist/integrations/pending-tasks-retry-job.d.ts.map +1 -1
- package/dist/integrations/pending-tasks-retry-job.js +6 -0
- package/dist/integrations/pending-tasks-retry-job.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +325 -18
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts +16 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +368 -13
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +14 -14
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/package.json +1 -1
- package/src/agent/run-loop-with-resume.ts +12 -0
- package/src/integrations/a2a-continuation-processor.ts +182 -0
- package/src/integrations/a2a-continuations-store.ts +122 -12
- package/src/integrations/integration-campaign-recovery.ts +127 -0
- package/src/integrations/integration-campaigns-store.ts +1039 -0
- package/src/integrations/integration-durable-dispatch.ts +28 -3
- package/src/integrations/pending-tasks-retry-job.ts +8 -0
- package/src/integrations/plugin.ts +453 -35
- package/src/integrations/webhook-handler.ts +469 -11
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getIntegrationCampaign,
|
|
3
|
+
failDisabledIntegrationCampaignTask,
|
|
4
|
+
listDueIntegrationCampaignIds,
|
|
5
|
+
} from "./integration-campaigns-store.js";
|
|
6
|
+
import {
|
|
7
|
+
dispatchPendingIntegrationTask,
|
|
8
|
+
isIntegrationDurableDispatchEnabledForTask,
|
|
9
|
+
} from "./integration-durable-dispatch.js";
|
|
10
|
+
import {
|
|
11
|
+
getNextPendingTaskForThread,
|
|
12
|
+
getPendingTask,
|
|
13
|
+
} from "./pending-tasks-store.js";
|
|
14
|
+
|
|
15
|
+
export interface IntegrationCampaignRecoveryResult {
|
|
16
|
+
selected: number;
|
|
17
|
+
dispatched: number;
|
|
18
|
+
skipped: number;
|
|
19
|
+
failed: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function hasConfirmedDeliveryReceipt(payload: string): boolean {
|
|
23
|
+
try {
|
|
24
|
+
const parsed = JSON.parse(payload) as {
|
|
25
|
+
kind?: unknown;
|
|
26
|
+
deliveryReceipt?: { status?: unknown };
|
|
27
|
+
};
|
|
28
|
+
return (
|
|
29
|
+
parsed.kind === "response-delivery" &&
|
|
30
|
+
parsed.deliveryReceipt?.status === "delivered"
|
|
31
|
+
);
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Wake due campaign chunks without claiming or executing them in the sweep.
|
|
39
|
+
* The signed process-task endpoint owns the lease and all mutations.
|
|
40
|
+
*/
|
|
41
|
+
export async function recoverDueIntegrationCampaigns(options: {
|
|
42
|
+
limit?: number;
|
|
43
|
+
event?: unknown;
|
|
44
|
+
webhookBaseUrl?: string;
|
|
45
|
+
}): Promise<IntegrationCampaignRecoveryResult> {
|
|
46
|
+
const ids = await listDueIntegrationCampaignIds(options.limit ?? 20);
|
|
47
|
+
const result: IntegrationCampaignRecoveryResult = {
|
|
48
|
+
selected: ids.length,
|
|
49
|
+
dispatched: 0,
|
|
50
|
+
skipped: 0,
|
|
51
|
+
failed: 0,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
for (const id of ids) {
|
|
55
|
+
try {
|
|
56
|
+
const campaign = await getIntegrationCampaign(id);
|
|
57
|
+
if (!campaign) {
|
|
58
|
+
result.skipped += 1;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const task = await getPendingTask(campaign.integrationTaskId);
|
|
62
|
+
if (!task || task.status !== "processing") {
|
|
63
|
+
result.skipped += 1;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const durableDispatchEnabled = isIntegrationDurableDispatchEnabledForTask(
|
|
67
|
+
{
|
|
68
|
+
platform: task.platform,
|
|
69
|
+
externalThreadId: task.externalThreadId,
|
|
70
|
+
platformContext: task.dispatchScope
|
|
71
|
+
? { channelId: task.dispatchScope }
|
|
72
|
+
: undefined,
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
const confirmedReceipt = hasConfirmedDeliveryReceipt(task.payload);
|
|
76
|
+
if (!durableDispatchEnabled && !confirmedReceipt) {
|
|
77
|
+
await failDisabledIntegrationCampaignTask(task.id);
|
|
78
|
+
const nextTask = await getNextPendingTaskForThread(
|
|
79
|
+
task.platform,
|
|
80
|
+
task.externalThreadId,
|
|
81
|
+
);
|
|
82
|
+
if (nextTask) {
|
|
83
|
+
await dispatchPendingIntegrationTask({
|
|
84
|
+
taskId: nextTask.id,
|
|
85
|
+
task: {
|
|
86
|
+
platform: task.platform,
|
|
87
|
+
externalThreadId: task.externalThreadId,
|
|
88
|
+
platformContext: nextTask.dispatchScope
|
|
89
|
+
? { channelId: nextTask.dispatchScope }
|
|
90
|
+
: undefined,
|
|
91
|
+
},
|
|
92
|
+
event: options.event,
|
|
93
|
+
baseUrl: options.webhookBaseUrl,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
result.skipped += 1;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const outcome = await dispatchPendingIntegrationTask({
|
|
100
|
+
taskId: task.id,
|
|
101
|
+
task: {
|
|
102
|
+
platform: task.platform,
|
|
103
|
+
externalThreadId: task.externalThreadId,
|
|
104
|
+
platformContext: task.dispatchScope
|
|
105
|
+
? { channelId: task.dispatchScope }
|
|
106
|
+
: undefined,
|
|
107
|
+
},
|
|
108
|
+
event: options.event,
|
|
109
|
+
baseUrl: options.webhookBaseUrl,
|
|
110
|
+
campaignContinuation: true,
|
|
111
|
+
...(confirmedReceipt && !durableDispatchEnabled
|
|
112
|
+
? { allowPortableConfirmedReceiptReconciliation: true }
|
|
113
|
+
: {}),
|
|
114
|
+
});
|
|
115
|
+
if (outcome === "failed") result.failed += 1;
|
|
116
|
+
else result.dispatched += 1;
|
|
117
|
+
} catch (error) {
|
|
118
|
+
result.failed += 1;
|
|
119
|
+
console.error(
|
|
120
|
+
`[integrations] Failed to wake integration campaign ${id}:`,
|
|
121
|
+
error,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return result;
|
|
127
|
+
}
|