oh-my-claude-sisyphus 1.10.0 → 1.11.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 +50 -10
- package/dist/agents/definitions.js +1 -1
- package/dist/agents/model-lists.d.ts +26 -0
- package/dist/agents/model-lists.d.ts.map +1 -0
- package/dist/agents/model-lists.js +62 -0
- package/dist/agents/model-lists.js.map +1 -0
- package/dist/agents/orchestrator-sisyphus.js +1 -1
- package/dist/auth/index.d.ts +10 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +13 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/manager.d.ts +54 -0
- package/dist/auth/manager.d.ts.map +1 -0
- package/dist/auth/manager.js +248 -0
- package/dist/auth/manager.js.map +1 -0
- package/dist/auth/oauth-google.d.ts +47 -0
- package/dist/auth/oauth-google.d.ts.map +1 -0
- package/dist/auth/oauth-google.js +280 -0
- package/dist/auth/oauth-google.js.map +1 -0
- package/dist/auth/oauth-openai.d.ts +46 -0
- package/dist/auth/oauth-openai.d.ts.map +1 -0
- package/dist/auth/oauth-openai.js +264 -0
- package/dist/auth/oauth-openai.js.map +1 -0
- package/dist/auth/pkce.d.ts +14 -0
- package/dist/auth/pkce.d.ts.map +1 -0
- package/dist/auth/pkce.js +35 -0
- package/dist/auth/pkce.js.map +1 -0
- package/dist/auth/storage.d.ts +52 -0
- package/dist/auth/storage.d.ts.map +1 -0
- package/dist/auth/storage.js +230 -0
- package/dist/auth/storage.js.map +1 -0
- package/dist/auth/types.d.ts +76 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +5 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/cli/index.js +0 -0
- package/dist/features/auto-update.d.ts +20 -0
- package/dist/features/auto-update.d.ts.map +1 -1
- package/dist/features/auto-update.js +35 -0
- package/dist/features/auto-update.js.map +1 -1
- package/dist/features/builtin-skills/skills.js +2 -2
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +26 -1
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +126 -4
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/preemptive-compaction/index.js +2 -2
- package/dist/hooks/preemptive-compaction/index.js.map +1 -1
- package/dist/hooks/thinking-block-validator/index.d.ts +3 -34
- package/dist/hooks/thinking-block-validator/index.d.ts.map +1 -1
- package/dist/hooks/thinking-block-validator/index.js +21 -70
- package/dist/hooks/thinking-block-validator/index.js.map +1 -1
- package/dist/installer/hooks.d.ts +2 -2
- package/dist/installer/hooks.d.ts.map +1 -1
- package/dist/installer/hooks.js +85 -2
- package/dist/installer/hooks.js.map +1 -1
- package/dist/installer/index.d.ts +2 -2
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +4 -84
- package/dist/installer/index.js.map +1 -1
- package/dist/providers/index.d.ts +8 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +10 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/registry.d.ts +29 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +162 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/router.d.ts +40 -0
- package/dist/providers/router.d.ts.map +1 -0
- package/dist/providers/router.js +88 -0
- package/dist/providers/router.js.map +1 -0
- package/dist/providers/types.d.ts +92 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +27 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/tools/ast-tools.d.ts +3 -3
- package/dist/tools/ast-tools.d.ts.map +1 -1
- package/dist/tools/ast-tools.js +205 -104
- package/dist/tools/ast-tools.js.map +1 -1
- package/package.json +1 -1
- package/scripts/claude-sisyphus.sh +9 -0
- package/scripts/install.sh +156 -62
- package/scripts/keyword-detector.sh +71 -0
- package/scripts/persistent-mode.sh +300 -0
- package/scripts/post-tool-verifier.sh +196 -0
- package/scripts/pre-tool-enforcer.sh +76 -0
- package/scripts/sisyphus-aliases.sh +18 -0
- package/scripts/stop-continuation.sh +31 -0
- package/scripts/uninstall.sh +129 -5
package/README.md
CHANGED
|
@@ -34,7 +34,20 @@
|
|
|
34
34
|
|
|
35
35
|
## Quick Install
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### Via Claude Code Plugin (Recommended)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# In Claude Code, run:
|
|
41
|
+
/plugin install oh-my-claude-sisyphus
|
|
42
|
+
|
|
43
|
+
# Or from a marketplace:
|
|
44
|
+
/plugin marketplace add Yeachan-Heo/oh-my-claude-sisyphus
|
|
45
|
+
/plugin install oh-my-claude-sisyphus@Yeachan-Heo/oh-my-claude-sisyphus
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This is the cleanest installation method - integrates directly with Claude Code's plugin system.
|
|
49
|
+
|
|
50
|
+
### One-liner (macOS/Linux)
|
|
38
51
|
|
|
39
52
|
```bash
|
|
40
53
|
curl -fsSL https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claude-sisyphus/main/scripts/install.sh | bash
|
|
@@ -46,7 +59,7 @@ curl -fsSL https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claude-sisyphus/m
|
|
|
46
59
|
npm install -g oh-my-claude-sisyphus
|
|
47
60
|
```
|
|
48
61
|
|
|
49
|
-
> **Windows Users**: This is the
|
|
62
|
+
> **Windows Users**: This is the recommended installation method. Requires Node.js 20+.
|
|
50
63
|
|
|
51
64
|
### Manual Install (macOS/Linux)
|
|
52
65
|
|
|
@@ -61,6 +74,24 @@ chmod +x scripts/install.sh
|
|
|
61
74
|
|
|
62
75
|
## What Gets Installed
|
|
63
76
|
|
|
77
|
+
### Plugin Structure (Claude Code Plugin Format)
|
|
78
|
+
|
|
79
|
+
The repository is also a Claude Code plugin with this structure:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
oh-my-claude-sisyphus/
|
|
83
|
+
├── .claude-plugin/
|
|
84
|
+
│ └── plugin.json # Plugin manifest
|
|
85
|
+
├── agents/ # 10 specialized subagents
|
|
86
|
+
├── commands/ # 12 slash commands
|
|
87
|
+
├── skills/ # 3 skills (ultrawork, git-master, frontend-ui-ux)
|
|
88
|
+
├── hooks/
|
|
89
|
+
│ └── hooks.json # Hook configuration
|
|
90
|
+
└── scripts/ # Hook scripts
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Traditional Installation Structure
|
|
94
|
+
|
|
64
95
|
The installer adds to your Claude Code config (`~/.claude/`):
|
|
65
96
|
|
|
66
97
|
```
|
|
@@ -74,7 +105,6 @@ The installer adds to your Claude Code config (`~/.claude/`):
|
|
|
74
105
|
│ ├── multimodal-looker.md # Visual analysis (Sonnet)
|
|
75
106
|
│ ├── momus.md # Plan reviewer (Opus)
|
|
76
107
|
│ ├── metis.md # Pre-planning consultant (Opus)
|
|
77
|
-
│ ├── orchestrator-sisyphus.md # Todo coordinator (Sonnet)
|
|
78
108
|
│ ├── sisyphus-junior.md # Focused executor (Sonnet)
|
|
79
109
|
│ └── prometheus.md # Strategic planner (Opus)
|
|
80
110
|
├── commands/
|
|
@@ -88,7 +118,12 @@ The installer adds to your Claude Code config (`~/.claude/`):
|
|
|
88
118
|
│ ├── prometheus.md # /prometheus command
|
|
89
119
|
│ ├── orchestrator.md # /orchestrator command
|
|
90
120
|
│ ├── ralph-loop.md # /ralph-loop command
|
|
91
|
-
│
|
|
121
|
+
│ ├── cancel-ralph.md # /cancel-ralph command
|
|
122
|
+
│ └── update.md # /update command
|
|
123
|
+
├── skills/
|
|
124
|
+
│ ├── ultrawork/SKILL.md # Maximum performance mode
|
|
125
|
+
│ ├── git-master/SKILL.md # Git expert skill
|
|
126
|
+
│ └── frontend-ui-ux/SKILL.md # UI/UX design skill
|
|
92
127
|
└── CLAUDE.md # Sisyphus system prompt
|
|
93
128
|
```
|
|
94
129
|
|
|
@@ -165,6 +200,11 @@ Just include these words anywhere in your prompt:
|
|
|
165
200
|
|
|
166
201
|
Oh-my-claude-sisyphus includes a silent auto-update system that checks for updates in the background. Updates are applied automatically without interrupting your workflow.
|
|
167
202
|
|
|
203
|
+
Features:
|
|
204
|
+
- **Rate-limited**: Checks at most once every 24 hours
|
|
205
|
+
- **Concurrent-safe**: Lock file prevents simultaneous update attempts
|
|
206
|
+
- **Cross-platform**: Works on both macOS and Linux
|
|
207
|
+
|
|
168
208
|
To manually check for updates:
|
|
169
209
|
```bash
|
|
170
210
|
/update
|
|
@@ -308,7 +348,6 @@ Claude will automatically delegate to these specialized agents:
|
|
|
308
348
|
|
|
309
349
|
| | Agent | Model | Best For |
|
|
310
350
|
|---|-------|-------|----------|
|
|
311
|
-
| 🪨 | **Orchestrator-Sisyphus** | Sonnet | Todo coordination, task delegation, progress tracking |
|
|
312
351
|
| ✨ | **Sisyphus Junior** | Sonnet | Focused task execution, plan following, direct implementation |
|
|
313
352
|
|
|
314
353
|
### Manual Agent Invocation
|
|
@@ -371,7 +410,7 @@ curl -fsSL https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claude-sisyphus/m
|
|
|
371
410
|
Or manually:
|
|
372
411
|
|
|
373
412
|
```bash
|
|
374
|
-
rm ~/.claude/agents/{oracle,librarian,explore,frontend-engineer,document-writer,multimodal-looker,momus,metis,
|
|
413
|
+
rm ~/.claude/agents/{oracle,librarian,explore,frontend-engineer,document-writer,multimodal-looker,momus,metis,sisyphus-junior,prometheus}.md
|
|
375
414
|
rm ~/.claude/commands/{sisyphus,sisyphus-default,ultrawork,deepsearch,analyze,plan,review,prometheus,orchestrator,ralph-loop,cancel-ralph}.md
|
|
376
415
|
```
|
|
377
416
|
|
|
@@ -450,7 +489,6 @@ The original oh-my-opencode used multiple AI providers. This port uses Claude mo
|
|
|
450
489
|
| **Multimodal Looker** | Various | Claude Sonnet | Visual analysis |
|
|
451
490
|
| **Momus** | GPT-5.2 | Claude Opus | Plan reviewer (Greek god of criticism) |
|
|
452
491
|
| **Metis** | Claude Opus 4.5 | Claude Opus | Pre-planning consultant (goddess of wisdom) |
|
|
453
|
-
| **Orchestrator-Sisyphus** | Claude Sonnet 4.5 | Claude Sonnet | Todo coordination and delegation |
|
|
454
492
|
| **Sisyphus-Junior** | Configurable | Claude Sonnet | Focused task executor |
|
|
455
493
|
| **Prometheus** | Planning System | Claude Opus | Strategic planner (fire-bringer) |
|
|
456
494
|
|
|
@@ -509,7 +547,7 @@ The original oh-my-opencode used multiple AI providers. This port uses Claude mo
|
|
|
509
547
|
|
|
510
548
|
| Feature | Description |
|
|
511
549
|
|---------|-------------|
|
|
512
|
-
| **
|
|
550
|
+
| **10 Specialized Agents** | Oracle, Librarian, Explore, Frontend Engineer, Document Writer, Multimodal Looker, Momus, Metis, Sisyphus-Junior, Prometheus |
|
|
513
551
|
| **18 Lifecycle Hooks** | rules-injector, sisyphus-orchestrator, auto-slash-command, keyword-detector, ralph-loop, todo-continuation, context-window-limit-recovery, preemptive-compaction, session-recovery, directory-readme-injector, comment-checker, thinking-block-validator, empty-message-sanitizer, edit-error-recovery, non-interactive-env, agent-usage-reminder, background-notification, think-mode |
|
|
514
552
|
| **6 Builtin Skills** | sisyphus, orchestrator, ultrawork, ralph-loop, frontend-ui-ux, git-master |
|
|
515
553
|
| **Magic Keywords** | `ultrawork`, `search`, `analyze`, `ultrathink` trigger enhanced modes |
|
|
@@ -594,8 +632,8 @@ If you're coming from oh-my-opencode:
|
|
|
594
632
|
|
|
595
633
|
- [Claude Code](https://docs.anthropic.com/claude-code) installed
|
|
596
634
|
- Anthropic API key (`ANTHROPIC_API_KEY` environment variable)
|
|
597
|
-
- **Windows**: Node.js
|
|
598
|
-
- **macOS/Linux**: Bash shell (default) or Node.js
|
|
635
|
+
- **Windows**: Node.js 20+ (for npm installation)
|
|
636
|
+
- **macOS/Linux**: Bash shell (default) or Node.js 20+ (optional)
|
|
599
637
|
|
|
600
638
|
### Platform Support
|
|
601
639
|
|
|
@@ -605,6 +643,8 @@ If you're coming from oh-my-opencode:
|
|
|
605
643
|
| **macOS** | curl or npm | Bash (.sh) |
|
|
606
644
|
| **Linux** | curl or npm | Bash (.sh) |
|
|
607
645
|
|
|
646
|
+
> **Note**: Bash hooks are fully portable across macOS and Linux (no GNU-specific dependencies).
|
|
647
|
+
|
|
608
648
|
> **Advanced**: Set `SISYPHUS_USE_NODE_HOOKS=1` to use Node.js hooks on macOS/Linux.
|
|
609
649
|
|
|
610
650
|
## License
|
|
@@ -777,7 +777,7 @@ export const orchestratorSisyphusAgent = {
|
|
|
777
777
|
- Adapting to codebase maturity (disciplined vs chaotic)
|
|
778
778
|
- Delegating specialized work to the right subagents
|
|
779
779
|
- Parallel execution for maximum throughput
|
|
780
|
-
- Follows user instructions. NEVER START IMPLEMENTING, UNLESS USER WANTS YOU TO IMPLEMENT SOMETHING
|
|
780
|
+
- Follows user instructions. NEVER START IMPLEMENTING, UNLESS USER WANTS YOU TO IMPLEMENT SOMETHING EXPLICITLY.
|
|
781
781
|
|
|
782
782
|
**Operating Mode**: You NEVER work alone when specialists are available. Frontend work → delegate. Deep research → parallel background agents. Complex architecture → consult Oracle.
|
|
783
783
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default model lists for each agent
|
|
3
|
+
*
|
|
4
|
+
* Each agent has an ordered list of preferred models.
|
|
5
|
+
* The first authenticated model is used; falls back through the list.
|
|
6
|
+
*/
|
|
7
|
+
import type { ModelId } from '../providers/types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Model lists categorized by capability tier
|
|
10
|
+
*/
|
|
11
|
+
/** High-capability models (for complex analysis, planning, debugging) */
|
|
12
|
+
export declare const OPUS_TIER_MODELS: ModelId[];
|
|
13
|
+
/** Balanced models (for implementation, coordination) */
|
|
14
|
+
export declare const SONNET_TIER_MODELS: ModelId[];
|
|
15
|
+
/** Fast/cheap models (for search, simple tasks) */
|
|
16
|
+
export declare const HAIKU_TIER_MODELS: ModelId[];
|
|
17
|
+
/**
|
|
18
|
+
* Default model lists for each agent
|
|
19
|
+
* These can be overridden in user config
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_AGENT_MODELS: Record<string, ModelId[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Get default models for an agent
|
|
24
|
+
*/
|
|
25
|
+
export declare function getDefaultModelsForAgent(agentName: string): ModelId[];
|
|
26
|
+
//# sourceMappingURL=model-lists.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-lists.d.ts","sourceRoot":"","sources":["../../src/agents/model-lists.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AAEH,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,EAAE,OAAO,EAIrC,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,kBAAkB,EAAE,OAAO,EAIvC,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,iBAAiB,EAAE,OAAO,EAItC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAyB1D,CAAC;AAEF;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,CAErE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default model lists for each agent
|
|
3
|
+
*
|
|
4
|
+
* Each agent has an ordered list of preferred models.
|
|
5
|
+
* The first authenticated model is used; falls back through the list.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Model lists categorized by capability tier
|
|
9
|
+
*/
|
|
10
|
+
/** High-capability models (for complex analysis, planning, debugging) */
|
|
11
|
+
export const OPUS_TIER_MODELS = [
|
|
12
|
+
'anthropic/claude-opus-4-5',
|
|
13
|
+
'openai/gpt-4o',
|
|
14
|
+
'google/gemini-2.0-flash',
|
|
15
|
+
];
|
|
16
|
+
/** Balanced models (for implementation, coordination) */
|
|
17
|
+
export const SONNET_TIER_MODELS = [
|
|
18
|
+
'anthropic/claude-sonnet-4-5',
|
|
19
|
+
'openai/gpt-4o-mini',
|
|
20
|
+
'google/gemini-2.0-flash',
|
|
21
|
+
];
|
|
22
|
+
/** Fast/cheap models (for search, simple tasks) */
|
|
23
|
+
export const HAIKU_TIER_MODELS = [
|
|
24
|
+
'anthropic/claude-haiku-4-5',
|
|
25
|
+
'google/gemini-2.0-flash-lite',
|
|
26
|
+
'openai/gpt-4o-mini',
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Default model lists for each agent
|
|
30
|
+
* These can be overridden in user config
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_AGENT_MODELS = {
|
|
33
|
+
// Opus-tier agents (complex analysis, planning)
|
|
34
|
+
oracle: [
|
|
35
|
+
'openai/gpt-4o', // Prefer GPT-4o for complex reasoning
|
|
36
|
+
'anthropic/claude-opus-4-5',
|
|
37
|
+
'google/gemini-2.0-flash',
|
|
38
|
+
],
|
|
39
|
+
momus: OPUS_TIER_MODELS, // Plan reviewer
|
|
40
|
+
metis: OPUS_TIER_MODELS, // Pre-planning analyst
|
|
41
|
+
prometheus: OPUS_TIER_MODELS, // Strategic planner
|
|
42
|
+
// Sonnet-tier agents (balanced implementation)
|
|
43
|
+
librarian: SONNET_TIER_MODELS,
|
|
44
|
+
'sisyphus-junior': SONNET_TIER_MODELS,
|
|
45
|
+
'frontend-engineer': SONNET_TIER_MODELS,
|
|
46
|
+
'orchestrator-sisyphus': SONNET_TIER_MODELS,
|
|
47
|
+
'multimodal-looker': SONNET_TIER_MODELS,
|
|
48
|
+
// Haiku-tier agents (fast, cheap)
|
|
49
|
+
explore: [
|
|
50
|
+
'google/gemini-2.0-flash-lite', // Prefer fast Gemini
|
|
51
|
+
'anthropic/claude-haiku-4-5',
|
|
52
|
+
'openai/gpt-4o-mini',
|
|
53
|
+
],
|
|
54
|
+
'document-writer': HAIKU_TIER_MODELS,
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Get default models for an agent
|
|
58
|
+
*/
|
|
59
|
+
export function getDefaultModelsForAgent(agentName) {
|
|
60
|
+
return DEFAULT_AGENT_MODELS[agentName] || SONNET_TIER_MODELS;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=model-lists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-lists.js","sourceRoot":"","sources":["../../src/agents/model-lists.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAc;IACzC,2BAA2B;IAC3B,eAAe;IACf,yBAAyB;CAC1B,CAAC;AAEF,yDAAyD;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAc;IAC3C,6BAA6B;IAC7B,oBAAoB;IACpB,yBAAyB;CAC1B,CAAC;AAEF,mDAAmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAc;IAC1C,4BAA4B;IAC5B,8BAA8B;IAC9B,oBAAoB;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA8B;IAC7D,gDAAgD;IAChD,MAAM,EAAE;QACN,eAAe,EAAY,sCAAsC;QACjE,2BAA2B;QAC3B,yBAAyB;KAC1B;IACD,KAAK,EAAE,gBAAgB,EAAM,gBAAgB;IAC7C,KAAK,EAAE,gBAAgB,EAAM,uBAAuB;IACpD,UAAU,EAAE,gBAAgB,EAAE,oBAAoB;IAElD,+CAA+C;IAC/C,SAAS,EAAE,kBAAkB;IAC7B,iBAAiB,EAAE,kBAAkB;IACrC,mBAAmB,EAAE,kBAAkB;IACvC,uBAAuB,EAAE,kBAAkB;IAC3C,mBAAmB,EAAE,kBAAkB;IAEvC,kCAAkC;IAClC,OAAO,EAAE;QACP,8BAA8B,EAAE,qBAAqB;QACrD,4BAA4B;QAC5B,oBAAoB;KACrB;IACD,iBAAiB,EAAE,iBAAiB;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,SAAiB;IACxD,OAAO,oBAAoB,CAAC,SAAS,CAAC,IAAI,kBAAkB,CAAC;AAC/D,CAAC"}
|
|
@@ -45,7 +45,7 @@ export const orchestratorSisyphusAgent = {
|
|
|
45
45
|
- Adapting to codebase maturity (disciplined vs chaotic)
|
|
46
46
|
- Delegating specialized work to the right subagents
|
|
47
47
|
- Parallel execution for maximum throughput
|
|
48
|
-
- Follows user instructions. NEVER START IMPLEMENTING, UNLESS USER WANTS YOU TO IMPLEMENT SOMETHING
|
|
48
|
+
- Follows user instructions. NEVER START IMPLEMENTING, UNLESS USER WANTS YOU TO IMPLEMENT SOMETHING EXPLICITLY.
|
|
49
49
|
|
|
50
50
|
**Operating Mode**: You NEVER work alone when specialists are available. Frontend work → delegate. Deep research → parallel background agents. Complex architecture → consult Oracle.
|
|
51
51
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication module exports
|
|
3
|
+
*/
|
|
4
|
+
export type { StoredCredential, AuthStatus, ConnectOptions, OAuthResult, PKCEData, } from './types.js';
|
|
5
|
+
export { CredentialStorage, getCredentialStorage } from './storage.js';
|
|
6
|
+
export { generatePKCE, verifyState } from './pkce.js';
|
|
7
|
+
export { OpenAIOAuth, createOpenAIOAuth, OPENAI_OAUTH_CONFIG } from './oauth-openai.js';
|
|
8
|
+
export { GoogleOAuth, createGoogleOAuth, GOOGLE_OAUTH_CONFIG } from './oauth-google.js';
|
|
9
|
+
export { AuthManager, getAuthManager } from './manager.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,WAAW,EACX,QAAQ,GACT,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGtD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication module exports
|
|
3
|
+
*/
|
|
4
|
+
// Storage
|
|
5
|
+
export { CredentialStorage, getCredentialStorage } from './storage.js';
|
|
6
|
+
// PKCE
|
|
7
|
+
export { generatePKCE, verifyState } from './pkce.js';
|
|
8
|
+
// OAuth providers
|
|
9
|
+
export { OpenAIOAuth, createOpenAIOAuth, OPENAI_OAUTH_CONFIG } from './oauth-openai.js';
|
|
10
|
+
export { GoogleOAuth, createGoogleOAuth, GOOGLE_OAUTH_CONFIG } from './oauth-google.js';
|
|
11
|
+
// Manager
|
|
12
|
+
export { AuthManager, getAuthManager } from './manager.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,UAAU;AACV,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO;AACP,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEtD,kBAAkB;AAClB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExF,UAAU;AACV,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified authentication manager for all providers
|
|
3
|
+
*/
|
|
4
|
+
import type { ProviderType } from '../providers/types.js';
|
|
5
|
+
import type { AuthStatus, ConnectOptions } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Authentication manager
|
|
8
|
+
*/
|
|
9
|
+
export declare class AuthManager {
|
|
10
|
+
private storage;
|
|
11
|
+
private openaiOAuth;
|
|
12
|
+
private googleOAuth;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Connect to a provider
|
|
16
|
+
*
|
|
17
|
+
* For OAuth providers (openai, google): Opens browser for authentication
|
|
18
|
+
* For API key providers (anthropic, openrouter): Requires apiKey in options
|
|
19
|
+
*/
|
|
20
|
+
connect(provider: ProviderType, options?: ConnectOptions): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Disconnect from a provider
|
|
23
|
+
*/
|
|
24
|
+
logout(provider: ProviderType): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Get authentication status for all providers
|
|
27
|
+
*/
|
|
28
|
+
getStatus(): Promise<AuthStatus[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Get authentication status for a specific provider
|
|
31
|
+
*/
|
|
32
|
+
getStatusForProvider(provider: ProviderType): Promise<AuthStatus>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if a provider is authenticated
|
|
35
|
+
*/
|
|
36
|
+
isAuthenticated(provider: ProviderType): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Get access token for a provider (auto-refreshes if needed)
|
|
39
|
+
*/
|
|
40
|
+
getAccessToken(provider: ProviderType): Promise<string | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Get authorization headers for a provider
|
|
43
|
+
*/
|
|
44
|
+
getHeaders(provider: ProviderType): Promise<Record<string, string>>;
|
|
45
|
+
/**
|
|
46
|
+
* Refresh OAuth tokens if they're close to expiring
|
|
47
|
+
*/
|
|
48
|
+
private refreshIfNeeded;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the auth manager instance
|
|
52
|
+
*/
|
|
53
|
+
export declare function getAuthManager(): AuthManager;
|
|
54
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/auth/manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAU7D;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAc;;IAQjC;;;;;OAKG;IACG,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA+C9E;;OAEG;IACG,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnD;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAKxC;;OAEG;IACG,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC;IA4DvE;;OAEG;IACG,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/D;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAmBpE;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAuCzE;;OAEG;YACW,eAAe;CA+B9B;AAOD;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAK5C"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified authentication manager for all providers
|
|
3
|
+
*/
|
|
4
|
+
import { getCredentialStorage } from './storage.js';
|
|
5
|
+
import { createOpenAIOAuth } from './oauth-openai.js';
|
|
6
|
+
import { createGoogleOAuth } from './oauth-google.js';
|
|
7
|
+
/**
|
|
8
|
+
* Time before expiry to refresh tokens (5 minutes)
|
|
9
|
+
*/
|
|
10
|
+
const REFRESH_THRESHOLD_MS = 5 * 60 * 1000;
|
|
11
|
+
/**
|
|
12
|
+
* Authentication manager
|
|
13
|
+
*/
|
|
14
|
+
export class AuthManager {
|
|
15
|
+
storage;
|
|
16
|
+
openaiOAuth;
|
|
17
|
+
googleOAuth;
|
|
18
|
+
constructor() {
|
|
19
|
+
this.storage = getCredentialStorage();
|
|
20
|
+
this.openaiOAuth = createOpenAIOAuth();
|
|
21
|
+
this.googleOAuth = createGoogleOAuth();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Connect to a provider
|
|
25
|
+
*
|
|
26
|
+
* For OAuth providers (openai, google): Opens browser for authentication
|
|
27
|
+
* For API key providers (anthropic, openrouter): Requires apiKey in options
|
|
28
|
+
*/
|
|
29
|
+
async connect(provider, options) {
|
|
30
|
+
// Check if already connected and not forcing
|
|
31
|
+
if (!options?.force && await this.isAuthenticated(provider)) {
|
|
32
|
+
const status = await this.getStatusForProvider(provider);
|
|
33
|
+
console.log(`Already connected to ${provider}${status.email ? ` as ${status.email}` : ''}.`);
|
|
34
|
+
console.log('Use --force to re-authenticate.');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
switch (provider) {
|
|
38
|
+
case 'openai': {
|
|
39
|
+
const result = await this.openaiOAuth.authenticate();
|
|
40
|
+
if (result.success && result.tokens) {
|
|
41
|
+
await this.storage.storeOAuthTokens('openai', result.tokens, result.email);
|
|
42
|
+
console.log(`\nConnected to OpenAI${result.email ? ` as ${result.email}` : ''}.`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
throw new Error(result.error || 'OpenAI authentication failed');
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case 'google': {
|
|
50
|
+
const result = await this.googleOAuth.authenticate();
|
|
51
|
+
if (result.success && result.tokens) {
|
|
52
|
+
await this.storage.storeOAuthTokens('google', result.tokens, result.email);
|
|
53
|
+
console.log(`\nConnected to Google${result.email ? ` as ${result.email}` : ''}.`);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
throw new Error(result.error || 'Google authentication failed');
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case 'anthropic':
|
|
61
|
+
case 'openrouter': {
|
|
62
|
+
if (!options?.apiKey) {
|
|
63
|
+
throw new Error(`API key required for ${provider}. Use /connect ${provider} <api-key>`);
|
|
64
|
+
}
|
|
65
|
+
await this.storage.storeApiKey(provider, options.apiKey);
|
|
66
|
+
console.log(`Connected to ${provider}.`);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
default:
|
|
70
|
+
throw new Error(`Unknown provider: ${provider}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Disconnect from a provider
|
|
75
|
+
*/
|
|
76
|
+
async logout(provider) {
|
|
77
|
+
await this.storage.delete(provider);
|
|
78
|
+
console.log(`Disconnected from ${provider}.`);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get authentication status for all providers
|
|
82
|
+
*/
|
|
83
|
+
async getStatus() {
|
|
84
|
+
const providers = ['anthropic', 'openai', 'google', 'openrouter'];
|
|
85
|
+
return Promise.all(providers.map(p => this.getStatusForProvider(p)));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get authentication status for a specific provider
|
|
89
|
+
*/
|
|
90
|
+
async getStatusForProvider(provider) {
|
|
91
|
+
// Check environment variables for API key providers
|
|
92
|
+
if (provider === 'anthropic' && process.env.ANTHROPIC_API_KEY) {
|
|
93
|
+
return {
|
|
94
|
+
provider,
|
|
95
|
+
authenticated: true,
|
|
96
|
+
authType: 'api_key',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (provider === 'openrouter' && process.env.OPENROUTER_API_KEY) {
|
|
100
|
+
return {
|
|
101
|
+
provider,
|
|
102
|
+
authenticated: true,
|
|
103
|
+
authType: 'api_key',
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const credential = await this.storage.getCredential(provider);
|
|
107
|
+
if (!credential) {
|
|
108
|
+
return {
|
|
109
|
+
provider,
|
|
110
|
+
authenticated: false,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
// Check if OAuth token is expired
|
|
114
|
+
if (credential.type === 'oauth' && credential.expiresAt) {
|
|
115
|
+
if (Date.now() > credential.expiresAt) {
|
|
116
|
+
// Try to refresh
|
|
117
|
+
try {
|
|
118
|
+
await this.refreshIfNeeded(provider);
|
|
119
|
+
const refreshed = await this.storage.getCredential(provider);
|
|
120
|
+
return {
|
|
121
|
+
provider,
|
|
122
|
+
authenticated: true,
|
|
123
|
+
authType: 'oauth',
|
|
124
|
+
expiresAt: refreshed?.expiresAt,
|
|
125
|
+
email: refreshed?.email,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return {
|
|
130
|
+
provider,
|
|
131
|
+
authenticated: false,
|
|
132
|
+
error: 'Token expired and refresh failed',
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
provider,
|
|
139
|
+
authenticated: true,
|
|
140
|
+
authType: credential.type,
|
|
141
|
+
expiresAt: credential.expiresAt,
|
|
142
|
+
email: credential.email,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Check if a provider is authenticated
|
|
147
|
+
*/
|
|
148
|
+
async isAuthenticated(provider) {
|
|
149
|
+
const status = await this.getStatusForProvider(provider);
|
|
150
|
+
return status.authenticated;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get access token for a provider (auto-refreshes if needed)
|
|
154
|
+
*/
|
|
155
|
+
async getAccessToken(provider) {
|
|
156
|
+
// Check environment variables first
|
|
157
|
+
if (provider === 'anthropic' && process.env.ANTHROPIC_API_KEY) {
|
|
158
|
+
return process.env.ANTHROPIC_API_KEY;
|
|
159
|
+
}
|
|
160
|
+
if (provider === 'openrouter' && process.env.OPENROUTER_API_KEY) {
|
|
161
|
+
return process.env.OPENROUTER_API_KEY;
|
|
162
|
+
}
|
|
163
|
+
// Auto-refresh OAuth tokens if needed
|
|
164
|
+
if (provider === 'openai' || provider === 'google') {
|
|
165
|
+
await this.refreshIfNeeded(provider);
|
|
166
|
+
}
|
|
167
|
+
const credential = await this.storage.getCredential(provider);
|
|
168
|
+
return credential?.accessToken || null;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get authorization headers for a provider
|
|
172
|
+
*/
|
|
173
|
+
async getHeaders(provider) {
|
|
174
|
+
const token = await this.getAccessToken(provider);
|
|
175
|
+
if (!token) {
|
|
176
|
+
throw new Error(`Not authenticated with ${provider}. Run /connect ${provider}`);
|
|
177
|
+
}
|
|
178
|
+
switch (provider) {
|
|
179
|
+
case 'anthropic':
|
|
180
|
+
return {
|
|
181
|
+
'x-api-key': token,
|
|
182
|
+
'anthropic-version': '2023-06-01',
|
|
183
|
+
'content-type': 'application/json',
|
|
184
|
+
};
|
|
185
|
+
case 'openai':
|
|
186
|
+
return {
|
|
187
|
+
Authorization: `Bearer ${token}`,
|
|
188
|
+
'Content-Type': 'application/json',
|
|
189
|
+
};
|
|
190
|
+
case 'google':
|
|
191
|
+
return {
|
|
192
|
+
Authorization: `Bearer ${token}`,
|
|
193
|
+
'Content-Type': 'application/json',
|
|
194
|
+
};
|
|
195
|
+
case 'openrouter':
|
|
196
|
+
return {
|
|
197
|
+
Authorization: `Bearer ${token}`,
|
|
198
|
+
'Content-Type': 'application/json',
|
|
199
|
+
'HTTP-Referer': 'https://github.com/your-repo', // Required by OpenRouter
|
|
200
|
+
};
|
|
201
|
+
default:
|
|
202
|
+
throw new Error(`Unknown provider: ${provider}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Refresh OAuth tokens if they're close to expiring
|
|
207
|
+
*/
|
|
208
|
+
async refreshIfNeeded(provider) {
|
|
209
|
+
const credential = await this.storage.getOAuthTokens(provider);
|
|
210
|
+
if (!credential) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
// Check if refresh is needed (5 minutes before expiry)
|
|
214
|
+
if (credential.expiresAt && Date.now() > credential.expiresAt - REFRESH_THRESHOLD_MS) {
|
|
215
|
+
if (!credential.refreshToken) {
|
|
216
|
+
throw new Error(`No refresh token available for ${provider}. Please re-authenticate.`);
|
|
217
|
+
}
|
|
218
|
+
console.log(`Refreshing ${provider} token...`);
|
|
219
|
+
try {
|
|
220
|
+
let newTokens;
|
|
221
|
+
if (provider === 'openai') {
|
|
222
|
+
newTokens = await this.openaiOAuth.refreshTokens(credential.refreshToken);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
newTokens = await this.googleOAuth.refreshTokens(credential.refreshToken);
|
|
226
|
+
}
|
|
227
|
+
await this.storage.storeOAuthTokens(provider, newTokens, credential.email);
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
throw new Error(`Failed to refresh ${provider} token: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Singleton auth manager instance
|
|
237
|
+
*/
|
|
238
|
+
let authManagerInstance = null;
|
|
239
|
+
/**
|
|
240
|
+
* Get the auth manager instance
|
|
241
|
+
*/
|
|
242
|
+
export function getAuthManager() {
|
|
243
|
+
if (!authManagerInstance) {
|
|
244
|
+
authManagerInstance = new AuthManager();
|
|
245
|
+
}
|
|
246
|
+
return authManagerInstance;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/auth/manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,oBAAoB,EAAqB,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAe,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAe,MAAM,mBAAmB,CAAC;AAEnE;;GAEG;AACH,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,WAAW;IACd,OAAO,CAAoB;IAC3B,WAAW,CAAc;IACzB,WAAW,CAAc;IAEjC;QACE,IAAI,CAAC,OAAO,GAAG,oBAAoB,EAAE,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,iBAAiB,EAAE,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,iBAAiB,EAAE,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,QAAsB,EAAE,OAAwB;QAC5D,6CAA6C;QAC7C,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;YACzD,OAAO,CAAC,GAAG,CAAC,wBAAwB,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC,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WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;gBAC5E,CAAC;gBAED,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;YAC7E,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CACb,qBAAqB,QAAQ,WAAW,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAC/F,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,IAAI,mBAAmB,GAAuB,IAAI,CAAC;AAEnD;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,mBAAmB,GAAG,IAAI,WAAW,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google OAuth 2.0 implementation for consumer Google accounts
|
|
3
|
+
*
|
|
4
|
+
* Uses the same OAuth flow as Gemini CLI
|
|
5
|
+
*/
|
|
6
|
+
import type { OAuthTokens, OAuthConfig } from '../providers/types.js';
|
|
7
|
+
import type { OAuthResult, PKCEData } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Google OAuth configuration
|
|
10
|
+
* These are the same credentials used by Gemini CLI
|
|
11
|
+
*/
|
|
12
|
+
export declare const GOOGLE_OAUTH_CONFIG: OAuthConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Google OAuth handler
|
|
15
|
+
*/
|
|
16
|
+
export declare class GoogleOAuth {
|
|
17
|
+
private config;
|
|
18
|
+
constructor(config?: OAuthConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Generate the authorization URL for the OAuth flow
|
|
21
|
+
*/
|
|
22
|
+
getAuthorizationUrl(pkce: PKCEData, redirectUri: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Exchange authorization code for tokens
|
|
25
|
+
*/
|
|
26
|
+
exchangeCodeForTokens(code: string, codeVerifier: string, redirectUri: string): Promise<OAuthTokens>;
|
|
27
|
+
/**
|
|
28
|
+
* Refresh tokens using refresh token
|
|
29
|
+
*/
|
|
30
|
+
refreshTokens(refreshToken: string): Promise<OAuthTokens>;
|
|
31
|
+
/**
|
|
32
|
+
* Get user info from Google
|
|
33
|
+
*/
|
|
34
|
+
getUserInfo(accessToken: string): Promise<{
|
|
35
|
+
email?: string;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Run the full OAuth authentication flow
|
|
39
|
+
* Opens a browser and waits for callback
|
|
40
|
+
*/
|
|
41
|
+
authenticate(): Promise<OAuthResult>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create Google OAuth handler instance
|
|
45
|
+
*/
|
|
46
|
+
export declare function createGoogleOAuth(): GoogleOAuth;
|
|
47
|
+
//# sourceMappingURL=oauth-google.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-google.d.ts","sourceRoot":"","sources":["../../src/auth/oauth-google.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA2BxD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAOjC,CAAC;AAwBF;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAc;gBAEhB,MAAM,GAAE,WAAiC;IAIrD;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IAgBhE;;OAEG;IACG,qBAAqB,CACzB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,WAAW,CAAC;IAsCvB;;OAEG;IACG,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAoC/D;;OAEG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAkBnE;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;CA8G3C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAE/C"}
|