zam-core 0.9.3 → 0.9.4
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/cli/app.js +60 -14
- package/dist/cli/app.js.map +1 -1
- package/dist/cli/commands/mcp.js +59 -13
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +44 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -864,6 +864,11 @@ declare function deleteSetting(db: Database, key: string): Promise<boolean>;
|
|
|
864
864
|
|
|
865
865
|
type BloomLevel$1 = 1 | 2 | 3 | 4 | 5;
|
|
866
866
|
type SymbiosisMode = "shadowing" | "copilot" | "autonomy";
|
|
867
|
+
/**
|
|
868
|
+
* Who authored a token's current recall question. LLM healing only
|
|
869
|
+
* overwrites questions whose source is not 'manual'.
|
|
870
|
+
*/
|
|
871
|
+
type QuestionSource = "manual" | "llm" | "template";
|
|
867
872
|
interface Token {
|
|
868
873
|
id: string;
|
|
869
874
|
slug: string;
|
|
@@ -875,6 +880,7 @@ interface Token {
|
|
|
875
880
|
symbiosis_mode: SymbiosisMode | null;
|
|
876
881
|
source_link: string | null;
|
|
877
882
|
question: string | null;
|
|
883
|
+
question_source: QuestionSource;
|
|
878
884
|
created_at: string;
|
|
879
885
|
updated_at: string;
|
|
880
886
|
deprecated_at: string | null;
|
|
@@ -891,6 +897,7 @@ interface CreateTokenInput {
|
|
|
891
897
|
symbiosis_mode?: SymbiosisMode | null;
|
|
892
898
|
source_link?: string | null;
|
|
893
899
|
question?: string | null;
|
|
900
|
+
question_source?: QuestionSource;
|
|
894
901
|
provider?: string | null;
|
|
895
902
|
topic_id?: string | null;
|
|
896
903
|
}
|
|
@@ -903,6 +910,7 @@ interface UpdateTokenInput {
|
|
|
903
910
|
symbiosis_mode?: SymbiosisMode | null;
|
|
904
911
|
source_link?: string | null;
|
|
905
912
|
question?: string | null;
|
|
913
|
+
question_source?: QuestionSource;
|
|
906
914
|
provider?: string | null;
|
|
907
915
|
topic_id?: string | null;
|
|
908
916
|
}
|
|
@@ -1963,6 +1971,7 @@ interface ReviewQueueItem {
|
|
|
1963
1971
|
dueAt: string;
|
|
1964
1972
|
sourceLink: string | null;
|
|
1965
1973
|
question: string | null;
|
|
1974
|
+
questionSource: string;
|
|
1966
1975
|
}
|
|
1967
1976
|
interface ReviewQueue {
|
|
1968
1977
|
items: ReviewQueueItem[];
|
|
@@ -2337,4 +2346,4 @@ declare function resolveAllBeliefPaths(db: Database): Promise<string[]>;
|
|
|
2337
2346
|
*/
|
|
2338
2347
|
declare function resolveAllGoalPaths(db: Database): Promise<string[]>;
|
|
2339
2348
|
|
|
2340
|
-
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 CreateKnowledgeContextInput, 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 EmbeddedTokenRow, type EmbeddingCoverage, type EmbeddingStaleness, type EvaluateInput, type EvaluateResult, type ExecuteReviewActionInput, type ExecutionContext, type FSRSParameters, type FoundationProposalInput, type FoundationSuggestion, type Goal, type GoalFrontmatter, type GoalStatus, type GoalSummary, HOMEBREW_CASK, type HybridScoredToken, type HybridSearchOptions, type ImportCurriculumResult, type ImportResult, type InstallChannel, type InstallConfig, type InstallMode, type InstallPlan, type InstallResult, type KnowledgeContext, type ListTokensOptions, 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 OllamaDetectionOptions, 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 SuggestFoundationsOptions, type SupportedLocale, type SymbiosisMode, type SynthesisConfidence, type SystemProfile, type Token, type TokenDeleteImpact, type TokenEmbedding, type TokenNeedingEmbedding, 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 UpdateKnowledgeContextInput, 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, assignTokenToContext, buildAncestorMap, buildReviewQueue, buildUiSynthesisCandidates, cascadeBlock, clearADOCredentials, clearProviderApiKey, clearReviewContextCache, clearTursoCredentials, compareVersions, computeContentHash, confirmCardSplit, confirmFoundations, confirmSourceImport, cosineSimilarity, createAgentSkill, createFSRS, createGoal, createKnowledgeContext, createToken, decidePostCapture, decidePreCapture, decideUpdate, decodeEmbedding, deleteCardForUser, deleteKnowledgeContext, deleteSetting, deleteToken, deprecateToken, detectSyncProvider, detectSystemLocale, discoverSkills, distributeGlobalSkills, embeddingContentForToken, encodeEmbedding, endSession, ensureCard, ensureMonitorDir, ensureUiObserverDir, evaluateRating, executeReviewAction, exportSnapshot, extractTasks, extractTokenRefs, fetchActiveWorkItems, findTokens, generateBashHooks, generateBashUnhooks, generateConceptFreeCue, generatePowerShellHooks, generatePowerShellUnhooks, generatePrompt, generateTokenSlug, generateZshHooks, generateZshUnhooks, getADOCredentials, getActiveWorkspace, getActiveWorkspaceContext, getActiveWorkspaceId, getAgentSkill, getAllSettings, getAllSettingsDetailed, getBlockedCards, getCard, getCardById, getCardDeletionImpact, getConfiguredWorkspaces, getDatabaseTargetInfo, getDefaultDbPath, getDependents, getDisplayTitle, getDomainCompetence, getDueCards, getEmbeddingCoverage, getGoal, getGoalTree, getInstallChannel, getInstallMode, getKnowledgeContextById, getKnowledgeContextByName, getMachineAiConfig, getMonitorDir, getMonitorLogStats, getMonitorPath, getPackageSkillPath, getPrerequisites, getProviderApiKey, getRepoPaths, getReviewsForCard, getReviewsForUser, getSessionSummary, getSessionSynthesisRecords, getSetting, getShortSlug, getSystemProfile, getTokenById, getTokenBySlug, getTokenDeleteImpact, getTokenEmbedding, getTokenNeighborhood, getTursoCredentials, getUiObservationPath, getUiObserverDir, getUserStats, hasCommand, importCurriculumCards, importSnapshot, injectShellHooks, installFastFlowLM, installOllama, installOpenCode, interleave, isObserverPolicyConfigured, isOllamaInstalled, isUiObservationReport, listAgentSkills, listContextsForToken, listEmbeddedTokens, listGoals, listKnowledgeContexts, listPersonalCards, listProviderApiKeyRefs, listTokens, listTokensNeedingEmbedding, 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, resolveOllamaCommand, resolveReference, resolveRepoPath, resolveReviewContext, saveConfiguredWorkspaces, saveCredentials, saveInstallConfig, saveMachineAiConfig, searchTokensHybrid, serializeGoal, setADOCredentials, setActiveWorkspaceContext, setActiveWorkspaceId, setInstallChannel, setInstallMode, setProviderApiKey, setSetting, setTursoCredentials, slugify, startSession, suggestFoundations, syncObserverSidecarPolicy, t, toSidecarPrivacyPolicy, uiObservationLogExists, uiObservationTimeSpan, unassignTokenFromContext, unblockReady, updateCard, updateGoalStatus, updateKnowledgeContext, updateToken, upsertConfiguredWorkspace, upsertTokenEmbedding, verifySnapshot, wouldCreateCycle, writeMonitorEvent };
|
|
2349
|
+
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 CreateKnowledgeContextInput, 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 EmbeddedTokenRow, type EmbeddingCoverage, type EmbeddingStaleness, type EvaluateInput, type EvaluateResult, type ExecuteReviewActionInput, type ExecutionContext, type FSRSParameters, type FoundationProposalInput, type FoundationSuggestion, type Goal, type GoalFrontmatter, type GoalStatus, type GoalSummary, HOMEBREW_CASK, type HybridScoredToken, type HybridSearchOptions, type ImportCurriculumResult, type ImportResult, type InstallChannel, type InstallConfig, type InstallMode, type InstallPlan, type InstallResult, type KnowledgeContext, type ListTokensOptions, 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 OllamaDetectionOptions, type PersonalCard, type PrepareSessionSynthesisInput, type Prerequisite, type PrerequisiteWithToken, type PromptInput, type QuestionSource, 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 SuggestFoundationsOptions, type SupportedLocale, type SymbiosisMode, type SynthesisConfidence, type SystemProfile, type Token, type TokenDeleteImpact, type TokenEmbedding, type TokenNeedingEmbedding, 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 UpdateKnowledgeContextInput, 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, assignTokenToContext, buildAncestorMap, buildReviewQueue, buildUiSynthesisCandidates, cascadeBlock, clearADOCredentials, clearProviderApiKey, clearReviewContextCache, clearTursoCredentials, compareVersions, computeContentHash, confirmCardSplit, confirmFoundations, confirmSourceImport, cosineSimilarity, createAgentSkill, createFSRS, createGoal, createKnowledgeContext, createToken, decidePostCapture, decidePreCapture, decideUpdate, decodeEmbedding, deleteCardForUser, deleteKnowledgeContext, deleteSetting, deleteToken, deprecateToken, detectSyncProvider, detectSystemLocale, discoverSkills, distributeGlobalSkills, embeddingContentForToken, encodeEmbedding, endSession, ensureCard, ensureMonitorDir, ensureUiObserverDir, evaluateRating, executeReviewAction, exportSnapshot, extractTasks, extractTokenRefs, fetchActiveWorkItems, findTokens, generateBashHooks, generateBashUnhooks, generateConceptFreeCue, generatePowerShellHooks, generatePowerShellUnhooks, generatePrompt, generateTokenSlug, generateZshHooks, generateZshUnhooks, getADOCredentials, getActiveWorkspace, getActiveWorkspaceContext, getActiveWorkspaceId, getAgentSkill, getAllSettings, getAllSettingsDetailed, getBlockedCards, getCard, getCardById, getCardDeletionImpact, getConfiguredWorkspaces, getDatabaseTargetInfo, getDefaultDbPath, getDependents, getDisplayTitle, getDomainCompetence, getDueCards, getEmbeddingCoverage, getGoal, getGoalTree, getInstallChannel, getInstallMode, getKnowledgeContextById, getKnowledgeContextByName, getMachineAiConfig, getMonitorDir, getMonitorLogStats, getMonitorPath, getPackageSkillPath, getPrerequisites, getProviderApiKey, getRepoPaths, getReviewsForCard, getReviewsForUser, getSessionSummary, getSessionSynthesisRecords, getSetting, getShortSlug, getSystemProfile, getTokenById, getTokenBySlug, getTokenDeleteImpact, getTokenEmbedding, getTokenNeighborhood, getTursoCredentials, getUiObservationPath, getUiObserverDir, getUserStats, hasCommand, importCurriculumCards, importSnapshot, injectShellHooks, installFastFlowLM, installOllama, installOpenCode, interleave, isObserverPolicyConfigured, isOllamaInstalled, isUiObservationReport, listAgentSkills, listContextsForToken, listEmbeddedTokens, listGoals, listKnowledgeContexts, listPersonalCards, listProviderApiKeyRefs, listTokens, listTokensNeedingEmbedding, 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, resolveOllamaCommand, resolveReference, resolveRepoPath, resolveReviewContext, saveConfiguredWorkspaces, saveCredentials, saveInstallConfig, saveMachineAiConfig, searchTokensHybrid, serializeGoal, setADOCredentials, setActiveWorkspaceContext, setActiveWorkspaceId, setInstallChannel, setInstallMode, setProviderApiKey, setSetting, setTursoCredentials, slugify, startSession, suggestFoundations, syncObserverSidecarPolicy, t, toSidecarPrivacyPolicy, uiObservationLogExists, uiObservationTimeSpan, unassignTokenFromContext, unblockReady, updateCard, updateGoalStatus, updateKnowledgeContext, updateToken, upsertConfiguredWorkspace, upsertTokenEmbedding, verifySnapshot, wouldCreateCycle, writeMonitorEvent };
|
package/dist/index.js
CHANGED
|
@@ -542,7 +542,12 @@ CREATE TABLE IF NOT EXISTS tokens (
|
|
|
542
542
|
deprecated_at TEXT,
|
|
543
543
|
question TEXT,
|
|
544
544
|
provider TEXT,
|
|
545
|
-
topic_id TEXT
|
|
545
|
+
topic_id TEXT,
|
|
546
|
+
-- Who authored the current question ('manual' | 'llm' | 'template');
|
|
547
|
+
-- validated in code, not via CHECK. Column default is 'llm' so unlabeled
|
|
548
|
+
-- writes (pre-M013 rows, old snapshot restores) count as LLM-era content;
|
|
549
|
+
-- createToken() defaults to 'manual' for API callers instead.
|
|
550
|
+
question_source TEXT NOT NULL DEFAULT 'llm'
|
|
546
551
|
);
|
|
547
552
|
|
|
548
553
|
-- Prerequisite dependency graph: "to learn A, first know B"
|
|
@@ -1058,6 +1063,11 @@ async function runMigrations(db) {
|
|
|
1058
1063
|
await db.exec(`
|
|
1059
1064
|
CREATE INDEX IF NOT EXISTS idx_token_contexts_context ON token_contexts(context_id)
|
|
1060
1065
|
`);
|
|
1066
|
+
if (tokenCols.length > 0 && !tokenCols.some((c) => c.name === "question_source")) {
|
|
1067
|
+
await db.exec(
|
|
1068
|
+
`ALTER TABLE tokens ADD COLUMN question_source TEXT NOT NULL DEFAULT 'llm'`
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1061
1071
|
}
|
|
1062
1072
|
|
|
1063
1073
|
// src/kernel/db/snapshot.ts
|
|
@@ -1074,7 +1084,11 @@ var SNAPSHOT_TABLES = [
|
|
|
1074
1084
|
"review_logs",
|
|
1075
1085
|
"session_syntheses",
|
|
1076
1086
|
"user_config",
|
|
1077
|
-
"agent_skills"
|
|
1087
|
+
"agent_skills",
|
|
1088
|
+
"sources",
|
|
1089
|
+
"token_sources",
|
|
1090
|
+
"contexts",
|
|
1091
|
+
"token_contexts"
|
|
1078
1092
|
];
|
|
1079
1093
|
function quoteValue(value) {
|
|
1080
1094
|
if (value === null || value === void 0) return "NULL";
|
|
@@ -1660,6 +1674,14 @@ async function listContextsForToken(db, tokenId) {
|
|
|
1660
1674
|
|
|
1661
1675
|
// src/kernel/models/token.ts
|
|
1662
1676
|
import { ulid as ulid4 } from "ulid";
|
|
1677
|
+
var VALID_QUESTION_SOURCES = ["manual", "llm", "template"];
|
|
1678
|
+
function validateQuestionSource(value) {
|
|
1679
|
+
if (!VALID_QUESTION_SOURCES.includes(value)) {
|
|
1680
|
+
throw new Error(
|
|
1681
|
+
`Invalid question_source: ${value} (expected one of ${VALID_QUESTION_SOURCES.join(", ")})`
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1663
1685
|
async function createToken(db, input) {
|
|
1664
1686
|
const id = ulid4();
|
|
1665
1687
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -1668,9 +1690,11 @@ async function createToken(db, input) {
|
|
|
1668
1690
|
throw new Error(`bloom_level must be between 1 and 5, got ${bloom}`);
|
|
1669
1691
|
}
|
|
1670
1692
|
const title = input.title ?? "";
|
|
1693
|
+
const questionSource = input.question_source ?? "manual";
|
|
1694
|
+
validateQuestionSource(questionSource);
|
|
1671
1695
|
await db.prepare(`
|
|
1672
|
-
INSERT INTO tokens (id, slug, title, concept, domain, bloom_level, context, symbiosis_mode, source_link, question, provider, topic_id, created_at, updated_at)
|
|
1673
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
1696
|
+
INSERT INTO tokens (id, slug, title, concept, domain, bloom_level, context, symbiosis_mode, source_link, question, question_source, provider, topic_id, created_at, updated_at)
|
|
1697
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
1674
1698
|
`).run(
|
|
1675
1699
|
id,
|
|
1676
1700
|
input.slug,
|
|
@@ -1682,6 +1706,7 @@ async function createToken(db, input) {
|
|
|
1682
1706
|
input.symbiosis_mode ?? null,
|
|
1683
1707
|
input.source_link ?? null,
|
|
1684
1708
|
input.question ?? null,
|
|
1709
|
+
questionSource,
|
|
1685
1710
|
input.provider ?? null,
|
|
1686
1711
|
input.topic_id ?? null,
|
|
1687
1712
|
now,
|
|
@@ -1770,6 +1795,12 @@ async function updateToken(db, slug, updates) {
|
|
|
1770
1795
|
fields.push("question = ?");
|
|
1771
1796
|
values.push(updates.question);
|
|
1772
1797
|
}
|
|
1798
|
+
const questionSource = updates.question_source ?? (updates.question !== void 0 ? "manual" : void 0);
|
|
1799
|
+
if (questionSource !== void 0) {
|
|
1800
|
+
validateQuestionSource(questionSource);
|
|
1801
|
+
fields.push("question_source = ?");
|
|
1802
|
+
values.push(questionSource);
|
|
1803
|
+
}
|
|
1773
1804
|
if (updates.provider !== void 0) {
|
|
1774
1805
|
fields.push("provider = ?");
|
|
1775
1806
|
values.push(updates.provider);
|
|
@@ -2098,6 +2129,9 @@ async function importCurriculumCards(db, userId, cards) {
|
|
|
2098
2129
|
symbiosis_mode: symbiosisMode,
|
|
2099
2130
|
source_link: card.source_link || null,
|
|
2100
2131
|
question: card.question || null,
|
|
2132
|
+
// Curriculum cards are LLM-extracted; their questions are LLM
|
|
2133
|
+
// inventions, not human-authored content.
|
|
2134
|
+
question_source: "llm",
|
|
2101
2135
|
provider: card.provider || null,
|
|
2102
2136
|
topic_id: card.topic_id || null
|
|
2103
2137
|
});
|
|
@@ -4901,7 +4935,8 @@ async function buildReviewQueue(db, options) {
|
|
|
4901
4935
|
c.state AS state,
|
|
4902
4936
|
c.due_at AS due_at,
|
|
4903
4937
|
t.source_link AS source_link,
|
|
4904
|
-
t.question AS question
|
|
4938
|
+
t.question AS question,
|
|
4939
|
+
t.question_source AS question_source
|
|
4905
4940
|
FROM cards c
|
|
4906
4941
|
JOIN tokens t ON t.id = c.token_id
|
|
4907
4942
|
WHERE c.user_id = ?
|
|
@@ -4931,7 +4966,8 @@ async function buildReviewQueue(db, options) {
|
|
|
4931
4966
|
c.state AS state,
|
|
4932
4967
|
c.due_at AS due_at,
|
|
4933
4968
|
t.source_link AS source_link,
|
|
4934
|
-
t.question AS question
|
|
4969
|
+
t.question AS question,
|
|
4970
|
+
t.question_source AS question_source
|
|
4935
4971
|
FROM cards c
|
|
4936
4972
|
JOIN tokens t ON t.id = c.token_id
|
|
4937
4973
|
WHERE c.user_id = ?
|
|
@@ -5000,7 +5036,8 @@ function rowToItem(row) {
|
|
|
5000
5036
|
state: row.state,
|
|
5001
5037
|
dueAt: row.due_at,
|
|
5002
5038
|
sourceLink: row.source_link,
|
|
5003
|
-
question: row.question
|
|
5039
|
+
question: row.question,
|
|
5040
|
+
questionSource: row.question_source
|
|
5004
5041
|
};
|
|
5005
5042
|
}
|
|
5006
5043
|
function intersperseNew(reviews, newCards, interval) {
|