@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.mjs
CHANGED
|
@@ -622,6 +622,32 @@ var InMemoryThreadStore = class {
|
|
|
622
622
|
total: filtered.length
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
+
async listChannelSenders(tenantId2, channelInstallationId, limit) {
|
|
626
|
+
const tenantThreads = this.threads.get(tenantId2);
|
|
627
|
+
if (!tenantThreads) return [];
|
|
628
|
+
const bySender = /* @__PURE__ */ new Map();
|
|
629
|
+
for (const assistantThreads of tenantThreads.values()) {
|
|
630
|
+
for (const thread of assistantThreads.values()) {
|
|
631
|
+
const metadata = thread.metadata ?? {};
|
|
632
|
+
if (metadata.channelInstallationId !== channelInstallationId) continue;
|
|
633
|
+
if (typeof metadata.senderId !== "string" || !metadata.senderId) continue;
|
|
634
|
+
const existing = bySender.get(metadata.senderId);
|
|
635
|
+
if (existing && existing.lastSeenAt.getTime() >= thread.updatedAt.getTime()) {
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
bySender.set(metadata.senderId, {
|
|
639
|
+
senderId: metadata.senderId,
|
|
640
|
+
...typeof metadata.senderDisplayName === "string" && metadata.senderDisplayName ? { displayName: metadata.senderDisplayName } : {},
|
|
641
|
+
lastSeenAt: thread.updatedAt,
|
|
642
|
+
lastThreadId: thread.id
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
const bounded = Math.max(1, Math.min(200, Math.floor(limit)));
|
|
647
|
+
return [...bySender.values()].sort(
|
|
648
|
+
(left, right) => right.lastSeenAt.getTime() - left.lastSeenAt.getTime()
|
|
649
|
+
).slice(0, bounded);
|
|
650
|
+
}
|
|
625
651
|
/**
|
|
626
652
|
* Get a thread by ID for a specific tenant
|
|
627
653
|
*/
|
|
@@ -4466,6 +4492,8 @@ var InMemoryChannelInstallationStore = class {
|
|
|
4466
4492
|
config: { ...data.config },
|
|
4467
4493
|
enabled: data.enabled ?? true,
|
|
4468
4494
|
fallbackAgentId: data.fallbackAgentId,
|
|
4495
|
+
workspaceId: data.workspaceId,
|
|
4496
|
+
projectId: data.projectId,
|
|
4469
4497
|
rejectWhenNoBinding: data.rejectWhenNoBinding ?? true,
|
|
4470
4498
|
createdAt: now,
|
|
4471
4499
|
updatedAt: now
|
|
@@ -4489,7 +4517,9 @@ var InMemoryChannelInstallationStore = class {
|
|
|
4489
4517
|
name: updates.name !== void 0 ? updates.name : existing.name,
|
|
4490
4518
|
config: updates.config !== void 0 ? { ...existing.config, ...updates.config } : existing.config,
|
|
4491
4519
|
enabled: updates.enabled !== void 0 ? updates.enabled : existing.enabled,
|
|
4492
|
-
fallbackAgentId: updates.fallbackAgentId !== void 0 ? updates.fallbackAgentId : existing.fallbackAgentId,
|
|
4520
|
+
fallbackAgentId: updates.fallbackAgentId === null || updates.fallbackAgentId === "" ? void 0 : updates.fallbackAgentId !== void 0 ? updates.fallbackAgentId : existing.fallbackAgentId,
|
|
4521
|
+
workspaceId: updates.workspaceId === "" ? void 0 : updates.workspaceId !== void 0 ? updates.workspaceId : existing.workspaceId,
|
|
4522
|
+
projectId: updates.projectId === "" ? void 0 : updates.projectId !== void 0 ? updates.projectId : existing.projectId,
|
|
4493
4523
|
rejectWhenNoBinding: updates.rejectWhenNoBinding !== void 0 ? updates.rejectWhenNoBinding : existing.rejectWhenNoBinding,
|
|
4494
4524
|
updatedAt: /* @__PURE__ */ new Date()
|
|
4495
4525
|
};
|
|
@@ -4600,8 +4630,8 @@ var InMemoryBindingStore = class {
|
|
|
4600
4630
|
...existing,
|
|
4601
4631
|
agentId: patch.agentId ?? existing.agentId,
|
|
4602
4632
|
threadId: patch.threadId !== void 0 ? patch.threadId : existing.threadId,
|
|
4603
|
-
workspaceId: patch.workspaceId !== void 0 ? patch.workspaceId : existing.workspaceId,
|
|
4604
|
-
projectId: patch.projectId !== void 0 ? patch.projectId : existing.projectId,
|
|
4633
|
+
workspaceId: patch.workspaceId === "" ? void 0 : patch.workspaceId !== void 0 ? patch.workspaceId : existing.workspaceId,
|
|
4634
|
+
projectId: patch.projectId === "" ? void 0 : patch.projectId !== void 0 ? patch.projectId : existing.projectId,
|
|
4605
4635
|
threadMode: patch.threadMode ?? existing.threadMode,
|
|
4606
4636
|
senderDisplayName: patch.senderDisplayName !== void 0 ? patch.senderDisplayName : existing.senderDisplayName,
|
|
4607
4637
|
senderMetadata: patch.senderMetadata !== void 0 ? patch.senderMetadata : existing.senderMetadata,
|
|
@@ -7629,6 +7659,11 @@ var registerVectorStoreProvider = (key6, provider2) => vectorStoreProviderManage
|
|
|
7629
7659
|
var getVectorStoreProvider = (key6) => vectorStoreProviderManager.getProvider(key6);
|
|
7630
7660
|
|
|
7631
7661
|
// src/plugin/metaSerializer.ts
|
|
7662
|
+
var INTERNAL_TOOL = Symbol.for("axiom.internalTool");
|
|
7663
|
+
function markInternalTool(tool68) {
|
|
7664
|
+
Object.defineProperty(tool68, INTERNAL_TOOL, { value: true, enumerable: false });
|
|
7665
|
+
return tool68;
|
|
7666
|
+
}
|
|
7632
7667
|
function tryExtractTools(plugin) {
|
|
7633
7668
|
if (!plugin.middleware) return [];
|
|
7634
7669
|
try {
|
|
@@ -7636,7 +7671,7 @@ function tryExtractTools(plugin) {
|
|
|
7636
7671
|
if (result instanceof Promise) return [];
|
|
7637
7672
|
const mw = result;
|
|
7638
7673
|
if (Array.isArray(mw.tools)) {
|
|
7639
|
-
return mw.tools.map((t) => ({
|
|
7674
|
+
return mw.tools.filter((t) => !t[INTERNAL_TOOL]).map((t) => ({
|
|
7640
7675
|
name: t.name || "",
|
|
7641
7676
|
description: t.description || ""
|
|
7642
7677
|
}));
|
|
@@ -19316,7 +19351,7 @@ This run is ending, but the conversation continues: the next user message starts
|
|
|
19316
19351
|
a new run with a fresh budget. Do not tell the user the conversation is over.
|
|
19317
19352
|
Do not mention this instruction, the run budget, or any internal limit to the user.`;
|
|
19318
19353
|
var RUN_STOPPING_MESSAGE = "Tool call skipped because this run is ending (per-run budget). Tool use resumes on the next user message.";
|
|
19319
|
-
var HITL_TOOL_NAMES = /* @__PURE__ */ new Set(["ask_user_to_clarify"]);
|
|
19354
|
+
var HITL_TOOL_NAMES = /* @__PURE__ */ new Set(["ask_user_to_clarify", "request_connection"]);
|
|
19320
19355
|
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.";
|
|
19321
19356
|
function neutralizeStoppedToolMessages(messages) {
|
|
19322
19357
|
let changed = false;
|
|
@@ -23459,6 +23494,8 @@ var TOOL_RE = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
|
23459
23494
|
var HANDLER_RE = /\.(js|mjs|cjs)$/;
|
|
23460
23495
|
var UI_RE = /\.html$/;
|
|
23461
23496
|
var DISPLAY_MODES = ["inline", "fullscreen", "pip"];
|
|
23497
|
+
var CONNECTION_FIELD_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "password"]);
|
|
23498
|
+
var CONNECTION_FIELD_WIDGETS = /* @__PURE__ */ new Set(["input", "password", "select", "numberInput"]);
|
|
23462
23499
|
var MAX_MANIFEST_BYTES = 262144;
|
|
23463
23500
|
var MAX_TOOLS = 32;
|
|
23464
23501
|
var MAX_PLUGINS_PER_TENANT = 50;
|
|
@@ -23486,6 +23523,7 @@ function isSafeUiPath(path8) {
|
|
|
23486
23523
|
function validateSandboxPluginManifest(args) {
|
|
23487
23524
|
const diagnostics = [];
|
|
23488
23525
|
const error = (code, message, pluginType, tool68) => diagnostics.push({ level: "error", code, message, pluginType, tool: tool68 });
|
|
23526
|
+
const warning = (code, message, pluginType, tool68) => diagnostics.push({ level: "warning", code, message, pluginType, tool: tool68 });
|
|
23489
23527
|
const raw = args.raw;
|
|
23490
23528
|
if (!isRecord7(raw)) {
|
|
23491
23529
|
error("MANIFEST_NOT_OBJECT", "manifest must be a JSON object", args.dirName);
|
|
@@ -23698,8 +23736,92 @@ function validateSandboxPluginManifest(args) {
|
|
|
23698
23736
|
if (!Array.isArray(fields)) {
|
|
23699
23737
|
error("CONNECTION_INVALID", "connection.fields must be an array", type);
|
|
23700
23738
|
} else {
|
|
23739
|
+
const normalizedFields = [];
|
|
23740
|
+
fields.forEach((field, index) => {
|
|
23741
|
+
if (!isRecord7(field)) {
|
|
23742
|
+
error(
|
|
23743
|
+
"CONNECTION_FIELD_INVALID",
|
|
23744
|
+
`connection.fields[${index}] must be an object`,
|
|
23745
|
+
type
|
|
23746
|
+
);
|
|
23747
|
+
return;
|
|
23748
|
+
}
|
|
23749
|
+
const key6 = field.key;
|
|
23750
|
+
const fieldType = field.type;
|
|
23751
|
+
const title = field.title;
|
|
23752
|
+
if (typeof key6 !== "string" || key6.trim() === "") {
|
|
23753
|
+
error(
|
|
23754
|
+
"CONNECTION_FIELD_INVALID",
|
|
23755
|
+
`connection.fields[${index}] requires a non-empty string key`,
|
|
23756
|
+
type
|
|
23757
|
+
);
|
|
23758
|
+
return;
|
|
23759
|
+
}
|
|
23760
|
+
if (typeof fieldType !== "string" || !CONNECTION_FIELD_TYPES.has(fieldType)) {
|
|
23761
|
+
error(
|
|
23762
|
+
"CONNECTION_FIELD_INVALID",
|
|
23763
|
+
`connection.fields[${index}] (${key6}) type must be one of ${[
|
|
23764
|
+
...CONNECTION_FIELD_TYPES
|
|
23765
|
+
].join(", ")}`,
|
|
23766
|
+
type
|
|
23767
|
+
);
|
|
23768
|
+
return;
|
|
23769
|
+
}
|
|
23770
|
+
if (typeof title !== "string" || title.trim() === "") {
|
|
23771
|
+
error(
|
|
23772
|
+
"CONNECTION_FIELD_INVALID",
|
|
23773
|
+
`connection.fields[${index}] (${key6}) requires a non-empty string title (the human-visible label; use "title", not "label")`,
|
|
23774
|
+
type
|
|
23775
|
+
);
|
|
23776
|
+
return;
|
|
23777
|
+
}
|
|
23778
|
+
if (field.widget !== void 0 && (typeof field.widget !== "string" || !CONNECTION_FIELD_WIDGETS.has(field.widget))) {
|
|
23779
|
+
error(
|
|
23780
|
+
"CONNECTION_FIELD_INVALID",
|
|
23781
|
+
`connection.fields[${index}] (${key6}) widget must be one of ${[
|
|
23782
|
+
...CONNECTION_FIELD_WIDGETS
|
|
23783
|
+
].join(", ")}`,
|
|
23784
|
+
type
|
|
23785
|
+
);
|
|
23786
|
+
return;
|
|
23787
|
+
}
|
|
23788
|
+
if (field.required !== void 0 && typeof field.required !== "boolean") {
|
|
23789
|
+
error(
|
|
23790
|
+
"CONNECTION_FIELD_INVALID",
|
|
23791
|
+
`connection.fields[${index}] (${key6}) required must be a boolean`,
|
|
23792
|
+
type
|
|
23793
|
+
);
|
|
23794
|
+
return;
|
|
23795
|
+
}
|
|
23796
|
+
if (field.enumValues !== void 0 && (!Array.isArray(field.enumValues) || field.enumValues.some((value) => typeof value !== "string"))) {
|
|
23797
|
+
error(
|
|
23798
|
+
"CONNECTION_FIELD_INVALID",
|
|
23799
|
+
`connection.fields[${index}] (${key6}) enumValues must be an array of strings`,
|
|
23800
|
+
type
|
|
23801
|
+
);
|
|
23802
|
+
return;
|
|
23803
|
+
}
|
|
23804
|
+
if (field.helpText !== void 0 && typeof field.helpText !== "string") {
|
|
23805
|
+
error(
|
|
23806
|
+
"CONNECTION_FIELD_INVALID",
|
|
23807
|
+
`connection.fields[${index}] (${key6}) helpText must be a string`,
|
|
23808
|
+
type
|
|
23809
|
+
);
|
|
23810
|
+
return;
|
|
23811
|
+
}
|
|
23812
|
+
if (title.trim().toLowerCase() === "label" || title.trim() === key6) {
|
|
23813
|
+
warning(
|
|
23814
|
+
"CONNECTION_FIELD_TITLE_PLACEHOLDER",
|
|
23815
|
+
`connection.fields[${index}] (${key6}) title "${title}" looks like a placeholder; use the human-visible label (for example "API Key")`,
|
|
23816
|
+
type
|
|
23817
|
+
);
|
|
23818
|
+
}
|
|
23819
|
+
normalizedFields.push(
|
|
23820
|
+
field
|
|
23821
|
+
);
|
|
23822
|
+
});
|
|
23701
23823
|
const normalized = {
|
|
23702
|
-
fields
|
|
23824
|
+
fields: normalizedFields
|
|
23703
23825
|
};
|
|
23704
23826
|
if (typeof raw.connection.resourceLabel === "string") {
|
|
23705
23827
|
normalized.resourceLabel = raw.connection.resourceLabel;
|
|
@@ -26325,7 +26447,7 @@ function hasExpectedInterrupt(interrupts, expectedInterruptId) {
|
|
|
26325
26447
|
return interrupts.length === 1 && interrupts[0]?.interruptId === expectedInterruptId;
|
|
26326
26448
|
}
|
|
26327
26449
|
return interrupts.filter(
|
|
26328
|
-
(
|
|
26450
|
+
(interrupt6) => interrupt6.interruptId === expectedInterruptId
|
|
26329
26451
|
).length === 1;
|
|
26330
26452
|
}
|
|
26331
26453
|
function normalizeAgentInterrupts(state, threadId) {
|
|
@@ -26335,11 +26457,11 @@ function normalizeAgentInterrupts(state, threadId) {
|
|
|
26335
26457
|
if (!isRecord12(task) || !Array.isArray(task.interrupts)) return;
|
|
26336
26458
|
const rawTaskId = task.id;
|
|
26337
26459
|
const taskId = typeof rawTaskId === "string" || typeof rawTaskId === "number" ? String(rawTaskId) : void 0;
|
|
26338
|
-
task.interrupts.forEach((
|
|
26339
|
-
const record = isRecord12(
|
|
26460
|
+
task.interrupts.forEach((interrupt6, index) => {
|
|
26461
|
+
const record = isRecord12(interrupt6) ? interrupt6 : {};
|
|
26340
26462
|
const rawId = record.id;
|
|
26341
26463
|
const interruptId = typeof rawId === "string" || typeof rawId === "number" ? String(rawId) : `${taskId ?? `task-${taskIndex}`}:${index}`;
|
|
26342
|
-
const rawValue = isRecord12(
|
|
26464
|
+
const rawValue = isRecord12(interrupt6) ? record.value : interrupt6;
|
|
26343
26465
|
const fenced = parseFence(rawValue);
|
|
26344
26466
|
const value = fenced ? fenced.payload : rawValue;
|
|
26345
26467
|
let type;
|
|
@@ -30697,7 +30819,7 @@ var Agent = class {
|
|
|
30697
30819
|
try {
|
|
30698
30820
|
const state = await this.getCurrentState();
|
|
30699
30821
|
const durable = (state?.tasks ?? []).some(
|
|
30700
|
-
(task) => (task.interrupts ?? []).some((
|
|
30822
|
+
(task) => (task.interrupts ?? []).some((interrupt6) => interrupt6.id === interruptId)
|
|
30701
30823
|
);
|
|
30702
30824
|
if (durable) return;
|
|
30703
30825
|
} catch {
|
|
@@ -42647,7 +42769,7 @@ function parseJudgeVerdict(raw) {
|
|
|
42647
42769
|
}
|
|
42648
42770
|
}
|
|
42649
42771
|
var MAX_INTERRUPT_RESUMES = 5;
|
|
42650
|
-
function resolveInterruptResponse(policy,
|
|
42772
|
+
function resolveInterruptResponse(policy, interrupt6) {
|
|
42651
42773
|
if (policy.mode === "auto-approve") return policy.value ?? "\u540C\u610F";
|
|
42652
42774
|
if (policy.mode === "auto-reject") return policy.value ?? "\u62D2\u7EDD";
|
|
42653
42775
|
return policy.value ?? "";
|
|
@@ -42749,31 +42871,31 @@ var _LatticeEval = class _LatticeEval {
|
|
|
42749
42871
|
let pendingInterrupt;
|
|
42750
42872
|
let interrupts = Array.isArray(result?.__interrupt__) ? result.__interrupt__ : [];
|
|
42751
42873
|
while (interrupts.length > 0) {
|
|
42752
|
-
const
|
|
42753
|
-
if (!
|
|
42874
|
+
const interrupt6 = interrupts[0];
|
|
42875
|
+
if (!interrupt6) break;
|
|
42754
42876
|
const policy = interruptPolicy;
|
|
42755
42877
|
if (!policy || policy.mode === "stop" || resumeCount >= MAX_INTERRUPT_RESUMES) {
|
|
42756
|
-
pendingInterrupt =
|
|
42878
|
+
pendingInterrupt = interrupt6;
|
|
42757
42879
|
break;
|
|
42758
42880
|
}
|
|
42759
|
-
const response = resolveInterruptResponse(policy,
|
|
42881
|
+
const response = resolveInterruptResponse(policy, interrupt6);
|
|
42760
42882
|
hitlEvents.push({
|
|
42761
42883
|
type: "interrupt",
|
|
42762
|
-
id:
|
|
42763
|
-
value:
|
|
42884
|
+
id: interrupt6.id,
|
|
42885
|
+
value: interrupt6.value
|
|
42764
42886
|
});
|
|
42765
42887
|
this.log("Auto-resolving HITL interrupt", {
|
|
42766
42888
|
agent_id: step.agent_id,
|
|
42767
42889
|
thread_id: threadId,
|
|
42768
42890
|
mode: policy.mode,
|
|
42769
|
-
interrupt_id:
|
|
42891
|
+
interrupt_id: interrupt6.id,
|
|
42770
42892
|
response,
|
|
42771
42893
|
resume_count: resumeCount + 1
|
|
42772
42894
|
});
|
|
42773
42895
|
result = await agent.invokeWithState({ input: stepInput, command: { resume: response } });
|
|
42774
42896
|
hitlEvents.push({
|
|
42775
42897
|
type: "interrupt_response",
|
|
42776
|
-
id:
|
|
42898
|
+
id: interrupt6.id,
|
|
42777
42899
|
mode: policy.mode,
|
|
42778
42900
|
response
|
|
42779
42901
|
});
|
|
@@ -42870,7 +42992,7 @@ var _LatticeEval = class _LatticeEval {
|
|
|
42870
42992
|
});
|
|
42871
42993
|
let currentThreadId = threadId;
|
|
42872
42994
|
let lastResponseData = null;
|
|
42873
|
-
let
|
|
42995
|
+
let interrupt6;
|
|
42874
42996
|
for (const step of evalCase.steps) {
|
|
42875
42997
|
const result = await this.executeAgentStep(
|
|
42876
42998
|
step,
|
|
@@ -42936,10 +43058,10 @@ ${toolCallStr}` : toolCallStr;
|
|
|
42936
43058
|
}
|
|
42937
43059
|
}
|
|
42938
43060
|
if (result.interrupted) {
|
|
42939
|
-
|
|
43061
|
+
interrupt6 = result.interrupt;
|
|
42940
43062
|
this.log("Case paused for HITL \u2014 remaining steps skipped; judge will evaluate the pause", {
|
|
42941
43063
|
case_id: evalCase.caseId,
|
|
42942
|
-
interrupt_id:
|
|
43064
|
+
interrupt_id: interrupt6?.id
|
|
42943
43065
|
});
|
|
42944
43066
|
break;
|
|
42945
43067
|
}
|
|
@@ -42949,7 +43071,7 @@ ${toolCallStr}` : toolCallStr;
|
|
|
42949
43071
|
final_thread_id: currentThreadId,
|
|
42950
43072
|
message_count: this.lastMessages.length
|
|
42951
43073
|
});
|
|
42952
|
-
const finalOutput =
|
|
43074
|
+
const finalOutput = interrupt6 ? typeof interrupt6.value === "string" ? interrupt6.value : JSON.stringify(interrupt6.value ?? "") : this.extractFinalMessage(lastResponseData);
|
|
42953
43075
|
this.lastFinalOutput = finalOutput;
|
|
42954
43076
|
const trajectory = this.buildTrajectory();
|
|
42955
43077
|
this.log("Final output extracted", {
|
|
@@ -43169,8 +43291,8 @@ Note: if final_score >= 80 and there are no fatal errors, pass should be true; o
|
|
|
43169
43291
|
final_score: finalScore,
|
|
43170
43292
|
dimension_results: dimensionResults,
|
|
43171
43293
|
summary: parsedResult.summary || testResultContent,
|
|
43172
|
-
interrupted:
|
|
43173
|
-
interrupt:
|
|
43294
|
+
interrupted: interrupt6 ? true : void 0,
|
|
43295
|
+
interrupt: interrupt6 ? { id: interrupt6.id, value: interrupt6.value } : void 0
|
|
43174
43296
|
};
|
|
43175
43297
|
}
|
|
43176
43298
|
};
|
|
@@ -44211,6 +44333,42 @@ var ProjectMutationMutex = class {
|
|
|
44211
44333
|
};
|
|
44212
44334
|
var projectMutationMutex = new ProjectMutationMutex();
|
|
44213
44335
|
|
|
44336
|
+
// src/services/TenantProvisioningService.ts
|
|
44337
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
44338
|
+
var DEFAULT_TENANT_WORKSPACE_NAME = "Default Workspace";
|
|
44339
|
+
var DEFAULT_TENANT_WORKSPACE_DESCRIPTION = "Default workspace created automatically for this tenant";
|
|
44340
|
+
function createTenantProvisioningService(deps) {
|
|
44341
|
+
const newId = deps.idFactory ?? randomUUID16;
|
|
44342
|
+
const defaults = deps.workspaceDefaults ?? {};
|
|
44343
|
+
return {
|
|
44344
|
+
async create(id, data) {
|
|
44345
|
+
const tenant = await deps.tenantStore.createTenant(id, data);
|
|
44346
|
+
try {
|
|
44347
|
+
await deps.workspaceStore.createWorkspace(tenant.id, newId(), {
|
|
44348
|
+
name: defaults.name ?? DEFAULT_TENANT_WORKSPACE_NAME,
|
|
44349
|
+
description: defaults.description ?? DEFAULT_TENANT_WORKSPACE_DESCRIPTION,
|
|
44350
|
+
storageType: defaults.storageType ?? "sandbox"
|
|
44351
|
+
});
|
|
44352
|
+
} catch (error) {
|
|
44353
|
+
try {
|
|
44354
|
+
await deps.tenantStore.deleteTenant(tenant.id);
|
|
44355
|
+
} catch (rollbackError) {
|
|
44356
|
+
deps.logger?.warn?.(
|
|
44357
|
+
"Tenant rollback after workspace failure failed",
|
|
44358
|
+
{
|
|
44359
|
+
tenantId: tenant.id,
|
|
44360
|
+
error: error instanceof Error ? error.message : String(error),
|
|
44361
|
+
rollbackError: rollbackError instanceof Error ? rollbackError.message : String(rollbackError)
|
|
44362
|
+
}
|
|
44363
|
+
);
|
|
44364
|
+
}
|
|
44365
|
+
throw error;
|
|
44366
|
+
}
|
|
44367
|
+
return tenant;
|
|
44368
|
+
}
|
|
44369
|
+
};
|
|
44370
|
+
}
|
|
44371
|
+
|
|
44214
44372
|
// src/services/TrustedAgentDispatcher.ts
|
|
44215
44373
|
function createTrustedAgentMessageDispatcher(resolve4) {
|
|
44216
44374
|
return {
|
|
@@ -44219,7 +44377,7 @@ function createTrustedAgentMessageDispatcher(resolve4) {
|
|
|
44219
44377
|
}
|
|
44220
44378
|
|
|
44221
44379
|
// src/services/RoomAgentMessageService.ts
|
|
44222
|
-
import { randomUUID as
|
|
44380
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
44223
44381
|
import { snapshotExactArray, snapshotExactRecord as snapshotExactRecord5 } from "@axiom-lattice/protocols";
|
|
44224
44382
|
var INPUT_KEYS = [
|
|
44225
44383
|
"tenantId",
|
|
@@ -44309,7 +44467,7 @@ var RoomAgentMessageService = class {
|
|
|
44309
44467
|
throw new Error("Invalid project room membership");
|
|
44310
44468
|
}
|
|
44311
44469
|
const candidate = {
|
|
44312
|
-
id: (this.deps.idFactory ??
|
|
44470
|
+
id: (this.deps.idFactory ?? randomUUID17)(),
|
|
44313
44471
|
tenantId: member.tenantId,
|
|
44314
44472
|
workspaceId: member.workspaceId,
|
|
44315
44473
|
projectId: member.projectId,
|
|
@@ -44352,7 +44510,7 @@ var RoomAgentMessageService = class {
|
|
|
44352
44510
|
throw new Error("Invalid project room membership");
|
|
44353
44511
|
}
|
|
44354
44512
|
const candidate = {
|
|
44355
|
-
id: (this.deps.idFactory ??
|
|
44513
|
+
id: (this.deps.idFactory ?? randomUUID17)(),
|
|
44356
44514
|
tenantId: input.tenantId,
|
|
44357
44515
|
workspaceId: input.workspaceId,
|
|
44358
44516
|
projectId: input.projectId,
|
|
@@ -47280,7 +47438,7 @@ function createTaskLifecycleService(deps) {
|
|
|
47280
47438
|
}
|
|
47281
47439
|
|
|
47282
47440
|
// src/services/TaskExecutionService.ts
|
|
47283
|
-
import { randomUUID as
|
|
47441
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
47284
47442
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
|
|
47285
47443
|
import { isExecutionResultEventKey as isExecutionResultEventKey2 } from "@axiom-lattice/protocols";
|
|
47286
47444
|
|
|
@@ -47636,13 +47794,13 @@ async function reconcileAllTenantTaskRuns(input) {
|
|
|
47636
47794
|
}
|
|
47637
47795
|
|
|
47638
47796
|
// src/services/taskRunLease.ts
|
|
47639
|
-
import { randomUUID as
|
|
47797
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
47640
47798
|
function taskRunLeaseKey(taskId) {
|
|
47641
47799
|
return `task-run:${taskId}`;
|
|
47642
47800
|
}
|
|
47643
47801
|
async function tryAcquireTaskRun(input) {
|
|
47644
47802
|
const key6 = taskRunLeaseKey(input.taskId);
|
|
47645
|
-
const holder = `${input.owner}#${
|
|
47803
|
+
const holder = `${input.owner}#${randomUUID18()}`;
|
|
47646
47804
|
if (!await input.store.tryAcquire(key6, holder, input.ttlMs)) return null;
|
|
47647
47805
|
const heartbeatMs = input.heartbeatMs ?? Math.max(1e3, Math.floor(input.ttlMs / 3));
|
|
47648
47806
|
let released = false;
|
|
@@ -48062,11 +48220,11 @@ function createTaskExecutionService(deps) {
|
|
|
48062
48220
|
let threadId;
|
|
48063
48221
|
let runId;
|
|
48064
48222
|
try {
|
|
48065
|
-
threadId = storedThreadId ?? (deps.createThreadId ??
|
|
48223
|
+
threadId = storedThreadId ?? (deps.createThreadId ?? randomUUID19)();
|
|
48066
48224
|
if (task.status === "interrupted" && reuseCurrentRun) {
|
|
48067
48225
|
runId = storedRunId;
|
|
48068
48226
|
} else if (task.status === "interrupted" || task.status === "failed") {
|
|
48069
|
-
runId = (deps.createRunId ??
|
|
48227
|
+
runId = (deps.createRunId ?? randomUUID19)();
|
|
48070
48228
|
}
|
|
48071
48229
|
} catch (error) {
|
|
48072
48230
|
return {
|
|
@@ -48346,11 +48504,11 @@ function createTaskExecutionService(deps) {
|
|
|
48346
48504
|
}
|
|
48347
48505
|
|
|
48348
48506
|
// src/services/leadership.ts
|
|
48349
|
-
import { randomUUID as
|
|
48507
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
48350
48508
|
async function runAsLeader(store2, name, fn, options = {}) {
|
|
48351
48509
|
const key6 = `leader:${name}`;
|
|
48352
48510
|
const owner3 = options.owner ?? getReplicaId();
|
|
48353
|
-
const holder = `${owner3}#${
|
|
48511
|
+
const holder = `${owner3}#${randomUUID20()}`;
|
|
48354
48512
|
const ttlMs = options.ttlMs ?? 6e4;
|
|
48355
48513
|
if (!await store2.tryAcquire(key6, holder, ttlMs)) return { ran: false };
|
|
48356
48514
|
const heartbeat = setInterval(() => {
|
|
@@ -54679,7 +54837,8 @@ var projectRoomPlugin = {
|
|
|
54679
54837
|
};
|
|
54680
54838
|
|
|
54681
54839
|
// src/middlewares/sandboxPluginsMiddleware.ts
|
|
54682
|
-
import { createMiddleware as createMiddleware28, tool as tool65 } from "langchain";
|
|
54840
|
+
import { createMiddleware as createMiddleware28, tool as tool65, ToolMessage as ToolMessage12 } from "langchain";
|
|
54841
|
+
import { interrupt as interrupt5 } from "@langchain/langgraph";
|
|
54683
54842
|
import { z as z73 } from "zod";
|
|
54684
54843
|
import { AgentType as AgentType10 } from "@axiom-lattice/protocols";
|
|
54685
54844
|
|
|
@@ -55214,7 +55373,7 @@ description: Field-by-field reference for plugin.json of a tenant sandbox plugin
|
|
|
55214
55373
|
| \`name\` / \`description\` | Display strings. |
|
|
55215
55374
|
| \`version\` | Non-empty string; bump it when files change so the hash refreshes. |
|
|
55216
55375
|
| \`tools[]\` | See below. Max 32 tools. |
|
|
55217
|
-
| \`connection\` | Optional;
|
|
55376
|
+
| \`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. |
|
|
55218
55377
|
| \`skills\` | Optional; keys must start with \`<type>-\`. |
|
|
55219
55378
|
| \`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. |
|
|
55220
55379
|
|
|
@@ -55567,8 +55726,10 @@ The platform key belongs to a human. Before writing the real handler:
|
|
|
55567
55726
|
2. Write a temporary \`handlers/probe.js\` that reads \`PLUGIN_CONNECTION_FILE\`,
|
|
55568
55727
|
creates \`OpenMcpClient\` with the connection key, and prints
|
|
55569
55728
|
\`listTools()\` (name, description, inputSchema) as JSON.
|
|
55570
|
-
3.
|
|
55571
|
-
|
|
55729
|
+
3. Call \`list_connections\` first; if no usable connection exists, call
|
|
55730
|
+
\`request_connection { type, pluginKey, toolName, reason }\` \u2014 it opens an inline
|
|
55731
|
+
connection form in the chat. Never ask the user to type, paste, or share any
|
|
55732
|
+
secret (password, API key, token) in chat.
|
|
55572
55733
|
4. Run \`manage_plugin test\` with the real \`connectionKey\`, e.g.
|
|
55573
55734
|
\`{ "kind": "tool", "name": "probe", "input": {}, "connectionKey": "prod" }\`.
|
|
55574
55735
|
5. Read the returned tool list; use it to choose the downstream tool names and
|
|
@@ -55768,11 +55929,15 @@ main().catch((err) => {
|
|
|
55768
55929
|
});
|
|
55769
55930
|
\`\`\`
|
|
55770
55931
|
|
|
55771
|
-
### 3.
|
|
55932
|
+
### 3. Request the connection
|
|
55772
55933
|
|
|
55773
55934
|
- Call \`list_connections { type }\`.
|
|
55774
|
-
- If
|
|
55775
|
-
|
|
55935
|
+
- If no usable connection exists, call
|
|
55936
|
+
\`request_connection { type, pluginKey, toolName, reason }\`; it opens an inline
|
|
55937
|
+
connection form in the chat. Only a human can create the platform API key and
|
|
55938
|
+
fill the connection.
|
|
55939
|
+
- Never ask the user to type, paste, or share any secret (password, API key,
|
|
55940
|
+
token) in chat.
|
|
55776
55941
|
- Never claim PTC works until a real \`connectionKey\` test passes.
|
|
55777
55942
|
|
|
55778
55943
|
### 4. Test with a real connection
|
|
@@ -55891,8 +56056,8 @@ resolution path. See \`sandbox-plugins-handlers\` \u2192 "Dependencies".
|
|
|
55891
56056
|
| every input field missing / \`{}\` | parsed base64 \`PLUGIN_INPUT\` as plaintext and swallowed the error | decode base64 with a plaintext fallback; fail visibly |
|
|
55892
56057
|
| \`API_GATEWAY_URL\` empty | Gateway has no \`PUBLIC_GATEWAY_URL\` | ask a human to set it; do not guess a host |
|
|
55893
56058
|
| \`OPEN_API_TOKEN\` empty | expected in plugin handlers (cleared by design) | use the connection password field, never the env token |
|
|
55894
|
-
| \`token is required\` / \`OpenMcpConfigError\` | connection has no platform key |
|
|
55895
|
-
| \`OpenMcpAuthError\` / 401 | key disabled, rotated, or invalid |
|
|
56059
|
+
| \`token is required\` / \`OpenMcpConfigError\` | connection has no platform key | call \`request_connection\` (inline form) |
|
|
56060
|
+
| \`OpenMcpAuthError\` / 401 | key disabled, rotated, or invalid | call \`request_connection\` (inline form) to reconfigure |
|
|
55896
56061
|
| tool-not-found | key has no such domain/action | do not retry; fix the key grant |
|
|
55897
56062
|
| \`GRANT_DENIED\` | key lacks the action | do not retry; fix the key grant |
|
|
55898
56063
|
| \`CONNECTION_NOT_ALLOWED\` / \`RESOURCE_DENIED\` | \`selector.connections\` mismatch | use an allowed connection or fix the key scope |
|
|
@@ -55904,7 +56069,8 @@ If the plugin previously called \`OpenMcpClient.fromEnv()\`:
|
|
|
55904
56069
|
1. Add a password field to \`connection.fields\` (for example \`platformApiKey\`).
|
|
55905
56070
|
2. Read \`PLUGIN_CONNECTION_FILE.connection.platformApiKey\`.
|
|
55906
56071
|
3. Construct \`new OpenMcpClient({ url: process.env.API_GATEWAY_URL, token: ... })\`.
|
|
55907
|
-
4.
|
|
56072
|
+
4. If no usable connection exists, call
|
|
56073
|
+
\`request_connection { type, pluginKey, toolName, reason }\`.
|
|
55908
56074
|
5. Re-test with \`manage_plugin test\` + \`connectionKey\`.
|
|
55909
56075
|
|
|
55910
56076
|
\`fromEnv()\` still works for agent \`code_eval\`, not for plugin handlers.
|
|
@@ -56069,8 +56235,32 @@ description: Define connection fields and test/discover handlers for a tenant sa
|
|
|
56069
56235
|
|
|
56070
56236
|
# Connections
|
|
56071
56237
|
|
|
56072
|
-
Define \`connection.fields\` in plugin.json.
|
|
56073
|
-
|
|
56238
|
+
Define \`connection.fields\` in plugin.json. Each field is:
|
|
56239
|
+
|
|
56240
|
+
\`{ key, type, title, widget?, required?, default?, enumValues?, helpText? }\`
|
|
56241
|
+
|
|
56242
|
+
- \`key\` (required): the config key your handler reads from \`PLUGIN_CONNECTION_FILE\`.
|
|
56243
|
+
- \`type\` (required): \`"string"\`, \`"number"\`, \`"boolean"\`, or \`"password"\`.
|
|
56244
|
+
- \`title\` (required): the human-visible label shown in the connection form.
|
|
56245
|
+
Use the real field name (for example \`"API Key"\` or \`"Server URL"\`);
|
|
56246
|
+
never use a placeholder such as \`"label"\`, and never use \`label\` as the
|
|
56247
|
+
property name.
|
|
56248
|
+
- \`widget\` (optional): \`"input"\`, \`"password"\`, \`"select"\`, or \`"numberInput"\`.
|
|
56249
|
+
- \`required\` (optional boolean), \`default\` (optional value),
|
|
56250
|
+
\`enumValues\` (required for \`select\`; string array), \`helpText\` (optional string).
|
|
56251
|
+
|
|
56252
|
+
\`\`\`json
|
|
56253
|
+
{
|
|
56254
|
+
"connection": {
|
|
56255
|
+
"fields": [
|
|
56256
|
+
{ "key": "baseUrl", "type": "string", "title": "Server URL", "required": true },
|
|
56257
|
+
{ "key": "apiKey", "type": "password", "title": "API Key", "widget": "password", "required": true }
|
|
56258
|
+
]
|
|
56259
|
+
}
|
|
56260
|
+
}
|
|
56261
|
+
\`\`\`
|
|
56262
|
+
|
|
56263
|
+
Mark secrets as \`type: "password"\`.
|
|
56074
56264
|
|
|
56075
56265
|
The resolved connection is injected at execution time as an
|
|
56076
56266
|
\`{ connection?, connections? }\` envelope in a JSON file path passed through
|
|
@@ -56116,10 +56306,18 @@ Use the \`manage_plugin\` tool. The loop:
|
|
|
56116
56306
|
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.
|
|
56117
56307
|
3. If the plugin has \`connection.fields\` and a tool reads credentials: a **human**
|
|
56118
56308
|
must configure a connection of this plugin type. You cannot create credentials.
|
|
56119
|
-
Call \`list_connections { type }\` first \u2014 if
|
|
56120
|
-
|
|
56121
|
-
|
|
56122
|
-
the
|
|
56309
|
+
Call \`list_connections { type }\` first \u2014 if no usable connection exists, call
|
|
56310
|
+
\`request_connection { type, pluginKey, toolName, reason }\`; it opens an inline
|
|
56311
|
+
connection form in the chat. The human configures, tests, and saves it; you
|
|
56312
|
+
receive only the connection key and whether the test passed \u2014 never the
|
|
56313
|
+
secret values.
|
|
56314
|
+
Never ask the user to type, paste, or share any secret (password, API key,
|
|
56315
|
+
token) in chat. Do not claim the tool works until a real \`connectionKey\` test
|
|
56316
|
+
passes. If the human cancels, report it as unverified (missing credentials) and
|
|
56317
|
+
end the run; do not call \`request_connection\` again in this run.
|
|
56318
|
+
If you just authored or changed this plugin, call \`manage_plugin { action: "reload" }\`
|
|
56319
|
+
before \`request_connection\`; \`/api/middleware-types\` only sees the new connection
|
|
56320
|
+
schema after the catalog reloads.
|
|
56123
56321
|
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).
|
|
56124
56322
|
5. \`action: "test"\` to exercise a handler without an LLM:
|
|
56125
56323
|
- Tool: \`{ type, target: { kind: "tool", name, input, connectionKey? } }\`
|
|
@@ -56313,13 +56511,22 @@ After the human confirms the design, author the plugin files directly with the f
|
|
|
56313
56511
|
the sandbox) \u2192 \`manage_plugin { action: "reload", type }\` (the catalog caches, so a
|
|
56314
56512
|
freshly written file is invisible to \`test\` until you reload) \u2192 \`manage_plugin
|
|
56315
56513
|
{ action: "test", type, target }\`.
|
|
56316
|
-
If a tool needs credentials,
|
|
56317
|
-
|
|
56318
|
-
|
|
56319
|
-
|
|
56320
|
-
|
|
56321
|
-
|
|
56322
|
-
|
|
56514
|
+
If a tool needs credentials, check \`list_connections\` first. If no usable
|
|
56515
|
+
connection exists, call \`request_connection { type, pluginKey, toolName, reason }\`
|
|
56516
|
+
\u2014 it opens an inline connection form in the chat. The human fills it in, tests
|
|
56517
|
+
it, and saves; you receive only the connection key and whether the test passed
|
|
56518
|
+
\u2014 never the secret values. If you just authored or changed this plugin, call
|
|
56519
|
+
\`manage_plugin { action: "reload" }\` before \`request_connection\`;
|
|
56520
|
+
\`/api/middleware-types\` only sees the new connection schema after the catalog
|
|
56521
|
+
reloads.
|
|
56522
|
+
Never ask the user to type, paste, or share any secret (password, API key,
|
|
56523
|
+
token) in chat. Only after a real \`connectionKey\` test passes may you call the
|
|
56524
|
+
tool verified; without it, report functionality as unverified (missing
|
|
56525
|
+
credentials), not as passing. If the human cancels, report it as unverified
|
|
56526
|
+
(missing credentials) and end the run; do not call \`request_connection\`
|
|
56527
|
+
again in this run. Use \`shell_exec\` (the tool provided by the \`code_eval\`
|
|
56528
|
+
middleware) to run \`node handlers/x.js\` for manual checks when reproducing a
|
|
56529
|
+
failure.
|
|
56323
56530
|
|
|
56324
56531
|
Deployment is human-gated: do NOT deploy on your own after the tests pass.
|
|
56325
56532
|
Only deploy when the human explicitly asks for it or approves it, then load
|
|
@@ -56518,6 +56725,21 @@ function tenantIdFrom(exeConfig) {
|
|
|
56518
56725
|
function errorText(err) {
|
|
56519
56726
|
return err instanceof Error ? err.message : String(err);
|
|
56520
56727
|
}
|
|
56728
|
+
function isRecord14(value) {
|
|
56729
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
56730
|
+
}
|
|
56731
|
+
function truncate2(value, max) {
|
|
56732
|
+
if (typeof value !== "string") return void 0;
|
|
56733
|
+
return value.length > max ? `${value.slice(0, max)}\u2026` : value;
|
|
56734
|
+
}
|
|
56735
|
+
function isProjectRoomRun2(request) {
|
|
56736
|
+
if (!isRecord14(request) || !isRecord14(request.runtime)) return false;
|
|
56737
|
+
const runtime = request.runtime;
|
|
56738
|
+
const configurable = isRecord14(runtime.configurable) ? runtime.configurable.runConfig : void 0;
|
|
56739
|
+
const context = isRecord14(runtime.context) ? runtime.context.runConfig : void 0;
|
|
56740
|
+
const runConfig = isRecord14(configurable) ? configurable : isRecord14(context) ? context : void 0;
|
|
56741
|
+
return isRecord14(runConfig?.projectRoom);
|
|
56742
|
+
}
|
|
56521
56743
|
function deploymentUnavailable(action) {
|
|
56522
56744
|
const error = `plugin deployment service is not configured; cannot ${action}. Resident plugin services are unavailable in this environment.`;
|
|
56523
56745
|
if (action === "undeploy") return JSON.stringify({ undeployed: false, error });
|
|
@@ -56554,6 +56776,13 @@ var managePluginSchema = z73.object({
|
|
|
56554
56776
|
connectionKey: z73.string().optional()
|
|
56555
56777
|
}).optional()
|
|
56556
56778
|
});
|
|
56779
|
+
var requestConnectionSchema = z73.object({
|
|
56780
|
+
type: z73.string().trim().min(1).max(120).describe("Plugin connection type (the plugin meta.type)."),
|
|
56781
|
+
pluginKey: z73.string().optional().describe("Plugin type being built, for display only."),
|
|
56782
|
+
toolName: z73.string().optional().describe("Tool that needs the connection, for display only."),
|
|
56783
|
+
reason: z73.string().optional().describe("Short reason shown to the human."),
|
|
56784
|
+
suggestedKey: z73.string().optional().describe("Optional connection key prefill.")
|
|
56785
|
+
});
|
|
56557
56786
|
var sandboxPluginsPlugin = {
|
|
56558
56787
|
meta: {
|
|
56559
56788
|
type: "sandbox-plugins",
|
|
@@ -56951,8 +57180,68 @@ var sandboxPluginsPlugin = {
|
|
|
56951
57180
|
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.",
|
|
56952
57181
|
schema: managePluginSchema
|
|
56953
57182
|
}
|
|
57183
|
+
),
|
|
57184
|
+
markInternalTool(
|
|
57185
|
+
tool65(
|
|
57186
|
+
async (input) => JSON.stringify(input),
|
|
57187
|
+
{
|
|
57188
|
+
name: "request_connection",
|
|
57189
|
+
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.",
|
|
57190
|
+
schema: requestConnectionSchema
|
|
57191
|
+
}
|
|
57192
|
+
)
|
|
56954
57193
|
)
|
|
56955
|
-
]
|
|
57194
|
+
],
|
|
57195
|
+
wrapToolCall: async (request, handler) => {
|
|
57196
|
+
const toolCall = request.toolCall;
|
|
57197
|
+
if (toolCall?.name !== "request_connection") {
|
|
57198
|
+
return handler(request);
|
|
57199
|
+
}
|
|
57200
|
+
if (isProjectRoomRun2(request)) {
|
|
57201
|
+
return new ToolMessage12({
|
|
57202
|
+
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.",
|
|
57203
|
+
tool_call_id: toolCall.id,
|
|
57204
|
+
name: toolCall.name
|
|
57205
|
+
});
|
|
57206
|
+
}
|
|
57207
|
+
const parsed = requestConnectionSchema.safeParse(toolCall.args);
|
|
57208
|
+
if (!parsed.success) {
|
|
57209
|
+
return new ToolMessage12({
|
|
57210
|
+
content: `Invalid request_connection tool arguments: ${parsed.error.message}`,
|
|
57211
|
+
tool_call_id: toolCall.id,
|
|
57212
|
+
name: toolCall.name
|
|
57213
|
+
});
|
|
57214
|
+
}
|
|
57215
|
+
const input = parsed.data;
|
|
57216
|
+
const md = genUIMarkdown("connection_setup", {
|
|
57217
|
+
type: input.type,
|
|
57218
|
+
pluginKey: truncate2(input.pluginKey, 120),
|
|
57219
|
+
toolName: truncate2(input.toolName, 120),
|
|
57220
|
+
reason: truncate2(input.reason, 500),
|
|
57221
|
+
suggestedKey: truncate2(input.suggestedKey, 120)
|
|
57222
|
+
});
|
|
57223
|
+
const feedback = await interrupt5(md);
|
|
57224
|
+
if (feedback?.action === "saved" && isRecord14(feedback.data)) {
|
|
57225
|
+
const connectionKey = feedback.data.connectionKey;
|
|
57226
|
+
if (typeof connectionKey === "string" && connectionKey.trim() !== "") {
|
|
57227
|
+
const testOk = feedback.data.testOk;
|
|
57228
|
+
const testPassed = testOk === true ? true : testOk === false ? false : null;
|
|
57229
|
+
return new ToolMessage12({
|
|
57230
|
+
content: JSON.stringify({
|
|
57231
|
+
connectionKey: connectionKey.trim(),
|
|
57232
|
+
testPassed
|
|
57233
|
+
}),
|
|
57234
|
+
tool_call_id: toolCall.id,
|
|
57235
|
+
name: toolCall.name
|
|
57236
|
+
});
|
|
57237
|
+
}
|
|
57238
|
+
}
|
|
57239
|
+
return new ToolMessage12({
|
|
57240
|
+
content: JSON.stringify({ cancelled: true }),
|
|
57241
|
+
tool_call_id: toolCall.id,
|
|
57242
|
+
name: toolCall.name
|
|
57243
|
+
});
|
|
57244
|
+
}
|
|
56956
57245
|
})
|
|
56957
57246
|
};
|
|
56958
57247
|
|
|
@@ -58322,11 +58611,11 @@ var INLINE_INPUT_LIMIT_BYTES2 = 48 * 1024;
|
|
|
58322
58611
|
var DEFAULT_HANDLER_TIMEOUT_MS = 6e4;
|
|
58323
58612
|
var MIN_HANDLER_TIMEOUT_MS = 1e3;
|
|
58324
58613
|
var MAX_HANDLER_TIMEOUT_MS = 3e5;
|
|
58325
|
-
function
|
|
58614
|
+
function isRecord15(value) {
|
|
58326
58615
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
58327
58616
|
}
|
|
58328
58617
|
function isEnvelope3(value) {
|
|
58329
|
-
return
|
|
58618
|
+
return isRecord15(value) && typeof value.ok === "boolean";
|
|
58330
58619
|
}
|
|
58331
58620
|
function parseHostArgs(argv) {
|
|
58332
58621
|
let type;
|
|
@@ -59177,6 +59466,8 @@ export {
|
|
|
59177
59466
|
DEFAULT_MODEL_EXTRA,
|
|
59178
59467
|
DEFAULT_RESIDENT_INVOKE_TIMEOUT_MS,
|
|
59179
59468
|
DEFAULT_SUMMARIZATION_TRIGGER_TOKENS,
|
|
59469
|
+
DEFAULT_TENANT_WORKSPACE_DESCRIPTION,
|
|
59470
|
+
DEFAULT_TENANT_WORKSPACE_NAME,
|
|
59180
59471
|
DEFAULT_TEXTS_EMBEDDING_PATH,
|
|
59181
59472
|
DaytonaInstance,
|
|
59182
59473
|
DaytonaProvider,
|
|
@@ -59450,6 +59741,7 @@ export {
|
|
|
59450
59741
|
createTaskMiddleware,
|
|
59451
59742
|
createTaskRunBridge,
|
|
59452
59743
|
createTaskRunLiveness,
|
|
59744
|
+
createTenantProvisioningService,
|
|
59453
59745
|
createTrustedAgentMessageDispatcher,
|
|
59454
59746
|
createUnknownToolHandlerMiddleware,
|
|
59455
59747
|
createWidgetMiddleware,
|