@aivin-labs/cli 1.0.4 → 1.0.8
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 +263 -216
- package/bin/cli.mjs +1780 -1361
- package/bin/lib/browserAutomation.mjs +655 -648
- package/bin/lib/browserTui.mjs +276 -245
- package/bin/lib/cancellation.mjs +61 -0
- package/bin/lib/codegen.mjs +61 -5
- package/bin/lib/connectors.mjs +55 -21
- package/bin/lib/deploy.mjs +25 -2
- package/bin/lib/mcpProxy.mjs +869 -773
- package/bin/lib/mission.mjs +13 -1
- package/bin/lib/missionStream.mjs +696 -660
- package/bin/lib/pluginAuthResolve.mjs +127 -0
- package/bin/lib/pluginTrigger.mjs +207 -90
- package/bin/lib/releaseKeys.mjs +9 -0
- package/bin/lib/remote/activityLog.mjs +68 -0
- package/bin/lib/remote/autoStart.mjs +457 -0
- package/bin/lib/remote/autoUpdate.mjs +129 -0
- package/bin/lib/remote/brand.mjs +60 -0
- package/bin/lib/remote/browserTunnel.mjs +292 -0
- package/bin/lib/remote/callLedger.mjs +134 -0
- package/bin/lib/remote/cdpPolicy.mjs +66 -0
- package/bin/lib/remote/client.mjs +726 -0
- package/bin/lib/remote/constants.mjs +173 -0
- package/bin/lib/remote/credentials.mjs +208 -0
- package/bin/lib/remote/daemonLock.mjs +86 -0
- package/bin/lib/remote/dailyBrowser.mjs +371 -0
- package/bin/lib/remote/deviceMemory.mjs +246 -0
- package/bin/lib/remote/deviceProfile.mjs +142 -0
- package/bin/lib/remote/deviceWatches.mjs +138 -0
- package/bin/lib/remote/docText.mjs +117 -0
- package/bin/lib/remote/fileIndexer.mjs +399 -0
- package/bin/lib/remote/gui/index.mjs +245 -0
- package/bin/lib/remote/gui/officeHostSource.mjs +393 -0
- package/bin/lib/remote/gui/windowsHost.mjs +109 -0
- package/bin/lib/remote/gui/windowsHostSource.mjs +904 -0
- package/bin/lib/remote/httpTransfer.mjs +89 -0
- package/bin/lib/remote/idempotency.mjs +135 -0
- package/bin/lib/remote/keepAwake.mjs +100 -0
- package/bin/lib/remote/localConfirm.mjs +268 -0
- package/bin/lib/remote/localPolicy.mjs +249 -0
- package/bin/lib/remote/mascot/assets.mjs +218 -0
- package/bin/lib/remote/mascot/hostSource.mjs +362 -0
- package/bin/lib/remote/mascot/index.mjs +322 -0
- package/bin/lib/remote/mascot/labels.mjs +83 -0
- package/bin/lib/remote/mascot/strings.mjs +189 -0
- package/bin/lib/remote/memberFsPool.mjs +134 -0
- package/bin/lib/remote/memberFsWorker.mjs +60 -0
- package/bin/lib/remote/mission.mjs +156 -0
- package/bin/lib/remote/missionQuestion.mjs +63 -0
- package/bin/lib/remote/multiUser.mjs +344 -0
- package/bin/lib/remote/netProxy.mjs +145 -0
- package/bin/lib/remote/notify.mjs +58 -0
- package/bin/lib/remote/office/index.mjs +90 -0
- package/bin/lib/remote/policyCommand.mjs +93 -0
- package/bin/lib/remote/processes.mjs +217 -0
- package/bin/lib/remote/sandbox.mjs +221 -0
- package/bin/lib/remote/schedule.mjs +213 -0
- package/bin/lib/remote/scheduler.mjs +124 -0
- package/bin/lib/remote/textIndex.mjs +131 -0
- package/bin/lib/remote/tokenStore.mjs +77 -0
- package/bin/lib/remote/toolHandlers.mjs +726 -0
- package/bin/lib/remote/undoStore.mjs +242 -0
- package/bin/lib/remoteControl.mjs +26 -0
- package/bin/lib/scaffold.mjs +654 -653
- package/bin/lib/selfUpdate.mjs +71 -0
- package/bin/lib/store.mjs +16 -2
- package/bin/lib/tasks.mjs +52 -8
- package/bin/lib/update/binarySwap.mjs +63 -0
- package/bin/lib/update/constants.mjs +56 -0
- package/bin/lib/update/download.mjs +145 -0
- package/bin/lib/update/signature.mjs +42 -0
- package/bin/lib/update/state.mjs +205 -0
- package/bin/lib/update/versions.mjs +60 -0
- package/bin/lib/util.mjs +8 -0
- package/docs/CLI.md +1353 -1274
- package/package.json +71 -62
package/bin/lib/codegen.mjs
CHANGED
|
@@ -573,11 +573,18 @@ export function buildProjectTree(dir, basePath = '', entries = []) {
|
|
|
573
573
|
if (entries.length >= CONVERT_MAX_TREE_ENTRIES) break;
|
|
574
574
|
const fullPath = path.join(dir, item);
|
|
575
575
|
const relativePath = path.join(basePath, item).split(path.sep).join('/');
|
|
576
|
-
|
|
577
|
-
|
|
576
|
+
// lstat (not stat) so a symlink is never followed here - stat() would happily report a
|
|
577
|
+
// symlink-to-directory as isDirectory()==true and recurse into it, walking (and later, via
|
|
578
|
+
// resolveProjectPath/executeProjectTool, reading) whatever it actually points to outside the
|
|
579
|
+
// project (e.g. a symlink committed into a project pulled from an untrusted source pointing at
|
|
580
|
+
// ~/.ssh or ~/.aivin/credentials). Silently skipping is fine - a real project source file is
|
|
581
|
+
// never a symlink.
|
|
582
|
+
const lstat = fs.lstatSync(fullPath);
|
|
583
|
+
if (lstat.isSymbolicLink()) continue;
|
|
584
|
+
if (lstat.isDirectory()) {
|
|
578
585
|
if (!CONVERT_EXCLUDE_DIRS.includes(item)) buildProjectTree(fullPath, relativePath, entries);
|
|
579
586
|
} else if (!CONVERT_EXCLUDE_FILES.includes(item) && !isEnvFile(item) && !CONVERT_BINARY_EXT.test(item)) {
|
|
580
|
-
entries.push({ path: relativePath, size:
|
|
587
|
+
entries.push({ path: relativePath, size: lstat.size });
|
|
581
588
|
}
|
|
582
589
|
}
|
|
583
590
|
return entries;
|
|
@@ -586,7 +593,15 @@ export function buildProjectTree(dir, basePath = '', entries = []) {
|
|
|
586
593
|
/** Resolves a backend-requested relative path against the real project directory, rejecting
|
|
587
594
|
* anything that would escape it. This is the actual security boundary for the tool-call relay -
|
|
588
595
|
* the backend validates paths too (assertSafeProjectPath), but this process is the one holding
|
|
589
|
-
* the real filesystem, so this check is the one that actually matters.
|
|
596
|
+
* the real filesystem, so this check is the one that actually matters.
|
|
597
|
+
*
|
|
598
|
+
* ✅ FIX: the lexical `startsWith` check alone only catches `../`-style escapes - a symlink
|
|
599
|
+
* physically located INSIDE the project (e.g. `project/link -> ~/.ssh` or `-> C:\Users\<user>`)
|
|
600
|
+
* has a lexically-valid, in-bounds path while its *real* target is anywhere on disk. Re-resolving
|
|
601
|
+
* through `fs.realpathSync` after the lexical check catches that: read_file/create_file/
|
|
602
|
+
* confirm_update all funnel through here, so a backend-driven (or AI-hallucinated, or a
|
|
603
|
+
* compromised backend's) tool-call requesting a project-relative path that happens to traverse
|
|
604
|
+
* such a symlink can no longer read/write files outside the project undetected. */
|
|
590
605
|
export function resolveProjectPath(currentDir, requestedPath) {
|
|
591
606
|
if (typeof requestedPath !== 'string' || !requestedPath) throw new Error('Invalid path');
|
|
592
607
|
const resolved = path.resolve(currentDir, requestedPath);
|
|
@@ -594,6 +609,20 @@ export function resolveProjectPath(currentDir, requestedPath) {
|
|
|
594
609
|
if (resolved !== currentDir && !resolved.startsWith(rootWithSep)) {
|
|
595
610
|
throw new Error(`Path escapes project directory: ${requestedPath}`);
|
|
596
611
|
}
|
|
612
|
+
// Symlink re-check: skip if the path doesn't exist yet (e.g. create_file writing a brand new
|
|
613
|
+
// file/directory - nothing to resolve, and the write itself lands at `resolved` on disk, not
|
|
614
|
+
// through any symlink since none exists there yet).
|
|
615
|
+
let real;
|
|
616
|
+
try {
|
|
617
|
+
real = fs.realpathSync(resolved);
|
|
618
|
+
} catch {
|
|
619
|
+
return resolved;
|
|
620
|
+
}
|
|
621
|
+
const realRoot = fs.realpathSync(currentDir);
|
|
622
|
+
const realRootWithSep = realRoot.endsWith(path.sep) ? realRoot : realRoot + path.sep;
|
|
623
|
+
if (real !== realRoot && !real.startsWith(realRootWithSep)) {
|
|
624
|
+
throw new Error(`Path escapes project directory (symlink): ${requestedPath}`);
|
|
625
|
+
}
|
|
597
626
|
return resolved;
|
|
598
627
|
}
|
|
599
628
|
|
|
@@ -652,7 +681,11 @@ export async function executeProjectTool(currentDir, tool, args) {
|
|
|
652
681
|
if (matches.length >= 20) return;
|
|
653
682
|
const fullPath = path.join(dir, item);
|
|
654
683
|
const rel = path.join(base, item).split(path.sep).join('/');
|
|
655
|
-
|
|
684
|
+
// lstat, not stat - this walker never goes through resolveProjectPath, so it needs its
|
|
685
|
+
// own symlink guard (same reasoning as buildProjectTree above) to avoid grepping through
|
|
686
|
+
// a symlink out of the project.
|
|
687
|
+
const stat = fs.lstatSync(fullPath);
|
|
688
|
+
if (stat.isSymbolicLink()) continue;
|
|
656
689
|
if (stat.isDirectory()) {
|
|
657
690
|
if (!CONVERT_EXCLUDE_DIRS.includes(item)) walk(fullPath, rel);
|
|
658
691
|
} else if (!CONVERT_BINARY_EXT.test(item) && stat.size > 0 && stat.size <= 200_000) {
|
|
@@ -722,6 +755,29 @@ export async function connectProjectToolServer(serverUrl, apiKey, codeId, curren
|
|
|
722
755
|
throw error;
|
|
723
756
|
}
|
|
724
757
|
|
|
758
|
+
// ✅ FIX: no 'error' listener registered at all after the initial connect - a server-side
|
|
759
|
+
// socket.io error later in the (potentially several-minute) scan/plan/generate/verify loop would
|
|
760
|
+
// crash the whole CLI process instead of just being visible as a log line.
|
|
761
|
+
socket.on('error', (error) => {
|
|
762
|
+
console.log(chalk.red(` Socket error: ${error?.message || error}`));
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
// ✅ FIX: `code:join` was only ever emitted once, before this promise resolved - `reconnection:
|
|
766
|
+
// true` means the client transparently reconnects on a network blip, but the server-side room
|
|
767
|
+
// membership from the original `code:join` is gone with the old connection. Without re-joining,
|
|
768
|
+
// the tool-call relay silently "dies" after a reconnect (no more code:tool_call/code:progress
|
|
769
|
+
// ever arrives) while the backend's own HTTP request just keeps waiting until its own timeout -
|
|
770
|
+
// no early warning to the user that anything went wrong.
|
|
771
|
+
socket.on('reconnect', () => {
|
|
772
|
+
socket.emit('code:join', { code_id: codeId }, (ack) => {
|
|
773
|
+
if (!ack?.success) {
|
|
774
|
+
console.log(chalk.yellow(`⚠️ Reconnected but couldn't rejoin conversion session: ${ack?.error || 'unknown error'} - tool calls may stop arriving.`));
|
|
775
|
+
} else {
|
|
776
|
+
console.log(chalk.gray(' (reconnected)'));
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
});
|
|
780
|
+
|
|
725
781
|
socket.on('code:tool_call', async (payload) => {
|
|
726
782
|
const { call_id, tool, args } = payload || {};
|
|
727
783
|
try {
|
package/bin/lib/connectors.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import inquirer from 'inquirer';
|
|
4
4
|
import { trustBadge, browseResults } from './pluginTrigger.mjs';
|
|
5
|
-
import { withSpinner } from './util.mjs';
|
|
5
|
+
import { withSpinner, DEFAULT_API_TIMEOUT_MS } from './util.mjs';
|
|
6
6
|
|
|
7
7
|
// ── Connectors - reusable OAuth apps / credential-form namespaces plugins can reference ────────
|
|
8
8
|
|
|
@@ -11,7 +11,11 @@ export function connectorAuthHeaders() {
|
|
|
11
11
|
if (!apiKey) {
|
|
12
12
|
console.log(chalk.yellow('⚠️ API_KEY not set - run `aivin login` first'));
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
// ✅ FIX: no call site in this file set a `timeout` before - worst case was `registerConnector`,
|
|
15
|
+
// where a hang meant re-typing an entire OAuth client_secret from scratch after Ctrl+C. Setting it
|
|
16
|
+
// once here (this object is passed straight through as the axios config everywhere it's used)
|
|
17
|
+
// covers every call site.
|
|
18
|
+
return { headers: { Authorization: `Bearer ${apiKey || 'dev-token'}` }, timeout: DEFAULT_API_TIMEOUT_MS };
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
export function connectorBaseUrl() {
|
|
@@ -34,12 +38,16 @@ export function formatConnectorDetail(connector) {
|
|
|
34
38
|
lines.push(`${chalk.gray('type')} ${connector.type}`);
|
|
35
39
|
lines.push(`${chalk.gray('visibility')} ${connector.visibility}${connector.store_status ? ` (${connector.store_status})` : ''}`);
|
|
36
40
|
if (connector.description) lines.push(`\n${connector.description}`);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
lines.push(`\n${chalk.gray('
|
|
41
|
+
// Backend's ConnectorManifest nests OAuth/form details under `config` (discriminated by `type`) -
|
|
42
|
+
// not top-level `oauth`/`fields` (see ConnectorDTO.ts's RegisterConnectorDto/ConnectorManifest and
|
|
43
|
+
// ConnectorService.sanitize, which keeps `config` intact). Reading the wrong path here used to
|
|
44
|
+
// print an empty detail section for every connector regardless of what it actually holds.
|
|
45
|
+
if (connector.type === 'oauth' && connector.config) {
|
|
46
|
+
lines.push(`\n${chalk.gray('authorize_url')} ${connector.config.authorize_url}`);
|
|
47
|
+
lines.push(`${chalk.gray('access_url')} ${connector.config.access_url}`);
|
|
48
|
+
if (connector.config.scopes?.length) lines.push(`${chalk.gray('scopes')} ${connector.config.scopes.join(', ')}`);
|
|
49
|
+
} else if (connector.type === 'credential_form' && connector.config?.fields?.length) {
|
|
50
|
+
lines.push(`\n${chalk.gray('fields')}\n${connector.config.fields.map(f => ` - ${f.name}${f.required ? ' (required)' : ''}${f.label ? `: ${f.label}` : ''}`).join('\n')}`);
|
|
43
51
|
}
|
|
44
52
|
lines.push(chalk.gray(`\nReference it from a plugin manifest's connection_id: "${connector.id}"`));
|
|
45
53
|
return lines.join('\n');
|
|
@@ -109,6 +117,40 @@ export async function listConnectors(options) {
|
|
|
109
117
|
}
|
|
110
118
|
}
|
|
111
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Pure assembly of the request body `POST /connectors/register` expects, split out of
|
|
122
|
+
* registerConnector() so it's unit-testable without stubbing inquirer prompts - this exact
|
|
123
|
+
* assembly (nesting under `config`, not top-level `oauth`/`fields`) is what drifted from the
|
|
124
|
+
* backend's actual RegisterConnectorDto before and broke every registration; a regression test
|
|
125
|
+
* pins the shape down going forward. `oauthAnswers`/`fields` are already-collected inquirer
|
|
126
|
+
* answers, not prompted here.
|
|
127
|
+
*/
|
|
128
|
+
export function buildRegisterConnectorDto(base, { oauthAnswers, fields } = {}) {
|
|
129
|
+
const dto = { id: base.id, name: base.name, description: base.description || undefined, image: base.image || undefined, type: base.type, visibility: base.visibility };
|
|
130
|
+
|
|
131
|
+
// ⚠ Backend's RegisterConnectorDto expects these nested under `config` (discriminated by `type` -
|
|
132
|
+
// see ConnectorDTO.ts / ConnectorService.register, which reads `dto.config.authorize_url` /
|
|
133
|
+
// `dto.config.fields`, never a top-level `dto.oauth`/`dto.fields`). This used to send them
|
|
134
|
+
// top-level, which the backend's `config` field (now validated with `@IsObject()`, previously
|
|
135
|
+
// silently stripped by the global whitelist ValidationPipe for having no class-validator
|
|
136
|
+
// decorators at all) would see as missing/wrong-shaped - registration failed every time regardless
|
|
137
|
+
// of what was typed here.
|
|
138
|
+
if (base.type === 'oauth') {
|
|
139
|
+
dto.config = {
|
|
140
|
+
authorize_url: oauthAnswers.authorize_url,
|
|
141
|
+
access_url: oauthAnswers.access_url,
|
|
142
|
+
profile_url: oauthAnswers.profile_url || undefined,
|
|
143
|
+
client_id: oauthAnswers.client_id,
|
|
144
|
+
client_secret: oauthAnswers.client_secret,
|
|
145
|
+
scopes: oauthAnswers.scopes ? oauthAnswers.scopes.split(',').map((s) => s.trim()).filter(Boolean) : [],
|
|
146
|
+
};
|
|
147
|
+
} else {
|
|
148
|
+
if (!fields || fields.length === 0) throw new Error('credential_form connectors need at least one field');
|
|
149
|
+
dto.config = { fields };
|
|
150
|
+
}
|
|
151
|
+
return dto;
|
|
152
|
+
}
|
|
153
|
+
|
|
112
154
|
export async function registerConnector() {
|
|
113
155
|
console.log(chalk.blue('🔌 Register a new connector\n'));
|
|
114
156
|
|
|
@@ -137,10 +179,9 @@ export async function registerConnector() {
|
|
|
137
179
|
},
|
|
138
180
|
]);
|
|
139
181
|
|
|
140
|
-
|
|
141
|
-
|
|
182
|
+
let oauthAnswers, fields;
|
|
142
183
|
if (base.type === 'oauth') {
|
|
143
|
-
|
|
184
|
+
oauthAnswers = await inquirer.prompt([
|
|
144
185
|
{ type: 'input', name: 'authorize_url', message: 'Authorize URL:' },
|
|
145
186
|
{ type: 'input', name: 'access_url', message: 'Token/access URL:' },
|
|
146
187
|
{ type: 'input', name: 'profile_url', message: 'Profile URL (optional):' },
|
|
@@ -148,16 +189,8 @@ export async function registerConnector() {
|
|
|
148
189
|
{ type: 'password', name: 'client_secret', message: 'Client secret:' },
|
|
149
190
|
{ type: 'input', name: 'scopes', message: 'Scopes (comma-separated, optional):' },
|
|
150
191
|
]);
|
|
151
|
-
dto.oauth = {
|
|
152
|
-
authorize_url: oauth.authorize_url,
|
|
153
|
-
access_url: oauth.access_url,
|
|
154
|
-
profile_url: oauth.profile_url || undefined,
|
|
155
|
-
client_id: oauth.client_id,
|
|
156
|
-
client_secret: oauth.client_secret,
|
|
157
|
-
scopes: oauth.scopes ? oauth.scopes.split(',').map((s) => s.trim()).filter(Boolean) : [],
|
|
158
|
-
};
|
|
159
192
|
} else {
|
|
160
|
-
|
|
193
|
+
fields = [];
|
|
161
194
|
console.log(chalk.gray('Add the fields a user must fill in (leave name blank to stop):'));
|
|
162
195
|
for (;;) {
|
|
163
196
|
const f = await inquirer.prompt([
|
|
@@ -172,9 +205,10 @@ export async function registerConnector() {
|
|
|
172
205
|
fields.push({ name: f.name, label: rest.label || undefined, type: rest.type, required: rest.required });
|
|
173
206
|
}
|
|
174
207
|
if (fields.length === 0) throw new Error('credential_form connectors need at least one field');
|
|
175
|
-
dto.fields = fields;
|
|
176
208
|
}
|
|
177
209
|
|
|
210
|
+
const dto = buildRegisterConnectorDto(base, { oauthAnswers, fields });
|
|
211
|
+
|
|
178
212
|
// Warn about likely-duplicate connectors before submitting - registering "Gmail" when
|
|
179
213
|
// official.google already covers the same thing just fragments the catalog.
|
|
180
214
|
try {
|
package/bin/lib/deploy.mjs
CHANGED
|
@@ -17,6 +17,15 @@ export const DEPLOY_EXCLUDE_FILES = ['.gitignore', 'yarn.lock'];
|
|
|
17
17
|
// secrets and must never end up in the uploaded `files` payload.
|
|
18
18
|
export const isEnvFile = (name) => name === '.env' || name.startsWith('.env.');
|
|
19
19
|
|
|
20
|
+
// ✅ FIX: readDirectoryRecursive used to read EVERY file with `fs.readFileSync(fullPath, 'utf8')`
|
|
21
|
+
// unconditionally - any binary asset (image, font, .wasm, a zip fixture used by a test) gets
|
|
22
|
+
// decoded as UTF-8 text and silently mangled before upload, with no warning anywhere. The backend's
|
|
23
|
+
// PluginDeployRequestDto only ever accepts `files` as plain UTF-8 string content (no base64/binary
|
|
24
|
+
// path exists there), so there is currently no way to deploy a binary asset correctly through this
|
|
25
|
+
// command - skipping with a clear warning is strictly better than corrupting it and finding out only
|
|
26
|
+
// when the deployed plugin is actually exercised. Same extension list `plugin convert` already uses.
|
|
27
|
+
const DEPLOY_BINARY_EXT = /\.(png|jpe?g|gif|webp|ico|svg|woff2?|ttf|eot|zip|tar|gz|pdf|mp4|mp3|wasm|node)$/i;
|
|
28
|
+
|
|
20
29
|
export function readDirectoryRecursive(dir, basePath = '') {
|
|
21
30
|
const files = {};
|
|
22
31
|
const items = fs.readdirSync(dir);
|
|
@@ -28,13 +37,20 @@ export function readDirectoryRecursive(dir, basePath = '') {
|
|
|
28
37
|
// backslash-separated keys (e.g. "src\\main.ts") that the backend's POSIX filesystem treats as
|
|
29
38
|
// one literal filename containing a backslash, not a nested path - breaking every deploy.
|
|
30
39
|
const relativePath = basePath ? `${basePath}/${item}` : item;
|
|
31
|
-
|
|
40
|
+
// lstat (not stat) so a symlink is never followed and treated as a real directory/file to
|
|
41
|
+
// upload - same reasoning as codegen.mjs's buildProjectTree.
|
|
42
|
+
const stat = fs.lstatSync(fullPath);
|
|
43
|
+
if (stat.isSymbolicLink()) continue;
|
|
32
44
|
|
|
33
45
|
if (stat.isDirectory()) {
|
|
34
46
|
if (!DEPLOY_EXCLUDE_DIRS.includes(item)) {
|
|
35
47
|
Object.assign(files, readDirectoryRecursive(fullPath, relativePath));
|
|
36
48
|
}
|
|
37
49
|
} else if (!DEPLOY_EXCLUDE_FILES.includes(item) && !isEnvFile(item)) {
|
|
50
|
+
if (DEPLOY_BINARY_EXT.test(item)) {
|
|
51
|
+
console.log(chalk.yellow(`⚠️ Skipping "${relativePath}" - binary files aren't supported by \`aivin deploy\` (would be corrupted if uploaded as text).`));
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
38
54
|
files[relativePath] = fs.readFileSync(fullPath, 'utf8');
|
|
39
55
|
}
|
|
40
56
|
}
|
|
@@ -95,7 +111,10 @@ export function ensureLockfile(currentDir) {
|
|
|
95
111
|
|
|
96
112
|
console.log(chalk.gray(' No package-lock.json found - generating one (required for the container build)...'));
|
|
97
113
|
try {
|
|
98
|
-
|
|
114
|
+
// ✅ FIX: no timeout - a hung npm registry (corporate proxy, network drop mid-request, a
|
|
115
|
+
// private-package auth prompt npm can't actually show under `stdio: 'pipe'`) used to hang
|
|
116
|
+
// `aivin deploy`/`aivin test` indefinitely with no feedback beyond "generating one...".
|
|
117
|
+
execSync('npm install --package-lock-only', { cwd: currentDir, stdio: 'pipe', timeout: 60000 });
|
|
99
118
|
} catch (error) {
|
|
100
119
|
throw new Error(
|
|
101
120
|
`Failed to generate package-lock.json: ${error.stderr?.toString().trim() || error.message}`,
|
|
@@ -331,6 +350,10 @@ export async function deployPlugin({ endpointPath, label, smokeTest, workspaceOv
|
|
|
331
350
|
'Content-Type': 'application/json',
|
|
332
351
|
Authorization: `Bearer ${apiKey || 'dev-token'}`,
|
|
333
352
|
},
|
|
353
|
+
// ✅ FIX: no timeout at all before - a hung/overloaded backend meant this could sit forever
|
|
354
|
+
// with no way out short of Ctrl+C. 5 minutes (not the usual short default) since this call
|
|
355
|
+
// covers the actual container build/scan, which can legitimately take a while.
|
|
356
|
+
timeout: 300000,
|
|
334
357
|
});
|
|
335
358
|
|
|
336
359
|
clearInterval(loadingInterval);
|