@grosspoetrysystems/oompf 0.2.1 → 0.3.0

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  # oompf
2
2
 
3
- `oompf` publishes, inspects, searches, and installs OMP (Oh My Pi) agent
4
- profiles through the OOMPF index at [oompf.run](https://oompf.run).
3
+ `oompf` publishes, inspects, searches, installs, and upgrades OMP (Oh My Pi)
4
+ agent profiles through the OOMPF index at [oompf.run](https://oompf.run).
5
5
 
6
6
  A local profile becomes a public GitHub Gist, its metadata is registered in the
7
7
  index, and anyone can reinstall it as a native OMP profile:
8
8
 
9
9
  ```text
10
- oompf publish <profile> → public Gist → indexed → https://oompf.run/p/<id>
11
- oompf add <url> → installs a native OMP profile
12
- omp --profile <name> → run it
10
+ oompf publish <profile-name> → public Gist → indexed → https://oompf.run/p/<id>
11
+ oompf add <oompf-url> → installs a verified native OMP profile
12
+ omp --profile <name> → run it
13
13
  ```
14
14
 
15
15
  The canonical profile artifact always stays at its public Gist; OOMPF persists
@@ -97,8 +97,9 @@ Nothing is registered if local validation fails.
97
97
 
98
98
  ### `oompf add <ref> [--name <name>]`
99
99
 
100
- Install a shared profile as a native OMP profile. The reference may be an OOMPF
101
- URL or id, a public Gist URL, or a bare Gist id.
100
+ Install a shared profile as a native OMP profile. The reference must be an
101
+ OOMPF URL or profile id. Direct Gist URLs and ids are rejected because they
102
+ have no indexed revision or fingerprint to verify.
102
103
 
103
104
  ```bash
104
105
  oompf add https://oompf.run/p/prof_1b7c9e0a4d2f3a5b6c8d9e0f1a2b3c4d
@@ -114,13 +115,14 @@ Output: the installed `name`, the `path` written, the artifact `hash`, the
114
115
 
115
116
  Failure modes:
116
117
 
118
+ - `unverifiable_artifact` — the reference is not an indexed OOMPF profile, or
119
+ the indexed profile has no pinned revision.
117
120
  - `invalid_artifact` — the fetched artifact failed structural validation.
118
121
  - `invalid_name` — the derived (or `--name`) profile name violates OMP's naming
119
122
  rules; pass an explicit valid `--name`.
120
123
  - `target_exists` — a profile with that name already has a config; OOMPF refuses
121
124
  to overwrite it.
122
125
  - `network_error` — the index or Gist source could not be reached.
123
- - The Gist is missing or private, or the reference is not a supported Gist/URL.
124
126
 
125
127
  ### `oompf inspect <ref>`
126
128
 
@@ -131,9 +133,10 @@ oompf inspect https://oompf.run/p/prof_1b7c9e0a4d2f3a5b6c8d9e0f1a2b3c4d
131
133
  ```
132
134
 
133
135
  An OOMPF reference is answered from the index; a Gist reference is fetched and
134
- validated live. Output is metadata only models, providers, aliases, the
135
- structural verdict, provenance, and the install command. The canonical artifact
136
- content is never emitted.
136
+ validated live for inspection only. OOMPF output includes the verified install
137
+ command; direct Gist output does not offer an install command. The output is
138
+ metadata only models, providers, aliases, the structural verdict, and
139
+ provenance. The canonical artifact content is never emitted.
137
140
 
138
141
  Failure modes: `not_found` for an unknown indexed id; `network_error` when the
139
142
  index is unreachable; Gist fetch errors when the source is missing, private, or
@@ -153,6 +156,41 @@ verdict, source, and canonical URL).
153
156
 
154
157
  Failure mode: `network_error` when the index is unreachable.
155
158
 
159
+ ### `oompf upgrade <ref> [--yes]`
160
+
161
+ Review, and optionally apply, model upgrades for a profile you published. The
162
+ reference must be an OOMPF URL or profile id; the Gist must be owned by your
163
+ authenticated `gh` account.
164
+
165
+ ```bash
166
+ oompf upgrade https://oompf.run/p/prof_1b7c9e0a4d2f3a5b6c8d9e0f1a2b3c4d
167
+ ```
168
+
169
+ The plan is computed from the Gist's current head rather than the indexed
170
+ pinned revision, printed for review, and applied only after confirmation
171
+ (`--yes` skips the prompt). Applying patches the same Gist in place and
172
+ re-registers the unchanged source URL, so the `/p/<id>` reference stays stable
173
+ while its revision and fingerprint change. Successors come from a
174
+ code-reviewed catalog; an unclassified model is reported unchanged rather than
175
+ guessed at.
176
+
177
+ Output: the `catalogRevision`, the `currentRevision` and `updatedRevision`, the
178
+ `changes` applied per role, anything left `unchanged` with a reason, and the
179
+ `oompfUrl`.
180
+
181
+ Failure modes:
182
+
183
+ - `invalid_ref` — the reference is not an OOMPF URL or profile id.
184
+ - `unverifiable_artifact` — the indexed profile has no source Gist.
185
+ - `unowned_gist` — the Gist belongs to another account, or `gh` is not
186
+ authenticated.
187
+ - `head_changed` — the Gist moved during review; nothing is patched.
188
+ - `invalid_artifact` / `blocking_secrets` — the upgraded YAML failed validation
189
+ or tripped the secret scan; nothing is patched.
190
+ - `index_update_failed` — the Gist was patched but the index could not be
191
+ refreshed; re-register the unchanged source URL rather than re-running the
192
+ patch.
193
+
156
194
  ## JSON output and errors
157
195
 
158
196
  - `--json` on any command returns the same data the human output renders,
package/dist/index.d.mts CHANGED
@@ -1,4 +1,46 @@
1
1
  import { Cli } from "incur";
2
+ //#region ../../packages/core/dist/agent-runtime.d.ts
3
+ /**
4
+ * Agent-runtime detection and selection.
5
+ *
6
+ * OOMPF commands ask the local `omp` binary for profile paths. That binary is
7
+ * one of two agent runtimes — `omp` (OMP) or `pi` (Programmable Intelligence).
8
+ * This module resolves which binary a command should invoke: the installed
9
+ * runtime, the sole installed one, or an explicit `--agent` request.
10
+ *
11
+ * It selects the *binary* only. `pi`'s profile-path layout compatibility is
12
+ * tracked upstream (GPS-148) and is deliberately out of scope here — the
13
+ * chosen command simply flows through the existing `ompCommand` seam.
14
+ */
15
+ /** The agent runtimes OOMPF knows how to drive. */
16
+ type AgentRuntime = "omp" | "pi";
17
+ /** A resolved runtime: the binary to invoke plus which runtime it is. */
18
+ interface AgentRuntimeSelection {
19
+ readonly command: string;
20
+ readonly runtime: AgentRuntime;
21
+ }
22
+ /** Options controlling {@link resolveAgentRuntime}. */
23
+ interface AgentRuntimeOptions {
24
+ /**
25
+ * Probe seam; defaults to running `<command> --version` and treating any
26
+ * result as "present". Tests inject a fake so no real binary is touched.
27
+ */
28
+ readonly probe?: (command: string) => Promise<boolean>;
29
+ /** The runtime the caller explicitly requested via `--agent`. */
30
+ readonly requested?: AgentRuntime;
31
+ }
32
+ /**
33
+ * Resolve which agent-runtime binary a command should drive.
34
+ *
35
+ * Precedence:
36
+ * 1. `requested` set -> probe only that runtime. Present -> return it;
37
+ * absent -> throw {@link AgentRuntimeUnavailableError}.
38
+ * 2. `requested` unset -> probe both concurrently. Both present -> `omp`;
39
+ * exactly one -> that one; neither -> throw
40
+ * {@link AgentRuntimeUnavailableError}.
41
+ */
42
+ declare function resolveAgentRuntime(options?: AgentRuntimeOptions): Promise<AgentRuntimeSelection>;
43
+ //#endregion
2
44
  //#region ../../packages/core/dist/omp-profile.d.ts
3
45
  /**
4
46
  * Portable OMP profile discovery and path resolution.
@@ -109,6 +151,10 @@ type CommandRunner = (input: CommandInput) => Promise<CommandResult>;
109
151
  //#region ../../packages/github/dist/gists.d.ts
110
152
  /** Minimal structural view of a `fetch` response used by this module. */
111
153
  interface GistFetchResponse {
154
+ /** Raw response body stream, used to cap oversized payloads pre-read. */
155
+ readonly body?: ReadableStream<Uint8Array> | null;
156
+ /** Response headers; only `content-length` is consulted. */
157
+ readonly headers?: Headers | Readonly<Record<string, string>>;
112
158
  readonly ok: boolean;
113
159
  readonly status: number;
114
160
  text(): Promise<string>;
@@ -118,6 +164,12 @@ type GistFetch = (url: string, init?: {
118
164
  readonly headers?: Record<string, string>;
119
165
  }) => Promise<GistFetchResponse>;
120
166
  //#endregion
167
+ //#region src/profile-selector.d.ts
168
+ interface ProfileSelector {
169
+ isInteractive(): boolean;
170
+ selectProfile(names: readonly string[]): Promise<string | null>;
171
+ }
172
+ //#endregion
121
173
  //#region src/deps.d.ts
122
174
  /** Minimal structural view of an HTTP response the API client consumes. */
123
175
  interface HttpResponse {
@@ -156,6 +208,10 @@ interface CliDeps {
156
208
  readonly httpFetch?: HttpFetch;
157
209
  /** `omp` executable name; defaults to `"omp"`. */
158
210
  readonly ompCommand?: string;
211
+ /** Interactive native-profile selection seam (publish). */
212
+ readonly profileSelector?: ProfileSelector;
213
+ /** Agent-runtime resolver seam (probes omp/pi when no binary is pinned). */
214
+ readonly resolveAgentRuntime?: typeof resolveAgentRuntime;
159
215
  /** Install-target resolver seam (add). */
160
216
  readonly resolveInstallTarget?: typeof resolveInstallTarget;
161
217
  /** Existing-profile resolver seam (publish). */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../packages/core/dist/omp-profile.d.ts","../../../packages/github/dist/gh.d.ts","../../../packages/github/dist/gists.d.ts","../src/deps.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;UAeiB;;WAEJ;;WAEA;;WAEA;;;UAGI;;WAEJ;;WAEA;;WAEA,UAAU;;WAEV;;;UAGI;;WAEJ;;;;;;;;;iBASW,qBAAqB,cAAc,UAAU,oBAAoB;;;;;;;;iBAQjE,qBAAqB,iBAAiB,UAAU,oBAAoB,QAAQ;;;;;;;;;iBAS5E,iBAAiB,UAAU,oBAAoB,QAAQ;;;;;;;;;;;;;;;;;;UChD9D;;WAEJ;WACA;WACA;;;UAGI;;WAEJ;;WAEA;;WAEA;;;;;;;;;;KAUD,iBAAiB,OAAO,iBAAiB,QAAQ;;;;UCG5C;WACJ;WACA;EACT,QAAQ;;;KAGA,aAAa,aAAa;WACzB,UAAU;MACjB,QAAQ;;;;UC3BG;WACN;WACA;EACT,QAAQ;;;KAIE,aACV,aACA;WACW;WACA,UAAU;WACV;MAER,QAAQ;;UAGI;;EAEf,OAAO,eAAe;;EAEtB,MAAM,cAAc,eAAe;;EAEnC,SAAS,eAAe;;EAExB,UAAU,cAAc,cAAc,eAAe;;;UAoCtC;;WAEN,0BAA0B;;WAE1B,KAAK;;WAEL;;WAEA,YAAY;;WAEZ,YAAY;;WAEZ;;WAEA,8BAA8B;;WAE9B,8BAA8B;;WAE9B,SAAS;;;;;;;;;;;;cC1EP;;iBAGG,UAAU,OAAM,UAAY,IAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../packages/core/dist/agent-runtime.d.ts","../../../packages/core/dist/omp-profile.d.ts","../../../packages/github/dist/gh.d.ts","../../../packages/github/dist/gists.d.ts","../src/profile-selector.ts","../src/deps.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;KAaY;;UAEK;WACJ;WACA,SAAS;;;UAGL;;;;;WAKJ,SAAS,oBAAoB;;WAE7B,YAAY;;;;;;;;;;;;iBAkBD,oBAAoB,UAAU,sBAAsB,QAAQ;;;;;;;;;;;;;;;;;;UC9BnE;;WAEJ;;WAEA;;WAEA;;;UAGI;;WAEJ;;WAEA;;WAEA,UAAU;;WAEV;;;UAGI;;WAEJ;;;;;;;;;iBAeW,qBAAqB,cAAc,UAAU,oBAAoB;;;;;;;;iBAQjE,qBAAqB,iBAAiB,UAAU,oBAAoB,QAAQ;;;;;;;;;iBAS5E,iBAAiB,UAAU,oBAAoB,QAAQ;;;;;;;;;;;;;;;;;;UCtD9D;;WAEJ;WACA;WACA;;;UAGI;;WAEJ;;WAEA;;WAEA;;;;;;;;;;KAUD,iBAAiB,OAAO,iBAAiB,QAAQ;;;;UCG5C;;WAEJ,OAAO,eAAe;;WAEtB,UAAU,UAAU,SAAS;WAC7B;WACA;EACT,QAAQ;;;KAGA,aAAa,aAAa;WACzB,UAAU;MACjB,QAAQ;;;UCnDG;EACf;EACA,cAAc,2BAA2B;;;;;UCyB1B;WACN;WACA;EACT,QAAQ;;;KAIE,aACV,aACA;WACW;WACA,UAAU;WACV;MAER,QAAQ;;UAGI;;EAEf,OAAO,eAAe;;EAEtB,MAAM,cAAc,eAAe;;EAEnC,SAAS,eAAe;;EAExB,UAAU,cAAc,cAAc,eAAe;;;UAuCtC;;WAEN,0BAA0B;;WAE1B,KAAK;;WAEL;;WAEA,YAAY;;WAEZ,YAAY;;WAEZ;;WAEA,kBAAkB;;WAElB,6BAA6B;;WAE7B,8BAA8B;;WAE9B,8BAA8B;;WAE9B,SAAS;;;;;;;;;;;;cCtFP;;iBAGG,UAAU,OAAM,UAAY,IAAA"}