zam-core 0.5.2 → 0.6.0

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 CHANGED
@@ -900,6 +900,102 @@ declare function findTokens(db: Database, query: string): Promise<ScoredToken[]>
900
900
  * Results are ordered by bloom_level then slug.
901
901
  */
902
902
  declare function listTokens(db: Database, options?: ListTokensOptions): Promise<Token[]>;
903
+ interface PersonalCard {
904
+ tokenId: string;
905
+ slug: string;
906
+ concept: string;
907
+ domain: string;
908
+ bloomLevel: BloomLevel$1;
909
+ context: string;
910
+ symbiosisMode: SymbiosisMode | null;
911
+ sourceLink: string | null;
912
+ question: string | null;
913
+ createdAt: string;
914
+ updatedAt: string;
915
+ cardId: string | null;
916
+ state: CardState$1 | null;
917
+ dueAt: string | null;
918
+ stability: number | null;
919
+ difficulty: number | null;
920
+ reps: number | null;
921
+ lapses: number | null;
922
+ elapsedDays: number | null;
923
+ scheduledDays: number | null;
924
+ blocked: number | null;
925
+ }
926
+ declare function slugify(text: string): string;
927
+ declare function generateTokenSlug(db: Database, domain: string, concept: string, question?: string | null): Promise<string>;
928
+ declare function listPersonalCards(db: Database, userId: string, options?: {
929
+ query?: string;
930
+ domain?: string;
931
+ }): Promise<PersonalCard[]>;
932
+ interface CurriculumCardInput {
933
+ question: string;
934
+ concept: string;
935
+ domain: string;
936
+ source_link?: string | null;
937
+ context?: string;
938
+ bloom_level?: number;
939
+ symbiosis_mode?: string | null;
940
+ }
941
+ interface ImportCurriculumResult {
942
+ createdCount: number;
943
+ ensuredCount: number;
944
+ }
945
+ /**
946
+ * Import curriculum cards in a single transaction.
947
+ * Reuses existing tokens on slug match and ensures FSRS cards exist.
948
+ */
949
+ declare function importCurriculumCards(db: Database, userId: string, cards: CurriculumCardInput[]): Promise<ImportCurriculumResult>;
950
+ interface SplitProposalInput {
951
+ question: string;
952
+ concept: string;
953
+ domain: string;
954
+ context?: string;
955
+ bloom_level?: number;
956
+ symbiosis_mode?: string | null;
957
+ source_link?: string | null;
958
+ }
959
+ /**
960
+ * Confirm a card split transaction.
961
+ * Creates proposal cards, links them as prerequisites to the original card,
962
+ * and either blocks the original card (surfacing proposals) or deletes it.
963
+ */
964
+ declare function confirmCardSplit(db: Database, userId: string, originalSlug: string, action: "block" | "remove", originalQuestion: string, originalConcept: string, proposals: SplitProposalInput[]): Promise<ImportCurriculumResult>;
965
+ interface FoundationProposalInput {
966
+ question: string;
967
+ concept: string;
968
+ domain: string;
969
+ context?: string;
970
+ bloom_level?: number;
971
+ symbiosis_mode?: string | null;
972
+ source_link?: string | null;
973
+ exists: boolean;
974
+ slug?: string | null;
975
+ }
976
+ interface ConfirmFoundationsResult {
977
+ createdCount: number;
978
+ linkedCount: number;
979
+ }
980
+ /**
981
+ * Confirm foundations import.
982
+ * Reuses existing tokens or creates new ones, then links them as prerequisites to the original card.
983
+ */
984
+ declare function confirmFoundations(db: Database, userId: string, originalSlug: string, proposals: FoundationProposalInput[]): Promise<ConfirmFoundationsResult>;
985
+ interface SourceProposalInput {
986
+ question: string;
987
+ concept: string;
988
+ domain: string;
989
+ bloom_level: number;
990
+ symbiosis_mode: string;
991
+ excerpt: string;
992
+ page_number?: string | null;
993
+ }
994
+ /**
995
+ * Confirm source import transaction.
996
+ * Saves tokens, maps them to the source in token_sources, and ensures cards exist for the user.
997
+ */
998
+ declare function confirmSourceImport(db: Database, userId: string, sourceId: string, proposals: SourceProposalInput[]): Promise<ConfirmFoundationsResult>;
903
999
 
