iosm-cli 0.1.2 → 0.2.0
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/CHANGELOG.md +33 -0
- package/README.md +37 -3
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-profiles.d.ts.map +1 -1
- package/dist/core/agent-profiles.js +1 -0
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +3 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/blast.d.ts +62 -0
- package/dist/core/blast.d.ts.map +1 -0
- package/dist/core/blast.js +448 -0
- package/dist/core/blast.js.map +1 -0
- package/dist/core/contract.d.ts +54 -0
- package/dist/core/contract.d.ts.map +1 -0
- package/dist/core/contract.js +300 -0
- package/dist/core/contract.js.map +1 -0
- package/dist/core/sdk.d.ts +3 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +11 -19
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/semantic/chunking.d.ts +10 -0
- package/dist/core/semantic/chunking.d.ts.map +1 -0
- package/dist/core/semantic/chunking.js +82 -0
- package/dist/core/semantic/chunking.js.map +1 -0
- package/dist/core/semantic/cli.d.ts +23 -0
- package/dist/core/semantic/cli.d.ts.map +1 -0
- package/dist/core/semantic/cli.js +86 -0
- package/dist/core/semantic/cli.js.map +1 -0
- package/dist/core/semantic/config.d.ts +8 -0
- package/dist/core/semantic/config.d.ts.map +1 -0
- package/dist/core/semantic/config.js +266 -0
- package/dist/core/semantic/config.js.map +1 -0
- package/dist/core/semantic/index-store.d.ts +21 -0
- package/dist/core/semantic/index-store.d.ts.map +1 -0
- package/dist/core/semantic/index-store.js +73 -0
- package/dist/core/semantic/index-store.js.map +1 -0
- package/dist/core/semantic/index.d.ts +8 -0
- package/dist/core/semantic/index.d.ts.map +1 -0
- package/dist/core/semantic/index.js +7 -0
- package/dist/core/semantic/index.js.map +1 -0
- package/dist/core/semantic/providers.d.ts +22 -0
- package/dist/core/semantic/providers.d.ts.map +1 -0
- package/dist/core/semantic/providers.js +317 -0
- package/dist/core/semantic/providers.js.map +1 -0
- package/dist/core/semantic/runtime.d.ts +32 -0
- package/dist/core/semantic/runtime.d.ts.map +1 -0
- package/dist/core/semantic/runtime.js +510 -0
- package/dist/core/semantic/runtime.js.map +1 -0
- package/dist/core/semantic/types.d.ts +157 -0
- package/dist/core/semantic/types.d.ts.map +1 -0
- package/dist/core/semantic/types.js +23 -0
- package/dist/core/semantic/types.js.map +1 -0
- package/dist/core/shadow-guard.d.ts +30 -0
- package/dist/core/shadow-guard.d.ts.map +1 -0
- package/dist/core/shadow-guard.js +81 -0
- package/dist/core/shadow-guard.js.map +1 -0
- package/dist/core/singular.d.ts +73 -0
- package/dist/core/singular.d.ts.map +1 -0
- package/dist/core/singular.js +413 -0
- package/dist/core/singular.js.map +1 -0
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +12 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +21 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/ast-grep.js +1 -1
- package/dist/core/tools/ast-grep.js.map +1 -1
- package/dist/core/tools/comby.js +1 -1
- package/dist/core/tools/comby.js.map +1 -1
- package/dist/core/tools/index.d.ts +9 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +6 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/rg.js +1 -1
- package/dist/core/tools/rg.js.map +1 -1
- package/dist/core/tools/semantic-search.d.ts +21 -0
- package/dist/core/tools/semantic-search.d.ts.map +1 -0
- package/dist/core/tools/semantic-search.js +123 -0
- package/dist/core/tools/semantic-search.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +124 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +8 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +70 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +58 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +2067 -104
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/cli-reference.md +36 -1
- package/docs/configuration.md +79 -2
- package/docs/getting-started.md +1 -0
- package/docs/interactive-mode.md +135 -1
- package/package.json +1 -1
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import AjvModule from "ajv";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
const Ajv = AjvModule.default || AjvModule;
|
|
5
|
+
const ajv = new Ajv({ allErrors: true, allowUnionTypes: true });
|
|
6
|
+
export class ContractValidationError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "ContractValidationError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class ContractParseError extends Error {
|
|
13
|
+
constructor(filePath, message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = "ContractParseError";
|
|
16
|
+
this.filePath = filePath;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const CONTRACT_SCHEMA = {
|
|
20
|
+
type: "object",
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
properties: {
|
|
23
|
+
goal: { type: "string" },
|
|
24
|
+
scope_include: {
|
|
25
|
+
type: "array",
|
|
26
|
+
items: { type: "string" },
|
|
27
|
+
},
|
|
28
|
+
scope_exclude: {
|
|
29
|
+
type: "array",
|
|
30
|
+
items: { type: "string" },
|
|
31
|
+
},
|
|
32
|
+
constraints: {
|
|
33
|
+
type: "array",
|
|
34
|
+
items: { type: "string" },
|
|
35
|
+
},
|
|
36
|
+
quality_gates: {
|
|
37
|
+
type: "array",
|
|
38
|
+
items: { type: "string" },
|
|
39
|
+
},
|
|
40
|
+
definition_of_done: {
|
|
41
|
+
type: "array",
|
|
42
|
+
items: { type: "string" },
|
|
43
|
+
},
|
|
44
|
+
assumptions: {
|
|
45
|
+
type: "array",
|
|
46
|
+
items: { type: "string" },
|
|
47
|
+
},
|
|
48
|
+
non_goals: {
|
|
49
|
+
type: "array",
|
|
50
|
+
items: { type: "string" },
|
|
51
|
+
},
|
|
52
|
+
risks: {
|
|
53
|
+
type: "array",
|
|
54
|
+
items: { type: "string" },
|
|
55
|
+
},
|
|
56
|
+
deliverables: {
|
|
57
|
+
type: "array",
|
|
58
|
+
items: { type: "string" },
|
|
59
|
+
},
|
|
60
|
+
success_metrics: {
|
|
61
|
+
type: "array",
|
|
62
|
+
items: { type: "string" },
|
|
63
|
+
},
|
|
64
|
+
stakeholders: {
|
|
65
|
+
type: "array",
|
|
66
|
+
items: { type: "string" },
|
|
67
|
+
},
|
|
68
|
+
owner: { type: "string" },
|
|
69
|
+
timebox: { type: "string" },
|
|
70
|
+
notes: { type: "string" },
|
|
71
|
+
},
|
|
72
|
+
required: [],
|
|
73
|
+
};
|
|
74
|
+
const validateContract = ajv.compile(CONTRACT_SCHEMA);
|
|
75
|
+
function isRecord(value) {
|
|
76
|
+
return typeof value === "object" && value !== null;
|
|
77
|
+
}
|
|
78
|
+
function normalizeString(value) {
|
|
79
|
+
if (typeof value !== "string")
|
|
80
|
+
return undefined;
|
|
81
|
+
const normalized = value.trim();
|
|
82
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
83
|
+
}
|
|
84
|
+
function normalizeStringArray(value) {
|
|
85
|
+
if (!Array.isArray(value))
|
|
86
|
+
return undefined;
|
|
87
|
+
const normalized = value
|
|
88
|
+
.filter((item) => typeof item === "string")
|
|
89
|
+
.map((item) => item.trim())
|
|
90
|
+
.filter((item) => item.length > 0);
|
|
91
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
92
|
+
}
|
|
93
|
+
function cloneContract(contract) {
|
|
94
|
+
return {
|
|
95
|
+
...(contract.goal ? { goal: contract.goal } : {}),
|
|
96
|
+
...(contract.scope_include ? { scope_include: [...contract.scope_include] } : {}),
|
|
97
|
+
...(contract.scope_exclude ? { scope_exclude: [...contract.scope_exclude] } : {}),
|
|
98
|
+
...(contract.constraints ? { constraints: [...contract.constraints] } : {}),
|
|
99
|
+
...(contract.quality_gates ? { quality_gates: [...contract.quality_gates] } : {}),
|
|
100
|
+
...(contract.definition_of_done ? { definition_of_done: [...contract.definition_of_done] } : {}),
|
|
101
|
+
...(contract.assumptions ? { assumptions: [...contract.assumptions] } : {}),
|
|
102
|
+
...(contract.non_goals ? { non_goals: [...contract.non_goals] } : {}),
|
|
103
|
+
...(contract.risks ? { risks: [...contract.risks] } : {}),
|
|
104
|
+
...(contract.deliverables ? { deliverables: [...contract.deliverables] } : {}),
|
|
105
|
+
...(contract.success_metrics ? { success_metrics: [...contract.success_metrics] } : {}),
|
|
106
|
+
...(contract.stakeholders ? { stakeholders: [...contract.stakeholders] } : {}),
|
|
107
|
+
...(contract.owner ? { owner: contract.owner } : {}),
|
|
108
|
+
...(contract.timebox ? { timebox: contract.timebox } : {}),
|
|
109
|
+
...(contract.notes ? { notes: contract.notes } : {}),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function formatValidationError(payload) {
|
|
113
|
+
const errors = validateContract.errors ?? [];
|
|
114
|
+
if (errors.length === 0) {
|
|
115
|
+
return `Invalid contract payload: ${JSON.stringify(payload)}`;
|
|
116
|
+
}
|
|
117
|
+
const details = errors
|
|
118
|
+
.map((error) => {
|
|
119
|
+
const path = error.instancePath || "/";
|
|
120
|
+
return `${path} ${error.message ?? "is invalid"}`;
|
|
121
|
+
})
|
|
122
|
+
.join("; ");
|
|
123
|
+
return `Invalid contract payload: ${details}`;
|
|
124
|
+
}
|
|
125
|
+
export function normalizeEngineeringContract(payload) {
|
|
126
|
+
if (!isRecord(payload)) {
|
|
127
|
+
throw new ContractValidationError("Contract payload must be a JSON object.");
|
|
128
|
+
}
|
|
129
|
+
if (!validateContract(payload)) {
|
|
130
|
+
throw new ContractValidationError(formatValidationError(payload));
|
|
131
|
+
}
|
|
132
|
+
const goal = normalizeString(payload.goal);
|
|
133
|
+
const scopeInclude = normalizeStringArray(payload.scope_include);
|
|
134
|
+
const scopeExclude = normalizeStringArray(payload.scope_exclude);
|
|
135
|
+
const constraints = normalizeStringArray(payload.constraints);
|
|
136
|
+
const qualityGates = normalizeStringArray(payload.quality_gates);
|
|
137
|
+
const definitionOfDone = normalizeStringArray(payload.definition_of_done);
|
|
138
|
+
const assumptions = normalizeStringArray(payload.assumptions);
|
|
139
|
+
const nonGoals = normalizeStringArray(payload.non_goals);
|
|
140
|
+
const risks = normalizeStringArray(payload.risks);
|
|
141
|
+
const deliverables = normalizeStringArray(payload.deliverables);
|
|
142
|
+
const successMetrics = normalizeStringArray(payload.success_metrics);
|
|
143
|
+
const stakeholders = normalizeStringArray(payload.stakeholders);
|
|
144
|
+
const owner = normalizeString(payload.owner);
|
|
145
|
+
const timebox = normalizeString(payload.timebox);
|
|
146
|
+
const notes = normalizeString(payload.notes);
|
|
147
|
+
return {
|
|
148
|
+
...(goal ? { goal } : {}),
|
|
149
|
+
...(scopeInclude ? { scope_include: scopeInclude } : {}),
|
|
150
|
+
...(scopeExclude ? { scope_exclude: scopeExclude } : {}),
|
|
151
|
+
...(constraints ? { constraints } : {}),
|
|
152
|
+
...(qualityGates ? { quality_gates: qualityGates } : {}),
|
|
153
|
+
...(definitionOfDone ? { definition_of_done: definitionOfDone } : {}),
|
|
154
|
+
...(assumptions ? { assumptions } : {}),
|
|
155
|
+
...(nonGoals ? { non_goals: nonGoals } : {}),
|
|
156
|
+
...(risks ? { risks } : {}),
|
|
157
|
+
...(deliverables ? { deliverables } : {}),
|
|
158
|
+
...(successMetrics ? { success_metrics: successMetrics } : {}),
|
|
159
|
+
...(stakeholders ? { stakeholders } : {}),
|
|
160
|
+
...(owner ? { owner } : {}),
|
|
161
|
+
...(timebox ? { timebox } : {}),
|
|
162
|
+
...(notes ? { notes } : {}),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export function deepMergeContracts(base, override) {
|
|
166
|
+
const merged = cloneContract(base);
|
|
167
|
+
for (const [key, value] of Object.entries(override)) {
|
|
168
|
+
if (value === undefined)
|
|
169
|
+
continue;
|
|
170
|
+
if (Array.isArray(value)) {
|
|
171
|
+
merged[key] = [...value];
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
merged[key] = value;
|
|
175
|
+
}
|
|
176
|
+
return normalizeEngineeringContract(merged);
|
|
177
|
+
}
|
|
178
|
+
function readContractFile(filePath) {
|
|
179
|
+
if (!existsSync(filePath)) {
|
|
180
|
+
return {};
|
|
181
|
+
}
|
|
182
|
+
let parsed;
|
|
183
|
+
try {
|
|
184
|
+
parsed = JSON.parse(readFileSync(filePath, "utf8"));
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
188
|
+
throw new ContractParseError(filePath, `Failed to parse contract JSON: ${message}`);
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
return normalizeEngineeringContract(parsed);
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
195
|
+
throw new ContractParseError(filePath, message);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function writeContractFile(filePath, contract) {
|
|
199
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
200
|
+
writeFileSync(filePath, `${JSON.stringify(contract, null, 2)}\n`, "utf8");
|
|
201
|
+
}
|
|
202
|
+
export class ContractService {
|
|
203
|
+
constructor(options) {
|
|
204
|
+
this.sessionOverlay = {};
|
|
205
|
+
this.cwd = options.cwd;
|
|
206
|
+
}
|
|
207
|
+
getProjectPath() {
|
|
208
|
+
return join(this.cwd, ".iosm", "contract.json");
|
|
209
|
+
}
|
|
210
|
+
getSessionOverlay() {
|
|
211
|
+
return cloneContract(this.sessionOverlay);
|
|
212
|
+
}
|
|
213
|
+
setSessionOverlay(payload) {
|
|
214
|
+
const normalized = normalizeEngineeringContract(payload);
|
|
215
|
+
this.sessionOverlay = normalized;
|
|
216
|
+
return cloneContract(normalized);
|
|
217
|
+
}
|
|
218
|
+
clearSessionOverlay() {
|
|
219
|
+
this.sessionOverlay = {};
|
|
220
|
+
}
|
|
221
|
+
loadProjectContract() {
|
|
222
|
+
return readContractFile(this.getProjectPath());
|
|
223
|
+
}
|
|
224
|
+
saveProjectContract(payload) {
|
|
225
|
+
const normalized = normalizeEngineeringContract(payload);
|
|
226
|
+
writeContractFile(this.getProjectPath(), normalized);
|
|
227
|
+
return cloneContract(normalized);
|
|
228
|
+
}
|
|
229
|
+
clearProjectContract() {
|
|
230
|
+
const projectPath = this.getProjectPath();
|
|
231
|
+
if (!existsSync(projectPath))
|
|
232
|
+
return false;
|
|
233
|
+
rmSync(projectPath, { force: true });
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
save(scope, payload) {
|
|
237
|
+
if (scope === "project") {
|
|
238
|
+
return this.saveProjectContract(payload);
|
|
239
|
+
}
|
|
240
|
+
return this.setSessionOverlay(payload);
|
|
241
|
+
}
|
|
242
|
+
clear(scope) {
|
|
243
|
+
if (scope === "project") {
|
|
244
|
+
return this.clearProjectContract();
|
|
245
|
+
}
|
|
246
|
+
this.clearSessionOverlay();
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
getState() {
|
|
250
|
+
const projectPath = this.getProjectPath();
|
|
251
|
+
const hasProjectFile = existsSync(projectPath);
|
|
252
|
+
const project = this.loadProjectContract();
|
|
253
|
+
const sessionOverlay = this.getSessionOverlay();
|
|
254
|
+
const effective = deepMergeContracts(project, sessionOverlay);
|
|
255
|
+
return {
|
|
256
|
+
projectPath,
|
|
257
|
+
hasProjectFile,
|
|
258
|
+
project,
|
|
259
|
+
sessionOverlay,
|
|
260
|
+
effective,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
buildPromptContext(maxItemsPerList = 4) {
|
|
264
|
+
const state = this.getState();
|
|
265
|
+
const contract = state.effective;
|
|
266
|
+
if (Object.keys(contract).length === 0) {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
269
|
+
const lines = ["Active engineering contract (effective):"];
|
|
270
|
+
if (contract.goal)
|
|
271
|
+
lines.push(`- goal: ${contract.goal}`);
|
|
272
|
+
const pushList = (label, values) => {
|
|
273
|
+
if (!values || values.length === 0)
|
|
274
|
+
return;
|
|
275
|
+
const preview = values.slice(0, Math.max(1, maxItemsPerList));
|
|
276
|
+
const suffix = values.length > preview.length ? ` (+${values.length - preview.length} more)` : "";
|
|
277
|
+
lines.push(`- ${label}: ${preview.join("; ")}${suffix}`);
|
|
278
|
+
};
|
|
279
|
+
pushList("scope_include", contract.scope_include);
|
|
280
|
+
pushList("scope_exclude", contract.scope_exclude);
|
|
281
|
+
pushList("constraints", contract.constraints);
|
|
282
|
+
pushList("quality_gates", contract.quality_gates);
|
|
283
|
+
pushList("definition_of_done", contract.definition_of_done);
|
|
284
|
+
pushList("assumptions", contract.assumptions);
|
|
285
|
+
pushList("non_goals", contract.non_goals);
|
|
286
|
+
pushList("risks", contract.risks);
|
|
287
|
+
pushList("deliverables", contract.deliverables);
|
|
288
|
+
pushList("success_metrics", contract.success_metrics);
|
|
289
|
+
pushList("stakeholders", contract.stakeholders);
|
|
290
|
+
if (contract.owner)
|
|
291
|
+
lines.push(`- owner: ${contract.owner}`);
|
|
292
|
+
if (contract.timebox)
|
|
293
|
+
lines.push(`- timebox: ${contract.timebox}`);
|
|
294
|
+
if (contract.notes)
|
|
295
|
+
lines.push(`- notes: ${contract.notes}`);
|
|
296
|
+
lines.push("Treat this contract as execution constraints unless user explicitly overrides it.");
|
|
297
|
+
return lines.join("\n");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/core/contract.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,GAAG,GAAI,SAAiB,CAAC,OAAO,IAAI,SAAS,CAAC;AACpD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;AA8BhE,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACjD,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACvC,CAAC;CACD;AAED,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAG5C,YAAY,QAAgB,EAAE,OAAe;QAC5C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;CACD;AAoBD,MAAM,eAAe,GAAG;IACvB,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACX,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,aAAa,EAAE;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzB;Q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AQ,CAAC,WAAW,CAAC,CAAC;QAC9C,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;QAClD,QAAQ,CAAC,oBAAoB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QAC5D,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC9C,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1C,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;QAChD,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;QACtD,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,QAAQ,CAAC,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,YAAY,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7D,IAAI,QAAQ,CAAC,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,cAAc,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,IAAI,QAAQ,CAAC,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,YAAY,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7D,KAAK,CAAC,IAAI,CAAC,mFAAmF,CAAC,CAAC;QAChG,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACD","sourcesContent":["import AjvModule from \"ajv\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\nconst Ajv = (AjvModule as any).default || AjvModule;\nconst ajv = new Ajv({ allErrors: true, allowUnionTypes: true });\n\nexport type ContractScope = \"project\" | \"session\";\n\nexport interface EngineeringContract {\n\tgoal?: string;\n\tscope_include?: string[];\n\tscope_exclude?: string[];\n\tconstraints?: string[];\n\tquality_gates?: string[];\n\tdefinition_of_done?: string[];\n\tassumptions?: string[];\n\tnon_goals?: string[];\n\trisks?: string[];\n\tdeliverables?: string[];\n\tsuccess_metrics?: string[];\n\tstakeholders?: string[];\n\towner?: string;\n\ttimebox?: string;\n\tnotes?: string;\n}\n\nexport interface ContractState {\n\tprojectPath: string;\n\thasProjectFile: boolean;\n\tproject: EngineeringContract;\n\tsessionOverlay: EngineeringContract;\n\teffective: EngineeringContract;\n}\n\nexport class ContractValidationError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"ContractValidationError\";\n\t}\n}\n\nexport class ContractParseError extends Error {\n\treadonly filePath: string;\n\n\tconstructor(filePath: string, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"ContractParseError\";\n\t\tthis.filePath = filePath;\n\t}\n}\n\ntype ContractSchemaPayload = {\n\tgoal?: string;\n\tscope_include?: string[];\n\tscope_exclude?: string[];\n\tconstraints?: string[];\n\tquality_gates?: string[];\n\tdefinition_of_done?: string[];\n\tassumptions?: string[];\n\tnon_goals?: string[];\n\trisks?: string[];\n\tdeliverables?: string[];\n\tsuccess_metrics?: string[];\n\tstakeholders?: string[];\n\towner?: string;\n\ttimebox?: string;\n\tnotes?: string;\n};\n\nconst CONTRACT_SCHEMA = {\n\ttype: \"object\",\n\tadditionalProperties: false,\n\tproperties: {\n\t\tgoal: { type: \"string\" },\n\t\tscope_include: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\tscope_exclude: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\tconstraints: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\tquality_gates: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\tdefinition_of_done: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\tassumptions: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\tnon_goals: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\trisks: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\tdeliverables: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\tsuccess_metrics: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\tstakeholders: {\n\t\t\ttype: \"array\",\n\t\t\titems: { type: \"string\" },\n\t\t},\n\t\towner: { type: \"string\" },\n\t\ttimebox: { type: \"string\" },\n\t\tnotes: { type: \"string\" },\n\t},\n\trequired: [],\n} as const;\n\nconst validateContract = ajv.compile(CONTRACT_SCHEMA as any) as {\n\t(payload: unknown): boolean;\n\terrors?: Array<{ instancePath?: string; message?: string }>;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction normalizeString(value: unknown): string | undefined {\n\tif (typeof value !== \"string\") return undefined;\n\tconst normalized = value.trim();\n\treturn normalized.length > 0 ? normalized : undefined;\n}\n\nfunction normalizeStringArray(value: unknown): string[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst normalized = value\n\t\t.filter((item): item is string => typeof item === \"string\")\n\t\t.map((item) => item.trim())\n\t\t.filter((item) => item.length > 0);\n\treturn normalized.length > 0 ? normalized : undefined;\n}\n\nfunction cloneContract(contract: EngineeringContract): EngineeringContract {\n\treturn {\n\t\t...(contract.goal ? { goal: contract.goal } : {}),\n\t\t...(contract.scope_include ? { scope_include: [...contract.scope_include] } : {}),\n\t\t...(contract.scope_exclude ? { scope_exclude: [...contract.scope_exclude] } : {}),\n\t\t...(contract.constraints ? { constraints: [...contract.constraints] } : {}),\n\t\t...(contract.quality_gates ? { quality_gates: [...contract.quality_gates] } : {}),\n\t\t...(contract.definition_of_done ? { definition_of_done: [...contract.definition_of_done] } : {}),\n\t\t...(contract.assumptions ? { assumptions: [...contract.assumptions] } : {}),\n\t\t...(contract.non_goals ? { non_goals: [...contract.non_goals] } : {}),\n\t\t...(contract.risks ? { risks: [...contract.risks] } : {}),\n\t\t...(contract.deliverables ? { deliverables: [...contract.deliverables] } : {}),\n\t\t...(contract.success_metrics ? { success_metrics: [...contract.success_metrics] } : {}),\n\t\t...(contract.stakeholders ? { stakeholders: [...contract.stakeholders] } : {}),\n\t\t...(contract.owner ? { owner: contract.owner } : {}),\n\t\t...(contract.timebox ? { timebox: contract.timebox } : {}),\n\t\t...(contract.notes ? { notes: contract.notes } : {}),\n\t};\n}\n\nfunction formatValidationError(payload: unknown): string {\n\tconst errors = validateContract.errors ?? [];\n\tif (errors.length === 0) {\n\t\treturn `Invalid contract payload: ${JSON.stringify(payload)}`;\n\t}\n\tconst details = errors\n\t\t.map((error: { instancePath?: string; message?: string }) => {\n\t\t\tconst path = error.instancePath || \"/\";\n\t\t\treturn `${path} ${error.message ?? \"is invalid\"}`;\n\t\t})\n\t\t.join(\"; \");\n\treturn `Invalid contract payload: ${details}`;\n}\n\nexport function normalizeEngineeringContract(payload: unknown): EngineeringContract {\n\tif (!isRecord(payload)) {\n\t\tthrow new ContractValidationError(\"Contract payload must be a JSON object.\");\n\t}\n\tif (!validateContract(payload)) {\n\t\tthrow new ContractValidationError(formatValidationError(payload));\n\t}\n\n\tconst goal = normalizeString(payload.goal);\n\tconst scopeInclude = normalizeStringArray(payload.scope_include);\n\tconst scopeExclude = normalizeStringArray(payload.scope_exclude);\n\tconst constraints = normalizeStringArray(payload.constraints);\n\tconst qualityGates = normalizeStringArray(payload.quality_gates);\n\tconst definitionOfDone = normalizeStringArray(payload.definition_of_done);\n\tconst assumptions = normalizeStringArray(payload.assumptions);\n\tconst nonGoals = normalizeStringArray(payload.non_goals);\n\tconst risks = normalizeStringArray(payload.risks);\n\tconst deliverables = normalizeStringArray(payload.deliverables);\n\tconst successMetrics = normalizeStringArray(payload.success_metrics);\n\tconst stakeholders = normalizeStringArray(payload.stakeholders);\n\tconst owner = normalizeString(payload.owner);\n\tconst timebox = normalizeString(payload.timebox);\n\tconst notes = normalizeString(payload.notes);\n\n\treturn {\n\t\t...(goal ? { goal } : {}),\n\t\t...(scopeInclude ? { scope_include: scopeInclude } : {}),\n\t\t...(scopeExclude ? { scope_exclude: scopeExclude } : {}),\n\t\t...(constraints ? { constraints } : {}),\n\t\t...(qualityGates ? { quality_gates: qualityGates } : {}),\n\t\t...(definitionOfDone ? { definition_of_done: definitionOfDone } : {}),\n\t\t...(assumptions ? { assumptions } : {}),\n\t\t...(nonGoals ? { non_goals: nonGoals } : {}),\n\t\t...(risks ? { risks } : {}),\n\t\t...(deliverables ? { deliverables } : {}),\n\t\t...(successMetrics ? { success_metrics: successMetrics } : {}),\n\t\t...(stakeholders ? { stakeholders } : {}),\n\t\t...(owner ? { owner } : {}),\n\t\t...(timebox ? { timebox } : {}),\n\t\t...(notes ? { notes } : {}),\n\t};\n}\n\nexport function deepMergeContracts(base: EngineeringContract, override: EngineeringContract): EngineeringContract {\n\tconst merged: EngineeringContract = cloneContract(base);\n\tfor (const [key, value] of Object.entries(override) as Array<[keyof EngineeringContract, unknown]>) {\n\t\tif (value === undefined) continue;\n\t\tif (Array.isArray(value)) {\n\t\t\t(merged as Record<string, unknown>)[key] = [...value];\n\t\t\tcontinue;\n\t\t}\n\t\t(merged as Record<string, unknown>)[key] = value;\n\t}\n\treturn normalizeEngineeringContract(merged);\n}\n\nfunction readContractFile(filePath: string): EngineeringContract {\n\tif (!existsSync(filePath)) {\n\t\treturn {};\n\t}\n\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(readFileSync(filePath, \"utf8\"));\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tthrow new ContractParseError(filePath, `Failed to parse contract JSON: ${message}`);\n\t}\n\n\ttry {\n\t\treturn normalizeEngineeringContract(parsed);\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tthrow new ContractParseError(filePath, message);\n\t}\n}\n\nfunction writeContractFile(filePath: string, contract: EngineeringContract): void {\n\tmkdirSync(dirname(filePath), { recursive: true });\n\twriteFileSync(filePath, `${JSON.stringify(contract, null, 2)}\\n`, \"utf8\");\n}\n\nexport interface ContractServiceOptions {\n\tcwd: string;\n}\n\nexport class ContractService {\n\tprivate readonly cwd: string;\n\tprivate sessionOverlay: EngineeringContract = {};\n\n\tconstructor(options: ContractServiceOptions) {\n\t\tthis.cwd = options.cwd;\n\t}\n\n\tgetProjectPath(): string {\n\t\treturn join(this.cwd, \".iosm\", \"contract.json\");\n\t}\n\n\tgetSessionOverlay(): EngineeringContract {\n\t\treturn cloneContract(this.sessionOverlay);\n\t}\n\n\tsetSessionOverlay(payload: unknown): EngineeringContract {\n\t\tconst normalized = normalizeEngineeringContract(payload);\n\t\tthis.sessionOverlay = normalized;\n\t\treturn cloneContract(normalized);\n\t}\n\n\tclearSessionOverlay(): void {\n\t\tthis.sessionOverlay = {};\n\t}\n\n\tloadProjectContract(): EngineeringContract {\n\t\treturn readContractFile(this.getProjectPath());\n\t}\n\n\tsaveProjectContract(payload: unknown): EngineeringContract {\n\t\tconst normalized = normalizeEngineeringContract(payload);\n\t\twriteContractFile(this.getProjectPath(), normalized);\n\t\treturn cloneContract(normalized);\n\t}\n\n\tclearProjectContract(): boolean {\n\t\tconst projectPath = this.getProjectPath();\n\t\tif (!existsSync(projectPath)) return false;\n\t\trmSync(projectPath, { force: true });\n\t\treturn true;\n\t}\n\n\tsave(scope: ContractScope, payload: unknown): EngineeringContract {\n\t\tif (scope === \"project\") {\n\t\t\treturn this.saveProjectContract(payload);\n\t\t}\n\t\treturn this.setSessionOverlay(payload);\n\t}\n\n\tclear(scope: ContractScope): boolean {\n\t\tif (scope === \"project\") {\n\t\t\treturn this.clearProjectContract();\n\t\t}\n\t\tthis.clearSessionOverlay();\n\t\treturn true;\n\t}\n\n\tgetState(): ContractState {\n\t\tconst projectPath = this.getProjectPath();\n\t\tconst hasProjectFile = existsSync(projectPath);\n\t\tconst project = this.loadProjectContract();\n\t\tconst sessionOverlay = this.getSessionOverlay();\n\t\tconst effective = deepMergeContracts(project, sessionOverlay);\n\t\treturn {\n\t\t\tprojectPath,\n\t\t\thasProjectFile,\n\t\t\tproject,\n\t\t\tsessionOverlay,\n\t\t\teffective,\n\t\t};\n\t}\n\n\tbuildPromptContext(maxItemsPerList = 4): string | undefined {\n\t\tconst state = this.getState();\n\t\tconst contract = state.effective;\n\t\tif (Object.keys(contract).length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst lines: string[] = [\"Active engineering contract (effective):\"];\n\t\tif (contract.goal) lines.push(`- goal: ${contract.goal}`);\n\n\t\tconst pushList = (label: string, values: string[] | undefined): void => {\n\t\t\tif (!values || values.length === 0) return;\n\t\t\tconst preview = values.slice(0, Math.max(1, maxItemsPerList));\n\t\t\tconst suffix = values.length > preview.length ? ` (+${values.length - preview.length} more)` : \"\";\n\t\t\tlines.push(`- ${label}: ${preview.join(\"; \")}${suffix}`);\n\t\t};\n\n\t\tpushList(\"scope_include\", contract.scope_include);\n\t\tpushList(\"scope_exclude\", contract.scope_exclude);\n\t\tpushList(\"constraints\", contract.constraints);\n\t\tpushList(\"quality_gates\", contract.quality_gates);\n\t\tpushList(\"definition_of_done\", contract.definition_of_done);\n\t\tpushList(\"assumptions\", contract.assumptions);\n\t\tpushList(\"non_goals\", contract.non_goals);\n\t\tpushList(\"risks\", contract.risks);\n\t\tpushList(\"deliverables\", contract.deliverables);\n\t\tpushList(\"success_metrics\", contract.success_metrics);\n\t\tpushList(\"stakeholders\", contract.stakeholders);\n\t\tif (contract.owner) lines.push(`- owner: ${contract.owner}`);\n\t\tif (contract.timebox) lines.push(`- timebox: ${contract.timebox}`);\n\t\tif (contract.notes) lines.push(`- notes: ${contract.notes}`);\n\t\tlines.push(\"Treat this contract as execution constraints unless user explicitly overrides it.\");\n\t\treturn lines.join(\"\\n\");\n\t}\n}\n"]}
|
package/dist/core/sdk.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { ModelRegistry } from "./model-registry.js";
|
|
|
8
8
|
import type { ResourceLoader } from "./resource-loader.js";
|
|
9
9
|
import { SessionManager } from "./session-manager.js";
|
|
10
10
|
import { SettingsManager } from "./settings-manager.js";
|
|
11
|
-
import { allTools, astGrepTool, bashTool, codingTools, combyTool, createAstGrepTool, createBashTool, createCodingTools, createCombyTool, createEditTool, createFdTool, createFindTool, createGrepTool, createJqTool, createLsTool, createReadOnlyTools, createReadTool, createRgTool, createSedTool, createSemgrepTool, createWriteTool, editTool, fdTool, findTool, grepTool, jqTool, lsTool, readOnlyTools, readTool, rgTool, sedTool, semgrepTool, type Tool, yqTool, createYqTool, writeTool } from "./tools/index.js";
|
|
11
|
+
import { allTools, astGrepTool, bashTool, codingTools, combyTool, createAstGrepTool, createBashTool, createCodingTools, createCombyTool, createEditTool, createFdTool, createFindTool, createGrepTool, createJqTool, createLsTool, createReadOnlyTools, createReadTool, createRgTool, createSedTool, createSemgrepTool, createSemanticSearchTool, createWriteTool, editTool, fdTool, findTool, grepTool, jqTool, lsTool, readOnlyTools, readTool, rgTool, sedTool, semanticSearchTool, semgrepTool, type Tool, yqTool, createYqTool, writeTool } from "./tools/index.js";
|
|
12
12
|
import { type AgentProfileName } from "./agent-profiles.js";
|
|
13
13
|
export interface CreateAgentSessionOptions {
|
|
14
14
|
/** Working directory for project-local discovery. Default: process.cwd() */
|
|
@@ -30,7 +30,7 @@ export interface CreateAgentSessionOptions {
|
|
|
30
30
|
model: Model<any>;
|
|
31
31
|
thinkingLevel?: ThinkingLevel;
|
|
32
32
|
}>;
|
|
33
|
-
/** Built-in tools to use. Default:
|
|
33
|
+
/** Built-in tools to use. Default: active profile tools (profile defaults to "full"). */
|
|
34
34
|
tools?: Tool[];
|
|
35
35
|
/** Custom tools to register (in addition to built-in tools). */
|
|
36
36
|
customTools?: ToolDefinition[];
|
|
@@ -66,7 +66,7 @@ export type { ExtensionAPI, ExtensionCommandContext, ExtensionContext, Extension
|
|
|
66
66
|
export type { PromptTemplate } from "./prompt-templates.js";
|
|
67
67
|
export type { Skill } from "./skills.js";
|
|
68
68
|
export type { Tool } from "./tools/index.js";
|
|
69
|
-
export { createAskUserTool, readTool, bashTool, editTool, writeTool, grepTool, findTool, lsTool, rgTool, fdTool, astGrepTool, combyTool, jqTool, yqTool, semgrepTool, sedTool, codingTools, readOnlyTools, allTools as allBuiltInTools, createCodingTools, createReadOnlyTools, createReadTool, createBashTool, createEditTool, createWriteTool, createGrepTool, createFindTool, createLsTool, createRgTool, createFdTool, createAstGrepTool, createCombyTool, createJqTool, createYqTool, createSemgrepTool, createSedTool, };
|
|
69
|
+
export { createAskUserTool, readTool, bashTool, editTool, writeTool, grepTool, findTool, lsTool, rgTool, fdTool, astGrepTool, combyTool, jqTool, yqTool, semgrepTool, sedTool, semanticSearchTool, codingTools, readOnlyTools, allTools as allBuiltInTools, createCodingTools, createReadOnlyTools, createReadTool, createBashTool, createEditTool, createWriteTool, createGrepTool, createFindTool, createLsTool, createRgTool, createFdTool, createAstGrepTool, createCombyTool, createJqTool, createYqTool, createSemgrepTool, createSedTool, createSemanticSearchTool, };
|
|
70
70
|
/**
|
|
71
71
|
* Create an AgentSession with the specified options.
|
|
72
72
|
*
|
package/dist/core/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/core/sdk.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,KAAK,EAAW,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAA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B,EACjB,aAAa,EACb,wBAAwB,GACxB,CAAC;AA+BH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAuanH"}
|
package/dist/core/sdk.js
CHANGED
|
@@ -14,13 +14,13 @@ import { SettingsManager } from "./settings-manager.js";
|
|
|
14
14
|
import { loadCustomSubagents, resolveCustomSubagentReference } from "./subagents.js";
|
|
15
15
|
import { time } from "./timings.js";
|
|
16
16
|
import { patchAgentForParallelTaskExecution } from "./parallel-task-agent.js";
|
|
17
|
-
import { allTools, astGrepTool, bashTool, codingTools, combyTool, createAstGrepTool, createBashTool, createCodingTools, createCombyTool, createEditTool, createFdTool, createFindTool, createGrepTool, createJqTool, createLsTool, createReadOnlyTools, createReadTool, createRgTool, createSedTool, createSemgrepTool, createTaskTool, createToolsFromNames, createWriteTool, editTool, fdTool, findTool, grepTool, jqTool, lsTool, readOnlyTools, readTool, rgTool, sedTool, semgrepTool, yqTool, createYqTool, writeTool, } from "./tools/index.js";
|
|
17
|
+
import { allTools, astGrepTool, bashTool, codingTools, combyTool, createAstGrepTool, createBashTool, createCodingTools, createCombyTool, createEditTool, createFdTool, createFindTool, createGrepTool, createJqTool, createLsTool, createReadOnlyTools, createReadTool, createRgTool, createSedTool, createSemgrepTool, createSemanticSearchTool, createTaskTool, createToolsFromNames, createWriteTool, editTool, fdTool, findTool, grepTool, jqTool, lsTool, readOnlyTools, readTool, rgTool, sedTool, semanticSearchTool, semgrepTool, yqTool, createYqTool, writeTool, } from "./tools/index.js";
|
|
18
18
|
import { getAgentProfile } from "./agent-profiles.js";
|
|
19
19
|
export { createAskUserTool,
|
|
20
20
|
// Pre-built tools (use process.cwd())
|
|
21
|
-
readTool, bashTool, editTool, writeTool, grepTool, findTool, lsTool, rgTool, fdTool, astGrepTool, combyTool, jqTool, yqTool, semgrepTool, sedTool, codingTools, readOnlyTools, allTools as allBuiltInTools,
|
|
21
|
+
readTool, bashTool, editTool, writeTool, grepTool, findTool, lsTool, rgTool, fdTool, astGrepTool, combyTool, jqTool, yqTool, semgrepTool, sedTool, semanticSearchTool, codingTools, readOnlyTools, allTools as allBuiltInTools,
|
|
22
22
|
// Tool factories (for custom cwd)
|
|
23
|
-
createCodingTools, createReadOnlyTools, createReadTool, createBashTool, createEditTool, createWriteTool, createGrepTool, createFindTool, createLsTool, createRgTool, createFdTool, createAstGrepTool, createCombyTool, createJqTool, createYqTool, createSemgrepTool, createSedTool, };
|
|
23
|
+
createCodingTools, createReadOnlyTools, createReadTool, createBashTool, createEditTool, createWriteTool, createGrepTool, createFindTool, createLsTool, createRgTool, createFdTool, createAstGrepTool, createCombyTool, createJqTool, createYqTool, createSemgrepTool, createSedTool, createSemanticSearchTool, };
|
|
24
24
|
// Helper Functions
|
|
25
25
|
function getDefaultAgentDir() {
|
|
26
26
|
return getAgentDir();
|
|
@@ -150,9 +150,10 @@ export async function createAgentSession(options = {}) {
|
|
|
150
150
|
if (!model || !model.reasoning) {
|
|
151
151
|
thinkingLevel = "off";
|
|
152
152
|
}
|
|
153
|
-
// Apply agent profile:
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
// Apply agent profile: default to "full" when no explicit profile is provided.
|
|
154
|
+
// This keeps runtime tool availability aligned with UI/profile badges.
|
|
155
|
+
const profile = getAgentProfile(options.profile);
|
|
156
|
+
if (profile.name !== "full") {
|
|
156
157
|
// Profile overrides thinking level only when caller did not explicitly pass one
|
|
157
158
|
if (options.thinkingLevel === undefined && !hasExistingSession) {
|
|
158
159
|
thinkingLevel = profile.thinkingLevel;
|
|
@@ -163,18 +164,7 @@ export async function createAgentSession(options = {}) {
|
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
const enableTaskTool = options.enableTaskTool !== false; // default true
|
|
166
|
-
const
|
|
167
|
-
"read",
|
|
168
|
-
"bash",
|
|
169
|
-
"edit",
|
|
170
|
-
"write",
|
|
171
|
-
...(enableTaskTool ? ["task"] : []),
|
|
172
|
-
"todo_write",
|
|
173
|
-
"todo_read",
|
|
174
|
-
];
|
|
175
|
-
const profileToolNames = profile
|
|
176
|
-
? [...profile.tools, ...(enableTaskTool ? ["task"] : []), "todo_write", "todo_read"].filter((n) => n === "task" || n in allTools)
|
|
177
|
-
: defaultActiveToolNames;
|
|
167
|
+
const profileToolNames = [...profile.tools, ...(enableTaskTool ? ["task"] : []), "todo_write", "todo_read"].filter((n) => n === "task" || n in allTools);
|
|
178
168
|
const initialActiveToolNames = options.tools
|
|
179
169
|
? options.tools.map((t) => t.name).filter((n) => n === "task" || n in allTools)
|
|
180
170
|
: profileToolNames;
|
|
@@ -287,7 +277,9 @@ export async function createAgentSession(options = {}) {
|
|
|
287
277
|
authStorage,
|
|
288
278
|
modelRegistry,
|
|
289
279
|
model: subModel,
|
|
290
|
-
tools: createToolsFromNames(runnerOptions.cwd, runnerOptions.tools
|
|
280
|
+
tools: createToolsFromNames(runnerOptions.cwd, runnerOptions.tools, {
|
|
281
|
+
semantic: { authStorage, agentDir },
|
|
282
|
+
}),
|
|
291
283
|
sessionManager: SessionManager.inMemory(),
|
|
292
284
|
settingsManager,
|
|
293
285
|
enableTaskTool: false, // prevent recursive subagent spawning
|