@codemem/server 0.46.0 → 0.46.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/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +56 -5
- package/dist/index.js.map +1 -1
- package/dist/routes/config.d.ts +5 -0
- package/dist/routes/config.d.ts.map +1 -1
- package/package.json +2 -2
- package/static/app.js +45 -45
- package/static/app.js.br +0 -0
- package/static/app.js.gz +0 -0
- package/static/index.html +8 -4
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { MemoryStore, type RawEventSweeper, VERSION } from "@codemem/core";
|
|
|
12
12
|
import { Hono } from "hono";
|
|
13
13
|
import type { RawEventInbox } from "./raw-event-inbox.js";
|
|
14
14
|
import { type InMemoryRequestRateLimiter } from "./request-rate-limit.js";
|
|
15
|
+
import { type ConfigRouteOptions } from "./routes/config.js";
|
|
15
16
|
import { type SyncRoutesOptions } from "./routes/sync.js";
|
|
16
17
|
import { type ViewerTargetStore } from "./routes/target-validation.js";
|
|
17
18
|
import { type LegacyTeamCompletionDependencies, type LegacyTeamConfiguredGroupSnapshotLoader } from "./routes/team-setup.js";
|
|
@@ -37,6 +38,9 @@ export interface AppOptions {
|
|
|
37
38
|
rawEventTarget?: ViewerTargetStore;
|
|
38
39
|
sweeper?: RawEventSweeper | null;
|
|
39
40
|
observer?: ObserverClient | null;
|
|
41
|
+
getObserver?: () => ObserverClient | null;
|
|
42
|
+
scheduleObserverApply?: ConfigRouteOptions["scheduleObserverApply"];
|
|
43
|
+
getObserverApplyStatus?: ConfigRouteOptions["getObserverApplyStatus"];
|
|
40
44
|
getUpdateStatus?: (options: GetUpdateStatusOptions) => Promise<UpdateStatus>;
|
|
41
45
|
loadDeviceIdentityCoordinatorEvidence?: () => Promise<DeviceIdentityCoordinatorEvidence>;
|
|
42
46
|
loadLegacyTeamConfiguredGroupSnapshots?: LegacyTeamConfiguredGroupSnapshotLoader;
|
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,EACtB,cAAc,EACd,YAAY,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAiB,OAAO,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAEN,KAAK,0BAA0B,EAC/B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { dirname, isAbsolute, join, posix, resolve, win32 } from "node:path";
|
|
3
|
-
import { ACCESS_CLEANUP_OP_TYPE, CodememConfigMutationError, CoordinatorReciprocalApprovalRequestChangedError, DEFAULT_TIME_WINDOW_S, 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, RawEventIngestValidationError, RecipientPolicyEdgeRequestError, RecipientPolicyTeamRenameError, RemoteCoordinatorRequestError, SCOPE_MEMBERSHIP_REVOCATION_LIMITATION, 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, applyReplicationOps, areLegacyTeamSetupCompletionPolicyFactsAdditivelyCompatible, automaticRecallHealth, buildAuthHeaders, buildBaseUrl, buildDirectPeerAuthHeaders, buildDistillReport, buildFilterClausesWithContext, buildPiFlushSignalFromEvent, buildRawEventEnvelopeFromCodexHook, buildRawEventEnvelopeFromHook, buildRawEventEnvelopeFromPiEvent, buildViewerIdentityTarget, canonicalCoordinatorLegacyTeamCompletionManifestJson, canonicalMemoryKind, canonicalRepositoryProjectIdentity, canonicalWorkspaceIdentity, claimRecipientPolicyActorMutations, claimRecipientPolicyPublicationMutation, classifyRecordedSyncFailure, cleanupNonces, clearLegacyTeamSetupDeviceDecision, clonePromptPackAttempt, coerceObserverCommand, commitDeviceIdentityBindings, commitRecipientPolicyEdges, containLegacyTeamSetupCompletionConflict, coordinatorArchiveGroupAction, 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, ensureDeviceIdentity, executeShareProvisioning, extractInvitePayload, extractReplicationOps, filterReplicationOpsForSyncWithStatus, fingerprintPublicKey, formatHostPort, friendlyDeviceName, fromJson, getCodememConfigPath, getCodememEnvOverrideValues, getCodememEnvOverrides, getCoordinatorEnrollmentReconciliationIssueSummary, getCoordinatorGroupPreference, getLegacyTeamSetupDraft, getRecipientPolicyAuthorityState, getSemanticIndexDiagnostics, getSyncResetState, getUpdateStatus, ingestRawEvents, inspectFreshLegacyTeamSetupActivation, inspectLegacyTeamSetupActivation, inviteTokenDigest, isAutomaticRecallMeasurement, isLegacyTeamCandidateSelectable, isLegacyTeamSetupProjectMappingIdentity, isPeerTrustBindingCompatible, isProjectSyncEnablementError, isScopedSyncCapability, judgeDistillReport, legacyTeamCandidateId, legacyTeamCandidateProjectInventory, legacyTeamCanonicalProjectRef, legacyTeamDeviceRef, legacyTeamResolvedProjectRef, legacyTeamSetupApiErrorCode, listAuthorizedScopesForPeer, listCoordinatorJoinRequests, listDeviceIdentityInventory, listInboundScopeRejections, listLegacyRecipientPolicyProjections, listMaintenanceJobs, listObserverProviderOptions, listPerPeerScopeSyncState, listProjectScopeCandidates, listProjectScopeInventory, listProjectScopeSettingsMappings, listRecipientPolicyIntent, listRecipientPolicyReview, listSharingDomainSettingsScopes, loadMemorySnapshotPageForPeer, loadReplicationOpsForPeer, lookupCoordinatorPeers, memoryFilterValueMatchesType, mergeAddresses, migrateRecipientPolicyIntent, mutateCodememConfigFile, negotiateSyncCapability, normalizeAddress, normalizeHumanPresentationName, normalizeSyncCapability, normalizeSyncFeatures, normalizeTeammateName, parseAcceptedProjectIntent, parsePositiveMemoryId, parseReassignScopePayload, parseRecipientPolicyEdgeCommitRequest, parseStrictInteger, parseSyncScopeRequest, persistShareOperation, personalScopeGrantStatusForPeer, planShareOperation, previewDeviceIdentityBindings, previewLegacyTeamSetupActivation, previewRecipientPolicyEdges, previewRecipientPolicyOnboarding, previewRecipientPolicyOnboardingFromReviewedIntent, probeAvailableCredentials, projectMatchesFilter, projectShareLifecycle, promptPackArtifactFingerprint, readCodememConfigFile, readCoordinatorSyncConfig, reassignProjectScopeInventoryProject, recipientInviteAuthoritativeIdentityId, recipientPolicyDigest, recipientReviewedIntentDigest, reconcileCoordinatorEnrollmentSnapshot, reconcileRecipientPolicyProject, reconcileShareOperationAcceptance, reconstructLegacyTeamSetupCompletionManifest, recordAutomaticRecall, recordHighestObservedDirectSignatureVersion, recordNonce, recordPromptPackArtifacts, recordPromptPackTerminal, refreshAuthorizedCoordinatorPeerTrust, refreshConfiguredScopeMembershipCache, refreshLegacyTeamCandidate, rejectInboundScopeFailures, renameRecipientPolicyTeam, replayLegacyTeamSetupActivation, repositoryIdentitiesByWorkspace, repositoryIdentityForWorkspace, requestJson, requireLegacyTeamSetupAccessDeltaWithinLimit, resolveDbPath, resolveObserverRuntime, resolveProject, resolveProjectRoot, resolveRecipientPolicyReview, resolveRecipientPolicyReviewBulk, runSyncPass, schema, serializeRecipientPolicyCoordinatorGroupMutation, serializeRecipientPolicyPublicationMutation, serializeRecipientPolicyTeamMutation, setLegacyTeamSetupDeviceAssignment, setLegacyTeamSetupDeviceDecision, setLegacyTeamSetupProjectMapping, storeVectors, 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, CoordinatorReciprocalApprovalRequestChangedError, DEFAULT_TIME_WINDOW_S, 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, RawEventIngestValidationError, RecipientPolicyEdgeRequestError, RecipientPolicyTeamRenameError, RemoteCoordinatorRequestError, SCOPE_MEMBERSHIP_REVOCATION_LIMITATION, 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, applyReplicationOps, areLegacyTeamSetupCompletionPolicyFactsAdditivelyCompatible, automaticRecallHealth, buildAuthHeaders, buildBaseUrl, buildDirectPeerAuthHeaders, buildDistillReport, buildFilterClausesWithContext, buildPiFlushSignalFromEvent, buildRawEventEnvelopeFromCodexHook, buildRawEventEnvelopeFromHook, buildRawEventEnvelopeFromPiEvent, buildViewerIdentityTarget, canonicalCoordinatorLegacyTeamCompletionManifestJson, canonicalMemoryKind, canonicalRepositoryProjectIdentity, canonicalWorkspaceIdentity, claimRecipientPolicyActorMutations, claimRecipientPolicyPublicationMutation, classifyRecordedSyncFailure, cleanupNonces, clearLegacyTeamSetupDeviceDecision, clonePromptPackAttempt, coerceObserverCommand, commitDeviceIdentityBindings, commitRecipientPolicyEdges, containLegacyTeamSetupCompletionConflict, coordinatorArchiveGroupAction, 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, ensureDeviceIdentity, executeShareProvisioning, extractInvitePayload, extractReplicationOps, filterReplicationOpsForSyncWithStatus, fingerprintPublicKey, formatHostPort, friendlyDeviceName, fromJson, generateWithOpenCodeV2, getCodememConfigPath, getCodememEnvOverrideValues, getCodememEnvOverrides, getCoordinatorEnrollmentReconciliationIssueSummary, getCoordinatorGroupPreference, getLegacyTeamSetupDraft, getRecipientPolicyAuthorityState, getSemanticIndexDiagnostics, getSyncResetState, getUpdateStatus, ingestRawEvents, inspectFreshLegacyTeamSetupActivation, inspectLegacyTeamSetupActivation, inviteTokenDigest, isAutomaticRecallMeasurement, isLegacyTeamCandidateSelectable, isLegacyTeamSetupProjectMappingIdentity, isPeerTrustBindingCompatible, isProjectSyncEnablementError, isScopedSyncCapability, judgeDistillReport, legacyTeamCandidateId, legacyTeamCandidateProjectInventory, legacyTeamCanonicalProjectRef, legacyTeamDeviceRef, legacyTeamResolvedProjectRef, legacyTeamSetupApiErrorCode, listAuthorizedScopesForPeer, listCoordinatorJoinRequests, listDeviceIdentityInventory, listInboundScopeRejections, listLegacyRecipientPolicyProjections, listMaintenanceJobs, listObserverProviderOptions, listOpenCodeV2Models, listPerPeerScopeSyncState, listProjectScopeCandidates, listProjectScopeInventory, listProjectScopeSettingsMappings, listRecipientPolicyIntent, listRecipientPolicyReview, listSharingDomainSettingsScopes, loadMemorySnapshotPageForPeer, loadReplicationOpsForPeer, lookupCoordinatorPeers, memoryFilterValueMatchesType, mergeAddresses, migrateRecipientPolicyIntent, mutateCodememConfigFile, negotiateSyncCapability, normalizeAddress, normalizeHumanPresentationName, normalizeSyncCapability, normalizeSyncFeatures, normalizeTeammateName, parseAcceptedProjectIntent, parsePositiveMemoryId, parseReassignScopePayload, parseRecipientPolicyEdgeCommitRequest, parseStrictInteger, parseSyncScopeRequest, persistShareOperation, personalScopeGrantStatusForPeer, planShareOperation, previewDeviceIdentityBindings, previewLegacyTeamSetupActivation, previewRecipientPolicyEdges, previewRecipientPolicyOnboarding, previewRecipientPolicyOnboardingFromReviewedIntent, probeAvailableCredentials, projectMatchesFilter, projectShareLifecycle, promptPackArtifactFingerprint, readCodememConfigFile, readCoordinatorSyncConfig, reassignProjectScopeInventoryProject, recipientInviteAuthoritativeIdentityId, recipientPolicyDigest, recipientReviewedIntentDigest, reconcileCoordinatorEnrollmentSnapshot, reconcileRecipientPolicyProject, reconcileShareOperationAcceptance, reconstructLegacyTeamSetupCompletionManifest, recordAutomaticRecall, recordHighestObservedDirectSignatureVersion, recordNonce, recordPromptPackArtifacts, recordPromptPackTerminal, refreshAuthorizedCoordinatorPeerTrust, refreshConfiguredScopeMembershipCache, refreshLegacyTeamCandidate, rejectInboundScopeFailures, renameRecipientPolicyTeam, replayLegacyTeamSetupActivation, repositoryIdentitiesByWorkspace, repositoryIdentityForWorkspace, requestJson, requireLegacyTeamSetupAccessDeltaWithinLimit, resolveDbPath, resolveObserverRuntime, resolveProject, resolveProjectRoot, resolveRecipientPolicyReview, resolveRecipientPolicyReviewBulk, runSyncPass, schema, serializeRecipientPolicyCoordinatorGroupMutation, serializeRecipientPolicyPublicationMutation, serializeRecipientPolicyTeamMutation, setLegacyTeamSetupDeviceAssignment, setLegacyTeamSetupDeviceDecision, setLegacyTeamSetupProjectMapping, storeVectors, 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 { createMiddleware } from "hono/factory";
|
|
@@ -264,6 +264,7 @@ var ALLOWED_KEYS = [
|
|
|
264
264
|
"sync_coordinator_presence_ttl_s",
|
|
265
265
|
"raw_events_sweeper_interval_s"
|
|
266
266
|
];
|
|
267
|
+
var OBSERVER_KEYS = new Set(ALLOWED_KEYS.filter((key) => key.startsWith("observer_") || key === "codex_command" || key === "claude_command"));
|
|
267
268
|
var DEFAULTS = {
|
|
268
269
|
claude_command: ["claude"],
|
|
269
270
|
codex_command: ["codex"],
|
|
@@ -530,17 +531,21 @@ function viewerConfigSavePayload(saved, opts) {
|
|
|
530
531
|
...savedChangedKeys,
|
|
531
532
|
...effectiveChangedKeys
|
|
532
533
|
])];
|
|
534
|
+
const observerChangedKeys = [.../* @__PURE__ */ new Set([...effectiveChangedKeys, ...savedChangedKeys.filter((key) => !(key in envOverrides))])].filter((key) => OBSERVER_KEYS.has(key));
|
|
535
|
+
const applyingKeys = observerChangedKeys.length > 0 && opts.scheduleObserverApply?.() === true ? observerChangedKeys : [];
|
|
533
536
|
return {
|
|
534
537
|
path: savedPath,
|
|
535
538
|
config: sanitizeConfigForResponse(nextConfig),
|
|
536
539
|
effective: sanitizeConfigForResponse(afterEffective),
|
|
537
540
|
...observerRuntimeMetadata(nextConfig),
|
|
541
|
+
...opts.getObserverApplyStatus ? { observer_apply: opts.getObserverApplyStatus() } : {},
|
|
538
542
|
protected_keys: [...PROTECTED_WRITE_KEYS].sort(),
|
|
539
543
|
effects: {
|
|
540
544
|
saved_keys: savedChangedKeys,
|
|
541
545
|
effective_keys: effectiveChangedKeys,
|
|
542
546
|
hot_reloaded_keys: applyRuntimeEffects(runtimeChangedKeys, opts),
|
|
543
|
-
|
|
547
|
+
applying_keys: applyingKeys,
|
|
548
|
+
restart_required_keys: [.../* @__PURE__ */ new Set([...effectiveChangedKeys, ...observerChangedKeys])].filter((key) => !HOT_RELOAD_KEYS.has(key) && !applyingKeys.includes(key) && !(key in envOverrides)),
|
|
544
549
|
ignored_by_env_keys: ignoredByEnvKeys,
|
|
545
550
|
warnings: ignoredByEnvKeys.map((key) => `${key} is currently controlled by ${envOverrides[key]}; saved config will not take effect until that override is removed.`)
|
|
546
551
|
}
|
|
@@ -559,6 +564,40 @@ async function handleConfigPost(c, opts) {
|
|
|
559
564
|
}
|
|
560
565
|
function configRoutes(opts = {}) {
|
|
561
566
|
const app = new Hono();
|
|
567
|
+
const modelChecks = createInMemoryRequestRateLimiter();
|
|
568
|
+
app.get("/api/observer-model-catalog", async (c) => {
|
|
569
|
+
return c.json({
|
|
570
|
+
models: await listOpenCodeV2Models(),
|
|
571
|
+
availability: "catalog_only"
|
|
572
|
+
});
|
|
573
|
+
});
|
|
574
|
+
app.post("/api/observer-model-check", async (c) => {
|
|
575
|
+
let input;
|
|
576
|
+
try {
|
|
577
|
+
input = await c.req.json();
|
|
578
|
+
} catch {
|
|
579
|
+
return c.json({ error: "Choose a provider and model to check." }, 400);
|
|
580
|
+
}
|
|
581
|
+
if (!input || typeof input !== "object") return c.json({ error: "Choose a provider and model to check." }, 400);
|
|
582
|
+
const { provider, model } = input;
|
|
583
|
+
if (provider !== "openai" && provider !== "anthropic" || typeof model !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/.test(model)) return c.json({ error: "Choose an OpenAI or Anthropic model to check." }, 400);
|
|
584
|
+
const check = modelChecks.check("observer-model-check", 2);
|
|
585
|
+
if (!check.allowed) {
|
|
586
|
+
c.header("Retry-After", String(check.retryAfterS));
|
|
587
|
+
return c.json({ error: "Model checks are limited. Try again shortly." }, 429);
|
|
588
|
+
}
|
|
589
|
+
const result = await generateWithOpenCodeV2({
|
|
590
|
+
provider,
|
|
591
|
+
model,
|
|
592
|
+
prompt: "Reply exactly OK."
|
|
593
|
+
});
|
|
594
|
+
return c.json({
|
|
595
|
+
provider,
|
|
596
|
+
model,
|
|
597
|
+
available: result.error === null && result.text?.trim() === "OK",
|
|
598
|
+
status: result.error ?? (result.text?.trim() === "OK" ? "verified" : "unexpected_response")
|
|
599
|
+
});
|
|
600
|
+
});
|
|
562
601
|
app.get("/api/config", (c) => {
|
|
563
602
|
const configPath = getCodememConfigPath();
|
|
564
603
|
const configData = withoutRemovedConfigKeys(readCodememConfigFile());
|
|
@@ -569,12 +608,17 @@ function configRoutes(opts = {}) {
|
|
|
569
608
|
defaults: DEFAULTS,
|
|
570
609
|
effective: sanitizeConfigForResponse(effective),
|
|
571
610
|
...observerRuntimeMetadata(configData),
|
|
611
|
+
...opts.getObserverApplyStatus ? { observer_apply: opts.getObserverApplyStatus() } : {},
|
|
572
612
|
env_overrides: getCodememEnvOverrides(),
|
|
573
613
|
protected_keys: [...PROTECTED_WRITE_KEYS].sort(),
|
|
574
614
|
providers: loadProviderOptions()
|
|
575
615
|
});
|
|
576
616
|
});
|
|
577
617
|
app.post("/api/config", (c) => handleConfigPost(c, opts));
|
|
618
|
+
app.post("/api/config/apply-observer", (c) => {
|
|
619
|
+
if (opts.scheduleObserverApply?.() !== true) return c.json({ error: "Observer settings could not be applied. Restart the viewer." }, 409);
|
|
620
|
+
return c.json({ observer_apply: opts.getObserverApplyStatus?.() ?? { state: "applying" } });
|
|
621
|
+
});
|
|
578
622
|
return app;
|
|
579
623
|
}
|
|
580
624
|
//#endregion
|
|
@@ -12504,10 +12548,17 @@ function registerStaticRoutes(app) {
|
|
|
12504
12548
|
return c.html(indexHtml);
|
|
12505
12549
|
});
|
|
12506
12550
|
}
|
|
12551
|
+
function registerConfigRoutes(app, opts, sweeper) {
|
|
12552
|
+
app.route("/", configRoutes({
|
|
12553
|
+
getSweeper: () => sweeper,
|
|
12554
|
+
scheduleObserverApply: opts?.scheduleObserverApply,
|
|
12555
|
+
getObserverApplyStatus: opts?.getObserverApplyStatus
|
|
12556
|
+
}));
|
|
12557
|
+
}
|
|
12507
12558
|
function createApp(opts) {
|
|
12508
12559
|
const storeFactory = opts?.storeFactory ?? getStore;
|
|
12509
12560
|
const sweeper = opts?.sweeper ?? null;
|
|
12510
|
-
const
|
|
12561
|
+
const getObserver = opts?.getObserver ?? (() => opts?.observer ?? null);
|
|
12511
12562
|
const getSyncRuntimeStatus = opts?.getSyncRuntimeStatus ?? (() => null);
|
|
12512
12563
|
let invalidateTeamSetupSummary = () => {};
|
|
12513
12564
|
const app = new Hono();
|
|
@@ -12525,9 +12576,9 @@ function createApp(opts) {
|
|
|
12525
12576
|
app.route("/", observerStatusRoutes({
|
|
12526
12577
|
getStore: storeFactory,
|
|
12527
12578
|
getSweeper: () => sweeper,
|
|
12528
|
-
getObserver
|
|
12579
|
+
getObserver
|
|
12529
12580
|
}));
|
|
12530
|
-
app
|
|
12581
|
+
registerConfigRoutes(app, opts, sweeper);
|
|
12531
12582
|
app.route("/", rawEventsRoutes(storeFactory, sweeper, opts?.rawEventInbox, opts?.rawEventTarget));
|
|
12532
12583
|
app.route("/", syncRoutes(storeFactory, getSyncRuntimeStatus, {
|
|
12533
12584
|
loadDeviceIdentityCoordinatorEvidence: opts?.loadDeviceIdentityCoordinatorEvidence,
|