Skip to content

Commit bed3d2c

Browse files
committed
fix(mothership): reconcile staging contracts and consolidate migrations
1 parent 8ad3e31 commit bed3d2c

82 files changed

Lines changed: 22765 additions & 374 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/docs/openapi-v2-knowledge.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5942,7 +5942,7 @@
59425942
},
59435943
"rankScore": {
59445944
"type": "number",
5945-
"description": "The score results are ordered by, descending. In `vector` mode it equals `similarity`; in `hybrid` mode it is the reciprocal-rank-fusion score (a sum of 1/(60 + rank) over the lexical and vector legs, so a chunk both legs ranked first scores 2/61); when a reranker ordered the results it is `rerankerScore`.",
5945+
"description": "Retrieval score before optional recency boosting. In `vector` mode it equals `similarity`; in `hybrid` mode it is the reciprocal-rank-fusion score (a sum of 1/(60 + rank) over the lexical and vector legs). When a reranker orders the results it is `rerankerScore`. Use `rank` for the final order.",
59465946
"examples": [0.0328]
59475947
},
59485948
"rank": {

apps/docs/openapi-v2-tables.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5658,16 +5658,7 @@
56585658
},
56595659
"type": {
56605660
"type": "string",
5661-
"enum": [
5662-
"string",
5663-
"number",
5664-
"currency",
5665-
"boolean",
5666-
"date",
5667-
"ttl",
5668-
"json",
5669-
"select"
5670-
],
5661+
"enum": ["string", "number", "currency", "boolean", "date", "json", "select"],
56715662
"description": "Data type of values stored in the column."
56725663
},
56735664
"required": {

apps/sim/app/api/copilot/chat/abort/route.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @vitest-environment node
33
*/
44
import { createMockRequest } from '@sim/testing'
5+
import { sleep } from '@sim/utils/helpers'
56
import { beforeEach, describe, expect, it, vi } from 'vitest'
67

78
const {
@@ -198,7 +199,7 @@ describe('POST /api/copilot/chat/abort', () => {
198199
const controller = new AbortController()
199200
const timeout = vi.spyOn(AbortSignal, 'timeout').mockReturnValue(controller.signal)
200201
mockWaitForPendingChatStream.mockImplementationOnce(async () => {
201-
await new Promise((resolve) => setTimeout(resolve, 8000))
202+
await sleep(8000)
202203
return false
203204
})
204205
const response = POST(abortRequest())

apps/sim/app/api/copilot/tool-permission/route.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import {
2929
createUnauthorizedResponse,
3030
} from '@/lib/mothership/request/http'
3131
import { withIncomingGoSpan } from '@/lib/mothership/request/otel'
32-
import { isCopilotToolPermissionsEnabled } from '@/lib/core/config/env-flags'
33-
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
3432
import { isWorkspaceCapabilityWithheld } from '@/lib/permission-groups/capability-assertions'
3533

3634
const logger = createLogger('CopilotToolPermissionAPI')

apps/sim/app/api/files/serve/[...path]/route.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import {
99
InternalUnauthenticatedError,
1010
} from '@/lib/api/server/routes'
1111
import { AuthType, checkSessionOrInternalAuth } from '@/lib/auth/hybrid'
12-
import { resolveServableDocBytes } from '@/lib/mothership/tools/server/files/doc-compile'
13-
import { DocCompileUserError } from '@/lib/mothership/tools/server/files/doc-compile-error'
1412
import { asOrchestrationError } from '@/lib/core/orchestration/types'
1513
import { assertKnownSizeWithinLimit, isPayloadSizeLimitError } from '@/lib/core/utils/stream-limits'
1614
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'

apps/sim/app/api/v2/chat/route.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ vi.mock('@/lib/permission-groups/config-scope.server', () => permissionGroupScop
125125
const mockResolvePermissionGroupConfig =
126126
permissionGroupScopeMockFns.mockResolvePermissionGroupConfig
127127

128-
import { chatOperations } from '@/lib/copilot/application/operations'
128+
import { chatOperations } from '@/lib/mothership/application/operations'
129129
import { CAPABILITY_RULES } from '@/lib/permission-groups/capabilities'
130130
import { DEFAULT_PERMISSION_GROUP_CONFIG } from '@/lib/permission-groups/fields'
131131
import { POST } from '@/app/api/v2/chat/route'

apps/sim/app/api/v2/chat/route.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ import {
1313
v2RateLimits,
1414
} from '@/lib/api/server/routes'
1515
import { resolveBillingAttribution } from '@/lib/billing/core/billing-attribution'
16+
import {
17+
forbiddenErrorDetails,
18+
PersonalApiKeysDisabledError,
19+
requirePersonalApiKeysAllowed,
20+
type WorkspaceAuthorizationContext,
21+
} from '@/lib/core/application'
1622
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
1723
import { getPersonalAndWorkspaceEnv } from '@/lib/environment/utils'
1824
import { chatOperations } from '@/lib/mothership/application/operations'
@@ -32,25 +38,16 @@ import {
3238
MothershipStreamV1EventType,
3339
MothershipStreamV1TextChannel,
3440
} from '@/lib/mothership/generated/mothership-stream-v1'
41+
import { PROTOCOL_VERSION } from '@/lib/mothership/generated/protocol'
3542
import { runHeadlessCopilotLifecycle } from '@/lib/mothership/request/lifecycle/headless'
3643
import { requestExplicitStreamAbort } from '@/lib/mothership/request/session/explicit-abort'
3744
import type { OrchestratorResult, StreamEvent } from '@/lib/mothership/request/types'
3845
import { normalizeSecretMountPolicy } from '@/lib/mothership/secret-mount-policy'
39-
import {
40-
forbiddenErrorDetails,
41-
PersonalApiKeysDisabledError,
42-
requirePersonalApiKeysAllowed,
43-
type WorkspaceAuthorizationContext,
44-
} from '@/lib/core/application'
45-
import { isDocSandboxEnabled } from '@/lib/core/config/env-flags'
46-
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
47-
import { getPersonalAndWorkspaceEnv } from '@/lib/environment/utils'
4846
import { CAPABILITY_RULES } from '@/lib/permission-groups/capabilities'
4947
import {
5048
capabilityRefusal,
5149
isWorkspaceCapabilityWithheld,
5250
} from '@/lib/permission-groups/capability-assertions'
53-
import { PROTOCOL_VERSION } from '@/lib/mothership/generated/protocol'
5451
import {
5552
assertActiveWorkspaceAccess,
5653
isWorkspaceAccessDeniedError,

apps/sim/app/workspace/[workspaceId]/components/message-actions/message-actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
useCopyToClipboard,
2020
} from '@sim/emcn'
2121
import { useParams, useRouter } from 'next/navigation'
22-
import { isLiveAssistantMessageId } from '@/lib/mothership/chat/effective-transcript'
22+
import { isLiveAssistantMessageId } from '@/lib/mothership/chat/live-message-id'
2323
import { useChatSurface } from '@/app/workspace/[workspaceId]/home/components/chat-surface-context'
2424
import { useSubmitCopilotFeedback } from '@/hooks/queries/copilot-feedback'
2525
import { useForkMothershipChat } from '@/hooks/queries/mothership-chats'

apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/plus-menu-dropdown/plus-menu-dropdown.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ vi.mock('@/blocks/integration-matcher', () => ({
4848
vi.mock('@/stores/browser-session/store', () => ({ useBrowserSessionStore: () => fixtures.tabs }))
4949
vi.mock('@/stores/copilot-terminal/store', () => ({ useCopilotTerminalStore: () => fixtures.tabs }))
5050

51+
import { setDesktopPreferencesSnapshot } from '@/lib/desktop'
5152
import {
5253
BROWSER_SESSION_RESOURCE_ID,
5354
TERMINAL_SESSION_RESOURCE_ID,
54-
} from '@/lib/copilot/resources/types'
55-
import { setDesktopPreferencesSnapshot } from '@/lib/desktop'
55+
} from '@/lib/mothership/resources/types'
5656
import {
5757
mapResourceToContext,
5858
type PlusMenuHandle,

apps/sim/app/workspace/[workspaceId]/home/hooks/send-handoff.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { generateId } from '@sim/utils/id'
88
import { isRecordLike } from '@sim/utils/object'
99
import { STREAM_STORAGE_KEY } from '@/lib/mothership/constants'
10+
import type { ChatRequestMode } from '@/app/workspace/[workspaceId]/home/types'
1011
import type { QueuedSendHandoffSeed } from '@/stores/mothership-queue/types'
1112
import type { ChatContext } from '@/stores/panel'
1213
import type { FileAttachmentForApi } from '../types'
@@ -24,6 +25,7 @@ export interface QueuedSendHandoffState extends QueuedSendHandoffSeed {
2425
message: string
2526
fileAttachments?: FileAttachmentForApi[]
2627
contexts?: ChatContext[]
28+
requestMode?: ChatRequestMode
2729
requestedAt: number
2830
resolveAttempts?: number
2931
}
@@ -167,6 +169,7 @@ export function readQueuedSendHandoffState(): QueuedSendHandoffState | null {
167169
...(Array.isArray(parsed.contexts)
168170
? { contexts: parsed.contexts.filter(isChatContext) }
169171
: {}),
172+
...(parsed.requestMode === 'ask' ? { requestMode: parsed.requestMode } : {}),
170173
requestedAt: parsed.requestedAt,
171174
...(typeof parsed.resolveAttempts === 'number' &&
172175
Number.isFinite(parsed.resolveAttempts) &&

0 commit comments

Comments
 (0)