@saturn-universe/runtime-host 0.1.2-dev.5 → 0.1.2-dev.6

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.
@@ -171,10 +171,10 @@ function matchesScopeFilters(item, categorySet, idSet) {
171
171
 
172
172
  export default {
173
173
  id: 'ctf',
174
- version: '0.1.2-dev.5',
174
+ version: '0.1.2-dev.6',
175
175
  kind: 'saturn-registrar',
176
176
  apiVersion: 1,
177
- sdkVersion: '0.1.2-dev.5',
177
+ sdkVersion: '0.1.2-dev.6',
178
178
  async setup(api, config = {}) {
179
179
  const { boardToken, boardPublicHost, ...boardSettings } = settingsFor(config);
180
180
  if (boardToken) api.registerSecret?.(boardToken);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saturn-plugin-ctf",
3
- "version": "0.1.2-dev.5",
3
+ "version": "0.1.2-dev.6",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
@@ -89,6 +89,8 @@ async function assembleRuntime(resources, store, root, options, diagnosticDestin
89
89
  }
90
90
  },
91
91
  };
92
+ let stopMemberImpl;
93
+ let steerMemberImpl;
92
94
  let notifyParentImpl;
93
95
  let syncWorkspaceSubpathsImpl;
94
96
  const workerLifecycleListeners = new Set();
@@ -208,6 +210,16 @@ async function assembleRuntime(resources, store, root, options, diagnosticDestin
208
210
  onRecordError: (processId) => logger.error({ code: 'PROCESS_RECORD_INVALID', processId }, 'Skipped an invalid process journal; the reservation will not be restarted'),
209
211
  },
210
212
  previousDataReview: (runId) => store.hasNumericReview(runId),
213
+ stopMember: (ctx, memberId, reason) => {
214
+ if (!stopMemberImpl)
215
+ throw new RuntimeError('INVALID_RUN_STATE', 'Team stopping is not initialized');
216
+ return stopMemberImpl(ctx, memberId, reason);
217
+ },
218
+ steerMember: (ctx, memberId, message) => {
219
+ if (!steerMemberImpl)
220
+ throw new RuntimeError('INVALID_RUN_STATE', 'Team steering is not initialized');
221
+ return steerMemberImpl(ctx, memberId, message);
222
+ },
211
223
  notifyParent: (delivery) => {
212
224
  if (!notifyParentImpl) {
213
225
  return Promise.reject(new RuntimeError('INVALID_RUN_STATE', 'Team notifier is not initialized'));
@@ -461,6 +473,8 @@ async function assembleRuntime(resources, store, root, options, diagnosticDestin
461
473
  });
462
474
  },
463
475
  });