904
1000
  /**
905
1001
  * Monitor log analyzer — maps observed shell commands to token ratings.
@@ -1789,9 +1885,8 @@ declare function planUpdate(decision: UpdateDecision): UpdateStep[];
1789
1885
  * and NOT the personal folder, so the mode never travels through a shared Turso
1790
1886
  * database or a synced folder, where it would be wrong for the other machine.
1791
1887
  *
1792
- * The personal-content folder itself is unchanged: it stays the existing
1793
- * `personal.workspace_dir` setting, and can already point at any local or
1794
- * file-synced directory (Drive, OneDrive, Dropbox, iCloud) — no GitHub required.
1888
+ * Workspace selection is machine-local too: `activeWorkspaceId` points at one
1889
+ * entry in `workspaces`, while legacy database settings are migrated by the CLI.
1795
1890
  */
1796
1891
 
1797
1892
  type InstallMode = "developer" | "default";
@@ -1803,6 +1898,8 @@ interface InstallConfig {
1803
1898
  ai?: MachineAiConfig;
1804
1899
  /** Machine-local paths to existing personal/team/community workspaces. */
1805
1900
  workspaces?: WorkspaceConfig[];
1901
+ /** Machine-local id of the workspace currently active in this install. */
1902
+ activeWorkspaceId?: string;
1806
1903
  }
1807
1904
  type MachineAiRole = "vision" | "recall" | "text";
1808
1905
  type MachineApiFlavor = "chat-completions" | "anthropic-messages";
@@ -1856,6 +1953,9 @@ declare function getMachineAiConfig(path?: string): MachineAiConfig;
1856
1953
  declare function saveMachineAiConfig(ai: MachineAiConfig, path?: string): void;
1857
1954
  declare function getConfiguredWorkspaces(path?: string): WorkspaceConfig[];
1858
1955
  declare function saveConfiguredWorkspaces(workspaces: WorkspaceConfig[], path?: string): void;
1956
+ declare function getActiveWorkspaceId(path?: string): string | undefined;
1957
+ declare function setActiveWorkspaceId(id: string | undefined, path?: string): void;
1958
+ declare function getActiveWorkspace(path?: string): WorkspaceConfig | undefined;
1859
1959
  declare function upsertConfiguredWorkspace(workspace: WorkspaceConfig, path?: string): WorkspaceConfig[];
1860
1960
  declare function removeConfiguredWorkspace(id: string, path?: string): WorkspaceConfig[];
1861
1961
  /**
@@ -1934,7 +2034,8 @@ interface RepoPaths {
1934
2034
  }
1935
2035
  /**
1936
2036
  * Resolve absolute paths for personal, team, and organization repositories.
1937
- * Personal falls back to personal.workspace_dir if repo.personal is not set.
2037
+ * Personal falls back to the active machine-local workspace if repo.personal is
2038
+ * not set.
1938
2039
  */
1939
2040
  declare function getRepoPaths(db: Database): Promise<RepoPaths>;
1940
2041
  /**
@@ -1952,4 +2053,4 @@ declare function resolveAllBeliefPaths(db: Database): Promise<string[]>;
1952
2053
  */
1953
2054
  declare function resolveAllGoalPaths(db: Database): Promise<string[]>;
1954
2055
 
