@agimon-ai/po-profile 0.0.0-alpha.41 → 0.0.0-alpha.42
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 +3 -3
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +3 -3
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{profileText-kBfecwbl.mjs → profileText-CO8YWKLD.mjs} +3 -3
- package/dist/profileText-CO8YWKLD.mjs.map +1 -0
- package/dist/{profileText-eSDL6Q5R.cjs → profileText-CW8eCbwJ.cjs} +3 -3
- package/dist/profileText-CW8eCbwJ.cjs.map +1 -0
- package/package.json +11 -11
- package/dist/profileText-eSDL6Q5R.cjs.map +0 -1
- package/dist/profileText-kBfecwbl.mjs.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_profileText = require("../profileText-
|
|
5
|
+
const require_profileText = require("../profileText-CW8eCbwJ.cjs");
|
|
6
6
|
let _agimon_ai_po_config_profiles = require("@agimon-ai/po-config/profiles");
|
|
7
7
|
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
8
8
|
let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
|
|
@@ -30,9 +30,9 @@ var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ ag
|
|
|
30
30
|
readBinding: (profileName) => readProfile(profileName).integration,
|
|
31
31
|
readEnv: (profileName) => readProfile(profileName).env
|
|
32
32
|
});
|
|
33
|
-
const unsubscribe = agent.subscribeSelection(async (selection) => {
|
|
33
|
+
const unsubscribe = agent.subscribeSelection(async (selection, applied) => {
|
|
34
34
|
try {
|
|
35
|
-
await runtime.select(selection.profile);
|
|
35
|
+
await runtime.select(selection.profile, { force: applied?.refresh?.includes("profile") === true });
|
|
36
36
|
} catch (error) {
|
|
37
37
|
throw new _agimon_ai_po_core_headless.PoHeadlessPromptAdmissionError(error);
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["defineRoot","createProfileSources","createProfileSecrets","findProfile","loadProfiles","nodeHost","createProfileSecretsPlugin","createProfileSourcesPlugin","defineRoot","findProfile","loadProfiles","nodeHost","readProfileSources","createProfileRuntime","PoHeadlessPromptAdmissionError","createProfileRuntimePlugin","runCleanups","defineRoute","findProfile","loadProfiles","buildPersonaPrompt","PO_PROFILE_IDENTITY_ENTRY_TYPE","PROFILE_COMMAND","mergeProfiles","profileTitle","profileItems","isPoHeadlessPromptAdmissionError","PoSessionSetupError","PoHeadlessPromptAdmissionError","defineRoutedContribution","readProfileSources","defineHook","defineHook","readProfileSources","defineResource","packageResourcePath","readPackageResource","defineResource","readProfileSources","defineServerPlugin","composeServerProviderOverrides","rootGlobal","rootSession","composeRootInjects","composeRootHooks","apiRoute","commandProfile","hookBeforeAgentStart","hookSessionStart","resourceHelpHowToProfile","resourceProfileConfig"],"sources":["../../src/extensions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/api/profile/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/profileServer.ts","../../src/extensions/workspaces/sessions/(backend)/command/profile.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-profile.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server.ts","../../generated/server.ts"],"sourcesContent":["import { loadProfiles } from '@agimon-ai/po-config/profiles';\nimport { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createProfileSecrets, createProfileSecretsPlugin } from '../../services/profileSecrets';\nimport { createProfileSources, createProfileSourcesPlugin, findProfile } from '../../services/profileSources';\n\nexport default defineRoot(({ host }: PoServerPluginContext) => {\n const environment = Object.freeze({ ...host.context.environment });\n const sources = createProfileSources();\n const secrets = createProfileSecrets({\n readBinding: (cwd, profile, homeDirectory) =>\n findProfile(loadProfiles(cwd, homeDirectory ?? environment.HOME ?? nodeHost.homeDirectory()), sources, profile)\n .integration,\n });\n return {\n value: secrets,\n services: [createProfileSecretsPlugin(secrets), createProfileSourcesPlugin(sources)],\n };\n});\n","import { loadProfiles } from '@agimon-ai/po-config/profiles';\nimport { defineRoot, runCleanups } from '@agimon-ai/po-core/extensionFile';\nimport { PoHeadlessPromptAdmissionError } from '@agimon-ai/po-core/headless';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createProfileRuntime, createProfileRuntimePlugin } from '../../../../services/profileRuntime';\nimport { findProfile, readProfileSources } from '../../../../services/profileSources';\n\nexport default defineRoot(({ agent, signal, context }: PoServerPluginContext) => {\n if (!agent) return { value: undefined };\n const execution = agent.context;\n const readProfile = (profileName: string) =>\n findProfile(\n loadProfiles(execution.repoRoot, execution.environment.HOME ?? nodeHost.homeDirectory()),\n readProfileSources(context),\n profileName,\n );\n const runtime = createProfileRuntime({\n profileName: execution.selection.profile,\n readBinding: (profileName) => readProfile(profileName).integration,\n readEnv: (profileName) => readProfile(profileName).env,\n });\n const unsubscribe = agent.subscribeSelection(async (selection) => {\n try {\n await runtime.select(selection.profile);\n } catch (error) {\n throw new PoHeadlessPromptAdmissionError(error);\n }\n });\n const invalidate = () => runtime.invalidate();\n signal.addEventListener('abort', invalidate, { once: true });\n if (signal.aborted) runtime.invalidate();\n return {\n value: runtime,\n services: [createProfileRuntimePlugin(runtime)],\n async onDispose() {\n await runCleanups(\n [unsubscribe, () => signal.removeEventListener('abort', invalidate), () => runtime.dispose()],\n 'Profile cleanup failed.',\n );\n },\n };\n});\n","import { defineRoute } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoute(({ agent }: PoServerPluginContext) => ({\n basePath: 'profile',\n start: () => ({\n fetch(request: Request) {\n if (new URL(request.url).pathname !== '/current') return Response.json({ error: 'Not found' }, { status: 404 });\n if (request.method !== 'GET')\n return Response.json({ error: 'Method not allowed' }, { status: 405, headers: { Allow: 'GET' } });\n if (!agent) return Response.json({ error: 'Session agent unavailable' }, { status: 404 });\n const selection = agent.context.selection;\n return Response.json({ profile: selection.profile ?? null });\n },\n close() {},\n }),\n}));\n","import { buildPersonaPrompt, loadProfiles } from '@agimon-ai/po-config/profiles';\nimport {\n PoHeadlessPromptAdmissionError,\n PoSessionSetupError,\n isPoHeadlessPromptAdmissionError,\n type PoHeadlessCommand,\n type PoHeadlessExecutionContext,\n type PoHeadlessHostService,\n type PoHeadlessHook,\n} from '@agimon-ai/po-core/headless';\nimport { PO_PROFILE_IDENTITY_ENTRY_TYPE } from '@agimon-ai/po-core/profileIdentity';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { findProfile, mergeProfiles } from '../../../../../services/profileSources';\nimport type { ProfileSources } from '../../../../../services/profileSources/type';\nimport { PROFILE_COMMAND, profileItems, profileTitle } from '../../../../../services/profileText';\n\ntype ProfileExecution = {\n readonly repoRoot: string;\n readonly environment?: Readonly<Record<string, string | undefined>>;\n};\n\nconst resolveSelected = (execution: ProfileExecution, sources: ProfileSources | undefined, name: string) =>\n findProfile(loadProfiles(execution.repoRoot, execution.environment?.HOME), sources, name);\n\nexport async function readSelectedPersona(\n execution: ProfileExecution & { readonly selection: { readonly profile?: string } },\n sources?: ProfileSources,\n): Promise<string> {\n const name = execution.selection.profile;\n if (!name) return '(no active profile)';\n const profile = resolveSelected(execution, sources, name);\n const prompt = profile.personaPrompt ?? buildPersonaPrompt(profile.personaRoot, profile.persona);\n if (!prompt) throw new Error(`Profile \"${name}\" has no readable persona text`);\n return prompt;\n}\n\nasync function publishSelectedIdentity(\n execution: PoHeadlessExecutionContext,\n sources: ProfileSources | undefined,\n profile: string,\n): Promise<void> {\n const identity = resolveSelected(execution, sources, profile).identity;\n await execution.session.appendCustomEntry(PO_PROFILE_IDENTITY_ENTRY_TYPE, {\n profile,\n ...(identity?.name === undefined ? {} : { name: identity.name }),\n ...(identity?.icon === undefined ? {} : { icon: identity.icon }),\n });\n}\n\nexport function createProfileServerCommand(host: PoHeadlessHostService, sources?: ProfileSources): PoHeadlessCommand {\n return {\n name: PROFILE_COMMAND,\n description: 'Show or change the active Po profile.',\n selectionRecovery: true,\n async execute(args, execution) {\n const profiles = mergeProfiles(loadProfiles(execution.repoRoot, execution.environment.HOME), sources);\n let requested = args.trim();\n if (!requested) {\n const selected = await execution.client.request({\n kind: 'select',\n title: profileTitle(execution.selection.profile),\n options: profileItems(profiles),\n });\n if (typeof selected !== 'string' || !selected) return;\n requested = selected;\n }\n if (!profiles.some(({ name }) => name === requested)) throw new Error(`Unknown profile: ${requested}`);\n if (requested === execution.selection.profile && host.inspectCapabilities().ready) return;\n try {\n await host.changeSelection({ axis: 'profile', profile: requested });\n } catch (error) {\n if (isPoHeadlessPromptAdmissionError(error))\n throw new PoSessionSetupError(\n 'Profile integration is unavailable. Restore its credential or choose another profile.',\n );\n throw error;\n }\n await publishSelectedIdentity(execution, sources, requested);\n },\n };\n}\nexport async function assertProfileReady(runtime: ProfileRuntime | undefined): Promise<void> {\n try {\n await runtime?.ready();\n } catch (error) {\n // Ordinary hook failures are advisory. This is a fail-closed admission boundary.\n throw new PoHeadlessPromptAdmissionError(error);\n }\n}\n\nexport function createProfileIdentityHook(sources?: ProfileSources): PoHeadlessHook<'session_start'> {\n return {\n event: 'session_start',\n async handle(_event, execution) {\n const profile = execution.selection.profile;\n if (profile !== undefined) await publishSelectedIdentity(execution, sources, profile);\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { createProfileServerCommand } from '../_lib/profileServer';\nexport default defineRoutedContribution(\n ({ agent, context }: PoServerPluginContext) =>\n agent ? createProfileServerCommand(agent, readProfileSources(context)) : undefined,\n { cardinality: 'optional' },\n);\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<PoServerPluginContext, ProfileRuntime | undefined>) => ({\n async handle() {\n await assertProfileReady(root);\n },\n}));\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { assertProfileReady, createProfileIdentityHook } from '../_lib/profileServer';\n\nexport default defineHook(({ root, context }: WithRoot<PoServerPluginContext, ProfileRuntime | undefined>) => {\n const identityHook = createProfileIdentityHook(readProfileSources(context));\n return {\n ...identityHook,\n async handle(event: Readonly<Record<string, unknown>>, execution: PoHeadlessExecutionContext) {\n await assertProfileReady(root);\n await identityHook.handle(event, execution);\n },\n };\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineResource({\n name: 'help-how-to-profile',\n description:\n 'Configure Po profile discovery, personas, environment defaults, and precedence in profiles.yaml. Use when creating or changing personal or repository profiles. Do not use for config.yaml runtime settings, modes.yaml, or domains.yaml.',\n when: { state: { 'minor-mode': 'help' }, attribution: { kind: 'minor' as const, mode: 'help' } },\n kind: 'skill' as const,\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-profile/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-profile/SKILL.md'),\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { readSelectedPersona } from '../_lib/profileServer';\nexport default defineResource(({ context }: PoServerPluginContext) => ({\n name: 'po/profile-config',\n kind: 'context' as const,\n read: (execution: Parameters<typeof readSelectedPersona>[0]) =>\n readSelectedPersona(execution, readProfileSources(context)),\n}));\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverPlugin';\nimport { composeRootHooks, composeRootInjects } from '@agimon-ai/po-core/extensionFile';\n\nimport rootGlobal from '../src/extensions/(backend)/root.server';\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/workspaces/sessions/(backend)/api/profile/route.server';\nimport commandProfile from '../src/extensions/workspaces/sessions/(backend)/command/profile.server';\nimport hookBeforeAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.server';\nimport resourceHelpHowToProfile from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-profile.server';\nimport resourceProfileConfig from '../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-profile',\n providerOverrides: composeServerProviderOverrides(rootGlobal, rootSession),\n injects: composeRootInjects({ global: [rootGlobal], workspace: [rootGlobal], session: [rootGlobal, rootSession] }),\n global: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n return {\n ...composeRootHooks(scopeGlobal),\n services: [...(scopeGlobal.services ?? [])],\n };\n },\n workspace: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n return {\n ...composeRootHooks(scopeGlobal),\n services: [...(scopeGlobal.services ?? [])],\n };\n },\n session: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n const contextGlobal = { ...context, root: scopeGlobal.value };\n const scopeSession = await context.scopeRoot('session', rootSession, contextGlobal);\n const contextSession = { ...contextGlobal, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeGlobal, scopeSession),\n get api(): PoServerSessionPlugin['api'] { return [at(apiRoute, contextSession)]; },\n get commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'profile' }, at(commandProfile, contextSession))]); },\n get hooks(): PoServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, contextSession)), via({ event: 'session_start' }, at(hookSessionStart, contextSession))]; },\n get resources(): PoServerSessionPlugin['resources'] { return [at(resourceHelpHowToProfile, contextSession), at(resourceProfileConfig, contextSession)]; },\n services: [...(scopeGlobal.services ?? []), ...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeGlobal.activities ?? []), ...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;;;AAQA,IAAA,yBAAA,GAAeA,iCAAAA,WA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,uBAAY,OAAO;EACzE,MAAM,gBAAgB;GAAE,GAAG;GAAS,MAAM,YAAY;EAAM;EAC5D,MAAM,eAAe,MAAM,QAAQ,UAAU,WAAWC,qBAAa,aAAa;EAClF,MAAM,iBAAiB;GAAE,GAAG;GAAe,MAAM,aAAa;EAAM;EACpE,OAAO;GACL,IAAA,GAAGE,iCAAAA,iBAAAA,CAAiB,aAAa,YAAY;GAC7C,IAAI,MAAoC;IAAE,OAAO,CAAC,GAAGC,sBAAU,cAAc,CAAC;GAAG;GACjF,IAAI,WAA8C;IAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,UAAU,GAAG,GAAGC,wBAAgB,cAAc,CAAC,CAAC,CAAC;GAAG;GACpI,IAAI,QAAwC;IAAE,OAAO,CAAC,IAAI,EAAE,OAAO,qBAAqB,GAAG,GAAGC,iCAAsB,cAAc,CAAC,GAAG,IAAI,EAAE,OAAO,gBAAgB,GAAG,GAAGC,6BAAkB,cAAc,CAAC,CAAC;GAAG;GAC9M,IAAI,YAAgD;IAAE,OAAO,CAAC,GAAGC,oCAA0B,cAAc,GAAG,GAAGC,8BAAuB,cAAc,CAAC;GAAG;GACxJ,UAAU,CAAC,GAAI,YAAY,YAAY,CAAC,GAAI,GAAI,aAAa,YAAY,CAAC,CAAE;GAC5E,IAAI,aAAkD;IAAE,OAAO,CAAC,GAAI,YAAY,cAAc,CAAC,GAAI,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EAC1I;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.cjs","names":["defineRoot","createProfileSources","createProfileSecrets","findProfile","loadProfiles","nodeHost","createProfileSecretsPlugin","createProfileSourcesPlugin","defineRoot","findProfile","loadProfiles","nodeHost","readProfileSources","createProfileRuntime","PoHeadlessPromptAdmissionError","createProfileRuntimePlugin","runCleanups","defineRoute","findProfile","loadProfiles","buildPersonaPrompt","PO_PROFILE_IDENTITY_ENTRY_TYPE","PROFILE_COMMAND","mergeProfiles","profileTitle","profileItems","isPoHeadlessPromptAdmissionError","PoSessionSetupError","PoHeadlessPromptAdmissionError","defineRoutedContribution","readProfileSources","defineHook","defineHook","readProfileSources","defineResource","packageResourcePath","readPackageResource","defineResource","readProfileSources","defineServerPlugin","composeServerProviderOverrides","rootGlobal","rootSession","composeRootInjects","composeRootHooks","apiRoute","commandProfile","hookBeforeAgentStart","hookSessionStart","resourceHelpHowToProfile","resourceProfileConfig"],"sources":["../../src/extensions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/api/profile/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/profileServer.ts","../../src/extensions/workspaces/sessions/(backend)/command/profile.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-profile.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server.ts","../../generated/server.ts"],"sourcesContent":["import { loadProfiles } from '@agimon-ai/po-config/profiles';\nimport { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createProfileSecrets, createProfileSecretsPlugin } from '../../services/profileSecrets';\nimport { createProfileSources, createProfileSourcesPlugin, findProfile } from '../../services/profileSources';\n\nexport default defineRoot(({ host }: PoServerPluginContext) => {\n const environment = Object.freeze({ ...host.context.environment });\n const sources = createProfileSources();\n const secrets = createProfileSecrets({\n readBinding: (cwd, profile, homeDirectory) =>\n findProfile(loadProfiles(cwd, homeDirectory ?? environment.HOME ?? nodeHost.homeDirectory()), sources, profile)\n .integration,\n });\n return {\n value: secrets,\n services: [createProfileSecretsPlugin(secrets), createProfileSourcesPlugin(sources)],\n };\n});\n","import { loadProfiles } from '@agimon-ai/po-config/profiles';\nimport { defineRoot, runCleanups } from '@agimon-ai/po-core/extensionFile';\nimport { PoHeadlessPromptAdmissionError } from '@agimon-ai/po-core/headless';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createProfileRuntime, createProfileRuntimePlugin } from '../../../../services/profileRuntime';\nimport { findProfile, readProfileSources } from '../../../../services/profileSources';\n\nexport default defineRoot(({ agent, signal, context }: PoServerPluginContext) => {\n if (!agent) return { value: undefined };\n const execution = agent.context;\n const readProfile = (profileName: string) =>\n findProfile(\n loadProfiles(execution.repoRoot, execution.environment.HOME ?? nodeHost.homeDirectory()),\n readProfileSources(context),\n profileName,\n );\n const runtime = createProfileRuntime({\n profileName: execution.selection.profile,\n readBinding: (profileName) => readProfile(profileName).integration,\n readEnv: (profileName) => readProfile(profileName).env,\n });\n const unsubscribe = agent.subscribeSelection(async (selection, applied) => {\n try {\n // A refresh re-reads the same profile's env and binding after it was edited on disk.\n await runtime.select(selection.profile, { force: applied?.refresh?.includes('profile') === true });\n } catch (error) {\n throw new PoHeadlessPromptAdmissionError(error);\n }\n });\n const invalidate = () => runtime.invalidate();\n signal.addEventListener('abort', invalidate, { once: true });\n if (signal.aborted) runtime.invalidate();\n return {\n value: runtime,\n services: [createProfileRuntimePlugin(runtime)],\n async onDispose() {\n await runCleanups(\n [unsubscribe, () => signal.removeEventListener('abort', invalidate), () => runtime.dispose()],\n 'Profile cleanup failed.',\n );\n },\n };\n});\n","import { defineRoute } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoute(({ agent }: PoServerPluginContext) => ({\n basePath: 'profile',\n start: () => ({\n fetch(request: Request) {\n if (new URL(request.url).pathname !== '/current') return Response.json({ error: 'Not found' }, { status: 404 });\n if (request.method !== 'GET')\n return Response.json({ error: 'Method not allowed' }, { status: 405, headers: { Allow: 'GET' } });\n if (!agent) return Response.json({ error: 'Session agent unavailable' }, { status: 404 });\n const selection = agent.context.selection;\n return Response.json({ profile: selection.profile ?? null });\n },\n close() {},\n }),\n}));\n","import { buildPersonaPrompt, loadProfiles } from '@agimon-ai/po-config/profiles';\nimport {\n PoHeadlessPromptAdmissionError,\n PoSessionSetupError,\n isPoHeadlessPromptAdmissionError,\n type PoHeadlessCommand,\n type PoHeadlessExecutionContext,\n type PoHeadlessHostService,\n type PoHeadlessHook,\n} from '@agimon-ai/po-core/headless';\nimport { PO_PROFILE_IDENTITY_ENTRY_TYPE } from '@agimon-ai/po-core/profileIdentity';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { findProfile, mergeProfiles } from '../../../../../services/profileSources';\nimport type { ProfileSources } from '../../../../../services/profileSources/type';\nimport { PROFILE_COMMAND, profileItems, profileTitle } from '../../../../../services/profileText';\n\ntype ProfileExecution = {\n readonly repoRoot: string;\n readonly environment?: Readonly<Record<string, string | undefined>>;\n};\n\nconst resolveSelected = (execution: ProfileExecution, sources: ProfileSources | undefined, name: string) =>\n findProfile(loadProfiles(execution.repoRoot, execution.environment?.HOME), sources, name);\n\nexport async function readSelectedPersona(\n execution: ProfileExecution & { readonly selection: { readonly profile?: string } },\n sources?: ProfileSources,\n): Promise<string> {\n const name = execution.selection.profile;\n if (!name) return '(no active profile)';\n const profile = resolveSelected(execution, sources, name);\n const prompt = profile.personaPrompt ?? buildPersonaPrompt(profile.personaRoot, profile.persona);\n if (!prompt) throw new Error(`Profile \"${name}\" has no readable persona text`);\n return prompt;\n}\n\nasync function publishSelectedIdentity(\n execution: PoHeadlessExecutionContext,\n sources: ProfileSources | undefined,\n profile: string,\n): Promise<void> {\n const identity = resolveSelected(execution, sources, profile).identity;\n await execution.session.appendCustomEntry(PO_PROFILE_IDENTITY_ENTRY_TYPE, {\n profile,\n ...(identity?.name === undefined ? {} : { name: identity.name }),\n ...(identity?.icon === undefined ? {} : { icon: identity.icon }),\n });\n}\n\nexport function createProfileServerCommand(host: PoHeadlessHostService, sources?: ProfileSources): PoHeadlessCommand {\n return {\n name: PROFILE_COMMAND,\n description: 'Show or change the active Po profile.',\n selectionRecovery: true,\n async execute(args, execution) {\n const profiles = mergeProfiles(loadProfiles(execution.repoRoot, execution.environment.HOME), sources);\n let requested = args.trim();\n if (!requested) {\n const selected = await execution.client.request({\n kind: 'select',\n title: profileTitle(execution.selection.profile),\n options: profileItems(profiles),\n });\n if (typeof selected !== 'string' || !selected) return;\n requested = selected;\n }\n if (!profiles.some(({ name }) => name === requested)) throw new Error(`Unknown profile: ${requested}`);\n if (requested === execution.selection.profile && host.inspectCapabilities().ready) return;\n try {\n await host.changeSelection({ axis: 'profile', profile: requested });\n } catch (error) {\n if (isPoHeadlessPromptAdmissionError(error))\n throw new PoSessionSetupError(\n 'Profile integration is unavailable. Restore its credential or choose another profile.',\n );\n throw error;\n }\n await publishSelectedIdentity(execution, sources, requested);\n },\n };\n}\nexport async function assertProfileReady(runtime: ProfileRuntime | undefined): Promise<void> {\n try {\n await runtime?.ready();\n } catch (error) {\n // Ordinary hook failures are advisory. This is a fail-closed admission boundary.\n throw new PoHeadlessPromptAdmissionError(error);\n }\n}\n\nexport function createProfileIdentityHook(sources?: ProfileSources): PoHeadlessHook<'session_start'> {\n return {\n event: 'session_start',\n async handle(_event, execution) {\n const profile = execution.selection.profile;\n if (profile !== undefined) await publishSelectedIdentity(execution, sources, profile);\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { createProfileServerCommand } from '../_lib/profileServer';\nexport default defineRoutedContribution(\n ({ agent, context }: PoServerPluginContext) =>\n agent ? createProfileServerCommand(agent, readProfileSources(context)) : undefined,\n { cardinality: 'optional' },\n);\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<PoServerPluginContext, ProfileRuntime | undefined>) => ({\n async handle() {\n await assertProfileReady(root);\n },\n}));\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { assertProfileReady, createProfileIdentityHook } from '../_lib/profileServer';\n\nexport default defineHook(({ root, context }: WithRoot<PoServerPluginContext, ProfileRuntime | undefined>) => {\n const identityHook = createProfileIdentityHook(readProfileSources(context));\n return {\n ...identityHook,\n async handle(event: Readonly<Record<string, unknown>>, execution: PoHeadlessExecutionContext) {\n await assertProfileReady(root);\n await identityHook.handle(event, execution);\n },\n };\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineResource({\n name: 'help-how-to-profile',\n description:\n 'Configure Po profile discovery, personas, environment defaults, and precedence in profiles.yaml. Use when creating or changing personal or repository profiles. Do not use for config.yaml runtime settings, modes.yaml, or domains.yaml.',\n when: { state: { 'minor-mode': 'help' }, attribution: { kind: 'minor' as const, mode: 'help' } },\n kind: 'skill' as const,\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-profile/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-profile/SKILL.md'),\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { readSelectedPersona } from '../_lib/profileServer';\nexport default defineResource(({ context }: PoServerPluginContext) => ({\n name: 'po/profile-config',\n kind: 'context' as const,\n read: (execution: Parameters<typeof readSelectedPersona>[0]) =>\n readSelectedPersona(execution, readProfileSources(context)),\n}));\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverPlugin';\nimport { composeRootHooks, composeRootInjects } from '@agimon-ai/po-core/extensionFile';\n\nimport rootGlobal from '../src/extensions/(backend)/root.server';\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/workspaces/sessions/(backend)/api/profile/route.server';\nimport commandProfile from '../src/extensions/workspaces/sessions/(backend)/command/profile.server';\nimport hookBeforeAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.server';\nimport resourceHelpHowToProfile from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-profile.server';\nimport resourceProfileConfig from '../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-profile',\n providerOverrides: composeServerProviderOverrides(rootGlobal, rootSession),\n injects: composeRootInjects({ global: [rootGlobal], workspace: [rootGlobal], session: [rootGlobal, rootSession] }),\n global: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n return {\n ...composeRootHooks(scopeGlobal),\n services: [...(scopeGlobal.services ?? [])],\n };\n },\n workspace: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n return {\n ...composeRootHooks(scopeGlobal),\n services: [...(scopeGlobal.services ?? [])],\n };\n },\n session: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n const contextGlobal = { ...context, root: scopeGlobal.value };\n const scopeSession = await context.scopeRoot('session', rootSession, contextGlobal);\n const contextSession = { ...contextGlobal, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeGlobal, scopeSession),\n get api(): PoServerSessionPlugin['api'] { return [at(apiRoute, contextSession)]; },\n get commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'profile' }, at(commandProfile, contextSession))]); },\n get hooks(): PoServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, contextSession)), via({ event: 'session_start' }, at(hookSessionStart, contextSession))]; },\n get resources(): PoServerSessionPlugin['resources'] { return [at(resourceHelpHowToProfile, contextSession), at(resourceProfileConfig, contextSession)]; },\n services: [...(scopeGlobal.services ?? []), ...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeGlobal.activities ?? []), ...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;;;AAQA,IAAA,yBAAA,GAAeA,iCAAAA,WAAAA,EAAY,EAAE,WAAkC;CAC7D,MAAM,cAAc,OAAO,OAAO,EAAE,GAAG,KAAK,QAAQ,YAAY,CAAC;CACjE,MAAM,UAAUC,oBAAAA,qBAAqB;CACrC,MAAM,UAAUC,oBAAAA,qBAAqB,EACnC,cAAc,KAAK,SAAS,kBAC1BC,oBAAAA,aAAAA,GAAYC,8BAAAA,aAAAA,CAAa,KAAK,iBAAiB,YAAY,QAAQC,4BAAAA,SAAS,cAAc,CAAC,GAAG,SAAS,OAAO,CAAC,CAC5G,YACP,CAAC;CACD,OAAO;EACL,OAAO;EACP,UAAU,CAACC,oBAAAA,2BAA2B,OAAO,GAAGC,oBAAAA,2BAA2B,OAAO,CAAC;CACrF;AACF,CAAC;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GAAG,GAAGC,wBAAgB,cAAc,CAAC,CAAC,CAAC;GAAG;GACpI,IAAI,QAAwC;IAAE,OAAO,CAAC,IAAI,EAAE,OAAO,qBAAqB,GAAG,GAAGC,iCAAsB,cAAc,CAAC,GAAG,IAAI,EAAE,OAAO,gBAAgB,GAAG,GAAGC,6BAAkB,cAAc,CAAC,CAAC;GAAG;GAC9M,IAAI,YAAgD;IAAE,OAAO,CAAC,GAAGC,oCAA0B,cAAc,GAAG,GAAGC,8BAAuB,cAAc,CAAC;GAAG;GACxJ,UAAU,CAAC,GAAI,YAAY,YAAY,CAAC,GAAI,GAAI,aAAa,YAAY,CAAC,CAAE;GAC5E,IAAI,aAAkD;IAAE,OAAO,CAAC,GAAI,YAAY,cAAc,CAAC,GAAI,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EAC1I;CACF;AACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as createProfileRuntime, c as createProfileSources, d as mergeProfiles, f as readProfileSources, h as createProfileSecretsPlugin, i as profileItems, l as createProfileSourcesPlugin, m as createProfileSecrets, s as profileTitle, t as PROFILE_COMMAND, u as findProfile, v as createProfileRuntimePlugin } from "../profileText-
|
|
1
|
+
import { _ as createProfileRuntime, c as createProfileSources, d as mergeProfiles, f as readProfileSources, h as createProfileSecretsPlugin, i as profileItems, l as createProfileSourcesPlugin, m as createProfileSecrets, s as profileTitle, t as PROFILE_COMMAND, u as findProfile, v as createProfileRuntimePlugin } from "../profileText-CO8YWKLD.mjs";
|
|
2
2
|
import { buildPersonaPrompt, loadProfiles } from "@agimon-ai/po-config/profiles";
|
|
3
3
|
import { composeServerProviderOverrides, defineServerPlugin, packageResourcePath, readPackageResource } from "@agimon-ai/po-core/serverPlugin";
|
|
4
4
|
import { composeRootHooks, composeRootInjects, defineHook, defineResource, defineRoot, defineRoute, defineRoutedContribution, runCleanups } from "@agimon-ai/po-core/extensionFile";
|
|
@@ -26,9 +26,9 @@ var root_server_default = defineRoot(({ agent, signal, context }) => {
|
|
|
26
26
|
readBinding: (profileName) => readProfile(profileName).integration,
|
|
27
27
|
readEnv: (profileName) => readProfile(profileName).env
|
|
28
28
|
});
|
|
29
|
-
const unsubscribe = agent.subscribeSelection(async (selection) => {
|
|
29
|
+
const unsubscribe = agent.subscribeSelection(async (selection, applied) => {
|
|
30
30
|
try {
|
|
31
|
-
await runtime.select(selection.profile);
|
|
31
|
+
await runtime.select(selection.profile, { force: applied?.refresh?.includes("profile") === true });
|
|
32
32
|
} catch (error) {
|
|
33
33
|
throw new PoHeadlessPromptAdmissionError(error);
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":["rootGlobal","rootSession","apiRoute","commandProfile","hookBeforeAgentStart","hookSessionStart","resourceHelpHowToProfile","resourceProfileConfig"],"sources":["../../src/extensions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/api/profile/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/profileServer.ts","../../src/extensions/workspaces/sessions/(backend)/command/profile.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-profile.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server.ts","../../generated/server.ts"],"sourcesContent":["import { loadProfiles } from '@agimon-ai/po-config/profiles';\nimport { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createProfileSecrets, createProfileSecretsPlugin } from '../../services/profileSecrets';\nimport { createProfileSources, createProfileSourcesPlugin, findProfile } from '../../services/profileSources';\n\nexport default defineRoot(({ host }: PoServerPluginContext) => {\n const environment = Object.freeze({ ...host.context.environment });\n const sources = createProfileSources();\n const secrets = createProfileSecrets({\n readBinding: (cwd, profile, homeDirectory) =>\n findProfile(loadProfiles(cwd, homeDirectory ?? environment.HOME ?? nodeHost.homeDirectory()), sources, profile)\n .integration,\n });\n return {\n value: secrets,\n services: [createProfileSecretsPlugin(secrets), createProfileSourcesPlugin(sources)],\n };\n});\n","import { loadProfiles } from '@agimon-ai/po-config/profiles';\nimport { defineRoot, runCleanups } from '@agimon-ai/po-core/extensionFile';\nimport { PoHeadlessPromptAdmissionError } from '@agimon-ai/po-core/headless';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createProfileRuntime, createProfileRuntimePlugin } from '../../../../services/profileRuntime';\nimport { findProfile, readProfileSources } from '../../../../services/profileSources';\n\nexport default defineRoot(({ agent, signal, context }: PoServerPluginContext) => {\n if (!agent) return { value: undefined };\n const execution = agent.context;\n const readProfile = (profileName: string) =>\n findProfile(\n loadProfiles(execution.repoRoot, execution.environment.HOME ?? nodeHost.homeDirectory()),\n readProfileSources(context),\n profileName,\n );\n const runtime = createProfileRuntime({\n profileName: execution.selection.profile,\n readBinding: (profileName) => readProfile(profileName).integration,\n readEnv: (profileName) => readProfile(profileName).env,\n });\n const unsubscribe = agent.subscribeSelection(async (selection) => {\n try {\n await runtime.select(selection.profile);\n } catch (error) {\n throw new PoHeadlessPromptAdmissionError(error);\n }\n });\n const invalidate = () => runtime.invalidate();\n signal.addEventListener('abort', invalidate, { once: true });\n if (signal.aborted) runtime.invalidate();\n return {\n value: runtime,\n services: [createProfileRuntimePlugin(runtime)],\n async onDispose() {\n await runCleanups(\n [unsubscribe, () => signal.removeEventListener('abort', invalidate), () => runtime.dispose()],\n 'Profile cleanup failed.',\n );\n },\n };\n});\n","import { defineRoute } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoute(({ agent }: PoServerPluginContext) => ({\n basePath: 'profile',\n start: () => ({\n fetch(request: Request) {\n if (new URL(request.url).pathname !== '/current') return Response.json({ error: 'Not found' }, { status: 404 });\n if (request.method !== 'GET')\n return Response.json({ error: 'Method not allowed' }, { status: 405, headers: { Allow: 'GET' } });\n if (!agent) return Response.json({ error: 'Session agent unavailable' }, { status: 404 });\n const selection = agent.context.selection;\n return Response.json({ profile: selection.profile ?? null });\n },\n close() {},\n }),\n}));\n","import { buildPersonaPrompt, loadProfiles } from '@agimon-ai/po-config/profiles';\nimport {\n PoHeadlessPromptAdmissionError,\n PoSessionSetupError,\n isPoHeadlessPromptAdmissionError,\n type PoHeadlessCommand,\n type PoHeadlessExecutionContext,\n type PoHeadlessHostService,\n type PoHeadlessHook,\n} from '@agimon-ai/po-core/headless';\nimport { PO_PROFILE_IDENTITY_ENTRY_TYPE } from '@agimon-ai/po-core/profileIdentity';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { findProfile, mergeProfiles } from '../../../../../services/profileSources';\nimport type { ProfileSources } from '../../../../../services/profileSources/type';\nimport { PROFILE_COMMAND, profileItems, profileTitle } from '../../../../../services/profileText';\n\ntype ProfileExecution = {\n readonly repoRoot: string;\n readonly environment?: Readonly<Record<string, string | undefined>>;\n};\n\nconst resolveSelected = (execution: ProfileExecution, sources: ProfileSources | undefined, name: string) =>\n findProfile(loadProfiles(execution.repoRoot, execution.environment?.HOME), sources, name);\n\nexport async function readSelectedPersona(\n execution: ProfileExecution & { readonly selection: { readonly profile?: string } },\n sources?: ProfileSources,\n): Promise<string> {\n const name = execution.selection.profile;\n if (!name) return '(no active profile)';\n const profile = resolveSelected(execution, sources, name);\n const prompt = profile.personaPrompt ?? buildPersonaPrompt(profile.personaRoot, profile.persona);\n if (!prompt) throw new Error(`Profile \"${name}\" has no readable persona text`);\n return prompt;\n}\n\nasync function publishSelectedIdentity(\n execution: PoHeadlessExecutionContext,\n sources: ProfileSources | undefined,\n profile: string,\n): Promise<void> {\n const identity = resolveSelected(execution, sources, profile).identity;\n await execution.session.appendCustomEntry(PO_PROFILE_IDENTITY_ENTRY_TYPE, {\n profile,\n ...(identity?.name === undefined ? {} : { name: identity.name }),\n ...(identity?.icon === undefined ? {} : { icon: identity.icon }),\n });\n}\n\nexport function createProfileServerCommand(host: PoHeadlessHostService, sources?: ProfileSources): PoHeadlessCommand {\n return {\n name: PROFILE_COMMAND,\n description: 'Show or change the active Po profile.',\n selectionRecovery: true,\n async execute(args, execution) {\n const profiles = mergeProfiles(loadProfiles(execution.repoRoot, execution.environment.HOME), sources);\n let requested = args.trim();\n if (!requested) {\n const selected = await execution.client.request({\n kind: 'select',\n title: profileTitle(execution.selection.profile),\n options: profileItems(profiles),\n });\n if (typeof selected !== 'string' || !selected) return;\n requested = selected;\n }\n if (!profiles.some(({ name }) => name === requested)) throw new Error(`Unknown profile: ${requested}`);\n if (requested === execution.selection.profile && host.inspectCapabilities().ready) return;\n try {\n await host.changeSelection({ axis: 'profile', profile: requested });\n } catch (error) {\n if (isPoHeadlessPromptAdmissionError(error))\n throw new PoSessionSetupError(\n 'Profile integration is unavailable. Restore its credential or choose another profile.',\n );\n throw error;\n }\n await publishSelectedIdentity(execution, sources, requested);\n },\n };\n}\nexport async function assertProfileReady(runtime: ProfileRuntime | undefined): Promise<void> {\n try {\n await runtime?.ready();\n } catch (error) {\n // Ordinary hook failures are advisory. This is a fail-closed admission boundary.\n throw new PoHeadlessPromptAdmissionError(error);\n }\n}\n\nexport function createProfileIdentityHook(sources?: ProfileSources): PoHeadlessHook<'session_start'> {\n return {\n event: 'session_start',\n async handle(_event, execution) {\n const profile = execution.selection.profile;\n if (profile !== undefined) await publishSelectedIdentity(execution, sources, profile);\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { createProfileServerCommand } from '../_lib/profileServer';\nexport default defineRoutedContribution(\n ({ agent, context }: PoServerPluginContext) =>\n agent ? createProfileServerCommand(agent, readProfileSources(context)) : undefined,\n { cardinality: 'optional' },\n);\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<PoServerPluginContext, ProfileRuntime | undefined>) => ({\n async handle() {\n await assertProfileReady(root);\n },\n}));\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { assertProfileReady, createProfileIdentityHook } from '../_lib/profileServer';\n\nexport default defineHook(({ root, context }: WithRoot<PoServerPluginContext, ProfileRuntime | undefined>) => {\n const identityHook = createProfileIdentityHook(readProfileSources(context));\n return {\n ...identityHook,\n async handle(event: Readonly<Record<string, unknown>>, execution: PoHeadlessExecutionContext) {\n await assertProfileReady(root);\n await identityHook.handle(event, execution);\n },\n };\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineResource({\n name: 'help-how-to-profile',\n description:\n 'Configure Po profile discovery, personas, environment defaults, and precedence in profiles.yaml. Use when creating or changing personal or repository profiles. Do not use for config.yaml runtime settings, modes.yaml, or domains.yaml.',\n when: { state: { 'minor-mode': 'help' }, attribution: { kind: 'minor' as const, mode: 'help' } },\n kind: 'skill' as const,\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-profile/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-profile/SKILL.md'),\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { readSelectedPersona } from '../_lib/profileServer';\nexport default defineResource(({ context }: PoServerPluginContext) => ({\n name: 'po/profile-config',\n kind: 'context' as const,\n read: (execution: Parameters<typeof readSelectedPersona>[0]) =>\n readSelectedPersona(execution, readProfileSources(context)),\n}));\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverPlugin';\nimport { composeRootHooks, composeRootInjects } from '@agimon-ai/po-core/extensionFile';\n\nimport rootGlobal from '../src/extensions/(backend)/root.server';\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/workspaces/sessions/(backend)/api/profile/route.server';\nimport commandProfile from '../src/extensions/workspaces/sessions/(backend)/command/profile.server';\nimport hookBeforeAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.server';\nimport resourceHelpHowToProfile from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-profile.server';\nimport resourceProfileConfig from '../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-profile',\n providerOverrides: composeServerProviderOverrides(rootGlobal, rootSession),\n injects: composeRootInjects({ global: [rootGlobal], workspace: [rootGlobal], session: [rootGlobal, rootSession] }),\n global: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n return {\n ...composeRootHooks(scopeGlobal),\n services: [...(scopeGlobal.services ?? [])],\n };\n },\n workspace: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n return {\n ...composeRootHooks(scopeGlobal),\n services: [...(scopeGlobal.services ?? [])],\n };\n },\n session: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n const contextGlobal = { ...context, root: scopeGlobal.value };\n const scopeSession = await context.scopeRoot('session', rootSession, contextGlobal);\n const contextSession = { ...contextGlobal, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeGlobal, scopeSession),\n get api(): PoServerSessionPlugin['api'] { return [at(apiRoute, contextSession)]; },\n get commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'profile' }, at(commandProfile, contextSession))]); },\n get hooks(): PoServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, contextSession)), via({ event: 'session_start' }, at(hookSessionStart, contextSession))]; },\n get resources(): PoServerSessionPlugin['resources'] { return [at(resourceHelpHowToProfile, contextSession), at(resourceProfileConfig, contextSession)]; },\n services: [...(scopeGlobal.services ?? []), ...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeGlobal.activities ?? []), ...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;AAQA,IAAA,wBAAe,YAAY,EAAE,WAAkC;CAC7D,MAAM,cAAc,OAAO,OAAO,EAAE,GAAG,KAAK,QAAQ,YAAY,CAAC;CACjE,MAAM,UAAU,qBAAqB;CACrC,MAAM,UAAU,qBAAqB,EACnC,cAAc,KAAK,SAAS,kBAC1B,YAAY,aAAa,KAAK,iBAAiB,YAAY,QAAQ,SAAS,cAAc,CAAC,GAAG,SAAS,OAAO,CAAC,CAC5G,YACP,CAAC;CACD,OAAO;EACL,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AW;GAC/B,UAAU,CAAC,GAAI,YAAY,YAAY,CAAC,CAAE;EAC5C;CACF;CACA,SAAS,OAAO,YAAY;EAC1B,MAAM,cAAc,MAAM,QAAQ,UAAU,UAAUA,uBAAY,OAAO;EACzE,MAAM,gBAAgB;GAAE,GAAG;GAAS,MAAM,YAAY;EAAM;EAC5D,MAAM,eAAe,MAAM,QAAQ,UAAU,WAAWC,qBAAa,aAAa;EAClF,MAAM,iBAAiB;GAAE,GAAG;GAAe,MAAM,aAAa;EAAM;EACpE,OAAO;GACL,GAAG,iBAAiB,aAAa,YAAY;GAC7C,IAAI,MAAoC;IAAE,OAAO,CAAC,GAAGC,sBAAU,cAAc,CAAC;GAAG;GACjF,IAAI,WAA8C;IAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,UAAU,GAAG,GAAGC,wBAAgB,cAAc,CAAC,CAAC,CAAC;GAAG;GACpI,IAAI,QAAwC;IAAE,OAAO,CAAC,IAAI,EAAE,OAAO,qBAAqB,GAAG,GAAGC,iCAAsB,cAAc,CAAC,GAAG,IAAI,EAAE,OAAO,gBAAgB,GAAG,GAAGC,6BAAkB,cAAc,CAAC,CAAC;GAAG;GAC9M,IAAI,YAAgD;IAAE,OAAO,CAAC,GAAGC,oCAA0B,cAAc,GAAG,GAAGC,8BAAuB,cAAc,CAAC;GAAG;GACxJ,UAAU,CAAC,GAAI,YAAY,YAAY,CAAC,GAAI,GAAI,aAAa,YAAY,CAAC,CAAE;GAC5E,IAAI,aAAkD;IAAE,OAAO,CAAC,GAAI,YAAY,cAAc,CAAC,GAAI,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EAC1I;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["rootGlobal","rootSession","apiRoute","commandProfile","hookBeforeAgentStart","hookSessionStart","resourceHelpHowToProfile","resourceProfileConfig"],"sources":["../../src/extensions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/root.server.ts","../../src/extensions/workspaces/sessions/(backend)/api/profile/route.server.ts","../../src/extensions/workspaces/sessions/(backend)/_lib/profileServer.ts","../../src/extensions/workspaces/sessions/(backend)/command/profile.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-profile.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server.ts","../../generated/server.ts"],"sourcesContent":["import { loadProfiles } from '@agimon-ai/po-config/profiles';\nimport { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createProfileSecrets, createProfileSecretsPlugin } from '../../services/profileSecrets';\nimport { createProfileSources, createProfileSourcesPlugin, findProfile } from '../../services/profileSources';\n\nexport default defineRoot(({ host }: PoServerPluginContext) => {\n const environment = Object.freeze({ ...host.context.environment });\n const sources = createProfileSources();\n const secrets = createProfileSecrets({\n readBinding: (cwd, profile, homeDirectory) =>\n findProfile(loadProfiles(cwd, homeDirectory ?? environment.HOME ?? nodeHost.homeDirectory()), sources, profile)\n .integration,\n });\n return {\n value: secrets,\n services: [createProfileSecretsPlugin(secrets), createProfileSourcesPlugin(sources)],\n };\n});\n","import { loadProfiles } from '@agimon-ai/po-config/profiles';\nimport { defineRoot, runCleanups } from '@agimon-ai/po-core/extensionFile';\nimport { PoHeadlessPromptAdmissionError } from '@agimon-ai/po-core/headless';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { createProfileRuntime, createProfileRuntimePlugin } from '../../../../services/profileRuntime';\nimport { findProfile, readProfileSources } from '../../../../services/profileSources';\n\nexport default defineRoot(({ agent, signal, context }: PoServerPluginContext) => {\n if (!agent) return { value: undefined };\n const execution = agent.context;\n const readProfile = (profileName: string) =>\n findProfile(\n loadProfiles(execution.repoRoot, execution.environment.HOME ?? nodeHost.homeDirectory()),\n readProfileSources(context),\n profileName,\n );\n const runtime = createProfileRuntime({\n profileName: execution.selection.profile,\n readBinding: (profileName) => readProfile(profileName).integration,\n readEnv: (profileName) => readProfile(profileName).env,\n });\n const unsubscribe = agent.subscribeSelection(async (selection, applied) => {\n try {\n // A refresh re-reads the same profile's env and binding after it was edited on disk.\n await runtime.select(selection.profile, { force: applied?.refresh?.includes('profile') === true });\n } catch (error) {\n throw new PoHeadlessPromptAdmissionError(error);\n }\n });\n const invalidate = () => runtime.invalidate();\n signal.addEventListener('abort', invalidate, { once: true });\n if (signal.aborted) runtime.invalidate();\n return {\n value: runtime,\n services: [createProfileRuntimePlugin(runtime)],\n async onDispose() {\n await runCleanups(\n [unsubscribe, () => signal.removeEventListener('abort', invalidate), () => runtime.dispose()],\n 'Profile cleanup failed.',\n );\n },\n };\n});\n","import { defineRoute } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineRoute(({ agent }: PoServerPluginContext) => ({\n basePath: 'profile',\n start: () => ({\n fetch(request: Request) {\n if (new URL(request.url).pathname !== '/current') return Response.json({ error: 'Not found' }, { status: 404 });\n if (request.method !== 'GET')\n return Response.json({ error: 'Method not allowed' }, { status: 405, headers: { Allow: 'GET' } });\n if (!agent) return Response.json({ error: 'Session agent unavailable' }, { status: 404 });\n const selection = agent.context.selection;\n return Response.json({ profile: selection.profile ?? null });\n },\n close() {},\n }),\n}));\n","import { buildPersonaPrompt, loadProfiles } from '@agimon-ai/po-config/profiles';\nimport {\n PoHeadlessPromptAdmissionError,\n PoSessionSetupError,\n isPoHeadlessPromptAdmissionError,\n type PoHeadlessCommand,\n type PoHeadlessExecutionContext,\n type PoHeadlessHostService,\n type PoHeadlessHook,\n} from '@agimon-ai/po-core/headless';\nimport { PO_PROFILE_IDENTITY_ENTRY_TYPE } from '@agimon-ai/po-core/profileIdentity';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { findProfile, mergeProfiles } from '../../../../../services/profileSources';\nimport type { ProfileSources } from '../../../../../services/profileSources/type';\nimport { PROFILE_COMMAND, profileItems, profileTitle } from '../../../../../services/profileText';\n\ntype ProfileExecution = {\n readonly repoRoot: string;\n readonly environment?: Readonly<Record<string, string | undefined>>;\n};\n\nconst resolveSelected = (execution: ProfileExecution, sources: ProfileSources | undefined, name: string) =>\n findProfile(loadProfiles(execution.repoRoot, execution.environment?.HOME), sources, name);\n\nexport async function readSelectedPersona(\n execution: ProfileExecution & { readonly selection: { readonly profile?: string } },\n sources?: ProfileSources,\n): Promise<string> {\n const name = execution.selection.profile;\n if (!name) return '(no active profile)';\n const profile = resolveSelected(execution, sources, name);\n const prompt = profile.personaPrompt ?? buildPersonaPrompt(profile.personaRoot, profile.persona);\n if (!prompt) throw new Error(`Profile \"${name}\" has no readable persona text`);\n return prompt;\n}\n\nasync function publishSelectedIdentity(\n execution: PoHeadlessExecutionContext,\n sources: ProfileSources | undefined,\n profile: string,\n): Promise<void> {\n const identity = resolveSelected(execution, sources, profile).identity;\n await execution.session.appendCustomEntry(PO_PROFILE_IDENTITY_ENTRY_TYPE, {\n profile,\n ...(identity?.name === undefined ? {} : { name: identity.name }),\n ...(identity?.icon === undefined ? {} : { icon: identity.icon }),\n });\n}\n\nexport function createProfileServerCommand(host: PoHeadlessHostService, sources?: ProfileSources): PoHeadlessCommand {\n return {\n name: PROFILE_COMMAND,\n description: 'Show or change the active Po profile.',\n selectionRecovery: true,\n async execute(args, execution) {\n const profiles = mergeProfiles(loadProfiles(execution.repoRoot, execution.environment.HOME), sources);\n let requested = args.trim();\n if (!requested) {\n const selected = await execution.client.request({\n kind: 'select',\n title: profileTitle(execution.selection.profile),\n options: profileItems(profiles),\n });\n if (typeof selected !== 'string' || !selected) return;\n requested = selected;\n }\n if (!profiles.some(({ name }) => name === requested)) throw new Error(`Unknown profile: ${requested}`);\n if (requested === execution.selection.profile && host.inspectCapabilities().ready) return;\n try {\n await host.changeSelection({ axis: 'profile', profile: requested });\n } catch (error) {\n if (isPoHeadlessPromptAdmissionError(error))\n throw new PoSessionSetupError(\n 'Profile integration is unavailable. Restore its credential or choose another profile.',\n );\n throw error;\n }\n await publishSelectedIdentity(execution, sources, requested);\n },\n };\n}\nexport async function assertProfileReady(runtime: ProfileRuntime | undefined): Promise<void> {\n try {\n await runtime?.ready();\n } catch (error) {\n // Ordinary hook failures are advisory. This is a fail-closed admission boundary.\n throw new PoHeadlessPromptAdmissionError(error);\n }\n}\n\nexport function createProfileIdentityHook(sources?: ProfileSources): PoHeadlessHook<'session_start'> {\n return {\n event: 'session_start',\n async handle(_event, execution) {\n const profile = execution.selection.profile;\n if (profile !== undefined) await publishSelectedIdentity(execution, sources, profile);\n },\n };\n}\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { createProfileServerCommand } from '../_lib/profileServer';\nexport default defineRoutedContribution(\n ({ agent, context }: PoServerPluginContext) =>\n agent ? createProfileServerCommand(agent, readProfileSources(context)) : undefined,\n { cardinality: 'optional' },\n);\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<PoServerPluginContext, ProfileRuntime | undefined>) => ({\n async handle() {\n await assertProfileReady(root);\n },\n}));\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { PoHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { assertProfileReady, createProfileIdentityHook } from '../_lib/profileServer';\n\nexport default defineHook(({ root, context }: WithRoot<PoServerPluginContext, ProfileRuntime | undefined>) => {\n const identityHook = createProfileIdentityHook(readProfileSources(context));\n return {\n ...identityHook,\n async handle(event: Readonly<Record<string, unknown>>, execution: PoHeadlessExecutionContext) {\n await assertProfileReady(root);\n await identityHook.handle(event, execution);\n },\n };\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverPlugin';\n\nexport default defineResource({\n name: 'help-how-to-profile',\n description:\n 'Configure Po profile discovery, personas, environment defaults, and precedence in profiles.yaml. Use when creating or changing personal or repository profiles. Do not use for config.yaml runtime settings, modes.yaml, or domains.yaml.',\n when: { state: { 'minor-mode': 'help' }, attribution: { kind: 'minor' as const, mode: 'help' } },\n kind: 'skill' as const,\n path: packageResourcePath(import.meta.url, 'src/prompts/help-how-to-profile/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/help-how-to-profile/SKILL.md'),\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport type { PoServerPluginContext } from '@agimon-ai/po-core/serverPlugin';\n\nimport { readProfileSources } from '../../../../../services/profileSources';\nimport { readSelectedPersona } from '../_lib/profileServer';\nexport default defineResource(({ context }: PoServerPluginContext) => ({\n name: 'po/profile-config',\n kind: 'context' as const,\n read: (execution: Parameters<typeof readSelectedPersona>[0]) =>\n readSelectedPersona(execution, readProfileSources(context)),\n}));\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverPlugin';\nimport { composeRootHooks, composeRootInjects } from '@agimon-ai/po-core/extensionFile';\n\nimport rootGlobal from '../src/extensions/(backend)/root.server';\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.server';\nimport apiRoute from '../src/extensions/workspaces/sessions/(backend)/api/profile/route.server';\nimport commandProfile from '../src/extensions/workspaces/sessions/(backend)/command/profile.server';\nimport hookBeforeAgentStart from '../src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server';\nimport hookSessionStart from '../src/extensions/workspaces/sessions/(backend)/hook/sessionStart.server';\nimport resourceHelpHowToProfile from '../src/extensions/workspaces/sessions/(backend)/resource/help-how-to-profile.server';\nimport resourceProfileConfig from '../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server';\n\ntype Factory<T, C> = (context: C) => T;\nconst at = <T, C>(value: T | Factory<T, C>, context: C): T =>\n typeof value === 'function' ? (value as Factory<T, C>)(context) : value;\n/* v8 ignore next -- generated normalization branch */\nconst defined = <T>(values: readonly (T | undefined)[]): T[] =>\n values.filter((value): value is T => value !== undefined);\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-profile',\n providerOverrides: composeServerProviderOverrides(rootGlobal, rootSession),\n injects: composeRootInjects({ global: [rootGlobal], workspace: [rootGlobal], session: [rootGlobal, rootSession] }),\n global: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n return {\n ...composeRootHooks(scopeGlobal),\n services: [...(scopeGlobal.services ?? [])],\n };\n },\n workspace: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n return {\n ...composeRootHooks(scopeGlobal),\n services: [...(scopeGlobal.services ?? [])],\n };\n },\n session: async (context) => {\n const scopeGlobal = await context.scopeRoot('global', rootGlobal, context);\n const contextGlobal = { ...context, root: scopeGlobal.value };\n const scopeSession = await context.scopeRoot('session', rootSession, contextGlobal);\n const contextSession = { ...contextGlobal, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeGlobal, scopeSession),\n get api(): PoServerSessionPlugin['api'] { return [at(apiRoute, contextSession)]; },\n get commands(): PoServerSessionPlugin['commands'] { return defined([via({ name: 'profile' }, at(commandProfile, contextSession))]); },\n get hooks(): PoServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, contextSession)), via({ event: 'session_start' }, at(hookSessionStart, contextSession))]; },\n get resources(): PoServerSessionPlugin['resources'] { return [at(resourceHelpHowToProfile, contextSession), at(resourceProfileConfig, contextSession)]; },\n services: [...(scopeGlobal.services ?? []), ...(scopeSession.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeGlobal.activities ?? []), ...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;AAQA,IAAA,wBAAe,YAAY,EAAE,WAAkC;CAC7D,MAAM,cAAc,OAAO,OAAO,EAAE,GAAG,KAAK,QAAQ,YAAY,CAAC;CACjE,MAAM,UAAU,qBAAqB;CACrC,MAAM,UAAU,qBAAqB,EACnC,cAAc,KAAK,SAAS,kBAC1B,YAAY,aAAa,KAAK,iBAAiB,YAAY,QAAQ,SAAS,cAAc,CAAC,GAAG,SAAS,OAAO,CAAC,CAC5G,YACP,CAAC;CACD,OAAO;EACL,OAAO;EACP,UAAU,CAAC,2BAA2B,OAAO,GAAG,2BAA2B,OAAO,CAAC;CACrF;AACF,CAAC;;;ACXD,IAAA,sBAAe,YAAY,EAAE,OAAO,QAAQ,cAAqC;CAC/E,IAAI,CAAC,OAAO,OAAO,EAAE,OAAO,KAAA,EAAU;CACtC,MAAM,YAAY,MAAM;CACxB,MAAM,eAAe,gBACnB,YACE,aAAa,UAAU,UAAU,UAAU,YAAY,QAAQ,SAAS,cAAc,CAAC,GACvF,mBAAmB,OAAO,GAC1B,WACF;CACF,MAAM,UAAU,qBAAqB;EACnC,aAAa,UAAU,UAAU;EACjC,cAAc,gBAAgB,YAAY,WAAW,CAAC,CAAC;EACvD,UAAU,gBAAgB,YAAY,WAAW,CAAC,CAAC;CACrD,CAAC;CACD,MAAM,cAAc,MAAM,mBAAmB,OAAO,WAAW,YAAY;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,CAAC,IAAI,EAAE,MAAM,UAAU,GAAG,GAAGC,wBAAgB,cAAc,CAAC,CAAC,CAAC;GAAG;GACpI,IAAI,QAAwC;IAAE,OAAO,CAAC,IAAI,EAAE,OAAO,qBAAqB,GAAG,GAAGC,iCAAsB,cAAc,CAAC,GAAG,IAAI,EAAE,OAAO,gBAAgB,GAAG,GAAGC,6BAAkB,cAAc,CAAC,CAAC;GAAG;GAC9M,IAAI,YAAgD;IAAE,OAAO,CAAC,GAAGC,oCAA0B,cAAc,GAAG,GAAGC,8BAAuB,cAAc,CAAC;GAAG;GACxJ,UAAU,CAAC,GAAI,YAAY,YAAY,CAAC,GAAI,GAAI,aAAa,YAAY,CAAC,CAAE;GAC5E,IAAI,aAAkD;IAAE,OAAO,CAAC,GAAI,YAAY,cAAc,CAAC,GAAI,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EAC1I;CACF;AACF,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_profileText = require("./profileText-
|
|
2
|
+
const require_profileText = require("./profileText-CW8eCbwJ.cjs");
|
|
3
3
|
//#region src/services/secretRedaction/index.ts
|
|
4
4
|
const REDACTED = "[redacted]";
|
|
5
5
|
/** Raw, JSON-escaped and URL-encoded forms of every non-empty value. */
|
package/dist/index.d.mts
CHANGED
|
@@ -44,7 +44,10 @@ interface ProfileRuntime {
|
|
|
44
44
|
resolveSecret(name: string, request: ProfileSecretRequest): Promise<string>;
|
|
45
45
|
/** Host-only: the binding's `browser.proxySecret`, which must carry the proxy purpose. */
|
|
46
46
|
resolveProxySecret(signal?: AbortSignal): Promise<string>;
|
|
47
|
-
|
|
47
|
+
/** Same name is a no-op unless `force`, which re-reads the profile's env and binding from disk. */
|
|
48
|
+
select(profileName?: string, options?: {
|
|
49
|
+
readonly force?: boolean;
|
|
50
|
+
}): Promise<void>;
|
|
48
51
|
/** Synchronous fence used when the owning scope aborts, before asynchronous disposal. */
|
|
49
52
|
invalidate(): void;
|
|
50
53
|
dispose(): Promise<void>;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["_0","_0"],"sources":["../src/constants/profileRuntime.ts","../src/constants/profileSecrets.ts","../src/constants/profileSources.ts","../src/services/profileRuntime/type.ts","../src/services/profileRuntime/index.ts","../src/services/profileSecrets/type.ts","../src/services/profileSecrets/index.ts","../src/services/profileSources/type.ts","../src/services/profileSources/index.ts","../src/services/secretRedaction/type.ts","../src/services/secretRedaction/index.ts","../src/services/profileText/index.ts"],"mappings":";;;qBAAa;;;qBCCA;;;qBCAA;;;UCCI;WACN;WACA,cAAc;;WAEd,MAAM,SAAS;WACf;WACA,QAAQ;;;UAIF;EACf,cAAc,WAAW,wBAAwB,QAAQ,cAAc;EACvE,kBAAkB;;;KAIR,0BACV,SAAS,2BACT;WAAoB;WAA8B,QAAQ;WAAsB;MAC7E,QAAQ;UAEI;;WAEN;WACA,SAAS;;UAGH;EACf,iBAAiB;;EAEjB,SAAS;;EAET,eAAe,sBAAsB,SAAS,yBAAyB,cAAc;;EAErF,cAAc,cAAc,SAAS,uBAAuB;;EAE5D,mBAAmB,SAAS,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["_0","_0"],"sources":["../src/constants/profileRuntime.ts","../src/constants/profileSecrets.ts","../src/constants/profileSources.ts","../src/services/profileRuntime/type.ts","../src/services/profileRuntime/index.ts","../src/services/profileSecrets/type.ts","../src/services/profileSecrets/index.ts","../src/services/profileSources/type.ts","../src/services/profileSources/index.ts","../src/services/secretRedaction/type.ts","../src/services/secretRedaction/index.ts","../src/services/profileText/index.ts"],"mappings":";;;qBAAa;;;qBCCA;;;qBCAA;;;UCCI;WACN;WACA,cAAc;;WAEd,MAAM,SAAS;WACf;WACA,QAAQ;;;UAIF;EACf,cAAc,WAAW,wBAAwB,QAAQ,cAAc;EAC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ACR,sBAAsB;;;;;;UC5FT;;EAEf,MAAM;;EAEN;;;;;wBC+Cc,cAAc,GAAG,OAAO,GAAG,SAAS,mBAAmB;wBAIvD,4BAA4B,SAAS,mBAAmB;;;;UCpD9D;EACR;EACA;EACA;;qBAGW;;;;;;wBAaG,cAAc,6BAA6B;;wBAM3C,aAAa,UAAU,iBAAiB;wBAQxC,mBAAmB,SAAS;;wBAM5B,eAAe,SAAS;wBAUxB,aAAa"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as PROFILE_RUNTIME_SERVICE, _ as createProfileRuntime, a as profileStatus, b as PROFILE_SOURCES_SERVICE, c as createProfileSources, f as readProfileSources, g as requireProfileSecrets, h as createProfileSecretsPlugin, i as profileItems, l as createProfileSourcesPlugin, m as createProfileSecrets, n as PROFILE_STATUS_KEY, o as profileSummary, p as ProfileSecretsService, r as profileDescription, s as profileTitle, v as createProfileRuntimePlugin, x as PROFILE_SECRETS_SERVICE, y as requireProfileRuntime } from "./profileText-
|
|
1
|
+
import { S as PROFILE_RUNTIME_SERVICE, _ as createProfileRuntime, a as profileStatus, b as PROFILE_SOURCES_SERVICE, c as createProfileSources, f as readProfileSources, g as requireProfileSecrets, h as createProfileSecretsPlugin, i as profileItems, l as createProfileSourcesPlugin, m as createProfileSecrets, n as PROFILE_STATUS_KEY, o as profileSummary, p as ProfileSecretsService, r as profileDescription, s as profileTitle, v as createProfileRuntimePlugin, x as PROFILE_SECRETS_SERVICE, y as requireProfileRuntime } from "./profileText-CO8YWKLD.mjs";
|
|
2
2
|
//#region src/services/secretRedaction/index.ts
|
|
3
3
|
const REDACTED = "[redacted]";
|
|
4
4
|
/** Raw, JSON-escaped and URL-encoded forms of every non-empty value. */
|
|
@@ -98,9 +98,9 @@ var SessionProfileRuntime = class {
|
|
|
98
98
|
}));
|
|
99
99
|
return this.transition;
|
|
100
100
|
}
|
|
101
|
-
async select(profileName) {
|
|
101
|
+
async select(profileName, options) {
|
|
102
102
|
if (this.disposed) throw new Error(INVALIDATED);
|
|
103
|
-
if (this.snapshot.profileName === profileName && !this.snapshot.signal.aborted && (!this.snapshot.integration || !this.provider || this.connection || this.initializing)) return;
|
|
103
|
+
if (options?.force !== true && this.snapshot.profileName === profileName && !this.snapshot.signal.aborted && (!this.snapshot.integration || !this.provider || this.connection || this.initializing)) return;
|
|
104
104
|
this.invalidate();
|
|
105
105
|
this.controller = new AbortController();
|
|
106
106
|
this.snapshot = this.capture(profileName, this.snapshot.generation + 1);
|
|
@@ -407,4 +407,4 @@ function profileTitle(current) {
|
|
|
407
407
|
//#endregion
|
|
408
408
|
export { PROFILE_RUNTIME_SERVICE as S, createProfileRuntime as _, profileStatus as a, PROFILE_SOURCES_SERVICE as b, createProfileSources as c, mergeProfiles as d, readProfileSources as f, requireProfileSecrets as g, createProfileSecretsPlugin as h, profileItems as i, createProfileSourcesPlugin as l, createProfileSecrets as m, PROFILE_STATUS_KEY as n, profileSummary as o, ProfileSecretsService as p, profileDescription as r, profileTitle as s, PROFILE_COMMAND as t, findProfile as u, createProfileRuntimePlugin as v, PROFILE_SECRETS_SERVICE as x, requireProfileRuntime as y };
|
|
409
409
|
|
|
410
|
-
//# sourceMappingURL=profileText-
|
|
410
|
+
//# sourceMappingURL=profileText-CO8YWKLD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileText-CO8YWKLD.mjs","names":["UNAVAILABLE"],"sources":["../src/constants/profileRuntime.ts","../src/constants/profileSecrets.ts","../src/constants/profileSources.ts","../src/services/profileRuntime/index.ts","../src/services/profileSecrets/index.ts","../src/services/profileSources/index.ts","../src/services/profileText/index.ts"],"sourcesContent":["export const PROFILE_RUNTIME_SERVICE = 'po/profile-runtime';\n","// @scaffold-generated\nexport const PROFILE_SECRETS_SERVICE = 'po/profile-secrets';\n","// @scaffold-generated\nexport const PROFILE_SOURCES_SERVICE = 'po/profile-sources';\n","import { parseProfileBinding, type ProfileSecretReference } from '@agimon-ai/po-config/profiles';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PROFILE_RUNTIME_SERVICE } from '../../constants/profileRuntime';\nimport type {\n ProfileProviderFactory,\n ProfileRuntime,\n ProfileRuntimeOptions,\n ProfileRuntimeSnapshot,\n ProfileSecretRequest,\n ProfileSecretResolver,\n} from './type';\n\nconst UNAVAILABLE = 'Profile integration provider is unavailable';\nconst INVALIDATED = 'Profile operation was invalidated';\n\n/** A single selected profile and provider, owned by one session, not a provider registry. */\nclass SessionProfileRuntime implements ProfileRuntime {\n private controller = new AbortController();\n private snapshot: ProfileRuntimeSnapshot;\n private provider?: { name: string; factory: ProfileProviderFactory };\n private connection?: ProfileSecretResolver;\n private transition: Promise<void> = Promise.resolve();\n private retirement: Promise<void> = Promise.resolve();\n private readonly pending = new Set<Promise<void>>();\n private initializing = false;\n private disposed = false;\n private disposal?: Promise<void>;\n\n constructor(private readonly options: ProfileRuntimeOptions) {\n this.snapshot = this.capture(options.profileName, 1);\n }\n\n private capture(profileName: string | undefined, generation: number): ProfileRuntimeSnapshot {\n const binding = profileName === undefined ? undefined : this.options.readBinding(profileName);\n const env = profileName === undefined ? undefined : this.options.readEnv?.(profileName);\n return Object.freeze({\n ...(profileName === undefined ? {} : { profileName }),\n ...(binding === undefined ? {} : { integration: parseProfileBinding(binding) }),\n ...(env === undefined ? {} : { env: Object.freeze({ ...env }) }),\n generation,\n signal: this.controller.signal,\n });\n }\n\n readSelection(): ProfileRuntimeSnapshot {\n return this.snapshot;\n }\n\n invalidate(): void {\n this.controller.abort();\n const connection = this.connection;\n this.connection = undefined;\n if (connection) {\n this.retirement = this.retirement.then(async () => {\n try {\n await connection.dispose();\n } catch {\n throw new Error('Profile provider disposal failed');\n }\n });\n void this.track(this.retirement);\n }\n }\n\n private track(work: Promise<void>): Promise<void> {\n this.pending.add(work);\n // Keep rejection observable through ready/dispose while preventing an unhandled\n // rejection when selection invalidates an initialization before its owner awaits it.\n void work.then(\n () => this.pending.delete(work),\n () => this.pending.delete(work),\n );\n return work;\n }\n\n private initialize(): Promise<void> {\n const snapshot = this.snapshot;\n const provider = this.provider;\n this.initializing = Boolean(snapshot.integration && provider);\n const work = (async () => {\n await this.retirement;\n if (snapshot.signal.aborted) return;\n if (!snapshot.integration || !provider) return;\n if (snapshot.integration.provider !== provider.name) throw new Error(UNAVAILABLE);\n let connection: ProfileSecretResolver;\n try {\n connection = await provider.factory(snapshot.integration, {\n profileName: snapshot.profileName!,\n generation: snapshot.generation,\n signal: snapshot.signal,\n });\n } catch {\n // A retired factory commonly rejects on abort. That cannot remove the\n // provider attachment or poison the replacement generation.\n if (snapshot.signal.aborted) return;\n throw new Error('Profile provider initialization failed');\n }\n if (snapshot.signal.aborted || this.snapshot !== snapshot || this.disposed) {\n try {\n await connection.dispose();\n } catch {\n throw new Error('Profile provider disposal failed');\n }\n return;\n }\n this.connection = connection;\n })();\n this.transition = this.track(\n work.finally(() => {\n if (this.snapshot === snapshot) this.initializing = false;\n }),\n );\n return this.transition;\n }\n\n async select(profileName?: string, options?: { readonly force?: boolean }): Promise<void> {\n if (this.disposed) throw new Error(INVALIDATED);\n if (\n options?.force !== true &&\n this.snapshot.profileName === profileName &&\n !this.snapshot.signal.aborted &&\n (!this.snapshot.integration || !this.provider || this.connection || this.initializing)\n )\n return;\n this.invalidate();\n this.controller = new AbortController();\n // If reading/validation fails, leave the old generation aborted, never usable.\n this.snapshot = this.capture(profileName, this.snapshot.generation + 1);\n await this.initialize();\n }\n\n async ready(): Promise<void> {\n const snapshot = this.snapshot;\n await this.transition;\n if (this.disposed || snapshot.signal.aborted || this.snapshot !== snapshot) throw new Error(INVALIDATED);\n if (snapshot.integration && !this.connection) throw new Error(UNAVAILABLE);\n }\n\n async attachProvider(providerName: string, factory: ProfileProviderFactory): Promise<() => Promise<void>> {\n if (this.disposed || this.snapshot.signal.aborted) throw new Error(INVALIDATED);\n if (this.provider) throw new Error('Profile provider is already attached');\n if (this.snapshot.integration && this.snapshot.integration.provider !== providerName) throw new Error(UNAVAILABLE);\n const provider = { name: providerName, factory };\n this.provider = provider;\n try {\n await this.initialize();\n await this.ready();\n if (this.disposed || this.provider !== provider) throw new Error(INVALIDATED);\n } catch {\n if (this.provider === provider) this.provider = undefined;\n this.invalidate();\n throw new Error('Profile provider initialization failed');\n }\n let detached = false;\n return async () => {\n if (detached || this.provider !== provider) return;\n detached = true;\n this.invalidate();\n this.provider = undefined;\n this.controller = new AbortController();\n this.snapshot = Object.freeze({\n ...this.snapshot,\n generation: this.snapshot.generation + 1,\n signal: this.controller.signal,\n });\n await this.retirement;\n };\n }\n\n resolveSecret(name: string, request: ProfileSecretRequest): Promise<string> {\n return this.resolveReference(name, request.signal, (reference) => {\n if (!reference.purposes.includes('browser')) throw new Error('Profile secret alias is unavailable');\n if (!reference.allowedOrigins.includes(request.origin)) throw new Error('Profile secret origin is not allowed');\n });\n }\n\n resolveProxySecret(signal?: AbortSignal): Promise<string> {\n const name = this.snapshot.integration?.browser?.proxySecret;\n if (name === undefined) return Promise.reject(new Error('Profile proxy is not configured'));\n return this.resolveReference(name, signal, (reference) => {\n if (!reference.purposes.includes('proxy')) throw new Error('Profile secret alias is unavailable');\n });\n }\n\n private async resolveReference(\n name: string,\n requestSignal: AbortSignal | undefined,\n authorize: (reference: ProfileSecretReference) => void,\n ): Promise<string> {\n // Do not await ready here: a provider factory invoking this callback would\n // otherwise wait for itself. Browser creation may retain, but not invoke it.\n if (this.initializing) throw new Error('Profile secrets are unavailable during provider initialization');\n await this.ready();\n const snapshot = this.snapshot;\n const connection = this.connection;\n const reference = snapshot.integration?.secrets[name];\n if (!connection || !reference || !Object.hasOwn(snapshot.integration!.secrets, name)) {\n throw new Error('Profile secret alias is unavailable');\n }\n authorize(reference);\n const signal = requestSignal ? AbortSignal.any([snapshot.signal, requestSignal]) : snapshot.signal;\n if (signal.aborted) throw new Error(INVALIDATED);\n let value: string;\n try {\n value = await connection.resolveSecret(reference, signal);\n } catch {\n // Provider failures must not leak API responses, credential fields or secrets.\n throw new Error('Profile secret resolution failed');\n }\n if (signal.aborted || this.snapshot !== snapshot || this.connection !== connection) throw new Error(INVALIDATED);\n if (typeof value !== 'string' || value.length === 0) throw new Error('Profile secret field is unavailable');\n return value;\n }\n\n dispose(): Promise<void> {\n if (this.disposal) return this.disposal;\n this.disposed = true;\n this.invalidate();\n this.provider = undefined;\n this.disposal = (async () => {\n const results = await Promise.allSettled([...this.pending, this.retirement]);\n if (results.some((result) => result.status === 'rejected')) throw new Error('Profile runtime disposal failed');\n })();\n return this.disposal;\n }\n}\n\nexport function createProfileRuntime(options: ProfileRuntimeOptions): ProfileRuntime {\n return new SessionProfileRuntime(options);\n}\n\n/** Mounted in the scoped root services array, before dependent integration tools. */\nexport function createProfileRuntimePlugin(runtime: ProfileRuntime): (context: Context) => void {\n return (context) => {\n context.provide(PROFILE_RUNTIME_SERVICE, runtime);\n };\n}\n\nexport function requireProfileRuntime(context: Context): ProfileRuntime {\n const service = context.get(PROFILE_RUNTIME_SERVICE);\n if (!service) throw new Error('Profile runtime service is unavailable');\n return service;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-runtime': ProfileRuntime;\n }\n}\n","// @scaffold-generated\nimport type { ProfileIntegrationBinding } from '@agimon-ai/po-config/profiles';\nimport { type Context, Service } from '@deepseek-ai/cordis';\n\nimport { PROFILE_SECRETS_SERVICE } from '../../constants/profileSecrets';\nimport type { ProfileProviderFactory, ProfileSecretResolver } from '../profileRuntime/type';\nimport type { ProfileEnvSecretRequest, ProfileSecrets, ProfileSecretsOptions } from './type';\n\n/** Every failure is generic so callers never learn which alias, field or provider response failed. */\nconst UNAVAILABLE = 'Profile secrets are unavailable';\n\nclass HostProfileSecrets implements ProfileSecrets {\n private readonly providers = new Map<string, ProfileProviderFactory>();\n private generation = 0;\n\n constructor(private readonly options: ProfileSecretsOptions) {}\n\n registerProvider(provider: string, factory: ProfileProviderFactory): () => void {\n if (this.providers.has(provider)) throw new Error('Profile secrets provider is already registered');\n this.providers.set(provider, factory);\n return () => {\n if (this.providers.get(provider) === factory) this.providers.delete(provider);\n };\n }\n\n async resolveEnv(request: ProfileEnvSecretRequest): Promise<Record<string, string>> {\n if (request.names.length === 0) return {};\n if (new Set(request.names).size !== request.names.length) throw new Error(UNAVAILABLE);\n let binding: ProfileIntegrationBinding | undefined;\n try {\n binding = await this.options.readBinding(request.cwd, request.profile, request.homeDirectory);\n } catch {\n throw new Error(UNAVAILABLE);\n }\n const factory = binding && this.providers.get(binding.provider);\n if (!binding || !factory) throw new Error(UNAVAILABLE);\n const references = request.names.map((name) => {\n const reference = Object.hasOwn(binding.secrets, name) ? binding.secrets[name] : undefined;\n if (!reference?.purposes.includes('env')) throw new Error(UNAVAILABLE);\n return [name, reference] as const;\n });\n\n const controller = new AbortController();\n const signal = request.signal ? AbortSignal.any([controller.signal, request.signal]) : controller.signal;\n let connection: ProfileSecretResolver | undefined;\n try {\n connection = await factory(binding, { profileName: request.profile, generation: ++this.generation, signal });\n const values: Record<string, string> = {};\n for (const [name, reference] of references) {\n const value = await connection.resolveSecret(reference, signal);\n if (signal.aborted || typeof value !== 'string' || value.length === 0) throw new Error(UNAVAILABLE);\n values[name] = value;\n }\n return values;\n } catch {\n throw new Error(UNAVAILABLE);\n } finally {\n controller.abort();\n try {\n await connection?.dispose();\n } catch {\n // Disposal failures are not secret-bearing, but the resolved values are still discarded.\n // oxlint-disable-next-line no-unsafe-finally\n throw new Error(UNAVAILABLE);\n }\n }\n }\n}\n\nexport function createProfileSecrets(options: ProfileSecretsOptions): ProfileSecrets {\n return new HostProfileSecrets(options);\n}\n\n/** Host-side env secret resolution for workflow run steps. Never registered as a model tool. */\nexport class ProfileSecretsService extends Service implements ProfileSecrets {\n constructor(\n context: Context,\n private readonly source: ProfileSecrets,\n ) {\n super(context, PROFILE_SECRETS_SERVICE);\n }\n\n registerProvider(provider: string, factory: ProfileProviderFactory): () => void {\n return this.source.registerProvider(provider, factory);\n }\n\n resolveEnv(request: ProfileEnvSecretRequest): Promise<Record<string, string>> {\n return this.source.resolveEnv(request);\n }\n}\n\n/** Include in the extension services array. The helper owns the child fiber. */\nexport function createProfileSecretsPlugin(source: ProfileSecrets): (context: Context) => void {\n return (context: Context): void => {\n new ProfileSecretsService(context, source);\n };\n}\n\nexport function requireProfileSecrets(context: Context): ProfileSecretsService {\n const service = context.get(PROFILE_SECRETS_SERVICE);\n if (!service) throw new Error('Profile secrets service is unavailable');\n return service;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-secrets': ProfileSecretsService;\n }\n}\n","// @scaffold-generated\nimport { type AgentProfile, inlineProfile } from '@agimon-ai/po-config/profiles';\nimport { type Context, Service } from '@deepseek-ai/cordis';\n\nimport { PROFILE_SOURCES_SERVICE } from '../../constants/profileSources';\nimport type { ContributedProfile, ProfileSource, ProfileSources } from './type';\n\nclass HostProfileSources implements ProfileSources {\n private readonly sources = new Map<string, ProfileSource>();\n\n register(id: string, source: ProfileSource): () => void {\n if (this.sources.has(id)) throw new Error('Profile source is already registered');\n this.sources.set(id, source);\n return () => {\n if (this.sources.get(id) === source) this.sources.delete(id);\n };\n }\n\n list(): ContributedProfile[] {\n const byName = new Map<string, ContributedProfile>();\n for (const source of this.sources.values()) {\n let inputs;\n try {\n inputs = source.list();\n } catch {\n continue;\n }\n for (const input of inputs) {\n if (byName.has(input.name)) continue;\n try {\n const profile = inlineProfile(input);\n if (profile.personaPrompt) byName.set(profile.name, { ...profile, personaPrompt: profile.personaPrompt });\n } catch {\n // An invalid definition is skipped like an invalid directory profile.\n }\n }\n }\n return [...byName.values()].sort((left, right) => left.name.localeCompare(right.name));\n }\n}\n\nexport function createProfileSources(): ProfileSources {\n return new HostProfileSources();\n}\n\n/** File profiles win; a contributed profile only fills a name the file catalog does not hold. */\nexport function mergeProfiles(files: readonly AgentProfile[], sources: ProfileSources | undefined): AgentProfile[] {\n const names = new Set(files.map(({ name }) => name));\n const contributed = (sources?.list() ?? []).filter(({ name }) => !names.has(name));\n return [...files, ...contributed].sort((left, right) => left.name.localeCompare(right.name));\n}\n\nexport function findProfile(\n files: readonly AgentProfile[],\n sources: ProfileSources | undefined,\n name: string,\n): AgentProfile {\n const profile =\n files.find((candidate) => candidate.name === name) ?? sources?.list().find((candidate) => candidate.name === name);\n if (!profile) throw new Error(`Unknown profile: ${name}`);\n return profile;\n}\n\n/** Profiles plugins hold in memory, merged into the session catalog. Optional: absent means files only. */\nexport class ProfileSourcesService extends Service implements ProfileSources {\n constructor(\n context: Context,\n private readonly source: ProfileSources,\n ) {\n super(context, PROFILE_SOURCES_SERVICE);\n }\n\n register(id: string, source: ProfileSource): () => void {\n return this.source.register(id, source);\n }\n\n list(): ContributedProfile[] {\n return this.source.list();\n }\n}\n\n/** Include in the extension services array. The helper owns the child fiber. */\nexport function createProfileSourcesPlugin(source: ProfileSources): (context: Context) => void {\n return (context: Context): void => {\n new ProfileSourcesService(context, source);\n };\n}\n\nexport function readProfileSources(context: Context): ProfileSources | undefined {\n return context.get(PROFILE_SOURCES_SERVICE);\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-sources': ProfileSourcesService;\n }\n}\n","import type { AgentProfile } from '@agimon-ai/po-config/profiles';\n\nconst NONE = '(none)';\n\n/** Footer status key the cockpit's profile axis reads. */\ninterface SelectItem {\n value: string;\n label: string;\n description?: string;\n}\n\nexport const PROFILE_STATUS_KEY = 'po-profile';\n\n/** Identity this package registers voice capabilities under. */\nexport const PROFILE_SOURCE = '@agimon-ai/po-profile';\n\n/** The command a queued voice switch invokes, and the reload handoff kind it parks. */\nexport const PROFILE_COMMAND = 'profile';\n\n/**\n * The published axis content: the active profile's name, empty while\n * profiles exist with none active, and undefined to withhold the status so\n * the cockpit keeps the axis off the bar entirely.\n */\nexport function profileStatus(current: string | undefined, hasProfiles: boolean): string | undefined {\n if (current) return current;\n return hasProfiles ? '' : undefined;\n}\n\n/** Rows for the single-select profile picker. */\nexport function profileItems(profiles: AgentProfile[]): SelectItem[] {\n return profiles.map((profile) => ({\n value: profile.name,\n label: profile.name,\n description: profileDescription(profile),\n }));\n}\n\nexport function profileDescription(profile: AgentProfile): string {\n const environmentKeys = Object.keys(profile.env).sort();\n return environmentKeys.length > 0 ? `${profile.persona} (env: ${environmentKeys.join(', ')})` : profile.persona;\n}\n\n/** Shown when the picked profile is already active. */\nexport function profileSummary(profile: AgentProfile): string {\n const environmentKeys = Object.keys(profile.env).sort();\n return [\n `Profile ${profile.name}`,\n `Persona: ${profile.persona}`,\n `Env: ${environmentKeys.join(', ') || NONE}`,\n 'Already loaded.',\n ].join('\\n');\n}\n\nexport function profileTitle(current?: string): string {\n return `Profile (current: ${current ?? NONE})`;\n}\n"],"mappings":";;;AAAA,MAAa,0BAA0B;;;ACCvC,MAAa,0BAA0B;;;ACAvC,MAAa,0BAA0B;;;ACYvC,MAAMA,gBAAc;AACpB,MAAM,cAAc;;AAGpB,IAAM,wBAAN,MAAsD;CAYvB;CAX7B,aAAqB,IAAI,gBAAgB;CACzC;CACA;CACA;CACA,aAAoC,QAAQ,QAAQ;CACpD,aAAoC,QAAQ,QAAQ;CACpD,0BAA2B,IAAI,IAAmB;CAClD,eAAuB;CACvB,WAAmB;CACnB;CAEA,YAAY,SAAiD;EAAhC,KAAA,UAAA;EAC3B,KAAK,WAAW,KAAK,QAAQ,QAAQ,aAAa,CAAC;CACrD;CAEA,QAAgB,aAAiC,YAA4C;EAC3F,MAAM,UAAU,gBAAgB,KAAA,IAAY,KAAA,IAAY,KAAK,QAAQ,YAAY,WAAW;EAC5F,MAAM,MAAM,gBAAgB,KAAA,IAAY,KAAA,IAAY,KAAK,QAAQ,UAAU,WAAW;EACtF,OAAO,OAAO,OAAO;GACnB,GAAI,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY;GACnD,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,oBAAoB,OAAO,EAAE;GAC7E,GAAI,QAAQ,KAAA,IAAY,CAAC,IAAI,EA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CACxC;CAEA,OAA6B;EAC3B,OAAO,KAAK,OAAO,KAAK;CAC1B;AACF;;AAGA,SAAgB,2BAA2B,QAAoD;CAC7F,QAAQ,YAA2B;EACjC,IAAI,sBAAsB,SAAS,MAAM;CAC3C;AACF;AAEA,SAAgB,mBAAmB,SAA8C;CAC/E,OAAO,QAAQ,IAAI,uBAAuB;AAC5C;;;ACxFA,MAAM,OAAO;AASb,MAAa,qBAAqB;;AAMlC,MAAa,kBAAkB;;;;;;AAO/B,SAAgB,cAAc,SAA6B,aAA0C;CACnG,IAAI,SAAS,OAAO;CACpB,OAAO,cAAc,KAAK,KAAA;AAC5B;;AAGA,SAAgB,aAAa,UAAwC;CACnE,OAAO,SAAS,KAAK,aAAa;EAChC,OAAO,QAAQ;EACf,OAAO,QAAQ;EACf,aAAa,mBAAmB,OAAO;CACzC,EAAE;AACJ;AAEA,SAAgB,mBAAmB,SAA+B;CAChE,MAAM,kBAAkB,OAAO,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK;CACtD,OAAO,gBAAgB,SAAS,IAAI,GAAG,QAAQ,QAAQ,SAAS,gBAAgB,KAAK,IAAI,EAAE,KAAK,QAAQ;AAC1G;;AAGA,SAAgB,eAAe,SAA+B;CAC5D,MAAM,kBAAkB,OAAO,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK;CACtD,OAAO;EACL,WAAW,QAAQ;EACnB,YAAY,QAAQ;EACpB,QAAQ,gBAAgB,KAAK,IAAI,KAAK;EACtC;CACF,CAAC,CAAC,KAAK,IAAI;AACb;AAEA,SAAgB,aAAa,SAA0B;CACrD,OAAO,qBAAqB,WAAW,KAAK;AAC9C"}
|
|
@@ -98,9 +98,9 @@ var SessionProfileRuntime = class {
|
|
|
98
98
|
}));
|
|
99
99
|
return this.transition;
|
|
100
100
|
}
|
|
101
|
-
async select(profileName) {
|
|
101
|
+
async select(profileName, options) {
|
|
102
102
|
if (this.disposed) throw new Error(INVALIDATED);
|
|
103
|
-
if (this.snapshot.profileName === profileName && !this.snapshot.signal.aborted && (!this.snapshot.integration || !this.provider || this.connection || this.initializing)) return;
|
|
103
|
+
if (options?.force !== true && this.snapshot.profileName === profileName && !this.snapshot.signal.aborted && (!this.snapshot.integration || !this.provider || this.connection || this.initializing)) return;
|
|
104
104
|
this.invalidate();
|
|
105
105
|
this.controller = new AbortController();
|
|
106
106
|
this.snapshot = this.capture(profileName, this.snapshot.generation + 1);
|
|
@@ -538,4 +538,4 @@ Object.defineProperty(exports, "requireProfileSecrets", {
|
|
|
538
538
|
}
|
|
539
539
|
});
|
|
540
540
|
|
|
541
|
-
//# sourceMappingURL=profileText-
|
|
541
|
+
//# sourceMappingURL=profileText-CW8eCbwJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileText-CW8eCbwJ.cjs","names":["UNAVAILABLE","parseProfileBinding","Service","inlineProfile","Service"],"sources":["../src/constants/profileRuntime.ts","../src/constants/profileSecrets.ts","../src/constants/profileSources.ts","../src/services/profileRuntime/index.ts","../src/services/profileSecrets/index.ts","../src/services/profileSources/index.ts","../src/services/profileText/index.ts"],"sourcesContent":["export const PROFILE_RUNTIME_SERVICE = 'po/profile-runtime';\n","// @scaffold-generated\nexport const PROFILE_SECRETS_SERVICE = 'po/profile-secrets';\n","// @scaffold-generated\nexport const PROFILE_SOURCES_SERVICE = 'po/profile-sources';\n","import { parseProfileBinding, type ProfileSecretReference } from '@agimon-ai/po-config/profiles';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PROFILE_RUNTIME_SERVICE } from '../../constants/profileRuntime';\nimport type {\n ProfileProviderFactory,\n ProfileRuntime,\n ProfileRuntimeOptions,\n ProfileRuntimeSnapshot,\n ProfileSecretRequest,\n ProfileSecretResolver,\n} from './type';\n\nconst UNAVAILABLE = 'Profile integration provider is unavailable';\nconst INVALIDATED = 'Profile operation was invalidated';\n\n/** A single selected profile and provider, owned by one session, not a provider registry. */\nclass SessionProfileRuntime implements ProfileRuntime {\n private controller = new AbortController();\n private snapshot: ProfileRuntimeSnapshot;\n private provider?: { name: string; factory: ProfileProviderFactory };\n private connection?: ProfileSecretResolver;\n private transition: Promise<void> = Promise.resolve();\n private retirement: Promise<void> = Promise.resolve();\n private readonly pending = new Set<Promise<void>>();\n private initializing = false;\n private disposed = false;\n private disposal?: Promise<void>;\n\n constructor(private readonly options: ProfileRuntimeOptions) {\n this.snapshot = this.capture(options.profileName, 1);\n }\n\n private capture(profileName: string | undefined, generation: number): ProfileRuntimeSnapshot {\n const binding = profileName === undefined ? undefined : this.options.readBinding(profileName);\n const env = profileName === undefined ? undefined : this.options.readEnv?.(profileName);\n return Object.freeze({\n ...(profileName === undefined ? {} : { profileName }),\n ...(binding === undefined ? {} : { integration: parseProfileBinding(binding) }),\n ...(env === undefined ? {} : { env: Object.freeze({ ...env }) }),\n generation,\n signal: this.controller.signal,\n });\n }\n\n readSelection(): ProfileRuntimeSnapshot {\n return this.snapshot;\n }\n\n invalidate(): void {\n this.controller.abort();\n const connection = this.connection;\n this.connection = undefined;\n if (connection) {\n this.retirement = this.retirement.then(async () => {\n try {\n await connection.dispose();\n } catch {\n throw new Error('Profile provider disposal failed');\n }\n });\n void this.track(this.retirement);\n }\n }\n\n private track(work: Promise<void>): Promise<void> {\n this.pending.add(work);\n // Keep rejection observable through ready/dispose while preventing an unhandled\n // rejection when selection invalidates an initialization before its owner awaits it.\n void work.then(\n () => this.pending.delete(work),\n () => this.pending.delete(work),\n );\n return work;\n }\n\n private initialize(): Promise<void> {\n const snapshot = this.snapshot;\n const provider = this.provider;\n this.initializing = Boolean(snapshot.integration && provider);\n const work = (async () => {\n await this.retirement;\n if (snapshot.signal.aborted) return;\n if (!snapshot.integration || !provider) return;\n if (snapshot.integration.provider !== provider.name) throw new Error(UNAVAILABLE);\n let connection: ProfileSecretResolver;\n try {\n connection = await provider.factory(snapshot.integration, {\n profileName: snapshot.profileName!,\n generation: snapshot.generation,\n signal: snapshot.signal,\n });\n } catch {\n // A retired factory commonly rejects on abort. That cannot remove the\n // provider attachment or poison the replacement generation.\n if (snapshot.signal.aborted) return;\n throw new Error('Profile provider initialization failed');\n }\n if (snapshot.signal.aborted || this.snapshot !== snapshot || this.disposed) {\n try {\n await connection.dispose();\n } catch {\n throw new Error('Profile provider disposal failed');\n }\n return;\n }\n this.connection = connection;\n })();\n this.transition = this.track(\n work.finally(() => {\n if (this.snapshot === snapshot) this.initializing = false;\n }),\n );\n return this.transition;\n }\n\n async select(profileName?: string, options?: { readonly force?: boolean }): Promise<void> {\n if (this.disposed) throw new Error(INVALIDATED);\n if (\n options?.force !== true &&\n this.snapshot.profileName === profileName &&\n !this.snapshot.signal.aborted &&\n (!this.snapshot.integration || !this.provider || this.connection || this.initializing)\n )\n return;\n this.invalidate();\n this.controller = new AbortController();\n // If reading/validation fails, leave the old generation aborted, never usable.\n this.snapshot = this.capture(profileName, this.snapshot.generation + 1);\n await this.initialize();\n }\n\n async ready(): Promise<void> {\n const snapshot = this.snapshot;\n await this.transition;\n if (this.disposed || snapshot.signal.aborted || this.snapshot !== snapshot) throw new Error(INVALIDATED);\n if (snapshot.integration && !this.connection) throw new Error(UNAVAILABLE);\n }\n\n async attachProvider(providerName: string, factory: ProfileProviderFactory): Promise<() => Promise<void>> {\n if (this.disposed || this.snapshot.signal.aborted) throw new Error(INVALIDATED);\n if (this.provider) throw new Error('Profile provider is already attached');\n if (this.snapshot.integration && this.snapshot.integration.provider !== providerName) throw new Error(UNAVAILABLE);\n const provider = { name: providerName, factory };\n this.provider = provider;\n try {\n await this.initialize();\n await this.ready();\n if (this.disposed || this.provider !== provider) throw new Error(INVALIDATED);\n } catch {\n if (this.provider === provider) this.provider = undefined;\n this.invalidate();\n throw new Error('Profile provider initialization failed');\n }\n let detached = false;\n return async () => {\n if (detached || this.provider !== provider) return;\n detached = true;\n this.invalidate();\n this.provider = undefined;\n this.controller = new AbortController();\n this.snapshot = Object.freeze({\n ...this.snapshot,\n generation: this.snapshot.generation + 1,\n signal: this.controller.signal,\n });\n await this.retirement;\n };\n }\n\n resolveSecret(name: string, request: ProfileSecretRequest): Promise<string> {\n return this.resolveReference(name, request.signal, (reference) => {\n if (!reference.purposes.includes('browser')) throw new Error('Profile secret alias is unavailable');\n if (!reference.allowedOrigins.includes(request.origin)) throw new Error('Profile secret origin is not allowed');\n });\n }\n\n resolveProxySecret(signal?: AbortSignal): Promise<string> {\n const name = this.snapshot.integration?.browser?.proxySecret;\n if (name === undefined) return Promise.reject(new Error('Profile proxy is not configured'));\n return this.resolveReference(name, signal, (reference) => {\n if (!reference.purposes.includes('proxy')) throw new Error('Profile secret alias is unavailable');\n });\n }\n\n private async resolveReference(\n name: string,\n requestSignal: AbortSignal | undefined,\n authorize: (reference: ProfileSecretReference) => void,\n ): Promise<string> {\n // Do not await ready here: a provider factory invoking this callback would\n // otherwise wait for itself. Browser creation may retain, but not invoke it.\n if (this.initializing) throw new Error('Profile secrets are unavailable during provider initialization');\n await this.ready();\n const snapshot = this.snapshot;\n const connection = this.connection;\n const reference = snapshot.integration?.secrets[name];\n if (!connection || !reference || !Object.hasOwn(snapshot.integration!.secrets, name)) {\n throw new Error('Profile secret alias is unavailable');\n }\n authorize(reference);\n const signal = requestSignal ? AbortSignal.any([snapshot.signal, requestSignal]) : snapshot.signal;\n if (signal.aborted) throw new Error(INVALIDATED);\n let value: string;\n try {\n value = await connection.resolveSecret(reference, signal);\n } catch {\n // Provider failures must not leak API responses, credential fields or secrets.\n throw new Error('Profile secret resolution failed');\n }\n if (signal.aborted || this.snapshot !== snapshot || this.connection !== connection) throw new Error(INVALIDATED);\n if (typeof value !== 'string' || value.length === 0) throw new Error('Profile secret field is unavailable');\n return value;\n }\n\n dispose(): Promise<void> {\n if (this.disposal) return this.disposal;\n this.disposed = true;\n this.invalidate();\n this.provider = undefined;\n this.disposal = (async () => {\n const results = await Promise.allSettled([...this.pending, this.retirement]);\n if (results.some((result) => result.status === 'rejected')) throw new Error('Profile runtime disposal failed');\n })();\n return this.disposal;\n }\n}\n\nexport function createProfileRuntime(options: ProfileRuntimeOptions): ProfileRuntime {\n return new SessionProfileRuntime(options);\n}\n\n/** Mounted in the scoped root services array, before dependent integration tools. */\nexport function createProfileRuntimePlugin(runtime: ProfileRuntime): (context: Context) => void {\n return (context) => {\n context.provide(PROFILE_RUNTIME_SERVICE, runtime);\n };\n}\n\nexport function requireProfileRuntime(context: Context): ProfileRuntime {\n const service = context.get(PROFILE_RUNTIME_SERVICE);\n if (!service) throw new Error('Profile runtime service is unavailable');\n return service;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-runtime': ProfileRuntime;\n }\n}\n","// @scaffold-generated\nimport type { ProfileIntegrationBinding } from '@agimon-ai/po-config/profiles';\nimport { type Context, Service } from '@deepseek-ai/cordis';\n\nimport { PROFILE_SECRETS_SERVICE } from '../../constants/profileSecrets';\nimport type { ProfileProviderFactory, ProfileSecretResolver } from '../profileRuntime/type';\nimport type { ProfileEnvSecretRequest, ProfileSecrets, ProfileSecretsOptions } from './type';\n\n/** Every failure is generic so callers never learn which alias, field or provider response failed. */\nconst UNAVAILABLE = 'Profile secrets are unavailable';\n\nclass HostProfileSecrets implements ProfileSecrets {\n private readonly providers = new Map<string, ProfileProviderFactory>();\n private generation = 0;\n\n constructor(private readonly options: ProfileSecretsOptions) {}\n\n registerProvider(provider: string, factory: ProfileProviderFactory): () => void {\n if (this.providers.has(provider)) throw new Error('Profile secrets provider is already registered');\n this.providers.set(provider, factory);\n return () => {\n if (this.providers.get(provider) === factory) this.providers.delete(provider);\n };\n }\n\n async resolveEnv(request: ProfileEnvSecretRequest): Promise<Record<string, string>> {\n if (request.names.length === 0) return {};\n if (new Set(request.names).size !== request.names.length) throw new Error(UNAVAILABLE);\n let binding: ProfileIntegrationBinding | undefined;\n try {\n binding = await this.options.readBinding(request.cwd, request.profile, request.homeDirectory);\n } catch {\n throw new Error(UNAVAILABLE);\n }\n const factory = binding && this.providers.get(binding.provider);\n if (!binding || !factory) throw new Error(UNAVAILABLE);\n const references = request.names.map((name) => {\n const reference = Object.hasOwn(binding.secrets, name) ? binding.secrets[name] : undefined;\n if (!reference?.purposes.includes('env')) throw new Error(UNAVAILABLE);\n return [name, reference] as const;\n });\n\n const controller = new AbortController();\n const signal = request.signal ? AbortSignal.any([controller.signal, request.signal]) : controller.signal;\n let connection: ProfileSecretResolver | undefined;\n try {\n connection = await factory(binding, { profileName: request.profile, generation: ++this.generation, signal });\n const values: Record<string, string> = {};\n for (const [name, reference] of references) {\n const value = await connection.resolveSecret(reference, signal);\n if (signal.aborted || typeof value !== 'string' || value.length === 0) throw new Error(UNAVAILABLE);\n values[name] = value;\n }\n return values;\n } catch {\n throw new Error(UNAVAILABLE);\n } finally {\n controller.abort();\n try {\n await connection?.dispose();\n } catch {\n // Disposal failures are not secret-bearing, but the resolved values are still discarded.\n // oxlint-disable-next-line no-unsafe-finally\n throw new Error(UNAVAILABLE);\n }\n }\n }\n}\n\nexport function createProfileSecrets(options: ProfileSecretsOptions): ProfileSecrets {\n return new HostProfileSecrets(options);\n}\n\n/** Host-side env secret resolution for workflow run steps. Never registered as a model tool. */\nexport class ProfileSecretsService extends Service implements ProfileSecrets {\n constructor(\n context: Context,\n private readonly source: ProfileSecrets,\n ) {\n super(context, PROFILE_SECRETS_SERVICE);\n }\n\n registerProvider(provider: string, factory: ProfileProviderFactory): () => void {\n return this.source.registerProvider(provider, factory);\n }\n\n resolveEnv(request: ProfileEnvSecretRequest): Promise<Record<string, string>> {\n return this.source.resolveEnv(request);\n }\n}\n\n/** Include in the extension services array. The helper owns the child fiber. */\nexport function createProfileSecretsPlugin(source: ProfileSecrets): (context: Context) => void {\n return (context: Context): void => {\n new ProfileSecretsService(context, source);\n };\n}\n\nexport function requireProfileSecrets(context: Context): ProfileSecretsService {\n const service = context.get(PROFILE_SECRETS_SERVICE);\n if (!service) throw new Error('Profile secrets service is unavailable');\n return service;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-secrets': ProfileSecretsService;\n }\n}\n","// @scaffold-generated\nimport { type AgentProfile, inlineProfile } from '@agimon-ai/po-config/profiles';\nimport { type Context, Service } from '@deepseek-ai/cordis';\n\nimport { PROFILE_SOURCES_SERVICE } from '../../constants/profileSources';\nimport type { ContributedProfile, ProfileSource, ProfileSources } from './type';\n\nclass HostProfileSources implements ProfileSources {\n private readonly sources = new Map<string, ProfileSource>();\n\n register(id: string, source: ProfileSource): () => void {\n if (this.sources.has(id)) throw new Error('Profile source is already registered');\n this.sources.set(id, source);\n return () => {\n if (this.sources.get(id) === source) this.sources.delete(id);\n };\n }\n\n list(): ContributedProfile[] {\n const byName = new Map<string, ContributedProfile>();\n for (const source of this.sources.values()) {\n let inputs;\n try {\n inputs = source.list();\n } catch {\n continue;\n }\n for (const input of inputs) {\n if (byName.has(input.name)) continue;\n try {\n const profile = inlineProfile(input);\n if (profile.personaPrompt) byName.set(profile.name, { ...profile, personaPrompt: profile.personaPrompt });\n } catch {\n // An invalid definition is skipped like an invalid directory profile.\n }\n }\n }\n return [...byName.values()].sort((left, right) => left.name.localeCompare(right.name));\n }\n}\n\nexport function createProfileSources(): ProfileSources {\n return new HostProfileSources();\n}\n\n/** File profiles win; a contributed profile only fills a name the file catalog does not hold. */\nexport function mergeProfiles(files: readonly AgentProfile[], sources: ProfileSources | undefined): AgentProfile[] {\n const names = new Set(files.map(({ name }) => name));\n const contributed = (sources?.list() ?? []).filter(({ name }) => !names.has(name));\n return [...files, ...contributed].sort((left, right) => left.name.localeCompare(right.name));\n}\n\nexport function findProfile(\n files: readonly AgentProfile[],\n sources: ProfileSources | undefined,\n name: string,\n): AgentProfile {\n const profile =\n files.find((candidate) => candidate.name === name) ?? sources?.list().find((candidate) => candidate.name === name);\n if (!profile) throw new Error(`Unknown profile: ${name}`);\n return profile;\n}\n\n/** Profiles plugins hold in memory, merged into the session catalog. Optional: absent means files only. */\nexport class ProfileSourcesService extends Service implements ProfileSources {\n constructor(\n context: Context,\n private readonly source: ProfileSources,\n ) {\n super(context, PROFILE_SOURCES_SERVICE);\n }\n\n register(id: string, source: ProfileSource): () => void {\n return this.source.register(id, source);\n }\n\n list(): ContributedProfile[] {\n return this.source.list();\n }\n}\n\n/** Include in the extension services array. The helper owns the child fiber. */\nexport function createProfileSourcesPlugin(source: ProfileSources): (context: Context) => void {\n return (context: Context): void => {\n new ProfileSourcesService(context, source);\n };\n}\n\nexport function readProfileSources(context: Context): ProfileSources | undefined {\n return context.get(PROFILE_SOURCES_SERVICE);\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-sources': ProfileSourcesService;\n }\n}\n","import type { AgentProfile } from '@agimon-ai/po-config/profiles';\n\nconst NONE = '(none)';\n\n/** Footer status key the cockpit's profile axis reads. */\ninterface SelectItem {\n value: string;\n label: string;\n description?: string;\n}\n\nexport const PROFILE_STATUS_KEY = 'po-profile';\n\n/** Identity this package registers voice capabilities under. */\nexport const PROFILE_SOURCE = '@agimon-ai/po-profile';\n\n/** The command a queued voice switch invokes, and the reload handoff kind it parks. */\nexport const PROFILE_COMMAND = 'profile';\n\n/**\n * The published axis content: the active profile's name, empty while\n * profiles exist with none active, and undefined to withhold the status so\n * the cockpit keeps the axis off the bar entirely.\n */\nexport function profileStatus(current: string | undefined, hasProfiles: boolean): string | undefined {\n if (current) return current;\n return hasProfiles ? '' : undefined;\n}\n\n/** Rows for the single-select profile picker. */\nexport function profileItems(profiles: AgentProfile[]): SelectItem[] {\n return profiles.map((profile) => ({\n value: profile.name,\n label: profile.name,\n description: profileDescription(profile),\n }));\n}\n\nexport function profileDescription(profile: AgentProfile): string {\n const environmentKeys = Object.keys(profile.env).sort();\n return environmentKeys.length > 0 ? `${profile.persona} (env: ${environmentKeys.join(', ')})` : profile.persona;\n}\n\n/** Shown when the picked profile is already active. */\nexport function profileSummary(profile: AgentProfile): string {\n const environmentKeys = Object.keys(profile.env).sort();\n return [\n `Profile ${profile.name}`,\n `Persona: ${profile.persona}`,\n `Env: ${environmentKeys.join(', ') || NONE}`,\n 'Already loaded.',\n ].join('\\n');\n}\n\nexport function profileTitle(current?: string): string {\n return `Profile (current: ${current ?? NONE})`;\n}\n"],"mappings":";;;AAAA,MAAa,0BAA0B;;;ACCvC,MAAa,0BAA0B;;;ACAvC,MAAa,0BAA0B;;;ACYvC,MAAMA,gBAAc;AACpB,MAAM,cAAc;;AAGpB,IAAM,wBAAN,MAAsD;CAYvB;CAX7B,aAAqB,IAAI,gBAAgB;CACzC;CACA;CACA;CACA,aAAoC,QAAQ,QAAQ;CACpD,aAAoC,QAAQ,QAAQ;CACpD,0BAA2B,IAAI,IAAmB;CAClD,eAAuB;CACvB,WAAmB;CACnB;CAEA,YAAY,SAAiD;EAAhC,KAAA,UAAA;EAC3B,KAAK,WAAW,KAAK,QAAQ,QAAQ,aAAa,CAAC;CACrD;CAEA,QAAgB,aAAiC,YAA4C;EAC3F,MAAM,UAAU,gBAAgB,KAAA,IAAY,KAAA,IAAY,KAAK,QAAQ,YAAY,WAAW;EAC5F,MAAM,MAAM,gBAAgB,KAAA,IAAY,KAAA,IAAY,KAAK,QAAQ,UAAU,WAAW;EACtF,OAAO,OAAO,OAAO;GACnB,GAAI,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY;GACnD,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,cAAA,GAAaC,8BAAAA,oBAAAA,CAAoB,OAAO,EAAE;GAC7E,GAAI,QAAQ,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK,OAAO,OAAO,EAAE,GAAG,IAAI,CAAC,EAAE;GAC9D;GACA,QAAQ,KAAK,WAAW;EAC1B,CAAC;CACH;CAEA,gBAAwC;EACtC,OAAO,KAAK;CACd;CAEA,aAAmB;EACjB,KAAK,WAAW,MAAM;EACtB,MAAM,aAAa,KAAK;EACxB,KAAK,aAAa,KAAA;EAClB,IAAI,YAAY;GACd,KAAK,aAAa,KAAK,WAAW,KAAK,YAAY;IACjD,IAAI;KACF,MAAM,WAAW,QAAQ;IAC3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Aa,kBAAkB;;;;;;AAO/B,SAAgB,cAAc,SAA6B,aAA0C;CACnG,IAAI,SAAS,OAAO;CACpB,OAAO,cAAc,KAAK,KAAA;AAC5B;;AAGA,SAAgB,aAAa,UAAwC;CACnE,OAAO,SAAS,KAAK,aAAa;EAChC,OAAO,QAAQ;EACf,OAAO,QAAQ;EACf,aAAa,mBAAmB,OAAO;CACzC,EAAE;AACJ;AAEA,SAAgB,mBAAmB,SAA+B;CAChE,MAAM,kBAAkB,OAAO,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK;CACtD,OAAO,gBAAgB,SAAS,IAAI,GAAG,QAAQ,QAAQ,SAAS,gBAAgB,KAAK,IAAI,EAAE,KAAK,QAAQ;AAC1G;;AAGA,SAAgB,eAAe,SAA+B;CAC5D,MAAM,kBAAkB,OAAO,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK;CACtD,OAAO;EACL,WAAW,QAAQ;EACnB,YAAY,QAAQ;EACpB,QAAQ,gBAAgB,KAAK,IAAI,KAAK;EACtC;CACF,CAAC,CAAC,KAAK,IAAI;AACb;AAEA,SAAgB,aAAa,SAA0B;CACrD,OAAO,qBAAqB,WAAW,KAAK;AAC9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-profile",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.42",
|
|
4
4
|
"description": "Persona and environment profile switching for Po sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-persona",
|
|
@@ -66,19 +66,19 @@
|
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@agimon-ai/po-config": "0.0.0-alpha.
|
|
70
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
71
|
-
"@agimon-ai/po-minor-mode": "0.0.0-alpha.
|
|
69
|
+
"@agimon-ai/po-config": "0.0.0-alpha.42",
|
|
70
|
+
"@agimon-ai/po-core": "0.0.0-alpha.42",
|
|
71
|
+
"@agimon-ai/po-minor-mode": "0.0.0-alpha.42",
|
|
72
72
|
"@deepseek-ai/cordis": "4.0.5",
|
|
73
73
|
"typebox": "1.4.2"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
77
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
78
|
-
"@agimon-ai/po-voice": "0.0.0-alpha.
|
|
79
|
-
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.
|
|
76
|
+
"@agimon-ai/po-build": "0.0.0-alpha.42",
|
|
77
|
+
"@agimon-ai/po-core": "0.0.0-alpha.42",
|
|
78
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.42",
|
|
79
|
+
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.42",
|
|
80
80
|
"@deepseek-ai/cordis": "4.0.5",
|
|
81
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
81
|
+
"@earendil-works/pi-coding-agent": "1.4.0",
|
|
82
82
|
"@types/node": "26.6.5",
|
|
83
83
|
"@vitest/coverage-v8": "5.0.4",
|
|
84
84
|
"tsdown": "0.23.1",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"vitest": "5.0.4"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
90
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
89
|
+
"@agimon-ai/po-core": "0.0.0-alpha.42",
|
|
90
|
+
"@earendil-works/pi-coding-agent": "1.4.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependenciesMeta": {
|
|
93
93
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profileText-eSDL6Q5R.cjs","names":["UNAVAILABLE","parseProfileBinding","Service","inlineProfile","Service"],"sources":["../src/constants/profileRuntime.ts","../src/constants/profileSecrets.ts","../src/constants/profileSources.ts","../src/services/profileRuntime/index.ts","../src/services/profileSecrets/index.ts","../src/services/profileSources/index.ts","../src/services/profileText/index.ts"],"sourcesContent":["export const PROFILE_RUNTIME_SERVICE = 'po/profile-runtime';\n","// @scaffold-generated\nexport const PROFILE_SECRETS_SERVICE = 'po/profile-secrets';\n","// @scaffold-generated\nexport const PROFILE_SOURCES_SERVICE = 'po/profile-sources';\n","import { parseProfileBinding, type ProfileSecretReference } from '@agimon-ai/po-config/profiles';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PROFILE_RUNTIME_SERVICE } from '../../constants/profileRuntime';\nimport type {\n ProfileProviderFactory,\n ProfileRuntime,\n ProfileRuntimeOptions,\n ProfileRuntimeSnapshot,\n ProfileSecretRequest,\n ProfileSecretResolver,\n} from './type';\n\nconst UNAVAILABLE = 'Profile integration provider is unavailable';\nconst INVALIDATED = 'Profile operation was invalidated';\n\n/** A single selected profile and provider, owned by one session, not a provider registry. */\nclass SessionProfileRuntime implements ProfileRuntime {\n private controller = new AbortController();\n private snapshot: ProfileRuntimeSnapshot;\n private provider?: { name: string; factory: ProfileProviderFactory };\n private connection?: ProfileSecretResolver;\n private transition: Promise<void> = Promise.resolve();\n private retirement: Promise<void> = Promise.resolve();\n private readonly pending = new Set<Promise<void>>();\n private initializing = false;\n private disposed = false;\n private disposal?: Promise<void>;\n\n constructor(private readonly options: ProfileRuntimeOptions) {\n this.snapshot = this.capture(options.profileName, 1);\n }\n\n private capture(profileName: string | undefined, generation: number): ProfileRuntimeSnapshot {\n const binding = profileName === undefined ? undefined : this.options.readBinding(profileName);\n const env = profileName === undefined ? undefined : this.options.readEnv?.(profileName);\n return Object.freeze({\n ...(profileName === undefined ? {} : { profileName }),\n ...(binding === undefined ? {} : { integration: parseProfileBinding(binding) }),\n ...(env === undefined ? {} : { env: Object.freeze({ ...env }) }),\n generation,\n signal: this.controller.signal,\n });\n }\n\n readSelection(): ProfileRuntimeSnapshot {\n return this.snapshot;\n }\n\n invalidate(): void {\n this.controller.abort();\n const connection = this.connection;\n this.connection = undefined;\n if (connection) {\n this.retirement = this.retirement.then(async () => {\n try {\n await connection.dispose();\n } catch {\n throw new Error('Profile provider disposal failed');\n }\n });\n void this.track(this.retirement);\n }\n }\n\n private track(work: Promise<void>): Promise<void> {\n this.pending.add(work);\n // Keep rejection observable through ready/dispose while preventing an unhandled\n // rejection when selection invalidates an initialization before its owner awaits it.\n void work.then(\n () => this.pending.delete(work),\n () => this.pending.delete(work),\n );\n return work;\n }\n\n private initialize(): Promise<void> {\n const snapshot = this.snapshot;\n const provider = this.provider;\n this.initializing = Boolean(snapshot.integration && provider);\n const work = (async () => {\n await this.retirement;\n if (snapshot.signal.aborted) return;\n if (!snapshot.integration || !provider) return;\n if (snapshot.integration.provider !== provider.name) throw new Error(UNAVAILABLE);\n let connection: ProfileSecretResolver;\n try {\n connection = await provider.factory(snapshot.integration, {\n profileName: snapshot.profileName!,\n generation: snapshot.generation,\n signal: snapshot.signal,\n });\n } catch {\n // A retired factory commonly rejects on abort. That cannot remove the\n // provider attachment or poison the replacement generation.\n if (snapshot.signal.aborted) return;\n throw new Error('Profile provider initialization failed');\n }\n if (snapshot.signal.aborted || this.snapshot !== snapshot || this.disposed) {\n try {\n await connection.dispose();\n } catch {\n throw new Error('Profile provider disposal failed');\n }\n return;\n }\n this.connection = connection;\n })();\n this.transition = this.track(\n work.finally(() => {\n if (this.snapshot === snapshot) this.initializing = false;\n }),\n );\n return this.transition;\n }\n\n async select(profileName?: string): Promise<void> {\n if (this.disposed) throw new Error(INVALIDATED);\n if (\n this.snapshot.profileName === profileName &&\n !this.snapshot.signal.aborted &&\n (!this.snapshot.integration || !this.provider || this.connection || this.initializing)\n )\n return;\n this.invalidate();\n this.controller = new AbortController();\n // If reading/validation fails, leave the old generation aborted, never usable.\n this.snapshot = this.capture(profileName, this.snapshot.generation + 1);\n await this.initialize();\n }\n\n async ready(): Promise<void> {\n const snapshot = this.snapshot;\n await this.transition;\n if (this.disposed || snapshot.signal.aborted || this.snapshot !== snapshot) throw new Error(INVALIDATED);\n if (snapshot.integration && !this.connection) throw new Error(UNAVAILABLE);\n }\n\n async attachProvider(providerName: string, factory: ProfileProviderFactory): Promise<() => Promise<void>> {\n if (this.disposed || this.snapshot.signal.aborted) throw new Error(INVALIDATED);\n if (this.provider) throw new Error('Profile provider is already attached');\n if (this.snapshot.integration && this.snapshot.integration.provider !== providerName) throw new Error(UNAVAILABLE);\n const provider = { name: providerName, factory };\n this.provider = provider;\n try {\n await this.initialize();\n await this.ready();\n if (this.disposed || this.provider !== provider) throw new Error(INVALIDATED);\n } catch {\n if (this.provider === provider) this.provider = undefined;\n this.invalidate();\n throw new Error('Profile provider initialization failed');\n }\n let detached = false;\n return async () => {\n if (detached || this.provider !== provider) return;\n detached = true;\n this.invalidate();\n this.provider = undefined;\n this.controller = new AbortController();\n this.snapshot = Object.freeze({\n ...this.snapshot,\n generation: this.snapshot.generation + 1,\n signal: this.controller.signal,\n });\n await this.retirement;\n };\n }\n\n resolveSecret(name: string, request: ProfileSecretRequest): Promise<string> {\n return this.resolveReference(name, request.signal, (reference) => {\n if (!reference.purposes.includes('browser')) throw new Error('Profile secret alias is unavailable');\n if (!reference.allowedOrigins.includes(request.origin)) throw new Error('Profile secret origin is not allowed');\n });\n }\n\n resolveProxySecret(signal?: AbortSignal): Promise<string> {\n const name = this.snapshot.integration?.browser?.proxySecret;\n if (name === undefined) return Promise.reject(new Error('Profile proxy is not configured'));\n return this.resolveReference(name, signal, (reference) => {\n if (!reference.purposes.includes('proxy')) throw new Error('Profile secret alias is unavailable');\n });\n }\n\n private async resolveReference(\n name: string,\n requestSignal: AbortSignal | undefined,\n authorize: (reference: ProfileSecretReference) => void,\n ): Promise<string> {\n // Do not await ready here: a provider factory invoking this callback would\n // otherwise wait for itself. Browser creation may retain, but not invoke it.\n if (this.initializing) throw new Error('Profile secrets are unavailable during provider initialization');\n await this.ready();\n const snapshot = this.snapshot;\n const connection = this.connection;\n const reference = snapshot.integration?.secrets[name];\n if (!connection || !reference || !Object.hasOwn(snapshot.integration!.secrets, name)) {\n throw new Error('Profile secret alias is unavailable');\n }\n authorize(reference);\n const signal = requestSignal ? AbortSignal.any([snapshot.signal, requestSignal]) : snapshot.signal;\n if (signal.aborted) throw new Error(INVALIDATED);\n let value: string;\n try {\n value = await connection.resolveSecret(reference, signal);\n } catch {\n // Provider failures must not leak API responses, credential fields or secrets.\n throw new Error('Profile secret resolution failed');\n }\n if (signal.aborted || this.snapshot !== snapshot || this.connection !== connection) throw new Error(INVALIDATED);\n if (typeof value !== 'string' || value.length === 0) throw new Error('Profile secret field is unavailable');\n return value;\n }\n\n dispose(): Promise<void> {\n if (this.disposal) return this.disposal;\n this.disposed = true;\n this.invalidate();\n this.provider = undefined;\n this.disposal = (async () => {\n const results = await Promise.allSettled([...this.pending, this.retirement]);\n if (results.some((result) => result.status === 'rejected')) throw new Error('Profile runtime disposal failed');\n })();\n return this.disposal;\n }\n}\n\nexport function createProfileRuntime(options: ProfileRuntimeOptions): ProfileRuntime {\n return new SessionProfileRuntime(options);\n}\n\n/** Mounted in the scoped root services array, before dependent integration tools. */\nexport function createProfileRuntimePlugin(runtime: ProfileRuntime): (context: Context) => void {\n return (context) => {\n context.provide(PROFILE_RUNTIME_SERVICE, runtime);\n };\n}\n\nexport function requireProfileRuntime(context: Context): ProfileRuntime {\n const service = context.get(PROFILE_RUNTIME_SERVICE);\n if (!service) throw new Error('Profile runtime service is unavailable');\n return service;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-runtime': ProfileRuntime;\n }\n}\n","// @scaffold-generated\nimport type { ProfileIntegrationBinding } from '@agimon-ai/po-config/profiles';\nimport { type Context, Service } from '@deepseek-ai/cordis';\n\nimport { PROFILE_SECRETS_SERVICE } from '../../constants/profileSecrets';\nimport type { ProfileProviderFactory, ProfileSecretResolver } from '../profileRuntime/type';\nimport type { ProfileEnvSecretRequest, ProfileSecrets, ProfileSecretsOptions } from './type';\n\n/** Every failure is generic so callers never learn which alias, field or provider response failed. */\nconst UNAVAILABLE = 'Profile secrets are unavailable';\n\nclass HostProfileSecrets implements ProfileSecrets {\n private readonly providers = new Map<string, ProfileProviderFactory>();\n private generation = 0;\n\n constructor(private readonly options: ProfileSecretsOptions) {}\n\n registerProvider(provider: string, factory: ProfileProviderFactory): () => void {\n if (this.providers.has(provider)) throw new Error('Profile secrets provider is already registered');\n this.providers.set(provider, factory);\n return () => {\n if (this.providers.get(provider) === factory) this.providers.delete(provider);\n };\n }\n\n async resolveEnv(request: ProfileEnvSecretRequest): Promise<Record<string, string>> {\n if (request.names.length === 0) return {};\n if (new Set(request.names).size !== request.names.length) throw new Error(UNAVAILABLE);\n let binding: ProfileIntegrationBinding | undefined;\n try {\n binding = await this.options.readBinding(request.cwd, request.profile, request.homeDirectory);\n } catch {\n throw new Error(UNAVAILABLE);\n }\n const factory = binding && this.providers.get(binding.provider);\n if (!binding || !factory) throw new Error(UNAVAILABLE);\n const references = request.names.map((name) => {\n const reference = Object.hasOwn(binding.secrets, name) ? binding.secrets[name] : undefined;\n if (!reference?.purposes.includes('env')) throw new Error(UNAVAILABLE);\n return [name, reference] as const;\n });\n\n const controller = new AbortController();\n const signal = request.signal ? AbortSignal.any([controller.signal, request.signal]) : controller.signal;\n let connection: ProfileSecretResolver | undefined;\n try {\n connection = await factory(binding, { profileName: request.profile, generation: ++this.generation, signal });\n const values: Record<string, string> = {};\n for (const [name, reference] of references) {\n const value = await connection.resolveSecret(reference, signal);\n if (signal.aborted || typeof value !== 'string' || value.length === 0) throw new Error(UNAVAILABLE);\n values[name] = value;\n }\n return values;\n } catch {\n throw new Error(UNAVAILABLE);\n } finally {\n controller.abort();\n try {\n await connection?.dispose();\n } catch {\n // Disposal failures are not secret-bearing, but the resolved values are still discarded.\n // oxlint-disable-next-line no-unsafe-finally\n throw new Error(UNAVAILABLE);\n }\n }\n }\n}\n\nexport function createProfileSecrets(options: ProfileSecretsOptions): ProfileSecrets {\n return new HostProfileSecrets(options);\n}\n\n/** Host-side env secret resolution for workflow run steps. Never registered as a model tool. */\nexport class ProfileSecretsService extends Service implements ProfileSecrets {\n constructor(\n context: Context,\n private readonly source: ProfileSecrets,\n ) {\n super(context, PROFILE_SECRETS_SERVICE);\n }\n\n registerProvider(provider: string, factory: ProfileProviderFactory): () => void {\n return this.source.registerProvider(provider, factory);\n }\n\n resolveEnv(request: ProfileEnvSecretRequest): Promise<Record<string, string>> {\n return this.source.resolveEnv(request);\n }\n}\n\n/** Include in the extension services array. The helper owns the child fiber. */\nexport function createProfileSecretsPlugin(source: ProfileSecrets): (context: Context) => void {\n return (context: Context): void => {\n new ProfileSecretsService(context, source);\n };\n}\n\nexport function requireProfileSecrets(context: Context): ProfileSecretsService {\n const service = context.get(PROFILE_SECRETS_SERVICE);\n if (!service) throw new Error('Profile secrets service is unavailable');\n return service;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-secrets': ProfileSecretsService;\n }\n}\n","// @scaffold-generated\nimport { type AgentProfile, inlineProfile } from '@agimon-ai/po-config/profiles';\nimport { type Context, Service } from '@deepseek-ai/cordis';\n\nimport { PROFILE_SOURCES_SERVICE } from '../../constants/profileSources';\nimport type { ContributedProfile, ProfileSource, ProfileSources } from './type';\n\nclass HostProfileSources implements ProfileSources {\n private readonly sources = new Map<string, ProfileSource>();\n\n register(id: string, source: ProfileSource): () => void {\n if (this.sources.has(id)) throw new Error('Profile source is already registered');\n this.sources.set(id, source);\n return () => {\n if (this.sources.get(id) === source) this.sources.delete(id);\n };\n }\n\n list(): ContributedProfile[] {\n const byName = new Map<string, ContributedProfile>();\n for (const source of this.sources.values()) {\n let inputs;\n try {\n inputs = source.list();\n } catch {\n continue;\n }\n for (const input of inputs) {\n if (byName.has(input.name)) continue;\n try {\n const profile = inlineProfile(input);\n if (profile.personaPrompt) byName.set(profile.name, { ...profile, personaPrompt: profile.personaPrompt });\n } catch {\n // An invalid definition is skipped like an invalid directory profile.\n }\n }\n }\n return [...byName.values()].sort((left, right) => left.name.localeCompare(right.name));\n }\n}\n\nexport function createProfileSources(): ProfileSources {\n return new HostProfileSources();\n}\n\n/** File profiles win; a contributed profile only fills a name the file catalog does not hold. */\nexport function mergeProfiles(files: readonly AgentProfile[], sources: ProfileSources | undefined): AgentProfile[] {\n const names = new Set(files.map(({ name }) => name));\n const contributed = (sources?.list() ?? []).filter(({ name }) => !names.has(name));\n return [...files, ...contributed].sort((left, right) => left.name.localeCompare(right.name));\n}\n\nexport function findProfile(\n files: readonly AgentProfile[],\n sources: ProfileSources | undefined,\n name: string,\n): AgentProfile {\n const profile =\n files.find((candidate) => candidate.name === name) ?? sources?.list().find((candidate) => candidate.name === name);\n if (!profile) throw new Error(`Unknown profile: ${name}`);\n return profile;\n}\n\n/** Profiles plugins hold in memory, merged into the session catalog. Optional: absent means files only. */\nexport class ProfileSourcesService extends Service implements ProfileSources {\n constructor(\n context: Context,\n private readonly source: ProfileSources,\n ) {\n super(context, PROFILE_SOURCES_SERVICE);\n }\n\n register(id: string, source: ProfileSource): () => void {\n return this.source.register(id, source);\n }\n\n list(): ContributedProfile[] {\n return this.source.list();\n }\n}\n\n/** Include in the extension services array. The helper owns the child fiber. */\nexport function createProfileSourcesPlugin(source: ProfileSources): (context: Context) => void {\n return (context: Context): void => {\n new ProfileSourcesService(context, source);\n };\n}\n\nexport function readProfileSources(context: Context): ProfileSources | undefined {\n return context.get(PROFILE_SOURCES_SERVICE);\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-sources': ProfileSourcesService;\n }\n}\n","import type { AgentProfile } from '@agimon-ai/po-config/profiles';\n\nconst NONE = '(none)';\n\n/** Footer status key the cockpit's profile axis reads. */\ninterface SelectItem {\n value: string;\n label: string;\n description?: string;\n}\n\nexport const PROFILE_STATUS_KEY = 'po-profile';\n\n/** Identity this package registers voice capabilities under. */\nexport const PROFILE_SOURCE = '@agimon-ai/po-profile';\n\n/** The command a queued voice switch invokes, and the reload handoff kind it parks. */\nexport const PROFILE_COMMAND = 'profile';\n\n/**\n * The published axis content: the active profile's name, empty while\n * profiles exist with none active, and undefined to withhold the status so\n * the cockpit keeps the axis off the bar entirely.\n */\nexport function profileStatus(current: string | undefined, hasProfiles: boolean): string | undefined {\n if (current) return current;\n return hasProfiles ? '' : undefined;\n}\n\n/** Rows for the single-select profile picker. */\nexport function profileItems(profiles: AgentProfile[]): SelectItem[] {\n return profiles.map((profile) => ({\n value: profile.name,\n label: profile.name,\n description: profileDescription(profile),\n }));\n}\n\nexport function profileDescription(profile: AgentProfile): string {\n const environmentKeys = Object.keys(profile.env).sort();\n return environmentKeys.length > 0 ? `${profile.persona} (env: ${environmentKeys.join(', ')})` : profile.persona;\n}\n\n/** Shown when the picked profile is already active. */\nexport function profileSummary(profile: AgentProfile): string {\n const environmentKeys = Object.keys(profile.env).sort();\n return [\n `Profile ${profile.name}`,\n `Persona: ${profile.persona}`,\n `Env: ${environmentKeys.join(', ') || NONE}`,\n 'Already loaded.',\n ].join('\\n');\n}\n\nexport function profileTitle(current?: string): string {\n return `Profile (current: ${current ?? NONE})`;\n}\n"],"mappings":";;;AAAA,MAAa,0BAA0B;;;ACCvC,MAAa,0BAA0B;;;ACAvC,MAAa,0BAA0B;;;ACYvC,MAAMA,gBAAc;AACpB,MAAM,cAAc;;AAGpB,IAAM,wBAAN,MAAsD;CAYvB;CAX7B,aAAqB,IAAI,gBAAgB;CACzC;CACA;CACA;CACA,aAAoC,QAAQ,QAAQ;CACpD,aAAoC,QAAQ,QAAQ;CACpD,0BAA2B,IAAI,IAAmB;CAClD,eAAuB;CACvB,WAAmB;CACnB;CAEA,YAAY,SAAiD;EAAhC,KAAA,UAAA;EAC3B,KAAK,WAAW,KAAK,QAAQ,QAAQ,aAAa,CAAC;CACrD;CAEA,QAAgB,aAAiC,YAA4C;EAC3F,MAAM,UAAU,gBAAgB,KAAA,IAAY,KAAA,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AAQ,gBAAgB,KAAK,IAAI,KAAK;EACtC;CACF,CAAC,CAAC,KAAK,IAAI;AACb;AAEA,SAAgB,aAAa,SAA0B;CACrD,OAAO,qBAAqB,WAAW,KAAK;AAC9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profileText-kBfecwbl.mjs","names":["UNAVAILABLE"],"sources":["../src/constants/profileRuntime.ts","../src/constants/profileSecrets.ts","../src/constants/profileSources.ts","../src/services/profileRuntime/index.ts","../src/services/profileSecrets/index.ts","../src/services/profileSources/index.ts","../src/services/profileText/index.ts"],"sourcesContent":["export const PROFILE_RUNTIME_SERVICE = 'po/profile-runtime';\n","// @scaffold-generated\nexport const PROFILE_SECRETS_SERVICE = 'po/profile-secrets';\n","// @scaffold-generated\nexport const PROFILE_SOURCES_SERVICE = 'po/profile-sources';\n","import { parseProfileBinding, type ProfileSecretReference } from '@agimon-ai/po-config/profiles';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PROFILE_RUNTIME_SERVICE } from '../../constants/profileRuntime';\nimport type {\n ProfileProviderFactory,\n ProfileRuntime,\n ProfileRuntimeOptions,\n ProfileRuntimeSnapshot,\n ProfileSecretRequest,\n ProfileSecretResolver,\n} from './type';\n\nconst UNAVAILABLE = 'Profile integration provider is unavailable';\nconst INVALIDATED = 'Profile operation was invalidated';\n\n/** A single selected profile and provider, owned by one session, not a provider registry. */\nclass SessionProfileRuntime implements ProfileRuntime {\n private controller = new AbortController();\n private snapshot: ProfileRuntimeSnapshot;\n private provider?: { name: string; factory: ProfileProviderFactory };\n private connection?: ProfileSecretResolver;\n private transition: Promise<void> = Promise.resolve();\n private retirement: Promise<void> = Promise.resolve();\n private readonly pending = new Set<Promise<void>>();\n private initializing = false;\n private disposed = false;\n private disposal?: Promise<void>;\n\n constructor(private readonly options: ProfileRuntimeOptions) {\n this.snapshot = this.capture(options.profileName, 1);\n }\n\n private capture(profileName: string | undefined, generation: number): ProfileRuntimeSnapshot {\n const binding = profileName === undefined ? undefined : this.options.readBinding(profileName);\n const env = profileName === undefined ? undefined : this.options.readEnv?.(profileName);\n return Object.freeze({\n ...(profileName === undefined ? {} : { profileName }),\n ...(binding === undefined ? {} : { integration: parseProfileBinding(binding) }),\n ...(env === undefined ? {} : { env: Object.freeze({ ...env }) }),\n generation,\n signal: this.controller.signal,\n });\n }\n\n readSelection(): ProfileRuntimeSnapshot {\n return this.snapshot;\n }\n\n invalidate(): void {\n this.controller.abort();\n const connection = this.connection;\n this.connection = undefined;\n if (connection) {\n this.retirement = this.retirement.then(async () => {\n try {\n await connection.dispose();\n } catch {\n throw new Error('Profile provider disposal failed');\n }\n });\n void this.track(this.retirement);\n }\n }\n\n private track(work: Promise<void>): Promise<void> {\n this.pending.add(work);\n // Keep rejection observable through ready/dispose while preventing an unhandled\n // rejection when selection invalidates an initialization before its owner awaits it.\n void work.then(\n () => this.pending.delete(work),\n () => this.pending.delete(work),\n );\n return work;\n }\n\n private initialize(): Promise<void> {\n const snapshot = this.snapshot;\n const provider = this.provider;\n this.initializing = Boolean(snapshot.integration && provider);\n const work = (async () => {\n await this.retirement;\n if (snapshot.signal.aborted) return;\n if (!snapshot.integration || !provider) return;\n if (snapshot.integration.provider !== provider.name) throw new Error(UNAVAILABLE);\n let connection: ProfileSecretResolver;\n try {\n connection = await provider.factory(snapshot.integration, {\n profileName: snapshot.profileName!,\n generation: snapshot.generation,\n signal: snapshot.signal,\n });\n } catch {\n // A retired factory commonly rejects on abort. That cannot remove the\n // provider attachment or poison the replacement generation.\n if (snapshot.signal.aborted) return;\n throw new Error('Profile provider initialization failed');\n }\n if (snapshot.signal.aborted || this.snapshot !== snapshot || this.disposed) {\n try {\n await connection.dispose();\n } catch {\n throw new Error('Profile provider disposal failed');\n }\n return;\n }\n this.connection = connection;\n })();\n this.transition = this.track(\n work.finally(() => {\n if (this.snapshot === snapshot) this.initializing = false;\n }),\n );\n return this.transition;\n }\n\n async select(profileName?: string): Promise<void> {\n if (this.disposed) throw new Error(INVALIDATED);\n if (\n this.snapshot.profileName === profileName &&\n !this.snapshot.signal.aborted &&\n (!this.snapshot.integration || !this.provider || this.connection || this.initializing)\n )\n return;\n this.invalidate();\n this.controller = new AbortController();\n // If reading/validation fails, leave the old generation aborted, never usable.\n this.snapshot = this.capture(profileName, this.snapshot.generation + 1);\n await this.initialize();\n }\n\n async ready(): Promise<void> {\n const snapshot = this.snapshot;\n await this.transition;\n if (this.disposed || snapshot.signal.aborted || this.snapshot !== snapshot) throw new Error(INVALIDATED);\n if (snapshot.integration && !this.connection) throw new Error(UNAVAILABLE);\n }\n\n async attachProvider(providerName: string, factory: ProfileProviderFactory): Promise<() => Promise<void>> {\n if (this.disposed || this.snapshot.signal.aborted) throw new Error(INVALIDATED);\n if (this.provider) throw new Error('Profile provider is already attached');\n if (this.snapshot.integration && this.snapshot.integration.provider !== providerName) throw new Error(UNAVAILABLE);\n const provider = { name: providerName, factory };\n this.provider = provider;\n try {\n await this.initialize();\n await this.ready();\n if (this.disposed || this.provider !== provider) throw new Error(INVALIDATED);\n } catch {\n if (this.provider === provider) this.provider = undefined;\n this.invalidate();\n throw new Error('Profile provider initialization failed');\n }\n let detached = false;\n return async () => {\n if (detached || this.provider !== provider) return;\n detached = true;\n this.invalidate();\n this.provider = undefined;\n this.controller = new AbortController();\n this.snapshot = Object.freeze({\n ...this.snapshot,\n generation: this.snapshot.generation + 1,\n signal: this.controller.signal,\n });\n await this.retirement;\n };\n }\n\n resolveSecret(name: string, request: ProfileSecretRequest): Promise<string> {\n return this.resolveReference(name, request.signal, (reference) => {\n if (!reference.purposes.includes('browser')) throw new Error('Profile secret alias is unavailable');\n if (!reference.allowedOrigins.includes(request.origin)) throw new Error('Profile secret origin is not allowed');\n });\n }\n\n resolveProxySecret(signal?: AbortSignal): Promise<string> {\n const name = this.snapshot.integration?.browser?.proxySecret;\n if (name === undefined) return Promise.reject(new Error('Profile proxy is not configured'));\n return this.resolveReference(name, signal, (reference) => {\n if (!reference.purposes.includes('proxy')) throw new Error('Profile secret alias is unavailable');\n });\n }\n\n private async resolveReference(\n name: string,\n requestSignal: AbortSignal | undefined,\n authorize: (reference: ProfileSecretReference) => void,\n ): Promise<string> {\n // Do not await ready here: a provider factory invoking this callback would\n // otherwise wait for itself. Browser creation may retain, but not invoke it.\n if (this.initializing) throw new Error('Profile secrets are unavailable during provider initialization');\n await this.ready();\n const snapshot = this.snapshot;\n const connection = this.connection;\n const reference = snapshot.integration?.secrets[name];\n if (!connection || !reference || !Object.hasOwn(snapshot.integration!.secrets, name)) {\n throw new Error('Profile secret alias is unavailable');\n }\n authorize(reference);\n const signal = requestSignal ? AbortSignal.any([snapshot.signal, requestSignal]) : snapshot.signal;\n if (signal.aborted) throw new Error(INVALIDATED);\n let value: string;\n try {\n value = await connection.resolveSecret(reference, signal);\n } catch {\n // Provider failures must not leak API responses, credential fields or secrets.\n throw new Error('Profile secret resolution failed');\n }\n if (signal.aborted || this.snapshot !== snapshot || this.connection !== connection) throw new Error(INVALIDATED);\n if (typeof value !== 'string' || value.length === 0) throw new Error('Profile secret field is unavailable');\n return value;\n }\n\n dispose(): Promise<void> {\n if (this.disposal) return this.disposal;\n this.disposed = true;\n this.invalidate();\n this.provider = undefined;\n this.disposal = (async () => {\n const results = await Promise.allSettled([...this.pending, this.retirement]);\n if (results.some((result) => result.status === 'rejected')) throw new Error('Profile runtime disposal failed');\n })();\n return this.disposal;\n }\n}\n\nexport function createProfileRuntime(options: ProfileRuntimeOptions): ProfileRuntime {\n return new SessionProfileRuntime(options);\n}\n\n/** Mounted in the scoped root services array, before dependent integration tools. */\nexport function createProfileRuntimePlugin(runtime: ProfileRuntime): (context: Context) => void {\n return (context) => {\n context.provide(PROFILE_RUNTIME_SERVICE, runtime);\n };\n}\n\nexport function requireProfileRuntime(context: Context): ProfileRuntime {\n const service = context.get(PROFILE_RUNTIME_SERVICE);\n if (!service) throw new Error('Profile runtime service is unavailable');\n return service;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-runtime': ProfileRuntime;\n }\n}\n","// @scaffold-generated\nimport type { ProfileIntegrationBinding } from '@agimon-ai/po-config/profiles';\nimport { type Context, Service } from '@deepseek-ai/cordis';\n\nimport { PROFILE_SECRETS_SERVICE } from '../../constants/profileSecrets';\nimport type { ProfileProviderFactory, ProfileSecretResolver } from '../profileRuntime/type';\nimport type { ProfileEnvSecretRequest, ProfileSecrets, ProfileSecretsOptions } from './type';\n\n/** Every failure is generic so callers never learn which alias, field or provider response failed. */\nconst UNAVAILABLE = 'Profile secrets are unavailable';\n\nclass HostProfileSecrets implements ProfileSecrets {\n private readonly providers = new Map<string, ProfileProviderFactory>();\n private generation = 0;\n\n constructor(private readonly options: ProfileSecretsOptions) {}\n\n registerProvider(provider: string, factory: ProfileProviderFactory): () => void {\n if (this.providers.has(provider)) throw new Error('Profile secrets provider is already registered');\n this.providers.set(provider, factory);\n return () => {\n if (this.providers.get(provider) === factory) this.providers.delete(provider);\n };\n }\n\n async resolveEnv(request: ProfileEnvSecretRequest): Promise<Record<string, string>> {\n if (request.names.length === 0) return {};\n if (new Set(request.names).size !== request.names.length) throw new Error(UNAVAILABLE);\n let binding: ProfileIntegrationBinding | undefined;\n try {\n binding = await this.options.readBinding(request.cwd, request.profile, request.homeDirectory);\n } catch {\n throw new Error(UNAVAILABLE);\n }\n const factory = binding && this.providers.get(binding.provider);\n if (!binding || !factory) throw new Error(UNAVAILABLE);\n const references = request.names.map((name) => {\n const reference = Object.hasOwn(binding.secrets, name) ? binding.secrets[name] : undefined;\n if (!reference?.purposes.includes('env')) throw new Error(UNAVAILABLE);\n return [name, reference] as const;\n });\n\n const controller = new AbortController();\n const signal = request.signal ? AbortSignal.any([controller.signal, request.signal]) : controller.signal;\n let connection: ProfileSecretResolver | undefined;\n try {\n connection = await factory(binding, { profileName: request.profile, generation: ++this.generation, signal });\n const values: Record<string, string> = {};\n for (const [name, reference] of references) {\n const value = await connection.resolveSecret(reference, signal);\n if (signal.aborted || typeof value !== 'string' || value.length === 0) throw new Error(UNAVAILABLE);\n values[name] = value;\n }\n return values;\n } catch {\n throw new Error(UNAVAILABLE);\n } finally {\n controller.abort();\n try {\n await connection?.dispose();\n } catch {\n // Disposal failures are not secret-bearing, but the resolved values are still discarded.\n // oxlint-disable-next-line no-unsafe-finally\n throw new Error(UNAVAILABLE);\n }\n }\n }\n}\n\nexport function createProfileSecrets(options: ProfileSecretsOptions): ProfileSecrets {\n return new HostProfileSecrets(options);\n}\n\n/** Host-side env secret resolution for workflow run steps. Never registered as a model tool. */\nexport class ProfileSecretsService extends Service implements ProfileSecrets {\n constructor(\n context: Context,\n private readonly source: ProfileSecrets,\n ) {\n super(context, PROFILE_SECRETS_SERVICE);\n }\n\n registerProvider(provider: string, factory: ProfileProviderFactory): () => void {\n return this.source.registerProvider(provider, factory);\n }\n\n resolveEnv(request: ProfileEnvSecretRequest): Promise<Record<string, string>> {\n return this.source.resolveEnv(request);\n }\n}\n\n/** Include in the extension services array. The helper owns the child fiber. */\nexport function createProfileSecretsPlugin(source: ProfileSecrets): (context: Context) => void {\n return (context: Context): void => {\n new ProfileSecretsService(context, source);\n };\n}\n\nexport function requireProfileSecrets(context: Context): ProfileSecretsService {\n const service = context.get(PROFILE_SECRETS_SERVICE);\n if (!service) throw new Error('Profile secrets service is unavailable');\n return service;\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-secrets': ProfileSecretsService;\n }\n}\n","// @scaffold-generated\nimport { type AgentProfile, inlineProfile } from '@agimon-ai/po-config/profiles';\nimport { type Context, Service } from '@deepseek-ai/cordis';\n\nimport { PROFILE_SOURCES_SERVICE } from '../../constants/profileSources';\nimport type { ContributedProfile, ProfileSource, ProfileSources } from './type';\n\nclass HostProfileSources implements ProfileSources {\n private readonly sources = new Map<string, ProfileSource>();\n\n register(id: string, source: ProfileSource): () => void {\n if (this.sources.has(id)) throw new Error('Profile source is already registered');\n this.sources.set(id, source);\n return () => {\n if (this.sources.get(id) === source) this.sources.delete(id);\n };\n }\n\n list(): ContributedProfile[] {\n const byName = new Map<string, ContributedProfile>();\n for (const source of this.sources.values()) {\n let inputs;\n try {\n inputs = source.list();\n } catch {\n continue;\n }\n for (const input of inputs) {\n if (byName.has(input.name)) continue;\n try {\n const profile = inlineProfile(input);\n if (profile.personaPrompt) byName.set(profile.name, { ...profile, personaPrompt: profile.personaPrompt });\n } catch {\n // An invalid definition is skipped like an invalid directory profile.\n }\n }\n }\n return [...byName.values()].sort((left, right) => left.name.localeCompare(right.name));\n }\n}\n\nexport function createProfileSources(): ProfileSources {\n return new HostProfileSources();\n}\n\n/** File profiles win; a contributed profile only fills a name the file catalog does not hold. */\nexport function mergeProfiles(files: readonly AgentProfile[], sources: ProfileSources | undefined): AgentProfile[] {\n const names = new Set(files.map(({ name }) => name));\n const contributed = (sources?.list() ?? []).filter(({ name }) => !names.has(name));\n return [...files, ...contributed].sort((left, right) => left.name.localeCompare(right.name));\n}\n\nexport function findProfile(\n files: readonly AgentProfile[],\n sources: ProfileSources | undefined,\n name: string,\n): AgentProfile {\n const profile =\n files.find((candidate) => candidate.name === name) ?? sources?.list().find((candidate) => candidate.name === name);\n if (!profile) throw new Error(`Unknown profile: ${name}`);\n return profile;\n}\n\n/** Profiles plugins hold in memory, merged into the session catalog. Optional: absent means files only. */\nexport class ProfileSourcesService extends Service implements ProfileSources {\n constructor(\n context: Context,\n private readonly source: ProfileSources,\n ) {\n super(context, PROFILE_SOURCES_SERVICE);\n }\n\n register(id: string, source: ProfileSource): () => void {\n return this.source.register(id, source);\n }\n\n list(): ContributedProfile[] {\n return this.source.list();\n }\n}\n\n/** Include in the extension services array. The helper owns the child fiber. */\nexport function createProfileSourcesPlugin(source: ProfileSources): (context: Context) => void {\n return (context: Context): void => {\n new ProfileSourcesService(context, source);\n };\n}\n\nexport function readProfileSources(context: Context): ProfileSources | undefined {\n return context.get(PROFILE_SOURCES_SERVICE);\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/profile-sources': ProfileSourcesService;\n }\n}\n","import type { AgentProfile } from '@agimon-ai/po-config/profiles';\n\nconst NONE = '(none)';\n\n/** Footer status key the cockpit's profile axis reads. */\ninterface SelectItem {\n value: string;\n label: string;\n description?: string;\n}\n\nexport const PROFILE_STATUS_KEY = 'po-profile';\n\n/** Identity this package registers voice capabilities under. */\nexport const PROFILE_SOURCE = '@agimon-ai/po-profile';\n\n/** The command a queued voice switch invokes, and the reload handoff kind it parks. */\nexport const PROFILE_COMMAND = 'profile';\n\n/**\n * The published axis content: the active profile's name, empty while\n * profiles exist with none active, and undefined to withhold the status so\n * the cockpit keeps the axis off the bar entirely.\n */\nexport function profileStatus(current: string | undefined, hasProfiles: boolean): string | undefined {\n if (current) return current;\n return hasProfiles ? '' : undefined;\n}\n\n/** Rows for the single-select profile picker. */\nexport function profileItems(profiles: AgentProfile[]): SelectItem[] {\n return profiles.map((profile) => ({\n value: profile.name,\n label: profile.name,\n description: profileDescription(profile),\n }));\n}\n\nexport function profileDescription(profile: AgentProfile): string {\n const environmentKeys = Object.keys(profile.env).sort();\n return environmentKeys.length > 0 ? `${profile.persona} (env: ${environmentKeys.join(', ')})` : profile.persona;\n}\n\n/** Shown when the picked profile is already active. */\nexport function profileSummary(profile: AgentProfile): string {\n const environmentKeys = Object.keys(profile.env).sort();\n return [\n `Profile ${profile.name}`,\n `Persona: ${profile.persona}`,\n `Env: ${environmentKeys.join(', ') || NONE}`,\n 'Already loaded.',\n ].join('\\n');\n}\n\nexport function profileTitle(current?: string): string {\n return `Profile (current: ${current ?? NONE})`;\n}\n"],"mappings":";;;AAAA,MAAa,0BAA0B;;;ACCvC,MAAa,0BAA0B;;;ACAvC,MAAa,0BAA0B;;;ACYvC,MAAMA,gBAAc;AACpB,MAAM,cAAc;;AAGpB,IAAM,wBAAN,MAAsD;CAYvB;CAX7B,aAAqB,IAAI,gBAAgB;CACzC;CACA;CACA;CACA,aAAoC,QAAQ,QAAQ;CACpD,aAAoC,QAAQ,QAAQ;CACpD,0BAA2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