nomoreide 0.1.70 → 0.1.71

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.
Files changed (35) hide show
  1. package/dist/core/agent-profiles/apply.d.ts +36 -0
  2. package/dist/core/agent-profiles/apply.js +160 -0
  3. package/dist/core/agent-profiles/apply.js.map +1 -0
  4. package/dist/core/agent-profiles/credentials.d.ts +26 -0
  5. package/dist/core/agent-profiles/credentials.js +151 -0
  6. package/dist/core/agent-profiles/credentials.js.map +1 -0
  7. package/dist/core/agent-profiles/index.d.ts +10 -0
  8. package/dist/core/agent-profiles/index.js +11 -0
  9. package/dist/core/agent-profiles/index.js.map +1 -0
  10. package/dist/core/agent-profiles/store.d.ts +35 -0
  11. package/dist/core/agent-profiles/store.js +210 -0
  12. package/dist/core/agent-profiles/store.js.map +1 -0
  13. package/dist/core/agent-profiles/transfer.d.ts +26 -0
  14. package/dist/core/agent-profiles/transfer.js +141 -0
  15. package/dist/core/agent-profiles/transfer.js.map +1 -0
  16. package/dist/core/agent-profiles/types.d.ts +250 -0
  17. package/dist/core/agent-profiles/types.js +63 -0
  18. package/dist/core/agent-profiles/types.js.map +1 -0
  19. package/dist/mcp/tools/agent-profiles.d.ts +9 -0
  20. package/dist/mcp/tools/agent-profiles.js +165 -0
  21. package/dist/mcp/tools/agent-profiles.js.map +1 -0
  22. package/dist/mcp/tools/index.d.ts +1 -1
  23. package/dist/mcp/tools/index.js +3 -0
  24. package/dist/mcp/tools/index.js.map +1 -1
  25. package/dist/web/client/assets/{code-editor-tF2NdMJV.js → code-editor-B0j6kcLb.js} +1 -1
  26. package/dist/web/client/assets/{index-CQmdoyuK.js → index-DAiSqTLR.js} +139 -139
  27. package/dist/web/client/assets/index-n7aEcfkd.css +1 -0
  28. package/dist/web/client/index.html +2 -2
  29. package/dist/web/routes/agent-profile-routes.d.ts +8 -0
  30. package/dist/web/routes/agent-profile-routes.js +180 -0
  31. package/dist/web/routes/agent-profile-routes.js.map +1 -0
  32. package/dist/web/routes/index.js +2 -0
  33. package/dist/web/routes/index.js.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/web/client/assets/index-C7lI87cF.css +0 -1
