@saturn-universe/core 0.1.2-dev.6 → 0.1.2-dev.9

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.
@@ -39,6 +39,7 @@ export interface Session {
39
39
  readonly title: string;
40
40
  readonly status: 'open' | 'archived';
41
41
  readonly createdAt: ISODateTime;
42
+ readonly modeRef?: string;
42
43
  }
43
44
  export type AgentSessionScope = 'run' | 'session' | 'project';
44
45
  export type AgentSessionOwner = {
@@ -119,14 +120,21 @@ export interface ModePromptsConfig {
119
120
  readonly worker?: readonly ModeRolePromptSection[];
120
121
  }>;
121
122
  }
122
- export interface ModeToolsConfig {
123
+ export interface ModeToolFilter {
124
+ readonly allowedTools?: readonly string[];
125
+ readonly deniedTools?: readonly string[];
126
+ }
127
+ export interface ModeToolsConfig extends ModeToolFilter {
123
128
  readonly workspaceTools?: boolean;
124
129
  readonly processManager?: boolean;
125
130
  readonly builtinAgentTools?: boolean;
126
- readonly allowedTools?: readonly string[];
127
- readonly deniedTools?: readonly string[];
131
+ readonly roles?: Readonly<Partial<Record<'main' | 'worker', ModeToolFilter>>>;
128
132
  readonly permissionMode?: PermissionMode;
129
133
  }
134
+ export interface ModeReasoningConfig {
135
+ readonly mainEffort?: string;
136
+ readonly workerEffort?: string;
137
+ }
130
138
  export interface ModePluginToolsGrant {
131
139
  readonly allowedTools: readonly string[];
132
140
  readonly readOnlyTools?: readonly string[];
@@ -195,18 +203,11 @@ export interface ModeTeamConfig {
195
203
  readonly coordinatorPollIntervalMs?: number;
196
204
  readonly workerSoftCheckpointMs?: number;
197
205
  readonly maxActiveDepth1?: number;
206
+ readonly defaultConcurrency?: number;
198
207
  readonly maxConcurrency?: number;
208
+ readonly defaultPreset?: string;
199
209
  }
200
- export interface ModeLimitsConfig {
201
- readonly maxModelAttempts?: number;
202
- readonly maxToolCalls?: number;
203
- readonly maxSteps?: number;
204
- readonly maxTotalTokens?: number;
205
- readonly subagentMaxModelAttempts?: number;
206
- readonly wallTimeMs?: number;
207
- readonly subagentWallTimeMs?: number;
208
- readonly toolTimeoutMs?: number;
209
- }
210
+ export type ModeLimitsConfig = Partial<RuntimeLimits>;
210
211
  export interface ModeDefinition {
211
212
  readonly ref: string;
212
213
  readonly displayName: string;
@@ -214,10 +215,13 @@ export interface ModeDefinition {
214
215
  readonly builtin?: boolean;
215
216
  readonly prompts?: ModePromptsConfig;
216
217
  readonly tools?: ModeToolsConfig;
218
+ readonly reasoning?: ModeReasoningConfig;
217
219
  readonly plugins?: readonly ModePluginBinding[];
218
220
  readonly sandbox?: SandboxConfig;
219
221
  readonly team?: ModeTeamConfig;
220
222
  readonly limits?: ModeLimitsConfig;
223
+ readonly retry?: Partial<RetryPolicy>;
224
+ readonly compaction?: AutoCompactionOptions;
221
225
  }
222
226
  export interface ModeSummary {
223
227
  readonly ref: string;
@@ -233,15 +237,15 @@ export interface RunConfig {
233
237
  readonly coordinatorPollIntervalMs?: number;
234
238
  readonly workerSoftCheckpointMs?: number;
235
239
  readonly teamMaxActiveDepth1?: number;
240
+ readonly teamDefaultConcurrency?: number;
236
241
  readonly teamMaxConcurrency?: number;
237
242
  readonly teamHint?: TeamHintConfig;
238
243
  readonly planner?: PlannerConfig;
239
244
  readonly contextExtensions?: {
240
- readonly mode?: {
245
+ readonly mode?: ModeToolFilter & {
241
246
  readonly ref: string;
242
247
  readonly instructions: string;
243
- readonly allowedTools?: readonly string[];
244
- readonly deniedTools?: readonly string[];
248
+ readonly toolRoles?: ModeToolsConfig['roles'];
245
249
  };
246
250
  readonly skills: readonly FrozenSkill[];
247
251
  };
@@ -253,9 +257,20 @@ export interface RunConfig {
253
257
  readonly toolSetVersion: string;
254
258
  readonly streamText?: boolean;
255
259
  readonly workerReasoningEffort?: string;
260
+ readonly workerReasoningDefaults?: {
261
+ readonly reasoning: NonNullable<ResponsesRequestOptions['reasoning']> | null;
262
+ readonly modeEffort?: string;
263
+ readonly explicitEffort?: true;
264
+ };
256
265
  readonly disabledSkills?: readonly string[];
257
266
  readonly limits: RuntimeLimits;
258
267
  readonly retry: RetryPolicy;
268
+ readonly compaction?: AutoCompactionOptions;
269
+ readonly runtimeOverrides?: {
270
+ readonly limits?: Partial<RuntimeTimingLimits>;
271
+ readonly retry?: Partial<RetryPolicy>;
272
+ readonly compaction?: AutoCompactionOptions;
273
+ };
259
274
  readonly responses: ResponsesRequestOptions;
260
275
  readonly continuation?: RunContinuationConfig;
261
276
  readonly search?: TreeSearchConfig;
@@ -413,6 +428,7 @@ export interface TeamMemberConfig {
413
428
  readonly task: string;
414
429
  readonly sandboxProfile?: WorkerSandboxProfile;
415
430
  readonly workSubpath?: string;
431
+ readonly modeRef?: string;
416
432
  }
417
433
  export interface TeamState {
418
434
  readonly runId: RunId;
@@ -463,6 +479,18 @@ export interface RetryPolicy {
463
479
  readonly baseDelayMs: number;
464
480
  readonly maxDelayMs: number;
465
481
  }
482
+ export interface AutoCompactionOptions {
483
+ readonly enabled?: boolean;
484
+ readonly thresholdRatio?: number;
485
+ readonly maxHeadroomTokens?: number;
486
+ readonly headroomRatio?: number;
487
+ readonly minRecentSteps?: number;
488
+ readonly tailWindowRatio?: number;
489
+ readonly preflightWindowRatio?: number;
490
+ readonly maxHalvings?: number;
491
+ readonly minPrefixChars?: number;
492
+ readonly summaryTimeoutMs?: number;
493
+ }
466
494
  export interface RuntimeLimits {
467
495
  readonly maxModelAttempts: number;
468
496
  readonly maxToolCalls: number;
@@ -475,10 +503,11 @@ export interface RuntimeLimits {
475
503
  readonly streamIdleTimeoutMs?: number;
476
504
  readonly requestTotalTimeoutMs?: number;
477
505
  readonly toolTimeoutMs: number;
478
- /** Host limit for built-in shell when no tool timeout was configured. */
506
+ /** Built-in shell timeout. Falls back to the tool timeout if omitted. */
479
507
  readonly shellTimeoutMs?: number;
480
508
  readonly maxParallelTools: number;
481
509
  }
510
+ export type RuntimeTimingLimits = Pick<RuntimeLimits, 'modelTimeoutMs' | 'streamIdleTimeoutMs' | 'requestTotalTimeoutMs' | 'toolTimeoutMs' | 'shellTimeoutMs' | 'maxParallelTools'>;
482
511
  export declare const turnStatuses: readonly ["queued", "running", "paused", "completed", "failed", "interrupted"];
483
512
  export type TurnStatus = (typeof turnStatuses)[number];
484
513
  export interface Turn {
@@ -641,7 +670,7 @@ export interface StreamRef {
641
670
  readonly id: string;
642
671
  }
643
672
  export type WorkspaceEventType = 'workspace.created' | 'workspace.archived' | 'agent.created';
644
- export type SessionEventType = 'session.created' | 'session.archived' | 'session.agent.bound';
673
+ export type SessionEventType = 'session.created' | 'session.archived' | 'session.agent.bound' | 'session.mode.selected';
645
674
  export declare const terminalRunEventTypes: readonly ("run.completed" | "run.failed" | "run.cancelled")[];
646
675
  export type TerminalRunEventType = (typeof terminalRunEventTypes)[number];
647
676
  export declare function isTerminalRunEventType(value: unknown): value is TerminalRunEventType;
@@ -699,6 +728,9 @@ export interface EventDataMap {
699
728
  'session.archived': {
700
729
  readonly reason: string;
701
730
  };
731
+ 'session.mode.selected': {
732
+ readonly modeRef: string;
733
+ };
702
734
  'agent_session.created': {
703
735
  readonly agentSession: AgentSession;
704
736
  };
@@ -1171,6 +1203,7 @@ export interface PersistedResponsesHistoryPlan {
1171
1203
  readonly initialSystemPrompt?: string;
1172
1204
  readonly initialBackground?: readonly BackgroundHistoryMessage[];
1173
1205
  readonly prunedToolResults?: boolean;
1206
+ readonly projectedToolHistory?: true;
1174
1207
  readonly fullInputDigest: string;
1175
1208
  readonly configurationDigest: string;
1176
1209
  readonly backgroundDigest?: string;
@@ -1213,6 +1246,8 @@ export interface HistorySelection {
1213
1246
  }
1214
1247
  export interface HistoryBuildInput {
1215
1248
  readonly surface: SessionSurface;
1249
+ readonly modeRef?: string;
1250
+ readonly historicalRunModes?: Readonly<Record<string, string>>;
1216
1251
  readonly model: ModelRef;
1217
1252
  readonly binding: ProviderBinding;
1218
1253
  readonly capabilities: ModelCapabilities;
@@ -1836,6 +1871,7 @@ export interface ContextStateSnapshot {
1836
1871
  readonly surface: SessionSurface;
1837
1872
  readonly runState: RunState;
1838
1873
  readonly activeRequest?: PersistedModelRequest;
1874
+ readonly historicalRunModes?: Readonly<Record<string, string>>;
1839
1875
  readonly teamReports?: readonly {
1840
1876
  readonly from: string;
1841
1877
  readonly text: string;
@@ -2110,7 +2146,10 @@ export interface ProtocolRequest {
2110
2146
  readonly command: RuntimeCommand;
2111
2147
  }
2112
2148
  export type HostSubmitInput = Omit<SubmitTask, 'commandId' | 'config' | 'plannerConfig'> & {
2113
- readonly config?: Partial<Omit<RunConfig, 'providerBinding' | 'contextExtensions' | 'toolSnapshot' | 'pluginBindings' | 'checkpoint'>>;
2149
+ readonly config?: Partial<Omit<RunConfig, 'providerBinding' | 'contextExtensions' | 'toolSnapshot' | 'pluginBindings' | 'checkpoint' | 'workerReasoningDefaults' | 'limits' | 'retry' | 'runtimeOverrides'>> & {
2150
+ readonly limits?: Partial<RuntimeLimits>;
2151
+ readonly retry?: Partial<RetryPolicy>;
2152
+ };
2114
2153
  readonly skillRefs?: readonly string[];
2115
2154
  readonly model?: ModelRef;
2116
2155
  readonly profile?: string;
@@ -2123,6 +2162,10 @@ export type HostSubmitInput = Omit<SubmitTask, 'commandId' | 'config' | 'planner
2123
2162
  export type HostCommand = Exclude<RuntimeCommand, {
2124
2163
  readonly type: 'run.submit' | 'tool.approval.resolve';
2125
2164
  }> | {
2165
+ readonly type: 'session.mode.select';
2166
+ readonly sessionId: SessionId;
2167
+ readonly modeRef: string;
2168
+ } | {
2126
2169
  readonly type: 'run.steer';
2127
2170
  readonly runId: RunId;
2128
2171
  readonly content: string;
package/dist/team.d.ts CHANGED
@@ -9,6 +9,7 @@ export declare const defaultTeamConcurrency = 4;
9
9
  export declare const maxTeamDepth = 2;
10
10
  export declare const maxTeamMembers = 16;
11
11
  export declare const maxAsyncTeamMembers = 256;
12
+ export declare const teamModeSelectorPattern: RegExp;
12
13
  export declare const teamMemberIdPattern: RegExp;
13
14
  export declare const teamNotifyMessagePrefix = "notify:";
14
15
  export declare const defaultCoordinatorPollIntervalMs = 600000;
@@ -16,7 +17,7 @@ export declare function teamConcurrency(team: TeamConfig): number;
16
17
  export declare function isTeamNotifyMessageId(messageId: string): boolean;
17
18
  export declare function isAsyncCoordinatorConfig(config: Pick<RunConfig, 'modeRef' | 'teamAsyncCoordinator'>): boolean;
18
19
  /** Resolve the total concurrent non-root worker limit consistently across scheduler and projection. */
19
- export declare function resolveEffectiveTeamConcurrency(teamConcurrencyValue: number, config: Pick<RunConfig, 'teamMaxConcurrency'> | undefined, asyncCoordinator: boolean): number;
20
+ export declare function resolveEffectiveTeamConcurrency(requested: number | undefined, config?: Pick<RunConfig, 'teamDefaultConcurrency' | 'teamMaxConcurrency'>): number;
20
21
  export declare function maxRunTeamWorkers(config: Pick<RunConfig, 'modeRef' | 'teamAsyncCoordinator' | 'teamHint'>): number;
21
22
  export declare function coordinatorPollIntervalMs(config: Pick<RunConfig, 'coordinatorPollIntervalMs'>): number;
22
23
  export declare function validateWorkSubpath(raw: string): string;
package/dist/team.js CHANGED
@@ -5,6 +5,7 @@ export const defaultTeamConcurrency = 4;
5
5
  export const maxTeamDepth = 2;
6
6
  export const maxTeamMembers = 16;
7
7
  export const maxAsyncTeamMembers = 256;
8
+ export const teamModeSelectorPattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}(?:@[A-Za-z0-9][A-Za-z0-9._-]{0,63})?$/;
8
9
  export const teamMemberIdPattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
9
10
  export const teamNotifyMessagePrefix = 'notify:';
10
11
  export const defaultCoordinatorPollIntervalMs = 600_000;
@@ -20,11 +21,9 @@ export function isAsyncCoordinatorConfig(config) {
20
21
  return config.modeRef === 'ctf@1' || config.modeRef.startsWith('ctf@');
21
22
  }
22
23
  /** Resolve the total concurrent non-root worker limit consistently across scheduler and projection. */
23
- export function resolveEffectiveTeamConcurrency(teamConcurrencyValue, config, asyncCoordinator) {
24
- if (asyncCoordinator && config?.teamMaxConcurrency !== undefined) {
25
- return Math.max(1, config.teamMaxConcurrency);
26
- }
27
- return Math.max(1, Math.min(teamConcurrencyValue, config?.teamMaxConcurrency ?? teamConcurrencyValue));
24
+ export function resolveEffectiveTeamConcurrency(requested, config) {
25
+ const concurrency = requested ?? config?.teamDefaultConcurrency ?? defaultTeamConcurrency;
26
+ return Math.max(1, Math.min(concurrency, config?.teamMaxConcurrency ?? concurrency));
28
27
  }
29
28
  export function maxRunTeamWorkers(config) {
30
29
  if (config.teamHint?.maxMembers !== undefined)
@@ -90,6 +89,9 @@ export function validateTeamConfig(value, options) {
90
89
  member.sandboxProfile !== 'readonly' &&
91
90
  member.sandboxProfile !== 'build')
92
91
  invalid(`invalid sandboxProfile for team member ${member.id}`);
92
+ if (member.modeRef !== undefined &&
93
+ (typeof member.modeRef !== 'string' || !teamModeSelectorPattern.test(member.modeRef)))
94
+ invalid(`invalid modeRef for team member ${member.id}`);
93
95
  if (member.workSubpath !== undefined) {
94
96
  validateWorkSubpath(member.workSubpath);
95
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saturn-universe/core",
3
- "version": "0.1.2-dev.6",
3
+ "version": "0.1.2-dev.9",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "files": [