mirror of
https://github.com/davidkaya/aryx.git
synced 2026-11-21 08:31:29 +01:00
feat: add phase 3 prompt customization backend
- parse prompt model and argument-hint metadata and persist model on prompt invocations - expand markdown-linked file context in scanned prompt and instruction bodies - discover .claude/rules instructions and support Claude-style paths metadata - discover customization roots up to the nearest parent repository and watch them for changes - apply per-turn prompt model overrides before sidecar execution Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
bcbdd2ef29
commit
6eadb36c10
17 files changed
+779
-114
No files matched your search
@@ -178,6 +178,20 @@ export function findModel(
|
||||
return models.find((model) => model.id === id);
|
||||
}
|
||||
|
||||
export function findModelByReference(
|
||||
reference: string,
|
||||
models: ReadonlyArray<ModelDefinition> = modelCatalog,
|
||||
): ModelDefinition | undefined {
|
||||
const trimmedReference = reference.trim();
|
||||
if (!trimmedReference) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return models.find((model) =>
|
||||
model.id === trimmedReference
|
||||
|| model.name.localeCompare(trimmedReference, undefined, { sensitivity: 'accent' }) === 0);
|
||||
}
|
||||
|
||||
export function inferProvider(modelId: string): ModelProvider | undefined {
|
||||
if (modelId.startsWith('gpt-')) return 'openai';
|
||||
if (modelId.startsWith('claude-')) return 'anthropic';
|
||||
|
||||
@@ -36,7 +36,9 @@ export interface ProjectPromptFile {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
argumentHint?: string;
|
||||
agent?: string;
|
||||
model?: string;
|
||||
tools?: string[];
|
||||
template: string;
|
||||
variables: ProjectPromptVariable[];
|
||||
@@ -50,6 +52,7 @@ export interface ProjectPromptInvocation {
|
||||
resolvedPrompt: string;
|
||||
description?: string;
|
||||
agent?: string;
|
||||
model?: string;
|
||||
tools?: string[];
|
||||
}
|
||||
|
||||
@@ -268,11 +271,21 @@ function normalizeProjectPromptFile(promptFile: ProjectPromptFile): ProjectPromp
|
||||
normalizedPromptFile.description = description;
|
||||
}
|
||||
|
||||
const argumentHint = normalizeOptionalString(promptFile.argumentHint);
|
||||
if (argumentHint) {
|
||||
normalizedPromptFile.argumentHint = argumentHint;
|
||||
}
|
||||
|
||||
const agent = normalizeOptionalString(promptFile.agent);
|
||||
if (agent) {
|
||||
normalizedPromptFile.agent = agent;
|
||||
}
|
||||
|
||||
const model = normalizeOptionalString(promptFile.model);
|
||||
if (model) {
|
||||
normalizedPromptFile.model = model;
|
||||
}
|
||||
|
||||
const tools = normalizeOptionalStringArray(promptFile.tools);
|
||||
if (tools) {
|
||||
normalizedPromptFile.tools = tools;
|
||||
@@ -313,6 +326,11 @@ export function normalizeProjectPromptInvocation(
|
||||
normalizedPromptInvocation.agent = agent;
|
||||
}
|
||||
|
||||
const model = normalizeOptionalString(promptInvocation.model);
|
||||
if (model) {
|
||||
normalizedPromptInvocation.model = model;
|
||||
}
|
||||
|
||||
const tools = normalizeOptionalStringArray(promptInvocation.tools);
|
||||
if (tools) {
|
||||
normalizedPromptInvocation.tools = tools;
|
||||
|
||||
Reference in new issue
Block a user