@codori/client 0.0.1 → 0.0.2

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 (29) hide show
  1. package/app/components/ChatWorkspace.vue +7 -7
  2. package/app/components/MessageContent.vue +2 -2
  3. package/app/components/MessagePartRenderer.ts +2 -2
  4. package/app/components/ProjectSidebar.vue +2 -2
  5. package/app/components/ThreadList.vue +5 -5
  6. package/app/components/ThreadPanel.vue +1 -1
  7. package/app/components/VisualSubagentStack.vue +1 -1
  8. package/app/components/message-item/CommandExecution.vue +2 -2
  9. package/app/components/message-item/DynamicToolCall.vue +2 -2
  10. package/app/components/message-item/FileChange.vue +2 -2
  11. package/app/components/message-item/McpToolCall.vue +2 -2
  12. package/app/components/message-item/SubagentActivity.vue +2 -2
  13. package/app/components/message-item/WebSearch.vue +2 -2
  14. package/app/components/message-part/Event.vue +1 -1
  15. package/app/components/message-part/Item.ts +1 -1
  16. package/app/composables/useChatSession.ts +2 -2
  17. package/app/composables/useProjects.ts +4 -5
  18. package/app/composables/useRpc.ts +3 -3
  19. package/app/composables/useVisualSubagentPanels.ts +1 -1
  20. package/app/pages/projects/[...projectId]/index.vue +3 -3
  21. package/app/pages/projects/[...projectId]/threads/[threadId].vue +5 -5
  22. package/package.json +1 -1
  23. package/server/api/codori/projects/[projectId]/start.post.ts +3 -3
  24. package/server/api/codori/projects/[projectId]/status.get.ts +3 -3
  25. package/server/api/codori/projects/[projectId]/stop.post.ts +3 -3
  26. package/server/api/codori/projects/[projectId].get.ts +3 -3
  27. package/server/api/codori/projects/index.get.ts +2 -2
  28. package/shared/codex-chat.ts +1 -1
  29. package/shared/network.ts +8 -0
@@ -2,10 +2,10 @@
2
2
  import { useRouter } from '#imports'
3
3
  import { computed, nextTick, onMounted, ref, watch } from 'vue'
4
4
  import MessageContent from './MessageContent.vue'
5
- import { useChatSession, type SubagentPanelState } from '../composables/useChatSession.js'
6
- import { useProjects } from '../composables/useProjects.js'
7
- import { useRpc } from '../composables/useRpc.js'
8
- import { useChatSubmitGuard } from '../composables/useChatSubmitGuard.js'
5
+ import { useChatSession, type SubagentPanelState } from '../composables/useChatSession'
6
+ import { useProjects } from '../composables/useProjects'
7
+ import { useRpc } from '../composables/useRpc'
8
+ import { useChatSubmitGuard } from '../composables/useChatSubmitGuard'
9
9
  import {
10
10
  ITEM_PART,
11
11
  eventToMessage,
@@ -18,7 +18,7 @@ import {
18
18
  type FileChangeItem,
19
19
  type ItemData,
20
20
  type McpToolCallItem
21
- } from '~~/shared/codex-chat.js'
21
+ } from '~~/shared/codex-chat'
22
22
  import {
23
23
  notificationThreadId,
24
24
  notificationTurnId,
@@ -29,8 +29,8 @@ import {
29
29
  type ThreadResumeResponse,
30
30
  type ThreadStartResponse,
31
31
  type TurnStartResponse
32
- } from '~~/shared/codex-rpc.js'
33
- import { toProjectThreadRoute } from '~~/shared/codori.js'
32
+ } from '~~/shared/codex-rpc'
33
+ import { toProjectThreadRoute } from '~~/shared/codori'
34
34
 
