negotium 0.23.9 → 0.23.11
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 +67 -7
- package/dist/agent-helpers.js.map +11 -11
- package/dist/background-bash.js.map +1 -1
- package/dist/browser-runtime.js.map +1 -1
- package/dist/{chunk-jsv1te9a.js → chunk-0fenxbe6.js} +2 -2
- package/dist/{chunk-jsv1te9a.js.map → chunk-0fenxbe6.js.map} +2 -2
- package/dist/chunk-da9ad838.js.map +1 -1
- package/dist/chunk-mxxwx5mg.js.map +1 -1
- package/dist/hosted-agent.js +3 -2
- package/dist/hosted-agent.js.map +4 -4
- package/dist/main.js +844 -1644
- package/dist/main.js.map +22 -22
- package/dist/mcp-factories.js +84 -11
- package/dist/mcp-factories.js.map +12 -12
- package/dist/media.js.map +1 -1
- package/dist/prompts.js.map +1 -1
- package/dist/query-runtime.js.map +1 -1
- package/dist/registry.js +1 -1
- package/dist/runtime/src/agents/archiver.ts +6 -0
- package/dist/runtime/src/agents/claude-provider.ts +5 -4
- package/dist/runtime/src/agents/idle-archiver.ts +1 -0
- package/dist/runtime/src/agents/index.ts +2 -1
- package/dist/runtime/src/bus.ts +10 -0
- package/dist/runtime/src/mcp/wiki-server.ts +115 -64
- package/dist/runtime/src/prompts/agents/wiki-archiver.md +3 -0
- package/dist/runtime/src/runtime/turn-event-stream.ts +60 -4
- package/dist/runtime/src/topics/lifecycle.ts +1 -0
- package/dist/runtime/src/types.ts +8 -0
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-helpers.js.map +1 -1
- package/dist/storage.js.map +1 -1
- package/dist/types/packages/core/src/agents/archiver.d.ts +2 -0
- package/dist/types/packages/core/src/bus.d.ts +9 -0
- package/dist/types/packages/core/src/mcp/wiki-server.d.ts +16 -4
- package/dist/types/packages/core/src/types.d.ts +11 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js.map +1 -1
- package/package.json +1 -1
package/dist/agent-helpers.js
CHANGED
|
@@ -5321,7 +5321,7 @@ var init_codex = __esm(async () => {
|
|
|
5321
5321
|
});
|
|
5322
5322
|
|
|
5323
5323
|
// ../../packages/core/src/version.ts
|
|
5324
|
-
var NEGOTIUM_VERSION = "0.23.
|
|
5324
|
+
var NEGOTIUM_VERSION = "0.23.11";
|
|
5325
5325
|
|
|
5326
5326
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
5327
5327
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -6797,6 +6797,7 @@ async function* claudeProvider(opts) {
|
|
|
6797
6797
|
yield beat;
|
|
6798
6798
|
} else if (delta.delta.type === "text_delta" && delta.delta.text) {
|
|
6799
6799
|
thinkingStart = null;
|
|
6800
|
+
yield { type: "text_preview", content: delta.delta.text };
|
|
6800
6801
|
} else {
|
|
6801
6802
|
thinkingStart = null;
|
|
6802
6803
|
}
|
|
@@ -9091,7 +9092,7 @@ async function* runAgent(opts) {
|
|
|
9091
9092
|
const taskScope = resolveTaskEventScope(dispatchOpts);
|
|
9092
9093
|
const stream = taskScope ? withTaskSnapshots(dispatchAgent(dispatchOpts), taskScope) : dispatchAgent(dispatchOpts);
|
|
9093
9094
|
for await (const event of stream) {
|
|
9094
|
-
if (recording && event.type !== "tasks") {
|
|
9095
|
+
if (recording && event.type !== "tasks" && event.type !== "text_preview") {
|
|
9095
9096
|
appendConversationEvent(opts.userId, opts.session, opts.agent, event);
|
|
9096
9097
|
}
|
|
9097
9098
|
yield event;
|
|
@@ -10441,7 +10442,8 @@ function createArchiverRuntime(host) {
|
|
|
10441
10442
|
archivePath,
|
|
10442
10443
|
rawArchivePaths = [],
|
|
10443
10444
|
messageCount,
|
|
10444
|
-
mode = "deleted-topic"
|
|
10445
|
+
mode = "deleted-topic",
|
|
10446
|
+
memoryKeyFixed = false
|
|
10445
10447
|
} = params;
|
|
10446
10448
|
const generalTopicId = host.storage.getGeneralTopicId(userId, sourceTopicId);
|
|
10447
10449
|
let definition;
|
|
@@ -10457,10 +10459,12 @@ function createArchiverRuntime(host) {
|
|
|
10457
10459
|
const model = resolveWorkerModel(agent, params.model ?? definition.model, getRegistry(agent));
|
|
10458
10460
|
const outputLanguage = resolveMemoryLanguage();
|
|
10459
10461
|
const generalReplyInstruction = `Reply with a short completion message in ${outputLanguage} for display in #General. ` + "Do not include tool-call logs or raw transcripts \u2014 just briefly name the summary / brief / articles you saved.";
|
|
10462
|
+
const memoryKeyLines = memoryKeyFixed ? [`fixed_memory_key: ${topicTitle}`] : [];
|
|
10460
10463
|
const prompt = mode === "active-topic" ? [
|
|
10461
10464
|
`Recent idle conversation snapshot of session "${topicTitle}". Extract durable memory from the archive below and save it into this topic's wiki.`,
|
|
10462
10465
|
`archive_path: ${archivePath}`,
|
|
10463
10466
|
...rawArchivePaths.map((path) => `raw_archive_path: ${path}`),
|
|
10467
|
+
...memoryKeyLines,
|
|
10464
10468
|
`wiki_dir: ${wikiDir}`,
|
|
10465
10469
|
`output_language: ${outputLanguage}`,
|
|
10466
10470
|
"",
|
|
@@ -10470,6 +10474,7 @@ function createArchiverRuntime(host) {
|
|
|
10470
10474
|
`Session "${topicTitle}" was deleted. Extract durable memory from the archive below and save it into the wiki.`,
|
|
10471
10475
|
`archive_path: ${archivePath}`,
|
|
10472
10476
|
...rawArchivePaths.map((path) => `raw_archive_path: ${path}`),
|
|
10477
|
+
...memoryKeyLines,
|
|
10473
10478
|
`wiki_dir: ${wikiDir}`,
|
|
10474
10479
|
`output_language: ${outputLanguage}`,
|
|
10475
10480
|
"",
|
|
@@ -11863,6 +11868,7 @@ function archiveActiveTopicForMemory(topicId, userId, options) {
|
|
|
11863
11868
|
sourceTopicId: topic.id,
|
|
11864
11869
|
topicId: memoryTopic.id,
|
|
11865
11870
|
topicTitle: memoryTitle,
|
|
11871
|
+
memoryKeyFixed: Boolean(memoryTopic.memoryKey?.trim()),
|
|
11866
11872
|
archivePath: job.archivePath,
|
|
11867
11873
|
...options.rawArchivePaths ? { rawArchivePaths: options.rawArchivePaths } : {},
|
|
11868
11874
|
messageCount: job.messageCount,
|
|
@@ -18181,6 +18187,7 @@ async function deleteTopicCascadeImpl(topic, userId, options, deletingAncestorId
|
|
|
18181
18187
|
sourceTopicId: topicId,
|
|
18182
18188
|
...memoryTopic.id !== topicId && !deletingTopicIds.has(memoryTopic.id) ? { topicId: memoryTopic.id } : {},
|
|
18183
18189
|
topicTitle: memoryTitle,
|
|
18190
|
+
memoryKeyFixed: Boolean(memoryTopic.memoryKey?.trim()),
|
|
18184
18191
|
archivePath: archived.path,
|
|
18185
18192
|
...rawArchives.length > 0 ? { rawArchivePaths: rawArchives } : {},
|
|
18186
18193
|
messageCount: archived.messageCount
|
|
@@ -19684,6 +19691,39 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
|
|
|
19684
19691
|
let pendingSawDelta = false;
|
|
19685
19692
|
let accumulatedText = "";
|
|
19686
19693
|
let pendingText = "";
|
|
19694
|
+
let previewText = "";
|
|
19695
|
+
let pendingMessage = null;
|
|
19696
|
+
let previewTimer = null;
|
|
19697
|
+
const clearPreviewTimer = () => {
|
|
19698
|
+
if (previewTimer)
|
|
19699
|
+
clearTimeout(previewTimer);
|
|
19700
|
+
previewTimer = null;
|
|
19701
|
+
};
|
|
19702
|
+
const scheduleTextPreview = () => {
|
|
19703
|
+
if (silent || previewTimer || !(pendingText + previewText).trim())
|
|
19704
|
+
return;
|
|
19705
|
+
pendingMessage ??= { id: randomUUID18(), createdAt: new Date().toISOString() };
|
|
19706
|
+
previewTimer = setTimeout(() => {
|
|
19707
|
+
previewTimer = null;
|
|
19708
|
+
if (!pendingMessage || abortController.signal.aborted)
|
|
19709
|
+
return;
|
|
19710
|
+
try {
|
|
19711
|
+
hub.broadcastAiStatus(topicId, {
|
|
19712
|
+
kind: "message_stream",
|
|
19713
|
+
queryId,
|
|
19714
|
+
messageId: pendingMessage.id,
|
|
19715
|
+
text: pendingText + previewText,
|
|
19716
|
+
createdAt: pendingMessage.createdAt,
|
|
19717
|
+
...execution?.threadRootId ? { threadRootId: execution.threadRootId } : {}
|
|
19718
|
+
});
|
|
19719
|
+
} catch (error) {
|
|
19720
|
+
control.abortReason = "infrastructure" /* Infrastructure */;
|
|
19721
|
+
control.abortError = stringifyError(error);
|
|
19722
|
+
abortController.abort();
|
|
19723
|
+
}
|
|
19724
|
+
}, 50);
|
|
19725
|
+
previewTimer.unref?.();
|
|
19726
|
+
};
|
|
19687
19727
|
let assistantContextTokens = 0;
|
|
19688
19728
|
let toolContextTokens = 0;
|
|
19689
19729
|
let lastContextProgressAt = 0;
|
|
@@ -19760,12 +19800,20 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
|
|
|
19760
19800
|
return providerId ? handledVisualToolResultIds.has(providerId) : false;
|
|
19761
19801
|
};
|
|
19762
19802
|
const emitPendingAssistantMessage = (usage) => {
|
|
19803
|
+
clearPreviewTimer();
|
|
19804
|
+
const identity = pendingMessage;
|
|
19805
|
+
pendingMessage = null;
|
|
19763
19806
|
const text2 = pendingText.trimEnd();
|
|
19764
19807
|
pendingText = "";
|
|
19765
|
-
|
|
19808
|
+
previewText = "";
|
|
19809
|
+
if (silent || !text2.trim()) {
|
|
19810
|
+
if (identity && !silent) {
|
|
19811
|
+
hub.broadcastMessageUpdated(topicId, identity.id, { deleted: true, text: "" });
|
|
19812
|
+
}
|
|
19766
19813
|
return null;
|
|
19814
|
+
}
|
|
19767
19815
|
const message = {
|
|
19768
|
-
id: randomUUID18(),
|
|
19816
|
+
id: identity?.id ?? randomUUID18(),
|
|
19769
19817
|
topicId,
|
|
19770
19818
|
authorId: "ai",
|
|
19771
19819
|
text: text2,
|
|
@@ -19775,7 +19823,7 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
|
|
|
19775
19823
|
sourceNode: execution?.sourceNode,
|
|
19776
19824
|
...execution?.threadRootId ? { threadRootId: execution.threadRootId } : {},
|
|
19777
19825
|
usage,
|
|
19778
|
-
createdAt: new Date().toISOString()
|
|
19826
|
+
createdAt: identity?.createdAt ?? new Date().toISOString()
|
|
19779
19827
|
};
|
|
19780
19828
|
appendApiMessage(message, execution?.threadRootId ? { updateTopicLastMessageAt: false } : undefined);
|
|
19781
19829
|
hub.broadcastMessage(topicId, message);
|
|
@@ -19830,11 +19878,17 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
|
|
|
19830
19878
|
const incoming = event.content;
|
|
19831
19879
|
accumulatedText += incoming;
|
|
19832
19880
|
pendingText += incoming;
|
|
19881
|
+
scheduleTextPreview();
|
|
19833
19882
|
assistantContextTokens = estimateTextTokens(accumulatedText);
|
|
19834
19883
|
broadcastContextProgress();
|
|
19835
19884
|
break;
|
|
19836
19885
|
}
|
|
19886
|
+
case "text_preview":
|
|
19887
|
+
previewText += event.content;
|
|
19888
|
+
scheduleTextPreview();
|
|
19889
|
+
break;
|
|
19837
19890
|
case "text":
|
|
19891
|
+
previewText = "";
|
|
19838
19892
|
if (pendingSawDelta) {
|
|
19839
19893
|
pendingSawDelta = false;
|
|
19840
19894
|
break;
|
|
@@ -19843,6 +19897,7 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
|
|
|
19843
19897
|
const incoming = event.content;
|
|
19844
19898
|
accumulatedText += incoming;
|
|
19845
19899
|
pendingText += incoming;
|
|
19900
|
+
scheduleTextPreview();
|
|
19846
19901
|
assistantContextTokens = estimateTextTokens(accumulatedText);
|
|
19847
19902
|
broadcastContextProgress();
|
|
19848
19903
|
}
|
|
@@ -20225,6 +20280,11 @@ ${JSON.stringify(event.input ?? {})}`);
|
|
|
20225
20280
|
deliverAskError(queryId, topicTitle, msg);
|
|
20226
20281
|
}
|
|
20227
20282
|
} finally {
|
|
20283
|
+
clearPreviewTimer();
|
|
20284
|
+
if (pendingMessage) {
|
|
20285
|
+
hub.broadcastMessageUpdated(topicId, pendingMessage.id, { deleted: true, text: "" });
|
|
20286
|
+
pendingMessage = null;
|
|
20287
|
+
}
|
|
20228
20288
|
if (!terminalEmitted && !abortController.signal.aborted) {
|
|
20229
20289
|
const error = "Provider stream ended without a terminal event";
|
|
20230
20290
|
outcome = { kind: "provider-error", error };
|
|
@@ -23840,4 +23900,4 @@ export {
|
|
|
23840
23900
|
DEFAULT_SELF_CONFIG_PRODUCT
|
|
23841
23901
|
};
|
|
23842
23902
|
|
|
23843
|
-
//# debugId=
|
|
23903
|
+
//# debugId=F0D0E016782B3E0564756E2164756E21
|