@yaks/persona 0.0.0-stage → 0.2.36

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.
Files changed (115) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +401 -2
  3. package/_dist/comp.d.ts +13 -0
  4. package/_dist/comp.d.ts.map +1 -0
  5. package/_dist/effects.d.ts +22 -0
  6. package/_dist/effects.d.ts.map +1 -0
  7. package/_dist/mod.d.ts +40 -0
  8. package/_dist/mod.d.ts.map +1 -0
  9. package/_dist/name.d.ts +49 -0
  10. package/_dist/name.d.ts.map +1 -0
  11. package/_dist/owed.d.ts +56 -0
  12. package/_dist/owed.d.ts.map +1 -0
  13. package/_dist/part.d.ts +4 -0
  14. package/_dist/part.d.ts.map +1 -0
  15. package/_dist/shipped.d.ts +30 -0
  16. package/_dist/shipped.d.ts.map +1 -0
  17. package/_dist/skill-checkout.d.ts +6 -0
  18. package/_dist/skill-checkout.d.ts.map +1 -0
  19. package/_dist/skill-effects.d.ts +25 -0
  20. package/_dist/skill-effects.d.ts.map +1 -0
  21. package/_dist/skill-mirror-io.d.ts +7 -0
  22. package/_dist/skill-mirror-io.d.ts.map +1 -0
  23. package/_dist/skill-mirror.d.ts +15 -0
  24. package/_dist/skill-mirror.d.ts.map +1 -0
  25. package/_dist/skill-text.d.ts +28 -0
  26. package/_dist/skill-text.d.ts.map +1 -0
  27. package/_dist/skills.d.ts +22 -0
  28. package/_dist/skills.d.ts.map +1 -0
  29. package/_dist/tools.d.ts +9 -0
  30. package/_dist/tools.d.ts.map +1 -0
  31. package/_dist/ui.d.ts +6 -0
  32. package/_dist/ui.d.ts.map +1 -0
  33. package/_dist/views.d.ts +19 -0
  34. package/_dist/views.d.ts.map +1 -0
  35. package/_dist/vocab.d.ts +7 -0
  36. package/_dist/vocab.d.ts.map +1 -0
  37. package/_dist/voice.d.ts +47 -0
  38. package/_dist/voice.d.ts.map +1 -0
  39. package/_dist/worn.d.ts +55 -0
  40. package/_dist/worn.d.ts.map +1 -0
  41. package/carried.js +201 -0
  42. package/carried.js.map +1 -0
  43. package/carried.ts +269 -0
  44. package/comp.js +31 -0
  45. package/comp.js.map +1 -0
  46. package/comp.ts +38 -0
  47. package/deno.json +1 -0
  48. package/desk.js +201 -0
  49. package/desk.js.map +1 -0
  50. package/desk.ts +301 -0
  51. package/effects.js +106 -0
  52. package/effects.js.map +1 -0
  53. package/effects.ts +120 -0
  54. package/files.js +305 -0
  55. package/files.js.map +1 -0
  56. package/files.ts +319 -0
  57. package/inspect.js +66 -0
  58. package/inspect.js.map +1 -0
  59. package/inspect.ts +30 -0
  60. package/mod.js +40 -0
  61. package/mod.js.map +1 -0
  62. package/mod.ts +61 -0
  63. package/name.js +161 -0
  64. package/name.js.map +1 -0
  65. package/name.ts +184 -0
  66. package/owed.js +196 -0
  67. package/owed.js.map +1 -0
  68. package/owed.ts +256 -0
  69. package/package.json +83 -4
  70. package/part.js +4 -0
  71. package/part.js.map +1 -0
  72. package/part.ts +4 -0
  73. package/shipped.js +130 -0
  74. package/shipped.js.map +1 -0
  75. package/shipped.ts +131 -0
  76. package/skill-checkout.js +92 -0
  77. package/skill-checkout.js.map +1 -0
  78. package/skill-checkout.ts +121 -0
  79. package/skill-effects.js +244 -0
  80. package/skill-effects.js.map +1 -0
  81. package/skill-effects.ts +274 -0
  82. package/skill-mirror-io.js +193 -0
  83. package/skill-mirror-io.js.map +1 -0
  84. package/skill-mirror-io.ts +212 -0
  85. package/skill-mirror.js +659 -0
  86. package/skill-mirror.js.map +1 -0
  87. package/skill-mirror.ts +640 -0
  88. package/skill-text.js +158 -0
  89. package/skill-text.js.map +1 -0
  90. package/skill-text.ts +183 -0
  91. package/skills.js +238 -0
  92. package/skills.js.map +1 -0
  93. package/skills.ts +383 -0
  94. package/text.js +59 -0
  95. package/text.js.map +1 -0
  96. package/text.ts +60 -0
  97. package/tools.js +76 -0
  98. package/tools.js.map +1 -0
  99. package/tools.ts +91 -0
  100. package/ui.js +19 -0
  101. package/ui.js.map +1 -0
  102. package/ui.ts +34 -0
  103. package/views.js +27 -0
  104. package/views.js.map +1 -0
  105. package/views.ts +29 -0
  106. package/vocab.js +14 -0
  107. package/vocab.js.map +1 -0
  108. package/vocab.json +270 -0
  109. package/vocab.ts +16 -0
  110. package/voice.js +105 -0
  111. package/voice.js.map +1 -0
  112. package/voice.ts +133 -0
  113. package/worn.js +328 -0
  114. package/worn.js.map +1 -0
  115. package/worn.ts +336 -0
