@intend-it/core 2.0.2 → 2.0.3
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/index.js +50 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -169459,15 +169459,57 @@ ${request.prompt}`;
|
|
|
169459
169459
|
async testConnection() {
|
|
169460
169460
|
try {
|
|
169461
169461
|
const response = await fetch(`${this.baseUrl}/api/version`);
|
|
169462
|
-
|
|
169463
|
-
return true;
|
|
169464
|
-
}
|
|
169465
|
-
return false;
|
|
169462
|
+
return response.ok;
|
|
169466
169463
|
} catch (error) {
|
|
169467
|
-
console.error("Ollama connection failed. Is Ollama running?");
|
|
169468
169464
|
return false;
|
|
169469
169465
|
}
|
|
169470
169466
|
}
|
|
169467
|
+
async checkModelExists() {
|
|
169468
|
+
try {
|
|
169469
|
+
const response = await fetch(`${this.baseUrl}/api/tags`);
|
|
169470
|
+
if (!response.ok)
|
|
169471
|
+
return false;
|
|
169472
|
+
const data = await response.json();
|
|
169473
|
+
return data.models.some((m) => m.name === this.model || m.name === `${this.model}:latest`);
|
|
169474
|
+
} catch {
|
|
169475
|
+
return false;
|
|
169476
|
+
}
|
|
169477
|
+
}
|
|
169478
|
+
async pullModel(onProgress) {
|
|
169479
|
+
try {
|
|
169480
|
+
const response = await fetch(`${this.baseUrl}/api/pull`, {
|
|
169481
|
+
method: "POST",
|
|
169482
|
+
headers: { "Content-Type": "application/json" },
|
|
169483
|
+
body: JSON.stringify({ name: this.model, stream: true })
|
|
169484
|
+
});
|
|
169485
|
+
if (!response.body)
|
|
169486
|
+
return false;
|
|
169487
|
+
const reader = response.body.getReader();
|
|
169488
|
+
const decoder = new TextDecoder;
|
|
169489
|
+
while (true) {
|
|
169490
|
+
const { done, value } = await reader.read();
|
|
169491
|
+
if (done)
|
|
169492
|
+
break;
|
|
169493
|
+
const chunk = decoder.decode(value, { stream: true });
|
|
169494
|
+
const lines = chunk.split(`
|
|
169495
|
+
`).filter(Boolean);
|
|
169496
|
+
for (const line of lines) {
|
|
169497
|
+
try {
|
|
169498
|
+
const data = JSON.parse(line);
|
|
169499
|
+
if (data.error) {
|
|
169500
|
+
throw new Error(data.error);
|
|
169501
|
+
}
|
|
169502
|
+
if (onProgress) {
|
|
169503
|
+
onProgress(data.status, data.completed, data.total);
|
|
169504
|
+
}
|
|
169505
|
+
} catch (e) {}
|
|
169506
|
+
}
|
|
169507
|
+
}
|
|
169508
|
+
return true;
|
|
169509
|
+
} catch (e) {
|
|
169510
|
+
throw e;
|
|
169511
|
+
}
|
|
169512
|
+
}
|
|
169471
169513
|
}
|
|
169472
169514
|
|
|
169473
169515
|
// src/validation/validator.ts
|
|
@@ -169514,6 +169556,9 @@ import { resolve, dirname } from "path";
|
|
|
169514
169556
|
class AICodeGenerator {
|
|
169515
169557
|
provider;
|
|
169516
169558
|
promptBuilder;
|
|
169559
|
+
getProvider() {
|
|
169560
|
+
return this.provider;
|
|
169561
|
+
}
|
|
169517
169562
|
mode;
|
|
169518
169563
|
validator;
|
|
169519
169564
|
maxAttempts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intend-it/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Core compiler and AI integration for the Intend programming language",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@intend-it/parser": "^1.1.
|
|
38
|
+
"@intend-it/parser": "^1.1.3",
|
|
39
39
|
"@google/generative-ai": "^0.21.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
"typescript": "^5.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@intend-it/parser": ">=1.1.
|
|
46
|
+
"@intend-it/parser": ">=1.1.3"
|
|
47
47
|
}
|
|
48
48
|
}
|