zam-core 0.5.2 → 0.5.3

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
@@ -1789,9 +1789,8 @@ declare function planUpdate(decision: UpdateDecision): UpdateStep[];
1789
1789
  * and NOT the personal folder, so the mode never travels through a shared Turso
1790
1790
  * database or a synced folder, where it would be wrong for the other machine.
1791
1791
  *
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.
1792
+ * Workspace selection is machine-local too: `activeWorkspaceId` points at one
1793
+ * entry in `workspaces`, while legacy database settings are migrated by the CLI.
1795
1794
  */
1796
1795
 
1797
1796
  type InstallMode = "developer" | "default";
@@ -1803,6 +1802,8 @@ interface InstallConfig {
1803
1802
  ai?: MachineAiConfig;
1804
1803
  /** Machine-local paths to existing personal/team/community workspaces. */
1805
1804
  workspaces?: WorkspaceConfig[];
1805
+ /** Machine-local id of the workspace currently active in this install. */
1806
+ activeWorkspaceId?: string;
1806
1807
  }
1807
1808
  type MachineAiRole = "vision" | "recall" | "text";
1808
1809
  type MachineApiFlavor = "chat-completions" | "anthropic-messages";
@@ -1856,6 +1857,9 @@ declare function getMachineAiConfig(path?: string): MachineAiConfig;
1856
1857
  declare function saveMachineAiConfig(ai: MachineAiConfig, path?: string): void;
1857
1858
  declare function getConfiguredWorkspaces(path?: string): WorkspaceConfig[];
1858
1859
  declare function saveConfiguredWorkspaces(workspaces: WorkspaceConfig[], path?: string): void;
1860
+ declare function getActiveWorkspaceId(path?: string): string | undefined;
1861
+ declare function setActiveWorkspaceId(id: string | undefined, path?: string): void;
1862
+ declare function getActiveWorkspace(path?: string): WorkspaceConfig | undefined;
1859
1863
  declare function upsertConfiguredWorkspace(workspace: WorkspaceConfig, path?: string): WorkspaceConfig[];
1860
1864
  declare function removeConfiguredWorkspace(id: string, path?: string): WorkspaceConfig[];
1861
1865
  /**
@@ -1934,7 +1938,8 @@ interface RepoPaths {
1934
1938
  }
1935
1939
  /**
1936
1940
  * Resolve absolute paths for personal, team, and organization repositories.
1937
- * Personal falls back to personal.workspace_dir if repo.personal is not set.
1941
+ * Personal falls back to the active machine-local workspace if repo.personal is
1942
+ * not set.
1938
1943
  */
1939
1944
  declare function getRepoPaths(db: Database): Promise<RepoPaths>;
1940
1945
  /**
@@ -1952,4 +1957,4 @@ declare function resolveAllBeliefPaths(db: Database): Promise<string[]>;
1952
1957
  */
1953
1958
  declare function resolveAllGoalPaths(db: Database): Promise<string[]>;
1954
1959
 
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 };
1960
+ 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, 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, 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, setActiveWorkspaceId, setInstallChannel, setInstallMode, setProviderApiKey, setSetting, setTursoCredentials, startSession, syncObserverSidecarPolicy, t, toSidecarPrivacyPolicy, uiObservationLogExists, uiObservationTimeSpan, unblockReady, updateCard, updateGoalStatus, updateToken, upsertConfiguredWorkspace, verifySnapshot, wouldCreateCycle, writeMonitorEvent };
package/dist/index.js CHANGED
@@ -4533,22 +4533,49 @@ function getConfiguredWorkspaces(path = defaultConfigPath()) {
4533
4533
  function saveConfiguredWorkspaces(workspaces, path = defaultConfigPath()) {
4534
4534
  const config = loadInstallConfig(path);
4535
4535
  config.workspaces = workspaces;
4536
+ if (config.activeWorkspaceId && !workspaces.some((workspace) => workspace.id === config.activeWorkspaceId)) {
4537
+ config.activeWorkspaceId = workspaces[0]?.id;
4538
+ }
4539
+ saveInstallConfig(config, path);
4540
+ }
4541
+ function getActiveWorkspaceId(path = defaultConfigPath()) {
4542
+ return loadInstallConfig(path).activeWorkspaceId;
4543
+ }
4544
+ function setActiveWorkspaceId(id, path = defaultConfigPath()) {
4545
+ const config = loadInstallConfig(path);
4546
+ if (id) {
4547
+ config.activeWorkspaceId = id;
4548
+ } else {
4549
+ delete config.activeWorkspaceId;
4550
+ }
4536
4551
  saveInstallConfig(config, path);
4537
4552
  }
4553
+ function getActiveWorkspace(path = defaultConfigPath()) {
4554
+ const config = loadInstallConfig(path);
4555
+ const id = config.activeWorkspaceId;
4556
+ return id ? config.workspaces?.find((workspace) => workspace.id === id) : void 0;
4557
+ }
4538
4558
  function upsertConfiguredWorkspace(workspace, path = defaultConfigPath()) {
4539
- const current = getConfiguredWorkspaces(path);
4559
+ const config = loadInstallConfig(path);
4560
+ const current = config.workspaces ?? [];
4540
4561
  const next = [
4541
4562
  ...current.filter((candidate) => candidate.id !== workspace.id),
4542
4563
  workspace
4543
4564
  ];
4544
- saveConfiguredWorkspaces(next, path);
4565
+ config.workspaces = next;
4566
+ saveInstallConfig(config, path);
4545
4567
  return next;
4546
4568
  }
4547
4569
  function removeConfiguredWorkspace(id, path = defaultConfigPath()) {
4548
- const next = getConfiguredWorkspaces(path).filter(
4570
+ const config = loadInstallConfig(path);
4571
+ const next = (config.workspaces ?? []).filter(
4549
4572
  (workspace) => workspace.id !== id
4550
4573
  );
4551
- saveConfiguredWorkspaces(next, path);
4574
+ config.workspaces = next;
4575
+ if (config.activeWorkspaceId === id) {
4576
+ config.activeWorkspaceId = next[0]?.id;
4577
+ }
4578
+ saveInstallConfig(config, path);
4552
4579
  return next;
4553
4580
  }
4554
4581
  function detectSyncProvider(dir) {
@@ -4880,7 +4907,7 @@ function getSystemProfile() {
4880
4907
  import { existsSync as existsSync10 } from "fs";
4881
4908
  import { resolve as resolve2 } from "path";
4882
4909
  async function getRepoPaths(db) {
4883
- const personalSetting = await getSetting(db, "repo.personal") || await getSetting(db, "personal.workspace_dir");
4910
+ const personalSetting = await getSetting(db, "repo.personal") || getActiveWorkspace()?.path;
4884
4911
  const teamSetting = await getSetting(db, "repo.team");
4885
4912
  const orgSetting = await getSetting(db, "repo.org");
4886
4913
  return {
@@ -5102,6 +5129,8 @@ export {
5102
5129
  generateZshHooks,
5103
5130
  generateZshUnhooks,
5104
5131
  getADOCredentials,
5132
+ getActiveWorkspace,
5133
+ getActiveWorkspaceId,
5105
5134
  getAgentSkill,
5106
5135
  getAllSettings,
5107
5136
  getAllSettingsDetailed,
@@ -5194,6 +5223,7 @@ export {
5194
5223
  saveMachineAiConfig,
5195
5224
  serializeGoal,
5196
5225
  setADOCredentials,
5226
+ setActiveWorkspaceId,
5197
5227
  setInstallChannel,
5198
5228
  setInstallMode,
5199
5229
  setProviderApiKey,