negotium 0.1.33 → 0.1.35
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 +93 -14
- package/dist/agent-helpers.js.map +10 -10
- package/dist/background-bash.js.map +2 -2
- package/dist/{chunk-1p2n47qd.js → chunk-s56ynvmp.js} +2 -2
- package/dist/{chunk-1p2n47qd.js.map → chunk-s56ynvmp.js.map} +3 -3
- package/dist/cron.js +271 -75
- package/dist/cron.js.map +16 -16
- package/dist/hosted-agent.js +40 -4
- package/dist/hosted-agent.js.map +7 -7
- package/dist/main.js +1246 -193
- package/dist/main.js.map +24 -22
- package/dist/mcp-factories.js +1517 -626
- package/dist/mcp-factories.js.map +30 -18
- package/dist/prompts.js +56 -13
- package/dist/prompts.js.map +5 -5
- package/dist/query-runtime.js.map +2 -2
- package/dist/registry.js +1 -1
- package/dist/registry.js.map +2 -2
- package/dist/rollout.js +1 -1
- package/dist/runtime/src/agents/mcp-tools/spawn-subagent.ts +447 -81
- package/dist/runtime/src/agents/tool-format.ts +48 -0
- package/dist/runtime/src/index.ts +7 -0
- package/dist/runtime/src/mcp/factories/session-comm.ts +44 -13
- package/dist/runtime/src/mcp/session-comm/context.ts +3 -0
- package/dist/runtime/src/mcp/session-comm/runtime.ts +1 -0
- package/dist/runtime/src/mcp/session-comm/server.ts +186 -154
- package/dist/runtime/src/mcp/session-comm/tell-permissions.ts +79 -0
- package/dist/runtime/src/platform/config.ts +1 -1
- package/dist/runtime/src/platform/mcp-config.ts +17 -1
- package/dist/runtime/src/prompts/builders.ts +86 -35
- package/dist/runtime/src/runtime/turn-runner.ts +21 -10
- package/dist/runtime/src/storage/api-topics.ts +143 -14
- package/dist/runtime/src/storage/storage-host.ts +4 -1
- package/dist/runtime/src/topics/derive.ts +11 -3
- package/dist/runtime/src/types/api.ts +15 -2
- package/dist/runtime/src/types.ts +2 -0
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-helpers.js.map +4 -4
- package/dist/storage.js +91 -13
- package/dist/storage.js.map +5 -5
- package/dist/types/packages/core/src/agents/mcp-tools/ask-user.d.ts +45 -0
- package/dist/types/packages/core/src/agents/mcp-tools/spawn-subagent.d.ts +47 -0
- package/dist/types/packages/core/src/agents/topic-cleanup.d.ts +75 -0
- package/dist/types/packages/core/src/mcp/peer-bridge.d.ts +87 -0
- package/dist/types/packages/core/src/mcp/session-comm/context.d.ts +2 -0
- package/dist/types/packages/core/src/mcp/session-comm/peer-forward.d.ts +59 -0
- package/dist/types/packages/core/src/mcp/session-comm/tell-permissions.d.ts +29 -0
- package/dist/types/packages/core/src/platform/config.d.ts +1 -1
- package/dist/types/packages/core/src/platform/mcp-config.d.ts +3 -0
- package/dist/types/packages/core/src/platform/playwright/browser-processes.d.ts +60 -0
- package/dist/types/packages/core/src/platform/playwright/headed-launch.d.ts +13 -0
- package/dist/types/packages/core/src/platform/playwright/manager-utils.d.ts +15 -0
- package/dist/types/packages/core/src/platform/playwright/manager.d.ts +80 -0
- package/dist/types/packages/core/src/prompts/builders.d.ts +7 -1
- package/dist/types/packages/core/src/query/session-inbox-cleanup.d.ts +5 -0
- package/dist/types/packages/core/src/query/session-inbox-path.d.ts +8 -0
- package/dist/types/packages/core/src/query/state.d.ts +4 -0
- package/dist/types/packages/core/src/runtime/ask-callbacks.d.ts +44 -0
- package/dist/types/packages/core/src/runtime/errors.d.ts +6 -0
- package/dist/types/packages/core/src/runtime/event-heartbeat.d.ts +17 -0
- package/dist/types/packages/core/src/runtime/tasks.d.ts +3 -0
- package/dist/types/packages/core/src/runtime/topic-config.d.ts +24 -0
- package/dist/types/packages/core/src/runtime/turn-event-stream.d.ts +26 -0
- package/dist/types/packages/core/src/runtime/turn-runner.d.ts +151 -0
- package/dist/types/packages/core/src/runtime/turn-session.d.ts +49 -0
- package/dist/types/packages/core/src/runtime/usage-alert.d.ts +11 -0
- package/dist/types/packages/core/src/runtime/visual-store.d.ts +46 -0
- package/dist/types/packages/core/src/runtime/visuals.d.ts +27 -0
- package/dist/types/packages/core/src/storage/api-topics.d.ts +8 -3
- package/dist/types/packages/core/src/storage/ask-user-gates.d.ts +63 -0
- package/dist/types/packages/core/src/storage/browser-profiles.d.ts +25 -0
- package/dist/types/packages/core/src/storage/runtime-process-leases.d.ts +47 -0
- package/dist/types/packages/core/src/storage/runtime-turn-requests.d.ts +55 -0
- package/dist/types/packages/core/src/storage/self-schedules.d.ts +54 -0
- package/dist/types/packages/core/src/topics/derive.d.ts +54 -0
- package/dist/types/packages/core/src/topics/lifecycle.d.ts +39 -0
- package/dist/types/packages/core/src/types/api.d.ts +15 -2
- package/dist/types/packages/core/src/types.d.ts +2 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js.map +2 -2
- package/package.json +3 -2
package/dist/agent-helpers.js
CHANGED
|
@@ -281,7 +281,7 @@ var AGENTS_PROMPTS_DIR = resolve(PROJECT_ROOT, "src/prompts/agents");
|
|
|
281
281
|
var RESOURCES_DIR = resolve(PROJECT_ROOT, "src/resources");
|
|
282
282
|
var FILE_TAG_REGEX = /\[FILE:(\/[^\]]+)\]/gi;
|
|
283
283
|
var MODEL_SONNET = "claude-sonnet-5";
|
|
284
|
-
var MODEL_OPUS = "claude-opus-
|
|
284
|
+
var MODEL_OPUS = "claude-opus-5";
|
|
285
285
|
var MODEL_FABLE = "claude-fable-5";
|
|
286
286
|
var FALLBACK_AGENT = resolveAgentEnv("FALLBACK_AGENT", "maestro", "DEFAULT_AGENT");
|
|
287
287
|
var SESSION_AGENT = resolveAgentEnv("SESSION_AGENT", FALLBACK_AGENT);
|
|
@@ -2668,12 +2668,22 @@ var MCP_CATALOG = {
|
|
|
2668
2668
|
},
|
|
2669
2669
|
"session-comm": {
|
|
2670
2670
|
...commonRuntimeMcpPolicy("session-comm"),
|
|
2671
|
-
build({
|
|
2671
|
+
build({
|
|
2672
|
+
userId,
|
|
2673
|
+
session,
|
|
2674
|
+
topicId,
|
|
2675
|
+
subagentParentTopicId,
|
|
2676
|
+
agent,
|
|
2677
|
+
depth = 0,
|
|
2678
|
+
silent,
|
|
2679
|
+
peerBridge
|
|
2680
|
+
}) {
|
|
2672
2681
|
const effectiveAgent = agent ?? FALLBACK_AGENT;
|
|
2673
2682
|
const args = [
|
|
2674
2683
|
`--user-id=${userId}`,
|
|
2675
2684
|
`--topic=${session}`,
|
|
2676
2685
|
...topicId ? [`--topic-id=${topicId}`] : [],
|
|
2686
|
+
...subagentParentTopicId ? [`--subagent-parent-topic-id=${subagentParentTopicId}`] : [],
|
|
2677
2687
|
`--depth=${depth}`,
|
|
2678
2688
|
`--agent=${effectiveAgent}`,
|
|
2679
2689
|
...silent ? ["--reply-only=true"] : [],
|
|
@@ -2823,6 +2833,7 @@ function getForumMcpServers(opts) {
|
|
|
2823
2833
|
userId,
|
|
2824
2834
|
session,
|
|
2825
2835
|
topicId,
|
|
2836
|
+
subagentParentTopicId,
|
|
2826
2837
|
queryId,
|
|
2827
2838
|
wikiTopicId,
|
|
2828
2839
|
agent,
|
|
@@ -2852,6 +2863,7 @@ function getForumMcpServers(opts) {
|
|
|
2852
2863
|
userId,
|
|
2853
2864
|
session,
|
|
2854
2865
|
topicId,
|
|
2866
|
+
subagentParentTopicId,
|
|
2855
2867
|
queryId,
|
|
2856
2868
|
wikiTopicId,
|
|
2857
2869
|
agent,
|
|
@@ -2938,6 +2950,7 @@ function getMcpServersForQuery(opts) {
|
|
|
2938
2950
|
userId: opts.userId || "default",
|
|
2939
2951
|
session: opts.session || "default",
|
|
2940
2952
|
topicId: opts.topicId,
|
|
2953
|
+
subagentParentTopicId: opts.subagentParentTopicId,
|
|
2941
2954
|
queryId: opts.queryId,
|
|
2942
2955
|
wikiTopicId: opts.wikiTopicId,
|
|
2943
2956
|
agent: opts.agent,
|
|
@@ -3519,7 +3532,7 @@ import { tmpdir } from "os";
|
|
|
3519
3532
|
import { dirname as dirname7, join as join11 } from "path";
|
|
3520
3533
|
|
|
3521
3534
|
// ../../packages/core/src/version.ts
|
|
3522
|
-
var NEGOTIUM_VERSION = "0.1.
|
|
3535
|
+
var NEGOTIUM_VERSION = "0.1.35";
|
|
3523
3536
|
|
|
3524
3537
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
3525
3538
|
var moduleRequire = createRequire(import.meta.url);
|
|
@@ -3730,6 +3743,29 @@ function writeCodexCatalogWithNativeMultiAgentDisabled(authFilePath, sourcePath)
|
|
|
3730
3743
|
|
|
3731
3744
|
// ../../packages/core/src/agents/tool-format.ts
|
|
3732
3745
|
import { diffLines as computeLineDiff } from "diff";
|
|
3746
|
+
var SSH_OPTIONS_WITH_VALUE = new Set([
|
|
3747
|
+
"-B",
|
|
3748
|
+
"-b",
|
|
3749
|
+
"-c",
|
|
3750
|
+
"-D",
|
|
3751
|
+
"-E",
|
|
3752
|
+
"-e",
|
|
3753
|
+
"-F",
|
|
3754
|
+
"-I",
|
|
3755
|
+
"-i",
|
|
3756
|
+
"-J",
|
|
3757
|
+
"-L",
|
|
3758
|
+
"-l",
|
|
3759
|
+
"-m",
|
|
3760
|
+
"-O",
|
|
3761
|
+
"-o",
|
|
3762
|
+
"-p",
|
|
3763
|
+
"-Q",
|
|
3764
|
+
"-R",
|
|
3765
|
+
"-S",
|
|
3766
|
+
"-W",
|
|
3767
|
+
"-w"
|
|
3768
|
+
]);
|
|
3733
3769
|
function changedDiffLines(value) {
|
|
3734
3770
|
const lines = value.split(`
|
|
3735
3771
|
`);
|
|
@@ -5437,6 +5473,7 @@ function initializeApiTopicsSchema() {
|
|
|
5437
5473
|
created_at TEXT NOT NULL,
|
|
5438
5474
|
last_message_at TEXT,
|
|
5439
5475
|
parent_topic_id TEXT,
|
|
5476
|
+
memory_topic_id TEXT,
|
|
5440
5477
|
is_fork INTEGER NOT NULL DEFAULT 0 CHECK (is_fork IN (0,1)),
|
|
5441
5478
|
is_subagent INTEGER NOT NULL DEFAULT 0 CHECK (is_subagent IN (0,1)),
|
|
5442
5479
|
visibility TEXT NOT NULL DEFAULT 'visible' CHECK (visibility IN ('visible','hidden')),
|
|
@@ -5486,8 +5523,8 @@ function initializeApiTopicsSchema() {
|
|
|
5486
5523
|
const legacyBaseEffort = row.base_effort ?? row.default_effort;
|
|
5487
5524
|
db.query(`INSERT INTO api_topics_next
|
|
5488
5525
|
(id,title,kind,description,agent,base_model,base_effort,response_policy,
|
|
5489
|
-
created_at,last_message_at,parent_topic_id,is_fork,is_subagent,visibility,access_mode,session_id)
|
|
5490
|
-
VALUES (
|
|
5526
|
+
created_at,last_message_at,parent_topic_id,memory_topic_id,is_fork,is_subagent,visibility,access_mode,session_id)
|
|
5527
|
+
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`).run(String(row.id), String(row.title), normalized.kind, typeof row.description === "string" ? row.description : null, normalized.agent ?? null, typeof legacyBaseModel === "string" ? legacyBaseModel : null, typeof legacyBaseEffort === "string" ? legacyBaseEffort : null, normalized.aiMode, String(row.created_at), typeof row.last_message_at === "string" ? row.last_message_at : null, typeof row.parent_topic_id === "string" ? row.parent_topic_id : null, typeof row.memory_topic_id === "string" ? row.memory_topic_id : null, Number(row.is_fork ?? 0) !== 0 ? 1 : 0, Number(row.is_subagent ?? 0) !== 0 ? 1 : 0, row.visibility === "hidden" ? "hidden" : "visible", row.access_mode === "shared" ? "shared" : "private", typeof row.session_id === "string" ? row.session_id : null);
|
|
5491
5528
|
}
|
|
5492
5529
|
db.exec("DROP TABLE IF EXISTS topic_members");
|
|
5493
5530
|
db.exec("DROP TABLE api_topics");
|
|
@@ -5522,6 +5559,22 @@ function initializeApiTopicsSchema() {
|
|
|
5522
5559
|
createCanonicalTopicsTable("api_topics");
|
|
5523
5560
|
createTopicMembersTable();
|
|
5524
5561
|
}
|
|
5562
|
+
db.exec(`
|
|
5563
|
+
CREATE TABLE IF NOT EXISTS subagent_tell_grants (
|
|
5564
|
+
subagent_topic_id TEXT NOT NULL REFERENCES api_topics(id) ON DELETE CASCADE,
|
|
5565
|
+
target_topic_id TEXT NOT NULL REFERENCES api_topics(id) ON DELETE CASCADE,
|
|
5566
|
+
granted_by_topic_id TEXT NOT NULL REFERENCES api_topics(id) ON DELETE CASCADE,
|
|
5567
|
+
created_at TEXT NOT NULL,
|
|
5568
|
+
PRIMARY KEY (subagent_topic_id, target_topic_id)
|
|
5569
|
+
)
|
|
5570
|
+
`);
|
|
5571
|
+
db.exec(`
|
|
5572
|
+
DELETE FROM subagent_tell_grants
|
|
5573
|
+
WHERE subagent_topic_id NOT IN (SELECT id FROM api_topics)
|
|
5574
|
+
OR target_topic_id NOT IN (SELECT id FROM api_topics)
|
|
5575
|
+
OR granted_by_topic_id NOT IN (SELECT id FROM api_topics)
|
|
5576
|
+
`);
|
|
5577
|
+
db.exec("DELETE FROM topic_members WHERE topic_id NOT IN (SELECT id FROM api_topics)");
|
|
5525
5578
|
if (!tableColumns2("api_topics").has("visibility")) {
|
|
5526
5579
|
db.exec("ALTER TABLE api_topics ADD COLUMN visibility TEXT NOT NULL DEFAULT 'visible'");
|
|
5527
5580
|
}
|
|
@@ -5534,6 +5587,12 @@ function initializeApiTopicsSchema() {
|
|
|
5534
5587
|
if (!tableColumns2("api_topics").has("browser_profile_owner")) {
|
|
5535
5588
|
db.exec("ALTER TABLE api_topics ADD COLUMN browser_profile_owner TEXT");
|
|
5536
5589
|
}
|
|
5590
|
+
if (!tableColumns2("api_topics").has("subagent_report_mode")) {
|
|
5591
|
+
db.exec("ALTER TABLE api_topics ADD COLUMN subagent_report_mode TEXT NOT NULL DEFAULT 'auto'");
|
|
5592
|
+
}
|
|
5593
|
+
if (!tableColumns2("api_topics").has("memory_topic_id")) {
|
|
5594
|
+
db.exec("ALTER TABLE api_topics ADD COLUMN memory_topic_id TEXT");
|
|
5595
|
+
}
|
|
5537
5596
|
db.exec(`
|
|
5538
5597
|
UPDATE api_topics
|
|
5539
5598
|
SET browser_profile_owner = (
|
|
@@ -5550,7 +5609,7 @@ registerStorageSchemaInitializer(initializeApiTopicsSchema, 20);
|
|
|
5550
5609
|
function getTopicParticipants(topicId) {
|
|
5551
5610
|
return db.query("SELECT user_id, role FROM topic_members WHERE topic_id = ? ORDER BY rowid").all(topicId).map((row) => ({ userId: row.user_id, role: row.role }));
|
|
5552
5611
|
}
|
|
5553
|
-
function rowToDto(r, participants = getTopicParticipants(r.id)) {
|
|
5612
|
+
function rowToDto(r, participants = getTopicParticipants(r.id), tellTargets) {
|
|
5554
5613
|
const normalized = normalizeTopicState({
|
|
5555
5614
|
id: r.id,
|
|
5556
5615
|
kind: normalizeTopicKind(r.kind),
|
|
@@ -5571,8 +5630,15 @@ function rowToDto(r, participants = getTopicParticipants(r.id)) {
|
|
|
5571
5630
|
createdAt: r.created_at,
|
|
5572
5631
|
lastMessageAt: r.last_message_at ?? new Date().toISOString(),
|
|
5573
5632
|
parentTopicId: r.parent_topic_id ?? undefined,
|
|
5633
|
+
memoryTopicId: r.memory_topic_id ?? undefined,
|
|
5574
5634
|
isFork: r.is_fork !== 0,
|
|
5575
5635
|
...r.is_subagent !== 0 ? { isSubagent: true } : {},
|
|
5636
|
+
...r.is_subagent !== 0 ? {
|
|
5637
|
+
subagentTellTargetIds: tellTargets ? tellTargets.get(r.id) ?? [] : listSubagentTellTargetIds(r.id)
|
|
5638
|
+
} : {},
|
|
5639
|
+
...r.is_subagent !== 0 ? {
|
|
5640
|
+
subagentReportMode: r.subagent_report_mode === "tell" || r.subagent_report_mode === "status-only" ? r.subagent_report_mode : "auto"
|
|
5641
|
+
} : {},
|
|
5576
5642
|
visibility: normalizeTopicVisibility(r.visibility),
|
|
5577
5643
|
accessMode: normalizeTopicAccessMode(r.access_mode)
|
|
5578
5644
|
};
|
|
@@ -5627,8 +5693,9 @@ function upsertTopic(t) {
|
|
|
5627
5693
|
db.transaction(() => {
|
|
5628
5694
|
db.query(`INSERT INTO api_topics
|
|
5629
5695
|
(id,title,kind,description,agent,base_model,base_effort,response_policy,
|
|
5630
|
-
created_at,last_message_at,parent_topic_id,is_fork,is_subagent,visibility,access_mode
|
|
5631
|
-
|
|
5696
|
+
created_at,last_message_at,parent_topic_id,memory_topic_id,is_fork,is_subagent,visibility,access_mode,
|
|
5697
|
+
subagent_report_mode)
|
|
5698
|
+
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
|
5632
5699
|
ON CONFLICT(id) DO UPDATE SET
|
|
5633
5700
|
title = excluded.title,
|
|
5634
5701
|
kind = excluded.kind,
|
|
@@ -5640,10 +5707,12 @@ function upsertTopic(t) {
|
|
|
5640
5707
|
created_at = excluded.created_at,
|
|
5641
5708
|
last_message_at = excluded.last_message_at,
|
|
5642
5709
|
parent_topic_id = excluded.parent_topic_id,
|
|
5710
|
+
memory_topic_id = excluded.memory_topic_id,
|
|
5643
5711
|
is_fork = excluded.is_fork,
|
|
5644
5712
|
is_subagent = excluded.is_subagent,
|
|
5645
5713
|
visibility = excluded.visibility,
|
|
5646
|
-
access_mode = excluded.access_mode
|
|
5714
|
+
access_mode = excluded.access_mode,
|
|
5715
|
+
subagent_report_mode = excluded.subagent_report_mode`).run(t.id, t.title, normalized.kind, t.description ?? null, normalized.agent ?? null, t.defaultModel ?? null, t.defaultEffort ?? null, normalized.aiMode, t.createdAt, t.lastMessageAt ?? null, t.parentTopicId ?? null, t.memoryTopicId ?? null, t.isFork ? 1 : 0, t.isSubagent ? 1 : 0, normalizeTopicVisibility(t.visibility), normalizeTopicAccessMode(t.accessMode), t.subagentReportMode ?? "auto");
|
|
5647
5716
|
db.query("DELETE FROM topic_members WHERE topic_id = ?").run(t.id);
|
|
5648
5717
|
for (const participant of t.participants) {
|
|
5649
5718
|
db.query("INSERT INTO topic_members (topic_id,user_id,role) VALUES (?,?,?)").run(t.id, participant.userId, participant.role);
|
|
@@ -5676,15 +5745,25 @@ function getTopicMemoryOrigin(id) {
|
|
|
5676
5745
|
if (!current2)
|
|
5677
5746
|
return null;
|
|
5678
5747
|
const seen = new Set([current2.id]);
|
|
5679
|
-
while (
|
|
5680
|
-
const
|
|
5681
|
-
if (!
|
|
5748
|
+
while (true) {
|
|
5749
|
+
const nextId = current2.memoryTopicId ?? current2.parentTopicId;
|
|
5750
|
+
if (!nextId || seen.has(nextId))
|
|
5751
|
+
break;
|
|
5752
|
+
const next = getTopic(nextId);
|
|
5753
|
+
if (!next) {
|
|
5754
|
+
if (current2.memoryTopicId) {
|
|
5755
|
+
console.warn(`[topics] memory topic ${current2.memoryTopicId} for ${current2.id} is unresolvable; using the topic's own memory`);
|
|
5756
|
+
}
|
|
5682
5757
|
break;
|
|
5683
|
-
|
|
5758
|
+
}
|
|
5759
|
+
current2 = next;
|
|
5684
5760
|
seen.add(current2.id);
|
|
5685
5761
|
}
|
|
5686
5762
|
return current2;
|
|
5687
5763
|
}
|
|
5764
|
+
function listSubagentTellTargetIds(subagentTopicId) {
|
|
5765
|
+
return db.query("SELECT target_topic_id FROM subagent_tell_grants WHERE subagent_topic_id = ? ORDER BY created_at").all(subagentTopicId).map((row) => row.target_topic_id);
|
|
5766
|
+
}
|
|
5688
5767
|
|
|
5689
5768
|
// ../../packages/core/src/topics/personal-general.ts
|
|
5690
5769
|
var LEGACY_PERSONAL_GENERAL_DESCRIPTION = "\uB098\uB9CC\uC758 \uAC1C\uC778 \uACF5\uAC04\uC774\uC5D0\uC694. \uB300\uD654\uC640 AI \uC791\uC5C5\uC740 \uB2E4\uB978 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uACF5\uAC1C\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.";
|
|
@@ -6871,4 +6950,4 @@ export {
|
|
|
6871
6950
|
MIN_MEMORY_ARCHIVE_EXCHANGES
|
|
6872
6951
|
};
|
|
6873
6952
|
|
|
6874
|
-
//# debugId=
|
|
6953
|
+
//# debugId=D36BB5FA96D755FD64756E2164756E21
|