@remixhq/core 0.1.45 → 0.1.46

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/dist/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CoreConfig } from './config.js';
2
2
  import { T as TokenProvider } from './tokenProvider-BP3YfJHm.js';
3
- import { T as TurnUsage } from './contracts-DTeSJnoC.js';
3
+ import { T as TurnUsage, S as SourceConversation } from './contracts-BAr3-IX5.js';
4
4
  import 'zod';
5
5
 
6
6
  type HistoryImportProvider = "claude_code" | "cursor";
@@ -569,6 +569,19 @@ type OpenAppPayload = {
569
569
  url?: string;
570
570
  correlationId?: string | null;
571
571
  };
572
+ type AppThread = {
573
+ appId: string;
574
+ id: string;
575
+ title: string | null;
576
+ isMain: boolean;
577
+ isArchived: boolean;
578
+ originProvider: "cursor" | "claude" | "codex" | null;
579
+ titleState: string | null;
580
+ messageCount: number;
581
+ lastMessageAt: string | null;
582
+ createdAt?: string;
583
+ updatedAt?: string;
584
+ };
572
585
  type AppProfileInput = {
573
586
  primaryCategory?: string;
574
587
  capabilities?: string[];
@@ -857,6 +870,15 @@ type ApiClient = {
857
870
  }): Promise<Json>;
858
871
  getApp(appId: string): Promise<Json>;
859
872
  openApp(appId: string, payload?: OpenAppPayload): Promise<Json>;
873
+ listAppThreads(appId: string): Promise<Json>;
874
+ createAppThread(appId: string, payload?: {
875
+ title?: string;
876
+ }): Promise<Json>;
877
+ renameAppThread(appId: string, threadId: string, payload: {
878
+ title: string;
879
+ }): Promise<Json>;
880
+ archiveAppThread(appId: string, threadId: string): Promise<Json>;
881
+ openAppThread(appId: string, threadId: string): Promise<Json>;
860
882
  updateAppStatus(appId: string, payload: {
861
883
  status: "archived" | "ready";
862
884
  cascadeBranchLanes?: boolean;
@@ -870,11 +892,13 @@ type ApiClient = {
870
892
  includeHistorical?: boolean;
871
893
  includeCosts?: boolean;
872
894
  includeMergeRequestHistory?: boolean;
895
+ threadId?: string;
873
896
  }): Promise<Json>;
874
897
  getAppTimelineEvent(appId: string, eventId: string): Promise<Json>;
875
898
  listAppEditQueue(appId: string, params?: {
876
899
  limit?: number;
877
900
  offset?: number;
901
+ threadId?: string;
878
902
  }): Promise<Json>;
879
903
  listAppJobQueue(appId: string, params?: {
880
904
  limit?: number;
@@ -1006,6 +1030,7 @@ type ApiClient = {
1006
1030
  version?: string;
1007
1031
  provider?: string;
1008
1032
  };
1033
+ sourceConversation?: SourceConversation;
1009
1034
  workspaceMetadata?: Record<string, unknown>;
1010
1035
  idempotencyKey?: string;
1011
1036
  }): Promise<Json>;
@@ -1013,6 +1038,7 @@ type ApiClient = {
1013
1038
  limit?: number;
1014
1039
  offset?: number;
1015
1040
  idempotencyKey?: string;
1041
+ threadId?: string;
1016
1042
  }): Promise<Json>;
1017
1043
  startChangeStepReplay(appId: string, payload: {
1018
1044
  prompt: string;
@@ -1045,6 +1071,7 @@ type ApiClient = {
1045
1071
  version?: string;
1046
1072
  provider?: string;
1047
1073
  };
1074
+ sourceConversation?: SourceConversation;
1048
1075
  workspaceMetadata?: Record<string, unknown>;
1049
1076
  idempotencyKey?: string;
1050
1077
  }): Promise<Json>;
@@ -1067,6 +1094,7 @@ type ApiClient = {
1067
1094
  limit?: number;
1068
1095
  offset?: number;
1069
1096
  kinds?: AgentMemoryKind[];
1097
+ threadId?: string;
1070
1098
  createdAfter?: string;
1071
1099
  createdBefore?: string;
1072
1100
  }): Promise<Json>;
@@ -1075,6 +1103,7 @@ type ApiClient = {
1075
1103
  limit?: number;
1076
1104
  offset?: number;
1077
1105
  kinds?: AgentMemoryKind[];
1106
+ threadId?: string;
1078
1107
  createdAfter?: string;
1079
1108
  createdBefore?: string;
1080
1109
  }): Promise<Json>;
