@yaks/session 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.
- package/LICENSE +202 -0
- package/README.md +1392 -2
- package/_dist/admission.d.ts +15 -0
- package/_dist/admission.d.ts.map +1 -0
- package/_dist/announce.d.ts +17 -0
- package/_dist/announce.d.ts.map +1 -0
- package/_dist/answer.d.ts +200 -0
- package/_dist/answer.d.ts.map +1 -0
- package/_dist/append.d.ts +10 -0
- package/_dist/append.d.ts.map +1 -0
- package/_dist/archive.d.ts +6 -0
- package/_dist/archive.d.ts.map +1 -0
- package/_dist/asks.d.ts +11 -0
- package/_dist/asks.d.ts.map +1 -0
- package/_dist/audit.d.ts +15 -0
- package/_dist/audit.d.ts.map +1 -0
- package/_dist/bounce.d.ts +19 -0
- package/_dist/bounce.d.ts.map +1 -0
- package/_dist/bus.d.ts +8 -0
- package/_dist/bus.d.ts.map +1 -0
- package/_dist/cache.d.ts +45 -0
- package/_dist/cache.d.ts.map +1 -0
- package/_dist/child-notice.d.ts +6 -0
- package/_dist/child-notice.d.ts.map +1 -0
- package/_dist/children.d.ts +59 -0
- package/_dist/children.d.ts.map +1 -0
- package/_dist/cli.d.ts +8 -0
- package/_dist/cli.d.ts.map +1 -0
- package/_dist/comp.d.ts +9 -0
- package/_dist/comp.d.ts.map +1 -0
- package/_dist/compact.d.ts +19 -0
- package/_dist/compact.d.ts.map +1 -0
- package/_dist/conversation.d.ts +158 -0
- package/_dist/conversation.d.ts.map +1 -0
- package/_dist/cost.d.ts +13 -0
- package/_dist/cost.d.ts.map +1 -0
- package/_dist/deferred.d.ts +79 -0
- package/_dist/deferred.d.ts.map +1 -0
- package/_dist/ended.d.ts +27 -0
- package/_dist/ended.d.ts.map +1 -0
- package/_dist/files.d.ts +73 -0
- package/_dist/files.d.ts.map +1 -0
- package/_dist/fork.d.ts +23 -0
- package/_dist/fork.d.ts.map +1 -0
- package/_dist/graft.d.ts +33 -0
- package/_dist/graft.d.ts.map +1 -0
- package/_dist/graph.d.ts +14 -0
- package/_dist/graph.d.ts.map +1 -0
- package/_dist/handoff.d.ts +29 -0
- package/_dist/handoff.d.ts.map +1 -0
- package/_dist/imported.d.ts +63 -0
- package/_dist/imported.d.ts.map +1 -0
- package/_dist/intake.d.ts +43 -0
- package/_dist/intake.d.ts.map +1 -0
- package/_dist/joined.d.ts +35 -0
- package/_dist/joined.d.ts.map +1 -0
- package/_dist/lease.d.ts +21 -0
- package/_dist/lease.d.ts.map +1 -0
- package/_dist/lines.d.ts +13 -0
- package/_dist/lines.d.ts.map +1 -0
- package/_dist/mod.d.ts +107 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/naming.d.ts +10 -0
- package/_dist/naming.d.ts.map +1 -0
- package/_dist/native.d.ts +13 -0
- package/_dist/native.d.ts.map +1 -0
- package/_dist/parts.d.ts +145 -0
- package/_dist/parts.d.ts.map +1 -0
- package/_dist/plugin.d.ts +33 -0
- package/_dist/plugin.d.ts.map +1 -0
- package/_dist/project.d.ts +67 -0
- package/_dist/project.d.ts.map +1 -0
- package/_dist/prose.d.ts +7 -0
- package/_dist/prose.d.ts.map +1 -0
- package/_dist/providers.d.ts +36 -0
- package/_dist/providers.d.ts.map +1 -0
- package/_dist/reach.d.ts +39 -0
- package/_dist/reach.d.ts.map +1 -0
- package/_dist/react.d.ts +236 -0
- package/_dist/react.d.ts.map +1 -0
- package/_dist/readers.d.ts +221 -0
- package/_dist/readers.d.ts.map +1 -0
- package/_dist/reap.d.ts +21 -0
- package/_dist/reap.d.ts.map +1 -0
- package/_dist/recall.d.ts +32 -0
- package/_dist/recall.d.ts.map +1 -0
- package/_dist/routes.d.ts +15 -0
- package/_dist/routes.d.ts.map +1 -0
- package/_dist/run.d.ts +81 -0
- package/_dist/run.d.ts.map +1 -0
- package/_dist/service.d.ts +131 -0
- package/_dist/service.d.ts.map +1 -0
- package/_dist/source.d.ts +9 -0
- package/_dist/source.d.ts.map +1 -0
- package/_dist/start.d.ts +29 -0
- package/_dist/start.d.ts.map +1 -0
- package/_dist/state.d.ts +75 -0
- package/_dist/state.d.ts.map +1 -0
- package/_dist/status.d.ts +38 -0
- package/_dist/status.d.ts.map +1 -0
- package/_dist/tail.d.ts +121 -0
- package/_dist/tail.d.ts.map +1 -0
- package/_dist/timing.d.ts +9 -0
- package/_dist/timing.d.ts.map +1 -0
- package/_dist/told.d.ts +17 -0
- package/_dist/told.d.ts.map +1 -0
- package/_dist/tools.d.ts +41 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/transcript.d.ts +5 -0
- package/_dist/transcript.d.ts.map +1 -0
- package/_dist/turn.d.ts +49 -0
- package/_dist/turn.d.ts.map +1 -0
- package/_dist/unknown.d.ts +6 -0
- package/_dist/unknown.d.ts.map +1 -0
- package/_dist/views.d.ts +9 -0
- package/_dist/views.d.ts.map +1 -0
- package/_dist/vocab.d.ts +9 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/_dist/wait.d.ts +15 -0
- package/_dist/wait.d.ts.map +1 -0
- package/_dist/wake.d.ts +116 -0
- package/_dist/wake.d.ts.map +1 -0
- package/_dist/watch.d.ts +52 -0
- package/_dist/watch.d.ts.map +1 -0
- package/_dist/who.d.ts +84 -0
- package/_dist/who.d.ts.map +1 -0
- package/_dist/window.d.ts +43 -0
- package/_dist/window.d.ts.map +1 -0
- package/admission.js +137 -0
- package/admission.js.map +1 -0
- package/admission.ts +164 -0
- package/announce.js +123 -0
- package/announce.js.map +1 -0
- package/announce.ts +126 -0
- package/answer.js +372 -0
- package/answer.js.map +1 -0
- package/answer.ts +426 -0
- package/append.js +125 -0
- package/append.js.map +1 -0
- package/append.ts +205 -0
- package/archive.js +62 -0
- package/archive.js.map +1 -0
- package/archive.ts +62 -0
- package/asks.js +80 -0
- package/asks.js.map +1 -0
- package/asks.ts +106 -0
- package/attempt.js +46 -0
- package/attempt.js.map +1 -0
- package/attempt.ts +60 -0
- package/audit.js +57 -0
- package/audit.js.map +1 -0
- package/audit.ts +65 -0
- package/bounce.js +29 -0
- package/bounce.js.map +1 -0
- package/bounce.ts +34 -0
- package/bus.js +568 -0
- package/bus.js.map +1 -0
- package/bus.ts +683 -0
- package/cache.js +169 -0
- package/cache.js.map +1 -0
- package/cache.ts +230 -0
- package/child-notice.js +128 -0
- package/child-notice.js.map +1 -0
- package/child-notice.ts +136 -0
- package/children.js +937 -0
- package/children.js.map +1 -0
- package/children.ts +925 -0
- package/claude-control.js +8 -0
- package/claude-control.js.map +1 -0
- package/claude-control.ts +12 -0
- package/cli.js +23 -0
- package/cli.js.map +1 -0
- package/cli.ts +28 -0
- package/comp.js +76 -0
- package/comp.js.map +1 -0
- package/comp.ts +78 -0
- package/compact.js +157 -0
- package/compact.js.map +1 -0
- package/compact.ts +209 -0
- package/compact_ask.js +280 -0
- package/compact_ask.js.map +1 -0
- package/compact_ask.ts +199 -0
- package/continue.js +131 -0
- package/continue.js.map +1 -0
- package/continue.ts +143 -0
- package/conversation.js +337 -0
- package/conversation.js.map +1 -0
- package/conversation.ts +593 -0
- package/cost.js +111 -0
- package/cost.js.map +1 -0
- package/cost.ts +93 -0
- package/deferred.js +207 -0
- package/deferred.js.map +1 -0
- package/deferred.ts +219 -0
- package/deno.json +1 -0
- package/dependencies.js +114 -0
- package/dependencies.js.map +1 -0
- package/dependencies.ts +110 -0
- package/draining.js +20 -0
- package/draining.js.map +1 -0
- package/draining.ts +26 -0
- package/ended.js +210 -0
- package/ended.js.map +1 -0
- package/ended.ts +225 -0
- package/files.js +285 -0
- package/files.js.map +1 -0
- package/files.ts +318 -0
- package/fork.js +96 -0
- package/fork.js.map +1 -0
- package/fork.ts +124 -0
- package/graft.js +97 -0
- package/graft.js.map +1 -0
- package/graft.ts +88 -0
- package/graph.js +49 -0
- package/graph.js.map +1 -0
- package/graph.ts +61 -0
- package/handoff.js +111 -0
- package/handoff.js.map +1 -0
- package/handoff.ts +147 -0
- package/help.js +432 -0
- package/help.js.map +1 -0
- package/help.ts +431 -0
- package/hooks.js +253 -0
- package/hooks.js.map +1 -0
- package/hooks.ts +333 -0
- package/imported.js +259 -0
- package/imported.js.map +1 -0
- package/imported.ts +201 -0
- package/inspect.js +353 -0
- package/inspect.js.map +1 -0
- package/inspect.ts +378 -0
- package/intake.js +115 -0
- package/intake.js.map +1 -0
- package/intake.ts +124 -0
- package/joined.js +67 -0
- package/joined.js.map +1 -0
- package/joined.ts +69 -0
- package/lease.js +146 -0
- package/lease.js.map +1 -0
- package/lease.ts +151 -0
- package/lifecycle.js +49 -0
- package/lifecycle.js.map +1 -0
- package/lifecycle.ts +46 -0
- package/lines.js +171 -0
- package/lines.js.map +1 -0
- package/lines.ts +177 -0
- package/listen.js +604 -0
- package/listen.js.map +1 -0
- package/listen.ts +976 -0
- package/log.js +78 -0
- package/log.js.map +1 -0
- package/log.ts +88 -0
- package/mod.js +107 -0
- package/mod.js.map +1 -0
- package/mod.ts +113 -0
- package/name.js +51 -0
- package/name.js.map +1 -0
- package/name.ts +84 -0
- package/naming.js +96 -0
- package/naming.js.map +1 -0
- package/naming.ts +102 -0
- package/native.js +17 -0
- package/native.js.map +1 -0
- package/native.ts +17 -0
- package/package.json +133 -4
- package/parts.js +334 -0
- package/parts.js.map +1 -0
- package/parts.ts +383 -0
- package/plugin.js +77 -0
- package/plugin.js.map +1 -0
- package/plugin.ts +98 -0
- package/project.js +354 -0
- package/project.js.map +1 -0
- package/project.ts +407 -0
- package/prompt.js +57 -0
- package/prompt.js.map +1 -0
- package/prompt.ts +92 -0
- package/prose.js +43 -0
- package/prose.js.map +1 -0
- package/prose.ts +63 -0
- package/providers.js +279 -0
- package/providers.js.map +1 -0
- package/providers.ts +306 -0
- package/pruning.js +80 -0
- package/pruning.js.map +1 -0
- package/pruning.ts +147 -0
- package/reach.js +923 -0
- package/reach.js.map +1 -0
- package/reach.ts +1107 -0
- package/react.js +2259 -0
- package/react.js.map +1 -0
- package/react.ts +2864 -0
- package/readers.js +956 -0
- package/readers.js.map +1 -0
- package/readers.ts +1017 -0
- package/reap.js +60 -0
- package/reap.js.map +1 -0
- package/reap.ts +65 -0
- package/recall.js +67 -0
- package/recall.js.map +1 -0
- package/recall.ts +114 -0
- package/reopen.js +45 -0
- package/reopen.js.map +1 -0
- package/reopen.ts +44 -0
- package/result-entry.js +32 -0
- package/result-entry.js.map +1 -0
- package/result-entry.ts +34 -0
- package/resume.js +266 -0
- package/resume.js.map +1 -0
- package/resume.ts +283 -0
- package/routes.js +129 -0
- package/routes.js.map +1 -0
- package/routes.ts +147 -0
- package/routine.js +179 -0
- package/routine.js.map +1 -0
- package/routine.ts +191 -0
- package/run.js +932 -0
- package/run.js.map +1 -0
- package/run.ts +999 -0
- package/service.js +806 -0
- package/service.js.map +1 -0
- package/service.ts +911 -0
- package/source.js +26 -0
- package/source.js.map +1 -0
- package/source.ts +40 -0
- package/start.js +197 -0
- package/start.js.map +1 -0
- package/start.ts +214 -0
- package/state.js +247 -0
- package/state.js.map +1 -0
- package/state.ts +404 -0
- package/status.js +1222 -0
- package/status.js.map +1 -0
- package/status.ts +1555 -0
- package/status_bench.ts +50 -0
- package/statusline.js +187 -0
- package/statusline.js.map +1 -0
- package/statusline.ts +232 -0
- package/tail.js +748 -0
- package/tail.js.map +1 -0
- package/tail.ts +815 -0
- package/talk.js +58 -0
- package/talk.js.map +1 -0
- package/talk.ts +51 -0
- package/task-context.js +41 -0
- package/task-context.js.map +1 -0
- package/task-context.ts +53 -0
- package/texted.js +65 -0
- package/texted.js.map +1 -0
- package/texted.ts +65 -0
- package/timing.js +37 -0
- package/timing.js.map +1 -0
- package/timing.ts +52 -0
- package/told.js +56 -0
- package/told.js.map +1 -0
- package/told.ts +54 -0
- package/tools.js +595 -0
- package/tools.js.map +1 -0
- package/tools.ts +633 -0
- package/transcript.js +34 -0
- package/transcript.js.map +1 -0
- package/transcript.ts +41 -0
- package/turn.js +47 -0
- package/turn.js.map +1 -0
- package/turn.ts +68 -0
- package/unknown.js +8 -0
- package/unknown.js.map +1 -0
- package/unknown.ts +9 -0
- package/views.js +15 -0
- package/views.js.map +1 -0
- package/views.ts +21 -0
- package/vocab.js +24 -0
- package/vocab.js.map +1 -0
- package/vocab.json +1573 -0
- package/vocab.ts +30 -0
- package/wait.js +30 -0
- package/wait.js.map +1 -0
- package/wait.ts +45 -0
- package/wake.js +552 -0
- package/wake.js.map +1 -0
- package/wake.ts +597 -0
- package/watch.js +520 -0
- package/watch.js.map +1 -0
- package/watch.ts +596 -0
- package/who.js +309 -0
- package/who.js.map +1 -0
- package/who.ts +347 -0
- package/window.js +179 -0
- package/window.js.map +1 -0
- package/window.ts +268 -0
- package/woken.js +129 -0
- package/woken.js.map +1 -0
- package/woken.ts +127 -0
package/transcript.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// A transcript's entries, read: what a page or a door showing a session reads,
|
|
2
|
+
// apart from the loop that runs one (./react.ts).
|
|
3
|
+
import { line, sub } from '@yaks/query'
|
|
4
|
+
import type { Bundle, Comp, Eid, Graph } from 'jsr:@yaks/graph@0.2.36'
|
|
5
|
+
import { ENTRY, FORK } from './native.js'
|
|
6
|
+
import { ordered, seqOf } from './state.js'
|
|
7
|
+
import { UnknownSession } from './unknown.js'
|
|
8
|
+
|
|
9
|
+
let comp = (b: Bundle, name: string) => b[name] as Comp | undefined
|
|
10
|
+
|
|
11
|
+
/** A transcript's entries: a fork's prefix from its parent up to the anchor,
|
|
12
|
+
* then its own, in order. With `since`, read entries created at or after that
|
|
13
|
+
* instant. */
|
|
14
|
+
export let transcript = async (
|
|
15
|
+
g: Graph,
|
|
16
|
+
session: Eid,
|
|
17
|
+
since?: string,
|
|
18
|
+
): Promise<Bundle[]> => {
|
|
19
|
+
let [self] = await g.read(
|
|
20
|
+
line`.entity.eid=${session}&.session&.fields=${[
|
|
21
|
+
'entity.eid',
|
|
22
|
+
...g.vocab.comp(FORK) ? [`${FORK}.from`] : [],
|
|
23
|
+
]}`,
|
|
24
|
+
)
|
|
25
|
+
if (!self) throw new UnknownSession(session)
|
|
26
|
+
let own = await g.read(
|
|
27
|
+
line`.${ENTRY}.session=${session}${
|
|
28
|
+
sub(since == null ? line`` : line`&.created.at>=${since}`)
|
|
29
|
+
}&*`,
|
|
30
|
+
)
|
|
31
|
+
let from = comp(self, FORK)?.from
|
|
32
|
+
if (!from) return ordered(own)
|
|
33
|
+
let [anchor] = await g.get([String(from)], [ENTRY])
|
|
34
|
+
let parent = anchor && comp(anchor, ENTRY)
|
|
35
|
+
if (!parent) return ordered(own)
|
|
36
|
+
let inherited = await transcript(g, String(parent.session), since)
|
|
37
|
+
return [
|
|
38
|
+
...inherited.filter((b) => seqOf(b) <= seqOf(anchor)),
|
|
39
|
+
...ordered(own),
|
|
40
|
+
]
|
|
41
|
+
}
|
package/turn.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a turn is the listener's: the conversation logic every channel
|
|
3
|
+
* shares, a group text, a chat room or a call alike (D-465). A channel says
|
|
4
|
+
* only whether words were said where others hear them (`group`) and whether
|
|
5
|
+
* they were said to the listener (`to`: naming it, replying to it, or to it
|
|
6
|
+
* alone). The listener reads everything it hears; in a group it answers only
|
|
7
|
+
* when the words are for it and their speaker is done, and otherwise answers
|
|
8
|
+
* {@link PASS}, which says nothing anywhere. A pause is not a turn.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/ /** What the listener answers to stay quiet: a turn answered with it alone is
|
|
12
|
+
* kept in its transcript and sent nowhere ({@link passes}). */ export let PASS = '(listening)';
|
|
13
|
+
/** Whether an answer is {@link PASS}, which no channel sends.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { equal } from '@yaks/testing'
|
|
17
|
+
* import { passes } from '@yaks/session/turn'
|
|
18
|
+
* equal(passes(' (listening)\n'), true)
|
|
19
|
+
* equal(passes('Sure, (listening) to you.'), false)
|
|
20
|
+
* ```
|
|
21
|
+
*/ export let passes = (text)=>text.trim() == PASS;
|
|
22
|
+
/** Whether `text` names the listener by one of `names`, as words of their
|
|
23
|
+
* own, in any case: how a channel without mentions (a group text) knows the
|
|
24
|
+
* words were said to it.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { equal } from '@yaks/testing'
|
|
28
|
+
* import { named } from '@yaks/session/turn'
|
|
29
|
+
* equal(named('Hey Mabel, what time is it?', ['Mabel', 'operator']), true)
|
|
30
|
+
* equal(named('ask the operator', ['Mabel', 'operator']), true)
|
|
31
|
+
* equal(named('Mabelle said so', ['Mabel']), false)
|
|
32
|
+
* ```
|
|
33
|
+
*/ export let named = (text, names)=>names.filter((n)=>n.trim()).some((n)=>new RegExp(`(^|[^\\p{L}\\p{N}])${escaped(n.trim())}($|[^\\p{L}\\p{N}])`, 'iu').test(text));
|
|
34
|
+
let escaped = (s)=>s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
35
|
+
/** What the listener is told before words, about whose turn it is: nothing
|
|
36
|
+
* where they were said to it alone; in a group, that everyone in it reads the
|
|
37
|
+
* answer, whether the words were said to it, and when to answer {@link PASS}.
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* import { equal } from '@yaks/testing'
|
|
41
|
+
* import { cue } from '@yaks/session/turn'
|
|
42
|
+
* equal(cue({ group: false, to: true }), '')
|
|
43
|
+
* equal(cue({ group: true, to: false }).includes('not said to you'), true)
|
|
44
|
+
* equal(cue({ group: true, to: true }).includes('not said to you'), false)
|
|
45
|
+
* ```
|
|
46
|
+
*/ export let cue = (said)=>said.group ? `In a group: everyone in it reads your answer.${said.to ? '' : ' These words were not said to you.'} Answer only when they are for you and their speaker is done; while people talk among themselves, or someone is thinking aloud and more is coming, answer ${PASS} alone, which sends nothing. ` : '';
|
|
47
|
+
//# sourceMappingURL=turn.js.map
|
package/turn.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn.js","sources":["./turn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;CAUC,GAED;6DAC6D,GAC7D,OAAO,IAAI,OAAO,cAAa;AAE/B;;;;;;;;CAQC,GACD,OAAO,IAAI,SAAS,CAAC,OAA0B,KAAK,IAAI,MAAM,KAAI;AAElE;;;;;;;;;;;CAWC,GACD,OAAO,IAAI,QAAQ,CAAC,MAAc,QAChC,MAAM,MAAM,CAAC,CAAC,IAAM,EAAE,IAAI,IAAI,IAAI,CAAC,CAAC,IAClC,IAAI,OACF,CAAC,mBAAmB,EAAE,QAAQ,EAAE,IAAI,IAAI,mBAAmB,CAAC,EAC5D,MAEC,IAAI,CAAC,OACT;AAEH,IAAI,UAAU,CAAC,IAAc,EAAE,OAAO,CAAC,uBAAuB;AAE9D;;;;;;;;;;;CAWC,GACD,OAAO,IAAI,MAAM,CAAC,OAChB,KAAK,KAAK,GACN,CAAC,6CAA6C,EAC9C,KAAK,EAAE,GAAG,KAAK,qCAChB,0JAA0J,EAAE,KAAK,6BAA6B,CAAC,GAC9L,GAAE"}
|
package/turn.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a turn is the listener's: the conversation logic every channel
|
|
3
|
+
* shares, a group text, a chat room or a call alike (D-465). A channel says
|
|
4
|
+
* only whether words were said where others hear them (`group`) and whether
|
|
5
|
+
* they were said to the listener (`to`: naming it, replying to it, or to it
|
|
6
|
+
* alone). The listener reads everything it hears; in a group it answers only
|
|
7
|
+
* when the words are for it and their speaker is done, and otherwise answers
|
|
8
|
+
* {@link PASS}, which says nothing anywhere. A pause is not a turn.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** What the listener answers to stay quiet: a turn answered with it alone is
|
|
14
|
+
* kept in its transcript and sent nowhere ({@link passes}). */
|
|
15
|
+
export let PASS = '(listening)'
|
|
16
|
+
|
|
17
|
+
/** Whether an answer is {@link PASS}, which no channel sends.
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { equal } from '@yaks/testing'
|
|
21
|
+
* import { passes } from '@yaks/session/turn'
|
|
22
|
+
* equal(passes(' (listening)\n'), true)
|
|
23
|
+
* equal(passes('Sure, (listening) to you.'), false)
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export let passes = (text: string): boolean => text.trim() == PASS
|
|
27
|
+
|
|
28
|
+
/** Whether `text` names the listener by one of `names`, as words of their
|
|
29
|
+
* own, in any case: how a channel without mentions (a group text) knows the
|
|
30
|
+
* words were said to it.
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { equal } from '@yaks/testing'
|
|
34
|
+
* import { named } from '@yaks/session/turn'
|
|
35
|
+
* equal(named('Hey Mabel, what time is it?', ['Mabel', 'operator']), true)
|
|
36
|
+
* equal(named('ask the operator', ['Mabel', 'operator']), true)
|
|
37
|
+
* equal(named('Mabelle said so', ['Mabel']), false)
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export let named = (text: string, names: string[]): boolean =>
|
|
41
|
+
names.filter((n) => n.trim()).some((n) =>
|
|
42
|
+
new RegExp(
|
|
43
|
+
`(^|[^\\p{L}\\p{N}])${escaped(n.trim())}($|[^\\p{L}\\p{N}])`,
|
|
44
|
+
'iu',
|
|
45
|
+
)
|
|
46
|
+
.test(text)
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
let escaped = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
50
|
+
|
|
51
|
+
/** What the listener is told before words, about whose turn it is: nothing
|
|
52
|
+
* where they were said to it alone; in a group, that everyone in it reads the
|
|
53
|
+
* answer, whether the words were said to it, and when to answer {@link PASS}.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { equal } from '@yaks/testing'
|
|
57
|
+
* import { cue } from '@yaks/session/turn'
|
|
58
|
+
* equal(cue({ group: false, to: true }), '')
|
|
59
|
+
* equal(cue({ group: true, to: false }).includes('not said to you'), true)
|
|
60
|
+
* equal(cue({ group: true, to: true }).includes('not said to you'), false)
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export let cue = (said: { group: boolean; to: boolean }): string =>
|
|
64
|
+
said.group
|
|
65
|
+
? `In a group: everyone in it reads your answer.${
|
|
66
|
+
said.to ? '' : ' These words were not said to you.'
|
|
67
|
+
} Answer only when they are for you and their speaker is done; while people talk among themselves, or someone is thinking aloud and more is coming, answer ${PASS} alone, which sends nothing. `
|
|
68
|
+
: ''
|
package/unknown.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A transcript API was given an eid that does not name a session. */ export class UnknownSession extends Error {
|
|
2
|
+
session;
|
|
3
|
+
constructor(session){
|
|
4
|
+
super(`unknown session ${session}`), this.session = session;
|
|
5
|
+
this.name = 'UnknownSession';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=unknown.js.map
|
package/unknown.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown.js","sources":["./unknown.ts"],"names":[],"mappings":"AAEA,oEAAoE,GACpE,OAAO,MAAM,uBAAuB;;EAClC,YAAY,AAAO,OAAY,CAAE;IAC/B,KAAK,CAAC,CAAC,gBAAgB,EAAE,SAAS,QADjB,UAAA;IAEjB,IAAI,CAAC,IAAI,GAAG;EACd;AACF"}
|
package/unknown.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Eid } from 'jsr:@yaks/graph@0.2.36'
|
|
2
|
+
|
|
3
|
+
/** A transcript API was given an eid that does not name a session. */
|
|
4
|
+
export class UnknownSession extends Error {
|
|
5
|
+
constructor(public session: Eid) {
|
|
6
|
+
super(`unknown session ${session}`)
|
|
7
|
+
this.name = 'UnknownSession'
|
|
8
|
+
}
|
|
9
|
+
}
|
package/views.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The `/views` facet: how a transcript is drawn wherever this package's views
|
|
2
|
+
// are asked for. `views`, the portable lines every interface prints, and
|
|
3
|
+
// `joined`, which entries make a line of a conversation (./lines.ts, ./joined.ts);
|
|
4
|
+
// `conversationKinds`, a conversation's lines drawn with the kit
|
|
5
|
+
// (./conversation.ts, also `@yaks/session/conversation`);
|
|
6
|
+
// `conversationViews`, a session drawn as its @yaks/ux Conversation
|
|
7
|
+
// (./talk.ts); and `inspectViews`, the inspector's pages and parts for an
|
|
8
|
+
// entry and a session (./inspect.ts). The three the kit draws load when asked
|
|
9
|
+
// for, so a host that prints text loads no kit.
|
|
10
|
+
export { sessionViews as views } from "./lines.js";
|
|
11
|
+
export { joined } from "./joined.js";
|
|
12
|
+
export let conversationKinds = ()=>import("./conversation.js").then((m)=>m.kinds);
|
|
13
|
+
export let conversationViews = ()=>import("./talk.js").then((m)=>m.conversationViews);
|
|
14
|
+
export let inspectViews = ()=>import("./inspect.js").then((m)=>m.inspectViews);
|
|
15
|
+
//# sourceMappingURL=views.js.map
|
package/views.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views.js","sources":["./views.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,yEAAyE;AACzE,mFAAmF;AACnF,iEAAiE;AACjE,0DAA0D;AAC1D,oEAAoE;AACpE,0EAA0E;AAC1E,8EAA8E;AAC9E,gDAAgD;AAKhD,SAAS,gBAAgB,KAAK,qBAAoB;AAClD,SAAsB,MAAM,sBAAqB;AACjD,OAAO,IAAI,oBAAoB,IAC7B,MAAM,CAAC,qBAAqB,IAAI,CAAC,CAAC,IAAM,EAAE,KAAK,EAAC;AAClD,OAAO,IAAI,oBAAoB,IAC7B,MAAM,CAAC,aAAa,IAAI,CAAC,CAAC,IAAM,EAAE,iBAAiB,EAAC;AACtD,OAAO,IAAI,eAAe,IACxB,MAAM,CAAC,gBAAgB,IAAI,CAAC,CAAC,IAAM,EAAE,YAAY,EAAC"}
|
package/views.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The `/views` facet: how a transcript is drawn wherever this package's views
|
|
2
|
+
// are asked for. `views`, the portable lines every interface prints, and
|
|
3
|
+
// `joined`, which entries make a line of a conversation (./lines.ts, ./joined.ts);
|
|
4
|
+
// `conversationKinds`, a conversation's lines drawn with the kit
|
|
5
|
+
// (./conversation.ts, also `@yaks/session/conversation`);
|
|
6
|
+
// `conversationViews`, a session drawn as its @yaks/ux Conversation
|
|
7
|
+
// (./talk.ts); and `inspectViews`, the inspector's pages and parts for an
|
|
8
|
+
// entry and a session (./inspect.ts). The three the kit draws load when asked
|
|
9
|
+
// for, so a host that prints text loads no kit.
|
|
10
|
+
import type { View } from 'jsr:@yaks/inspect@0.2.36'
|
|
11
|
+
import type { Kind } from './conversation.js'
|
|
12
|
+
import type { Registry } from 'jsr:@yaks/render@0.2.36'
|
|
13
|
+
|
|
14
|
+
export { sessionViews as views } from './lines.js'
|
|
15
|
+
export { type Joined, joined } from './joined.js'
|
|
16
|
+
export let conversationKinds = (): Promise<Registry<Kind>> =>
|
|
17
|
+
import('./conversation.js').then((m) => m.kinds)
|
|
18
|
+
export let conversationViews = (): Promise<View[]> =>
|
|
19
|
+
import('./talk.js').then((m) => m.conversationViews)
|
|
20
|
+
export let inspectViews = (): Promise<View[]> =>
|
|
21
|
+
import('./inspect.js').then((m) => m.inspectViews)
|
package/vocab.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The transcript's component declarations, and only those: the module exported
|
|
2
|
+
// as `@yaks/session/vocab`. It imports no storage, no SQL and no runtime, so a
|
|
3
|
+
// browser tab that loads this vocabulary loads nothing else.
|
|
4
|
+
//
|
|
5
|
+
// A transcript's status is read off its newest entry, as SQL here
|
|
6
|
+
// (./status.ts). A task's status is its ladder in @yaks/task's vocabulary, and
|
|
7
|
+
// a graph that leases its tasks has a state @yaks/task cannot know about: a
|
|
8
|
+
// held claim reads `wip`. That rung belongs to whoever owns `claim`, which is
|
|
9
|
+
// this package, so ./vocab.json adds it to the ladder with an `extends` entry
|
|
10
|
+
// on `task`, and every store reads it from there.
|
|
11
|
+
import { sessionDoc } from "./comp.js";
|
|
12
|
+
import { sessionDerived } from "./status.js";
|
|
13
|
+
import { blobRead } from "@yaks/blob/vocab";
|
|
14
|
+
import manifest from './package.json' with {
|
|
15
|
+
type: 'json'
|
|
16
|
+
};
|
|
17
|
+
export { sessionDoc };
|
|
18
|
+
/** What this package is: its manifest's description, the one place it is
|
|
19
|
+
* written, which a host stamps on each document here. */ export let description = manifest.description;
|
|
20
|
+
/** Every document this plugin declares. */ export let docs = [
|
|
21
|
+
sessionDoc
|
|
22
|
+
];
|
|
23
|
+
/** A transcript's status and cost. */ export let derived = (vocab)=>sessionDerived(vocab, blobRead(vocab));
|
|
24
|
+
//# sourceMappingURL=vocab.js.map
|
package/vocab.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocab.js","sources":["./vocab.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+EAA+E;AAC/E,6DAA6D;AAC7D,EAAE;AACF,kEAAkE;AAClE,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,kDAAkD;AAIlD,SAAS,UAAU,oBAAmB;AACtC,SAAS,cAAc,sBAAqB;AAC5C,SAAS,QAAQ,gCAAqC;AACtD,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;AAE1C,oCAAoC,GACpC,OAAO,IAAI,UAAU,CAAC,QACpB,eAAe,OAAO,SAAS,QAAO"}
|