@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/desk.js ADDED
@@ -0,0 +1,201 @@
1
+ /**
2
+ * The desk where what agents are given is written: every persona and every
3
+ * skill, found by what is typed, and the one open lit. `Context.Page`, the
4
+ * page the sidebar offers as Context, is the desk alone, each persona with the
5
+ * project it works for and each skill with its description. `Context`, the tab
6
+ * a persona or a skill opens on, sets it beside the desk, titles only, with
7
+ * its Full page in the middle, where what it says and every document it
8
+ * carries are typed into (./carried.ts), and, on the right, what an agent
9
+ * gets: the conversation that tries it, where the host draws one
10
+ * (`Conversation`), and the text it is given. Stacked, as on a phone, the one
11
+ * open comes first and the desk last.
12
+ *
13
+ * A row of the desk drags its entity (@yaks/ux `drag`), so it can be dropped
14
+ * on any list that takes one.
15
+ *
16
+ * What is typed to find one is the person's draft (the UX host's `drafts`), so
17
+ * it stays as they go from one to the next, and in every interface they use.
18
+ *
19
+ * @module
20
+ */ /* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h, useLayoutEffect, useRef } from "react";
21
+ import * as ui from "@yaks/ui";
22
+ import { drag, useDraft, useHost } from "@yaks/ux";
23
+ import { useNamed } from "@yaks/inspect";
24
+ import { PERSONA, SKILL } from "./comp.js";
25
+ /** How many personas, and how many skills, the desk lists. */ export let SHELF = 500;
26
+ /** Where what is typed to find a persona or a skill is kept, as the
27
+ * person's draft. */ export let FINDING = 'context:find';
28
+ let str = (b, name, prop)=>{
29
+ let v = b?.[name]?.[prop];
30
+ return typeof v == 'string' ? v : '';
31
+ };
32
+ let rows = (a)=>a?.rows ?? [];
33
+ /** What a persona or a skill is called. */ export let title = (b)=>str(b, 'doc', 'title');
34
+ let byTitle = (a, b)=>title(a).localeCompare(title(b), undefined, {
35
+ sensitivity: 'base'
36
+ });
37
+ /** Whether what was said finds a persona or a skill: each word of it is in
38
+ * its title or its description, in any case. Nothing said finds everything. */ /// let skill = { entity: { eid: 's' }, doc: { title: 'ui-building', body: 'How to build interface' } }
39
+ /// fits('build ui', skill) -> true
40
+ /// fits('Interface', skill) -> true
41
+ /// fits('tests', skill) -> false
42
+ export let fits = (said, b)=>{
43
+ let words = `${title(b)} ${str(b, 'doc', 'body')}`.toLowerCase();
44
+ return said.toLowerCase().split(/\s+/).every((w)=>words.includes(w));
45
+ };
46
+ /** What the desk asks: each persona's title and the project it works for,
47
+ * and each skill's name and description. */ let asking = (io)=>{
48
+ let live = io.vocab.comp('archived') ? '&!archived' : '';
49
+ return {
50
+ personas: `.${PERSONA}${live}&.fields=doc.title,${PERSONA}.home` + `&.limit=${SHELF}`,
51
+ ...io.vocab.comp(SKILL) ? {
52
+ skills: `.${SKILL}${live}&.fields=doc.title,doc.body&.limit=${SHELF}`
53
+ } : {}
54
+ };
55
+ };
56
+ /** Every persona and skill, found by what was typed: a hook. */ let useDesk = (io)=>{
57
+ let got = io.ask(asking(io));
58
+ let said = useDraft(FINDING).trim();
59
+ let found = (a)=>rows(a).filter((b)=>fits(said, b)).toSorted(byTitle);
60
+ return {
61
+ got,
62
+ said,
63
+ personas: found(got.personas),
64
+ skills: found(got.skills)
65
+ };
66
+ };
67
+ /** The field a persona or a skill is found from: Enter opens the first it
68
+ * finds, Escape clears it. */ let Find = ({ io, said, personas, skills })=>{
69
+ let { drafts } = useHost();
70
+ let box = useRef(null);
71
+ useLayoutEffect(()=>{
72
+ let el = box.current;
73
+ if (el && el.value != said) el.value = said;
74
+ }, [
75
+ said
76
+ ]);
77
+ let first = personas[0] ?? skills[0];
78
+ return /*#__PURE__*/ h(ui.Field, {
79
+ elRef: box,
80
+ type: 'search',
81
+ name: 'find',
82
+ 'aria-label': 'find a persona or a skill',
83
+ placeholder: 'find a persona or a skill…',
84
+ onInput: (ev)=>drafts.type(FINDING, ev.currentTarget.value),
85
+ onKeyDown: (ev)=>{
86
+ if (ev.key == 'Enter' && first) {
87
+ ev.preventDefault();
88
+ drafts.spend(FINDING);
89
+ io.go(io.link(first.entity.eid));
90
+ } else if (ev.key == 'Escape' && said) {
91
+ ev.preventDefault();
92
+ drafts.spend(FINDING);
93
+ }
94
+ }
95
+ });
96
+ };
97
+ /** One persona or skill on the desk, linked to its page, lit when open, its
98
+ * cover under it where covers show. Dragged, it drags itself. */ let Item = ({ io, b, lit, covers })=>{
99
+ let eid = b.entity.eid;
100
+ let home = str(b, PERSONA, 'home');
101
+ // A persona's body is what it says to an agent, too long for a cover; a
102
+ // skill's is the description an agent decides by.
103
+ let cover = !covers ? '' : b[PERSONA] ? home ? `for ${io.name(home)}` : 'for no project' : str(b, 'doc', 'body');
104
+ return /*#__PURE__*/ h(ui.Rows.Item, {
105
+ role: 'listitem',
106
+ 'data-given': eid,
107
+ onDragStart: (ev)=>drag(ev, eid)
108
+ }, /*#__PURE__*/ h(ui.Tile, {
109
+ href: io.link(eid),
110
+ mod: eid == lit ? 'on' : undefined,
111
+ 'aria-current': eid == lit ? 'page' : undefined
112
+ }, /*#__PURE__*/ h(ui.Tile.Title, {
113
+ mod: covers ? 'wrap' : undefined
114
+ }, title(b)), cover ? /*#__PURE__*/ h(ui.Tile.Sub, {
115
+ mod: 'wrap'
116
+ }, cover) : null));
117
+ };
118
+ /** One shelf of the desk, under its heading and count, or why it shows
119
+ * nothing. */ let Shelf = ({ io, heading, all, got, said, lit, covers })=>!got && !all.length ? null : /*#__PURE__*/ h(ui.Section, {
120
+ 'data-shelf': heading
121
+ }, /*#__PURE__*/ h(ui.Section.Title, {}, heading, got?.ready ? /*#__PURE__*/ h(ui.Section.Count, {}, String(all.length)) : null), got?.error ? /*#__PURE__*/ h(ui.Rows.More, {}, got.error) : !got?.ready && !all.length ? /*#__PURE__*/ h(ui.Loading, {}) : !all.length ? /*#__PURE__*/ h(ui.Rows.More, {}, said ? `none fits “${said}”` : `no ${heading.toLowerCase()} yet`) : /*#__PURE__*/ h(ui.Rows, {
122
+ role: 'list',
123
+ mod: covers ? 'ruled' : undefined
124
+ }, all.map((b)=>/*#__PURE__*/ h(Item, {
125
+ key: b.entity.eid,
126
+ io,
127
+ b,
128
+ lit,
129
+ covers
130
+ }))));
131
+ /** The desk's two shelves: the personas, then the skills. */ let Shelves = (d)=>{
132
+ useNamed(d.io, d.covers ? d.personas.map((b)=>str(b, PERSONA, 'home')) : []);
133
+ return /*#__PURE__*/ h('div', {
134
+ 'data-desk': ''
135
+ }, /*#__PURE__*/ h(Shelf, {
136
+ ...d,
137
+ heading: 'Personas',
138
+ all: d.personas,
139
+ got: d.got.personas
140
+ }), /*#__PURE__*/ h(Shelf, {
141
+ ...d,
142
+ heading: 'Skills',
143
+ all: d.skills,
144
+ got: d.got.skills
145
+ }));
146
+ };
147
+ /** The page the sidebar offers as Context: every persona with the project it
148
+ * works for, every skill with its description, and the field that finds
149
+ * one. */ export let DeskPage = ({ io })=>{
150
+ let d = useDesk(io);
151
+ let ready = d.got.personas?.ready;
152
+ let n = (a, one)=>`${a.length} ${one}${a.length == 1 ? '' : 's'}`;
153
+ return /*#__PURE__*/ h('article', {
154
+ 'data-context': ''
155
+ }, /*#__PURE__*/ h(ui.Head, {}, /*#__PURE__*/ h(ui.Head.Title, {}, 'Context'), /*#__PURE__*/ h(ui.Head.Sub, {}, 'What agents are given: every persona and skill, and what each contains and reads. Open one to arrange it, read what an agent is given, and try it.'), ready ? /*#__PURE__*/ h(ui.Head.Facts, {}, n(d.personas, 'persona'), ...d.got.skills ? [
156
+ n(d.skills, 'skill')
157
+ ] : []) : null), /*#__PURE__*/ h(ui.Section, {}, /*#__PURE__*/ h(Find, {
158
+ ...d,
159
+ io
160
+ })), /*#__PURE__*/ h(Shelves, {
161
+ ...d,
162
+ io,
163
+ covers: true
164
+ }));
165
+ };
166
+ /** A persona or a skill opened at the desk: the desk, its Full page without
167
+ * the chat a page has beside it, and what an agent gets beside that: a
168
+ * session to try it where the host draws a conversation, and the text it is
169
+ * given. */ export let Workshop = ({ e, io })=>{
170
+ let d = useDesk(io);
171
+ let eid = e.entity.eid;
172
+ return /*#__PURE__*/ h(ui.Panes, {
173
+ 'data-workshop': eid
174
+ }, /*#__PURE__*/ h(ui.Panes.Pane, {
175
+ mod: [
176
+ 'nav',
177
+ 'aside'
178
+ ],
179
+ 'aria-label': 'Context'
180
+ }, /*#__PURE__*/ h(ui.Panes.Top, {}, /*#__PURE__*/ h(Find, {
181
+ ...d,
182
+ io
183
+ })), /*#__PURE__*/ h(ui.Panes.Body, {}, /*#__PURE__*/ h(Shelves, {
184
+ ...d,
185
+ io,
186
+ lit: eid
187
+ }))), /*#__PURE__*/ h(ui.Panes.Pane, {
188
+ mod: 'main',
189
+ 'aria-label': 'Full'
190
+ }, /*#__PURE__*/ h(ui.Panes.Body, {}, io.show(e, 'Full', {
191
+ chat: false
192
+ }))), /*#__PURE__*/ h(ui.Panes.Pane, {
193
+ mod: 'side',
194
+ 'aria-label': 'What an agent gets'
195
+ }, /*#__PURE__*/ h(ui.Panes.Body, {}, io.can(e, 'Conversation') ? /*#__PURE__*/ h(ui.Section, {
196
+ 'data-section': 'Try it'
197
+ }, /*#__PURE__*/ h(ui.Section.Title, {}, 'Try it'), io.show(e, 'Conversation', {})) : null, /*#__PURE__*/ h(ui.Section, {
198
+ 'data-section': 'What an agent is given'
199
+ }, /*#__PURE__*/ h(ui.Section.Title, {}, 'What an agent is given'), io.show(e, 'Markdown', {})))));
200
+ };
201
+ //# sourceMappingURL=desk.js.map
package/desk.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"desk.js","sources":["./desk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;CAmBC,GAED,uCAAuC,GAAG,SAAS,iBAAiB,CAAC,EAAY,eAAe,EAAE,MAAM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I,CAAC,GAAG,gBAAgB,CAAC,MAE5B,oBACJ,EACE,GAAG,OAAO,EACV;IAAE,gBAAgB;EAAyB,iBAC3C,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,2BACxB,GAAG,IAAI,CAAC,GAAG,YAAY,CAAC;AAKlC,EAAC"}
package/desk.ts ADDED
@@ -0,0 +1,301 @@
1
+ /**
2
+ * The desk where what agents are given is written: every persona and every
3
+ * skill, found by what is typed, and the one open lit. `Context.Page`, the
4
+ * page the sidebar offers as Context, is the desk alone, each persona with the
5
+ * project it works for and each skill with its description. `Context`, the tab
6
+ * a persona or a skill opens on, sets it beside the desk, titles only, with
7
+ * its Full page in the middle, where what it says and every document it
8
+ * carries are typed into (./carried.ts), and, on the right, what an agent
9
+ * gets: the conversation that tries it, where the host draws one
10
+ * (`Conversation`), and the text it is given. Stacked, as on a phone, the one
11
+ * open comes first and the desk last.
12
+ *
13
+ * A row of the desk drags its entity (@yaks/ux `drag`), so it can be dropped
14
+ * on any list that takes one.
15
+ *
16
+ * What is typed to find one is the person's draft (the UX host's `drafts`), so
17
+ * it stays as they go from one to the next, and in every interface they use.
18
+ *
19
+ * @module
20
+ */
21
+
22
+ /* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h, type JSX, useLayoutEffect, useRef } from 'react'
23
+ import * as ui from '@yaks/ui'
24
+ import { drag, useDraft, useHost } from '@yaks/ux'
25
+ import {
26
+ type Answer,
27
+ type Bundle,
28
+ type Io,
29
+ type Props,
30
+ useNamed,
31
+ } from '@yaks/inspect'
32
+ import { PERSONA, SKILL } from './comp.js'
33
+
34
+ /** How many personas, and how many skills, the desk lists. */
35
+ export let SHELF = 500
36
+
37
+ /** Where what is typed to find a persona or a skill is kept, as the
38
+ * person's draft. */
39
+ export let FINDING = 'context:find'
40
+
41
+ type Comp = Record<string, unknown>
42
+ let str = (b: Bundle | undefined, name: string, prop: string): string => {
43
+ let v = (b?.[name] as Comp | undefined)?.[prop]
44
+ return typeof v == 'string' ? v : ''
45
+ }
46
+ let rows = (a?: Answer): Bundle[] => a?.rows ?? []
47
+
48
+ /** What a persona or a skill is called. */
49
+ export let title = (b: Bundle): string => str(b, 'doc', 'title')
50
+
51
+ let byTitle = (a: Bundle, b: Bundle) =>
52
+ title(a).localeCompare(title(b), undefined, { sensitivity: 'base' })
53
+
54
+ /** Whether what was said finds a persona or a skill: each word of it is in
55
+ * its title or its description, in any case. Nothing said finds everything. */
56
+ /// let skill = { entity: { eid: 's' }, doc: { title: 'ui-building', body: 'How to build interface' } }
57
+ /// fits('build ui', skill) -> true
58
+ /// fits('Interface', skill) -> true
59
+ /// fits('tests', skill) -> false
60
+ export let fits = (said: string, b: Bundle): boolean => {
61
+ let words = `${title(b)} ${str(b, 'doc', 'body')}`.toLowerCase()
62
+ return said.toLowerCase().split(/\s+/).every((w) => words.includes(w))
63
+ }
64
+
65
+ /** What the desk asks: each persona's title and the project it works for,
66
+ * and each skill's name and description. */
67
+ let asking = (io: Io) => {
68
+ let live = io.vocab.comp('archived') ? '&!archived' : ''
69
+ return {
70
+ personas: `.${PERSONA}${live}&.fields=doc.title,${PERSONA}.home` +
71
+ `&.limit=${SHELF}`,
72
+ ...io.vocab.comp(SKILL)
73
+ ? {
74
+ skills: `.${SKILL}${live}&.fields=doc.title,doc.body&.limit=${SHELF}`,
75
+ }
76
+ : {},
77
+ }
78
+ }
79
+
80
+ type Shelved = {
81
+ /** the answers, for whether they have come */
82
+ got: Record<string, Answer>
83
+ /** what was typed to find one */
84
+ said: string
85
+ /** the personas and the skills what was typed finds, each by title */
86
+ personas: Bundle[]
87
+ skills: Bundle[]
88
+ }
89
+
90
+ /** Every persona and skill, found by what was typed: a hook. */
91
+ let useDesk = (io: Io): Shelved => {
92
+ let got = io.ask(asking(io))
93
+ let said = useDraft(FINDING).trim()
94
+ let found = (a?: Answer) =>
95
+ rows(a).filter((b) => fits(said, b)).toSorted(byTitle)
96
+ return {
97
+ got,
98
+ said,
99
+ personas: found(got.personas),
100
+ skills: found(got.skills),
101
+ }
102
+ }
103
+
104
+ /** The field a persona or a skill is found from: Enter opens the first it
105
+ * finds, Escape clears it. */
106
+ let Find = ({ io, said, personas, skills }: Shelved & { io: Io }) => {
107
+ let { drafts } = useHost()
108
+ let box = useRef<HTMLInputElement>(null)
109
+ useLayoutEffect(() => {
110
+ let el = box.current
111
+ if (el && el.value != said) el.value = said
112
+ }, [said])
113
+ let first = personas[0] ?? skills[0]
114
+ return h(ui.Field, {
115
+ elRef: box,
116
+ type: 'search',
117
+ name: 'find',
118
+ 'aria-label': 'find a persona or a skill',
119
+ placeholder: 'find a persona or a skill…',
120
+ onInput: (ev: Event) =>
121
+ drafts.type(FINDING, (ev.currentTarget as HTMLInputElement).value),
122
+ onKeyDown: (ev: KeyboardEvent) => {
123
+ if (ev.key == 'Enter' && first) {
124
+ ev.preventDefault()
125
+ drafts.spend(FINDING)
126
+ io.go(io.link(first.entity.eid))
127
+ } else if (ev.key == 'Escape' && said) {
128
+ ev.preventDefault()
129
+ drafts.spend(FINDING)
130
+ }
131
+ },
132
+ })
133
+ }
134
+
135
+ type Drawn = { io: Io; lit?: string; covers?: boolean }
136
+
137
+ /** One persona or skill on the desk, linked to its page, lit when open, its
138
+ * cover under it where covers show. Dragged, it drags itself. */
139
+ let Item = (
140
+ { io, b, lit, covers }: Drawn & { b: Bundle },
141
+ ): JSX.Element => {
142
+ let eid = b.entity.eid
143
+ let home = str(b, PERSONA, 'home')
144
+ // A persona's body is what it says to an agent, too long for a cover; a
145
+ // skill's is the description an agent decides by.
146
+ let cover = !covers
147
+ ? ''
148
+ : b[PERSONA]
149
+ ? home ? `for ${io.name(home)}` : 'for no project'
150
+ : str(b, 'doc', 'body')
151
+ return h(
152
+ ui.Rows.Item,
153
+ {
154
+ role: 'listitem',
155
+ 'data-given': eid,
156
+ onDragStart: (ev: DragEvent) => drag(ev, eid),
157
+ },
158
+ h(
159
+ ui.Tile,
160
+ {
161
+ href: io.link(eid),
162
+ mod: eid == lit ? 'on' : undefined,
163
+ 'aria-current': eid == lit ? 'page' : undefined,
164
+ },
165
+ h(ui.Tile.Title, { mod: covers ? 'wrap' : undefined }, title(b)),
166
+ cover ? h(ui.Tile.Sub, { mod: 'wrap' }, cover) : null,
167
+ ),
168
+ )
169
+ }
170
+
171
+ /** One shelf of the desk, under its heading and count, or why it shows
172
+ * nothing. */
173
+ let Shelf = (
174
+ { io, heading, all, got, said, lit, covers }: Drawn & {
175
+ heading: string
176
+ all: Bundle[]
177
+ got?: Answer
178
+ said: string
179
+ },
180
+ ): JSX.Element | null =>
181
+ !got && !all.length ? null : h(
182
+ ui.Section,
183
+ { 'data-shelf': heading },
184
+ h(
185
+ ui.Section.Title,
186
+ {},
187
+ heading,
188
+ got?.ready ? h(ui.Section.Count, {}, String(all.length)) : null,
189
+ ),
190
+ got?.error
191
+ ? h(ui.Rows.More, {}, got.error)
192
+ : !got?.ready && !all.length
193
+ ? h(ui.Loading, {})
194
+ : !all.length
195
+ ? h(
196
+ ui.Rows.More,
197
+ {},
198
+ said ? `none fits “${said}”` : `no ${heading.toLowerCase()} yet`,
199
+ )
200
+ : h(
201
+ ui.Rows,
202
+ { role: 'list', mod: covers ? 'ruled' : undefined },
203
+ all.map((b) => h(Item, { key: b.entity.eid, io, b, lit, covers })),
204
+ ),
205
+ )
206
+
207
+ /** The desk's two shelves: the personas, then the skills. */
208
+ let Shelves = (d: Shelved & Drawn): JSX.Element => {
209
+ useNamed(d.io, d.covers ? d.personas.map((b) => str(b, PERSONA, 'home')) : [])
210
+ return h(
211
+ 'div',
212
+ { 'data-desk': '' },
213
+ h(Shelf, {
214
+ ...d,
215
+ heading: 'Personas',
216
+ all: d.personas,
217
+ got: d.got.personas,
218
+ }),
219
+ h(Shelf, { ...d, heading: 'Skills', all: d.skills, got: d.got.skills }),
220
+ )
221
+ }
222
+
223
+ /** The page the sidebar offers as Context: every persona with the project it
224
+ * works for, every skill with its description, and the field that finds
225
+ * one. */
226
+ export let DeskPage = ({ io }: Props): JSX.Element => {
227
+ let d = useDesk(io)
228
+ let ready = d.got.personas?.ready
229
+ let n = (a: Bundle[], one: string) =>
230
+ `${a.length} ${one}${a.length == 1 ? '' : 's'}`
231
+ return h(
232
+ 'article',
233
+ { 'data-context': '' },
234
+ h(
235
+ ui.Head,
236
+ {},
237
+ h(ui.Head.Title, {}, 'Context'),
238
+ h(
239
+ ui.Head.Sub,
240
+ {},
241
+ 'What agents are given: every persona and skill, and what each contains and reads. Open one to arrange it, read what an agent is given, and try it.',
242
+ ),
243
+ ready
244
+ ? h(
245
+ ui.Head.Facts,
246
+ {},
247
+ n(d.personas, 'persona'),
248
+ ...d.got.skills ? [n(d.skills, 'skill')] : [],
249
+ )
250
+ : null,
251
+ ),
252
+ h(ui.Section, {}, h(Find, { ...d, io })),
253
+ h(Shelves, { ...d, io, covers: true }),
254
+ )
255
+ }
256
+
257
+ /** A persona or a skill opened at the desk: the desk, its Full page without
258
+ * the chat a page has beside it, and what an agent gets beside that: a
259
+ * session to try it where the host draws a conversation, and the text it is
260
+ * given. */
261
+ export let Workshop = ({ e, io }: Props): JSX.Element => {
262
+ let d = useDesk(io)
263
+ let eid = e.entity.eid
264
+ return h(
265
+ ui.Panes,
266
+ { 'data-workshop': eid },
267
+ h(
268
+ ui.Panes.Pane,
269
+ { mod: ['nav', 'aside'], 'aria-label': 'Context' },
270
+ h(ui.Panes.Top, {}, h(Find, { ...d, io })),
271
+ h(ui.Panes.Body, {}, h(Shelves, { ...d, io, lit: eid })),
272
+ ),
273
+ h(
274
+ ui.Panes.Pane,
275
+ { mod: 'main', 'aria-label': 'Full' },
276
+ h(ui.Panes.Body, {}, io.show(e, 'Full', { chat: false })),
277
+ ),
278
+ h(
279
+ ui.Panes.Pane,
280
+ { mod: 'side', 'aria-label': 'What an agent gets' },
281
+ h(
282
+ ui.Panes.Body,
283
+ {},
284
+ io.can(e, 'Conversation')
285
+ ? h(
286
+ ui.Section,
287
+ { 'data-section': 'Try it' },
288
+ h(ui.Section.Title, {}, 'Try it'),
289
+ io.show(e, 'Conversation', {}),
290
+ )
291
+ : null,
292
+ h(
293
+ ui.Section,
294
+ { 'data-section': 'What an agent is given' },
295
+ h(ui.Section.Title, {}, 'What an agent is given'),
296
+ io.show(e, 'Markdown', {}),
297
+ ),
298
+ ),
299
+ ),
300
+ )
301
+ }
package/effects.js ADDED
@@ -0,0 +1,106 @@
1
+ // What a host does about a persona that changed, exported as
2
+ // `@yaks/persona/effects`: the code behind `persona_files` (./vocab.json),
3
+ // which writes the persona files again (./files.ts) a moment after the write
4
+ // commits, so a checkout's AGENTS.md says what the graph says without anybody
5
+ // running `persona sync`.
6
+ //
7
+ // Only where the config asks for it: `{"use": "@yaks/persona", "with":
8
+ // {"files": true}}`. Each file's path comes from a project's checkout, not from
9
+ // the database, so a host opened on a copy of a graph would write into the
10
+ // checkouts the original names. The live host opts in; a probe does not.
11
+ //
12
+ // A write starts a timer and returns, so the commit is never held open, and a
13
+ // burst of writes is one pass. A pass renders every persona (a few hundred
14
+ // milliseconds over the fleet's graph) and writes only the files whose text
15
+ // moved, so a run only has to avoid passes nothing asked for: a text edit or a
16
+ // new link counts when it touches something the last pass said, and archiving
17
+ // or restoring a project with a repository counts because that moves its
18
+ // checkout in or out of the files. A host that has not made a pass yet counts
19
+ // every one, and its first pass learns the set. Passes run one at a time; the timer is dropped when the
20
+ // host shuts down.
21
+ import * as systemProcess from "@yaks/process/system";
22
+ import { EDGE } from "@yaks/edge";
23
+ import { DOC } from "@yaks/doc";
24
+ import { sync } from "@yaks/mirror";
25
+ import { link, personaMirror, remembered } from "./files.js";
26
+ import { skillEffects } from "./skill-effects.js";
27
+ /** How long a burst of writes settles before one pass answers all of it. */ export let AFTER = 1_000;
28
+ /** Whether a write moves the persona files, given the entities the last pass
29
+ * said (none until a pass has been made, and then every write counts). Text or
30
+ * a link counts when it touches what the last pass said, a link that went
31
+ * read by the ends its `edge` had (@yaks/effects `Event.before`); a persona
32
+ * moving always does. A project with a repository put away or brought back
33
+ * does too: the last pass never said it while it was archived, and its
34
+ * checkout is what the files are written into. */ export let moves = async (e, tx, said)=>{
35
+ let about = (...eids)=>!said.size || eids.some((x)=>said.has(String(x)));
36
+ if (e.name == 'archived') {
37
+ let [row] = await tx.get([
38
+ e.entity.eid
39
+ ], [
40
+ 'project',
41
+ 'repo'
42
+ ]);
43
+ return !!(row?.project && row.repo);
44
+ }
45
+ if (e.name == DOC || e.name == 'content') return about(e.entity.eid);
46
+ if (e.name == EDGE || e.name == 'contains' || e.name == 'reads') {
47
+ let ends = e.before?.[EDGE] ?? (await tx.get([
48
+ e.entity.eid
49
+ ], [
50
+ EDGE
51
+ ]))[0]?.[EDGE];
52
+ return about(ends?.from, ends?.to);
53
+ }
54
+ return true;
55
+ };
56
+ /** The code that keeps the persona files current, when `files` is on. */ export let effects = (host, options = {}, runtime = {})=>{
57
+ let skills = skillEffects(host, options, runtime);
58
+ if (!options.files) return skills;
59
+ let db = host.config?.db ?? systemProcess.env.get('DB_PATH');
60
+ let said = new Set();
61
+ let timer;
62
+ let last = Promise.resolve();
63
+ let pass = async ()=>{
64
+ try {
65
+ let m = await personaMirror(host.graph, remembered(db));
66
+ said = m.said;
67
+ let done = await sync(m.binding);
68
+ for (let f of [
69
+ ...done.failed,
70
+ ...(await link(m.links)).failed
71
+ ]){
72
+ console.warn('@yaks/persona files —', f);
73
+ await host.report?.(new Error(`persona files: ${f}`), {
74
+ tags: {
75
+ step: 'persona_files'
76
+ }
77
+ });
78
+ }
79
+ for (let p of done.conflicts){
80
+ console.warn(`@yaks/persona files — ${p} was edited by hand, left`);
81
+ }
82
+ } catch (error) {
83
+ console.warn('@yaks/persona files —', error);
84
+ await host.report?.(error, {
85
+ tags: {
86
+ step: 'persona_files'
87
+ }
88
+ });
89
+ }
90
+ };
91
+ let soon = ()=>{
92
+ if (host.stopping?.aborted) return;
93
+ clearTimeout(timer);
94
+ timer = setTimeout(()=>last = last.then(pass), runtime.after ?? AFTER);
95
+ };
96
+ host.stopping?.addEventListener('abort', ()=>clearTimeout(timer), {
97
+ once: true
98
+ });
99
+ return {
100
+ ...skills,
101
+ persona_files: async (e, tx)=>{
102
+ if (await moves(e, tx, said)) soon();
103
+ }
104
+ };
105
+ };
106
+ //# sourceMappingURL=effects.js.map
package/effects.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effects.js","sources":["./effects.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,2EAA2E;AAC3E,6EAA6E;AAC7E,8EAA8E;AAC9E,0BAA0B;AAC1B,EAAE;AACF,uEAAuE;AACvE,gFAAgF;AAChF,2EAA2E;AAC3E,yEAAyE;AACzE,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,yEAAyE;AACzE,8EAA8E;AAC9E,wGAAwG;AACxG,mBAAmB;AAEnB,YAAY,+CAAoD;AAIhE,SAAS,IAAI,0BAA+B;AAC5C,SAAS,GAAG,yBAA8B;AAC1C,SAAS,IAAI,4BAAiC;AAC9C,SAAS,IAAI,EAAE,aAAa,EAAE,UAAU,qBAAoB;AAC5D,SACE,YAAY,6BAGa;AAK3B,0EAA0E,GAC1E,OAAO,IAAI,QAAQ,MAAK;AAQxB;;;;;;gDAMgD,GAChD,OAAO,IAAI,QAAQ,OACjB,GACA,IACA;EAEA,IAAI,QAAQ,CAAC,GAAG,OACd,CAAC,KAAK,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,IAAM,KAAK,GAAG,CAAC,OAAO;EACjD,IAAI,EAAE,IAAI,IAAI,YAAY;IACxB,IAAI,CAAC,IAAI,GAAG,MAAM,GAAG,GAAG,CAAC;MAAC,EAAE,MAAM,CAAC,GAAG;KAAC,EAAE;MAAC;MAAW;KAAO;IAC5D,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,IAAI,IAAI;EACpC;EACA,IAAI,EAAE,IAAI,IAAI,OAAO,EAAE,IAAI,IAAI,WAAW,OAAO,MAAM,EAA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