@teamvibe/poller 0.1.19 → 0.1.21
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/dist/brain-manager.d.ts +5 -0
- package/dist/brain-manager.js +18 -2
- package/dist/poller.js +2 -1
- package/package.json +1 -1
package/dist/brain-manager.d.ts
CHANGED
package/dist/brain-manager.js
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
import { exec } from 'child_process';
|
|
2
2
|
import { promisify } from 'util';
|
|
3
|
-
import { existsSync, mkdirSync } from 'fs';
|
|
3
|
+
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
import { config } from './config.js';
|
|
6
6
|
import { logger } from './logger.js';
|
|
7
7
|
const execAsync = promisify(exec);
|
|
8
|
-
// Clean env for git commands — npm/npx sets GIT_ASKPASS
|
|
8
|
+
// Clean env for git commands — npm/npx sets GIT_ASKPASS which
|
|
9
9
|
// prevents git credential helpers (like gh) from working.
|
|
10
10
|
const gitEnv = { ...process.env };
|
|
11
11
|
delete gitEnv['GIT_ASKPASS'];
|
|
12
12
|
function gitExec(command, options) {
|
|
13
13
|
return execAsync(command, { ...options, env: gitEnv });
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Configure git credentials from GITHUB_TOKEN env var.
|
|
17
|
+
* Uses git credential store so tokens don't appear in remote URLs.
|
|
18
|
+
*/
|
|
19
|
+
export async function configureGitAuth() {
|
|
20
|
+
const token = process.env['GITHUB_TOKEN'];
|
|
21
|
+
if (!token) {
|
|
22
|
+
logger.info('GITHUB_TOKEN not set, skipping git auth configuration');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const home = process.env['HOME'] || '/root';
|
|
26
|
+
const credentialsPath = join(home, '.git-credentials');
|
|
27
|
+
writeFileSync(credentialsPath, `https://x-access-token:${token}@github.com\n`, { mode: 0o600 });
|
|
28
|
+
await execAsync('git config --global credential.helper store');
|
|
29
|
+
logger.info('Git credentials configured from GITHUB_TOKEN');
|
|
30
|
+
}
|
|
15
31
|
// Cooldown tracker per brain
|
|
16
32
|
const lastUpdateTimes = new Map();
|
|
17
33
|
/**
|
package/dist/poller.js
CHANGED
|
@@ -4,7 +4,7 @@ import { pollMessages, deleteMessage, extendVisibility, } from './sqs-poller.js'
|
|
|
4
4
|
import { spawnClaudeCode, isAtCapacity, getActiveProcessCount } from './claude-spawner.js';
|
|
5
5
|
import { sendSlackError, addReaction, getUserInfo, startTypingIndicator } from './slack-client.js';
|
|
6
6
|
import { acquireSessionLock, releaseSessionLock, updateSessionId } from './session-store.js';
|
|
7
|
-
import { getBrainPath, ensureDirectories, ensureBaseBrain, pushBrainChanges } from './brain-manager.js';
|
|
7
|
+
import { getBrainPath, ensureDirectories, ensureBaseBrain, pushBrainChanges, configureGitAuth } from './brain-manager.js';
|
|
8
8
|
import { initAuth, stopRefresh } from './auth-provider.js';
|
|
9
9
|
// Track active message processing
|
|
10
10
|
const processingMessages = new Set();
|
|
@@ -254,6 +254,7 @@ export async function startPoller() {
|
|
|
254
254
|
logger.info(` Queue: ${config.SQS_QUEUE_URL}`);
|
|
255
255
|
logger.info(` Sessions table: ${config.SESSIONS_TABLE}`);
|
|
256
256
|
}
|
|
257
|
+
await configureGitAuth();
|
|
257
258
|
await ensureDirectories();
|
|
258
259
|
await ensureBaseBrain();
|
|
259
260
|
await pollLoop();
|