@deepagents/text2sql 0.14.0 → 0.15.1
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.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2012 -3287
- package/dist/index.js.map +4 -4
- package/dist/lib/adapters/adapter.d.ts +2 -0
- package/dist/lib/adapters/adapter.d.ts.map +1 -1
- package/dist/lib/adapters/bigquery/bigquery.d.ts +41 -0
- package/dist/lib/adapters/bigquery/bigquery.d.ts.map +1 -0
- package/dist/lib/adapters/bigquery/constraint.bigquery.grounding.d.ts +11 -0
- package/dist/lib/adapters/bigquery/constraint.bigquery.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/bigquery/index.d.ts +35 -0
- package/dist/lib/adapters/bigquery/index.d.ts.map +1 -0
- package/dist/lib/adapters/bigquery/index.js +1321 -0
- package/dist/lib/adapters/bigquery/index.js.map +7 -0
- package/dist/lib/adapters/bigquery/indexes.bigquery.grounding.d.ts +14 -0
- package/dist/lib/adapters/bigquery/indexes.bigquery.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/bigquery/info.bigquery.grounding.d.ts +9 -0
- package/dist/lib/adapters/bigquery/info.bigquery.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/bigquery/row-count.bigquery.grounding.d.ts +14 -0
- package/dist/lib/adapters/bigquery/row-count.bigquery.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/bigquery/table.bigquery.grounding.d.ts +15 -0
- package/dist/lib/adapters/bigquery/table.bigquery.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/bigquery/view.bigquery.grounding.d.ts +12 -0
- package/dist/lib/adapters/bigquery/view.bigquery.grounding.d.ts.map +1 -0
- package/dist/lib/adapters/groundings/index.js +11 -2058
- package/dist/lib/adapters/groundings/index.js.map +4 -4
- package/dist/lib/adapters/mysql/index.js +11 -2058
- package/dist/lib/adapters/mysql/index.js.map +4 -4
- package/dist/lib/adapters/postgres/column-stats.postgres.grounding.d.ts +2 -4
- package/dist/lib/adapters/postgres/column-stats.postgres.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/postgres/column-values.postgres.grounding.d.ts +0 -8
- package/dist/lib/adapters/postgres/column-values.postgres.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/postgres/index.js +139 -2068
- package/dist/lib/adapters/postgres/index.js.map +4 -4
- package/dist/lib/adapters/postgres/row-count.postgres.grounding.d.ts +0 -3
- package/dist/lib/adapters/postgres/row-count.postgres.grounding.d.ts.map +1 -1
- package/dist/lib/adapters/spreadsheet/index.js +11 -56
- package/dist/lib/adapters/spreadsheet/index.js.map +4 -4
- package/dist/lib/adapters/sqlite/index.js +11 -2058
- package/dist/lib/adapters/sqlite/index.js.map +4 -4
- package/dist/lib/adapters/sqlserver/index.js +11 -2058
- package/dist/lib/adapters/sqlserver/index.js.map +4 -4
- package/dist/lib/agents/result-tools.d.ts +1 -3
- package/dist/lib/agents/result-tools.d.ts.map +1 -1
- package/dist/lib/fragments/schema.d.ts +2 -0
- package/dist/lib/fragments/schema.d.ts.map +1 -1
- package/dist/lib/fs/index.d.ts +2 -1
- package/dist/lib/fs/index.d.ts.map +1 -1
- package/dist/lib/fs/mssql/ddl.mssql-fs.d.ts +2 -0
- package/dist/lib/fs/mssql/ddl.mssql-fs.d.ts.map +1 -0
- package/dist/lib/fs/mssql/mssql-fs.d.ts +56 -0
- package/dist/lib/fs/mssql/mssql-fs.d.ts.map +1 -0
- package/dist/lib/fs/scoped-fs.d.ts +2 -0
- package/dist/lib/fs/scoped-fs.d.ts.map +1 -1
- package/dist/lib/fs/{sqlite-fs.d.ts → sqlite/sqlite-fs.d.ts} +2 -0
- package/dist/lib/fs/sqlite/sqlite-fs.d.ts.map +1 -0
- package/dist/lib/fs/tracked-fs.d.ts +2 -0
- package/dist/lib/fs/tracked-fs.d.ts.map +1 -1
- package/dist/lib/instructions.d.ts.map +1 -1
- package/dist/lib/sql.d.ts +2 -2
- package/dist/lib/sql.d.ts.map +1 -1
- package/dist/lib/synthesis/index.js +254 -2119
- package/dist/lib/synthesis/index.js.map +4 -4
- package/package.json +17 -10
- package/dist/lib/agents/text2sql.agent.d.ts +0 -3
- package/dist/lib/agents/text2sql.agent.d.ts.map +0 -1
- package/dist/lib/fs/sqlite-fs.d.ts.map +0 -1
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { Adapter } from '../adapter.ts';
|
|
2
2
|
import { RowCountGrounding, type RowCountGroundingConfig } from '../groundings/row-count.grounding.ts';
|
|
3
|
-
/**
|
|
4
|
-
* PostgreSQL implementation of RowCountGrounding.
|
|
5
|
-
*/
|
|
6
3
|
export declare class PostgresRowCountGrounding extends RowCountGrounding {
|
|
7
4
|
#private;
|
|
8
5
|
constructor(adapter: Adapter, config?: RowCountGroundingConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-count.postgres.grounding.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapters/postgres/row-count.postgres.grounding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,KAAK,uBAAuB,EAC7B,MAAM,sCAAsC,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"row-count.postgres.grounding.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapters/postgres/row-count.postgres.grounding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,KAAK,uBAAuB,EAC7B,MAAM,sCAAsC,CAAC;AAE9C,qBAAa,yBAA0B,SAAQ,iBAAiB;;gBAGlD,OAAO,EAAE,OAAO,EAAE,MAAM,GAAE,uBAA4B;cAKzC,WAAW,CAClC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAkC/B"}
|
|
@@ -508,64 +508,19 @@ var ColumnValuesGrounding = class extends AbstractGrounding {
|
|
|
508
508
|
};
|
|
509
509
|
|
|
510
510
|
// packages/text2sql/src/lib/adapters/groundings/report.grounding.ts
|
|
511
|
-
import { groq
|
|
511
|
+
import { groq } from "@ai-sdk/groq";
|
|
512
512
|
import { tool } from "ai";
|
|
513
|
-
import
|
|
513
|
+
import dedent from "dedent";
|
|
514
514
|
import z from "zod";
|
|
515
515
|
import "@deepagents/agent";
|
|
516
|
-
|
|
517
|
-
// packages/context/dist/index.js
|
|
518
|
-
import { mergeWith } from "lodash-es";
|
|
519
|
-
import { encode } from "gpt-tokenizer";
|
|
520
|
-
import { generateId } from "ai";
|
|
521
|
-
import pluralize from "pluralize";
|
|
522
|
-
import { titlecase } from "stringcase";
|
|
523
|
-
import chalk from "chalk";
|
|
524
|
-
import { defineCommand } from "just-bash";
|
|
525
|
-
import spawn from "nano-spawn";
|
|
526
|
-
import "bash-tool";
|
|
527
|
-
import spawn2 from "nano-spawn";
|
|
528
|
-
import {
|
|
529
|
-
createBashTool
|
|
530
|
-
} from "bash-tool";
|
|
531
|
-
import dedent from "dedent";
|
|
532
|
-
import YAML from "yaml";
|
|
533
|
-
import { DatabaseSync } from "node:sqlite";
|
|
534
|
-
import { groq } from "@ai-sdk/groq";
|
|
535
516
|
import {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
stepCountIs,
|
|
544
|
-
streamText
|
|
545
|
-
} from "ai";
|
|
546
|
-
import chalk2 from "chalk";
|
|
547
|
-
import "zod";
|
|
548
|
-
import "@deepagents/agent";
|
|
549
|
-
var LAZY_ID = Symbol.for("@deepagents/context:lazy-id");
|
|
550
|
-
var SKILLS_INSTRUCTIONS = dedent`A skill is a set of local instructions to follow that is stored in a \`SKILL.md\` file. Below is the list of skills that can be used. Each entry includes a name, description, and file path so you can open the source for full instructions when using a specific skill.
|
|
551
|
-
|
|
552
|
-
### How to use skills
|
|
553
|
-
- Discovery: The list below shows the skills available in this session (name + description + file path). Skill bodies live on disk at the listed paths.
|
|
554
|
-
- Trigger rules: If the user names a skill (with \`$SkillName\` or plain text) OR the task clearly matches a skill's description shown below, you must use that skill for that turn before doing anything else. Multiple mentions mean use them all. Do not carry skills across turns unless re-mentioned.
|
|
555
|
-
- Missing/blocked: If a named skill isn't in the list or the path can't be read, say so briefly and continue with the best fallback.
|
|
556
|
-
- How to use a skill (progressive disclosure):
|
|
557
|
-
1) After deciding to use a skill, open its \`SKILL.md\`. Read only enough to follow the workflow.
|
|
558
|
-
2) If \`SKILL.md\` points to extra folders such as \`references/\`, load only the specific files needed for the request; don't bulk-load everything.
|
|
559
|
-
3) If \`scripts/\` exist, prefer running or patching them instead of retyping large code blocks.
|
|
560
|
-
4) If \`assets/\` or templates exist, reuse them instead of recreating from scratch.
|
|
561
|
-
- Coordination and sequencing:
|
|
562
|
-
- If multiple skills apply, choose the minimal set that covers the request and state the order you'll use them.
|
|
563
|
-
- Announce which skill(s) you're using and why (one short line). If you skip an obvious skill, say why.
|
|
564
|
-
- Context hygiene:
|
|
565
|
-
- Keep context small: summarize long sections instead of pasting them; only load extra files when needed.
|
|
566
|
-
- Avoid deep reference-chasing: prefer opening only files directly linked from \`SKILL.md\` unless you're blocked.
|
|
567
|
-
- When variants exist (frameworks, providers, domains), pick only the relevant reference file(s) and note that choice.
|
|
568
|
-
- Safety and fallback: If a skill can't be applied cleanly (missing files, unclear instructions), state the issue, pick the next-best approach, and continue.`;
|
|
517
|
+
ContextEngine,
|
|
518
|
+
InMemoryContextStore,
|
|
519
|
+
agent,
|
|
520
|
+
fragment,
|
|
521
|
+
persona,
|
|
522
|
+
user
|
|
523
|
+
} from "@deepagents/context";
|
|
569
524
|
|
|
570
525
|
// packages/text2sql/src/lib/adapters/groundings/row-count.grounding.ts
|
|
571
526
|
var RowCountGrounding = class extends AbstractGrounding {
|
|
@@ -1067,7 +1022,7 @@ function rowCount(config = {}) {
|
|
|
1067
1022
|
}
|
|
1068
1023
|
|
|
1069
1024
|
// packages/text2sql/src/lib/adapters/spreadsheet/spreadsheet.ts
|
|
1070
|
-
import { DatabaseSync
|
|
1025
|
+
import { DatabaseSync } from "node:sqlite";
|
|
1071
1026
|
|
|
1072
1027
|
// packages/text2sql/src/lib/adapters/spreadsheet/parser.ts
|
|
1073
1028
|
import * as path from "node:path";
|
|
@@ -1204,7 +1159,7 @@ var Spreadsheet = class extends Sqlite {
|
|
|
1204
1159
|
constructor(options) {
|
|
1205
1160
|
const sheets = parseFile(options.file);
|
|
1206
1161
|
const dbPath = options.database ?? ":memory:";
|
|
1207
|
-
const db = new
|
|
1162
|
+
const db = new DatabaseSync(dbPath);
|
|
1208
1163
|
for (const sheet of sheets) {
|
|
1209
1164
|
const createSQL = createTableSQL(sheet);
|
|
1210
1165
|
db.exec(createSQL);
|