@@ -1223,6 +1252,7 @@ type ApiClient = {
1223
1252
  limit?: number;
1224
1253
  offset?: number;
1225
1254
  status?: string;
1255
+ threadId?: string;
1226
1256
  currentPhase?: string;
1227
1257
  createdAfter?: string;
1228
1258
  createdBefore?: string;
@@ -1262,4 +1292,4 @@ declare function createApiClient(config: CoreConfig, opts?: {
1262
1292
  defaultRequestTimeoutMs?: number;
1263
1293
  }): ApiClient;
1264
1294
 
1265
- export { type AgentMemoryItem, type AgentMemoryKind, type AgentMemorySearchItem, type AgentMemorySearchResponse, type AgentMemorySummary, type AgentMemoryTimelineResponse, type ApiClient, type AppContext, type AppContextAccessPath, type AppPreviewExpectedKind, type AppPreviewProcessStatus, type AppPreviewQuery, type AppPreviewResponse, type AppProfileInput, type AppReconcileResponse, type AppSandboxCommandRun, type AppShareLinkSummary, type Bundle, type BundlePlatform, type BundleStatus, type ChangeStepDiffResponse, type CreateAppShareLinkPayload, type DetectProjectRuntimeTargetsPayload, type HistoricalTurnRecord, type HistoryImportCaptureSource, type HistoryImportProvider, type HistoryImportRecordMetadata, type HistoryImportWorkspaceMetadata, type ImportHistoryRecordOutcome, type ImportHistoryRequest, type ImportHistoryResponse, type ImportProjectRuntimeEnvPayload, type InitiateBundleRequest, type InvitationRecord, type MergeRequest, type MergeRequestReview, type MergeRequestStatus, type MobileQrPayloads, type ProjectRuntimeEnvMetadata, type ProjectRuntimeEnvScope, type ProjectRuntimeTargetMetadata, type ProjectRuntimeTargetScope, type ProjectTrigger, type ProjectTriggerPayload, type ProjectTriggerScope, type ProjectTriggerStep, type ProjectTriggerStepPayload, type ReconcilePreflightResponse, type ResolveProjectRuntimeEnvForLocalPullResponse, type RunAppRuntimeTargetPayload, type RunAppSandboxCommandPayload, type RunAppTriggerEventPayload, type RunAppTriggerPayload, type RuntimeCommandKind, type RuntimeTargetKind, type SetProjectRuntimeEnvPayload, type SetProjectRuntimeTargetPayload, type SyncLocalResponse, type SyncUpstreamResponse, type TriggerEventMetadata, type TriggerEventSource, type TriggerIntegrationStatus, type TriggerMode, type TriggerRun, type TriggerStepRun, type TriggerStepType, type UpdateProjectTriggerPayload, createApiClient };
1295
+ export { type AgentMemoryItem, type AgentMemoryKind, type AgentMemorySearchItem, type AgentMemorySearchResponse, type AgentMemorySummary, type AgentMemoryTimelineResponse, type ApiClient, type AppContext, type AppContextAccessPath, type AppPreviewExpectedKind, type AppPreviewProcessStatus, type AppPreviewQuery, type AppPreviewResponse, type AppProfileInput, type AppReconcileResponse, type AppSandboxCommandRun, type AppShareLinkSummary, type AppThread, type Bundle, type BundlePlatform, type BundleStatus, type ChangeStepDiffResponse, type CreateAppShareLinkPayload, type DetectProjectRuntimeTargetsPayload, type HistoricalTurnRecord, type HistoryImportCaptureSource, type HistoryImportProvider, type HistoryImportRecordMetadata, type HistoryImportWorkspaceMetadata, type ImportHistoryRecordOutcome, type ImportHistoryRequest, type ImportHistoryResponse, type ImportProjectRuntimeEnvPayload, type InitiateBundleRequest, type InvitationRecord, type MergeRequest, type MergeRequestReview, type MergeRequestStatus, type MobileQrPayloads, type ProjectRuntimeEnvMetadata, type ProjectRuntimeEnvScope, type ProjectRuntimeTargetMetadata, type ProjectRuntimeTargetScope, type ProjectTrigger, type ProjectTriggerPayload, type ProjectTriggerScope, type ProjectTriggerStep, type ProjectTriggerStepPayload, type ReconcilePreflightResponse, type ResolveProjectRuntimeEnvForLocalPullResponse, type RunAppRuntimeTargetPayload, type RunAppSandboxCommandPayload, type RunAppTriggerEventPayload, type RunAppTriggerPayload, type RuntimeCommandKind, type RuntimeTargetKind, type SetProjectRuntimeEnvPayload, type SetProjectRuntimeTargetPayload, type SyncLocalResponse, type SyncUpstreamResponse, type TriggerEventMetadata, type TriggerEventSource, type TriggerIntegrationStatus, type TriggerMode, type TriggerRun, type TriggerStepRun, type TriggerStepType, type UpdateProjectTriggerPayload, createApiClient };
package/dist/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-OSHNZWYW.js";
3
+ } from "./chunk-KANZPW3X.js";
4
4
  import "./chunk-7XJGOKEO.js";