35
35
  const props = defineProps<{
36
36
  projectId: string
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import MessagePartRenderer from './MessagePartRenderer.js'
3
- import type { ChatMessage, ChatPart } from '~~/shared/codex-chat.js'
2
+ import MessagePartRenderer from './MessagePartRenderer'
3
+ import type { ChatMessage, ChatPart } from '~~/shared/codex-chat'
4
4
 
5
5
  defineProps<{
6
6
  message?: ChatMessage | null
@@ -1,8 +1,8 @@
1
1
  import { defineComponent, h, type PropType } from 'vue'
2
2
  import { UChatReasoning } from '#components'
3
- import { EVENT_PART, ITEM_PART, type ChatMessage, type ChatPart } from '~~/shared/codex-chat.js'
3
+ import { EVENT_PART, ITEM_PART, type ChatMessage, type ChatPart } from '~~/shared/codex-chat'
4
4
  import MessagePartEvent from './message-part/Event.vue'
5
- import MessagePartItem from './message-part/Item.js'
5
+ import MessagePartItem from './message-part/Item'
6
6
  import MessagePartText from './message-part/Text.vue'
7
7
 
8
8
  export default defineComponent({
@@ -2,8 +2,8 @@
2
2
  import type { NavigationMenuItem } from '@nuxt/ui'
3
3
  import { useRoute } from '#imports'
4
4
  import { computed, onMounted } from 'vue'
5
- import { useProjects } from '../composables/useProjects.js'
6
- import { toProjectRoute } from '~~/shared/codori.js'
5
+ import { useProjects } from '../composables/useProjects'
6
+ import { toProjectRoute } from '~~/shared/codori'
7
7
 
8
8
  const props = defineProps<{
9
9
  collapsed?: boolean
@@ -2,11 +2,11 @@
2
2
  import type { NavigationMenuItem } from '@nuxt/ui'
3
3
  import { useRoute } from '#imports'
4
4
  import { computed, onMounted, ref, watch } from 'vue'
5
- import { useProjects } from '../composables/useProjects.js'
6
- import { useRpc } from '../composables/useRpc.js'
7
- import { useThreadPanel } from '../composables/useThreadPanel.js'
8
- import type { ThreadListResponse } from '~~/shared/codex-rpc.js'
9
- import { toProjectThreadRoute } from '~~/shared/codori.js'
5
+ import { useProjects } from '../composables/useProjects'
6
+ import { useRpc } from '../composables/useRpc'
7
+ import { useThreadPanel } from '../composables/useThreadPanel'
8
+ import type { ThreadListResponse } from '~~/shared/codex-rpc'
9
+ import { toProjectThreadRoute } from '~~/shared/codori'
10
10
 
11
11
  const props = defineProps<{
12
12
  projectId: string | null
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ref } from 'vue'
3
- import { useThreadPanel } from '../composables/useThreadPanel.js'
3
+ import { useThreadPanel } from '../composables/useThreadPanel'
4
4
  import ThreadList from './ThreadList.vue'
5
5
 
6
6
  defineProps<{
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, nextTick, onBeforeUnmount, watch, type ComponentPublicInstance, type VNodeRef } from 'vue'
3
- import type { VisualSubagentPanel } from '~~/shared/codex-chat.js'
3
+ import type { VisualSubagentPanel } from '~~/shared/codex-chat'
4
4
 
5
5
  const props = defineProps<{
6
6
  agents: VisualSubagentPanel[]
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import type { CommandExecutionItem } from '~~/shared/codex-chat.js'
4
- import { useChatToolState } from './use-chat-tool-state.js'
3
+ import type { CommandExecutionItem } from '~~/shared/codex-chat'
4
+ import { useChatToolState } from './use-chat-tool-state'
5
5
 
6
6
  const props = defineProps<{
7
7
  item: CommandExecutionItem
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import type { DynamicToolCallItem } from '~~/shared/codex-chat.js'
4
- import { useChatToolState } from './use-chat-tool-state.js'
3
+ import type { DynamicToolCallItem } from '~~/shared/codex-chat'
4
+ import { useChatToolState } from './use-chat-tool-state'
5
5
 
6
6
  const props = defineProps<{
7
7
  item: DynamicToolCallItem
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import type { FileChangeItem } from '~~/shared/codex-chat.js'
4
- import { useChatToolState } from './use-chat-tool-state.js'
3
+ import type { FileChangeItem } from '~~/shared/codex-chat'
4
+ import { useChatToolState } from './use-chat-tool-state'
5
5
 
6
6
  const props = defineProps<{
7
7
  item: FileChangeItem
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import type { McpToolCallItem } from '~~/shared/codex-chat.js'
4
- import { useChatToolState } from './use-chat-tool-state.js'
3
+ import type { McpToolCallItem } from '~~/shared/codex-chat'
4
+ import { useChatToolState } from './use-chat-tool-state'
5
5
 
6
6
  const props = defineProps<{
7
7
  item: McpToolCallItem
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import type { SubagentActivityItem, SubagentAgentState } from '~~/shared/codex-chat.js'
4
- import { useChatToolState } from './use-chat-tool-state.js'
3
+ import type { SubagentActivityItem, SubagentAgentState } from '~~/shared/codex-chat'
4
+ import { useChatToolState } from './use-chat-tool-state'
5
5
 
6
6
  const props = defineProps<{
7
7
  item: SubagentActivityItem
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import type { CodexThreadItem } from '~~/shared/codex-rpc.js'
3
- import { useChatToolState } from './use-chat-tool-state.js'
2
+ import type { CodexThreadItem } from '~~/shared/codex-rpc'
3
+ import { useChatToolState } from './use-chat-tool-state'
4
4
 
5
5
  const props = defineProps<{
6
6
  item: Extract<CodexThreadItem, { type: 'webSearch' }>
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import { EVENT_PART, type ThreadEventData } from '~~/shared/codex-chat.js'
3
+ import { EVENT_PART, type ThreadEventData } from '~~/shared/codex-chat'
4
4
 
5
5
  const props = defineProps<{
6
6
  part?: {
@@ -3,7 +3,7 @@ import {
3
3
  ITEM_PART,
4
4
  type ChatPart,
5
5
  type ItemData
6
- } from '~~/shared/codex-chat.js'
6
+ } from '~~/shared/codex-chat'
7
7
  import MessageItemCommandExecution from '../message-item/CommandExecution.vue'
8
8
  import MessageItemContextCompaction from '../message-item/ContextCompaction.vue'
9
9
  import MessageItemDynamicToolCall from '../message-item/DynamicToolCall.vue'
@@ -1,6 +1,6 @@
1
1
  import { ref, type Ref } from 'vue'
2
- import type { ChatMessage, SubagentAgentStatus, VisualSubagentPanel } from '~~/shared/codex-chat.js'
3
- import type { CodexRpcNotification } from '~~/shared/codex-rpc.js'
2
+ import type { ChatMessage, SubagentAgentStatus, VisualSubagentPanel } from '~~/shared/codex-chat'
3
+ import type { CodexRpcNotification } from '~~/shared/codex-rpc'
4
4
 
5
5
  export type ChatStatus = 'ready' | 'submitted' | 'streaming' | 'error'
6
6
 
@@ -1,13 +1,13 @@
1
1
  import { useRuntimeConfig, useState } from '#imports'
2
2
  import { $fetch } from 'ofetch'
3
- import { encodeProjectIdSegment } from '~~/shared/codori.js'
4
- import { resolveHttpBase, shouldUseServerProxy } from '~~/shared/network.js'
3
+ import { encodeProjectIdSegment } from '~~/shared/codori'
4
+ import { resolveApiUrl, shouldUseServerProxy } from '~~/shared/network'
5
5
  import type {
6
6
  ProjectRecord,
7
7
  ProjectResponse,
8
8
  ProjectsResponse,
9
9
  StartProjectResult
10
- } from '~~/shared/codori.js'
10
+ } from '~~/shared/codori'
11
11
 
12
12
  const mergeProject = (projects: ProjectRecord[], nextProject: ProjectRecord) => {
13
13
  const filtered = projects.filter(project => project.projectId !== nextProject.projectId)
@@ -21,13 +21,12 @@ export const useProjects = () => {
21
21
  const pendingProjectId = useState<string | null>('codori-projects-pending-id', () => null)
22
22
  const error = useState<string | null>('codori-projects-error', () => null)
23
23
  const configuredBase = String(useRuntimeConfig().public.serverBase ?? '')
24
- const apiBase = resolveHttpBase(configuredBase)
25
24
  const useProxy = shouldUseServerProxy(configuredBase)
26
25
 
27
26
  const toApiUrl = (path: string) =>
28
27
  useProxy
29
28
  ? `/api/codori${path}`
30
- : new URL(path, apiBase).toString()
29
+ : resolveApiUrl(path, configuredBase)
31
30
 
32
31
  const refreshProjects = async () => {
33
32
  if (loading.value) {
@@ -1,7 +1,7 @@
1
1
  import { useRuntimeConfig } from '#imports'
2
- import { encodeProjectIdSegment } from '~~/shared/codori.js'
3
- import { CodexRpcClient } from '~~/shared/codex-rpc.js'
4
- import { resolveWsBase } from '~~/shared/network.js'
2
+ import { encodeProjectIdSegment } from '~~/shared/codori'
3
+ import { CodexRpcClient } from '~~/shared/codex-rpc'
4
+ import { resolveWsBase } from '~~/shared/network'
5
5
 
6
6
  const clients = new Map<string, CodexRpcClient>()
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { computed, toValue, type MaybeRefOrGetter } from 'vue'
2
- import { isSubagentActiveStatus, type VisualSubagentPanel } from '~~/shared/codex-chat.js'
2
+ import { isSubagentActiveStatus, type VisualSubagentPanel } from '~~/shared/codex-chat'
3
3
 
4
4
  export const useVisualSubagentPanels = (
5
5
  panels: MaybeRefOrGetter<VisualSubagentPanel[] | null | undefined>
@@ -1,9 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import { useRoute, useRouter } from '#imports'
3
3
  import { computed, onMounted } from 'vue'
4
- import { useProjects } from '../../../composables/useProjects.js'
5
- import { useThreadPanel } from '../../../composables/useThreadPanel.js'
6
- import { normalizeProjectIdParam } from '~~/shared/codori.js'
4
+ import { useProjects } from '../../../composables/useProjects'
5
+ import { useThreadPanel } from '../../../composables/useThreadPanel'
6
+ import { normalizeProjectIdParam } from '~~/shared/codori'
7
7
 
8
8
  const route = useRoute()
9
9
  const router = useRouter()
@@ -1,11 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import { useRoute, useRouter } from '#imports'
3
3
  import { computed, onMounted, ref, watch } from 'vue'
4
- import { useChatSession } from '../../../../composables/useChatSession.js'
5
- import { useProjects } from '../../../../composables/useProjects.js'
6
- import { useThreadPanel } from '../../../../composables/useThreadPanel.js'
7
- import { useVisualSubagentPanels } from '../../../../composables/useVisualSubagentPanels.js'
8
- import { normalizeProjectIdParam, toProjectRoute } from '~~/shared/codori.js'
4
+ import { useChatSession } from '../../../../composables/useChatSession'
5
+ import { useProjects } from '../../../../composables/useProjects'
6
+ import { useThreadPanel } from '../../../../composables/useThreadPanel'
7
+ import { useVisualSubagentPanels } from '../../../../composables/useVisualSubagentPanels'
8
+ import { normalizeProjectIdParam, toProjectRoute } from '~~/shared/codori'
9
9
 
10
10
  const route = useRoute()
11
11
  const router = useRouter()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codori/client",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "private": false,
5
5
  "description": "Codori Nuxt dashboard for project browsing, Codex chat, and thread resume.",
6
6
  "type": "module",
@@ -1,7 +1,7 @@
1
1
  import { defineEventHandler, getRouterParam } from 'h3'
2
- import { encodeProjectIdSegment } from '~~/shared/codori.js'
3
- import type { ProjectResponse } from '~~/shared/codori.js'
4
- import { proxyServerRequest } from '../../../../utils/server-proxy.js'
2
+ import { encodeProjectIdSegment } from '~~/shared/codori'
3
+ import type { ProjectResponse } from '~~/shared/codori'
4
+ import { proxyServerRequest } from '../../../../utils/server-proxy'
5
5
 
6
6
  export default defineEventHandler(async (event) => {
7
7
  const projectId = getRouterParam(event, 'projectId')
@@ -1,7 +1,7 @@
1
1
  import { defineEventHandler, getRouterParam } from 'h3'
2
- import { encodeProjectIdSegment } from '~~/shared/codori.js'
3
- import type { ProjectResponse } from '~~/shared/codori.js'
4
- import { proxyServerRequest } from '../../../../utils/server-proxy.js'
2
+ import { encodeProjectIdSegment } from '~~/shared/codori'
3
+ import type { ProjectResponse } from '~~/shared/codori'
4
+ import { proxyServerRequest } from '../../../../utils/server-proxy'
5
5
 
6
6
  export default defineEventHandler(async (event) => {
7
7
  const projectId = getRouterParam(event, 'projectId')
@@ -1,7 +1,7 @@
1
1
  import { defineEventHandler, getRouterParam } from 'h3'
2
- import { encodeProjectIdSegment } from '~~/shared/codori.js'
3
- import type { ProjectResponse } from '~~/shared/codori.js'
4
- import { proxyServerRequest } from '../../../../utils/server-proxy.js'
2
+ import { encodeProjectIdSegment } from '~~/shared/codori'
3
+ import type { ProjectResponse } from '~~/shared/codori'
4
+ import { proxyServerRequest } from '../../../../utils/server-proxy'
5
5
 
6
6
  export default defineEventHandler(async (event) => {
7
7
  const projectId = getRouterParam(event, 'projectId')
@@ -1,7 +1,7 @@
1
1
  import { defineEventHandler, getRouterParam } from 'h3'
2
- import { encodeProjectIdSegment } from '~~/shared/codori.js'
3
- import type { ProjectResponse } from '~~/shared/codori.js'
4
- import { proxyServerRequest } from '../../../utils/server-proxy.js'
2
+ import { encodeProjectIdSegment } from '~~/shared/codori'
3
+ import type { ProjectResponse } from '~~/shared/codori'
4
+ import { proxyServerRequest } from '../../../utils/server-proxy'
5
5
 
6
6
  export default defineEventHandler(async (event) => {
7
7
  const projectId = getRouterParam(event, 'projectId')
@@ -1,6 +1,6 @@
1
1
  import { defineEventHandler } from 'h3'
2
- import type { ProjectsResponse } from '~~/shared/codori.js'
3
- import { proxyServerRequest } from '../../../utils/server-proxy.js'
2
+ import type { ProjectsResponse } from '~~/shared/codori'
3
+ import { proxyServerRequest } from '../../../utils/server-proxy'
4
4
 
5
5
  export default defineEventHandler(async (event) =>
6
6
  await proxyServerRequest<ProjectsResponse>(event, '/api/projects')
@@ -1,4 +1,4 @@
1
- import type { CodexThread, CodexThreadItem, CodexUserInput } from './codex-rpc.js'
1
+ import type { CodexThread, CodexThreadItem, CodexUserInput } from './codex-rpc'
2
2
 
3
3
  export const EVENT_PART = 'data-thread-event' as const
4
4
  export const ITEM_PART = 'data-thread-item' as const
package/shared/network.ts CHANGED
@@ -21,6 +21,14 @@ export const resolveHttpBase = (configuredBase: string | null | undefined) => {
21
21
  export const shouldUseServerProxy = (configuredBase: string | null | undefined) =>
22
22
  Boolean(configuredBase && configuredBase.trim().length > 0)
23
23
 
24
+ export const resolveApiUrl = (
25
+ path: string,
26
+ configuredBase: string | null | undefined
27
+ ) => {
28
+ const normalizedPath = path.startsWith('/api/') ? path : `/api${path.startsWith('/') ? path : `/${path}`}`
29
+ return new URL(normalizedPath, resolveHttpBase(configuredBase)).toString()
30
+ }
31
+
24
32
  export const resolveWsBase = (
25
33
  configuredWsBase: string | null | undefined,
26
34
  configuredHttpBase: string | null | undefined