476
+ steerMemberImpl = loop.steerMember;
477
+ stopMemberImpl = loop.stopMember;
464
478
  notifyParentImpl = async ({ runId, from, to, messageId, text }) => {
465
479
  const { route } = await environment.load(runId);
466
480
  const scope = { kind: 'run', workspaceId: route.workspaceId, sessionId: route.sessionId, runId };
@@ -1,10 +1,10 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import type { PromptSection, RunConfig, RunId, ToolBinding, ToolSpec } from '@saturn-universe/core';
3
- import { type TeamNotifyParentDelivery } from '@saturn-universe/tools';
3
+ import { type TeamMemberAction, type TeamNotifyParentDelivery } from '@saturn-universe/tools';
4
4
  import type { ToolConfiguration } from './tools-core-plugin.js';
5
5
  import { type SkillRegistryService } from '../../skills-runtime.js';
6
6
  export declare function teamHintSections(hint: RunConfig['teamHint'], tools: readonly ToolSpec[]): PromptSection[];
7
- export declare function createBuiltinAgentToolsPlugin(root: string, settings: ToolConfiguration['counter'], resultReader?: ToolBinding, previousDataReview?: (runId: RunId) => Promise<boolean>, suppressedGuidanceRoles?: ReadonlySet<'main' | 'worker'>, skillService?: SkillRegistryService, notifyParent?: (delivery: TeamNotifyParentDelivery) => Promise<void>): {
7
+ export declare function createBuiltinAgentToolsPlugin(root: string, settings: ToolConfiguration['counter'], resultReader?: ToolBinding, previousDataReview?: (runId: RunId) => Promise<boolean>, suppressedGuidanceRoles?: ReadonlySet<'main' | 'worker'>, skillService?: SkillRegistryService, notifyParent?: (delivery: TeamNotifyParentDelivery) => Promise<void>, steerMember?: TeamMemberAction, stopMember?: TeamMemberAction): {
8
8
  name: string;
9
9
  inject: string[];
10
10
  apply(ctx: Context, startupSignal: AbortSignal): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { buildTeamHintPrompt } from '@saturn-universe/context';
3
- import { createCounterTool, createDataReviewTool, createPlannerTool, createSpawnTeamTool, createTeamNotifyParentTool, createTodoWriteTool, dataReviewToolSet, teamNotifyParentToolName, } from '@saturn-universe/tools';
3
+ import { createCounterTool, createDataReviewTool, createPlannerTool, createSpawnTeamTool, createTeamNotifyParentTool, createTeamSteerMemberTool, createTeamStopMemberTool, createTodoWriteTool, dataReviewToolSet, teamNotifyParentToolName, } from '@saturn-universe/tools';
4
4
  import { sharedToolPriority } from './tools-core-plugin.js';
5
5
  import { registerToolGuidance } from './tool-guidance.js';
6
6
  import { createNativeSkillTool, skillToolName } from '../../skills-runtime.js';
@@ -19,7 +19,7 @@ export function teamHintSections(hint, tools) {
19
19
  },
20
20
  ];
21
21
  }
22
- export function createBuiltinAgentToolsPlugin(root, settings, resultReader, previousDataReview, suppressedGuidanceRoles, skillService, notifyParent) {
22
+ export function createBuiltinAgentToolsPlugin(root, settings, resultReader, previousDataReview, suppressedGuidanceRoles, skillService, notifyParent, steerMember, stopMember) {
23
23
  return {
24
24
  name: 'builtin-agent-tools',
25
25
  inject: ['saturnTools'],
@@ -52,7 +52,7 @@ export function createBuiltinAgentToolsPlugin(root, settings, resultReader, prev
52
52
  if (depth === 0 && env.config.teamMaxActiveDepth1 !== undefined) {
53
53
  const team = await store.stateReader.team?.(toolCtx.runId);
54
54
  activeDepth1Count = (team?.members ?? []).filter((member) => member.parent === 'main' &&
55
- !['completed', 'failed', 'interrupted'].includes(member.status)).length;
55
+ !['completed', 'failed', 'interrupted', 'stopped'].includes(member.status)).length;
56
56
  }
57
57
  return {
58
58
  memberId,
@@ -127,6 +127,16 @@ export function createBuiltinAgentToolsPlugin(root, settings, resultReader, prev
127
127
  scope: { kind: 'role', roles: ['worker'] },
128
128
  order: { tier: 'tail', priority: 5 },
129
129
  }));
130
+ const memberControls = [
131
+ ...(steerMember ? [createTeamSteerMemberTool(steerMember)] : []),
132
+ ...(stopMember ? [createTeamStopMemberTool(stopMember)] : []),
133
+ ];
134
+ for (const { definition, handler } of memberControls) {
135
+ ctx.effect(() => tools.registerTool(definition, handler, sets.defaultVersions, {
136
+ scope: { kind: 'role', roles: ['main'] },
137
+ order: { tier: 'tail', priority: 6 },
138
+ }));
139
+ }
130
140
  registerToolGuidance(ctx, 'agent-tool-guidance', -30, (visible, config) => {
131
141
  const lines = [];
132
142
  if (visible.has('read_tool_result'))
@@ -1,5 +1,5 @@
1
1
  import type { RunId, ToolBinding } from '@saturn-universe/core';
2
- import type { ProcessManagerOptions, TeamNotifyParentDelivery } from '@saturn-universe/tools';
2
+ import type { ProcessManagerOptions, TeamMemberAction, TeamNotifyParentDelivery } from '@saturn-universe/tools';
3
3
  import type { SkillRegistryService } from '../../skills-runtime.js';
4
4
  import type { RequiredHostPlugin } from '../required-host-plugin.js';
5
5
  import type { ToolConfiguration } from './tools-core-plugin.js';
@@ -12,6 +12,8 @@ export interface HostToolOptions {
12
12
  previousDataReview?: (runId: RunId) => Promise<boolean>;
13
13
  suppressedGuidanceRoles?: ReadonlySet<'main' | 'worker'>;
14
14
  skillService?: SkillRegistryService;
15
+ steerMember?: TeamMemberAction;
16
+ stopMember?: TeamMemberAction;
15
17
  notifyParent?: (delivery: TeamNotifyParentDelivery) => Promise<void>;
16
18
  }
17
19
  export declare function createToolPlugins(root: string, options: HostToolOptions, startupDependencies?: string[], withContext?: boolean): RequiredHostPlugin[];
@@ -4,7 +4,7 @@ import { createProcessManagerPlugin } from './process-manager-plugin.js';
4
4
  import { createToolsCorePlugin } from './tools-core-plugin.js';
5
5
  import { createWorkspaceToolsPlugin } from './workspace-tools-plugin.js';
6
6
  export function createToolPlugins(root, options, startupDependencies = [], withContext = false) {
7
- const { config, trustedConfig, hash, resultReader, processManager, previousDataReview, suppressedGuidanceRoles, skillService, notifyParent, } = options;
7
+ const { config, trustedConfig, hash, resultReader, processManager, previousDataReview, suppressedGuidanceRoles, skillService, notifyParent, steerMember, stopMember, } = options;
8
8
  const effectiveWorkspaceTools = Boolean(config.workspaceTools);
9
9
  const effectiveProcessManager = config.processManager ?? effectiveWorkspaceTools;
10
10
  const effectiveBuiltinAgentTools = config.builtinAgentTools !== false;
@@ -30,7 +30,7 @@ export function createToolPlugins(root, options, startupDependencies = [], withC
30
30
  : []),
31
31
  ...(effectiveBuiltinAgentTools
32
32
  ? [
33
- guidanceOwner(createBuiltinAgentToolsPlugin(root, config.counter, resultReader, previousDataReview, suppressedGuidanceRoles, skillService, notifyParent)),
33
+ guidanceOwner(createBuiltinAgentToolsPlugin(root, config.counter, resultReader, previousDataReview, suppressedGuidanceRoles, skillService, notifyParent, steerMember, stopMember)),
34
34
  ]
35
35
  : []),
36
36
  ...(Object.keys(config.mcpServers ?? {}).length
@@ -1,5 +1,5 @@
1
- import { configForDerivedAgent, RuntimeError } from '@saturn-universe/core';
2
- import { Registry, dataReviewToolName, dataReviewToolSet, outsideWorkspacePrefix, plannerToolName, spawnTeamToolName, teamNotifyParentToolName, todoWriteToolName, } from '@saturn-universe/tools';
1
+ import { configForDerivedAgent, isAsyncCoordinatorConfig, RuntimeError } from '@saturn-universe/core';
2
+ import { Registry, dataReviewToolName, dataReviewToolSet, outsideWorkspacePrefix, plannerToolName, spawnTeamToolName, teamNotifyParentToolName, isTeamMemberControlTool, todoWriteToolName, } from '@saturn-universe/tools';
3
3
  import { resolveWorkerReasoning } from '../../provider-catalog.js';
4
4
  import { skillToolName } from '../../skills-runtime.js';
5
5
  import { contributionScopeKey, globalScope, matchesScope, primaryRole, ScopedLayers, validateContributionScope, } from '../scoped-layers.js';
@@ -280,7 +280,8 @@ function createToolsService(config, trustedConfig, hash) {
280
280
  return { decision: 'allow' };
281
281
  if (definition.name === spawnTeamToolName ||
282
282
  definition.name === todoWriteToolName ||
283
- definition.name === teamNotifyParentToolName)
283
+ definition.name === teamNotifyParentToolName ||
284
+ isTeamMemberControlTool(definition.name))
284
285
  return { decision: 'allow' };
285
286
  if (definition.name === skillToolName)
286
287
  return { decision: 'allow' };
@@ -351,9 +352,9 @@ function createToolsService(config, trustedConfig, hash) {
351
352
  const rawDefinitions = runConfig.team
352
353
  ? snapshot.definitions.map((definition) => teamVariant(definition, runConfig.toolSetVersion))
353
354
  : snapshot.definitions;
354
- const definitions = target.role === 'worker' && !config.workerAllowTargetServices
355
- ? rawDefinitions.filter(({ name }) => !sandboxTargetToolNames.has(name))
356
- : rawDefinitions;
355
+ const allowMemberControl = target.role === 'main' && isAsyncCoordinatorConfig(runConfig);
356
+ const definitions = rawDefinitions.filter(({ name }) => (allowMemberControl || !isTeamMemberControlTool(name)) &&
357
+ (target.role !== 'worker' || config.workerAllowTargetServices || !sandboxTargetToolNames.has(name)));
357
358
  const allowed = runConfig.contextExtensions?.mode?.allowedTools;
358
359
  const denied = runConfig.contextExtensions?.mode?.deniedTools;
359
360
  if (allowed) {
@@ -449,6 +450,7 @@ function createToolsService(config, trustedConfig, hash) {
449
450
  const snapshot = await registry.snapshot(workerBase);
450
451
  const definitions = snapshot.definitions
451
452
  .filter(({ name }) => name !== todoWriteToolName &&
453
+ !isTeamMemberControlTool(name) &&
452
454
  (allowSpawnTeam || name !== spawnTeamToolName) &&
453
455
  (allowNotifyParent || name !== teamNotifyParentToolName) &&
454
456
  (allowTargetServices || !sandboxTargetToolNames.has(name)))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saturn-universe/runtime-host",
3
- "version": "0.1.2-dev.5",
3
+ "version": "0.1.2-dev.6",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "files": [
@@ -8,14 +8,14 @@
8
8
  ],
9
9
  "dependencies": {
10
10
  "@deepseek-ai/cordis": "4.1.0",
11
- "@saturn-universe/context": "0.1.2-dev.5",
12
- "@saturn-universe/core": "0.1.2-dev.5",
13
- "@saturn-universe/model": "0.1.2-dev.5",
14
- "@saturn-universe/plugin-sdk": "0.1.2-dev.5",
15
- "@saturn-universe/protocol": "0.1.2-dev.5",
16
- "@saturn-universe/runtime": "0.1.2-dev.5",
17
- "@saturn-universe/storage": "0.1.2-dev.5",
18
- "@saturn-universe/tools": "0.1.2-dev.5",
11
+ "@saturn-universe/context": "0.1.2-dev.6",
12
+ "@saturn-universe/core": "0.1.2-dev.6",
13
+ "@saturn-universe/model": "0.1.2-dev.6",
14
+ "@saturn-universe/plugin-sdk": "0.1.2-dev.6",
15
+ "@saturn-universe/protocol": "0.1.2-dev.6",
16
+ "@saturn-universe/runtime": "0.1.2-dev.6",
17
+ "@saturn-universe/storage": "0.1.2-dev.6",
18
+ "@saturn-universe/tools": "0.1.2-dev.6",
19
19
  "import-meta-resolve": "4.2.0",
20
20
  "pino": "10.4.0",
21
21
  "semver": "7.7.4",