negotium 0.22.2 → 0.22.3
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/agent-helpers.js +2 -2
- package/dist/agent-helpers.js.map +2 -2
- package/dist/{chunk-gzph93xn.js → chunk-6c637pwe.js} +2 -2
- package/dist/{chunk-gzph93xn.js.map → chunk-6c637pwe.js.map} +2 -2
- package/dist/hosted-agent.js +2 -2
- package/dist/hosted-agent.js.map +2 -2
- package/dist/main.js +9 -126
- package/dist/main.js.map +4 -4
- package/dist/mcp-factories.js +2 -2
- package/dist/mcp-factories.js.map +2 -2
- package/dist/registry.js +1 -1
- package/dist/runtime/src/runtime/inbox.ts +33 -171
- package/dist/runtime/src/version.ts +1 -1
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -6536,7 +6536,7 @@ var exports_version = {};
|
|
|
6536
6536
|
__export(exports_version, {
|
|
6537
6537
|
NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
|
|
6538
6538
|
});
|
|
6539
|
-
var NEGOTIUM_VERSION = "0.22.
|
|
6539
|
+
var NEGOTIUM_VERSION = "0.22.3";
|
|
6540
6540
|
|
|
6541
6541
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
6542
6542
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -7166,12 +7166,6 @@ var init_registry = __esm(async () => {
|
|
|
7166
7166
|
});
|
|
7167
7167
|
|
|
7168
7168
|
// ../../packages/core/src/agents/fork.ts
|
|
7169
|
-
var exports_fork = {};
|
|
7170
|
-
__export(exports_fork, {
|
|
7171
|
-
forkAgentSession: () => forkAgentSession,
|
|
7172
|
-
createAgentForkHelpers: () => createAgentForkHelpers,
|
|
7173
|
-
cleanupAgentFork: () => cleanupAgentFork
|
|
7174
|
-
});
|
|
7175
7169
|
import { existsSync as existsSync10, unlinkSync as unlinkSync7 } from "fs";
|
|
7176
7170
|
function createAgentForkHelpers(host) {
|
|
7177
7171
|
return {
|
|
@@ -27574,22 +27568,8 @@ function normalizeAskTarget(target) {
|
|
|
27574
27568
|
return "main";
|
|
27575
27569
|
return target === "cron" ? "cron" : null;
|
|
27576
27570
|
}
|
|
27577
|
-
function askRunsOnTargetSession(
|
|
27578
|
-
return
|
|
27579
|
-
}
|
|
27580
|
-
async function createAskForkPlan(options) {
|
|
27581
|
-
const snapshot = structuredClone(options.entries);
|
|
27582
|
-
const prepareSession = options.prepareSession ?? (async () => options.synthesize(structuredClone(snapshot)));
|
|
27583
|
-
let forkHandle;
|
|
27584
|
-
if (options.forkNative) {
|
|
27585
|
-
try {
|
|
27586
|
-
forkHandle = await options.forkNative();
|
|
27587
|
-
} catch (error) {
|
|
27588
|
-
options.onNativeForkError?.(error);
|
|
27589
|
-
}
|
|
27590
|
-
}
|
|
27591
|
-
forkHandle ??= await options.synthesize(structuredClone(snapshot));
|
|
27592
|
-
return { forkHandle, prepareSession };
|
|
27571
|
+
function askRunsOnTargetSession(_target) {
|
|
27572
|
+
return true;
|
|
27593
27573
|
}
|
|
27594
27574
|
function scheduledEntryDeliveryTime(value) {
|
|
27595
27575
|
if (!value || typeof value !== "object")
|
|
@@ -28150,22 +28130,11 @@ ${entry.message}
|
|
|
28150
28130
|
const { getTopic: getTopic2 } = await init_api_topics().then(() => exports_api_topics);
|
|
28151
28131
|
const fullTopic = getTopic2(topic.id);
|
|
28152
28132
|
const agentOverride = fullTopic?.agent ?? topic.agent ?? undefined;
|
|
28153
|
-
const cwd = resolveTopicWorkspaceDir(topic.id);
|
|
28154
28133
|
if (!agentOverride) {
|
|
28155
28134
|
clearPendingAskForEntry(scope, entry, topicName, "target-agent-missing");
|
|
28156
28135
|
await notifyAskDrop(scope, entry, topicName, "(error: target topic has no agent)");
|
|
28157
28136
|
return;
|
|
28158
28137
|
}
|
|
28159
|
-
const { cleanupAgentFork: cleanupAgentFork2, forkAgentSession: forkAgentSession2 } = await init_fork().then(() => exports_fork);
|
|
28160
|
-
const { getRegistry: getRegistry2, getRegistryOperations: getRegistryOperations2 } = await init_registry().then(() => exports_registry);
|
|
28161
|
-
const { resolveModelForAgent: resolveModelForAgent2 } = await Promise.resolve().then(() => (init_model_catalog(), exports_model_catalog));
|
|
28162
|
-
const { getApiTopicConfig: getApiTopicConfig2 } = await init_api_topic_config().then(() => exports_api_topic_config);
|
|
28163
|
-
const { readConversation: readConversation2 } = await init_conversations().then(() => exports_conversations);
|
|
28164
|
-
const registry = getRegistry2(agentOverride);
|
|
28165
|
-
const topicConfig = getApiTopicConfig2(topic.id);
|
|
28166
|
-
const model = resolveModelForAgent2(agentOverride, topicConfig?.model ?? fullTopic?.defaultModel, registry);
|
|
28167
|
-
const requestedEffort = topicConfig?.effort ?? fullTopic?.defaultEffort;
|
|
28168
|
-
const effort = requestedEffort && registry.validateEffort(requestedEffort) ? requestedEffort : registry.defaultEffort;
|
|
28169
28138
|
const cronSession = askTarget === "cron" ? getRegisteredCronSession(topic.id, agentOverride) : null;
|
|
28170
28139
|
const parentSessionId = askTarget === "cron" ? cronSession?.sessionId ?? null : getTopicSessionId(topic.id);
|
|
28171
28140
|
if (askTarget === "cron" && !parentSessionId) {
|
|
@@ -28225,103 +28194,17 @@ ${entry.message}
|
|
|
28225
28194
|
label: `Ask from ${fromLabel}`,
|
|
28226
28195
|
message: entry.message
|
|
28227
28196
|
},
|
|
28197
|
+
...askTarget === "cron" ? {
|
|
28198
|
+
sessionId: parentSessionId,
|
|
28199
|
+
sessionScope: "isolated",
|
|
28200
|
+
turnConcurrency: "isolated"
|
|
28201
|
+
} : {},
|
|
28228
28202
|
onSettled,
|
|
28229
28203
|
onDispatched
|
|
28230
28204
|
});
|
|
28231
28205
|
logger.info({ topicName, from: entry.from, requestId, callerTopicId, agent: agentOverride }, "session-inbox: ask delivered to target session");
|
|
28232
28206
|
return;
|
|
28233
28207
|
}
|
|
28234
|
-
const forkNative = parentSessionId ? () => forkAgentSession2({
|
|
28235
|
-
agent: agentOverride,
|
|
28236
|
-
parentSessionId,
|
|
28237
|
-
cwd,
|
|
28238
|
-
userId: scope.userId,
|
|
28239
|
-
topicName,
|
|
28240
|
-
title: `ask: ${entry.from} -> ${targetLabel}`,
|
|
28241
|
-
model,
|
|
28242
|
-
...effort ? { effort } : {}
|
|
28243
|
-
}) : undefined;
|
|
28244
|
-
let forkPlan;
|
|
28245
|
-
try {
|
|
28246
|
-
forkPlan = await createAskForkPlan({
|
|
28247
|
-
entries: askTarget === "cron" ? [] : readConversation2(scope.userId, topicName),
|
|
28248
|
-
...forkNative ? { forkNative } : {},
|
|
28249
|
-
...askTarget === "cron" && forkNative ? { prepareSession: forkNative } : {},
|
|
28250
|
-
synthesize: async (entries) => {
|
|
28251
|
-
if (askTarget === "cron") {
|
|
28252
|
-
throw new Error("cron session fork failed");
|
|
28253
|
-
}
|
|
28254
|
-
const rollout = getRegistryOperations2(agentOverride).writeRollout({
|
|
28255
|
-
cwd,
|
|
28256
|
-
entries,
|
|
28257
|
-
model,
|
|
28258
|
-
...effort ? { effort } : {}
|
|
28259
|
-
});
|
|
28260
|
-
return {
|
|
28261
|
-
agent: agentOverride,
|
|
28262
|
-
forkId: rollout.sessionId,
|
|
28263
|
-
rolloutPath: rollout.rolloutPath
|
|
28264
|
-
};
|
|
28265
|
-
},
|
|
28266
|
-
onNativeForkError: (err2) => {
|
|
28267
|
-
logger.warn({ err: err2, topicName, from: entry.from, requestId, parentSessionId }, "session-inbox: native target fork failed");
|
|
28268
|
-
}
|
|
28269
|
-
});
|
|
28270
|
-
} catch (err2) {
|
|
28271
|
-
logger.error({ err: err2, topicName, from: entry.from, requestId, parentSessionId }, "session-inbox: failed to prepare target ask session");
|
|
28272
|
-
try {
|
|
28273
|
-
clearPendingAskForEntry(scope, entry, topicName, "target-session-prepare-failed");
|
|
28274
|
-
} catch (clearError) {
|
|
28275
|
-
logger.warn({ err: clearError, topicName, from: entry.from, requestId }, "session-inbox: failed to clear ask after session preparation failure");
|
|
28276
|
-
}
|
|
28277
|
-
const message2 = "(error: target session could not be prepared)";
|
|
28278
|
-
if (remoteReply) {
|
|
28279
|
-
try {
|
|
28280
|
-
const delivered = await deliverPeerReply(remoteReply, targetLabel, message2, "error");
|
|
28281
|
-
if (!delivered) {
|
|
28282
|
-
logger.warn({ topicName, from: entry.from, requestId }, "session-inbox: failed to deliver remote ask preparation error");
|
|
28283
|
-
}
|
|
28284
|
-
} catch (deliveryError) {
|
|
28285
|
-
logger.warn({ err: deliveryError, topicName, from: entry.from, requestId }, "session-inbox: remote ask preparation error delivery threw");
|
|
28286
|
-
}
|
|
28287
|
-
} else {
|
|
28288
|
-
try {
|
|
28289
|
-
await notifyAskDrop(scope, entry, targetLabel, message2);
|
|
28290
|
-
} catch (deliveryError) {
|
|
28291
|
-
logger.warn({ err: deliveryError, topicName, from: entry.from, requestId }, "session-inbox: local ask preparation error delivery threw");
|
|
28292
|
-
}
|
|
28293
|
-
}
|
|
28294
|
-
return;
|
|
28295
|
-
}
|
|
28296
|
-
if (askTarget === "cron") {
|
|
28297
|
-
const currentCronSession = getRegisteredCronSession(topic.id, agentOverride);
|
|
28298
|
-
if (!cronSession || !currentCronSession || currentCronSession.sessionId !== cronSession.sessionId || currentCronSession.ownerUserId !== cronSession.ownerUserId) {
|
|
28299
|
-
cleanupAgentFork2(forkPlan.forkHandle);
|
|
28300
|
-
clearPendingAskForEntry(scope, entry, topicName, "cron-session-changed-during-fork");
|
|
28301
|
-
const message2 = "(error: cron session changed while preparing the request; retry the request)";
|
|
28302
|
-
if (remoteReply) {
|
|
28303
|
-
await deliverPeerReply(remoteReply, targetLabel, message2, "error");
|
|
28304
|
-
} else {
|
|
28305
|
-
await notifyAskDrop(scope, entry, targetLabel, message2);
|
|
28306
|
-
}
|
|
28307
|
-
return;
|
|
28308
|
-
}
|
|
28309
|
-
}
|
|
28310
|
-
triggerTopicAiTurn2(topic.id, String(scope.userId), prompt, agentOverride ?? topic.agent ?? undefined, {
|
|
28311
|
-
origin: entry.from,
|
|
28312
|
-
requestId,
|
|
28313
|
-
contextId: entry.contextId,
|
|
28314
|
-
depth: (entry.fromDepth ?? 0) + 1,
|
|
28315
|
-
silent: true,
|
|
28316
|
-
sessionId: forkPlan.forkHandle.forkId,
|
|
28317
|
-
turnConcurrency: "isolated",
|
|
28318
|
-
forkHandle: forkPlan.forkHandle,
|
|
28319
|
-
prepareSession: forkPlan.prepareSession,
|
|
28320
|
-
cwd,
|
|
28321
|
-
onSettled,
|
|
28322
|
-
onDispatched
|
|
28323
|
-
});
|
|
28324
|
-
logger.info({ topicName, from: entry.from, requestId, callerTopicId }, "session-inbox: ask delivered");
|
|
28325
28208
|
}
|
|
28326
28209
|
function stopLeaderResources2() {
|
|
28327
28210
|
if (watcher2) {
|
|
@@ -58299,4 +58182,4 @@ switch (command) {
|
|
|
58299
58182
|
}
|
|
58300
58183
|
}
|
|
58301
58184
|
|
|
58302
|
-
//# debugId=
|
|
58185
|
+
//# debugId=EDA696EC3AD07A8E64756E2164756E21
|