@promptev/context-engine 0.0.4 → 0.0.5
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 +40 -0
- package/dist/cli.js +205 -21
- package/dist/cli.js.map +1 -1
- package/dist/express.cjs +205 -21
- package/dist/express.cjs.map +1 -1
- package/dist/express.js +205 -21
- package/dist/express.js.map +1 -1
- package/dist/fastify.cjs +205 -21
- package/dist/fastify.cjs.map +1 -1
- package/dist/fastify.js +205 -21
- package/dist/fastify.js.map +1 -1
- package/dist/hono.cjs +205 -21
- package/dist/hono.cjs.map +1 -1
- package/dist/hono.js +205 -21
- package/dist/hono.js.map +1 -1
- package/dist/index.cjs +223 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +222 -23
- package/dist/index.js.map +1 -1
- package/dist/skills/context-engine/SKILL.md +25 -0
- package/package.json +1 -1
- package/src/skills/context-engine/SKILL.md +25 -0
|
@@ -130,6 +130,31 @@ await engine.search(q, { principals: user.groups }); // scoped
|
|
|
130
130
|
header before the LLM sees a schema, and sweeps the result.
|
|
131
131
|
- Filing a document under an ACL the caller does not hold returns **403**, on
|
|
132
132
|
ingest and on PATCH alike.
|
|
133
|
+
- **`executeTool` cuts its `result` to 8,000 characters and 100 rows by
|
|
134
|
+
default.** A cut result is `{ _truncated, _original_size }` — a model
|
|
135
|
+
reading only that prefix will say "not found" about data that was there.
|
|
136
|
+
Size the budget to the model's window with `resultMaxChars` /
|
|
137
|
+
`resultMaxRows` (omitted = default, `null` = no limit; rows are per table,
|
|
138
|
+
and a db tool's own `max_rows`, default 1000, still applies first).
|
|
139
|
+
`responseMode: "tsv"` works for ANY tool: every array of objects in the
|
|
140
|
+
result (db `rows`, an HTTP body's list, a function's returned list) becomes
|
|
141
|
+
a TSV string under the same key — header first, `\N` = NULL, nested values
|
|
142
|
+
as JSON cells, tab/newline/backslash escaped — and the budget cuts at whole
|
|
143
|
+
rows, reporting `_result_shaping: { "<dotted.path>": { rows_returned,
|
|
144
|
+
rows_omitted } }`. Everything else stays JSON. The audit row keeps the
|
|
145
|
+
original under its own 50KB cap regardless. An http tool can store
|
|
146
|
+
`response_mode: "tsv"` in its config (every method, `QUERY` included;
|
|
147
|
+
omitted = `json`); an explicit `responseMode` on the call wins. The
|
|
148
|
+
conversion alone is `formatResult(result, "tsv")`.
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
const out = await engine.executeTool("db_sales", { query: "SELECT * FROM orders" }, {
|
|
152
|
+
principals,
|
|
153
|
+
resultMaxChars: 200_000,
|
|
154
|
+
resultMaxRows: null,
|
|
155
|
+
responseMode: "tsv",
|
|
156
|
+
});
|
|
157
|
+
```
|
|
133
158
|
|
|
134
159
|
## Search
|
|
135
160
|
|
package/package.json
CHANGED
|
@@ -130,6 +130,31 @@ await engine.search(q, { principals: user.groups }); // scoped
|
|
|
130
130
|
header before the LLM sees a schema, and sweeps the result.
|
|
131
131
|
- Filing a document under an ACL the caller does not hold returns **403**, on
|
|
132
132
|
ingest and on PATCH alike.
|
|
133
|
+
- **`executeTool` cuts its `result` to 8,000 characters and 100 rows by
|
|
134
|
+
default.** A cut result is `{ _truncated, _original_size }` — a model
|
|
135
|
+
reading only that prefix will say "not found" about data that was there.
|
|
136
|
+
Size the budget to the model's window with `resultMaxChars` /
|
|
137
|
+
`resultMaxRows` (omitted = default, `null` = no limit; rows are per table,
|
|
138
|
+
and a db tool's own `max_rows`, default 1000, still applies first).
|
|
139
|
+
`responseMode: "tsv"` works for ANY tool: every array of objects in the
|
|
140
|
+
result (db `rows`, an HTTP body's list, a function's returned list) becomes
|
|
141
|
+
a TSV string under the same key — header first, `\N` = NULL, nested values
|
|
142
|
+
as JSON cells, tab/newline/backslash escaped — and the budget cuts at whole
|
|
143
|
+
rows, reporting `_result_shaping: { "<dotted.path>": { rows_returned,
|
|
144
|
+
rows_omitted } }`. Everything else stays JSON. The audit row keeps the
|
|
145
|
+
original under its own 50KB cap regardless. An http tool can store
|
|
146
|
+
`response_mode: "tsv"` in its config (every method, `QUERY` included;
|
|
147
|
+
omitted = `json`); an explicit `responseMode` on the call wins. The
|
|
148
|
+
conversion alone is `formatResult(result, "tsv")`.
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
const out = await engine.executeTool("db_sales", { query: "SELECT * FROM orders" }, {
|
|
152
|
+
principals,
|
|
153
|
+
resultMaxChars: 200_000,
|
|
154
|
+
resultMaxRows: null,
|
|
155
|
+
responseMode: "tsv",
|
|
156
|
+
});
|
|
157
|
+
```
|
|
133
158
|
|
|
134
159
|
## Search
|
|
135
160
|
|