remote-codex 0.1.10 → 0.11.1

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 (46) hide show
  1. package/apps/supervisor-api/dist/chunk-6M32PPHZ.js +24507 -0
  2. package/apps/supervisor-api/dist/chunk-7AA2MFXK.js +24499 -0
  3. package/apps/supervisor-api/dist/chunk-HKBFCPHH.js +24511 -0
  4. package/apps/supervisor-api/dist/index.js +12525 -28436
  5. package/apps/supervisor-api/dist/worker-index.d.ts +2 -0
  6. package/apps/supervisor-api/dist/worker-index.js +33 -0
  7. package/apps/supervisor-web/dist/assets/{highlighted-body-OFNGDK62-CyMcatlD.js → highlighted-body-OFNGDK62-p31aS0f0.js} +1 -1
  8. package/apps/supervisor-web/dist/assets/index-BiuFei_K.css +32 -0
  9. package/apps/supervisor-web/dist/assets/index-D1R9CUnx.js +2161 -0
  10. package/apps/supervisor-web/dist/assets/{xterm-DbYWMNQ0.js → xterm-D92BViLH.js} +1 -1
  11. package/apps/supervisor-web/dist/index.html +2 -2
  12. package/package.json +2 -3
  13. package/packages/agent-runtime/src/index.ts +4 -0
  14. package/packages/agent-runtime/src/management-errors.ts +11 -0
  15. package/packages/agent-runtime/src/model-pricing.ts +325 -0
  16. package/packages/agent-runtime/src/registry.ts +19 -4
  17. package/packages/agent-runtime/src/runtime-errors.ts +97 -0
  18. package/packages/agent-runtime/src/types.ts +36 -3
  19. package/packages/agent-runtime/src/unavailable-runtime.ts +169 -0
  20. package/packages/claude/src/historyItems.ts +41 -5
  21. package/packages/claude/src/runtimeAdapter.test.ts +117 -6
  22. package/packages/claude/src/runtimeAdapter.ts +421 -65
  23. package/packages/codex/src/historyItems.test.ts +137 -0
  24. package/packages/codex/src/historyItems.ts +135 -17
  25. package/packages/codex/src/hookHistory.test.ts +59 -0
  26. package/packages/codex/src/index.ts +7 -0
  27. package/packages/codex/src/local-session-store.ts +390 -0
  28. package/packages/codex/src/management/codex-management-service.ts +454 -0
  29. package/packages/codex/src/management/codexHostConfig.test.ts +88 -0
  30. package/packages/codex/src/management/codexHostConfig.ts +188 -0
  31. package/packages/codex/src/management/errors.ts +20 -0
  32. package/packages/codex/src/modelPricing.test.ts +235 -0
  33. package/packages/codex/src/modelPricing.ts +9 -0
  34. package/packages/codex/src/runtime-errors.test.ts +72 -0
  35. package/packages/codex/src/runtime-errors.ts +37 -0
  36. package/packages/codex/src/runtimeAdapter.ts +15 -0
  37. package/packages/codex/src/thread-title.ts +1 -0
  38. package/packages/opencode/src/historyItems.test.ts +504 -0
  39. package/packages/opencode/src/historyItems.ts +896 -0
  40. package/packages/opencode/src/index.ts +2 -0
  41. package/packages/opencode/src/runtimeAdapter.test.ts +1444 -0
  42. package/packages/opencode/src/runtimeAdapter.ts +1473 -0
  43. package/packages/shared/src/agent-providers.ts +56 -0
  44. package/packages/shared/src/index.ts +240 -35
  45. package/apps/supervisor-web/dist/assets/index-BlAhoIuq.js +0 -379
  46. 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 {
@@ -300,6 +347,7 @@ export interface ThreadHistoryItemDto {
300
347
  kind:
301
348
  | 'userMessage'
302
349
  | 'agentMessage'
350
+ | 'artifact'
303
351
  | 'image'
304
352
  | 'plan'
305
353
  | 'contextCompaction'
@@ -318,6 +366,8 @@ export interface ThreadHistoryItemDto {
318
366
  detailText?: string | null;
319
367
  hasDeferredDetail?: boolean | null;
320
368
  sequence?: number | null;
369
+ transcriptOrder?: number | null;
370
+ sourceTurnId?: string | null;
321
371
  status?: string | null;
322
372
  assetPath?: string | null;
323
373
  changedFiles?: number | null;
@@ -334,6 +384,7 @@ export interface ThreadHistoryItemDto {
334
384
  kind: string;
335
385
  text: string;
336
386
  }> | null;
387
+ artifact?: ThreadArtifactDto | null;
337
388
  }
338
389
 
339
390
  export interface ThreadHistoryItemDetailDto {
@@ -343,6 +394,73 @@ export interface ThreadHistoryItemDetailDto {
343
394
  text: string;
344
395
  }
345
396
 
397
+ export interface ThreadArtifactDto {
398
+ id: string;
399
+ pluginId: string;
400
+ type: string;
401
+ title: string;
402
+ summaryText?: string | null;
403
+ payload: unknown;
404
+ assets?: Array<{
405
+ id: string;
406
+ mediaType: string;
407
+ url: string;
408
+ name?: string | null;
409
+ }> | null;
410
+ sourceTurnId?: string | null;
411
+ sourceItemId?: string | null;
412
+ createdAt: string;
413
+ }
414
+
415
+ export interface PluginArtifactTypeDto {
416
+ type: string;
417
+ title: string;
418
+ fileExtensions?: string[];
419
+ }
420
+
421
+ export interface PluginThreadPanelDto {
422
+ id: string;
423
+ label: string;
424
+ artifactTypes: string[];
425
+ }
426
+
427
+ export interface PluginCapabilitiesDto {
428
+ artifactTypes: PluginArtifactTypeDto[];
429
+ timelineRenderers: string[];
430
+ threadPanels: PluginThreadPanelDto[];
431
+ frontend?: {
432
+ entry?: string;
433
+ style?: string;
434
+ };
435
+ backend?: {
436
+ entry?: string;
437
+ };
438
+ }
439
+
440
+ export interface PluginManifestDto {
441
+ id: string;
442
+ name: string;
443
+ version: string;
444
+ description: string;
445
+ remoteCodex: string;
446
+ capabilities: PluginCapabilitiesDto;
447
+ }
448
+
449
+ export interface PluginDto extends PluginManifestDto {
450
+ enabled: boolean;
451
+ source?: 'builtin' | 'imported' | null;
452
+ }
453
+
454
+ export interface UpdatePluginInput {
455
+ enabled: boolean;
456
+ }
457
+
458
+ export interface ImportPluginInput {
459
+ manifest?: unknown;
460
+ manifestJson?: string;
461
+ enabled?: boolean;
462
+ }
463
+
346
464
  export interface ThreadTurnTokenBreakdownDto {
347
465
  totalTokens: number;
348
466
  inputTokens: number;
@@ -795,40 +913,127 @@ export interface RespondThreadActionRequestInput {
795
913
  answers: Record<string, ThreadActionRequestAnswerDto>;
796
914
  }
797
915
 
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>;
916
+ export interface ThreadEventPayloadMap {
917
+ 'thread.updated': {
918
+ status?: ThreadStatusDto | string | null;
919
+ title?: string | null;
920
+ reason?: string;
921
+ turnId?: string;
922
+ model?: string | null;
923
+ reasoningEffort?: ReasoningEffortDto | string | null;
924
+ fastMode?: boolean;
925
+ collaborationMode?: CollaborationModeDto | string | null;
926
+ sandboxMode?: SandboxModeDto | string | null;
927
+ };
928
+ 'thread.context.updated': {
929
+ contextUsage: ThreadContextUsageDto;
930
+ };
931
+ 'thread.goal.updated': {
932
+ turnId?: string | null;
933
+ goal: ThreadGoalDto | null;
934
+ goalHistory: ThreadGoalDto[];
935
+ };
936
+ 'thread.goal.cleared': {
937
+ goalHistory: ThreadGoalDto[];
938
+ };
939
+ 'thread.turn.token.updated': {
940
+ turnId: string;
941
+ tokenUsage: ThreadTurnTokenUsageDto;
942
+ priceEstimate: ThreadTurnPriceEstimateDto | null;
943
+ };
944
+ 'thread.turn.started': {
945
+ turnId: string;
946
+ };
947
+ 'thread.item.started': {
948
+ turnId: string;
949
+ item: ThreadHistoryItemDto;
950
+ };
951
+ 'thread.item.completed': {
952
+ turnId: string;
953
+ item: ThreadHistoryItemDto;
954
+ };
955
+ 'thread.plan.updated': {
956
+ turnId: string;
957
+ explanation: string | null;
958
+ plan: ThreadLivePlanDto['plan'];
959
+ };
960
+ 'thread.request.created': {
961
+ request: ThreadActionRequestDto;
962
+ };
963
+ 'thread.request.resolved': {
964
+ requestId: string;
965
+ };
966
+ 'thread.output.delta': {
967
+ turnId: string;
968
+ itemId: string;
969
+ sequence: number;
970
+ delta: string;
971
+ };
972
+ 'thread.turn.completed': {
973
+ turnId: string;
974
+ status: ThreadTurnDto['status'];
975
+ error: string | null;
976
+ };
977
+ 'thread.turn.failed': {
978
+ turnId: string;
979
+ error: string | null;
980
+ willRetry?: boolean;
981
+ };
982
+ }
983
+
984
+ export type ThreadEventEnvelope = {
985
+ [Type in keyof ThreadEventPayloadMap]: {
986
+ type: Type;
987
+ threadId: string;
988
+ timestamp: string;
989
+ payload: ThreadEventPayloadMap[Type];
990
+ };
991
+ }[keyof ThreadEventPayloadMap];
992
+
993
+ export interface ShellEventPayloadMap {
994
+ 'shell.connected': {
995
+ viewerId: string;
996
+ };
997
+ 'shell.status': {
998
+ threadId: string;
999
+ state: ShellStatusDto;
1000
+ viewerId?: string;
1001
+ };
1002
+ 'shell.output': {
1003
+ data: string;
1004
+ replace?: boolean;
1005
+ cursorX?: number;
1006
+ cursorY?: number;
1007
+ paneHeight?: number;
1008
+ cwdBaseName?: string;
1009
+ envPrefix?: string;
1010
+ isCommandRunning?: boolean;
1011
+ };
1012
+ 'shell.detached': {
1013
+ threadId: string;
1014
+ state: Extract<ShellStatusDto, 'detached'>;
1015
+ viewerId: string;
1016
+ reason?: string;
1017
+ };
1018
+ 'shell.exited': {
1019
+ threadId: string;
1020
+ state: Extract<ShellStatusDto, 'exited' | 'not_found'>;
1021
+ };
1022
+ 'shell.error': {
1023
+ code: string;
1024
+ message: string;
1025
+ };
830
1026
  }
831
1027
 
1028
+ export type ShellEventEnvelope = {
1029
+ [Type in keyof ShellEventPayloadMap]: {
1030
+ type: Type;
1031
+ shellId: string;
1032
+ timestamp: string;
1033
+ payload: ShellEventPayloadMap[Type];
1034
+ };
1035
+ }[keyof ShellEventPayloadMap];
1036
+
832
1037
  export interface SupervisorConnectedEnvelope {
833
1038
  type: 'supervisor.connected';
834
1039
  timestamp: string;