MCPcopy Create free account
hub / github.com/tiann/hapi / migrateLegacyCursorSession

Method migrateLegacyCursorSession

hub/src/sync/syncEngine.ts:535–551  ·  view source on GitHub ↗

* Migrate a single legacy cursor session to ACP. Hub-side; runs on the * operator's machine (the hub host); see tiann/hapi#824 design. * Returns a structured outcome (ok or refusal); does not throw.

(
        sessionId: string,
        namespace: string,
        request: CursorMigrateToAcpRequest
    )

Source from the content-addressed store, hash-verified

533 * Returns a structured outcome (ok or refusal); does not throw.
534 */
535 async migrateLegacyCursorSession(
536 sessionId: string,
537 namespace: string,
538 request: CursorMigrateToAcpRequest
539 ): Promise<CursorMigrateOutcome> {
540 const session = this.sessionCache.getSessionByNamespace(sessionId, namespace)
541 ?? this.sessionCache.refreshSession(sessionId)
542 if (!session) {
543 return { ok: false, sessionId, reason: 'internal_error', message: 'session not found in namespace', durationMs: 0 }
544 }
545 const migrator = this.buildMigratorForRequest(request)
546 return migrator.migrateOne(session, {
547 keepSource: request.keepSource,
548 forceArchiveRunning: request.forceArchiveRunning,
549 skipVerify: request.skipVerify
550 })
551 }
552
553 private buildMigratorForRequest(_request: CursorMigrateToAcpRequest): CursorLegacyMigrator {
554 const migratorOpts: CursorLegacyMigratorOptions = {}

Callers 2

createSessionsRoutesFunction · 0.80
createCliRoutesFunction · 0.80

Calls 4

refreshSessionMethod · 0.80
migrateOneMethod · 0.80
getSessionByNamespaceMethod · 0.45

Tested by

no test coverage detected