zam-core 0.4.4 → 0.5.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 CHANGED
@@ -1795,6 +1795,40 @@ interface InstallConfig {
1795
1795
  mode?: InstallMode;
1796
1796
  /** How this copy was installed; drives the self-update mechanism. */
1797
1797
  channel?: InstallChannel;
1798
+ /** Machine-local AI provider choices; never synchronized through the DB. */
1799
+ ai?: MachineAiConfig;
1800
+ /** Machine-local paths to existing personal/team/community workspaces. */
1801
+ workspaces?: WorkspaceConfig[];
1802
+ }
1803
+ type MachineAiRole = "vision" | "recall" | "text";
1804
+ type MachineApiFlavor = "chat-completions" | "anthropic-messages";
1805
+ interface MachineProviderRecord {
1806
+ label?: string;
1807
+ url?: string;
1808
+ model?: string;
1809
+ apiFlavor?: MachineApiFlavor;
1810
+ apiKeyRef?: string;
1811
+ local?: boolean;
1812
+ runner?: string;
1813
+ }
1814
+ interface MachineRoleBinding {
1815
+ primary?: string;
1816
+ fallback?: string;
1817
+ }
1818
+ interface MachineAiConfig {
1819
+ providers?: Record<string, MachineProviderRecord>;
1820
+ roles?: Partial<Record<MachineAiRole, MachineRoleBinding>>;
1821
+ }
1822
+ type WorkspaceKind = "personal" | "team" | "family" | "community" | "organization" | "custom";
1823
+ type WorkspaceSourceControl = "github" | "azure-devops" | "git" | "none";
1824
+ interface WorkspaceConfig {
1825
+ id: string;
1826
+ label?: string;
1827
+ kind: WorkspaceKind;
1828
+ path: string;
1829
+ sourceControl?: WorkspaceSourceControl;
1830
+ knowledgeScopes?: string[];
1831
+ defaultAgent?: string;
1798
1832
  }
1799
1833
  /** Load ~/.zam/config.json. Returns an empty config if missing or unreadable. */
1800
1834
  declare function loadInstallConfig(path?: string): InstallConfig;
@@ -1814,6 +1848,12 @@ declare function setInstallMode(mode: InstallMode, path?: string): void;
1814
1848
  */
1815
1849
  declare function getInstallChannel(path?: string): InstallChannel;
1816
1850
  declare function setInstallChannel(channel: InstallChannel, path?: string): void;
1851
+ declare function getMachineAiConfig(path?: string): MachineAiConfig;
1852
+ declare function saveMachineAiConfig(ai: MachineAiConfig, path?: string): void;
1853
+ declare function getConfiguredWorkspaces(path?: string): WorkspaceConfig[];
1854
+ declare function saveConfiguredWorkspaces(workspaces: WorkspaceConfig[], path?: string): void;
1855
+ declare function upsertConfiguredWorkspace(workspace: WorkspaceConfig, path?: string): WorkspaceConfig[];
1856
+ declare function removeConfiguredWorkspace(id: string, path?: string): WorkspaceConfig[];
1817
1857
  /**
1818
1858
  * Best-effort detection of the file-sync provider a folder lives in, from its
1819
1859
  * path. Used only for friendly messaging ("this folder syncs via OneDrive —
@@ -1908,4 +1948,4 @@ declare function resolveAllBeliefPaths(db: Database): Promise<string[]>;
1908
1948
  */
1909
1949
  declare function resolveAllGoalPaths(db: Database): Promise<string[]>;
1910
1950
 
