@qvac/core 0.1.6 → 0.1.8
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/README.md +10 -5
- package/dist-lib/lib/api/chat-groups.d.ts +1 -1
- package/dist-lib/lib/api/chat-groups.js +6 -3
- package/dist-lib/lib/core/chat-group.d.ts +5 -0
- package/dist-lib/lib/core/chat-group.js +63 -1
- package/dist-lib/lib/core/chat.d.ts +10 -0
- package/dist-lib/lib/core/chat.js +75 -9
- package/dist-lib/lib/core/mesh.js +2 -1
- package/dist-lib/lib/core/rank.d.ts +14 -0
- package/dist-lib/lib/core/rank.js +23 -0
- package/dist-lib/schema/content.js +5 -1
- package/dist-lib/schema/engine.js +30 -0
- package/dist-lib/schema/field-order.js +3 -1
- package/dist-lib/schema/qvac.js +5 -2
- package/dist-lib/spec/bind.js +9 -0
- package/dist-lib/spec/calls.js +31 -28
- package/dist-lib/spec/capabilities.d.ts +6 -0
- package/dist-lib/spec/hrpc/hrpc.json +39 -0
- package/dist-lib/spec/hrpc/index.js +39 -3
- package/dist-lib/spec/hrpc/messages.js +85 -46
- package/dist-lib/spec/hyperschema/index.js +85 -46
- package/dist-lib/spec/hyperschema/schema.json +56 -1
- package/dist-lib/spec/hyperschema/types.d.ts +14 -1
- package/dist-lib/spec/local/hyperdb/messages.js +48 -96
- package/dist-lib/spec/local/hyperschema/index.js +24 -48
- package/dist-lib/spec/local/hyperschema/schema.json +12 -0
- package/dist-lib/spec/mesh/hyperdb/messages.js +177 -296
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +126 -222
- package/dist-lib/spec/mesh/hyperschema/index.js +126 -222
- package/dist-lib/spec/mesh/hyperschema/schema.json +71 -1
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +4 -1
- package/package.json +12 -11
- package/tui/app.mjs +95 -23
- package/tui/lib/sidebar.mjs +3 -2
package/tui/app.mjs
CHANGED
|
@@ -1273,15 +1273,16 @@ export class ChatApp {
|
|
|
1273
1273
|
const HELP = [
|
|
1274
1274
|
'Chat',
|
|
1275
1275
|
' /menu — open the navigable menu (Agent, Chat, Models, Voice, …); also ctrl+p, arrows + enter to browse',
|
|
1276
|
-
' ctrl+b — the chats sidebar: ↑/↓ walks it, enter opens a chat, m moves one to a group, esc closes',
|
|
1276
|
+
' ctrl+b — the chats sidebar: ↑/↓ walks it, enter opens a chat, m moves one to a group, shift+↑/↓ reorders it, esc closes',
|
|
1277
1277
|
' esc — stop the run in flight, or clear the last command’s output',
|
|
1278
1278
|
' ctrl+o — expand the tool call/result previews (a click on a preview’s marker does the same)',
|
|
1279
1279
|
' /new-chat — create and switch to a new chat (shortcut for /chat new)',
|
|
1280
1280
|
' /chats — pick from your chats to switch (interactive) · /chat — show current',
|
|
1281
1281
|
' /chat new [title] · /chat use <title|id> · /chat rename <title> · /chat del <title|id> · /chat websearch on|off · /chat rag on|off',
|
|
1282
|
-
' /group — the sidebar as core orders it (groups, then ungrouped,
|
|
1282
|
+
' /group — the sidebar as core orders it (groups, then ungrouped; a chat sits where it was dragged until it gets a message, then on top)',
|
|
1283
1283
|
' /group new <name> · /group rename <group> <name> · /group del <group> — quote any name containing spaces',
|
|
1284
|
-
' /group move <group> [chat] — move a chat into a group; the chat defaults to the active one, and - as the group ungroups it',
|
|
1284
|
+
' /group move <group> [chat] [after <chat>|first] — move a chat into a group, optionally to a place in it; the chat defaults to the active one, and - as the group ungroups it',
|
|
1285
|
+
' /group order <group> after <group>|first — reorder the groups themselves',
|
|
1285
1286
|
' /knowledge [list] · /knowledge add <file> · /knowledge add-dir <directory> · /knowledge download <n|id> · /knowledge remove <n|id>',
|
|
1286
1287
|
' /files — show upload progress, local readiness, and failures for this chat',
|
|
1287
1288
|
' /attach <path> [<path> …] — attach local files to this chat (quote paths that contain spaces)',
|
|
@@ -1960,12 +1961,18 @@ export class ChatApp {
|
|
|
1960
1961
|
})
|
|
1961
1962
|
}
|
|
1962
1963
|
if (action === 'move') {
|
|
1963
|
-
// group first, chat optional,
|
|
1964
|
-
//
|
|
1965
|
-
const
|
|
1966
|
-
|
|
1964
|
+
// group first, chat optional, quoted names intact. A trailing `after <chat>|first` also
|
|
1965
|
+
// places the chat (moveChat); without it recency places it (setChatGroup)
|
|
1966
|
+
const tokens = splitPaths(argParts.join(' '))
|
|
1967
|
+
const afterAt = tokens.indexOf('after', 1)
|
|
1968
|
+
const [groupNeedle, chatNeedle, ...extra] =
|
|
1969
|
+
afterAt === -1 ? tokens : tokens.slice(0, afterAt)
|
|
1970
|
+
const anchorNeedle = afterAt === -1 ? null : tokens[afterAt + 1]
|
|
1971
|
+
const malformed =
|
|
1972
|
+
!groupNeedle || extra.length > 0 || (afterAt !== -1 && tokens.length !== afterAt + 2)
|
|
1973
|
+
if (malformed) {
|
|
1967
1974
|
return notice(
|
|
1968
|
-
'usage: /group move <group>|- [chat] (defaults to this chat; quote a name with spaces)'
|
|
1975
|
+
'usage: /group move <group>|- [chat] [after <chat>|first] (defaults to this chat; quote a name with spaces)'
|
|
1969
1976
|
)
|
|
1970
1977
|
}
|
|
1971
1978
|
// a miss comes back as text, not a throw, so it renders as a notice like every other miss
|
|
@@ -1976,19 +1983,48 @@ export class ChatApp {
|
|
|
1976
1983
|
if (!chat) return { miss: `no chat matching "${chatNeedle}"` }
|
|
1977
1984
|
return { id: chat.id, what: `"${chat.title}"` }
|
|
1978
1985
|
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
return
|
|
1985
|
-
}
|
|
1986
|
+
const anchor = async () => {
|
|
1987
|
+
if (anchorNeedle === null) return { placed: '' }
|
|
1988
|
+
if (anchorNeedle === 'first') return { afterId: undefined, placed: ', first' }
|
|
1989
|
+
const { chat, ambiguous } = await this._resolveChat(anchorNeedle)
|
|
1990
|
+
if (ambiguous) {
|
|
1991
|
+
return { miss: `"${anchorNeedle}" matches ${ambiguous} chats — be specific` }
|
|
1992
|
+
}
|
|
1993
|
+
if (!chat) return { miss: `no chat matching "${anchorNeedle}"` }
|
|
1994
|
+
return { afterId: chat.id, placed: `, after "${chat.title}"` }
|
|
1986
1995
|
}
|
|
1987
|
-
|
|
1996
|
+
const place = async (groupId, into) => {
|
|
1988
1997
|
const { id, what, miss } = await target()
|
|
1989
1998
|
if (miss) return miss
|
|
1990
|
-
|
|
1991
|
-
|
|
1999
|
+
const at = await anchor()
|
|
2000
|
+
if (at.miss) return at.miss
|
|
2001
|
+
if (anchorNeedle === null) {
|
|
2002
|
+
await engine.setChatGroup({ id, groupId })
|
|
2003
|
+
return groupId ? `moved ${what} to ${into}` : `${what} is ungrouped`
|
|
2004
|
+
}
|
|
2005
|
+
await engine.moveChat({ id, groupId, afterId: at.afterId })
|
|
2006
|
+
return `moved ${what} to ${into}${at.placed}`
|
|
2007
|
+
}
|
|
2008
|
+
if (groupNeedle === '-') return run(() => place(undefined, 'the ungrouped list'))
|
|
2009
|
+
return withGroup(groupNeedle, (group) => place(group.id, `"${group.name}"`))
|
|
2010
|
+
}
|
|
2011
|
+
if (action === 'order') {
|
|
2012
|
+
const [needle, keyword, anchorNeedle, ...extra] = splitPaths(argParts.join(' '))
|
|
2013
|
+
if (!needle || keyword !== 'after' || !anchorNeedle || extra.length > 0) {
|
|
2014
|
+
return notice(
|
|
2015
|
+
'usage: /group order <group> after <group>|first (quote a name with spaces)'
|
|
2016
|
+
)
|
|
2017
|
+
}
|
|
2018
|
+
return withGroup(needle, async (group) => {
|
|
2019
|
+
if (anchorNeedle === 'first') {
|
|
2020
|
+
await engine.moveChatGroup({ id: group.id })
|
|
2021
|
+
return `moved "${group.name}" first`
|
|
2022
|
+
}
|
|
2023
|
+
const { group: anchor, ambiguous } = await this._resolveGroup(anchorNeedle)
|
|
2024
|
+
if (ambiguous) return `"${anchorNeedle}" matches ${ambiguous} groups — be specific`
|
|
2025
|
+
if (!anchor) return `no group matching "${anchorNeedle}"`
|
|
2026
|
+
await engine.moveChatGroup({ id: group.id, afterId: anchor.id })
|
|
2027
|
+
return `moved "${group.name}" after "${anchor.name}"`
|
|
1992
2028
|
})
|
|
1993
2029
|
}
|
|
1994
2030
|
if (action === 'rename') {
|
|
@@ -2013,7 +2049,9 @@ export class ChatApp {
|
|
|
2013
2049
|
return `deleted "${group.name}" — its chats are now ungrouped`
|
|
2014
2050
|
})
|
|
2015
2051
|
}
|
|
2016
|
-
return notice(
|
|
2052
|
+
return notice(
|
|
2053
|
+
'usage: /group [new <name>|rename <group> <name>|del <group>|move <group>|- [chat] [after <chat>|first]|order <group> after <group>|first]'
|
|
2054
|
+
)
|
|
2017
2055
|
}
|
|
2018
2056
|
|
|
2019
2057
|
return notice(`unknown command: /${cmd}\n${HELP}`)
|
|
@@ -2052,8 +2090,7 @@ export class ChatApp {
|
|
|
2052
2090
|
return { group: matches[0] ?? null }
|
|
2053
2091
|
}
|
|
2054
2092
|
|
|
2055
|
-
// core hands chats back
|
|
2056
|
-
// same so the listing reads newest-first, and groups already arrive in presentation order
|
|
2093
|
+
// core hands chats back bottom-of-sidebar first; reversed so the listing reads top-down
|
|
2057
2094
|
_groupOverview() {
|
|
2058
2095
|
const { engine } = this
|
|
2059
2096
|
return [
|
|
@@ -2080,7 +2117,7 @@ export class ChatApp {
|
|
|
2080
2117
|
return {
|
|
2081
2118
|
type: 'notice',
|
|
2082
2119
|
text: lines.length
|
|
2083
|
-
? `chats by group —
|
|
2120
|
+
? `chats by group — in sidebar order\n${lines.join('\n')}`
|
|
2084
2121
|
: 'no chats yet'
|
|
2085
2122
|
}
|
|
2086
2123
|
} catch (error) {
|
|
@@ -2932,6 +2969,38 @@ export class ChatApp {
|
|
|
2932
2969
|
return [this, null]
|
|
2933
2970
|
}
|
|
2934
2971
|
|
|
2972
|
+
// shift+↑/↓ on a chat row: drop it one place up or down inside its container
|
|
2973
|
+
_nudgeChat(delta) {
|
|
2974
|
+
const rows = this._sidebarRows()
|
|
2975
|
+
const row = rows[this._sidebarCursor(rows)]
|
|
2976
|
+
if (row?.kind !== 'chat') return [this, null]
|
|
2977
|
+
const chat = this._chats.find((c) => c.id === row.chatId)
|
|
2978
|
+
if (!chat) return [this, null]
|
|
2979
|
+
const groupId = chat.groupId || undefined
|
|
2980
|
+
const siblings = [...this._chats]
|
|
2981
|
+
.reverse()
|
|
2982
|
+
.filter((c) => !c.deletedAt && (c.groupId || undefined) === groupId)
|
|
2983
|
+
.map((c) => c.id)
|
|
2984
|
+
const at = siblings.indexOf(chat.id)
|
|
2985
|
+
const to = at + delta
|
|
2986
|
+
if (to < 0 || to >= siblings.length) return [this, null]
|
|
2987
|
+
// up: under the chat two above (none = top); down: under the chat just below
|
|
2988
|
+
const afterId = delta < 0 ? siblings[to - 1] : siblings[to]
|
|
2989
|
+
const { engine } = this
|
|
2990
|
+
const token = ++this._statusToken
|
|
2991
|
+
return [
|
|
2992
|
+
this,
|
|
2993
|
+
async () => {
|
|
2994
|
+
try {
|
|
2995
|
+
await engine.moveChat({ id: chat.id, groupId, afterId })
|
|
2996
|
+
return { type: 'transient-status', token, text: `moved ${delta < 0 ? 'up' : 'down'}` }
|
|
2997
|
+
} catch (error) {
|
|
2998
|
+
return { type: 'run.error', error }
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
]
|
|
3002
|
+
}
|
|
3003
|
+
|
|
2935
3004
|
_sidebarActivate() {
|
|
2936
3005
|
const s = this._sidebar
|
|
2937
3006
|
const rows = this._sidebarRows()
|
|
@@ -2967,6 +3036,9 @@ export class ChatApp {
|
|
|
2967
3036
|
// just hands focus back.
|
|
2968
3037
|
_sidebarKey(msg) {
|
|
2969
3038
|
const s = this._sidebar
|
|
3039
|
+
// shift first: the plain arrow also matches a shifted one
|
|
3040
|
+
if (!s.moving && key.matches(msg, 'shift+up')) return this._nudgeChat(-1)
|
|
3041
|
+
if (!s.moving && key.matches(msg, 'shift+down')) return this._nudgeChat(1)
|
|
2970
3042
|
if (key.matches(msg, 'up')) return this._moveSidebar(-1)
|
|
2971
3043
|
if (key.matches(msg, 'down')) return this._moveSidebar(1)
|
|
2972
3044
|
if (key.matches(msg, 'enter')) return this._sidebarActivate()
|
|
@@ -3986,7 +4058,7 @@ export class ChatApp {
|
|
|
3986
4058
|
if (this._sidebar?.focus) {
|
|
3987
4059
|
return this._sidebar.moving
|
|
3988
4060
|
? '↑/↓: group · enter: move here · esc: cancel · ctrl+c: quit'
|
|
3989
|
-
: '↑/↓: chat · enter: open · m: move to group · esc: close · ctrl+c: quit'
|
|
4061
|
+
: '↑/↓: chat · shift+↑/↓: reorder · enter: open · m: move to group · esc: close · ctrl+c: quit'
|
|
3990
4062
|
}
|
|
3991
4063
|
if (this._models) return '↑/↓: move · enter: use · esc: back · ctrl+c: quit'
|
|
3992
4064
|
if (this._selector) {
|
package/tui/lib/sidebar.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// The chat sidebar's row model: chats under their groups, in the order core
|
|
2
|
-
// presents them (groups first, each chat
|
|
3
|
-
// the pane draws and what its cursor
|
|
2
|
+
// presents them (groups first, each chat where it was dragged or else
|
|
3
|
+
// newest-activity first). Rows are what the pane draws and what its cursor
|
|
4
|
+
// walks; only `chat` rows are selectable.
|
|
4
5
|
|
|
5
6
|
export const SIDEBAR_COLS = 26
|
|
6
7
|
|