@agimon-ai/po-config 0.0.0-alpha.210 → 0.0.0-alpha.211
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/extensions/server.cjs +1 -1
- package/dist/extensions/server.mjs +1 -1
- package/dist/{index-CIBMaST9.d.mts → index-CeIBIUUY.d.mts} +3 -1
- package/dist/index-CeIBIUUY.d.mts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/po-runtime-identity.json +1 -1
- package/dist/{profiles-DwgWBBg6.mjs → profiles-34IRn-nw.mjs} +4 -1
- package/dist/profiles-34IRn-nw.mjs.map +1 -0
- package/dist/{profiles-ILyTd4_d.cjs → profiles-BJrLd2Ri.cjs} +4 -1
- package/dist/profiles-BJrLd2Ri.cjs.map +1 -0
- package/dist/profiles.cjs +1 -1
- package/dist/profiles.d.mts +2 -2
- package/dist/profiles.d.mts.map +1 -1
- package/dist/profiles.mjs +1 -1
- package/dist/selectionSwitch.cjs +1 -1
- package/dist/selectionSwitch.d.mts +1 -1
- package/dist/selectionSwitch.mjs +1 -1
- package/dist/{settingsApi-Dr6B6fZj.cjs → settingsApi-C7z-W3wT.cjs} +2 -2
- package/dist/{settingsApi-Dr6B6fZj.cjs.map → settingsApi-C7z-W3wT.cjs.map} +1 -1
- package/dist/{settingsApi-B4kihcFn.mjs → settingsApi-CX-qJEgx.mjs} +2 -2
- package/dist/{settingsApi-B4kihcFn.mjs.map → settingsApi-CX-qJEgx.mjs.map} +1 -1
- package/dist/{sync-8qbJf1Uu.d.mts → sync-CLt-VBdA.d.mts} +2 -2
- package/dist/{sync-8qbJf1Uu.d.mts.map → sync-CLt-VBdA.d.mts.map} +1 -1
- package/package.json +4 -4
- package/dist/index-CIBMaST9.d.mts.map +0 -1
- package/dist/profiles-DwgWBBg6.mjs.map +0 -1
- package/dist/profiles-ILyTd4_d.cjs.map +0 -1
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_settingsApi = require("../settingsApi-
|
|
5
|
+
const require_settingsApi = require("../settingsApi-C7z-W3wT.cjs");
|
|
6
6
|
const require_sessionConfig = require("../sessionConfig-Bm2aUxeM.cjs");
|
|
7
7
|
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
8
8
|
let _agimon_ai_po_core_mcpProjection = require("@agimon-ai/po-core/mcpProjection");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createSettingsApi } from "../settingsApi-
|
|
1
|
+
import { t as createSettingsApi } from "../settingsApi-CX-qJEgx.mjs";
|
|
2
2
|
import { d as providePoConfigContext, o as createNativePoConfigContext } from "../sessionConfig-BZZ6_9Vg.mjs";
|
|
3
3
|
import { BACKGROUND_CONTEXT, requirePoFs, withAbortSignal } from "@agimon-ai/po-core/platform";
|
|
4
4
|
import { PO_MCP_PROJECTION_SERVICE, createDisabledPoMcpProjection, createPoMcpProjectionService, isPoMcpProjection } from "@agimon-ai/po-core/mcpProjection";
|
|
@@ -45,6 +45,8 @@ interface ProfileBrowserBinding {
|
|
|
45
45
|
readonly proxySecret?: string;
|
|
46
46
|
/** Derive timezone and locale from the proxy exit IP. Explicit `timezone` and `locale` win. */
|
|
47
47
|
readonly geoip?: boolean;
|
|
48
|
+
/** Default for CloakBrowser's human-like input behavior. A launch may override it. */
|
|
49
|
+
readonly humanize?: boolean;
|
|
48
50
|
/** IANA timezone, for example `America/Chicago`. */
|
|
49
51
|
readonly timezone?: string;
|
|
50
52
|
/** BCP 47 locale, for example `en-US`. */
|
|
@@ -223,4 +225,4 @@ declare function planGlobalProfileRootAsync(fs: FileSystem, homeDirectory: strin
|
|
|
223
225
|
declare function commitGlobalProfileRootAsync(fs: FileSystem, plan: GlobalProfileRootPlan, context: IoContext): Promise<void>;
|
|
224
226
|
//#endregion
|
|
225
227
|
export { ProfileSecretPurpose as A, inlineProfile as C, ProfileBrowserFingerprint as D, ProfileBrowserBinding as E, ProfileVaultSecretReference as M, ProfileBrowserMode as O, applyProfileEnvironment as S, replaceProfileEnvironment as T, ProfileDiagnostic as _, commitGlobalProfileRootAsync as a, ProfileSettings as b, loadProfileManagementCatalogAsync as c, readPersonaFilesAsync as d, resolveProfileAsync as f, PERSONA_FILES as g, ManagedProfile as h, buildPersonaPromptAsync as i, ProfileSecretReference as j, ProfileIntegrationBinding as k, loadProfilesAsync as l, InlineProfileInput as m, PersonaFileRead as n, listProfileNamesAsync as o, AgentProfile as p, ProfileCatalogChangedError as r, loadProfileCatalogAsync as s, GlobalProfileRootPlan as t, planGlobalProfileRootAsync as u, ProfileManagementCatalog as v, personaPromptHeader as w, ProfileWake as x, ProfileOrigin as y };
|
|
226
|
-
//# sourceMappingURL=index-
|
|
228
|
+
//# sourceMappingURL=index-CeIBIUUY.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CeIBIUUY.d.mts","names":[],"sources":["../src/services/profileBinding/type.ts","../src/services/profiles/core.ts","../src/services/profiles/index.ts"],"mappings":";;;;;KACY;;KAGA;;UAGK;WACN;WACA;;WAEA,mBAAmB;;WAEnB;;WAEA,iBAAiB,SAAS;;;UAIpB;WACN;aAAkB;aAA4B;aAAsB;;WACpE,mBAAmB;WACnB;WACA,iBAAiB,SAAS;;;UAIpB;WACN;;WAEA;;WAEA;;UAGM;;WAEN;WACA;WACA,OAAO;;WAEP;;WAEA;;WAEA;;WAEA;;WAEA;WACA,cAAc;;;UAIR;WACN;WACA;WACA;WACA;WACA,SAAS,SAAS,eAAe;WACjC,UAAU;;;;;cChDR;UAKI;EACf;;EAEA;;;;;EAKA;;EAEA,KAAK;;EAEL,cAAc;;EAEd,UAAU,SAAS,eAAe;;EAElC;;EAEA,WAAW;;EAEX,QAAQ;;EAER;;EAEA;;EAEA,OAAO;;EAEP;;;UA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package/dist/index.cjs
CHANGED
|
@@ -8,10 +8,10 @@ const require_layeredConfig = require("./layeredConfig-BKBQ56-v.cjs");
|
|
|
8
8
|
const require_domains = require("./domains-CCVx5bSY.cjs");
|
|
9
9
|
const require_harnessState = require("./harnessState-BpJcKc7A.cjs");
|
|
10
10
|
const require_harnessStore = require("./harnessStore-CEGS2XsW.cjs");
|
|
11
|
-
const require_settingsApi = require("./settingsApi-
|
|
11
|
+
const require_settingsApi = require("./settingsApi-C7z-W3wT.cjs");
|
|
12
12
|
const require_piConfig = require("./piConfig-cluCie5i.cjs");
|
|
13
13
|
const require_presetConfig = require("./presetConfig-BkOUNRB6.cjs");
|
|
14
|
-
const require_profiles = require("./profiles-
|
|
14
|
+
const require_profiles = require("./profiles-BJrLd2Ri.cjs");
|
|
15
15
|
const require_init = require("./init-Bcoo0dpO.cjs");
|
|
16
16
|
require("./config-zZz80Mh5.cjs");
|
|
17
17
|
const require_sessionConfig = require("./sessionConfig-Bm2aUxeM.cjs");
|
package/dist/index.d.mts
CHANGED
|
@@ -13,8 +13,8 @@ import { _ as HARNESS_STATE_POINTER, a as requireHarnessPaths, b as resetHarness
|
|
|
13
13
|
import { a as loadPiConfigAsync, c as piConfigPaths, d as MIN_IMAGE_MAX_DIMENSION, f as PiImageSettings, h as parsePiImageSettings, i as loadPiConfig, l as piImageSettingsPath, m as clampImageMaxDimension, o as loadPiImageSettings, p as PiImageSettingsUpdate, s as savePiImageSettings, u as DEFAULT_IMAGE_MAX_DIMENSION } from "./index-7RuIAWX1.mjs";
|
|
14
14
|
import { a as GLOBAL_PO_SEED_FILES, c as PO_CONFIG_TEMPLATES, d as RepositoryPoInitResult, i as initializeRepositoryPoConfig, l as REPOSITORY_PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, s as GlobalPoInitResult, u as RepositoryPoInitOptions } from "./index-B2r4kUcO.mjs";
|
|
15
15
|
import { _ as layerEntries, c as LayerPackage, d as PackageNameResolver, f as PresetDefinition, g as isLocalPackageSpecifier, h as ResolvedPackageConfiguration, l as LayerPackageConfig, m as ResolvedLayerDefinition, n as readPackageConfigurations, p as PresetsConfig, s as LayerDefinition, u as LayerResolvers, v as resolveLayers, y as resolvePackageConfigurations } from "./index-CCTIKKkR.mjs";
|
|
16
|
-
import { S as applyProfileEnvironment, T as replaceProfileEnvironment, g as PERSONA_FILES, p as AgentProfile } from "./index-
|
|
17
|
-
import { a as resolveProfile, i as loadProfiles, n as listProfileNames, t as buildPersonaPrompt } from "./sync-
|
|
16
|
+
import { S as applyProfileEnvironment, T as replaceProfileEnvironment, g as PERSONA_FILES, p as AgentProfile } from "./index-CeIBIUUY.mjs";
|
|
17
|
+
import { a as resolveProfile, i as loadProfiles, n as listProfileNames, t as buildPersonaPrompt } from "./sync-CLt-VBdA.mjs";
|
|
18
18
|
import { _ as supersedePoConfigTransition, a as appendPoConfigSelection, c as createPoConfigContextAsync, d as providePoConfigContext, f as readPoConfigContextGeneration, g as requirePoConfigContext, h as replacePoConfigContext, i as acknowledgePoConfigTransition, l as freezePoConfigContext, m as readPoConfigSelection, n as PO_CONFIG_TRANSITION_ENTRY_TYPE, o as appendPoConfigTransition, p as readPoConfigPendingSelection, r as PoConfigSelection, s as createPoConfigContext, t as PO_CONFIG_ENTRY_TYPE } from "./index-CUxIAqIX.mjs";
|
|
19
19
|
import { FileSystem } from "@agimon-ai/po-core/platform";
|
|
20
20
|
import { PoApi } from "@agimon-ai/po-core/packageApi";
|
package/dist/index.mjs
CHANGED
|
@@ -7,10 +7,10 @@ import { o as PO_DIR } from "./layeredConfig-CrNhukCI.mjs";
|
|
|
7
7
|
import { S as MARKETPLACE_MANIFEST_RELATIVE_PATHS, _ as domainCompletionItems, b as findPluginManifestPathAsync, c as loadDomains, d as resolveSharedSkills, k as pluginDirectoryForSource, l as resolvePluginDirectories, s as listDomainNames, u as resolvePluginEntries, v as domainCompletionPrefix, w as isRemotePluginSource, x as findPluginManifestPath, y as expandDomainNames } from "./domains-DJ9UuWe3.mjs";
|
|
8
8
|
import { i as readHarnessState, n as HARNESS_STATE_KEYS, r as projectHarnessEnvironment, t as FILE_ONLY_STATE_FIELDS } from "./harnessState-XYW0Kxrp.mjs";
|
|
9
9
|
import { _ as HARNESS_STATE_POINTER, a as requireHarnessPaths, d as getHarnessState, g as updateHarnessState, h as snapshotHarnessState, l as createHarnessSession, m as restoreHarnessStateSnapshot, o as requireHarnessRoot, r as harnessRoot, u as disposeHarnessState, v as resetHarnessStore } from "./harnessStore-C3slJmA6.mjs";
|
|
10
|
-
import { t as createSettingsApi } from "./settingsApi-
|
|
10
|
+
import { t as createSettingsApi } from "./settingsApi-CX-qJEgx.mjs";
|
|
11
11
|
import { a as loadPiConfigAsync, c as piConfigPaths, d as MIN_IMAGE_MAX_DIMENSION, f as clampImageMaxDimension, i as loadPiConfig, l as piImageSettingsPath, o as loadPiImageSettings, p as parsePiImageSettings, s as savePiImageSettings, u as DEFAULT_IMAGE_MAX_DIMENSION } from "./piConfig-Bq36PQFF.mjs";
|
|
12
12
|
import { c as isLocalPackageSpecifier, d as resolveLayers, f as resolvePackageConfigurations, l as layerEntries, t as readPackageConfigurations } from "./presetConfig-CswBRvp4.mjs";
|
|
13
|
-
import { d as buildPersonaPrompt, f as listProfileNames, g as PERSONA_FILES, h as resolveProfile, m as loadProfiles, v as applyProfileEnvironment, w as replaceProfileEnvironment } from "./profiles-
|
|
13
|
+
import { d as buildPersonaPrompt, f as listProfileNames, g as PERSONA_FILES, h as resolveProfile, m as loadProfiles, v as applyProfileEnvironment, w as replaceProfileEnvironment } from "./profiles-34IRn-nw.mjs";
|
|
14
14
|
import { a as GLOBAL_PO_SEED_FILES, i as initializeRepositoryPoConfig, o as PO_CONFIG_TEMPLATES, r as initializeGlobalPoConfig, s as REPOSITORY_PO_CONFIG_TEMPLATES } from "./init-FN5UTd7_.mjs";
|
|
15
15
|
import { t as PO_CONFIG_SERVICE } from "./config-BBvn_ZLP.mjs";
|
|
16
16
|
import { _ as supersedePoConfigTransition, a as appendPoConfigTransition, c as createPoConfigContextAsync, d as providePoConfigContext, f as readPoConfigContextGeneration, g as requirePoConfigContext, h as replacePoConfigContext, i as appendPoConfigSelection, l as freezePoConfigContext, m as readPoConfigSelection, n as PO_CONFIG_TRANSITION_ENTRY_TYPE, p as readPoConfigPendingSelection, r as acknowledgePoConfigTransition, s as createPoConfigContext, t as PO_CONFIG_ENTRY_TYPE } from "./sessionConfig-BZZ6_9Vg.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"platformRequirements":{},"sourceFiles":["README.md","generated/mcp-ui.ts","generated/mcp.ts","generated/server.ts","llms.txt","locales/vi.json","locales/zh-CN.json","package.json","src/constants/config.ts","src/constants/settings.ts","src/exports/agentPluginMcp.ts","src/exports/apiContracts.ts","src/exports/atomicJson.ts","src/exports/config.ts","src/exports/configSchema.ts","src/exports/configWriter.ts","src/exports/domains.ts","src/exports/harnessState.ts","src/exports/harnessStore.ts","src/exports/index.ts","src/exports/init.ts","src/exports/layeredConfig.ts","src/exports/piConfig.ts","src/exports/piContext.ts","src/exports/presets.ts","src/exports/profiles.ts","src/exports/selectionSwitch.ts","src/exports/sync.ts","src/exports/types.ts","src/extensions/(backend)/api/settings/route.server.ts","src/extensions/workspaces/sessions/(backend)/resource/help-how-to-config.server.ts","src/extensions/workspaces/sessions/(backend)/root.server.ts","src/extensions/workspaces/sessions/(backend)/skill/help-how-to-config.mcp.ts","src/extensions/workspaces/sessions/(backend)/tool/load_context.mcp.ts","src/extensions/workspaces/sessions/(backend)/tool/rename_thread.mcp.ts","src/extensions/workspaces/sessions/(backend)/tool/show_session.mcp.ts","src/extensions/workspaces/sessions/(frontend)/tool/load_context.mcp.tsx","src/extensions/workspaces/sessions/(frontend)/tool/rename_thread.mcp.tsx","src/extensions/workspaces/sessions/(frontend)/tool/show_session.mcp.tsx","src/models/harnessCache.ts","src/prompts/help-how-to-config/SKILL.md","src/prompts/help-how-to-config/agents/openai.yaml","src/prompts/help-how-to-config/references/config-contract.md","src/schemas/apiContracts.ts","src/schemas/mcpContextTools.ts","src/schemas/mcpSessionView.ts","src/services/agentPluginMcp/index.ts","src/services/agentPluginMcp/normalize.ts","src/services/agentPluginMcp/sync.edge.ts","src/services/agentPluginMcp/sync.ts","src/services/atomicJson/format.ts","src/services/atomicJson/index.ts","src/services/atomicJson/sync.edge.ts","src/services/atomicJson/sync.ts","src/services/config/core.ts","src/services/config/index.ts","src/services/config/sync.edge.ts","src/services/config/sync.ts","src/services/configPolicy/index.ts","src/services/configRuntime/index.ts","src/services/configRuntime/type.ts","src/services/configWriter/core.ts","src/services/configWriter/index.ts","src/services/configWriter/sync.edge.ts","src/services/configWriter/sync.ts","src/services/domains/completion.ts","src/services/domains/core.ts","src/services/domains/index.ts","src/services/domains/sync.edge.ts","src/services/domains/sync.ts","src/services/harnessState/index.ts","src/services/harnessStore/core.ts","src/services/harnessStore/index.ts","src/services/harnessStore/sync.edge.ts","src/services/harnessStore/sync.ts","src/services/imageSettings/index.ts","src/services/init/index.ts","src/services/init/sync.edge.ts","src/services/init/sync.ts","src/services/init/templates.ts","src/services/layeredConfig/core.ts","src/services/layeredConfig/index.ts","src/services/layeredConfig/orgActivation.ts","src/services/layeredConfig/sync.edge.ts","src/services/layeredConfig/sync.ts","src/services/mcpContextTools/index.ts","src/services/personaFrontMatter/index.ts","src/services/personaFrontMatter/type.ts","src/services/personaIcon/core.ts","src/services/personaIcon/index.ts","src/services/personaIcon/sync.edge.ts","src/services/personaIcon/sync.ts","src/services/piConfig/core.ts","src/services/piConfig/index.ts","src/services/piConfig/sync.edge.ts","src/services/piConfig/sync.ts","src/services/pluginCatalog/index.ts","src/services/pluginCatalog/parse.ts","src/services/pluginCatalog/sync.edge.ts","src/services/pluginCatalog/sync.ts","src/services/poConfigService/index.ts","src/services/presetConfig/core.ts","src/services/presetConfig/index.ts","src/services/presetConfig/sync.edge.ts","src/services/presetConfig/sync.ts","src/services/presets/index.ts","src/services/profileBinding/index.ts","src/services/profileBinding/type.ts","src/services/profileEdit/index.ts","src/services/profileEdit/type.ts","src/services/profiles/core.ts","src/services/profiles/index.ts","src/services/profiles/sync.edge.ts","src/services/profiles/sync.ts","src/services/selectionSwitch/core.ts","src/services/selectionSwitch/index.ts","src/services/selectionSwitch/sync.edge.ts","src/services/selectionSwitch/sync.ts","src/services/sessionConfig/index.ts","src/services/settings/index.ts","src/services/settingsApi/index.ts","src/services/settingsWire/index.ts","src/types/apiRoutes.ts","src/types/config.ts","src/types/domains.ts","src/types/piConfig.ts","src/types/profiles.ts","src/types/sessionView.ts","src/types/settings.ts","tsdown.config.ts"],"sourceRevision":"
|
|
1
|
+
{"version":1,"platformRequirements":{},"sourceFiles":["README.md","generated/mcp-ui.ts","generated/mcp.ts","generated/server.ts","llms.txt","locales/vi.json","locales/zh-CN.json","package.json","src/constants/config.ts","src/constants/settings.ts","src/exports/agentPluginMcp.ts","src/exports/apiContracts.ts","src/exports/atomicJson.ts","src/exports/config.ts","src/exports/configSchema.ts","src/exports/configWriter.ts","src/exports/domains.ts","src/exports/harnessState.ts","src/exports/harnessStore.ts","src/exports/index.ts","src/exports/init.ts","src/exports/layeredConfig.ts","src/exports/piConfig.ts","src/exports/piContext.ts","src/exports/presets.ts","src/exports/profiles.ts","src/exports/selectionSwitch.ts","src/exports/sync.ts","src/exports/types.ts","src/extensions/(backend)/api/settings/route.server.ts","src/extensions/workspaces/sessions/(backend)/resource/help-how-to-config.server.ts","src/extensions/workspaces/sessions/(backend)/root.server.ts","src/extensions/workspaces/sessions/(backend)/skill/help-how-to-config.mcp.ts","src/extensions/workspaces/sessions/(backend)/tool/load_context.mcp.ts","src/extensions/workspaces/sessions/(backend)/tool/rename_thread.mcp.ts","src/extensions/workspaces/sessions/(backend)/tool/show_session.mcp.ts","src/extensions/workspaces/sessions/(frontend)/tool/load_context.mcp.tsx","src/extensions/workspaces/sessions/(frontend)/tool/rename_thread.mcp.tsx","src/extensions/workspaces/sessions/(frontend)/tool/show_session.mcp.tsx","src/models/harnessCache.ts","src/prompts/help-how-to-config/SKILL.md","src/prompts/help-how-to-config/agents/openai.yaml","src/prompts/help-how-to-config/references/config-contract.md","src/schemas/apiContracts.ts","src/schemas/mcpContextTools.ts","src/schemas/mcpSessionView.ts","src/services/agentPluginMcp/index.ts","src/services/agentPluginMcp/normalize.ts","src/services/agentPluginMcp/sync.edge.ts","src/services/agentPluginMcp/sync.ts","src/services/atomicJson/format.ts","src/services/atomicJson/index.ts","src/services/atomicJson/sync.edge.ts","src/services/atomicJson/sync.ts","src/services/config/core.ts","src/services/config/index.ts","src/services/config/sync.edge.ts","src/services/config/sync.ts","src/services/configPolicy/index.ts","src/services/configRuntime/index.ts","src/services/configRuntime/type.ts","src/services/configWriter/core.ts","src/services/configWriter/index.ts","src/services/configWriter/sync.edge.ts","src/services/configWriter/sync.ts","src/services/domains/completion.ts","src/services/domains/core.ts","src/services/domains/index.ts","src/services/domains/sync.edge.ts","src/services/domains/sync.ts","src/services/harnessState/index.ts","src/services/harnessStore/core.ts","src/services/harnessStore/index.ts","src/services/harnessStore/sync.edge.ts","src/services/harnessStore/sync.ts","src/services/imageSettings/index.ts","src/services/init/index.ts","src/services/init/sync.edge.ts","src/services/init/sync.ts","src/services/init/templates.ts","src/services/layeredConfig/core.ts","src/services/layeredConfig/index.ts","src/services/layeredConfig/orgActivation.ts","src/services/layeredConfig/sync.edge.ts","src/services/layeredConfig/sync.ts","src/services/mcpContextTools/index.ts","src/services/personaFrontMatter/index.ts","src/services/personaFrontMatter/type.ts","src/services/personaIcon/core.ts","src/services/personaIcon/index.ts","src/services/personaIcon/sync.edge.ts","src/services/personaIcon/sync.ts","src/services/piConfig/core.ts","src/services/piConfig/index.ts","src/services/piConfig/sync.edge.ts","src/services/piConfig/sync.ts","src/services/pluginCatalog/index.ts","src/services/pluginCatalog/parse.ts","src/services/pluginCatalog/sync.edge.ts","src/services/pluginCatalog/sync.ts","src/services/poConfigService/index.ts","src/services/presetConfig/core.ts","src/services/presetConfig/index.ts","src/services/presetConfig/sync.edge.ts","src/services/presetConfig/sync.ts","src/services/presets/index.ts","src/services/profileBinding/index.ts","src/services/profileBinding/type.ts","src/services/profileEdit/index.ts","src/services/profileEdit/type.ts","src/services/profiles/core.ts","src/services/profiles/index.ts","src/services/profiles/sync.edge.ts","src/services/profiles/sync.ts","src/services/selectionSwitch/core.ts","src/services/selectionSwitch/index.ts","src/services/selectionSwitch/sync.edge.ts","src/services/selectionSwitch/sync.ts","src/services/sessionConfig/index.ts","src/services/settings/index.ts","src/services/settingsApi/index.ts","src/services/settingsWire/index.ts","src/types/apiRoutes.ts","src/types/config.ts","src/types/domains.ts","src/types/piConfig.ts","src/types/profiles.ts","src/types/sessionView.ts","src/types/settings.ts","tsdown.config.ts"],"sourceRevision":"e29ad53d6f01a20aa9571802ab736355","manifestRevision":"6e953b697f09756ba047d0f2a7be0aec","outputFiles":["README.md","dist/agentPluginMcp.cjs","dist/agentPluginMcp.mjs","dist/apiContracts.cjs","dist/apiContracts.mjs","dist/atomicJson-D3MHqnLW.cjs","dist/atomicJson-Dj3rlZbD.mjs","dist/atomicJson.cjs","dist/atomicJson.mjs","dist/config-BBvn_ZLP.mjs","dist/config-BLG7l_l3.mjs","dist/config-C-X9JHzR.cjs","dist/config-zZz80Mh5.cjs","dist/config.cjs","dist/config.mjs","dist/configSchema.cjs","dist/configSchema.mjs","dist/configWriter-B7Wd7YXY.cjs","dist/configWriter-BoGILUs4.mjs","dist/configWriter.cjs","dist/configWriter.mjs","dist/core-BVKJSk4d.mjs","dist/core-flH758tm.cjs","dist/domains-CCVx5bSY.cjs","dist/domains-DJ9UuWe3.mjs","dist/domains.cjs","dist/domains.mjs","dist/extensions/mcp-ui.mjs","dist/extensions/mcp.cjs","dist/extensions/mcp.mjs","dist/extensions/server.cjs","dist/extensions/server.mjs","dist/harnessState-BpJcKc7A.cjs","dist/harnessState-XYW0Kxrp.mjs","dist/harnessState.cjs","dist/harnessState.mjs","dist/harnessStore-C3slJmA6.mjs","dist/harnessStore-CEGS2XsW.cjs","dist/harnessStore.cjs","dist/harnessStore.mjs","dist/index.cjs","dist/index.mjs","dist/init-Bcoo0dpO.cjs","dist/init-FN5UTd7_.mjs","dist/init.cjs","dist/init.mjs","dist/layeredConfig-BKBQ56-v.cjs","dist/layeredConfig-CrNhukCI.mjs","dist/layeredConfig.cjs","dist/layeredConfig.mjs","dist/piConfig-Bq36PQFF.mjs","dist/piConfig-cluCie5i.cjs","dist/piConfig.cjs","dist/piConfig.mjs","dist/piContext.cjs","dist/piContext.mjs","dist/presetConfig-BkOUNRB6.cjs","dist/presetConfig-CswBRvp4.mjs","dist/presets-BrkK8RXC.cjs","dist/presets-D4EVBv1F.mjs","dist/presets.cjs","dist/presets.mjs","dist/profiles-34IRn-nw.mjs","dist/profiles-BJrLd2Ri.cjs","dist/profiles.cjs","dist/profiles.mjs","dist/rolldown-runtime-VH7oDXx4.cjs","dist/selectionSwitch.cjs","dist/selectionSwitch.mjs","dist/sessionConfig-BZZ6_9Vg.mjs","dist/sessionConfig-Bm2aUxeM.cjs","dist/settingsApi-C7z-W3wT.cjs","dist/settingsApi-CX-qJEgx.mjs","dist/sync-BJ8gCP9s.mjs","dist/sync-Dlxz2msM.cjs","dist/sync.cjs","dist/sync.mjs","dist/types.cjs","dist/types.mjs","llms.txt","locales/vi.json","locales/zh-CN.json","src/prompts/help-how-to-config/SKILL.md","src/prompts/help-how-to-config/agents/openai.yaml","src/prompts/help-how-to-config/references/config-contract.md"],"outputRevision":"da51295b602b17bb875e6a0cb826f889"}
|
|
@@ -374,6 +374,7 @@ const BROWSER_KEYS = /* @__PURE__ */ new Set([
|
|
|
374
374
|
"mode",
|
|
375
375
|
"proxySecret",
|
|
376
376
|
"geoip",
|
|
377
|
+
"humanize",
|
|
377
378
|
"timezone",
|
|
378
379
|
"locale",
|
|
379
380
|
"fingerprint"
|
|
@@ -478,6 +479,7 @@ function browser(value, location) {
|
|
|
478
479
|
if (entry.mode !== void 0 && (typeof entry.mode !== "string" || !BROWSER_MODES.has(entry.mode))) throw new Error(`${location}.mode must be playwright, extension or stealth`);
|
|
479
480
|
if (entry.proxySecret !== void 0 && (typeof entry.proxySecret !== "string" || !ALIAS_PATTERN.test(entry.proxySecret))) throw new Error(`${location}.proxySecret must be an uppercase alias name`);
|
|
480
481
|
if (entry.geoip !== void 0 && typeof entry.geoip !== "boolean") throw new Error(`${location}.geoip must be a boolean`);
|
|
482
|
+
if (entry.humanize !== void 0 && typeof entry.humanize !== "boolean") throw new Error(`${location}.humanize must be a boolean`);
|
|
481
483
|
const pinned = entry.fingerprint === void 0 ? void 0 : fingerprint(entry.fingerprint, `${location}.fingerprint`);
|
|
482
484
|
if (pinned?.required && entry.mode !== void 0 && entry.mode !== "playwright") throw new Error(`${location}.fingerprint.required needs playwright mode`);
|
|
483
485
|
return Object.freeze({
|
|
@@ -486,6 +488,7 @@ function browser(value, location) {
|
|
|
486
488
|
...entry.mode === void 0 ? {} : { mode: entry.mode },
|
|
487
489
|
...entry.proxySecret === void 0 ? {} : { proxySecret: entry.proxySecret },
|
|
488
490
|
...entry.geoip === void 0 ? {} : { geoip: entry.geoip },
|
|
491
|
+
...entry.humanize === void 0 ? {} : { humanize: entry.humanize },
|
|
489
492
|
...entry.timezone === void 0 ? {} : { timezone: timezone(entry.timezone, `${location}.timezone`) },
|
|
490
493
|
...entry.locale === void 0 ? {} : { locale: locale(entry.locale, `${location}.locale`) },
|
|
491
494
|
...pinned === void 0 ? {} : { fingerprint: pinned }
|
|
@@ -1325,4 +1328,4 @@ async function commitGlobalProfileRootAsync(fs, plan, context) {
|
|
|
1325
1328
|
//#endregion
|
|
1326
1329
|
export { editPersonaFrontMatter as A, personaPromptHeader as C, parseProfileVaultSecrets as D, parseProfileBinding as E, readPersonaIconAsync as O, parseProfileSidecar as S, PROFILE_SOCIAL_BROWSER_ORIGINS as T, PROFILE_SIDECAR_FILE as _, loadProfileCatalogAsync as a, parseProfileLayer as b, planGlobalProfileRootAsync as c, buildPersonaPrompt as d, listProfileNames as f, PERSONA_FILES as g, resolveProfile as h, listProfileNamesAsync as i, parsePersonaFrontMatter as j, readPersonaIcon as k, readPersonaFilesAsync as l, loadProfiles as m, buildPersonaPromptAsync as n, loadProfileManagementCatalogAsync as o, loadProfileCatalog as p, commitGlobalProfileRootAsync as r, loadProfilesAsync as s, ProfileCatalogChangedError as t, resolveProfileAsync as u, applyProfileEnvironment as v, replaceProfileEnvironment as w, parseProfileSettings as x, inlineProfile as y };
|
|
1327
1330
|
|
|
1328
|
-
//# sourceMappingURL=profiles-
|
|
1331
|
+
//# sourceMappingURL=profiles-34IRn-nw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles-34IRn-nw.mjs","names":["isRecord","parseYaml","stringifyYaml","PARENT_DIRECTORY","Buffer","parseYaml","stringifyYaml","parseProfile","readPersonaFrontMatter","readPersonaPresentation","containsPersonaFile","readSidecar","discoverProfile","discoverProfileRoot","readProfileLayers","profilesFromLayers"],"sources":["../src/services/personaFrontMatter/index.ts","../src/services/personaIcon/core.ts","../src/services/personaIcon/sync.ts","../src/services/personaIcon/index.ts","../src/services/profileBinding/index.ts","../src/services/profiles/core.ts","../src/services/profiles/sync.ts","../src/services/profiles/index.ts"],"sourcesContent":["import {\n type Document,\n type YAMLMap,\n isMap,\n isScalar,\n parseDocument,\n parse as parseYaml,\n stringify as stringifyYaml,\n} from 'yaml';\n\nimport type { PersonaDocument, PersonaFrontMatter, PersonaVoiceOverride } from '../../types/profiles';\nimport type { PersonaIdentityEdit } from './type';\n\n/**\n * Optional identity a persona declares at the top of its `profile.md`.\n *\n * A profile used to be prompt text only, so there was nowhere to say who the\n * persona is or how it should sound. Front-matter puts that beside the persona\n * text it describes, which is the only place that works for both explicit\n * `profiles.yaml` entries and folders found by root discovery.\n *\n * Recognition is deliberately narrow. Personas that exist today were written\n * without any of this, and one of them may legitimately open with a horizontal\n * rule, so a leading fence alone is not enough to claim the block. A block is\n * only treated as identity when it is fenced at the very first line, closed,\n * parses as a mapping, and declares at least one field this contract owns.\n * Anything else is passed through byte for byte.\n */\n\nconst FENCE = '---';\nconst OWNED_KEYS = ['name', 'icon', 'role', 'voice'] as const;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction readVoice(value: unknown): PersonaVoiceOverride | undefined {\n if (!isRecord(value)) return undefined;\n const voice = typeof value.voice === 'string' && value.voice.trim().length > 0 ? value.voice.trim() : undefined;\n const rate = typeof value.rate === 'number' && Number.isFinite(value.rate) ? value.rate : undefined;\n if (voice === undefined && rate === undefined) return undefined;\n return { ...(voice === undefined ? {} : { voice }), ...(rate === undefined ? {} : { rate }) };\n}\n\nfunction readText(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;\n}\n\nfunction readFrontMatter(parsed: Record<string, unknown>): PersonaFrontMatter | undefined {\n const name = readText(parsed.name);\n const icon = readText(parsed.icon);\n const role = readText(parsed.role);\n const voice = readVoice(parsed.voice);\n if (name === undefined && icon === undefined && role === undefined && voice === undefined) return undefined;\n return {\n ...(name === undefined ? {} : { name }),\n ...(icon === undefined ? {} : { icon }),\n ...(role === undefined ? {} : { role }),\n ...(voice === undefined ? {} : { voice }),\n };\n}\n\n/**\n * Splits a recognised identity block off a persona document.\n *\n * Never throws: a malformed avatar must not make a persona unloadable, so an\n * unparseable or unrecognised block leaves the document exactly as it arrived.\n */\nexport function parsePersonaFrontMatter(content: string): PersonaDocument {\n const lines = content.split('\\n');\n if (lines[0]?.trimEnd() !== FENCE) return { body: content };\n\n const closingIndex = lines.findIndex((line, index) => index > 0 && line.trimEnd() === FENCE);\n if (closingIndex === -1) return { body: content };\n\n let parsed: unknown;\n try {\n parsed = parseYaml(lines.slice(1, closingIndex).join('\\n'));\n } catch {\n return { body: content };\n }\n if (!isRecord(parsed)) return { body: content };\n if (!OWNED_KEYS.some((key) => Object.hasOwn(parsed, key))) return { body: content };\n\n const frontMatter = readFrontMatter(parsed);\n if (!frontMatter) return { body: content };\n return { frontMatter, body: lines.slice(closingIndex + 1).join('\\n') };\n}\n\nconst MAX_NAME_LENGTH = 80;\n/** The bounds the config policy puts on a spoken voice, so a persona cannot hold a voice the config would refuse. */\nconst MAX_VOICE_LENGTH = 64;\nconst MIN_VOICE_RATE = 80;\nconst MAX_VOICE_RATE = 500;\n/** Any control character, newlines and tabs included: names and ids are one visible line. */\nconst CONTROL_CHARACTER = /\\p{Cc}/u;\n/** Long text stays on one line and `[a, b]` keeps its spacing, so only the edited lines differ. */\nconst YAML_OUTPUT = { lineWidth: 0, flowCollectionPadding: false } as const;\nconst CRLF = '\\r\\n';\nconst LF = '\\n';\nconst VOICE_KEYS = ['voice', 'rate'] as const;\n/** A line that opens an identity key, used to tell a broken identity block from prose that happens to be fenced. */\nconst OWNED_KEY_LINE = /^(?:name|icon|role|voice)\\s*:/mu;\n\ninterface FenceBlock {\n /** Offset of the first line after the opening fence. */\n readonly bodyStart: number;\n /** Offset of the closing fence line. */\n readonly closingStart: number;\n /** Offset of the first line after the closing fence, where the persona text begins. */\n readonly closingEnd: number;\n}\n\n/** Finds a leading fenced block the way `parsePersonaFrontMatter` does, keeping offsets so the rest stays byte for byte. */\nfunction findFence(content: string): FenceBlock | undefined {\n let offset = 0;\n let bodyStart = 0;\n for (let index = 0; ; index += 1) {\n const newline = content.indexOf(LF, offset);\n const next = newline === -1 ? content.length : newline + 1;\n const line = content.slice(offset, newline === -1 ? content.length : newline).trimEnd();\n if (index === 0) {\n if (line !== FENCE) return undefined;\n bodyStart = next;\n } else if (line === FENCE) {\n return { bodyStart, closingStart: offset, closingEnd: next };\n }\n if (newline === -1) return undefined;\n offset = next;\n }\n}\n\nfunction hasControlCharacter(value: string): boolean {\n return CONTROL_CHARACTER.test(value);\n}\n\nfunction editedName(value: string): string {\n const name = value.trim();\n if (name.length === 0 || name.length > MAX_NAME_LENGTH || hasControlCharacter(name)) {\n throw new Error(`A persona name must be one line of 1 to ${MAX_NAME_LENGTH} characters`);\n }\n return name;\n}\n\n/** The voice to write, or null when the override is empty and should be removed. */\nfunction editedVoice(value: PersonaVoiceOverride): PersonaVoiceOverride | null {\n if (Object.keys(value).some((key) => !VOICE_KEYS.some((allowed) => allowed === key))) {\n throw new Error('A persona voice can only set voice and rate');\n }\n const voice = value.voice?.trim();\n if (value.voice !== undefined && (!voice || voice.length > MAX_VOICE_LENGTH || hasControlCharacter(voice))) {\n throw new Error(`A persona voice must be one line of 1 to ${MAX_VOICE_LENGTH} characters`);\n }\n if (\n value.rate !== undefined &&\n (!Number.isInteger(value.rate) || value.rate < MIN_VOICE_RATE || value.rate > MAX_VOICE_RATE)\n ) {\n throw new Error(`A persona voice rate must be a whole number from ${MIN_VOICE_RATE} to ${MAX_VOICE_RATE}`);\n }\n if (voice === undefined && value.rate === undefined) return null;\n return { ...(voice === undefined ? {} : { voice }), ...(value.rate === undefined ? {} : { rate: value.rate }) };\n}\n\nfunction expectedFrontMatter(\n prior: PersonaFrontMatter | undefined,\n name: string | null | undefined,\n voice: PersonaVoiceOverride | null | undefined,\n): PersonaFrontMatter | undefined {\n const next: PersonaFrontMatter = { ...prior };\n if (name === null) delete next.name;\n else if (name !== undefined) next.name = name;\n if (voice === null) delete next.voice;\n else if (voice !== undefined) next.voice = voice;\n return Object.keys(next).length === 0 ? undefined : next;\n}\n\nfunction sameFrontMatter(left: PersonaFrontMatter | undefined, right: PersonaFrontMatter | undefined): boolean {\n return (\n left?.name === right?.name &&\n left?.icon === right?.icon &&\n left?.role === right?.role &&\n left?.voice?.voice === right?.voice?.voice &&\n left?.voice?.rate === right?.voice?.rate\n );\n}\n\n/** Replaces a scalar in place, so a comment beside the old value stays with the key. */\nfunction setScalar(mapping: YAMLMap, key: string, value: string | number): void {\n const node = mapping.get(key, true);\n if (isScalar(node)) node.value = value;\n else mapping.set(key, value);\n}\n\nfunction setVoice(document: Document, mapping: YAMLMap, voice: PersonaVoiceOverride): void {\n const current = mapping.get('voice', true);\n if (!isMap(current)) {\n mapping.set('voice', document.createNode(voice));\n return;\n }\n for (const key of VOICE_KEYS) {\n const value = voice[key];\n if (value === undefined) current.delete(key);\n else setScalar(current, key, value);\n }\n}\n\nfunction withEndOfLine(text: string, eol: string): string {\n const converted = eol === CRLF ? text.replace(/\\n/gu, CRLF) : text;\n return converted.endsWith(eol) ? converted : `${converted}${eol}`;\n}\n\n/** A new identity block in front of text that has none. Undefined when there is nothing to declare. */\nfunction prependedBlock(\n content: string,\n name: string | null | undefined,\n voice: PersonaVoiceOverride | null | undefined,\n eol: string,\n): string | undefined {\n const fields: Record<string, unknown> = {};\n if (typeof name === 'string') fields.name = name;\n if (voice) fields.voice = voice;\n if (Object.keys(fields).length === 0) return undefined;\n return `${FENCE}${eol}${withEndOfLine(stringifyYaml(fields, YAML_OUTPUT), eol)}${FENCE}${eol}${content}`;\n}\n\nfunction rewrittenBlock(\n content: string,\n fence: FenceBlock,\n document: Document,\n mapping: YAMLMap,\n edit: { name: string | null | undefined; voice: PersonaVoiceOverride | null | undefined },\n eol: string,\n): string {\n if (edit.name === null) mapping.delete('name');\n else if (edit.name !== undefined) setScalar(mapping, 'name', edit.name);\n if (edit.voice === null) {\n const current = mapping.get('voice', true);\n if (isMap(current)) {\n for (const key of VOICE_KEYS) current.delete(key);\n if (current.items.length === 0) mapping.delete('voice');\n } else mapping.delete('voice');\n } else if (edit.voice !== undefined) setVoice(document, mapping, edit.voice);\n\n if (!OWNED_KEYS.some((key) => mapping.has(key))) {\n // A block with no identity key is no longer one, so its leftovers would become persona text.\n if (mapping.items.length > 0)\n throw new Error('Removing these fields would leave a front-matter block that is not an identity block');\n return content.slice(fence.closingEnd);\n }\n const block = withEndOfLine(document.toString(YAML_OUTPUT), eol);\n return `${content.slice(0, fence.bodyStart)}${block}${content.slice(fence.closingStart)}`;\n}\n\n/**\n * Changes the name and voice a persona declares in `profile.md`, returning the next file text, or undefined when it\n * would not change. The persona text after the block, `icon`, `role`, unknown keys and comments are kept, and\n * text without an identity block gets a new one in front, leaving whatever it opened with exactly as it was.\n *\n * Refuses, rather than guesses, when the text opens with a fenced block that names an identity key but does not\n * read as an identity block (broken YAML, repeated keys), when removing fields would leave an unrecognised block,\n * and when the result would not read back as the requested identity over the same persona text.\n *\n * The caller still owns whether the profile keeps persona text: a `profile.md` holding only an identity block\n * leaves the persona empty unless `SOUL.md` or `AGENTS.md` supplies it.\n */\nexport function editPersonaFrontMatter(content: string, edit: PersonaIdentityEdit): string | undefined {\n if (Object.keys(edit).some((key) => key !== 'name' && key !== 'voice')) {\n throw new Error('Only the name and voice of a persona can be edited');\n }\n const name = edit.name === undefined || edit.name === null ? edit.name : editedName(edit.name);\n const voice = edit.voice === undefined || edit.voice === null ? edit.voice : editedVoice(edit.voice);\n const firstBreak = content.indexOf(LF);\n const eol = firstBreak > 0 && content[firstBreak - 1] === '\\r' ? CRLF : LF;\n\n const fence = findFence(content);\n const raw = fence === undefined ? undefined : content.slice(fence.bodyStart, fence.closingStart);\n const document = raw === undefined ? undefined : parseDocument(raw);\n const mapping = document && document.errors.length === 0 && isMap(document.contents) ? document.contents : undefined;\n if (raw !== undefined && mapping === undefined && OWNED_KEY_LINE.test(raw)) {\n throw new Error('The persona opens with a front-matter block that cannot be read, so it was not edited');\n }\n\n const prior = parsePersonaFrontMatter(content);\n const expected = expectedFrontMatter(prior.frontMatter, name, voice);\n if (sameFrontMatter(prior.frontMatter, expected)) return undefined;\n\n const identityBlock =\n fence !== undefined &&\n document !== undefined &&\n mapping !== undefined &&\n OWNED_KEYS.some((key) => mapping.has(key));\n const output =\n identityBlock && fence && document && mapping\n ? rewrittenBlock(content, fence, document, mapping, { name, voice }, eol)\n : prependedBlock(content, name, voice, eol);\n if (output === undefined || output === content) return undefined;\n\n const parsed = parsePersonaFrontMatter(output);\n if (parsed.body !== prior.body || !sameFrontMatter(parsed.frontMatter, expected)) {\n throw new Error('The persona front-matter could not be edited without changing something else');\n }\n return output;\n}\n","import { Buffer } from 'node:buffer';\nimport path from 'node:path';\n\nimport { PROFILE_ICON_MAX_DATA_URL_LENGTH, type ProfileIconMimeType } from '@agimon-ai/po-core/profileIdentity';\n\n/**\n * Pure half of persona icon loading: confinement and image sniffing. The\n * readers in `index.ts` (async, over a FileSystem) and `sync.ts` (Node shim)\n * only resolve paths and fetch bytes.\n */\nconst PARENT_DIRECTORY = '..';\n\n/**\n * Magic-byte signatures, checked instead of trusting the filename.\n *\n * `image/svg+xml` is absent on purpose: an SVG rendered same-origin executes\n * script, and the author of this path is whoever wrote the persona. Do not add\n * it to match the cockpit's broader media catalog.\n */\nconst SIGNATURES: readonly { readonly mime: ProfileIconMimeType; readonly test: (bytes: Buffer) => boolean }[] = [\n {\n mime: 'image/png',\n test: (b) => b.length > 8 && b.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10])),\n },\n { mime: 'image/jpeg', test: (b) => b.length > 3 && b[0] === 0xff && b[1] === 0xd8 && b[2] === 0xff },\n { mime: 'image/gif', test: (b) => b.length > 6 && b.subarray(0, 6).toString('latin1').startsWith('GIF8') },\n {\n mime: 'image/webp',\n test: (b) =>\n b.length > 12 &&\n b.subarray(0, 4).toString('latin1') === 'RIFF' &&\n b.subarray(8, 12).toString('latin1') === 'WEBP',\n },\n];\n\n/** True when `realIconPath` lies inside `realPersonaPath` (both already canonical). */\nexport function isInsidePersona(realPersonaPath: string, realIconPath: string): boolean {\n const relative = path.relative(realPersonaPath, realIconPath);\n return !(\n relative === PARENT_DIRECTORY ||\n relative.startsWith(`${PARENT_DIRECTORY}${path.sep}`) ||\n path.isAbsolute(relative)\n );\n}\n\n/** A bounded `data:` URL for an allowed image, or undefined. */\nexport function iconDataUrl(content: Uint8Array): string | undefined {\n const bytes = Buffer.from(content.buffer, content.byteOffset, content.byteLength);\n const mime = SIGNATURES.find((signature) => signature.test(bytes))?.mime;\n if (!mime) return undefined;\n const dataUrl = `data:${mime};base64,${bytes.toString('base64')}`;\n return dataUrl.length > PROFILE_ICON_MAX_DATA_URL_LENGTH ? undefined : dataUrl;\n}\n","// sync: Preserve the exported Node-only readPersonaIcon signature until phase 2.\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { iconDataUrl, isInsidePersona } from './core';\n\n/**\n * Resolves an icon declared in persona front-matter, or undefined when it is\n * missing, unreadable, not an allowed image, escapes the persona directory, or\n * exceeds the data-URL ceiling.\n *\n * @deprecated Node-only sync shim; use readPersonaIconAsync. Removed in M2.\n */\nexport function readPersonaIcon(personaPath: string, iconRelative: string): string | undefined {\n if (path.isAbsolute(iconRelative)) return undefined;\n\n try {\n const realPersonaPath = fs.realpathSync(personaPath);\n const iconPath = path.resolve(realPersonaPath, iconRelative);\n if (!fs.existsSync(iconPath)) return undefined;\n\n const realIconPath = fs.realpathSync(iconPath);\n if (!isInsidePersona(realPersonaPath, realIconPath)) return undefined;\n if (!fs.statSync(realIconPath).isFile()) return undefined;\n\n return iconDataUrl(fs.readFileSync(realIconPath));\n } catch {\n return undefined;\n }\n}\n","import path from 'node:path';\n\nimport { getOrThrow, type FileSystem } from '@agimon-ai/po-core/platform';\n\nimport { iconDataUrl, isInsidePersona } from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\n/**\n * Reads a persona icon into a bounded `data:` URL.\n *\n * The icon travels inside the journalled identity entry rather than through an\n * HTTP route. A route would leave a request-time filesystem resolution reachable\n * from the browser for the life of a session, defended on every request forever;\n * this resolves the path once, server side, at the moment the profile loads.\n *\n * The path comes from user-authored front-matter, so it is confined the same way\n * `buildPersonaPrompt` confines persona files: a symlink must not read outside\n * the persona directory.\n *\n * Every failure is silent and returns undefined. An avatar is decoration, and a\n * broken one must never stop a persona from loading. That includes a host whose\n * filesystem lacks the persona entirely, such as the edge.\n */\nexport async function readPersonaIconAsync(\n fs: FileSystem,\n personaPath: string,\n iconRelative: string,\n context: IoContext,\n): Promise<string | undefined> {\n if (path.isAbsolute(iconRelative)) return undefined;\n\n try {\n const realPersonaPath = getOrThrow(await fs.canonicalPath(personaPath, context));\n const iconPath = path.resolve(realPersonaPath, iconRelative);\n if (!getOrThrow(await fs.exists(iconPath, context))) return undefined;\n\n const realIconPath = getOrThrow(await fs.canonicalPath(iconPath, context));\n if (!isInsidePersona(realPersonaPath, realIconPath)) return undefined;\n if (getOrThrow(await fs.fileInfo(realIconPath, context)).kind !== 'file') return undefined;\n\n return iconDataUrl(getOrThrow(await fs.readBinaryFile(realIconPath, context)));\n } catch {\n return undefined;\n }\n}\n\nexport { readPersonaIcon } from './sync';\n","import type {\n ProfileBrowserBinding,\n ProfileBrowserFingerprint,\n ProfileBrowserMode,\n ProfileIntegrationBinding,\n ProfileSecretPurpose,\n ProfileSecretReference,\n ProfileVaultSecretReference,\n} from './type';\n\nconst BINDING_KEYS = new Set(['provider', 'organizationId', 'mailboxId', 'credentialRef', 'secrets', 'browser']);\nconst SECRET_KEYS = new Set(['credentialId', 'field', 'purposes', 'allowedOrigins', 'allowedTargets']);\nconst VAULT_SECRET_KEYS = new Set(['vault', 'purposes', 'allowedOrigins', 'allowedTargets']);\nconst BROWSER_KEYS = new Set([\n 'profileName',\n 'allowedOrigins',\n 'mode',\n 'proxySecret',\n 'geoip',\n 'humanize',\n 'timezone',\n 'locale',\n 'fingerprint',\n]);\nconst FINGERPRINT_KEYS = new Set(['platform', 'seed', 'required']);\nconst PURPOSES: ReadonlySet<string> = new Set<ProfileSecretPurpose>(['browser', 'proxy', 'env', 'input']);\nconst BROWSER_MODES: ReadonlySet<string> = new Set<ProfileBrowserMode>(['playwright', 'extension', 'stealth']);\nconst ALIAS_PATTERN = /^[A-Z][A-Z0-9_]{0,63}$/;\nconst FIELD_PATTERN = /^(?:[A-Za-z][A-Za-z0-9_.-]{0,63}|profileSecret:[A-Z][A-Z0-9_]{0,63})$/;\nconst BROWSER_PROFILE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;\n\n/** Browser-level defaults only. Every alias still requires its own exact recipient origins. */\nexport const PROFILE_SOCIAL_BROWSER_ORIGINS = Object.freeze([\n 'https://x.com',\n 'https://www.x.com',\n 'https://twitter.com',\n 'https://www.twitter.com',\n 'https://reddit.com',\n 'https://www.reddit.com',\n 'https://linkedin.com',\n 'https://www.linkedin.com',\n 'https://facebook.com',\n 'https://www.facebook.com',\n 'https://instagram.com',\n 'https://www.instagram.com',\n 'https://tiktok.com',\n 'https://www.tiktok.com',\n 'https://youtube.com',\n 'https://www.youtube.com',\n 'https://accounts.google.com',\n]);\nfunction record(value: unknown, location: string, keys?: ReadonlySet<string>): Record<string, unknown> {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new Error(`${location} must be a mapping`);\n }\n if (keys && Object.keys(value).some((key) => !keys.has(key))) {\n // Never echo an unknown key or value, either of which might contain a misplaced secret.\n throw new Error(`${location} contains unsupported metadata`);\n }\n return value as Record<string, unknown>;\n}\n\nfunction reference(value: unknown, location: string): string {\n if (typeof value !== 'string' || value.length === 0 || value.length > 256 || /\\s/.test(value)) {\n throw new Error(`${location} must be a non-empty reference without whitespace`);\n }\n return value;\n}\n\nfunction origins(value: unknown, location: string): readonly string[] {\n if (!Array.isArray(value) || value.length === 0) throw new Error(`${location} must contain exact HTTP(S) origins`);\n const result = value.map((entry: unknown) => {\n if (typeof entry !== 'string') throw new Error(`${location} must contain exact HTTP(S) origins`);\n let url: URL;\n try {\n url = new URL(entry);\n } catch {\n throw new Error(`${location} must contain exact HTTP(S) origins`);\n }\n if (\n (url.protocol !== 'https:' && url.protocol !== 'http:') ||\n url.origin !== entry ||\n url.username ||\n url.password\n ) {\n throw new Error(`${location} must contain exact HTTP(S) origins`);\n }\n return entry;\n });\n return Object.freeze([...new Set(result)]);\n}\n\nfunction purposes(value: unknown, location: string): readonly ProfileSecretPurpose[] {\n if (value === undefined) return Object.freeze(['browser'] as const);\n if (\n !Array.isArray(value) ||\n value.length === 0 ||\n value.some((entry: unknown) => typeof entry !== 'string' || !PURPOSES.has(entry)) ||\n new Set(value).size !== value.length\n ) {\n throw new Error(`${location} must list distinct purposes: browser, proxy, env or input`);\n }\n return Object.freeze([...(value as ProfileSecretPurpose[])]);\n}\n\nfunction timezone(value: unknown, location: string): string {\n try {\n if (typeof value === 'string' && value.length <= 64) {\n new Intl.DateTimeFormat('en-US', { timeZone: value });\n return value;\n }\n } catch {}\n throw new Error(`${location} must be an IANA timezone`);\n}\n\nfunction locale(value: unknown, location: string): string {\n try {\n if (typeof value === 'string' && value.length <= 35 && Intl.getCanonicalLocales(value).length === 1) return value;\n } catch {}\n throw new Error(`${location} must be a BCP 47 locale`);\n}\n\nfunction fingerprint(value: unknown, location: string): ProfileBrowserFingerprint {\n const entry = record(value, location, FINGERPRINT_KEYS);\n if (entry.platform !== undefined && entry.platform !== 'windows' && entry.platform !== 'macos') {\n throw new Error(`${location}.platform must be windows or macos`);\n }\n if (\n entry.seed !== undefined &&\n (typeof entry.seed !== 'number' || !Number.isInteger(entry.seed) || entry.seed < 10000 || entry.seed > 99999)\n ) {\n throw new Error(`${location}.seed must be an integer from 10000 to 99999`);\n }\n if (entry.required !== undefined && typeof entry.required !== 'boolean') {\n throw new Error(`${location}.required must be a boolean`);\n }\n return Object.freeze({\n ...(entry.platform === undefined ? {} : { platform: entry.platform as 'windows' | 'macos' }),\n ...(entry.seed === undefined ? {} : { seed: entry.seed }),\n ...(entry.required === undefined ? {} : { required: entry.required }),\n });\n}\n\nfunction browser(value: unknown, location: string): ProfileBrowserBinding {\n const entry = record(value, location, BROWSER_KEYS);\n if (typeof entry.profileName !== 'string' || !BROWSER_PROFILE_PATTERN.test(entry.profileName)) {\n throw new Error(`${location}.profileName must be a safe browser profile name`);\n }\n if (entry.mode !== undefined && (typeof entry.mode !== 'string' || !BROWSER_MODES.has(entry.mode))) {\n throw new Error(`${location}.mode must be playwright, extension or stealth`);\n }\n if (\n entry.proxySecret !== undefined &&\n (typeof entry.proxySecret !== 'string' || !ALIAS_PATTERN.test(entry.proxySecret))\n ) {\n throw new Error(`${location}.proxySecret must be an uppercase alias name`);\n }\n if (entry.geoip !== undefined && typeof entry.geoip !== 'boolean') {\n throw new Error(`${location}.geoip must be a boolean`);\n }\n if (entry.humanize !== undefined && typeof entry.humanize !== 'boolean') {\n throw new Error(`${location}.humanize must be a boolean`);\n }\n const pinned =\n entry.fingerprint === undefined ? undefined : fingerprint(entry.fingerprint, `${location}.fingerprint`);\n if (pinned?.required && entry.mode !== undefined && entry.mode !== 'playwright') {\n throw new Error(`${location}.fingerprint.required needs playwright mode`);\n }\n return Object.freeze({\n profileName: entry.profileName,\n allowedOrigins: Object.freeze([\n ...new Set([...origins(entry.allowedOrigins, `${location}.allowedOrigins`), ...PROFILE_SOCIAL_BROWSER_ORIGINS]),\n ]),\n ...(entry.mode === undefined ? {} : { mode: entry.mode as ProfileBrowserMode }),\n ...(entry.proxySecret === undefined ? {} : { proxySecret: entry.proxySecret }),\n ...(entry.geoip === undefined ? {} : { geoip: entry.geoip }),\n ...(entry.humanize === undefined ? {} : { humanize: entry.humanize }),\n ...(entry.timezone === undefined ? {} : { timezone: timezone(entry.timezone, `${location}.timezone`) }),\n ...(entry.locale === undefined ? {} : { locale: locale(entry.locale, `${location}.locale`) }),\n ...(pinned === undefined ? {} : { fingerprint: pinned }),\n });\n}\n\nfunction targets(\n value: unknown,\n forInput: boolean,\n location: string,\n): Readonly<Record<string, readonly string[]>> | undefined {\n if (value === undefined) {\n if (forInput) throw new Error(`${location} requires explicit input targets`);\n return undefined;\n }\n if (!forInput) throw new Error(`${location} requires the input purpose`);\n const entries = record(value, location);\n if (Object.keys(entries).length === 0) throw new Error(`${location} requires explicit input targets`);\n const result: Record<string, readonly string[]> = Object.create(null);\n for (const [surface, list] of Object.entries(entries)) {\n if (\n !/^[a-z][a-z0-9-]{0,63}$/.test(surface) ||\n ['browser', 'env', 'proxy', 'constructor', 'prototype'].includes(surface) ||\n !Array.isArray(list) ||\n list.length === 0 ||\n list.some((entry: unknown) => typeof entry !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_.-]{0,255}$/.test(entry))\n ) {\n throw new Error(`${location} must map surfaces to exact application identifiers`);\n }\n result[surface] = Object.freeze([...new Set(list as string[])]);\n }\n return Object.freeze(result);\n}\n\nfunction delivery(secret: Record<string, unknown>, location: string) {\n const secretPurposes = purposes(secret.purposes, `${location}.purposes`);\n const forBrowser = secretPurposes.includes('browser');\n const emptyOrigins = Array.isArray(secret.allowedOrigins) && secret.allowedOrigins.length === 0;\n if (!forBrowser && secret.allowedOrigins !== undefined && !emptyOrigins) {\n throw new Error(`${location}.allowedOrigins requires the browser purpose`);\n }\n const allowedTargets = targets(secret.allowedTargets, secretPurposes.includes('input'), `${location}.allowedTargets`);\n return {\n purposes: secretPurposes,\n allowedOrigins: forBrowser\n ? origins(secret.allowedOrigins, `${location}.allowedOrigins`)\n : Object.freeze([] as string[]),\n ...(allowedTargets === undefined ? {} : { allowedTargets }),\n };\n}\n\n/** Explicit vault aliases only. Templates never name a namespace or key themselves. */\nexport function parseProfileVaultSecrets(\n value: unknown,\n location = 'Profile secrets',\n): Readonly<Record<string, ProfileVaultSecretReference>> {\n const result: Record<string, ProfileVaultSecretReference> = Object.create(null);\n for (const [alias, valueEntry] of Object.entries(record(value, location))) {\n if (!ALIAS_PATTERN.test(alias)) throw new Error(`${location} requires uppercase alias names`);\n const secret = record(valueEntry, location, VAULT_SECRET_KEYS);\n const vault = record(secret.vault, `${location}.vault`, new Set(['namespace', 'key', 'field']));\n if (\n typeof vault.namespace !== 'string' ||\n !/^[a-z][a-z0-9.-]{0,63}$/.test(vault.namespace) ||\n typeof vault.key !== 'string' ||\n vault.key.length < 1 ||\n vault.key.length > 512 ||\n /\\p{Cc}/u.test(vault.key)\n ) {\n throw new Error(`${location}.vault requires a valid namespace and key`);\n }\n const field = vault.field === undefined ? undefined : reference(vault.field, `${location}.vault.field`);\n if (\n field !== undefined &&\n (['__proto__', 'prototype', 'constructor'].includes(field) || !FIELD_PATTERN.test(field))\n ) {\n throw new Error(`${location}.vault.field must be an own string field name`);\n }\n const scope = delivery(secret, location);\n if (scope.purposes.some((purpose) => purpose !== 'browser' && purpose !== 'input')) {\n throw new Error(`${location} vault aliases support browser and input purposes only`);\n }\n result[alias] = Object.freeze({\n vault: Object.freeze({\n namespace: vault.namespace,\n key: vault.key,\n ...(field === undefined ? {} : { field }),\n }),\n ...scope,\n });\n }\n return Object.freeze(result);\n}\n\n/** Validates and deeply freezes a detached metadata snapshot. No provider SDK or secret is loaded. */\nexport function parseProfileBinding(value: unknown, location = 'Profile integration'): ProfileIntegrationBinding {\n const entry = record(value, location, BINDING_KEYS);\n const sourceSecrets = record(entry.secrets, `${location}.secrets`);\n const secrets: Record<string, ProfileSecretReference> = {};\n for (const [alias, value] of Object.entries(sourceSecrets)) {\n if (!ALIAS_PATTERN.test(alias)) throw new Error(`${location}.secrets requires uppercase alias names`);\n const secret = record(value, `${location}.secrets.${alias}`, SECRET_KEYS);\n if (typeof secret.field !== 'string' || !FIELD_PATTERN.test(secret.field)) {\n throw new Error(`${location}.secrets.${alias}.field must be a credential field name`);\n }\n secrets[alias] = Object.freeze({\n credentialId: reference(secret.credentialId, `${location}.secrets.${alias}.credentialId`),\n field: secret.field,\n ...delivery(secret, `${location}.secrets.${alias}`),\n });\n }\n const browserBinding = entry.browser === undefined ? undefined : browser(entry.browser, `${location}.browser`);\n if (\n browserBinding &&\n Object.values(secrets).some((secret) =>\n secret.allowedOrigins.some((origin) => !browserBinding.allowedOrigins.includes(origin)),\n )\n ) {\n throw new Error(`${location} secret origins must be included in browser.allowedOrigins`);\n }\n if (browserBinding?.proxySecret !== undefined && !secrets[browserBinding.proxySecret]?.purposes.includes('proxy')) {\n throw new Error(`${location}.browser.proxySecret must name a proxy-purpose secret`);\n }\n return Object.freeze({\n provider: reference(entry.provider, `${location}.provider`),\n organizationId: reference(entry.organizationId, `${location}.organizationId`),\n mailboxId: reference(entry.mailboxId, `${location}.mailboxId`),\n credentialRef: reference(entry.credentialRef, `${location}.credentialRef`),\n secrets: Object.freeze(secrets),\n ...(browserBinding === undefined ? {} : { browser: browserBinding }),\n });\n}\n","import path from 'node:path';\n\nimport { isTimeZone } from '@agimon-ai/po-core/personTimeZone';\nimport { PROFILE_ICON_MAX_DATA_URL_LENGTH, PROFILE_ICON_MIME_TYPES } from '@agimon-ai/po-core/profileIdentity';\nimport { YAMLMap, isMap, isSeq, parseDocument, parse as parseYaml, stringify as stringifyYaml } from 'yaml';\n\nimport type { PersonaFrontMatter, PersonaIdentity, PersonaVoiceOverride } from '../../types/profiles';\nimport { parsePersonaFrontMatter } from '../personaFrontMatter';\nimport { parseProfileBinding, parseProfileVaultSecrets } from '../profileBinding';\nimport type { ProfileIntegrationBinding, ProfileVaultSecretReference } from '../profileBinding/type';\n\n/** Files that make up one repository persona, concatenated in this order. */\nexport const PERSONA_FILES = ['profile.md', 'SOUL.md', 'AGENTS.md'];\n\n/** The persona file that may carry an identity block; the others are prose only. */\nexport const PERSONA_IDENTITY_FILE = 'profile.md';\n\nexport interface AgentProfile {\n name: string;\n /** Directory relative to personaRoot, which remains the persona source. */\n persona: string;\n /**\n * Root the persona path resolves against: the repository root for a\n * repository profile, the global `.po` directory for a global one.\n */\n personaRoot: string;\n /** Environment defaults. Values already exported by the caller win. */\n env: Record<string, string>;\n /** Nonsecret integration metadata. Resolved secrets never enter profile environment. */\n integration?: ProfileIntegrationBinding;\n /** Explicit, scoped vault aliases. No resolved values. */\n secrets?: Readonly<Record<string, ProfileVaultSecretReference>>;\n /** The person's IANA zone, such as `Australia/Sydney`. It wins over the zone of the device they write from. */\n timezone?: string;\n /** Display name, avatar and role declared in the persona's own front-matter, plus a source's contact. */\n identity?: PersonaIdentity;\n /** Narrowly scoped TTS override declared alongside the identity. */\n voice?: PersonaVoiceOverride;\n /** Preset the profile starts a session with. Validated by shape only; the launch checks it against the catalog. */\n preset?: string;\n /** Domains the profile starts a session with. Validated by shape only. */\n domains?: string[];\n /** Proactive wake settings. Nothing is injected when absent. */\n wake?: ProfileWake;\n /** Persona prompt for a profile served from memory; directory profiles build theirs from disk. */\n personaPrompt?: string;\n}\n\n/** Canonical wake settings: the period is milliseconds, parsed from a string like `30m`, `6h` or `1d`. */\nexport interface ProfileWake {\n periodMs: number;\n prompt?: string;\n}\n\n/** The settings shared by explicit entries, sidecars and inline profiles. */\nexport type ProfileSettings = Pick<AgentProfile, 'preset' | 'domains' | 'wake'>;\n\n/** A profile contributed from memory, validated with the directory profile rules. */\nexport interface InlineProfileInput {\n name: string;\n /** Stable origin label, shown in place of a persona directory. */\n source: string;\n /** Persona file text keyed by file name; only PERSONA_FILES are read. */\n files: Readonly<Record<string, string>>;\n env?: unknown;\n integration?: unknown;\n secrets?: unknown;\n /** IANA zone name; checked like a directory profile's `timezone`. */\n timezone?: unknown;\n preset?: unknown;\n domains?: unknown;\n /** `{ period: '6h', prompt?: string }`; the period is bounded to 15m..7d. */\n wake?: unknown;\n /** Display-only address shown under the profile's name, such as the mailbox it sends from. Never a secret. */\n contact?: string;\n /** The source's avatar as a `data:` URL of an allowed image type; anything else is dropped. */\n icon?: string;\n}\n\nexport interface ProfileConfigLayer {\n filePath: string;\n baseDirectory: string;\n roots: string[];\n entries: Record<string, unknown>;\n defaultProfile?: string;\n}\n\n/** An explicit entry that passed shape checks, before its persona is read from disk. */\nexport interface ProfileEntryDraft {\n name: string;\n persona: string;\n personaPath: string;\n /** Allowed roots that lexically contain the persona; the caller confirms one after resolving links. */\n lexicalRoots: string[];\n value: Record<string, unknown>;\n}\n\nexport type PersonaPresentation = { identity?: PersonaIdentity; voice?: PersonaVoiceOverride };\n\n/** A discovered profile that was skipped. Messages name keys and files, never values. */\nexport interface ProfileDiagnostic {\n filePath: string;\n profile: string;\n message: string;\n}\n\n/**\n * Where a winning profile was declared. Server-side only: `declaringFile` is a path and never leaves the host.\n * `layer` is `personal` for Po's home and `repository` for the repository's `.po`.\n */\nexport interface ProfileOrigin {\n layer: 'personal' | 'repository';\n /** `discovered` from a configured root, `explicit` from a `profiles.yaml` entry. */\n kind: 'discovered' | 'explicit';\n /** The profiles.yaml that lists the entry, or the discovery root. */\n declaringFile: string;\n}\n\n/** A catalog winner with the origin it came from. */\nexport interface ManagedProfile {\n profile: AgentProfile;\n origin: ProfileOrigin;\n}\n\n/** The file catalog with provenance, the winning default and each layer's own declared default. */\nexport interface ProfileManagementCatalog {\n profiles: ManagedProfile[];\n /** The personal profiles.yaml, which may not exist yet. Server-side only: it is a path. */\n personalFile: string;\n /** The winning default, as `loadProfileCatalogAsync` reports it. Repository replaces personal. */\n defaultProfile?: string;\n layerDefaults: { personal?: string; repository?: string };\n diagnostics?: ProfileDiagnostic[];\n}\n\nexport type ProfileSidecar = Pick<\n AgentProfile,\n 'env' | 'integration' | 'secrets' | 'timezone' | 'preset' | 'domains' | 'wake'\n>;\n\nconst PROFILE_KEYS = new Set(['persona', 'env', 'integration', 'secrets', 'timezone', 'preset', 'domains', 'wake']);\nconst PROFILE_CATALOG_KEYS = new Set(['roots', 'entries', 'defaultProfile']);\nconst SIDECAR_KEYS = new Set(['version', 'env', 'integration', 'secrets', 'timezone', 'preset', 'domains', 'wake']);\nconst SIDECAR_VERSION = 1;\nconst SIDECAR_MAX_BYTES = 64 * 1024;\nexport const PROFILES_FILE = 'profiles.yaml';\n/** Optional nonsecret sidecar beside a discovered persona, validated like an explicit entry. */\nexport const PROFILE_SIDECAR_FILE = 'profile.yaml';\nconst PROFILES_ROOT_KEY = 'profiles';\nconst AGENTS_DIRECTORY = 'agents';\nexport const PARENT_DIRECTORY = '..';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function isPathInside(root: string, candidate: string): boolean {\n const relative = path.relative(root, candidate);\n return (\n relative === '' ||\n (!path.isAbsolute(relative) &&\n relative !== PARENT_DIRECTORY &&\n !relative.startsWith(`${PARENT_DIRECTORY}${path.sep}`))\n );\n}\n\nfunction parseEnvironment(name: string, value: unknown): Record<string, string> {\n if (value === undefined) return {};\n if (!isRecord(value)) throw new Error(`Profile \"${name}\" env must be a string mapping`);\n\n const environment: Record<string, string> = {};\n for (const [key, entry] of Object.entries(value)) {\n if (typeof entry !== 'string') throw new Error(`Profile \"${name}\" env.${key} must be a string`);\n if (/\\$\\{\\s*secrets?\\b|\\{\\{\\s*secrets?\\b/.test(entry)) {\n throw new Error(`Profile \"${name}\" env cannot contain secret aliases`);\n }\n environment[key] = entry;\n }\n return environment;\n}\n\n/** The profile's own zone, spread into the profile only when declared. */\nfunction parseTimezone(name: string, value: unknown): { timezone?: string } {\n if (value === undefined) return {};\n if (!isTimeZone(value)) throw new Error(`Profile \"${name}\" timezone must be an IANA zone such as Australia/Sydney`);\n return { timezone: value };\n}\nconst NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u;\nconst MAX_DOMAINS = 32;\n// `fallbackModel` shipped once; old files still load and the key is ignored. The wake planner model is host-wide.\nconst WAKE_KEYS = new Set(['period', 'prompt', 'fallbackModel']);\nconst WAKE_PERIOD_PATTERN = /^([1-9][0-9]{0,4})([mhd])$/u;\nconst WAKE_UNIT_MS = { m: 60_000, h: 3_600_000, d: 86_400_000 } as const;\nexport const WAKE_MIN_PERIOD_MS = 15 * WAKE_UNIT_MS.m;\nexport const WAKE_MAX_PERIOD_MS = 7 * WAKE_UNIT_MS.d;\nconst WAKE_PROMPT_MAX_LENGTH = 4000;\n\n/** Preset, domains and wake, spread into the profile only when declared. */\nexport function parseProfileSettings(\n name: string,\n value: { preset?: unknown; domains?: unknown; wake?: unknown },\n): ProfileSettings {\n const settings: ProfileSettings = {};\n if (value.preset !== undefined) {\n if (typeof value.preset !== 'string' || !NAME_PATTERN.test(value.preset.trim())) {\n throw new Error(`Profile \"${name}\" preset must be a preset name`);\n }\n settings.preset = value.preset.trim();\n }\n if (value.domains !== undefined) {\n const domains = value.domains;\n if (\n !Array.isArray(domains) ||\n domains.length > MAX_DOMAINS ||\n domains.some((entry) => typeof entry !== 'string' || !NAME_PATTERN.test(entry.trim()))\n ) {\n throw new Error(`Profile \"${name}\" domains must be an array of up to ${MAX_DOMAINS} domain names`);\n }\n settings.domains = [...new Set((domains as string[]).map((entry) => entry.trim()))];\n }\n if (value.wake !== undefined) settings.wake = parseWake(name, value.wake);\n return settings;\n}\n\nfunction parseWake(name: string, value: unknown): ProfileWake {\n if (!isRecord(value) || Object.keys(value).some((key) => !WAKE_KEYS.has(key))) {\n throw new Error(`Profile \"${name}\" wake may only set period and prompt`);\n }\n const match = typeof value.period === 'string' ? WAKE_PERIOD_PATTERN.exec(value.period.trim()) : null;\n const periodMs = match ? Number(match[1]) * WAKE_UNIT_MS[match[2] as keyof typeof WAKE_UNIT_MS] : Number.NaN;\n if (!(periodMs >= WAKE_MIN_PERIOD_MS && periodMs <= WAKE_MAX_PERIOD_MS)) {\n throw new Error(`Profile \"${name}\" wake.period must be between 15m and 7d, such as 30m, 6h or 1d`);\n }\n const wake: ProfileWake = { periodMs };\n if (value.prompt !== undefined) {\n if (\n typeof value.prompt !== 'string' ||\n value.prompt.trim().length === 0 ||\n value.prompt.length > WAKE_PROMPT_MAX_LENGTH\n ) {\n throw new Error(\n `Profile \"${name}\" wake.prompt must be a non-empty string of at most ${WAKE_PROMPT_MAX_LENGTH} characters`,\n );\n }\n wake.prompt = value.prompt.trim();\n }\n return wake;\n}\n\n/** Strict v1 sidecar parse. YAML errors are reported generically so source text never reaches a diagnostic. */\nexport function parseProfileSidecar(name: string, text: string): ProfileSidecar {\n if (Buffer.byteLength(text) > SIDECAR_MAX_BYTES)\n throw new Error(`Profile \"${name}\" ${PROFILE_SIDECAR_FILE} is too large`);\n let document: unknown;\n try {\n document = parseYaml(text);\n } catch {\n throw new Error(`Profile \"${name}\" ${PROFILE_SIDECAR_FILE} is not valid YAML`);\n }\n if (!isRecord(document)) throw new Error(`Profile \"${name}\" ${PROFILE_SIDECAR_FILE} must be a mapping`);\n if (Object.keys(document).some((key) => !SIDECAR_KEYS.has(key))) {\n throw new Error(\n `Profile \"${name}\" ${PROFILE_SIDECAR_FILE} may only set version, env, integration, secrets, timezone, preset, domains and wake`,\n );\n }\n if (document.version !== SIDECAR_VERSION) {\n throw new Error(`Profile \"${name}\" ${PROFILE_SIDECAR_FILE} must declare version: ${SIDECAR_VERSION}`);\n }\n return {\n env: parseEnvironment(name, document.env),\n ...(document.secrets === undefined ? {} : { secrets: parseProfileVaultSecrets(document.secrets) }),\n ...(document.integration === undefined\n ? {}\n : { integration: parseProfileBinding(document.integration, `Profile \"${name}\" integration`) }),\n ...parseTimezone(name, document.timezone),\n ...parseProfileSettings(name, document),\n };\n}\n\nexport function sidecarDiagnostic(filePath: string, profile: string, error: unknown): ProfileDiagnostic {\n return { filePath, profile, message: error instanceof Error ? error.message : `Profile \"${profile}\" is invalid` };\n}\nfunction parseProfileRoots(value: unknown, filePath: string, baseDirectory: string): string[] {\n if (value === undefined) return [];\n if (!Array.isArray(value)) throw new Error(`profiles.roots in ${filePath} must be an array`);\n return value.map((entry, index) => {\n if (typeof entry !== 'string' || entry.trim().length === 0) {\n throw new Error(`profiles.roots[${index}] in ${filePath} must be a non-empty string`);\n }\n return path.resolve(baseDirectory, entry.trim());\n });\n}\n\nexport function parseProfileLayer(source: {\n filePath: string;\n baseDirectory: string;\n document: unknown;\n}): ProfileConfigLayer {\n if (!isRecord(source.document) || !isRecord(source.document[PROFILES_ROOT_KEY])) {\n throw new Error(`${source.filePath} must contain a profiles mapping`);\n }\n const unsupportedDocumentKeys = Object.keys(source.document).filter((key) => key !== PROFILES_ROOT_KEY);\n if (unsupportedDocumentKeys.length > 0) {\n throw new Error(`${source.filePath} may only contain profiles; unsupported: ${unsupportedDocumentKeys.join(', ')}`);\n }\n\n const profiles = source.document[PROFILES_ROOT_KEY];\n const usesCatalogShape = Object.hasOwn(profiles, 'roots') || Object.hasOwn(profiles, 'entries');\n if (!usesCatalogShape) {\n return { filePath: source.filePath, baseDirectory: source.baseDirectory, roots: [], entries: profiles };\n }\n\n const unsupportedCatalogKeys = Object.keys(profiles).filter((key) => !PROFILE_CATALOG_KEYS.has(key));\n if (unsupportedCatalogKeys.length > 0) {\n throw new Error(\n `profiles in ${source.filePath} may only contain roots, entries and defaultProfile; unsupported: ${unsupportedCatalogKeys.join(', ')}`,\n );\n }\n if (\n profiles.defaultProfile !== undefined &&\n (typeof profiles.defaultProfile !== 'string' || profiles.defaultProfile.trim().length === 0)\n ) {\n throw new Error(`profiles.defaultProfile in ${source.filePath} must be a non-empty string`);\n }\n if (profiles.entries !== undefined && !isRecord(profiles.entries)) {\n throw new Error(`profiles.entries in ${source.filePath} must be a mapping`);\n }\n return {\n filePath: source.filePath,\n baseDirectory: source.baseDirectory,\n roots: parseProfileRoots(profiles.roots, source.filePath, source.baseDirectory),\n entries: profiles.entries ?? {},\n ...(profiles.defaultProfile === undefined ? {} : { defaultProfile: String(profiles.defaultProfile).trim() }),\n };\n}\n\n/**\n * The profiles.yaml text that also lists `root` in `profiles.roots`, or undefined when it already does.\n * Comments and every other key are kept, a flat-form file moves under `entries`, and `defaultProfile` is never set.\n */\nexport function withProfileRoot(\n text: string,\n filePath: string,\n baseDirectory: string,\n root: string,\n): string | undefined {\n const document = parseDocument(text);\n if (document.errors.length > 0) throw new Error(`${filePath} is not valid YAML`);\n const current: unknown = document.toJS();\n if (current === null || current === undefined) return stringifyYaml({ [PROFILES_ROOT_KEY]: { roots: [root] } });\n const layer = parseProfileLayer({ filePath, baseDirectory, document: current });\n if (layer.roots.includes(path.resolve(baseDirectory, root))) return undefined;\n const profiles = document.get(PROFILES_ROOT_KEY, true);\n if (!isMap(profiles)) throw new Error(`${filePath} must contain a profiles mapping`);\n const roots = profiles.get('roots', true);\n if (isSeq(roots)) roots.add(document.createNode(root));\n else if (profiles.has('entries') || profiles.items.length === 0) profiles.set('roots', document.createNode([root]));\n else {\n const catalog = new YAMLMap<string, unknown>();\n catalog.set('roots', document.createNode([root]));\n catalog.set('entries', profiles);\n document.set(PROFILES_ROOT_KEY, catalog);\n }\n const output = document.toString();\n parseProfileLayer({ filePath, baseDirectory, document: parseYaml(output) });\n return output;\n}\n\n/**\n * Shape checks for one explicit entry. The caller checks the persona on disk,\n * then `profileFromDraft` parses env and integration, keeping the error order.\n */\nexport function draftProfileEntry(\n personaRoot: string,\n configuredRoots: readonly string[],\n name: string,\n value: unknown,\n): ProfileEntryDraft {\n if (!isRecord(value)) throw new Error(`Profile \"${name}\" must be a mapping`);\n\n const unsupported = Object.keys(value).filter((key) => !PROFILE_KEYS.has(key));\n if (unsupported.length > 0) {\n throw new Error(\n `Profile \"${name}\" may only set persona, env, integration, secrets, timezone, preset, domains or wake; unsupported metadata`,\n );\n }\n if (typeof value.persona !== 'string' || value.persona.trim().length === 0) {\n throw new Error(`Profile \"${name}\" must set a persona`);\n }\n if (path.isAbsolute(value.persona)) {\n throw new Error(`Profile \"${name}\" persona must be relative to the config that declares it`);\n }\n\n const persona = value.persona;\n const personaPath = path.resolve(personaRoot, persona);\n const lexicalRoots = [path.resolve(personaRoot, AGENTS_DIRECTORY), ...configuredRoots].filter((root) =>\n isPathInside(root, personaPath),\n );\n if (lexicalRoots.length === 0) throw outsideAllowedRoot(name);\n return {\n name,\n persona,\n personaPath,\n lexicalRoots,\n value,\n };\n}\n\nexport function outsideAllowedRoot(name: string): Error {\n return new Error(`Profile \"${name}\" persona must stay inside agents/ or a configured profile root`);\n}\n\nexport function missingPersona(name: string, persona: string): Error {\n return new Error(`Profile \"${name}\" references a missing persona: ${persona}`);\n}\n\n/**\n * An identity block is not persona text, so a profile.md holding nothing else\n * leaves the persona empty. Say that, rather than claiming the file is unreadable.\n */\nexport function emptyPersona(name: string, persona: string, declaresIdentity: boolean): Error {\n return new Error(\n declaresIdentity\n ? `Profile \"${name}\" persona declares identity front-matter but no persona text: ${persona}`\n : `Profile \"${name}\" persona has no readable persona files: ${persona}`,\n );\n}\n\nexport function profileFromDraft(\n draft: ProfileEntryDraft,\n personaRoot: string,\n presentation: PersonaPresentation,\n): AgentProfile {\n const { name, value } = draft;\n return {\n name,\n persona: draft.persona,\n personaRoot,\n env: parseEnvironment(name, value.env),\n ...(value.secrets === undefined ? {} : { secrets: parseProfileVaultSecrets(value.secrets) }),\n ...(value.integration === undefined\n ? {}\n : { integration: parseProfileBinding(value.integration, `Profile \"${name}\" integration`) }),\n ...parseTimezone(name, value.timezone),\n ...parseProfileSettings(name, value),\n ...presentation,\n };\n}\n\nexport function presentationFrom(frontMatter: PersonaFrontMatter, icon: string | undefined): PersonaPresentation {\n const identity: PersonaIdentity = {\n ...(frontMatter.name === undefined ? {} : { name: frontMatter.name }),\n ...(icon === undefined ? {} : { icon }),\n ...(frontMatter.role === undefined ? {} : { role: frontMatter.role }),\n };\n return {\n ...(Object.keys(identity).length === 0 ? {} : { identity }),\n ...(frontMatter.voice === undefined ? {} : { voice: frontMatter.voice }),\n };\n}\n\n/** Rejects a persona file whose real path left the persona directory. */\nexport function assertPersonaFileInside(\n personaPath: string,\n realFilePath: string,\n personaDirectory: string,\n file: string,\n): void {\n const relativeFilePath = path.relative(personaPath, realFilePath);\n if (relativeFilePath === PARENT_DIRECTORY || relativeFilePath.startsWith(`${PARENT_DIRECTORY}${path.sep}`)) {\n throw new Error(`Persona file must stay inside ${personaDirectory}: ${file}`);\n }\n}\n\n/** The text one persona file contributes. Only profile.md may declare identity, so only profile.md is stripped. */\nexport function personaFileSection(file: string, raw: string): string {\n return (file === PERSONA_IDENTITY_FILE ? parsePersonaFrontMatter(raw).body : raw).trim();\n}\n\n/** The first line of every persona prompt. A reader that shows the persona text strips exactly this line. */\nexport function personaPromptHeader(personaDirectory: string): string {\n return `[PERSONA] You are operating as the person described below (source: ${personaDirectory}).`;\n}\n\nexport function personaPromptFromSections(personaDirectory: string, sections: readonly string[]): string | undefined {\n if (sections.length === 0) return undefined;\n return [personaPromptHeader(personaDirectory), ...sections].join('\\n\\n');\n}\n\n/** A source's avatar, kept only as a bounded base64 `data:` URL of a persona icon type, so SVG never passes. */\nfunction sourceIcon(value: unknown): string | undefined {\n if (typeof value !== 'string' || value.length > PROFILE_ICON_MAX_DATA_URL_LENGTH) return undefined;\n const mime = /^data:([a-z]+\\/[a-z]+);base64,[A-Za-z0-9+/]+={0,2}$/.exec(value)?.[1];\n return mime !== undefined && (PROFILE_ICON_MIME_TYPES as readonly string[]).includes(mime) ? value : undefined;\n}\n\n/** Builds a profile from in-memory persona text. Nothing is read from disk; only the source can supply an icon. */\nexport function inlineProfile(input: InlineProfileInput): AgentProfile {\n const { name, source, files } = input;\n const read = (file: string): string | undefined => (Object.hasOwn(files, file) ? files[file] : undefined);\n const sections = PERSONA_FILES.flatMap((file) => {\n const raw = read(file);\n const section = raw === undefined ? '' : personaFileSection(file, raw);\n return section ? [section] : [];\n });\n const identityText = read(PERSONA_IDENTITY_FILE);\n const frontMatter = identityText === undefined ? undefined : parsePersonaFrontMatter(identityText).frontMatter;\n const personaPrompt = personaPromptFromSections(source, sections);\n if (!personaPrompt) throw emptyPersona(name, source, frontMatter !== undefined);\n const presentation = frontMatter === undefined ? {} : presentationFrom(frontMatter, undefined);\n const contact = typeof input.contact === 'string' ? input.contact.trim() || undefined : undefined;\n const icon = sourceIcon(input.icon);\n const identity = {\n ...presentation.identity,\n ...(icon === undefined ? {} : { icon }),\n ...(contact === undefined ? {} : { contact }),\n };\n return {\n name,\n persona: source,\n personaRoot: '',\n env: parseEnvironment(name, input.env),\n ...(input.secrets === undefined ? {} : { secrets: parseProfileVaultSecrets(input.secrets) }),\n ...(input.integration === undefined\n ? {}\n : { integration: parseProfileBinding(input.integration, `Profile \"${name}\" integration`) }),\n ...parseTimezone(name, input.timezone),\n ...parseProfileSettings(name, input),\n ...presentation,\n ...(Object.keys(identity).length === 0 ? {} : { identity }),\n personaPrompt,\n };\n}\n\nexport function sortProfiles(byName: Map<string, AgentProfile>): AgentProfile[] {\n return [...byName.values()].sort((left, right) => left.name.localeCompare(right.name));\n}\n\n/**\n * A repository declaration replaces a personal one.\n *\n * The name is a request, not a file-catalog reference: a plugin may contribute the\n * profile after this loader runs, so membership is checked by the launch against the\n * merged catalog. Malformed declarations are already rejected by `parseProfileLayer`.\n */\nexport function catalogDefaultProfile(layers: readonly ProfileConfigLayer[]): string | undefined {\n let defaultProfile: string | undefined;\n for (const layer of layers) {\n if (layer.defaultProfile !== undefined) defaultProfile = layer.defaultProfile;\n }\n return defaultProfile;\n}\n\n/** Applies profile environment defaults and returns only the values it contributed. */\nexport function applyProfileEnvironment(\n environment: NodeJS.ProcessEnv,\n defaults: Record<string, string>,\n): Record<string, string> {\n const applied: Record<string, string> = {};\n for (const [key, value] of Object.entries(defaults)) {\n if (environment[key] !== undefined) continue;\n environment[key] = value;\n applied[key] = value;\n }\n return applied;\n}\n\n/** Replaces environment defaults previously contributed by another profile. */\nexport function replaceProfileEnvironment(\n environment: NodeJS.ProcessEnv,\n previous: Record<string, string>,\n next: Record<string, string>,\n): Record<string, string> {\n for (const [key, value] of Object.entries(previous)) {\n if (environment[key] === value) delete environment[key];\n }\n return applyProfileEnvironment(environment, next);\n}\n","// sync: These helpers implement exported Node-only synchronous profile and persona APIs.\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport type { PersonaFrontMatter } from '../../types/profiles';\nimport { readPoConfigSources } from '../layeredConfig';\nimport { parsePersonaFrontMatter } from '../personaFrontMatter';\nimport { readPersonaIcon } from '../personaIcon';\nimport {\n PERSONA_FILES,\n PERSONA_IDENTITY_FILE,\n PROFILE_SIDECAR_FILE,\n PROFILES_FILE,\n assertPersonaFileInside,\n catalogDefaultProfile,\n draftProfileEntry,\n emptyPersona,\n isPathInside,\n missingPersona,\n outsideAllowedRoot,\n parseProfileLayer,\n parseProfileSidecar,\n personaFileSection,\n personaPromptFromSections,\n presentationFrom,\n profileFromDraft,\n sidecarDiagnostic,\n sortProfiles,\n type AgentProfile,\n type PersonaPresentation,\n type ProfileConfigLayer,\n type ProfileDiagnostic,\n type ProfileSidecar,\n} from './core';\n\nconst TEXT_ENCODING = 'utf8';\n\nfunction parseProfile(\n personaRoot: string,\n configuredRoots: readonly string[],\n name: string,\n value: unknown,\n): AgentProfile {\n const draft = draftProfileEntry(personaRoot, configuredRoots, name, value);\n if (!fs.existsSync(draft.personaPath) || !fs.statSync(draft.personaPath).isDirectory()) {\n throw missingPersona(name, draft.persona);\n }\n const realPersonaPath = fs.realpathSync(draft.personaPath);\n if (!draft.lexicalRoots.some((root) => isPathInside(fs.realpathSync(root), realPersonaPath))) {\n throw outsideAllowedRoot(name);\n }\n if (!buildPersonaPrompt(personaRoot, draft.persona)) {\n throw emptyPersona(name, draft.persona, readPersonaFrontMatter(personaRoot, draft.persona) !== undefined);\n }\n return profileFromDraft(draft, personaRoot, readPersonaPresentation(personaRoot, draft.persona));\n}\n\nfunction containsPersonaFile(directory: string): boolean {\n return PERSONA_FILES.some((file) => {\n try {\n return fs.lstatSync(path.join(directory, file)).isFile();\n } catch {\n return false;\n }\n });\n}\n\n/** Reads the optional sidecar, which must be a regular file whose real path stays in the persona directory. */\nfunction readSidecar(name: string, realDirectory: string): ProfileSidecar {\n const filePath = path.join(realDirectory, PROFILE_SIDECAR_FILE);\n if (!fs.existsSync(filePath)) return { env: {} };\n const realFilePath = fs.realpathSync(filePath);\n if (!isPathInside(realDirectory, realFilePath) || !fs.statSync(realFilePath).isFile()) {\n throw new Error(`Profile \"${name}\" ${PROFILE_SIDECAR_FILE} must be a file inside the persona directory`);\n }\n return parseProfileSidecar(name, fs.readFileSync(realFilePath, TEXT_ENCODING));\n}\n\nfunction discoverProfile(\n directory: string,\n configuredRoot: string,\n personaRoot: string,\n diagnostics: ProfileDiagnostic[],\n): AgentProfile | undefined {\n if (!containsPersonaFile(directory)) return undefined;\n const name = path.basename(directory);\n try {\n const realConfiguredRoot = fs.realpathSync(configuredRoot);\n const realDirectory = fs.realpathSync(directory);\n if (!isPathInside(realConfiguredRoot, realDirectory)) return undefined;\n const persona = path.relative(personaRoot, directory) || '.';\n if (!buildPersonaPrompt(personaRoot, persona)) return undefined;\n let sidecar: ProfileSidecar;\n try {\n sidecar = readSidecar(name, realDirectory);\n } catch (error) {\n // A bad sidecar skips only this profile, visibly, rather than failing the catalog.\n diagnostics.push(sidecarDiagnostic(path.join(directory, PROFILE_SIDECAR_FILE), name, error));\n return undefined;\n }\n return {\n name,\n persona,\n personaRoot,\n ...sidecar,\n ...readPersonaPresentation(personaRoot, persona),\n };\n } catch {\n // Automatic discovery ignores unreadable or unsafe candidates; explicit entries remain fatal.\n return undefined;\n }\n}\n\nfunction discoverProfileRoot(root: string, personaRoot: string, diagnostics: ProfileDiagnostic[]): AgentProfile[] {\n if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) {\n throw new Error(`Configured profile root is not a directory: ${root}`);\n }\n\n const rootProfile = discoverProfile(root, root, personaRoot, diagnostics);\n if (rootProfile) return [rootProfile];\n\n return fs\n .readdirSync(root, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .sort((left, right) => left.name.localeCompare(right.name))\n .flatMap((entry) => {\n const profile = discoverProfile(path.join(root, entry.name), root, personaRoot, diagnostics);\n return profile ? [profile] : [];\n });\n}\n\nfunction readProfileLayers(\n repoRoot: string,\n homeDirectory: string,\n environment?: Readonly<Record<string, string | undefined>>,\n): ProfileConfigLayer[] {\n return readPoConfigSources<unknown>(PROFILES_FILE, repoRoot, homeDirectory, environment).map(parseProfileLayer);\n}\n\nfunction profilesFromLayers(\n layers: readonly ProfileConfigLayer[],\n diagnostics: ProfileDiagnostic[] = [],\n): AgentProfile[] {\n const byName = new Map<string, AgentProfile>();\n for (const layer of layers) {\n for (const root of layer.roots) {\n for (const profile of discoverProfileRoot(root, layer.baseDirectory, diagnostics)) {\n byName.set(profile.name, profile);\n }\n }\n }\n for (const layer of layers) {\n for (const [name, value] of Object.entries(layer.entries)) {\n byName.set(name, parseProfile(layer.baseDirectory, layer.roots, name, value));\n }\n }\n return sortProfiles(byName);\n}\n\n/**\n * Loads profiles from the global and repository configs, repository last.\n *\n * Configured roots accumulate and inspect themselves or their direct-child\n * directories for persona files. Later discoveries replace earlier names, and\n * explicit entries replace discoveries. Legacy flat profile mappings remain\n * accepted as explicit entries.\n *\n * @deprecated Node-only sync shim; use loadProfilesAsync. Removed in M2.\n */\nexport function loadProfiles(\n repoRoot: string,\n homeDirectory: string = os.homedir(),\n environment?: Readonly<Record<string, string | undefined>>,\n): AgentProfile[] {\n return profilesFromLayers(readProfileLayers(repoRoot, homeDirectory, environment));\n}\n\n/**\n * The profile catalog: every resolved profile, plus the name a launch starts on\n * when the caller names none.\n *\n * `defaultProfile` mirrors `defaultPreset` in presets.yaml and `defaultDomains`\n * in domains.yaml, so each selection axis declares its default in its own\n * catalog. A repository declaration replaces a personal one. The name is a\n * request that need not be a file profile, because a plugin may contribute it;\n * the launch resolves it against the merged catalog and warns when it is absent.\n *\n * @deprecated Node-only sync shim; use loadProfileCatalogAsync. Removed in M2.\n */\nexport function loadProfileCatalog(\n repoRoot: string,\n homeDirectory: string = os.homedir(),\n environment?: Readonly<Record<string, string | undefined>>,\n): { profiles: AgentProfile[]; defaultProfile?: string; diagnostics?: ProfileDiagnostic[] } {\n const layers = readProfileLayers(repoRoot, homeDirectory, environment);\n const diagnostics: ProfileDiagnostic[] = [];\n const profiles = profilesFromLayers(layers, diagnostics);\n const defaultProfile = catalogDefaultProfile(layers);\n return {\n profiles,\n ...(defaultProfile === undefined ? {} : { defaultProfile }),\n ...(diagnostics.length === 0 ? {} : { diagnostics }),\n };\n}\n\n/**\n * Resolves one selected profile and fails clearly when its name is unknown.\n *\n * @deprecated Node-only sync shim; use resolveProfileAsync. Removed in M2.\n */\nexport function resolveProfile(\n repoRoot: string,\n name: string,\n homeDirectory?: string,\n environment?: Readonly<Record<string, string | undefined>>,\n): AgentProfile {\n const profile = loadProfiles(repoRoot, homeDirectory, environment).find((candidate) => candidate.name === name);\n if (!profile) throw new Error(`Unknown profile: ${name}`);\n return profile;\n}\n\n/** @deprecated Node-only sync shim; use listProfileNamesAsync. Removed in M2. */\nexport function listProfileNames(\n repoRoot: string,\n homeDirectory?: string,\n environment?: Readonly<Record<string, string | undefined>>,\n): string[] {\n return loadProfiles(repoRoot, homeDirectory, environment).map((profile) => profile.name);\n}\n\nfunction readPersonaPresentation(personaRoot: string, personaDirectory: string): PersonaPresentation {\n const frontMatter = readPersonaFrontMatter(personaRoot, personaDirectory);\n if (!frontMatter) return {};\n const icon =\n frontMatter.icon === undefined\n ? undefined\n : readPersonaIcon(path.join(personaRoot, personaDirectory), frontMatter.icon);\n return presentationFrom(frontMatter, icon);\n}\n\nfunction readPersonaFrontMatter(personaRoot: string, personaDirectory: string): PersonaFrontMatter | undefined {\n try {\n const personaPath = fs.realpathSync(path.join(personaRoot, personaDirectory));\n const filePath = path.join(personaPath, PERSONA_IDENTITY_FILE);\n if (!fs.existsSync(filePath)) return undefined;\n return parsePersonaFrontMatter(fs.readFileSync(fs.realpathSync(filePath), TEXT_ENCODING)).frontMatter;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Builds the persona system-prompt block, or undefined when nothing is readable.\n *\n * @deprecated Node-only sync shim; use buildPersonaPromptAsync. Removed in M2.\n */\nexport function buildPersonaPrompt(personaRoot: string, personaDirectory: string): string | undefined {\n const sections: string[] = [];\n const personaPath = fs.realpathSync(path.join(personaRoot, personaDirectory));\n for (const file of PERSONA_FILES) {\n const filePath = path.join(personaPath, file);\n if (!fs.existsSync(filePath)) continue;\n const realFilePath = fs.realpathSync(filePath);\n assertPersonaFileInside(personaPath, realFilePath, personaDirectory, file);\n const content = personaFileSection(file, fs.readFileSync(realFilePath, TEXT_ENCODING));\n if (content) sections.push(content);\n }\n return personaPromptFromSections(personaDirectory, sections);\n}\n","import path from 'node:path';\n\nimport {\n createSerialRunner,\n getOrThrow,\n nodeHost,\n readTextIfExists,\n writeFileAtomic,\n type FileSystem,\n} from '@agimon-ai/po-core/platform';\n\nimport type { PersonaFrontMatter } from '../../types/profiles';\nimport { poConfigCandidates, readPoConfigSourcesAsync } from '../layeredConfig';\nimport { parsePersonaFrontMatter } from '../personaFrontMatter';\nimport { readPersonaIconAsync } from '../personaIcon';\nimport {\n PERSONA_FILES,\n PERSONA_IDENTITY_FILE,\n PROFILE_SIDECAR_FILE,\n PROFILES_FILE,\n assertPersonaFileInside,\n catalogDefaultProfile,\n draftProfileEntry,\n emptyPersona,\n isPathInside,\n missingPersona,\n outsideAllowedRoot,\n parseProfileLayer,\n parseProfileSidecar,\n personaFileSection,\n personaPromptFromSections,\n presentationFrom,\n profileFromDraft,\n sidecarDiagnostic,\n sortProfiles,\n withProfileRoot,\n type AgentProfile,\n type PersonaPresentation,\n type ProfileConfigLayer,\n type ProfileDiagnostic,\n type ProfileManagementCatalog,\n type ProfileOrigin,\n type ProfileSidecar,\n} from './core';\n\ntype IoContext = Parameters<FileSystem['readTextFile']>[1];\n\n/** Profile reads over a FileSystem; the Node shims in `./sync` give the same answers from node:fs. */\n\nconst realPath = async (fs: FileSystem, target: string, context: IoContext): Promise<string> =>\n getOrThrow(await fs.canonicalPath(target, context));\n\nconst exists = async (fs: FileSystem, target: string, context: IoContext): Promise<boolean> =>\n getOrThrow(await fs.exists(target, context));\n\n/** Whether a path is a directory once links are followed, as `statSync().isDirectory()`. */\nasync function isDirectory(fs: FileSystem, target: string, context: IoContext): Promise<boolean> {\n if (!(await exists(fs, target, context))) return false;\n const info = getOrThrow(await fs.fileInfo(await realPath(fs, target, context), context));\n return info.kind === 'directory';\n}\n\nasync function readPersonaFrontMatter(\n fs: FileSystem,\n personaRoot: string,\n personaDirectory: string,\n context: IoContext,\n): Promise<PersonaFrontMatter | undefined> {\n try {\n const personaPath = await realPath(fs, path.join(personaRoot, personaDirectory), context);\n const filePath = path.join(personaPath, PERSONA_IDENTITY_FILE);\n if (!(await exists(fs, filePath, context))) return undefined;\n const text = await readTextIfExists(fs, await realPath(fs, filePath, context), context);\n return text === undefined ? undefined : parsePersonaFrontMatter(text).frontMatter;\n } catch {\n return undefined;\n }\n}\n\nasync function readPersonaPresentation(\n fs: FileSystem,\n personaRoot: string,\n personaDirectory: string,\n context: IoContext,\n): Promise<PersonaPresentation> {\n const frontMatter = await readPersonaFrontMatter(fs, personaRoot, personaDirectory, context);\n if (!frontMatter) return {};\n const icon =\n frontMatter.icon === undefined\n ? undefined\n : await readPersonaIconAsync(fs, path.join(personaRoot, personaDirectory), frontMatter.icon, context);\n return presentationFrom(frontMatter, icon);\n}\n\n/** One persona file as read: its raw text, and the prompt text it contributes (profile.md without its identity block). */\nexport interface PersonaFileRead {\n file: string;\n raw: string;\n text: string;\n}\n\n/**\n * The persona files that exist, in prompt order. Each real path must stay inside the persona directory, so a file\n * link cannot import text from outside it. Throws when the persona directory is missing.\n */\nexport async function readPersonaFilesAsync(\n fs: FileSystem,\n personaRoot: string,\n personaDirectory: string,\n context: IoContext,\n): Promise<PersonaFileRead[]> {\n const files: PersonaFileRead[] = [];\n const personaPath = await realPath(fs, path.join(personaRoot, personaDirectory), context);\n for (const file of PERSONA_FILES) {\n const filePath = path.join(personaPath, file);\n if (!(await exists(fs, filePath, context))) continue;\n const realFilePath = await realPath(fs, filePath, context);\n assertPersonaFileInside(personaPath, realFilePath, personaDirectory, file);\n const raw = getOrThrow(await fs.readTextFile(realFilePath, context));\n files.push({ file, raw, text: personaFileSection(file, raw) });\n }\n return files;\n}\n\n/** Builds the persona system-prompt block, or undefined when nothing is readable. */\nexport async function buildPersonaPromptAsync(\n fs: FileSystem,\n personaRoot: string,\n personaDirectory: string,\n context: IoContext,\n): Promise<string | undefined> {\n const files = await readPersonaFilesAsync(fs, personaRoot, personaDirectory, context);\n return personaPromptFromSections(\n personaDirectory,\n files.flatMap(({ text }) => (text ? [text] : [])),\n );\n}\n\nasync function parseProfile(\n fs: FileSystem,\n personaRoot: string,\n configuredRoots: readonly string[],\n name: string,\n value: unknown,\n context: IoContext,\n): Promise<AgentProfile> {\n const draft = draftProfileEntry(personaRoot, configuredRoots, name, value);\n if (!(await isDirectory(fs, draft.personaPath, context))) throw missingPersona(name, draft.persona);\n const realPersonaPath = await realPath(fs, draft.personaPath, context);\n let allowed = false;\n for (const root of draft.lexicalRoots) {\n if (isPathInside(await realPath(fs, root, context), realPersonaPath)) {\n allowed = true;\n break;\n }\n }\n if (!allowed) throw outsideAllowedRoot(name);\n if (!(await buildPersonaPromptAsync(fs, personaRoot, draft.persona, context))) {\n const declaresIdentity = (await readPersonaFrontMatter(fs, personaRoot, draft.persona, context)) !== undefined;\n throw emptyPersona(name, draft.persona, declaresIdentity);\n }\n return profileFromDraft(draft, personaRoot, await readPersonaPresentation(fs, personaRoot, draft.persona, context));\n}\n\nasync function containsPersonaFile(fs: FileSystem, directory: string, context: IoContext): Promise<boolean> {\n for (const file of PERSONA_FILES) {\n const info = await fs.fileInfo(path.join(directory, file), context);\n if (info.ok && info.value.kind === 'file') return true;\n }\n return false;\n}\n\n/** Reads the optional sidecar, which must be a regular file whose real path stays in the persona directory. */\nasync function readSidecar(\n fs: FileSystem,\n name: string,\n realDirectory: string,\n context: IoContext,\n): Promise<ProfileSidecar> {\n const filePath = path.join(realDirectory, PROFILE_SIDECAR_FILE);\n if (!(await exists(fs, filePath, context))) return { env: {} };\n const realFilePath = await realPath(fs, filePath, context);\n if (\n !isPathInside(realDirectory, realFilePath) ||\n getOrThrow(await fs.fileInfo(realFilePath, context)).kind !== 'file'\n ) {\n throw new Error(`Profile \"${name}\" ${PROFILE_SIDECAR_FILE} must be a file inside the persona directory`);\n }\n return parseProfileSidecar(name, getOrThrow(await fs.readTextFile(realFilePath, context)));\n}\n\nasync function discoverProfile(\n fs: FileSystem,\n directory: string,\n configuredRoot: string,\n personaRoot: string,\n diagnostics: ProfileDiagnostic[],\n context: IoContext,\n): Promise<AgentProfile | undefined> {\n if (!(await containsPersonaFile(fs, directory, context))) return undefined;\n const name = path.basename(directory);\n try {\n const realConfiguredRoot = await realPath(fs, configuredRoot, context);\n const realDirectory = await realPath(fs, directory, context);\n if (!isPathInside(realConfiguredRoot, realDirectory)) return undefined;\n const persona = path.relative(personaRoot, directory) || '.';\n if (!(await buildPersonaPromptAsync(fs, personaRoot, persona, context))) return undefined;\n let sidecar: ProfileSidecar;\n try {\n sidecar = await readSidecar(fs, name, realDirectory, context);\n } catch (error) {\n // A bad sidecar skips only this profile, visibly, rather than failing the catalog.\n diagnostics.push(sidecarDiagnostic(path.join(directory, PROFILE_SIDECAR_FILE), name, error));\n return undefined;\n }\n return {\n name,\n persona,\n personaRoot,\n ...sidecar,\n ...(await readPersonaPresentation(fs, personaRoot, persona, context)),\n };\n } catch {\n // Automatic discovery ignores unreadable or unsafe candidates; explicit entries remain fatal.\n return undefined;\n }\n}\n\nasync function discoverProfileRoot(\n fs: FileSystem,\n root: string,\n personaRoot: string,\n diagnostics: ProfileDiagnostic[],\n context: IoContext,\n): Promise<AgentProfile[]> {\n if (!(await isDirectory(fs, root, context))) throw new Error(`Configured profile root is not a directory: ${root}`);\n\n const rootProfile = await discoverProfile(fs, root, root, personaRoot, diagnostics, context);\n if (rootProfile) return [rootProfile];\n\n const directories = getOrThrow(await fs.listDir(root, context))\n .filter((entry) => entry.kind === 'directory')\n .sort((left, right) => left.name.localeCompare(right.name));\n const profiles: AgentProfile[] = [];\n for (const entry of directories) {\n const profile = await discoverProfile(fs, path.join(root, entry.name), root, personaRoot, diagnostics, context);\n if (profile) profiles.push(profile);\n }\n return profiles;\n}\n\nasync function readProfileLayers(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n homeDirectory: string,\n environment?: Parameters<typeof poConfigCandidates>[3],\n): Promise<ProfileConfigLayer[]> {\n const sources = await readPoConfigSourcesAsync<unknown>(\n fs,\n PROFILES_FILE,\n repoRoot,\n context,\n homeDirectory,\n environment,\n );\n return sources.map(parseProfileLayer);\n}\n\n/** The layer and kind of each winning name, filled as later declarations replace earlier ones. */\ntype WinningDeclarations = Map<string, { layer: ProfileConfigLayer; kind: ProfileOrigin['kind'] }>;\n\nasync function profilesFromLayers(\n fs: FileSystem,\n layers: readonly ProfileConfigLayer[],\n context: IoContext,\n diagnostics: ProfileDiagnostic[] = [],\n winners?: WinningDeclarations,\n): Promise<AgentProfile[]> {\n const byName = new Map<string, AgentProfile>();\n for (const layer of layers) {\n for (const root of layer.roots) {\n for (const profile of await discoverProfileRoot(fs, root, layer.baseDirectory, diagnostics, context)) {\n byName.set(profile.name, profile);\n winners?.set(profile.name, { layer, kind: 'discovered' });\n }\n }\n }\n for (const layer of layers) {\n for (const [name, value] of Object.entries(layer.entries)) {\n byName.set(name, await parseProfile(fs, layer.baseDirectory, layer.roots, name, value, context));\n winners?.set(name, { layer, kind: 'explicit' });\n }\n }\n return sortProfiles(byName);\n}\n\n/**\n * Loads profiles from the global and repository configs, repository last.\n *\n * Configured roots accumulate and inspect themselves or their direct-child\n * directories for persona files. Later discoveries replace earlier names, and\n * explicit entries replace discoveries. Legacy flat profile mappings remain\n * accepted as explicit entries.\n */\nexport async function loadProfilesAsync(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n homeDirectory: string = nodeHost.homeDirectory(),\n environment?: Parameters<typeof poConfigCandidates>[3],\n): Promise<AgentProfile[]> {\n return profilesFromLayers(fs, await readProfileLayers(fs, repoRoot, context, homeDirectory, environment), context);\n}\n\n/** The profile catalog plus the name a launch starts on when the caller names none. */\nexport async function loadProfileCatalogAsync(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n homeDirectory: string = nodeHost.homeDirectory(),\n environment?: Parameters<typeof poConfigCandidates>[3],\n): Promise<{ profiles: AgentProfile[]; defaultProfile?: string; diagnostics?: ProfileDiagnostic[] }> {\n const layers = await readProfileLayers(fs, repoRoot, context, homeDirectory, environment);\n const diagnostics: ProfileDiagnostic[] = [];\n const profiles = await profilesFromLayers(fs, layers, context, diagnostics);\n const defaultProfile = catalogDefaultProfile(layers);\n return {\n profiles,\n ...(defaultProfile === undefined ? {} : { defaultProfile }),\n ...(diagnostics.length === 0 ? {} : { diagnostics }),\n };\n}\n\n/**\n * The same catalog as `loadProfileCatalogAsync`, with where each winner was declared and each layer's own default.\n * Precedence is unchanged: the winners are exactly the profiles `loadProfilesAsync` returns.\n *\n * A layer is `personal` when its file is the personal profiles.yaml and `repository` otherwise. Shadowed\n * definitions are not kept, so a profile that a later layer replaced reports only the layer that won.\n */\nexport async function loadProfileManagementCatalogAsync(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n homeDirectory: string = nodeHost.homeDirectory(),\n environment?: Parameters<typeof poConfigCandidates>[3],\n): Promise<ProfileManagementCatalog> {\n const layers = await readProfileLayers(fs, repoRoot, context, homeDirectory, environment);\n const personalFile = poConfigCandidates(PROFILES_FILE, repoRoot, homeDirectory, environment)[0]?.filePath;\n if (personalFile === undefined) throw new Error('No personal profiles.yaml location');\n const layerName = (layer: ProfileConfigLayer): ProfileOrigin['layer'] =>\n layer.filePath === personalFile ? 'personal' : 'repository';\n const diagnostics: ProfileDiagnostic[] = [];\n const winners: WinningDeclarations = new Map();\n const profiles = await profilesFromLayers(fs, layers, context, diagnostics, winners);\n const layerDefaults: ProfileManagementCatalog['layerDefaults'] = {};\n for (const layer of layers) {\n if (layer.defaultProfile !== undefined) layerDefaults[layerName(layer)] = layer.defaultProfile;\n }\n const defaultProfile = catalogDefaultProfile(layers);\n return {\n personalFile,\n profiles: profiles.map((profile) => {\n const winner = winners.get(profile.name);\n if (!winner) throw new Error(`Profile \"${profile.name}\" has no recorded declaration`);\n return {\n profile,\n origin: { layer: layerName(winner.layer), kind: winner.kind, declaringFile: winner.layer.filePath },\n };\n }),\n ...(defaultProfile === undefined ? {} : { defaultProfile }),\n layerDefaults,\n ...(diagnostics.length === 0 ? {} : { diagnostics }),\n };\n}\n\n/** Resolves one selected profile and fails clearly when its name is unknown. */\nexport async function resolveProfileAsync(\n fs: FileSystem,\n repoRoot: string,\n name: string,\n context: IoContext,\n homeDirectory?: string,\n environment?: Parameters<typeof poConfigCandidates>[3],\n): Promise<AgentProfile> {\n const profiles = await loadProfilesAsync(fs, repoRoot, context, homeDirectory, environment);\n const profile = profiles.find((candidate) => candidate.name === name);\n if (!profile) throw new Error(`Unknown profile: ${name}`);\n return profile;\n}\n\nexport async function listProfileNamesAsync(\n fs: FileSystem,\n repoRoot: string,\n context: IoContext,\n homeDirectory?: string,\n environment?: Parameters<typeof poConfigCandidates>[3],\n): Promise<string[]> {\n return (await loadProfilesAsync(fs, repoRoot, context, homeDirectory, environment)).map((profile) => profile.name);\n}\n\n/** Thrown when `~/.po/profiles.yaml` changed between planning and committing a root. */\nexport class ProfileCatalogChangedError extends Error {\n constructor(filePath: string) {\n super(`${filePath} changed while it was being updated`);\n this.name = 'ProfileCatalogChangedError';\n }\n}\n\n/** A pending change to the personal profiles.yaml, checked against the text it was computed from. */\nexport interface GlobalProfileRootPlan {\n readonly filePath: string;\n readonly before: string | undefined;\n readonly next: string | undefined;\n}\n\nconst profileCatalogWrites = createSerialRunner();\n\n/** Reads the personal profiles.yaml and computes the text that lists `root`. Throws when the file is invalid. */\nexport async function planGlobalProfileRootAsync(\n fs: FileSystem,\n homeDirectory: string,\n root: string,\n context: IoContext,\n environment?: Parameters<typeof poConfigCandidates>[3],\n): Promise<GlobalProfileRootPlan> {\n const [candidate] = poConfigCandidates(PROFILES_FILE, homeDirectory, homeDirectory, environment);\n if (!candidate) throw new Error('No personal profiles.yaml location');\n const before = await readTextIfExists(fs, candidate.filePath, context);\n return {\n filePath: candidate.filePath,\n before,\n next: withProfileRoot(before ?? '', candidate.filePath, candidate.baseDirectory, root),\n };\n}\n\n/** Writes a plan unless the file changed since it was read, which throws ProfileCatalogChangedError. */\nexport async function commitGlobalProfileRootAsync(\n fs: FileSystem,\n plan: GlobalProfileRootPlan,\n context: IoContext,\n): Promise<void> {\n await profileCatalogWrites.forKey(path.resolve(plan.filePath))(async () => {\n if ((await readTextIfExists(fs, plan.filePath, context)) !== plan.before)\n throw new ProfileCatalogChangedError(plan.filePath);\n if (plan.next !== undefined) await writeFileAtomic(fs, plan.filePath, plan.next, context);\n });\n}\n\nexport {\n PERSONA_FILES,\n applyProfileEnvironment,\n inlineProfile,\n personaPromptHeader,\n replaceProfileEnvironment,\n} from './core';\nexport type {\n AgentProfile,\n InlineProfileInput,\n ManagedProfile,\n ProfileDiagnostic,\n ProfileManagementCatalog,\n ProfileOrigin,\n ProfileSettings,\n ProfileWake,\n} from './core';\nexport { buildPersonaPrompt, listProfileNames, loadProfileCatalog, loadProfiles, resolveProfile } from './sync';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,QAAQ;AACd,MAAM,aAAa;CAAC;CAAQ;CAAQ;CAAQ;AAAO;AAEnD,SAASA,WAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,UAAU,OAAkD;CACnE,IAAI,CAACA,WAAS,KAAK,GAAG,OAAO,KAAA;CAC7B,MAAM,QAAQ,OAAO,MAAM,UAAU,YAAY,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,IAAI,MAAM,MAAM,KAAK,IAAI,KAAA;CACtG,MAAM,OAAO,OAAO,MAAM,SAAS,YAAY,OAAO,SAAS,MAAM,IAAI,IAAI,MAAM,OAAO,KAAA;CAC1F,IAAI,UAAU,KAAA,KAAa,SAAS,KAAA,GAAW,OAAO,KAAA;CACtD,OAAO;EAAE,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;EAAI,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK;CAAG;AAC9F;AAEA,SAAS,SAAS,OAAoC;CACpD,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,CAAC,CAAC,SAAS,IAAI,MAAM,KAAK,IAAI,KAAA;AAC/E;AAEA,SAAS,gBAAgB,QAAiE;CACxF,MAAM,OAAO,SAAS,OAAO,IAAI;CACjC,MAAM,OAAO,SAAS,OAAO,IAAI;CACjC,MAAM,OAAO,SAAS,OAAO,IAAI;CACjC,MAAM,QAAQ,UAAU,OAAO,KAAK;CACpC,IAAI,SAAS,KAAA,KAAa,SAAS,KAAA,KAAa,SAAS,KAAA,KAAa,UAAU,KAAA,GAAW,OAAO,KAAA;CA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Q;EACpD,IAAI,KAAK,SAAS,KAAA,GAAW,MAAM,gBAAgB,IAAI,KAAK,UAAU,KAAK,MAAM,OAAO;CAC1F,CAAC;AACH"}
|
|
@@ -378,6 +378,7 @@ const BROWSER_KEYS = /* @__PURE__ */ new Set([
|
|
|
378
378
|
"mode",
|
|
379
379
|
"proxySecret",
|
|
380
380
|
"geoip",
|
|
381
|
+
"humanize",
|
|
381
382
|
"timezone",
|
|
382
383
|
"locale",
|
|
383
384
|
"fingerprint"
|
|
@@ -482,6 +483,7 @@ function browser(value, location) {
|
|
|
482
483
|
if (entry.mode !== void 0 && (typeof entry.mode !== "string" || !BROWSER_MODES.has(entry.mode))) throw new Error(`${location}.mode must be playwright, extension or stealth`);
|
|
483
484
|
if (entry.proxySecret !== void 0 && (typeof entry.proxySecret !== "string" || !ALIAS_PATTERN.test(entry.proxySecret))) throw new Error(`${location}.proxySecret must be an uppercase alias name`);
|
|
484
485
|
if (entry.geoip !== void 0 && typeof entry.geoip !== "boolean") throw new Error(`${location}.geoip must be a boolean`);
|
|
486
|
+
if (entry.humanize !== void 0 && typeof entry.humanize !== "boolean") throw new Error(`${location}.humanize must be a boolean`);
|
|
485
487
|
const pinned = entry.fingerprint === void 0 ? void 0 : fingerprint(entry.fingerprint, `${location}.fingerprint`);
|
|
486
488
|
if (pinned?.required && entry.mode !== void 0 && entry.mode !== "playwright") throw new Error(`${location}.fingerprint.required needs playwright mode`);
|
|
487
489
|
return Object.freeze({
|
|
@@ -490,6 +492,7 @@ function browser(value, location) {
|
|
|
490
492
|
...entry.mode === void 0 ? {} : { mode: entry.mode },
|
|
491
493
|
...entry.proxySecret === void 0 ? {} : { proxySecret: entry.proxySecret },
|
|
492
494
|
...entry.geoip === void 0 ? {} : { geoip: entry.geoip },
|
|
495
|
+
...entry.humanize === void 0 ? {} : { humanize: entry.humanize },
|
|
493
496
|
...entry.timezone === void 0 ? {} : { timezone: timezone(entry.timezone, `${location}.timezone`) },
|
|
494
497
|
...entry.locale === void 0 ? {} : { locale: locale(entry.locale, `${location}.locale`) },
|
|
495
498
|
...pinned === void 0 ? {} : { fingerprint: pinned }
|
|
@@ -1514,4 +1517,4 @@ Object.defineProperty(exports, "resolveProfileAsync", {
|
|
|
1514
1517
|
}
|
|
1515
1518
|
});
|
|
1516
1519
|
|
|
1517
|
-
//# sourceMappingURL=profiles-
|
|
1520
|
+
//# sourceMappingURL=profiles-BJrLd2Ri.cjs.map
|