1911
- 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 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, 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, addPrerequisite, analyzeObservation, appendUiObservationReport, applySessionSynthesis, buildReviewQueue, buildUiSynthesisCandidates, cascadeBlock, clearADOCredentials, clearProviderApiKey, 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, getDatabaseTargetInfo, getDefaultDbPath, getDependents, getDomainCompetence, getDueCards, getGoal, getGoalTree, getInstallChannel, getInstallMode, 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, resolveAllBeliefPaths, resolveAllGoalPaths, resolveObserverPolicy, resolveReference, resolveRepoPath, resolveReviewContext, saveCredentials, saveInstallConfig, serializeGoal, setADOCredentials, setInstallChannel, setInstallMode, setProviderApiKey, setSetting, setTursoCredentials, startSession, syncObserverSidecarPolicy, t, toSidecarPrivacyPolicy, uiObservationLogExists, uiObservationTimeSpan, unblockReady, updateCard, updateGoalStatus, updateToken, verifySnapshot, wouldCreateCycle, writeMonitorEvent };
1951
+ 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, 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, 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 };
package/dist/index.js CHANGED
@@ -4466,8 +4466,10 @@ function t(locale, key, params = {}) {
4466
4466
  import { existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync8, writeFileSync as writeFileSync5 } from "fs";
4467
4467
  import { homedir as homedir6 } from "os";
4468
4468
  import { dirname as dirname4, join as join9 } from "path";
4469
- var DEFAULT_CONFIG_PATH = join9(homedir6(), ".zam", "config.json");
4470
- function loadInstallConfig(path = DEFAULT_CONFIG_PATH) {
4469
+ function defaultConfigPath() {
4470
+ return process.env.ZAM_CONFIG_PATH || join9(homedir6(), ".zam", "config.json");
4471
+ }
4472
+ function loadInstallConfig(path = defaultConfigPath()) {
4471
4473
  if (!existsSync8(path)) return {};
4472
4474
  try {
4473
4475
  return JSON.parse(readFileSync8(path, "utf-8"));
@@ -4475,30 +4477,62 @@ function loadInstallConfig(path = DEFAULT_CONFIG_PATH) {
4475
4477
  return {};
4476
4478
  }
4477
4479
  }
4478
- function saveInstallConfig(config, path = DEFAULT_CONFIG_PATH) {
4480
+ function saveInstallConfig(config, path = defaultConfigPath()) {
4479
4481
  const dir = dirname4(path);
4480
4482
  if (!existsSync8(dir)) mkdirSync7(dir, { recursive: true });
4481
4483
  writeFileSync5(path, `${JSON.stringify(config, null, 2)}
4482
4484
  `, "utf-8");
4483
4485
  }
4484
- function getInstallMode(path = DEFAULT_CONFIG_PATH) {
4486
+ function getInstallMode(path = defaultConfigPath()) {
4485
4487
  return loadInstallConfig(path).mode ?? "developer";
4486
4488
  }
4487
- function setInstallMode(mode, path = DEFAULT_CONFIG_PATH) {
4489
+ function setInstallMode(mode, path = defaultConfigPath()) {
4488
4490
  const config = loadInstallConfig(path);
4489
4491
  config.mode = mode;
4490
4492
  saveInstallConfig(config, path);
4491
4493
  }
4492
- function getInstallChannel(path = DEFAULT_CONFIG_PATH) {
4494
+ function getInstallChannel(path = defaultConfigPath()) {
4493
4495
  const config = loadInstallConfig(path);
4494
4496
  if (config.channel) return config.channel;
4495
4497
  return (config.mode ?? "developer") === "developer" ? "developer" : "direct";
4496
4498
  }
4497
- function setInstallChannel(channel, path = DEFAULT_CONFIG_PATH) {
4499
+ function setInstallChannel(channel, path = defaultConfigPath()) {
4498
4500
  const config = loadInstallConfig(path);
4499
4501
  config.channel = channel;
4500
4502
  saveInstallConfig(config, path);
4501
4503
  }
4504
+ function getMachineAiConfig(path = defaultConfigPath()) {
4505
+ return loadInstallConfig(path).ai ?? {};
4506
+ }
4507
+ function saveMachineAiConfig(ai, path = defaultConfigPath()) {
4508
+ const config = loadInstallConfig(path);
4509
+ config.ai = ai;
4510
+ saveInstallConfig(config, path);
4511
+ }
4512
+ function getConfiguredWorkspaces(path = defaultConfigPath()) {
4513
+ return loadInstallConfig(path).workspaces ?? [];
4514
+ }
4515
+ function saveConfiguredWorkspaces(workspaces, path = defaultConfigPath()) {
4516
+ const config = loadInstallConfig(path);
4517
+ config.workspaces = workspaces;
4518
+ saveInstallConfig(config, path);
4519
+ }
4520
+ function upsertConfiguredWorkspace(workspace, path = defaultConfigPath()) {
4521
+ const current = getConfiguredWorkspaces(path);
4522
+ const next = [
4523
+ ...current.filter((candidate) => candidate.id !== workspace.id),
4524
+ workspace
4525
+ ];
4526
+ saveConfiguredWorkspaces(next, path);
4527
+ return next;
4528
+ }
4529
+ function removeConfiguredWorkspace(id, path = defaultConfigPath()) {
4530
+ const next = getConfiguredWorkspaces(path).filter(
4531
+ (workspace) => workspace.id !== id
4532
+ );
4533
+ saveConfiguredWorkspaces(next, path);
4534
+ return next;
4535
+ }
4502
4536
  function detectSyncProvider(dir) {
4503
4537
  const p = dir.toLowerCase();
4504
4538
  if (p.includes("onedrive")) return "OneDrive";
@@ -5055,6 +5089,7 @@ export {
5055
5089
  getCard,
5056
5090
  getCardById,
5057
5091
  getCardDeletionImpact,
5092
+ getConfiguredWorkspaces,
5058
5093
  getDatabaseTargetInfo,
5059
5094
  getDefaultDbPath,
5060
5095
  getDependents,
@@ -5064,6 +5099,7 @@ export {
5064
5099
  getGoalTree,
5065
5100
  getInstallChannel,
5066
5101
  getInstallMode,
5102
+ getMachineAiConfig,
5067
5103
  getMonitorDir,
5068
5104
  getMonitorLogStats,
5069
5105
  getMonitorPath,
@@ -5125,14 +5161,17 @@ export {
5125
5161
  prepareSessionSynthesis,
5126
5162
  readMonitorLog,
5127
5163
  readUiObservationLog,
5164
+ removeConfiguredWorkspace,
5128
5165
  resolveAllBeliefPaths,
5129
5166
  resolveAllGoalPaths,
5130
5167
  resolveObserverPolicy,
5131
5168
  resolveReference,
5132
5169
  resolveRepoPath,
5133
5170
  resolveReviewContext,
5171
+ saveConfiguredWorkspaces,
5134
5172
  saveCredentials,
5135
5173
  saveInstallConfig,
5174
+ saveMachineAiConfig,
5136
5175
  serializeGoal,
5137
5176
  setADOCredentials,
5138
5177
  setInstallChannel,
@@ -5150,6 +5189,7 @@ export {
5150
5189
  updateCard,
5151
5190
  updateGoalStatus,
5152
5191
  updateToken,
5192
+ upsertConfiguredWorkspace,
5153
5193
  verifySnapshot,
5154
5194
  wouldCreateCycle,
5155
5195
  writeMonitorEvent