5
5
  export {
6
6
  createApiClient
@@ -74,6 +74,7 @@ function buildAppTimelineQuery(params) {
74
74
  const qs = new URLSearchParams();
75
75
  if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
76
76
  if (params?.cursor) qs.set("cursor", params.cursor);
77
+ if (params?.threadId) qs.set("threadId", params.threadId);
77
78
  if (typeof params?.includeHistorical === "boolean") qs.set("includeHistorical", String(params.includeHistorical));
78
79
  if (typeof params?.includeCosts === "boolean") qs.set("includeCosts", String(params.includeCosts));
79
80
  if (typeof params?.includeMergeRequestHistory === "boolean") {
@@ -82,7 +83,9 @@ function buildAppTimelineQuery(params) {
82
83
  return suffix(qs);
83
84
  }
84
85
  function buildAppEditQueueQuery(params) {
85
- return buildPaginationQuery(params);
86
+ const qs = new URLSearchParams(buildPaginationQuery(params).replace(/^\?/, ""));
87
+ if (params?.threadId) qs.set("threadId", params.threadId);
88
+ return suffix(qs);
86
89
  }
87
90
  function buildAppJobQueueQuery(params) {
88
91
  const qs = new URLSearchParams();
@@ -393,6 +396,23 @@ function createApiClient(config, opts) {
393
396
  body: JSON.stringify(payload)
394
397
  }),
395
398
  openApp: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/open`, { method: "POST", body: JSON.stringify(payload ?? {}) }),
399
+ listAppThreads: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/threads`, { method: "GET" }),
400
+ createAppThread: (appId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/threads`, {
401
+ method: "POST",
402
+ body: JSON.stringify(payload ?? {})
403
+ }),
404
+ renameAppThread: (appId, threadId, payload) => request(`/v1/apps/${encodeURIComponent(appId)}/threads/${encodeURIComponent(threadId)}`, {
405
+ method: "PATCH",
406
+ body: JSON.stringify(payload)
407
+ }),
408
+ archiveAppThread: (appId, threadId) => request(`/v1/apps/${encodeURIComponent(appId)}/threads/${encodeURIComponent(threadId)}/archive`, {
409
+ method: "POST",
410
+ body: JSON.stringify({})
411
+ }),
412
+ openAppThread: (appId, threadId) => request(`/v1/apps/${encodeURIComponent(appId)}/threads/${encodeURIComponent(threadId)}/open`, {
413
+ method: "POST",
414
+ body: JSON.stringify({})
415
+ }),
396
416
  getAppContext: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/context`, { method: "GET" }),
397
417
  getAppOverview: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/overview`, { method: "GET" }),
398
418
  getAppMergePreview: (appId) => request(`/v1/apps/${encodeURIComponent(appId)}/merge-preview`, { method: "GET" }),
@@ -422,6 +442,7 @@ function createApiClient(config, opts) {
422
442
  if (params?.limit !== void 0) qs.set("limit", String(params.limit));
423
443
  if (params?.offset !== void 0) qs.set("offset", String(params.offset));
424
444
  if (params?.idempotencyKey) qs.set("idempotencyKey", params.idempotencyKey);
445
+ if (params?.threadId) qs.set("threadId", params.threadId);
425
446
  const suffix2 = qs.toString() ? `?${qs.toString()}` : "";
426
447
  return request(`/v1/apps/${encodeURIComponent(appId)}/change-steps${suffix2}`, { method: "GET" });
427
448
  },
@@ -455,6 +476,7 @@ function createApiClient(config, opts) {
455
476
  if (params?.offset !== void 0) qs.set("offset", String(params.offset));
456
477
  if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
457
478
  if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
479
+ if (params?.threadId) qs.set("threadId", params.threadId);
458
480
  if (params?.kinds?.length) {
459
481
  for (const kind of params.kinds) qs.append("kinds", kind);
460
482
  }
@@ -468,6 +490,7 @@ function createApiClient(config, opts) {
468
490
  if (params.offset !== void 0) qs.set("offset", String(params.offset));
469
491
  if (params.createdAfter) qs.set("createdAfter", params.createdAfter);
470
492
  if (params.createdBefore) qs.set("createdBefore", params.createdBefore);
493
+ if (params.threadId) qs.set("threadId", params.threadId);
471
494
  if (params.kinds?.length) {
472
495
  for (const kind of params.kinds) qs.append("kinds", kind);
473
496
  }
@@ -603,6 +626,7 @@ function createApiClient(config, opts) {
603
626
  if (typeof params?.limit === "number") qs.set("limit", String(params.limit));
604
627
  if (typeof params?.offset === "number") qs.set("offset", String(params.offset));
605
628
  if (params?.status) qs.set("status", params.status);
629
+ if (params?.threadId) qs.set("threadId", params.threadId);
606
630
  if (params?.currentPhase) qs.set("currentPhase", params.currentPhase);
607
631
  if (params?.createdAfter) qs.set("createdAfter", params.createdAfter);
608
632
  if (params?.createdBefore) qs.set("createdBefore", params.createdBefore);
package/dist/collab.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { C as CollabApiClient, a as TurnUsagePayload, b as CollabFinalizeTurnResult, c as CollabRecordingPreflight, d as CollabApproveMode, e as CollabApprovalStrategy, f as CollabApproveResult, M as MergeRequestQueue, g as MergeRequest, I as InvitationScopeType, h as CollabMember, A as AppProfileInput, J as JsonObject, i as AppDeltaResponse, j as CollabStatus, k as MergeRequestReview } from './contracts-DTeSJnoC.js';
2
- export { l as AppHeadResponse, m as AppMember, n as AppMemberRole, o as AppReconcileResponse, p as CollabFinalizeTurnAutoSync, q as CollabFinalizeTurnMode, r as CollabPendingFinalizeState, s as CollabPendingFinalizeSummary, t as CollabRecordingPreflightStatus, u as CollabRepoStateKind, v as CollabStatusBlockedReason, w as CollabStatusRecommendedAction, x as CollabTurn, y as MembershipScopeType, z as MergeRequestStatus, B as ModelCall, O as OrganizationMember, D as OrganizationMemberRole, P as ProjectMember, E as ProjectMemberRole, R as ReconcilePreflightResponse, S as ServerToolUsage, F as SyncLocalResponse, G as SyncUpstreamResponse, T as TurnUsage, H as TurnUsageCaptureSource, K as TurnUsageConfidence, L as TurnUsagePreviousPatch } from './contracts-DTeSJnoC.js';
1
+ import { C as CollabApiClient, S as SourceConversation, a as TurnUsagePayload, b as CollabFinalizeTurnResult, c as CollabRecordingPreflight, d as CollabApproveMode, e as CollabApprovalStrategy, f as CollabApproveResult, M as MergeRequestQueue, g as MergeRequest, I as InvitationScopeType, h as CollabMember, A as AppProfileInput, J as JsonObject, i as AppDeltaResponse, j as CollabStatus, k as MergeRequestReview } from './contracts-BAr3-IX5.js';
2
+ export { l as AppHeadResponse, m as AppMember, n as AppMemberRole, o as AppReconcileResponse, p as CollabFinalizeTurnAutoSync, q as CollabFinalizeTurnMode, r as CollabPendingFinalizeState, s as CollabPendingFinalizeSummary, t as CollabRecordingPreflightStatus, u as CollabRepoStateKind, v as CollabStatusBlockedReason, w as CollabStatusRecommendedAction, x as CollabTurn, y as MembershipScopeType, z as MergeRequestStatus, B as ModelCall, O as OrganizationMember, D as OrganizationMemberRole, P as ProjectMember, E as ProjectMemberRole, R as ReconcilePreflightResponse, F as ServerToolUsage, G as SourceConversationSchema, H as SyncLocalResponse, K as SyncUpstreamResponse, T as TurnUsage, L as TurnUsageCaptureSource, N as TurnUsageConfidence, Q as TurnUsagePreviousPatch } from './contracts-BAr3-IX5.js';
3
3
  import { B as BranchBindingMode } from './binding-WiIRI2fl.js';
4
+ import 'zod';
4
5
 
5
6
  declare function collabFinalizeTurn(params: {
6
7
  api: CollabApiClient;
@@ -18,6 +19,7 @@ declare function collabFinalizeTurn(params: {
18
19
  version?: string;
19
20
  provider?: string;
20
21
  };
22
+ sourceConversation?: SourceConversation | null;
21
23
  turnUsage?: TurnUsagePayload | null;
22
24
  /**
23
25
  * ISO-8601 timestamp of when the user actually typed/submitted this prompt
@@ -482,6 +484,7 @@ type PendingFinalizeJob = {
482
484
  currentAppId: string;
483
485
  laneId: string | null;
484
486
  threadId: string | null;
487
+ sourceConversation?: SourceConversation | null;
485
488
  branchName: string | null;
486
489
  prompt: string;
487
490
  assistantResponse: string;
@@ -575,4 +578,4 @@ declare function drainerLogPath(): string;
575
578
  declare function getDrainerLogPath(): string;
576
579
  declare function getDrainerPidPath(): string;
577
580
 
578
- export { AppDeltaResponse, AppProfileInput, type AsyncJob, type AsyncJobBase, type AsyncJobKind, type AsyncJobStatus, type AsyncJobSummary, type AwaitAsyncJobResult, CollabApiClient, CollabApproveMode, CollabApproveResult, CollabFinalizeTurnResult, type CollabInitQueuedResult, CollabMember, CollabRecordingPreflight, CollabStatus, type DrainerLogEvent, FINALIZE_JOB_LOCK_STALE_MS, FINALIZE_PREFLIGHT_FAILURE_CODES, type FinalizePreflightFailureCode, type InitJobPayload, InvitationScopeType, JsonObject, type LocalSnapshotRecord, MergeRequest, MergeRequestQueue, MergeRequestReview, type PendingFinalizeJob, TurnUsagePayload, awaitAsyncJob, cleanStaleFinalizeJobLocks, collabApprove, collabCheckout, collabFinalizeTurn, collabInit, collabInitProcess, collabInitSubmit, collabInvite, collabList, collabListMembers, collabListMergeRequests, collabReconcile, collabRecordingPreflight, collabReject, collabRemix, collabRequestMerge, collabStatus, collabSync, collabSyncUpstream, collabUpdateMemberRole, collabView, deleteAsyncJob, drainAsyncJobs, drainPendingFinalizeQueue, drainerLogPath, findFailedAsyncJob, findPendingAsyncJob, forgetPendingFinalizeJob, getDrainerLogPath, getDrainerPidPath, getMemberRolesForScope, isFinalizePreflightFailureCode, listAsyncJobs, listAsyncJobsForRepo, listPendingFinalizeJobs, processPendingFinalizeJob, pruneTerminalAsyncJobs, readAsyncJob, readLocalSnapshot, readPendingFinalizeJob, requeuePendingFinalizeJob, summarizeAsyncJobs, updatePendingFinalizeJob, validateMemberRole };
581
+ export { AppDeltaResponse, AppProfileInput, type AsyncJob, type AsyncJobBase, type AsyncJobKind, type AsyncJobStatus, type AsyncJobSummary, type AwaitAsyncJobResult, CollabApiClient, CollabApproveMode, CollabApproveResult, CollabFinalizeTurnResult, type CollabInitQueuedResult, CollabMember, CollabRecordingPreflight, CollabStatus, type DrainerLogEvent, FINALIZE_JOB_LOCK_STALE_MS, FINALIZE_PREFLIGHT_FAILURE_CODES, type FinalizePreflightFailureCode, type InitJobPayload, InvitationScopeType, JsonObject, type LocalSnapshotRecord, MergeRequest, MergeRequestQueue, MergeRequestReview, type PendingFinalizeJob, SourceConversation, TurnUsagePayload, awaitAsyncJob, cleanStaleFinalizeJobLocks, collabApprove, collabCheckout, collabFinalizeTurn, collabInit, collabInitProcess, collabInitSubmit, collabInvite, collabList, collabListMembers, collabListMergeRequests, collabReconcile, collabRecordingPreflight, collabReject, collabRemix, collabRequestMerge, collabStatus, collabSync, collabSyncUpstream, collabUpdateMemberRole, collabView, deleteAsyncJob, drainAsyncJobs, drainPendingFinalizeQueue, drainerLogPath, findFailedAsyncJob, findPendingAsyncJob, forgetPendingFinalizeJob, getDrainerLogPath, getDrainerPidPath, getMemberRolesForScope, isFinalizePreflightFailureCode, listAsyncJobs, listAsyncJobsForRepo, listPendingFinalizeJobs, processPendingFinalizeJob, pruneTerminalAsyncJobs, readAsyncJob, readLocalSnapshot, readPendingFinalizeJob, requeuePendingFinalizeJob, summarizeAsyncJobs, updatePendingFinalizeJob, validateMemberRole };
package/dist/collab.js CHANGED
@@ -40,6 +40,31 @@ import {
40
40
  RemixError
41
41
  } from "./chunk-7XJGOKEO.js";
42
42
 
43
+ // src/application/collab/contracts.ts
44
+ import { z } from "zod";
45
+ var sourceId = z.string().trim().min(1).max(500);
46
+ var sourceTurnIds = {
47
+ nativeTurnId: sourceId.optional(),
48
+ turnId: sourceId.optional()
49
+ };
50
+ var SourceConversationSchema = z.discriminatedUnion("provider", [
51
+ z.object({
52
+ provider: z.literal("cursor"),
53
+ conversationId: sourceId,
54
+ ...sourceTurnIds
55
+ }).strict(),
56
+ z.object({
57
+ provider: z.literal("claude"),
58
+ sessionId: sourceId,
59
+ ...sourceTurnIds
60
+ }).strict(),
61
+ z.object({
62
+ provider: z.literal("codex"),
63
+ sessionId: sourceId,
64
+ ...sourceTurnIds
65
+ }).strict()
66
+ ]);
67
+
43
68
  // src/application/collab/appDeltaCache.ts
44
69
  var APP_DELTA_CACHE_TTL_MS = 5e3;
45
70
  var appDeltaCache = /* @__PURE__ */ new Map();
@@ -1060,6 +1085,7 @@ async function cleanStaleFinalizeJobLocks() {
1060
1085
  }
1061
1086
  function normalizeJob2(input) {
1062
1087
  const now = (/* @__PURE__ */ new Date()).toISOString();
1088
+ const sourceConversation = SourceConversationSchema.safeParse(input.sourceConversation);
1063
1089
  return {
1064
1090
  schemaVersion: 1,
1065
1091
  id: input.id ?? randomUUID3(),
@@ -1069,6 +1095,7 @@ function normalizeJob2(input) {
1069
1095
  currentAppId: input.currentAppId,
1070
1096
  laneId: input.laneId ?? null,
1071
1097
  threadId: input.threadId ?? null,
1098
+ sourceConversation: sourceConversation.success ? sourceConversation.data : null,
1072
1099
  branchName: input.branchName ?? null,
1073
1100
  prompt: input.prompt,
1074
1101
  assistantResponse: input.assistantResponse,
@@ -1104,6 +1131,7 @@ async function readPendingFinalizeJob(jobId) {
1104
1131
  currentAppId: String(parsed.currentAppId ?? ""),
1105
1132
  laneId: parsed.laneId ?? null,
1106
1133
  threadId: parsed.threadId ?? null,
1134
+ sourceConversation: parsed.sourceConversation ?? null,
1107
1135
  branchName: parsed.branchName ?? null,
1108
1136
  prompt: String(parsed.prompt ?? ""),
1109
1137
  assistantResponse: String(parsed.assistantResponse ?? ""),
@@ -3190,6 +3218,7 @@ async function processClaimedPendingFinalizeJobInner(params) {
3190
3218
  prompt: job.prompt,
3191
3219
  assistantResponse: job.assistantResponse,
3192
3220
  actor,
3221
+ sourceConversation: job.sourceConversation ?? void 0,
3193
3222
  workspaceMetadata: buildWorkspaceMetadata({
3194
3223
  repoRoot: job.repoRoot,
3195
3224
  branchName: job.branchName,
@@ -3391,6 +3420,7 @@ async function processClaimedPendingFinalizeJobInner(params) {
3391
3420
  insertions: diffResult.stats.insertions,
3392
3421
  deletions: diffResult.stats.deletions,
3393
3422
  actor,
3423
+ sourceConversation: job.sourceConversation ?? void 0,
3394
3424
  workspaceMetadata: buildWorkspaceMetadata({
3395
3425
  repoRoot: job.repoRoot,
3396
3426
  branchName: job.branchName,
@@ -3468,6 +3498,7 @@ async function enqueueCapturedFinalizeTurn(params) {
3468
3498
  currentAppId: params.currentAppId,
3469
3499
  laneId: params.laneId,
3470
3500
  threadId: params.threadId,
3501
+ sourceConversation: params.sourceConversation ?? null,
3471
3502
  branchName: params.branchName,
3472
3503
  prompt: params.prompt,
3473
3504
  assistantResponse: params.assistantResponse,
@@ -3618,7 +3649,8 @@ async function recordConversationOnlyTurn(params) {
3618
3649
  localCommitHash: params.localCommitHash ?? null,
3619
3650
  repoState: params.repoState,
3620
3651
  prompt: params.prompt,
3621
- assistantResponse: params.assistantResponse
3652
+ assistantResponse: params.assistantResponse,
3653
+ sourceConversation: params.sourceConversation ?? null
3622
3654
  });
3623
3655
  const collabTurnResp = await params.api.createCollabTurn(params.binding.currentAppId, {
3624
3656
  threadId: params.binding.threadId ?? void 0,
@@ -3626,6 +3658,7 @@ async function recordConversationOnlyTurn(params) {
3626
3658
  prompt: params.prompt,
3627
3659
  assistantResponse: params.assistantResponse,
3628
3660
  actor: params.actor,
3661
+ sourceConversation: params.sourceConversation ?? void 0,
3629
3662
  workspaceMetadata: buildConversationOnlyWorkspaceMetadata({
3630
3663
  repoRoot: params.repoRoot,
3631
3664
  branchName: params.binding.branchName,
@@ -3692,6 +3725,7 @@ async function collabFinalizeTurn(params) {
3692
3725
  }
3693
3726
  const prompt = params.prompt.trim();
3694
3727
  const assistantResponse = params.assistantResponse.trim();
3728
+ const sourceConversation = params.sourceConversation ? SourceConversationSchema.parse(params.sourceConversation) : null;
3695
3729
  if (!prompt) throw new RemixError("Prompt is required.", { exitCode: 2 });
3696
3730
  if (!assistantResponse) throw new RemixError("Assistant response is required.", { exitCode: 2 });
3697
3731
  if (params.diff?.trim()) {
@@ -3754,6 +3788,7 @@ async function collabFinalizeTurn(params) {
3754
3788
  assistantResponse,
3755
3789
  explicitIdempotencyKey: params.idempotencyKey,
3756
3790
  actor: params.actor,
3791
+ sourceConversation,
3757
3792
  turnUsage: params.turnUsage,
3758
3793
  promptedAt: params.promptedAt,
3759
3794
  repoState: "init_post_pending",
@@ -3805,6 +3840,7 @@ async function collabFinalizeTurn(params) {
3805
3840
  assistantResponse,
3806
3841
  explicitIdempotencyKey: params.idempotencyKey,
3807
3842
  actor: params.actor,
3843
+ sourceConversation,
3808
3844
  turnUsage: params.turnUsage,
3809
3845
  promptedAt: params.promptedAt,
3810
3846
  repoState: "missing_head",
@@ -3823,6 +3859,7 @@ async function collabFinalizeTurn(params) {
3823
3859
  assistantResponse,
3824
3860
  explicitIdempotencyKey: params.idempotencyKey,
3825
3861
  actor: params.actor,
3862
+ sourceConversation,
3826
3863
  turnUsage: params.turnUsage,
3827
3864
  promptedAt: params.promptedAt,
3828
3865
  repoState: detected.repoState,
@@ -3847,6 +3884,7 @@ async function collabFinalizeTurn(params) {
3847
3884
  assistantResponse,
3848
3885
  explicitIdempotencyKey: params.idempotencyKey,
3849
3886
  actor: params.actor,
3887
+ sourceConversation,
3850
3888
  turnUsage: params.turnUsage,
3851
3889
  promptedAt: params.promptedAt,
3852
3890
  repoState: "external_local_base_changed",
@@ -3876,6 +3914,7 @@ async function collabFinalizeTurn(params) {
3876
3914
  assistantResponse,
3877
3915
  explicitIdempotencyKey: params.idempotencyKey,
3878
3916
  actor: params.actor,
3917
+ sourceConversation,
3879
3918
  turnUsage: params.turnUsage,
3880
3919
  promptedAt: params.promptedAt,
3881
3920
  repoState: "baseline_missing",
@@ -3909,7 +3948,8 @@ async function collabFinalizeTurn(params) {
3909
3948
  currentSnapshotHash: snapshot.snapshotHash,
3910
3949
  repoState: detected.repoState,
3911
3950
  prompt,
3912
- assistantResponse
3951
+ assistantResponse,
3952
+ sourceConversation
3913
3953
  });
3914
3954
  const awaitingDeadlineMs = typeof params.awaitingUsageDeadlineMs === "number" && params.awaitingUsageDeadlineMs > 0 ? params.awaitingUsageDeadlineMs : null;
3915
3955
  const nextRetryAt = awaitingDeadlineMs === null ? null : new Date(Date.now() + awaitingDeadlineMs).toISOString();
@@ -3919,6 +3959,7 @@ async function collabFinalizeTurn(params) {
3919
3959
  currentAppId: binding.currentAppId,
3920
3960
  laneId: binding.laneId,
3921
3961
  threadId: binding.threadId,
3962
+ sourceConversation,
3922
3963
  branchName: binding.branchName,
3923
3964
  prompt,
3924
3965
  assistantResponse,
@@ -3931,6 +3972,7 @@ async function collabFinalizeTurn(params) {
3931
3972
  remoteUrl: binding.remoteUrl,
3932
3973
  defaultBranch: binding.defaultBranch,
3933
3974
  actor: params.actor ?? null,
3975
+ sourceConversation,
3934
3976
  repoState: detected.repoState,
3935
3977
  turnUsage: params.turnUsage ?? null,
3936
3978
  promptedAt: typeof params.promptedAt === "string" && params.promptedAt.trim() ? params.promptedAt.trim() : null
@@ -7823,6 +7865,7 @@ async function drainAsyncJobs(opts) {
7823
7865
  export {
7824
7866
  FINALIZE_JOB_LOCK_STALE_MS,
7825
7867
  FINALIZE_PREFLIGHT_FAILURE_CODES,
7868
+ SourceConversationSchema,
7826
7869
  awaitAsyncJob,
7827
7870
  cleanStaleFinalizeJobLocks,
7828
7871
  collabApprove,
@@ -1,3 +1,5 @@
1
+ import { z } from 'zod';
2
+
1
3
  type JsonObject = Record<string, any>;
2
4
  type AppProfileInput = {
3
5
  primaryCategory?: string;
@@ -66,6 +68,53 @@ type TurnUsagePayload = {
66
68
  currentTurn: TurnUsage | null;
67
69
  previousTurn: TurnUsagePreviousPatch | null;
68
70
  };
71
+ declare const SourceConversationSchema: z.ZodDiscriminatedUnion<"provider", [z.ZodObject<{
72
+ nativeTurnId: z.ZodOptional<z.ZodString>;
73
+ turnId: z.ZodOptional<z.ZodString>;
74
+ provider: z.ZodLiteral<"cursor">;
75
+ conversationId: z.ZodString;
76
+ }, "strict", z.ZodTypeAny, {
77
+ provider: "cursor";
78
+ conversationId: string;
79
+ nativeTurnId?: string | undefined;
80
+ turnId?: string | undefined;
81
+ }, {
82
+ provider: "cursor";
83
+ conversationId: string;
84
+ nativeTurnId?: string | undefined;
85
+ turnId?: string | undefined;
86
+ }>, z.ZodObject<{
87
+ nativeTurnId: z.ZodOptional<z.ZodString>;
88
+ turnId: z.ZodOptional<z.ZodString>;
89
+ provider: z.ZodLiteral<"claude">;
90
+ sessionId: z.ZodString;
91
+ }, "strict", z.ZodTypeAny, {
92
+ provider: "claude";
93
+ sessionId: string;
94
+ nativeTurnId?: string | undefined;
95
+ turnId?: string | undefined;
96
+ }, {
97
+ provider: "claude";
98
+ sessionId: string;
99
+ nativeTurnId?: string | undefined;
100
+ turnId?: string | undefined;
101
+ }>, z.ZodObject<{
102
+ nativeTurnId: z.ZodOptional<z.ZodString>;
103
+ turnId: z.ZodOptional<z.ZodString>;
104
+ provider: z.ZodLiteral<"codex">;
105
+ sessionId: z.ZodString;
106
+ }, "strict", z.ZodTypeAny, {
107
+ provider: "codex";
108
+ sessionId: string;
109
+ nativeTurnId?: string | undefined;
110
+ turnId?: string | undefined;
111
+ }, {
112
+ provider: "codex";
113
+ sessionId: string;
114
+ nativeTurnId?: string | undefined;
115
+ turnId?: string | undefined;
116
+ }>]>;
117
+ type SourceConversation = z.infer<typeof SourceConversationSchema>;
69
118
  type MergeRequestStatus = "open" | "approved" | "rejected" | "merged" | "closed" | "manual_resolution_required";
70
119
  type MergeRequestQueue = "reviewable" | "created_by_me" | "app_reviewable" | "app_outgoing" | "app_related_visible";
71
120
  type MergeRequest = {
@@ -486,6 +535,15 @@ type CollabApiClient = {
486
535
  offset?: number;
487
536
  }): Promise<unknown>;
488
537
  getApp(appId: string): Promise<unknown>;
538
+ listAppThreads(appId: string): Promise<unknown>;
539
+ createAppThread(appId: string, payload?: {
540
+ title?: string;
541
+ }): Promise<unknown>;
542
+ renameAppThread(appId: string, threadId: string, payload: {
543
+ title: string;
544
+ }): Promise<unknown>;
545
+ archiveAppThread(appId: string, threadId: string): Promise<unknown>;
546
+ openAppThread(appId: string, threadId: string): Promise<unknown>;
489
547
  getAppHead(appId: string): Promise<unknown>;
490
548
  getAppDelta(appId: string, payload: {
491
549
  baseHeadHash: string;
@@ -550,6 +608,7 @@ type CollabApiClient = {
550
608
  version?: string;
551
609
  provider?: string;
552
610
  };
611
+ sourceConversation?: SourceConversation;
553
612
  workspaceMetadata?: Record<string, unknown>;
554
613
  idempotencyKey?: string;
555
614
  }): Promise<unknown>;
@@ -557,6 +616,7 @@ type CollabApiClient = {
557
616
  limit?: number;
558
617
  offset?: number;
559
618
  idempotencyKey?: string;
619
+ threadId?: string;
560
620
  }): Promise<unknown>;
561
621
  startChangeStepReplay(appId: string, payload: {
562
622
  prompt: string;
@@ -589,6 +649,7 @@ type CollabApiClient = {
589
649
  version?: string;
590
650
  provider?: string;
591
651
  };
652
+ sourceConversation?: SourceConversation;
592
653
  workspaceMetadata?: Record<string, unknown>;
593
654
  idempotencyKey?: string;
594
655
  }): Promise<unknown>;
@@ -777,4 +838,4 @@ type CollabApiClient = {
777
838
  }): Promise<unknown>;
778
839
  };
779
840
 
780
- export type { AppProfileInput as A, ModelCall as B, CollabApiClient as C, OrganizationMemberRole as D, ProjectMemberRole as E, SyncLocalResponse as F, SyncUpstreamResponse as G, TurnUsageCaptureSource as H, InvitationScopeType as I, JsonObject as J, TurnUsageConfidence as K, TurnUsagePreviousPatch as L, MergeRequestQueue as M, OrganizationMember as O, ProjectMember as P, ReconcilePreflightResponse as R, ServerToolUsage as S, TurnUsage as T, TurnUsagePayload as a, CollabFinalizeTurnResult as b, CollabRecordingPreflight as c, CollabApproveMode as d, CollabApprovalStrategy as e, CollabApproveResult as f, MergeRequest as g, CollabMember as h, AppDeltaResponse as i, CollabStatus as j, MergeRequestReview as k, AppHeadResponse as l, AppMember as m, AppMemberRole as n, AppReconcileResponse as o, CollabFinalizeTurnAutoSync as p, CollabFinalizeTurnMode as q, CollabPendingFinalizeState as r, CollabPendingFinalizeSummary as s, CollabRecordingPreflightStatus as t, CollabRepoStateKind as u, CollabStatusBlockedReason as v, CollabStatusRecommendedAction as w, CollabTurn as x, MembershipScopeType as y, MergeRequestStatus as z };
841
+ export { type AppProfileInput as A, type ModelCall as B, type CollabApiClient as C, type OrganizationMemberRole as D, type ProjectMemberRole as E, type ServerToolUsage as F, SourceConversationSchema as G, type SyncLocalResponse as H, type InvitationScopeType as I, type JsonObject as J, type SyncUpstreamResponse as K, type TurnUsageCaptureSource as L, type MergeRequestQueue as M, type TurnUsageConfidence as N, type OrganizationMember as O, type ProjectMember as P, type TurnUsagePreviousPatch as Q, type ReconcilePreflightResponse as R, type SourceConversation as S, type TurnUsage as T, type TurnUsagePayload as a, type CollabFinalizeTurnResult as b, type CollabRecordingPreflight as c, type CollabApproveMode as d, type CollabApprovalStrategy as e, type CollabApproveResult as f, type MergeRequest as g, type CollabMember as h, type AppDeltaResponse as i, type CollabStatus as j, type MergeRequestReview as k, type AppHeadResponse as l, type AppMember as m, type AppMemberRole as n, type AppReconcileResponse as o, type CollabFinalizeTurnAutoSync as p, type CollabFinalizeTurnMode as q, type CollabPendingFinalizeState as r, type CollabPendingFinalizeSummary as s, type CollabRecordingPreflightStatus as t, type CollabRepoStateKind as u, type CollabStatusBlockedReason as v, type CollabStatusRecommendedAction as w, type CollabTurn as x, type MembershipScopeType as y, type MergeRequestStatus as z };
package/dist/history.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { T as TurnUsage } from './contracts-DTeSJnoC.js';
1
+ import { T as TurnUsage } from './contracts-BAr3-IX5.js';
2
+ import 'zod';
2
3
 
3
4
  type TranscriptEvent = Record<string, unknown>;
4
5
  type ReadTranscriptResult = {
package/dist/index.d.ts CHANGED
@@ -3,6 +3,6 @@ export { REMIX_ERROR_CODES, RemixErrorCode } from './errors.js';
3
3
  export { CoreConfig, ResolveConfigOptions, configSchema, resolveConfig } from './config.js';
4
4
  export { S as SessionStore, a as StoredSession, W as WithRefreshLock, c as createRefreshLock, b as createStoredSessionTokenProvider, s as shouldRefreshSoon, d as storedSessionSchema } from './tokenProvider-BP3YfJHm.js';
5
5
  export { RemixAuthContinuationError, WorkosAuthChallenge, WorkosContinuationInput, createDefaultRefreshLock, createLocalSessionStore, createRemixAuthHelpers, defaultSessionFilePath, isInvalidGrantError, isNetworkError } from './auth.js';
6
- export { AgentMemoryItem, AgentMemoryKind, AgentMemorySearchItem, AgentMemorySearchResponse, AgentMemorySummary, AgentMemoryTimelineResponse, ApiClient, AppContext, AppContextAccessPath, AppPreviewExpectedKind, AppPreviewProcessStatus, AppPreviewQuery, AppPreviewResponse, AppReconcileResponse, AppSandboxCommandRun, AppShareLinkSummary, Bundle, BundlePlatform, BundleStatus, ChangeStepDiffResponse, CreateAppShareLinkPayload, DetectProjectRuntimeTargetsPayload, ImportProjectRuntimeEnvPayload, InitiateBundleRequest, InvitationRecord, MergeRequest, MergeRequestReview, MergeRequestStatus, MobileQrPayloads, ProjectRuntimeEnvMetadata, ProjectRuntimeEnvScope, ProjectRuntimeTargetMetadata, ProjectRuntimeTargetScope, ProjectTrigger, ProjectTriggerPayload, ProjectTriggerScope, ProjectTriggerStep, ProjectTriggerStepPayload, ReconcilePreflightResponse, ResolveProjectRuntimeEnvForLocalPullResponse, RunAppRuntimeTargetPayload, RunAppSandboxCommandPayload, RunAppTriggerEventPayload, RunAppTriggerPayload, RuntimeCommandKind, RuntimeTargetKind, SetProjectRuntimeEnvPayload, SetProjectRuntimeTargetPayload, SyncLocalResponse, SyncUpstreamResponse, TriggerEventMetadata, TriggerEventSource, TriggerIntegrationStatus, TriggerMode, TriggerRun, TriggerStepRun, TriggerStepType, UpdateProjectTriggerPayload, createApiClient } from './api.js';
6
+ export { AgentMemoryItem, AgentMemoryKind, AgentMemorySearchItem, AgentMemorySearchResponse, AgentMemorySummary, AgentMemoryTimelineResponse, ApiClient, AppContext, AppContextAccessPath, AppPreviewExpectedKind, AppPreviewProcessStatus, AppPreviewQuery, AppPreviewResponse, AppReconcileResponse, AppSandboxCommandRun, AppShareLinkSummary, AppThread, Bundle, BundlePlatform, BundleStatus, ChangeStepDiffResponse, CreateAppShareLinkPayload, DetectProjectRuntimeTargetsPayload, ImportProjectRuntimeEnvPayload, InitiateBundleRequest, InvitationRecord, MergeRequest, MergeRequestReview, MergeRequestStatus, MobileQrPayloads, ProjectRuntimeEnvMetadata, ProjectRuntimeEnvScope, ProjectRuntimeTargetMetadata, ProjectRuntimeTargetScope, ProjectTrigger, ProjectTriggerPayload, ProjectTriggerScope, ProjectTriggerStep, ProjectTriggerStepPayload, ReconcilePreflightResponse, ResolveProjectRuntimeEnvForLocalPullResponse, RunAppRuntimeTargetPayload, RunAppSandboxCommandPayload, RunAppTriggerEventPayload, RunAppTriggerPayload, RuntimeCommandKind, RuntimeTargetKind, SetProjectRuntimeEnvPayload, SetProjectRuntimeTargetPayload, SyncLocalResponse, SyncUpstreamResponse, TriggerEventMetadata, TriggerEventSource, TriggerIntegrationStatus, TriggerMode, TriggerRun, TriggerStepRun, TriggerStepType, UpdateProjectTriggerPayload, createApiClient } from './api.js';
7
7
  import 'zod';
8
- import './contracts-DTeSJnoC.js';
8
+ import './contracts-BAr3-IX5.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-OSHNZWYW.js";
3
+ } from "./chunk-KANZPW3X.js";
4
4
  import {
5
5
  RemixAuthContinuationError,
6
6
  createDefaultRefreshLock,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remixhq/core",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "Remix core library",
5
5
  "homepage": "https://github.com/RemixDotOne/remix-core",
6
6
  "license": "MIT",