0xkobold 0.6.10 → 0.7.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/README.md +97 -23
- package/dist/package.json +6 -5
- package/dist/src/cli/commands/tui.js +16 -3
- package/dist/src/cli/commands/tui.js.map +1 -1
- package/dist/src/cli/extensions/env.js +175 -14
- package/dist/src/cli/extensions/env.js.map +1 -1
- package/dist/src/extensions/community/pi-ollama-wrapper.js +27 -0
- package/dist/src/extensions/community/pi-ollama-wrapper.js.map +1 -0
- package/dist/src/extensions/core/agent-orchestrator-extension.js +160 -43
- package/dist/src/extensions/core/agent-orchestrator-extension.js.map +1 -1
- package/dist/src/extensions/core/cloudflare-browser-extension.js +389 -0
- package/dist/src/extensions/core/cloudflare-browser-extension.js.map +1 -0
- package/dist/src/extensions/core/draconic-extension-loader.js +144 -0
- package/dist/src/extensions/core/draconic-extension-loader.js.map +1 -0
- package/dist/src/extensions/core/intelligent-context-extension.js +196 -0
- package/dist/src/extensions/core/intelligent-context-extension.js.map +1 -0
- package/dist/src/extensions/core/obsidian-bridge-extension.js +488 -0
- package/dist/src/extensions/core/obsidian-bridge-extension.js.map +1 -0
- package/dist/src/gateway/discord-bot.js +4 -4
- package/dist/src/gateway/discord-bot.js.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/llm/ollama.js +26 -1
- package/dist/src/llm/ollama.js.map +1 -1
- package/dist/src/pi-config.js +18 -2
- package/dist/src/pi-config.js.map +1 -1
- package/dist/src/utils/redact.js +212 -0
- package/dist/src/utils/redact.js.map +1 -0
- package/package.json +6 -5
- package/skills/cloudflare-research.ts +345 -0
- package/dist/src/extensions/core/context-pruning/extension.js +0 -124
- package/dist/src/extensions/core/context-pruning/extension.js.map +0 -1
- package/dist/src/extensions/core/context-pruning/pruner.js +0 -312
- package/dist/src/extensions/core/context-pruning/pruner.js.map +0 -1
- package/dist/src/extensions/core/context-pruning/runtime.js +0 -48
- package/dist/src/extensions/core/context-pruning/runtime.js.map +0 -1
- package/dist/src/extensions/core/context-pruning/settings.js +0 -105
- package/dist/src/extensions/core/context-pruning/settings.js.map +0 -1
- package/dist/src/extensions/core/ollama-extension.js +0 -442
- package/dist/src/extensions/core/ollama-extension.js.map +0 -1
- package/dist/src/gateway/server.js +0 -325
- package/dist/src/gateway/server.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
# 0xKobold
|
|
2
|
-
|
|
3
|
-
**v0.6.10** — Gateway auto-starts by default for TUI (detects existing)
|
|
4
|
-
|
|
5
|
-
**v0.6.9** — Fix gateway detection when dev already running
|
|
6
|
-
|
|
7
|
-
**v0.6.8** — Add /lair-sync command to bridge local/global context
|
|
8
|
-
|
|
9
|
-
**v0.6.7** — Auto-detect and notify about project lairs in local mode
|
|
10
|
-
|
|
11
|
-
**v0.6.6** — Enforce global workspace sandboxing, proper CWD isolation
|
|
12
|
-
|
|
13
|
-
**v0.6.5** — Clean dist/ before build, removes ghost extensions
|
|
14
|
-
|
|
15
|
-
**v0.6.4** — Fix workspace detection from home directory
|
|
16
|
-
|
|
17
|
-
**v0.6.3** — Workspace-aware footer, cleaner gateway display
|
|
18
|
-
|
|
19
|
-
**v0.6.2** — Gateway auto-start opt-in (fixes port conflicts)
|
|
20
|
-
|
|
21
|
-
**v0.6.0 "Koclaw Gateway"** — JSON-RPC gateway, session persistence, multi-channel
|
|
1
|
+
# 0xKobold
|
|
22
2
|
|
|
23
3
|
```
|
|
24
4
|
..
|
|
@@ -56,7 +36,20 @@
|
|
|
56
36
|
|
|
57
37
|
> *"Your digital familiar - a personal AI assistant that connects, persists, and evolves"*
|
|
58
38
|
|
|
59
|
-
|
|
39
|
+
## 🔥 Latest: v0.7.0 "NPM Release"
|
|
40
|
+
|
|
41
|
+
**v0.7.0** — Published to npm! `@0xkobold/pi-*` extension packages available
|
|
42
|
+
**v0.6.11** — Automatic secret redaction in env commands, README restructure
|
|
43
|
+
**v0.6.10** — Gateway auto-starts by default for TUI (detects existing)
|
|
44
|
+
**v0.6.9** — Fix gateway detection when dev already running
|
|
45
|
+
**v0.6.8** — Add /lair-sync command to bridge local/global context
|
|
46
|
+
**v0.6.7** — Auto-detect and notify about project lairs in local mode
|
|
47
|
+
**v0.6.6** — Enforce global workspace sandboxing, proper CWD isolation
|
|
48
|
+
**v0.6.5** — Clean dist/ before build, removes ghost extensions
|
|
49
|
+
**v0.6.4** — Fix workspace detection from home directory
|
|
50
|
+
**v0.6.3** — Workspace-aware footer, cleaner gateway display
|
|
51
|
+
**v0.6.2** — Gateway auto-start opt-in (fixes port conflicts)
|
|
52
|
+
**v0.6.0** — JSON-RPC gateway, session persistence, multi-channel
|
|
60
53
|
|
|
61
54
|
> **New in v0.6.0:** Koclaw Gateway (JSON-RPC), Session Management, Auth Profiles, Session Resume
|
|
62
55
|
> **From v0.5.0:** Generative Agents, Semantic Memory, Multi-agent Orchestration
|
|
@@ -112,6 +105,13 @@
|
|
|
112
105
|
| **Discord Integration** | ✅ | Bot interface |
|
|
113
106
|
| **WebSocket Gateway** | ✅ | Real-time communication (port 18789) |
|
|
114
107
|
|
|
108
|
+
### v0.7.0 - NPM Extensions
|
|
109
|
+
| Feature | Status | Description |
|
|
110
|
+
|---------|--------|-------------|
|
|
111
|
+
| **Pi Ollama** | ✅ | `@0xkobold/pi-ollama` - Local + Cloud Ollama models |
|
|
112
|
+
| **Pi Wallet** | ✅ | `@0xkobold/pi-wallet` - CDP Agentic Wallet + x402 payments |
|
|
113
|
+
| **Pi ERC-8004** | ✅ | `@0xkobold/pi-erc8004` - Agent identity + reputation |
|
|
114
|
+
|
|
115
115
|
---
|
|
116
116
|
|
|
117
117
|
## Quick Start
|
|
@@ -130,6 +130,21 @@ ollama pull nomic-embed-text # For semantic memory
|
|
|
130
130
|
|
|
131
131
|
### Install & Run
|
|
132
132
|
|
|
133
|
+
#### Option 1: Install from npm (Recommended)
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Install globally
|
|
137
|
+
npm install -g 0xkobold
|
|
138
|
+
|
|
139
|
+
# Initialize workspace
|
|
140
|
+
0xkobold init
|
|
141
|
+
|
|
142
|
+
# Start 0xKobold
|
|
143
|
+
0xkobold start
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Option 2: Clone from source
|
|
147
|
+
|
|
133
148
|
```bash
|
|
134
149
|
# Clone repository
|
|
135
150
|
git clone https://github.com/kobolds/0xKobolds.git
|
|
@@ -244,6 +259,28 @@ recall "what was the database decision"
|
|
|
244
259
|
|
|
245
260
|
---
|
|
246
261
|
|
|
262
|
+
## Secret Management 🔐
|
|
263
|
+
|
|
264
|
+
Environment variables with automatic redaction:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Show env vars (secrets automatically redacted)
|
|
268
|
+
0xkobold env show
|
|
269
|
+
|
|
270
|
+
# Show with secrets revealed (careful!)
|
|
271
|
+
0xkobold env show --show-secrets
|
|
272
|
+
|
|
273
|
+
# Show entire .env file (redacted)
|
|
274
|
+
0xkobold env show --file
|
|
275
|
+
|
|
276
|
+
# Check status
|
|
277
|
+
0xkobold env status
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**Auto-redacted:** TOKEN, KEY, SECRET, PASSWORD, API_KEY, WEBHOOK_URL, and token-like values
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
247
284
|
## Skills System 🔧
|
|
248
285
|
|
|
249
286
|
Create custom capabilities without restarting:
|
|
@@ -280,6 +317,32 @@ export const mySkill: Skill = {
|
|
|
280
317
|
|
|
281
318
|
---
|
|
282
319
|
|
|
320
|
+
## NPM Extension Packages 📦
|
|
321
|
+
|
|
322
|
+
Official Pi extensions published to npm:
|
|
323
|
+
|
|
324
|
+
### `@0xkobold/pi-ollama`
|
|
325
|
+
Local + Cloud Ollama models with auto-discovery
|
|
326
|
+
```bash
|
|
327
|
+
pi install npm:@0xkobold/pi-ollama
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### `@0xkobold/pi-wallet`
|
|
331
|
+
CDP Agentic Wallet + x402 payments + Ethers.js backup
|
|
332
|
+
```bash
|
|
333
|
+
pi install npm:@0xkobold/pi-wallet
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### `@0xkobold/pi-erc8004`
|
|
337
|
+
ERC-8004 identity + reputation on Base L2
|
|
338
|
+
```bash
|
|
339
|
+
pi install npm:@0xkobold/pi-erc8004
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Note:** Pi extensions use the `pi install` CLI, not npm directly.
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
283
346
|
## Commands
|
|
284
347
|
|
|
285
348
|
### Core
|
|
@@ -332,6 +395,14 @@ bun run init # Initialize workspace
|
|
|
332
395
|
0xkobold gateway health
|
|
333
396
|
```
|
|
334
397
|
|
|
398
|
+
### Environment
|
|
399
|
+
```bash
|
|
400
|
+
0xkobold env status # Check environment status
|
|
401
|
+
0xkobold env show # Show env vars (redacted)
|
|
402
|
+
0xkobold env show --show-secrets # Show with secrets visible
|
|
403
|
+
0xkobold env show --file # Show .env file contents
|
|
404
|
+
```
|
|
405
|
+
|
|
335
406
|
---
|
|
336
407
|
|
|
337
408
|
## Configuration
|
|
@@ -408,6 +479,7 @@ eventBus.on('agent.spawned', handler);
|
|
|
408
479
|
| `src/skills/` | Hot-reload skill system |
|
|
409
480
|
| `src/tui/` | Terminal UI (React-based) |
|
|
410
481
|
| `src/event-bus/` | Decoupled event system |
|
|
482
|
+
| `src/cli/extensions/env.ts` | Secret management with auto-redaction |
|
|
411
483
|
|
|
412
484
|
---
|
|
413
485
|
|
|
@@ -455,7 +527,7 @@ bun test --coverage
|
|
|
455
527
|
│ │ ├── builtin/ # Built-in skills
|
|
456
528
|
│ │ └── loader.ts # Hot-reload logic
|
|
457
529
|
│ ├── tui/ # Terminal UI
|
|
458
|
-
│ └── utils/ # Utilities (nl-patterns.ts)
|
|
530
|
+
│ └── utils/ # Utilities (nl-patterns.ts, redact.ts)
|
|
459
531
|
├── skills/ # Your custom skills (hot-reloaded)
|
|
460
532
|
├── test/ # Test suites
|
|
461
533
|
│ ├── unit/
|
|
@@ -482,6 +554,8 @@ bun test --coverage
|
|
|
482
554
|
- `src/agent/auth-profiles.ts` - Auth profile management
|
|
483
555
|
- `src/extensions/core/generative-agents-extension.ts` - Generative agents
|
|
484
556
|
- `src/utils/nl-patterns.ts` - Natural language parsing
|
|
557
|
+
- `src/utils/redact.ts` - Secret redaction utilities
|
|
558
|
+
- `src/cli/extensions/env.ts` - Environment & secrets management
|
|
485
559
|
- `~/.0xkobold/config.json` - User configuration
|
|
486
560
|
- `~/.0xkobold/memory/perennial/knowledge.db` - Semantic memory
|
|
487
561
|
- `CLAUDE.md` - AI assistant context
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "0xkobold",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Your digital familiar - Koclaw-style gateway, session management, and multi-agent orchestration",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"author": "0xKobold Team",
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"dependencies": {
|
|
46
|
+
"@0xkobold/pi-ollama": "0.1.7",
|
|
46
47
|
"@aliou/pi-processes": "^0.6.2",
|
|
47
48
|
"@mariozechner/pi-agent-core": "0.57.1",
|
|
48
49
|
"@mariozechner/pi-coding-agent": "0.57.1",
|
|
@@ -56,12 +57,12 @@
|
|
|
56
57
|
"json5": "^2.2.3",
|
|
57
58
|
"node-machine-id": "^1.1.12",
|
|
58
59
|
"node-telegram-bot-api": "^0.67.0",
|
|
59
|
-
"pi-extmgr": "^0.1.
|
|
60
|
+
"pi-extmgr": "^0.1.25",
|
|
60
61
|
"pi-librarian": "^1.3.0",
|
|
61
62
|
"pi-memory-md": "^0.1.1",
|
|
62
63
|
"pi-messenger": "^0.13.0",
|
|
63
|
-
"pi-subagents": "^0.11.
|
|
64
|
-
"pi-web-access": "^0.10.
|
|
64
|
+
"pi-subagents": "^0.11.2",
|
|
65
|
+
"pi-web-access": "^0.10.3",
|
|
65
66
|
"playwright": "^1.58.2",
|
|
66
67
|
"react": "^19.2.4",
|
|
67
68
|
"sharp": "^0.33.5",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"@types/blessed": "^0.1.27",
|
|
72
73
|
"@types/bun": "latest",
|
|
73
74
|
"@types/json5": "^2.2.0",
|
|
74
|
-
"@types/node": "^20.19.
|
|
75
|
+
"@types/node": "^20.19.37",
|
|
75
76
|
"bun-types": "latest",
|
|
76
77
|
"typescript": "^5.9.3"
|
|
77
78
|
},
|
|
@@ -13,9 +13,13 @@ export const tuiCommand = new Command()
|
|
|
13
13
|
.option("-r, --remote <url>", "Connect to remote gateway instead of local (e.g., wss://vps.example.com:7777)")
|
|
14
14
|
.option("--token <token>", "Authentication token for remote gateway")
|
|
15
15
|
.action(async (options) => {
|
|
16
|
-
// The main TUI entry point
|
|
16
|
+
// The main TUI entry point - check for source first (dev), then compiled (prod)
|
|
17
17
|
const packageRoot = resolve(__dirname, "../../..");
|
|
18
|
-
const
|
|
18
|
+
const devEntry = resolve(packageRoot, "src/index.ts");
|
|
19
|
+
const prodEntry = resolve(packageRoot, "dist/src/index.js");
|
|
20
|
+
// Use source if available (development), otherwise compiled (production/npm)
|
|
21
|
+
const tuiEntryPoint = existsSync(devEntry) ? devEntry : prodEntry;
|
|
22
|
+
const isCompiled = tuiEntryPoint === prodEntry;
|
|
19
23
|
// Determine working directory: global workspace by default, or current dir with --local
|
|
20
24
|
const globalWorkspace = resolve(homedir(), ".0xkobold");
|
|
21
25
|
const cwd = options.local ? process.cwd() : globalWorkspace;
|
|
@@ -83,13 +87,22 @@ export const tuiCommand = new Command()
|
|
|
83
87
|
}
|
|
84
88
|
try {
|
|
85
89
|
const args = [tuiEntryPoint];
|
|
90
|
+
// Pass through --local flag if set (for the entry point to handle)
|
|
91
|
+
if (options.local) {
|
|
92
|
+
args.push("--local");
|
|
93
|
+
}
|
|
86
94
|
// Add any custom extensions if provided
|
|
87
95
|
if (options.extensions) {
|
|
88
96
|
for (const ext of options.extensions) {
|
|
89
97
|
args.push("--extension", ext);
|
|
90
98
|
}
|
|
91
99
|
}
|
|
92
|
-
|
|
100
|
+
// Use bun for .ts files, node for compiled .js files
|
|
101
|
+
const runner = isCompiled ? "node" : "bun";
|
|
102
|
+
if (isCompiled) {
|
|
103
|
+
console.log(`[Using compiled entry point: ${tuiEntryPoint}]`);
|
|
104
|
+
}
|
|
105
|
+
const child = spawn(runner, args, {
|
|
93
106
|
stdio: "inherit",
|
|
94
107
|
shell: true,
|
|
95
108
|
// Always run from package root so extensions resolve correctly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../../../../src/cli/commands/tui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEtE,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,EAAE;KACpC,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,mDAAmD,CAAC;KAChE,MAAM,CAAC,6BAA6B,EAAE,oCAAoC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AAC;YACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -2,11 +2,124 @@
|
|
|
2
2
|
* Environment CLI Extension
|
|
3
3
|
*
|
|
4
4
|
* Registers Environment subcommands under 0xkobold CLI
|
|
5
|
+
*
|
|
6
|
+
* Secret Redaction:
|
|
7
|
+
* - Automatically detects secret keys ( TOKEN, KEY, SECRET, PASSWORD, etc.)
|
|
8
|
+
* - Masks values like "sk-abc123***xyz" (shows first/last 4 chars only)
|
|
9
|
+
* - Use --show-secrets flag to reveal actual values
|
|
5
10
|
*/
|
|
6
|
-
import { existsSync } from "fs";
|
|
11
|
+
import { existsSync, readFileSync } from "fs";
|
|
7
12
|
import { homedir } from "os";
|
|
8
13
|
import { join } from "path";
|
|
9
14
|
const CONFIG_DIR = join(homedir(), ".0xkobold", "config");
|
|
15
|
+
/** Patterns that indicate a secret key */
|
|
16
|
+
const SECRET_KEY_PATTERNS = [
|
|
17
|
+
/token/i,
|
|
18
|
+
/password/i,
|
|
19
|
+
/secret/i,
|
|
20
|
+
/api[_-]?key/i,
|
|
21
|
+
/auth/i,
|
|
22
|
+
/credential/i,
|
|
23
|
+
/private/i,
|
|
24
|
+
/webhook[_-]?url/i,
|
|
25
|
+
];
|
|
26
|
+
/** Environment variable names that are known secrets */
|
|
27
|
+
const SECRET_ENV_NAMES = [
|
|
28
|
+
'DISCORD_BOT_TOKEN',
|
|
29
|
+
'TELEGRAM_BOT_TOKEN',
|
|
30
|
+
'ANTHROPIC_API_KEY',
|
|
31
|
+
'OPENAI_API_KEY',
|
|
32
|
+
'LLM_API_KEY',
|
|
33
|
+
'KOBOLD_REMOTE_TOKEN',
|
|
34
|
+
'KOBOLD_API_KEY',
|
|
35
|
+
'SOPS_AGE_KEY',
|
|
36
|
+
'AWS_ACCESS_KEY_ID',
|
|
37
|
+
'AWS_SECRET_ACCESS_KEY',
|
|
38
|
+
'GITHUB_TOKEN',
|
|
39
|
+
'GITLAB_TOKEN',
|
|
40
|
+
'SLACK_TOKEN',
|
|
41
|
+
'STRIPE_SECRET_KEY',
|
|
42
|
+
'JWT_SECRET',
|
|
43
|
+
'SESSION_SECRET',
|
|
44
|
+
'COOKIE_SECRET',
|
|
45
|
+
];
|
|
46
|
+
/**
|
|
47
|
+
* Check if a key looks like it could be a secret
|
|
48
|
+
*/
|
|
49
|
+
function isSecretKey(key) {
|
|
50
|
+
return SECRET_KEY_PATTERNS.some(pattern => pattern.test(key));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if an environment variable name is a known secret
|
|
54
|
+
*/
|
|
55
|
+
function isSecretEnvVar(name) {
|
|
56
|
+
return SECRET_ENV_NAMES.some(secret => name.toUpperCase() === secret ||
|
|
57
|
+
name.toUpperCase().startsWith(secret + '_'));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Redact a secret value, showing only first/last 4 chars
|
|
61
|
+
* e.g., "sk-abc123***xyz" -> "sk-a************xyz"
|
|
62
|
+
*/
|
|
63
|
+
function redactValue(value, visibleChars = 4) {
|
|
64
|
+
if (!value || value.length <= visibleChars * 2) {
|
|
65
|
+
return '<redacted>';
|
|
66
|
+
}
|
|
67
|
+
const start = value.slice(0, visibleChars);
|
|
68
|
+
const end = value.slice(-visibleChars);
|
|
69
|
+
const middleLength = value.length - (visibleChars * 2);
|
|
70
|
+
return `${start}${'•'.repeat(Math.min(middleLength, 8))}${end}`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check if a value looks like a token/key
|
|
74
|
+
*/
|
|
75
|
+
function looksLikeToken(value) {
|
|
76
|
+
const tokenPatterns = [
|
|
77
|
+
/^sk-/, /^pk_/, /^sk_/, /^ghp_/, /^gho_/, /^xoxb-/, /^xoxp-/, /^bot/,
|
|
78
|
+
/^eyJ/, /^Bearer /, /^Basic /,
|
|
79
|
+
/[a-f0-9]{32,}/i, // Hex tokens
|
|
80
|
+
];
|
|
81
|
+
return value.length > 20 && tokenPatterns.some(p => p.test(value));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Format an env var value with optional redaction
|
|
85
|
+
*/
|
|
86
|
+
function formatEnvValue(key, value, showSecrets) {
|
|
87
|
+
if (!value)
|
|
88
|
+
return '<not set>';
|
|
89
|
+
if (showSecrets)
|
|
90
|
+
return value;
|
|
91
|
+
// Check if this is a secret
|
|
92
|
+
const isSecret = isSecretKey(key) || isSecretEnvVar(key) || looksLikeToken(value);
|
|
93
|
+
if (isSecret) {
|
|
94
|
+
return redactValue(value, 4);
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Redact secrets in .env file content
|
|
100
|
+
*/
|
|
101
|
+
function redactEnvFile(content, showSecrets) {
|
|
102
|
+
if (showSecrets)
|
|
103
|
+
return content;
|
|
104
|
+
return content.split('\n').map(line => {
|
|
105
|
+
// Skip comments and empty lines
|
|
106
|
+
if (!line.trim() || line.startsWith('#'))
|
|
107
|
+
return line;
|
|
108
|
+
// Match KEY=VALUE patterns
|
|
109
|
+
const match = line.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
|
|
110
|
+
if (!match)
|
|
111
|
+
return line;
|
|
112
|
+
const [, key, rawValue] = match;
|
|
113
|
+
// Strip quotes if present
|
|
114
|
+
const value = rawValue.replace(/^["']|["']$/g, '');
|
|
115
|
+
// Check if this is a secret
|
|
116
|
+
const isSecret = isSecretKey(key) || isSecretEnvVar(key);
|
|
117
|
+
if (isSecret && value) {
|
|
118
|
+
return `${key}=${redactValue(value, 4)}`;
|
|
119
|
+
}
|
|
120
|
+
return line;
|
|
121
|
+
}).join('\n');
|
|
122
|
+
}
|
|
10
123
|
export function registerEnvCli(program) {
|
|
11
124
|
const env = program
|
|
12
125
|
.command("env")
|
|
@@ -14,7 +127,8 @@ export function registerEnvCli(program) {
|
|
|
14
127
|
env
|
|
15
128
|
.command("status")
|
|
16
129
|
.description("Show environment status")
|
|
17
|
-
.
|
|
130
|
+
.option("--show-secrets", "Reveal secret values (careful!)")
|
|
131
|
+
.action(async (opts) => {
|
|
18
132
|
console.log("📁 Environment Status");
|
|
19
133
|
console.log("═════════════════════\n");
|
|
20
134
|
// Check config directory
|
|
@@ -33,9 +147,18 @@ export function registerEnvCli(program) {
|
|
|
33
147
|
const vars = ["DISCORD_BOT_TOKEN", "DISCORD_NOTIFY_CHANNEL_ID", "NODE_ENV"];
|
|
34
148
|
vars.forEach(v => {
|
|
35
149
|
const set = !!process.env[v];
|
|
36
|
-
|
|
150
|
+
const displayValue = process.env[v]
|
|
151
|
+
? formatEnvValue(v, process.env[v], opts.showSecrets)
|
|
152
|
+
: null;
|
|
153
|
+
const status = set
|
|
154
|
+
? (opts.showSecrets ? `=${displayValue}` : `: ${displayValue}`)
|
|
155
|
+
: " (not set)";
|
|
156
|
+
console.log(` ${set ? "✅" : "❌"} ${v}${status}`);
|
|
37
157
|
});
|
|
38
|
-
|
|
158
|
+
if (!opts.showSecrets) {
|
|
159
|
+
console.log("\n🛡️ Secrets are redacted. Use --show-secrets to reveal (careful!)");
|
|
160
|
+
}
|
|
161
|
+
// Check Discord token status
|
|
39
162
|
if (process.env.DISCORD_BOT_TOKEN) {
|
|
40
163
|
console.log("\n🟢 Discord: Configured");
|
|
41
164
|
}
|
|
@@ -45,25 +168,63 @@ export function registerEnvCli(program) {
|
|
|
45
168
|
});
|
|
46
169
|
env
|
|
47
170
|
.command("show")
|
|
48
|
-
.description("Show environment variables (
|
|
49
|
-
.
|
|
50
|
-
|
|
171
|
+
.description("Show environment variables (secrets redacted by default)")
|
|
172
|
+
.option("--show-secrets", "Reveal secret values (careful!)")
|
|
173
|
+
.option("--file", "Show entire .env file content")
|
|
174
|
+
.action(async (opts) => {
|
|
175
|
+
if (opts.file) {
|
|
176
|
+
const envPath = join(CONFIG_DIR, ".env");
|
|
177
|
+
if (!existsSync(envPath)) {
|
|
178
|
+
console.log("⚠️ No .env file found");
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
console.log("📄 .env file contents");
|
|
182
|
+
console.log("════════════════════\n");
|
|
183
|
+
const content = readFileSync(envPath, "utf-8");
|
|
184
|
+
const redacted = redactEnvFile(content, opts.showSecrets);
|
|
185
|
+
console.log(redacted);
|
|
186
|
+
if (!opts.showSecrets && content !== redacted) {
|
|
187
|
+
console.log("\n🛡️ Some values are redacted. Use --show-secrets to reveal (careful!)");
|
|
188
|
+
}
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
console.log("📊 Environment Variables");
|
|
192
|
+
console.log(opts.showSecrets
|
|
193
|
+
? "⚠️ WARNING: Secrets are visible!\n"
|
|
194
|
+
: "🛡️ (Secrets automatically redacted)\n");
|
|
51
195
|
console.log("══════════════════════════════════\n");
|
|
52
|
-
|
|
196
|
+
// Get all env vars sorted
|
|
197
|
+
const sortedVars = Object.keys(process.env).sort();
|
|
198
|
+
// Known safe vars to always show first
|
|
199
|
+
const safeVars = [
|
|
53
200
|
"NODE_ENV",
|
|
54
201
|
"GATEWAY_PORT",
|
|
202
|
+
"KOBOLD_GATEWAY_HOST",
|
|
203
|
+
"KOBOLD_GATEWAY_PORT",
|
|
55
204
|
"DISCORD_NOTIFY_CHANNEL_ID",
|
|
56
205
|
];
|
|
57
|
-
|
|
206
|
+
// Show known safe vars
|
|
207
|
+
const shown = new Set();
|
|
208
|
+
for (const v of safeVars) {
|
|
58
209
|
const val = process.env[v];
|
|
59
|
-
if (val) {
|
|
210
|
+
if (val !== undefined) {
|
|
60
211
|
console.log(`${v}=${val}`);
|
|
212
|
+
shown.add(v);
|
|
61
213
|
}
|
|
62
|
-
|
|
63
|
-
|
|
214
|
+
}
|
|
215
|
+
// Show other vars (redacted if secret)
|
|
216
|
+
const otherVars = sortedVars.filter(v => !shown.has(v) && !v.startsWith('_'));
|
|
217
|
+
if (otherVars.length > 0) {
|
|
218
|
+
console.log("\n# Other variables:");
|
|
219
|
+
for (const v of otherVars) {
|
|
220
|
+
const val = process.env[v] || '<not set>';
|
|
221
|
+
const display = formatEnvValue(v, val, opts.showSecrets);
|
|
222
|
+
console.log(`${v}=${display}`);
|
|
64
223
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
224
|
+
}
|
|
225
|
+
if (!opts.showSecrets) {
|
|
226
|
+
console.log("\n🛡️ Secrets are redacted. Use --show-secrets to reveal (careful!)");
|
|
227
|
+
}
|
|
67
228
|
});
|
|
68
229
|
env
|
|
69
230
|
.command("secrets")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../src/cli/extensions/env.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../src/cli/extensions/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AAE1D,0CAA0C;AAC1C,MAAM,mBAAmB,GAAG;IAC1B,QAAQ;IACR,WAAW;IACX,SAAS;IACT,cAAc;IACd,OAAO;IACP,aAAa;IACb,UAAU;IACV,kBAAkB;CACnB,CAAC;AAEF,wDAAwD;AACxD,MAAM,gBAAgB,GAAG;IACvB,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,gBAAgB;IAChB,aAAa;IACb,qBAAqB;IACrB,gBAAgB;IA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WAAW,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🦙 Pi Ollama - Community Extension Wrapper
|
|
3
|
+
*
|
|
4
|
+
* Wraps @0xkobold/pi-ollama npm package
|
|
5
|
+
*
|
|
6
|
+
* Note: This extension is loaded via pi-config.ts
|
|
7
|
+
* The npm package is loaded via `pi install npm:@0xkobold/pi-ollama`
|
|
8
|
+
*/
|
|
9
|
+
export default async function register(pi) {
|
|
10
|
+
console.log("[🦙 PiOllama] Loading npm package...");
|
|
11
|
+
try {
|
|
12
|
+
// Dynamic import from npm package
|
|
13
|
+
const ollamaMod = await import("@0xkobold/pi-ollama");
|
|
14
|
+
const ollamaExt = ollamaMod.default;
|
|
15
|
+
if (typeof ollamaExt !== 'function') {
|
|
16
|
+
throw new Error('Pi-ollama does not export a callable default');
|
|
17
|
+
}
|
|
18
|
+
// Initialize the extension
|
|
19
|
+
await ollamaExt(pi);
|
|
20
|
+
console.log("[🦙 PiOllama] npm package loaded successfully");
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
console.error("[🦙 PiOllama] Failed to load npm package:", err);
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=pi-ollama-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi-ollama-wrapper.js","sourceRoot":"","sources":["../../../../src/extensions/community/pi-ollama-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,QAAQ,CAAC,EAAgB;IACrD,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IAEpD,IAAI,CAAC;QACH,kCAAkC;QAClC,MAAM,SAAS,GAAQ,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC3D,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;QAEpC,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QAED,2BAA2B;QAC3B,MAAM,SAAS,CAAC,EAAE,CAAC,CAAC;QAEpB,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,GAAG,CAAC,CAAC;QAChE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|