@agimon-ai/po-profile 0.0.0-alpha.2 → 0.0.0-alpha.3

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.
@@ -2,35 +2,12 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- //#region \0rolldown/runtime.js
6
- var __create = Object.create;
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __getOwnPropNames = Object.getOwnPropertyNames;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
- key = keys[i];
15
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: ((k) => from[k]).bind(null, key),
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
- //#endregion
27
5
  const require_profileText = require("../profileText-BkeG0Ulo.cjs");
28
6
  let _agimon_ai_po_config_profiles = require("@agimon-ai/po-config/profiles");
29
7
  let _agimon_ai_po_core_serverFacet = require("@agimon-ai/po-core/serverFacet");
30
8
  let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
31
- let node_os = require("node:os");
32
- node_os = __toESM(node_os, 1);
33
9
  let _agimon_ai_po_core_headless = require("@agimon-ai/po-core/headless");
10
+ let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
34
11
  let _agimon_ai_po_core_profileIdentity = require("@agimon-ai/po-core/profileIdentity");
35
12
  //#region src/extensions/workspaces/sessions/(backend)/root.server.ts
36
13
  var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ agent, signal }) => {
@@ -38,7 +15,7 @@ var root_server_default = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ ag
38
15
  const execution = agent.context;
39
16
  const runtime = require_profileText.createProfileRuntime({
40
17
  profileName: execution.selection.profile,
41
- readBinding: (profileName) => (0, _agimon_ai_po_config_profiles.resolveProfile)(execution.repoRoot, profileName, execution.environment.HOME ?? node_os.default.homedir()).integration
18
+ readBinding: (profileName) => (0, _agimon_ai_po_config_profiles.resolveProfile)(execution.repoRoot, profileName, execution.environment.HOME ?? _agimon_ai_po_core_platform.nodeHost.homeDirectory()).integration
42
19
  });
43
20
  const unsubscribe = agent.subscribeSelection(async (selection) => {
44
21
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"server.cjs","names":["defineRoot","createProfileRuntime","resolveProfile","os","DoomHeadlessPromptAdmissionError","createProfileRuntimePlugin","resolveProfile","buildPersonaPrompt","DOOM_PROFILE_IDENTITY_ENTRY_TYPE","PROFILE_COMMAND","loadProfiles","profileTitle","profileItems","isDoomHeadlessPromptAdmissionError","DoomSessionSetupError","DoomHeadlessPromptAdmissionError","defineRoutedContribution","defineHook","defineHook","defineResource","packageResourcePath","readPackageResource","defineResource","defineServerPlugin","composeServerProviderOverrides","rootSession","composeRootHooks","commandProfile","hookBeforeAgentStart","hookSessionStart","resourcePoAuthorProfile","resourceProfileConfig"],"sources":["../../src/extensions/workspaces/sessions/(backend)/root.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/poAuthorProfile.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server.ts","../../generated/server.ts"],"sourcesContent":["import os from 'node:os';\n\nimport { resolveProfile } from '@agimon-ai/po-config/profiles';\nimport { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { DoomHeadlessPromptAdmissionError } from '@agimon-ai/po-core/headless';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport { createProfileRuntime, createProfileRuntimePlugin } from '../../../../services/profileRuntime';\n\nexport default defineRoot(({ agent, signal }: DoomServerPluginContext) => {\n if (!agent) return { value: undefined };\n const execution = agent.context;\n const runtime = createProfileRuntime({\n profileName: execution.selection.profile,\n readBinding: (profileName) =>\n resolveProfile(execution.repoRoot, profileName, execution.environment.HOME ?? os.homedir()).integration,\n });\n const unsubscribe = agent.subscribeSelection(async (selection) => {\n try {\n await runtime.select(selection.profile);\n } catch (error) {\n throw new DoomHeadlessPromptAdmissionError(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 unsubscribe();\n signal.removeEventListener('abort', invalidate);\n await runtime.dispose();\n },\n };\n});\n","import { buildPersonaPrompt, loadProfiles, resolveProfile } from '@agimon-ai/po-config/profiles';\nimport {\n DoomHeadlessPromptAdmissionError,\n DoomSessionSetupError,\n isDoomHeadlessPromptAdmissionError,\n type DoomHeadlessCommand,\n type DoomHeadlessExecutionContext,\n type DoomHeadlessHostService,\n type DoomHeadlessHook,\n} from '@agimon-ai/po-core/headless';\nimport { DOOM_PROFILE_IDENTITY_ENTRY_TYPE } from '@agimon-ai/po-core/profileIdentity';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { PROFILE_COMMAND, profileItems, profileTitle } from '../../../../../services/profileText';\n\nexport async function readSelectedPersona(execution: {\n readonly repoRoot: string;\n readonly selection: { readonly profile?: string };\n readonly environment?: Readonly<Record<string, string | undefined>>;\n}): Promise<string> {\n const name = execution.selection.profile;\n if (!name) return '(no active profile)';\n const profile = resolveProfile(execution.repoRoot, name, execution.environment?.HOME);\n const prompt = 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(execution: DoomHeadlessExecutionContext, profile: string): Promise<void> {\n const identity = resolveProfile(execution.repoRoot, profile, execution.environment.HOME).identity;\n await execution.session.appendCustomEntry(DOOM_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: DoomHeadlessHostService): DoomHeadlessCommand {\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 = loadProfiles(execution.repoRoot, execution.environment.HOME);\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 (isDoomHeadlessPromptAdmissionError(error))\n throw new DoomSessionSetupError(\n 'Profile integration is unavailable. Restore its credential or choose another profile.',\n );\n throw error;\n }\n await publishSelectedIdentity(execution, 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 DoomHeadlessPromptAdmissionError(error);\n }\n}\n\nexport const profileIdentityHook: DoomHeadlessHook<'session_start'> = {\n event: 'session_start',\n async handle(_event, execution) {\n const profile = execution.selection.profile;\n if (profile !== undefined) await publishSelectedIdentity(execution, profile);\n },\n};\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport { createProfileServerCommand } from '../_lib/profileServer';\nexport default defineRoutedContribution(\n ({ agent }: DoomServerPluginContext) => (agent ? createProfileServerCommand(agent) : undefined),\n { cardinality: 'optional' },\n);\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<DoomServerPluginContext, ProfileRuntime | undefined>) => ({\n async handle() {\n await assertProfileReady(root);\n },\n}));\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady, profileIdentityHook } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<DoomServerPluginContext, ProfileRuntime | undefined>) => ({\n ...profileIdentityHook,\n async handle(event: Readonly<Record<string, unknown>>, execution: DoomHeadlessExecutionContext) {\n await assertProfileReady(root);\n await profileIdentityHook.handle(event, execution);\n },\n}));\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverFacet';\n\nexport default defineResource({\n name: 'po-author-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/po-author-profile/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/po-author-profile/SKILL.md'),\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\n\nimport { readSelectedPersona } from '../_lib/profileServer';\nexport default defineResource({ name: 'po/profile-config', kind: 'context' as const, read: readSelectedPersona });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/po-core/serverFacet';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverFacet';\nimport { composeRootHooks } from '@agimon-ai/po-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.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 resourcePoAuthorProfile from '../src/extensions/workspaces/sessions/(backend)/resource/poAuthorProfile.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 facet = defineServerPlugin({\n name: '@agimon-ai/po-profile',\n providerOverrides: composeServerProviderOverrides(rootSession),\n session: async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get commands(): DoomServerSessionPlugin['commands'] { return defined([via({ name: 'profile' }, at(commandProfile, contextSession))]); },\n get hooks(): DoomServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, contextSession)), via({ event: 'session_start' }, at(hookSessionStart, contextSession))]; },\n get resources(): DoomServerSessionPlugin['resources'] { return [at(resourcePoAuthorProfile, contextSession), at(resourceProfileConfig, contextSession)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAA,uBAAA,GAAeA,iCAAAA,WAAAA,EAAY,EAAE,OAAO,aAAsC;CACxE,IAAI,CAAC,OAAO,OAAO,EAAE,OAAO,KAAA,EAAU;CACtC,MAAM,YAAY,MAAM;CACxB,MAAM,UAAUC,oBAAAA,qBAAqB;EACnC,aAAa,UAAU,UAAU;EACjC,cAAc,iBAAA,GACZC,8BAAAA,eAAAA,CAAe,UAAU,UAAU,aAAa,UAAU,YAAY,QAAQC,QAAAA,QAAG,QAAQ,CAAC,CAAC,CAAC;CAChG,CAAC;CACD,MAAM,cAAc,MAAM,mBAAmB,OAAO,cAAc;EAChE,IAAI;GACF,MAAM,QAAQ,OAAO,UAAU,OAAO;EACxC,SAAS,OAAO;GACd,MAAM,IAAIC,4BAAAA,iCAAiC,KAAK;EAClD;CACF,CAAC;CACD,MAAM,mBAAmB,QAAQ,WAAW;CAC5C,OAAO,iBAAiB,SAAS,YAAY,EAAE,MAAM,KAAK,CAAC;CAC3D,IAAI,OAAO,SAAS,QAAQ,WAAW;CACvC,OAAO;EACL,OAAO;EACP,UAAU,CAACC,oBAAAA,2BAA2B,OAAO,CAAC;EAC9C,MAAM,YAAY;GAChB,YAAY;GACZ,OAAO,oBAAoB,SAAS,UAAU;GAC9C,MAAM,QAAQ,QAAQ;EACxB;CACF;AACF,CAAC;;;ACrBD,eAAsB,oBAAoB,WAItB;CAClB,MAAM,OAAO,UAAU,UAAU;CACjC,IAAI,CAAC,MA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AC,CAAE;GAC3C,IAAI,aAAoD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACzG;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"server.cjs","names":["defineRoot","createProfileRuntime","resolveProfile","nodeHost","DoomHeadlessPromptAdmissionError","createProfileRuntimePlugin","resolveProfile","buildPersonaPrompt","DOOM_PROFILE_IDENTITY_ENTRY_TYPE","PROFILE_COMMAND","loadProfiles","profileTitle","profileItems","isDoomHeadlessPromptAdmissionError","DoomSessionSetupError","DoomHeadlessPromptAdmissionError","defineRoutedContribution","defineHook","defineHook","defineResource","packageResourcePath","readPackageResource","defineResource","defineServerPlugin","composeServerProviderOverrides","rootSession","composeRootHooks","commandProfile","hookBeforeAgentStart","hookSessionStart","resourcePoAuthorProfile","resourceProfileConfig"],"sources":["../../src/extensions/workspaces/sessions/(backend)/root.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/poAuthorProfile.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server.ts","../../generated/server.ts"],"sourcesContent":["import { resolveProfile } from '@agimon-ai/po-config/profiles';\nimport { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { DoomHeadlessPromptAdmissionError } from '@agimon-ai/po-core/headless';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport { createProfileRuntime, createProfileRuntimePlugin } from '../../../../services/profileRuntime';\n\nexport default defineRoot(({ agent, signal }: DoomServerPluginContext) => {\n if (!agent) return { value: undefined };\n const execution = agent.context;\n const runtime = createProfileRuntime({\n profileName: execution.selection.profile,\n readBinding: (profileName) =>\n resolveProfile(execution.repoRoot, profileName, execution.environment.HOME ?? nodeHost.homeDirectory())\n .integration,\n });\n const unsubscribe = agent.subscribeSelection(async (selection) => {\n try {\n await runtime.select(selection.profile);\n } catch (error) {\n throw new DoomHeadlessPromptAdmissionError(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 unsubscribe();\n signal.removeEventListener('abort', invalidate);\n await runtime.dispose();\n },\n };\n});\n","import { buildPersonaPrompt, loadProfiles, resolveProfile } from '@agimon-ai/po-config/profiles';\nimport {\n DoomHeadlessPromptAdmissionError,\n DoomSessionSetupError,\n isDoomHeadlessPromptAdmissionError,\n type DoomHeadlessCommand,\n type DoomHeadlessExecutionContext,\n type DoomHeadlessHostService,\n type DoomHeadlessHook,\n} from '@agimon-ai/po-core/headless';\nimport { DOOM_PROFILE_IDENTITY_ENTRY_TYPE } from '@agimon-ai/po-core/profileIdentity';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { PROFILE_COMMAND, profileItems, profileTitle } from '../../../../../services/profileText';\n\nexport async function readSelectedPersona(execution: {\n readonly repoRoot: string;\n readonly selection: { readonly profile?: string };\n readonly environment?: Readonly<Record<string, string | undefined>>;\n}): Promise<string> {\n const name = execution.selection.profile;\n if (!name) return '(no active profile)';\n const profile = resolveProfile(execution.repoRoot, name, execution.environment?.HOME);\n const prompt = 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(execution: DoomHeadlessExecutionContext, profile: string): Promise<void> {\n const identity = resolveProfile(execution.repoRoot, profile, execution.environment.HOME).identity;\n await execution.session.appendCustomEntry(DOOM_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: DoomHeadlessHostService): DoomHeadlessCommand {\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 = loadProfiles(execution.repoRoot, execution.environment.HOME);\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 (isDoomHeadlessPromptAdmissionError(error))\n throw new DoomSessionSetupError(\n 'Profile integration is unavailable. Restore its credential or choose another profile.',\n );\n throw error;\n }\n await publishSelectedIdentity(execution, 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 DoomHeadlessPromptAdmissionError(error);\n }\n}\n\nexport const profileIdentityHook: DoomHeadlessHook<'session_start'> = {\n event: 'session_start',\n async handle(_event, execution) {\n const profile = execution.selection.profile;\n if (profile !== undefined) await publishSelectedIdentity(execution, profile);\n },\n};\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport { createProfileServerCommand } from '../_lib/profileServer';\nexport default defineRoutedContribution(\n ({ agent }: DoomServerPluginContext) => (agent ? createProfileServerCommand(agent) : undefined),\n { cardinality: 'optional' },\n);\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<DoomServerPluginContext, ProfileRuntime | undefined>) => ({\n async handle() {\n await assertProfileReady(root);\n },\n}));\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady, profileIdentityHook } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<DoomServerPluginContext, ProfileRuntime | undefined>) => ({\n ...profileIdentityHook,\n async handle(event: Readonly<Record<string, unknown>>, execution: DoomHeadlessExecutionContext) {\n await assertProfileReady(root);\n await profileIdentityHook.handle(event, execution);\n },\n}));\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverFacet';\n\nexport default defineResource({\n name: 'po-author-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/po-author-profile/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/po-author-profile/SKILL.md'),\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\n\nimport { readSelectedPersona } from '../_lib/profileServer';\nexport default defineResource({ name: 'po/profile-config', kind: 'context' as const, read: readSelectedPersona });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/po-core/serverFacet';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverFacet';\nimport { composeRootHooks } from '@agimon-ai/po-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.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 resourcePoAuthorProfile from '../src/extensions/workspaces/sessions/(backend)/resource/poAuthorProfile.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 facet = defineServerPlugin({\n name: '@agimon-ai/po-profile',\n providerOverrides: composeServerProviderOverrides(rootSession),\n session: async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get commands(): DoomServerSessionPlugin['commands'] { return defined([via({ name: 'profile' }, at(commandProfile, contextSession))]); },\n get hooks(): DoomServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, contextSession)), via({ event: 'session_start' }, at(hookSessionStart, contextSession))]; },\n get resources(): DoomServerSessionPlugin['resources'] { return [at(resourcePoAuthorProfile, contextSession), at(resourceProfileConfig, contextSession)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;;;;;;;;AAQA,IAAA,uBAAA,GAAeA,iCAAAA,WAAAA,EAAY,EAAE,OAAO,aAAsC;CACxE,IAAI,CAAC,OAAO,OAAO,EAAE,OAAO,KAA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A,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,SAAA,GAAQC,+BAAAA,mBAAAA,CAAmB;CACtC,MAAM;CACN,oBAAA,GAAmBC,+BAAAA,+BAAAA,CAA+BC,mBAAW;CAC7D,SAAS,OAAO,YAAY;EAC1B,MAAM,eAAe,MAAMA,oBAAY,OAAO;EAC9C,MAAM,iBAAiB;GAAE,GAAG;GAAS,MAAM,aAAa;EAAM;EAC9D,OAAO;GACL,IAAA,GAAGC,iCAAAA,iBAAAA,CAAiB,YAAY;GAChC,IAAI,WAAgD;IAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,UAAU,GAAG,GAAGC,wBAAgB,cAAc,CAAC,CAAC,CAAC;GAAG;GACtI,IAAI,QAA0C;IAAE,OAAO,CAAC,IAAI,EAAE,OAAO,qBAAqB,GAAG,GAAGC,iCAAsB,cAAc,CAAC,GAAG,IAAI,EAAE,OAAO,gBAAgB,GAAG,GAAGC,6BAAkB,cAAc,CAAC,CAAC;GAAG;GAChN,IAAI,YAAkD;IAAE,OAAO,CAAC,GAAGC,gCAAyB,cAAc,GAAG,GAAGC,8BAAuB,cAAc,CAAC;GAAG;GACzJ,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAoD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACzG;CACF;AACF,CAAC"}
@@ -2,8 +2,8 @@ import { c as createProfileRuntime, i as profileItems, l as createProfileRuntime
2
2
  import { buildPersonaPrompt, loadProfiles, resolveProfile } from "@agimon-ai/po-config/profiles";
3
3
  import { composeServerProviderOverrides, defineServerPlugin, packageResourcePath, readPackageResource } from "@agimon-ai/po-core/serverFacet";
4
4
  import { composeRootHooks, defineHook, defineResource, defineRoot, defineRoutedContribution } from "@agimon-ai/po-core/extensionFile";
5
- import os from "node:os";
6
5
  import { DoomHeadlessPromptAdmissionError, DoomSessionSetupError, isDoomHeadlessPromptAdmissionError } from "@agimon-ai/po-core/headless";
6
+ import { nodeHost } from "@agimon-ai/po-core/platform";
7
7
  import { DOOM_PROFILE_IDENTITY_ENTRY_TYPE } from "@agimon-ai/po-core/profileIdentity";
8
8
  //#region src/extensions/workspaces/sessions/(backend)/root.server.ts
9
9
  var root_server_default = defineRoot(({ agent, signal }) => {
@@ -11,7 +11,7 @@ var root_server_default = defineRoot(({ agent, signal }) => {
11
11
  const execution = agent.context;
12
12
  const runtime = createProfileRuntime({
13
13
  profileName: execution.selection.profile,
14
- readBinding: (profileName) => resolveProfile(execution.repoRoot, profileName, execution.environment.HOME ?? os.homedir()).integration
14
+ readBinding: (profileName) => resolveProfile(execution.repoRoot, profileName, execution.environment.HOME ?? nodeHost.homeDirectory()).integration
15
15
  });
16
16
  const unsubscribe = agent.subscribeSelection(async (selection) => {
17
17
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"server.mjs","names":["rootSession","commandProfile","hookBeforeAgentStart","hookSessionStart","resourcePoAuthorProfile","resourceProfileConfig"],"sources":["../../src/extensions/workspaces/sessions/(backend)/root.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/poAuthorProfile.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server.ts","../../generated/server.ts"],"sourcesContent":["import os from 'node:os';\n\nimport { resolveProfile } from '@agimon-ai/po-config/profiles';\nimport { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { DoomHeadlessPromptAdmissionError } from '@agimon-ai/po-core/headless';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport { createProfileRuntime, createProfileRuntimePlugin } from '../../../../services/profileRuntime';\n\nexport default defineRoot(({ agent, signal }: DoomServerPluginContext) => {\n if (!agent) return { value: undefined };\n const execution = agent.context;\n const runtime = createProfileRuntime({\n profileName: execution.selection.profile,\n readBinding: (profileName) =>\n resolveProfile(execution.repoRoot, profileName, execution.environment.HOME ?? os.homedir()).integration,\n });\n const unsubscribe = agent.subscribeSelection(async (selection) => {\n try {\n await runtime.select(selection.profile);\n } catch (error) {\n throw new DoomHeadlessPromptAdmissionError(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 unsubscribe();\n signal.removeEventListener('abort', invalidate);\n await runtime.dispose();\n },\n };\n});\n","import { buildPersonaPrompt, loadProfiles, resolveProfile } from '@agimon-ai/po-config/profiles';\nimport {\n DoomHeadlessPromptAdmissionError,\n DoomSessionSetupError,\n isDoomHeadlessPromptAdmissionError,\n type DoomHeadlessCommand,\n type DoomHeadlessExecutionContext,\n type DoomHeadlessHostService,\n type DoomHeadlessHook,\n} from '@agimon-ai/po-core/headless';\nimport { DOOM_PROFILE_IDENTITY_ENTRY_TYPE } from '@agimon-ai/po-core/profileIdentity';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { PROFILE_COMMAND, profileItems, profileTitle } from '../../../../../services/profileText';\n\nexport async function readSelectedPersona(execution: {\n readonly repoRoot: string;\n readonly selection: { readonly profile?: string };\n readonly environment?: Readonly<Record<string, string | undefined>>;\n}): Promise<string> {\n const name = execution.selection.profile;\n if (!name) return '(no active profile)';\n const profile = resolveProfile(execution.repoRoot, name, execution.environment?.HOME);\n const prompt = 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(execution: DoomHeadlessExecutionContext, profile: string): Promise<void> {\n const identity = resolveProfile(execution.repoRoot, profile, execution.environment.HOME).identity;\n await execution.session.appendCustomEntry(DOOM_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: DoomHeadlessHostService): DoomHeadlessCommand {\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 = loadProfiles(execution.repoRoot, execution.environment.HOME);\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 (isDoomHeadlessPromptAdmissionError(error))\n throw new DoomSessionSetupError(\n 'Profile integration is unavailable. Restore its credential or choose another profile.',\n );\n throw error;\n }\n await publishSelectedIdentity(execution, 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 DoomHeadlessPromptAdmissionError(error);\n }\n}\n\nexport const profileIdentityHook: DoomHeadlessHook<'session_start'> = {\n event: 'session_start',\n async handle(_event, execution) {\n const profile = execution.selection.profile;\n if (profile !== undefined) await publishSelectedIdentity(execution, profile);\n },\n};\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport { createProfileServerCommand } from '../_lib/profileServer';\nexport default defineRoutedContribution(\n ({ agent }: DoomServerPluginContext) => (agent ? createProfileServerCommand(agent) : undefined),\n { cardinality: 'optional' },\n);\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<DoomServerPluginContext, ProfileRuntime | undefined>) => ({\n async handle() {\n await assertProfileReady(root);\n },\n}));\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady, profileIdentityHook } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<DoomServerPluginContext, ProfileRuntime | undefined>) => ({\n ...profileIdentityHook,\n async handle(event: Readonly<Record<string, unknown>>, execution: DoomHeadlessExecutionContext) {\n await assertProfileReady(root);\n await profileIdentityHook.handle(event, execution);\n },\n}));\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverFacet';\n\nexport default defineResource({\n name: 'po-author-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/po-author-profile/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/po-author-profile/SKILL.md'),\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\n\nimport { readSelectedPersona } from '../_lib/profileServer';\nexport default defineResource({ name: 'po/profile-config', kind: 'context' as const, read: readSelectedPersona });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/po-core/serverFacet';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverFacet';\nimport { composeRootHooks } from '@agimon-ai/po-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.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 resourcePoAuthorProfile from '../src/extensions/workspaces/sessions/(backend)/resource/poAuthorProfile.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 facet = defineServerPlugin({\n name: '@agimon-ai/po-profile',\n providerOverrides: composeServerProviderOverrides(rootSession),\n session: async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get commands(): DoomServerSessionPlugin['commands'] { return defined([via({ name: 'profile' }, at(commandProfile, contextSession))]); },\n get hooks(): DoomServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, contextSession)), via({ event: 'session_start' }, at(hookSessionStart, contextSession))]; },\n get resources(): DoomServerSessionPlugin['resources'] { return [at(resourcePoAuthorProfile, contextSession), at(resourceProfileConfig, contextSession)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;;;;AASA,IAAA,sBAAe,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0C;IAAE,OAAO,CAAC,IAAI,EAAE,OAAO,qBAAqB,GAAG,GAAGC,iCAAsB,cAAc,CAAC,GAAG,IAAI,EAAE,OAAO,gBAAgB,GAAG,GAAGC,6BAAkB,cAAc,CAAC,CAAC;GAAG;GAChN,IAAI,YAAkD;IAAE,OAAO,CAAC,GAAGC,gCAAyB,cAAc,GAAG,GAAGC,8BAAuB,cAAc,CAAC;GAAG;GACzJ,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAoD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACzG;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"server.mjs","names":["rootSession","commandProfile","hookBeforeAgentStart","hookSessionStart","resourcePoAuthorProfile","resourceProfileConfig"],"sources":["../../src/extensions/workspaces/sessions/(backend)/root.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/poAuthorProfile.server.ts","../../src/extensions/workspaces/sessions/(backend)/resource/profileConfig.server.ts","../../generated/server.ts"],"sourcesContent":["import { resolveProfile } from '@agimon-ai/po-config/profiles';\nimport { defineRoot } from '@agimon-ai/po-core/extensionFile';\nimport { DoomHeadlessPromptAdmissionError } from '@agimon-ai/po-core/headless';\nimport { nodeHost } from '@agimon-ai/po-core/platform';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport { createProfileRuntime, createProfileRuntimePlugin } from '../../../../services/profileRuntime';\n\nexport default defineRoot(({ agent, signal }: DoomServerPluginContext) => {\n if (!agent) return { value: undefined };\n const execution = agent.context;\n const runtime = createProfileRuntime({\n profileName: execution.selection.profile,\n readBinding: (profileName) =>\n resolveProfile(execution.repoRoot, profileName, execution.environment.HOME ?? nodeHost.homeDirectory())\n .integration,\n });\n const unsubscribe = agent.subscribeSelection(async (selection) => {\n try {\n await runtime.select(selection.profile);\n } catch (error) {\n throw new DoomHeadlessPromptAdmissionError(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 unsubscribe();\n signal.removeEventListener('abort', invalidate);\n await runtime.dispose();\n },\n };\n});\n","import { buildPersonaPrompt, loadProfiles, resolveProfile } from '@agimon-ai/po-config/profiles';\nimport {\n DoomHeadlessPromptAdmissionError,\n DoomSessionSetupError,\n isDoomHeadlessPromptAdmissionError,\n type DoomHeadlessCommand,\n type DoomHeadlessExecutionContext,\n type DoomHeadlessHostService,\n type DoomHeadlessHook,\n} from '@agimon-ai/po-core/headless';\nimport { DOOM_PROFILE_IDENTITY_ENTRY_TYPE } from '@agimon-ai/po-core/profileIdentity';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { PROFILE_COMMAND, profileItems, profileTitle } from '../../../../../services/profileText';\n\nexport async function readSelectedPersona(execution: {\n readonly repoRoot: string;\n readonly selection: { readonly profile?: string };\n readonly environment?: Readonly<Record<string, string | undefined>>;\n}): Promise<string> {\n const name = execution.selection.profile;\n if (!name) return '(no active profile)';\n const profile = resolveProfile(execution.repoRoot, name, execution.environment?.HOME);\n const prompt = 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(execution: DoomHeadlessExecutionContext, profile: string): Promise<void> {\n const identity = resolveProfile(execution.repoRoot, profile, execution.environment.HOME).identity;\n await execution.session.appendCustomEntry(DOOM_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: DoomHeadlessHostService): DoomHeadlessCommand {\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 = loadProfiles(execution.repoRoot, execution.environment.HOME);\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 (isDoomHeadlessPromptAdmissionError(error))\n throw new DoomSessionSetupError(\n 'Profile integration is unavailable. Restore its credential or choose another profile.',\n );\n throw error;\n }\n await publishSelectedIdentity(execution, 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 DoomHeadlessPromptAdmissionError(error);\n }\n}\n\nexport const profileIdentityHook: DoomHeadlessHook<'session_start'> = {\n event: 'session_start',\n async handle(_event, execution) {\n const profile = execution.selection.profile;\n if (profile !== undefined) await publishSelectedIdentity(execution, profile);\n },\n};\n","import { defineRoutedContribution } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport { createProfileServerCommand } from '../_lib/profileServer';\nexport default defineRoutedContribution(\n ({ agent }: DoomServerPluginContext) => (agent ? createProfileServerCommand(agent) : undefined),\n { cardinality: 'optional' },\n);\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<DoomServerPluginContext, ProfileRuntime | undefined>) => ({\n async handle() {\n await assertProfileReady(root);\n },\n}));\n","import { defineHook, type WithRoot } from '@agimon-ai/po-core/extensionFile';\nimport type { DoomHeadlessExecutionContext } from '@agimon-ai/po-core/headless';\nimport type { DoomServerPluginContext } from '@agimon-ai/po-core/serverFacet';\n\nimport type { ProfileRuntime } from '../../../../../services/profileRuntime/type';\nimport { assertProfileReady, profileIdentityHook } from '../_lib/profileServer';\n\nexport default defineHook(({ root }: WithRoot<DoomServerPluginContext, ProfileRuntime | undefined>) => ({\n ...profileIdentityHook,\n async handle(event: Readonly<Record<string, unknown>>, execution: DoomHeadlessExecutionContext) {\n await assertProfileReady(root);\n await profileIdentityHook.handle(event, execution);\n },\n}));\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\nimport { packageResourcePath, readPackageResource } from '@agimon-ai/po-core/serverFacet';\n\nexport default defineResource({\n name: 'po-author-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/po-author-profile/SKILL.md'),\n read: () => readPackageResource(import.meta.url, 'src/prompts/po-author-profile/SKILL.md'),\n});\n","import { defineResource } from '@agimon-ai/po-core/extensionFile';\n\nimport { readSelectedPersona } from '../_lib/profileServer';\nexport default defineResource({ name: 'po/profile-config', kind: 'context' as const, read: readSelectedPersona });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type DoomServerSessionPlugin } from '@agimon-ai/po-core/serverFacet';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverFacet';\nimport { composeRootHooks } from '@agimon-ai/po-core/extensionFile';\n\nimport rootSession from '../src/extensions/workspaces/sessions/(backend)/root.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 resourcePoAuthorProfile from '../src/extensions/workspaces/sessions/(backend)/resource/poAuthorProfile.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 facet = defineServerPlugin({\n name: '@agimon-ai/po-profile',\n providerOverrides: composeServerProviderOverrides(rootSession),\n session: async (context) => {\n const scopeSession = await rootSession(context);\n const contextSession = { ...context, root: scopeSession.value };\n return {\n ...composeRootHooks(scopeSession),\n get commands(): DoomServerSessionPlugin['commands'] { return defined([via({ name: 'profile' }, at(commandProfile, contextSession))]); },\n get hooks(): DoomServerSessionPlugin['hooks'] { return [via({ event: 'before_agent_start' }, at(hookBeforeAgentStart, contextSession)), via({ event: 'session_start' }, at(hookSessionStart, contextSession))]; },\n get resources(): DoomServerSessionPlugin['resources'] { return [at(resourcePoAuthorProfile, contextSession), at(resourceProfileConfig, contextSession)]; },\n services: [...(scopeSession.services ?? [])],\n get activities(): DoomServerSessionPlugin['activities'] { return [...(scopeSession.activities ?? [])]; },\n };\n },\n});\n\nexport default facet;\n"],"mappings":";;;;;;;;AAQA,IAAA,sBAAe,YAAY,EAAE,OAAO,aAAsC;CACxE,IAAI,CAAC,OAAO,OAAO,EAAE,OAAO,KAAA,EAAU;CACtC,MAAM,YAAY,MAAM;CACxB,M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,GAAG,GAAGC,6BAAkB,cAAc,CAAC,CAAC;GAAG;GAChN,IAAI,YAAkD;IAAE,OAAO,CAAC,GAAGC,gCAAyB,cAAc,GAAG,GAAGC,8BAAuB,cAAc,CAAC;GAAG;GACzJ,UAAU,CAAC,GAAI,aAAa,YAAY,CAAC,CAAE;GAC3C,IAAI,aAAoD;IAAE,OAAO,CAAC,GAAI,aAAa,cAAc,CAAC,CAAE;GAAG;EACzG;CACF;AACF,CAAC"}
package/dist/index.mjs CHANGED
@@ -1,2 +1 @@
1
- import { a as profileStatus, c as createProfileRuntime, d as PROFILE_RUNTIME_SERVICE, i as profileItems, l as createProfileRuntimePlugin, n as PROFILE_STATUS_KEY, o as profileSummary, r as profileDescription, s as profileTitle, u as requireProfileRuntime } from "./profileText-B1dz_9lS.mjs";
2
- export { PROFILE_RUNTIME_SERVICE, PROFILE_STATUS_KEY, createProfileRuntime, createProfileRuntimePlugin, profileDescription, profileItems, profileStatus, profileSummary, profileTitle, requireProfileRuntime };
1
+ export { d as PROFILE_RUNTIME_SERVICE, n as PROFILE_STATUS_KEY, c as createProfileRuntime, l as createProfileRuntimePlugin, r as profileDescription, i as profileItems, a as profileStatus, o as profileSummary, s as profileTitle, u as requireProfileRuntime } from "./profileText-B1dz_9lS.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-profile",
3
- "version": "0.0.0-alpha.2",
3
+ "version": "0.0.0-alpha.3",
4
4
  "description": "Persona and environment profile switching for Po sessions.",
5
5
  "keywords": [
6
6
  "agent-persona",
@@ -66,28 +66,28 @@
66
66
  "access": "public"
67
67
  },
68
68
  "dependencies": {
69
- "@agimon-ai/po-config": "0.0.0-alpha.2",
70
- "@agimon-ai/po-core": "0.0.0-alpha.2",
71
- "@agimon-ai/po-minor-mode": "0.0.0-alpha.2",
72
- "@agimon-ai/po-telemetry": "0.0.0-alpha.2",
69
+ "@agimon-ai/po-config": "0.0.0-alpha.3",
70
+ "@agimon-ai/po-core": "0.0.0-alpha.3",
71
+ "@agimon-ai/po-minor-mode": "0.0.0-alpha.3",
72
+ "@agimon-ai/po-telemetry": "0.0.0-alpha.3",
73
73
  "@deepseek-ai/cordis": "4.0.4",
74
- "typebox": "1.3.34"
74
+ "typebox": "1.3.36"
75
75
  },
76
76
  "devDependencies": {
77
- "@agimon-ai/po-build": "0.0.0-alpha.2",
78
- "@agimon-ai/po-core": "0.0.0-alpha.2",
79
- "@agimon-ai/po-voice": "0.0.0-alpha.2",
80
- "@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.0-alpha.2",
77
+ "@agimon-ai/po-build": "0.0.0-alpha.3",
78
+ "@agimon-ai/po-core": "0.0.0-alpha.3",
79
+ "@agimon-ai/po-voice": "0.0.0-alpha.3",
80
+ "@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.0-alpha.3",
81
81
  "@deepseek-ai/cordis": "4.0.4",
82
82
  "@earendil-works/pi-coding-agent": "1.2.0",
83
- "@types/node": "26.6.4",
83
+ "@types/node": "25.9.9",
84
84
  "@vitest/coverage-v8": "5.0.3",
85
- "tsdown": "0.23.0",
85
+ "tsdown": "0.23.1",
86
86
  "typescript": "7.0.2",
87
87
  "vitest": "5.0.3"
88
88
  },
89
89
  "peerDependencies": {
90
- "@agimon-ai/po-core": "0.0.0-alpha.2",
90
+ "@agimon-ai/po-core": "0.0.0-alpha.3",
91
91
  "@earendil-works/pi-coding-agent": "1.2.0"
92
92
  },
93
93
  "peerDependenciesMeta": {