@otium-team/negotium 0.23.14 → 0.24.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/agent-helpers.js +956 -243
- package/dist/agent-helpers.js.map +12 -9
- package/dist/{chunk-3v58ejrk.js → chunk-3r4xfhkx.js} +3 -3
- package/dist/{chunk-3v58ejrk.js.map → chunk-3r4xfhkx.js.map} +2 -2
- package/dist/{chunk-ng13grfj.js → chunk-fzfzskjq.js} +18 -2
- package/dist/{chunk-ng13grfj.js.map → chunk-fzfzskjq.js.map} +4 -4
- package/dist/{chunk-m1ngkjdd.js → chunk-hn2cqdd0.js} +1 -1
- package/dist/hosted-agent.js +19 -3
- package/dist/hosted-agent.js.map +5 -5
- package/dist/main.js +38697 -37819
- package/dist/main.js.map +89 -85
- package/dist/mcp-factories.js +946 -227
- package/dist/mcp-factories.js.map +13 -10
- package/dist/prompts.js +221 -1
- package/dist/prompts.js.map +7 -5
- package/dist/registry.js +3 -3
- package/dist/rollout.js +2 -2
- package/dist/runtime/src/mcp/wiki-server.ts +8 -0
- package/dist/runtime/src/platform/mcp-config.ts +26 -0
- package/dist/runtime/src/prompts/builders.ts +5 -0
- package/dist/runtime/src/runtime/turn-runner.ts +104 -1
- package/dist/runtime/src/storage/api-topics.ts +29 -0
- package/dist/runtime/src/topics/agent-plugins/mcp.schema.json +120 -0
- package/dist/runtime/src/topics/agent-plugins/plugin.schema.json +65 -0
- package/dist/runtime/src/topics/plugin-server-instructions.ts +201 -0
- package/dist/runtime/src/topics/plugin-turn.ts +37 -0
- package/dist/runtime/src/topics/plugins.ts +445 -0
- package/dist/runtime/src/topics/update.ts +34 -0
- package/dist/runtime/src/types/api.ts +5 -0
- package/dist/runtime/src/version.ts +1 -1
- package/dist/storage.js +23 -2
- package/dist/storage.js.map +3 -3
- package/dist/types/packages/core/src/platform/mcp-config.d.ts +6 -0
- package/dist/types/packages/core/src/prompts/builders.d.ts +3 -0
- package/dist/types/packages/core/src/runtime/turn-runner.d.ts +14 -1
- package/dist/types/packages/core/src/storage/api-topics.d.ts +3 -0
- package/dist/types/packages/core/src/topics/plugin-server-instructions.d.ts +55 -0
- package/dist/types/packages/core/src/topics/plugin-turn.d.ts +17 -0
- package/dist/types/packages/core/src/topics/plugins.d.ts +66 -0
- package/dist/types/packages/core/src/types/api.d.ts +5 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-m1ngkjdd.js.map → chunk-hn2cqdd0.js.map} +0 -0
|
@@ -15,6 +15,7 @@ import { getRegistry } from "#agents/registry";
|
|
|
15
15
|
import { WsHub } from "#bus";
|
|
16
16
|
import { resolveFallbackAgent } from "#platform/config-helpers";
|
|
17
17
|
import { RESERVED_TOPIC_NAMES } from "#platform/constants";
|
|
18
|
+
import { pluginMcpRefusal } from "#platform/mcp-config";
|
|
18
19
|
import { getApiTopicConfig, setApiTopicConfig, type TopicConfig } from "#storage/api-topic-config";
|
|
19
20
|
import {
|
|
20
21
|
findTopicTitleConflict,
|
|
@@ -23,11 +24,14 @@ import {
|
|
|
23
24
|
normalizeTopicKind,
|
|
24
25
|
normalizeTopicState,
|
|
25
26
|
setApiTopicAgent,
|
|
27
|
+
setTopicPlugins,
|
|
26
28
|
upsertTopic,
|
|
27
29
|
} from "#storage/api-topics";
|
|
28
30
|
import { isBrowserConnectPort, setTopicBrowserConnectPort } from "#storage/browser-profiles";
|
|
29
31
|
import { db } from "#storage/forum-db";
|
|
32
|
+
import { getTopicHostMcpGrant } from "#storage/topic-host-mcp-grants";
|
|
30
33
|
import { TopicValidationError } from "#topics/create";
|
|
34
|
+
import { loadTopicPlugins } from "#topics/plugins";
|
|
31
35
|
import { type AgentKind, type EffortLevel, isAgentKind } from "#types";
|
|
32
36
|
import type { AiMode, TopicDto } from "#types/api";
|
|
33
37
|
|
|
@@ -54,6 +58,12 @@ export interface UpdateTopicSettingsOptions {
|
|
|
54
58
|
* its browser tools attach there. `null` returns the room to its profile.
|
|
55
59
|
*/
|
|
56
60
|
browserConnectPort?: number | null;
|
|
61
|
+
/**
|
|
62
|
+
* Absolute paths of Agent Plugins folders (`#topics/plugins`) whose
|
|
63
|
+
* skills and servers every turn of the room gets, in this order. Each is
|
|
64
|
+
* read and checked now and again on every turn. `null` or `[]` removes them.
|
|
65
|
+
*/
|
|
66
|
+
plugins?: readonly string[] | null;
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
/** Room for a full work procedure (Otium tax rooms keep one per room), still small next to a turn's prompt. */
|
|
@@ -183,6 +193,8 @@ export function updateTopicSettings(opts: UpdateTopicSettingsOptions): TopicDto
|
|
|
183
193
|
throw new TopicValidationError("browserConnectPort must be an integer from 1024 to 65535");
|
|
184
194
|
}
|
|
185
195
|
|
|
196
|
+
if (opts.plugins) checkTopicPlugins(current, opts.plugins);
|
|
197
|
+
|
|
186
198
|
if (opts.agent !== undefined && opts.agent !== null && !isAgentKind(opts.agent)) {
|
|
187
199
|
throw new TopicValidationError(`Unknown agent '${opts.agent}'`);
|
|
188
200
|
}
|
|
@@ -267,6 +279,7 @@ export function updateTopicSettings(opts: UpdateTopicSettingsOptions): TopicDto
|
|
|
267
279
|
if (opts.browserConnectPort !== undefined) {
|
|
268
280
|
setTopicBrowserConnectPort(next.id, opts.browserConnectPort);
|
|
269
281
|
}
|
|
282
|
+
if (opts.plugins !== undefined) setTopicPlugins(next.id, opts.plugins);
|
|
270
283
|
|
|
271
284
|
// `resolveTopicTurnExecution` reads `config.model ?? topic.defaultModel`, so a
|
|
272
285
|
// stale per-topic override (set earlier by `/model` in the terminal) would
|
|
@@ -285,3 +298,24 @@ export function updateTopicSettings(opts: UpdateTopicSettingsOptions): TopicDto
|
|
|
285
298
|
WsHub.get().broadcastTopicUpdated(next.id);
|
|
286
299
|
return getTopic(next.id) ?? next;
|
|
287
300
|
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Refuse a plugin list with anything to report, though a turn would run
|
|
304
|
+
* with what loads: a host learns of a problem when it attaches the plugin,
|
|
305
|
+
* not from a turn that quietly lacks part of it. Also refuse servers that
|
|
306
|
+
* clash with the node's or the host's.
|
|
307
|
+
*/
|
|
308
|
+
function checkTopicPlugins(topic: TopicDto, dirs: readonly string[]): void {
|
|
309
|
+
const loaded = loadTopicPlugins(dirs);
|
|
310
|
+
if (loaded.problems.length > 0) {
|
|
311
|
+
throw new TopicValidationError(
|
|
312
|
+
`plugins are invalid:\n${loaded.problems.map((problem) => `- ${problem}`).join("\n")}`,
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
const refusal = pluginMcpRefusal(
|
|
316
|
+
topic,
|
|
317
|
+
loaded.plugins.flatMap((plugin) => Object.keys(plugin.mcpServers)),
|
|
318
|
+
Object.keys(getTopicHostMcpGrant(topic.id) ?? {}),
|
|
319
|
+
);
|
|
320
|
+
if (refusal) throw new TopicValidationError(refusal);
|
|
321
|
+
}
|
|
@@ -77,6 +77,11 @@ export interface TopicDto {
|
|
|
77
77
|
* launches, kills or deletes it.
|
|
78
78
|
*/
|
|
79
79
|
browserConnectPort?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Absolute paths of the Agent Plugins folders attached to this room
|
|
82
|
+
* (`#topics/plugins`), in the order their rules and skills reach the prompt.
|
|
83
|
+
*/
|
|
84
|
+
plugins?: string[];
|
|
80
85
|
/** AI agent invited to this topic. */
|
|
81
86
|
agent?: AgentKind;
|
|
82
87
|
/** Canonical base model alias used by newer clients. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const NEGOTIUM_VERSION = "0.
|
|
1
|
+
export const NEGOTIUM_VERSION = "0.24.0";
|
package/dist/storage.js
CHANGED
|
@@ -129,6 +129,7 @@ __export(exports_api_topics, {
|
|
|
129
129
|
setDefaultSurfaceScope: () => setDefaultSurfaceScope,
|
|
130
130
|
setMountedSurfaceScopeCount: () => setMountedSurfaceScopeCount,
|
|
131
131
|
setSurfaceScopeRequired: () => setSurfaceScopeRequired,
|
|
132
|
+
setTopicPlugins: () => setTopicPlugins,
|
|
132
133
|
setTopicSessionId: () => setTopicSessionId,
|
|
133
134
|
setTopicSurfaceScope: () => setTopicSurfaceScope,
|
|
134
135
|
setTopicSurfaces: () => setTopicSurfaces,
|
|
@@ -2045,6 +2046,7 @@ function initializeApiTopicsSchema() {
|
|
|
2045
2046
|
browser_profile TEXT NOT NULL DEFAULT 'default',
|
|
2046
2047
|
browser_profile_owner TEXT,
|
|
2047
2048
|
browser_connect_port INTEGER,
|
|
2049
|
+
plugins_json TEXT,
|
|
2048
2050
|
session_id TEXT,
|
|
2049
2051
|
CHECK (
|
|
2050
2052
|
(kind = 'channel' AND response_policy = 'off' AND agent IS NULL) OR
|
|
@@ -2165,6 +2167,10 @@ function initializeApiTopicsSchema() {
|
|
|
2165
2167
|
if (!tableColumns2("api_topics").has("browser_connect_port")) {
|
|
2166
2168
|
db.exec("ALTER TABLE api_topics ADD COLUMN browser_connect_port INTEGER");
|
|
2167
2169
|
}
|
|
2170
|
+
if (!tableColumns2("api_topics").has("plugins_json")) {
|
|
2171
|
+
db.exec("ALTER TABLE api_topics ADD COLUMN plugins_json TEXT");
|
|
2172
|
+
}
|
|
2173
|
+
db.exec("DROP TABLE IF EXISTS api_topic_plugin_variables");
|
|
2168
2174
|
if (!tableColumns2("api_topics").has("subagent_report_mode")) {
|
|
2169
2175
|
db.exec("ALTER TABLE api_topics ADD COLUMN subagent_report_mode TEXT NOT NULL DEFAULT 'auto'");
|
|
2170
2176
|
}
|
|
@@ -2441,9 +2447,23 @@ function rowToDto2(r, participants = getTopicParticipants(r.id), tellTargets) {
|
|
|
2441
2447
|
visibility: normalizeTopicVisibility(r.visibility),
|
|
2442
2448
|
surface: normalizeTopicSurface(r.surface),
|
|
2443
2449
|
surfaceScope: normalizeSurfaceScope(r.surface_scope),
|
|
2444
|
-
...r.browser_connect_port != null ? { browserConnectPort: r.browser_connect_port } : {}
|
|
2450
|
+
...r.browser_connect_port != null ? { browserConnectPort: r.browser_connect_port } : {},
|
|
2451
|
+
...pluginsField(r.plugins_json)
|
|
2445
2452
|
};
|
|
2446
2453
|
}
|
|
2454
|
+
function pluginsField(json) {
|
|
2455
|
+
if (!json)
|
|
2456
|
+
return {};
|
|
2457
|
+
try {
|
|
2458
|
+
const plugins = JSON.parse(json);
|
|
2459
|
+
return Array.isArray(plugins) && plugins.every((dir) => typeof dir === "string") ? { plugins } : {};
|
|
2460
|
+
} catch {
|
|
2461
|
+
return {};
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
function setTopicPlugins(topicId, plugins) {
|
|
2465
|
+
db.query("UPDATE api_topics SET plugins_json = ? WHERE id = ?").run(plugins?.length ? JSON.stringify(plugins) : null, topicId);
|
|
2466
|
+
}
|
|
2447
2467
|
function normalizeTopicVisibility(value) {
|
|
2448
2468
|
return value === "hidden" ? "hidden" : "visible";
|
|
2449
2469
|
}
|
|
@@ -5181,6 +5201,7 @@ export {
|
|
|
5181
5201
|
setSurfaceScopeRequired,
|
|
5182
5202
|
setTopicArchiveState,
|
|
5183
5203
|
setTopicBrief,
|
|
5204
|
+
setTopicPlugins,
|
|
5184
5205
|
setTopicSessionId,
|
|
5185
5206
|
setTopicSurfaceScope,
|
|
5186
5207
|
setTopicSurfaces,
|
|
@@ -5222,4 +5243,4 @@ export {
|
|
|
5222
5243
|
writeTasks
|
|
5223
5244
|
};
|
|
5224
5245
|
|
|
5225
|
-
//# debugId=
|
|
5246
|
+
//# debugId=336FBAC4179C866764756E2164756E21
|