@vpxa/aikit 0.1.83 → 0.1.84
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/package.json +1 -1
- package/packages/cli/dist/index.js +1 -1
- package/packages/core/dist/index.d.ts +13 -1
- package/packages/core/dist/index.js +1 -1
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/{server-DyCYX0nU.js → server-CRBcgUPU.js} +138 -138
- package/packages/store/dist/index.d.ts +1 -1
- package/packages/store/dist/index.js +1 -1
- package/packages/tools/dist/index.d.ts +8 -10
- package/packages/tools/dist/index.js +70 -62
- package/scaffold/dist/definitions/bodies.mjs +1 -1
- package/scaffold/dist/definitions/skills.mjs +1 -1
|
@@ -279,7 +279,7 @@ interface ISqliteAdapter {
|
|
|
279
279
|
close(): void;
|
|
280
280
|
}
|
|
281
281
|
interface SqliteAdapterOptions {
|
|
282
|
-
/** Which adapter to try first. Default: '
|
|
282
|
+
/** Which adapter to try first. Default: 'better-sqlite3' (lower memory usage) */
|
|
283
283
|
primary?: SqliteAdapterType;
|
|
284
284
|
}
|
|
285
285
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./lance-store-jdHZp-V4.js";import{AIKIT_PATHS as t}from"../../core/dist/index.js";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{dirname as o,join as s}from"node:path";var c=class{type=`better-sqlite3`;db=null;async open(e){let t=(await import(`better-sqlite3`)).default;this.db=new t(e)}exec(e){this.getDb().exec(e)}pragma(e){this.getDb().pragma(e)}queryAll(e,t=[]){return this.getDb().prepare(e).all(...t)}run(e,t=[]){this.getDb().prepare(e).run(...t)}flush(){}close(){this.db&&=(this.db.close(),null)}getDb(){if(!this.db)throw Error(`BetterSqliteAdapter: database not opened`);return this.db}},l=class{type=`sql.js`;db=null;dbPath=``;dirty=!1;inTransaction=!1;async open(e){this.dbPath=e;let t=(await import(`sql.js`)).default,r=await t();if(n(e)){let t=i(e);this.db=new r.Database(t)}else this.db=new r.Database}exec(e){let t=e.trimStart().toUpperCase();t.startsWith(`BEGIN`)?this.inTransaction=!0:(t.startsWith(`COMMIT`)||t.startsWith(`ROLLBACK`))&&(this.inTransaction=!1),this.getDb().run(e),this.dirty=!0}pragma(e){this.getDb().exec(`PRAGMA ${e}`)}queryAll(e,t=[]){let n=this.getDb().prepare(e);t.length>0&&n.bind(t);let r=[];for(;n.step();)r.push(n.getAsObject());return n.free(),r}run(e,t=[]){let n=this.getDb(),r=e.trimStart().toUpperCase(),i=!this.inTransaction&&(r.startsWith(`INSERT`)||r.startsWith(`UPDATE`));if(i&&n.run(`SAVEPOINT fk_check`),t.length>0){let r=n.prepare(e);try{r.bind(t),r.step()}finally{r.free()}}else n.run(e);if(i){if(n.exec(`PRAGMA foreign_key_check`).length>0)throw n.run(`ROLLBACK TO fk_check`),n.run(`RELEASE fk_check`),Error(`FOREIGN KEY constraint failed`);n.run(`RELEASE fk_check`)}this.dirty=!0}flush(){if(!this.dirty||!this.db)return;let e=this.db.export();a(this.dbPath,Buffer.from(e)),this.dirty=!1}close(){this.db&&=(this.flush(),this.db.close(),null)}getDb(){if(!this.db)throw Error(`SqlJsAdapter: database not opened`);return this.db}};async function u(e,t){let n=t?.primary??`
|
|
1
|
+
import{t as e}from"./lance-store-jdHZp-V4.js";import{AIKIT_PATHS as t}from"../../core/dist/index.js";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{dirname as o,join as s}from"node:path";var c=class{type=`better-sqlite3`;db=null;async open(e){let t=(await import(`better-sqlite3`)).default;this.db=new t(e)}exec(e){this.getDb().exec(e)}pragma(e){this.getDb().pragma(e)}queryAll(e,t=[]){return this.getDb().prepare(e).all(...t)}run(e,t=[]){this.getDb().prepare(e).run(...t)}flush(){}close(){this.db&&=(this.db.close(),null)}getDb(){if(!this.db)throw Error(`BetterSqliteAdapter: database not opened`);return this.db}},l=class{type=`sql.js`;db=null;dbPath=``;dirty=!1;inTransaction=!1;async open(e){this.dbPath=e;let t=(await import(`sql.js`)).default,r=await t();if(n(e)){let t=i(e);this.db=new r.Database(t)}else this.db=new r.Database}exec(e){let t=e.trimStart().toUpperCase();t.startsWith(`BEGIN`)?this.inTransaction=!0:(t.startsWith(`COMMIT`)||t.startsWith(`ROLLBACK`))&&(this.inTransaction=!1),this.getDb().run(e),this.dirty=!0}pragma(e){this.getDb().exec(`PRAGMA ${e}`)}queryAll(e,t=[]){let n=this.getDb().prepare(e);t.length>0&&n.bind(t);let r=[];for(;n.step();)r.push(n.getAsObject());return n.free(),r}run(e,t=[]){let n=this.getDb(),r=e.trimStart().toUpperCase(),i=!this.inTransaction&&(r.startsWith(`INSERT`)||r.startsWith(`UPDATE`));if(i&&n.run(`SAVEPOINT fk_check`),t.length>0){let r=n.prepare(e);try{r.bind(t),r.step()}finally{r.free()}}else n.run(e);if(i){if(n.exec(`PRAGMA foreign_key_check`).length>0)throw n.run(`ROLLBACK TO fk_check`),n.run(`RELEASE fk_check`),Error(`FOREIGN KEY constraint failed`);n.run(`RELEASE fk_check`)}this.dirty=!0}flush(){if(!this.dirty||!this.db)return;let e=this.db.export();a(this.dbPath,Buffer.from(e)),this.dirty=!1}close(){this.db&&=(this.flush(),this.db.close(),null)}getDb(){if(!this.db)throw Error(`SqlJsAdapter: database not opened`);return this.db}};async function u(e,t){let n=t?.primary??`better-sqlite3`,r=[n,n===`better-sqlite3`?`sql.js`:`better-sqlite3`];for(let t of r)try{let r=t===`better-sqlite3`?new c:new l;return await r.open(e),t!==n&&console.error(`[aikit] SQLite adapter: primary "${n}" unavailable, using fallback "${t}"`),r}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`[aikit] SQLite adapter "${t}" failed to load: ${n}`)}throw Error(`[aikit] No SQLite adapter available. Tried: ${r.join(`, `)}. Install either better-sqlite3 or sql.js.`)}var d=class{adapter=null;dbPath;adapterOptions;constructor(e){let n=e?.path??t.data;this.dbPath=s(n,`graph.db`),this.adapterOptions=e?.sqliteAdapter}async initialize(){let e=o(this.dbPath);n(e)||r(e,{recursive:!0}),this.adapter=await u(this.dbPath,this.adapterOptions),this.configureAdapter(this.adapter),this.createTables(this.adapter),this.migrateSchema(this.adapter),this.adapter.flush()}configureAdapter(e){e.pragma(`journal_mode = WAL`),e.pragma(`foreign_keys = ON`)}createTables(e){e.exec(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS nodes (
|
|
3
3
|
id TEXT PRIMARY KEY,
|
|
4
4
|
type TEXT NOT NULL,
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { ContentType, KnowledgeOrigin } from "../../core/dist/index.js";
|
|
1
|
+
import { ContentType, KnowledgeOrigin, TokenBudget } from "../../core/dist/index.js";
|
|
2
2
|
import { IEmbedder } from "../../embeddings/dist/index.js";
|
|
3
3
|
import { DepthGroupedResult, GraphEdge, GraphNode, GraphStats, GraphTraversalResult, GraphValidationResult, IGraphStore, IKnowledgeStore, ProcessInfo, Symbol360 } from "../../store/dist/index.js";
|
|
4
4
|
|
|
5
5
|
//#region packages/tools/src/response-envelope.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Standardized response envelope for AI Kit tools (E-009).
|
|
8
|
-
* New tools should return KBResponse<T>. Existing tools can adopt gradually.
|
|
9
|
-
*/
|
|
10
6
|
interface KBNextHint {
|
|
11
7
|
tool: string;
|
|
12
8
|
reason: string;
|
|
@@ -23,7 +19,7 @@ type KBErrorCode = 'SYMBOL_NOT_FOUND' | 'INDEX_STALE' | 'TREE_SITTER_UNAVAILABLE
|
|
|
23
19
|
interface KBResponseMeta {
|
|
24
20
|
durationMs: number;
|
|
25
21
|
tokensEstimate: number;
|
|
26
|
-
detail:
|
|
22
|
+
detail: TokenBudget;
|
|
27
23
|
cached: boolean;
|
|
28
24
|
truncated: boolean;
|
|
29
25
|
caveats?: string[];
|
|
@@ -51,8 +47,8 @@ interface AuditOptions {
|
|
|
51
47
|
path?: string;
|
|
52
48
|
/** Which checks to run (default: all) */
|
|
53
49
|
checks?: AuditCheck[];
|
|
54
|
-
/** Detail level (default: '
|
|
55
|
-
detail?:
|
|
50
|
+
/** Detail level (default: 'efficient') */
|
|
51
|
+
detail?: TokenBudget;
|
|
56
52
|
}
|
|
57
53
|
interface AuditRecommendation {
|
|
58
54
|
priority: 'high' | 'medium' | 'low';
|
|
@@ -252,8 +248,8 @@ interface CheckOptions {
|
|
|
252
248
|
skipTypes?: boolean;
|
|
253
249
|
/** Skip lint */
|
|
254
250
|
skipLint?: boolean;
|
|
255
|
-
/** Detail level:
|
|
256
|
-
detail?:
|
|
251
|
+
/** Detail level: efficient (default, minimal), normal (parsed errors), full (includes raw) */
|
|
252
|
+
detail?: TokenBudget;
|
|
257
253
|
}
|
|
258
254
|
interface CheckSummaryResult {
|
|
259
255
|
passed: boolean;
|
|
@@ -1331,6 +1327,8 @@ interface GuideRecommendation {
|
|
|
1331
1327
|
reason: string;
|
|
1332
1328
|
order: number;
|
|
1333
1329
|
suggestedArgs?: Record<string, unknown>;
|
|
1330
|
+
/** Optional token-saving tip shown alongside the recommendation */
|
|
1331
|
+
tokenTip?: string;
|
|
1334
1332
|
}
|
|
1335
1333
|
interface GuideResult {
|
|
1336
1334
|
workflow: string;
|