← Public packages
@kody/kody-factory
Forkable multi-project software factory: signals, priority queue, project UI, sweep job. Agent runners and Sentry reach it by events.
Files
/**
* Every link the factory hands out (card links, report links, health links,
* agent briefs, PR references) starts from one base URL: the
* `publicBaseUrl` setting when set (for example `https://factory.kody.build`),
* else the app's hosted kody.run URL. Card links use the short form
* `<base>/c/<card id>`; `/cards/<card id>` keeps working.
*/
import { packageContext } from 'kody:runtime'
import { loadSettings, normalizeBaseUrl } from './settings.ts'
export const DEFAULT_HOSTED_URL = 'https://kody-factory--kody.kody.run'
/** The hosted kody.run URL of this app, no trailing slash. */
export function hostedBaseUrl(): string {
return normalizeBaseUrl(packageContext?.hostedUrl) || DEFAULT_HOSTED_URL
}
/** Base for links: `publicBaseUrl` when set, else the hosted URL. */
export async function appBaseUrl(): Promise<string> {
try {
return (await loadSettings()).publicBaseUrl || hostedBaseUrl()
} catch {
return hostedBaseUrl()
}
}
/** Short, stable card link: `<base>/c/<card id>`. */
export function cardLink(base: string, cardId: string): string {
return `${base.replace(/\/+$/, '')}/c/${encodeURIComponent(cardId)}`
}
export function reportLink(base: string, reportId: string): string {
return `${base.replace(/\/+$/, '')}/reports/${encodeURIComponent(reportId)}`
}