@mrclrchtr/supi-consulting 0.0.0-stage → 8.0.1
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/CLAUDE.md +23 -0
- package/CONTEXT.md +53 -0
- package/README.md +104 -2
- package/docs/adr/0001-use-an-isolated-antigravity-home.md +5 -0
- package/node_modules/@mrclrchtr/supi-core/README.md +137 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +77 -0
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +42 -0
- package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +342 -0
- package/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +363 -0
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +17 -0
- package/node_modules/@mrclrchtr/supi-core/src/context/context-provider-registry.ts +36 -0
- package/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/context.ts +8 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +313 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug-timing.ts +120 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug.ts +14 -0
- package/node_modules/@mrclrchtr/supi-core/src/evidence-badge.ts +41 -0
- package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +64 -0
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +38 -0
- package/node_modules/@mrclrchtr/supi-core/src/llm.ts +356 -0
- package/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +44 -0
- package/node_modules/@mrclrchtr/supi-core/src/path.ts +2 -0
- package/node_modules/@mrclrchtr/supi-core/src/project-roots.ts +170 -0
- package/node_modules/@mrclrchtr/supi-core/src/project.ts +15 -0
- package/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
- package/node_modules/@mrclrchtr/supi-core/src/registry-utils.ts +93 -0
- package/node_modules/@mrclrchtr/supi-core/src/report.ts +121 -0
- package/node_modules/@mrclrchtr/supi-core/src/session-capabilities.ts +242 -0
- package/node_modules/@mrclrchtr/supi-core/src/session-capability-profiles.ts +240 -0
- package/node_modules/@mrclrchtr/supi-core/src/session-utils.ts +71 -0
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +47 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +105 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +454 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings.ts +36 -0
- package/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-core/src/terminal.ts +60 -0
- package/node_modules/@mrclrchtr/supi-core/src/tui.ts +141 -0
- package/package.json +78 -4
- package/scripts/live-probe.ts +139 -0
- package/src/agents/antigravity/activity.ts +22 -0
- package/src/agents/antigravity/adapter.ts +196 -0
- package/src/agents/antigravity/availability.ts +231 -0
- package/src/agents/antigravity/isolated-home.ts +346 -0
- package/src/agents/antigravity/models.ts +15 -0
- package/src/agents/antigravity/process/environment.ts +33 -0
- package/src/agents/antigravity/process/event-values.ts +273 -0
- package/src/agents/antigravity/process/events.ts +366 -0
- package/src/agents/antigravity/process/hooks.ts +219 -0
- package/src/agents/antigravity/process/ndjson.ts +120 -0
- package/src/agents/antigravity/process/protocol.ts +69 -0
- package/src/agents/antigravity/process/runner.ts +147 -0
- package/src/agents/antigravity/process/subprocess.ts +278 -0
- package/src/agents/antigravity/process/usage.ts +50 -0
- package/src/agents/antigravity/structured-output.ts +58 -0
- package/src/agents/antigravity/types.ts +17 -0
- package/src/agents/errors.ts +27 -0
- package/src/agents/types.ts +43 -0
- package/src/catalogue.ts +17 -0
- package/src/config.ts +26 -0
- package/src/conversation/handles.ts +187 -0
- package/src/evidence-hash.ts +6 -0
- package/src/extension.ts +26 -0
- package/src/footer-constants.ts +5 -0
- package/src/footer.ts +25 -0
- package/src/runtime.ts +244 -0
- package/src/settings.ts +38 -0
- package/src/tool/consulting_run/evidence.ts +169 -0
- package/src/tool/consulting_run/execute.ts +201 -0
- package/src/tool/consulting_run/guidance.ts +3 -0
- package/src/tool/consulting_run/input.ts +117 -0
- package/src/tool/consulting_run/register.ts +36 -0
- package/src/tool/consulting_run/render.ts +261 -0
- package/src/tool/consulting_run/result.ts +185 -0
- package/src/tool/consulting_run/spec.ts +20 -0
- package/src/types.ts +104 -0
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
`@mrclrchtr/supi-consulting` owns `consulting_run`, Consulting Agent availability, evidence classification, and Conversation Handle state. Antigravity is the only agent adapter. There is no `supi-agent-runtime` integration.
|
|
6
|
+
|
|
7
|
+
## Design rules
|
|
8
|
+
|
|
9
|
+
- Keep agent-specific models, authentication, process code, protocol parsing, and tool-activity classification in `src/agents/antigravity/`. Shared workflow uses the private interface in `src/agents/types.ts`.
|
|
10
|
+
- Keep each Model Catalogue immutable until the next session start or reload. Register `consulting_run` only after agent discovery succeeds.
|
|
11
|
+
- Require explicit agent, model, and Workspace Access for a new Consultation. Keep `new` and `continue` exact-one; follow-ups inherit all selections and their working directory.
|
|
12
|
+
- Acquire a handle before process work. Report process start, including hook probes, through the adapter interface. Reject overlap before startup; retire only after a started follow-up fails or is canceled.
|
|
13
|
+
- Keep raw conversation IDs opaque to shared policy. Persist only new consulting handle records and results; old Antigravity state has no migration or legacy read path.
|
|
14
|
+
- Use `<PI agent dir>/supi/consulting/antigravity/` for Antigravity state. Leave the old `supi/antigravity/` tree untouched.
|
|
15
|
+
- Use the Isolated Antigravity Home for every `agy` process. On macOS, create and unlock its private keychain, exposed as the login keychain, before startup. Do not copy the normal profile, credentials, or PI provider environment.
|
|
16
|
+
- Spawn `agy` directly with an argument array. Keep raw stdout, stderr, tool parameters, tool output, and transcripts out of PI state.
|
|
17
|
+
- Treat the Inspection Permission Set as an Antigravity policy, not an operating-system sandbox. Project hooks and accepted `read_url(*)` targets remain explicit limitations.
|
|
18
|
+
- Build model-visible results in `tool/consulting_run/result.ts`. Renderers use structured details; they never parse result content for presentation.
|
|
19
|
+
- Keep sources and workspace paths bounded. Distinguish observed references from claimed references.
|
|
20
|
+
|
|
21
|
+
## Verification
|
|
22
|
+
|
|
23
|
+
Use focused tests and source/test typechecking during changes. Run `pnpm verify:ai` before completion. The live probe requires separate approval and `SUPI_CONSULTING_LIVE=1`; it must not run in normal tests or CI.
|
package/CONTEXT.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# supi-consulting
|
|
2
|
+
|
|
3
|
+
Runs bounded Consultations while keeping agent selection, workspace exposure, and observed evidence explicit.
|
|
4
|
+
|
|
5
|
+
## Language
|
|
6
|
+
|
|
7
|
+
**Consultation**:
|
|
8
|
+
One bounded request to a Consulting Agent that returns an answer and execution evidence. It can start a conversation or continue one through a Conversation Handle.
|
|
9
|
+
_Avoid_: Antigravity Run, Agent Run, child session
|
|
10
|
+
|
|
11
|
+
**Consulting Agent**:
|
|
12
|
+
An agent selected to perform a Consultation. Antigravity is the only supported Consulting Agent.
|
|
13
|
+
_Avoid_: Agent Profile, PI model provider, model
|
|
14
|
+
|
|
15
|
+
**Workspace Access**:
|
|
16
|
+
The caller's decision to expose the current PI workspace to a Consultation. A Consultation without Workspace Access uses the selected agent's Consultation Workspace.
|
|
17
|
+
_Avoid_: consult mode, explore mode, repository mode
|
|
18
|
+
|
|
19
|
+
**Consultation Workspace**:
|
|
20
|
+
A package-managed empty project for Consultations without access to the current PI workspace. Its stable identity keeps agent-specific permissions and conversations separate from the current workspace.
|
|
21
|
+
_Avoid_: temporary workspace, sandbox, current workspace
|
|
22
|
+
|
|
23
|
+
**Web Capability**:
|
|
24
|
+
A Consulting Agent's permission-controlled ability to retrieve external sources during a Consultation. SuPi exposes and observes this capability but does not grant it.
|
|
25
|
+
_Avoid_: SuPi web search, automatic web access, web mode
|
|
26
|
+
|
|
27
|
+
**Isolated Antigravity Home**:
|
|
28
|
+
The package-owned Antigravity profile that separates configuration, authentication, customizations, and conversation state from the user's normal Antigravity profile. It stays stable across Consultations so Conversation Handles can continue.
|
|
29
|
+
_Avoid_: user home, temporary home, sandbox
|
|
30
|
+
|
|
31
|
+
**Inspection Permission Set**:
|
|
32
|
+
The Antigravity rules that allow external reads and deny known file, command, MCP, and browser-actuation paths. They limit Antigravity tools but are not an operating-system sandbox and do not control project-local hooks.
|
|
33
|
+
_Avoid_: read-only mode, safe mode, SuPi permissions
|
|
34
|
+
|
|
35
|
+
**Model Catalogue**:
|
|
36
|
+
The immutable model choices available through one Consulting Agent for the current session. A new Consultation selects one entry explicitly.
|
|
37
|
+
_Avoid_: PI model list, default model, all provider models
|
|
38
|
+
|
|
39
|
+
**Observed Evidence**:
|
|
40
|
+
Bounded execution facts derived from Consulting Agent tool activity and validated result references. Model claims alone are not Observed Evidence.
|
|
41
|
+
_Avoid_: claimed evidence, answer citations, raw event stream
|
|
42
|
+
|
|
43
|
+
**Web Evidence**:
|
|
44
|
+
Observed Evidence that contains successful web tool activity and at least one validated source URL.
|
|
45
|
+
_Avoid_: source list, cited answer, web claim
|
|
46
|
+
|
|
47
|
+
**Workspace Evidence**:
|
|
48
|
+
Observed Evidence that contains successful workspace inspection activity and validated workspace-relative paths.
|
|
49
|
+
_Avoid_: code claim, file list, exploration output
|
|
50
|
+
|
|
51
|
+
**Conversation Handle**:
|
|
52
|
+
An opaque SuPi identifier for an observed conversation with one Consulting Agent. It retains the original agent, model, working directory, and Workspace Access.
|
|
53
|
+
_Avoid_: raw conversation ID, Agent Run Handle, session ID
|
package/README.md
CHANGED
|
@@ -1,3 +1,105 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mrclrchtr/supi-consulting
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@mrclrchtr/supi-consulting` adds the beta `consulting_run` tool to Pi. It runs bounded Consultations with explicit agent, model, and workspace selection and reports observed evidence. **Antigravity is the only supported Consulting Agent.**
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pi install npm:@mrclrchtr/supi-consulting
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The package is not part of the recommended or full SuPi installer. Run `/reload` after installation.
|
|
12
|
+
|
|
13
|
+
## Switch from supi-antigravity
|
|
14
|
+
|
|
15
|
+
This is a clean break. Remove the old package before you install the new one:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pi remove npm:@mrclrchtr/supi-antigravity
|
|
19
|
+
pi install npm:@mrclrchtr/supi-consulting
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use the same personal or project scope as the original install. Update local extension paths to `packages/supi-consulting/src/extension.ts`, then reload Pi.
|
|
23
|
+
|
|
24
|
+
- `antigravity_run` has no alias. Use `consulting_run` and supply `new.agent`.
|
|
25
|
+
- The setting is now `consulting.agentToolEnabled`. The old `antigravity` section is ignored, including an old disabled value. The new setting defaults to `true`; set it to `false` before reload if you want to skip discovery.
|
|
26
|
+
- Old Conversation Handles and tool results are not restored as consulting state. Start a new Consultation.
|
|
27
|
+
- The isolated home has moved to a new namespace. Sign in again. The package does not read, move, copy, or delete the old `<PI agent dir>/supi/antigravity/` data.
|
|
28
|
+
|
|
29
|
+
## First sign-in
|
|
30
|
+
|
|
31
|
+
The Antigravity adapter never uses the normal Antigravity profile. It creates these stable, agent-specific directories:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
<PI agent dir>/supi/consulting/antigravity/home/
|
|
35
|
+
<PI agent dir>/supi/consulting/antigravity/consultation-workspace/
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
After Pi starts, the package checks availability without making startup wait. The footer shows a spinning icon during the check. The tool appears only after discovery succeeds. The ready footer uses the terminal-safe `✦` icon; the SuPi footer shows it on the stats line as `| ✦`.
|
|
39
|
+
|
|
40
|
+
When sign-in is needed, Pi shows a command with the resolved paths:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cd "<consultation-workspace>" &&
|
|
44
|
+
HOME="<isolated-home>" AGY_CLI_DISABLE_AUTO_UPDATE=true agy
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
On macOS, the adapter creates and unlocks a private keychain inside the Isolated Antigravity Home. It exposes that keychain as the login keychain without prompting for the normal keychain password. Run the displayed command, sign in, exit Antigravity, and reload Pi. The installed `agy` version must be at least `1.1.24`.
|
|
48
|
+
|
|
49
|
+
If macOS displays `antigravity.` in a warning, the final `.` is sentence punctuation, not part of a keychain name.
|
|
50
|
+
|
|
51
|
+
## `consulting_run`
|
|
52
|
+
|
|
53
|
+
A new Consultation requires the agent, an available model, and Workspace Access:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"prompt": "Explain this API design.",
|
|
58
|
+
"new": {
|
|
59
|
+
"agent": "antigravity",
|
|
60
|
+
"workspace": false,
|
|
61
|
+
"model": "gemini-3.8-flash-low"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The Model Catalogue is the intersection of the curated Antigravity models and the models available to the signed-in account. It stays fixed until the next session start or reload. There is no default model or automatic agent fallback.
|
|
67
|
+
|
|
68
|
+
Set `workspace` to `true` only when the Consultation needs repository evidence. This exposes the current PI workspace. Set it to `false` to use the empty Consultation Workspace.
|
|
69
|
+
|
|
70
|
+
A follow-up supplies only a returned Conversation Handle:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"prompt": "Now compare the alternatives.",
|
|
75
|
+
"continue": { "handle": "consult_..." }
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Supply exactly one of `new` and `continue`. Follow-ups retain the original agent, model, working directory, and Workspace Access. A handle is opaque and branch-aware. It is retired if a follow-up fails or is canceled after process work starts. Overlapping follow-ups on the same handle are rejected.
|
|
80
|
+
|
|
81
|
+
Results report web use, workspace use, observed and claimed references, warnings, token use, and the Conversation Handle. An answer can claim a reference without matching tool activity; SuPi labels that reference as claimed, not observed.
|
|
82
|
+
|
|
83
|
+
Use `/supi-settings` → **Consulting** to disable the tool. Disabling it skips availability checks and removes `consulting_run` from the active tool list.
|
|
84
|
+
|
|
85
|
+
## Security limits
|
|
86
|
+
|
|
87
|
+
The Antigravity adapter enforces its Inspection Permission Set in the Isolated Antigravity Home. It allows `read_url(*)` and denies known file writes, commands, unsandboxed actions, MCP, and URL execution. These rules are **not an operating-system sandbox**.
|
|
88
|
+
|
|
89
|
+
For workspace Consultations, project-local hooks can run commands, read the Antigravity transcript, and cause side effects outside these permission rules. The adapter probes hook state before the paid process and warns when hooks are active or unknown.
|
|
90
|
+
|
|
91
|
+
`read_url(*)` can reach local, private-network, and link-local endpoints that Antigravity accepts. It does not enforce public-internet-only access.
|
|
92
|
+
|
|
93
|
+
These limits describe the Antigravity integration. The private adapter interface does not promise that future agents have the same permissions or isolation. There is no `supi-agent-runtime` integration in this package.
|
|
94
|
+
|
|
95
|
+
## Development and live probe
|
|
96
|
+
|
|
97
|
+
The repository's [rename plan](https://github.com/mrclrchtr/supi/blob/main/packages/supi-consulting/CONSULTING-RENAME-PLAN.md) records the approved scope and verification criteria. Its [original plan](https://github.com/mrclrchtr/supi/blob/main/packages/supi-consulting/PLAN.md) is the historical Antigravity specification, not the current tool contract.
|
|
98
|
+
|
|
99
|
+
The live probe requires separate approval and sign-in. It never runs in normal tests or CI:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
SUPI_CONSULTING_LIVE=1 pnpm exec jiti packages/supi-consulting/scripts/live-probe.ts
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
It uses the isolated profile and checks web evidence, follow-up context, workspace evidence, and byte-identical fixture state.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Use an Isolated Antigravity Home
|
|
2
|
+
|
|
3
|
+
Consultations through Antigravity use a stable Isolated Antigravity Home under PI agent state instead of the user's normal Antigravity profile or a new home for each Consultation. This lets `supi-consulting` enforce the Antigravity Inspection Permission Set and exclude global customizations without changing user settings. Stable conversation state supports Conversation Handles; the trade-off is one separate sign-in and explicit manual cleanup.
|
|
4
|
+
|
|
5
|
+
On macOS, `agy` uses the system keychain for authentication. An isolated `HOME` has no default keychain until the package creates one. The package creates a package-owned `antigravity.keychain-db` with an empty password and exposes it as `Library/Keychains/login.keychain-db` through a symlink. It unlocks this private keychain before each `agy` process, without prompting for a password. It does not copy or use the normal profile's keychain.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://github.com/mrclrchtr/supi/tree/main/packages/supi-core">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/mrclrchtr/supi/main/packages/supi-core/assets/social-preview.png" alt="SuPi Core" width="100%">
|
|
4
|
+
</a>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
# @mrclrchtr/supi-core
|
|
8
|
+
|
|
9
|
+
[](https://github.com/mrclrchtr/supi/stargazers)
|
|
10
|
+
|
|
11
|
+
Shared infrastructure for SuPi extensions.
|
|
12
|
+
|
|
13
|
+
This is a **pure library** — it does not register any pi commands or tools. The `/supi-settings` command is now available through `@mrclrchtr/supi-settings`.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @mrclrchtr/supi-core
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Package surfaces
|
|
22
|
+
|
|
23
|
+
- `@mrclrchtr/supi-core/api` — reusable helpers for other packages and extensions
|
|
24
|
+
- `@mrclrchtr/supi-core/llm` — PI-owned direct model requests and JSON helpers
|
|
25
|
+
- `@mrclrchtr/supi-core/report` — shared text/report rendering helpers for TUI and plain-text summaries
|
|
26
|
+
- `@mrclrchtr/supi-core/tui` — shared terminal UI helpers for list titles, rows, menus, and descriptions
|
|
27
|
+
|
|
28
|
+
## What you get from the API
|
|
29
|
+
|
|
30
|
+
### Config helpers
|
|
31
|
+
|
|
32
|
+
- `loadSupiConfig()` — merged config with resolution order `defaults <- global <- project`
|
|
33
|
+
- `loadSupiConfigForScope()` — load one scope at a time for settings UIs
|
|
34
|
+
- `writeSupiConfig()` — persist values
|
|
35
|
+
- `replaceSupiConfigSection()` — replace one nested section while preserving other sections
|
|
36
|
+
- `removeSupiConfigKey()` — remove a key or override
|
|
37
|
+
|
|
38
|
+
Config file locations:
|
|
39
|
+
|
|
40
|
+
- global: `~/.pi/agent/supi/config.json`
|
|
41
|
+
- project: `.pi/supi/config.json`
|
|
42
|
+
|
|
43
|
+
### Settings helpers
|
|
44
|
+
|
|
45
|
+
- `registerSettings(pi, module)` — register one canonical asynchronous settings module
|
|
46
|
+
- `defineConfigSettings(options)` — adapt a fixed SuPi config section to that module interface
|
|
47
|
+
- settings registry helpers and types for the `@mrclrchtr/supi-settings` configuration surface
|
|
48
|
+
|
|
49
|
+
### Context helpers
|
|
50
|
+
|
|
51
|
+
- `wrapExtensionContext()` — wrap injected text in SuPi's `<extension-context>` tag
|
|
52
|
+
|
|
53
|
+
### Model requests
|
|
54
|
+
|
|
55
|
+
- `completeModelRequest(ctx, model, context, options)` — send API-specific options through PI's model registry.
|
|
56
|
+
- `completeSimpleModelRequest(ctx, model, context, options)` — send provider-neutral options through `streamSimple().result()` on PI 0.86.0 or later. PI supplies model-derived output limits and context guards.
|
|
57
|
+
- `callWithJsonResponse()` — retry a registry request, extract JSON, and validate it with TypeBox.
|
|
58
|
+
|
|
59
|
+
Both completion helpers require a stable `affinityScope`. PI owns auth and endpoint resolution. The helpers keep cache retention defaults, exclude prompt content from the affinity ID, and add OpenCode headers only when the provider or exact model endpoint matches OpenCode. Use the simple helper when PI should manage output limits; the API-specific helper forwards the caller's limit unchanged.
|
|
60
|
+
|
|
61
|
+
### Shared registries
|
|
62
|
+
|
|
63
|
+
- context-provider registry for `/supi-context`
|
|
64
|
+
- debug-event registry and monotonic phase timers for producers that want shared debug capture
|
|
65
|
+
- optional Debug Operation IDs for exact, directly owned public Tool-call correlation; ambient events stay uncorrelated
|
|
66
|
+
- settings registry used by `/supi-settings`
|
|
67
|
+
|
|
68
|
+
### Project and session helpers
|
|
69
|
+
|
|
70
|
+
- project-root detection and directory walking helpers such as `findProjectRoot()` and `walkProject()`
|
|
71
|
+
- active-branch session helper: `getActiveBranchEntries()`
|
|
72
|
+
- terminal helpers such as `formatTitle()`, `signalWaiting()`, and `signalDone()`
|
|
73
|
+
|
|
74
|
+
### TUI helpers
|
|
75
|
+
|
|
76
|
+
- `formatTuiTitleLine()` — use the shared title style in terminal lists
|
|
77
|
+
- `renderSelectableRow()` — render a selected row with an aligned value
|
|
78
|
+
- `renderDescriptionViewport()` — show a fixed-height description preview
|
|
79
|
+
- `renderTuiHintLine()` — render short key hints in one line
|
|
80
|
+
- `createSelectListMenu()` — build an action menu with shared key hints
|
|
81
|
+
|
|
82
|
+
### Report helpers
|
|
83
|
+
|
|
84
|
+
- `clampReportWidth()` — enforce a minimum readable report width
|
|
85
|
+
- `formatReportTitle()` / `formatSectionHeader()` — shared themed headers
|
|
86
|
+
- `formatDimLine()` / `formatKeyValueLine()` — common summary rows
|
|
87
|
+
- `formatOverflowHint()` — consistent preview-overflow hints
|
|
88
|
+
- `wrapReportText()` — ANSI-aware wrapped report blocks with optional indentation
|
|
89
|
+
|
|
90
|
+
## Example
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
94
|
+
import {
|
|
95
|
+
defineConfigSettings,
|
|
96
|
+
loadSupiConfig,
|
|
97
|
+
registerSettings,
|
|
98
|
+
wrapExtensionContext,
|
|
99
|
+
} from "@mrclrchtr/supi-core/api";
|
|
100
|
+
|
|
101
|
+
export default function myExtension(pi: ExtensionAPI) {
|
|
102
|
+
const defaults = { enabled: true };
|
|
103
|
+
const config = loadSupiConfig("my-extension", process.cwd(), defaults);
|
|
104
|
+
|
|
105
|
+
registerSettings(
|
|
106
|
+
pi,
|
|
107
|
+
defineConfigSettings({
|
|
108
|
+
id: "my-extension",
|
|
109
|
+
label: "My Extension",
|
|
110
|
+
section: "my-extension",
|
|
111
|
+
defaults,
|
|
112
|
+
fields: [
|
|
113
|
+
{
|
|
114
|
+
kind: "boolean" as const,
|
|
115
|
+
key: "enabled",
|
|
116
|
+
label: "Enabled",
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const message = wrapExtensionContext("my-extension", "hello", {
|
|
123
|
+
enabled: config.enabled,
|
|
124
|
+
});
|
|
125
|
+
void message;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Source
|
|
130
|
+
|
|
131
|
+
- `src/api.ts` — exported library surface
|
|
132
|
+
- `src/config.ts` — shared config loading and writing
|
|
133
|
+
- `src/debug-registry.ts` — Debug domain surface, event state, retention, redaction, listeners, and queries
|
|
134
|
+
- `src/debug-timing.ts` — monotonic total and phase timers for Debug Event Producers
|
|
135
|
+
- `src/settings/` — settings registry, schema, scope resolution, and persistence
|
|
136
|
+
- `src/report.ts` — shared text/report rendering helpers
|
|
137
|
+
- `src/tui.ts` — shared terminal UI list and action-menu helpers
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mrclrchtr/supi-core",
|
|
3
|
+
"version": "8.0.1",
|
|
4
|
+
"description": "Shared settings, configuration, reporting, and session infrastructure",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/mrclrchtr/supi.git",
|
|
9
|
+
"directory": "packages/supi-core"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/mrclrchtr/supi/tree/main/packages/supi-core#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/mrclrchtr/supi/issues"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"pi",
|
|
20
|
+
"pi-coding-agent",
|
|
21
|
+
"supi",
|
|
22
|
+
"extension-utils",
|
|
23
|
+
"settings",
|
|
24
|
+
"configuration"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"files": [
|
|
28
|
+
"src/**/*.ts",
|
|
29
|
+
"!__tests__"
|
|
30
|
+
],
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@earendil-works/pi-ai": "*",
|
|
33
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
34
|
+
"@earendil-works/pi-tui": "*",
|
|
35
|
+
"typebox": "*"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"@earendil-works/pi-ai": {
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
41
|
+
"@earendil-works/pi-coding-agent": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"@earendil-works/pi-tui": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"typebox": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "25.9.9",
|
|
53
|
+
"vitest": "5.0.4"
|
|
54
|
+
},
|
|
55
|
+
"main": "src/api.ts",
|
|
56
|
+
"exports": {
|
|
57
|
+
"./api": "./src/api.ts",
|
|
58
|
+
"./config": "./src/config.ts",
|
|
59
|
+
"./context": "./src/context.ts",
|
|
60
|
+
"./debug": "./src/debug.ts",
|
|
61
|
+
"./evidence-badge": "./src/evidence-badge.ts",
|
|
62
|
+
"./footer-registry": "./src/footer-registry.ts",
|
|
63
|
+
"./llm": "./src/llm.ts",
|
|
64
|
+
"./model-selection": "./src/model-selection.ts",
|
|
65
|
+
"./package.json": "./package.json",
|
|
66
|
+
"./path": "./src/path.ts",
|
|
67
|
+
"./project": "./src/project.ts",
|
|
68
|
+
"./prompt-surface": "./src/prompt-surface.ts",
|
|
69
|
+
"./report": "./src/report.ts",
|
|
70
|
+
"./session": "./src/session.ts",
|
|
71
|
+
"./settings": "./src/settings.ts",
|
|
72
|
+
"./spinner-frames": "./src/spinner-frames.ts",
|
|
73
|
+
"./status-spinner": "./src/status-spinner.ts",
|
|
74
|
+
"./terminal": "./src/terminal.ts",
|
|
75
|
+
"./tui": "./src/tui.ts"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// supi-core — shared infrastructure for SuPi extensions.
|
|
2
|
+
// Provides XML context tag wrapping, unified config, prompt-surface resolution,
|
|
3
|
+
// and shared settings, reporting, and session utilities.
|
|
4
|
+
//
|
|
5
|
+
// Convenience barrel — re-exports all domain entry points.
|
|
6
|
+
// For lighter imports, use one of the domain subpaths directly
|
|
7
|
+
// (e.g. @mrclrchtr/supi-core/config, @mrclrchtr/supi-core/context).
|
|
8
|
+
|
|
9
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
10
|
+
export * from "./config.ts";
|
|
11
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
12
|
+
export * from "./context.ts";
|
|
13
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
14
|
+
export * from "./debug.ts";
|
|
15
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
16
|
+
export * from "./evidence-badge.ts";
|
|
17
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
18
|
+
export * from "./footer-registry.ts";
|
|
19
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
20
|
+
export * from "./llm.ts";
|
|
21
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
22
|
+
export * from "./model-selection.ts";
|
|
23
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
24
|
+
export * from "./path.ts";
|
|
25
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
26
|
+
export * from "./project.ts";
|
|
27
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
28
|
+
export * from "./prompt-surface.ts";
|
|
29
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
30
|
+
export * from "./report.ts";
|
|
31
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
32
|
+
export * from "./session.ts";
|
|
33
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
34
|
+
export * from "./settings.ts";
|
|
35
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
36
|
+
export * from "./spinner-frames.ts";
|
|
37
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
38
|
+
export * from "./status-spinner.ts";
|
|
39
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
40
|
+
export * from "./terminal.ts";
|
|
41
|
+
// biome-ignore lint/performance/noReExportAll: intentional convenience barrel
|
|
42
|
+
export * from "./tui.ts";
|