package/ui.js ADDED
@@ -0,0 +1,19 @@
1
+ // The `@yaks/persona/ui` facet: what a persona's people change of it, drawn
2
+ // from the kit's parts. Where a card's fields are sent is its host's: the
3
+ // host puts it in its form.
4
+ /* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h } from "react";
5
+ import { Card, Field, Form } from "@yaks/ui/parts";
6
+ import { LONGEST } from "./name.js";
7
+ /** Where a persona's people change what it is called (`doc{title}`): one
8
+ * field, `name`, holding `name` now, as long as `given` (./name.ts) takes. */ export let NameCard = ({ name })=>/*#__PURE__*/ h(Card, null, /*#__PURE__*/ h(Card.Head, null, /*#__PURE__*/ h(Card.Title, null, 'Name')), /*#__PURE__*/ h('p', null, 'What it goes by. It introduces itself by this name and signs what it writes with it.'), /*#__PURE__*/ h(Form.Field, null, /*#__PURE__*/ h(Form.Label, {
9
+ for: 'persona-name'
10
+ }, 'Name'), /*#__PURE__*/ h(Field, {
11
+ id: 'persona-name',
12
+ name: 'name',
13
+ placeholder: 'e.g. Dana',
14
+ value: name,
15
+ maxlength: LONGEST,
16
+ required: true,
17
+ autocomplete: 'off'
18
+ })));
19
+ //# sourceMappingURL=ui.js.map
package/ui.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sources":["./ui.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0EAA0E;AAC1E,4BAA4B;AAC5B,uCAAuC,GAAG,SAAS,iBAAiB,CAAC,gBAAoC;AACzG,SAAS,IAAI,EAAE,KAAK,EAAE,IAAI,8BAAmC;AAC7D,SAAS,OAAO,oBAAmB;AAEnC;4EAC4E,GAC5E,OAAO,IAAI,WAAW,CAAC,EAAE,IAAI,EAAoB,iBAC/C,EACE,MACA,oBACA,EAAE,KAAK,IAAI,EAAE,oBAAM,EAAE,KAAK,KAAK,EAAE,MAAM,wBACvC,EACE,KACA,MACA,uGAEF,EACE,KAAK,KAAK,EACV,oBACA,EAAE,KAAK,KAAK,EAAE;IAAE,KAAK;EAAe,GAAG,uBACvC,EAAE,OAAO;IACP,IAAI;IACJ,MAAM;IACN,aAAa;IACb,OAAO;IACP,WAAW;IACX,UAAU;IACV,cAAc;EAChB,KAEH"}
package/ui.ts ADDED
@@ -0,0 +1,34 @@
1
+ // The `@yaks/persona/ui` facet: what a persona's people change of it, drawn
2
+ // from the kit's parts. Where a card's fields are sent is its host's: the
3
+ // host puts it in its form.
4
+ /* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h, type JSX } from 'react'
5
+ import { Card, Field, Form } from '@yaks/ui/parts'
6
+ import { LONGEST } from './name.js'
7
+
8
+ /** Where a persona's people change what it is called (`doc{title}`): one
9
+ * field, `name`, holding `name` now, as long as `given` (./name.ts) takes. */
10
+ export let NameCard = ({ name }: { name: string }): JSX.Element =>
11
+ h(
12
+ Card,
13
+ null,
14
+ h(Card.Head, null, h(Card.Title, null, 'Name')),
15
+ h(
16
+ 'p',
17
+ null,
18
+ 'What it goes by. It introduces itself by this name and signs what it writes with it.',
19
+ ),
20
+ h(
21
+ Form.Field,
22
+ null,
23
+ h(Form.Label, { for: 'persona-name' }, 'Name'),
24
+ h(Field, {
25
+ id: 'persona-name',
26
+ name: 'name',
27
+ placeholder: 'e.g. Dana',
28
+ value: name,
29
+ maxlength: LONGEST,
30
+ required: true,
31
+ autocomplete: 'off',
32
+ }),
33
+ ),
34
+ )
package/views.js ADDED
@@ -0,0 +1,27 @@
1
+ // The `@yaks/persona/views` facet: the desk where personas and skills are
2
+ // written, the body of a persona's or a skill's Full page, loaded only by an
3
+ // interface that draws them (./inspect.ts); the tab a persona or a skill opens
4
+ // on; and the page the sidebar offers, Context, every persona and skill on the
5
+ // desk.
6
+ // @ts-types="@yaks/ui/lucide"
7
+ import NotebookPen from "lucide/dist/esm/icons/notebook-pen.mjs";
8
+ /** The desk, the workshop and the bodies, as the inspector draws them. */ export let inspectViews = ()=>import("./inspect.js").then((m)=>m.inspectViews);
9
+ /** The tab a persona or a skill wears first, so it opens at the desk. */ export let tabs = [
10
+ {
11
+ view: 'Context',
12
+ icon: 'notebook-pen'
13
+ }
14
+ ];
15
+ /** The page the sidebar offers: every persona and skill, and the field that
16
+ * finds one. */ export let destinations = [
17
+ {
18
+ key: 'context',
19
+ name: 'Context',
20
+ icon: 'notebook-pen',
21
+ view: 'Context.Page'
22
+ }
23
+ ];
24
+ /** The glyph it wears there. */ export let icons = {
25
+ 'notebook-pen': NotebookPen
26
+ };
27
+ //# sourceMappingURL=views.js.map
package/views.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"views.js","sources":["./views.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,QAAQ;AAER,8BAA8B;AAC9B,OAAO,0DAAoE;AAE3E,wEAAwE,GACxE,OAAO,IAAI,eAAe,IACxB,MAAM,CAAC,gBAAgB,IAAI,CAAC,CAAC,IAAM,EAAE,YAAY,EAAC;AAEpD,uEAAuE,GACvE,OAAO,IAAI,OAAO;EAAC;IAAE,MAAM;IAAW,MAAM;EAAe;CAAE,CAAA;AAE7D;cACc,GACd,OAAO,IAAI,eAAe;EACxB;IACE,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;EACR;CACD,CAAA;AAED,8BAA8B,GAC9B,OAAO,IAAI,QAAQ;EAAE,gBAAgB;AAAY,EAAC"}
package/views.ts ADDED
@@ -0,0 +1,29 @@
1
+ // The `@yaks/persona/views` facet: the desk where personas and skills are
2
+ // written, the body of a persona's or a skill's Full page, loaded only by an
3
+ // interface that draws them (./inspect.ts); the tab a persona or a skill opens
4
+ // on; and the page the sidebar offers, Context, every persona and skill on the
5
+ // desk.
6
+ import type { View } from 'jsr:@yaks/inspect@0.2.36'
7
+ // @ts-types="@yaks/ui/lucide"
8
+ import NotebookPen from 'lucide/dist/esm/icons/notebook-pen.mjs'
9
+
10
+ /** The desk, the workshop and the bodies, as the inspector draws them. */
11
+ export let inspectViews = (): Promise<View[]> =>
12
+ import('./inspect.js').then((m) => m.inspectViews)
13
+
14
+ /** The tab a persona or a skill wears first, so it opens at the desk. */
15
+ export let tabs = [{ view: 'Context', icon: 'notebook-pen' }]
16
+
17
+ /** The page the sidebar offers: every persona and skill, and the field that
18
+ * finds one. */
19
+ export let destinations = [
20
+ {
21
+ key: 'context',
22
+ name: 'Context',
23
+ icon: 'notebook-pen',
24
+ view: 'Context.Page',
25
+ },
26
+ ]
27
+
28
+ /** The glyph it wears there. */
29
+ export let icons = { 'notebook-pen': NotebookPen }
package/vocab.js ADDED
@@ -0,0 +1,14 @@
1
+ // The persona component declarations alone, exported as
2
+ // `@yaks/persona/vocab`. Nothing here touches storage, SQL or any runtime API,
3
+ // so a browser tab that only needs these components loads nothing else.
4
+ import { personaDoc } from "./comp.js";
5
+ import manifest from './package.json' with {
6
+ type: 'json'
7
+ };
8
+ export { personaDoc };
9
+ /** What this package is: its manifest's description, the one place it is
10
+ * written, which a host stamps on each document here. */ export let description = manifest.description;
11
+ /** Every document this plugin declares. */ export let docs = [
12
+ personaDoc
13
+ ];
14
+ //# sourceMappingURL=vocab.js.map
package/vocab.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vocab.js","sources":["./vocab.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,+EAA+E;AAC/E,wEAAwE;AAGxE,SAAS,UAAU,oBAAmB;AACtC,OAAO,cAAc,sBAAsB;EAAE,MAAM;AAAO,EAAC;AAE3D,SAAS,UAAU,GAAE;AAErB;uDACuD,GACvD,OAAO,IAAI,cAAsB,SAAS,WAAW,CAAA;AAErD,yCAAyC,GACzC,OAAO,IAAI,OAAmB;EAAC;CAAW,CAAA"}
package/vocab.json ADDED
@@ -0,0 +1,270 @@
1
+ {
2
+ "$id": "urn:uuid:6bc0e00a-ea63-4aef-9f34-3f428c816d24",
3
+ "$vocabulary": {
4
+ "https://yak.sh/vocab/core": true,
5
+ "https://yak.sh/vocab/edge": true,
6
+ "https://yak.sh/vocab/id": true,
7
+ "https://yak.sh/vocab/names": true,
8
+ "https://yak.sh/vocab/kernel": true
9
+ },
10
+ "title": "persona",
11
+ "$defs": {
12
+ "person": {
13
+ "$id": "urn:uuid:c743d98e-0b7b-4461-b222-9e3a35a8fecb",
14
+ "component": true,
15
+ "type": "object",
16
+ "by_name": true,
17
+ "properties": {},
18
+ "description": "a human being, as this graph knows them"
19
+ },
20
+ "relationship": {
21
+ "$id": "urn:uuid:ca33fb2d-bb08-46e6-a59e-594856a70ce9",
22
+ "component": true,
23
+ "type": "object",
24
+ "edge": true,
25
+ "properties": {
26
+ "role": {
27
+ "$id": "urn:uuid:20e3fb49-b2e5-400b-8763-4b3393c2ee9a",
28
+ "type": "string",
29
+ "index": true,
30
+ "description": "how the person at edge.from is related to the person at edge.to, such as brother, mother or friend"
31
+ }
32
+ },
33
+ "description": "a relationship known between two people"
34
+ },
35
+ "persona": {
36
+ "$id": "urn:uuid:f6028db6-760b-413e-8a89-d8f398b491a0",
37
+ "component": true,
38
+ "type": "object",
39
+ "by_name": true,
40
+ "governed": true,
41
+ "properties": {
42
+ "home": {
43
+ "$id": "urn:uuid:3376c2f3-eaf4-418a-8950-1a6370010302",
44
+ "type": "string",
45
+ "ref": "project",
46
+ "death": "detach",
47
+ "description": "the project it works for"
48
+ },
49
+ "base": {
50
+ "$id": "urn:uuid:3058887d-894e-4a26-9ec2-e30f190c3787",
51
+ "type": "string",
52
+ "description": "the persona this one is worn on, whose text and documents come first; it may be kept in another store, which whoever wears this one reads it from"
53
+ }
54
+ },
55
+ "description": "instructions an agent runs with: the doc body on the same entity is the instruction text"
56
+ },
57
+ "persona_read": {
58
+ "tool": true,
59
+ "page": true,
60
+ "noun": "persona",
61
+ "verb": "read",
62
+ "title": "Read a persona",
63
+ "description": "Read a persona (a named set of agent instructions) by id or name. Returns one markdown document: its own instruction text, then the full text of every document it includes, then one line naming each document it only references. This is the text an agent is given; where it goes (a file, a repository, a spawned agent’s system prompt) is up to the caller.",
64
+ "input": {
65
+ "persona": {
66
+ "type": "string",
67
+ "ref": "persona",
68
+ "description": "the persona’s unique entity id (eid), human-readable id, registered name, or exact title"
69
+ }
70
+ },
71
+ "required": [
72
+ "persona"
73
+ ],
74
+ "readOnly": true,
75
+ "positional": [
76
+ "persona"
77
+ ]
78
+ },
79
+ "persona_sync": {
80
+ "tool": true,
81
+ "destructive": false,
82
+ "noun": "persona",
83
+ "verb": "sync",
84
+ "title": "Write the persona files",
85
+ "description": "Write each project’s personas into its checkout, where a harness started there reads them: the persona the project contains as .tasks/AGENTS.md (a repository’s CLAUDE.md and AGENTS.md link to it), and every other persona whose home is the project as .tasks/personas/<name>.md (the sync links .claude/agents/<name>.md to it, and removes a link into .tasks/personas no file wants). Only a file whose text moved is written; the file of a renamed or deleted persona is removed; a file edited by hand while the graph also moved is left alone and reported. Returns one line per file it wrote, removed or left, and per link it made or removed.",
86
+ "input": {
87
+ "check": {
88
+ "type": "boolean",
89
+ "description": "write nothing: report the files that would change"
90
+ }
91
+ }
92
+ },
93
+ "persona_files": {
94
+ "effect": true,
95
+ "created": [
96
+ "persona",
97
+ "doc",
98
+ "content",
99
+ "contains",
100
+ "reads",
101
+ "archived"
102
+ ],
103
+ "changed": [
104
+ "persona.home",
105
+ "doc.title",
106
+ "doc.body",
107
+ "content.body"
108
+ ],
109
+ "removed": [
110
+ "persona",
111
+ "doc",
112
+ "content",
113
+ "contains",
114
+ "reads",
115
+ "edge",
116
+ "archived"
117
+ ],
118
+ "target": ".persona|.edges_to.edge.from.persona|.contains|.reads|.project .repo",
119
+ "description": "write the persona files again: a persona, its home, text a persona says in doc or content, a link carrying or reading it (read by the ends it had once it is gone), or a project with a repository archived or restored moved",
120
+ "option": "files"
121
+ },
122
+ "skill": {
123
+ "$id": "urn:uuid:37ac2058-224a-43a1-a0e0-52b3e7e5d864",
124
+ "component": true,
125
+ "type": "object",
126
+ "properties": {
127
+ "invoke": {
128
+ "$id": "urn:uuid:be83a7c7-7e51-4e6d-a2a3-8ddf07e397e6",
129
+ "type": "string",
130
+ "enum": [
131
+ "user",
132
+ "model",
133
+ "both"
134
+ ],
135
+ "description": "who may load the skill; both when omitted"
136
+ },
137
+ "arguments": {
138
+ "$id": "urn:uuid:5b747841-922f-4bc6-8e17-590aae5a0d51",
139
+ "type": "array",
140
+ "items": {
141
+ "type": "string"
142
+ },
143
+ "description": "the argument names the skill accepts"
144
+ },
145
+ "paths": {
146
+ "$id": "urn:uuid:63a3746e-a178-4513-85f1-e8dd927f1dd0",
147
+ "type": "array",
148
+ "items": {
149
+ "type": "string"
150
+ },
151
+ "description": "the path globs the skill applies under"
152
+ },
153
+ "fork": {
154
+ "$id": "urn:uuid:fdbde148-afee-45f0-9fb0-e5ab549705bf",
155
+ "type": "boolean",
156
+ "description": "run in a context of its own"
157
+ },
158
+ "options": {
159
+ "$id": "urn:uuid:f470ea6b-ffba-4c1b-a59a-f8a0ce564720",
160
+ "type": "object",
161
+ "additionalProperties": true,
162
+ "description": "other Claude frontmatter options, preserved without interpreting or executing them"
163
+ }
164
+ },
165
+ "description": "instructions loaded on demand: doc.title is the name and folder, doc.body the description an agent decides by, content.body the instructions. A references edge points to its repository file; names do not determine its identity"
166
+ },
167
+ "skill_files": {
168
+ "effect": true,
169
+ "created": [
170
+ "skill",
171
+ "file",
172
+ "content",
173
+ "doc",
174
+ "edge",
175
+ "repository",
176
+ "worktree",
177
+ "references"
178
+ ],
179
+ "changed": [
180
+ "skill",
181
+ "doc.title",
182
+ "doc.body",
183
+ "content.body",
184
+ "file",
185
+ "repository",
186
+ "worktree",
187
+ "edge"
188
+ ],
189
+ "removed": [
190
+ "skill",
191
+ "file",
192
+ "content",
193
+ "references",
194
+ "edge",
195
+ "doc",
196
+ "repository",
197
+ "worktree"
198
+ ],
199
+ "description": "reconcile skills, their repository files and reference links when skills mirroring is enabled; exports land through a dedicated worktree",
200
+ "option": "skills",
201
+ "target": ".skill|.file.path~=.claude/skills/|.references .edge.from.skill|.repository|.worktree"
202
+ },
203
+ "skill_watch": {
204
+ "effect": true,
205
+ "start": true,
206
+ "description": "reconcile repository skill files at startup and while the filesystem changes, only when skills mirroring is enabled",
207
+ "option": "skills"
208
+ }
209
+ },
210
+ "kinds": {
211
+ "person": {
212
+ "$id": "urn:uuid:c743d98e-0b7b-4461-b222-9e3a35a8fecb",
213
+ "description": "a human being, as this graph knows them",
214
+ "with": {
215
+ "doc": true
216
+ },
217
+ "before": [
218
+ "email"
219
+ ],
220
+ "prefix": "U",
221
+ "examples": [
222
+ {
223
+ "person": {},
224
+ "doc": {
225
+ "title": "Ada Lovelace"
226
+ }
227
+ }
228
+ ]
229
+ },
230
+ "persona": {
231
+ "$id": "urn:uuid:f6028db6-760b-413e-8a89-d8f398b491a0",
232
+ "description": "instructions an agent runs with: the doc body on the same entity is the instruction text",
233
+ "with": {
234
+ "doc": true
235
+ },
236
+ "prefix": "N",
237
+ "examples": [
238
+ {
239
+ "persona": {},
240
+ "doc": {
241
+ "title": "Reviewer",
242
+ "body": "Read the change and say what breaks"
243
+ }
244
+ }
245
+ ]
246
+ },
247
+ "skill": {
248
+ "$id": "urn:uuid:37ac2058-224a-43a1-a0e0-52b3e7e5d864",
249
+ "description": "instructions loaded on demand: doc.title is the name and folder, doc.body the description an agent decides by, content.body the instructions. A references edge points to its repository file; names do not determine its identity",
250
+ "with": {
251
+ "doc": true,
252
+ "content": true
253
+ },
254
+ "examples": [
255
+ {
256
+ "skill": {
257
+ "invoke": "model"
258
+ },
259
+ "doc": {
260
+ "title": "testing",
261
+ "body": "Use when writing or running tests"
262
+ },
263
+ "content": {
264
+ "body": "Run deno task test without paths."
265
+ }
266
+ }
267
+ ]
268
+ }
269
+ }
270
+ }
package/vocab.ts ADDED
@@ -0,0 +1,16 @@
1
+ // The persona component declarations alone, exported as
2
+ // `@yaks/persona/vocab`. Nothing here touches storage, SQL or any runtime API,
3
+ // so a browser tab that only needs these components loads nothing else.
4
+
5
+ import type { VocabDoc } from 'jsr:@yaks/vocab@0.2.36'
6
+ import { personaDoc } from './comp.js'
7
+ import manifest from './package.json' with { type: 'json' }
8
+
9
+ export { personaDoc }
10
+
11
+ /** What this package is: its manifest's description, the one place it is
12
+ * written, which a host stamps on each document here. */
13
+ export let description: string = manifest.description
14
+
15
+ /** Every document this plugin declares. */
16
+ export let docs: VocabDoc[] = [personaDoc]
package/voice.js ADDED
@@ -0,0 +1,105 @@
1
+ // Rendering a persona: one markdown document — the persona's own `doc`, then
2
+ // the documents it includes in full, then a list of the ones it only mentions
3
+ // by id. This is the text an agent is given at the top of its context.
4
+ //
5
+ // The persona's `doc` body is the instruction text (./vocab.json declares it
6
+ // that way), so it comes first and everything after it is a document the
7
+ // persona links to. Its words live in `doc.body` or `content.body`: a memory
8
+ // may mark a document, a comment or a transcript entry, and a persona linking
9
+ // to any of them renders the words where they already live. That is why there is no
10
+ // memory-shaped index line here and no section only memories may enter —
11
+ // restating another package's components is exactly what would stop this
12
+ // document carrying the next kind of thing somebody writes.
13
+ //
14
+ // Two sections, because there are two things a persona does with a document:
15
+ // it includes one (the body appears in full, so the reader has read it before
16
+ // starting) or it lists one (a line saying it exists, so the reader can ask
17
+ // for it). A third section would be a budget, and the budget belongs to the
18
+ // caller: it is the one that knows the size of the context window.
19
+ //
20
+ // Authored order, and nothing cleverer. The fleet's materializer sorted these
21
+ // by a warmth score that decayed against the wall clock, so two documents
22
+ // nobody had touched could swap places between renders, and a file written
23
+ // from it went stale with no graph write behind it. An edge's `ord` is a
24
+ // stored fact and the entity's number is another; both are stable, and a
25
+ // reader who wants a different order moves the edge.
26
+ //
27
+ // Markdown assembled from parts, never pasted together: each body is its own
28
+ // small document under an H1 of its own with a `---` rule above it, so a body
29
+ // may use `##` freely without colliding with the enclosing structure. Every
30
+ // title and id this module writes goes through @yaks/text's `safe` first — a
31
+ // control byte in a title is not something the terminal printing this should
32
+ // have to survive. A BODY does not: it is the author's whole document, and
33
+ // `safe` would strip the line breaks that make it one.
34
+ import { BODY, DOC, TITLE } from "@yaks/doc";
35
+ import { human } from "@yaks/id";
36
+ import { drawn } from "@yaks/markdown/structural";
37
+ import { safe } from "@yaks/text";
38
+ import { PART } from "./part.js";
39
+ export { PART };
40
+ /** The heading over the documents a persona only mentions by id. */ export let NAMED = '## Reads';
41
+ // Printed once, under that heading: a reader who meets an id needs to know it
42
+ // is an id and not a citation. Which tool resolves it is the caller's
43
+ // business, not this package's.
44
+ let ASK = 'Named here, not carried — ask the graph for one by id.';
45
+ let doc = (b)=>b[DOC] ?? {};
46
+ let prop = (b, name)=>{
47
+ let value = doc(b)[name];
48
+ if (name == BODY && !value) value = b.content?.body;
49
+ return value == null ? '' : String(value);
50
+ };
51
+ /**
52
+ * A persona as one markdown document. Takes the loaded vocabulary the bundles
53
+ * came from first — `let render = voice(vocab)`, then `render(worn)`.
54
+ *
55
+ * ```md
56
+ * # N-1 TaskMaster
57
+ *
58
+ * the instruction text itself
59
+ *
60
+ * ---
61
+ *
62
+ * # M-3 delegation discipline
63
+ *
64
+ * an included document, in full
65
+ *
66
+ * ---
67
+ *
68
+ * ## Reads
69
+ *
70
+ * Named here, not carried — ask the graph for one by id.
71
+ *
72
+ * - M-9 tickets carry signal
73
+ * ```
74
+ *
75
+ * A pure function: give it bundles and it returns text. Where that text goes
76
+ * — a file, a repo, the system prompt of a spawned agent — is the caller's
77
+ * decision, which is why nothing here writes a file.
78
+ */ export let voice = (vocab)=>{
79
+ let id = human(vocab);
80
+ let head = (b)=>safe(`${id(b)} ${prop(b, TITLE)}`).trim();
81
+ return ({ persona, contains, names })=>{
82
+ // A body's eids are drawn as the ids of what the persona carries, or as
83
+ // short handles (@yaks/markdown `drawn`): an agent never reads a uuid.
84
+ let own = new Map([
85
+ persona,
86
+ ...contains,
87
+ ...names
88
+ ].filter((b)=>b.entity.num).map((b)=>[
89
+ b.entity.eid,
90
+ id(b)
91
+ ]));
92
+ let part = (b)=>[
93
+ `# ${head(b)}`,
94
+ drawn(prop(b, BODY).trim(), (eid)=>own.get(eid))
95
+ ].filter(Boolean).join('\n\n');
96
+ return [
97
+ part(persona),
98
+ ...contains.map(part),
99
+ ...names.length ? [
100
+ `${NAMED}\n\n${ASK}\n\n${names.map((b)=>`- ${head(b)}`).join('\n')}`
101
+ ] : []
102
+ ].join(PART) + '\n';
103
+ };
104
+ };
105
+ //# sourceMappingURL=voice.js.map
package/voice.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice.js","sources":["./voice.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,uEAAuE;AACvE,EAAE;AACF,6EAA6E;AAC7E,yEAAyE;AACzE,6EAA6E;AAC7E,8EAA8E;AAC9E,oFAAoF;AACpF,yEAAyE;AACzE,yEAAyE;AACzE,4DAA4D;AAC5D,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,mEAAmE;AACnE,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,qDAAqD;AACrD,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,uDAAuD;AAGvD,SAAS,IAAI,EAAE,GAAG,EAAE,KAAK,yBAA8B;AACvD,SAAS,KAAK,wBAA6B;AAC3C,SAAS,KAAK,yCAA8C;AAC5D,SAAS,IAAI,0BAA+B;AAE5C,SAAS,IAAI,oBAAmB;AAChC,SAAS,IAAI,GAAE;AAsBf,kEAAkE,GAClE,OAAO,IAAI,QAAQ,WAAU;AAE7B,8EAA8E;AAC9E,sEAAsE;AACtE,gCAAgC;AAChC,IAAI,MAAM;AAEV,IAAI,MAAM,CAAC,IAAqB,CAAC,CAAC,IAAI,IAAI,CAAC;AAE3C,IAAI,OAAO,CAAC,GAAW;EACrB,IAAI,QAAQ,IAAI,EAAE,CAAC,KAAK;EACxB,IAAI,QAAQ,QAAQ,CAAC,OAAO,QAAS,EAAE,OAAO,EAAuB;EACrE,OAAO,SAAS,OAAO,KAAK,OAAO;AACrC;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GACD,OAAO,IAAI,QAAQ,CAAC;EAClB,IAAI,KAAK,MAAM;EACf,IAAI,OAAO,CAAC,IAAsB,KAAK,GAAG,GAAG,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,EAAE,IAAI;EACzE,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE;IAClC,wEAAwE;IACxE,uEAAuE;IACvE,IAAI,MAAM,IAAI,IACZ;MAAC;SAAY;SAAa;KAAM,CAAC,MAAM,CAAC,CAAC,IAAM,EAAE,MAAM,CAAC,GAAG,EACxD,GAAG,CAAC,CAAC,IAAM;QAAC,EAAE,MAAM,CAAC,GAAG;QAAE,GAAG;OAAG;IAErC,IAAI,OAAO,CAAC,IACV;QAAC,CAAC,EAAE,EAAE,KAAK,IAAI;QAAE,MAAM,KAAK,GAAG,MAAM,IAAI,IAAI,CAAC,MAAQ,IAAI,GAAG,CAAC;OAAM,CACjE,MAAM,CAAC,SAAS,IAAI,CAAC;IAC1B,OAAO;MACL,KAAK;SACF,SAAS,GAAG,CAAC;SACb,MAAM,MAAM,GACX;QACA,GAAG,MAAM,IAAI,EAAE,IAAI,IAAI,EACrB,MAAM,GAAG,CAAC,CAAC,IAAM,CAAC,EAAE,EAAE,KAAK,IAAI,EAAE,IAAI,CAAC,OACtC;OACH,GACC,EAAE;KACP,CAAC,IAAI,CAAC,QAAQ;EACjB;AACF,EAAC"}
package/voice.ts ADDED
@@ -0,0 +1,133 @@
1
+ // Rendering a persona: one markdown document — the persona's own `doc`, then
2
+ // the documents it includes in full, then a list of the ones it only mentions
3
+ // by id. This is the text an agent is given at the top of its context.
4
+ //
5
+ // The persona's `doc` body is the instruction text (./vocab.json declares it
6
+ // that way), so it comes first and everything after it is a document the
7
+ // persona links to. Its words live in `doc.body` or `content.body`: a memory
8
+ // may mark a document, a comment or a transcript entry, and a persona linking
9
+ // to any of them renders the words where they already live. That is why there is no
10
+ // memory-shaped index line here and no section only memories may enter —
11
+ // restating another package's components is exactly what would stop this
12
+ // document carrying the next kind of thing somebody writes.
13
+ //
14
+ // Two sections, because there are two things a persona does with a document:
15
+ // it includes one (the body appears in full, so the reader has read it before
16
+ // starting) or it lists one (a line saying it exists, so the reader can ask
17
+ // for it). A third section would be a budget, and the budget belongs to the
18
+ // caller: it is the one that knows the size of the context window.
19
+ //
20
+ // Authored order, and nothing cleverer. The fleet's materializer sorted these
21
+ // by a warmth score that decayed against the wall clock, so two documents
22
+ // nobody had touched could swap places between renders, and a file written
23
+ // from it went stale with no graph write behind it. An edge's `ord` is a
24
+ // stored fact and the entity's number is another; both are stable, and a
25
+ // reader who wants a different order moves the edge.
26
+ //
27
+ // Markdown assembled from parts, never pasted together: each body is its own
28
+ // small document under an H1 of its own with a `---` rule above it, so a body
29
+ // may use `##` freely without colliding with the enclosing structure. Every
30
+ // title and id this module writes goes through @yaks/text's `safe` first — a
31
+ // control byte in a title is not something the terminal printing this should
32
+ // have to survive. A BODY does not: it is the author's whole document, and
33
+ // `safe` would strip the line breaks that make it one.
34
+
35
+ import type { Bundle, Comp } from 'jsr:@yaks/graph@0.2.36'
36
+ import { BODY, DOC, TITLE } from '@yaks/doc'
37
+ import { human } from '@yaks/id'
38
+ import { drawn } from '@yaks/markdown/structural'
39
+ import { safe } from '@yaks/text'
40
+ import type { Vocab } from 'jsr:@yaks/vocab@0.2.36'
41
+ import { PART } from './part.js'
42
+ export { PART }
43
+
44
+ /** A persona and the documents it is built from: both sets, already resolved
45
+ * and ordered, and the tools it offers. */
46
+ export type Worn = {
47
+ /** the persona itself — its `doc` body is the instruction text */
48
+ persona: Bundle
49
+ /** the documents it includes: each body in full */
50
+ contains: Bundle[]
51
+ /** the documents it only mentions: one line apiece */
52
+ names: Bundle[]
53
+ /** the tools a session wearing it is offered: each registered tool
54
+ * (@yaks/tools' `tool{name}`) it or a persona it includes contains. Never
55
+ * part of its text. */
56
+ tools: Bundle[]
57
+ /** the saved queries a session wearing it is told the rows of when it
58
+ * starts and after each compaction: each `board{query}` (@yaks/project) it
59
+ * or a persona it includes contains. Resolved at delivery, never part of
60
+ * its text. */
61
+ queries: Bundle[]
62
+ }
63
+
64
+ /** The heading over the documents a persona only mentions by id. */
65
+ export let NAMED = '## Reads'
66
+
67
+ // Printed once, under that heading: a reader who meets an id needs to know it
68
+ // is an id and not a citation. Which tool resolves it is the caller's
69
+ // business, not this package's.
70
+ let ASK = 'Named here, not carried — ask the graph for one by id.'
71
+
72
+ let doc = (b: Bundle): Comp => (b[DOC] ?? {}) as Comp
73
+
74
+ let prop = (b: Bundle, name: string): string => {
75
+ let value = doc(b)[name]
76
+ if (name == BODY && !value) value = (b.content as Comp | undefined)?.body
77
+ return value == null ? '' : String(value)
78
+ }
79
+
80
+ /**
81
+ * A persona as one markdown document. Takes the loaded vocabulary the bundles
82
+ * came from first — `let render = voice(vocab)`, then `render(worn)`.
83
+ *
84
+ * ```md
85
+ * # N-1 TaskMaster
86
+ *
87
+ * the instruction text itself
88
+ *
89
+ * ---
90
+ *
91
+ * # M-3 delegation discipline
92
+ *
93
+ * an included document, in full
94
+ *
95
+ * ---
96
+ *
97
+ * ## Reads
98
+ *
99
+ * Named here, not carried — ask the graph for one by id.
100
+ *
101
+ * - M-9 tickets carry signal
102
+ * ```
103
+ *
104
+ * A pure function: give it bundles and it returns text. Where that text goes
105
+ * — a file, a repo, the system prompt of a spawned agent — is the caller's
106
+ * decision, which is why nothing here writes a file.
107
+ */
108
+ export let voice = (vocab: Vocab): (worn: Worn) => string => {
109
+ let id = human(vocab)
110
+ let head = (b: Bundle): string => safe(`${id(b)} ${prop(b, TITLE)}`).trim()
111
+ return ({ persona, contains, names }) => {
112
+ // A body's eids are drawn as the ids of what the persona carries, or as
113
+ // short handles (@yaks/markdown `drawn`): an agent never reads a uuid.
114
+ let own = new Map(
115
+ [persona, ...contains, ...names].filter((b) => b.entity.num)
116
+ .map((b) => [b.entity.eid, id(b)]),
117
+ )
118
+ let part = (b: Bundle): string =>
119
+ [`# ${head(b)}`, drawn(prop(b, BODY).trim(), (eid) => own.get(eid))]
120
+ .filter(Boolean).join('\n\n')
121
+ return [
122
+ part(persona),
123
+ ...contains.map(part),
124
+ ...names.length
125
+ ? [
126
+ `${NAMED}\n\n${ASK}\n\n${
127
+ names.map((b) => `- ${head(b)}`).join('\n')
128
+ }`,
129
+ ]
130
+ : [],
131
+ ].join(PART) + '\n'
132
+ }
133
+ }