zam-core 0.4.3 → 0.5.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/.agent/skills/zam/SKILL.md +9 -6
- package/.agents/skills/zam/SKILL.md +9 -6
- package/.claude/skills/zam/SKILL.md +9 -6
- package/dist/cli/index.js +2489 -909
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +56 -1
- package/dist/index.js +79 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -120,6 +120,14 @@ interface ADOCredentials {
|
|
|
120
120
|
interface Credentials {
|
|
121
121
|
turso?: Partial<TursoCredentials>;
|
|
122
122
|
ado?: Partial<ADOCredentials>;
|
|
123
|
+
/**
|
|
124
|
+
* API keys for named LLM providers, keyed by the provider's reference name
|
|
125
|
+
* (the `apiKeyRef` in the `llm.providers` setting). Kept here — not in the
|
|
126
|
+
* database — so workspace exports / DB snapshots never carry provider keys.
|
|
127
|
+
*/
|
|
128
|
+
llmProviders?: Record<string, {
|
|
129
|
+
apiKey: string;
|
|
130
|
+
}>;
|
|
123
131
|
}
|
|
124
132
|
/** Load credentials from ~/.zam/credentials.json. Returns empty object if missing. */
|
|
125
133
|
declare function loadCredentials(path?: string): Credentials;
|
|
@@ -137,6 +145,14 @@ declare function getADOCredentials(path?: string): ADOCredentials | null;
|
|
|
137
145
|
declare function setADOCredentials(orgUrl: string, project: string, pat: string, path?: string): void;
|
|
138
146
|
/** Clear ADO credentials. */
|
|
139
147
|
declare function clearADOCredentials(path?: string): void;
|
|
148
|
+
/** Get a named LLM provider's API key (by `apiKeyRef`), or null if unset. */
|
|
149
|
+
declare function getProviderApiKey(name: string, path?: string): string | null;
|
|
150
|
+
/** Store a named LLM provider's API key (referenced by `apiKeyRef`). */
|
|
151
|
+
declare function setProviderApiKey(name: string, apiKey: string, path?: string): void;
|
|
152
|
+
/** Remove a named LLM provider's stored API key. No-op if it was unset. */
|
|
153
|
+
declare function clearProviderApiKey(name: string, path?: string): void;
|
|
154
|
+
/** List the reference names (`apiKeyRef`) that currently have a stored key. */
|
|
155
|
+
declare function listProviderApiKeyRefs(path?: string): string[];
|
|
140
156
|
|
|
141
157
|
/**
|
|
142
158
|
* - `local`: better-sqlite3 file database (default without cloud credentials)
|
|
@@ -1779,6 +1795,40 @@ interface InstallConfig {
|
|
|
1779
1795
|
mode?: InstallMode;
|
|
1780
1796
|
/** How this copy was installed; drives the self-update mechanism. */
|
|
1781
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;
|
|
1782
1832
|
}
|
|
1783
1833
|
/** Load ~/.zam/config.json. Returns an empty config if missing or unreadable. */
|
|
1784
1834
|
declare function loadInstallConfig(path?: string): InstallConfig;
|
|
@@ -1798,6 +1848,11 @@ declare function setInstallMode(mode: InstallMode, path?: string): void;
|
|
|
1798
1848
|
*/
|
|
1799
1849
|
declare function getInstallChannel(path?: string): InstallChannel;
|
|
1800
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[];
|
|
1801
1856
|
/**
|
|
1802
1857
|
* Best-effort detection of the file-sync provider a folder lives in, from its
|
|
1803
1858
|
* path. Used only for friendly messaging ("this folder syncs via OneDrive —
|
|
@@ -1892,4 +1947,4 @@ declare function resolveAllBeliefPaths(db: Database): Promise<string[]>;
|
|
|
1892
1947
|
*/
|
|
1893
1948
|
declare function resolveAllGoalPaths(db: Database): Promise<string[]>;
|
|
1894
1949
|
|
|
1895
|
-
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, 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, 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, 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, setSetting, setTursoCredentials, startSession, syncObserverSidecarPolicy, t, toSidecarPrivacyPolicy, uiObservationLogExists, uiObservationTimeSpan, unblockReady, updateCard, updateGoalStatus, updateToken, verifySnapshot, wouldCreateCycle, writeMonitorEvent };
|
|
1950
|
+
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, 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
|
@@ -190,6 +190,25 @@ function clearADOCredentials(path) {
|
|
|
190
190
|
delete creds.ado;
|
|
191
191
|
saveCredentials(creds, path);
|
|
192
192
|
}
|
|
193
|
+
function getProviderApiKey(name, path) {
|
|
194
|
+
const key = loadCredentials(path).llmProviders?.[name]?.apiKey;
|
|
195
|
+
return key && key.length > 0 ? key : null;
|
|
196
|
+
}
|
|
197
|
+
function setProviderApiKey(name, apiKey, path) {
|
|
198
|
+
const creds = loadCredentials(path);
|
|
199
|
+
creds.llmProviders = { ...creds.llmProviders, [name]: { apiKey } };
|
|
200
|
+
saveCredentials(creds, path);
|
|
201
|
+
}
|
|
202
|
+
function clearProviderApiKey(name, path) {
|
|
203
|
+
const creds = loadCredentials(path);
|
|
204
|
+
if (creds.llmProviders && name in creds.llmProviders) {
|
|
205
|
+
delete creds.llmProviders[name];
|
|
206
|
+
saveCredentials(creds, path);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function listProviderApiKeyRefs(path) {
|
|
210
|
+
return Object.keys(loadCredentials(path).llmProviders ?? {});
|
|
211
|
+
}
|
|
193
212
|
|
|
194
213
|
// src/kernel/connectors/azure-devops.ts
|
|
195
214
|
function loadADOConfig() {
|
|
@@ -4447,8 +4466,10 @@ function t(locale, key, params = {}) {
|
|
|
4447
4466
|
import { existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync8, writeFileSync as writeFileSync5 } from "fs";
|
|
4448
4467
|
import { homedir as homedir6 } from "os";
|
|
4449
4468
|
import { dirname as dirname4, join as join9 } from "path";
|
|
4450
|
-
|
|
4451
|
-
|
|
4469
|
+
function defaultConfigPath() {
|
|
4470
|
+
return process.env.ZAM_CONFIG_PATH || join9(homedir6(), ".zam", "config.json");
|
|
4471
|
+
}
|
|
4472
|
+
function loadInstallConfig(path = defaultConfigPath()) {
|
|
4452
4473
|
if (!existsSync8(path)) return {};
|
|
4453
4474
|
try {
|
|
4454
4475
|
return JSON.parse(readFileSync8(path, "utf-8"));
|
|
@@ -4456,30 +4477,55 @@ function loadInstallConfig(path = DEFAULT_CONFIG_PATH) {
|
|
|
4456
4477
|
return {};
|
|
4457
4478
|
}
|
|
4458
4479
|
}
|
|
4459
|
-
function saveInstallConfig(config, path =
|
|
4480
|
+
function saveInstallConfig(config, path = defaultConfigPath()) {
|
|
4460
4481
|
const dir = dirname4(path);
|
|
4461
4482
|
if (!existsSync8(dir)) mkdirSync7(dir, { recursive: true });
|
|
4462
4483
|
writeFileSync5(path, `${JSON.stringify(config, null, 2)}
|
|
4463
4484
|
`, "utf-8");
|
|
4464
4485
|
}
|
|
4465
|
-
function getInstallMode(path =
|
|
4486
|
+
function getInstallMode(path = defaultConfigPath()) {
|
|
4466
4487
|
return loadInstallConfig(path).mode ?? "developer";
|
|
4467
4488
|
}
|
|
4468
|
-
function setInstallMode(mode, path =
|
|
4489
|
+
function setInstallMode(mode, path = defaultConfigPath()) {
|
|
4469
4490
|
const config = loadInstallConfig(path);
|
|
4470
4491
|
config.mode = mode;
|
|
4471
4492
|
saveInstallConfig(config, path);
|
|
4472
4493
|
}
|
|
4473
|
-
function getInstallChannel(path =
|
|
4494
|
+
function getInstallChannel(path = defaultConfigPath()) {
|
|
4474
4495
|
const config = loadInstallConfig(path);
|
|
4475
4496
|
if (config.channel) return config.channel;
|
|
4476
4497
|
return (config.mode ?? "developer") === "developer" ? "developer" : "direct";
|
|
4477
4498
|
}
|
|
4478
|
-
function setInstallChannel(channel, path =
|
|
4499
|
+
function setInstallChannel(channel, path = defaultConfigPath()) {
|
|
4479
4500
|
const config = loadInstallConfig(path);
|
|
4480
4501
|
config.channel = channel;
|
|
4481
4502
|
saveInstallConfig(config, path);
|
|
4482
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
|
+
}
|
|
4483
4529
|
function detectSyncProvider(dir) {
|
|
4484
4530
|
const p = dir.toLowerCase();
|
|
4485
4531
|
if (p.includes("onedrive")) return "OneDrive";
|
|
@@ -4756,13 +4802,11 @@ function runCommand(cmd) {
|
|
|
4756
4802
|
return "";
|
|
4757
4803
|
}
|
|
4758
4804
|
}
|
|
4759
|
-
function
|
|
4805
|
+
function detectWindowsNPU() {
|
|
4760
4806
|
if (process.platform !== "win32") return false;
|
|
4761
|
-
const cmd = `powershell -NoProfile -Command "Get-CimInstance Win32_PnPEntity | Where-Object { $_.Name -like '*AMD IPU*' -or $_.Name -like '*AMD NPU*' -or $_.Name -like '*NPU
|
|
4807
|
+
const cmd = `powershell -NoProfile -Command "Get-CimInstance Win32_PnPEntity | Where-Object { $_.PNPClass -eq 'ComputeAccelerator' -or $_.Name -like '*AMD IPU*' -or $_.Name -like '*AMD NPU*' -or $_.Name -like '*Qualcomm*NPU*' -or $_.Name -like '*Hexagon*NPU*' -or $_.Name -like '*Intel*AI Boost*' -or $_.Name -like '*NPU Compute*' -or $_.Name -like '*Ryzen AI*' } | Select-Object -First 1 -ExpandProperty Name"`;
|
|
4762
4808
|
const output = runCommand(cmd);
|
|
4763
|
-
return Boolean(
|
|
4764
|
-
output && (output.toLowerCase().includes("amd") || output.toLowerCase().includes("ipu") || output.toLowerCase().includes("npu") || output.toLowerCase().includes("ryzen"))
|
|
4765
|
-
);
|
|
4809
|
+
return Boolean(output && output.length > 0);
|
|
4766
4810
|
}
|
|
4767
4811
|
function getSystemProfile() {
|
|
4768
4812
|
const platform = process.platform;
|
|
@@ -4774,13 +4818,21 @@ function getSystemProfile() {
|
|
|
4774
4818
|
let arch = "unknown";
|
|
4775
4819
|
if (archStr === "x64") arch = "x64";
|
|
4776
4820
|
else if (archStr === "arm64") arch = "arm64";
|
|
4777
|
-
const
|
|
4821
|
+
const hasNpu = os === "windows" && detectWindowsNPU();
|
|
4778
4822
|
const hasAppleSilicon = os === "macos" && arch === "arm64";
|
|
4779
4823
|
let recommendedRunner = "generic";
|
|
4780
4824
|
let recommendedModel = "qwen3.5:4b";
|
|
4781
|
-
if (
|
|
4782
|
-
|
|
4783
|
-
|
|
4825
|
+
if (hasNpu) {
|
|
4826
|
+
const isQualcomm = runCommand(
|
|
4827
|
+
`powershell -NoProfile -Command "Get-CimInstance Win32_PnPEntity | Where-Object { $_.Name -like '*Qualcomm*' } | Select-Object -First 1"`
|
|
4828
|
+
).length > 0;
|
|
4829
|
+
if (isQualcomm) {
|
|
4830
|
+
recommendedRunner = "generic";
|
|
4831
|
+
recommendedModel = "qwen3.5-4b";
|
|
4832
|
+
} else {
|
|
4833
|
+
recommendedRunner = "fastflowlm";
|
|
4834
|
+
recommendedModel = "qwen3.5:4b";
|
|
4835
|
+
}
|
|
4784
4836
|
} else if (hasAppleSilicon) {
|
|
4785
4837
|
recommendedRunner = "ollama";
|
|
4786
4838
|
recommendedModel = "llama3.2:3b";
|
|
@@ -4791,7 +4843,8 @@ function getSystemProfile() {
|
|
|
4791
4843
|
return {
|
|
4792
4844
|
os,
|
|
4793
4845
|
arch,
|
|
4794
|
-
hasRyzenNPU,
|
|
4846
|
+
hasRyzenNPU: hasNpu && !archStr.includes("arm64"),
|
|
4847
|
+
// backwards compatibility flag
|
|
4795
4848
|
hasAppleSilicon,
|
|
4796
4849
|
recommendedRunner,
|
|
4797
4850
|
recommendedModel
|
|
@@ -4984,6 +5037,7 @@ export {
|
|
|
4984
5037
|
buildUiSynthesisCandidates,
|
|
4985
5038
|
cascadeBlock,
|
|
4986
5039
|
clearADOCredentials,
|
|
5040
|
+
clearProviderApiKey,
|
|
4987
5041
|
clearTursoCredentials,
|
|
4988
5042
|
compareVersions,
|
|
4989
5043
|
createAgentSkill,
|
|
@@ -5028,6 +5082,7 @@ export {
|
|
|
5028
5082
|
getCard,
|
|
5029
5083
|
getCardById,
|
|
5030
5084
|
getCardDeletionImpact,
|
|
5085
|
+
getConfiguredWorkspaces,
|
|
5031
5086
|
getDatabaseTargetInfo,
|
|
5032
5087
|
getDefaultDbPath,
|
|
5033
5088
|
getDependents,
|
|
@@ -5037,11 +5092,13 @@ export {
|
|
|
5037
5092
|
getGoalTree,
|
|
5038
5093
|
getInstallChannel,
|
|
5039
5094
|
getInstallMode,
|
|
5095
|
+
getMachineAiConfig,
|
|
5040
5096
|
getMonitorDir,
|
|
5041
5097
|
getMonitorLogStats,
|
|
5042
5098
|
getMonitorPath,
|
|
5043
5099
|
getPackageSkillPath,
|
|
5044
5100
|
getPrerequisites,
|
|
5101
|
+
getProviderApiKey,
|
|
5045
5102
|
getRepoPaths,
|
|
5046
5103
|
getReviewsForCard,
|
|
5047
5104
|
getReviewsForUser,
|
|
@@ -5068,6 +5125,7 @@ export {
|
|
|
5068
5125
|
isUiObservationReport,
|
|
5069
5126
|
listAgentSkills,
|
|
5070
5127
|
listGoals,
|
|
5128
|
+
listProviderApiKeyRefs,
|
|
5071
5129
|
listTokens,
|
|
5072
5130
|
loadADOConfig,
|
|
5073
5131
|
loadCredentials,
|
|
@@ -5102,12 +5160,15 @@ export {
|
|
|
5102
5160
|
resolveReference,
|
|
5103
5161
|
resolveRepoPath,
|
|
5104
5162
|
resolveReviewContext,
|
|
5163
|
+
saveConfiguredWorkspaces,
|
|
5105
5164
|
saveCredentials,
|
|
5106
5165
|
saveInstallConfig,
|
|
5166
|
+
saveMachineAiConfig,
|
|
5107
5167
|
serializeGoal,
|
|
5108
5168
|
setADOCredentials,
|
|
5109
5169
|
setInstallChannel,
|
|
5110
5170
|
setInstallMode,
|
|
5171
|
+
setProviderApiKey,
|
|
5111
5172
|
setSetting,
|
|
5112
5173
|
setTursoCredentials,
|
|
5113
5174
|
startSession,
|
|
@@ -5120,6 +5181,7 @@ export {
|
|
|
5120
5181
|
updateCard,
|
|
5121
5182
|
updateGoalStatus,
|
|
5122
5183
|
updateToken,
|
|
5184
|
+
upsertConfiguredWorkspace,
|
|
5123
5185
|
verifySnapshot,
|
|
5124
5186
|
wouldCreateCycle,
|
|
5125
5187
|
writeMonitorEvent
|