remote-codex 0.1.9 → 0.11.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/apps/supervisor-api/dist/index.js +11942 -6101
- package/apps/supervisor-web/dist/assets/{highlighted-body-OFNGDK62-BFD4Ytvg.js → highlighted-body-OFNGDK62-ChrwAL9u.js} +1 -1
- package/apps/supervisor-web/dist/assets/index-DHf2HOXx.js +381 -0
- package/apps/supervisor-web/dist/assets/index-DpWxXCgt.css +32 -0
- package/apps/supervisor-web/dist/assets/{xterm-CukFWbxr.js → xterm-D4sevve4.js} +1 -1
- package/apps/supervisor-web/dist/index.html +2 -2
- package/config/codex-model-pricing.json +63 -0
- package/package.json +5 -2
- package/packages/agent-runtime/src/index.ts +4 -0
- package/packages/agent-runtime/src/management-errors.ts +11 -0
- package/packages/agent-runtime/src/model-pricing.ts +312 -0
- package/packages/agent-runtime/src/registry.ts +19 -4
- package/packages/agent-runtime/src/runtime-errors.ts +97 -0
- package/packages/agent-runtime/src/types.ts +50 -4
- package/packages/agent-runtime/src/unavailable-runtime.ts +169 -0
- package/packages/claude/src/historyItems.ts +693 -0
- package/packages/claude/src/index.ts +2 -0
- package/packages/claude/src/runtimeAdapter.test.ts +2138 -0
- package/packages/claude/src/runtimeAdapter.ts +2145 -0
- package/packages/codex/src/appServerManager.ts +12 -3
- package/packages/codex/src/historyItems.test.ts +110 -0
- package/packages/codex/src/historyItems.ts +97 -16
- package/packages/codex/src/hookHistory.test.ts +59 -0
- package/packages/codex/src/index.ts +7 -0
- package/packages/codex/src/local-session-store.ts +390 -0
- package/packages/codex/src/management/codex-management-service.ts +454 -0
- package/packages/codex/src/management/codexHostConfig.test.ts +88 -0
- package/packages/codex/src/management/codexHostConfig.ts +188 -0
- package/packages/codex/src/management/errors.ts +20 -0
- package/packages/codex/src/modelPricing.test.ts +184 -0
- package/packages/codex/src/modelPricing.ts +9 -0
- package/packages/codex/src/runtime-errors.test.ts +72 -0
- package/packages/codex/src/runtime-errors.ts +37 -0
- package/packages/codex/src/runtimeAdapter.ts +25 -2
- package/packages/codex/src/thread-title.ts +1 -0
- package/packages/db/src/repositories.ts +30 -0
- package/packages/opencode/src/historyItems.test.ts +504 -0
- package/packages/opencode/src/historyItems.ts +896 -0
- package/packages/opencode/src/index.ts +2 -0
- package/packages/opencode/src/runtimeAdapter.test.ts +1355 -0
- package/packages/opencode/src/runtimeAdapter.ts +1469 -0
- package/packages/shared/src/agent-providers.ts +56 -0
- package/packages/shared/src/index.ts +174 -35
- package/apps/supervisor-web/dist/assets/index-CbIt0KnL.css +0 -32
- package/apps/supervisor-web/dist/assets/index-Rd2EBQac.js +0 -377
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const agentBackendIds = ['codex', 'claude', 'opencode'] as const;
|
|
2
|
+
|
|
3
|
+
export type AgentBackendIdDto = (typeof agentBackendIds)[number];
|
|
4
|
+
|
|
5
|
+
export const defaultAgentBackendId: AgentBackendIdDto = 'codex';
|
|
6
|
+
|
|
7
|
+
export interface AgentBackendMetadata {
|
|
8
|
+
displayName: string;
|
|
9
|
+
description: string;
|
|
10
|
+
defaultTransport: 'stdio' | 'sdk' | 'none';
|
|
11
|
+
homeEnvVar: string;
|
|
12
|
+
commandEnvVar: string;
|
|
13
|
+
defaultHomeDir: string;
|
|
14
|
+
defaultCommand: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const agentBackendMetadata: Record<AgentBackendIdDto, AgentBackendMetadata> = {
|
|
18
|
+
codex: {
|
|
19
|
+
displayName: 'Codex',
|
|
20
|
+
description: 'Local Codex app-server runtime.',
|
|
21
|
+
defaultTransport: 'stdio',
|
|
22
|
+
homeEnvVar: 'CODEX_HOME',
|
|
23
|
+
commandEnvVar: 'CODEX_COMMAND',
|
|
24
|
+
defaultHomeDir: '.codex',
|
|
25
|
+
defaultCommand: 'codex',
|
|
26
|
+
},
|
|
27
|
+
claude: {
|
|
28
|
+
displayName: 'Claude Code',
|
|
29
|
+
description: 'Local Claude Code Agent SDK runtime.',
|
|
30
|
+
defaultTransport: 'sdk',
|
|
31
|
+
homeEnvVar: 'CLAUDE_HOME',
|
|
32
|
+
commandEnvVar: 'CLAUDE_COMMAND',
|
|
33
|
+
defaultHomeDir: '.claude',
|
|
34
|
+
defaultCommand: 'claude',
|
|
35
|
+
},
|
|
36
|
+
opencode: {
|
|
37
|
+
displayName: 'OpenCode',
|
|
38
|
+
description: 'Local OpenCode runtime.',
|
|
39
|
+
defaultTransport: 'sdk',
|
|
40
|
+
homeEnvVar: 'OPENCODE_HOME',
|
|
41
|
+
commandEnvVar: 'OPENCODE_COMMAND',
|
|
42
|
+
defaultHomeDir: '.opencode',
|
|
43
|
+
defaultCommand: 'opencode',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export function isAgentBackendId(value: unknown): value is AgentBackendIdDto {
|
|
48
|
+
return (
|
|
49
|
+
typeof value === 'string' &&
|
|
50
|
+
agentBackendIds.includes(value as AgentBackendIdDto)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function normalizeAgentBackendId(value: unknown): AgentBackendIdDto | null {
|
|
55
|
+
return isAgentBackendId(value) ? value : null;
|
|
56
|
+
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AgentBackendIdDto,
|
|
3
|
+
} from './agent-providers';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
agentBackendIds,
|
|
7
|
+
agentBackendMetadata,
|
|
8
|
+
defaultAgentBackendId,
|
|
9
|
+
isAgentBackendId,
|
|
10
|
+
normalizeAgentBackendId,
|
|
11
|
+
} from './agent-providers';
|
|
12
|
+
export type {
|
|
13
|
+
AgentBackendIdDto,
|
|
14
|
+
AgentBackendMetadata,
|
|
15
|
+
} from './agent-providers';
|
|
16
|
+
|
|
1
17
|
export type ApiErrorCode =
|
|
2
18
|
| 'bad_request'
|
|
3
19
|
| 'not_found'
|
|
@@ -14,6 +30,26 @@ export interface ApiErrorShape {
|
|
|
14
30
|
details?: Record<string, unknown>;
|
|
15
31
|
}
|
|
16
32
|
|
|
33
|
+
const AUTO_THREAD_TITLE_MAX_CHARS = 15;
|
|
34
|
+
|
|
35
|
+
function normalizeAutoThreadTitleWhitespace(value: string) {
|
|
36
|
+
return value.replace(/\s+/g, ' ').trim();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function truncateAutoThreadTitle(value: string) {
|
|
40
|
+
const normalized = normalizeAutoThreadTitleWhitespace(value);
|
|
41
|
+
if (!normalized) {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const characters = Array.from(normalized);
|
|
46
|
+
if (characters.length <= AUTO_THREAD_TITLE_MAX_CHARS) {
|
|
47
|
+
return normalized;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return `${characters.slice(0, AUTO_THREAD_TITLE_MAX_CHARS).join('')}...`;
|
|
51
|
+
}
|
|
52
|
+
|
|
17
53
|
export interface RuntimeConfigDto {
|
|
18
54
|
appName: string;
|
|
19
55
|
appVersion: string;
|
|
@@ -23,8 +59,6 @@ export interface RuntimeConfigDto {
|
|
|
23
59
|
environment: string;
|
|
24
60
|
}
|
|
25
61
|
|
|
26
|
-
export type AgentBackendIdDto = 'codex' | 'claude';
|
|
27
|
-
|
|
28
62
|
export interface AgentRuntimeStatusDto {
|
|
29
63
|
state: 'starting' | 'ready' | 'degraded' | 'stopped' | 'failed';
|
|
30
64
|
transport: 'stdio' | 'sdk' | 'none';
|
|
@@ -85,6 +119,18 @@ export interface AgentBackendDto {
|
|
|
85
119
|
status: AgentRuntimeStatusDto;
|
|
86
120
|
capabilities: AgentProviderCapabilitiesDto;
|
|
87
121
|
managementSchema: AgentBackendManagementSchemaDto;
|
|
122
|
+
installation: AgentBackendInstallationDto;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface AgentBackendInstallationDto {
|
|
126
|
+
packageName: string | null;
|
|
127
|
+
installed: boolean;
|
|
128
|
+
installedVersion: string | null;
|
|
129
|
+
latestVersion: string | null;
|
|
130
|
+
installCommand: string | null;
|
|
131
|
+
updateCommand: string | null;
|
|
132
|
+
busy: boolean;
|
|
133
|
+
lastError: string | null;
|
|
88
134
|
}
|
|
89
135
|
|
|
90
136
|
export interface AgentBackendConfigFileSchemaDto {
|
|
@@ -133,8 +179,9 @@ export interface ModelOptionDto {
|
|
|
133
179
|
description: string;
|
|
134
180
|
isDefault: boolean;
|
|
135
181
|
hidden: boolean;
|
|
182
|
+
supportsPerformanceMode?: boolean;
|
|
136
183
|
supportedReasoningEfforts: ReasoningEffortOptionDto[];
|
|
137
|
-
defaultReasoningEffort: ReasoningEffortDto;
|
|
184
|
+
defaultReasoningEffort: ReasoningEffortDto | null;
|
|
138
185
|
}
|
|
139
186
|
|
|
140
187
|
export interface VersionDto {
|
|
@@ -306,8 +353,11 @@ export interface ThreadHistoryItemDto {
|
|
|
306
353
|
| 'reasoning'
|
|
307
354
|
| 'commandExecution'
|
|
308
355
|
| 'webSearch'
|
|
356
|
+
| 'fileRead'
|
|
309
357
|
| 'fileChange'
|
|
310
358
|
| 'hook'
|
|
359
|
+
| 'agentToolCall'
|
|
360
|
+
| 'skillToolCall'
|
|
311
361
|
| 'toolCall'
|
|
312
362
|
| 'other';
|
|
313
363
|
text: string;
|
|
@@ -315,6 +365,7 @@ export interface ThreadHistoryItemDto {
|
|
|
315
365
|
detailText?: string | null;
|
|
316
366
|
hasDeferredDetail?: boolean | null;
|
|
317
367
|
sequence?: number | null;
|
|
368
|
+
sourceTurnId?: string | null;
|
|
318
369
|
status?: string | null;
|
|
319
370
|
assetPath?: string | null;
|
|
320
371
|
changedFiles?: number | null;
|
|
@@ -388,6 +439,7 @@ export interface ThreadActionQuestionDto {
|
|
|
388
439
|
id: string;
|
|
389
440
|
header: string;
|
|
390
441
|
question: string;
|
|
442
|
+
multiSelect?: boolean;
|
|
391
443
|
isOther: boolean;
|
|
392
444
|
isSecret: boolean;
|
|
393
445
|
options: ThreadActionQuestionOptionDto[] | null;
|
|
@@ -791,40 +843,127 @@ export interface RespondThreadActionRequestInput {
|
|
|
791
843
|
answers: Record<string, ThreadActionRequestAnswerDto>;
|
|
792
844
|
}
|
|
793
845
|
|
|
794
|
-
export interface
|
|
795
|
-
|
|
796
|
-
|
|
|
797
|
-
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
|
801
|
-
|
|
|
802
|
-
|
|
803
|
-
|
|
|
804
|
-
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
846
|
+
export interface ThreadEventPayloadMap {
|
|
847
|
+
'thread.updated': {
|
|
848
|
+
status?: ThreadStatusDto | string | null;
|
|
849
|
+
title?: string | null;
|
|
850
|
+
reason?: string;
|
|
851
|
+
turnId?: string;
|
|
852
|
+
model?: string | null;
|
|
853
|
+
reasoningEffort?: ReasoningEffortDto | string | null;
|
|
854
|
+
fastMode?: boolean;
|
|
855
|
+
collaborationMode?: CollaborationModeDto | string | null;
|
|
856
|
+
sandboxMode?: SandboxModeDto | string | null;
|
|
857
|
+
};
|
|
858
|
+
'thread.context.updated': {
|
|
859
|
+
contextUsage: ThreadContextUsageDto;
|
|
860
|
+
};
|
|
861
|
+
'thread.goal.updated': {
|
|
862
|
+
turnId?: string | null;
|
|
863
|
+
goal: ThreadGoalDto | null;
|
|
864
|
+
goalHistory: ThreadGoalDto[];
|
|
865
|
+
};
|
|
866
|
+
'thread.goal.cleared': {
|
|
867
|
+
goalHistory: ThreadGoalDto[];
|
|
868
|
+
};
|
|
869
|
+
'thread.turn.token.updated': {
|
|
870
|
+
turnId: string;
|
|
871
|
+
tokenUsage: ThreadTurnTokenUsageDto;
|
|
872
|
+
priceEstimate: ThreadTurnPriceEstimateDto | null;
|
|
873
|
+
};
|
|
874
|
+
'thread.turn.started': {
|
|
875
|
+
turnId: string;
|
|
876
|
+
};
|
|
877
|
+
'thread.item.started': {
|
|
878
|
+
turnId: string;
|
|
879
|
+
item: ThreadHistoryItemDto;
|
|
880
|
+
};
|
|
881
|
+
'thread.item.completed': {
|
|
882
|
+
turnId: string;
|
|
883
|
+
item: ThreadHistoryItemDto;
|
|
884
|
+
};
|
|
885
|
+
'thread.plan.updated': {
|
|
886
|
+
turnId: string;
|
|
887
|
+
explanation: string | null;
|
|
888
|
+
plan: ThreadLivePlanDto['plan'];
|
|
889
|
+
};
|
|
890
|
+
'thread.request.created': {
|
|
891
|
+
request: ThreadActionRequestDto;
|
|
892
|
+
};
|
|
893
|
+
'thread.request.resolved': {
|
|
894
|
+
requestId: string;
|
|
895
|
+
};
|
|
896
|
+
'thread.output.delta': {
|
|
897
|
+
turnId: string;
|
|
898
|
+
itemId: string;
|
|
899
|
+
sequence: number;
|
|
900
|
+
delta: string;
|
|
901
|
+
};
|
|
902
|
+
'thread.turn.completed': {
|
|
903
|
+
turnId: string;
|
|
904
|
+
status: ThreadTurnDto['status'];
|
|
905
|
+
error: string | null;
|
|
906
|
+
};
|
|
907
|
+
'thread.turn.failed': {
|
|
908
|
+
turnId: string;
|
|
909
|
+
error: string | null;
|
|
910
|
+
willRetry?: boolean;
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
export type ThreadEventEnvelope = {
|
|
915
|
+
[Type in keyof ThreadEventPayloadMap]: {
|
|
916
|
+
type: Type;
|
|
917
|
+
threadId: string;
|
|
918
|
+
timestamp: string;
|
|
919
|
+
payload: ThreadEventPayloadMap[Type];
|
|
920
|
+
};
|
|
921
|
+
}[keyof ThreadEventPayloadMap];
|
|
922
|
+
|
|
923
|
+
export interface ShellEventPayloadMap {
|
|
924
|
+
'shell.connected': {
|
|
925
|
+
viewerId: string;
|
|
926
|
+
};
|
|
927
|
+
'shell.status': {
|
|
928
|
+
threadId: string;
|
|
929
|
+
state: ShellStatusDto;
|
|
930
|
+
viewerId?: string;
|
|
931
|
+
};
|
|
932
|
+
'shell.output': {
|
|
933
|
+
data: string;
|
|
934
|
+
replace?: boolean;
|
|
935
|
+
cursorX?: number;
|
|
936
|
+
cursorY?: number;
|
|
937
|
+
paneHeight?: number;
|
|
938
|
+
cwdBaseName?: string;
|
|
939
|
+
envPrefix?: string;
|
|
940
|
+
isCommandRunning?: boolean;
|
|
941
|
+
};
|
|
942
|
+
'shell.detached': {
|
|
943
|
+
threadId: string;
|
|
944
|
+
state: Extract<ShellStatusDto, 'detached'>;
|
|
945
|
+
viewerId: string;
|
|
946
|
+
reason?: string;
|
|
947
|
+
};
|
|
948
|
+
'shell.exited': {
|
|
949
|
+
threadId: string;
|
|
950
|
+
state: Extract<ShellStatusDto, 'exited' | 'not_found'>;
|
|
951
|
+
};
|
|
952
|
+
'shell.error': {
|
|
953
|
+
code: string;
|
|
954
|
+
message: string;
|
|
955
|
+
};
|
|
826
956
|
}
|
|
827
957
|
|
|
958
|
+
export type ShellEventEnvelope = {
|
|
959
|
+
[Type in keyof ShellEventPayloadMap]: {
|
|
960
|
+
type: Type;
|
|
961
|
+
shellId: string;
|
|
962
|
+
timestamp: string;
|
|
963
|
+
payload: ShellEventPayloadMap[Type];
|
|
964
|
+
};
|
|
965
|
+
}[keyof ShellEventPayloadMap];
|
|
966
|
+
|
|
828
967
|
export interface SupervisorConnectedEnvelope {
|
|
829
968
|
type: 'supervisor.connected';
|
|
830
969
|
timestamp: string;
|