1955
- export { type ADOConfig, type ADOCredentials, type AgentSkill, type AnalysisResult, type ApplySessionSynthesisInput, type ApplySessionSynthesisResult, BUILT_IN_SENSITIVE_MATCHERS, type BloomLevel$1 as BloomLevel, type CaptureDecision, type CaptureDenialReason, type CaptureRequest, type Card, type CardDeletionImpact, type CardState$1 as CardState, type CascadeBlockResult, type CommandRecord, type CommandSequence, type ConnectionOptions, type CreateAgentSkillInput, type CreateGoalInput, type CreateReviewInput, type CreateSessionInput, type CreateTokenInput, type Credentials, DEFAULT_OBSERVER_POLICY, DEFAULT_REVIEW_CONTEXT_MAX_CHARS, type Database, type DatabaseProvider, type DatabaseTargetInfo, type DatabaseValue, type DeleteCardResult, type DeleteTokenResult, type DiscoveryOptions, type DomainCompetence, type EvaluateInput, type EvaluateResult, type ExecuteReviewActionInput, type ExecutionContext, type FSRSParameters, type Goal, type GoalFrontmatter, type GoalStatus, type GoalSummary, HOMEBREW_CASK, type ImportResult, type InstallChannel, type InstallConfig, type InstallMode, type InstallPlan, type InstallResult, type LocalLLMRunner, type LogStepInput, type MachineAiConfig, type MachineProviderRecord, type MachineRoleBinding, type MonitorEvent, type Neighborhood, type NeighborhoodToken, OBSERVER_POLICY_UNSET_HINT, OBSERVER_POLICY_VERSION, type ObservationRating, type ObserverConsent, type ObserverPolicy, type ObserverRetention, type ObserverScope, type ObserverSettingKey, type PrepareSessionSynthesisInput, type Prerequisite, type PrerequisiteWithToken, type PromptInput, REVIEW_CONTEXT_CACHE_TTL_MS, type Rating, type RecallPrompt, type RemoteDatabaseOptions, type RepoPaths, type ResolvedCaptureTarget, type ResolvedReference, type ReviewActionResult, type ReviewActionType, type ReviewContext, type ReviewLog, type ReviewQueue, type ReviewQueueItem, type ReviewQueueOptions, type RunResult, SIDECAR_POLICY_FILE, SNAPSHOT_VERSION, type SchedulingCard, type Session, type SessionStep, type SessionSummary, type SessionSynthesisCandidate, type SessionSynthesisEvidence, type SessionSynthesisPreview, type SessionSynthesisRecord, type SidecarPrivacyPolicy, type SkillProposal, type SkillSource, type SnapshotManifest, type Statement, type SupportedLocale, type SymbiosisMode, type SynthesisConfidence, type SystemProfile, type Token, type TokenDeleteImpact, type TokenPattern, type TranslationKey, type TursoCredentials, UI_OBSERVATION_PROTOCOL_VERSION, type UiActionType, type UiApplicationContext, type UiCandidateToken, type UiEvidenceRef, type UiEvidenceType, type UiObservationKind, type UiObservationReport, type UiObservedAction, type UnblockResult, type UpdateActionKind, type UpdateCardInput, type UpdateDecision, type UpdateStep, type UpdateStepKind, type UpdateTokenInput, type UserSetting, type UserStats, WINGET_PACKAGE_ID, type WorkItem, type WorkspaceConfig, type WorkspaceKind, type WorkspaceSourceControl, addPrerequisite, analyzeObservation, appendUiObservationReport, applySessionSynthesis, buildReviewQueue, buildUiSynthesisCandidates, cascadeBlock, clearADOCredentials, clearProviderApiKey, clearReviewContextCache, clearTursoCredentials, compareVersions, createAgentSkill, createFSRS, createGoal, createToken, decidePostCapture, decidePreCapture, decideUpdate, deleteCardForUser, deleteSetting, deleteToken, deprecateToken, detectSyncProvider, detectSystemLocale, discoverSkills, distributeGlobalSkills, endSession, ensureCard, ensureMonitorDir, ensureUiObserverDir, evaluateRating, executeReviewAction, exportSnapshot, extractTasks, extractTokenRefs, fetchActiveWorkItems, findTokens, generateBashHooks, generateBashUnhooks, generateConceptFreeCue, generatePowerShellHooks, generatePowerShellUnhooks, generatePrompt, generateZshHooks, generateZshUnhooks, getADOCredentials, getAgentSkill, getAllSettings, getAllSettingsDetailed, getBlockedCards, getCard, getCardById, getCardDeletionImpact, getConfiguredWorkspaces, getDatabaseTargetInfo, getDefaultDbPath, getDependents, getDomainCompetence, getDueCards, getGoal, getGoalTree, getInstallChannel, getInstallMode, getMachineAiConfig, getMonitorDir, getMonitorLogStats, getMonitorPath, getPackageSkillPath, getPrerequisites, getProviderApiKey, getRepoPaths, getReviewsForCard, getReviewsForUser, getSessionSummary, getSessionSynthesisRecords, getSetting, getSystemProfile, getTokenById, getTokenBySlug, getTokenDeleteImpact, getTokenNeighborhood, getTursoCredentials, getUiObservationPath, getUiObserverDir, getUserStats, hasCommand, importSnapshot, injectShellHooks, installFastFlowLM, installOllama, installOpenCode, interleave, isObserverPolicyConfigured, isUiObservationReport, listAgentSkills, listGoals, listProviderApiKeyRefs, listTokens, loadADOConfig, loadCredentials, loadInstallConfig, logReview, logStep, matchBuiltInSensitive, matchDenylist, matchesFilePath, monitorLogExists, normalizeLocale, normalizePath, openDatabase, openDatabaseWithSync, openRemoteDatabase, pairCommands, parseGoalFile, parseMonitorLog, parseObserverList, parseObserverPolicy, parseSnapshot, parseUiObservationLog, planOpenCodeInstall, planUpdate, prepareLocalModel, prepareSessionSynthesis, readMonitorLog, readUiObservationLog, removeConfiguredWorkspace, resolveAllBeliefPaths, resolveAllGoalPaths, resolveObserverPolicy, resolveReference, resolveRepoPath, resolveReviewContext, saveConfiguredWorkspaces, saveCredentials, saveInstallConfig, saveMachineAiConfig, serializeGoal, setADOCredentials, setInstallChannel, setInstallMode, setProviderApiKey, setSetting, setTursoCredentials, startSession, syncObserverSidecarPolicy, t, toSidecarPrivacyPolicy, uiObservationLogExists, uiObservationTimeSpan, unblockReady, updateCard, updateGoalStatus, updateToken, upsertConfiguredWorkspace, verifySnapshot, wouldCreateCycle, writeMonitorEvent };
2056
+ export { type ADOConfig, type ADOCredentials, type AgentSkill, type AnalysisResult, type ApplySessionSynthesisInput, type ApplySessionSynthesisResult, BUILT_IN_SENSITIVE_MATCHERS, type BloomLevel$1 as BloomLevel, type CaptureDecision, type CaptureDenialReason, type CaptureRequest, type Card, type CardDeletionImpact, type CardState$1 as CardState, type CascadeBlockResult, type CommandRecord, type CommandSequence, type ConfirmFoundationsResult, type ConnectionOptions, type CreateAgentSkillInput, type CreateGoalInput, type CreateReviewInput, type CreateSessionInput, type CreateTokenInput, type Credentials, type CurriculumCardInput, DEFAULT_OBSERVER_POLICY, DEFAULT_REVIEW_CONTEXT_MAX_CHARS, type Database, type DatabaseProvider, type DatabaseTargetInfo, type DatabaseValue, type DeleteCardResult, type DeleteTokenResult, type DiscoveryOptions, type DomainCompetence, type EvaluateInput, type EvaluateResult, type ExecuteReviewActionInput, type ExecutionContext, type FSRSParameters, type FoundationProposalInput, type Goal, type GoalFrontmatter, type GoalStatus, type GoalSummary, HOMEBREW_CASK, type ImportCurriculumResult, type ImportResult, type InstallChannel, type InstallConfig, type InstallMode, type InstallPlan, type InstallResult, type LocalLLMRunner, type LogStepInput, type MachineAiConfig, type MachineProviderRecord, type MachineRoleBinding, type MonitorEvent, type Neighborhood, type NeighborhoodToken, OBSERVER_POLICY_UNSET_HINT, OBSERVER_POLICY_VERSION, type ObservationRating, type ObserverConsent, type ObserverPolicy, type ObserverRetention, type ObserverScope, type ObserverSettingKey, type PersonalCard, type PrepareSessionSynthesisInput, type Prerequisite, type PrerequisiteWithToken, type PromptInput, REVIEW_CONTEXT_CACHE_TTL_MS, type Rating, type RecallPrompt, type RemoteDatabaseOptions, type RepoPaths, type ResolvedCaptureTarget, type ResolvedReference, type ReviewActionResult, type ReviewActionType, type ReviewContext, type ReviewLog, type ReviewQueue, type ReviewQueueItem, type ReviewQueueOptions, type RunResult, SIDECAR_POLICY_FILE, SNAPSHOT_VERSION, type SchedulingCard, type Session, type SessionStep, type SessionSummary, type SessionSynthesisCandidate, type SessionSynthesisEvidence, type SessionSynthesisPreview, type SessionSynthesisRecord, type SidecarPrivacyPolicy, type SkillProposal, type SkillSource, type SnapshotManifest, type SourceProposalInput, type SplitProposalInput, type Statement, type SupportedLocale, type SymbiosisMode, type SynthesisConfidence, type SystemProfile, type Token, type TokenDeleteImpact, type TokenPattern, type TranslationKey, type TursoCredentials, UI_OBSERVATION_PROTOCOL_VERSION, type UiActionType, type UiApplicationContext, type UiCandidateToken, type UiEvidenceRef, type UiEvidenceType, type UiObservationKind, type UiObservationReport, type UiObservedAction, type UnblockResult, type UpdateActionKind, type UpdateCardInput, type UpdateDecision, type UpdateStep, type UpdateStepKind, type UpdateTokenInput, type UserSetting, type UserStats, WINGET_PACKAGE_ID, type WorkItem, type WorkspaceConfig, type WorkspaceKind, type WorkspaceSourceControl, addPrerequisite, analyzeObservation, appendUiObservationReport, applySessionSynthesis, buildReviewQueue, buildUiSynthesisCandidates, cascadeBlock, clearADOCredentials, clearProviderApiKey, clearReviewContextCache, clearTursoCredentials, compareVersions, confirmCardSplit, confirmFoundations, confirmSourceImport, createAgentSkill, createFSRS, createGoal, createToken, decidePostCapture, decidePreCapture, decideUpdate, deleteCardForUser, deleteSetting, deleteToken, deprecateToken, detectSyncProvider, detectSystemLocale, discoverSkills, distributeGlobalSkills, endSession, ensureCard, ensureMonitorDir, ensureUiObserverDir, evaluateRating, executeReviewAction, exportSnapshot, extractTasks, extractTokenRefs, fetchActiveWorkItems, findTokens, generateBashHooks, generateBashUnhooks, generateConceptFreeCue, generatePowerShellHooks, generatePowerShellUnhooks, generatePrompt, generateTokenSlug, generateZshHooks, generateZshUnhooks, getADOCredentials, getActiveWorkspace, getActiveWorkspaceId, getAgentSkill, getAllSettings, getAllSettingsDetailed, getBlockedCards, getCard, getCardById, getCardDeletionImpact, getConfiguredWorkspaces, getDatabaseTargetInfo, getDefaultDbPath, getDependents, getDomainCompetence, getDueCards, getGoal, getGoalTree, getInstallChannel, getInstallMode, getMachineAiConfig, getMonitorDir, getMonitorLogStats, getMonitorPath, getPackageSkillPath, getPrerequisites, getProviderApiKey, getRepoPaths, getReviewsForCard, getReviewsForUser, getSessionSummary, getSessionSynthesisRecords, getSetting, getSystemProfile, getTokenById, getTokenBySlug, getTokenDeleteImpact, getTokenNeighborhood, getTursoCredentials, getUiObservationPath, getUiObserverDir, getUserStats, hasCommand, importCurriculumCards, importSnapshot, injectShellHooks, installFastFlowLM, installOllama, installOpenCode, interleave, isObserverPolicyConfigured, isUiObservationReport, listAgentSkills, listGoals, listPersonalCards, listProviderApiKeyRefs, listTokens, loadADOConfig, loadCredentials, loadInstallConfig, logReview, logStep, matchBuiltInSensitive, matchDenylist, matchesFilePath, monitorLogExists, normalizeLocale, normalizePath, openDatabase, openDatabaseWithSync, openRemoteDatabase, pairCommands, parseGoalFile, parseMonitorLog, parseObserverList, parseObserverPolicy, parseSnapshot, parseUiObservationLog, planOpenCodeInstall, planUpdate, prepareLocalModel, prepareSessionSynthesis, readMonitorLog, readUiObservationLog, removeConfiguredWorkspace, resolveAllBeliefPaths, resolveAllGoalPaths, resolveObserverPolicy, resolveReference, resolveRepoPath, resolveReviewContext, saveConfiguredWorkspaces, saveCredentials, saveInstallConfig, saveMachineAiConfig, serializeGoal, setADOCredentials, setActiveWorkspaceId, setInstallChannel, setInstallMode, setProviderApiKey, setSetting, setTursoCredentials, slugify, startSession, syncObserverSidecarPolicy, t, toSidecarPrivacyPolicy, uiObservationLogExists, uiObservationTimeSpan, unblockReady, updateCard, updateGoalStatus, updateToken, upsertConfiguredWorkspace, verifySnapshot, wouldCreateCycle, writeMonitorEvent };