@shrkcrft/context 0.1.0-alpha.19 → 0.1.0-alpha.20
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-builder.d.ts","sourceRoot":"","sources":["../src/context-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAqB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"context-builder.d.ts","sourceRoot":"","sources":["../src/context-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAqB,MAAM,2BAA2B,CAAC;AAcrF,wBAAgB,YAAY,CAC1B,UAAU,EAAE,SAAS,eAAe,EAAE,EACtC,OAAO,EAAE,eAAe,GACvB,cAAc,CA4GhB;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
package/dist/context-builder.js
CHANGED
|
@@ -38,6 +38,18 @@ export function buildContext(allEntries, request) {
|
|
|
38
38
|
if (r.includeDocs) {
|
|
39
39
|
sectionPlans.push({ title: 'Reference Docs', priority: 10, entries: buckets.docs });
|
|
40
40
|
}
|
|
41
|
+
// Agent Actions: aggregate action hints (recommended MCP tools / CLI commands
|
|
42
|
+
// / forbidden actions / verification commands / human-review points) from
|
|
43
|
+
// every included entry into ONE composite section. Register it in the SAME
|
|
44
|
+
// priority-sorted pipeline with a HIGH priority so it survives budget pruning
|
|
45
|
+
// — it is the most agent-actionable section and was previously appended after
|
|
46
|
+
// the loop with leftover budget, so it was the first thing dropped.
|
|
47
|
+
const allIncludedEntries = sectionPlans.flatMap((p) => p.entries);
|
|
48
|
+
const aggregated = aggregateActionHints(allIncludedEntries);
|
|
49
|
+
const hintsBody = formatAggregatedHints(aggregated, { level: '###', compact: true });
|
|
50
|
+
if (hintsBody && hintsBody.length > 0) {
|
|
51
|
+
sectionPlans.push({ title: 'Agent Actions', priority: 92, entries: [], body: hintsBody });
|
|
52
|
+
}
|
|
41
53
|
sectionPlans.sort((a, b) => b.priority - a.priority);
|
|
42
54
|
const sections = [];
|
|
43
55
|
const omitted = [];
|
|
@@ -65,6 +77,13 @@ export function buildContext(allEntries, request) {
|
|
|
65
77
|
tryAddSection('Project Overview', r.projectOverview.trim(), []);
|
|
66
78
|
continue;
|
|
67
79
|
}
|
|
80
|
+
// Composite section with a precomputed body (e.g. Agent Actions) — added in
|
|
81
|
+
// priority order with its contributing-entry ids.
|
|
82
|
+
if (plan.body !== undefined) {
|
|
83
|
+
if (plan.body.length > 0)
|
|
84
|
+
tryAddSection(plan.title, plan.body, aggregated.contributingEntries);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
68
87
|
if (plan.entries.length === 0)
|
|
69
88
|
continue;
|
|
70
89
|
const body = formatSectionBody(plan.entries, {
|
|
@@ -74,14 +93,6 @@ export function buildContext(allEntries, request) {
|
|
|
74
93
|
const ids = plan.entries.map((e) => e.id);
|
|
75
94
|
tryAddSection(plan.title, body, ids);
|
|
76
95
|
}
|
|
77
|
-
// Action hints: aggregate from every included entry and emit a single
|
|
78
|
-
// composite "Agent Actions" section. Skipped when no entry contributes.
|
|
79
|
-
const allIncludedEntries = sectionPlans.flatMap((p) => p.entries);
|
|
80
|
-
const aggregated = aggregateActionHints(allIncludedEntries);
|
|
81
|
-
const hintsBody = formatAggregatedHints(aggregated, { level: '###', compact: true });
|
|
82
|
-
if (hintsBody && hintsBody.length > 0) {
|
|
83
|
-
tryAddSection('Agent Actions', hintsBody, aggregated.contributingEntries);
|
|
84
|
-
}
|
|
85
96
|
const fullBody = sections
|
|
86
97
|
.map((s) => `## ${s.title}${s.truncated ? ' (truncated)' : ''}\n\n${s.body}`)
|
|
87
98
|
.join('\n\n');
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/context",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.20",
|
|
4
4
|
"description": "SharkCraft AI context builder: token-budgeted relevance retrieval for tasks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
|
-
"types": "./dist/index.d.
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
48
|
-
"@shrkcrft/knowledge": "^0.1.0-alpha.
|
|
49
|
-
"@shrkcrft/rules": "^0.1.0-alpha.
|
|
50
|
-
"@shrkcrft/paths": "^0.1.0-alpha.
|
|
51
|
-
"@shrkcrft/templates": "^0.1.0-alpha.
|
|
47
|
+
"@shrkcrft/core": "^0.1.0-alpha.20",
|
|
48
|
+
"@shrkcrft/knowledge": "^0.1.0-alpha.20",
|
|
49
|
+
"@shrkcrft/rules": "^0.1.0-alpha.20",
|
|
50
|
+
"@shrkcrft/paths": "^0.1.0-alpha.20",
|
|
51
|
+
"@shrkcrft/templates": "^0.1.0-alpha.20"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|