@axiom-lattice/core 13.3.1 → 13.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +362 -67
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +354 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1652,6 +1652,8 @@ __export(index_exports, {
|
|
|
1652
1652
|
DEFAULT_MODEL_EXTRA: () => DEFAULT_MODEL_EXTRA,
|
|
1653
1653
|
DEFAULT_RESIDENT_INVOKE_TIMEOUT_MS: () => DEFAULT_RESIDENT_INVOKE_TIMEOUT_MS,
|
|
1654
1654
|
DEFAULT_SUMMARIZATION_TRIGGER_TOKENS: () => DEFAULT_SUMMARIZATION_TRIGGER_TOKENS,
|
|
1655
|
+
DEFAULT_TENANT_WORKSPACE_DESCRIPTION: () => DEFAULT_TENANT_WORKSPACE_DESCRIPTION,
|
|
1656
|
+
DEFAULT_TENANT_WORKSPACE_NAME: () => DEFAULT_TENANT_WORKSPACE_NAME,
|
|
1655
1657
|
DEFAULT_TEXTS_EMBEDDING_PATH: () => DEFAULT_TEXTS_EMBEDDING_PATH,
|
|
1656
1658
|
DaytonaInstance: () => DaytonaInstance,
|
|
1657
1659
|
DaytonaProvider: () => DaytonaProvider,
|
|
@@ -1925,6 +1927,7 @@ __export(index_exports, {
|
|
|
1925
1927
|
createTaskMiddleware: () => createTaskMiddleware,
|
|
1926
1928
|
createTaskRunBridge: () => createTaskRunBridge,
|
|
1927
1929
|
createTaskRunLiveness: () => createTaskRunLiveness,
|
|
1930
|
+
createTenantProvisioningService: () => createTenantProvisioningService,
|
|
1928
1931
|
createTrustedAgentMessageDispatcher: () => createTrustedAgentMessageDispatcher,
|
|
1929
1932
|
createUnknownToolHandlerMiddleware: () => createUnknownToolHandlerMiddleware,
|
|
1930
1933
|
createWidgetMiddleware: () => createWidgetMiddleware,
|
|
@@ -2788,6 +2791,32 @@ var InMemoryThreadStore = class {
|
|
|
2788
2791
|
total: filtered.length
|
|
2789
2792
|
};
|
|
2790
2793
|
}
|
|
2794
|
+
async listChannelSenders(tenantId2, channelInstallationId, limit) {
|
|
2795
|
+
const tenantThreads = this.threads.get(tenantId2);
|
|
2796
|
+
if (!tenantThreads) return [];
|
|
2797
|
+
const bySender = /* @__PURE__ */ new Map();
|
|
2798
|
+
for (const assistantThreads of tenantThreads.values()) {
|
|
2799
|
+
for (const thread of assistantThreads.values()) {
|
|
2800
|
+
const metadata = thread.metadata ?? {};
|
|
2801
|
+
if (metadata.channelInstallationId !== channelInstallationId) continue;
|
|
2802
|
+
if (typeof metadata.senderId !== "string" || !metadata.senderId) continue;
|
|
2803
|
+
const existing = bySender.get(metadata.senderId);
|
|
2804
|
+
if (existing && existing.lastSeenAt.getTime() >= thread.updatedAt.getTime()) {
|
|
2805
|
+
continue;
|
|
2806
|
+
}
|
|
2807
|
+
bySender.set(metadata.senderId, {
|
|
2808
|
+
senderId: metadata.senderId,
|
|
2809
|
+
...typeof metadata.senderDisplayName === "string" && metadata.senderDisplayName ? { displayName: metadata.senderDisplayName } : {},
|
|
2810
|
+
lastSeenAt: thread.updatedAt,
|
|
2811
|
+
lastThreadId: thread.id
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
const bounded = Math.max(1, Math.min(200, Math.floor(limit)));
|
|
2816
|
+
return [...bySender.values()].sort(
|
|
2817
|
+
(left, right) => right.lastSeenAt.getTime() - left.lastSeenAt.getTime()
|
|
2818
|
+
).slice(0, bounded);
|
|
2819
|
+
}
|
|
2791
2820
|
/**
|
|
2792
2821
|
* Get a thread by ID for a specific tenant
|
|
2793
2822
|
*/
|
|
@@ -6608,6 +6637,8 @@ var InMemoryChannelInstallationStore = class {
|
|
|
6608
6637
|
config: { ...data.config },
|
|
6609
6638
|
enabled: data.enabled ?? true,
|
|
6610
6639
|
fallbackAgentId: data.fallbackAgentId,
|
|
6640
|
+
workspaceId: data.workspaceId,
|
|
6641
|
+
projectId: data.projectId,
|
|
6611
6642
|
rejectWhenNoBinding: data.rejectWhenNoBinding ?? true,
|
|
6612
6643
|
createdAt: now,
|
|
6613
6644
|
updatedAt: now
|
|
@@ -6631,7 +6662,9 @@ var InMemoryChannelInstallationStore = class {
|
|
|
6631
6662
|
name: updates.name !== void 0 ? updates.name : existing.name,
|
|
6632
6663
|
config: updates.config !== void 0 ? { ...existing.config, ...updates.config } : existing.config,
|
|
6633
6664
|
enabled: updates.enabled !== void 0 ? updates.enabled : existing.enabled,
|
|
6634
|
-
fallbackAgentId: updates.fallbackAgentId !== void 0 ? updates.fallbackAgentId : existing.fallbackAgentId,
|
|
6665
|
+
fallbackAgentId: updates.fallbackAgentId === null || updates.fallbackAgentId === "" ? void 0 : updates.fallbackAgentId !== void 0 ? updates.fallbackAgentId : existing.fallbackAgentId,
|
|
6666
|
+
workspaceId: updates.workspaceId === "" ? void 0 : updates.workspaceId !== void 0 ? updates.workspaceId : existing.workspaceId,
|
|
6667
|
+
projectId: updates.projectId === "" ? void 0 : updates.projectId !== void 0 ? updates.projectId : existing.projectId,
|
|
6635
6668
|
rejectWhenNoBinding: updates.rejectWhenNoBinding !== void 0 ? updates.rejectWhenNoBinding : existing.rejectWhenNoBinding,
|
|
6636
6669
|
updatedAt: /* @__PURE__ */ new Date()
|
|
6637
6670
|
};
|
|
@@ -6740,8 +6773,8 @@ var InMemoryBindingStore = class {
|
|
|
6740
6773
|
...existing,
|
|
6741
6774
|
agentId: patch.agentId ?? existing.agentId,
|
|
6742
6775
|
threadId: patch.threadId !== void 0 ? patch.threadId : existing.threadId,
|
|
6743
|
-
workspaceId: patch.workspaceId !== void 0 ? patch.workspaceId : existing.workspaceId,
|
|
6744
|
-
projectId: patch.projectId !== void 0 ? patch.projectId : existing.projectId,
|
|
6776
|
+
workspaceId: patch.workspaceId === "" ? void 0 : patch.workspaceId !== void 0 ? patch.workspaceId : existing.workspaceId,
|
|
6777
|
+
projectId: patch.projectId === "" ? void 0 : patch.projectId !== void 0 ? patch.projectId : existing.projectId,
|
|
6745
6778
|
threadMode: patch.threadMode ?? existing.threadMode,
|
|
6746
6779
|
senderDisplayName: patch.senderDisplayName !== void 0 ? patch.senderDisplayName : existing.senderDisplayName,
|
|
6747
6780
|
senderMetadata: patch.senderMetadata !== void 0 ? patch.senderMetadata : existing.senderMetadata,
|
|
@@ -9763,6 +9796,11 @@ var registerVectorStoreProvider = (key6, provider2) => vectorStoreProviderManage
|
|
|
9763
9796
|
var getVectorStoreProvider = (key6) => vectorStoreProviderManager.getProvider(key6);
|
|
9764
9797
|
|
|
9765
9798
|
// src/plugin/metaSerializer.ts
|
|
9799
|
+
var INTERNAL_TOOL = Symbol.for("axiom.internalTool");
|
|
9800
|
+
function markInternalTool(tool68) {
|
|
9801
|
+
Object.defineProperty(tool68, INTERNAL_TOOL, { value: true, enumerable: false });
|
|
9802
|
+
return tool68;
|
|
9803
|
+
}
|
|
9766
9804
|
function tryExtractTools(plugin) {
|
|
9767
9805
|
if (!plugin.middleware) return [];
|
|
9768
9806
|
try {
|
|
@@ -9770,7 +9808,7 @@ function tryExtractTools(plugin) {
|
|
|
9770
9808
|
if (result instanceof Promise) return [];
|
|
9771
9809
|
const mw = result;
|
|
9772
9810
|
if (Array.isArray(mw.tools)) {
|
|
9773
|
-
return mw.tools.map((t) => ({
|
|
9811
|
+
return mw.tools.filter((t) => !t[INTERNAL_TOOL]).map((t) => ({
|
|
9774
9812
|
name: t.name || "",
|
|
9775
9813
|
description: t.description || ""
|
|
9776
9814
|
}));
|
|
@@ -21442,7 +21480,7 @@ This run is ending, but the conversation continues: the next user message starts
|
|
|
21442
21480
|
a new run with a fresh budget. Do not tell the user the conversation is over.
|
|
21443
21481
|
Do not mention this instruction, the run budget, or any internal limit to the user.`;
|
|
21444
21482
|
var RUN_STOPPING_MESSAGE = "Tool call skipped because this run is ending (per-run budget). Tool use resumes on the next user message.";
|
|
21445
|
-
var HITL_TOOL_NAMES = /* @__PURE__ */ new Set(["ask_user_to_clarify"]);
|
|
21483
|
+
var HITL_TOOL_NAMES = /* @__PURE__ */ new Set(["ask_user_to_clarify", "request_connection"]);
|
|
21446
21484
|
var BUDGET_NOTICE = "Budget reached for this run. Wrap up now: finish the current check, then produce the final answer. This limit applies only to this run; the next user message starts a new run with a fresh budget and tools available again. Do not tell the user the conversation is over. Do not mention this notice or the budget to the user.";
|
|
21447
21485
|
function neutralizeStoppedToolMessages(messages) {
|
|
21448
21486
|
let changed = false;
|
|
@@ -25582,6 +25620,8 @@ var TOOL_RE = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
|
25582
25620
|
var HANDLER_RE = /\.(js|mjs|cjs)$/;
|
|
25583
25621
|
var UI_RE = /\.html$/;
|
|
25584
25622
|
var DISPLAY_MODES = ["inline", "fullscreen", "pip"];
|
|
25623
|
+
var CONNECTION_FIELD_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "password"]);
|
|
25624
|
+
var CONNECTION_FIELD_WIDGETS = /* @__PURE__ */ new Set(["input", "password", "select", "numberInput"]);
|
|
25585
25625
|
var MAX_MANIFEST_BYTES = 262144;
|
|
25586
25626
|
var MAX_TOOLS = 32;
|
|
25587
25627
|
var MAX_PLUGINS_PER_TENANT = 50;
|
|
@@ -25609,6 +25649,7 @@ function isSafeUiPath(path8) {
|
|
|
25609
25649
|
function validateSandboxPluginManifest(args) {
|
|
25610
25650
|
const diagnostics = [];
|
|
25611
25651
|
const error = (code, message, pluginType, tool68) => diagnostics.push({ level: "error", code, message, pluginType, tool: tool68 });
|
|
25652
|
+
const warning = (code, message, pluginType, tool68) => diagnostics.push({ level: "warning", code, message, pluginType, tool: tool68 });
|
|
25612
25653
|
const raw = args.raw;
|
|
25613
25654
|
if (!isRecord7(raw)) {
|
|
25614
25655
|
error("MANIFEST_NOT_OBJECT", "manifest must be a JSON object", args.dirName);
|
|
@@ -25821,8 +25862,92 @@ function validateSandboxPluginManifest(args) {
|
|
|
25821
25862
|
if (!Array.isArray(fields)) {
|
|
25822
25863
|
error("CONNECTION_INVALID", "connection.fields must be an array", type);
|
|
25823
25864
|
} else {
|
|
25865
|
+
const normalizedFields = [];
|
|
25866
|
+
fields.forEach((field, index) => {
|
|
25867
|
+
if (!isRecord7(field)) {
|
|
25868
|
+
error(
|
|
25869
|
+
"CONNECTION_FIELD_INVALID",
|
|
25870
|
+
`connection.fields[${index}] must be an object`,
|
|
25871
|
+
type
|
|
25872
|
+
);
|
|
25873
|
+
return;
|
|
25874
|
+
}
|
|
25875
|
+
const key6 = field.key;
|
|
25876
|
+
const fieldType = field.type;
|
|
25877
|
+
const title = field.title;
|
|
25878
|
+
if (typeof key6 !== "string" || key6.trim() === "") {
|
|
25879
|
+
error(
|
|
25880
|
+
"CONNECTION_FIELD_INVALID",
|
|
25881
|
+
`connection.fields[${index}] requires a non-empty string key`,
|
|
25882
|
+
type
|
|
25883
|
+
);
|
|
25884
|
+
return;
|
|
25885
|
+
}
|
|
25886
|
+
if (typeof fieldType !== "string" || !CONNECTION_FIELD_TYPES.has(fieldType)) {
|
|
25887
|
+
error(
|
|
25888
|
+
"CONNECTION_FIELD_INVALID",
|
|
25889
|
+
`connection.fields[${index}] (${key6}) type must be one of ${[
|
|
25890
|
+
...CONNECTION_FIELD_TYPES
|
|
25891
|
+
].join(", ")}`,
|
|
25892
|
+
type
|
|
25893
|
+
);
|
|
25894
|
+
return;
|
|
25895
|
+
}
|
|
25896
|
+
if (typeof title !== "string" || title.trim() === "") {
|
|
25897
|
+
error(
|
|
25898
|
+
"CONNECTION_FIELD_INVALID",
|
|
25899
|
+
`connection.fields[${index}] (${key6}) requires a non-empty string title (the human-visible label; use "title", not "label")`,
|
|
25900
|
+
type
|
|
25901
|
+
);
|
|
25902
|
+
return;
|
|
25903
|
+
}
|
|
25904
|
+
if (field.widget !== void 0 && (typeof field.widget !== "string" || !CONNECTION_FIELD_WIDGETS.has(field.widget))) {
|
|
25905
|
+
error(
|
|
25906
|
+
"CONNECTION_FIELD_INVALID",
|
|
25907
|
+
`connection.fields[${index}] (${key6}) widget must be one of ${[
|
|
25908
|
+
...CONNECTION_FIELD_WIDGETS
|
|
25909
|
+
].join(", ")}`,
|
|
25910
|
+
type
|
|
25911
|
+
);
|
|
25912
|
+
return;
|
|
25913
|
+
}
|
|
25914
|
+
if (field.required !== void 0 && typeof field.required !== "boolean") {
|
|
25915
|
+
error(
|
|
25916
|
+
"CONNECTION_FIELD_INVALID",
|
|
25917
|
+
`connection.fields[${index}] (${key6}) required must be a boolean`,
|
|
25918
|
+
type
|
|
25919
|
+
);
|
|
25920
|
+
return;
|
|
25921
|
+
}
|
|
25922
|
+
if (field.enumValues !== void 0 && (!Array.isArray(field.enumValues) || field.enumValues.some((value) => typeof value !== "string"))) {
|
|
25923
|
+
error(
|
|
25924
|
+
"CONNECTION_FIELD_INVALID",
|
|
25925
|
+
`connection.fields[${index}] (${key6}) enumValues must be an array of strings`,
|
|
25926
|
+
type
|
|
25927
|
+
);
|
|
25928
|
+
return;
|
|
25929
|
+
}
|
|
25930
|
+
if (field.helpText !== void 0 && typeof field.helpText !== "string") {
|
|
25931
|
+
error(
|
|
25932
|
+
"CONNECTION_FIELD_INVALID",
|
|
25933
|
+
`connection.fields[${index}] (${key6}) helpText must be a string`,
|
|
25934
|
+
type
|
|
25935
|
+
);
|
|
25936
|
+
return;
|
|
25937
|
+
}
|
|
25938
|
+
if (title.trim().toLowerCase() === "label" || title.trim() === key6) {
|
|
25939
|
+
warning(
|
|
25940
|
+
"CONNECTION_FIELD_TITLE_PLACEHOLDER",
|
|
25941
|
+
`connection.fields[${index}] (${key6}) title "${title}" looks like a placeholder; use the human-visible label (for example "API Key")`,
|
|
25942
|
+
type
|
|
25943
|
+
);
|
|
25944
|
+
}
|
|
25945
|
+
normalizedFields.push(
|
|
25946
|
+
field
|
|
25947
|
+
);
|
|
25948
|
+
});
|
|
25824
25949
|
const normalized = {
|
|
25825
|
-
fields
|
|
25950
|
+
fields: normalizedFields
|
|
25826
25951
|
};
|
|
25827
25952
|
if (typeof raw.connection.resourceLabel === "string") {
|
|
25828
25953
|
normalized.resourceLabel = raw.connection.resourceLabel;
|
|
@@ -28432,7 +28557,7 @@ function hasExpectedInterrupt(interrupts, expectedInterruptId) {
|
|
|
28432
28557
|
return interrupts.length === 1 && interrupts[0]?.interruptId === expectedInterruptId;
|
|
28433
28558
|
}
|
|
28434
28559
|
return interrupts.filter(
|
|
28435
|
-
(
|
|
28560
|
+
(interrupt6) => interrupt6.interruptId === expectedInterruptId
|
|
28436
28561
|
).length === 1;
|
|
28437
28562
|
}
|
|
28438
28563
|
function normalizeAgentInterrupts(state, threadId) {
|
|
@@ -28442,11 +28567,11 @@ function normalizeAgentInterrupts(state, threadId) {
|
|
|
28442
28567
|
if (!isRecord12(task) || !Array.isArray(task.interrupts)) return;
|
|
28443
28568
|
const rawTaskId = task.id;
|
|
28444
28569
|
const taskId = typeof rawTaskId === "string" || typeof rawTaskId === "number" ? String(rawTaskId) : void 0;
|
|
28445
|
-
task.interrupts.forEach((
|
|
28446
|
-
const record = isRecord12(
|
|
28570
|
+
task.interrupts.forEach((interrupt6, index) => {
|
|
28571
|
+
const record = isRecord12(interrupt6) ? interrupt6 : {};
|
|
28447
28572
|
const rawId = record.id;
|
|
28448
28573
|
const interruptId = typeof rawId === "string" || typeof rawId === "number" ? String(rawId) : `${taskId ?? `task-${taskIndex}`}:${index}`;
|
|
28449
|
-
const rawValue = isRecord12(
|
|
28574
|
+
const rawValue = isRecord12(interrupt6) ? record.value : interrupt6;
|
|
28450
28575
|
const fenced = parseFence(rawValue);
|
|
28451
28576
|
const value = fenced ? fenced.payload : rawValue;
|
|
28452
28577
|
let type;
|
|
@@ -32802,7 +32927,7 @@ var Agent = class {
|
|
|
32802
32927
|
try {
|
|
32803
32928
|
const state = await this.getCurrentState();
|
|
32804
32929
|
const durable = (state?.tasks ?? []).some(
|
|
32805
|
-
(task) => (task.interrupts ?? []).some((
|
|
32930
|
+
(task) => (task.interrupts ?? []).some((interrupt6) => interrupt6.id === interruptId)
|
|
32806
32931
|
);
|
|
32807
32932
|
if (durable) return;
|
|
32808
32933
|
} catch {
|
|
@@ -44755,7 +44880,7 @@ function parseJudgeVerdict(raw) {
|
|
|
44755
44880
|
}
|
|
44756
44881
|
}
|
|
44757
44882
|
var MAX_INTERRUPT_RESUMES = 5;
|
|
44758
|
-
function resolveInterruptResponse(policy,
|
|
44883
|
+
function resolveInterruptResponse(policy, interrupt6) {
|
|
44759
44884
|
if (policy.mode === "auto-approve") return policy.value ?? "\u540C\u610F";
|
|
44760
44885
|
if (policy.mode === "auto-reject") return policy.value ?? "\u62D2\u7EDD";
|
|
44761
44886
|
return policy.value ?? "";
|
|
@@ -44857,31 +44982,31 @@ var _LatticeEval = class _LatticeEval {
|
|
|
44857
44982
|
let pendingInterrupt;
|
|
44858
44983
|
let interrupts = Array.isArray(result?.__interrupt__) ? result.__interrupt__ : [];
|
|
44859
44984
|
while (interrupts.length > 0) {
|
|
44860
|
-
const
|
|
44861
|
-
if (!
|
|
44985
|
+
const interrupt6 = interrupts[0];
|
|
44986
|
+
if (!interrupt6) break;
|
|
44862
44987
|
const policy = interruptPolicy;
|
|
44863
44988
|
if (!policy || policy.mode === "stop" || resumeCount >= MAX_INTERRUPT_RESUMES) {
|
|
44864
|
-
pendingInterrupt =
|
|
44989
|
+
pendingInterrupt = interrupt6;
|
|
44865
44990
|
break;
|
|
44866
44991
|
}
|
|
44867
|
-
const response = resolveInterruptResponse(policy,
|
|
44992
|
+
const response = resolveInterruptResponse(policy, interrupt6);
|
|
44868
44993
|
hitlEvents.push({
|
|
44869
44994
|
type: "interrupt",
|
|
44870
|
-
id:
|
|
44871
|
-
value:
|
|
44995
|
+
id: interrupt6.id,
|
|
44996
|
+
value: interrupt6.value
|
|
44872
44997
|
});
|
|
44873
44998
|
this.log("Auto-resolving HITL interrupt", {
|
|
44874
44999
|
agent_id: step.agent_id,
|
|
44875
45000
|
thread_id: threadId,
|
|
44876
45001
|
mode: policy.mode,
|
|
44877
|
-
interrupt_id:
|
|
45002
|
+
interrupt_id: interrupt6.id,
|
|
44878
45003
|
response,
|
|
44879
45004
|
resume_count: resumeCount + 1
|
|
44880
45005
|
});
|
|
44881
45006
|
result = await agent.invokeWithState({ input: stepInput, command: { resume: response } });
|
|
44882
45007
|
hitlEvents.push({
|
|
44883
45008
|
type: "interrupt_response",
|
|
44884
|
-
id:
|
|
45009
|
+
id: interrupt6.id,
|
|
44885
45010
|
mode: policy.mode,
|
|
44886
45011
|
response
|
|
44887
45012
|
});
|
|
@@ -44978,7 +45103,7 @@ var _LatticeEval = class _LatticeEval {
|
|
|
44978
45103
|
});
|
|
44979
45104
|
let currentThreadId = threadId;
|
|
44980
45105
|
let lastResponseData = null;
|
|
44981
|
-
let
|
|
45106
|
+
let interrupt6;
|
|
44982
45107
|
for (const step of evalCase.steps) {
|
|
44983
45108
|
const result = await this.executeAgentStep(
|
|
44984
45109
|
step,
|
|
@@ -45044,10 +45169,10 @@ ${toolCallStr}` : toolCallStr;
|
|
|
45044
45169
|
}
|
|
45045
45170
|
}
|
|
45046
45171
|
if (result.interrupted) {
|
|
45047
|
-
|
|
45172
|
+
interrupt6 = result.interrupt;
|
|
45048
45173
|
this.log("Case paused for HITL \u2014 remaining steps skipped; judge will evaluate the pause", {
|
|
45049
45174
|
case_id: evalCase.caseId,
|
|
45050
|
-
interrupt_id:
|
|
45175
|
+
interrupt_id: interrupt6?.id
|
|
45051
45176
|
});
|
|
45052
45177
|
break;
|
|
45053
45178
|
}
|
|
@@ -45057,7 +45182,7 @@ ${toolCallStr}` : toolCallStr;
|
|
|
45057
45182
|
final_thread_id: currentThreadId,
|
|
45058
45183
|
message_count: this.lastMessages.length
|
|
45059
45184
|
});
|
|
45060
|
-
const finalOutput =
|
|
45185
|
+
const finalOutput = interrupt6 ? typeof interrupt6.value === "string" ? interrupt6.value : JSON.stringify(interrupt6.value ?? "") : this.extractFinalMessage(lastResponseData);
|
|
45061
45186
|
this.lastFinalOutput = finalOutput;
|
|
45062
45187
|
const trajectory = this.buildTrajectory();
|
|
45063
45188
|
this.log("Final output extracted", {
|
|
@@ -45277,8 +45402,8 @@ Note: if final_score >= 80 and there are no fatal errors, pass should be true; o
|
|
|
45277
45402
|
final_score: finalScore,
|
|
45278
45403
|
dimension_results: dimensionResults,
|
|
45279
45404
|
summary: parsedResult.summary || testResultContent,
|
|
45280
|
-
interrupted:
|
|
45281
|
-
interrupt:
|
|
45405
|
+
interrupted: interrupt6 ? true : void 0,
|
|
45406
|
+
interrupt: interrupt6 ? { id: interrupt6.id, value: interrupt6.value } : void 0
|
|
45282
45407
|
};
|
|
45283
45408
|
}
|
|
45284
45409
|
};
|
|
@@ -46319,6 +46444,42 @@ var ProjectMutationMutex = class {
|
|
|
46319
46444
|
};
|
|
46320
46445
|
var projectMutationMutex = new ProjectMutationMutex();
|
|
46321
46446
|
|
|
46447
|
+
// src/services/TenantProvisioningService.ts
|
|
46448
|
+
var import_node_crypto16 = require("crypto");
|
|
46449
|
+
var DEFAULT_TENANT_WORKSPACE_NAME = "Default Workspace";
|
|
46450
|
+
var DEFAULT_TENANT_WORKSPACE_DESCRIPTION = "Default workspace created automatically for this tenant";
|
|
46451
|
+
function createTenantProvisioningService(deps) {
|
|
46452
|
+
const newId = deps.idFactory ?? import_node_crypto16.randomUUID;
|
|
46453
|
+
const defaults = deps.workspaceDefaults ?? {};
|
|
46454
|
+
return {
|
|
46455
|
+
async create(id, data) {
|
|
46456
|
+
const tenant = await deps.tenantStore.createTenant(id, data);
|
|
46457
|
+
try {
|
|
46458
|
+
await deps.workspaceStore.createWorkspace(tenant.id, newId(), {
|
|
46459
|
+
name: defaults.name ?? DEFAULT_TENANT_WORKSPACE_NAME,
|
|
46460
|
+
description: defaults.description ?? DEFAULT_TENANT_WORKSPACE_DESCRIPTION,
|
|
46461
|
+
storageType: defaults.storageType ?? "sandbox"
|
|
46462
|
+
});
|
|
46463
|
+
} catch (error) {
|
|
46464
|
+
try {
|
|
46465
|
+
await deps.tenantStore.deleteTenant(tenant.id);
|
|
46466
|
+
} catch (rollbackError) {
|
|
46467
|
+
deps.logger?.warn?.(
|
|
46468
|
+
"Tenant rollback after workspace failure failed",
|
|
46469
|
+
{
|
|
46470
|
+
tenantId: tenant.id,
|
|
46471
|
+
error: error instanceof Error ? error.message : String(error),
|
|
46472
|
+
rollbackError: rollbackError instanceof Error ? rollbackError.message : String(rollbackError)
|
|
46473
|
+
}
|
|
46474
|
+
);
|
|
46475
|
+
}
|
|
46476
|
+
throw error;
|
|
46477
|
+
}
|
|
46478
|
+
return tenant;
|
|
46479
|
+
}
|
|
46480
|
+
};
|
|
46481
|
+
}
|
|
46482
|
+
|
|
46322
46483
|
// src/services/TrustedAgentDispatcher.ts
|
|
46323
46484
|
function createTrustedAgentMessageDispatcher(resolve4) {
|
|
46324
46485
|
return {
|
|
@@ -47088,11 +47249,11 @@ function describe(error) {
|
|
|
47088
47249
|
}
|
|
47089
47250
|
|
|
47090
47251
|
// src/services/TaskLifecycleService.ts
|
|
47091
|
-
var
|
|
47252
|
+
var import_node_crypto18 = require("crypto");
|
|
47092
47253
|
var import_protocols52 = require("@axiom-lattice/protocols");
|
|
47093
47254
|
|
|
47094
47255
|
// src/middlewares/taskBelief.ts
|
|
47095
|
-
var
|
|
47256
|
+
var import_node_crypto17 = require("crypto");
|
|
47096
47257
|
function buildBeliefCompletionEventKey(taskId, result, impacts) {
|
|
47097
47258
|
const canonical = JSON.stringify({
|
|
47098
47259
|
beliefImpact: impacts.map((impact) => ({
|
|
@@ -47103,7 +47264,7 @@ function buildBeliefCompletionEventKey(taskId, result, impacts) {
|
|
|
47103
47264
|
})),
|
|
47104
47265
|
result: result.trim()
|
|
47105
47266
|
});
|
|
47106
|
-
return (0,
|
|
47267
|
+
return (0, import_node_crypto17.createHash)("sha256").update(canonical).digest("hex");
|
|
47107
47268
|
}
|
|
47108
47269
|
function buildCompletionEvidenceDetail(result, impacts, eventKey) {
|
|
47109
47270
|
return { result, beliefImpact: impacts, eventKey };
|
|
@@ -47306,7 +47467,7 @@ function canonicalJson(value) {
|
|
|
47306
47467
|
return JSON.stringify(value);
|
|
47307
47468
|
}
|
|
47308
47469
|
function sha256(value) {
|
|
47309
|
-
return (0,
|
|
47470
|
+
return (0, import_node_crypto18.createHash)("sha256").update(canonicalJson(value)).digest("hex");
|
|
47310
47471
|
}
|
|
47311
47472
|
function sameEvidenceDetail(detail, taskId, result, impacts, eventKey, beliefOwner) {
|
|
47312
47473
|
const storedOwner = detail.beliefOwner;
|
|
@@ -49388,7 +49549,7 @@ function createTaskLifecycleService(deps) {
|
|
|
49388
49549
|
}
|
|
49389
49550
|
|
|
49390
49551
|
// src/services/TaskExecutionService.ts
|
|
49391
|
-
var
|
|
49552
|
+
var import_node_crypto20 = require("crypto");
|
|
49392
49553
|
var import_node_util3 = require("util");
|
|
49393
49554
|
var import_protocols53 = require("@axiom-lattice/protocols");
|
|
49394
49555
|
|
|
@@ -49744,13 +49905,13 @@ async function reconcileAllTenantTaskRuns(input) {
|
|
|
49744
49905
|
}
|
|
49745
49906
|
|
|
49746
49907
|
// src/services/taskRunLease.ts
|
|
49747
|
-
var
|
|
49908
|
+
var import_node_crypto19 = require("crypto");
|
|
49748
49909
|
function taskRunLeaseKey(taskId) {
|
|
49749
49910
|
return `task-run:${taskId}`;
|
|
49750
49911
|
}
|
|
49751
49912
|
async function tryAcquireTaskRun(input) {
|
|
49752
49913
|
const key6 = taskRunLeaseKey(input.taskId);
|
|
49753
|
-
const holder = `${input.owner}#${(0,
|
|
49914
|
+
const holder = `${input.owner}#${(0, import_node_crypto19.randomUUID)()}`;
|
|
49754
49915
|
if (!await input.store.tryAcquire(key6, holder, input.ttlMs)) return null;
|
|
49755
49916
|
const heartbeatMs = input.heartbeatMs ?? Math.max(1e3, Math.floor(input.ttlMs / 3));
|
|
49756
49917
|
let released = false;
|
|
@@ -50170,11 +50331,11 @@ function createTaskExecutionService(deps) {
|
|
|
50170
50331
|
let threadId;
|
|
50171
50332
|
let runId;
|
|
50172
50333
|
try {
|
|
50173
|
-
threadId = storedThreadId ?? (deps.createThreadId ??
|
|
50334
|
+
threadId = storedThreadId ?? (deps.createThreadId ?? import_node_crypto20.randomUUID)();
|
|
50174
50335
|
if (task.status === "interrupted" && reuseCurrentRun) {
|
|
50175
50336
|
runId = storedRunId;
|
|
50176
50337
|
} else if (task.status === "interrupted" || task.status === "failed") {
|
|
50177
|
-
runId = (deps.createRunId ??
|
|
50338
|
+
runId = (deps.createRunId ?? import_node_crypto20.randomUUID)();
|
|
50178
50339
|
}
|
|
50179
50340
|
} catch (error) {
|
|
50180
50341
|
return {
|
|
@@ -50454,11 +50615,11 @@ function createTaskExecutionService(deps) {
|
|
|
50454
50615
|
}
|
|
50455
50616
|
|
|
50456
50617
|
// src/services/leadership.ts
|
|
50457
|
-
var
|
|
50618
|
+
var import_node_crypto21 = require("crypto");
|
|
50458
50619
|
async function runAsLeader(store2, name, fn, options = {}) {
|
|
50459
50620
|
const key6 = `leader:${name}`;
|
|
50460
50621
|
const owner3 = options.owner ?? getReplicaId();
|
|
50461
|
-
const holder = `${owner3}#${(0,
|
|
50622
|
+
const holder = `${owner3}#${(0, import_node_crypto21.randomUUID)()}`;
|
|
50462
50623
|
const ttlMs = options.ttlMs ?? 6e4;
|
|
50463
50624
|
if (!await store2.tryAcquire(key6, holder, ttlMs)) return { ran: false };
|
|
50464
50625
|
const heartbeat = setInterval(() => {
|
|
@@ -56778,6 +56939,7 @@ var projectRoomPlugin = {
|
|
|
56778
56939
|
|
|
56779
56940
|
// src/middlewares/sandboxPluginsMiddleware.ts
|
|
56780
56941
|
var import_langchain87 = require("langchain");
|
|
56942
|
+
var import_langgraph14 = require("@langchain/langgraph");
|
|
56781
56943
|
var import_zod75 = require("zod");
|
|
56782
56944
|
var import_protocols62 = require("@axiom-lattice/protocols");
|
|
56783
56945
|
|
|
@@ -57312,7 +57474,7 @@ description: Field-by-field reference for plugin.json of a tenant sandbox plugin
|
|
|
57312
57474
|
| \`name\` / \`description\` | Display strings. |
|
|
57313
57475
|
| \`version\` | Non-empty string; bump it when files change so the hash refreshes. |
|
|
57314
57476
|
| \`tools[]\` | See below. Max 32 tools. |
|
|
57315
|
-
| \`connection\` | Optional;
|
|
57477
|
+
| \`connection\` | Optional; \`connection.fields[]\` uses \`{ key, type, title, widget?, required?, default?, enumValues?, helpText? }\` \u2014 \`title\` is the human-visible label (not \`label\`). See the sandbox-plugins-connection skill. |
|
|
57316
57478
|
| \`skills\` | Optional; keys must start with \`<type>-\`. |
|
|
57317
57479
|
| \`agents\` | The schema accepts it and tenant plugin agents are registered, but this is **not a supported authoring path** \u2014 do not declare it. Build standalone agents with the Agent Architect (\`agent-architecture\`/\`agent-build\`); built-in plugins may still use this field. |
|
|
57318
57480
|
|
|
@@ -57665,8 +57827,10 @@ The platform key belongs to a human. Before writing the real handler:
|
|
|
57665
57827
|
2. Write a temporary \`handlers/probe.js\` that reads \`PLUGIN_CONNECTION_FILE\`,
|
|
57666
57828
|
creates \`OpenMcpClient\` with the connection key, and prints
|
|
57667
57829
|
\`listTools()\` (name, description, inputSchema) as JSON.
|
|
57668
|
-
3.
|
|
57669
|
-
|
|
57830
|
+
3. Call \`list_connections\` first; if no usable connection exists, call
|
|
57831
|
+
\`request_connection { type, pluginKey, toolName, reason }\` \u2014 it opens an inline
|
|
57832
|
+
connection form in the chat. Never ask the user to type, paste, or share any
|
|
57833
|
+
secret (password, API key, token) in chat.
|
|
57670
57834
|
4. Run \`manage_plugin test\` with the real \`connectionKey\`, e.g.
|
|
57671
57835
|
\`{ "kind": "tool", "name": "probe", "input": {}, "connectionKey": "prod" }\`.
|
|
57672
57836
|
5. Read the returned tool list; use it to choose the downstream tool names and
|
|
@@ -57866,11 +58030,15 @@ main().catch((err) => {
|
|
|
57866
58030
|
});
|
|
57867
58031
|
\`\`\`
|
|
57868
58032
|
|
|
57869
|
-
### 3.
|
|
58033
|
+
### 3. Request the connection
|
|
57870
58034
|
|
|
57871
58035
|
- Call \`list_connections { type }\`.
|
|
57872
|
-
- If
|
|
57873
|
-
|
|
58036
|
+
- If no usable connection exists, call
|
|
58037
|
+
\`request_connection { type, pluginKey, toolName, reason }\`; it opens an inline
|
|
58038
|
+
connection form in the chat. Only a human can create the platform API key and
|
|
58039
|
+
fill the connection.
|
|
58040
|
+
- Never ask the user to type, paste, or share any secret (password, API key,
|
|
58041
|
+
token) in chat.
|
|
57874
58042
|
- Never claim PTC works until a real \`connectionKey\` test passes.
|
|
57875
58043
|
|
|
57876
58044
|
### 4. Test with a real connection
|
|
@@ -57989,8 +58157,8 @@ resolution path. See \`sandbox-plugins-handlers\` \u2192 "Dependencies".
|
|
|
57989
58157
|
| every input field missing / \`{}\` | parsed base64 \`PLUGIN_INPUT\` as plaintext and swallowed the error | decode base64 with a plaintext fallback; fail visibly |
|
|
57990
58158
|
| \`API_GATEWAY_URL\` empty | Gateway has no \`PUBLIC_GATEWAY_URL\` | ask a human to set it; do not guess a host |
|
|
57991
58159
|
| \`OPEN_API_TOKEN\` empty | expected in plugin handlers (cleared by design) | use the connection password field, never the env token |
|
|
57992
|
-
| \`token is required\` / \`OpenMcpConfigError\` | connection has no platform key |
|
|
57993
|
-
| \`OpenMcpAuthError\` / 401 | key disabled, rotated, or invalid |
|
|
58160
|
+
| \`token is required\` / \`OpenMcpConfigError\` | connection has no platform key | call \`request_connection\` (inline form) |
|
|
58161
|
+
| \`OpenMcpAuthError\` / 401 | key disabled, rotated, or invalid | call \`request_connection\` (inline form) to reconfigure |
|
|
57994
58162
|
| tool-not-found | key has no such domain/action | do not retry; fix the key grant |
|
|
57995
58163
|
| \`GRANT_DENIED\` | key lacks the action | do not retry; fix the key grant |
|
|
57996
58164
|
| \`CONNECTION_NOT_ALLOWED\` / \`RESOURCE_DENIED\` | \`selector.connections\` mismatch | use an allowed connection or fix the key scope |
|
|
@@ -58002,7 +58170,8 @@ If the plugin previously called \`OpenMcpClient.fromEnv()\`:
|
|
|
58002
58170
|
1. Add a password field to \`connection.fields\` (for example \`platformApiKey\`).
|
|
58003
58171
|
2. Read \`PLUGIN_CONNECTION_FILE.connection.platformApiKey\`.
|
|
58004
58172
|
3. Construct \`new OpenMcpClient({ url: process.env.API_GATEWAY_URL, token: ... })\`.
|
|
58005
|
-
4.
|
|
58173
|
+
4. If no usable connection exists, call
|
|
58174
|
+
\`request_connection { type, pluginKey, toolName, reason }\`.
|
|
58006
58175
|
5. Re-test with \`manage_plugin test\` + \`connectionKey\`.
|
|
58007
58176
|
|
|
58008
58177
|
\`fromEnv()\` still works for agent \`code_eval\`, not for plugin handlers.
|
|
@@ -58167,8 +58336,32 @@ description: Define connection fields and test/discover handlers for a tenant sa
|
|
|
58167
58336
|
|
|
58168
58337
|
# Connections
|
|
58169
58338
|
|
|
58170
|
-
Define \`connection.fields\` in plugin.json.
|
|
58171
|
-
|
|
58339
|
+
Define \`connection.fields\` in plugin.json. Each field is:
|
|
58340
|
+
|
|
58341
|
+
\`{ key, type, title, widget?, required?, default?, enumValues?, helpText? }\`
|
|
58342
|
+
|
|
58343
|
+
- \`key\` (required): the config key your handler reads from \`PLUGIN_CONNECTION_FILE\`.
|
|
58344
|
+
- \`type\` (required): \`"string"\`, \`"number"\`, \`"boolean"\`, or \`"password"\`.
|
|
58345
|
+
- \`title\` (required): the human-visible label shown in the connection form.
|
|
58346
|
+
Use the real field name (for example \`"API Key"\` or \`"Server URL"\`);
|
|
58347
|
+
never use a placeholder such as \`"label"\`, and never use \`label\` as the
|
|
58348
|
+
property name.
|
|
58349
|
+
- \`widget\` (optional): \`"input"\`, \`"password"\`, \`"select"\`, or \`"numberInput"\`.
|
|
58350
|
+
- \`required\` (optional boolean), \`default\` (optional value),
|
|
58351
|
+
\`enumValues\` (required for \`select\`; string array), \`helpText\` (optional string).
|
|
58352
|
+
|
|
58353
|
+
\`\`\`json
|
|
58354
|
+
{
|
|
58355
|
+
"connection": {
|
|
58356
|
+
"fields": [
|
|
58357
|
+
{ "key": "baseUrl", "type": "string", "title": "Server URL", "required": true },
|
|
58358
|
+
{ "key": "apiKey", "type": "password", "title": "API Key", "widget": "password", "required": true }
|
|
58359
|
+
]
|
|
58360
|
+
}
|
|
58361
|
+
}
|
|
58362
|
+
\`\`\`
|
|
58363
|
+
|
|
58364
|
+
Mark secrets as \`type: "password"\`.
|
|
58172
58365
|
|
|
58173
58366
|
The resolved connection is injected at execution time as an
|
|
58174
58367
|
\`{ connection?, connections? }\` envelope in a JSON file path passed through
|
|
@@ -58214,10 +58407,18 @@ Use the \`manage_plugin\` tool. The loop:
|
|
|
58214
58407
|
2. \`action: "validate"\` with \`{ type }\` \u2014 reads the plugin back **from the sandbox** and returns diagnostics (no writes). The files must already be on disk; a \`type\` with no files reports a read error.
|
|
58215
58408
|
3. If the plugin has \`connection.fields\` and a tool reads credentials: a **human**
|
|
58216
58409
|
must configure a connection of this plugin type. You cannot create credentials.
|
|
58217
|
-
Call \`list_connections { type }\` first \u2014 if
|
|
58218
|
-
|
|
58219
|
-
|
|
58220
|
-
the
|
|
58410
|
+
Call \`list_connections { type }\` first \u2014 if no usable connection exists, call
|
|
58411
|
+
\`request_connection { type, pluginKey, toolName, reason }\`; it opens an inline
|
|
58412
|
+
connection form in the chat. The human configures, tests, and saves it; you
|
|
58413
|
+
receive only the connection key and whether the test passed \u2014 never the
|
|
58414
|
+
secret values.
|
|
58415
|
+
Never ask the user to type, paste, or share any secret (password, API key,
|
|
58416
|
+
token) in chat. Do not claim the tool works until a real \`connectionKey\` test
|
|
58417
|
+
passes. If the human cancels, report it as unverified (missing credentials) and
|
|
58418
|
+
end the run; do not call \`request_connection\` again in this run.
|
|
58419
|
+
If you just authored or changed this plugin, call \`manage_plugin { action: "reload" }\`
|
|
58420
|
+
before \`request_connection\`; \`/api/middleware-types\` only sees the new connection
|
|
58421
|
+
schema after the catalog reloads.
|
|
58221
58422
|
4. \`action: "reload"\` \u2014 refresh the compiled catalog after writing/editing files (the catalog caches; an edited file is invisible to \`test\` until you reload).
|
|
58222
58423
|
5. \`action: "test"\` to exercise a handler without an LLM:
|
|
58223
58424
|
- Tool: \`{ type, target: { kind: "tool", name, input, connectionKey? } }\`
|
|
@@ -58411,13 +58612,22 @@ After the human confirms the design, author the plugin files directly with the f
|
|
|
58411
58612
|
the sandbox) \u2192 \`manage_plugin { action: "reload", type }\` (the catalog caches, so a
|
|
58412
58613
|
freshly written file is invisible to \`test\` until you reload) \u2192 \`manage_plugin
|
|
58413
58614
|
{ action: "test", type, target }\`.
|
|
58414
|
-
If a tool needs credentials,
|
|
58415
|
-
|
|
58416
|
-
|
|
58417
|
-
|
|
58418
|
-
|
|
58419
|
-
|
|
58420
|
-
|
|
58615
|
+
If a tool needs credentials, check \`list_connections\` first. If no usable
|
|
58616
|
+
connection exists, call \`request_connection { type, pluginKey, toolName, reason }\`
|
|
58617
|
+
\u2014 it opens an inline connection form in the chat. The human fills it in, tests
|
|
58618
|
+
it, and saves; you receive only the connection key and whether the test passed
|
|
58619
|
+
\u2014 never the secret values. If you just authored or changed this plugin, call
|
|
58620
|
+
\`manage_plugin { action: "reload" }\` before \`request_connection\`;
|
|
58621
|
+
\`/api/middleware-types\` only sees the new connection schema after the catalog
|
|
58622
|
+
reloads.
|
|
58623
|
+
Never ask the user to type, paste, or share any secret (password, API key,
|
|
58624
|
+
token) in chat. Only after a real \`connectionKey\` test passes may you call the
|
|
58625
|
+
tool verified; without it, report functionality as unverified (missing
|
|
58626
|
+
credentials), not as passing. If the human cancels, report it as unverified
|
|
58627
|
+
(missing credentials) and end the run; do not call \`request_connection\`
|
|
58628
|
+
again in this run. Use \`shell_exec\` (the tool provided by the \`code_eval\`
|
|
58629
|
+
middleware) to run \`node handlers/x.js\` for manual checks when reproducing a
|
|
58630
|
+
failure.
|
|
58421
58631
|
|
|
58422
58632
|
Deployment is human-gated: do NOT deploy on your own after the tests pass.
|
|
58423
58633
|
Only deploy when the human explicitly asks for it or approves it, then load
|
|
@@ -58616,6 +58826,21 @@ function tenantIdFrom(exeConfig) {
|
|
|
58616
58826
|
function errorText(err) {
|
|
58617
58827
|
return err instanceof Error ? err.message : String(err);
|
|
58618
58828
|
}
|
|
58829
|
+
function isRecord14(value) {
|
|
58830
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
58831
|
+
}
|
|
58832
|
+
function truncate2(value, max) {
|
|
58833
|
+
if (typeof value !== "string") return void 0;
|
|
58834
|
+
return value.length > max ? `${value.slice(0, max)}\u2026` : value;
|
|
58835
|
+
}
|
|
58836
|
+
function isProjectRoomRun2(request) {
|
|
58837
|
+
if (!isRecord14(request) || !isRecord14(request.runtime)) return false;
|
|
58838
|
+
const runtime = request.runtime;
|
|
58839
|
+
const configurable = isRecord14(runtime.configurable) ? runtime.configurable.runConfig : void 0;
|
|
58840
|
+
const context = isRecord14(runtime.context) ? runtime.context.runConfig : void 0;
|
|
58841
|
+
const runConfig = isRecord14(configurable) ? configurable : isRecord14(context) ? context : void 0;
|
|
58842
|
+
return isRecord14(runConfig?.projectRoom);
|
|
58843
|
+
}
|
|
58619
58844
|
function deploymentUnavailable(action) {
|
|
58620
58845
|
const error = `plugin deployment service is not configured; cannot ${action}. Resident plugin services are unavailable in this environment.`;
|
|
58621
58846
|
if (action === "undeploy") return JSON.stringify({ undeployed: false, error });
|
|
@@ -58652,6 +58877,13 @@ var managePluginSchema = import_zod75.z.object({
|
|
|
58652
58877
|
connectionKey: import_zod75.z.string().optional()
|
|
58653
58878
|
}).optional()
|
|
58654
58879
|
});
|
|
58880
|
+
var requestConnectionSchema = import_zod75.z.object({
|
|
58881
|
+
type: import_zod75.z.string().trim().min(1).max(120).describe("Plugin connection type (the plugin meta.type)."),
|
|
58882
|
+
pluginKey: import_zod75.z.string().optional().describe("Plugin type being built, for display only."),
|
|
58883
|
+
toolName: import_zod75.z.string().optional().describe("Tool that needs the connection, for display only."),
|
|
58884
|
+
reason: import_zod75.z.string().optional().describe("Short reason shown to the human."),
|
|
58885
|
+
suggestedKey: import_zod75.z.string().optional().describe("Optional connection key prefill.")
|
|
58886
|
+
});
|
|
58655
58887
|
var sandboxPluginsPlugin = {
|
|
58656
58888
|
meta: {
|
|
58657
58889
|
type: "sandbox-plugins",
|
|
@@ -59049,8 +59281,68 @@ var sandboxPluginsPlugin = {
|
|
|
59049
59281
|
description: "Author and manage tenant sandbox plugins (list/get/validate/create/delete/reload/test/backup/restore) and deploy/undeploy/status a plugin as a resident service.",
|
|
59050
59282
|
schema: managePluginSchema
|
|
59051
59283
|
}
|
|
59284
|
+
),
|
|
59285
|
+
markInternalTool(
|
|
59286
|
+
(0, import_langchain87.tool)(
|
|
59287
|
+
async (input) => JSON.stringify(input),
|
|
59288
|
+
{
|
|
59289
|
+
name: "request_connection",
|
|
59290
|
+
description: "Ask the human to configure a connection for the plugin being built. Use only when list_connections shows no usable connection. Opens an inline connection form in the chat; the human configures and tests the connector, and you receive only the connection key. Never ask the human to paste secrets into the chat. Call this tool alone, not in parallel with other tools.",
|
|
59291
|
+
schema: requestConnectionSchema
|
|
59292
|
+
}
|
|
59293
|
+
)
|
|
59052
59294
|
)
|
|
59053
|
-
]
|
|
59295
|
+
],
|
|
59296
|
+
wrapToolCall: async (request, handler) => {
|
|
59297
|
+
const toolCall = request.toolCall;
|
|
59298
|
+
if (toolCall?.name !== "request_connection") {
|
|
59299
|
+
return handler(request);
|
|
59300
|
+
}
|
|
59301
|
+
if (isProjectRoomRun2(request)) {
|
|
59302
|
+
return new import_langchain87.ToolMessage({
|
|
59303
|
+
content: "You are replying inside a project room, which has no interactive connection setup UI. Ask the user in plain text to configure the connection, then continue after their next message.",
|
|
59304
|
+
tool_call_id: toolCall.id,
|
|
59305
|
+
name: toolCall.name
|
|
59306
|
+
});
|
|
59307
|
+
}
|
|
59308
|
+
const parsed = requestConnectionSchema.safeParse(toolCall.args);
|
|
59309
|
+
if (!parsed.success) {
|
|
59310
|
+
return new import_langchain87.ToolMessage({
|
|
59311
|
+
content: `Invalid request_connection tool arguments: ${parsed.error.message}`,
|
|
59312
|
+
tool_call_id: toolCall.id,
|
|
59313
|
+
name: toolCall.name
|
|
59314
|
+
});
|
|
59315
|
+
}
|
|
59316
|
+
const input = parsed.data;
|
|
59317
|
+
const md = genUIMarkdown("connection_setup", {
|
|
59318
|
+
type: input.type,
|
|
59319
|
+
pluginKey: truncate2(input.pluginKey, 120),
|
|
59320
|
+
toolName: truncate2(input.toolName, 120),
|
|
59321
|
+
reason: truncate2(input.reason, 500),
|
|
59322
|
+
suggestedKey: truncate2(input.suggestedKey, 120)
|
|
59323
|
+
});
|
|
59324
|
+
const feedback = await (0, import_langgraph14.interrupt)(md);
|
|
59325
|
+
if (feedback?.action === "saved" && isRecord14(feedback.data)) {
|
|
59326
|
+
const connectionKey = feedback.data.connectionKey;
|
|
59327
|
+
if (typeof connectionKey === "string" && connectionKey.trim() !== "") {
|
|
59328
|
+
const testOk = feedback.data.testOk;
|
|
59329
|
+
const testPassed = testOk === true ? true : testOk === false ? false : null;
|
|
59330
|
+
return new import_langchain87.ToolMessage({
|
|
59331
|
+
content: JSON.stringify({
|
|
59332
|
+
connectionKey: connectionKey.trim(),
|
|
59333
|
+
testPassed
|
|
59334
|
+
}),
|
|
59335
|
+
tool_call_id: toolCall.id,
|
|
59336
|
+
name: toolCall.name
|
|
59337
|
+
});
|
|
59338
|
+
}
|
|
59339
|
+
}
|
|
59340
|
+
return new import_langchain87.ToolMessage({
|
|
59341
|
+
content: JSON.stringify({ cancelled: true }),
|
|
59342
|
+
tool_call_id: toolCall.id,
|
|
59343
|
+
name: toolCall.name
|
|
59344
|
+
});
|
|
59345
|
+
}
|
|
59054
59346
|
})
|
|
59055
59347
|
};
|
|
59056
59348
|
|
|
@@ -60417,11 +60709,11 @@ var INLINE_INPUT_LIMIT_BYTES2 = 48 * 1024;
|
|
|
60417
60709
|
var DEFAULT_HANDLER_TIMEOUT_MS = 6e4;
|
|
60418
60710
|
var MIN_HANDLER_TIMEOUT_MS = 1e3;
|
|
60419
60711
|
var MAX_HANDLER_TIMEOUT_MS = 3e5;
|
|
60420
|
-
function
|
|
60712
|
+
function isRecord15(value) {
|
|
60421
60713
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
60422
60714
|
}
|
|
60423
60715
|
function isEnvelope3(value) {
|
|
60424
|
-
return
|
|
60716
|
+
return isRecord15(value) && typeof value.ok === "boolean";
|
|
60425
60717
|
}
|
|
60426
60718
|
function parseHostArgs(argv) {
|
|
60427
60719
|
let type;
|
|
@@ -60503,7 +60795,7 @@ function normalizeEnvelope(parsed) {
|
|
|
60503
60795
|
}
|
|
60504
60796
|
|
|
60505
60797
|
// src/sandbox_plugin/host/pluginHostSource.ts
|
|
60506
|
-
var
|
|
60798
|
+
var import_node_crypto22 = require("crypto");
|
|
60507
60799
|
var PLUGIN_HOST_VERSION = "1.1.0";
|
|
60508
60800
|
var PLUGIN_HOST_SERVER_SOURCE = String.raw`#!/usr/bin/env node
|
|
60509
60801
|
"use strict";
|
|
@@ -60804,7 +61096,7 @@ server.listen(config.port, "0.0.0.0", function () {
|
|
|
60804
61096
|
});
|
|
60805
61097
|
`;
|
|
60806
61098
|
function pluginHostContentHash() {
|
|
60807
|
-
return (0,
|
|
61099
|
+
return (0, import_node_crypto22.createHash)("sha256").update(`${PLUGIN_HOST_VERSION}:${PLUGIN_HOST_SERVER_SOURCE}`).digest("hex").slice(0, 16);
|
|
60808
61100
|
}
|
|
60809
61101
|
|
|
60810
61102
|
// src/sandbox_plugin/host/pluginHostInstaller.ts
|
|
@@ -61216,16 +61508,16 @@ var IdRemapper = class {
|
|
|
61216
61508
|
};
|
|
61217
61509
|
|
|
61218
61510
|
// src/util/directRoomId.ts
|
|
61219
|
-
var
|
|
61511
|
+
var import_node_crypto23 = require("crypto");
|
|
61220
61512
|
function generateDirectHumanProjectId(tenantId2, workspaceId, userId1, userId2) {
|
|
61221
61513
|
const sortedUserIds = [userId1, userId2].sort();
|
|
61222
61514
|
const parts = [tenantId2, workspaceId, ...sortedUserIds];
|
|
61223
|
-
const hash = (0,
|
|
61515
|
+
const hash = (0, import_node_crypto23.createHash)("sha256").update(parts.join(":")).digest("hex");
|
|
61224
61516
|
return `direct_human_${hash}`;
|
|
61225
61517
|
}
|
|
61226
61518
|
function generateDirectBotProjectId(tenantId2, workspaceId, userId, assistantId) {
|
|
61227
61519
|
const parts = [tenantId2, workspaceId, userId, assistantId];
|
|
61228
|
-
const hash = (0,
|
|
61520
|
+
const hash = (0, import_node_crypto23.createHash)("sha256").update(parts.join(":")).digest("hex");
|
|
61229
61521
|
return `direct_bot_${hash}`;
|
|
61230
61522
|
}
|
|
61231
61523
|
function parseDirectRoomType(projectId) {
|
|
@@ -61280,6 +61572,8 @@ registerBuiltinPlugins();
|
|
|
61280
61572
|
DEFAULT_MODEL_EXTRA,
|
|
61281
61573
|
DEFAULT_RESIDENT_INVOKE_TIMEOUT_MS,
|
|
61282
61574
|
DEFAULT_SUMMARIZATION_TRIGGER_TOKENS,
|
|
61575
|
+
DEFAULT_TENANT_WORKSPACE_DESCRIPTION,
|
|
61576
|
+
DEFAULT_TENANT_WORKSPACE_NAME,
|
|
61283
61577
|
DEFAULT_TEXTS_EMBEDDING_PATH,
|
|
61284
61578
|
DaytonaInstance,
|
|
61285
61579
|
DaytonaProvider,
|
|
@@ -61553,6 +61847,7 @@ registerBuiltinPlugins();
|
|
|
61553
61847
|
createTaskMiddleware,
|
|
61554
61848
|
createTaskRunBridge,
|
|
61555
61849
|
createTaskRunLiveness,
|
|
61850
|
+
createTenantProvisioningService,
|
|
61556
61851
|
createTrustedAgentMessageDispatcher,
|
|
61557
61852
|
createUnknownToolHandlerMiddleware,
|
|
61558
61853
|
createWidgetMiddleware,
|