@quantiya/codevibe-claude-plugin 1.0.11 → 1.0.12
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/.claude-plugin/plugin.json +1 -1
- package/dist/server.js +16 -1162
- package/node_modules/@quantiya/codevibe-core/README.md +15 -6
- package/node_modules/@quantiya/codevibe-core/bin/codevibe.js +1 -1
- package/node_modules/@quantiya/codevibe-core/dist/index.js +216 -67
- package/node_modules/@quantiya/codevibe-core/package.json +12 -9
- package/node_modules/node-abi/abi_registry.json +7 -0
- package/node_modules/node-abi/package.json +1 -1
- package/package.json +6 -13
- package/dist/appsync-client.js +0 -858
- package/dist/auth-cli.js +0 -472
- package/dist/command-executor.js +0 -127
- package/dist/config.js +0 -106
- package/dist/crypto-service.js +0 -278
- package/dist/http-api.js +0 -334
- package/dist/key-manager.js +0 -287
- package/dist/logger.js +0 -18
- package/dist/prompt-responder.js +0 -132
- package/dist/token-storage.js +0 -169
- package/dist/types.js +0 -17
- package/node_modules/@quantiya/codevibe-core/dist/appsync/appsync-client.js +0 -576
- package/node_modules/@quantiya/codevibe-core/dist/appsync/index.js +0 -10
- package/node_modules/@quantiya/codevibe-core/dist/appsync/queries.js +0 -189
- package/node_modules/@quantiya/codevibe-core/dist/auth/auth-cli.js +0 -217
- package/node_modules/@quantiya/codevibe-core/dist/auth/auth-service.js +0 -464
- package/node_modules/@quantiya/codevibe-core/dist/auth/fetch-helpers.js +0 -165
- package/node_modules/@quantiya/codevibe-core/dist/auth/index.js +0 -9
- package/node_modules/@quantiya/codevibe-core/dist/config/config.js +0 -123
- package/node_modules/@quantiya/codevibe-core/dist/config/index.js +0 -8
- package/node_modules/@quantiya/codevibe-core/dist/crypto/crypto-service.js +0 -284
- package/node_modules/@quantiya/codevibe-core/dist/crypto/index.js +0 -9
- package/node_modules/@quantiya/codevibe-core/dist/keychain/index.js +0 -8
- package/node_modules/@quantiya/codevibe-core/dist/keychain/keychain-manager.js +0 -375
- package/node_modules/@quantiya/codevibe-core/dist/logger/index.js +0 -8
- package/node_modules/@quantiya/codevibe-core/dist/logger/logger.js +0 -142
- package/node_modules/@quantiya/codevibe-core/dist/prompt-parser.js +0 -236
- package/node_modules/@quantiya/codevibe-core/dist/session/index.js +0 -7
- package/node_modules/@quantiya/codevibe-core/dist/session/session-resume.js +0 -151
- package/node_modules/@quantiya/codevibe-core/dist/types/auth.js +0 -3
- package/node_modules/@quantiya/codevibe-core/dist/types/encryption.js +0 -3
- package/node_modules/@quantiya/codevibe-core/dist/types/events.js +0 -28
- package/node_modules/@quantiya/codevibe-core/dist/types/index.js +0 -22
- package/node_modules/@quantiya/codevibe-core/dist/types/session.js +0 -22
package/dist/prompt-responder.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PromptResponder = void 0;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
|
-
const util_1 = require("util");
|
|
6
|
-
const logger_1 = require("./logger");
|
|
7
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
8
|
-
class PromptResponder {
|
|
9
|
-
/**
|
|
10
|
-
* Answer an interactive prompt by sending input to the waiting Claude process
|
|
11
|
-
* Requires tmux session (set by codevibe-claude wrapper)
|
|
12
|
-
*/
|
|
13
|
-
async answerInteractivePrompt(sessionId, response) {
|
|
14
|
-
logger_1.logger.info('Attempting to answer interactive prompt', {
|
|
15
|
-
sessionId,
|
|
16
|
-
response,
|
|
17
|
-
});
|
|
18
|
-
try {
|
|
19
|
-
// Check if running in tmux (set by codevibe-claude wrapper)
|
|
20
|
-
const tmuxSession = process.env.CODEVIBE_TMUX_SESSION;
|
|
21
|
-
logger_1.logger.info('Checking tmux session environment', {
|
|
22
|
-
tmuxSession: tmuxSession || '(not set)',
|
|
23
|
-
allEnvKeys: Object.keys(process.env).filter(k => k.includes('CODEVIBE') || k.includes('TMUX')),
|
|
24
|
-
});
|
|
25
|
-
if (!tmuxSession) {
|
|
26
|
-
logger_1.logger.error('No tmux session found - codevibe-claude wrapper is required', {
|
|
27
|
-
sessionId,
|
|
28
|
-
hint: 'Start Claude Code using the codevibe-claude wrapper script',
|
|
29
|
-
});
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
// Use tmux send-keys (works even when screen is locked)
|
|
33
|
-
logger_1.logger.info('Using tmux send-keys', { tmuxSession });
|
|
34
|
-
await this.sendViaTmux(tmuxSession, response);
|
|
35
|
-
logger_1.logger.info('Successfully sent response to interactive prompt', {
|
|
36
|
-
sessionId,
|
|
37
|
-
response,
|
|
38
|
-
});
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
logger_1.logger.error('Failed to answer interactive prompt', {
|
|
43
|
-
sessionId,
|
|
44
|
-
error: error instanceof Error ? error.message : String(error),
|
|
45
|
-
});
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Send input via tmux send-keys
|
|
51
|
-
* Works even when screen is locked - this is the only supported method
|
|
52
|
-
*/
|
|
53
|
-
async sendViaTmux(sessionName, input) {
|
|
54
|
-
// Escape special characters for tmux
|
|
55
|
-
// tmux send-keys interprets certain sequences, so we need to escape them
|
|
56
|
-
const escaped = input
|
|
57
|
-
.replace(/\\/g, '\\\\') // Escape backslashes first
|
|
58
|
-
.replace(/"/g, '\\"') // Escape double quotes
|
|
59
|
-
.replace(/\$/g, '\\$') // Escape dollar signs
|
|
60
|
-
.replace(/`/g, '\\`'); // Escape backticks
|
|
61
|
-
logger_1.logger.info('Sending via tmux', { sessionName, inputLength: input.length });
|
|
62
|
-
try {
|
|
63
|
-
// Step 1: Send the input text (without Enter)
|
|
64
|
-
const textCmd = `tmux send-keys -t "${sessionName}" -l "${escaped}"`;
|
|
65
|
-
const textResult = await execAsync(textCmd);
|
|
66
|
-
logger_1.logger.info('tmux send-keys (text) completed', {
|
|
67
|
-
stdout: textResult.stdout || '(empty)',
|
|
68
|
-
stderr: textResult.stderr || '(empty)'
|
|
69
|
-
});
|
|
70
|
-
// Step 2: Wait for the text to be processed by the terminal
|
|
71
|
-
// Longer delay needed for Claude Code's interactive prompts
|
|
72
|
-
await this.delay(500);
|
|
73
|
-
// Step 3: Send Enter key separately
|
|
74
|
-
const enterCmd = `tmux send-keys -t "${sessionName}" Enter`;
|
|
75
|
-
const enterResult = await execAsync(enterCmd);
|
|
76
|
-
logger_1.logger.info('tmux send-keys (Enter) completed', {
|
|
77
|
-
stdout: enterResult.stdout || '(empty)',
|
|
78
|
-
stderr: enterResult.stderr || '(empty)'
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
logger_1.logger.error('tmux send-keys failed', { sessionName, error });
|
|
83
|
-
throw error;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Simple delay helper
|
|
88
|
-
*/
|
|
89
|
-
delay(ms) {
|
|
90
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Check if a response looks like an answer to an interactive prompt
|
|
94
|
-
* Covers Y/N prompts, numbered choices, and other common responses
|
|
95
|
-
*/
|
|
96
|
-
isPromptResponse(content) {
|
|
97
|
-
const normalized = content.trim().toLowerCase();
|
|
98
|
-
// Y/N responses
|
|
99
|
-
if (normalized === 'y' ||
|
|
100
|
-
normalized === 'n' ||
|
|
101
|
-
normalized === 'yes' ||
|
|
102
|
-
normalized === 'no') {
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
// Numbered choices (1-9, or just digits)
|
|
106
|
-
if (/^[0-9]+$/.test(normalized)) {
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
// Single letter choices (a, b, c, etc.)
|
|
110
|
-
if (/^[a-z]$/.test(normalized)) {
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
// Common terminal control inputs
|
|
114
|
-
// These are typically responses to prompts, not new commands
|
|
115
|
-
const controlInputs = [
|
|
116
|
-
'exit',
|
|
117
|
-
'quit',
|
|
118
|
-
'q',
|
|
119
|
-
'continue',
|
|
120
|
-
'skip',
|
|
121
|
-
'abort',
|
|
122
|
-
'retry',
|
|
123
|
-
'cancel',
|
|
124
|
-
];
|
|
125
|
-
if (controlInputs.includes(normalized)) {
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.PromptResponder = PromptResponder;
|
|
132
|
-
//# sourceMappingURL=prompt-responder.js.map
|
package/dist/token-storage.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.saveTokens = saveTokens;
|
|
37
|
-
exports.loadTokens = loadTokens;
|
|
38
|
-
exports.deleteTokens = deleteTokens;
|
|
39
|
-
exports.isTokenExpired = isTokenExpired;
|
|
40
|
-
exports.isAuthenticated = isAuthenticated;
|
|
41
|
-
exports.getTokenFilePath = getTokenFilePath;
|
|
42
|
-
exports.getTokenExpiration = getTokenExpiration;
|
|
43
|
-
const fs = __importStar(require("fs"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
const os = __importStar(require("os"));
|
|
46
|
-
const logger_1 = require("./logger");
|
|
47
|
-
// Token storage location - environment-specific
|
|
48
|
-
const TOKEN_DIR = path.join(os.homedir(), '.codevibe-claude');
|
|
49
|
-
// Get environment-specific token file
|
|
50
|
-
function getTokenFile() {
|
|
51
|
-
const environment = process.env.ENVIRONMENT || 'production';
|
|
52
|
-
return path.join(TOKEN_DIR, `tokens-${environment}.json`);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Ensure the token directory exists with proper permissions
|
|
56
|
-
*/
|
|
57
|
-
function ensureTokenDir() {
|
|
58
|
-
if (!fs.existsSync(TOKEN_DIR)) {
|
|
59
|
-
fs.mkdirSync(TOKEN_DIR, { mode: 0o700 }); // rwx------
|
|
60
|
-
logger_1.logger.debug('Created token directory', { path: TOKEN_DIR });
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Save tokens to secure file storage
|
|
65
|
-
*/
|
|
66
|
-
function saveTokens(tokens) {
|
|
67
|
-
try {
|
|
68
|
-
ensureTokenDir();
|
|
69
|
-
const tokenFile = getTokenFile();
|
|
70
|
-
const content = JSON.stringify(tokens, null, 2);
|
|
71
|
-
fs.writeFileSync(tokenFile, content, { mode: 0o600 }); // rw-------
|
|
72
|
-
logger_1.logger.info('Tokens saved successfully', {
|
|
73
|
-
userId: tokens.userId,
|
|
74
|
-
email: tokens.email,
|
|
75
|
-
expiresAt: new Date(tokens.expiresAt).toISOString(),
|
|
76
|
-
environment: process.env.ENVIRONMENT || 'production',
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
logger_1.logger.error('Failed to save tokens:', error);
|
|
81
|
-
throw new Error(`Failed to save tokens: ${error}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Load tokens from secure file storage
|
|
86
|
-
* Returns null if no tokens are stored or if they're invalid
|
|
87
|
-
*/
|
|
88
|
-
function loadTokens() {
|
|
89
|
-
try {
|
|
90
|
-
const tokenFile = getTokenFile();
|
|
91
|
-
if (!fs.existsSync(tokenFile)) {
|
|
92
|
-
logger_1.logger.debug('No tokens file found', { environment: process.env.ENVIRONMENT || 'production' });
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
const content = fs.readFileSync(tokenFile, 'utf-8');
|
|
96
|
-
const tokens = JSON.parse(content);
|
|
97
|
-
// Validate required fields
|
|
98
|
-
if (!tokens.accessToken || !tokens.refreshToken || !tokens.expiresAt) {
|
|
99
|
-
logger_1.logger.warn('Invalid tokens file - missing required fields');
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
logger_1.logger.debug('Tokens loaded', {
|
|
103
|
-
userId: tokens.userId,
|
|
104
|
-
email: tokens.email,
|
|
105
|
-
expiresAt: new Date(tokens.expiresAt).toISOString(),
|
|
106
|
-
isExpired: isTokenExpired(tokens),
|
|
107
|
-
});
|
|
108
|
-
return tokens;
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
logger_1.logger.error('Failed to load tokens:', error);
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Delete stored tokens (logout)
|
|
117
|
-
*/
|
|
118
|
-
function deleteTokens() {
|
|
119
|
-
try {
|
|
120
|
-
const tokenFile = getTokenFile();
|
|
121
|
-
if (fs.existsSync(tokenFile)) {
|
|
122
|
-
fs.unlinkSync(tokenFile);
|
|
123
|
-
logger_1.logger.info('Tokens deleted successfully', { environment: process.env.ENVIRONMENT || 'production' });
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
logger_1.logger.debug('No tokens file to delete', { environment: process.env.ENVIRONMENT || 'production' });
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
logger_1.logger.error('Failed to delete tokens:', error);
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Check if the access token is expired or about to expire
|
|
136
|
-
* Considers token expired if less than 5 minutes remaining
|
|
137
|
-
*/
|
|
138
|
-
function isTokenExpired(tokens) {
|
|
139
|
-
const bufferMs = 5 * 60 * 1000; // 5 minutes buffer
|
|
140
|
-
return Date.now() >= (tokens.expiresAt - bufferMs);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Check if user is authenticated (has valid, non-expired tokens)
|
|
144
|
-
*/
|
|
145
|
-
function isAuthenticated() {
|
|
146
|
-
const tokens = loadTokens();
|
|
147
|
-
if (!tokens) {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
// Even if access token is expired, we can refresh if we have a refresh token
|
|
151
|
-
return !!tokens.refreshToken;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Get the token file path (for display purposes)
|
|
155
|
-
*/
|
|
156
|
-
function getTokenFilePath() {
|
|
157
|
-
return getTokenFile();
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Get token expiration date
|
|
161
|
-
*/
|
|
162
|
-
function getTokenExpiration() {
|
|
163
|
-
const tokens = loadTokens();
|
|
164
|
-
if (!tokens) {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
return new Date(tokens.expiresAt);
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=token-storage.js.map
|
package/dist/types.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//
|
|
3
|
-
// types.ts
|
|
4
|
-
// CodeVibe Claude Plugin
|
|
5
|
-
//
|
|
6
|
-
// Re-export shared types from codevibe-core and define plugin-specific types
|
|
7
|
-
//
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.AgentType = exports.SessionStatus = exports.DeliveryStatus = exports.EventSource = exports.EventType = void 0;
|
|
10
|
-
// Re-export all shared types from core
|
|
11
|
-
var codevibe_core_1 = require("@quantiya/codevibe-core");
|
|
12
|
-
Object.defineProperty(exports, "EventType", { enumerable: true, get: function () { return codevibe_core_1.EventType; } });
|
|
13
|
-
Object.defineProperty(exports, "EventSource", { enumerable: true, get: function () { return codevibe_core_1.EventSource; } });
|
|
14
|
-
Object.defineProperty(exports, "DeliveryStatus", { enumerable: true, get: function () { return codevibe_core_1.DeliveryStatus; } });
|
|
15
|
-
Object.defineProperty(exports, "SessionStatus", { enumerable: true, get: function () { return codevibe_core_1.SessionStatus; } });
|
|
16
|
-
Object.defineProperty(exports, "AgentType", { enumerable: true, get: function () { return codevibe_core_1.AgentType; } });
|
|
17
|
-
//# sourceMappingURL=types.js.map
|