@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
package/dist/registry.js
CHANGED
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
extractChatPairs2,
|
|
14
14
|
hostedCodexHomePath,
|
|
15
15
|
writeCodexRollout2
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-fzfzskjq.js";
|
|
17
17
|
import {
|
|
18
18
|
encodeClaudeCwd2,
|
|
19
19
|
writeClaudeRollout2
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-hn2cqdd0.js";
|
|
21
21
|
|
|
22
22
|
// ../../packages/core/src/agents/claude-registry.ts
|
|
23
23
|
import { existsSync, mkdirSync, readdirSync, renameSync, unlinkSync } from "fs";
|
|
@@ -133,7 +133,7 @@ var codexRegistryOperations = {
|
|
|
133
133
|
return { sessionId: threadId, rolloutPath };
|
|
134
134
|
},
|
|
135
135
|
async forkSession({ parentSessionId }) {
|
|
136
|
-
const { forkCodexSession } = await import("./chunk-
|
|
136
|
+
const { forkCodexSession } = await import("./chunk-3r4xfhkx.js");
|
|
137
137
|
return await forkCodexSession(parentSessionId);
|
|
138
138
|
},
|
|
139
139
|
async cleanupRollouts({ sessionIds }) {
|
package/dist/rollout.js
CHANGED
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
migrateCodexRolloutNativeMultiAgentMetadata2,
|
|
12
12
|
writeCodexRollout2,
|
|
13
13
|
decodeUuidV7Timestamp2
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-fzfzskjq.js";
|
|
15
15
|
import {
|
|
16
16
|
encodeClaudeCwd2,
|
|
17
17
|
writeClaudeRollout2,
|
|
18
18
|
repairPoisonedRollout2
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-hn2cqdd0.js";
|
|
20
20
|
|
|
21
21
|
// src/rollout.ts
|
|
22
22
|
import { fileURLToPath } from "url";
|
|
@@ -1515,7 +1515,15 @@ function skillSave(args: Record<string, unknown>): CallToolResult {
|
|
|
1515
1515
|
return `${target.trimEnd()}\n\n## Gotchas\n${fresh.join("\n")}\n`;
|
|
1516
1516
|
}
|
|
1517
1517
|
|
|
1518
|
+
// A name that is a path (`../x`, `/abs/dir`) would write outside the skill
|
|
1519
|
+
// library, anywhere the node can write.
|
|
1518
1520
|
const skillDir = resolve(runtime().skillsDir, name);
|
|
1521
|
+
if (dirname(skillDir) !== resolve(runtime().skillsDir) || name !== basename(skillDir)) {
|
|
1522
|
+
return {
|
|
1523
|
+
content: [{ type: "text", text: "Skill name must be a single folder name." }],
|
|
1524
|
+
isError: true,
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1519
1527
|
ensureDir(skillDir);
|
|
1520
1528
|
const skillPath = resolve(skillDir, "skill.md");
|
|
1521
1529
|
|
|
@@ -875,6 +875,32 @@ export function hostMcpGrantRefusal(
|
|
|
875
875
|
return managerOnly ? `${managerOnly} is only allowed for manager topics` : null;
|
|
876
876
|
}
|
|
877
877
|
|
|
878
|
+
/**
|
|
879
|
+
* Why servers from a room's plugins (their root `mcp.json`) may not join its
|
|
880
|
+
* turns, or null when they may. They take the checks host grants get, and must not
|
|
881
|
+
* share a name with the host's own servers for the room.
|
|
882
|
+
*/
|
|
883
|
+
export function pluginMcpRefusal(
|
|
884
|
+
topic: Pick<TopicDto, "kind" | "isSubagent">,
|
|
885
|
+
names: readonly string[],
|
|
886
|
+
hostNames: readonly string[] = [],
|
|
887
|
+
): string | null {
|
|
888
|
+
if (names.length > 0 && topic.isSubagent)
|
|
889
|
+
return "plugin servers are not allowed for subagent topics";
|
|
890
|
+
for (const name of names) {
|
|
891
|
+
if (isReservedRuntimeMcpServerName(name)) {
|
|
892
|
+
return `plugin MCP server name conflicts with node catalog: ${name}`;
|
|
893
|
+
}
|
|
894
|
+
if (topic.kind !== "manager" && MANAGER_ONLY_HOST_MCP_NAMES.has(name)) {
|
|
895
|
+
return `${name} is only allowed for manager topics`;
|
|
896
|
+
}
|
|
897
|
+
if (hostNames.includes(name)) {
|
|
898
|
+
return `plugin MCP server name conflicts with a host MCP server: ${name}`;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
return null;
|
|
902
|
+
}
|
|
903
|
+
|
|
878
904
|
function withoutManagerOnlyHostMcpServers(
|
|
879
905
|
hostMcpServers: Record<string, HostMcpServerSpec> | undefined,
|
|
880
906
|
): Record<string, HostMcpServerSpec> | undefined {
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
resolveOutputLanguage,
|
|
15
15
|
} from "#platform/config";
|
|
16
16
|
import { logger } from "#platform/logger";
|
|
17
|
+
import { renderTopicPluginsPrompt, type TopicPlugin } from "#topics/plugins";
|
|
17
18
|
import type { AgentKind, EffortLevel } from "#types";
|
|
18
19
|
import type { SubagentReportMode, TopicSurface } from "#types/api";
|
|
19
20
|
|
|
@@ -233,6 +234,8 @@ export interface SessionSystemPromptOpts {
|
|
|
233
234
|
visualTools?: boolean;
|
|
234
235
|
/** True only when the current adapter can deliver files to its chat. */
|
|
235
236
|
fileDeliveryTools?: boolean;
|
|
237
|
+
/** The room's plugins (`#topics/plugins`): their rules and skills follow the topic's own instructions. */
|
|
238
|
+
plugins?: readonly TopicPlugin[];
|
|
236
239
|
}
|
|
237
240
|
|
|
238
241
|
export type SessionPromptKind = "topic" | "channel" | "manager";
|
|
@@ -603,6 +606,8 @@ export function createPromptBuilders(host: PromptBuilderHost = {}): PromptBuilde
|
|
|
603
606
|
if (sessionKind !== "channel" && opts.description?.trim()) {
|
|
604
607
|
prompt += `\n\n## Topic-Specific Instructions\n${opts.description.trim()}`;
|
|
605
608
|
}
|
|
609
|
+
const plugins = renderTopicPluginsPrompt(opts.plugins ?? []);
|
|
610
|
+
if (plugins) prompt += `\n\n${plugins}`;
|
|
606
611
|
if (sessionKind === "manager") {
|
|
607
612
|
// Substitute the same vars so a host manager template using placeholders
|
|
608
613
|
// like {{RESPONSE_LANGUAGE}} never reaches the model unresolved.
|
|
@@ -80,6 +80,7 @@ import {
|
|
|
80
80
|
} from "#runtime/user-turn-envelope";
|
|
81
81
|
import { getActiveVisualForPrompt } from "#runtime/visual-store";
|
|
82
82
|
import { activeVisualHtmlForPrompt } from "#runtime/visuals";
|
|
83
|
+
import type { HostMcpServerSpec } from "#runtime-gateway";
|
|
83
84
|
import { appendApiMessage, getApiMessage } from "#storage/api-messages";
|
|
84
85
|
import { resolveTopicBrief } from "#storage/api-topic-brief";
|
|
85
86
|
import {
|
|
@@ -120,6 +121,12 @@ import {
|
|
|
120
121
|
wikiSummaryFilename,
|
|
121
122
|
} from "#storage/wiki-summary-names";
|
|
122
123
|
import { getTopics } from "#topics/derive";
|
|
124
|
+
import {
|
|
125
|
+
fetchMcpServerInstructions,
|
|
126
|
+
renderMcpServerInstructions,
|
|
127
|
+
} from "#topics/plugin-server-instructions";
|
|
128
|
+
import { resolveTopicPluginTurn } from "#topics/plugin-turn";
|
|
129
|
+
import type { TopicPlugin } from "#topics/plugins";
|
|
123
130
|
import type {
|
|
124
131
|
ActorTopicScope,
|
|
125
132
|
AgentKind,
|
|
@@ -789,6 +796,44 @@ export function resolveTurnHostMcpServers(
|
|
|
789
796
|
return getTopicHostMcpGrant(topic.id) ?? undefined;
|
|
790
797
|
}
|
|
791
798
|
|
|
799
|
+
/**
|
|
800
|
+
* The room's plugins for this turn, under the same scope rule as its host
|
|
801
|
+
* grant: the plugins, the servers they add, and the turn's host servers with
|
|
802
|
+
* those added. Broken plugins or unusable servers are logged and left out,
|
|
803
|
+
* never thrown.
|
|
804
|
+
*/
|
|
805
|
+
export function resolveTurnPlugins(
|
|
806
|
+
topic: Pick<TopicDto, "id" | "kind" | "isSubagent">,
|
|
807
|
+
sessionType: "dm" | "forum" | "ephemeral" | "manager" | "cron" | undefined,
|
|
808
|
+
hostMcpServers: Record<string, HostMcpServerSpec> | undefined,
|
|
809
|
+
): {
|
|
810
|
+
plugins: readonly TopicPlugin[];
|
|
811
|
+
pluginMcpServers: Record<string, HostMcpServerSpec>;
|
|
812
|
+
hostMcpServers: Record<string, HostMcpServerSpec> | undefined;
|
|
813
|
+
} {
|
|
814
|
+
const ownScope = topic.kind === "manager" ? "manager" : "forum";
|
|
815
|
+
const stored = getTopic(topic.id);
|
|
816
|
+
if (!stored?.plugins?.length || (sessionType ?? ownScope) !== ownScope) {
|
|
817
|
+
return { plugins: [], pluginMcpServers: {}, hostMcpServers };
|
|
818
|
+
}
|
|
819
|
+
const turn = resolveTopicPluginTurn(stored, Object.keys(hostMcpServers ?? {}));
|
|
820
|
+
const problems = [...turn.loadProblems, ...turn.serverProblems];
|
|
821
|
+
if (problems.length > 0) {
|
|
822
|
+
logger.warn(
|
|
823
|
+
{ topicId: topic.id, problems },
|
|
824
|
+
"ai: topic plugins partly or wholly left out of the turn",
|
|
825
|
+
);
|
|
826
|
+
}
|
|
827
|
+
return {
|
|
828
|
+
plugins: turn.plugins,
|
|
829
|
+
pluginMcpServers: turn.mcpServers,
|
|
830
|
+
hostMcpServers:
|
|
831
|
+
Object.keys(turn.mcpServers).length > 0
|
|
832
|
+
? { ...hostMcpServers, ...turn.mcpServers }
|
|
833
|
+
: hostMcpServers,
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
|
|
792
837
|
export interface StartAiTurnParams extends AiTurnExecutionOptions {
|
|
793
838
|
topic: AiTurnTopic;
|
|
794
839
|
userId: string;
|
|
@@ -987,6 +1032,29 @@ async function drainOneDurableUserTurn(): Promise<void> {
|
|
|
987
1032
|
try {
|
|
988
1033
|
const request = claimNextRuntimeUserTurnRequest(RUNTIME_INSTANCE_ID);
|
|
989
1034
|
if (!request) return;
|
|
1035
|
+
// The claim only proves the topic's turn lease *looked* stale. When the
|
|
1036
|
+
// host sleeps, or this event loop stalls, past TURN_LEASE_STALE_MS, this
|
|
1037
|
+
// process's own running turn looks abandoned too, and the worker claims
|
|
1038
|
+
// the row that turn is executing. Starting it again would take the
|
|
1039
|
+
// same-actor steering path and fold the request into itself, doubling its
|
|
1040
|
+
// messages, then re-queue the doubled row for the next tick to double
|
|
1041
|
+
// again. A turn this process is running is never someone else's to
|
|
1042
|
+
// recover: keep its row marked running, or hand a different row back to
|
|
1043
|
+
// be claimed once the local turn releases the room.
|
|
1044
|
+
const localTurn = getRoomQuery(request.topicId);
|
|
1045
|
+
if (localTurn) {
|
|
1046
|
+
if (localTurn.durableRequestIds?.includes(request.requestId)) {
|
|
1047
|
+
markRuntimeUserTurnRunning(
|
|
1048
|
+
request.topicId,
|
|
1049
|
+
request.requestId,
|
|
1050
|
+
RUNTIME_INSTANCE_ID,
|
|
1051
|
+
localTurn.queryId,
|
|
1052
|
+
);
|
|
1053
|
+
} else {
|
|
1054
|
+
releaseRuntimeUserTurnClaim(request.topicId, request.requestId, RUNTIME_INSTANCE_ID);
|
|
1055
|
+
}
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
990
1058
|
const topic = getTopic(request.topicId);
|
|
991
1059
|
if (!topic?.agent) {
|
|
992
1060
|
completeRuntimeUserTurnRequest(request.topicId, request.requestId, RUNTIME_INSTANCE_ID);
|
|
@@ -1136,7 +1204,11 @@ export function startAiTurn(params: StartAiTurnParams): string | null {
|
|
|
1136
1204
|
const sessionName = params.sessionName ?? topic.title;
|
|
1137
1205
|
const sessionType = params.sessionType;
|
|
1138
1206
|
const { visualTools, fileDeliveryTools } = resolveTurnToolCapabilities(topicId, params);
|
|
1139
|
-
const hostMcpServers =
|
|
1207
|
+
const { plugins, pluginMcpServers, hostMcpServers } = resolveTurnPlugins(
|
|
1208
|
+
topic,
|
|
1209
|
+
sessionType,
|
|
1210
|
+
resolveTurnHostMcpServers(topic, sessionType),
|
|
1211
|
+
);
|
|
1140
1212
|
const onSessionId = params.onSessionId;
|
|
1141
1213
|
const onSessionReset = params.onSessionReset;
|
|
1142
1214
|
const bridgeSessionFromHistory = params.bridgeSessionFromHistory === true;
|
|
@@ -1275,6 +1347,22 @@ export function startAiTurn(params: StartAiTurnParams): string | null {
|
|
|
1275
1347
|
}
|
|
1276
1348
|
if (decision.action === "abort-replace") {
|
|
1277
1349
|
const running = decision.running;
|
|
1350
|
+
// A replay of the very request this room is already running carries no
|
|
1351
|
+
// new message. Steering with it would append the running turn's messages
|
|
1352
|
+
// to themselves and replace the turn with a doubled copy of the same
|
|
1353
|
+
// request. Leave the running turn alone; its own settlement completes the
|
|
1354
|
+
// durable row.
|
|
1355
|
+
const runningRequestIds = new Set(running.durableRequestIds ?? []);
|
|
1356
|
+
if (
|
|
1357
|
+
durableRequestIds.length > 0 &&
|
|
1358
|
+
durableRequestIds.every((requestId) => runningRequestIds.has(requestId))
|
|
1359
|
+
) {
|
|
1360
|
+
logger.warn(
|
|
1361
|
+
{ topicId, queryId: running.queryId, durableRequestIds },
|
|
1362
|
+
"ai: ignored a replay of the durable request this room is already running",
|
|
1363
|
+
);
|
|
1364
|
+
return running.queryId;
|
|
1365
|
+
}
|
|
1278
1366
|
// Another person's running answer is not this message's to interrupt. The
|
|
1279
1367
|
// message keeps its own durable row (the merge never folds across actors)
|
|
1280
1368
|
// and the worker claims it once the running turn releases the room. A
|
|
@@ -1619,6 +1707,7 @@ export function startAiTurn(params: StartAiTurnParams): string | null {
|
|
|
1619
1707
|
subagentReportMode: topicRecord?.isSubagent ? subagentReportMode(topicId) : undefined,
|
|
1620
1708
|
visualTools,
|
|
1621
1709
|
fileDeliveryTools,
|
|
1710
|
+
plugins,
|
|
1622
1711
|
};
|
|
1623
1712
|
const isManager = topicRecord?.kind === "manager";
|
|
1624
1713
|
const isMentionOnlyChannel = topic.aiMode === "mention" && !isManager;
|
|
@@ -1847,6 +1936,20 @@ export function startAiTurn(params: StartAiTurnParams): string | null {
|
|
|
1847
1936
|
"<system-reminder>Playwright browser tools are UNAVAILABLE this turn. The `mcp__playwright__*` tools have been removed from this turn's catalog because the long-lived browser MCP could not be prepared. Do not attempt to call browser tools. If browser interaction is required, ask the user to retry shortly or use a non-browser alternative.</system-reminder>",
|
|
1848
1937
|
);
|
|
1849
1938
|
}
|
|
1939
|
+
if (Object.keys(pluginMcpServers).length > 0) {
|
|
1940
|
+
const fetched = await fetchMcpServerInstructions(pluginMcpServers, {
|
|
1941
|
+
signal: abortController.signal,
|
|
1942
|
+
});
|
|
1943
|
+
if (abortController.signal.aborted) return;
|
|
1944
|
+
const { section, problems } = renderMcpServerInstructions(fetched.instructions);
|
|
1945
|
+
if (fetched.problems.length + problems.length > 0) {
|
|
1946
|
+
logger.warn(
|
|
1947
|
+
{ topicId, problems: [...fetched.problems, ...problems] },
|
|
1948
|
+
"ai: plugin server instructions cut or left out of the turn",
|
|
1949
|
+
);
|
|
1950
|
+
}
|
|
1951
|
+
if (section) systemPrompt += `\n\n${section}`;
|
|
1952
|
+
}
|
|
1850
1953
|
// Build this after conversation recording: transient runtime facts must be
|
|
1851
1954
|
// supplied again by the host on a later external turn, never resumed from
|
|
1852
1955
|
// Negotium's canonical conversation state.
|
|
@@ -320,6 +320,7 @@ function initializeApiTopicsSchema(): void {
|
|
|
320
320
|
browser_profile TEXT NOT NULL DEFAULT 'default',
|
|
321
321
|
browser_profile_owner TEXT,
|
|
322
322
|
browser_connect_port INTEGER,
|
|
323
|
+
plugins_json TEXT,
|
|
323
324
|
session_id TEXT,
|
|
324
325
|
CHECK (
|
|
325
326
|
(kind = 'channel' AND response_policy = 'off' AND agent IS NULL) OR
|
|
@@ -497,6 +498,11 @@ function initializeApiTopicsSchema(): void {
|
|
|
497
498
|
if (!tableColumns("api_topics").has("browser_connect_port")) {
|
|
498
499
|
db.exec("ALTER TABLE api_topics ADD COLUMN browser_connect_port INTEGER");
|
|
499
500
|
}
|
|
501
|
+
if (!tableColumns("api_topics").has("plugins_json")) {
|
|
502
|
+
db.exec("ALTER TABLE api_topics ADD COLUMN plugins_json TEXT");
|
|
503
|
+
}
|
|
504
|
+
// Plugin url placeholders were removed; a node that ran them kept credential-bearing values here.
|
|
505
|
+
db.exec("DROP TABLE IF EXISTS api_topic_plugin_variables");
|
|
500
506
|
if (!tableColumns("api_topics").has("subagent_report_mode")) {
|
|
501
507
|
db.exec("ALTER TABLE api_topics ADD COLUMN subagent_report_mode TEXT NOT NULL DEFAULT 'auto'");
|
|
502
508
|
}
|
|
@@ -912,6 +918,7 @@ export interface TopicRow {
|
|
|
912
918
|
surface_scope: string | null;
|
|
913
919
|
browser_profile_owner: string | null;
|
|
914
920
|
browser_connect_port: number | null;
|
|
921
|
+
plugins_json?: string | null;
|
|
915
922
|
session_id: string | null;
|
|
916
923
|
}
|
|
917
924
|
|
|
@@ -1013,9 +1020,31 @@ function rowToDto(
|
|
|
1013
1020
|
surface: normalizeTopicSurface(r.surface),
|
|
1014
1021
|
surfaceScope: normalizeSurfaceScope(r.surface_scope),
|
|
1015
1022
|
...(r.browser_connect_port != null ? { browserConnectPort: r.browser_connect_port } : {}),
|
|
1023
|
+
...pluginsField(r.plugins_json),
|
|
1016
1024
|
};
|
|
1017
1025
|
}
|
|
1018
1026
|
|
|
1027
|
+
/** A stored plugin list that does not parse reads as none: fail closed. */
|
|
1028
|
+
function pluginsField(json: string | null | undefined): { plugins?: string[] } {
|
|
1029
|
+
if (!json) return {};
|
|
1030
|
+
try {
|
|
1031
|
+
const plugins: unknown = JSON.parse(json);
|
|
1032
|
+
return Array.isArray(plugins) && plugins.every((dir) => typeof dir === "string")
|
|
1033
|
+
? { plugins }
|
|
1034
|
+
: {};
|
|
1035
|
+
} catch {
|
|
1036
|
+
return {};
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/** The room's plugin folders; an empty list or `null` removes them all. */
|
|
1041
|
+
export function setTopicPlugins(topicId: string, plugins: readonly string[] | null): void {
|
|
1042
|
+
db.query("UPDATE api_topics SET plugins_json = ? WHERE id = ?").run(
|
|
1043
|
+
plugins?.length ? JSON.stringify(plugins) : null,
|
|
1044
|
+
topicId,
|
|
1045
|
+
);
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1019
1048
|
export function normalizeTopicVisibility(value: unknown): TopicVisibility {
|
|
1020
1049
|
return value === "hidden" ? "hidden" : "visible";
|
|
1021
1050
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
|
|
4
|
+
"title": "Agent Plugins MCP Configuration",
|
|
5
|
+
"description": "Machine-readable schema for mcp.json in Agent Plugins 1.0.0. The Agent Plugins specification defines additional semantic and operational requirements.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": {
|
|
9
|
+
"const": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
|
|
10
|
+
"description": "Canonical identifier of the MCP configuration schema for the Agent Plugins version targeted by this document."
|
|
11
|
+
},
|
|
12
|
+
"mcpServers": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": {
|
|
15
|
+
"$ref": "#/$defs/server"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": ["$schema", "mcpServers"],
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"$defs": {
|
|
22
|
+
"server": {
|
|
23
|
+
"title": "MCP server",
|
|
24
|
+
"oneOf": [
|
|
25
|
+
{
|
|
26
|
+
"$ref": "#/$defs/stdioServer"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"$ref": "#/$defs/streamableHttpServer"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"$ref": "#/$defs/sseServer"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"stdioServer": {
|
|
37
|
+
"title": "stdio MCP server",
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": {
|
|
40
|
+
"type": {
|
|
41
|
+
"const": "stdio"
|
|
42
|
+
},
|
|
43
|
+
"command": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"minLength": 1,
|
|
46
|
+
"description": "Executable token. Resolution rules are defined by the Agent Plugins specification."
|
|
47
|
+
},
|
|
48
|
+
"args": {
|
|
49
|
+
"type": "array",
|
|
50
|
+
"items": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"env": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"propertyNames": {
|
|
57
|
+
"not": {
|
|
58
|
+
"enum": ["PLUGIN_ROOT", "PLUGIN_DATA"]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"additionalProperties": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"cwd": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"pattern": "^(?:\\./|\\$\\{PLUGIN_ROOT\\}(?:/|$)|\\$\\{PLUGIN_DATA\\}(?:/|$))",
|
|
68
|
+
"description": "Plugin-relative, PLUGIN_ROOT-rooted, or PLUGIN_DATA-rooted working directory. Filesystem containment is validated separately."
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": ["type", "command"],
|
|
72
|
+
"additionalProperties": false
|
|
73
|
+
},
|
|
74
|
+
"streamableHttpServer": {
|
|
75
|
+
"title": "Streamable HTTP MCP server",
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"type": {
|
|
79
|
+
"const": "streamable-http"
|
|
80
|
+
},
|
|
81
|
+
"url": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"minLength": 1,
|
|
84
|
+
"description": "MCP endpoint URL. URL semantics are defined by the Agent Plugins specification."
|
|
85
|
+
},
|
|
86
|
+
"headers": {
|
|
87
|
+
"$ref": "#/$defs/headers"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": ["type", "url"],
|
|
91
|
+
"additionalProperties": false
|
|
92
|
+
},
|
|
93
|
+
"sseServer": {
|
|
94
|
+
"title": "Legacy HTTP+SSE MCP server",
|
|
95
|
+
"type": "object",
|
|
96
|
+
"properties": {
|
|
97
|
+
"type": {
|
|
98
|
+
"const": "sse"
|
|
99
|
+
},
|
|
100
|
+
"url": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"minLength": 1,
|
|
103
|
+
"description": "MCP endpoint URL. URL semantics are defined by the Agent Plugins specification."
|
|
104
|
+
},
|
|
105
|
+
"headers": {
|
|
106
|
+
"$ref": "#/$defs/headers"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": ["type", "url"],
|
|
110
|
+
"additionalProperties": false
|
|
111
|
+
},
|
|
112
|
+
"headers": {
|
|
113
|
+
"title": "HTTP headers",
|
|
114
|
+
"type": "object",
|
|
115
|
+
"additionalProperties": {
|
|
116
|
+
"type": "string"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
4
|
+
"title": "Agent Plugins Manifest",
|
|
5
|
+
"description": "Machine-readable schema for plugin.json in Agent Plugins 1.0.0. The Agent Plugins specification defines additional semantic and operational requirements.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": {
|
|
9
|
+
"const": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
10
|
+
"description": "Canonical identifier of the plugin manifest schema for the Agent Plugins version targeted by this document."
|
|
11
|
+
},
|
|
12
|
+
"name": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"minLength": 1,
|
|
15
|
+
"maxLength": 64,
|
|
16
|
+
"pattern": "^(?!.*(?:--|\\.\\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$",
|
|
17
|
+
"description": "Human-readable plugin name."
|
|
18
|
+
},
|
|
19
|
+
"version": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"description": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"author": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"name": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"email": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"url": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
},
|
|
40
|
+
"homepage": {
|
|
41
|
+
"type": "string"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"license": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
},
|
|
49
|
+
"keywords": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"extensions": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"description": "Client-specific manifest data keyed by reverse-domain extension namespace. Agent Plugins assigns no semantics to namespace object contents.",
|
|
58
|
+
"additionalProperties": {
|
|
59
|
+
"type": "object"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"required": ["$schema", "name"],
|
|
64
|
+
"additionalProperties": false
|
|
65
|
+
}
|