@axiom-lattice/gateway 8.3.0 → 9.0.0
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/{A2AAuthService-7UGQ7GMW.mjs → A2AAuthService-UKN53ZGP.mjs} +2 -2
- package/dist/{a2a-BHBLACJV.mjs → a2a-YLKZE5JG.mjs} +7 -5
- package/dist/{a2a-standard-VL5I7B4W.mjs → a2a-standard-MD7WNDTP.mjs} +79 -127
- package/dist/a2a-standard-MD7WNDTP.mjs.map +1 -0
- package/dist/chunk-A7YNAU5L.mjs +377 -0
- package/dist/chunk-A7YNAU5L.mjs.map +1 -0
- package/dist/{chunk-3XIIQ6EK.mjs → chunk-BOPNXTMO.mjs} +66 -5
- package/dist/chunk-BOPNXTMO.mjs.map +1 -0
- package/dist/{chunk-L6MBEEII.mjs → chunk-JGQURU44.mjs} +24 -6
- package/dist/chunk-JGQURU44.mjs.map +1 -0
- package/dist/{chunk-GPHOYR3X.mjs → chunk-LCM4OQTI.mjs} +30 -1
- package/dist/chunk-LCM4OQTI.mjs.map +1 -0
- package/dist/{chunk-HVIKCUOF.mjs → chunk-MFWTGNQR.mjs} +74 -5
- package/dist/chunk-MFWTGNQR.mjs.map +1 -0
- package/dist/chunk-NYYSBNDG.mjs +575 -0
- package/dist/chunk-NYYSBNDG.mjs.map +1 -0
- package/dist/{chunk-W3YH4S6G.mjs → chunk-SIMEG2JT.mjs} +19 -2
- package/dist/chunk-SIMEG2JT.mjs.map +1 -0
- package/dist/chunk-T2HIWZGP.mjs +580 -0
- package/dist/chunk-T2HIWZGP.mjs.map +1 -0
- package/dist/chunk-Y7OVVPVU.mjs +13 -0
- package/dist/chunk-Y7OVVPVU.mjs.map +1 -0
- package/dist/{chunk-GL7RV5L3.mjs → chunk-YR32MWEJ.mjs} +36 -73
- package/dist/chunk-YR32MWEJ.mjs.map +1 -0
- package/dist/embed/{embed-page-AgentDetailSideApp-7YTMN643.js → embed-page-AgentDetailSideApp-6RYNHS5F.js} +1 -1
- package/dist/embed/{embed-page-AgentDetailSideApp-O6G4NJ7I.css → embed-page-AgentDetailSideApp-JMJOOC4V.css} +1 -1
- package/dist/embed/{embed-page-AgentGovernanceWorkbench-SFZNVMUH.css → embed-page-AgentGovernanceWorkbench-3T3ZFJI5.css} +1 -1
- package/dist/embed/embed-page-AgentGovernanceWorkbench-UAPXF3SZ.js +1 -0
- package/dist/embed/{embed-page-LangfuseDashboard-BEOJDMWF.js → embed-page-LangfuseDashboard-ZYGZNW7P.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-N2DXVMEK.js → embed-page-MessageGraph-S2P3WACC.js} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-CWOXLVFW.css → embed-page-MessageGraph-UDC6GQA5.css} +1 -1
- package/dist/embed/{embed-page-ReactChart-3QDZX2WG.js → embed-page-ReactChart-I3UZVE4Z.js} +1 -1
- package/dist/embed/{embed-page-ReactChart-MXGF35OQ.css → embed-page-ReactChart-URBKYQYE.css} +1 -1
- package/dist/embed/{embed-page-SkillFlow-3X24ILKU.js → embed-page-SkillFlow-JMIJ46FX.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-MYIRJWFM.js → embed-page-TasksSideApp-IVFEFLSH.js} +1 -1
- package/dist/embed/{embed-page-TasksSideApp-HV6DKQ26.css → embed-page-TasksSideApp-TTCP4ENP.css} +1 -1
- package/dist/embed/{embed-page-ThreadMaintenancePanel-V327PV5R.js → embed-page-ThreadMaintenancePanel-KQPPAEWJ.js} +1 -1
- package/dist/embed/{embed-page-WorkflowAutomationView-YQFB3CTV.css → embed-page-TopologyRuntimeView-S4AMB4RI.css} +1 -1
- package/dist/embed/{embed-page-TopologyRuntimeView-3O6VJUZR.js → embed-page-TopologyRuntimeView-XCFQ23HF.js} +1 -1
- package/dist/embed/{embed-page-MessageGraph-UT2TCPSO.css → embed-page-WorkflowAutomationView-FWVCQ3YM.css} +1 -1
- package/dist/embed/embed-page-WorkflowAutomationView-UTKCKP75.js +3 -0
- package/dist/embed/embed-page-chunk-5X4MNQAW.js +242 -0
- package/dist/embed/{embed-page-chunk-PMOGSY6W.js → embed-page-chunk-77CQOFKU.js} +1 -1
- package/dist/embed/{embed-page-chunk-PROZXFWS.js → embed-page-chunk-7VDAOX3D.js} +1 -1
- package/dist/embed/{embed-page-chunk-BSRASK7V.js → embed-page-chunk-MD4U4DHC.js} +5 -5
- package/dist/embed/embed-page-chunk-RANB2CUO.js +3 -0
- package/dist/embed/{embed-page-chunk-IELKCYQX.js → embed-page-chunk-RVIS6CKE.js} +1 -1
- package/dist/embed/embed-page-chunk-SEOTZ4Q7.js +6829 -0
- package/dist/embed/{embed-page-chunk-ASEIOK7X.js → embed-page-chunk-TCVPYXPL.js} +2 -2
- package/dist/embed/embed-page-chunk-WHGU76CU.js +211 -0
- package/dist/embed/{embed-page-chunk-WGEXK773.js → embed-page-chunk-ZZFTCBM6.js} +1 -1
- package/dist/embed/embed-page-en-4HSTKY4Q.js +1 -0
- package/dist/embed/{embed-page-en-XJYWUJEL.js → embed-page-en-DNDGCPMA.js} +1 -1
- package/dist/embed/embed-page-en-H5NOZEKE.js +1 -0
- package/dist/embed/embed-page-en-MIVBTEEL.js +1 -0
- package/dist/embed/{embed-page-en-HDSVQ4O6.js → embed-page-en-QJRX2NQE.js} +1 -1
- package/dist/embed/{embed-page-zh-6EBUEFKP.js → embed-page-zh-2H4EB3F3.js} +1 -1
- package/dist/embed/embed-page-zh-4C2K3RH2.js +1 -0
- package/dist/embed/embed-page-zh-7PJNJJZY.js +1 -0
- package/dist/embed/{embed-page-zh-IR652A6J.js → embed-page-zh-HTEHFCSL.js} +1 -1
- package/dist/embed/embed-page-zh-UZ4GPIU7.js +1 -0
- package/dist/embed/embed-page.css +1 -1
- package/dist/embed/embed-page.js +1 -1
- package/dist/embed/mcp-app-page.js +61 -0
- package/dist/index.d.mts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +3574 -2349
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +327 -1049
- package/dist/index.mjs.map +1 -1
- package/dist/mcp-app-shares-SHPBJQXS.mjs +300 -0
- package/dist/mcp-app-shares-SHPBJQXS.mjs.map +1 -0
- package/dist/mcp-apps-QVUK6UBA.mjs +26 -0
- package/dist/{open-7ED27I5B.mjs → open-27ZPLBIW.mjs} +101 -18
- package/dist/open-27ZPLBIW.mjs.map +1 -0
- package/dist/{open-catalog-SZQ435AY.mjs → open-catalog-NVGP6SQP.mjs} +38 -7
- package/dist/open-catalog-NVGP6SQP.mjs.map +1 -0
- package/dist/{open-exposure-I3DN2X4E.mjs → open-exposure-HGYT5VFC.mjs} +8 -9
- package/dist/open-exposure-HGYT5VFC.mjs.map +1 -0
- package/dist/{open-files-V3R2BFTV.mjs → open-files-JPB2NBL6.mjs} +4 -4
- package/dist/{open-session-2Y7XJJW2.mjs → open-session-CLZT3HVG.mjs} +5 -5
- package/dist/open-session-CLZT3HVG.mjs.map +1 -0
- package/dist/openLattice-D5YTSZBY.mjs +28 -0
- package/dist/{registerExposedPlugins-6GCOE64C.mjs → registerExposedPlugins-2JGXSMAL.mjs} +4 -3
- package/dist/{resources-DAU5ZIPB.mjs → resources-YD5DOPGD.mjs} +83 -3
- package/dist/resources-YD5DOPGD.mjs.map +1 -0
- package/dist/{sandboxOpenCredentialProvider-AT227D4N.mjs → sandboxOpenCredentialProvider-RTYOYRCT.mjs} +19 -14
- package/dist/sandboxOpenCredentialProvider-RTYOYRCT.mjs.map +1 -0
- package/package.json +10 -8
- package/dist/a2a-standard-VL5I7B4W.mjs.map +0 -1
- package/dist/chunk-3XIIQ6EK.mjs.map +0 -1
- package/dist/chunk-GL7RV5L3.mjs.map +0 -1
- package/dist/chunk-GPHOYR3X.mjs.map +0 -1
- package/dist/chunk-GXZFO3VU.mjs +0 -42
- package/dist/chunk-GXZFO3VU.mjs.map +0 -1
- package/dist/chunk-HVIKCUOF.mjs.map +0 -1
- package/dist/chunk-HYYLYIMH.mjs +0 -230
- package/dist/chunk-HYYLYIMH.mjs.map +0 -1
- package/dist/chunk-L6MBEEII.mjs.map +0 -1
- package/dist/chunk-W3YH4S6G.mjs.map +0 -1
- package/dist/embed/embed-page-AgentGovernanceWorkbench-YWJ4ZLEV.js +0 -1
- package/dist/embed/embed-page-WorkflowAutomationView-YHOS4WQR.js +0 -3
- package/dist/embed/embed-page-chunk-4XKCMM5C.js +0 -211
- package/dist/embed/embed-page-chunk-IBRMWDHE.js +0 -6835
- package/dist/embed/embed-page-chunk-JTL73EBV.js +0 -3
- package/dist/embed/embed-page-chunk-YMVKQQXJ.js +0 -242
- package/dist/embed/embed-page-en-E35GE7TA.js +0 -1
- package/dist/embed/embed-page-en-GLT2HEZZ.js +0 -1
- package/dist/embed/embed-page-en-JOTELYAL.js +0 -1
- package/dist/embed/embed-page-zh-BPO6ZSJM.js +0 -1
- package/dist/embed/embed-page-zh-XMEJPDMF.js +0 -1
- package/dist/embed/embed-page-zh-ZLK3GLM3.js +0 -1
- package/dist/open-7ED27I5B.mjs.map +0 -1
- package/dist/open-catalog-SZQ435AY.mjs.map +0 -1
- package/dist/open-exposure-I3DN2X4E.mjs.map +0 -1
- package/dist/open-session-2Y7XJJW2.mjs.map +0 -1
- package/dist/openLattice-Q6M5S6CY.mjs +0 -18
- package/dist/openRateLimiter-XEOL3A5G.mjs +0 -8
- package/dist/resources-DAU5ZIPB.mjs.map +0 -1
- package/dist/sandboxOpenCredentialProvider-AT227D4N.mjs.map +0 -1
- /package/dist/{A2AAuthService-7UGQ7GMW.mjs.map → A2AAuthService-UKN53ZGP.mjs.map} +0 -0
- /package/dist/{a2a-BHBLACJV.mjs.map → a2a-YLKZE5JG.mjs.map} +0 -0
- /package/dist/{openLattice-Q6M5S6CY.mjs.map → mcp-apps-QVUK6UBA.mjs.map} +0 -0
- /package/dist/{open-files-V3R2BFTV.mjs.map → open-files-JPB2NBL6.mjs.map} +0 -0
- /package/dist/{openRateLimiter-XEOL3A5G.mjs.map → openLattice-D5YTSZBY.mjs.map} +0 -0
- /package/dist/{registerExposedPlugins-6GCOE64C.mjs.map → registerExposedPlugins-2JGXSMAL.mjs.map} +0 -0
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
A2AAuthError,
|
|
3
3
|
A2AAuthService,
|
|
4
4
|
parseEnvKeys
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LCM4OQTI.mjs";
|
|
6
6
|
import "./chunk-NFEGQTCC.mjs";
|
|
7
7
|
export {
|
|
8
8
|
A2AAuthError,
|
|
9
9
|
A2AAuthService,
|
|
10
10
|
parseEnvKeys
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=A2AAuthService-
|
|
12
|
+
//# sourceMappingURL=A2AAuthService-UKN53ZGP.mjs.map
|
|
@@ -3,15 +3,17 @@ import {
|
|
|
3
3
|
refreshStoreKeyMap,
|
|
4
4
|
registerA2ARoutes,
|
|
5
5
|
setA2AAuthService,
|
|
6
|
-
setA2AKeyStore
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
setA2AKeyStore,
|
|
7
|
+
setA2AProjectAccess
|
|
8
|
+
} from "./chunk-NYYSBNDG.mjs";
|
|
9
|
+
import "./chunk-LCM4OQTI.mjs";
|
|
9
10
|
import "./chunk-NFEGQTCC.mjs";
|
|
10
11
|
export {
|
|
11
12
|
broadcastA2AKeyChanged,
|
|
12
13
|
refreshStoreKeyMap,
|
|
13
14
|
registerA2ARoutes,
|
|
14
15
|
setA2AAuthService,
|
|
15
|
-
setA2AKeyStore
|
|
16
|
+
setA2AKeyStore,
|
|
17
|
+
setA2AProjectAccess
|
|
16
18
|
};
|
|
17
|
-
//# sourceMappingURL=a2a-
|
|
19
|
+
//# sourceMappingURL=a2a-YLKZE5JG.mjs.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildAgentCardForAssistant,
|
|
3
|
-
deriveAgentSkills
|
|
4
|
-
|
|
3
|
+
deriveAgentSkills,
|
|
4
|
+
resolveRequestBaseUrl
|
|
5
|
+
} from "./chunk-SIMEG2JT.mjs";
|
|
5
6
|
import {
|
|
6
7
|
formatFileRefsSection,
|
|
7
8
|
getRunCancelRouter,
|
|
@@ -9,19 +10,19 @@ import {
|
|
|
9
10
|
saveProjectFile,
|
|
10
11
|
wakeRunTaskQueue
|
|
11
12
|
} from "./chunk-2SR4F3ZD.mjs";
|
|
13
|
+
import {
|
|
14
|
+
getRateLimitService
|
|
15
|
+
} from "./chunk-A7YNAU5L.mjs";
|
|
12
16
|
import {
|
|
13
17
|
A2AAuthError
|
|
14
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-LCM4OQTI.mjs";
|
|
15
19
|
import "./chunk-NFEGQTCC.mjs";
|
|
16
20
|
|
|
17
21
|
// src/routes/a2a-standard.ts
|
|
18
|
-
import { v4 as uuidv42 } from "uuid";
|
|
19
22
|
import {
|
|
20
23
|
A2AError as A2AError3,
|
|
21
|
-
DefaultExecutionEventBus as DefaultExecutionEventBus2,
|
|
22
24
|
DefaultRequestHandler,
|
|
23
|
-
JsonRpcTransportHandler
|
|
24
|
-
RequestContext
|
|
25
|
+
JsonRpcTransportHandler
|
|
25
26
|
} from "@a2a-js/sdk/server";
|
|
26
27
|
import { AgentCard as AgentCardV1 } from "@a2a-js/sdk-v1";
|
|
27
28
|
import {
|
|
@@ -1388,6 +1389,8 @@ var A2ATaskStoreAdapter = class {
|
|
|
1388
1389
|
if (!item || !this.isInScope(item)) return void 0;
|
|
1389
1390
|
const pageSize = 100;
|
|
1390
1391
|
let selected;
|
|
1392
|
+
let latestCompleted;
|
|
1393
|
+
let authoritative;
|
|
1391
1394
|
for (let offset = 0; ; offset += pageSize) {
|
|
1392
1395
|
const activities = await this.workItemStore.list({
|
|
1393
1396
|
tenantId: this.scope.tenantId,
|
|
@@ -1409,6 +1412,12 @@ var A2ATaskStoreAdapter = class {
|
|
|
1409
1412
|
id: activity.id
|
|
1410
1413
|
};
|
|
1411
1414
|
if (!selected || this.isLaterSnapshot(candidate, selected)) selected = candidate;
|
|
1415
|
+
if (candidate.task.status?.state === "completed" && (!latestCompleted || this.isLaterSnapshot(candidate, latestCompleted))) {
|
|
1416
|
+
latestCompleted = candidate;
|
|
1417
|
+
}
|
|
1418
|
+
if (candidate.task.status?.state === "completed" && candidate.task.metadata?.resultArtifactSource === "agent_output" && (!authoritative || this.isLaterSnapshot(candidate, authoritative))) {
|
|
1419
|
+
authoritative = candidate;
|
|
1420
|
+
}
|
|
1412
1421
|
}
|
|
1413
1422
|
if (activities.length < pageSize) break;
|
|
1414
1423
|
}
|
|
@@ -1428,8 +1437,13 @@ var A2ATaskStoreAdapter = class {
|
|
|
1428
1437
|
...contextThreadId === void 0 ? {} : { threadId: contextThreadId },
|
|
1429
1438
|
...interruption && typeof interruption === "object" ? { interruption } : {}
|
|
1430
1439
|
};
|
|
1431
|
-
const
|
|
1432
|
-
const
|
|
1440
|
+
const artifactSnapshot = item.status === "completed" ? latestCompleted?.task ?? snapshot : snapshot;
|
|
1441
|
+
const nonResultArtifacts = (artifactSnapshot.artifacts ?? []).filter((artifact) => artifact.name !== "result");
|
|
1442
|
+
const latestResult = (artifactSnapshot.artifacts ?? []).filter((artifact) => artifact.name === "result").at(-1);
|
|
1443
|
+
const markedResult = (authoritative?.task.artifacts ?? []).filter((artifact) => artifact.name === "result").at(-1);
|
|
1444
|
+
const markedResultMatchesLatest = item.status === "completed" && latestCompleted !== void 0 && latestResult !== void 0 && markedResult !== void 0 && extractText(latestResult.parts) === extractText(markedResult.parts);
|
|
1445
|
+
const authoritativeSnapshotResult = item.status === "completed" && markedResultMatchesLatest ? latestResult : void 0;
|
|
1446
|
+
const artifacts = item.status !== "completed" ? nonResultArtifacts : authoritativeSnapshotResult ? [...nonResultArtifacts, authoritativeSnapshotResult] : item.result?.trim() ? [...nonResultArtifacts, {
|
|
1433
1447
|
artifactId: `${item.id}:result`,
|
|
1434
1448
|
name: "result",
|
|
1435
1449
|
parts: [{ kind: "text", text: item.result }]
|
|
@@ -2157,14 +2171,28 @@ var AxiomAgentExecutor = class {
|
|
|
2157
2171
|
}
|
|
2158
2172
|
const canonicalResult = canonical?.artifacts?.find((artifact) => artifact.name === "result");
|
|
2159
2173
|
const canonicalText = canonicalResult ? extractText2(canonicalResult.parts).trim() : "";
|
|
2160
|
-
const
|
|
2174
|
+
const agentOutputText = outputText.trim();
|
|
2175
|
+
const resultText = agentOutputText || canonicalText || "(no output)";
|
|
2161
2176
|
const resultArtifact = {
|
|
2162
2177
|
artifactId: uuidv4(),
|
|
2163
2178
|
name: "result",
|
|
2164
2179
|
parts: [{ kind: "text", text: resultText }]
|
|
2165
2180
|
};
|
|
2181
|
+
const baseTask = this.taskFor(
|
|
2182
|
+
ctx,
|
|
2183
|
+
threadId,
|
|
2184
|
+
projection.inputFiles,
|
|
2185
|
+
projection.dependencies,
|
|
2186
|
+
projection
|
|
2187
|
+
);
|
|
2166
2188
|
const completed = {
|
|
2167
|
-
...
|
|
2189
|
+
...baseTask,
|
|
2190
|
+
...agentOutputText ? {
|
|
2191
|
+
metadata: {
|
|
2192
|
+
...baseTask.metadata ?? {},
|
|
2193
|
+
resultArtifactSource: "agent_output"
|
|
2194
|
+
}
|
|
2195
|
+
} : {},
|
|
2168
2196
|
artifacts: [...existing?.artifacts ?? [], resultArtifact],
|
|
2169
2197
|
status: { state: "completed", timestamp: isoNow() }
|
|
2170
2198
|
};
|
|
@@ -3117,15 +3145,6 @@ function getHeader(value) {
|
|
|
3117
3145
|
if (Array.isArray(value)) return value[0];
|
|
3118
3146
|
return value;
|
|
3119
3147
|
}
|
|
3120
|
-
function getSessionUser(request) {
|
|
3121
|
-
return request.user;
|
|
3122
|
-
}
|
|
3123
|
-
function buildBaseUrl(request) {
|
|
3124
|
-
const protocol = getHeader(request.headers["x-forwarded-proto"]) ?? request.protocol;
|
|
3125
|
-
const forwardedHost = getHeader(request.headers["x-forwarded-host"]);
|
|
3126
|
-
const host = forwardedHost ? forwardedHost.split(",")[0].trim() : request.host;
|
|
3127
|
-
return `${protocol}://${host}`;
|
|
3128
|
-
}
|
|
3129
3148
|
function makeFileIngestor(tenantId, maxFileBytes) {
|
|
3130
3149
|
return new A2AFileIngestor({
|
|
3131
3150
|
saveProjectFile: (params) => saveProjectFile({ tenantId, ...params }),
|
|
@@ -3317,6 +3336,12 @@ var SSE_HEADERS = {
|
|
|
3317
3336
|
};
|
|
3318
3337
|
function registerA2AStandardRoutes(app, deps) {
|
|
3319
3338
|
const authService = deps.authService;
|
|
3339
|
+
const rateLimits = deps.rateLimits ?? getRateLimitService();
|
|
3340
|
+
const enforceRateLimit = async (request, reply, dimensions, requestId) => {
|
|
3341
|
+
const decision = await rateLimits.consume("a2a.jsonrpc", dimensions);
|
|
3342
|
+
if (decision.allowed) return null;
|
|
3343
|
+
return reply.header("Retry-After", String(decision.retryAfterSeconds)).status(429).send(jsonRpcError(requestId, -32005, "Rate limited"));
|
|
3344
|
+
};
|
|
3320
3345
|
const resolveTasks = deps.getTaskStoreLattice ?? (() => getStoreLattice("default", "task").store);
|
|
3321
3346
|
const resolveTaskWorkItems = deps.getTaskWorkItemStore ?? (() => getStoreLattice("default", "taskWorkItem").store);
|
|
3322
3347
|
const getAssistantStore = deps.getAssistantStore ?? (() => getStoreLattice("default", "assistant").store);
|
|
@@ -3592,7 +3617,7 @@ function registerA2AStandardRoutes(app, deps) {
|
|
|
3592
3617
|
reply.status(200).send(
|
|
3593
3618
|
buildAgentCardForAssistant({
|
|
3594
3619
|
assistant,
|
|
3595
|
-
baseUrl:
|
|
3620
|
+
baseUrl: resolveRequestBaseUrl(request),
|
|
3596
3621
|
pushNotifications: hasPushStore(),
|
|
3597
3622
|
...officialAlias ? { jsonRpcPath: `/a2a/${assistant.id}` } : {}
|
|
3598
3623
|
})
|
|
@@ -3608,6 +3633,13 @@ function registerA2AStandardRoutes(app, deps) {
|
|
|
3608
3633
|
);
|
|
3609
3634
|
const handleJsonRpc = async (request, reply) => {
|
|
3610
3635
|
const requestId = extractRequestId(request.body);
|
|
3636
|
+
const preAuthBlocked = await enforceRateLimit(
|
|
3637
|
+
request,
|
|
3638
|
+
reply,
|
|
3639
|
+
{ ip: request.ip },
|
|
3640
|
+
requestId
|
|
3641
|
+
);
|
|
3642
|
+
if (preAuthBlocked) return;
|
|
3611
3643
|
const auth = await authService.authenticate(
|
|
3612
3644
|
getHeader(request.headers.authorization) ?? getHeader(request.headers["x-api-key"])
|
|
3613
3645
|
);
|
|
@@ -3636,6 +3668,13 @@ function registerA2AStandardRoutes(app, deps) {
|
|
|
3636
3668
|
reply.status(500).send(jsonRpcError(requestId, -32603, "Internal error"));
|
|
3637
3669
|
return;
|
|
3638
3670
|
}
|
|
3671
|
+
const blocked = await enforceRateLimit(
|
|
3672
|
+
request,
|
|
3673
|
+
reply,
|
|
3674
|
+
{ key: auth.apiKey },
|
|
3675
|
+
requestId
|
|
3676
|
+
);
|
|
3677
|
+
if (blocked) return;
|
|
3639
3678
|
const tenantId = auth.tenantId ?? "default";
|
|
3640
3679
|
const scope = {
|
|
3641
3680
|
tenantId,
|
|
@@ -3671,7 +3710,7 @@ function registerA2AStandardRoutes(app, deps) {
|
|
|
3671
3710
|
}
|
|
3672
3711
|
const extendedCard = buildAgentCardForAssistant({
|
|
3673
3712
|
assistant,
|
|
3674
|
-
baseUrl:
|
|
3713
|
+
baseUrl: resolveRequestBaseUrl(request),
|
|
3675
3714
|
pushNotifications: hasPushStore(),
|
|
3676
3715
|
...request.url.split("?")[0].startsWith("/a2a/") ? { jsonRpcPath: `/a2a/${assistant.id}` } : {}
|
|
3677
3716
|
});
|
|
@@ -3734,7 +3773,7 @@ function registerA2AStandardRoutes(app, deps) {
|
|
|
3734
3773
|
}
|
|
3735
3774
|
const card = buildAgentCardForAssistant({
|
|
3736
3775
|
assistant,
|
|
3737
|
-
baseUrl:
|
|
3776
|
+
baseUrl: resolveRequestBaseUrl(request),
|
|
3738
3777
|
pushNotifications: pushStore !== void 0,
|
|
3739
3778
|
...request.url.split("?")[0].startsWith("/a2a/") ? { jsonRpcPath: `/a2a/${assistant.id}` } : {}
|
|
3740
3779
|
});
|
|
@@ -3815,110 +3854,9 @@ data: ${JSON.stringify(errorResponse)}
|
|
|
3815
3854
|
"/a2a/:assistantId",
|
|
3816
3855
|
handleJsonRpc
|
|
3817
3856
|
);
|
|
3818
|
-
app.post(
|
|
3819
|
-
"/api/a2a/agents/:assistantId/test-call",
|
|
3820
|
-
async (request, reply) => {
|
|
3821
|
-
const user = getSessionUser(request);
|
|
3822
|
-
if (!user?.tenantId) {
|
|
3823
|
-
reply.status(401).send({ success: false, error: "Unauthorized" });
|
|
3824
|
-
return;
|
|
3825
|
-
}
|
|
3826
|
-
const tenantId = user.tenantId;
|
|
3827
|
-
const body = request.body ?? {};
|
|
3828
|
-
const { projectId, message } = body;
|
|
3829
|
-
if (!projectId) {
|
|
3830
|
-
reply.status(400).send({ error: "projectId is required" });
|
|
3831
|
-
return;
|
|
3832
|
-
}
|
|
3833
|
-
if (!message || !message.trim()) {
|
|
3834
|
-
reply.status(400).send({ error: "message is required" });
|
|
3835
|
-
return;
|
|
3836
|
-
}
|
|
3837
|
-
const assistant = await getAssistantStore().getAssistantById(
|
|
3838
|
-
tenantId,
|
|
3839
|
-
request.params.assistantId
|
|
3840
|
-
);
|
|
3841
|
-
if (!assistant) {
|
|
3842
|
-
reply.status(404).send({ error: "Assistant not found" });
|
|
3843
|
-
return;
|
|
3844
|
-
}
|
|
3845
|
-
const project = await getProjectStore().getProjectById(
|
|
3846
|
-
tenantId,
|
|
3847
|
-
projectId
|
|
3848
|
-
);
|
|
3849
|
-
if (!project || project.tenantId !== tenantId) {
|
|
3850
|
-
reply.status(403).send({ error: "Project not found" });
|
|
3851
|
-
return;
|
|
3852
|
-
}
|
|
3853
|
-
const scope = {
|
|
3854
|
-
tenantId,
|
|
3855
|
-
projectId,
|
|
3856
|
-
workspaceId: project.workspaceId,
|
|
3857
|
-
assistantId: assistant.id
|
|
3858
|
-
};
|
|
3859
|
-
const ingestor = makeFileIngestor(scope.tenantId, deps.maxFileBytes);
|
|
3860
|
-
const internalTasks = resolveTasks();
|
|
3861
|
-
const workItems = resolveTaskWorkItems();
|
|
3862
|
-
const taskStore = taskStoreFor(scope, internalTasks, workItems);
|
|
3863
|
-
const executor = new AxiomAgentExecutor({
|
|
3864
|
-
scope,
|
|
3865
|
-
assistant,
|
|
3866
|
-
taskStore,
|
|
3867
|
-
ingestor,
|
|
3868
|
-
runService: runServiceFor(scope),
|
|
3869
|
-
blocking: true,
|
|
3870
|
-
getInterrupts: (threadId) => stateResolver.getInterrupts(threadId, assistant.id, scope)
|
|
3871
|
-
});
|
|
3872
|
-
const taskId = uuidv42();
|
|
3873
|
-
const contextId = uuidv42();
|
|
3874
|
-
const userMessage = {
|
|
3875
|
-
kind: "message",
|
|
3876
|
-
messageId: uuidv42(),
|
|
3877
|
-
role: "user",
|
|
3878
|
-
parts: [{ kind: "text", text: message }]
|
|
3879
|
-
};
|
|
3880
|
-
const requestContext = new RequestContext(userMessage, taskId, contextId);
|
|
3881
|
-
const bus = new DefaultExecutionEventBus2();
|
|
3882
|
-
reply.hijack();
|
|
3883
|
-
reply.raw.writeHead(200, SSE_HEADERS);
|
|
3884
|
-
const sendEvent = (event, data) => {
|
|
3885
|
-
reply.raw.write(`event: ${event}
|
|
3886
|
-
data: ${JSON.stringify(data)}
|
|
3887
|
-
|
|
3888
|
-
`);
|
|
3889
|
-
};
|
|
3890
|
-
bus.on("event", (event) => {
|
|
3891
|
-
sendEvent(event.kind, event);
|
|
3892
|
-
});
|
|
3893
|
-
try {
|
|
3894
|
-
await executor.execute(requestContext, bus);
|
|
3895
|
-
} catch (err) {
|
|
3896
|
-
request.log.error({ err }, "a2a:test-call:execution");
|
|
3897
|
-
try {
|
|
3898
|
-
await taskStore.save({
|
|
3899
|
-
kind: "task",
|
|
3900
|
-
id: taskId,
|
|
3901
|
-
contextId,
|
|
3902
|
-
status: { state: "failed", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
3903
|
-
});
|
|
3904
|
-
} catch (saveError) {
|
|
3905
|
-
request.log.error({ err: saveError }, "a2a:test-call:settle");
|
|
3906
|
-
}
|
|
3907
|
-
sendEvent("status-update", {
|
|
3908
|
-
kind: "status-update",
|
|
3909
|
-
taskId,
|
|
3910
|
-
contextId,
|
|
3911
|
-
status: { state: "failed", timestamp: (/* @__PURE__ */ new Date()).toISOString() },
|
|
3912
|
-
final: true
|
|
3913
|
-
});
|
|
3914
|
-
} finally {
|
|
3915
|
-
reply.raw.end();
|
|
3916
|
-
}
|
|
3917
|
-
}
|
|
3918
|
-
);
|
|
3919
3857
|
const v1CardFor = (request, assistant, pushNotifications) => buildAgentCardForAssistantV1({
|
|
3920
3858
|
assistant,
|
|
3921
|
-
baseUrl:
|
|
3859
|
+
baseUrl: resolveRequestBaseUrl(request),
|
|
3922
3860
|
pushNotifications
|
|
3923
3861
|
});
|
|
3924
3862
|
const authenticateV1 = async (request) => {
|
|
@@ -3968,12 +3906,26 @@ data: ${JSON.stringify(data)}
|
|
|
3968
3906
|
reply.header("A2A-Version", "1.0").send(versionNotSupportedError(requestId, requestedVersion));
|
|
3969
3907
|
return;
|
|
3970
3908
|
}
|
|
3909
|
+
const preAuthBlocked = await enforceRateLimit(
|
|
3910
|
+
request,
|
|
3911
|
+
reply,
|
|
3912
|
+
{ ip: request.ip },
|
|
3913
|
+
requestId
|
|
3914
|
+
);
|
|
3915
|
+
if (preAuthBlocked) return;
|
|
3971
3916
|
const auth = await authenticateV1(request);
|
|
3972
3917
|
if (!auth.ok) {
|
|
3973
3918
|
reply.status(auth.status).send(jsonRpcError(requestId, authErrorToRpcCode(auth.status), auth.message));
|
|
3974
3919
|
return;
|
|
3975
3920
|
}
|
|
3976
3921
|
const rawMethod = asString4(requestBody.method);
|
|
3922
|
+
const blocked = await enforceRateLimit(
|
|
3923
|
+
request,
|
|
3924
|
+
reply,
|
|
3925
|
+
{ key: auth.auth.apiKey },
|
|
3926
|
+
requestId
|
|
3927
|
+
);
|
|
3928
|
+
if (blocked) return;
|
|
3977
3929
|
const tenantId = auth.auth.tenantId ?? "default";
|
|
3978
3930
|
const scope = {
|
|
3979
3931
|
tenantId,
|
|
@@ -4089,7 +4041,7 @@ data: ${JSON.stringify(data)}
|
|
|
4089
4041
|
}
|
|
4090
4042
|
const card = buildAgentCardForAssistant({
|
|
4091
4043
|
assistant: auth.assistant,
|
|
4092
|
-
baseUrl:
|
|
4044
|
+
baseUrl: resolveRequestBaseUrl(request),
|
|
4093
4045
|
pushNotifications: pushStore !== void 0,
|
|
4094
4046
|
jsonRpcPath: `/a2a/v1/${auth.assistant.id}`
|
|
4095
4047
|
});
|
|
@@ -4185,4 +4137,4 @@ data: ${JSON.stringify(errorResponse)}
|
|
|
4185
4137
|
export {
|
|
4186
4138
|
registerA2AStandardRoutes
|
|
4187
4139
|
};
|
|
4188
|
-
//# sourceMappingURL=a2a-standard-
|
|
4140
|
+
//# sourceMappingURL=a2a-standard-MD7WNDTP.mjs.map
|