@@ -0,0 +1,36 @@
1
+ import { type AgentName } from "../agent-env/index.js";
2
+ import { type ProfileStoreOptions } from "./store.js";
3
+ export type ProfileItemStatus = "add" | "identical" | "conflict";
4
+ export interface ProfileApplyItem {
5
+ category: "mcp" | "skill";
6
+ name: string;
7
+ status: ProfileItemStatus;
8
+ warnings: string[];
9
+ }
10
+ export interface ProfileApplyPreview {
11
+ profile: string;
12
+ agent: AgentName;
13
+ items: ProfileApplyItem[];
14
+ /** `${credentials.*}` keys still unresolved in the profile — applied as-is. */
15
+ unresolvedCredentials: string[];
16
+ }
17
+ export interface ProfileApplyOptions extends ProfileStoreOptions {
18
+ cwd: string;
19
+ name: string;
20
+ agent: AgentName;
21
+ /** Item names (per category) to leave untouched — typically conflicts the user kept. */
22
+ skip?: {
23
+ mcps?: string[];
24
+ skills?: string[];
25
+ };
26
+ }
27
+ export declare function previewProfileApply(options: Omit<ProfileApplyOptions, "skip">): Promise<ProfileApplyPreview>;
28
+ export interface ProfileApplyResult {
29
+ profile: string;
30
+ agent: AgentName;
31
+ mcpsApplied: string[];
32
+ skillsApplied: string[];
33
+ skipped: string[];
34
+ backups: string[];
35
+ }
36
+ export declare function applyProfile(options: ProfileApplyOptions): Promise<ProfileApplyResult>;
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Apply a profile to an agent — the write-gated half of Agent Profiles.
3
+ * Mirrors the ROR-61 staged-writes gate: `previewProfileApply` classifies
4
+ * every item (add / identical / conflict) and surfaces warnings, then
5
+ * `applyProfile` snapshots the agent's config, writes through the
6
+ * write-guarded agent-env-writers layer, and reports every backup created.
7
+ */
8
+ import { cp, mkdir, rm } from "node:fs/promises";
9
+ import path from "node:path";
10
+ import { addMcp, getSkillDir, snapshotAgentConfig } from "../agent-env-writers.js";
11
+ import { readAllAgentConfigs, } from "../agent-env/index.js";
12
+ import { findUnresolvedCredentialKeys } from "./credentials.js";
13
+ import { getProfile, profileSkillsDir, pathExists } from "./store.js";
14
+ export async function previewProfileApply(options) {
15
+ const [profile, live] = await Promise.all([
16
+ getProfile(options.name, options),
17
+ readLiveConfig(options),
18
+ ]);
19
+ const items = [];
20
+ for (const [key, mcp] of Object.entries(profile.mcps)) {
21
+ const existing = findLiveMcp(live, key);
22
+ const warnings = [];
23
+ if (options.agent === "codex" &&
24
+ mcp.kind === "remote" &&
25
+ (mcp.headers || mcp.transport === "sse")) {
26
+ warnings.push("Codex config only stores a URL for remote MCPs; transport and headers will be dropped.");
27
+ }
28
+ items.push({
29
+ category: "mcp",
30
+ name: key,
31
+ status: existing === undefined ? "add" : sameMcp(existing, mcp) ? "identical" : "conflict",
32
+ warnings,
33
+ });
34
+ }
35
+ const liveSkillNames = new Set(live.skills.filter((skill) => skill.scope === "user").map((skill) => skill.name));
36
+ for (const skill of profile.skills) {
37
+ items.push({
38
+ category: "skill",
39
+ name: skill.name,
40
+ // Skill contents aren't diffed — an existing dir with the same name is a conflict.
41
+ status: liveSkillNames.has(skill.name) ? "conflict" : "add",
42
+ warnings: [],
43
+ });
44
+ }
45
+ return {
46
+ profile: profile.name,
47
+ agent: options.agent,
48
+ items,
49
+ unresolvedCredentials: findUnresolvedCredentialKeys(profile.mcps),
50
+ };
51
+ }
52
+ export async function applyProfile(options) {
53
+ const profile = await getProfile(options.name, options);
54
+ const base = { cwd: options.cwd, homeDir: options.homeDir };
55
+ const skipMcps = new Set(options.skip?.mcps ?? []);
56
+ const skipSkills = new Set(options.skip?.skills ?? []);
57
+ const backups = [];
58
+ const skipped = [];
59
+ // One snapshot of the agent's config file before the batch (plus the
60
+ // per-write .bak.* copies the writers create anyway).
61
+ const snapshot = await snapshotAgentConfig({ ...base, agent: options.agent });
62
+ backups.push(...snapshot.backups);
63
+ const mcpsApplied = [];
64
+ for (const [key, mcp] of Object.entries(profile.mcps)) {
65
+ if (skipMcps.has(key)) {
66
+ skipped.push(`mcp "${key}"`);
67
+ continue;
68
+ }
69
+ const outcome = await addMcp({
70
+ ...base,
71
+ agent: options.agent,
72
+ key,
73
+ scope: "user",
74
+ entry: mcp.kind === "local"
75
+ ? { command: mcp.command, args: mcp.args, env: mcp.env }
76
+ : undefined,
77
+ remoteEntry: mcp.kind === "remote"
78
+ ? { transport: mcp.transport, url: mcp.url, headers: mcp.headers, env: mcp.env }
79
+ : undefined,
80
+ });
81
+ backups.push(...outcome.backups);
82
+ mcpsApplied.push(key);
83
+ }
84
+ const skillsApplied = [];
85
+ for (const skill of profile.skills) {
86
+ if (skipSkills.has(skill.name)) {
87
+ skipped.push(`skill "${skill.name}"`);
88
+ continue;
89
+ }
90
+ const sourceDir = path.join(profileSkillsDir(options.name, options), path.basename(skill.name));
91
+ if (!(await pathExists(sourceDir))) {
92
+ skipped.push(`skill "${skill.name}" (missing from profile bundle)`);
93
+ continue;
94
+ }
95
+ await installProfileSkill(sourceDir, skill.name, options);
96
+ skillsApplied.push(skill.name);
97
+ }
98
+ return {
99
+ profile: profile.name,
100
+ agent: options.agent,
101
+ mcpsApplied,
102
+ skillsApplied,
103
+ skipped,
104
+ backups,
105
+ };
106
+ }
107
+ /** Copy a bundled skill dir into the agent's user skills dir (idempotent overwrite). */
108
+ async function installProfileSkill(sourceDir, skillName, options) {
109
+ const targetDir = getSkillDir({ agent: options.agent, skillName, scope: "user" }, options.cwd, options.homeDir);
110
+ await mkdir(path.dirname(targetDir), { recursive: true });
111
+ await rm(targetDir, { recursive: true, force: true });
112
+ await cp(sourceDir, targetDir, { recursive: true });
113
+ }
114
+ async function readLiveConfig(options) {
115
+ const configs = await readAllAgentConfigs({ cwd: options.cwd, homeDir: options.homeDir });
116
+ const config = configs.find((candidate) => candidate.agent === options.agent);
117
+ if (!config)
118
+ throw new Error(`Unknown agent "${options.agent}".`);
119
+ return config;
120
+ }
121
+ function findLiveMcp(config, key) {
122
+ const local = config.mcpServers[key];
123
+ if (local)
124
+ return { kind: "local", command: local.command, args: local.args, env: local.env };
125
+ const remote = config.remoteMcpServers[key];
126
+ if (remote) {
127
+ return {
128
+ kind: "remote",
129
+ transport: remote.transport,
130
+ url: remote.url,
131
+ headers: remote.headers,
132
+ env: remote.env,
133
+ };
134
+ }
135
+ return undefined;
136
+ }
137
+ function sameMcp(left, right) {
138
+ return JSON.stringify(normalizeMcp(left)) === JSON.stringify(normalizeMcp(right));
139
+ }
140
+ function normalizeMcp(mcp) {
141
+ if (mcp.kind === "local") {
142
+ return {
143
+ kind: "local",
144
+ command: mcp.command,
145
+ args: mcp.args ?? [],
146
+ env: sortedEntries(mcp.env),
147
+ };
148
+ }
149
+ return {
150
+ kind: "remote",
151
+ transport: mcp.transport,
152
+ url: mcp.url,
153
+ headers: sortedEntries(mcp.headers),
154
+ env: sortedEntries(mcp.env),
155
+ };
156
+ }
157
+ function sortedEntries(map) {
158
+ return Object.entries(map ?? {}).sort(([a], [b]) => a.localeCompare(b));
159
+ }
160
+ //# sourceMappingURL=apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/core/agent-profiles/apply.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EACL,mBAAmB,GAGpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAA4B,MAAM,YAAY,CAAC;AA4BhG,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAA0C;IAE1C,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,MAAM,O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,CAAC;QACzB,OAAO;YACL,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE;YACpB,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC;SAC5B,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;QACnC,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC;KAC5B,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,GAAuC;IAC5D,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Credential redaction (export) and resolution (import) for portable
3
+ * profiles, ported from brainctl's credential services. Exported archives
4
+ * must never contain raw secrets: secret-looking env/header values become
5
+ * `${credentials.<key>}` placeholders plus a spec describing what the
6
+ * importer has to supply.
7
+ */
8
+ import type { CredentialSpec, ProfileMcp } from "./types.js";
9
+ export interface RedactionResult {
10
+ redacted: ProfileMcp;
11
+ credentials: CredentialSpec[];
12
+ /** Original secret values, keyed by normalized credential key (kept out of archives). */
13
+ rawValues: Record<string, string>;
14
+ }
15
+ export declare function redactMcpCredentials(config: ProfileMcp): RedactionResult;
16
+ export interface ResolutionResult {
17
+ resolved: ProfileMcp;
18
+ missing: CredentialSpec[];
19
+ }
20
+ export declare function resolveMcpCredentials(config: ProfileMcp, options?: {
21
+ credentials?: Record<string, string>;
22
+ credentialSpecs?: CredentialSpec[];
23
+ environment?: Record<string, string | undefined>;
24
+ }): ResolutionResult;
25
+ /** Every `${credentials.*}` key still present anywhere in the given MCPs. */
26
+ export declare function findUnresolvedCredentialKeys(mcps: Record<string, ProfileMcp>): string[];
@@ -0,0 +1,151 @@
1
+ export function redactMcpCredentials(config) {
2
+ const specs = new Map();
3
+ const rawValues = {};
4
+ const env = redactStringMap(config.env, "env", specs, rawValues);
5
+ const redacted = config.kind === "remote"
6
+ ? {
7
+ ...config,
8
+ ...(env ? { env } : {}),
9
+ ...((() => {
10
+ const headers = redactStringMap(config.headers, "header", specs, rawValues);
11
+ return headers ? { headers } : {};
12
+ })()),
13
+ }
14
+ : { ...config, ...(env ? { env } : {}) };
15
+ return {
16
+ redacted,
17
+ credentials: Array.from(specs.values())
18
+ .sort((left, right) => left.key.localeCompare(right.key))
19
+ .map((entry) => ({
20
+ key: entry.key,
21
+ required: true,
22
+ description: `${Array.from(entry.descriptions).sort().join("; ")} required for MCP access`,
23
+ })),
24
+ rawValues,
25
+ };
26
+ }
27
+ function redactStringMap(values, source, specs, rawValues) {
28
+ if (!values)
29
+ return undefined;
30
+ const redacted = {};
31
+ for (const [key, value] of Object.entries(values)) {
32
+ if (!shouldRedact(key)) {
33
+ redacted[key] = value;
34
+ continue;
35
+ }
36
+ const credentialKey = tokenizeCredentialKey(key).join("_");
37
+ const description = source === "env" ? `Environment variable ${key}` : `Header ${key}`;
38
+ const existing = specs.get(credentialKey);
39
+ if (existing)
40
+ existing.descriptions.add(description);
41
+ else
42
+ specs.set(credentialKey, { key: credentialKey, descriptions: new Set([description]) });
43
+ if (isCredentialPlaceholder(value)) {
44
+ redacted[key] = value; // already a placeholder — keep as-is
45
+ }
46
+ else {
47
+ rawValues[credentialKey] = value;
48
+ redacted[key] = `\${credentials.${credentialKey}}`;
49
+ }
50
+ }
51
+ return redacted;
52
+ }
53
+ function shouldRedact(key) {
54
+ const tokens = tokenizeCredentialKey(key);
55
+ if (tokens.length === 0)
56
+ return false;
57
+ const last = tokens[tokens.length - 1];
58
+ return (last === "authorization" ||
59
+ last === "password" ||
60
+ last === "secret" ||
61
+ last === "token" ||
62
+ (last === "key" && (tokens.includes("api") || tokens.includes("auth"))));
63
+ }
64
+ function tokenizeCredentialKey(key) {
65
+ return key
66
+ .trim()
67
+ .replace(/([A-Z]+)([A-Z][a-z0-9])/g, "$1 $2")
68
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
69
+ .toLowerCase()
70
+ .split(/[^a-z0-9]+/g)
71
+ .filter(Boolean);
72
+ }
73
+ function isCredentialPlaceholder(value) {
74
+ return (/^\$\{credentials\.[^}]+\}$/.test(value) ||
75
+ /^(Bearer|Token)\s+\$\{credentials\.[^}]+\}$/i.test(value));
76
+ }
77
+ export function resolveMcpCredentials(config, options = {}) {
78
+ const specs = new Map((options.credentialSpecs ?? []).map((spec) => [spec.key, spec]));
79
+ const missing = new Map();
80
+ const env = resolveStringMap(config.env, specs, missing, options);
81
+ const resolved = config.kind === "remote"
82
+ ? {
83
+ ...config,
84
+ ...(env ? { env } : {}),
85
+ ...((() => {
86
+ const headers = resolveStringMap(config.headers, specs, missing, options);
87
+ return headers ? { headers } : {};
88
+ })()),
89
+ }
90
+ : { ...config, ...(env ? { env } : {}) };
91
+ return { resolved, missing: Array.from(missing.values()) };
92
+ }
93
+ function resolveStringMap(values, specs, missing, options) {
94
+ if (!values)
95
+ return undefined;
96
+ const resolved = {};
97
+ for (const [key, value] of Object.entries(values)) {
98
+ const placeholder = parseCredentialPlaceholder(value);
99
+ if (!placeholder) {
100
+ resolved[key] = value;
101
+ continue;
102
+ }
103
+ const supplied = options.credentials?.[placeholder.key] ?? options.environment?.[placeholder.key];
104
+ if (typeof supplied === "string" && supplied.length > 0) {
105
+ resolved[key] = placeholder.prefix ? `${placeholder.prefix} ${supplied}` : supplied;
106
+ continue;
107
+ }
108
+ const spec = specs.get(placeholder.key) ?? {
109
+ key: placeholder.key,
110
+ required: true,
111
+ description: `Credential ${placeholder.key} is required`,
112
+ };
113
+ if (spec.required)
114
+ missing.set(spec.key, spec);
115
+ resolved[key] = value; // keep the placeholder; the user can fill it later
116
+ }
117
+ return resolved;
118
+ }
119
+ function parseCredentialPlaceholder(value) {
120
+ const bare = value.match(/^\$\{credentials\.([^}]+)\}$/);
121
+ if (bare)
122
+ return { key: bare[1] };
123
+ const prefixed = value.match(/^(Bearer|Token)\s+\$\{credentials\.([^}]+)\}$/i);
124
+ if (prefixed) {
125
+ return {
126
+ key: prefixed[2],
127
+ prefix: prefixed[1].toLowerCase() === "bearer" ? "Bearer" : "Token",
128
+ };
129
+ }
130
+ return null;
131
+ }
132
+ const PLACEHOLDER_PATTERN = /\$\{\s*credentials\.([^}\s]+)\s*\}/g;
133
+ /** Every `${credentials.*}` key still present anywhere in the given MCPs. */
134
+ export function findUnresolvedCredentialKeys(mcps) {
135
+ const keys = new Set();
136
+ const visit = (value) => {
137
+ if (typeof value === "string") {
138
+ for (const match of value.matchAll(PLACEHOLDER_PATTERN))
139
+ keys.add(match[1]);
140
+ }
141
+ else if (Array.isArray(value)) {
142
+ value.forEach(visit);
143
+ }
144
+ else if (value && typeof value === "object") {
145
+ Object.values(value).forEach(visit);
146
+ }
147
+ };
148
+ visit(mcps);
149
+ return Array.from(keys).sort();
150
+ }
151
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../src/core/agent-profiles/credentials.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,oBAAoB,CAAC,MAAkB;IACrD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsD,CAAC;IAC5E,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAEjE,MAAM,QAAQ,GACZ,MAAM,CAAC,IAAI,KAAK,QAAQ;QACtB,CAAC,CAAC;YACE,GAAG,MAAM;YAC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,KAAc,EAAQ,EAAE;QACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,mBAAmB,CAAC;gBAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9E,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;aAAM,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,CAAC;IACZ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Agent Profiles (ROR-62): named MCP+skill bundles stored under
3
+ * `~/.config/nomoreide/agent-profiles/`, applied to agents through the
4
+ * write-guarded agent-env layer, shared as credential-redacted tarballs.
5
+ */
6
+ export { applyProfile, previewProfileApply, type ProfileApplyItem, type ProfileApplyPreview, type ProfileApplyResult, type ProfileItemStatus, } from "./apply.js";
7
+ export { findUnresolvedCredentialKeys, redactMcpCredentials, resolveMcpCredentials, } from "./credentials.js";
8
+ export { assertValidProfileName, copySkillBetweenProfiles, createProfile, deleteProfile, getProfile, listProfiles, profileDir, profilesRoot, profileSkillsDir, snapshotProfileFromAgent, updateProfile, writeProfile, type ProfileStoreOptions, } from "./store.js";
9
+ export { exportProfile, importProfile, type ExportResult, type ImportResult } from "./transfer.js";
10
+ export { PROFILE_NAME_PATTERN, profileManifestSchema, profileMcpSchema, profileSchema, slugifyProfileName, type CredentialSpec, type Profile, type ProfileManifest, type ProfileMcp, type ProfileSummary, } from "./types.js";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Agent Profiles (ROR-62): named MCP+skill bundles stored under
3
+ * `~/.config/nomoreide/agent-profiles/`, applied to agents through the
4
+ * write-guarded agent-env layer, shared as credential-redacted tarballs.
5
+ */
6
+ export { applyProfile, previewProfileApply, } from "./apply.js";
7
+ export { findUnresolvedCredentialKeys, redactMcpCredentials, resolveMcpCredentials, } from "./credentials.js";
8
+ export { assertValidProfileName, copySkillBetweenProfiles, createProfile, deleteProfile, getProfile, listProfiles, profileDir, profilesRoot, profileSkillsDir, snapshotProfileFromAgent, updateProfile, writeProfile, } from "./store.js";
9
+ export { exportProfile, importProfile } from "./transfer.js";
10
+ export { PROFILE_NAME_PATTERN, profileManifestSchema, profileMcpSchema, profileSchema, slugifyProfileName, } from "./types.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/agent-profiles/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,YAAY,EACZ,mBAAmB,GAKpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,EACb,YAAY,GAEb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAwC,MAAM,eAAe,CAAC;AACnG,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,GAMnB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type AgentMcpEntry, type AgentName, type RemoteMcpEntry } from "../agent-env/index.js";
2
+ import { type Profile, type ProfileMcp, type ProfileSummary } from "./types.js";
3
+ export interface ProfileStoreOptions {
4
+ /** Injectable for tmpdir tests, like the agent-env readers. */
5
+ homeDir?: string;
6
+ }
7
+ export declare function profilesRoot(options?: ProfileStoreOptions): string;
8
+ export declare function profileDir(name: string, options?: ProfileStoreOptions): string;
9
+ export declare function profileSkillsDir(name: string, options?: ProfileStoreOptions): string;
10
+ export declare function assertValidProfileName(name: string): string;
11
+ export declare function listProfiles(options?: ProfileStoreOptions): Promise<ProfileSummary[]>;
12
+ export declare function getProfile(name: string, options?: ProfileStoreOptions): Promise<Profile>;
13
+ export declare function createProfile(input: {
14
+ name: string;
15
+ description?: string;
16
+ }, options?: ProfileStoreOptions): Promise<Profile>;
17
+ export declare function updateProfile(name: string, patch: Partial<Pick<Profile, "description" | "mcps" | "skills">>, options?: ProfileStoreOptions): Promise<Profile>;
18
+ export declare function deleteProfile(name: string, options?: ProfileStoreOptions): Promise<void>;
19
+ export declare function writeProfile(profile: Profile, options?: ProfileStoreOptions): Promise<void>;
20
+ /**
21
+ * Capture an agent's live config (MCPs + local skills) into a new profile.
22
+ * Raw credential values are kept — the profile lives in the user's own config
23
+ * dir; redaction happens at export time.
24
+ */
25
+ export declare function snapshotProfileFromAgent(input: {
26
+ agent: AgentName;
27
+ name: string;
28
+ description?: string;
29
+ cwd: string;
30
+ }, options?: ProfileStoreOptions): Promise<Profile>;
31
+ export declare function toLocalProfileMcp(entry: AgentMcpEntry): ProfileMcp;
32
+ export declare function toRemoteProfileMcp(entry: RemoteMcpEntry): ProfileMcp;
33
+ /** Copy one bundled skill dir between profiles (no-op if the source has no files). */
34
+ export declare function copySkillBetweenProfiles(from: string, to: string, skillName: string, options?: ProfileStoreOptions): Promise<void>;
35
+ export declare function pathExists(target: string): Promise<boolean>;