The first page of P2 to leave app.js's core. sessions.js and sessions.css
move to assets/plugins/sessions/ (client.js, sessions.css). The page
registers through the kernel as magpie.plugin("sessions"): mount takes its
<main>, which the kernel now makes, open and relang read it again, and
reveal is the Usage page's way in. window.loadSessionsPage and
window.openSessionOnPage are gone. app.js reaches the page only through
magpie.call, and show() takes a page's title from its part. The plugin's
manifest lists i18n.js, sessions.css and client.js.
Words: the kernel's magpie.strings(dict) adds a plugin's words to I18N.
A key that is already there is logged and not taken, since the later one
would silently win. The 65 keys only the Sessions page says (own-keys over
every asset, Go and index.html) move, as written, from i18n.js to
plugins/sessions/i18n.js. tests/strings.cjs reads i18n.js and every
plugin's i18n.js as the page has them. gui-de/ja/zh-tw use it, and
i18n-keys now checks that no key is said twice across files and that a
plugin's words are in every language. TestBuiltinClientsLoaded takes a
.css entry as a <link> in <head>, and a script between kernel.js and
app.js.
Docs: plugin-runtime.md (Words, Pages moved out: Sessions), gui-shell.md,
gateway-sessions.md.
Run:
- go test ./internal/gui/ ./internal/pluginrt/ ./internal/gateway/: ok.
- gofmt clean. go vet darwin, GOOS=linux -tags nogui and GOOS=windows on
gui, pluginrt and plugins: clean.
- GUI, in both chromium and webkit, 40 files, all green:
- the sessions-* and sess-* tests, session-identity, routing-sessions,
account-mask-sessions, usage-session*, gateway-conversations;
- plugin-kernel, the plugin-move* tests, font-cascade, win-fonts;
- i18n-keys, gui-de, gui-ja, gui-zh-tw.
- session-terminal's red under parallel load is the same on origin/main
591ed58b5. It is fixed at its cause in the commit before this one.
31 lines
978 B
Go
31 lines
978 B
Go
// Package sessions is the Sessions page: the agents' past conversations,
|
|
// to read, search, resume and export. Off, the page leaves the window;
|
|
// the gateway still records conversations while Settings asks it to, and
|
|
// that keeps the plugin on.
|
|
package sessions
|
|
|
|
import (
|
|
"github.com/yetone/magpie/internal/pluginrt"
|
|
"github.com/yetone/magpie/internal/settings"
|
|
)
|
|
|
|
func init() {
|
|
pluginrt.Register(pluginrt.Manifest{
|
|
ID: "sessions", API: "^1", Requires: []string{"window"},
|
|
Name: "Sessions", Sub: "Your agents' past conversations: read, search, resume and export them",
|
|
One: "Recording gateway conversations", Many: "Recording gateway conversations",
|
|
InUse: func() (int, error) {
|
|
s, err := settings.LoadChecked()
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
if s.GatewayConversations {
|
|
return 1, nil
|
|
}
|
|
return 0, nil
|
|
},
|
|
Parts: []pluginrt.Part{{Slot: "nav.page", Key: "sessions"}},
|
|
Client: []string{"i18n.js", "sessions.css", "client.js"},
|
|
})
|
|
}
|