@codemem/server 0.48.0 → 0.48.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.
- package/dist/application/sync-health.d.ts +5 -0
- package/dist/application/sync-health.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +90 -31
- package/dist/index.js.map +1 -1
- package/dist/relay-reachability.d.ts.map +1 -1
- package/dist/routes/sync.d.ts +2 -0
- package/dist/routes/sync.d.ts.map +1 -1
- package/package.json +2 -2
- package/static/app.js +35 -35
- package/static/app.js.br +0 -0
- package/static/app.js.gz +0 -0
- package/static/index.html +21 -9
|
@@ -21,6 +21,11 @@ export interface PeerSyncHealth {
|
|
|
21
21
|
state: "exchange_succeeded" | "not_verified" | "stale" | "needs_attention";
|
|
22
22
|
send: DirectionSyncHealth;
|
|
23
23
|
receive: DirectionSyncHealth;
|
|
24
|
+
/** Latest successful locally initiated sync, independent of inbound activity. */
|
|
25
|
+
last_successful_connection?: {
|
|
26
|
+
transport: "direct" | "relay" | null;
|
|
27
|
+
at: string | null;
|
|
28
|
+
};
|
|
24
29
|
}
|
|
25
30
|
export declare function directionSyncHealth(evidence: DirectionEvidence | undefined, options: {
|
|
26
31
|
now: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-health.d.ts","sourceRoot":"","sources":["../../src/application/sync-health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAmD,MAAM,eAAe,CAAC;AAIlG,MAAM,WAAW,iBAAiB;IACjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,MA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IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,EACzD,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;;EAqBpD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export interface AppOptions extends SyncAppOptions {
|
|
|
75
75
|
teamSetupCompletionDependencies?: LegacyTeamCompletionDependencies | null;
|
|
76
76
|
readCoordinatorConfig?: SyncRoutesOptions["readCoordinatorConfig"];
|
|
77
77
|
renameCoordinatorGroup?: SyncRoutesOptions["renameCoordinatorGroup"];
|
|
78
|
+
syncReachability?: SyncRoutesOptions["syncReachability"];
|
|
78
79
|
getSyncRuntimeStatus?: () => {
|
|
79
80
|
phase: "starting" | "running" | "stopping" | "error" | "disabled" | "rebootstrapping" | "needs_attention" | null;
|
|
80
81
|
detail?: string | null;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EACX,iCAAiC,EACjC,sBAAsB,EAEtB,cAAc,EACd,YAAY,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAI1D,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,oBAAoB,CAAC;AAK3E,OAAO,EAEN,K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,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACzD,oBAAoB,CAAC,EAAE,MAAM;QAC5B,KAAK,EACF,UAAU,GACV,SAAS,GACT,UAAU,GACV,OAAO,GACP,UAAU,GACV,iBAAiB,GACjB,iBAAiB,GACjB,IAAI,CAAC;QACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,GAAG,IAAI,CAAC;CACT;AAsFD,wBAAgB,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,8EAiE1C;AAED,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,UAAU,8EAE9C"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { closeSync, existsSync, fstatSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { basename, dirname, isAbsolute, join, posix, resolve, win32 } from "node:path";
|
|
3
|
-
import { ACCESS_CLEANUP_OP_TYPE, CodememConfigMutationError, CoordinatorAccountLinkError, CoordinatorReciprocalApprovalRequestChangedError, DEFAULT_TIME_WINDOW_S, FILE_CONTEXT_TRANSPORT_MAX_BYTES, LEGACY_SHARED_REVIEW_SCOPE_ID, LOCAL_DEFAULT_SCOPE_ID, LOCAL_SYNC_CAPABILITY, LOCAL_SYNC_FEATURES, LegacyTeamSetupAdditiveConvergenceError, LegacyTeamSetupRosterCapacityError, MEMORY_FILTER_FIELD_TYPES, MEMORY_FILTER_NAMES, MEMORY_KIND_DESCRIPTIONS, MemoryStore, ObserverClient, PROMPT_TRANSPORT_PROTOCOL_RANGE, REMEMBER_MEMORY_KINDS, RICH_TIER_ANTHROPIC_DEFAULTS, RICH_TIER_DEFAULTS, RawEventIngestValidationError, RecipientPolicyEdgeRequestError, RecipientPolicyTeamRenameError, RemoteCoordinatorRequestError, SCOPE_MEMBERSHIP_REVOCATION_LIMITATION, SIMPLE_TIER_ANTHROPIC_DEFAULTS, SIMPLE_TIER_DEFAULTS, SYNC_AUTHORIZATION_REFRESH_HEADER, SYNC_CAPABILITY_HEADER, SYNC_FEATURES_HEADER, SYNC_SCOPE_QUERY_PARAM, VERSION, VERSION as VERSION$1, VIEWER_IDENTITY_TARGET_KEYS, VIEWER_SERVICE_DISCRIMINATOR, addSyncScopeToBoundary, analyzeProjectScopeMappingChangeGuardrails, analyzeProjectScopeMappingChangesGuardrails, analyzeProjectScopeMappingDeletionGuardrails, applyLegacyTeamSetupCompletionManifest, applyLegacyTeamSetupCompletionManifestAndReturnActivation, applyLocalIdentitySwitch, applyPeerReplicationOps, areLegacyTeamSetupCompletionPolicyFactsAdditivelyCompatible, assertNoLocalIdentityOverride, automaticRecallHealth, buildAuthHeaders, buildBaseUrl, buildDirectPeerAuthHeaders, buildDistillReport, buildFilterBranchesWithContext, buildFilterClausesWithContext, buildPiFlushSignalFromEvent, buildRawEventEnvelopeFromCodexHook, buildRawEventEnvelopeFromHook, buildRawEventEnvelopeFromPiEvent, buildViewerIdentityTarget, canonicalCoordinatorLegacyTeamCompletionManifestJson, canonicalMemoryKind, canonicalRepositoryProjectIdentity, canonicalWorkspaceIdentity, captureAccountOwnerProfilePins, changeCoordinatorAccount, claimRecipientPolicyActorMutations, claimRecipientPolicyPublicationMutation, classifyRecordedSyncFailure, cleanupNonces, clearLegacyTeamSetupDeviceDecision, clonePromptPackAttempt, coerceObserverCommand, commitDeviceIdentityBindings, commitRecipientPolicyEdges, completeLocalIdentitySwitch, containLegacyTeamSetupCompletionConflict, coordinatorArchiveGroupAction, coordinatorAuthControllerReviewAction, coordinatorCreateAddDeviceInviteAction, coordinatorCreateGroupAction, coordinatorCreateInviteAction, coordinatorCreateLegacyTeamCompletionAction, coordinatorCreateScopeAction, coordinatorDisableDeviceAction, coordinatorEnableDeviceAction, coordinatorGetLegacyTeamCompletionAction, coordinatorGrantScopeMembershipAction, coordinatorImportInviteAction, coordinatorListBootstrapGrantsAction, coordinatorListConsumedTeamInvitesAction, coordinatorListDevicesAction, coordinatorListGroupsAction, coordinatorListJoinRequestsAction, coordinatorListLegacyTeamCompletionsAction, coordinatorListReviewedRecipientInviteEvidenceAction, coordinatorListScopeMembershipsAction, coordinatorListScopesAction, coordinatorRemoveDeviceAction, coordinatorRenameDeviceAction, coordinatorRenameGroupAction, coordinatorReviewJoinRequestAction, coordinatorRevokeBootstrapGrantAction, coordinatorRevokeScopeMembershipAction, coordinatorStatusSnapshot, coordinatorUnarchiveGroupAction, coordinatorUpdateScopeAction, countShareableProjectMemories, createCoordinatorReciprocalApproval, decodeInvitePayload, dedupeOrderedIds, defaultSpaceScopeIdForGroup, deleteProjectScopeSettingsMapping, deriveLegacyTeamSetupCompletionManifest, detectInstallKind, deterministicPolicyTeamId, diagnoseStalePeerReceivedRows, discoverLegacyTeamCandidates, dispatchFileContextTransport, ensureDeviceIdentity, executeShareProvisioning, extractInvitePayload, extractReplicationOps, filterReplicationOpsForSyncWithStatus, fingerprintPublicKey, formatHostPort, friendlyDeviceName, fromJson, generateWithOpenCodeV2, getCodememConfigPath, getCodememEnvOverrideValues, getCodememEnvOverrides, getCoordinatorEnrollmentReconciliationIssueSummary, getCoordinatorGroupPreference, getEffectiveCachedScopeAuthorization, getLegacyTeamSetupDraft, getRecipientPolicyAuthorityState, getSemanticIndexDiagnostics, getSyncResetState, getUpdateStatus, ingestRawEvents, inspectFreshLegacyTeamSetupActivation, inspectLegacyTeamSetupActivation, inviteTokenDigest, isAutomaticRecallMeasurement, isLegacyTeamCandidateSelectable, isLegacyTeamSetupProjectMappingIdentity, isPeerTrustBindingCompatible, isProjectSyncEnablementError, isScopedSyncCapability, judgeDistillReport, legacyDecisionCountsAsOwner, legacyTeamCandidateId, legacyTeamCandidateProjectInventory, legacyTeamCanonicalProjectRef, legacyTeamDeviceRef, legacyTeamResolvedProjectRef, legacyTeamSetupApiErrorCode, legacyTeamSetupCompletionActorIds, legacyTeamSetupFailureCheck, linkCoordinatorAccount, listAuthorizedScopesForPeer, listCoordinatorJoinRequests, listDeviceIdentityInventory, listInboundScopeRejections, listLegacyRecipientPolicyProjections, listMaintenanceJobs, listObserverProviderOptions, listOpenCodeV2Models, listPerPeerScopeSyncState, listProjectScopeCandidates, listProjectScopeInventory, listProjectScopeSettingsMappings, listRecipientPolicyIntent, listRecipientPolicyReview, listSharingDomainSettingsScopes, loadMemorySnapshotPageForPeer, loadPrivateKey, loadPublicKey, loadReplicationOpsForPeer, loadRuntimeSigningPublicKey, lookupCoordinatorPeers, markLocalIdentitySwitchBound, markLocalIdentitySwitchNotCommitted, memoryFilterValueMatchesType, mergeAddresses, migrateRecipientPolicyIntent, mutateCodememConfigFile, negotiateSyncCapability, normalizeAddress, normalizeCoordinatorAccountLinkOrigin, normalizeCoordinatorLegacyTeamCompletionManifest, normalizeHumanPresentationName, normalizeSyncCapability, normalizeSyncFeatures, normalizeTeammateName, parseAcceptedProjectIntent, parseBootstrapExpiry, parseFileContextTransportRequest, parsePositiveMemoryId, parseReassignScopePayload, parseRecipientPolicyEdgeCommitRequest, parseStrictInteger, parseSyncScopeRequest, persistShareOperation, personalScopeGrantStatusForPeer, planShareOperation, previewDeviceIdentityBindings, previewLegacyTeamSetupActivation, previewRecipientPolicyEdges, previewRecipientPolicyOnboarding, previewRecipientPolicyOnboardingFromReviewedIntent, probeAvailableCredentials, projectMatchesFilter, projectShareLifecycle, promptPackArtifactFingerprint, readAccountLinkDevice, readAccountOwnerAssociation, readAccountOwnerAssociationRetainedAtMs, readCodememConfigFile, readCompletedLocalIdentitySwitches, readCoordinatorAccountChangeCapabilities, readCoordinatorAccountLinkStatus, readCoordinatorResolvedAccountOwnerReceiptStatus, readCoordinatorResolvedAccountOwnerStatus, readCoordinatorSyncConfig, readOpenLocalIdentitySwitch, readPeerSyncActivity, reassignProjectScopeInventoryProject, recipientInviteAuthoritativeIdentityId, recipientPolicyDigest, recipientReviewedIntentDigest, reconcileCoordinatorEnrollmentSnapshot, reconcileRecipientPolicyProject, reconcileShareOperationAcceptance, reconstructLegacyTeamSetupCompletionManifest, recordAutomaticRecall, recordHighestObservedDirectSignatureVersion, recordLocalIdentitySwitch, recordNonce, recordPromptPackArtifacts, recordPromptPackTerminal, recordSyncTransferObservation, refreshAuthorizedCoordinatorPeerTrust, refreshConfiguredScopeMembershipCache, refreshLegacyTeamCandidate, rejectInboundScopeFailures, renameRecipientPolicyTeam, replayLegacyTeamSetupActivation, repositoryIdentitiesByWorkspace, repositoryIdentityForWorkspace, requestJson, requireLegacyTeamSetupAccessDeltaWithinLimit, resolveCodememConfigPath, resolveDbPath, resolveObserverDefaultModel, resolveObserverRuntime, resolveProject, resolveProjectRoot, resolveRecipientPolicyReview, resolveRecipientPolicyReviewBulk, resolveVisibleScopeIds, resumeDeviceRebind, runDeviceRebind, runSyncPass, schema, scopeAuthorizationFailureReason, searchPiSessions, serializeRecipientPolicyActorMutations, serializeRecipientPolicyCoordinatorGroupMutation, serializeRecipientPolicyPublicationMutation, serializeRecipientPolicyTeamMutation, setLegacyTeamSetupDeviceAssignment, setLegacyTeamSetupDeviceDecision, setLegacyTeamSetupProjectMapping, setLocalSyncFeature, summarizeInboundScopeRejections, summaryLikeSqlPredicate, supportsSyncFeature, syncScopeResetRequiredPayload, toJson, tryUpdateRetrievalDelivery, updatePeerAddresses, upsertCoordinatorGroupPreference, upsertProjectScopeSettingsMappings, validateLegacyTeamSetupCompletionManifest, validateLegacyTeamSetupCompletionManifestBinding, validateRawEvents, verifyDirectPeerSignature, verifyRecipientReviewedIntent, verifySignature, wakeRecipientPoliciesForIdentities, wakeRecipientPoliciesForProjectIdentities } from "@codemem/core";
|
|
3
|
+
import { ACCESS_CLEANUP_OP_TYPE, CodememConfigMutationError, CoordinatorAccountLinkError, CoordinatorReciprocalApprovalRequestChangedError, DEFAULT_TIME_WINDOW_S, FILE_CONTEXT_TRANSPORT_MAX_BYTES, LEGACY_SHARED_REVIEW_SCOPE_ID, LOCAL_DEFAULT_SCOPE_ID, LOCAL_SYNC_CAPABILITY, LOCAL_SYNC_FEATURES, LegacyTeamSetupAdditiveConvergenceError, LegacyTeamSetupRosterCapacityError, MEMORY_FILTER_FIELD_TYPES, MEMORY_FILTER_NAMES, MEMORY_KIND_DESCRIPTIONS, MemoryStore, ObserverClient, PROMPT_TRANSPORT_PROTOCOL_RANGE, REMEMBER_MEMORY_KINDS, RICH_TIER_ANTHROPIC_DEFAULTS, RICH_TIER_DEFAULTS, RawEventIngestValidationError, RecipientPolicyEdgeRequestError, RecipientPolicyTeamRenameError, RemoteCoordinatorRequestError, SCOPE_MEMBERSHIP_REVOCATION_LIMITATION, SIMPLE_TIER_ANTHROPIC_DEFAULTS, SIMPLE_TIER_DEFAULTS, SYNC_AUTHORIZATION_REFRESH_HEADER, SYNC_CAPABILITY_HEADER, SYNC_FEATURES_HEADER, SYNC_SCOPE_QUERY_PARAM, VERSION, VERSION as VERSION$1, VIEWER_IDENTITY_TARGET_KEYS, VIEWER_SERVICE_DISCRIMINATOR, addSyncScopeToBoundary, analyzeProjectScopeMappingChangeGuardrails, analyzeProjectScopeMappingChangesGuardrails, analyzeProjectScopeMappingDeletionGuardrails, applyLegacyTeamSetupCompletionManifest, applyLegacyTeamSetupCompletionManifestAndReturnActivation, applyLocalIdentitySwitch, applyPeerReplicationOps, areLegacyTeamSetupCompletionPolicyFactsAdditivelyCompatible, assertNoLocalIdentityOverride, automaticRecallHealth, buildAuthHeaders, buildBaseUrl, buildDirectPeerAuthHeaders, buildDistillReport, buildFilterBranchesWithContext, buildFilterClausesWithContext, buildPiFlushSignalFromEvent, buildRawEventEnvelopeFromCodexHook, buildRawEventEnvelopeFromHook, buildRawEventEnvelopeFromPiEvent, buildViewerIdentityTarget, canonicalCoordinatorLegacyTeamCompletionManifestJson, canonicalMemoryKind, canonicalRepositoryProjectIdentity, canonicalWorkspaceIdentity, captureAccountOwnerProfilePins, changeCoordinatorAccount, claimRecipientPolicyActorMutations, claimRecipientPolicyPublicationMutation, classifyRecordedSyncFailure, cleanupNonces, clearLegacyTeamSetupDeviceDecision, clonePromptPackAttempt, coerceObserverCommand, commitDeviceIdentityBindings, commitRecipientPolicyEdges, completeLocalIdentitySwitch, containLegacyTeamSetupCompletionConflict, coordinatorArchiveGroupAction, coordinatorAuthControllerReviewAction, coordinatorCreateAddDeviceInviteAction, coordinatorCreateGroupAction, coordinatorCreateInviteAction, coordinatorCreateLegacyTeamCompletionAction, coordinatorCreateScopeAction, coordinatorDisableDeviceAction, coordinatorEnableDeviceAction, coordinatorGetLegacyTeamCompletionAction, coordinatorGrantScopeMembershipAction, coordinatorImportInviteAction, coordinatorListBootstrapGrantsAction, coordinatorListConsumedTeamInvitesAction, coordinatorListDevicesAction, coordinatorListGroupsAction, coordinatorListJoinRequestsAction, coordinatorListLegacyTeamCompletionsAction, coordinatorListReviewedRecipientInviteEvidenceAction, coordinatorListScopeMembershipsAction, coordinatorListScopesAction, coordinatorRemoveDeviceAction, coordinatorRenameDeviceAction, coordinatorRenameGroupAction, coordinatorReviewJoinRequestAction, coordinatorRevokeBootstrapGrantAction, coordinatorRevokeScopeMembershipAction, coordinatorStatusSnapshot, coordinatorUnarchiveGroupAction, coordinatorUpdateScopeAction, countShareableProjectMemories, createCoordinatorReciprocalApproval, decodeInvitePayload, dedupeOrderedIds, defaultSpaceScopeIdForGroup, deleteProjectScopeSettingsMapping, deriveLegacyTeamSetupCompletionManifest, detectInstallKind, deterministicPolicyTeamId, diagnoseStalePeerReceivedRows, discoverLegacyTeamCandidates, dispatchFileContextTransport, ensureDeviceIdentity, executeShareProvisioning, extractInvitePayload, extractReplicationOps, filterReplicationOpsForSyncWithStatus, fingerprintPublicKey, formatHostPort, friendlyDeviceName, fromJson, generateWithOpenCodeV2, getCodememConfigPath, getCodememEnvOverrideValues, getCodememEnvOverrides, getCoordinatorEnrollmentReconciliationIssueSummary, getCoordinatorGroupPreference, getEffectiveCachedScopeAuthorization, getLegacyTeamSetupDraft, getRecipientPolicyAuthorityState, getSemanticIndexDiagnostics, getSyncResetState, getUpdateStatus, ingestRawEvents, inspectFreshLegacyTeamSetupActivation, inspectLegacyTeamSetupActivation, inviteTokenDigest, isAutomaticRecallMeasurement, isLegacyTeamCandidateSelectable, isLegacyTeamSetupProjectMappingIdentity, isPeerTrustBindingCompatible, isProjectSyncEnablementError, isScopedSyncCapability, judgeDistillReport, legacyDecisionCountsAsOwner, legacyTeamCandidateId, legacyTeamCandidateProjectInventory, legacyTeamCanonicalProjectRef, legacyTeamDeviceRef, legacyTeamResolvedProjectRef, legacyTeamSetupApiErrorCode, legacyTeamSetupCompletionActorIds, legacyTeamSetupFailureCheck, linkCoordinatorAccount, listAuthorizedScopesForPeer, listCoordinatorJoinRequests, listDeviceIdentityInventory, listInboundScopeRejections, listLegacyRecipientPolicyProjections, listMaintenanceJobs, listObserverProviderOptions, listOpenCodeV2Models, listPerPeerScopeSyncState, listProjectScopeCandidates, listProjectScopeInventory, listProjectScopeSettingsMappings, listRecipientPolicyIntent, listRecipientPolicyReview, listSharingDomainSettingsScopes, loadMemorySnapshotPageForPeer, loadPrivateKey, loadPublicKey, loadReplicationOpsForPeer, loadRuntimeSigningPublicKey, lookupCoordinatorPeers, markLocalIdentitySwitchBound, markLocalIdentitySwitchNotCommitted, memoryFilterValueMatchesType, mergeAddresses, migrateRecipientPolicyIntent, mutateCodememConfigFile, negotiateSyncCapability, normalizeAddress, normalizeCoordinatorAccountLinkOrigin, normalizeCoordinatorLegacyTeamCompletionManifest, normalizeHumanPresentationName, normalizeSyncCapability, normalizeSyncFeatures, normalizeTeammateName, parseAcceptedProjectIntent, parseBootstrapExpiry, parseFileContextTransportRequest, parsePositiveMemoryId, parseReassignScopePayload, parseRecipientPolicyEdgeCommitRequest, parseStrictInteger, parseSyncScopeRequest, persistShareOperation, personalScopeGrantStatusForPeer, planShareOperation, previewDeviceIdentityBindings, previewLegacyTeamSetupActivation, previewRecipientPolicyEdges, previewRecipientPolicyOnboarding, previewRecipientPolicyOnboardingFromReviewedIntent, probeAvailableCredentials, projectMatchesFilter, projectShareLifecycle, promptPackArtifactFingerprint, readAccountLinkDevice, readAccountOwnerAssociation, readAccountOwnerAssociationRetainedAtMs, readCodememConfigFile, readCompletedLocalIdentitySwitches, readCoordinatorAccountChangeCapabilities, readCoordinatorAccountLinkStatus, readCoordinatorResolvedAccountOwnerReceiptStatus, readCoordinatorResolvedAccountOwnerStatus, readCoordinatorSyncConfig, readOpenLocalIdentitySwitch, readPeerSyncActivity, readRepositoryIdentitySnapshot, reassignProjectScopeInventoryProject, recipientInviteAuthoritativeIdentityId, recipientPolicyDigest, recipientReviewedIntentDigest, reconcileCoordinatorEnrollmentSnapshot, reconcileRecipientPolicyProject, reconcileShareOperationAcceptance, reconstructLegacyTeamSetupCompletionManifest, recordAutomaticRecall, recordHighestObservedDirectSignatureVersion, recordLocalIdentitySwitch, recordNonce, recordPromptPackArtifacts, recordPromptPackTerminal, recordSyncAttempt, recordSyncTransferObservation, refreshAuthorizedCoordinatorPeerTrust, refreshConfiguredScopeMembershipCache, refreshLegacyTeamCandidate, rejectInboundScopeFailures, renameRecipientPolicyTeam, replayLegacyTeamSetupActivation, repositoryIdentitiesByWorkspace, repositoryIdentityForWorkspace, requestJson, requireLegacyTeamSetupAccessDeltaWithinLimit, resolveCodememConfigPath, resolveDbPath, resolveObserverDefaultModel, resolveObserverRuntime, resolveProject, resolveProjectRoot, resolveRecipientPolicyReview, resolveRecipientPolicyReviewBulk, resolveVisibleScopeIds, resumeDeviceRebind, runDeviceRebind, runSyncPass, schema, scopeAuthorizationFailureReason, searchPiSessions, serializeRecipientPolicyActorMutations, serializeRecipientPolicyCoordinatorGroupMutation, serializeRecipientPolicyPublicationMutation, serializeRecipientPolicyTeamMutation, setLegacyTeamSetupDeviceAssignment, setLegacyTeamSetupDeviceDecision, setLegacyTeamSetupProjectMapping, setLocalSyncFeature, summarizeInboundScopeRejections, summaryLikeSqlPredicate, supportsSyncFeature, syncScopeResetRequiredPayload, toJson, tryUpdateRetrievalDelivery, updatePeerAddresses, upsertCoordinatorGroupPreference, upsertProjectScopeSettingsMappings, validateLegacyTeamSetupCompletionManifest, validateLegacyTeamSetupCompletionManifestBinding, validateRawEvents, verifyDirectPeerSignature, verifyRecipientReviewedIntent, verifySignature, wakeRecipientPoliciesForIdentities, wakeRecipientPoliciesForProjectIdentities } from "@codemem/core";
|
|
4
4
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
5
5
|
import { Hono } from "hono";
|
|
6
6
|
import { createCipheriv, createDecipheriv, createHash, createPrivateKey, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
@@ -5933,6 +5933,15 @@ async function reconcileRecipientPolicyProjectsOperation(store, options) {
|
|
|
5933
5933
|
//#endregion
|
|
5934
5934
|
//#region src/application/sync-health.ts
|
|
5935
5935
|
var STALE_AFTER_MS = 6e5;
|
|
5936
|
+
function readLastSuccessfulConnections(store) {
|
|
5937
|
+
const rows = store.db.prepare(`
|
|
5938
|
+
SELECT p.peer_device_id, a.transport, a.finished_at FROM sync_peers p
|
|
5939
|
+
JOIN sync_attempts a ON a.id = (
|
|
5940
|
+
SELECT id FROM sync_attempts WHERE peer_device_id = p.peer_device_id AND ok <> 0
|
|
5941
|
+
ORDER BY started_at DESC, id DESC LIMIT 1
|
|
5942
|
+
)`);
|
|
5943
|
+
return new Map(rows.all().map((row) => [row.peer_device_id, row]));
|
|
5944
|
+
}
|
|
5936
5945
|
function timestamp(value) {
|
|
5937
5946
|
if (!value) return null;
|
|
5938
5947
|
const parsed = Date.parse(value);
|
|
@@ -5997,11 +6006,22 @@ function readPeerSyncHealth(store, peerIds) {
|
|
|
5997
6006
|
)`);
|
|
5998
6007
|
const failed = /* @__PURE__ */ new Map();
|
|
5999
6008
|
for (const row of latest.all()) if (!row.ok && row.finished_at) failed.set(row.peer_device_id, row.finished_at);
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6009
|
+
const connections = readLastSuccessfulConnections(store);
|
|
6010
|
+
return new Map(peerIds.map((id) => {
|
|
6011
|
+
const connection = connections.get(id);
|
|
6012
|
+
const transport = connection?.transport;
|
|
6013
|
+
return [id, {
|
|
6014
|
+
...peerSyncHealth(activity.get(id), {
|
|
6015
|
+
now,
|
|
6016
|
+
staleAfterMs,
|
|
6017
|
+
failedAt: failed.get(id)
|
|
6018
|
+
}),
|
|
6019
|
+
last_successful_connection: {
|
|
6020
|
+
transport: transport === "direct" || transport === "relay" ? transport : null,
|
|
6021
|
+
at: connection?.finished_at ?? null
|
|
6022
|
+
}
|
|
6023
|
+
}];
|
|
6024
|
+
}));
|
|
6005
6025
|
}
|
|
6006
6026
|
function overallSyncHealth(peers, options) {
|
|
6007
6027
|
const paired = peers.filter((peer) => peer.pinned);
|
|
@@ -8541,6 +8561,29 @@ function teamSetupRoutes(options) {
|
|
|
8541
8561
|
/**
|
|
8542
8562
|
* Sync routes — status, peers, actors, attempts, pairing, mutations.
|
|
8543
8563
|
*/
|
|
8564
|
+
function manualSyncReachability(resolver, store, peerId) {
|
|
8565
|
+
let route;
|
|
8566
|
+
try {
|
|
8567
|
+
route = resolver?.forPeer(store.db, peerId);
|
|
8568
|
+
} catch {
|
|
8569
|
+
return;
|
|
8570
|
+
}
|
|
8571
|
+
if (!route) return void 0;
|
|
8572
|
+
const signals = [resolver?.signal, route.signal].filter((signal) => signal !== void 0);
|
|
8573
|
+
return {
|
|
8574
|
+
...route,
|
|
8575
|
+
signal: signals.length > 0 ? AbortSignal.any(signals) : void 0,
|
|
8576
|
+
deadlineMs: void 0
|
|
8577
|
+
};
|
|
8578
|
+
}
|
|
8579
|
+
function runManualSyncPass(store, peerId, resolver) {
|
|
8580
|
+
return runSyncPass(store.db, peerId, {
|
|
8581
|
+
keysDir: syncKeysDir(),
|
|
8582
|
+
dbPath: store.dbPath,
|
|
8583
|
+
scanner: store.scanner,
|
|
8584
|
+
reachability: manualSyncReachability(resolver, store, peerId)
|
|
8585
|
+
});
|
|
8586
|
+
}
|
|
8544
8587
|
function safeSkippedSyncDetail(detail) {
|
|
8545
8588
|
if (!detail) return null;
|
|
8546
8589
|
return {
|
|
@@ -11962,11 +12005,14 @@ async function deleteProjectScopeMappingRoute(c, store) {
|
|
|
11962
12005
|
releasePublicationMutation?.();
|
|
11963
12006
|
}
|
|
11964
12007
|
}
|
|
11965
|
-
function projectSharingByRepository(store, operations) {
|
|
12008
|
+
function projectSharingByRepository(store, operations, repositoryIdentitySnapshot) {
|
|
11966
12009
|
const operationById = new Map(operations.map((operation) => [operation.operation_id, operation]));
|
|
11967
12010
|
const sharingByProject = /* @__PURE__ */ new Map();
|
|
11968
12011
|
const mappings = store.db.prepare("SELECT workspace_identity, project_pattern FROM project_scope_mappings").all();
|
|
11969
|
-
const repositoryIdentities = repositoryIdentitiesByWorkspace(store.db, {
|
|
12012
|
+
const repositoryIdentities = repositoryIdentitiesByWorkspace(store.db, {
|
|
12013
|
+
repositoryIdentitySnapshot,
|
|
12014
|
+
knownRepositoryIdentities: mappings.flatMap((mapping) => [mapping.workspace_identity, mapping.project_pattern])
|
|
12015
|
+
});
|
|
11970
12016
|
const seenOperationProjects = /* @__PURE__ */ new Set();
|
|
11971
12017
|
const reviewed = store.db.prepare(`SELECT p.operation_id, p.canonical_project_identity
|
|
11972
12018
|
FROM share_operation_projects p
|
|
@@ -12177,6 +12223,22 @@ function createActorMutationPreflightRoutes(getStore) {
|
|
|
12177
12223
|
app.post("/api/sync/actors/merge", preflight);
|
|
12178
12224
|
return app;
|
|
12179
12225
|
}
|
|
12226
|
+
async function projectScopeInventoryRoute(c, store) {
|
|
12227
|
+
const limit = Math.max(1, queryInt(c.req.query("limit"), 50));
|
|
12228
|
+
const offset = Math.max(0, queryInt(c.req.query("offset"), 0));
|
|
12229
|
+
const repositoryIdentitySnapshot = readRepositoryIdentitySnapshot(store.db);
|
|
12230
|
+
const inventory = listProjectScopeInventory(store.db, {
|
|
12231
|
+
repositoryIdentitySnapshot,
|
|
12232
|
+
identitySource: c.req.query("identity_source"),
|
|
12233
|
+
limit,
|
|
12234
|
+
offset,
|
|
12235
|
+
query: c.req.query("q"),
|
|
12236
|
+
scopeId: c.req.query("scope_id"),
|
|
12237
|
+
status: c.req.query("status")
|
|
12238
|
+
});
|
|
12239
|
+
const sharingByProject = projectSharingByRepository(store, await shareOperationReadModels(store, void 0, false), repositoryIdentitySnapshot);
|
|
12240
|
+
return c.json(serializeProjectScopeInventory(store, inventory, sharingByProject));
|
|
12241
|
+
}
|
|
12180
12242
|
function syncRoutes(getStore, getSyncRuntimeStatus, options = {}) {
|
|
12181
12243
|
const app = createActorMutationPreflightRoutes(getStore);
|
|
12182
12244
|
app.post("/api/sync/invites/inspect", inspectPairingInvite);
|
|
@@ -12520,11 +12582,7 @@ function syncRoutes(getStore, getSyncRuntimeStatus, options = {}) {
|
|
|
12520
12582
|
else peerIds = store.db.prepare("SELECT peer_device_id FROM sync_peers").all().map((row) => String(row.peer_device_id ?? "").trim()).filter(Boolean);
|
|
12521
12583
|
const items = [];
|
|
12522
12584
|
for (const peerId of peerIds) {
|
|
12523
|
-
const result = await
|
|
12524
|
-
keysDir: syncKeysDir(),
|
|
12525
|
-
dbPath: store.dbPath,
|
|
12526
|
-
scanner: store.scanner
|
|
12527
|
-
});
|
|
12585
|
+
const result = await runManualSyncPass(store, peerId, options.syncReachability);
|
|
12528
12586
|
items.push({
|
|
12529
12587
|
peer_device_id: peerId,
|
|
12530
12588
|
...result,
|
|
@@ -12788,21 +12846,7 @@ function syncRoutes(getStore, getSyncRuntimeStatus, options = {}) {
|
|
|
12788
12846
|
}, requests);
|
|
12789
12847
|
return c.json(result, result.results.some((item) => item.status !== "applied") ? 207 : 200);
|
|
12790
12848
|
});
|
|
12791
|
-
app.get("/api/sync/projects",
|
|
12792
|
-
const store = getStore();
|
|
12793
|
-
const limit = Math.max(1, queryInt(c.req.query("limit"), 50));
|
|
12794
|
-
const offset = Math.max(0, queryInt(c.req.query("offset"), 0));
|
|
12795
|
-
const inventory = listProjectScopeInventory(store.db, {
|
|
12796
|
-
identitySource: c.req.query("identity_source"),
|
|
12797
|
-
limit,
|
|
12798
|
-
offset,
|
|
12799
|
-
query: c.req.query("q"),
|
|
12800
|
-
scopeId: c.req.query("scope_id"),
|
|
12801
|
-
status: c.req.query("status")
|
|
12802
|
-
});
|
|
12803
|
-
const sharingByProject = projectSharingByRepository(store, await shareOperationReadModels(store, void 0, false));
|
|
12804
|
-
return c.json(serializeProjectScopeInventory(store, inventory, sharingByProject));
|
|
12805
|
-
});
|
|
12849
|
+
app.get("/api/sync/projects", (c) => projectScopeInventoryRoute(c, getStore()));
|
|
12806
12850
|
app.post("/api/sync/projects/reassign-project", async (c) => {
|
|
12807
12851
|
const store = getStore();
|
|
12808
12852
|
const body = await parseViewerJsonBody(c);
|
|
@@ -15972,7 +16016,8 @@ sqliteTable("sync_attempts", {
|
|
|
15972
16016
|
local_sync_capability: text("local_sync_capability"),
|
|
15973
16017
|
peer_sync_capability: text("peer_sync_capability"),
|
|
15974
16018
|
negotiated_sync_capability: text("negotiated_sync_capability"),
|
|
15975
|
-
failure_category: text("failure_category")
|
|
16019
|
+
failure_category: text("failure_category"),
|
|
16020
|
+
transport: text("transport")
|
|
15976
16021
|
}, (table) => [
|
|
15977
16022
|
index("idx_sync_attempts_peer_started").on(table.peer_device_id, table.started_at),
|
|
15978
16023
|
index("idx_sync_attempts_occurred").on(sql`CASE WHEN ${table.finished_at} IS NULL THEN ${table.started_at} ELSE ${table.finished_at} END`, table.id),
|
|
@@ -17659,6 +17704,20 @@ function buildClient(deps, config) {
|
|
|
17659
17704
|
}),
|
|
17660
17705
|
resolvePeerPin: (peerDeviceId) => pinnedPeerKey(db, peerDeviceId),
|
|
17661
17706
|
validateLocal: () => sameDevice(readLocalDevice(db), device),
|
|
17707
|
+
onInboundFailure: (failure) => {
|
|
17708
|
+
const http = failure.httpCode ? ` http=${failure.httpCode}` : "";
|
|
17709
|
+
const diagnostic = `relay_target_failure stage=${failure.stage} reason=${failure.reason}${http}`;
|
|
17710
|
+
try {
|
|
17711
|
+
recordSyncAttempt(db, "", {
|
|
17712
|
+
ok: false,
|
|
17713
|
+
error: diagnostic,
|
|
17714
|
+
failureCategory: "connectivity"
|
|
17715
|
+
});
|
|
17716
|
+
} catch {
|
|
17717
|
+
options.log?.("[codemem] relay target diagnostic could not be persisted", "warn");
|
|
17718
|
+
}
|
|
17719
|
+
options.log?.(`[codemem] ${diagnostic}`, "warn");
|
|
17720
|
+
},
|
|
17662
17721
|
onInbound: (_connection, context) => context.serve({
|
|
17663
17722
|
origin: RELAY_LOGICAL_ORIGIN,
|
|
17664
17723
|
dispatch: deps.dispatch
|
|
@@ -17967,7 +18026,6 @@ function createApp(opts) {
|
|
|
17967
18026
|
const storeFactory = opts?.storeFactory ?? getStore;
|
|
17968
18027
|
const sweeper = opts?.sweeper ?? null;
|
|
17969
18028
|
const getObserver = opts?.getObserver ?? (() => opts?.observer ?? null);
|
|
17970
|
-
const getSyncRuntimeStatus = opts?.getSyncRuntimeStatus ?? (() => null);
|
|
17971
18029
|
let invalidateTeamSetupSummary = () => {};
|
|
17972
18030
|
const app = new Hono();
|
|
17973
18031
|
registerViewerBoundary(app, opts);
|
|
@@ -17991,7 +18049,8 @@ function createApp(opts) {
|
|
|
17991
18049
|
}));
|
|
17992
18050
|
registerConfigRoutes(app, opts, sweeper);
|
|
17993
18051
|
app.route("/", rawEventsRoutes(storeFactory, sweeper, opts?.rawEventInbox, opts?.rawEventTarget));
|
|
17994
|
-
app.route("/", syncRoutes(storeFactory, getSyncRuntimeStatus, {
|
|
18052
|
+
app.route("/", syncRoutes(storeFactory, opts?.getSyncRuntimeStatus, {
|
|
18053
|
+
syncReachability: opts?.syncReachability,
|
|
17995
18054
|
loadDeviceIdentityCoordinatorEvidence: opts?.loadDeviceIdentityCoordinatorEvidence,
|
|
17996
18055
|
onRecipientPolicyTeamRenamed: () => invalidateTeamSetupSummary(),
|
|
17997
18056
|
readCoordinatorConfig: opts?.readCoordinatorConfig,
|