@axiom-lattice/core 2.1.77 → 2.1.79

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/index.js CHANGED
@@ -52,7 +52,8 @@ __export(index_exports, {
52
52
  EmbeddingsLatticeManager: () => EmbeddingsLatticeManager,
53
53
  FileSystemSkillStore: () => FileSystemSkillStore,
54
54
  FilesystemBackend: () => FilesystemBackend,
55
- HumanMessage: () => import_messages5.HumanMessage,
55
+ HumanMessage: () => import_messages6.HumanMessage,
56
+ InMemoryA2AApiKeyStore: () => InMemoryA2AApiKeyStore,
56
57
  InMemoryAssistantStore: () => InMemoryAssistantStore,
57
58
  InMemoryBindingStore: () => InMemoryBindingStore,
58
59
  InMemoryChannelInstallationStore: () => InMemoryChannelInstallationStore,
@@ -1894,6 +1895,7 @@ var InMemoryProjectStore = class {
1894
1895
  workspaceId,
1895
1896
  name: data.name,
1896
1897
  description: data.description,
1898
+ config: data.config,
1897
1899
  createdAt: now,
1898
1900
  updatedAt: now
1899
1901
  };
@@ -1901,6 +1903,13 @@ var InMemoryProjectStore = class {
1901
1903
  this.projects.set(key, project);
1902
1904
  return project;
1903
1905
  }
1906
+ /**
1907
+ * Update an existing project
1908
+ *
1909
+ * @remarks
1910
+ * - The `config` field uses **replace** semantics: if provided, it completely
1911
+ * overwrites the existing config. To preserve the current config, omit this field.
1912
+ */
1904
1913
  async updateProject(tenantId, id, updates) {
1905
1914
  const key = this.getKey(tenantId, id);
1906
1915
  const existing = this.projects.get(key);
@@ -2908,6 +2917,87 @@ var InMemoryBindingStore = class {
2908
2917
  }
2909
2918
  };
2910
2919
 
2920
+ // src/store_lattice/InMemoryA2AApiKeyStore.ts
2921
+ var import_crypto2 = require("crypto");
2922
+ function generateApiKey() {
2923
+ return `a2a_${(0, import_crypto2.randomUUID)().replace(/-/g, "")}`;
2924
+ }
2925
+ var InMemoryA2AApiKeyStore = class {
2926
+ constructor() {
2927
+ this.keys = /* @__PURE__ */ new Map();
2928
+ }
2929
+ async findByKey(key) {
2930
+ for (const record of this.keys.values()) {
2931
+ if (record.key === key && record.enabled) return record;
2932
+ }
2933
+ return null;
2934
+ }
2935
+ async list(params) {
2936
+ let records = Array.from(this.keys.values());
2937
+ if (params.tenantId) {
2938
+ records = records.filter((r) => r.tenantId === params.tenantId);
2939
+ }
2940
+ const offset = params.offset || 0;
2941
+ const limit = params.limit;
2942
+ records = records.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
2943
+ return limit ? records.slice(offset, offset + limit) : records.slice(offset);
2944
+ }
2945
+ async create(input) {
2946
+ const now = /* @__PURE__ */ new Date();
2947
+ const record = {
2948
+ id: (0, import_crypto2.randomUUID)(),
2949
+ key: generateApiKey(),
2950
+ tenantId: input.tenantId,
2951
+ projectId: input.projectId,
2952
+ workspaceId: input.workspaceId,
2953
+ label: input.label,
2954
+ enabled: true,
2955
+ createdAt: now,
2956
+ updatedAt: now
2957
+ };
2958
+ this.keys.set(record.id, record);
2959
+ return record;
2960
+ }
2961
+ async disable(id) {
2962
+ const record = this.keys.get(id);
2963
+ if (!record) throw new Error(`A2A API key not found: ${id}`);
2964
+ const updated = { ...record, enabled: false, updatedAt: /* @__PURE__ */ new Date() };
2965
+ this.keys.set(id, updated);
2966
+ return updated;
2967
+ }
2968
+ async enable(id) {
2969
+ const record = this.keys.get(id);
2970
+ if (!record) throw new Error(`A2A API key not found: ${id}`);
2971
+ const updated = { ...record, enabled: true, updatedAt: /* @__PURE__ */ new Date() };
2972
+ this.keys.set(id, updated);
2973
+ return updated;
2974
+ }
2975
+ async rotate(id) {
2976
+ const record = this.keys.get(id);
2977
+ if (!record) throw new Error(`A2A API key not found: ${id}`);
2978
+ const updated = { ...record, key: generateApiKey(), updatedAt: /* @__PURE__ */ new Date() };
2979
+ this.keys.set(id, updated);
2980
+ return updated;
2981
+ }
2982
+ async delete(id) {
2983
+ this.keys.delete(id);
2984
+ }
2985
+ async loadIntoMap() {
2986
+ const map = /* @__PURE__ */ new Map();
2987
+ for (const record of this.keys.values()) {
2988
+ if (record.enabled) {
2989
+ map.set(record.key, {
2990
+ key: record.key,
2991
+ tenantId: record.tenantId,
2992
+ projectId: record.projectId,
2993
+ workspaceId: record.workspaceId
2994
+ });
2995
+ }
2996
+ }
2997
+ return map;
2998
+ }
2999
+ };
3000
+
2911
3001
  // src/store_lattice/StoreLatticeManager.ts
2912
3002
  var StoreLatticeManager = class _StoreLatticeManager extends BaseLatticeManager {
2913
3003
  /**
@@ -3082,6 +3172,12 @@ storeLatticeManager.registerLattice(
3082
3172
  "channelBinding",
3083
3173
  defaultChannelBindingStore
3084
3174
  );
3175
+ var defaultA2AApiKeyStore = new InMemoryA2AApiKeyStore();
3176
+ storeLatticeManager.registerLattice(
3177
+ "default",
3178
+ "a2aApiKey",
3179
+ defaultA2AApiKeyStore
3180
+ );
3085
3181
 
3086
3182
  // src/tool_lattice/manage_binding/index.ts
3087
3183
  function getInstallationStore() {
@@ -7169,7 +7265,7 @@ var createBrowserGetInfoTool = ({ vmIsolation }) => {
7169
7265
  };
7170
7266
 
7171
7267
  // src/index.ts
7172
- var import_messages5 = require("@langchain/core/messages");
7268
+ var import_messages6 = require("@langchain/core/messages");
7173
7269
 
7174
7270
  // src/agent_lattice/types.ts
7175
7271
  var import_protocols = require("@axiom-lattice/protocols");
@@ -18276,6 +18372,227 @@ var ProcessingAgentGraphBuilder = class {
18276
18372
  }
18277
18373
  };
18278
18374
 
18375
+ // src/agent_lattice/builders/RemoteAgentGraphBuilder.ts
18376
+ var import_langgraph14 = require("@langchain/langgraph");
18377
+ var import_messages5 = require("@langchain/core/messages");
18378
+
18379
+ // src/services/a2a-client.ts
18380
+ var import_uuid4 = require("uuid");
18381
+ var A2ARemoteError = class extends Error {
18382
+ constructor(message, statusCode, body) {
18383
+ super(message);
18384
+ this.statusCode = statusCode;
18385
+ this.body = body;
18386
+ this.name = "A2ARemoteError";
18387
+ }
18388
+ };
18389
+ var A2ARemoteClient = class {
18390
+ constructor(config) {
18391
+ this.config = config;
18392
+ this.jsonRpcUrl = null;
18393
+ this.card = null;
18394
+ }
18395
+ // ── Resolution ───────────────────────────────────────────────────────────
18396
+ /**
18397
+ * Fetch the agent card and resolve the JSON-RPC endpoint.
18398
+ */
18399
+ async resolve() {
18400
+ if (this.card) return this.card;
18401
+ const resp = await fetch(this.config.agentCardUrl, {
18402
+ signal: AbortSignal.timeout(this.config.timeout ?? 3e4)
18403
+ });
18404
+ if (!resp.ok) {
18405
+ throw new A2ARemoteError(
18406
+ `Failed to fetch agent card: HTTP ${resp.status}`,
18407
+ resp.status
18408
+ );
18409
+ }
18410
+ this.card = await resp.json();
18411
+ const card = this.card;
18412
+ const jsonRpc = card.additionalInterfaces?.find(
18413
+ (i) => i.transport === "JSONRPC"
18414
+ );
18415
+ this.jsonRpcUrl = jsonRpc?.url ?? card.url;
18416
+ return this.card;
18417
+ }
18418
+ // ── Execute ──────────────────────────────────────────────────────────────
18419
+ /**
18420
+ * Send a text prompt to the remote A2A agent and return the response.
18421
+ *
18422
+ * Supports SSE streaming (parses status-update events) and falls back
18423
+ * to polling the task status for non-streaming agents.
18424
+ */
18425
+ async sendMessage(text) {
18426
+ await this.resolve();
18427
+ const taskId = (0, import_uuid4.v4)();
18428
+ const body = JSON.stringify({
18429
+ jsonrpc: "2.0",
18430
+ method: "tasks/send",
18431
+ params: {
18432
+ id: taskId,
18433
+ message: {
18434
+ role: "user",
18435
+ parts: [{ kind: "text", text }]
18436
+ }
18437
+ },
18438
+ id: taskId
18439
+ });
18440
+ const headers = {
18441
+ "Content-Type": "application/json",
18442
+ "Accept": "text/event-stream"
18443
+ };
18444
+ if (this.config.apiKey) {
18445
+ headers["Authorization"] = `Bearer ${this.config.apiKey}`;
18446
+ }
18447
+ const resp = await fetch(this.jsonRpcUrl, {
18448
+ method: "POST",
18449
+ headers,
18450
+ body,
18451
+ signal: AbortSignal.timeout(this.config.timeout ?? 3e5)
18452
+ });
18453
+ if (!resp.ok) {
18454
+ const text2 = await resp.text().catch(() => "");
18455
+ throw new A2ARemoteError(
18456
+ `A2A request failed: HTTP ${resp.status}`,
18457
+ resp.status,
18458
+ text2
18459
+ );
18460
+ }
18461
+ const contentType = resp.headers.get("content-type") ?? "";
18462
+ if (contentType.includes("text/event-stream")) {
18463
+ return this.parseSSE(resp);
18464
+ }
18465
+ const json = await resp.json();
18466
+ return this.extractArtifactText(json);
18467
+ }
18468
+ // ── SSE Parsing ──────────────────────────────────────────────────────────
18469
+ async parseSSE(resp) {
18470
+ if (!resp.body) {
18471
+ throw new A2ARemoteError("Empty response body");
18472
+ }
18473
+ const reader = resp.body.getReader();
18474
+ const decoder = new TextDecoder();
18475
+ let buffer2 = "";
18476
+ let accumulatedText = "";
18477
+ try {
18478
+ while (true) {
18479
+ const { done, value } = await reader.read();
18480
+ if (done) break;
18481
+ buffer2 += decoder.decode(value, { stream: true });
18482
+ const lines = buffer2.split("\n");
18483
+ buffer2 = lines.pop() ?? "";
18484
+ for (const line of lines) {
18485
+ if (line.startsWith("data: ")) {
18486
+ const data = line.slice(6).trim();
18487
+ if (!data) continue;
18488
+ try {
18489
+ const event = JSON.parse(data);
18490
+ this.handleSSEEvent(event, (t) => {
18491
+ accumulatedText += t;
18492
+ });
18493
+ } catch {
18494
+ }
18495
+ }
18496
+ }
18497
+ }
18498
+ if (buffer2.startsWith("data: ")) {
18499
+ const data = buffer2.slice(6).trim();
18500
+ if (data) {
18501
+ try {
18502
+ const event = JSON.parse(data);
18503
+ this.handleSSEEvent(event, (t) => {
18504
+ accumulatedText += t;
18505
+ });
18506
+ } catch {
18507
+ }
18508
+ }
18509
+ }
18510
+ } finally {
18511
+ reader.releaseLock();
18512
+ }
18513
+ return accumulatedText;
18514
+ }
18515
+ handleSSEEvent(event, onText) {
18516
+ const e = event;
18517
+ const messageParts = e.status?.message?.parts;
18518
+ if (messageParts) {
18519
+ for (const part of messageParts) {
18520
+ if (part.text) onText(part.text);
18521
+ }
18522
+ }
18523
+ }
18524
+ // ── Artifact Extraction ──────────────────────────────────────────────────
18525
+ extractArtifactText(task) {
18526
+ const artifacts = task.artifacts ?? [];
18527
+ return artifacts.flatMap((a) => a.parts ?? []).filter((p) => p.text).map((p) => p.text).join("\n");
18528
+ }
18529
+ };
18530
+
18531
+ // src/agent_lattice/builders/RemoteAgentGraphBuilder.ts
18532
+ var import_protocols9 = require("@axiom-lattice/protocols");
18533
+ var RemoteAgentGraphBuilder = class {
18534
+ async build(agentLattice, params) {
18535
+ if (agentLattice.config.type !== import_protocols9.AgentType.A2A_REMOTE) {
18536
+ throw new Error(
18537
+ `RemoteAgentGraphBuilder received wrong agent type: ${agentLattice.config.type}`
18538
+ );
18539
+ }
18540
+ const config = agentLattice.config;
18541
+ const client = new A2ARemoteClient({
18542
+ agentCardUrl: config.agentCardUrl,
18543
+ apiKey: config.apiKey,
18544
+ timeout: config.timeout
18545
+ });
18546
+ await client.resolve();
18547
+ const remoteCallNode = async (state) => {
18548
+ const messages = state.messages ?? [];
18549
+ const text = extractLastHumanMessage(messages);
18550
+ if (!text) {
18551
+ return {
18552
+ messages: [
18553
+ new import_messages5.AIMessage("No text input provided to remote agent.")
18554
+ ]
18555
+ };
18556
+ }
18557
+ try {
18558
+ const fullPrompt = params.prompt ? `${params.prompt}
18559
+
18560
+ User request:
18561
+ ${text}` : text;
18562
+ const response = await client.sendMessage(fullPrompt);
18563
+ return {
18564
+ messages: [new import_messages5.AIMessage(response)]
18565
+ };
18566
+ } catch (error) {
18567
+ const msg = error.message ?? String(error);
18568
+ return {
18569
+ messages: [
18570
+ new import_messages5.AIMessage(`Remote A2A agent error: ${msg}`)
18571
+ ]
18572
+ };
18573
+ }
18574
+ };
18575
+ const workflow = new import_langgraph14.StateGraph(import_langgraph14.MessagesAnnotation).addNode("remote_call", remoteCallNode).addEdge("__start__", "remote_call").addEdge("remote_call", "__end__");
18576
+ return workflow.compile();
18577
+ }
18578
+ };
18579
+ function extractLastHumanMessage(messages) {
18580
+ for (let i = messages.length - 1; i >= 0; i--) {
18581
+ const msg = messages[i];
18582
+ if (msg._getType() === "human") {
18583
+ const content = msg.content;
18584
+ if (typeof content === "string") return content;
18585
+ if (Array.isArray(content)) {
18586
+ return content.filter(
18587
+ (c) => typeof c === "object" && c !== null && c.type === "text"
18588
+ ).map((c) => c.text).join("\n");
18589
+ }
18590
+ return String(content);
18591
+ }
18592
+ }
18593
+ return "";
18594
+ }
18595
+
18279
18596
  // src/agent_lattice/builders/AgentGraphBuilderFactory.ts
18280
18597
  var AgentGraphBuilderFactory = class _AgentGraphBuilderFactory {
18281
18598
  constructor() {
@@ -18299,6 +18616,7 @@ var AgentGraphBuilderFactory = class _AgentGraphBuilderFactory {
18299
18616
  this.builders.set(import_protocols.AgentType.DEEP_AGENT, new DeepAgentGraphBuilder());
18300
18617
  this.builders.set(import_protocols.AgentType.TEAM, new TeamAgentGraphBuilder());
18301
18618
  this.builders.set(import_protocols.AgentType.PROCESSING, new ProcessingAgentGraphBuilder());
18619
+ this.builders.set(import_protocols.AgentType.A2A_REMOTE, new RemoteAgentGraphBuilder());
18302
18620
  }
18303
18621
  /**
18304
18622
  * 注册自定义Builder
@@ -18325,7 +18643,7 @@ var AgentGraphBuilderFactory = class _AgentGraphBuilderFactory {
18325
18643
  };
18326
18644
 
18327
18645
  // src/agent_lattice/builders/AgentParamsBuilder.ts
18328
- var import_protocols9 = require("@axiom-lattice/protocols");
18646
+ var import_protocols10 = require("@axiom-lattice/protocols");
18329
18647
  var AgentParamsBuilder = class {
18330
18648
  /**
18331
18649
  * constructor
@@ -18343,8 +18661,8 @@ var AgentParamsBuilder = class {
18343
18661
  * @returns Agent build parameters
18344
18662
  */
18345
18663
  async buildParams(agentLattice, options) {
18346
- const skills = (0, import_protocols9.isDeepAgentConfig)(agentLattice.config) || (0, import_protocols9.isProcessingAgentConfig)(agentLattice.config) ? agentLattice.config.skillCategories : void 0;
18347
- const toolKeys = options?.overrideTools || (0, import_protocols9.getToolsFromConfig)(agentLattice.config);
18664
+ const skills = (0, import_protocols10.isDeepAgentConfig)(agentLattice.config) || (0, import_protocols10.isProcessingAgentConfig)(agentLattice.config) ? agentLattice.config.skillCategories : void 0;
18665
+ const toolKeys = options?.overrideTools || (0, import_protocols10.getToolsFromConfig)(agentLattice.config);
18348
18666
  const tools = toolKeys.map((toolKey) => {
18349
18667
  const toolLattice = toolLatticeManager.getToolLattice(toolKey);
18350
18668
  if (!toolLattice) {
@@ -18361,7 +18679,7 @@ var AgentParamsBuilder = class {
18361
18679
  if (!model) {
18362
18680
  throw new Error(`Model "${modelKey}" does not exist`);
18363
18681
  }
18364
- const subAgentKeys = (0, import_protocols9.getSubAgentsFromConfig)(agentLattice.config);
18682
+ const subAgentKeys = (0, import_protocols10.getSubAgentsFromConfig)(agentLattice.config);
18365
18683
  const subAgents = await Promise.all(subAgentKeys.map(async (agentKey) => {
18366
18684
  const subAgentLattice = await this.getAgentLatticeFunc(agentKey);
18367
18685
  if (!subAgentLattice) {
@@ -18374,7 +18692,7 @@ var AgentParamsBuilder = class {
18374
18692
  };
18375
18693
  }));
18376
18694
  let internalSubAgents = [];
18377
- if ((0, import_protocols9.isDeepAgentConfig)(agentLattice.config) || (0, import_protocols9.isProcessingAgentConfig)(agentLattice.config)) {
18695
+ if ((0, import_protocols10.isDeepAgentConfig)(agentLattice.config) || (0, import_protocols10.isProcessingAgentConfig)(agentLattice.config)) {
18378
18696
  internalSubAgents = agentLattice.config.internalSubAgents?.map((i) => ({
18379
18697
  key: i.key,
18380
18698
  config: i
@@ -18970,8 +19288,8 @@ ${body}` : `${frontmatter}
18970
19288
 
18971
19289
  // src/agent_lattice/agentArchitectTools.ts
18972
19290
  var import_zod53 = __toESM(require("zod"));
18973
- var import_uuid4 = require("uuid");
18974
- var import_protocols10 = require("@axiom-lattice/protocols");
19291
+ var import_uuid5 = require("uuid");
19292
+ var import_protocols11 = require("@axiom-lattice/protocols");
18975
19293
  function getTenantId(exeConfig) {
18976
19294
  const runConfig = exeConfig?.configurable?.runConfig || {};
18977
19295
  return runConfig.tenantId || "default";
@@ -19079,7 +19397,7 @@ registerToolLattice(
19079
19397
  key: id,
19080
19398
  name: input.name,
19081
19399
  description: input.description || "",
19082
- type: input.type === "deep_agent" ? import_protocols10.AgentType.DEEP_AGENT : import_protocols10.AgentType.REACT,
19400
+ type: input.type === "deep_agent" ? import_protocols11.AgentType.DEEP_AGENT : import_protocols11.AgentType.REACT,
19083
19401
  prompt: input.prompt,
19084
19402
  ...input.tools && input.tools.length > 0 ? { tools: input.tools } : {},
19085
19403
  ...input.middleware && input.middleware.length > 0 ? { middleware: input.middleware } : {},
@@ -19168,7 +19486,7 @@ registerToolLattice(
19168
19486
  key: id,
19169
19487
  name: input.name,
19170
19488
  description: input.description || "",
19171
- type: import_protocols10.AgentType.PROCESSING,
19489
+ type: import_protocols11.AgentType.PROCESSING,
19172
19490
  prompt: input.prompt,
19173
19491
  ...input.tools && input.tools.length > 0 ? { tools: input.tools } : {},
19174
19492
  middleware,
@@ -19236,7 +19554,7 @@ registerToolLattice(
19236
19554
  return JSON.stringify({ error: `Agent '${input.id}' not found` });
19237
19555
  }
19238
19556
  const existingConfig = existing.graphDefinition || {};
19239
- if (existingConfig.type !== import_protocols10.AgentType.PROCESSING) {
19557
+ if (existingConfig.type !== import_protocols11.AgentType.PROCESSING) {
19240
19558
  return JSON.stringify({ error: `Agent '${input.id}' is not a PROCESSING agent (type: ${existingConfig.type})` });
19241
19559
  }
19242
19560
  const normalize = (s) => s.toLowerCase().replace(/[_\-\s]/g, "");
@@ -19444,7 +19762,7 @@ registerToolLattice(
19444
19762
  if (!existing) {
19445
19763
  return JSON.stringify({ error: `Agent '${id}' not found` });
19446
19764
  }
19447
- const threadId = (0, import_uuid4.v4)();
19765
+ const threadId = (0, import_uuid5.v4)();
19448
19766
  const agent = new Agent({
19449
19767
  tenant_id: tenantId,
19450
19768
  assistant_id: id,
@@ -19468,7 +19786,7 @@ registerToolLattice(
19468
19786
  );
19469
19787
 
19470
19788
  // src/agent_lattice/agentArchitectConfig.ts
19471
- var import_protocols12 = require("@axiom-lattice/protocols");
19789
+ var import_protocols13 = require("@axiom-lattice/protocols");
19472
19790
 
19473
19791
  // src/agent_lattice/agentArchitectPrompt.ts
19474
19792
  var AGENT_ARCHITECT_PROMPT = `# Agent Architect
@@ -20108,7 +20426,7 @@ Updates a PROCESSING agent's topology edges, name, prompt, or sub-agents. Unlike
20108
20426
  `;
20109
20427
 
20110
20428
  // src/agent_lattice/agentReviewerConfig.ts
20111
- var import_protocols11 = require("@axiom-lattice/protocols");
20429
+ var import_protocols12 = require("@axiom-lattice/protocols");
20112
20430
 
20113
20431
  // src/agent_lattice/agentReviewerPrompt.ts
20114
20432
  var AGENT_REVIEWER_PROMPT = `# Agent Reviewer
@@ -20171,7 +20489,7 @@ var agentReviewerConfig = {
20171
20489
  key: AGENT_REVIEWER_KEY,
20172
20490
  name: "Agent Reviewer",
20173
20491
  description: "Review and test AI agents. Use this agent to check agent configurations for correctness and to test agents by invoking them with realistic messages.",
20174
- type: import_protocols11.AgentType.REACT,
20492
+ type: import_protocols12.AgentType.REACT,
20175
20493
  prompt: AGENT_REVIEWER_PROMPT,
20176
20494
  tools: [
20177
20495
  "invoke_agent",
@@ -20197,7 +20515,7 @@ var agentArchitectConfig = {
20197
20515
  key: AGENT_ARCHITECT_KEY,
20198
20516
  name: "Agent Architect",
20199
20517
  description: "Design and manage AI agents through natural language conversation. Use this agent when you want to create a new agent, modify an existing agent, or manage your agent collection (list, view, update, delete).",
20200
- type: import_protocols12.AgentType.DEEP_AGENT,
20518
+ type: import_protocols13.AgentType.DEEP_AGENT,
20201
20519
  prompt: AGENT_ARCHITECT_PROMPT,
20202
20520
  tools: [
20203
20521
  "list_agents",
@@ -20863,7 +21181,7 @@ var getVectorStoreLattice = (key) => vectorStoreLatticeManager.getVectorStoreLat
20863
21181
  var getVectorStoreClient = (key) => vectorStoreLatticeManager.getVectorStoreClient(key);
20864
21182
 
20865
21183
  // src/logger_lattice/LoggerLatticeManager.ts
20866
- var import_protocols13 = require("@axiom-lattice/protocols");
21184
+ var import_protocols14 = require("@axiom-lattice/protocols");
20867
21185
 
20868
21186
  // src/logger_lattice/PinoLoggerClient.ts
20869
21187
  var import_pino = __toESM(require("pino"));
@@ -21085,11 +21403,11 @@ var LoggerLatticeManager = class _LoggerLatticeManager extends BaseLatticeManage
21085
21403
  if (client) {
21086
21404
  loggerClient = client;
21087
21405
  } else {
21088
- if (config.type === import_protocols13.LoggerType.PINO) {
21406
+ if (config.type === import_protocols14.LoggerType.PINO) {
21089
21407
  loggerClient = new PinoLoggerClient(config);
21090
- } else if (config.type === import_protocols13.LoggerType.CONSOLE) {
21408
+ } else if (config.type === import_protocols14.LoggerType.CONSOLE) {
21091
21409
  loggerClient = new ConsoleLoggerClient(config);
21092
- } else if (config.type === import_protocols13.LoggerType.CUSTOM) {
21410
+ } else if (config.type === import_protocols14.LoggerType.CUSTOM) {
21093
21411
  throw new Error(
21094
21412
  `Custom logger client must be provided. Please pass the client to registerLattice.`
21095
21413
  );
@@ -22939,7 +23257,7 @@ function createSandboxProvider(config) {
22939
23257
  var Protocols = __toESM(require("@axiom-lattice/protocols"));
22940
23258
 
22941
23259
  // src/util/encryption.ts
22942
- var import_crypto2 = require("crypto");
23260
+ var import_crypto3 = require("crypto");
22943
23261
  var ALGORITHM = "aes-256-gcm";
22944
23262
  var IV_LENGTH = 16;
22945
23263
  var SALT_LENGTH = 32;
@@ -22952,7 +23270,7 @@ function getEncryptionKey() {
22952
23270
  return cachedKey;
22953
23271
  }
22954
23272
  const key = process.env.LATTICE_ENCRYPTION_KEY || DEFAULT_ENCRYPTION_KEY;
22955
- cachedKey = (0, import_crypto2.pbkdf2Sync)(key, "lattice-encryption-salt", ITERATIONS, 32, "sha256");
23273
+ cachedKey = (0, import_crypto3.pbkdf2Sync)(key, "lattice-encryption-salt", ITERATIONS, 32, "sha256");
22956
23274
  if (!keyValidated) {
22957
23275
  keyValidated = true;
22958
23276
  validateEncryptionKey();
@@ -22961,10 +23279,10 @@ function getEncryptionKey() {
22961
23279
  }
22962
23280
  function encrypt(plaintext, key) {
22963
23281
  const actualKey = key || getEncryptionKey();
22964
- const salt = (0, import_crypto2.randomBytes)(SALT_LENGTH);
22965
- const iv = (0, import_crypto2.randomBytes)(IV_LENGTH);
22966
- const derivedKey = (0, import_crypto2.pbkdf2Sync)(actualKey, salt, ITERATIONS, 32, "sha256");
22967
- const cipher = (0, import_crypto2.createCipheriv)(ALGORITHM, derivedKey, iv);
23282
+ const salt = (0, import_crypto3.randomBytes)(SALT_LENGTH);
23283
+ const iv = (0, import_crypto3.randomBytes)(IV_LENGTH);
23284
+ const derivedKey = (0, import_crypto3.pbkdf2Sync)(actualKey, salt, ITERATIONS, 32, "sha256");
23285
+ const cipher = (0, import_crypto3.createCipheriv)(ALGORITHM, derivedKey, iv);
22968
23286
  const encrypted = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]);
22969
23287
  const authTag = cipher.getAuthTag();
22970
23288
  return Buffer.concat([salt, iv, encrypted, authTag]).toString("base64");
@@ -22976,8 +23294,8 @@ function decrypt(encrypted, key) {
22976
23294
  const iv = data.subarray(SALT_LENGTH, SALT_LENGTH + IV_LENGTH);
22977
23295
  const authTag = data.subarray(-16);
22978
23296
  const ciphertext = data.subarray(SALT_LENGTH + IV_LENGTH, -16);
22979
- const derivedKey = (0, import_crypto2.pbkdf2Sync)(actualKey, salt, ITERATIONS, 32, "sha256");
22980
- const decipher = (0, import_crypto2.createDecipheriv)(ALGORITHM, derivedKey, iv);
23297
+ const derivedKey = (0, import_crypto3.pbkdf2Sync)(actualKey, salt, ITERATIONS, 32, "sha256");
23298
+ const decipher = (0, import_crypto3.createDecipheriv)(ALGORITHM, derivedKey, iv);
22981
23299
  decipher.setAuthTag(authTag);
22982
23300
  return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
22983
23301
  }
@@ -23026,6 +23344,7 @@ function clearEncryptionKeyCache() {
23026
23344
  FileSystemSkillStore,
23027
23345
  FilesystemBackend,
23028
23346
  HumanMessage,
23347
+ InMemoryA2AApiKeyStore,
23029
23348
  InMemoryAssistantStore,
23030
23349
  InMemoryBindingStore,
23031
23350
  InMemoryChannelInstallationStore,