Files
plugins/packages/powercontext/page/settings.html
T
Tsukikage 1e4c8a2b91 powercontext 0.2.0: PowerContext recall and opt-in capture as a gateway hook (#117)
PowerContext as a gateway hook package (@magpie-community/gateway-powercontext 0.2.0): recall from a user-deployed PowerContext service before a request, and opt-in capture of completed conversations, with a connection page that uses only the options/theme bridge. By @Tsukikage7.

Reviewed at c61036e9 (author) plus bff430f9 (maintainer merge of main: README, registry.json and scripts/check.mjs conflicts, both sides kept; check.mjs takes main's identical hooks skip).
All four points of the 10-25 review are fixed: the timing tests give the healthy side 1000 ms and move the backoff with a stubbed Date.now(); the empty page panels are gone; Scope ID is optional on the page as in the hook; both READMEs describe the npm install and the registry lists it.

Run on mote (macOS, Bun 1.4.2, temp HOME) at bff430f9:
- bun scripts/check.mjs: exit 0. Full bun test: 3423 pass, 8 skip, 0 fail.
- packages/powercontext: 107 pass, 5 runs in a row, then 8 runs in parallel, 0 fail each.
- Broken by hand: putting the Scope-required check back in page/settings.js turns the optional-Scope page test red; making the recall backoff expire at once (powercontext.hooks.mjs:336) turns 4 tests red (hung scope/prepare/body and connection-failure backoff).
- Earlier round (10-25): the real package in magpie's Bun host behind the gateway handler, against fake PowerContext and upstream.
Not tried: the page in a browser at this head (the author reports 40 Chromium/WebKit cases), a real PowerContext server.
2026-10-29 21:13:37 +08:00

40 lines
7.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>PowerContext</title><link rel="stylesheet" href="style.css">
<script src="_magpie/bridge.js" defer></script><script src="i18n.js" defer></script><script src="settings.js" defer></script></head>
<body><main>
<header class="page-head"><img class="pc-brand-light" src="powercontext-favicon-color.svg" width="24" height="24" alt=""><img class="pc-brand-dark" src="powercontext-favicon-reverse.svg" width="24" height="24" alt=""><div><h1>PowerContext</h1><p data-t="intro">Connect an independently deployed memory service.</p></div><div class="header-actions"><button id="deployment" class="secondary" type="button" data-t="deployButton">Deployment</button><button id="configure" type="button" disabled data-t="configure">Configure connection</button></div></header>
<section class="panel"><div class="section-heading"><h2 data-t="connection">Existing service</h2><span id="configured" role="status"></span></div>
<div class="connection-summary"><dl><div><dt data-t="url">Service URL</dt><dd id="summary-url">—</dd></div><div><dt data-t="scope">Scope ID</dt><dd id="summary-scope">—</dd></div><div><dt id="summary-capture-label" data-t="capture">Save complete conversations</dt><dd class="capture-status"><input id="summary-capture" class="slide-switch" type="checkbox" role="switch" disabled aria-labelledby="summary-capture-label" aria-describedby="capture-feedback"><span id="capture-state"></span></dd></div></dl><p id="capture-feedback" role="status" aria-live="polite" hidden></p></div></section>
<dialog id="settings" aria-labelledby="dialog-title" aria-describedby="dialog-description">
<div class="dialog-head settings-head">
<img class="pc-brand-light" src="powercontext-favicon-color.svg" width="24" height="24" alt=""><img class="pc-brand-dark" src="powercontext-favicon-reverse.svg" width="24" height="24" alt="">
<div><h2 id="dialog-title" data-t="dialogTitle">Connection settings</h2><p id="dialog-description" data-t="settingsIntro">Connect Magpie to your PowerContext service.</p></div>
<button id="close" class="icon-button" type="button" aria-label="Close">×</button>
</div>
<form id="form" novalidate><div class="dialog-body">
<fieldset class="settings-section"><legend><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="4" width="18" height="6" rx="2"/><rect x="3" y="14" width="18" height="6" rx="2"/><path d="M7 7h.01M7 17h.01M16 7h2M16 17h2"/></svg><span data-t="serviceSection">Service connection</span></legend>
<div class="fields">
<label for="url"><span data-t="url">Service URL</span><input id="url" type="url" required placeholder="http://127.0.0.1:8000" autocomplete="off" spellcheck="false" aria-describedby="url-help"><small id="url-help" data-t="urlHelp">Local HTTP or remote HTTPS. No credentials in the URL.</small></label>
<label for="scope"><span data-t="scope">Scope ID</span><input id="scope" placeholder="scp_…" autocomplete="off" spellcheck="false" aria-describedby="scope-help"><small id="scope-help" data-t="scopeHelp">Optional. Leave empty to use the session/workspace binding or the service’s default Scope.</small></label>
</div></fieldset>
<fieldset class="settings-section"><legend><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="8" cy="9" r="5"/><path d="m12 12 8 8h2v-4h-3v-3h-3"/></svg><span data-t="authSection">Authentication</span></legend>
<label for="auth"><span data-t="auth">Service key</span></label><div class="secret-input"><input id="auth" type="password" autocomplete="off" spellcheck="false" autocapitalize="off" aria-describedby="auth-help"><button id="show-auth" type="button" class="secret-toggle" aria-controls="auth" aria-pressed="false" aria-label="Show key" title="Show key"><svg class="eye-show" viewBox="0 0 24 24" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/></svg><svg class="eye-hide" viewBox="0 0 24 24" aria-hidden="true"><path d="m3 3 18 18M10.6 5.1A12 12 0 0 1 12 5c6.5 0 10 7 10 7a17 17 0 0 1-3.1 4.1M6.5 6.5A20 20 0 0 0 2 12s3.5 7 10 7a12 12 0 0 0 5.5-1.5M9.9 9.9a3 3 0 0 0 4.2 4.2"/></svg></button></div><small id="auth-help" data-t="authHelp">Enter the service token; Bearer is added automatically. Optional if authentication is disabled. Saved in Magpie's local plugin configuration.</small><small data-t="authFallback">An existing authorization environment variable remains a fallback when this field is empty.</small>
</fieldset>
<p id="result" role="status" aria-live="polite" hidden></p>
</div><footer><span data-t="saveHelp">Advanced options are preserved.</span><div class="actions"><button id="cancel" class="secondary" type="button" data-t="cancel">Cancel</button><button id="save" type="button" disabled data-t="save">Save configuration</button></div></footer>
</form></dialog>
<section class="data-notice" aria-labelledby="data-title"><h2 id="data-title" data-t="dataTitle">What is sent</h2><p data-t="recallDisclosure">Recall sends the latest user turn to the configured service URL above, even when capture is off.</p><p data-t="captureDisclosure">Capture is off by default. When enabled, complete user and assistant turns, client tool calls and results, including files and command output read by the Agent, are sent to that same service. Remote recall and capture require separate opt-ins.</p></section>
<dialog id="deployment-dialog" aria-labelledby="deployment-title">
<div class="dialog-head"><img class="pc-brand-light" src="powercontext-favicon-color.svg" width="20" height="20" alt=""><img class="pc-brand-dark" src="powercontext-favicon-reverse.svg" width="20" height="20" alt=""><h2 id="deployment-title" data-t="deployButton">Deployment</h2><button id="deployment-close" class="icon-button" type="button" aria-label="Close">×</button></div>
<div class="dialog-body deployment-body"><p class="deploy-intro" data-t="deployIntro">Run PowerContext independently, then connect Magpie.</p>
<ol class="deploy-steps"><li><span class="step-number">1</span><div><h3 data-t="deployOne">Deploy the service</h3><p data-t="deployOneHelp">Follow the official quickstart for the current installation and startup commands. This plugin connects to your service; it does not install or start it.</p></div></li>
<li><span class="step-number">2</span><div><h3 data-t="deployTwo">Prepare models and a Scope</h3><p data-t="deployTwoHelp">Configure Generation, Embedding and the Memory schedule on the Server. Use an explicit Scope, a session/workspace binding or the service’s default Scope.</p></div></li>
<li><span class="step-number">3</span><div><h3 data-t="deployThree">Connect in Magpie</h3><p data-t="deployThreeHelp">Enter the service URL, optional Scope ID and service key in Connection settings. Leave the key empty if authentication is disabled. Enable conversation capture when ready.</p></div></li></ol>
<section class="docs-card" aria-labelledby="docs-title"><div class="docs-heading"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9zM14 3v6h6M8 13h8M8 17h5"/></svg><div><h3 id="docs-title" data-t="docs">Official deployment guide</h3><p data-t="docsHelp">Installation, model setup and service configuration.</p></div><button id="copy-docs" class="secondary" type="button"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="8" y="8" width="12" height="13" rx="2"/><path d="M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3"/></svg><span data-t="copyLink">Copy link</span></button></div><p id="docs" class="docs-address">https://powercontext.oceanbase.io/en/docs/get-started/quickstart/</p><p id="docs-feedback" role="status" aria-live="polite" hidden></p></section>
<p class="deployment-boundary" data-t="boundary"></p></div>
<footer><button id="deployment-done" class="secondary" type="button" data-t="done">Done</button></footer></dialog>
</main></body></html>