omni-pi 0.8.0 → 0.8.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/PROVIDERS.md CHANGED
@@ -30,6 +30,8 @@ If a bundled provider already has valid auth in the Pi runtime, Omni-Pi may use
30
30
 
31
31
  Use `/manage-providers` to list bundled providers that currently have stored auth and remove that auth when needed.
32
32
 
33
+ Anthropic is API-key-only in Omni-Pi. Anthropic OAuth login is intentionally disabled.
34
+
33
35
  The bundled-provider list below is expected to stay in sync with the exported provider setup list in `src/model-setup.ts`. The test suite checks that this section matches the code list.
34
36
 
35
37
  ### Bundled provider list
package/README.md CHANGED
@@ -10,7 +10,7 @@ Requires Node.js 22 or newer.
10
10
 
11
11
  ## What It Does
12
12
 
13
- - Starts in normal Pi behavior by default while keeping Omni-Pi branding and UI.
13
+ - Starts in normal Pi behavior with an opinionated setup.
14
14
  - `/omni-mode` turns on Omni's specialized interview, plan, build, and verify workflow for the current project.
15
15
  - Keeps durable standards and project context in `.omni/`, even when Omni mode is off.
16
16
  - Writes specs, tasks, and progress into `.omni/` once Omni mode is enabled.
@@ -96,6 +96,8 @@ Use it when you want to configure:
96
96
 
97
97
  Use `/manage-providers` to remove stored auth for bundled Pi providers.
98
98
 
99
+ Anthropic is intentionally API-key-only in Omni-Pi. Anthropic OAuth login is disabled.
100
+
99
101
  See [PROVIDERS.md](PROVIDERS.md) for the current supported-provider list and auth-management split.
100
102
 
101
103
  ## Omni Mode
@@ -1,5 +1,6 @@
1
1
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
2
2
 
3
+ import { disableAnthropicOAuth } from "../../src/anthropic-auth-guard.js";
3
4
  import { refreshAuthenticatedProviderModels } from "../../src/model-setup.js";
4
5
  import { registerOmniProviders } from "../../src/providers.js";
5
6
 
@@ -9,6 +10,7 @@ export default async function omniProvidersExtension(
9
10
  await registerOmniProviders(api);
10
11
 
11
12
  api.on("session_start", async (_event, ctx) => {
13
+ disableAnthropicOAuth(ctx.modelRegistry);
12
14
  await refreshAuthenticatedProviderModels(ctx.modelRegistry);
13
15
  });
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-pi",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Single-agent Pi package that interviews the user, documents the spec, and implements work in bounded slices.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,95 @@
1
+ interface AnthropicCredential {
2
+ type: "api_key";
3
+ key: string;
4
+ }
5
+
6
+ interface AuthStorageLike {
7
+ get?(provider: string): AnthropicCredential | { type: "oauth" } | undefined;
8
+ getApiKey?(
9
+ provider: string,
10
+ options?: { includeFallback?: boolean },
11
+ ): Promise<string | undefined>;
12
+ hasAuth?(provider: string): boolean;
13
+ getOAuthProviders?(): Array<{ id: string; name?: string }>;
14
+ login?(providerId: string, callbacks: unknown): Promise<void>;
15
+ }
16
+
17
+ interface ModelRegistryLike {
18
+ authStorage: AuthStorageLike;
19
+ refresh(): void;
20
+ __omniAnthropicAuthGuardInstalled?: boolean;
21
+ }
22
+
23
+ function getAnthropicApiKeyFromStorage(
24
+ authStorage: AuthStorageLike,
25
+ ): string | undefined {
26
+ const envApiKey = process.env.ANTHROPIC_API_KEY?.trim();
27
+ if (envApiKey) {
28
+ return envApiKey;
29
+ }
30
+
31
+ const stored = authStorage.get?.("anthropic");
32
+ if (stored?.type === "api_key" && stored.key.trim()) {
33
+ return stored.key.trim();
34
+ }
35
+
36
+ return undefined;
37
+ }
38
+
39
+ export function disableAnthropicOAuthInAuthStorage(
40
+ authStorage: AuthStorageLike,
41
+ ): void {
42
+ const originalGetApiKey = authStorage.getApiKey?.bind(authStorage);
43
+ const originalGetOAuthProviders =
44
+ authStorage.getOAuthProviders?.bind(authStorage);
45
+ authStorage.getApiKey = async (
46
+ provider: string,
47
+ options?: { includeFallback?: boolean },
48
+ ) => {
49
+ if (provider !== "anthropic") {
50
+ return originalGetApiKey?.(provider, options);
51
+ }
52
+
53
+ return getAnthropicApiKeyFromStorage(authStorage);
54
+ };
55
+
56
+ const originalHasAuth = authStorage.hasAuth?.bind(authStorage);
57
+ authStorage.hasAuth = (provider: string) => {
58
+ if (provider !== "anthropic") {
59
+ return originalHasAuth?.(provider) ?? false;
60
+ }
61
+
62
+ return getAnthropicApiKeyFromStorage(authStorage) !== undefined;
63
+ };
64
+
65
+ authStorage.getOAuthProviders = () =>
66
+ (originalGetOAuthProviders?.() ?? []).filter(
67
+ (provider) => provider.id !== "anthropic",
68
+ );
69
+
70
+ const originalLogin = authStorage.login?.bind(authStorage);
71
+ authStorage.login = async (providerId: string, callbacks: unknown) => {
72
+ if (providerId === "anthropic") {
73
+ throw new Error(
74
+ "Anthropic OAuth login is disabled in Omni-Pi. Use an Anthropic API key instead.",
75
+ );
76
+ }
77
+
78
+ await originalLogin?.(providerId, callbacks);
79
+ };
80
+ }
81
+
82
+ export function disableAnthropicOAuth(modelRegistry: ModelRegistryLike): void {
83
+ disableAnthropicOAuthInAuthStorage(modelRegistry.authStorage);
84
+
85
+ if (modelRegistry.__omniAnthropicAuthGuardInstalled) {
86
+ return;
87
+ }
88
+
89
+ const originalRefresh = modelRegistry.refresh.bind(modelRegistry);
90
+ modelRegistry.refresh = () => {
91
+ originalRefresh();
92
+ disableAnthropicOAuthInAuthStorage(modelRegistry.authStorage);
93
+ };
94
+ modelRegistry.__omniAnthropicAuthGuardInstalled = true;
95
+ }