negotium 0.7.0 → 0.7.1

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/main.js CHANGED
@@ -3708,7 +3708,7 @@ var exports_version = {};
3708
3708
  __export(exports_version, {
3709
3709
  NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
3710
3710
  });
3711
- var NEGOTIUM_VERSION = "0.7.0";
3711
+ var NEGOTIUM_VERSION = "0.7.1";
3712
3712
 
3713
3713
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
3714
3714
  import { spawn as spawn2 } from "child_process";
@@ -23967,6 +23967,40 @@ var init_inbox = __esm(async () => {
23967
23967
  });
23968
23968
 
23969
23969
  // ../../packages/core/src/topics/update.ts
23970
+ function updateManagerTopicRuntimeConfig(opts) {
23971
+ const current3 = getTopic(opts.topicId);
23972
+ if (!current3)
23973
+ throw new TopicValidationError("Topic not found");
23974
+ if (current3.kind !== "manager") {
23975
+ throw new TopicValidationError("Runtime config agent updates are manager-only");
23976
+ }
23977
+ if (!isAgentKind(opts.agent))
23978
+ throw new TopicValidationError(`Unknown agent '${opts.agent}'`);
23979
+ const registry = getRegistry(opts.agent);
23980
+ if (opts.config.model && resolveModelForAgent(opts.agent, opts.config.model, registry) !== opts.config.model) {
23981
+ throw new TopicValidationError(`Invalid model for agent ${opts.agent}`);
23982
+ }
23983
+ if (opts.config.effort && !registry.validateEffort(opts.config.effort)) {
23984
+ throw new TopicValidationError(`Invalid effort for agent ${opts.agent}`);
23985
+ }
23986
+ const defaultModel = resolveModelForAgent(opts.agent, opts.config.model ?? (opts.agent === current3.agent ? current3.defaultModel : undefined), registry);
23987
+ const requestedEffort = opts.config.effort ?? (opts.agent === current3.agent ? current3.defaultEffort : undefined);
23988
+ const defaultEffort = requestedEffort && registry.validateEffort(requestedEffort) ? requestedEffort : registry.defaultEffort ?? "medium";
23989
+ db.transaction(() => {
23990
+ setApiTopicAgent(current3.id, opts.agent, {
23991
+ model: defaultModel,
23992
+ effort: defaultEffort
23993
+ });
23994
+ setApiTopicConfig(current3.id, opts.config);
23995
+ })();
23996
+ WsHub.get().broadcastTopicUpdated(current3.id);
23997
+ return getTopic(current3.id) ?? {
23998
+ ...current3,
23999
+ agent: opts.agent,
24000
+ defaultModel,
24001
+ defaultEffort
24002
+ };
24003
+ }
23970
24004
  function updateTopicSettings(opts) {
23971
24005
  const current3 = getTopic(opts.topicId);
23972
24006
  if (!current3)
@@ -24052,6 +24086,7 @@ var init_update = __esm(async () => {
24052
24086
  init_constants();
24053
24087
  await init_api_topic_config();
24054
24088
  await init_api_topics();
24089
+ await init_forum_db();
24055
24090
  await init_create();
24056
24091
  init_types();
24057
24092
  TopicUpdateConflictError = class TopicUpdateConflictError extends Error {
@@ -24077,6 +24112,7 @@ __export(exports_src, {
24077
24112
  upsertTopic: () => upsertTopic,
24078
24113
  updateTopicSettings: () => updateTopicSettings,
24079
24114
  updateTopic: () => updateTopic,
24115
+ updateManagerTopicRuntimeConfig: () => updateManagerTopicRuntimeConfig,
24080
24116
  unregisterNodeRequestHandler: () => unregisterNodeRequestHandler,
24081
24117
  triggerTopicAiTurn: () => triggerTopicAiTurn,
24082
24118
  transcribeAudio: () => transcribeAudio,
@@ -24695,6 +24731,7 @@ __export(exports_node_host, {
24695
24731
  writeDecisionGraphSvg: () => writeDecisionGraphSvg,
24696
24732
  upsertTopic: () => upsertTopic,
24697
24733
  updateTopicSettings: () => updateTopicSettings,
24734
+ updateManagerTopicRuntimeConfig: () => updateManagerTopicRuntimeConfig,
24698
24735
  updateApiMessageText: () => updateApiMessageText,
24699
24736
  topicService: () => topicService,
24700
24737
  switchTopicModel: () => switchTopicModel,
@@ -34005,6 +34042,16 @@ function createNodeControlHandler(options) {
34005
34042
  const topic = getTopic(topicId);
34006
34043
  if (!topic || !topicInRequestScope(req, topic))
34007
34044
  return jsonError(404, "Topic not found");
34045
+ let requestedAgent;
34046
+ if ("agent" in body) {
34047
+ if (topic.kind !== "manager") {
34048
+ return jsonError(400, "Config endpoint agent updates are manager-only");
34049
+ }
34050
+ if (typeof body.agent !== "string" || !["claude", "codex", "maestro"].includes(body.agent)) {
34051
+ return jsonError(400, "Invalid agent");
34052
+ }
34053
+ requestedAgent = body.agent;
34054
+ }
34008
34055
  const next = { ...getApiTopicConfig(topicId) ?? {} };
34009
34056
  for (const key of ["model", "effort"]) {
34010
34057
  if (!(key in body))
@@ -34039,11 +34086,26 @@ function createNodeControlHandler(options) {
34039
34086
  else
34040
34087
  return jsonError(400, `${key} must be a boolean or null`);
34041
34088
  }
34042
- setApiTopicConfig(topicId, next);
34089
+ let updatedTopic = topic;
34090
+ try {
34091
+ if (requestedAgent) {
34092
+ updatedTopic = updateManagerTopicRuntimeConfig({
34093
+ topicId,
34094
+ agent: requestedAgent,
34095
+ config: next
34096
+ });
34097
+ } else {
34098
+ setApiTopicConfig(topicId, next);
34099
+ }
34100
+ } catch (err2) {
34101
+ if (err2 instanceof TopicValidationError)
34102
+ return jsonError(400, err2.message);
34103
+ throw err2;
34104
+ }
34043
34105
  return Response.json({
34044
34106
  ok: true,
34045
34107
  v: NODE_RUNTIME_CONTRACT_VERSION,
34046
- topic,
34108
+ topic: updatedTopic,
34047
34109
  config: getApiTopicConfig(topicId) ?? {}
34048
34110
  });
34049
34111
  }
@@ -49681,4 +49743,4 @@ switch (command) {
49681
49743
  }
49682
49744
  }
49683
49745
 
49684
- //# debugId=ACF572F467044FC364756E2164756E21
49746
+ //# debugId=3B82619F70BCB0E864756E2164756E21