@axiom-lattice/core 4.2.3 → 4.2.4
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.d.mts +44 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +1051 -973
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +983 -905
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8546,7 +8546,7 @@ var createBrowserGetInfoTool = ({ vmIsolation }) => {
|
|
|
8546
8546
|
};
|
|
8547
8547
|
|
|
8548
8548
|
// src/index.ts
|
|
8549
|
-
import { HumanMessage as
|
|
8549
|
+
import { HumanMessage as HumanMessage6 } from "@langchain/core/messages";
|
|
8550
8550
|
|
|
8551
8551
|
// src/agent_lattice/types.ts
|
|
8552
8552
|
import {
|
|
@@ -11510,7 +11510,7 @@ var ConnectionRegistry = class {
|
|
|
11510
11510
|
ConnectionRegistry.store = null;
|
|
11511
11511
|
|
|
11512
11512
|
// src/agent_lattice/builders/commonMiddleware.ts
|
|
11513
|
-
import { createMiddleware as
|
|
11513
|
+
import { createMiddleware as createMiddleware11 } from "langchain";
|
|
11514
11514
|
|
|
11515
11515
|
// src/agent_lattice/builders/taskMiddlewareValidation.ts
|
|
11516
11516
|
var REQUIRED_TASK_TOOLS = ["manage_task", "task"];
|
|
@@ -11880,373 +11880,6 @@ function createCapabilityGuardMiddleware(registry4) {
|
|
|
11880
11880
|
});
|
|
11881
11881
|
}
|
|
11882
11882
|
|
|
11883
|
-
// src/middlewares/projectRoomMiddleware.ts
|
|
11884
|
-
import { createHash as createHash3 } from "crypto";
|
|
11885
|
-
import {
|
|
11886
|
-
descriptorDataValue,
|
|
11887
|
-
parseTrustedRunContext as parseTrustedRunContext2,
|
|
11888
|
-
snapshotExactArray as snapshotExactArray2,
|
|
11889
|
-
snapshotExactRecord as snapshotExactRecord2
|
|
11890
|
-
} from "@axiom-lattice/protocols";
|
|
11891
|
-
import { createMiddleware as createMiddleware11, tool as tool39 } from "langchain";
|
|
11892
|
-
import { z as z41 } from "zod";
|
|
11893
|
-
|
|
11894
|
-
// src/services/RoomAgentMessageService.ts
|
|
11895
|
-
import { randomUUID as randomUUID5 } from "crypto";
|
|
11896
|
-
import { snapshotExactArray, snapshotExactRecord } from "@axiom-lattice/protocols";
|
|
11897
|
-
var INPUT_KEYS = [
|
|
11898
|
-
"tenantId",
|
|
11899
|
-
"workspaceId",
|
|
11900
|
-
"projectId",
|
|
11901
|
-
"roomId",
|
|
11902
|
-
"membershipId",
|
|
11903
|
-
"assistantId",
|
|
11904
|
-
"text",
|
|
11905
|
-
"sourceRoomMessageId",
|
|
11906
|
-
"sourceId",
|
|
11907
|
-
"idempotencyKey"
|
|
11908
|
-
];
|
|
11909
|
-
var REPLY_INPUT_KEYS = ["tenantId", "membershipId", "text", "sourceRoomMessageId", "inputMessageId", "sourceId", "idempotencyKey"];
|
|
11910
|
-
var RoomAgentMessageService = class {
|
|
11911
|
-
/**
|
|
11912
|
-
* Creates a room writer over the durable membership and message stores.
|
|
11913
|
-
*
|
|
11914
|
-
* @param deps Store methods, optional deterministic ID factory, and detached post-commit hooks.
|
|
11915
|
-
*/
|
|
11916
|
-
constructor(deps) {
|
|
11917
|
-
this.deps = deps;
|
|
11918
|
-
}
|
|
11919
|
-
/**
|
|
11920
|
-
* Persists a fully scoped Agent response after validating its human source and active membership.
|
|
11921
|
-
*
|
|
11922
|
-
* @param input Exact trusted scope and response payload.
|
|
11923
|
-
* @returns A deep clone of the canonical idempotent room message.
|
|
11924
|
-
*/
|
|
11925
|
-
post(input) {
|
|
11926
|
-
const snapshot = exactStringRecord(input, INPUT_KEYS, "Invalid project room message input");
|
|
11927
|
-
return this.persist(snapshot);
|
|
11928
|
-
}
|
|
11929
|
-
/**
|
|
11930
|
-
* Persists a channel reply while deriving all scope from validated durable records.
|
|
11931
|
-
*
|
|
11932
|
-
* @param input Exact correlation IDs, tenant, target membership, and response text.
|
|
11933
|
-
* @returns A deep clone of the canonical idempotent room message.
|
|
11934
|
-
*/
|
|
11935
|
-
postReply(input) {
|
|
11936
|
-
const snapshot = exactStringRecord(input, REPLY_INPUT_KEYS, "Invalid project room reply input");
|
|
11937
|
-
if (snapshot.sourceId !== `reply:${snapshot.inputMessageId}` || snapshot.idempotencyKey !== `room-reply:${snapshot.sourceRoomMessageId}:${snapshot.membershipId}:${snapshot.sourceId}`) {
|
|
11938
|
-
throw new Error("Invalid project room reply correlation");
|
|
11939
|
-
}
|
|
11940
|
-
return this.persistDerived(snapshot);
|
|
11941
|
-
}
|
|
11942
|
-
async persistDerived(input) {
|
|
11943
|
-
const source = snapshotSource(await this.deps.messages.findById(input.tenantId, input.sourceRoomMessageId));
|
|
11944
|
-
if (!source || source.id !== input.sourceRoomMessageId || source.tenantId !== input.tenantId) throw new Error("Invalid project room message");
|
|
11945
|
-
const member = snapshotMembership(await this.deps.memberships.findById(input.tenantId, input.membershipId));
|
|
11946
|
-
if (!member || member.id !== input.membershipId || member.tenantId !== input.tenantId) throw new Error("Invalid project room membership");
|
|
11947
|
-
return this.persist({
|
|
11948
|
-
...input,
|
|
11949
|
-
workspaceId: source.workspaceId,
|
|
11950
|
-
projectId: source.projectId,
|
|
11951
|
-
roomId: source.roomId,
|
|
11952
|
-
assistantId: member.assistantId
|
|
11953
|
-
}, source, member);
|
|
11954
|
-
}
|
|
11955
|
-
async persist(input, loadedSource, loadedMember) {
|
|
11956
|
-
const text = input.text.trim();
|
|
11957
|
-
if (text.length < 1 || text.length > 2e4) throw new Error("Invalid project room message text");
|
|
11958
|
-
const source = loadedSource ?? snapshotSource(await this.deps.messages.findById(input.tenantId, input.sourceRoomMessageId));
|
|
11959
|
-
if (!source || source.id !== input.sourceRoomMessageId || source.tenantId !== input.tenantId || source.workspaceId !== input.workspaceId || source.projectId !== input.projectId || source.roomId !== input.roomId) {
|
|
11960
|
-
throw new Error("Invalid project room message");
|
|
11961
|
-
}
|
|
11962
|
-
const member = loadedMember ?? snapshotMembership(await this.deps.memberships.findById(input.tenantId, input.membershipId));
|
|
11963
|
-
if (!member || member.id !== input.membershipId || member.status !== "active" || member.assistantId !== input.assistantId || member.tenantId !== input.tenantId || member.workspaceId !== input.workspaceId || member.projectId !== input.projectId || member.roomId !== input.roomId) {
|
|
11964
|
-
throw new Error("Invalid project room membership");
|
|
11965
|
-
}
|
|
11966
|
-
const candidate = {
|
|
11967
|
-
id: (this.deps.idFactory ?? randomUUID5)(),
|
|
11968
|
-
tenantId: input.tenantId,
|
|
11969
|
-
workspaceId: input.workspaceId,
|
|
11970
|
-
projectId: input.projectId,
|
|
11971
|
-
roomId: input.roomId,
|
|
11972
|
-
author: { type: "bot", membershipId: input.membershipId, assistantId: input.assistantId },
|
|
11973
|
-
content: { type: "text", text },
|
|
11974
|
-
mentions: [],
|
|
11975
|
-
replyToMessageId: input.sourceRoomMessageId,
|
|
11976
|
-
source: "agent",
|
|
11977
|
-
sourceId: input.sourceId,
|
|
11978
|
-
idempotencyKey: input.idempotencyKey
|
|
11979
|
-
};
|
|
11980
|
-
const canonical = snapshotCanonical(await this.deps.messages.createIdempotent(candidate), candidate);
|
|
11981
|
-
if (!canonical) throw new Error("Invalid canonical project room message");
|
|
11982
|
-
const result = structuredClone(canonical);
|
|
11983
|
-
this.notifyCommitted(result);
|
|
11984
|
-
return result;
|
|
11985
|
-
}
|
|
11986
|
-
notifyCommitted(message) {
|
|
11987
|
-
const callback = this.deps.onMessageCommitted;
|
|
11988
|
-
if (!callback) return;
|
|
11989
|
-
Promise.resolve().then(() => callback(structuredClone(message))).catch(() => {
|
|
11990
|
-
try {
|
|
11991
|
-
this.deps.onCallbackFailure?.({ messageId: message.id, code: "ROOM_MESSAGE_COMMIT_CALLBACK_FAILED" });
|
|
11992
|
-
} catch {
|
|
11993
|
-
}
|
|
11994
|
-
});
|
|
11995
|
-
}
|
|
11996
|
-
};
|
|
11997
|
-
function exactValues(value, required, optional = []) {
|
|
11998
|
-
try {
|
|
11999
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
12000
|
-
return snapshotExactRecord(value, required, optional);
|
|
12001
|
-
} catch {
|
|
12002
|
-
return void 0;
|
|
12003
|
-
}
|
|
12004
|
-
}
|
|
12005
|
-
function exactStringRecord(value, keys, message) {
|
|
12006
|
-
const values = exactValues(value, keys);
|
|
12007
|
-
if (!values || keys.some((key4) => typeof values[key4] !== "string" || values[key4].length === 0)) throw new Error(message);
|
|
12008
|
-
return values;
|
|
12009
|
-
}
|
|
12010
|
-
function date(value) {
|
|
12011
|
-
try {
|
|
12012
|
-
const timestamp = Date.prototype.getTime.call(value);
|
|
12013
|
-
return Number.isFinite(timestamp) ? new Date(timestamp) : void 0;
|
|
12014
|
-
} catch {
|
|
12015
|
-
return void 0;
|
|
12016
|
-
}
|
|
12017
|
-
}
|
|
12018
|
-
function snapshotSource(value) {
|
|
12019
|
-
const values = exactValues(value, ["id", "tenantId", "workspaceId", "projectId", "roomId", "author", "content", "mentions", "source", "createdAt"], ["replyToMessageId", "sourceId", "idempotencyKey"]);
|
|
12020
|
-
const author = exactValues(values?.author, ["type", "userId"]);
|
|
12021
|
-
const content = exactValues(values?.content, ["type", "text"]);
|
|
12022
|
-
const createdAt = date(values?.createdAt);
|
|
12023
|
-
const mentions = snapshotMentions(values?.mentions);
|
|
12024
|
-
if (!values || values.source !== "user" || author?.type !== "human" || typeof author.userId !== "string" || !author.userId || content?.type !== "text" || typeof content.text !== "string" || !mentions || !createdAt || ["id", "tenantId", "workspaceId", "projectId", "roomId"].some((key4) => typeof values[key4] !== "string" || !values[key4])) return void 0;
|
|
12025
|
-
return {
|
|
12026
|
-
id: values.id,
|
|
12027
|
-
tenantId: values.tenantId,
|
|
12028
|
-
workspaceId: values.workspaceId,
|
|
12029
|
-
projectId: values.projectId,
|
|
12030
|
-
roomId: values.roomId,
|
|
12031
|
-
author: { type: "human", userId: author.userId },
|
|
12032
|
-
content: { type: "text", text: content.text },
|
|
12033
|
-
mentions,
|
|
12034
|
-
source: "user",
|
|
12035
|
-
createdAt
|
|
12036
|
-
};
|
|
12037
|
-
}
|
|
12038
|
-
function snapshotMentions(value) {
|
|
12039
|
-
const rows = snapshotExactArray(value);
|
|
12040
|
-
if (!rows) return void 0;
|
|
12041
|
-
const mentions = [];
|
|
12042
|
-
for (const row of rows) {
|
|
12043
|
-
const team = exactValues(row, ["type"]);
|
|
12044
|
-
if (team?.type === "team") {
|
|
12045
|
-
mentions.push({ type: "team" });
|
|
12046
|
-
continue;
|
|
12047
|
-
}
|
|
12048
|
-
const bot = exactValues(row, ["type", "membershipId"]);
|
|
12049
|
-
if (bot?.type !== "bot" || typeof bot.membershipId !== "string" || !bot.membershipId) return void 0;
|
|
12050
|
-
mentions.push({ type: "bot", membershipId: bot.membershipId });
|
|
12051
|
-
}
|
|
12052
|
-
return mentions;
|
|
12053
|
-
}
|
|
12054
|
-
function snapshotMembership(value) {
|
|
12055
|
-
const required = ["id", "tenantId", "workspaceId", "projectId", "roomId", "assistantId", "role", "title", "mentionName", "status", "roomThreadId", "joinedAt", "updatedAt"];
|
|
12056
|
-
const values = exactValues(value, required, ["responsibility"]);
|
|
12057
|
-
const joinedAt = date(values?.joinedAt);
|
|
12058
|
-
const updatedAt = date(values?.updatedAt);
|
|
12059
|
-
if (!values || required.slice(0, 7).some((key4) => typeof values[key4] !== "string" || !values[key4]) || values.role !== "coordinator" && values.role !== "specialist" || typeof values.title !== "string" || !values.title || typeof values.mentionName !== "string" || !values.mentionName || !["active", "paused", "removed"].includes(values.status) || typeof values.roomThreadId !== "string" || !values.roomThreadId || values.responsibility !== void 0 && typeof values.responsibility !== "string" || !joinedAt || !updatedAt) return void 0;
|
|
12060
|
-
return { ...values, joinedAt, updatedAt };
|
|
12061
|
-
}
|
|
12062
|
-
function snapshotCanonical(value, expected) {
|
|
12063
|
-
const values = exactValues(value, ["id", "tenantId", "workspaceId", "projectId", "roomId", "author", "content", "mentions", "replyToMessageId", "source", "sourceId", "idempotencyKey", "createdAt"]);
|
|
12064
|
-
const author = exactValues(values?.author, ["type", "membershipId", "assistantId"]);
|
|
12065
|
-
const content = exactValues(values?.content, ["type", "text"]);
|
|
12066
|
-
const createdAt = date(values?.createdAt);
|
|
12067
|
-
if (!values || !createdAt || typeof values.id !== "string" || values.id.length === 0 || snapshotExactArray(values.mentions)?.length !== 0 || author?.type !== "bot" || expected.author.type !== "bot" || author.membershipId !== expected.author.membershipId || author.assistantId !== expected.author.assistantId || content?.type !== "text" || content.text !== expected.content.text || values.tenantId !== expected.tenantId || values.workspaceId !== expected.workspaceId || values.projectId !== expected.projectId || values.roomId !== expected.roomId || values.replyToMessageId !== expected.replyToMessageId || values.source !== "agent" || values.sourceId !== expected.sourceId || values.idempotencyKey !== expected.idempotencyKey) return void 0;
|
|
12068
|
-
return {
|
|
12069
|
-
id: values.id,
|
|
12070
|
-
tenantId: expected.tenantId,
|
|
12071
|
-
workspaceId: expected.workspaceId,
|
|
12072
|
-
projectId: expected.projectId,
|
|
12073
|
-
roomId: expected.roomId,
|
|
12074
|
-
author: { type: "bot", membershipId: expected.author.membershipId, assistantId: expected.author.assistantId },
|
|
12075
|
-
content: { type: "text", text: expected.content.text },
|
|
12076
|
-
mentions: [],
|
|
12077
|
-
replyToMessageId: expected.replyToMessageId,
|
|
12078
|
-
source: "agent",
|
|
12079
|
-
sourceId: expected.sourceId,
|
|
12080
|
-
idempotencyKey: expected.idempotencyKey,
|
|
12081
|
-
createdAt
|
|
12082
|
-
};
|
|
12083
|
-
}
|
|
12084
|
-
|
|
12085
|
-
// src/middlewares/projectRoomMiddleware.ts
|
|
12086
|
-
var PROJECT_ROOM_CONTEXT_REQUIRED = "PROJECT_ROOM_CONTEXT_REQUIRED";
|
|
12087
|
-
var PROJECT_ROOM_POST_FAILED = "PROJECT_ROOM_POST_FAILED";
|
|
12088
|
-
var PROJECT_ROOM_ROSTER_FAILED = "PROJECT_ROOM_ROSTER_FAILED";
|
|
12089
|
-
var PROJECT_ROOM_POST_FAILED_MESSAGE = "Project room message could not be posted";
|
|
12090
|
-
var PROJECT_ROOM_ROSTER_FAILED_MESSAGE = "Project room roster is unavailable";
|
|
12091
|
-
var CONTEXT_REQUIRED = JSON.stringify({
|
|
12092
|
-
success: false,
|
|
12093
|
-
error: PROJECT_ROOM_CONTEXT_REQUIRED
|
|
12094
|
-
});
|
|
12095
|
-
var POST_FAILED = JSON.stringify({
|
|
12096
|
-
success: false,
|
|
12097
|
-
error: PROJECT_ROOM_POST_FAILED,
|
|
12098
|
-
message: PROJECT_ROOM_POST_FAILED_MESSAGE
|
|
12099
|
-
});
|
|
12100
|
-
var ROSTER_FAILED = JSON.stringify({
|
|
12101
|
-
success: false,
|
|
12102
|
-
error: PROJECT_ROOM_ROSTER_FAILED,
|
|
12103
|
-
message: PROJECT_ROOM_ROSTER_FAILED_MESSAGE
|
|
12104
|
-
});
|
|
12105
|
-
var postSchema = z41.object({
|
|
12106
|
-
text: z41.string().trim().min(1).max(2e4)
|
|
12107
|
-
}).strict();
|
|
12108
|
-
var listSchema = z41.object({}).strict();
|
|
12109
|
-
function ownDataValue(record, key4) {
|
|
12110
|
-
if (typeof record !== "object" || record === null || Array.isArray(record)) return void 0;
|
|
12111
|
-
try {
|
|
12112
|
-
const descriptor = Object.getOwnPropertyDescriptor(record, key4);
|
|
12113
|
-
return descriptorDataValue(descriptor)?.value;
|
|
12114
|
-
} catch {
|
|
12115
|
-
return void 0;
|
|
12116
|
-
}
|
|
12117
|
-
}
|
|
12118
|
-
function readTrustedRoomScope(config) {
|
|
12119
|
-
const configurable = ownDataValue(config, "configurable");
|
|
12120
|
-
const runConfig = ownDataValue(configurable, "runConfig");
|
|
12121
|
-
const projectRoom = ownDataValue(runConfig, "projectRoom");
|
|
12122
|
-
try {
|
|
12123
|
-
return parseTrustedRunContext2({ projectRoom }).projectRoom;
|
|
12124
|
-
} catch {
|
|
12125
|
-
return void 0;
|
|
12126
|
-
}
|
|
12127
|
-
}
|
|
12128
|
-
function exactValues2(value, required, optional = []) {
|
|
12129
|
-
try {
|
|
12130
|
-
return snapshotExactRecord2(value, required, optional);
|
|
12131
|
-
} catch {
|
|
12132
|
-
return void 0;
|
|
12133
|
-
}
|
|
12134
|
-
}
|
|
12135
|
-
function safeDate(value) {
|
|
12136
|
-
try {
|
|
12137
|
-
const timestamp = Date.prototype.getTime.call(value);
|
|
12138
|
-
return Number.isFinite(timestamp) ? new Date(timestamp) : void 0;
|
|
12139
|
-
} catch {
|
|
12140
|
-
return void 0;
|
|
12141
|
-
}
|
|
12142
|
-
}
|
|
12143
|
-
function snapshotMembership2(value) {
|
|
12144
|
-
const required = [
|
|
12145
|
-
"id",
|
|
12146
|
-
"tenantId",
|
|
12147
|
-
"workspaceId",
|
|
12148
|
-
"projectId",
|
|
12149
|
-
"roomId",
|
|
12150
|
-
"assistantId",
|
|
12151
|
-
"role",
|
|
12152
|
-
"title",
|
|
12153
|
-
"mentionName",
|
|
12154
|
-
"status",
|
|
12155
|
-
"roomThreadId",
|
|
12156
|
-
"joinedAt",
|
|
12157
|
-
"updatedAt"
|
|
12158
|
-
];
|
|
12159
|
-
const values = exactValues2(value, required, ["responsibility"]);
|
|
12160
|
-
const joinedAt = safeDate(values?.joinedAt);
|
|
12161
|
-
const updatedAt = safeDate(values?.updatedAt);
|
|
12162
|
-
if (!values || !joinedAt || !updatedAt || required.slice(0, 6).some((key4) => typeof values[key4] !== "string" || values[key4] === "") || values.role !== "coordinator" && values.role !== "specialist" || typeof values.title !== "string" || values.title === "" || typeof values.mentionName !== "string" || values.mentionName === "" || !["active", "paused", "removed"].includes(values.status) || typeof values.roomThreadId !== "string" || values.roomThreadId === "" || values.responsibility !== void 0 && typeof values.responsibility !== "string") return void 0;
|
|
12163
|
-
return { ...values, joinedAt, updatedAt };
|
|
12164
|
-
}
|
|
12165
|
-
function snapshotRows(value) {
|
|
12166
|
-
return snapshotExactArray2(value) ?? [];
|
|
12167
|
-
}
|
|
12168
|
-
async function hasActiveCurrentMembership(scope) {
|
|
12169
|
-
const memberships = getStoreLattice("default", "projectBotMembership").store;
|
|
12170
|
-
const member = snapshotMembership2(await memberships.findById(scope.tenantId, scope.membershipId));
|
|
12171
|
-
if (!member || member.status !== "active" || member.id !== scope.membershipId || member.tenantId !== scope.tenantId || member.workspaceId !== scope.workspaceId || member.projectId !== scope.projectId || member.roomId !== scope.roomId || member.assistantId !== scope.assistantId) return false;
|
|
12172
|
-
return true;
|
|
12173
|
-
}
|
|
12174
|
-
function createProjectRoomMiddleware() {
|
|
12175
|
-
return createMiddleware11({
|
|
12176
|
-
name: "ProjectRoomMiddleware",
|
|
12177
|
-
tools: [
|
|
12178
|
-
tool39(async (input, config) => {
|
|
12179
|
-
const { text } = input;
|
|
12180
|
-
const scope = readTrustedRoomScope(config);
|
|
12181
|
-
if (!scope) return CONTEXT_REQUIRED;
|
|
12182
|
-
const digest = createHash3("sha256").update(text).digest("hex");
|
|
12183
|
-
try {
|
|
12184
|
-
const service2 = new RoomAgentMessageService({
|
|
12185
|
-
memberships: getStoreLattice("default", "projectBotMembership").store,
|
|
12186
|
-
messages: getStoreLattice("default", "projectRoomMessage").store
|
|
12187
|
-
});
|
|
12188
|
-
await service2.post({
|
|
12189
|
-
tenantId: scope.tenantId,
|
|
12190
|
-
workspaceId: scope.workspaceId,
|
|
12191
|
-
projectId: scope.projectId,
|
|
12192
|
-
roomId: scope.roomId,
|
|
12193
|
-
membershipId: scope.membershipId,
|
|
12194
|
-
assistantId: scope.assistantId,
|
|
12195
|
-
text,
|
|
12196
|
-
sourceRoomMessageId: scope.sourceRoomMessageId,
|
|
12197
|
-
sourceId: `${scope.inputMessageId}:${digest}`,
|
|
12198
|
-
idempotencyKey: `room-tool:${scope.inputMessageId}:${scope.membershipId}:${digest}`
|
|
12199
|
-
});
|
|
12200
|
-
return JSON.stringify({ success: true, message: "Project room message posted" });
|
|
12201
|
-
} catch {
|
|
12202
|
-
return POST_FAILED;
|
|
12203
|
-
}
|
|
12204
|
-
}, {
|
|
12205
|
-
name: "post_room_message",
|
|
12206
|
-
description: "Post a text reply to the current trusted Project Room message",
|
|
12207
|
-
schema: postSchema
|
|
12208
|
-
}),
|
|
12209
|
-
tool39(async (_input, config) => {
|
|
12210
|
-
const scope = readTrustedRoomScope(config);
|
|
12211
|
-
if (!scope) return CONTEXT_REQUIRED;
|
|
12212
|
-
try {
|
|
12213
|
-
if (!await hasActiveCurrentMembership(scope)) return CONTEXT_REQUIRED;
|
|
12214
|
-
const rows = await getStoreLattice("default", "projectBotMembership").store.list(scope.tenantId, scope.projectId);
|
|
12215
|
-
const members = snapshotRows(rows).map(snapshotMembership2).filter((member) => member !== void 0 && member.status === "active" && member.tenantId === scope.tenantId && member.workspaceId === scope.workspaceId && member.projectId === scope.projectId && member.roomId === scope.roomId).sort((left, right) => left.joinedAt.getTime() - right.joinedAt.getTime() || (left.id < right.id ? -1 : left.id > right.id ? 1 : 0)).map((member) => ({
|
|
12216
|
-
assistantId: member.assistantId,
|
|
12217
|
-
mentionName: member.mentionName,
|
|
12218
|
-
title: member.title,
|
|
12219
|
-
...member.responsibility === void 0 ? {} : { responsibility: member.responsibility },
|
|
12220
|
-
role: member.role
|
|
12221
|
-
}));
|
|
12222
|
-
return JSON.stringify({ success: true, members });
|
|
12223
|
-
} catch {
|
|
12224
|
-
return ROSTER_FAILED;
|
|
12225
|
-
}
|
|
12226
|
-
}, {
|
|
12227
|
-
name: "list_room_roster",
|
|
12228
|
-
description: "List active Agent roles in the current trusted Project Room, including assistantId for delegation",
|
|
12229
|
-
schema: listSchema
|
|
12230
|
-
})
|
|
12231
|
-
]
|
|
12232
|
-
});
|
|
12233
|
-
}
|
|
12234
|
-
var projectRoomPlugin = {
|
|
12235
|
-
meta: {
|
|
12236
|
-
type: "project_room",
|
|
12237
|
-
category: "assistant",
|
|
12238
|
-
name: "Project Room",
|
|
12239
|
-
description: "Trusted Project Room posting and active roster tools",
|
|
12240
|
-
tools: [
|
|
12241
|
-
{ name: "post_room_message", description: "Post to the current trusted Project Room" },
|
|
12242
|
-
{ name: "list_room_roster", description: "List active Agents in the current trusted Project Room" }
|
|
12243
|
-
],
|
|
12244
|
-
configSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
12245
|
-
defaultConfig: {}
|
|
12246
|
-
},
|
|
12247
|
-
middleware: () => createProjectRoomMiddleware()
|
|
12248
|
-
};
|
|
12249
|
-
|
|
12250
11883
|
// src/agent_lattice/builders/commonMiddleware.ts
|
|
12251
11884
|
var SKILL_RESOURCE_SELECTOR = Object.freeze({
|
|
12252
11885
|
argumentField: "skill_name",
|
|
@@ -12417,7 +12050,7 @@ async function resolveAllConnections(type, tenantId2) {
|
|
|
12417
12050
|
}
|
|
12418
12051
|
}
|
|
12419
12052
|
function createStandardConnectionRefreshMiddleware(configurations, toolTypes) {
|
|
12420
|
-
return
|
|
12053
|
+
return createMiddleware11({
|
|
12421
12054
|
name: "StandardConnectionRefreshMiddleware",
|
|
12422
12055
|
wrapToolCall: async (request, handler) => {
|
|
12423
12056
|
const type = toolTypes.get(request.toolCall.name);
|
|
@@ -12483,7 +12116,6 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
12483
12116
|
})
|
|
12484
12117
|
);
|
|
12485
12118
|
}
|
|
12486
|
-
middlewares.push(createProjectRoomMiddleware());
|
|
12487
12119
|
const filesystemConfig = normalizedMiddlewareConfigs.find((m) => m.type === "filesystem");
|
|
12488
12120
|
const clawConfig = normalizedMiddlewareConfigs.find((m) => m.type === "claw");
|
|
12489
12121
|
const needsFilesystemBackend = filesystemConfig?.enabled || clawConfig?.enabled;
|
|
@@ -12510,7 +12142,7 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
12510
12142
|
}
|
|
12511
12143
|
}
|
|
12512
12144
|
for (const config of normalizedMiddlewareConfigs) {
|
|
12513
|
-
if (!config.enabled || config.type === "filesystem"
|
|
12145
|
+
if (!config.enabled || config.type === "filesystem") continue;
|
|
12514
12146
|
switch (config.type) {
|
|
12515
12147
|
case "code_eval":
|
|
12516
12148
|
addConfiguredMiddleware(
|
|
@@ -12852,16 +12484,15 @@ import {
|
|
|
12852
12484
|
} from "langchain";
|
|
12853
12485
|
|
|
12854
12486
|
// src/deep_agent_new/middleware/subagents.ts
|
|
12855
|
-
import { z as
|
|
12487
|
+
import { z as z42 } from "zod/v3";
|
|
12856
12488
|
import {
|
|
12857
|
-
createMiddleware as
|
|
12489
|
+
createMiddleware as createMiddleware12,
|
|
12858
12490
|
createAgent as createAgent2,
|
|
12859
|
-
tool as
|
|
12491
|
+
tool as tool39,
|
|
12860
12492
|
ToolMessage as ToolMessage6,
|
|
12861
12493
|
humanInTheLoopMiddleware
|
|
12862
12494
|
} from "langchain";
|
|
12863
12495
|
import { Command as Command3, getCurrentTaskInput as getCurrentTaskInput2, GraphInterrupt } from "@langchain/langgraph";
|
|
12864
|
-
import { HumanMessage as HumanMessage4 } from "@langchain/core/messages";
|
|
12865
12496
|
|
|
12866
12497
|
// src/agent_worker/agent_worker_graph.ts
|
|
12867
12498
|
import {
|
|
@@ -13268,7 +12899,7 @@ function createAgentWorkerGraph() {
|
|
|
13268
12899
|
var agentWorkerGraph = createAgentWorkerGraph();
|
|
13269
12900
|
|
|
13270
12901
|
// src/services/Agent.ts
|
|
13271
|
-
import { descriptorDataValue
|
|
12902
|
+
import { descriptorDataValue } from "@axiom-lattice/protocols";
|
|
13272
12903
|
import { Command as Command2 } from "@langchain/langgraph";
|
|
13273
12904
|
import { AIMessage as AIMessage3, filterMessages, HumanMessage as HumanMessage3, SystemMessage, ToolMessage as ToolMessage5 } from "langchain";
|
|
13274
12905
|
|
|
@@ -13590,10 +13221,10 @@ registerChunkBuffer("default", buffer);
|
|
|
13590
13221
|
import { v4 as v42 } from "uuid";
|
|
13591
13222
|
|
|
13592
13223
|
// src/capability/CapabilityRuntimeResolver.ts
|
|
13593
|
-
import { z as
|
|
13224
|
+
import { z as z41 } from "zod";
|
|
13594
13225
|
|
|
13595
13226
|
// src/capability/CapabilityBundleMerger.ts
|
|
13596
|
-
import { createHash as
|
|
13227
|
+
import { createHash as createHash3 } from "crypto";
|
|
13597
13228
|
import { isDeepStrictEqual } from "util";
|
|
13598
13229
|
|
|
13599
13230
|
// src/capability/CredentialFieldPolicy.ts
|
|
@@ -14029,7 +13660,7 @@ function createCapabilityRevision(bundles, effectivePolicy) {
|
|
|
14029
13660
|
bundles: bundles.map(({ id, updatedAt }) => [id, updatedAt]),
|
|
14030
13661
|
effectivePolicy
|
|
14031
13662
|
};
|
|
14032
|
-
return
|
|
13663
|
+
return createHash3("sha256").update(JSON.stringify(canonicalize(revisionInput))).digest("hex");
|
|
14033
13664
|
}
|
|
14034
13665
|
var LEGACY_UNION_CONFIG_FIELDS = new Set(
|
|
14035
13666
|
Object.values(LEGACY_PLUGIN_CONNECTION_FIELDS).map(({ selectorField }) => selectorField)
|
|
@@ -14372,9 +14003,9 @@ var CapabilityRuntimeResolutionError = class extends Error {
|
|
|
14372
14003
|
this.actualRevision = context.actualRevision;
|
|
14373
14004
|
}
|
|
14374
14005
|
};
|
|
14375
|
-
var bundleIdsSchema =
|
|
14006
|
+
var bundleIdsSchema = z41.array(z41.string().uuid()).superRefine((ids, context) => {
|
|
14376
14007
|
if (new Set(ids).size !== ids.length) {
|
|
14377
|
-
context.addIssue({ code:
|
|
14008
|
+
context.addIssue({ code: z41.ZodIssueCode.custom, message: "Bundle IDs must be unique" });
|
|
14378
14009
|
}
|
|
14379
14010
|
});
|
|
14380
14011
|
function projectBundleIds(config) {
|
|
@@ -14650,7 +14281,7 @@ function cloneRunConfig(value, stripReserved) {
|
|
|
14650
14281
|
const clone4 = [];
|
|
14651
14282
|
for (let index = 0; index < length; index += 1) {
|
|
14652
14283
|
const key4 = String(index);
|
|
14653
|
-
const data =
|
|
14284
|
+
const data = descriptorDataValue(descriptors[key4]);
|
|
14654
14285
|
if (!data || data.value === void 0) {
|
|
14655
14286
|
throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${path8}/${key4}`);
|
|
14656
14287
|
}
|
|
@@ -14665,7 +14296,7 @@ function cloneRunConfig(value, stripReserved) {
|
|
|
14665
14296
|
for (const key4 of keys) {
|
|
14666
14297
|
if (typeof key4 !== "string") continue;
|
|
14667
14298
|
const fieldPath = callerRunConfigPath(path8, key4);
|
|
14668
|
-
const data =
|
|
14299
|
+
const data = descriptorDataValue(descriptors[key4]);
|
|
14669
14300
|
if (!data) throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${fieldPath}`);
|
|
14670
14301
|
if (stripReserved && RESERVED_CALLER_RUN_KEYS.has(key4) || data.value === void 0) continue;
|
|
14671
14302
|
Object.defineProperty(clone3, key4, {
|
|
@@ -14701,7 +14332,7 @@ function sanitizeCallerRunConfig(value, preserveDelegatedContext = true) {
|
|
|
14701
14332
|
if (Array.isArray(entry)) {
|
|
14702
14333
|
const descriptors2 = Object.getOwnPropertyDescriptors(entry);
|
|
14703
14334
|
for (let index = 0; index < entry.length; index += 1) {
|
|
14704
|
-
const data =
|
|
14335
|
+
const data = descriptorDataValue(descriptors2[String(index)]);
|
|
14705
14336
|
if (!data) throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${path8}/${index}`);
|
|
14706
14337
|
visit(data.value, `${path8}/${index}`);
|
|
14707
14338
|
}
|
|
@@ -14720,7 +14351,7 @@ function sanitizeCallerRunConfig(value, preserveDelegatedContext = true) {
|
|
|
14720
14351
|
}
|
|
14721
14352
|
const fieldPath = callerRunConfigPath(path8, key4);
|
|
14722
14353
|
const descriptor = descriptors[key4];
|
|
14723
|
-
const data =
|
|
14354
|
+
const data = descriptorDataValue(descriptor);
|
|
14724
14355
|
if (!data) throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${fieldPath}`);
|
|
14725
14356
|
if (isCredentialBearingKey(key4)) {
|
|
14726
14357
|
throw new CapabilityRuntimeResolutionError(
|
|
@@ -14755,7 +14386,7 @@ function cloneExecutionRunConfigBase(value) {
|
|
|
14755
14386
|
throw new CallerRunConfigValidationError("Unsupported caller run config value at /run_config");
|
|
14756
14387
|
}
|
|
14757
14388
|
const descriptor = descriptors[key4];
|
|
14758
|
-
const data =
|
|
14389
|
+
const data = descriptorDataValue(descriptor);
|
|
14759
14390
|
if (!data) {
|
|
14760
14391
|
throw new CallerRunConfigValidationError("Unsupported caller run config value at /run_config");
|
|
14761
14392
|
}
|
|
@@ -14838,19 +14469,19 @@ var DelegatedScopeNotQueueableError = class extends Error {
|
|
|
14838
14469
|
this.name = "DelegatedScopeNotQueueableError";
|
|
14839
14470
|
}
|
|
14840
14471
|
};
|
|
14841
|
-
function
|
|
14472
|
+
function ownDataValue(value, key4) {
|
|
14842
14473
|
if (typeof value !== "object" || value === null) return void 0;
|
|
14843
14474
|
try {
|
|
14844
|
-
return
|
|
14475
|
+
return descriptorDataValue(Object.getOwnPropertyDescriptor(value, key4))?.value;
|
|
14845
14476
|
} catch {
|
|
14846
14477
|
return void 0;
|
|
14847
14478
|
}
|
|
14848
14479
|
}
|
|
14849
14480
|
function checkpointCapabilityRevision(state) {
|
|
14850
|
-
const config =
|
|
14851
|
-
const configurable =
|
|
14852
|
-
const runConfig =
|
|
14853
|
-
const revision =
|
|
14481
|
+
const config = ownDataValue(state, "config");
|
|
14482
|
+
const configurable = ownDataValue(config, "configurable");
|
|
14483
|
+
const runConfig = ownDataValue(configurable, "runConfig");
|
|
14484
|
+
const revision = ownDataValue(runConfig, "capabilityRuntimeRevision");
|
|
14854
14485
|
return typeof revision === "string" && revision.length > 0 ? revision : void 0;
|
|
14855
14486
|
}
|
|
14856
14487
|
var QUEUE_PROCESSOR_RETRY_BASE_MS = 100;
|
|
@@ -15490,10 +15121,14 @@ var Agent = class {
|
|
|
15490
15121
|
if (!Array.isArray(messages) || messages.length === 0) {
|
|
15491
15122
|
return [new HumanMessage3({ id: content.id, content: content.message })];
|
|
15492
15123
|
}
|
|
15124
|
+
const invalid = messages.filter((message) => !isMessageContent(message.content));
|
|
15125
|
+
if (invalid.length > 0) {
|
|
15126
|
+
console.error(
|
|
15127
|
+
`[Agent] Dropping ${invalid.length} queued message(s) with invalid serialized content for queued message ${content.id}; falling back to stored display content`
|
|
15128
|
+
);
|
|
15129
|
+
return [new HumanMessage3({ id: content.id, content: content.message })];
|
|
15130
|
+
}
|
|
15493
15131
|
return messages.map((message) => {
|
|
15494
|
-
if (!isMessageContent(message.content)) {
|
|
15495
|
-
throw new Error(`Invalid structured message content for queued message ${content.id}`);
|
|
15496
|
-
}
|
|
15497
15132
|
const fields = {
|
|
15498
15133
|
id: message.id,
|
|
15499
15134
|
content: message.content,
|
|
@@ -16802,7 +16437,7 @@ function createTaskTool(options) {
|
|
|
16802
16437
|
generalPurposeAgent
|
|
16803
16438
|
});
|
|
16804
16439
|
const finalTaskDescription = taskDescription ? taskDescription : getTaskToolDescription(subagentDescriptions);
|
|
16805
|
-
return
|
|
16440
|
+
return tool39(
|
|
16806
16441
|
async (input, config) => {
|
|
16807
16442
|
const { description, subagent_type, async } = input;
|
|
16808
16443
|
if (input.taskId) {
|
|
@@ -16858,7 +16493,8 @@ function createTaskTool(options) {
|
|
|
16858
16493
|
const currentState = getCurrentTaskInput2();
|
|
16859
16494
|
const subagentState = filterStateForSubagent(currentState);
|
|
16860
16495
|
subagentState.messages = input.taskId ? [
|
|
16861
|
-
|
|
16496
|
+
{
|
|
16497
|
+
role: "human",
|
|
16862
16498
|
content: `${description}
|
|
16863
16499
|
|
|
16864
16500
|
---
|
|
@@ -16868,8 +16504,8 @@ You are executing a persistent task (ID: ${input.taskId}). Use manage_task.updat
|
|
|
16868
16504
|
- Preserve the Objective and Acceptance Criteria contract. Do not append progress notes to the description; put progress and evidence in the result or Activity.
|
|
16869
16505
|
- Complete agent-owned tasks with result plus beliefImpact: [{ key, after, basis }] where key references the belief owner's canonical Belief State; the middleware records completion evidence and writes the parent belief activity automatically.
|
|
16870
16506
|
- Use add_activity only for additional observations or plan revisions when the result changes the parent belief or plan.`
|
|
16871
|
-
}
|
|
16872
|
-
] : [
|
|
16507
|
+
}
|
|
16508
|
+
] : [{ role: "human", content: description }];
|
|
16873
16509
|
const subagent_thread_id = config.configurable?.thread_id + "____" + assistant_id + "_" + config.toolCall.id;
|
|
16874
16510
|
if (async) {
|
|
16875
16511
|
const tenantId2 = config.configurable?.runConfig?.tenantId;
|
|
@@ -16963,19 +16599,19 @@ The result will be delivered as a notification when complete. Do not poll.`,
|
|
|
16963
16599
|
{
|
|
16964
16600
|
name: "task",
|
|
16965
16601
|
description: finalTaskDescription,
|
|
16966
|
-
schema:
|
|
16967
|
-
description:
|
|
16968
|
-
subagent_type:
|
|
16602
|
+
schema: z42.object({
|
|
16603
|
+
description: z42.string().describe("The task to execute with the selected agent"),
|
|
16604
|
+
subagent_type: z42.string().describe(
|
|
16969
16605
|
`Name of the agent to use. Available: ${Object.keys(
|
|
16970
16606
|
subagentGraphs
|
|
16971
16607
|
).join(", ")}`
|
|
16972
16608
|
),
|
|
16973
16609
|
...allowAsync ? {
|
|
16974
|
-
async:
|
|
16610
|
+
async: z42.boolean().default(false).describe(
|
|
16975
16611
|
"When true, runs the task in the background and returns immediately. Use for independent tasks that can run in parallel. The result is delivered as a notification when complete. Use check_async_task or list_async_tasks to monitor progress."
|
|
16976
16612
|
)
|
|
16977
16613
|
} : {},
|
|
16978
|
-
taskId:
|
|
16614
|
+
taskId: z42.string().optional().describe(
|
|
16979
16615
|
"Optional: ID of a TaskItem created via manage_task. When set, the subagent will update this task's status as it works. Use this when executing a persistent task from the task board."
|
|
16980
16616
|
)
|
|
16981
16617
|
})
|
|
@@ -16993,7 +16629,7 @@ function getMainAgentFromConfig(config) {
|
|
|
16993
16629
|
});
|
|
16994
16630
|
}
|
|
16995
16631
|
function createCheckAsyncTaskTool() {
|
|
16996
|
-
return
|
|
16632
|
+
return tool39(
|
|
16997
16633
|
async (input, config) => {
|
|
16998
16634
|
const { task_id } = input;
|
|
16999
16635
|
const mainAgent = getMainAgentFromConfig(config);
|
|
@@ -17053,14 +16689,14 @@ Description: ${cached.description}`;
|
|
|
17053
16689
|
{
|
|
17054
16690
|
name: "check_async_task",
|
|
17055
16691
|
description: "Get the current status and result of an async background task. Use this to check if a previously launched async task has completed.",
|
|
17056
|
-
schema:
|
|
17057
|
-
task_id:
|
|
16692
|
+
schema: z42.object({
|
|
16693
|
+
task_id: z42.string().describe("The task ID returned when the async task was started")
|
|
17058
16694
|
})
|
|
17059
16695
|
}
|
|
17060
16696
|
);
|
|
17061
16697
|
}
|
|
17062
16698
|
function createListAsyncTasksTool() {
|
|
17063
|
-
return
|
|
16699
|
+
return tool39(
|
|
17064
16700
|
async (_input, config) => {
|
|
17065
16701
|
const mainAgent = getMainAgentFromConfig(config);
|
|
17066
16702
|
if (!mainAgent) {
|
|
@@ -17106,12 +16742,12 @@ function createListAsyncTasksTool() {
|
|
|
17106
16742
|
{
|
|
17107
16743
|
name: "list_async_tasks",
|
|
17108
16744
|
description: "List all async background tasks with their current status. Use this before reporting task status to the user. Statuses in conversation history may be stale.",
|
|
17109
|
-
schema:
|
|
16745
|
+
schema: z42.object({})
|
|
17110
16746
|
}
|
|
17111
16747
|
);
|
|
17112
16748
|
}
|
|
17113
16749
|
function createCancelAsyncTaskTool() {
|
|
17114
|
-
return
|
|
16750
|
+
return tool39(
|
|
17115
16751
|
async (input, config) => {
|
|
17116
16752
|
const { task_id } = input;
|
|
17117
16753
|
const mainAgent = getMainAgentFromConfig(config);
|
|
@@ -17150,8 +16786,8 @@ function createCancelAsyncTaskTool() {
|
|
|
17150
16786
|
{
|
|
17151
16787
|
name: "cancel_async_task",
|
|
17152
16788
|
description: "Cancel a running async background task.",
|
|
17153
|
-
schema:
|
|
17154
|
-
task_id:
|
|
16789
|
+
schema: z42.object({
|
|
16790
|
+
task_id: z42.string().describe("The task ID to cancel")
|
|
17155
16791
|
})
|
|
17156
16792
|
}
|
|
17157
16793
|
);
|
|
@@ -17187,7 +16823,7 @@ function createSubAgentMiddleware(options) {
|
|
|
17187
16823
|
);
|
|
17188
16824
|
}
|
|
17189
16825
|
const effectiveSystemPrompt = allowAsync ? systemPrompt + getAsyncPromptText() : systemPrompt;
|
|
17190
|
-
return
|
|
16826
|
+
return createMiddleware12({
|
|
17191
16827
|
name: "subAgentMiddleware",
|
|
17192
16828
|
tools: allTools,
|
|
17193
16829
|
wrapModelCall: async (request, handler) => {
|
|
@@ -17207,8 +16843,8 @@ ${effectiveSystemPrompt}` : effectiveSystemPrompt;
|
|
|
17207
16843
|
}
|
|
17208
16844
|
|
|
17209
16845
|
// src/deep_agent_new/middleware/date.ts
|
|
17210
|
-
import { createMiddleware as
|
|
17211
|
-
import { z as
|
|
16846
|
+
import { createMiddleware as createMiddleware13, tool as tool40 } from "langchain";
|
|
16847
|
+
import { z as z43 } from "zod";
|
|
17212
16848
|
function formatCurrentDate(timezone = "UTC") {
|
|
17213
16849
|
const now = /* @__PURE__ */ new Date();
|
|
17214
16850
|
let validTimezone = timezone;
|
|
@@ -17236,10 +16872,10 @@ function generateDateContext(timezone = "UTC") {
|
|
|
17236
16872
|
function createDateMiddleware(options = {}) {
|
|
17237
16873
|
const timezone = options.timezone || "UTC";
|
|
17238
16874
|
const dateContext = generateDateContext(timezone);
|
|
17239
|
-
return
|
|
16875
|
+
return createMiddleware13({
|
|
17240
16876
|
name: "DateMiddleware",
|
|
17241
16877
|
tools: [
|
|
17242
|
-
|
|
16878
|
+
tool40(
|
|
17243
16879
|
async () => {
|
|
17244
16880
|
const now = /* @__PURE__ */ new Date();
|
|
17245
16881
|
let validTimezone = timezone;
|
|
@@ -17269,7 +16905,7 @@ function createDateMiddleware(options = {}) {
|
|
|
17269
16905
|
{
|
|
17270
16906
|
name: "get_current_date_time",
|
|
17271
16907
|
description: "Get the exact current date and time at the moment of invocation. Use this when the user asks about the current time (e.g., 'what time is it', '\u51E0\u70B9\u4E86', '\u73B0\u5728\u51E0\u70B9'), or when you need to know the precise time for scheduling, deadlines, or time-sensitive operations.",
|
|
17272
|
-
schema:
|
|
16908
|
+
schema: z43.object({})
|
|
17273
16909
|
}
|
|
17274
16910
|
)
|
|
17275
16911
|
],
|
|
@@ -17335,8 +16971,8 @@ var datePlugin = {
|
|
|
17335
16971
|
};
|
|
17336
16972
|
|
|
17337
16973
|
// src/deep_agent_new/middleware/scheduler.ts
|
|
17338
|
-
import { tool as
|
|
17339
|
-
import { z as
|
|
16974
|
+
import { tool as tool41, createMiddleware as createMiddleware14 } from "langchain";
|
|
16975
|
+
import { z as z44 } from "zod";
|
|
17340
16976
|
import { v4 as uuidv43 } from "uuid";
|
|
17341
16977
|
import { ScheduledTaskStatus as ScheduledTaskStatus3, ScheduleExecutionType as ScheduleExecutionType3 } from "@axiom-lattice/protocols";
|
|
17342
16978
|
|
|
@@ -18410,10 +18046,10 @@ function registerAgentAddMessageHandler() {
|
|
|
18410
18046
|
function createSchedulerMiddleware(options = {}) {
|
|
18411
18047
|
const defaultMaxRetries = options.defaultMaxRetries ?? 0;
|
|
18412
18048
|
registerAgentAddMessageHandler();
|
|
18413
|
-
return
|
|
18049
|
+
return createMiddleware14({
|
|
18414
18050
|
name: "SchedulerMiddleware",
|
|
18415
18051
|
tools: [
|
|
18416
|
-
|
|
18052
|
+
tool41(
|
|
18417
18053
|
async (input, config) => {
|
|
18418
18054
|
const runConfig = getRunConfig(config);
|
|
18419
18055
|
const scheduleLattice = getScheduleLattice(SCHEDULE_LATTICE_KEY);
|
|
@@ -18441,14 +18077,14 @@ function createSchedulerMiddleware(options = {}) {
|
|
|
18441
18077
|
{
|
|
18442
18078
|
name: "schedule_at",
|
|
18443
18079
|
description: "Schedule a system message for an absolute future timestamp",
|
|
18444
|
-
schema:
|
|
18445
|
-
executeAt:
|
|
18446
|
-
maxRetries:
|
|
18447
|
-
message:
|
|
18080
|
+
schema: z44.object({
|
|
18081
|
+
executeAt: z44.number(),
|
|
18082
|
+
maxRetries: z44.number().int().min(0).optional(),
|
|
18083
|
+
message: z44.string()
|
|
18448
18084
|
})
|
|
18449
18085
|
}
|
|
18450
18086
|
),
|
|
18451
|
-
|
|
18087
|
+
tool41(
|
|
18452
18088
|
async (input, config) => {
|
|
18453
18089
|
const runConfig = getRunConfig(config);
|
|
18454
18090
|
const scheduleLattice = getScheduleLattice(SCHEDULE_LATTICE_KEY);
|
|
@@ -18476,14 +18112,14 @@ function createSchedulerMiddleware(options = {}) {
|
|
|
18476
18112
|
{
|
|
18477
18113
|
name: "schedule_after",
|
|
18478
18114
|
description: "Schedule a system message after a relative delay",
|
|
18479
|
-
schema:
|
|
18480
|
-
delayMs:
|
|
18481
|
-
maxRetries:
|
|
18482
|
-
message:
|
|
18115
|
+
schema: z44.object({
|
|
18116
|
+
delayMs: z44.number().positive(),
|
|
18117
|
+
maxRetries: z44.number().int().min(0).optional(),
|
|
18118
|
+
message: z44.string()
|
|
18483
18119
|
})
|
|
18484
18120
|
}
|
|
18485
18121
|
),
|
|
18486
|
-
|
|
18122
|
+
tool41(
|
|
18487
18123
|
async (input, config) => {
|
|
18488
18124
|
const runConfig = getRunConfig(config);
|
|
18489
18125
|
const scheduleLattice = getScheduleLattice(SCHEDULE_LATTICE_KEY);
|
|
@@ -18518,16 +18154,16 @@ function createSchedulerMiddleware(options = {}) {
|
|
|
18518
18154
|
{
|
|
18519
18155
|
name: "schedule_recurring",
|
|
18520
18156
|
description: "Schedule a recurring system message with a cron expression",
|
|
18521
|
-
schema:
|
|
18522
|
-
cronExpression:
|
|
18523
|
-
maxRuns:
|
|
18524
|
-
expiresAt:
|
|
18525
|
-
maxRetries:
|
|
18526
|
-
message:
|
|
18157
|
+
schema: z44.object({
|
|
18158
|
+
cronExpression: z44.string(),
|
|
18159
|
+
maxRuns: z44.number().int().positive().optional(),
|
|
18160
|
+
expiresAt: z44.number().optional(),
|
|
18161
|
+
maxRetries: z44.number().int().min(0).optional(),
|
|
18162
|
+
message: z44.string()
|
|
18527
18163
|
})
|
|
18528
18164
|
}
|
|
18529
18165
|
),
|
|
18530
|
-
|
|
18166
|
+
tool41(
|
|
18531
18167
|
async (input) => {
|
|
18532
18168
|
const scheduleLattice = getScheduleLattice(SCHEDULE_LATTICE_KEY);
|
|
18533
18169
|
const success = await scheduleLattice.client.cancel(input.taskId);
|
|
@@ -18536,12 +18172,12 @@ function createSchedulerMiddleware(options = {}) {
|
|
|
18536
18172
|
{
|
|
18537
18173
|
name: "cancel_scheduled_task",
|
|
18538
18174
|
description: "Cancel a scheduled task by task id",
|
|
18539
|
-
schema:
|
|
18540
|
-
taskId:
|
|
18175
|
+
schema: z44.object({
|
|
18176
|
+
taskId: z44.string()
|
|
18541
18177
|
})
|
|
18542
18178
|
}
|
|
18543
18179
|
),
|
|
18544
|
-
|
|
18180
|
+
tool41(
|
|
18545
18181
|
async (input, config) => {
|
|
18546
18182
|
const runConfig = getRunConfig(config);
|
|
18547
18183
|
const scheduleLattice = getScheduleLattice(SCHEDULE_LATTICE_KEY);
|
|
@@ -18563,11 +18199,11 @@ function createSchedulerMiddleware(options = {}) {
|
|
|
18563
18199
|
{
|
|
18564
18200
|
name: "list_scheduled_tasks",
|
|
18565
18201
|
description: "List scheduled tasks for the current agent context",
|
|
18566
|
-
schema:
|
|
18567
|
-
status:
|
|
18568
|
-
executionType:
|
|
18569
|
-
limit:
|
|
18570
|
-
offset:
|
|
18202
|
+
schema: z44.object({
|
|
18203
|
+
status: z44.enum(["pending", "running", "completed", "failed", "cancelled", "paused"]).optional(),
|
|
18204
|
+
executionType: z44.enum(["once", "cron"]).optional(),
|
|
18205
|
+
limit: z44.number().int().positive().optional(),
|
|
18206
|
+
offset: z44.number().int().min(0).optional()
|
|
18571
18207
|
})
|
|
18572
18208
|
}
|
|
18573
18209
|
)
|
|
@@ -19824,8 +19460,8 @@ var MemoryBackend = class {
|
|
|
19824
19460
|
|
|
19825
19461
|
// src/deep_agent_new/middleware/todos.ts
|
|
19826
19462
|
import { Command as Command4 } from "@langchain/langgraph";
|
|
19827
|
-
import { z as
|
|
19828
|
-
import { createMiddleware as
|
|
19463
|
+
import { z as z45 } from "zod";
|
|
19464
|
+
import { createMiddleware as createMiddleware15, tool as tool42, ToolMessage as ToolMessage7 } from "langchain";
|
|
19829
19465
|
var WRITE_TODOS_DESCRIPTION = `Use this tool to create and manage a structured task list for your current work session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
19830
19466
|
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
19831
19467
|
Only use this tool if you think it will be helpful in staying organized. If the user's request is trivial and takes less than 3 steps, it is better to NOT use this tool and just do the taks directly.
|
|
@@ -20052,14 +19688,14 @@ Writing todos takes time and tokens, use it when it is helpful for managing comp
|
|
|
20052
19688
|
## Important To-Do List Usage Notes to Remember
|
|
20053
19689
|
- The \`write_todos\` tool should never be called multiple times in parallel.
|
|
20054
19690
|
- Don't be afraid to revise the To-Do list as you go. New information may reveal new tasks that need to be done, or old tasks that are irrelevant.`;
|
|
20055
|
-
var TodoStatus =
|
|
20056
|
-
var TodoSchema =
|
|
20057
|
-
content:
|
|
19691
|
+
var TodoStatus = z45.enum(["pending", "in_progress", "completed"]).describe("Status of the todo");
|
|
19692
|
+
var TodoSchema = z45.object({
|
|
19693
|
+
content: z45.string().describe("Content of the todo item"),
|
|
20058
19694
|
status: TodoStatus
|
|
20059
19695
|
});
|
|
20060
|
-
var stateSchema =
|
|
19696
|
+
var stateSchema = z45.object({ todos: z45.array(TodoSchema).default([]) });
|
|
20061
19697
|
function todoListMiddleware(options) {
|
|
20062
|
-
const writeTodos =
|
|
19698
|
+
const writeTodos = tool42(
|
|
20063
19699
|
({ todos }, config) => {
|
|
20064
19700
|
return new Command4({
|
|
20065
19701
|
update: {
|
|
@@ -20076,12 +19712,12 @@ function todoListMiddleware(options) {
|
|
|
20076
19712
|
{
|
|
20077
19713
|
name: "write_todos",
|
|
20078
19714
|
description: options?.toolDescription ?? WRITE_TODOS_DESCRIPTION,
|
|
20079
|
-
schema:
|
|
20080
|
-
todos:
|
|
19715
|
+
schema: z45.object({
|
|
19716
|
+
todos: z45.array(TodoSchema).describe("List of todo items to update")
|
|
20081
19717
|
})
|
|
20082
19718
|
}
|
|
20083
19719
|
);
|
|
20084
|
-
return
|
|
19720
|
+
return createMiddleware15({
|
|
20085
19721
|
name: "todoListMiddleware",
|
|
20086
19722
|
stateSchema,
|
|
20087
19723
|
tools: [writeTodos],
|
|
@@ -20232,7 +19868,7 @@ var DeepAgentGraphBuilder = class {
|
|
|
20232
19868
|
};
|
|
20233
19869
|
|
|
20234
19870
|
// src/agent_team/agent_team.ts
|
|
20235
|
-
import { z as
|
|
19871
|
+
import { z as z48 } from "zod/v3";
|
|
20236
19872
|
import { createAgent as createAgent5 } from "langchain";
|
|
20237
19873
|
|
|
20238
19874
|
// src/agent_team/types.ts
|
|
@@ -20668,14 +20304,14 @@ var InMemoryMailboxStore = class {
|
|
|
20668
20304
|
};
|
|
20669
20305
|
|
|
20670
20306
|
// src/agent_team/middleware/team.ts
|
|
20671
|
-
import { z as
|
|
20672
|
-
import { createMiddleware as
|
|
20307
|
+
import { z as z47 } from "zod/v3";
|
|
20308
|
+
import { createMiddleware as createMiddleware16, createAgent as createAgent4, tool as tool44, ToolMessage as ToolMessage9 } from "langchain";
|
|
20673
20309
|
import { Command as Command6, getCurrentTaskInput as getCurrentTaskInput3 } from "@langchain/langgraph";
|
|
20674
20310
|
import { v4 as uuidv44 } from "uuid";
|
|
20675
20311
|
|
|
20676
20312
|
// src/agent_team/middleware/teammate_tools.ts
|
|
20677
|
-
import { z as
|
|
20678
|
-
import { tool as
|
|
20313
|
+
import { z as z46 } from "zod/v3";
|
|
20314
|
+
import { tool as tool43, ToolMessage as ToolMessage8 } from "langchain";
|
|
20679
20315
|
import { Command as Command5 } from "@langchain/langgraph";
|
|
20680
20316
|
|
|
20681
20317
|
// src/agent_team/middleware/formatMessages.ts
|
|
@@ -20700,7 +20336,7 @@ ${meta}${body}`;
|
|
|
20700
20336
|
// src/agent_team/middleware/teammate_tools.ts
|
|
20701
20337
|
function createTeammateTools(options) {
|
|
20702
20338
|
const { teamId, agentId, taskListStore, mailboxStore } = options;
|
|
20703
|
-
const claimTaskTool =
|
|
20339
|
+
const claimTaskTool = tool43(
|
|
20704
20340
|
async (input) => {
|
|
20705
20341
|
const task = await taskListStore.claimTaskById(
|
|
20706
20342
|
teamId,
|
|
@@ -20725,12 +20361,12 @@ function createTeammateTools(options) {
|
|
|
20725
20361
|
{
|
|
20726
20362
|
name: "claim_task",
|
|
20727
20363
|
description: "Pick a task to work on by task_id. Use check_tasks first to see all tasks; then call this with the task_id you choose. The task's assignee is set to you and you should focus on that task until you complete_task or fail_task it.",
|
|
20728
|
-
schema:
|
|
20729
|
-
task_id:
|
|
20364
|
+
schema: z46.object({
|
|
20365
|
+
task_id: z46.string().describe("ID of the task to claim (e.g. task-01). Use check_tasks to see IDs.")
|
|
20730
20366
|
})
|
|
20731
20367
|
}
|
|
20732
20368
|
);
|
|
20733
|
-
const completeTaskTool =
|
|
20369
|
+
const completeTaskTool = tool43(
|
|
20734
20370
|
async (input) => {
|
|
20735
20371
|
const task = await taskListStore.completeTask(
|
|
20736
20372
|
teamId,
|
|
@@ -20751,13 +20387,13 @@ function createTeammateTools(options) {
|
|
|
20751
20387
|
{
|
|
20752
20388
|
name: "complete_task",
|
|
20753
20389
|
description: "Mark a claimed task as completed with a result summary. Call this after you have finished working on a task.",
|
|
20754
|
-
schema:
|
|
20755
|
-
task_id:
|
|
20756
|
-
result:
|
|
20390
|
+
schema: z46.object({
|
|
20391
|
+
task_id: z46.string().describe("ID of the task to complete"),
|
|
20392
|
+
result: z46.string().describe("Summary of the task result")
|
|
20757
20393
|
})
|
|
20758
20394
|
}
|
|
20759
20395
|
);
|
|
20760
|
-
const failTaskTool =
|
|
20396
|
+
const failTaskTool = tool43(
|
|
20761
20397
|
async (input) => {
|
|
20762
20398
|
const task = await taskListStore.failTask(
|
|
20763
20399
|
teamId,
|
|
@@ -20778,13 +20414,13 @@ function createTeammateTools(options) {
|
|
|
20778
20414
|
{
|
|
20779
20415
|
name: "fail_task",
|
|
20780
20416
|
description: "Mark a claimed task as failed with an error description. Call this if you cannot complete the task.",
|
|
20781
|
-
schema:
|
|
20782
|
-
task_id:
|
|
20783
|
-
error:
|
|
20417
|
+
schema: z46.object({
|
|
20418
|
+
task_id: z46.string().describe("ID of the task to fail"),
|
|
20419
|
+
error: z46.string().describe("Description of why the task failed")
|
|
20784
20420
|
})
|
|
20785
20421
|
}
|
|
20786
20422
|
);
|
|
20787
|
-
const sendMessageTool =
|
|
20423
|
+
const sendMessageTool = tool43(
|
|
20788
20424
|
async (input) => {
|
|
20789
20425
|
await mailboxStore.sendMessage(
|
|
20790
20426
|
teamId,
|
|
@@ -20798,11 +20434,11 @@ function createTeammateTools(options) {
|
|
|
20798
20434
|
{
|
|
20799
20435
|
name: "send_message",
|
|
20800
20436
|
description: 'Send a message to the team lead or another teammate via the mailbox. Use "team_lead" to message the team lead. Use this to report discoveries, request guidance, or suggest new tasks.',
|
|
20801
|
-
schema:
|
|
20802
|
-
to:
|
|
20437
|
+
schema: z46.object({
|
|
20438
|
+
to: z46.string().describe(
|
|
20803
20439
|
'Recipient agent name (e.g. "team_lead" or a teammate name)'
|
|
20804
20440
|
),
|
|
20805
|
-
content:
|
|
20441
|
+
content: z46.string().describe("Message content")
|
|
20806
20442
|
})
|
|
20807
20443
|
}
|
|
20808
20444
|
);
|
|
@@ -20822,7 +20458,7 @@ function createTeammateTools(options) {
|
|
|
20822
20458
|
read: msg.read
|
|
20823
20459
|
}));
|
|
20824
20460
|
};
|
|
20825
|
-
const readMessagesTool =
|
|
20461
|
+
const readMessagesTool = tool43(
|
|
20826
20462
|
async (input, config) => {
|
|
20827
20463
|
const formatAndMarkAsRead = async (msgs2) => {
|
|
20828
20464
|
for (const msg of msgs2) {
|
|
@@ -20881,10 +20517,10 @@ function createTeammateTools(options) {
|
|
|
20881
20517
|
{
|
|
20882
20518
|
name: "read_messages",
|
|
20883
20519
|
description: "Read unread messages from the mailbox. Returns immediately if messages exist, otherwise waits for up to 3 minutes for new messages.",
|
|
20884
|
-
schema:
|
|
20520
|
+
schema: z46.object({})
|
|
20885
20521
|
}
|
|
20886
20522
|
);
|
|
20887
|
-
const checkTasksTool =
|
|
20523
|
+
const checkTasksTool = tool43(
|
|
20888
20524
|
async () => {
|
|
20889
20525
|
const tasks = await taskListStore.getAllTasks(teamId);
|
|
20890
20526
|
return formatTaskSummary(tasks);
|
|
@@ -20892,10 +20528,10 @@ function createTeammateTools(options) {
|
|
|
20892
20528
|
{
|
|
20893
20529
|
name: "check_tasks",
|
|
20894
20530
|
description: "Use this tool to get the current status of all tasks in a team. This is your primary way to monitor task progress.",
|
|
20895
|
-
schema:
|
|
20531
|
+
schema: z46.object({})
|
|
20896
20532
|
}
|
|
20897
20533
|
);
|
|
20898
|
-
const broadcastMessageTool =
|
|
20534
|
+
const broadcastMessageTool = tool43(
|
|
20899
20535
|
async (input) => {
|
|
20900
20536
|
const allAgents = await mailboxStore.getRegisteredAgents(teamId);
|
|
20901
20537
|
const recipients = allAgents.filter((a) => a !== agentId);
|
|
@@ -20914,8 +20550,8 @@ function createTeammateTools(options) {
|
|
|
20914
20550
|
{
|
|
20915
20551
|
name: "broadcast_message",
|
|
20916
20552
|
description: "Send a message to everyone in the team except yourself. Use this to share updates or information with all teammates and the team lead at once.",
|
|
20917
|
-
schema:
|
|
20918
|
-
content:
|
|
20553
|
+
schema: z46.object({
|
|
20554
|
+
content: z46.string().describe("Message content to broadcast to others")
|
|
20919
20555
|
})
|
|
20920
20556
|
}
|
|
20921
20557
|
);
|
|
@@ -21149,7 +20785,7 @@ async function spawnTeammate(options) {
|
|
|
21149
20785
|
function createTeamMiddleware(options) {
|
|
21150
20786
|
const { teamConfig, taskListStore, mailboxStore, tenantId: tenantId2 } = options;
|
|
21151
20787
|
const defaultModel = teamConfig.model ?? "claude-sonnet-4-5-20250929";
|
|
21152
|
-
const createTeamTool =
|
|
20788
|
+
const createTeamTool = tool44(
|
|
21153
20789
|
async (input, config) => {
|
|
21154
20790
|
const state = getCurrentTaskInput3();
|
|
21155
20791
|
if (state?.team?.teamId) {
|
|
@@ -21304,20 +20940,20 @@ After calling create_team, you MUST:
|
|
|
21304
20940
|
2. When messages indicate task changes, call check_tasks to get full task status
|
|
21305
20941
|
3. Continue until all tasks show "completed" or "failed"
|
|
21306
20942
|
4. Do NOT assume tasks are done - always verify with check_tasks`,
|
|
21307
|
-
schema:
|
|
21308
|
-
tasks:
|
|
21309
|
-
|
|
21310
|
-
id:
|
|
21311
|
-
title:
|
|
21312
|
-
description:
|
|
21313
|
-
dependencies:
|
|
20943
|
+
schema: z47.object({
|
|
20944
|
+
tasks: z47.array(
|
|
20945
|
+
z47.object({
|
|
20946
|
+
id: z47.string().describe("Task ID in format task-01, task-02, etc."),
|
|
20947
|
+
title: z47.string().describe("Short task title"),
|
|
20948
|
+
description: z47.string().describe("Detailed task description - what exactly needs to be done"),
|
|
20949
|
+
dependencies: z47.array(z47.string()).optional().default([]).describe('Array of task IDs that must complete before this task (e.g. ["task-01"])')
|
|
21314
20950
|
})
|
|
21315
20951
|
).describe("List of tasks for teammates to work on. Each task needs unique ID (task-01, task-02, etc.)."),
|
|
21316
|
-
teammates:
|
|
21317
|
-
|
|
21318
|
-
name:
|
|
21319
|
-
role:
|
|
21320
|
-
description:
|
|
20952
|
+
teammates: z47.array(
|
|
20953
|
+
z47.object({
|
|
20954
|
+
name: z47.string().describe("Teammate name (must match a pre-configured teammate type)"),
|
|
20955
|
+
role: z47.string().describe("Role category (e.g. researcher, writer, coder, reviewer)"),
|
|
20956
|
+
description: z47.string().describe("What this teammate will focus on - specific instructions for their work")
|
|
21321
20957
|
})
|
|
21322
20958
|
).describe("Teammate agents to create. Each should have a clear role and focus.")
|
|
21323
20959
|
})
|
|
@@ -21328,7 +20964,7 @@ After calling create_team, you MUST:
|
|
|
21328
20964
|
if (state?.team?.teamId) return state.team.teamId;
|
|
21329
20965
|
throw new Error("No team_id provided and no team in state. Call create_team first.");
|
|
21330
20966
|
};
|
|
21331
|
-
const addTasksTool =
|
|
20967
|
+
const addTasksTool = tool44(
|
|
21332
20968
|
async (input, config) => {
|
|
21333
20969
|
const teamId = resolveTeamId();
|
|
21334
20970
|
const created = await taskListStore.addTasks(
|
|
@@ -21380,20 +21016,20 @@ IMPORTANT: Dependencies
|
|
|
21380
21016
|
|
|
21381
21017
|
IMPORTANT: Assigning to a specific teammate
|
|
21382
21018
|
- When you need a particular teammate to do the work, set assignee to that teammate's name (e.g. assignee: "researcher"). They can then claim or see the task as assigned to them.`,
|
|
21383
|
-
schema:
|
|
21384
|
-
tasks:
|
|
21385
|
-
|
|
21386
|
-
id:
|
|
21387
|
-
title:
|
|
21388
|
-
description:
|
|
21389
|
-
assignee:
|
|
21390
|
-
dependencies:
|
|
21019
|
+
schema: z47.object({
|
|
21020
|
+
tasks: z47.array(
|
|
21021
|
+
z47.object({
|
|
21022
|
+
id: z47.string().describe("Task ID in format task-01, task-02, etc. Must be unique."),
|
|
21023
|
+
title: z47.string().describe("Short task title"),
|
|
21024
|
+
description: z47.string().describe("Detailed task description - what needs to be done"),
|
|
21025
|
+
assignee: z47.string().optional().describe("Teammate name to assign this task to (use when you need that person to do the work)"),
|
|
21026
|
+
dependencies: z47.array(z47.string()).optional().default([]).describe("Array of task IDs that must complete before this task")
|
|
21391
21027
|
})
|
|
21392
21028
|
).describe("New tasks to add to the team")
|
|
21393
21029
|
})
|
|
21394
21030
|
}
|
|
21395
21031
|
);
|
|
21396
|
-
const assignTaskTool =
|
|
21032
|
+
const assignTaskTool = tool44(
|
|
21397
21033
|
async (input, config) => {
|
|
21398
21034
|
const teamId = resolveTeamId();
|
|
21399
21035
|
const task = await taskListStore.updateTask(teamId, input.task_id, {
|
|
@@ -21415,13 +21051,13 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
21415
21051
|
{
|
|
21416
21052
|
name: "assign_task",
|
|
21417
21053
|
description: "Assign a task to a specific teammate. Use when you need to reassign work to a different teammate. Omit team_id to use the active team from state.",
|
|
21418
|
-
schema:
|
|
21419
|
-
task_id:
|
|
21420
|
-
assignee:
|
|
21054
|
+
schema: z47.object({
|
|
21055
|
+
task_id: z47.string().describe("Task ID to assign"),
|
|
21056
|
+
assignee: z47.string().describe("Teammate name to assign this task to")
|
|
21421
21057
|
})
|
|
21422
21058
|
}
|
|
21423
21059
|
);
|
|
21424
|
-
const setTaskStatusTool =
|
|
21060
|
+
const setTaskStatusTool = tool44(
|
|
21425
21061
|
async (input, config) => {
|
|
21426
21062
|
const teamId = resolveTeamId();
|
|
21427
21063
|
const task = await taskListStore.updateTask(teamId, input.task_id, {
|
|
@@ -21443,13 +21079,13 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
21443
21079
|
{
|
|
21444
21080
|
name: "set_task_status",
|
|
21445
21081
|
description: "Set a task's status. Use to reopen a task (set to pending), mark as failed, or correct status. Values: pending, claimed, in_progress, completed, failed. Omit team_id to use the active team from state.",
|
|
21446
|
-
schema:
|
|
21447
|
-
task_id:
|
|
21448
|
-
status:
|
|
21082
|
+
schema: z47.object({
|
|
21083
|
+
task_id: z47.string().describe("Task ID to update"),
|
|
21084
|
+
status: z47.enum(["pending", "claimed", "in_progress", "completed", "failed"]).describe("New status for the task")
|
|
21449
21085
|
})
|
|
21450
21086
|
}
|
|
21451
21087
|
);
|
|
21452
|
-
const setTaskDependenciesTool =
|
|
21088
|
+
const setTaskDependenciesTool = tool44(
|
|
21453
21089
|
async (input, config) => {
|
|
21454
21090
|
const teamId = resolveTeamId();
|
|
21455
21091
|
const task = await taskListStore.updateTask(teamId, input.task_id, {
|
|
@@ -21471,13 +21107,13 @@ IMPORTANT: Assigning to a specific teammate
|
|
|
21471
21107
|
{
|
|
21472
21108
|
name: "set_task_dependencies",
|
|
21473
21109
|
description: 'Set which task IDs must complete before this task can be claimed. Pass an array of task IDs (e.g. ["task-01", "task-02"]). Use to fix task order or add/remove dependencies. Omit team_id to use the active team from state.',
|
|
21474
|
-
schema:
|
|
21475
|
-
task_id:
|
|
21476
|
-
dependencies:
|
|
21110
|
+
schema: z47.object({
|
|
21111
|
+
task_id: z47.string().describe("Task ID to update"),
|
|
21112
|
+
dependencies: z47.array(z47.string()).describe("Task IDs that must complete before this task can be claimed")
|
|
21477
21113
|
})
|
|
21478
21114
|
}
|
|
21479
21115
|
);
|
|
21480
|
-
const checkTasksTool =
|
|
21116
|
+
const checkTasksTool = tool44(
|
|
21481
21117
|
async (input, config) => {
|
|
21482
21118
|
const teamId = resolveTeamId();
|
|
21483
21119
|
const tasks = await taskListStore.getAllTasks(teamId);
|
|
@@ -21517,12 +21153,12 @@ Task Status Values:
|
|
|
21517
21153
|
- in_progress: Teammate is actively working on this task
|
|
21518
21154
|
- completed: Task finished successfully
|
|
21519
21155
|
- failed: Task encountered an error`,
|
|
21520
|
-
schema:
|
|
21521
|
-
team_id:
|
|
21156
|
+
schema: z47.object({
|
|
21157
|
+
team_id: z47.string().optional().describe("Team ID (omit to use active team)")
|
|
21522
21158
|
})
|
|
21523
21159
|
}
|
|
21524
21160
|
);
|
|
21525
|
-
const sendMessageTool =
|
|
21161
|
+
const sendMessageTool = tool44(
|
|
21526
21162
|
async (input, config) => {
|
|
21527
21163
|
const teamId = resolveTeamId();
|
|
21528
21164
|
await mailboxStore.sendMessage(
|
|
@@ -21541,13 +21177,13 @@ Task Status Values:
|
|
|
21541
21177
|
{
|
|
21542
21178
|
name: "send_message",
|
|
21543
21179
|
description: "Send a message to a specific teammate in the team. Omit team_id to use the active team from state.",
|
|
21544
|
-
schema:
|
|
21545
|
-
to:
|
|
21546
|
-
content:
|
|
21180
|
+
schema: z47.object({
|
|
21181
|
+
to: z47.string().describe("Recipient teammate name"),
|
|
21182
|
+
content: z47.string().describe("Message content")
|
|
21547
21183
|
})
|
|
21548
21184
|
}
|
|
21549
21185
|
);
|
|
21550
|
-
const readMessagesTool =
|
|
21186
|
+
const readMessagesTool = tool44(
|
|
21551
21187
|
async (input, config) => {
|
|
21552
21188
|
const teamId = resolveTeamId();
|
|
21553
21189
|
const formatAndMarkAsRead = async (msgs2) => {
|
|
@@ -21629,12 +21265,12 @@ Task Status Values:
|
|
|
21629
21265
|
{
|
|
21630
21266
|
name: "read_messages",
|
|
21631
21267
|
description: "Read unread messages from teammates. Returns immediately if messages exist, otherwise waits for up to 3 minutes for new messages.",
|
|
21632
|
-
schema:
|
|
21633
|
-
team_id:
|
|
21268
|
+
schema: z47.object({
|
|
21269
|
+
team_id: z47.string().optional().describe("Team ID (omit to use active team)")
|
|
21634
21270
|
})
|
|
21635
21271
|
}
|
|
21636
21272
|
);
|
|
21637
|
-
const disbandTeamTool =
|
|
21273
|
+
const disbandTeamTool = tool44(
|
|
21638
21274
|
async (input, config) => {
|
|
21639
21275
|
const teamId = resolveTeamId();
|
|
21640
21276
|
await mailboxStore.broadcastMessage(
|
|
@@ -21655,7 +21291,7 @@ Task Status Values:
|
|
|
21655
21291
|
description: "Disband a team when all work is done. Before calling: (1) Call check_tasks to verify no tasks are still pending/in_progress; (2) if any are, discuss with the team via read_messages and broadcast_message/send_message whether to continue or stop/cancel them; (3) only after alignment (all tasks completed/failed or explicitly stopped), then call this tool. This will: 1) Send a shutdown message to all teammates, 2) Wait briefly for them to clean up, 3) Clear all tasks and messages. Omit team_id to use the active team from state."
|
|
21656
21292
|
}
|
|
21657
21293
|
);
|
|
21658
|
-
const broadcastMessageTool =
|
|
21294
|
+
const broadcastMessageTool = tool44(
|
|
21659
21295
|
async (input, config) => {
|
|
21660
21296
|
const teamId = resolveTeamId();
|
|
21661
21297
|
await mailboxStore.broadcastMessage(
|
|
@@ -21673,12 +21309,12 @@ Task Status Values:
|
|
|
21673
21309
|
{
|
|
21674
21310
|
name: "broadcast_message",
|
|
21675
21311
|
description: "Send a message to all teammates at once. Use this to communicate with everyone in the team. Omit team_id to use the active team from state.",
|
|
21676
|
-
schema:
|
|
21677
|
-
content:
|
|
21312
|
+
schema: z47.object({
|
|
21313
|
+
content: z47.string().describe("Message content to broadcast to all teammates")
|
|
21678
21314
|
})
|
|
21679
21315
|
}
|
|
21680
21316
|
);
|
|
21681
|
-
return
|
|
21317
|
+
return createMiddleware16({
|
|
21682
21318
|
name: "teamMiddleware",
|
|
21683
21319
|
tools: [
|
|
21684
21320
|
createTeamTool,
|
|
@@ -21706,37 +21342,37 @@ ${TEAM_SYSTEM_PROMPT}` : TEAM_SYSTEM_PROMPT;
|
|
|
21706
21342
|
}
|
|
21707
21343
|
|
|
21708
21344
|
// src/agent_team/agent_team.ts
|
|
21709
|
-
var TeammateInfoSchema =
|
|
21710
|
-
name:
|
|
21711
|
-
role:
|
|
21712
|
-
description:
|
|
21345
|
+
var TeammateInfoSchema = z48.object({
|
|
21346
|
+
name: z48.string().describe("Teammate name"),
|
|
21347
|
+
role: z48.string().describe("Role category (e.g. research, writing, review)"),
|
|
21348
|
+
description: z48.string().describe("What this teammate focuses on")
|
|
21713
21349
|
});
|
|
21714
|
-
var TeamTaskInfoSchema =
|
|
21715
|
-
id:
|
|
21716
|
-
title:
|
|
21717
|
-
description:
|
|
21718
|
-
status:
|
|
21350
|
+
var TeamTaskInfoSchema = z48.object({
|
|
21351
|
+
id: z48.string(),
|
|
21352
|
+
title: z48.string(),
|
|
21353
|
+
description: z48.string(),
|
|
21354
|
+
status: z48.string().optional()
|
|
21719
21355
|
});
|
|
21720
|
-
var MailboxMessageSchema =
|
|
21721
|
-
id:
|
|
21722
|
-
from:
|
|
21723
|
-
to:
|
|
21724
|
-
content:
|
|
21725
|
-
timestamp:
|
|
21726
|
-
type:
|
|
21727
|
-
read:
|
|
21356
|
+
var MailboxMessageSchema = z48.object({
|
|
21357
|
+
id: z48.string().describe("Unique message identifier"),
|
|
21358
|
+
from: z48.string().describe("Sender agent name"),
|
|
21359
|
+
to: z48.string().describe("Recipient agent name"),
|
|
21360
|
+
content: z48.string().describe("Message content"),
|
|
21361
|
+
timestamp: z48.string().describe("ISO timestamp when the message was sent"),
|
|
21362
|
+
type: z48.nativeEnum(MessageType).describe("Message type"),
|
|
21363
|
+
read: z48.boolean().describe("Whether the recipient has read this message")
|
|
21728
21364
|
});
|
|
21729
|
-
var TeamInfoSchema =
|
|
21730
|
-
teamId:
|
|
21731
|
-
teamLeadId:
|
|
21732
|
-
teammates:
|
|
21733
|
-
tasks:
|
|
21734
|
-
createdAt:
|
|
21365
|
+
var TeamInfoSchema = z48.object({
|
|
21366
|
+
teamId: z48.string().describe("Unique team identifier"),
|
|
21367
|
+
teamLeadId: z48.string().default("team_lead").describe("Team lead agent ID"),
|
|
21368
|
+
teammates: z48.array(TeammateInfoSchema).describe("Active teammates in this team"),
|
|
21369
|
+
tasks: z48.array(TeamTaskInfoSchema).optional().describe("Initial tasks snapshot"),
|
|
21370
|
+
createdAt: z48.string().optional().describe("ISO timestamp when team was created")
|
|
21735
21371
|
});
|
|
21736
|
-
var TEAM_STATE_SCHEMA =
|
|
21372
|
+
var TEAM_STATE_SCHEMA = z48.object({
|
|
21737
21373
|
team: TeamInfoSchema.optional().describe("Team info: teamId, teamLeadId, teammates, tasks. Set when create_team succeeds."),
|
|
21738
|
-
tasks:
|
|
21739
|
-
team_mailbox:
|
|
21374
|
+
tasks: z48.array(TeamTaskInfoSchema).optional().describe("Current tasks snapshot from check_tasks. Updated on each check."),
|
|
21375
|
+
team_mailbox: z48.array(MailboxMessageSchema).optional().describe("All team mailbox messages for display")
|
|
21740
21376
|
});
|
|
21741
21377
|
var TEAM_LEAD_BASE_PROMPT = `You are a team lead that coordinates a team of specialized agents. In order to complete the objective that the user asks of you, you will need to:
|
|
21742
21378
|
|
|
@@ -25858,7 +25494,7 @@ ${body}` : `${frontmatter}
|
|
|
25858
25494
|
};
|
|
25859
25495
|
|
|
25860
25496
|
// src/store_lattice/InMemoryMenuStore.ts
|
|
25861
|
-
import { randomUUID as
|
|
25497
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
25862
25498
|
var InMemoryMenuStore = class {
|
|
25863
25499
|
constructor() {
|
|
25864
25500
|
this.items = /* @__PURE__ */ new Map();
|
|
@@ -25879,7 +25515,7 @@ var InMemoryMenuStore = class {
|
|
|
25879
25515
|
async create(input) {
|
|
25880
25516
|
const now = /* @__PURE__ */ new Date();
|
|
25881
25517
|
const item = {
|
|
25882
|
-
id:
|
|
25518
|
+
id: randomUUID5(),
|
|
25883
25519
|
tenantId: input.tenantId,
|
|
25884
25520
|
menuTarget: input.menuTarget,
|
|
25885
25521
|
group: input.group,
|
|
@@ -25915,7 +25551,7 @@ var InMemoryMenuStore = class {
|
|
|
25915
25551
|
};
|
|
25916
25552
|
|
|
25917
25553
|
// src/agent_lattice/agentArchitectTools.ts
|
|
25918
|
-
import
|
|
25554
|
+
import z49 from "zod";
|
|
25919
25555
|
import { v4 as v43 } from "uuid";
|
|
25920
25556
|
import { AgentType as AgentType3 } from "@axiom-lattice/protocols";
|
|
25921
25557
|
function getTenantId2(exeConfig) {
|
|
@@ -26024,7 +25660,7 @@ registerToolLattice(
|
|
|
26024
25660
|
{
|
|
26025
25661
|
name: "list_agents",
|
|
26026
25662
|
description: "List all agents for the current workspace. Returns a summary with id, name, description, and type for each agent.",
|
|
26027
|
-
schema:
|
|
25663
|
+
schema: z49.object({})
|
|
26028
25664
|
},
|
|
26029
25665
|
async (_input, exeConfig) => {
|
|
26030
25666
|
try {
|
|
@@ -26051,8 +25687,8 @@ registerToolLattice(
|
|
|
26051
25687
|
{
|
|
26052
25688
|
name: "get_agent",
|
|
26053
25689
|
description: "Get the full configuration of a specific agent by its ID. Returns the complete AgentConfig including prompt, middleware, tools, and sub-agents.",
|
|
26054
|
-
schema:
|
|
26055
|
-
id:
|
|
25690
|
+
schema: z49.object({
|
|
25691
|
+
id: z49.string().describe("The agent ID to retrieve")
|
|
26056
25692
|
})
|
|
26057
25693
|
},
|
|
26058
25694
|
async (input, exeConfig) => {
|
|
@@ -26069,27 +25705,27 @@ registerToolLattice(
|
|
|
26069
25705
|
}
|
|
26070
25706
|
}
|
|
26071
25707
|
);
|
|
26072
|
-
var middlewareConfigSchema =
|
|
26073
|
-
id:
|
|
26074
|
-
type:
|
|
26075
|
-
name:
|
|
26076
|
-
description:
|
|
26077
|
-
enabled:
|
|
26078
|
-
allowedTools:
|
|
26079
|
-
config:
|
|
25708
|
+
var middlewareConfigSchema = z49.object({
|
|
25709
|
+
id: z49.string(),
|
|
25710
|
+
type: z49.string(),
|
|
25711
|
+
name: z49.string(),
|
|
25712
|
+
description: z49.string(),
|
|
25713
|
+
enabled: z49.boolean(),
|
|
25714
|
+
allowedTools: z49.array(z49.string()).optional().describe("Optional tool-name allowlist. Omit it or pass [] to enable all tools from this middleware. A non-empty task middleware allowlist must include both manage_task and task."),
|
|
25715
|
+
config: z49.record(z49.any()).optional()
|
|
26080
25716
|
});
|
|
26081
|
-
var createAgentSchema =
|
|
26082
|
-
skillLoaded:
|
|
26083
|
-
name:
|
|
26084
|
-
description:
|
|
26085
|
-
type:
|
|
26086
|
-
prompt:
|
|
26087
|
-
tools:
|
|
26088
|
-
middleware:
|
|
26089
|
-
subAgents:
|
|
26090
|
-
internalSubAgents:
|
|
26091
|
-
modelKey:
|
|
26092
|
-
metadata:
|
|
25717
|
+
var createAgentSchema = z49.object({
|
|
25718
|
+
skillLoaded: z49.literal(true).optional().describe("For agent-architect, set true only after loading agent-architecture in the current conversation context."),
|
|
25719
|
+
name: z49.string().describe("Human-friendly display name for the agent. The machine ID (used in other tools) is auto-generated as a slug from this name (e.g. 'My Cool Agent' \u2192 'my-cool-agent')."),
|
|
25720
|
+
description: z49.string().optional().describe("Short description"),
|
|
25721
|
+
type: z49.enum(["react", "deep_agent"]).describe("Agent type. Use 'react' for simple single-responsibility agents, 'deep_agent' for complex open-ended agents. For PROCESSING agents (workflow orchestration), use create_processing_agent instead."),
|
|
25722
|
+
prompt: z49.string().describe("System prompt for the agent"),
|
|
25723
|
+
tools: z49.array(z49.string()).optional().describe("Tool keys (strings) to assign. Call list_tools first to see available keys. Each element is a plain string like 'sap_api_search'. IMPORTANT: tools is a FLAT string array of tool names. Do NOT put middleware-like objects here \u2014 middleware goes in the separate 'middleware' field."),
|
|
25724
|
+
middleware: z49.array(middlewareConfigSchema).optional().describe("Middleware configuration objects. Each has {id, type, name, description, enabled, config}. IMPORTANT: middleware objects are NOT tools. Do NOT put tool keys (strings) here \u2014 tool names go in the separate 'tools' array. For user approval/confirmation scenarios, use type: 'ask_user_to_clarify' with config: {}."),
|
|
25725
|
+
subAgents: z49.array(z49.string()).optional().describe("Sub-agent IDs (deep_agent only)"),
|
|
25726
|
+
internalSubAgents: z49.array(z49.any()).optional().describe("Inline sub-agent configs (deep_agent only)"),
|
|
25727
|
+
modelKey: z49.string().optional().describe("Model key to use"),
|
|
25728
|
+
metadata: z49.record(z49.string(), z49.string()).optional().describe("Arbitrary metadata key-value pairs (e.g. verified: 'human-reviewed', version: '1.0', source: 'PO-Format-SAP.pdf')")
|
|
26093
25729
|
});
|
|
26094
25730
|
registerToolLattice(
|
|
26095
25731
|
"create_agent",
|
|
@@ -26134,14 +25770,14 @@ registerToolLattice(
|
|
|
26134
25770
|
}
|
|
26135
25771
|
}
|
|
26136
25772
|
);
|
|
26137
|
-
var createWorkflowSchema =
|
|
26138
|
-
name:
|
|
26139
|
-
description:
|
|
26140
|
-
skillLoaded:
|
|
26141
|
-
yaml:
|
|
26142
|
-
tools:
|
|
26143
|
-
middleware:
|
|
26144
|
-
modelKey:
|
|
25773
|
+
var createWorkflowSchema = z49.object({
|
|
25774
|
+
name: z49.string().describe("Display name for the workflow agent"),
|
|
25775
|
+
description: z49.string().optional().describe("Short description"),
|
|
25776
|
+
skillLoaded: z49.literal(true).describe("MUST be true. Set after loading the 'create-workflow' skill."),
|
|
25777
|
+
yaml: z49.string().describe("The YAML workflow definition in linear DSL format (steps execute top-to-bottom, use parallel: for concurrency)"),
|
|
25778
|
+
tools: z49.array(z49.string()).optional().describe("Tool keys for the workflow agent"),
|
|
25779
|
+
middleware: z49.array(middlewareConfigSchema).optional().describe("Middleware configs"),
|
|
25780
|
+
modelKey: z49.string().optional().describe("Model key")
|
|
26145
25781
|
});
|
|
26146
25782
|
registerToolLattice(
|
|
26147
25783
|
"create_workflow",
|
|
@@ -26192,8 +25828,8 @@ registerToolLattice(
|
|
|
26192
25828
|
{
|
|
26193
25829
|
name: "validate_workflow",
|
|
26194
25830
|
description: "Validate a workflow agent's DSL for correctness by compiling it.",
|
|
26195
|
-
schema:
|
|
26196
|
-
id:
|
|
25831
|
+
schema: z49.object({
|
|
25832
|
+
id: z49.string().describe("The workflow agent ID to validate")
|
|
26197
25833
|
})
|
|
26198
25834
|
},
|
|
26199
25835
|
async (input, exeConfig) => {
|
|
@@ -26290,15 +25926,15 @@ registerToolLattice(
|
|
|
26290
25926
|
}
|
|
26291
25927
|
}
|
|
26292
25928
|
);
|
|
26293
|
-
var updateWorkflowSchema =
|
|
26294
|
-
id:
|
|
26295
|
-
skillLoaded:
|
|
26296
|
-
name:
|
|
26297
|
-
description:
|
|
26298
|
-
yaml:
|
|
26299
|
-
tools:
|
|
26300
|
-
middleware:
|
|
26301
|
-
modelKey:
|
|
25929
|
+
var updateWorkflowSchema = z49.object({
|
|
25930
|
+
id: z49.string().describe("The workflow agent ID to update"),
|
|
25931
|
+
skillLoaded: z49.literal(true).optional().describe("For agent-architect, set true only after loading agent-architecture in the current conversation context."),
|
|
25932
|
+
name: z49.string().optional().describe("New display name"),
|
|
25933
|
+
description: z49.string().optional().describe("New description"),
|
|
25934
|
+
yaml: z49.string().optional().describe("Replacement YAML workflow DSL. Omit to keep existing."),
|
|
25935
|
+
tools: z49.array(z49.string()).optional().describe("Replacement tool keys"),
|
|
25936
|
+
middleware: z49.array(middlewareConfigSchema).optional().describe("Replacement middleware configs"),
|
|
25937
|
+
modelKey: z49.string().optional().describe("Replacement model key")
|
|
26302
25938
|
});
|
|
26303
25939
|
registerToolLattice(
|
|
26304
25940
|
"update_workflow",
|
|
@@ -26404,20 +26040,20 @@ registerToolLattice(
|
|
|
26404
26040
|
}
|
|
26405
26041
|
}
|
|
26406
26042
|
);
|
|
26407
|
-
var updateAgentSchema =
|
|
26408
|
-
id:
|
|
26409
|
-
skillLoaded:
|
|
26410
|
-
config:
|
|
26411
|
-
name:
|
|
26412
|
-
description:
|
|
26413
|
-
type:
|
|
26414
|
-
prompt:
|
|
26415
|
-
tools:
|
|
26416
|
-
middleware:
|
|
26417
|
-
subAgents:
|
|
26418
|
-
internalSubAgents:
|
|
26419
|
-
modelKey:
|
|
26420
|
-
metadata:
|
|
26043
|
+
var updateAgentSchema = z49.object({
|
|
26044
|
+
id: z49.string().describe("The agent ID to update"),
|
|
26045
|
+
skillLoaded: z49.literal(true).optional().describe("For agent-architect, set true only after loading agent-architecture in the current conversation context."),
|
|
26046
|
+
config: z49.object({
|
|
26047
|
+
name: z49.string().optional().describe("New display name for the agent"),
|
|
26048
|
+
description: z49.string().optional().describe("New short description"),
|
|
26049
|
+
type: z49.enum(["react", "deep_agent"]).optional().describe("Agent type"),
|
|
26050
|
+
prompt: z49.string().optional().describe("New system prompt for the agent"),
|
|
26051
|
+
tools: z49.array(z49.string()).optional().describe("Tool keys to assign to this agent. These are registered tool names (strings), NOT middleware objects."),
|
|
26052
|
+
middleware: z49.array(middlewareConfigSchema).optional().describe("Middleware configurations. NOTE: middleware objects have type/name/description/enabled/config fields and are NOT the same as tools. Tool keys go in the 'tools' array. For user approval/confirmation scenarios, use type: 'ask_user_to_clarify' with config: {}."),
|
|
26053
|
+
subAgents: z49.array(z49.string()).optional().describe("Sub-agent IDs (deep_agent only)"),
|
|
26054
|
+
internalSubAgents: z49.array(z49.any()).optional().describe("Inline sub-agent configs (deep_agent only)"),
|
|
26055
|
+
modelKey: z49.string().optional().describe("Model key to use"),
|
|
26056
|
+
metadata: z49.record(z49.string(), z49.string()).optional().describe("Arbitrary metadata key-value pairs (e.g. verified: 'machine-confirmed', version: '1.1'). Replaces the whole map when provided.")
|
|
26421
26057
|
}).describe("Configuration fields to update. Only include the fields you want to change.")
|
|
26422
26058
|
});
|
|
26423
26059
|
registerToolLattice(
|
|
@@ -26539,8 +26175,8 @@ registerToolLattice(
|
|
|
26539
26175
|
{
|
|
26540
26176
|
name: "delete_agent",
|
|
26541
26177
|
description: "Permanently delete an agent by its ID. This action cannot be undone.",
|
|
26542
|
-
schema:
|
|
26543
|
-
id:
|
|
26178
|
+
schema: z49.object({
|
|
26179
|
+
id: z49.string().describe("The agent ID to delete")
|
|
26544
26180
|
})
|
|
26545
26181
|
},
|
|
26546
26182
|
async (input, exeConfig) => {
|
|
@@ -26566,7 +26202,7 @@ registerToolLattice(
|
|
|
26566
26202
|
{
|
|
26567
26203
|
name: "list_tools",
|
|
26568
26204
|
description: "List all available tools that can be assigned to agents. Returns each tool's registry key (use this string value in the 'tools' array), name, description, and whether it requires user approval.",
|
|
26569
|
-
schema:
|
|
26205
|
+
schema: z49.object({})
|
|
26570
26206
|
},
|
|
26571
26207
|
async (_input, _exeConfig) => {
|
|
26572
26208
|
try {
|
|
@@ -26589,7 +26225,7 @@ registerToolLattice(
|
|
|
26589
26225
|
{
|
|
26590
26226
|
name: "list_models",
|
|
26591
26227
|
description: "List all registered models. Returns each model's key (use this string as modelKey when creating eval projects via manage_eval create_project, or as an agent's modelKey in create_agent/update_agent) and its display name.",
|
|
26592
|
-
schema:
|
|
26228
|
+
schema: z49.object({})
|
|
26593
26229
|
},
|
|
26594
26230
|
async (_input) => {
|
|
26595
26231
|
try {
|
|
@@ -26610,9 +26246,9 @@ registerToolLattice(
|
|
|
26610
26246
|
{
|
|
26611
26247
|
name: "invoke_agent",
|
|
26612
26248
|
description: "Invoke an agent with a test message and return its response. Use this to verify an agent works correctly after creating or modifying it. The agent must be compiled (already created and valid).",
|
|
26613
|
-
schema:
|
|
26614
|
-
id:
|
|
26615
|
-
message:
|
|
26249
|
+
schema: z49.object({
|
|
26250
|
+
id: z49.string().describe("The agent ID to invoke"),
|
|
26251
|
+
message: z49.string().describe("The test message to send to the agent")
|
|
26616
26252
|
})
|
|
26617
26253
|
},
|
|
26618
26254
|
async (input, exeConfig) => {
|
|
@@ -26648,7 +26284,7 @@ registerToolLattice(
|
|
|
26648
26284
|
{
|
|
26649
26285
|
name: "list_middleware_types",
|
|
26650
26286
|
description: "\u5217\u51FA\u5F53\u524D\u7CFB\u7EDF\u4E2D\u6240\u6709\u53EF\u7528\u7684\u4E2D\u95F4\u4EF6\u7C7B\u578B\uFF08Middlewares\uFF09\uFF0C\u5305\u62EC\u5185\u7F6E\u548C\u81EA\u5B9A\u4E49\u63D2\u4EF6\u3002\u8FD4\u56DE\u6BCF\u4E2A\u4E2D\u95F4\u4EF6\u7684 type\u3001name\u3001description\u3001tools \u6E05\u5355\uFF08\u652F\u6301 allowedTools \u8FC7\u6EE4\uFF09\u3001configSchema\uFF08\u914D\u7F6E\u9762\u677F\u9700\u8981\u54EA\u4E9B\u5B57\u6BB5\uFF09\u548C connectionSchema\uFF08\u662F\u5426\u652F\u6301\u8FDE\u63A5\u6D4B\u8BD5\u548C\u8D44\u6E90\u53D1\u73B0\uFF09\u3002\n\n\u4F7F\u7528\u573A\u666F\uFF1A\n1. \u5728\u521B\u5EFA agent \u524D\uFF0C\u5148\u8C03\u6B64\u5DE5\u5177\u4E86\u89E3\u6709\u54EA\u4E9B\u4E2D\u95F4\u4EF6\u53EF\u914D\u7F6E\n2. \u6839\u636E configSchema \u51B3\u5B9A\u9700\u8981\u63D0\u4F9B\u54EA\u4E9B\u914D\u7F6E\u5B57\u6BB5\uFF1B\u65B0\u8FDE\u63A5\u578B\u63D2\u4EF6\u4F7F\u7528 connections \u548C connectAll\uFF0C\u5185\u7F6E\u65E7\u63D2\u4EF6\u7684 selector \u5B57\u6BB5\u7531 core \u7684 legacy compatibility map \u5B9A\u4E49\n3. \u5982\u679C\u67D0\u4E2A\u4E2D\u95F4\u4EF6\u7684 connectionSchema \u5B58\u5728\uFF0C\u8BF4\u660E\u5B83\u662F\u8FDE\u63A5\u578B\u4E2D\u95F4\u4EF6\uFF0C\u9700\u8981\u518D\u8C03 list_connections \u83B7\u53D6\u53EF\u7528\u8FDE\u63A5\n4. \u7528\u8FD4\u56DE\u7684 type \u5B57\u6BB5\u6784\u5EFA middleware \u6570\u7EC4\u4F20\u7ED9 create_agent / update_agent",
|
|
26651
|
-
schema:
|
|
26287
|
+
schema: z49.object({})
|
|
26652
26288
|
},
|
|
26653
26289
|
async () => {
|
|
26654
26290
|
const availableMiddlewareTypes = getAvailableMiddlewareTypes();
|
|
@@ -26661,8 +26297,8 @@ registerToolLattice(
|
|
|
26661
26297
|
{
|
|
26662
26298
|
name: "list_connections",
|
|
26663
26299
|
description: "\u5217\u51FA\u6307\u5B9A\u63D2\u4EF6\u7C7B\u578B\u7684\u6240\u6709\u5DF2\u914D\u7F6E\u8FDE\u63A5\u3002\u7528\u4E8E\u67E5\u8BE2\u6709\u54EA\u4E9B\u53EF\u7528\u7684\u8FDE\u63A5\u5B9E\u4F8B\uFF08\u5982 'sap-prod', 'sap-dev'\uFF09\uFF0C\u65B9\u4FBF\u5728 agent \u914D\u7F6E\u4E2D\u9009\u62E9\u5177\u4F53\u8FDE\u63A5\u3002\n\n\u4F7F\u7528\u573A\u666F\uFF1A\n1. \u5148\u8C03 list_middleware_types \u786E\u5B9A\u67D0\u4E2A\u4E2D\u95F4\u4EF6\u662F\u8FDE\u63A5\u578B\uFF08\u6709 connectionSchema\uFF09\n2. \u8C03\u6B64\u5DE5\u5177\u4F20\u5165 type\uFF08\u5982 'erp'\uFF09\uFF0C\u83B7\u53D6\u8BE5\u7C7B\u578B\u4E0B\u5DF2\u914D\u597D\u7684\u8FDE\u63A5\u5217\u8868\n3. \u5728 create_agent \u7684 middleware[i].config.connections \u4E2D\u586B\u5165\u5BF9\u5E94\u7684 key \u503C\n\n\u8FD4\u56DE\u683C\u5F0F\uFF1A{ success: true, data: { records: [{ key, name, ... }] } }",
|
|
26664
|
-
schema:
|
|
26665
|
-
type:
|
|
26300
|
+
schema: z49.object({
|
|
26301
|
+
type: z49.string().describe("\u63D2\u4EF6\u7C7B\u578B\u6807\u8BC6\uFF0C\u5982 'erp'\u3002\u4ECE list_middleware_types \u7684\u8FD4\u56DE\u4E2D\u83B7\u53D6")
|
|
26666
26302
|
}),
|
|
26667
26303
|
needUserApprove: false
|
|
26668
26304
|
},
|
|
@@ -26938,6 +26574,14 @@ var roomCoordinatorConfig = {
|
|
|
26938
26574
|
description: "Wait for user input at approval gates",
|
|
26939
26575
|
enabled: true,
|
|
26940
26576
|
config: {}
|
|
26577
|
+
},
|
|
26578
|
+
{
|
|
26579
|
+
id: "project_room",
|
|
26580
|
+
type: "project_room",
|
|
26581
|
+
name: "Project Room",
|
|
26582
|
+
description: "Post to the room and list active members for delegation",
|
|
26583
|
+
enabled: true,
|
|
26584
|
+
config: {}
|
|
26941
26585
|
}
|
|
26942
26586
|
]
|
|
26943
26587
|
};
|
|
@@ -26980,7 +26624,7 @@ function assistantToConfig(assistant) {
|
|
|
26980
26624
|
Object.assign(config, graphDef);
|
|
26981
26625
|
return config;
|
|
26982
26626
|
}
|
|
26983
|
-
var
|
|
26627
|
+
var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager {
|
|
26984
26628
|
constructor() {
|
|
26985
26629
|
super();
|
|
26986
26630
|
this.initialized = false;
|
|
@@ -27089,7 +26733,18 @@ var AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
27089
26733
|
getLatticeType() {
|
|
27090
26734
|
return "agents";
|
|
27091
26735
|
}
|
|
27092
|
-
|
|
26736
|
+
/**
|
|
26737
|
+
* Returns the parent assistant key for a `{parent}-general-purpose` key, or
|
|
26738
|
+
* `null` when the key is not a suffixed GP key (including the bare
|
|
26739
|
+
* `general-purpose` key itself).
|
|
26740
|
+
*/
|
|
26741
|
+
generalPurposeParentKey(key4) {
|
|
26742
|
+
const suffix = _AgentLatticeManager.GENERAL_PURPOSE_SUFFIX;
|
|
26743
|
+
if (!key4.endsWith(suffix) || key4.length <= suffix.length) {
|
|
26744
|
+
return null;
|
|
26745
|
+
}
|
|
26746
|
+
return key4.slice(0, -suffix.length);
|
|
26747
|
+
}
|
|
27093
26748
|
/**
|
|
27094
26749
|
* 带租户注册Agent Lattice
|
|
27095
26750
|
* @param tenantId 租户ID
|
|
@@ -27105,20 +26760,66 @@ var AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
27105
26760
|
}
|
|
27106
26761
|
/**
|
|
27107
26762
|
* 带租户获取AgentLattice
|
|
26763
|
+
*
|
|
26764
|
+
* @remarks
|
|
26765
|
+
* For unregistered `{parent}-general-purpose` keys (ephemeral subagent
|
|
26766
|
+
* assistants created by the subagents middleware), this falls back to the
|
|
26767
|
+
* parent assistant's lattice so that read paths (thread state/messages)
|
|
26768
|
+
* resolve in processes where the runtime GP registration is absent.
|
|
26769
|
+
* {@link hasAgentLatticeWithTenant} stays strict.
|
|
26770
|
+
*
|
|
27108
26771
|
* @param tenantId 租户ID
|
|
27109
26772
|
* @param key Lattice键名
|
|
27110
26773
|
*/
|
|
27111
26774
|
getAgentLatticeWithTenant(tenantId2, key4) {
|
|
27112
|
-
|
|
26775
|
+
const exact = this.getWithTenant(tenantId2, key4);
|
|
26776
|
+
if (exact) {
|
|
26777
|
+
return exact;
|
|
26778
|
+
}
|
|
26779
|
+
const parentKey = this.generalPurposeParentKey(key4);
|
|
26780
|
+
if (!parentKey) {
|
|
26781
|
+
return void 0;
|
|
26782
|
+
}
|
|
26783
|
+
return this.getWithTenant(tenantId2, parentKey);
|
|
27113
26784
|
}
|
|
27114
26785
|
/**
|
|
27115
26786
|
* 带租户检查Lattice是否存在
|
|
26787
|
+
*
|
|
26788
|
+
* @remarks
|
|
26789
|
+
* Deliberately strict: `{parent}-general-purpose` keys are NOT covered by
|
|
26790
|
+
* the read fallback. The subagents middleware relies on this check to decide
|
|
26791
|
+
* whether to register the real GP runtime agent; a permissive check would
|
|
26792
|
+
* skip that registration and silently run the parent graph for GP tasks.
|
|
26793
|
+
*
|
|
27116
26794
|
* @param tenantId 租户ID
|
|
27117
26795
|
* @param key Lattice键名
|
|
27118
26796
|
*/
|
|
27119
26797
|
hasAgentLatticeWithTenant(tenantId2, key4) {
|
|
27120
26798
|
return this.hasWithTenant(tenantId2, key4);
|
|
27121
26799
|
}
|
|
26800
|
+
/**
|
|
26801
|
+
* 异步获取AgentLattice(内存未命中时尝试从store加载)
|
|
26802
|
+
*
|
|
26803
|
+
* @remarks
|
|
26804
|
+
* Mirrors {@link getAgentLatticeWithTenant}'s general-purpose fallback: an
|
|
26805
|
+
* unregistered `{parent}-general-purpose` key resolves to the parent
|
|
26806
|
+
* assistant's lattice. This is the lookup used by `getAgentClientAsync`,
|
|
26807
|
+
* which backs Gateway thread state/message reads for GP subagent threads.
|
|
26808
|
+
*
|
|
26809
|
+
* @param tenantId 租户ID
|
|
26810
|
+
* @param key Lattice键名
|
|
26811
|
+
*/
|
|
26812
|
+
async getOrLoadWithTenant(tenantId2, key4) {
|
|
26813
|
+
const exact = await super.getOrLoadWithTenant(tenantId2, key4);
|
|
26814
|
+
if (exact) {
|
|
26815
|
+
return exact;
|
|
26816
|
+
}
|
|
26817
|
+
const parentKey = this.generalPurposeParentKey(key4);
|
|
26818
|
+
if (!parentKey) {
|
|
26819
|
+
return void 0;
|
|
26820
|
+
}
|
|
26821
|
+
return super.getOrLoadWithTenant(tenantId2, parentKey);
|
|
26822
|
+
}
|
|
27122
26823
|
/**
|
|
27123
26824
|
* 带租户移除Lattice
|
|
27124
26825
|
* @param tenantId 租户ID
|
|
@@ -27442,6 +27143,18 @@ var AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
27442
27143
|
}
|
|
27443
27144
|
}
|
|
27444
27145
|
};
|
|
27146
|
+
// ========== 带租户的新API ==========
|
|
27147
|
+
/**
|
|
27148
|
+
* Suffix that identifies ephemeral general-purpose subagent assistants.
|
|
27149
|
+
*
|
|
27150
|
+
* The subagents middleware (deep_agent_new) registers a runtime agent
|
|
27151
|
+
* `{assistant_id}-general-purpose` in the process that executes the task.
|
|
27152
|
+
* Other processes (e.g. the Gateway serving thread state/messages) never see
|
|
27153
|
+
* that in-memory registration, so lattice lookups for the suffixed key fall
|
|
27154
|
+
* back to the parent assistant's lattice.
|
|
27155
|
+
*/
|
|
27156
|
+
_AgentLatticeManager.GENERAL_PURPOSE_SUFFIX = "-general-purpose";
|
|
27157
|
+
var AgentLatticeManager = _AgentLatticeManager;
|
|
27445
27158
|
var agentLatticeManager = AgentLatticeManager.getInstance();
|
|
27446
27159
|
var registerAgentLattice = (config) => {
|
|
27447
27160
|
agentLatticeManager.registerLattice(config);
|
|
@@ -30821,7 +30534,7 @@ function clearEvalRunService() {
|
|
|
30821
30534
|
}
|
|
30822
30535
|
|
|
30823
30536
|
// src/eval_lattice/LatticeEval.ts
|
|
30824
|
-
import { HumanMessage as
|
|
30537
|
+
import { HumanMessage as HumanMessage4 } from "@langchain/core/messages";
|
|
30825
30538
|
import { v4 as v44 } from "uuid";
|
|
30826
30539
|
function parseJudgeVerdict(raw) {
|
|
30827
30540
|
try {
|
|
@@ -31230,7 +30943,7 @@ Note: if final_score >= 80 and there are no fatal errors, pass should be true; o
|
|
|
31230
30943
|
const judgeAgent = await getAgentClient(judgeTenantId, judgeAgentKey);
|
|
31231
30944
|
const testResponse = await judgeAgent.invoke(
|
|
31232
30945
|
{
|
|
31233
|
-
messages: [new
|
|
30946
|
+
messages: [new HumanMessage4(testPrompt)]
|
|
31234
30947
|
},
|
|
31235
30948
|
{
|
|
31236
30949
|
configurable: {
|
|
@@ -31601,7 +31314,7 @@ var LatticeEvalSuite = class {
|
|
|
31601
31314
|
|
|
31602
31315
|
// src/eval_lattice/LatticeEvalProject.ts
|
|
31603
31316
|
import { AgentType as AgentType7 } from "@axiom-lattice/protocols";
|
|
31604
|
-
import { HumanMessage as
|
|
31317
|
+
import { HumanMessage as HumanMessage5 } from "@langchain/core/messages";
|
|
31605
31318
|
import { v4 as uuidv46 } from "uuid";
|
|
31606
31319
|
var DEFAULT_CALIBRATION_PROBES = [
|
|
31607
31320
|
{
|
|
@@ -31765,7 +31478,7 @@ Respond with JSON only: {"pass": true|false, "final_score": 0-100, "summary": "r
|
|
|
31765
31478
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
31766
31479
|
try {
|
|
31767
31480
|
const resp = await judgeAgent.invoke(
|
|
31768
|
-
{ messages: [new
|
|
31481
|
+
{ messages: [new HumanMessage5(prompt)] },
|
|
31769
31482
|
{ configurable: { thread_id: uuidv46() } }
|
|
31770
31483
|
);
|
|
31771
31484
|
const last = resp?.messages?.[resp.messages.length - 1];
|
|
@@ -31882,7 +31595,7 @@ function getMenuRegistry() {
|
|
|
31882
31595
|
}
|
|
31883
31596
|
|
|
31884
31597
|
// src/services/ProjectTaskReassignmentAuthorization.ts
|
|
31885
|
-
import { snapshotExactRecord
|
|
31598
|
+
import { snapshotExactRecord } from "@axiom-lattice/protocols";
|
|
31886
31599
|
var issued = /* @__PURE__ */ new WeakMap();
|
|
31887
31600
|
function createProjectTaskReassignmentAuthorizer(policy, threadValidator) {
|
|
31888
31601
|
return {
|
|
@@ -31915,7 +31628,7 @@ function inspectProjectTaskReassignmentAuthorization(authorization) {
|
|
|
31915
31628
|
return snapshot ? { ...snapshot } : void 0;
|
|
31916
31629
|
}
|
|
31917
31630
|
function snapshotInput(input) {
|
|
31918
|
-
const row =
|
|
31631
|
+
const row = snapshotExactRecord(input, [
|
|
31919
31632
|
"tenantId",
|
|
31920
31633
|
"workspaceId",
|
|
31921
31634
|
"projectId",
|
|
@@ -31958,7 +31671,7 @@ function snapshotInput(input) {
|
|
|
31958
31671
|
}
|
|
31959
31672
|
|
|
31960
31673
|
// src/services/TaskLifecycleNotifier.ts
|
|
31961
|
-
import { snapshotExactRecord as
|
|
31674
|
+
import { snapshotExactRecord as snapshotExactRecord2 } from "@axiom-lattice/protocols";
|
|
31962
31675
|
var TaskLifecycleNotifier = class {
|
|
31963
31676
|
constructor() {
|
|
31964
31677
|
this.listeners = /* @__PURE__ */ new Set();
|
|
@@ -32002,7 +31715,7 @@ var TaskLifecycleNotifier = class {
|
|
|
32002
31715
|
};
|
|
32003
31716
|
var taskLifecycleNotifier = new TaskLifecycleNotifier();
|
|
32004
31717
|
function snapshotNotification(value) {
|
|
32005
|
-
const row =
|
|
31718
|
+
const row = snapshotExactRecord2(value, [
|
|
32006
31719
|
"tenantId",
|
|
32007
31720
|
"workspaceId",
|
|
32008
31721
|
"projectId",
|
|
@@ -32034,7 +31747,7 @@ function nonempty(value) {
|
|
|
32034
31747
|
}
|
|
32035
31748
|
|
|
32036
31749
|
// src/services/ProjectTaskAdmissionNotifier.ts
|
|
32037
|
-
import { snapshotExactRecord as
|
|
31750
|
+
import { snapshotExactRecord as snapshotExactRecord3 } from "@axiom-lattice/protocols";
|
|
32038
31751
|
var ProjectTaskAdmissionNotifier = class {
|
|
32039
31752
|
/**
|
|
32040
31753
|
* Creates a bounded Project task admission notifier.
|
|
@@ -32107,7 +31820,7 @@ var ProjectTaskAdmissionNotifier = class {
|
|
|
32107
31820
|
};
|
|
32108
31821
|
var projectTaskAdmissionNotifier = new ProjectTaskAdmissionNotifier();
|
|
32109
31822
|
function snapshotNotification2(value) {
|
|
32110
|
-
const row =
|
|
31823
|
+
const row = snapshotExactRecord3(value, [
|
|
32111
31824
|
"tenantId",
|
|
32112
31825
|
"workspaceId",
|
|
32113
31826
|
"projectId",
|
|
@@ -32137,9 +31850,9 @@ function canonicalTimestamp(value) {
|
|
|
32137
31850
|
}
|
|
32138
31851
|
|
|
32139
31852
|
// src/services/ProjectMutationMutex.ts
|
|
32140
|
-
import { snapshotExactRecord as
|
|
31853
|
+
import { snapshotExactRecord as snapshotExactRecord4 } from "@axiom-lattice/protocols";
|
|
32141
31854
|
function projectKey(scope) {
|
|
32142
|
-
const row =
|
|
31855
|
+
const row = snapshotExactRecord4(scope, ["tenantId", "projectId"]);
|
|
32143
31856
|
if (!row || typeof row.tenantId !== "string" || !row.tenantId || row.tenantId.includes("\0") || typeof row.projectId !== "string" || !row.projectId || row.projectId.includes("\0")) {
|
|
32144
31857
|
throw new Error("Invalid Project mutation scope");
|
|
32145
31858
|
}
|
|
@@ -32212,8 +31925,199 @@ function createTrustedAgentMessageDispatcher(resolve4) {
|
|
|
32212
31925
|
};
|
|
32213
31926
|
}
|
|
32214
31927
|
|
|
31928
|
+
// src/services/RoomAgentMessageService.ts
|
|
31929
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
31930
|
+
import { snapshotExactArray, snapshotExactRecord as snapshotExactRecord5 } from "@axiom-lattice/protocols";
|
|
31931
|
+
var INPUT_KEYS = [
|
|
31932
|
+
"tenantId",
|
|
31933
|
+
"workspaceId",
|
|
31934
|
+
"projectId",
|
|
31935
|
+
"roomId",
|
|
31936
|
+
"membershipId",
|
|
31937
|
+
"assistantId",
|
|
31938
|
+
"text",
|
|
31939
|
+
"sourceRoomMessageId",
|
|
31940
|
+
"sourceId",
|
|
31941
|
+
"idempotencyKey"
|
|
31942
|
+
];
|
|
31943
|
+
var REPLY_INPUT_KEYS = ["tenantId", "membershipId", "text", "sourceRoomMessageId", "inputMessageId", "sourceId", "idempotencyKey"];
|
|
31944
|
+
var RoomAgentMessageService = class {
|
|
31945
|
+
/**
|
|
31946
|
+
* Creates a room writer over the durable membership and message stores.
|
|
31947
|
+
*
|
|
31948
|
+
* @param deps Store methods, optional deterministic ID factory, and detached post-commit hooks.
|
|
31949
|
+
*/
|
|
31950
|
+
constructor(deps) {
|
|
31951
|
+
this.deps = deps;
|
|
31952
|
+
}
|
|
31953
|
+
/**
|
|
31954
|
+
* Persists a fully scoped Agent response after validating its human source and active membership.
|
|
31955
|
+
*
|
|
31956
|
+
* @param input Exact trusted scope and response payload.
|
|
31957
|
+
* @returns A deep clone of the canonical idempotent room message.
|
|
31958
|
+
*/
|
|
31959
|
+
post(input) {
|
|
31960
|
+
const snapshot = exactStringRecord(input, INPUT_KEYS, "Invalid project room message input");
|
|
31961
|
+
return this.persist(snapshot);
|
|
31962
|
+
}
|
|
31963
|
+
/**
|
|
31964
|
+
* Persists a channel reply while deriving all scope from validated durable records.
|
|
31965
|
+
*
|
|
31966
|
+
* @param input Exact correlation IDs, tenant, target membership, and response text.
|
|
31967
|
+
* @returns A deep clone of the canonical idempotent room message.
|
|
31968
|
+
*/
|
|
31969
|
+
postReply(input) {
|
|
31970
|
+
const snapshot = exactStringRecord(input, REPLY_INPUT_KEYS, "Invalid project room reply input");
|
|
31971
|
+
if (snapshot.sourceId !== `reply:${snapshot.inputMessageId}` || snapshot.idempotencyKey !== `room-reply:${snapshot.sourceRoomMessageId}:${snapshot.membershipId}:${snapshot.sourceId}`) {
|
|
31972
|
+
throw new Error("Invalid project room reply correlation");
|
|
31973
|
+
}
|
|
31974
|
+
return this.persistDerived(snapshot);
|
|
31975
|
+
}
|
|
31976
|
+
async persistDerived(input) {
|
|
31977
|
+
const source = snapshotSource(await this.deps.messages.findById(input.tenantId, input.sourceRoomMessageId));
|
|
31978
|
+
if (!source || source.id !== input.sourceRoomMessageId || source.tenantId !== input.tenantId) throw new Error("Invalid project room message");
|
|
31979
|
+
const member = snapshotMembership(await this.deps.memberships.findById(input.tenantId, input.membershipId));
|
|
31980
|
+
if (!member || member.id !== input.membershipId || member.tenantId !== input.tenantId) throw new Error("Invalid project room membership");
|
|
31981
|
+
return this.persist({
|
|
31982
|
+
...input,
|
|
31983
|
+
workspaceId: source.workspaceId,
|
|
31984
|
+
projectId: source.projectId,
|
|
31985
|
+
roomId: source.roomId,
|
|
31986
|
+
assistantId: member.assistantId
|
|
31987
|
+
}, source, member);
|
|
31988
|
+
}
|
|
31989
|
+
async persist(input, loadedSource, loadedMember) {
|
|
31990
|
+
const text = input.text.trim();
|
|
31991
|
+
if (text.length < 1 || text.length > 2e4) throw new Error("Invalid project room message text");
|
|
31992
|
+
const source = loadedSource ?? snapshotSource(await this.deps.messages.findById(input.tenantId, input.sourceRoomMessageId));
|
|
31993
|
+
if (!source || source.id !== input.sourceRoomMessageId || source.tenantId !== input.tenantId || source.workspaceId !== input.workspaceId || source.projectId !== input.projectId || source.roomId !== input.roomId) {
|
|
31994
|
+
throw new Error("Invalid project room message");
|
|
31995
|
+
}
|
|
31996
|
+
const member = loadedMember ?? snapshotMembership(await this.deps.memberships.findById(input.tenantId, input.membershipId));
|
|
31997
|
+
if (!member || member.id !== input.membershipId || member.status !== "active" || member.assistantId !== input.assistantId || member.tenantId !== input.tenantId || member.workspaceId !== input.workspaceId || member.projectId !== input.projectId || member.roomId !== input.roomId) {
|
|
31998
|
+
throw new Error("Invalid project room membership");
|
|
31999
|
+
}
|
|
32000
|
+
const candidate = {
|
|
32001
|
+
id: (this.deps.idFactory ?? randomUUID6)(),
|
|
32002
|
+
tenantId: input.tenantId,
|
|
32003
|
+
workspaceId: input.workspaceId,
|
|
32004
|
+
projectId: input.projectId,
|
|
32005
|
+
roomId: input.roomId,
|
|
32006
|
+
author: { type: "bot", membershipId: input.membershipId, assistantId: input.assistantId },
|
|
32007
|
+
content: { type: "text", text },
|
|
32008
|
+
mentions: [],
|
|
32009
|
+
replyToMessageId: input.sourceRoomMessageId,
|
|
32010
|
+
source: "agent",
|
|
32011
|
+
sourceId: input.sourceId,
|
|
32012
|
+
idempotencyKey: input.idempotencyKey
|
|
32013
|
+
};
|
|
32014
|
+
const canonical = snapshotCanonical(await this.deps.messages.createIdempotent(candidate), candidate);
|
|
32015
|
+
if (!canonical) throw new Error("Invalid canonical project room message");
|
|
32016
|
+
const result = structuredClone(canonical);
|
|
32017
|
+
this.notifyCommitted(result);
|
|
32018
|
+
return result;
|
|
32019
|
+
}
|
|
32020
|
+
notifyCommitted(message) {
|
|
32021
|
+
const callback = this.deps.onMessageCommitted;
|
|
32022
|
+
if (!callback) return;
|
|
32023
|
+
Promise.resolve().then(() => callback(structuredClone(message))).catch(() => {
|
|
32024
|
+
try {
|
|
32025
|
+
this.deps.onCallbackFailure?.({ messageId: message.id, code: "ROOM_MESSAGE_COMMIT_CALLBACK_FAILED" });
|
|
32026
|
+
} catch {
|
|
32027
|
+
}
|
|
32028
|
+
});
|
|
32029
|
+
}
|
|
32030
|
+
};
|
|
32031
|
+
function exactValues(value, required, optional = []) {
|
|
32032
|
+
try {
|
|
32033
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
32034
|
+
return snapshotExactRecord5(value, required, optional);
|
|
32035
|
+
} catch {
|
|
32036
|
+
return void 0;
|
|
32037
|
+
}
|
|
32038
|
+
}
|
|
32039
|
+
function exactStringRecord(value, keys, message) {
|
|
32040
|
+
const values = exactValues(value, keys);
|
|
32041
|
+
if (!values || keys.some((key4) => typeof values[key4] !== "string" || values[key4].length === 0)) throw new Error(message);
|
|
32042
|
+
return values;
|
|
32043
|
+
}
|
|
32044
|
+
function date(value) {
|
|
32045
|
+
try {
|
|
32046
|
+
const timestamp = Date.prototype.getTime.call(value);
|
|
32047
|
+
return Number.isFinite(timestamp) ? new Date(timestamp) : void 0;
|
|
32048
|
+
} catch {
|
|
32049
|
+
return void 0;
|
|
32050
|
+
}
|
|
32051
|
+
}
|
|
32052
|
+
function snapshotSource(value) {
|
|
32053
|
+
const values = exactValues(value, ["id", "tenantId", "workspaceId", "projectId", "roomId", "author", "content", "mentions", "source", "createdAt"], ["replyToMessageId", "sourceId", "idempotencyKey"]);
|
|
32054
|
+
const author = exactValues(values?.author, ["type", "userId"]);
|
|
32055
|
+
const content = exactValues(values?.content, ["type", "text"]);
|
|
32056
|
+
const createdAt = date(values?.createdAt);
|
|
32057
|
+
const mentions = snapshotMentions(values?.mentions);
|
|
32058
|
+
if (!values || values.source !== "user" || author?.type !== "human" || typeof author.userId !== "string" || !author.userId || content?.type !== "text" || typeof content.text !== "string" || !mentions || !createdAt || ["id", "tenantId", "workspaceId", "projectId", "roomId"].some((key4) => typeof values[key4] !== "string" || !values[key4])) return void 0;
|
|
32059
|
+
return {
|
|
32060
|
+
id: values.id,
|
|
32061
|
+
tenantId: values.tenantId,
|
|
32062
|
+
workspaceId: values.workspaceId,
|
|
32063
|
+
projectId: values.projectId,
|
|
32064
|
+
roomId: values.roomId,
|
|
32065
|
+
author: { type: "human", userId: author.userId },
|
|
32066
|
+
content: { type: "text", text: content.text },
|
|
32067
|
+
mentions,
|
|
32068
|
+
source: "user",
|
|
32069
|
+
createdAt
|
|
32070
|
+
};
|
|
32071
|
+
}
|
|
32072
|
+
function snapshotMentions(value) {
|
|
32073
|
+
const rows = snapshotExactArray(value);
|
|
32074
|
+
if (!rows) return void 0;
|
|
32075
|
+
const mentions = [];
|
|
32076
|
+
for (const row of rows) {
|
|
32077
|
+
const team = exactValues(row, ["type"]);
|
|
32078
|
+
if (team?.type === "team") {
|
|
32079
|
+
mentions.push({ type: "team" });
|
|
32080
|
+
continue;
|
|
32081
|
+
}
|
|
32082
|
+
const bot = exactValues(row, ["type", "membershipId"]);
|
|
32083
|
+
if (bot?.type !== "bot" || typeof bot.membershipId !== "string" || !bot.membershipId) return void 0;
|
|
32084
|
+
mentions.push({ type: "bot", membershipId: bot.membershipId });
|
|
32085
|
+
}
|
|
32086
|
+
return mentions;
|
|
32087
|
+
}
|
|
32088
|
+
function snapshotMembership(value) {
|
|
32089
|
+
const required = ["id", "tenantId", "workspaceId", "projectId", "roomId", "assistantId", "role", "title", "mentionName", "status", "roomThreadId", "joinedAt", "updatedAt"];
|
|
32090
|
+
const values = exactValues(value, required, ["responsibility"]);
|
|
32091
|
+
const joinedAt = date(values?.joinedAt);
|
|
32092
|
+
const updatedAt = date(values?.updatedAt);
|
|
32093
|
+
if (!values || required.slice(0, 7).some((key4) => typeof values[key4] !== "string" || !values[key4]) || values.role !== "coordinator" && values.role !== "specialist" || typeof values.title !== "string" || !values.title || typeof values.mentionName !== "string" || !values.mentionName || !["active", "paused", "removed"].includes(values.status) || typeof values.roomThreadId !== "string" || !values.roomThreadId || values.responsibility !== void 0 && typeof values.responsibility !== "string" || !joinedAt || !updatedAt) return void 0;
|
|
32094
|
+
return { ...values, joinedAt, updatedAt };
|
|
32095
|
+
}
|
|
32096
|
+
function snapshotCanonical(value, expected) {
|
|
32097
|
+
const values = exactValues(value, ["id", "tenantId", "workspaceId", "projectId", "roomId", "author", "content", "mentions", "replyToMessageId", "source", "sourceId", "idempotencyKey", "createdAt"]);
|
|
32098
|
+
const author = exactValues(values?.author, ["type", "membershipId", "assistantId"]);
|
|
32099
|
+
const content = exactValues(values?.content, ["type", "text"]);
|
|
32100
|
+
const createdAt = date(values?.createdAt);
|
|
32101
|
+
if (!values || !createdAt || typeof values.id !== "string" || values.id.length === 0 || snapshotExactArray(values.mentions)?.length !== 0 || author?.type !== "bot" || expected.author.type !== "bot" || author.membershipId !== expected.author.membershipId || author.assistantId !== expected.author.assistantId || content?.type !== "text" || content.text !== expected.content.text || values.tenantId !== expected.tenantId || values.workspaceId !== expected.workspaceId || values.projectId !== expected.projectId || values.roomId !== expected.roomId || values.replyToMessageId !== expected.replyToMessageId || values.source !== "agent" || values.sourceId !== expected.sourceId || values.idempotencyKey !== expected.idempotencyKey) return void 0;
|
|
32102
|
+
return {
|
|
32103
|
+
id: values.id,
|
|
32104
|
+
tenantId: expected.tenantId,
|
|
32105
|
+
workspaceId: expected.workspaceId,
|
|
32106
|
+
projectId: expected.projectId,
|
|
32107
|
+
roomId: expected.roomId,
|
|
32108
|
+
author: { type: "bot", membershipId: expected.author.membershipId, assistantId: expected.author.assistantId },
|
|
32109
|
+
content: { type: "text", text: expected.content.text },
|
|
32110
|
+
mentions: [],
|
|
32111
|
+
replyToMessageId: expected.replyToMessageId,
|
|
32112
|
+
source: "agent",
|
|
32113
|
+
sourceId: expected.sourceId,
|
|
32114
|
+
idempotencyKey: expected.idempotencyKey,
|
|
32115
|
+
createdAt
|
|
32116
|
+
};
|
|
32117
|
+
}
|
|
32118
|
+
|
|
32215
32119
|
// src/services/ProjectTaskOwnerPolicy.ts
|
|
32216
|
-
import { snapshotExactRecord as
|
|
32120
|
+
import { snapshotExactRecord as snapshotExactRecord6 } from "@axiom-lattice/protocols";
|
|
32217
32121
|
var MEMBERSHIP_REQUIRED_KEYS = [
|
|
32218
32122
|
"id",
|
|
32219
32123
|
"tenantId",
|
|
@@ -32268,7 +32172,7 @@ var ProjectTaskOwnerPolicy = class {
|
|
|
32268
32172
|
if (!scope) throw new ProjectTaskOwnerPolicyError("PROJECT_TASK_CALLER_INACTIVE", CALLER_MESSAGE);
|
|
32269
32173
|
let caller;
|
|
32270
32174
|
try {
|
|
32271
|
-
caller =
|
|
32175
|
+
caller = snapshotMembership2(await this.memberships.findById(scope.tenantId, scope.callerMembershipId));
|
|
32272
32176
|
} catch {
|
|
32273
32177
|
throw new ProjectTaskOwnerPolicyError("PROJECT_TASK_CALLER_INACTIVE", CALLER_MESSAGE);
|
|
32274
32178
|
}
|
|
@@ -32288,7 +32192,7 @@ var ProjectTaskOwnerPolicy = class {
|
|
|
32288
32192
|
if (!scope) throw new ProjectTaskOwnerPolicyError("PROJECT_TASK_OWNER_INACTIVE", OWNER_MESSAGE);
|
|
32289
32193
|
let target;
|
|
32290
32194
|
try {
|
|
32291
|
-
target =
|
|
32195
|
+
target = snapshotMembership2(await this.memberships.findByAssistant(
|
|
32292
32196
|
scope.tenantId,
|
|
32293
32197
|
scope.projectId,
|
|
32294
32198
|
scope.targetAssistantId
|
|
@@ -32322,7 +32226,7 @@ function sameRosterScope(membership, scope) {
|
|
|
32322
32226
|
return membership.tenantId === scope.tenantId && membership.workspaceId === scope.workspaceId && membership.projectId === scope.projectId && membership.roomId === scope.roomId;
|
|
32323
32227
|
}
|
|
32324
32228
|
function snapshotScope(value, keys) {
|
|
32325
|
-
const values =
|
|
32229
|
+
const values = snapshotExactRecord6(value, keys);
|
|
32326
32230
|
if (!values || keys.some((key4) => !isNonemptyString(values[key4]))) return void 0;
|
|
32327
32231
|
return values;
|
|
32328
32232
|
}
|
|
@@ -32331,10 +32235,10 @@ function projectScope(scope, keys) {
|
|
|
32331
32235
|
for (const key4 of keys) projected[key4] = scope[key4];
|
|
32332
32236
|
return projected;
|
|
32333
32237
|
}
|
|
32334
|
-
function
|
|
32238
|
+
function snapshotMembership2(value) {
|
|
32335
32239
|
try {
|
|
32336
32240
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
32337
|
-
const values =
|
|
32241
|
+
const values = snapshotExactRecord6(value, MEMBERSHIP_REQUIRED_KEYS, ["responsibility"]);
|
|
32338
32242
|
if (!values) return void 0;
|
|
32339
32243
|
const joinedAt = snapshotDate(values.joinedAt);
|
|
32340
32244
|
const updatedAt = snapshotDate(values.updatedAt);
|
|
@@ -32372,11 +32276,11 @@ function snapshotDate(value) {
|
|
|
32372
32276
|
}
|
|
32373
32277
|
|
|
32374
32278
|
// src/services/TaskLifecycleService.ts
|
|
32375
|
-
import { createHash as
|
|
32376
|
-
import { parseTaskBeliefState as parseTaskBeliefState2, replaceTaskBeliefState, snapshotExactArray as
|
|
32279
|
+
import { createHash as createHash5 } from "crypto";
|
|
32280
|
+
import { parseTaskBeliefState as parseTaskBeliefState2, replaceTaskBeliefState, snapshotExactArray as snapshotExactArray2, snapshotExactRecord as snapshotExactRecord7, taskBeliefStatesEqual } from "@axiom-lattice/protocols";
|
|
32377
32281
|
|
|
32378
32282
|
// src/middlewares/taskBelief.ts
|
|
32379
|
-
import { createHash as
|
|
32283
|
+
import { createHash as createHash4 } from "crypto";
|
|
32380
32284
|
import { parseTaskBeliefState } from "@axiom-lattice/protocols";
|
|
32381
32285
|
function resolveBeliefOwnerScope(parent) {
|
|
32382
32286
|
if (parent != null && parent.ownerType === "agent") {
|
|
@@ -32433,7 +32337,7 @@ function buildBeliefCompletionEventKey(taskId, result, impacts) {
|
|
|
32433
32337
|
})),
|
|
32434
32338
|
result: result.trim()
|
|
32435
32339
|
});
|
|
32436
|
-
return
|
|
32340
|
+
return createHash4("sha256").update(canonical).digest("hex");
|
|
32437
32341
|
}
|
|
32438
32342
|
function buildCompletionEvidenceDetail(result, impacts, eventKey) {
|
|
32439
32343
|
return { result, beliefImpact: impacts, eventKey };
|
|
@@ -32540,8 +32444,8 @@ function isProjectLifecycleTask(task) {
|
|
|
32540
32444
|
return typeof task.workspaceId === "string" && task.workspaceId.length > 0 && typeof task.projectId === "string" && task.projectId.length > 0 && task.workspaceId !== "default" && task.projectId !== "default" && (source === "project_room" || source === "project_task");
|
|
32541
32445
|
}
|
|
32542
32446
|
function parseExternalDependency(value) {
|
|
32543
|
-
const row =
|
|
32544
|
-
const ids =
|
|
32447
|
+
const row = snapshotExactRecord7(value, ["type", "summary", "requestedAt", "dependencyTaskIds"]);
|
|
32448
|
+
const ids = snapshotExactArray2(row?.dependencyTaskIds);
|
|
32545
32449
|
if (!row || row.type !== "external_dependency" || typeof row.summary !== "string" || !row.summary.trim() || typeof row.requestedAt !== "string" || !Number.isFinite(Date.parse(row.requestedAt)) || !ids || ids.length === 0 || ids.some((id) => typeof id !== "string" || !id.trim())) return void 0;
|
|
32546
32450
|
const trimmed = ids.map((id) => id.trim());
|
|
32547
32451
|
if (new Set(trimmed).size !== trimmed.length) return void 0;
|
|
@@ -32647,7 +32551,7 @@ function canonicalJson(value) {
|
|
|
32647
32551
|
return JSON.stringify(value);
|
|
32648
32552
|
}
|
|
32649
32553
|
function sha256(value) {
|
|
32650
|
-
return
|
|
32554
|
+
return createHash5("sha256").update(canonicalJson(value)).digest("hex");
|
|
32651
32555
|
}
|
|
32652
32556
|
function sameEvidenceDetail(detail, taskId, result, impacts, eventKey, beliefOwner) {
|
|
32653
32557
|
const storedOwner = detail.beliefOwner;
|
|
@@ -35333,11 +35237,11 @@ function clearEncryptionKeyCache() {
|
|
|
35333
35237
|
}
|
|
35334
35238
|
|
|
35335
35239
|
// src/middlewares/skillMiddleware.ts
|
|
35336
|
-
import { createMiddleware as
|
|
35240
|
+
import { createMiddleware as createMiddleware17 } from "langchain";
|
|
35337
35241
|
|
|
35338
35242
|
// src/tool_lattice/skill/load_skills.ts
|
|
35339
|
-
import
|
|
35340
|
-
import { tool as
|
|
35243
|
+
import z50 from "zod";
|
|
35244
|
+
import { tool as tool45 } from "langchain";
|
|
35341
35245
|
var LOAD_SKILLS_DESCRIPTION = `Load all available skills and return their metadata (name, description, license, compatibility, metadata, and subSkills) without the content. This tool returns skill information including hierarchical relationships (subSkills). Use this to discover what skills are available and their structure.`;
|
|
35342
35246
|
function getSandboxFromExeConfig(_exe_config) {
|
|
35343
35247
|
const runConfig = _exe_config?.configurable?.runConfig || {};
|
|
@@ -35352,7 +35256,7 @@ function getSandboxFromExeConfig(_exe_config) {
|
|
|
35352
35256
|
});
|
|
35353
35257
|
}
|
|
35354
35258
|
var createLoadSkillsTool = ({ skills, readAll, pluginSkills, pluginSkillOwners } = {}) => {
|
|
35355
|
-
return
|
|
35259
|
+
return tool45(
|
|
35356
35260
|
async (_input, _exe_config) => {
|
|
35357
35261
|
const allSkills = [];
|
|
35358
35262
|
try {
|
|
@@ -35418,7 +35322,7 @@ var createLoadSkillsTool = ({ skills, readAll, pluginSkills, pluginSkillOwners }
|
|
|
35418
35322
|
{
|
|
35419
35323
|
name: "load_skills",
|
|
35420
35324
|
description: LOAD_SKILLS_DESCRIPTION,
|
|
35421
|
-
schema:
|
|
35325
|
+
schema: z50.object({})
|
|
35422
35326
|
}
|
|
35423
35327
|
);
|
|
35424
35328
|
};
|
|
@@ -35428,8 +35332,8 @@ function isSkillAllowed(skillName, staticSkills, staticReadAll) {
|
|
|
35428
35332
|
}
|
|
35429
35333
|
|
|
35430
35334
|
// src/tool_lattice/skill/load_skill_content.ts
|
|
35431
|
-
import
|
|
35432
|
-
import { tool as
|
|
35335
|
+
import z51 from "zod";
|
|
35336
|
+
import { tool as tool46 } from "langchain";
|
|
35433
35337
|
var LOAD_SKILL_CONTENT_DESCRIPTION = `
|
|
35434
35338
|
Execute a skill within the main conversation
|
|
35435
35339
|
|
|
@@ -35469,7 +35373,7 @@ function getSandboxFromExeConfig2(_exe_config) {
|
|
|
35469
35373
|
var createLoadSkillContentTool = (pluginSkills, pluginSkillOwnersOrStaticSelection, staticSelection) => {
|
|
35470
35374
|
const pluginSkillOwners = staticSelection === void 0 ? isStaticSkillSelection(pluginSkillOwnersOrStaticSelection) ? void 0 : pluginSkillOwnersOrStaticSelection : pluginSkillOwnersOrStaticSelection;
|
|
35471
35375
|
const effectiveStaticSelection = isStaticSkillSelection(pluginSkillOwnersOrStaticSelection) ? pluginSkillOwnersOrStaticSelection : staticSelection ?? {};
|
|
35472
|
-
return
|
|
35376
|
+
return tool46(
|
|
35473
35377
|
async (input, _exe_config) => {
|
|
35474
35378
|
try {
|
|
35475
35379
|
if (!isSkillAllowed2(input.skill_name, effectiveStaticSelection)) {
|
|
@@ -35550,8 +35454,8 @@ var createLoadSkillContentTool = (pluginSkills, pluginSkillOwnersOrStaticSelecti
|
|
|
35550
35454
|
{
|
|
35551
35455
|
name: "skill",
|
|
35552
35456
|
description: LOAD_SKILL_CONTENT_DESCRIPTION,
|
|
35553
|
-
schema:
|
|
35554
|
-
skill_name:
|
|
35457
|
+
schema: z51.object({
|
|
35458
|
+
skill_name: z51.string().describe("The name of the skill to load")
|
|
35555
35459
|
})
|
|
35556
35460
|
}
|
|
35557
35461
|
);
|
|
@@ -35570,8 +35474,8 @@ function isSkillAllowed2(skillName, staticSelection) {
|
|
|
35570
35474
|
}
|
|
35571
35475
|
|
|
35572
35476
|
// src/tool_lattice/skill/load_skill_resource.ts
|
|
35573
|
-
import
|
|
35574
|
-
import { tool as
|
|
35477
|
+
import z52 from "zod";
|
|
35478
|
+
import { tool as tool47 } from "langchain";
|
|
35575
35479
|
var LOAD_SKILL_RESOURCE_DESCRIPTION = `Load a specific resource file from a skill's resources directory. Use this tool when you need to access template files, example data, or other resources bundled with a skill. The resource paths are listed in the skill content when using the load_skill_content tool.`;
|
|
35576
35480
|
function getSandboxFromExeConfig3(_exe_config) {
|
|
35577
35481
|
const runConfig = _exe_config?.configurable?.runConfig || {};
|
|
@@ -35586,7 +35490,7 @@ function getSandboxFromExeConfig3(_exe_config) {
|
|
|
35586
35490
|
});
|
|
35587
35491
|
}
|
|
35588
35492
|
var createLoadSkillResourceTool = (pluginSkills, pluginSkillOwners) => {
|
|
35589
|
-
return
|
|
35493
|
+
return tool47(
|
|
35590
35494
|
async (input, _exe_config) => {
|
|
35591
35495
|
try {
|
|
35592
35496
|
validateRelativePath(input.skill_name, "skill");
|
|
@@ -35613,17 +35517,17 @@ var createLoadSkillResourceTool = (pluginSkills, pluginSkillOwners) => {
|
|
|
35613
35517
|
{
|
|
35614
35518
|
name: "load_skill_resource",
|
|
35615
35519
|
description: LOAD_SKILL_RESOURCE_DESCRIPTION,
|
|
35616
|
-
schema:
|
|
35617
|
-
skill_name:
|
|
35618
|
-
resource_path:
|
|
35520
|
+
schema: z52.object({
|
|
35521
|
+
skill_name: z52.string().describe("The name of the skill containing the resource"),
|
|
35522
|
+
resource_path: z52.string().describe("The path to the resource relative to the skill's resources/ directory")
|
|
35619
35523
|
})
|
|
35620
35524
|
}
|
|
35621
35525
|
);
|
|
35622
35526
|
};
|
|
35623
35527
|
|
|
35624
35528
|
// src/tool_lattice/skill/delete_skill.ts
|
|
35625
|
-
import
|
|
35626
|
-
import { tool as
|
|
35529
|
+
import z53 from "zod";
|
|
35530
|
+
import { tool as tool48 } from "langchain";
|
|
35627
35531
|
var DELETE_SKILL_DESCRIPTION = `
|
|
35628
35532
|
Delete a skill by name from the skill system.
|
|
35629
35533
|
This permanently removes the skill and its SKILL.md file.
|
|
@@ -35650,7 +35554,7 @@ function validateSkillName3(name) {
|
|
|
35650
35554
|
}
|
|
35651
35555
|
}
|
|
35652
35556
|
var createDeleteSkillTool = (staticSelection = {}) => {
|
|
35653
|
-
return
|
|
35557
|
+
return tool48(
|
|
35654
35558
|
async (input, _exe_config) => {
|
|
35655
35559
|
try {
|
|
35656
35560
|
validateSkillName3(input.skill_name);
|
|
@@ -35682,8 +35586,8 @@ var createDeleteSkillTool = (staticSelection = {}) => {
|
|
|
35682
35586
|
{
|
|
35683
35587
|
name: "delete_skill",
|
|
35684
35588
|
description: DELETE_SKILL_DESCRIPTION,
|
|
35685
|
-
schema:
|
|
35686
|
-
skill_name:
|
|
35589
|
+
schema: z53.object({
|
|
35590
|
+
skill_name: z53.string().describe("The name of the skill to delete")
|
|
35687
35591
|
})
|
|
35688
35592
|
}
|
|
35689
35593
|
);
|
|
@@ -35707,7 +35611,7 @@ function createSkillMiddleware(params = {}) {
|
|
|
35707
35611
|
} = params;
|
|
35708
35612
|
const skills = params.skills;
|
|
35709
35613
|
let latestSkills = [];
|
|
35710
|
-
return
|
|
35614
|
+
return createMiddleware17({
|
|
35711
35615
|
name: "skillMiddleware",
|
|
35712
35616
|
contextSchema,
|
|
35713
35617
|
tools: [
|
|
@@ -35857,11 +35761,11 @@ var skillPlugin = {
|
|
|
35857
35761
|
};
|
|
35858
35762
|
|
|
35859
35763
|
// src/middlewares/semanticMetricsMiddleware.ts
|
|
35860
|
-
import { createMiddleware as
|
|
35764
|
+
import { createMiddleware as createMiddleware18 } from "langchain";
|
|
35861
35765
|
|
|
35862
35766
|
// src/tool_lattice/semantic_metrics/metrics_datasource_tool.ts
|
|
35863
|
-
import
|
|
35864
|
-
import { tool as
|
|
35767
|
+
import z54 from "zod";
|
|
35768
|
+
import { tool as tool49 } from "langchain";
|
|
35865
35769
|
|
|
35866
35770
|
// src/tool_lattice/semantic_metrics/types.ts
|
|
35867
35771
|
function readToolRunConfig(exeConfig) {
|
|
@@ -36339,7 +36243,7 @@ COMMON MISTAKES (do not):
|
|
|
36339
36243
|
- Do not attempt writes \u2014 SQL is validated read-only and rejected before sending.`;
|
|
36340
36244
|
function createMetricsDatasourceTool(params) {
|
|
36341
36245
|
const { resolvedConnections, selectedDataSources } = params;
|
|
36342
|
-
return
|
|
36246
|
+
return tool49(
|
|
36343
36247
|
async (input, exeConfig) => {
|
|
36344
36248
|
try {
|
|
36345
36249
|
const client = await resolveClientFromConnections(input.connectionKey, resolvedConnections, readToolRunConfig(exeConfig));
|
|
@@ -36394,23 +36298,23 @@ function createMetricsDatasourceTool(params) {
|
|
|
36394
36298
|
{
|
|
36395
36299
|
name: "metrics_datasource_tool",
|
|
36396
36300
|
description: DESCRIPTION,
|
|
36397
|
-
schema:
|
|
36398
|
-
action:
|
|
36301
|
+
schema: z54.object({
|
|
36302
|
+
action: z54.enum(["list_datasources", "get_grants", "query_sql", "test_connection", "pool_status"]).describe(
|
|
36399
36303
|
"list_datasources: list datasources \u2014 ALWAYS call this first to obtain the datasource id used by every other action and tool; get_grants: read table-grants; query_sql: run read-only SQL against PHYSICAL tables (note: this is query_sql, NOT the semantic 'query' action of metrics_runtime_tool); test_connection: test the datasource; pool_status: connection-pool status"
|
|
36400
36304
|
),
|
|
36401
|
-
connectionKey:
|
|
36402
|
-
datasourceId:
|
|
36403
|
-
sql:
|
|
36404
|
-
params:
|
|
36405
|
-
maxRows:
|
|
36305
|
+
connectionKey: z54.string().optional().describe("Connection key. Omit when only one semantic-metrics connection exists"),
|
|
36306
|
+
datasourceId: z54.coerce.number().optional().describe("Numeric datasource id, e.g. 15 (required for all actions except list_datasources; optional if set in runConfig.metricsDataSource)"),
|
|
36307
|
+
sql: z54.string().optional().describe("Read-only SQL (SELECT/WITH only). Required for the query action. Metadata templates \u2014 PostgreSQL/SQL Server columns: select column_name, data_type from information_schema.columns where table_schema = :schemaName and table_name = :tableName order by ordinal_position; HANA columns: select column_name, data_type_name from table_columns where schema_name = :schemaName and table_name = :tableName order by position; distributions: select <dim>, count(*) as row_count from <table> group by <dim> order by row_count desc limit :maxRows"),
|
|
36308
|
+
params: z54.record(z54.union([z54.string(), z54.number(), z54.boolean()])).optional().describe("Named :param values for the SQL"),
|
|
36309
|
+
maxRows: z54.number().optional().describe("Max rows to return")
|
|
36406
36310
|
})
|
|
36407
36311
|
}
|
|
36408
36312
|
);
|
|
36409
36313
|
}
|
|
36410
36314
|
|
|
36411
36315
|
// src/tool_lattice/semantic_metrics/metrics_meta_tool.ts
|
|
36412
|
-
import
|
|
36413
|
-
import { tool as
|
|
36316
|
+
import z55 from "zod";
|
|
36317
|
+
import { tool as tool50 } from "langchain";
|
|
36414
36318
|
var DESCRIPTION2 = `SEMANTIC ASSET REGISTRY (Builder/Admin only) \u2014 the only tool for reading and publishing the runtime's semantic layer: table meta (meta/tables) and metric meta (meta/metrics).
|
|
36415
36319
|
|
|
36416
36320
|
OWNS: listing published tables and metrics, reading one by objectKey, publishing a semantic table (create_table: columns tagged with role dimension|measure), publishing a metric (create_metric: a metric_index payload then a metric_detail payload using the SQL-free calculation DSL), and correcting published assets (update_table / update_metric).
|
|
@@ -36446,7 +36350,7 @@ function actionRequiresPayload(action) {
|
|
|
36446
36350
|
}
|
|
36447
36351
|
function createMetricsMetaTool(params) {
|
|
36448
36352
|
const { resolvedConnections, selectedDataSources } = params;
|
|
36449
|
-
return
|
|
36353
|
+
return tool50(
|
|
36450
36354
|
async (input, exeConfig) => {
|
|
36451
36355
|
try {
|
|
36452
36356
|
const guardError = requireModelingSkillLoaded(input.action, input, exeConfig);
|
|
@@ -36495,8 +36399,8 @@ function createMetricsMetaTool(params) {
|
|
|
36495
36399
|
{
|
|
36496
36400
|
name: "metrics_meta_tool",
|
|
36497
36401
|
description: DESCRIPTION2,
|
|
36498
|
-
schema:
|
|
36499
|
-
action:
|
|
36402
|
+
schema: z55.object({
|
|
36403
|
+
action: z55.enum([
|
|
36500
36404
|
"list_tables",
|
|
36501
36405
|
"read_table_meta",
|
|
36502
36406
|
"create_table",
|
|
@@ -36508,19 +36412,19 @@ function createMetricsMetaTool(params) {
|
|
|
36508
36412
|
]).describe(
|
|
36509
36413
|
"Actions ONLY in this meta tool (runtime query actions like get_meta/query belong to metrics_runtime_tool): list_tables/list_metrics (browse published assets), read_table_meta/read_metric_meta (details by objectKey), create_table/create_metric (publish), update_table/update_metric (correct)"
|
|
36510
36414
|
),
|
|
36511
|
-
connectionKey:
|
|
36512
|
-
datasourceId:
|
|
36513
|
-
objectKey:
|
|
36514
|
-
payload:
|
|
36515
|
-
modelingSkillLoaded:
|
|
36415
|
+
connectionKey: z55.string().optional().describe("Connection key. Omit when only one semantic-metrics connection exists"),
|
|
36416
|
+
datasourceId: z55.coerce.number().optional().describe("Numeric datasource id, e.g. 15 (optional if set in runConfig.metricsDataSource)"),
|
|
36417
|
+
objectKey: z55.string().optional().describe("Semantic table/metric key (required for read_table_meta/update_table/read_metric_meta/update_metric)"),
|
|
36418
|
+
payload: z55.record(z55.unknown()).optional().describe("Meta payload (required for create/update actions; objectType/objectKey/status/payload/accessGrant)"),
|
|
36419
|
+
modelingSkillLoaded: z55.literal(true).optional().describe("Set true after loading the semantic-metrics-modeling skill (required for the builder assistant on write actions)")
|
|
36516
36420
|
})
|
|
36517
36421
|
}
|
|
36518
36422
|
);
|
|
36519
36423
|
}
|
|
36520
36424
|
|
|
36521
36425
|
// src/tool_lattice/semantic_metrics/metrics_runtime_tool.ts
|
|
36522
|
-
import
|
|
36523
|
-
import { tool as
|
|
36426
|
+
import z56 from "zod";
|
|
36427
|
+
import { tool as tool51 } from "langchain";
|
|
36524
36428
|
var DESCRIPTION3 = `RUNTIME QUERY SURFACE \u2014 read what is published and answer business questions with numbers. Business agents use ONLY this tool; Builder agents also use it to verify freshly published metrics.
|
|
36525
36429
|
|
|
36526
36430
|
OWNS: read_semantic_catalog (the published semantic model for a datasource: tables, metrics, dimensions, filters) and query_metrics (the semantic metric query: metrics / groupBy / filters / orderBy / limit \u2014 the server generates the SQL, so there is no free-form SQL here).
|
|
@@ -36538,7 +36442,7 @@ COMMON MISTAKES (do not):
|
|
|
36538
36442
|
- Metrics and dimensions in query_metrics must already be published; querying an unpublished metric fails with "not found in catalog".`;
|
|
36539
36443
|
function createMetricsRuntimeTool(params) {
|
|
36540
36444
|
const { resolvedConnections, selectedDataSources } = params;
|
|
36541
|
-
return
|
|
36445
|
+
return tool51(
|
|
36542
36446
|
async (input, exeConfig) => {
|
|
36543
36447
|
try {
|
|
36544
36448
|
const client = await resolveClientFromConnections(input.connectionKey, resolvedConnections, readToolRunConfig(exeConfig));
|
|
@@ -36565,13 +36469,13 @@ function createMetricsRuntimeTool(params) {
|
|
|
36565
36469
|
{
|
|
36566
36470
|
name: "metrics_runtime_tool",
|
|
36567
36471
|
description: DESCRIPTION3,
|
|
36568
|
-
schema:
|
|
36569
|
-
action:
|
|
36472
|
+
schema: z56.object({
|
|
36473
|
+
action: z56.enum(["read_semantic_catalog", "query_metrics"]).describe(
|
|
36570
36474
|
"Actions ONLY in this runtime tool: read_semantic_catalog (read the published semantic model: tables, metrics, dimensions \u2014 obtain the datasourceId from metrics_datasource_tool list_datasources first), query_metrics (run a semantic metric query \u2014 the only way to get business numbers). Do NOT put meta-tool actions (list_tables/read_table_meta/create_table/update_table/list_metrics/read_metric_meta/create_metric/update_metric) here"
|
|
36571
36475
|
),
|
|
36572
|
-
connectionKey:
|
|
36573
|
-
datasourceId:
|
|
36574
|
-
query:
|
|
36476
|
+
connectionKey: z56.string().optional().describe("Connection key. Omit when only one semantic-metrics connection exists"),
|
|
36477
|
+
datasourceId: z56.coerce.number().optional().describe("Numeric datasource id, e.g. 15 (optional if set in runConfig.metricsDataSource)"),
|
|
36478
|
+
query: z56.record(z56.unknown()).optional().describe('Semantic metric query request. Required for the query_metrics action, e.g. { datasourceId: 15, metrics: ["sell_in_nes"], groupBy: ["sales_team"], filters: [{ dimension: "posting_year", operator: "GTE", values: [2024] }], limit: 10 }')
|
|
36575
36479
|
})
|
|
36576
36480
|
}
|
|
36577
36481
|
);
|
|
@@ -36994,7 +36898,7 @@ import { AgentType as AgentType8 } from "@axiom-lattice/protocols";
|
|
|
36994
36898
|
function createSemanticMetricsMiddleware(config) {
|
|
36995
36899
|
const resolvedConnections = config._resolvedConnections ?? [];
|
|
36996
36900
|
const selectedDataSources = void 0;
|
|
36997
|
-
return
|
|
36901
|
+
return createMiddleware18({
|
|
36998
36902
|
name: "SemanticMetrics",
|
|
36999
36903
|
contextSchema,
|
|
37000
36904
|
tools: [
|
|
@@ -37194,11 +37098,11 @@ var semanticMetricsPlugin = {
|
|
|
37194
37098
|
};
|
|
37195
37099
|
|
|
37196
37100
|
// src/middlewares/collectionMiddleware.ts
|
|
37197
|
-
import { createMiddleware as
|
|
37101
|
+
import { createMiddleware as createMiddleware19 } from "langchain";
|
|
37198
37102
|
|
|
37199
37103
|
// src/tool_lattice/collection/list_collections.ts
|
|
37200
|
-
import
|
|
37201
|
-
import { tool as
|
|
37104
|
+
import z57 from "zod";
|
|
37105
|
+
import { tool as tool52 } from "langchain";
|
|
37202
37106
|
|
|
37203
37107
|
// src/tool_lattice/collection/utils.ts
|
|
37204
37108
|
function getEffectiveCollectionScope(exeConfig, staticScope) {
|
|
@@ -37221,7 +37125,7 @@ var createListCollectionsTool = ({
|
|
|
37221
37125
|
collectionKeys,
|
|
37222
37126
|
connectAll
|
|
37223
37127
|
}) => {
|
|
37224
|
-
return
|
|
37128
|
+
return tool52(
|
|
37225
37129
|
async (_input, _exeConfig) => {
|
|
37226
37130
|
try {
|
|
37227
37131
|
const tenantId2 = _exeConfig?.configurable?.runConfig?.tenantId || "default";
|
|
@@ -37256,23 +37160,23 @@ var createListCollectionsTool = ({
|
|
|
37256
37160
|
{
|
|
37257
37161
|
name: "list_collections",
|
|
37258
37162
|
description: LIST_COLLECTIONS_DESCRIPTION,
|
|
37259
|
-
schema:
|
|
37163
|
+
schema: z57.object({})
|
|
37260
37164
|
}
|
|
37261
37165
|
);
|
|
37262
37166
|
};
|
|
37263
37167
|
|
|
37264
37168
|
// src/tool_lattice/collection/search_collection.ts
|
|
37265
|
-
import
|
|
37266
|
-
import { tool as
|
|
37169
|
+
import z58 from "zod";
|
|
37170
|
+
import { tool as tool53 } from "langchain";
|
|
37267
37171
|
var SEARCH_COLLECTION_DESCRIPTION = `Search for content within a specific collection using semantic (vector) similarity. Use the 'filter' parameter to narrow results by metadata fields (e.g., {"category": "cardiovascular"}). Returns the most relevant content entries with similarity scores.`;
|
|
37268
|
-
var searchSchema =
|
|
37269
|
-
collection:
|
|
37270
|
-
query:
|
|
37271
|
-
filter:
|
|
37272
|
-
top_k:
|
|
37172
|
+
var searchSchema = z58.object({
|
|
37173
|
+
collection: z58.string().describe("The collection name to search in"),
|
|
37174
|
+
query: z58.string().describe("The search query text"),
|
|
37175
|
+
filter: z58.record(z58.unknown()).optional().describe("Metadata filter conditions"),
|
|
37176
|
+
top_k: z58.number().optional().default(5).describe("Number of results to return")
|
|
37273
37177
|
});
|
|
37274
37178
|
var createSearchCollectionTool = (scope = { collectionKeys: [], connectAll: true }) => {
|
|
37275
|
-
return
|
|
37179
|
+
return tool53(
|
|
37276
37180
|
async (input, _exeConfig) => {
|
|
37277
37181
|
try {
|
|
37278
37182
|
const { collection, query, filter: filter2, top_k } = input;
|
|
@@ -37338,10 +37242,10 @@ var createSearchCollectionTool = (scope = { collectionKeys: [], connectAll: true
|
|
|
37338
37242
|
};
|
|
37339
37243
|
|
|
37340
37244
|
// src/tool_lattice/collection/get_collection.ts
|
|
37341
|
-
import
|
|
37342
|
-
import { tool as
|
|
37245
|
+
import z59 from "zod";
|
|
37246
|
+
import { tool as tool54 } from "langchain";
|
|
37343
37247
|
var GET_COLLECTION_DESCRIPTION = `Get a collection's full definition including its custom fields schema. Use this to discover what metadata fields are available before adding entries.`;
|
|
37344
|
-
var createGetCollectionTool = (scope = { collectionKeys: [], connectAll: true }) =>
|
|
37248
|
+
var createGetCollectionTool = (scope = { collectionKeys: [], connectAll: true }) => tool54(
|
|
37345
37249
|
async (input, _exeConfig) => {
|
|
37346
37250
|
try {
|
|
37347
37251
|
const scopeError = validateCollectionScope(input.name, _exeConfig, scope);
|
|
@@ -37366,24 +37270,24 @@ Embedding: ${c.embeddingKey}${fieldsDesc}`;
|
|
|
37366
37270
|
return `Error: ${error.message}`;
|
|
37367
37271
|
}
|
|
37368
37272
|
},
|
|
37369
|
-
{ name: "get_collection", description: GET_COLLECTION_DESCRIPTION, schema:
|
|
37273
|
+
{ name: "get_collection", description: GET_COLLECTION_DESCRIPTION, schema: z59.object({ name: z59.string().describe("Collection name") }) }
|
|
37370
37274
|
);
|
|
37371
37275
|
|
|
37372
37276
|
// src/tool_lattice/collection/create_collection.ts
|
|
37373
|
-
import
|
|
37374
|
-
import { tool as
|
|
37375
|
-
var createSchema =
|
|
37376
|
-
name:
|
|
37377
|
-
label:
|
|
37378
|
-
embeddingKey:
|
|
37379
|
-
fields:
|
|
37380
|
-
key:
|
|
37381
|
-
type:
|
|
37382
|
-
enumValues:
|
|
37383
|
-
required:
|
|
37277
|
+
import z60 from "zod";
|
|
37278
|
+
import { tool as tool55 } from "langchain";
|
|
37279
|
+
var createSchema = z60.object({
|
|
37280
|
+
name: z60.string().describe("Collection name (lowercase, underscores only)"),
|
|
37281
|
+
label: z60.string().describe("Display name"),
|
|
37282
|
+
embeddingKey: z60.string().describe("Embedding model key"),
|
|
37283
|
+
fields: z60.array(z60.object({
|
|
37284
|
+
key: z60.string().describe("Field key name"),
|
|
37285
|
+
type: z60.enum(["string", "number", "enum"]).describe("Field data type"),
|
|
37286
|
+
enumValues: z60.array(z60.string()).optional().describe("Valid values for enum type"),
|
|
37287
|
+
required: z60.boolean().optional().default(false).describe("Whether field is required")
|
|
37384
37288
|
})).optional().describe("Custom field definitions for entries in this collection")
|
|
37385
37289
|
});
|
|
37386
|
-
var createCreateCollectionTool = (scope = {}) =>
|
|
37290
|
+
var createCreateCollectionTool = (scope = {}) => tool55(
|
|
37387
37291
|
async (input, _exeConfig) => {
|
|
37388
37292
|
try {
|
|
37389
37293
|
const tenantId2 = _exeConfig?.configurable?.runConfig?.tenantId || "default";
|
|
@@ -37409,20 +37313,20 @@ var createCreateCollectionTool = (scope = {}) => tool56(
|
|
|
37409
37313
|
);
|
|
37410
37314
|
|
|
37411
37315
|
// src/tool_lattice/collection/update_collection.ts
|
|
37412
|
-
import
|
|
37413
|
-
import { tool as
|
|
37414
|
-
var schema =
|
|
37415
|
-
name:
|
|
37416
|
-
label:
|
|
37417
|
-
embeddingKey:
|
|
37418
|
-
fields:
|
|
37419
|
-
key:
|
|
37420
|
-
type:
|
|
37421
|
-
enumValues:
|
|
37422
|
-
required:
|
|
37316
|
+
import z61 from "zod";
|
|
37317
|
+
import { tool as tool56 } from "langchain";
|
|
37318
|
+
var schema = z61.object({
|
|
37319
|
+
name: z61.string().describe("Collection name"),
|
|
37320
|
+
label: z61.string().optional().describe("New display name"),
|
|
37321
|
+
embeddingKey: z61.string().optional().describe("New embedding model key"),
|
|
37322
|
+
fields: z61.array(z61.object({
|
|
37323
|
+
key: z61.string().describe("Field key name"),
|
|
37324
|
+
type: z61.enum(["string", "number", "enum"]).describe("Field data type"),
|
|
37325
|
+
enumValues: z61.array(z61.string()).optional().describe("Valid values for enum type"),
|
|
37326
|
+
required: z61.boolean().optional().default(false).describe("Whether field is required")
|
|
37423
37327
|
})).optional().describe("Custom field definitions for entries (replaces existing schema)")
|
|
37424
37328
|
});
|
|
37425
|
-
var createUpdateCollectionTool = (scope = { collectionKeys: [], connectAll: true }) =>
|
|
37329
|
+
var createUpdateCollectionTool = (scope = { collectionKeys: [], connectAll: true }) => tool56(
|
|
37426
37330
|
async (input, _exeConfig) => {
|
|
37427
37331
|
try {
|
|
37428
37332
|
const scopeError = validateCollectionScope(input.name, _exeConfig, scope);
|
|
@@ -37443,9 +37347,9 @@ var createUpdateCollectionTool = (scope = { collectionKeys: [], connectAll: true
|
|
|
37443
37347
|
);
|
|
37444
37348
|
|
|
37445
37349
|
// src/tool_lattice/collection/delete_collection.ts
|
|
37446
|
-
import
|
|
37447
|
-
import { tool as
|
|
37448
|
-
var createDeleteCollectionTool = (scope = { collectionKeys: [], connectAll: true }) =>
|
|
37350
|
+
import z62 from "zod";
|
|
37351
|
+
import { tool as tool57 } from "langchain";
|
|
37352
|
+
var createDeleteCollectionTool = (scope = { collectionKeys: [], connectAll: true }) => tool57(
|
|
37449
37353
|
async (input, _exeConfig) => {
|
|
37450
37354
|
try {
|
|
37451
37355
|
const scopeError = validateCollectionScope(input.name, _exeConfig, scope);
|
|
@@ -37457,19 +37361,19 @@ var createDeleteCollectionTool = (scope = { collectionKeys: [], connectAll: true
|
|
|
37457
37361
|
return `Error: ${e.message}`;
|
|
37458
37362
|
}
|
|
37459
37363
|
},
|
|
37460
|
-
{ name: "delete_collection", description: `Delete a collection and all its entries. This cannot be undone.`, schema:
|
|
37364
|
+
{ name: "delete_collection", description: `Delete a collection and all its entries. This cannot be undone.`, schema: z62.object({ name: z62.string().describe("Collection name") }) }
|
|
37461
37365
|
);
|
|
37462
37366
|
|
|
37463
37367
|
// src/tool_lattice/collection/list_entries.ts
|
|
37464
|
-
import
|
|
37465
|
-
import { tool as
|
|
37466
|
-
var schema2 =
|
|
37467
|
-
collection:
|
|
37368
|
+
import z63 from "zod";
|
|
37369
|
+
import { tool as tool58 } from "langchain";
|
|
37370
|
+
var schema2 = z63.object({
|
|
37371
|
+
collection: z63.string().describe("Collection name")
|
|
37468
37372
|
});
|
|
37469
37373
|
function buildKey2(tenantId2, name) {
|
|
37470
37374
|
return `${tenantId2}:${name}`;
|
|
37471
37375
|
}
|
|
37472
|
-
var createListEntriesTool = (scope = { collectionKeys: [], connectAll: true }) =>
|
|
37376
|
+
var createListEntriesTool = (scope = { collectionKeys: [], connectAll: true }) => tool58(
|
|
37473
37377
|
async (input, _exeConfig) => {
|
|
37474
37378
|
try {
|
|
37475
37379
|
const scopeError = validateCollectionScope(input.collection, _exeConfig, scope);
|
|
@@ -37498,19 +37402,19 @@ var createListEntriesTool = (scope = { collectionKeys: [], connectAll: true }) =
|
|
|
37498
37402
|
);
|
|
37499
37403
|
|
|
37500
37404
|
// src/tool_lattice/collection/add_entry.ts
|
|
37501
|
-
import
|
|
37502
|
-
import { tool as
|
|
37405
|
+
import z64 from "zod";
|
|
37406
|
+
import { tool as tool59 } from "langchain";
|
|
37503
37407
|
import { Document } from "@langchain/core/documents";
|
|
37504
37408
|
import { v4 as uuidv47 } from "uuid";
|
|
37505
|
-
var schema3 =
|
|
37506
|
-
collection:
|
|
37507
|
-
content:
|
|
37508
|
-
metadata:
|
|
37409
|
+
var schema3 = z64.object({
|
|
37410
|
+
collection: z64.string().describe("Collection name"),
|
|
37411
|
+
content: z64.string().describe("Entry content text"),
|
|
37412
|
+
metadata: z64.record(z64.unknown()).optional().describe("Metadata fields matching the collection schema")
|
|
37509
37413
|
});
|
|
37510
37414
|
function key(t, n) {
|
|
37511
37415
|
return `${t}:${n}`;
|
|
37512
37416
|
}
|
|
37513
|
-
var createAddEntryTool = (scope = { collectionKeys: [], connectAll: true }) =>
|
|
37417
|
+
var createAddEntryTool = (scope = { collectionKeys: [], connectAll: true }) => tool59(
|
|
37514
37418
|
async (input, _exeConfig) => {
|
|
37515
37419
|
try {
|
|
37516
37420
|
const scopeError = validateCollectionScope(input.collection, _exeConfig, scope);
|
|
@@ -37542,18 +37446,18 @@ var createAddEntryTool = (scope = { collectionKeys: [], connectAll: true }) => t
|
|
|
37542
37446
|
);
|
|
37543
37447
|
|
|
37544
37448
|
// src/tool_lattice/collection/update_entry.ts
|
|
37545
|
-
import
|
|
37546
|
-
import { tool as
|
|
37547
|
-
var schema4 =
|
|
37548
|
-
collection:
|
|
37549
|
-
entryId:
|
|
37550
|
-
content:
|
|
37551
|
-
metadata:
|
|
37449
|
+
import z65 from "zod";
|
|
37450
|
+
import { tool as tool60 } from "langchain";
|
|
37451
|
+
var schema4 = z65.object({
|
|
37452
|
+
collection: z65.string().describe("Collection name"),
|
|
37453
|
+
entryId: z65.string().describe("Entry ID to update"),
|
|
37454
|
+
content: z65.string().optional().describe("New content"),
|
|
37455
|
+
metadata: z65.record(z65.unknown()).optional().describe("New metadata")
|
|
37552
37456
|
});
|
|
37553
37457
|
function key2(t, n) {
|
|
37554
37458
|
return `${t}:${n}`;
|
|
37555
37459
|
}
|
|
37556
|
-
var createUpdateEntryTool = (scope = { collectionKeys: [], connectAll: true }) =>
|
|
37460
|
+
var createUpdateEntryTool = (scope = { collectionKeys: [], connectAll: true }) => tool60(
|
|
37557
37461
|
async (input, _exeConfig) => {
|
|
37558
37462
|
try {
|
|
37559
37463
|
const scopeError = validateCollectionScope(input.collection, _exeConfig, scope);
|
|
@@ -37574,16 +37478,16 @@ var createUpdateEntryTool = (scope = { collectionKeys: [], connectAll: true }) =
|
|
|
37574
37478
|
);
|
|
37575
37479
|
|
|
37576
37480
|
// src/tool_lattice/collection/delete_entry.ts
|
|
37577
|
-
import
|
|
37578
|
-
import { tool as
|
|
37579
|
-
var schema5 =
|
|
37580
|
-
collection:
|
|
37581
|
-
entryId:
|
|
37481
|
+
import z66 from "zod";
|
|
37482
|
+
import { tool as tool61 } from "langchain";
|
|
37483
|
+
var schema5 = z66.object({
|
|
37484
|
+
collection: z66.string().describe("Collection name"),
|
|
37485
|
+
entryId: z66.string().describe("Entry ID to delete")
|
|
37582
37486
|
});
|
|
37583
37487
|
function key3(t, n) {
|
|
37584
37488
|
return `${t}:${n}`;
|
|
37585
37489
|
}
|
|
37586
|
-
var createDeleteEntryTool = (scope = { collectionKeys: [], connectAll: true }) =>
|
|
37490
|
+
var createDeleteEntryTool = (scope = { collectionKeys: [], connectAll: true }) => tool61(
|
|
37587
37491
|
async (input, _exeConfig) => {
|
|
37588
37492
|
try {
|
|
37589
37493
|
const scopeError = validateCollectionScope(input.collection, _exeConfig, scope);
|
|
@@ -37603,7 +37507,7 @@ var createDeleteEntryTool = (scope = { collectionKeys: [], connectAll: true }) =
|
|
|
37603
37507
|
function createCollectionMiddleware(params) {
|
|
37604
37508
|
const { collectionKeys, connectAll, compileStableCandidateTools = false } = params;
|
|
37605
37509
|
if (!compileStableCandidateTools && !connectAll && (!collectionKeys || collectionKeys.length === 0)) {
|
|
37606
|
-
return
|
|
37510
|
+
return createMiddleware19({
|
|
37607
37511
|
name: "collectionMiddleware",
|
|
37608
37512
|
contextSchema,
|
|
37609
37513
|
tools: [
|
|
@@ -37613,7 +37517,7 @@ function createCollectionMiddleware(params) {
|
|
|
37613
37517
|
});
|
|
37614
37518
|
}
|
|
37615
37519
|
const toolParams = { collectionKeys, connectAll };
|
|
37616
|
-
return
|
|
37520
|
+
return createMiddleware19({
|
|
37617
37521
|
name: "collectionMiddleware",
|
|
37618
37522
|
contextSchema,
|
|
37619
37523
|
tools: [
|
|
@@ -37676,24 +37580,24 @@ var collectionPlugin = {
|
|
|
37676
37580
|
};
|
|
37677
37581
|
|
|
37678
37582
|
// src/middlewares/askUserClarifyMiddleware.ts
|
|
37679
|
-
import { createMiddleware as
|
|
37583
|
+
import { createMiddleware as createMiddleware20, ToolMessage as ToolMessage10 } from "langchain";
|
|
37680
37584
|
import { interrupt as interrupt3 } from "@langchain/langgraph";
|
|
37681
37585
|
|
|
37682
37586
|
// src/tool_lattice/ask_user_to_clarify/index.ts
|
|
37683
|
-
import { tool as
|
|
37684
|
-
import
|
|
37685
|
-
var questionSchema =
|
|
37686
|
-
question:
|
|
37687
|
-
options:
|
|
37688
|
-
type:
|
|
37689
|
-
required:
|
|
37690
|
-
allowOther:
|
|
37587
|
+
import { tool as tool62 } from "langchain";
|
|
37588
|
+
import z67 from "zod";
|
|
37589
|
+
var questionSchema = z67.object({
|
|
37590
|
+
question: z67.string().describe("The question text to ask the user. MUST include the specific context, options, or details being clarified \u2014 never use a bare generic label. Good: 'Confirm the plan: use Redis cache + PostgreSQL primary, split microservices as needed?' Bad: 'Confirm the plan?'"),
|
|
37591
|
+
options: z67.array(z67.string()).optional().default([]).describe("List of EXACT, selectable values. Maximum 3 options allowed. DO NOT include placeholder values like 'Other' or 'Enter manually'. For free-text with predefined choices, use allowOther=true (works with 'single' and 'multiple'). For pure free-text without choices, use type='input' instead. For file_upload and input, pass an empty array."),
|
|
37592
|
+
type: z67.enum(["single", "multiple", "file_upload", "input"]).describe("The question format. 'single' = pick one from options (default, see tool description for guidance). 'multiple' = pick several from options. 'input' = free-text field (only when options cannot express the answer). 'file_upload' = file picker."),
|
|
37593
|
+
required: z67.boolean().optional().default(false).describe("Whether this question must be answered"),
|
|
37594
|
+
allowOther: z67.boolean().optional().default(true).describe("Set to true to append an 'Other' checkbox with a free-text input field. Works with 'single' and 'multiple' types. Use for open-ended answers or when the options cannot cover all possibilities. Not applicable for 'input' or 'file_upload' types.")
|
|
37691
37595
|
});
|
|
37692
|
-
var inputSchema =
|
|
37693
|
-
questions:
|
|
37596
|
+
var inputSchema = z67.object({
|
|
37597
|
+
questions: z67.array(questionSchema).min(1, "At least one question is required").describe("A structured sequence of clarification questions. Use these to gather missing parameters or disambiguate user intent before proceeding.")
|
|
37694
37598
|
});
|
|
37695
37599
|
function createAskUserToClarifyTool() {
|
|
37696
|
-
return
|
|
37600
|
+
return tool62(
|
|
37697
37601
|
async (input) => {
|
|
37698
37602
|
return JSON.stringify(input);
|
|
37699
37603
|
},
|
|
@@ -37707,7 +37611,7 @@ function createAskUserToClarifyTool() {
|
|
|
37707
37611
|
|
|
37708
37612
|
// src/middlewares/askUserClarifyMiddleware.ts
|
|
37709
37613
|
function createAskUserClarifyMiddleware() {
|
|
37710
|
-
return
|
|
37614
|
+
return createMiddleware20({
|
|
37711
37615
|
name: "AskUserClarifyMiddleware",
|
|
37712
37616
|
tools: [createAskUserToClarifyTool()],
|
|
37713
37617
|
wrapToolCall: async (request, handler) => {
|
|
@@ -37804,11 +37708,11 @@ var askUserClarifyPlugin = {
|
|
|
37804
37708
|
};
|
|
37805
37709
|
|
|
37806
37710
|
// src/middlewares/widgetMiddleware.ts
|
|
37807
|
-
import { createMiddleware as
|
|
37711
|
+
import { createMiddleware as createMiddleware21 } from "langchain";
|
|
37808
37712
|
|
|
37809
37713
|
// src/tool_lattice/widget/loadGuidelines.ts
|
|
37810
|
-
import { tool as
|
|
37811
|
-
import { z as
|
|
37714
|
+
import { tool as tool63 } from "langchain";
|
|
37715
|
+
import { z as z68 } from "zod";
|
|
37812
37716
|
|
|
37813
37717
|
// src/middlewares/guidelines/index.ts
|
|
37814
37718
|
var CORE = `# Imagine \u2014 Visual Creation Suite
|
|
@@ -38599,13 +38503,13 @@ function getGuidelines(modules) {
|
|
|
38599
38503
|
var AVAILABLE_MODULES = Object.keys(MODULE_SECTIONS);
|
|
38600
38504
|
|
|
38601
38505
|
// src/tool_lattice/widget/loadGuidelines.ts
|
|
38602
|
-
var LoadGuidelinesInputSchema =
|
|
38603
|
-
modules:
|
|
38506
|
+
var LoadGuidelinesInputSchema = z68.object({
|
|
38507
|
+
modules: z68.array(z68.string()).describe(
|
|
38604
38508
|
"Which design modules to load. Choose all that apply. Available modules: [" + AVAILABLE_MODULES.join(",") + "]"
|
|
38605
38509
|
)
|
|
38606
38510
|
});
|
|
38607
38511
|
function createLoadGuidelinesTool() {
|
|
38608
|
-
return
|
|
38512
|
+
return tool63(
|
|
38609
38513
|
async (input) => {
|
|
38610
38514
|
const result = getGuidelines(input.modules);
|
|
38611
38515
|
return result;
|
|
@@ -38619,8 +38523,8 @@ function createLoadGuidelinesTool() {
|
|
|
38619
38523
|
}
|
|
38620
38524
|
|
|
38621
38525
|
// src/tool_lattice/widget/showWidget.ts
|
|
38622
|
-
import { tool as
|
|
38623
|
-
import { z as
|
|
38526
|
+
import { tool as tool64 } from "langchain";
|
|
38527
|
+
import { z as z69 } from "zod";
|
|
38624
38528
|
function containsForbiddenTags(code) {
|
|
38625
38529
|
const forbiddenPatterns = [
|
|
38626
38530
|
/<!DOCTYPE/i,
|
|
@@ -38642,20 +38546,20 @@ function validateWidgetCode(code) {
|
|
|
38642
38546
|
}
|
|
38643
38547
|
return { valid: true };
|
|
38644
38548
|
}
|
|
38645
|
-
var ShowWidgetInputSchema =
|
|
38646
|
-
i_have_seen_guidelines:
|
|
38549
|
+
var ShowWidgetInputSchema = z69.object({
|
|
38550
|
+
i_have_seen_guidelines: z69.boolean().describe(
|
|
38647
38551
|
"Must be true. Confirm you have called load_guidelines first."
|
|
38648
38552
|
),
|
|
38649
|
-
title:
|
|
38650
|
-
loading_messages:
|
|
38553
|
+
title: z69.string().describe("Title displayed above the widget"),
|
|
38554
|
+
loading_messages: z69.array(z69.string()).optional().describe(
|
|
38651
38555
|
"1-4 short strings shown while the widget renders"
|
|
38652
38556
|
),
|
|
38653
|
-
widget_code:
|
|
38557
|
+
widget_code: z69.string().describe(
|
|
38654
38558
|
"HTML fragment to render. Rules: 1. No DOCTYPE, <html>, <head>, or <body> tags. 2. Order: <style> block first, then HTML content, then <script> last. 3. Use only CSS variables for colors (e.g. var(--color-accent)). 4. No gradients, shadows, or blur effects. For SVG: start directly with <svg> tag."
|
|
38655
38559
|
)
|
|
38656
38560
|
});
|
|
38657
38561
|
function createShowWidgetTool() {
|
|
38658
|
-
return
|
|
38562
|
+
return tool64(
|
|
38659
38563
|
async (input) => {
|
|
38660
38564
|
if (!input.i_have_seen_guidelines) {
|
|
38661
38565
|
return "Error: You must call load_guidelines before using show_widget. Set i_have_seen_guidelines to true only after loading guidelines.";
|
|
@@ -38686,7 +38590,7 @@ function createWidgetMiddleware() {
|
|
|
38686
38590
|
createLoadGuidelinesTool(),
|
|
38687
38591
|
createShowWidgetTool()
|
|
38688
38592
|
];
|
|
38689
|
-
return
|
|
38593
|
+
return createMiddleware21({
|
|
38690
38594
|
name: "widgetMiddleware",
|
|
38691
38595
|
contextSchema,
|
|
38692
38596
|
tools
|
|
@@ -38710,12 +38614,12 @@ var widgetPlugin = {
|
|
|
38710
38614
|
};
|
|
38711
38615
|
|
|
38712
38616
|
// src/middlewares/taskMiddleware.ts
|
|
38713
|
-
import { createMiddleware as
|
|
38714
|
-
import { z as
|
|
38617
|
+
import { createMiddleware as createMiddleware22, tool as tool65 } from "langchain";
|
|
38618
|
+
import { z as z70 } from "zod";
|
|
38715
38619
|
import { GraphInterrupt as GraphInterrupt2, interrupt as interrupt4 } from "@langchain/langgraph";
|
|
38716
38620
|
import {
|
|
38717
38621
|
isExecutionResultEventKey as isExecutionResultEventKey3,
|
|
38718
|
-
parseTrustedRunContext as
|
|
38622
|
+
parseTrustedRunContext as parseTrustedRunContext2,
|
|
38719
38623
|
requireProjectTaskWorkItemStore
|
|
38720
38624
|
} from "@axiom-lattice/protocols";
|
|
38721
38625
|
|
|
@@ -39048,7 +38952,7 @@ function classifyTaskAuthority(runConfig) {
|
|
|
39048
38952
|
return delegatedTaskId ? { kind: "delegated", taskId: delegatedTaskId } : { kind: "ordinary" };
|
|
39049
38953
|
}
|
|
39050
38954
|
try {
|
|
39051
|
-
const trusted =
|
|
38955
|
+
const trusted = parseTrustedRunContext2(hasProjectTask ? { projectTask: runConfig.projectTask } : { projectRoom: runConfig.projectRoom });
|
|
39052
38956
|
return { kind: hasProjectTask ? "projectTask" : "projectRoom", trusted };
|
|
39053
38957
|
} catch {
|
|
39054
38958
|
return { kind: "invalid" };
|
|
@@ -39401,38 +39305,38 @@ function missingBeliefImpactError() {
|
|
|
39401
39305
|
hint: "Provide beliefImpact: [{ key: '<belief-key>', after: <0-100>, basis: '<evidence>' }]"
|
|
39402
39306
|
});
|
|
39403
39307
|
}
|
|
39404
|
-
var manageTaskSchema =
|
|
39405
|
-
action:
|
|
39406
|
-
id:
|
|
39407
|
-
title:
|
|
39408
|
-
description:
|
|
39409
|
-
priority:
|
|
39410
|
-
status:
|
|
39411
|
-
dueDate:
|
|
39412
|
-
metadata:
|
|
39413
|
-
parentId:
|
|
39414
|
-
sourceId:
|
|
39415
|
-
context:
|
|
39416
|
-
ownerType:
|
|
39417
|
-
ownerId:
|
|
39418
|
-
requireReview:
|
|
39419
|
-
dependencies:
|
|
39420
|
-
dependencyTaskIds:
|
|
39421
|
-
result:
|
|
39422
|
-
failureReason:
|
|
39423
|
-
files:
|
|
39424
|
-
uri:
|
|
39425
|
-
name:
|
|
39426
|
-
addedBy:
|
|
39308
|
+
var manageTaskSchema = z70.object({
|
|
39309
|
+
action: z70.enum(["create", "get", "list", "update", "add_activity", "delete"]).describe("Action to perform. Available: create, get, list, update, add_activity, delete. To mark a task complete, use update with status='completed'"),
|
|
39310
|
+
id: z70.string().optional().describe("Task ID (required for get, update, add_activity, and delete)"),
|
|
39311
|
+
title: z70.string().optional().describe("Task title (required for create)"),
|
|
39312
|
+
description: z70.string().optional().describe("Task description in Markdown"),
|
|
39313
|
+
priority: z70.enum(["low", "medium", "high"]).optional().describe("Priority level"),
|
|
39314
|
+
status: z70.enum(["pending", "in_progress", "review", "failed", "interrupted", "completed", "cancelled"]).optional().describe("Task status. Agent summary-only interrupted updates default to missing_input"),
|
|
39315
|
+
dueDate: z70.string().optional().describe("Due date (ISO 8601 format)"),
|
|
39316
|
+
metadata: z70.record(z70.unknown()).optional().describe("Structured metadata (e.g. projectId, module)"),
|
|
39317
|
+
parentId: z70.string().optional().describe("Parent task ID for grouping subtasks"),
|
|
39318
|
+
sourceId: z70.string().optional().describe("Source session/thread ID"),
|
|
39319
|
+
context: z70.record(z70.unknown()).optional().describe("Additional context data"),
|
|
39320
|
+
ownerType: z70.enum(["user", "agent"]).optional().describe("Owner type. Defaults to 'user' if omitted"),
|
|
39321
|
+
ownerId: z70.string().optional().describe("Owner ID. Auto-filled from current user/agent if omitted"),
|
|
39322
|
+
requireReview: z70.boolean().optional().describe("If true, agent completion pauses as interrupted(review_required) for HITL approval"),
|
|
39323
|
+
dependencies: z70.array(z70.string()).optional().describe("List of task IDs that must be completed before this task can start"),
|
|
39324
|
+
dependencyTaskIds: z70.array(z70.string().trim().min(1)).optional().describe("Exact blocking task IDs required for an external_dependency interruption"),
|
|
39325
|
+
result: z70.string().optional().describe("Nonblank result summary required when creating or updating a task with status='completed'"),
|
|
39326
|
+
failureReason: z70.string().optional().describe("Nonblank failure reason required when creating or updating a task with status='failed'"),
|
|
39327
|
+
files: z70.array(z70.object({
|
|
39328
|
+
uri: z70.string().describe("Uniquely locates the resource: http(s):// URL, /s/:token share, or sandbox path"),
|
|
39329
|
+
name: z70.string().optional().describe("Display name"),
|
|
39330
|
+
addedBy: z70.enum(["user", "agent"]).optional().describe("Who attached the file")
|
|
39427
39331
|
})).optional().describe("File references attached to this task"),
|
|
39428
|
-
beliefImpact:
|
|
39429
|
-
key:
|
|
39430
|
-
after:
|
|
39431
|
-
basis:
|
|
39332
|
+
beliefImpact: z70.array(z70.object({
|
|
39333
|
+
key: z70.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
|
|
39334
|
+
after: z70.number().int().min(0).max(100),
|
|
39335
|
+
basis: z70.string().trim().min(1).max(1e3)
|
|
39432
39336
|
})).optional().describe("Structured belief reports required when an agent-owned task completes; keys must exist in the belief owner's Belief State"),
|
|
39433
|
-
content:
|
|
39434
|
-
summary:
|
|
39435
|
-
executionResultId:
|
|
39337
|
+
content: z70.string().optional().describe("Markdown content required for add_activity"),
|
|
39338
|
+
summary: z70.string().optional().describe("Brief summary of the operation"),
|
|
39339
|
+
executionResultId: z70.string().refine(isExecutionResultEventKey3, {
|
|
39436
39340
|
message: "executionResultId must be the execution-result:<threadId> event key returned by task()"
|
|
39437
39341
|
}).optional().describe(
|
|
39438
39342
|
"Canonical ASCII `execution-result:<suffix>` event key returned by task(); the nonempty suffix allows only A-Z, a-z, 0-9, period, underscore, colon, and hyphen, and is not a database row ID"
|
|
@@ -39440,15 +39344,15 @@ var manageTaskSchema = z71.object({
|
|
|
39440
39344
|
}).superRefine((input, context) => {
|
|
39441
39345
|
if (input.executionResultId && input.action !== "update" && input.action !== "add_activity") {
|
|
39442
39346
|
context.addIssue({
|
|
39443
|
-
code:
|
|
39347
|
+
code: z70.ZodIssueCode.custom,
|
|
39444
39348
|
path: ["executionResultId"],
|
|
39445
39349
|
message: "executionResultId is valid only for update or add_activity"
|
|
39446
39350
|
});
|
|
39447
39351
|
}
|
|
39448
39352
|
});
|
|
39449
|
-
var startTaskSchema =
|
|
39450
|
-
taskId:
|
|
39451
|
-
agentId:
|
|
39353
|
+
var startTaskSchema = z70.object({
|
|
39354
|
+
taskId: z70.string().trim().min(1).describe("ID of the persisted TaskItem to start"),
|
|
39355
|
+
agentId: z70.string().trim().min(1).describe("ID of the Agent that should execute the task")
|
|
39452
39356
|
});
|
|
39453
39357
|
function mergeTaskUpdateWarnings(existing, added) {
|
|
39454
39358
|
const warnings = [...existing ?? [], ...added ?? []];
|
|
@@ -40683,7 +40587,7 @@ function createTaskMiddleware(options = {}) {
|
|
|
40683
40587
|
callerThreadId: rc.thread_id
|
|
40684
40588
|
}));
|
|
40685
40589
|
};
|
|
40686
|
-
return
|
|
40590
|
+
return createMiddleware22({
|
|
40687
40591
|
name: "TaskMiddleware",
|
|
40688
40592
|
contextSchema,
|
|
40689
40593
|
wrapModelCall: async (request, handler) => {
|
|
@@ -40724,7 +40628,7 @@ ${TASK_CONVERGENCE_GUIDANCE}
|
|
|
40724
40628
|
});
|
|
40725
40629
|
},
|
|
40726
40630
|
tools: [
|
|
40727
|
-
|
|
40631
|
+
tool65(
|
|
40728
40632
|
handleManageTask,
|
|
40729
40633
|
{
|
|
40730
40634
|
name: "manage_task",
|
|
@@ -40758,7 +40662,7 @@ pending/in_progress, then complete them separately.`,
|
|
|
40758
40662
|
schema: manageTaskSchema
|
|
40759
40663
|
}
|
|
40760
40664
|
),
|
|
40761
|
-
|
|
40665
|
+
tool65(handleStartTask, {
|
|
40762
40666
|
name: "task",
|
|
40763
40667
|
description: "Start a persisted TaskItem with any Agent in a fresh isolated thread and return an observation plus executionResultId; the caller passes that exact ID to the manage_task update or add_activity that interprets it.",
|
|
40764
40668
|
schema: startTaskSchema
|
|
@@ -40896,8 +40800,8 @@ canonical Belief State:
|
|
|
40896
40800
|
};
|
|
40897
40801
|
|
|
40898
40802
|
// src/middlewares/evalMiddleware.ts
|
|
40899
|
-
import { createMiddleware as
|
|
40900
|
-
import { z as
|
|
40803
|
+
import { createMiddleware as createMiddleware23, tool as tool66 } from "langchain";
|
|
40804
|
+
import { z as z71 } from "zod";
|
|
40901
40805
|
import { v4 as uuidv48 } from "uuid";
|
|
40902
40806
|
|
|
40903
40807
|
// src/middlewares/evalSkills.ts
|
|
@@ -41116,8 +41020,8 @@ async function runWithResults(tid, store, svc, run, runnerAlive) {
|
|
|
41116
41020
|
return { ...run, runnerAlive, results };
|
|
41117
41021
|
}
|
|
41118
41022
|
function createReadEvalTool() {
|
|
41119
|
-
const schema6 =
|
|
41120
|
-
action:
|
|
41023
|
+
const schema6 = z71.object({
|
|
41024
|
+
action: z71.enum([
|
|
41121
41025
|
"list_projects",
|
|
41122
41026
|
"get_project",
|
|
41123
41027
|
"list_suites",
|
|
@@ -41129,13 +41033,13 @@ function createReadEvalTool() {
|
|
|
41129
41033
|
"get_run_results",
|
|
41130
41034
|
"get_project_report"
|
|
41131
41035
|
]).describe("Operation"),
|
|
41132
|
-
projectId:
|
|
41133
|
-
suiteId:
|
|
41134
|
-
caseId:
|
|
41135
|
-
runId:
|
|
41136
|
-
status:
|
|
41036
|
+
projectId: z71.string().optional(),
|
|
41037
|
+
suiteId: z71.string().optional(),
|
|
41038
|
+
caseId: z71.string().optional(),
|
|
41039
|
+
runId: z71.string().optional(),
|
|
41040
|
+
status: z71.string().optional().describe("Filter: running|completed|failed|aborted")
|
|
41137
41041
|
});
|
|
41138
|
-
return
|
|
41042
|
+
return tool66(
|
|
41139
41043
|
async (input, exeConfig) => {
|
|
41140
41044
|
const tid = tenantId(exeConfig);
|
|
41141
41045
|
if (!tid) {
|
|
@@ -41217,8 +41121,8 @@ ACTIONS:
|
|
|
41217
41121
|
);
|
|
41218
41122
|
}
|
|
41219
41123
|
function createManageEvalTool() {
|
|
41220
|
-
const schema6 =
|
|
41221
|
-
action:
|
|
41124
|
+
const schema6 = z71.object({
|
|
41125
|
+
action: z71.enum([
|
|
41222
41126
|
"create_project",
|
|
41223
41127
|
"update_project",
|
|
41224
41128
|
"delete_project",
|
|
@@ -41229,26 +41133,26 @@ function createManageEvalTool() {
|
|
|
41229
41133
|
"update_case",
|
|
41230
41134
|
"delete_case"
|
|
41231
41135
|
]).describe("Operation"),
|
|
41232
|
-
projectId:
|
|
41233
|
-
name:
|
|
41234
|
-
description:
|
|
41235
|
-
judgeModelKey:
|
|
41236
|
-
concurrency:
|
|
41237
|
-
targetAgentId:
|
|
41238
|
-
suiteId:
|
|
41239
|
-
caseId:
|
|
41240
|
-
inputMessage:
|
|
41241
|
-
inputFiles:
|
|
41242
|
-
steps:
|
|
41243
|
-
outputType:
|
|
41244
|
-
contentAssertion:
|
|
41245
|
-
rubrics:
|
|
41246
|
-
interruptPolicy:
|
|
41247
|
-
mode:
|
|
41248
|
-
value:
|
|
41136
|
+
projectId: z71.string().optional(),
|
|
41137
|
+
name: z71.string().optional(),
|
|
41138
|
+
description: z71.string().optional(),
|
|
41139
|
+
judgeModelKey: z71.string().optional(),
|
|
41140
|
+
concurrency: z71.number().optional(),
|
|
41141
|
+
targetAgentId: z71.string().optional().describe("Optional for create_project \u2014 the agent this eval project verifies. Recorded in targetServerConfig so the agent's detail page can find its eval data without relying on project naming."),
|
|
41142
|
+
suiteId: z71.string().optional(),
|
|
41143
|
+
caseId: z71.string().optional(),
|
|
41144
|
+
inputMessage: z71.string().optional(),
|
|
41145
|
+
inputFiles: z71.record(z71.string()).optional(),
|
|
41146
|
+
steps: z71.array(z71.object({ agent_id: z71.string(), override_message: z71.string().optional() })).optional(),
|
|
41147
|
+
outputType: z71.enum(["file_content", "message_content"]).optional(),
|
|
41148
|
+
contentAssertion: z71.string().optional(),
|
|
41149
|
+
rubrics: z71.array(z71.object({ name: z71.string(), weight: z71.number(), description: z71.string() })).optional(),
|
|
41150
|
+
interruptPolicy: z71.object({
|
|
41151
|
+
mode: z71.enum(["stop", "auto-approve", "auto-reject", "canned-response"]).describe("stop=judge the pause; auto-approve/auto-reject/canned-response=resume the agent to test the flow after the human input"),
|
|
41152
|
+
value: z71.string().optional().describe("Response to inject (defaults: \u540C\u610F / \u62D2\u7EDD; required for canned-response)")
|
|
41249
41153
|
}).optional().describe("Optional for create_case/update_case \u2014 how HITL interrupts are handled")
|
|
41250
41154
|
});
|
|
41251
|
-
return
|
|
41155
|
+
return tool66(
|
|
41252
41156
|
async (input, exeConfig) => {
|
|
41253
41157
|
const tid = tenantId(exeConfig);
|
|
41254
41158
|
if (!tid) {
|
|
@@ -41357,17 +41261,17 @@ Case: create_case(suiteId, inputMessage, steps, outputType, contentAssertion, in
|
|
|
41357
41261
|
);
|
|
41358
41262
|
}
|
|
41359
41263
|
function createRunEvalTool() {
|
|
41360
|
-
const schema6 =
|
|
41361
|
-
action:
|
|
41362
|
-
projectId:
|
|
41363
|
-
suiteIds:
|
|
41364
|
-
caseIds:
|
|
41365
|
-
runId:
|
|
41366
|
-
taskId:
|
|
41367
|
-
sleepMs:
|
|
41368
|
-
wait:
|
|
41264
|
+
const schema6 = z71.object({
|
|
41265
|
+
action: z71.enum(["start", "status", "resume", "abort"]).describe("Operation"),
|
|
41266
|
+
projectId: z71.string().optional().describe("Required for start"),
|
|
41267
|
+
suiteIds: z71.array(z71.string()).optional().describe("Optional for start \u2014 only run these suites (e.g. dev set only). Omit to run all."),
|
|
41268
|
+
caseIds: z71.array(z71.string()).optional().describe("Optional for start \u2014 only run these cases across the selected suites. Omit to run all cases in those suites."),
|
|
41269
|
+
runId: z71.string().optional().describe("Required for status, resume, abort"),
|
|
41270
|
+
taskId: z71.string().optional().describe("Optional for start \u2014 training task ID this run belongs to (round association)"),
|
|
41271
|
+
sleepMs: z71.number().int().min(0).max(12e4).optional().describe("Optional for status \u2014 sleep this many ms BEFORE checking the run, to pace polling (e.g. 15000 \u2192 30000 \u2192 60000 \u2192 120000). Omit to check immediately."),
|
|
41272
|
+
wait: z71.boolean().optional().describe("Optional for start \u2014 defaults to true: block synchronously (up to ~150s) and return final results in one call. Set false to return the runId immediately and poll.")
|
|
41369
41273
|
});
|
|
41370
|
-
return
|
|
41274
|
+
return tool66(
|
|
41371
41275
|
withToolTimeout(
|
|
41372
41276
|
async (input, exeConfig) => {
|
|
41373
41277
|
const tid = tenantId(exeConfig);
|
|
@@ -41498,7 +41402,7 @@ var evalPlugin = {
|
|
|
41498
41402
|
defaultConfig: {}
|
|
41499
41403
|
},
|
|
41500
41404
|
skills: EVAL_SKILLS,
|
|
41501
|
-
middleware: () =>
|
|
41405
|
+
middleware: () => createMiddleware23({
|
|
41502
41406
|
name: "EvalMiddleware",
|
|
41503
41407
|
tools: [createReadEvalTool(), createManageEvalTool(), createRunEvalTool()]
|
|
41504
41408
|
})
|
|
@@ -41506,7 +41410,7 @@ var evalPlugin = {
|
|
|
41506
41410
|
|
|
41507
41411
|
// src/middlewares/documentLearningMiddleware.ts
|
|
41508
41412
|
import { AgentType as AgentType9 } from "@axiom-lattice/protocols";
|
|
41509
|
-
import { createMiddleware as
|
|
41413
|
+
import { createMiddleware as createMiddleware24 } from "langchain";
|
|
41510
41414
|
|
|
41511
41415
|
// src/middlewares/documentLearningSkills.ts
|
|
41512
41416
|
var LEARN_CAPABILITY_SKILL = `---
|
|
@@ -41718,7 +41622,7 @@ patterns discovered, recommendations. Include validation coverage: user-sample N
|
|
|
41718
41622
|
`;
|
|
41719
41623
|
|
|
41720
41624
|
// src/middlewares/documentLearningMiddleware.ts
|
|
41721
|
-
var createDocumentLearningMiddleware = () =>
|
|
41625
|
+
var createDocumentLearningMiddleware = () => createMiddleware24({
|
|
41722
41626
|
name: "DocumentLearningMiddleware",
|
|
41723
41627
|
contextSchema,
|
|
41724
41628
|
tools: []
|
|
@@ -41836,12 +41740,12 @@ var documentLearningPlugin = {
|
|
|
41836
41740
|
};
|
|
41837
41741
|
|
|
41838
41742
|
// src/middlewares/documentParserMiddleware.ts
|
|
41839
|
-
import { createMiddleware as
|
|
41743
|
+
import { createMiddleware as createMiddleware25 } from "langchain";
|
|
41840
41744
|
|
|
41841
41745
|
// src/tool_lattice/document_parser/index.ts
|
|
41842
41746
|
import * as path7 from "path";
|
|
41843
|
-
import
|
|
41844
|
-
import { tool as
|
|
41747
|
+
import z72 from "zod";
|
|
41748
|
+
import { tool as tool67 } from "langchain";
|
|
41845
41749
|
var PARSE_DOCUMENT_DESCRIPTION = `Parse a document file (docx, pdf) into structured Markdown using a remote document parsing service.
|
|
41846
41750
|
This tool handles the full pipeline internally: file upload \u2192 document parsing \u2192 polling until complete \u2192 download result \u2192 save to filesystem.
|
|
41847
41751
|
|
|
@@ -41964,7 +41868,7 @@ function createParseDocumentTool({
|
|
|
41964
41868
|
baseUrl = "",
|
|
41965
41869
|
apiKey = ""
|
|
41966
41870
|
}) {
|
|
41967
|
-
return
|
|
41871
|
+
return tool67(
|
|
41968
41872
|
async (input, exe_config) => {
|
|
41969
41873
|
try {
|
|
41970
41874
|
const runConfig = exe_config?.configurable?.runConfig ?? { assistant_id: "", thread_id: "" };
|
|
@@ -42035,17 +41939,17 @@ function createParseDocumentTool({
|
|
|
42035
41939
|
{
|
|
42036
41940
|
name: "parse_document",
|
|
42037
41941
|
description: PARSE_DOCUMENT_DESCRIPTION,
|
|
42038
|
-
schema:
|
|
42039
|
-
file_path:
|
|
41942
|
+
schema: z72.object({
|
|
41943
|
+
file_path: z72.string().describe(
|
|
42040
41944
|
'Absolute path to the document file. Must point to an existing .docx or .pdf file. Example: "/project/reports/contract.docx". The file must be accessible from the current workspace.'
|
|
42041
41945
|
),
|
|
42042
|
-
engine:
|
|
41946
|
+
engine: z72.string().describe(
|
|
42043
41947
|
'Parsing engine to use. Available options: "textin" (recommended, works with local files, supports docx/pdf), "datalab" (alternative engine for docx/pdf), "mineru" (requires public URL, use only if textin/datalab fail), "paddleocr_remote" (PaddleOCR, good for scanned documents), "qwen_ocr" (OCR-focused, best for image-heavy PDFs).'
|
|
42044
41948
|
),
|
|
42045
|
-
output_path:
|
|
41949
|
+
output_path: z72.string().optional().describe(
|
|
42046
41950
|
'Path to save the parsed result. If not specified, the input extension is replaced with .md. Example: "/project/report.docx" becomes "/project/report.md". Parent directories are created automatically.'
|
|
42047
41951
|
),
|
|
42048
|
-
output_format:
|
|
41952
|
+
output_format: z72.enum(["markdown", "json"]).optional().default("markdown").describe(
|
|
42049
41953
|
'Output format. "markdown": structured Markdown with tables, headers, formatting preserved (recommended). "json": raw JSON output from the parsing engine (for programmatic use).'
|
|
42050
41954
|
)
|
|
42051
41955
|
})
|
|
@@ -42501,7 +42405,7 @@ function createDocumentParserMiddleware(config) {
|
|
|
42501
42405
|
const baseUrl = config.baseUrl || "";
|
|
42502
42406
|
const apiKey = config.apiKey || "";
|
|
42503
42407
|
const connections = Array.isArray(config.connections) ? config.connections.filter((key4) => typeof key4 === "string") : [];
|
|
42504
|
-
return
|
|
42408
|
+
return createMiddleware25({
|
|
42505
42409
|
name: "DocumentParser",
|
|
42506
42410
|
contextSchema,
|
|
42507
42411
|
tools: [createParseDocumentTool({ connectAll, connections, baseUrl, apiKey })]
|
|
@@ -42613,6 +42517,180 @@ var documentParserPlugin = {
|
|
|
42613
42517
|
}
|
|
42614
42518
|
};
|
|
42615
42519
|
|
|
42520
|
+
// src/middlewares/projectRoomMiddleware.ts
|
|
42521
|
+
import { createHash as createHash6 } from "crypto";
|
|
42522
|
+
import {
|
|
42523
|
+
descriptorDataValue as descriptorDataValue2,
|
|
42524
|
+
parseTrustedRunContext as parseTrustedRunContext3,
|
|
42525
|
+
snapshotExactArray as snapshotExactArray3,
|
|
42526
|
+
snapshotExactRecord as snapshotExactRecord8
|
|
42527
|
+
} from "@axiom-lattice/protocols";
|
|
42528
|
+
import { createMiddleware as createMiddleware26, tool as tool68 } from "langchain";
|
|
42529
|
+
import { z as z73 } from "zod";
|
|
42530
|
+
var PROJECT_ROOM_CONTEXT_REQUIRED = "PROJECT_ROOM_CONTEXT_REQUIRED";
|
|
42531
|
+
var PROJECT_ROOM_POST_FAILED = "PROJECT_ROOM_POST_FAILED";
|
|
42532
|
+
var PROJECT_ROOM_ROSTER_FAILED = "PROJECT_ROOM_ROSTER_FAILED";
|
|
42533
|
+
var PROJECT_ROOM_POST_FAILED_MESSAGE = "Project room message could not be posted";
|
|
42534
|
+
var PROJECT_ROOM_ROSTER_FAILED_MESSAGE = "Project room roster is unavailable";
|
|
42535
|
+
var CONTEXT_REQUIRED = JSON.stringify({
|
|
42536
|
+
success: false,
|
|
42537
|
+
error: PROJECT_ROOM_CONTEXT_REQUIRED
|
|
42538
|
+
});
|
|
42539
|
+
var POST_FAILED = JSON.stringify({
|
|
42540
|
+
success: false,
|
|
42541
|
+
error: PROJECT_ROOM_POST_FAILED,
|
|
42542
|
+
message: PROJECT_ROOM_POST_FAILED_MESSAGE
|
|
42543
|
+
});
|
|
42544
|
+
var ROSTER_FAILED = JSON.stringify({
|
|
42545
|
+
success: false,
|
|
42546
|
+
error: PROJECT_ROOM_ROSTER_FAILED,
|
|
42547
|
+
message: PROJECT_ROOM_ROSTER_FAILED_MESSAGE
|
|
42548
|
+
});
|
|
42549
|
+
var postSchema = z73.object({
|
|
42550
|
+
text: z73.string().trim().min(1).max(2e4)
|
|
42551
|
+
}).strict();
|
|
42552
|
+
var listSchema = z73.object({}).strict();
|
|
42553
|
+
function ownDataValue2(record, key4) {
|
|
42554
|
+
if (typeof record !== "object" || record === null || Array.isArray(record)) return void 0;
|
|
42555
|
+
try {
|
|
42556
|
+
const descriptor = Object.getOwnPropertyDescriptor(record, key4);
|
|
42557
|
+
return descriptorDataValue2(descriptor)?.value;
|
|
42558
|
+
} catch {
|
|
42559
|
+
return void 0;
|
|
42560
|
+
}
|
|
42561
|
+
}
|
|
42562
|
+
function readTrustedRoomScope(config) {
|
|
42563
|
+
const configurable = ownDataValue2(config, "configurable");
|
|
42564
|
+
const runConfig = ownDataValue2(configurable, "runConfig");
|
|
42565
|
+
const projectRoom = ownDataValue2(runConfig, "projectRoom");
|
|
42566
|
+
try {
|
|
42567
|
+
return parseTrustedRunContext3({ projectRoom }).projectRoom;
|
|
42568
|
+
} catch {
|
|
42569
|
+
return void 0;
|
|
42570
|
+
}
|
|
42571
|
+
}
|
|
42572
|
+
function exactValues2(value, required, optional = []) {
|
|
42573
|
+
try {
|
|
42574
|
+
return snapshotExactRecord8(value, required, optional);
|
|
42575
|
+
} catch {
|
|
42576
|
+
return void 0;
|
|
42577
|
+
}
|
|
42578
|
+
}
|
|
42579
|
+
function safeDate(value) {
|
|
42580
|
+
try {
|
|
42581
|
+
const timestamp = Date.prototype.getTime.call(value);
|
|
42582
|
+
return Number.isFinite(timestamp) ? new Date(timestamp) : void 0;
|
|
42583
|
+
} catch {
|
|
42584
|
+
return void 0;
|
|
42585
|
+
}
|
|
42586
|
+
}
|
|
42587
|
+
function snapshotMembership3(value) {
|
|
42588
|
+
const required = [
|
|
42589
|
+
"id",
|
|
42590
|
+
"tenantId",
|
|
42591
|
+
"workspaceId",
|
|
42592
|
+
"projectId",
|
|
42593
|
+
"roomId",
|
|
42594
|
+
"assistantId",
|
|
42595
|
+
"role",
|
|
42596
|
+
"title",
|
|
42597
|
+
"mentionName",
|
|
42598
|
+
"status",
|
|
42599
|
+
"roomThreadId",
|
|
42600
|
+
"joinedAt",
|
|
42601
|
+
"updatedAt"
|
|
42602
|
+
];
|
|
42603
|
+
const values = exactValues2(value, required, ["responsibility"]);
|
|
42604
|
+
const joinedAt = safeDate(values?.joinedAt);
|
|
42605
|
+
const updatedAt = safeDate(values?.updatedAt);
|
|
42606
|
+
if (!values || !joinedAt || !updatedAt || required.slice(0, 6).some((key4) => typeof values[key4] !== "string" || values[key4] === "") || values.role !== "coordinator" && values.role !== "specialist" || typeof values.title !== "string" || values.title === "" || typeof values.mentionName !== "string" || values.mentionName === "" || !["active", "paused", "removed"].includes(values.status) || typeof values.roomThreadId !== "string" || values.roomThreadId === "" || values.responsibility !== void 0 && typeof values.responsibility !== "string") return void 0;
|
|
42607
|
+
return { ...values, joinedAt, updatedAt };
|
|
42608
|
+
}
|
|
42609
|
+
function snapshotRows(value) {
|
|
42610
|
+
return snapshotExactArray3(value) ?? [];
|
|
42611
|
+
}
|
|
42612
|
+
async function hasActiveCurrentMembership(scope) {
|
|
42613
|
+
const memberships = getStoreLattice("default", "projectBotMembership").store;
|
|
42614
|
+
const member = snapshotMembership3(await memberships.findById(scope.tenantId, scope.membershipId));
|
|
42615
|
+
if (!member || member.status !== "active" || member.id !== scope.membershipId || member.tenantId !== scope.tenantId || member.workspaceId !== scope.workspaceId || member.projectId !== scope.projectId || member.roomId !== scope.roomId || member.assistantId !== scope.assistantId) return false;
|
|
42616
|
+
return true;
|
|
42617
|
+
}
|
|
42618
|
+
function createProjectRoomMiddleware() {
|
|
42619
|
+
return createMiddleware26({
|
|
42620
|
+
name: "ProjectRoomMiddleware",
|
|
42621
|
+
tools: [
|
|
42622
|
+
tool68(async (input, config) => {
|
|
42623
|
+
const { text } = input;
|
|
42624
|
+
const scope = readTrustedRoomScope(config);
|
|
42625
|
+
if (!scope) return CONTEXT_REQUIRED;
|
|
42626
|
+
const digest = createHash6("sha256").update(text).digest("hex");
|
|
42627
|
+
try {
|
|
42628
|
+
const service2 = new RoomAgentMessageService({
|
|
42629
|
+
memberships: getStoreLattice("default", "projectBotMembership").store,
|
|
42630
|
+
messages: getStoreLattice("default", "projectRoomMessage").store
|
|
42631
|
+
});
|
|
42632
|
+
await service2.post({
|
|
42633
|
+
tenantId: scope.tenantId,
|
|
42634
|
+
workspaceId: scope.workspaceId,
|
|
42635
|
+
projectId: scope.projectId,
|
|
42636
|
+
roomId: scope.roomId,
|
|
42637
|
+
membershipId: scope.membershipId,
|
|
42638
|
+
assistantId: scope.assistantId,
|
|
42639
|
+
text,
|
|
42640
|
+
sourceRoomMessageId: scope.sourceRoomMessageId,
|
|
42641
|
+
sourceId: `${scope.inputMessageId}:${digest}`,
|
|
42642
|
+
idempotencyKey: `room-tool:${scope.inputMessageId}:${scope.membershipId}:${digest}`
|
|
42643
|
+
});
|
|
42644
|
+
return JSON.stringify({ success: true, message: "Project room message posted" });
|
|
42645
|
+
} catch {
|
|
42646
|
+
return POST_FAILED;
|
|
42647
|
+
}
|
|
42648
|
+
}, {
|
|
42649
|
+
name: "post_room_message",
|
|
42650
|
+
description: "Post a text reply to the current trusted Project Room message",
|
|
42651
|
+
schema: postSchema
|
|
42652
|
+
}),
|
|
42653
|
+
tool68(async (_input, config) => {
|
|
42654
|
+
const scope = readTrustedRoomScope(config);
|
|
42655
|
+
if (!scope) return CONTEXT_REQUIRED;
|
|
42656
|
+
try {
|
|
42657
|
+
if (!await hasActiveCurrentMembership(scope)) return CONTEXT_REQUIRED;
|
|
42658
|
+
const rows = await getStoreLattice("default", "projectBotMembership").store.list(scope.tenantId, scope.projectId);
|
|
42659
|
+
const members = snapshotRows(rows).map(snapshotMembership3).filter((member) => member !== void 0 && member.status === "active" && member.tenantId === scope.tenantId && member.workspaceId === scope.workspaceId && member.projectId === scope.projectId && member.roomId === scope.roomId).sort((left, right) => left.joinedAt.getTime() - right.joinedAt.getTime() || (left.id < right.id ? -1 : left.id > right.id ? 1 : 0)).map((member) => ({
|
|
42660
|
+
assistantId: member.assistantId,
|
|
42661
|
+
mentionName: member.mentionName,
|
|
42662
|
+
title: member.title,
|
|
42663
|
+
...member.responsibility === void 0 ? {} : { responsibility: member.responsibility },
|
|
42664
|
+
role: member.role
|
|
42665
|
+
}));
|
|
42666
|
+
return JSON.stringify({ success: true, members });
|
|
42667
|
+
} catch {
|
|
42668
|
+
return ROSTER_FAILED;
|
|
42669
|
+
}
|
|
42670
|
+
}, {
|
|
42671
|
+
name: "list_room_roster",
|
|
42672
|
+
description: "List active Agent roles in the current trusted Project Room, including assistantId for delegation",
|
|
42673
|
+
schema: listSchema
|
|
42674
|
+
})
|
|
42675
|
+
]
|
|
42676
|
+
});
|
|
42677
|
+
}
|
|
42678
|
+
var projectRoomPlugin = {
|
|
42679
|
+
meta: {
|
|
42680
|
+
type: "project_room",
|
|
42681
|
+
category: "assistant",
|
|
42682
|
+
name: "Project Room",
|
|
42683
|
+
description: "Trusted Project Room posting and active roster tools",
|
|
42684
|
+
tools: [
|
|
42685
|
+
{ name: "post_room_message", description: "Post to the current trusted Project Room" },
|
|
42686
|
+
{ name: "list_room_roster", description: "List active Agents in the current trusted Project Room" }
|
|
42687
|
+
],
|
|
42688
|
+
configSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
42689
|
+
defaultConfig: {}
|
|
42690
|
+
},
|
|
42691
|
+
middleware: () => createProjectRoomMiddleware()
|
|
42692
|
+
};
|
|
42693
|
+
|
|
42616
42694
|
// src/plugin/BuiltinPlugins.ts
|
|
42617
42695
|
var BUILTIN_PLUGINS = [
|
|
42618
42696
|
filesystemPlugin,
|
|
@@ -43084,7 +43162,7 @@ export {
|
|
|
43084
43162
|
ExportableEntityRegistry,
|
|
43085
43163
|
FileSystemSkillStore,
|
|
43086
43164
|
FilesystemBackend,
|
|
43087
|
-
|
|
43165
|
+
HumanMessage6 as HumanMessage,
|
|
43088
43166
|
IdRemapper,
|
|
43089
43167
|
InMemoryA2AApiKeyStore,
|
|
43090
43168
|
InMemoryAgentWebAppStore,
|