arkaos 3.2.0 → 3.3.0
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/VERSION +1 -1
- package/core/agents/__pycache__/field_suggester.cpython-313.pyc +0 -0
- package/core/personas/__pycache__/description_drafter.cpython-313.pyc +0 -0
- package/core/personas/description_drafter.py +111 -0
- package/dashboard/app/components/PersonaWizard.vue +102 -10
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/__pycache__/dashboard-api.cpython-313.pyc +0 -0
- package/scripts/dashboard-api.py +37 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.3.0
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""AI-powered persona draft from a free-text description (PR83a v3.3.0).
|
|
2
|
+
|
|
3
|
+
Sibling to `core/personas/builder.PersonaBuilder` but does NOT require
|
|
4
|
+
indexed content. Useful when:
|
|
5
|
+
|
|
6
|
+
- The operator wants to model a persona quickly without ingesting sources
|
|
7
|
+
- A YouTuber / author isn't yet in the knowledge base
|
|
8
|
+
- The persona is a synthetic archetype rather than a real person
|
|
9
|
+
|
|
10
|
+
Reuses the same JSON schema and parsing as the vector-driven builder so
|
|
11
|
+
the resulting Persona is interchangeable.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import uuid
|
|
17
|
+
from dataclasses import dataclass
|
|
18
|
+
from datetime import datetime, timezone
|
|
19
|
+
|
|
20
|
+
from core.personas.builder import (
|
|
21
|
+
_PERSONA_SYSTEM_PROMPT,
|
|
22
|
+
_extract_json_object,
|
|
23
|
+
)
|
|
24
|
+
from core.personas.schema import (
|
|
25
|
+
Persona,
|
|
26
|
+
PersonaBigFive,
|
|
27
|
+
PersonaCommunication,
|
|
28
|
+
PersonaDISC,
|
|
29
|
+
PersonaEnneagram,
|
|
30
|
+
)
|
|
31
|
+
from core.runtime.llm_provider import LLMProvider, LLMUnavailable, get_llm_provider
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
_DESCRIPTION_MIN_CHARS = 20
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class PersonaDraftError(RuntimeError):
|
|
38
|
+
"""LLM produced unusable output or could not be reached."""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class PersonaDraftResult:
|
|
43
|
+
persona: Persona
|
|
44
|
+
provider_name: str
|
|
45
|
+
raw_response: str
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def draft_persona_from_description(
|
|
49
|
+
description: str,
|
|
50
|
+
*,
|
|
51
|
+
name: str,
|
|
52
|
+
source_label: str = "",
|
|
53
|
+
provider: LLMProvider | None = None,
|
|
54
|
+
) -> PersonaDraftResult:
|
|
55
|
+
"""Generate a Persona draft from a free-text description."""
|
|
56
|
+
description = (description or "").strip()
|
|
57
|
+
if not name or not name.strip():
|
|
58
|
+
raise PersonaDraftError("name must not be empty")
|
|
59
|
+
if len(description) < _DESCRIPTION_MIN_CHARS:
|
|
60
|
+
raise PersonaDraftError(
|
|
61
|
+
f"description must be at least {_DESCRIPTION_MIN_CHARS} characters"
|
|
62
|
+
)
|
|
63
|
+
llm = provider or get_llm_provider()
|
|
64
|
+
prompt = _build_prompt(name.strip(), description)
|
|
65
|
+
try:
|
|
66
|
+
resp = llm.complete(prompt, max_tokens=3000, system=_PERSONA_SYSTEM_PROMPT)
|
|
67
|
+
except LLMUnavailable as exc:
|
|
68
|
+
raise PersonaDraftError(str(exc)) from exc
|
|
69
|
+
persona = _parse(name.strip(), source_label.strip() or name.strip(), resp.text)
|
|
70
|
+
return PersonaDraftResult(
|
|
71
|
+
persona=persona, provider_name=llm.name(), raw_response=resp.text,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _build_prompt(name: str, description: str) -> str:
|
|
76
|
+
return (
|
|
77
|
+
f"Person: {name}\n\n"
|
|
78
|
+
f"Description provided by the operator:\n{description}\n\n"
|
|
79
|
+
"Build the persona purely from the description above. If a field is "
|
|
80
|
+
"not implied, choose the closest neutral default rather than "
|
|
81
|
+
"fabricating. NEVER invent quotes — leave key_quotes empty if no "
|
|
82
|
+
"quotes are present in the description."
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _parse(name: str, source_label: str, raw: str) -> Persona:
|
|
87
|
+
data = _extract_json_object(raw)
|
|
88
|
+
if data is None:
|
|
89
|
+
raise PersonaDraftError(
|
|
90
|
+
f"LLM did not return a JSON object; raw response: {raw[:200]!r}"
|
|
91
|
+
)
|
|
92
|
+
try:
|
|
93
|
+
return Persona(
|
|
94
|
+
id=str(uuid.uuid4()),
|
|
95
|
+
name=name,
|
|
96
|
+
title=str(data.get("title") or ""),
|
|
97
|
+
tagline=str(data.get("tagline") or ""),
|
|
98
|
+
source=source_label,
|
|
99
|
+
disc=PersonaDISC(**(data.get("disc") or {})),
|
|
100
|
+
enneagram=PersonaEnneagram(**(data.get("enneagram") or {})),
|
|
101
|
+
big_five=PersonaBigFive(**(data.get("big_five") or {})),
|
|
102
|
+
mbti=str(data.get("mbti") or "").upper() or "INTJ",
|
|
103
|
+
mental_models=[str(x) for x in (data.get("mental_models") or [])],
|
|
104
|
+
expertise_domains=[str(x) for x in (data.get("expertise_domains") or [])],
|
|
105
|
+
frameworks=[str(x) for x in (data.get("frameworks") or [])],
|
|
106
|
+
key_quotes=[str(x) for x in (data.get("key_quotes") or [])],
|
|
107
|
+
communication=PersonaCommunication(**(data.get("communication") or {})),
|
|
108
|
+
created_at=datetime.now(timezone.utc).isoformat(),
|
|
109
|
+
)
|
|
110
|
+
except (TypeError, ValueError) as exc:
|
|
111
|
+
raise PersonaDraftError(f"persona schema mismatch: {exc}") from exc
|
|
@@ -37,6 +37,12 @@ const sourceLineCount = computed(() =>
|
|
|
37
37
|
.length,
|
|
38
38
|
)
|
|
39
39
|
|
|
40
|
+
// PR83a v3.3.0 — Mode 3: build from a free-text description (no chunks).
|
|
41
|
+
type Mode = 'sources' | 'existing' | 'description'
|
|
42
|
+
const mode = ref<Mode>('sources')
|
|
43
|
+
const description = ref('')
|
|
44
|
+
const descriptionLength = computed(() => description.value.trim().length)
|
|
45
|
+
|
|
40
46
|
// ─── Step 2 state ────────────────────────────────────────────────────────
|
|
41
47
|
const ingestJobs = ref<Array<{
|
|
42
48
|
source: string
|
|
@@ -81,7 +87,14 @@ const tierOptions = [
|
|
|
81
87
|
|
|
82
88
|
|
|
83
89
|
async function startIngest() {
|
|
84
|
-
if (
|
|
90
|
+
if (mode.value === 'description') {
|
|
91
|
+
// PR83a — no ingest, no chunks. Build directly from description.
|
|
92
|
+
if (descriptionLength.value < 20 || !name.value.trim()) return
|
|
93
|
+
step.value = 3
|
|
94
|
+
await runDescriptionBuild()
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
if (mode.value === 'existing' || skipIngest.value) {
|
|
85
98
|
// Jump straight to step 3 — operator says content is already indexed.
|
|
86
99
|
step.value = 3
|
|
87
100
|
await runBuild()
|
|
@@ -166,6 +179,36 @@ onBeforeUnmount(() => {
|
|
|
166
179
|
// ─── Step 3: build the persona draft ────────────────────────────────────
|
|
167
180
|
|
|
168
181
|
|
|
182
|
+
async function runDescriptionBuild() {
|
|
183
|
+
building.value = true
|
|
184
|
+
buildError.value = null
|
|
185
|
+
draft.value = null
|
|
186
|
+
try {
|
|
187
|
+
const res = await $fetch<{ persona: Persona, provider_name: string, error?: string }>(
|
|
188
|
+
`${apiBase}/api/personas/draft`,
|
|
189
|
+
{
|
|
190
|
+
method: 'POST',
|
|
191
|
+
body: {
|
|
192
|
+
name: name.value.trim(),
|
|
193
|
+
description: description.value.trim(),
|
|
194
|
+
source_label: sourceLabel.value.trim() || name.value.trim(),
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
)
|
|
198
|
+
if ('error' in res && typeof (res as any).error === 'string') {
|
|
199
|
+
throw new Error((res as any).error)
|
|
200
|
+
}
|
|
201
|
+
draft.value = res.persona
|
|
202
|
+
chunksUsed.value = 0
|
|
203
|
+
step.value = 4
|
|
204
|
+
} catch (err) {
|
|
205
|
+
buildError.value = err instanceof Error ? err.message : 'unknown error'
|
|
206
|
+
} finally {
|
|
207
|
+
building.value = false
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
|
|
169
212
|
async function runBuild() {
|
|
170
213
|
building.value = true
|
|
171
214
|
buildError.value = null
|
|
@@ -308,7 +351,28 @@ function backToStep1() {
|
|
|
308
351
|
/>
|
|
309
352
|
</UFormField>
|
|
310
353
|
|
|
354
|
+
<UFormField label="How should we generate this persona?">
|
|
355
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-2">
|
|
356
|
+
<button
|
|
357
|
+
v-for="m in ([
|
|
358
|
+
{ key: 'sources', title: 'Ingest sources', desc: 'YouTube, articles, PDFs — best fidelity' },
|
|
359
|
+
{ key: 'existing', title: 'Existing chunks', desc: 'Use what is already indexed' },
|
|
360
|
+
{ key: 'description', title: 'From description', desc: 'No sources — pure description' },
|
|
361
|
+
] as const)"
|
|
362
|
+
:key="m.key"
|
|
363
|
+
type="button"
|
|
364
|
+
class="text-left rounded-lg border p-3 transition-colors"
|
|
365
|
+
:class="mode === m.key ? 'border-primary bg-primary/5' : 'border-default hover:border-primary/40'"
|
|
366
|
+
@click="mode = m.key"
|
|
367
|
+
>
|
|
368
|
+
<p class="text-sm font-semibold">{{ m.title }}</p>
|
|
369
|
+
<p class="text-xs text-muted mt-1">{{ m.desc }}</p>
|
|
370
|
+
</button>
|
|
371
|
+
</div>
|
|
372
|
+
</UFormField>
|
|
373
|
+
|
|
311
374
|
<UFormField
|
|
375
|
+
v-if="mode === 'sources'"
|
|
312
376
|
label="Sources (one URL per line)"
|
|
313
377
|
help="YouTube videos, articles, PDFs, blog posts about this person. The builder will search the indexed chunks and synthesise their behavioural DNA. Up to 50 sources per batch."
|
|
314
378
|
>
|
|
@@ -317,28 +381,56 @@ function backToStep1() {
|
|
|
317
381
|
:rows="6"
|
|
318
382
|
placeholder="https://www.youtube.com/watch?v=... https://example.com/article https://example.com/paper.pdf"
|
|
319
383
|
class="w-full font-mono text-sm"
|
|
320
|
-
:disabled="skipIngest"
|
|
321
384
|
/>
|
|
322
385
|
</UFormField>
|
|
323
386
|
|
|
324
|
-
<
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
387
|
+
<UFormField
|
|
388
|
+
v-else-if="mode === 'description'"
|
|
389
|
+
label="Description"
|
|
390
|
+
help="Plain-text description of the person — their style, beliefs, what they do, how they talk. The LLM uses this verbatim. Minimum 20 characters."
|
|
391
|
+
>
|
|
392
|
+
<UTextarea
|
|
393
|
+
v-model="description"
|
|
394
|
+
:rows="6"
|
|
395
|
+
placeholder="A direct-response copywriter who treats offers as the only true growth lever. Punchy, allergic to fluff. Loves Hormozi-style hooks."
|
|
396
|
+
class="w-full"
|
|
329
397
|
/>
|
|
398
|
+
</UFormField>
|
|
399
|
+
|
|
400
|
+
<div
|
|
401
|
+
v-if="mode === 'sources'"
|
|
402
|
+
class="flex items-center justify-between text-xs text-muted"
|
|
403
|
+
>
|
|
404
|
+
<span>{{ sourceLineCount }} source{{ sourceLineCount === 1 ? '' : 's' }} detected</span>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
<div v-else-if="mode === 'existing'" class="text-xs text-muted">
|
|
408
|
+
We will search the vector DB for chunks tagged with this name and synthesise from what we find. Make sure you've ingested content for this person first.
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
<div v-else-if="mode === 'description'" class="text-xs text-muted">
|
|
412
|
+
{{ descriptionLength }} character{{ descriptionLength === 1 ? '' : 's' }} ·
|
|
413
|
+
{{ descriptionLength >= 20 ? 'ready' : `${20 - descriptionLength} more needed` }}
|
|
330
414
|
</div>
|
|
331
415
|
|
|
332
416
|
<div class="flex justify-end gap-2 pt-4">
|
|
333
417
|
<UButton
|
|
334
|
-
:label="
|
|
418
|
+
:label="(
|
|
419
|
+
mode === 'sources' ? `Index ${sourceLineCount} source${sourceLineCount === 1 ? '' : 's'} & build`
|
|
420
|
+
: mode === 'existing' ? 'Generate from existing knowledge'
|
|
421
|
+
: 'Generate from description'
|
|
422
|
+
)"
|
|
335
423
|
icon="i-lucide-arrow-right"
|
|
336
|
-
:disabled="
|
|
424
|
+
:disabled="(
|
|
425
|
+
!name.trim()
|
|
426
|
+
|| (mode === 'sources' && (sourceLineCount === 0 || sourceLineCount > 50))
|
|
427
|
+
|| (mode === 'description' && descriptionLength < 20)
|
|
428
|
+
)"
|
|
337
429
|
size="md"
|
|
338
430
|
@click="startIngest"
|
|
339
431
|
/>
|
|
340
432
|
</div>
|
|
341
|
-
<p v-if="sourceLineCount > 50" class="text-xs text-red-400">
|
|
433
|
+
<p v-if="mode === 'sources' && sourceLineCount > 50" class="text-xs text-red-400">
|
|
342
434
|
Over the 50-source cap. Trim the list before continuing.
|
|
343
435
|
</p>
|
|
344
436
|
</div>
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
Binary file
|
package/scripts/dashboard-api.py
CHANGED
|
@@ -1827,6 +1827,43 @@ def _build_agent_yaml(
|
|
|
1827
1827
|
return payload
|
|
1828
1828
|
|
|
1829
1829
|
|
|
1830
|
+
# --- AI persona draft from description (PR83a v3.3.0) ---
|
|
1831
|
+
|
|
1832
|
+
@app.post("/api/personas/draft")
|
|
1833
|
+
def personas_draft(body: dict):
|
|
1834
|
+
"""Generate a Persona draft from a free-text description (no vector DB).
|
|
1835
|
+
|
|
1836
|
+
Body: {
|
|
1837
|
+
"description": "...", # min 20 chars
|
|
1838
|
+
"name": "Alex Carter", # required
|
|
1839
|
+
"source_label": "..." # optional
|
|
1840
|
+
}
|
|
1841
|
+
Returns: {"persona": {...}, "provider_name": "..."}
|
|
1842
|
+
|
|
1843
|
+
Sibling to /api/personas/build (which requires indexed chunks). Useful
|
|
1844
|
+
when the operator wants a quick draft without ingesting sources first.
|
|
1845
|
+
The result is NOT saved — operator reviews + POSTs to /api/personas.
|
|
1846
|
+
"""
|
|
1847
|
+
from core.personas.description_drafter import (
|
|
1848
|
+
PersonaDraftError,
|
|
1849
|
+
draft_persona_from_description,
|
|
1850
|
+
)
|
|
1851
|
+
|
|
1852
|
+
description = (body.get("description") or "").strip()
|
|
1853
|
+
name = (body.get("name") or "").strip()
|
|
1854
|
+
source_label = (body.get("source_label") or "").strip()
|
|
1855
|
+
try:
|
|
1856
|
+
res = draft_persona_from_description(
|
|
1857
|
+
description, name=name, source_label=source_label,
|
|
1858
|
+
)
|
|
1859
|
+
except PersonaDraftError as exc:
|
|
1860
|
+
return {"error": str(exc)}
|
|
1861
|
+
return {
|
|
1862
|
+
"persona": res.persona.model_dump(),
|
|
1863
|
+
"provider_name": res.provider_name,
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
|
|
1830
1867
|
# --- AI agent draft from description (PR82b v3.1.0) ---
|
|
1831
1868
|
|
|
1832
1869
|
@app.post("/api/agents/draft")
|