@saturn-universe/core 0.1.2-dev.5 → 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.
- package/dist/contracts.d.ts +79 -22
- package/dist/team.d.ts +6 -1
- package/dist/team.js +7 -5
- package/package.json +1 -1
package/dist/contracts.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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;
|
|
@@ -427,13 +443,18 @@ export interface TeamMemberState {
|
|
|
427
443
|
readonly parent: string | null;
|
|
428
444
|
readonly agentSessionId: AgentSessionId;
|
|
429
445
|
readonly turnId?: TurnId;
|
|
430
|
-
readonly status:
|
|
446
|
+
readonly status: TeamMemberStatus;
|
|
447
|
+
readonly stopRequest?: {
|
|
448
|
+
readonly requestedBy: 'main';
|
|
449
|
+
readonly reason: string;
|
|
450
|
+
};
|
|
431
451
|
}
|
|
452
|
+
export type TeamMemberStatus = 'waiting' | 'stopped' | TurnStatus;
|
|
432
453
|
export interface TeamTaskState {
|
|
433
454
|
readonly memberId: string;
|
|
434
455
|
readonly task: string;
|
|
435
456
|
readonly turnId?: TurnId;
|
|
436
|
-
readonly status:
|
|
457
|
+
readonly status: TeamMemberStatus;
|
|
437
458
|
readonly resultMessageId?: MessageId;
|
|
438
459
|
}
|
|
439
460
|
export interface TeamInboxMessage {
|
|
@@ -458,6 +479,18 @@ export interface RetryPolicy {
|
|
|
458
479
|
readonly baseDelayMs: number;
|
|
459
480
|
readonly maxDelayMs: number;
|
|
460
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
|
+
}
|
|
461
494
|
export interface RuntimeLimits {
|
|
462
495
|
readonly maxModelAttempts: number;
|
|
463
496
|
readonly maxToolCalls: number;
|
|
@@ -470,10 +503,11 @@ export interface RuntimeLimits {
|
|
|
470
503
|
readonly streamIdleTimeoutMs?: number;
|
|
471
504
|
readonly requestTotalTimeoutMs?: number;
|
|
472
505
|
readonly toolTimeoutMs: number;
|
|
473
|
-
/**
|
|
506
|
+
/** Built-in shell timeout. Falls back to the tool timeout if omitted. */
|
|
474
507
|
readonly shellTimeoutMs?: number;
|
|
475
508
|
readonly maxParallelTools: number;
|
|
476
509
|
}
|
|
510
|
+
export type RuntimeTimingLimits = Pick<RuntimeLimits, 'modelTimeoutMs' | 'streamIdleTimeoutMs' | 'requestTotalTimeoutMs' | 'toolTimeoutMs' | 'shellTimeoutMs' | 'maxParallelTools'>;
|
|
477
511
|
export declare const turnStatuses: readonly ["queued", "running", "paused", "completed", "failed", "interrupted"];
|
|
478
512
|
export type TurnStatus = (typeof turnStatuses)[number];
|
|
479
513
|
export interface Turn {
|
|
@@ -636,12 +670,12 @@ export interface StreamRef {
|
|
|
636
670
|
readonly id: string;
|
|
637
671
|
}
|
|
638
672
|
export type WorkspaceEventType = 'workspace.created' | 'workspace.archived' | 'agent.created';
|
|
639
|
-
export type SessionEventType = 'session.created' | 'session.archived' | 'session.agent.bound';
|
|
673
|
+
export type SessionEventType = 'session.created' | 'session.archived' | 'session.agent.bound' | 'session.mode.selected';
|
|
640
674
|
export declare const terminalRunEventTypes: readonly ("run.completed" | "run.failed" | "run.cancelled")[];
|
|
641
675
|
export type TerminalRunEventType = (typeof terminalRunEventTypes)[number];
|
|
642
676
|
export declare function isTerminalRunEventType(value: unknown): value is TerminalRunEventType;
|
|
643
677
|
export type RunTransition = 'run.started' | 'run.paused' | 'run.resumed' | 'run.cancel_requested' | TerminalRunEventType;
|
|
644
|
-
export type RunEventType = 'run.created' | 'run.agent.attached' | 'run.team.planned' | 'run.team.message.sent' | 'run.team.message.read' | 'run.search.started' | 'run.search.branch.created' | 'run.search.branch.evaluated' | 'run.search.converged' | 'run.plugin.availability' | RunTransition;
|
|
678
|
+
export type RunEventType = 'run.created' | 'run.agent.attached' | 'run.team.planned' | 'run.team.member.stop_requested' | 'run.team.message.sent' | 'run.team.message.read' | 'run.search.started' | 'run.search.branch.created' | 'run.search.branch.evaluated' | 'run.search.converged' | 'run.plugin.availability' | RunTransition;
|
|
645
679
|
export type ScopeFor<K> = K extends WorkspaceEventType ? WorkspaceScope : K extends SessionEventType ? SessionScope : K extends RunEventType ? RunScope : K extends 'agent_session.created' | 'agent_session.archived' | 'surface.compacted' ? AgentSessionEventScope : AgentExecutionScope;
|
|
646
680
|
export interface EventMetadata {
|
|
647
681
|
readonly actor: {
|
|
@@ -694,6 +728,9 @@ export interface EventDataMap {
|
|
|
694
728
|
'session.archived': {
|
|
695
729
|
readonly reason: string;
|
|
696
730
|
};
|
|
731
|
+
'session.mode.selected': {
|
|
732
|
+
readonly modeRef: string;
|
|
733
|
+
};
|
|
697
734
|
'agent_session.created': {
|
|
698
735
|
readonly agentSession: AgentSession;
|
|
699
736
|
};
|
|
@@ -720,6 +757,13 @@ export interface EventDataMap {
|
|
|
720
757
|
readonly verificationCriteria?: readonly string[];
|
|
721
758
|
readonly team?: TeamConfig;
|
|
722
759
|
};
|
|
760
|
+
'run.team.member.stop_requested': {
|
|
761
|
+
readonly memberId: string;
|
|
762
|
+
readonly turnId: TurnId;
|
|
763
|
+
readonly requesterAgentSessionId: AgentSessionId;
|
|
764
|
+
readonly requestedBy: 'main';
|
|
765
|
+
readonly reason: string;
|
|
766
|
+
};
|
|
723
767
|
'run.team.message.sent': {
|
|
724
768
|
readonly messageId: string;
|
|
725
769
|
readonly from: string;
|
|
@@ -829,6 +873,7 @@ export interface EventDataMap {
|
|
|
829
873
|
};
|
|
830
874
|
'turn.interrupted': {
|
|
831
875
|
readonly turnId: TurnId;
|
|
876
|
+
readonly stoppedByMain?: true;
|
|
832
877
|
readonly reason: 'cancelled' | 'timeout' | 'limit';
|
|
833
878
|
readonly usage: Usage;
|
|
834
879
|
readonly unresolvedCallIds: readonly ToolCallId[];
|
|
@@ -851,6 +896,7 @@ export interface EventDataMap {
|
|
|
851
896
|
'message.user.added': {
|
|
852
897
|
readonly message: UserMessage;
|
|
853
898
|
readonly steering?: true;
|
|
899
|
+
readonly steeringSource?: 'main';
|
|
854
900
|
};
|
|
855
901
|
'message.assistant.added': {
|
|
856
902
|
readonly message: AssistantMessage;
|
|
@@ -1157,6 +1203,7 @@ export interface PersistedResponsesHistoryPlan {
|
|
|
1157
1203
|
readonly initialSystemPrompt?: string;
|
|
1158
1204
|
readonly initialBackground?: readonly BackgroundHistoryMessage[];
|
|
1159
1205
|
readonly prunedToolResults?: boolean;
|
|
1206
|
+
readonly projectedToolHistory?: true;
|
|
1160
1207
|
readonly fullInputDigest: string;
|
|
1161
1208
|
readonly configurationDigest: string;
|
|
1162
1209
|
readonly backgroundDigest?: string;
|
|
@@ -1199,6 +1246,8 @@ export interface HistorySelection {
|
|
|
1199
1246
|
}
|
|
1200
1247
|
export interface HistoryBuildInput {
|
|
1201
1248
|
readonly surface: SessionSurface;
|
|
1249
|
+
readonly modeRef?: string;
|
|
1250
|
+
readonly historicalRunModes?: Readonly<Record<string, string>>;
|
|
1202
1251
|
readonly model: ModelRef;
|
|
1203
1252
|
readonly binding: ProviderBinding;
|
|
1204
1253
|
readonly capabilities: ModelCapabilities;
|
|
@@ -1822,6 +1871,7 @@ export interface ContextStateSnapshot {
|
|
|
1822
1871
|
readonly surface: SessionSurface;
|
|
1823
1872
|
readonly runState: RunState;
|
|
1824
1873
|
readonly activeRequest?: PersistedModelRequest;
|
|
1874
|
+
readonly historicalRunModes?: Readonly<Record<string, string>>;
|
|
1825
1875
|
readonly teamReports?: readonly {
|
|
1826
1876
|
readonly from: string;
|
|
1827
1877
|
readonly text: string;
|
|
@@ -2096,7 +2146,10 @@ export interface ProtocolRequest {
|
|
|
2096
2146
|
readonly command: RuntimeCommand;
|
|
2097
2147
|
}
|
|
2098
2148
|
export type HostSubmitInput = Omit<SubmitTask, 'commandId' | 'config' | 'plannerConfig'> & {
|
|
2099
|
-
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
|
+
};
|
|
2100
2153
|
readonly skillRefs?: readonly string[];
|
|
2101
2154
|
readonly model?: ModelRef;
|
|
2102
2155
|
readonly profile?: string;
|
|
@@ -2109,6 +2162,10 @@ export type HostSubmitInput = Omit<SubmitTask, 'commandId' | 'config' | 'planner
|
|
|
2109
2162
|
export type HostCommand = Exclude<RuntimeCommand, {
|
|
2110
2163
|
readonly type: 'run.submit' | 'tool.approval.resolve';
|
|
2111
2164
|
}> | {
|
|
2165
|
+
readonly type: 'session.mode.select';
|
|
2166
|
+
readonly sessionId: SessionId;
|
|
2167
|
+
readonly modeRef: string;
|
|
2168
|
+
} | {
|
|
2112
2169
|
readonly type: 'run.steer';
|
|
2113
2170
|
readonly runId: RunId;
|
|
2114
2171
|
readonly content: string;
|
package/dist/team.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { PlannerConfig, RunConfig, TeamConfig, TeamHintConfig } from './contracts.js';
|
|
2
|
+
export interface TeamMemberActionResult {
|
|
3
|
+
readonly status: 'accepted' | 'ended' | 'inactive' | 'invalid_target' | 'forbidden';
|
|
4
|
+
readonly message: string;
|
|
5
|
+
}
|
|
2
6
|
export declare const teamRootId = "main";
|
|
3
7
|
export declare const plannerMemberId = "planner";
|
|
4
8
|
export declare const defaultTeamConcurrency = 4;
|
|
5
9
|
export declare const maxTeamDepth = 2;
|
|
6
10
|
export declare const maxTeamMembers = 16;
|
|
7
11
|
export declare const maxAsyncTeamMembers = 256;
|
|
12
|
+
export declare const teamModeSelectorPattern: RegExp;
|
|
8
13
|
export declare const teamMemberIdPattern: RegExp;
|
|
9
14
|
export declare const teamNotifyMessagePrefix = "notify:";
|
|
10
15
|
export declare const defaultCoordinatorPollIntervalMs = 600000;
|
|
@@ -12,7 +17,7 @@ export declare function teamConcurrency(team: TeamConfig): number;
|
|
|
12
17
|
export declare function isTeamNotifyMessageId(messageId: string): boolean;
|
|
13
18
|
export declare function isAsyncCoordinatorConfig(config: Pick<RunConfig, 'modeRef' | 'teamAsyncCoordinator'>): boolean;
|
|
14
19
|
/** Resolve the total concurrent non-root worker limit consistently across scheduler and projection. */
|
|
15
|
-
export declare function resolveEffectiveTeamConcurrency(
|
|
20
|
+
export declare function resolveEffectiveTeamConcurrency(requested: number | undefined, config?: Pick<RunConfig, 'teamDefaultConcurrency' | 'teamMaxConcurrency'>): number;
|
|
16
21
|
export declare function maxRunTeamWorkers(config: Pick<RunConfig, 'modeRef' | 'teamAsyncCoordinator' | 'teamHint'>): number;
|
|
17
22
|
export declare function coordinatorPollIntervalMs(config: Pick<RunConfig, 'coordinatorPollIntervalMs'>): number;
|
|
18
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(
|
|
24
|
-
|
|
25
|
-
|
|
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
|
}
|