remote-codex 0.1.10 → 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.
Files changed (40) hide show
  1. package/apps/supervisor-api/dist/index.js +11159 -27875
  2. package/apps/supervisor-web/dist/assets/{highlighted-body-OFNGDK62-CyMcatlD.js → highlighted-body-OFNGDK62-ChrwAL9u.js} +1 -1
  3. package/apps/supervisor-web/dist/assets/index-DHf2HOXx.js +381 -0
  4. package/apps/supervisor-web/dist/assets/index-DpWxXCgt.css +32 -0
  5. package/apps/supervisor-web/dist/assets/{xterm-DbYWMNQ0.js → xterm-D4sevve4.js} +1 -1
  6. package/apps/supervisor-web/dist/index.html +2 -2
  7. package/package.json +2 -3
  8. package/packages/agent-runtime/src/index.ts +4 -0
  9. package/packages/agent-runtime/src/management-errors.ts +11 -0
  10. package/packages/agent-runtime/src/model-pricing.ts +312 -0
  11. package/packages/agent-runtime/src/registry.ts +19 -4
  12. package/packages/agent-runtime/src/runtime-errors.ts +97 -0
  13. package/packages/agent-runtime/src/types.ts +36 -3
  14. package/packages/agent-runtime/src/unavailable-runtime.ts +169 -0
  15. package/packages/claude/src/runtimeAdapter.test.ts +95 -6
  16. package/packages/claude/src/runtimeAdapter.ts +421 -65
  17. package/packages/codex/src/historyItems.test.ts +110 -0
  18. package/packages/codex/src/historyItems.ts +96 -15
  19. package/packages/codex/src/hookHistory.test.ts +59 -0
  20. package/packages/codex/src/index.ts +7 -0
  21. package/packages/codex/src/local-session-store.ts +390 -0
  22. package/packages/codex/src/management/codex-management-service.ts +454 -0
  23. package/packages/codex/src/management/codexHostConfig.test.ts +88 -0
  24. package/packages/codex/src/management/codexHostConfig.ts +188 -0
  25. package/packages/codex/src/management/errors.ts +20 -0
  26. package/packages/codex/src/modelPricing.test.ts +184 -0
  27. package/packages/codex/src/modelPricing.ts +9 -0
  28. package/packages/codex/src/runtime-errors.test.ts +72 -0
  29. package/packages/codex/src/runtime-errors.ts +37 -0
  30. package/packages/codex/src/runtimeAdapter.ts +15 -0
  31. package/packages/codex/src/thread-title.ts +1 -0
  32. package/packages/opencode/src/historyItems.test.ts +504 -0
  33. package/packages/opencode/src/historyItems.ts +896 -0
  34. package/packages/opencode/src/index.ts +2 -0
  35. package/packages/opencode/src/runtimeAdapter.test.ts +1355 -0
  36. package/packages/opencode/src/runtimeAdapter.ts +1469 -0
  37. package/packages/shared/src/agent-providers.ts +56 -0
  38. package/packages/shared/src/index.ts +170 -35
  39. package/apps/supervisor-web/dist/assets/index-BlAhoIuq.js +0 -379
  40. package/apps/supervisor-web/dist/assets/index-DI0NRNgr.css +0 -32
@@ -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 {
@@ -318,6 +365,7 @@ export interface ThreadHistoryItemDto {
318
365
  detailText?: string | null;
319
366
  hasDeferredDetail?: boolean | null;
320
367
  sequence?: number | null;
368
+ sourceTurnId?: string | null;
321
369
  status?: string | null;
322
370
  assetPath?: string | null;
323
371
  changedFiles?: number | null;
@@ -795,40 +843,127 @@ export interface RespondThreadActionRequestInput {
795
843
  answers: Record<string, ThreadActionRequestAnswerDto>;
796
844
  }
797
845
 
798
- export interface ThreadEventEnvelope {
799
- type:
800
- | 'thread.updated'
801
- | 'thread.context.updated'
802
- | 'thread.goal.updated'
803
- | 'thread.goal.cleared'
804
- | 'thread.turn.token.updated'
805
- | 'thread.turn.started'
806
- | 'thread.item.started'
807
- | 'thread.item.completed'
808
- | 'thread.plan.updated'
809
- | 'thread.request.created'
810
- | 'thread.request.resolved'
811
- | 'thread.output.delta'
812
- | 'thread.turn.completed'
813
- | 'thread.turn.failed';
814
- threadId: string;
815
- timestamp: string;
816
- payload: Record<string, unknown>;
817
- }
818
-
819
- export interface ShellEventEnvelope {
820
- type:
821
- | 'shell.connected'
822
- | 'shell.status'
823
- | 'shell.output'
824
- | 'shell.detached'
825
- | 'shell.exited'
826
- | 'shell.error';
827
- shellId: string;
828
- timestamp: string;
829
- payload: Record<string, unknown>;
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
+ };
830
956
  }
831
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
+
832
967
  export interface SupervisorConnectedEnvelope {
833
968
  type: 'supervisor.connected';
834
969
  timestamp: string;