iosm-cli 0.1.2 → 0.1.3
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 +6 -0
- package/README.md +6 -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/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 +261 -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 +499 -0
- package/dist/core/semantic/runtime.js.map +1 -0
- package/dist/core/semantic/types.d.ts +151 -0
- package/dist/core/semantic/types.d.ts.map +1 -0
- package/dist/core/semantic/types.js +17 -0
- package/dist/core/semantic/types.js.map +1 -0
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -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 +19 -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 +122 -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 +117 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +15 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +687 -4
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/cli-reference.md +18 -1
- package/docs/configuration.md +74 -2
- package/docs/getting-started.md +1 -0
- package/docs/interactive-mode.md +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
export type SemanticScope = "user" | "project";
|
|
2
|
+
export type SemanticProviderType = "openrouter" | "ollama" | "custom_openai";
|
|
3
|
+
export type SemanticAction = "status" | "index" | "rebuild" | "query";
|
|
4
|
+
export type SemanticStaleReason = "missing_index" | "provider_changed" | "chunking_changed" | "index_filters_changed" | "files_changed" | "dimension_mismatch";
|
|
5
|
+
export interface SemanticProviderConfig {
|
|
6
|
+
type: SemanticProviderType;
|
|
7
|
+
model: string;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
apiKeyEnv?: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
batchSize: number;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
}
|
|
14
|
+
export interface SemanticIndexConfig {
|
|
15
|
+
includeGlobs: string[];
|
|
16
|
+
excludeGlobs: string[];
|
|
17
|
+
chunkMaxChars: number;
|
|
18
|
+
chunkOverlapChars: number;
|
|
19
|
+
maxFileBytes: number;
|
|
20
|
+
maxFiles: number;
|
|
21
|
+
}
|
|
22
|
+
export interface SemanticSearchConfig {
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
provider: SemanticProviderConfig;
|
|
25
|
+
index: SemanticIndexConfig;
|
|
26
|
+
}
|
|
27
|
+
export interface SemanticConfigFile {
|
|
28
|
+
semanticSearch?: Partial<{
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
provider: Partial<{
|
|
31
|
+
type: SemanticProviderType;
|
|
32
|
+
model: string;
|
|
33
|
+
baseUrl: string;
|
|
34
|
+
apiKeyEnv: string;
|
|
35
|
+
headers: Record<string, string>;
|
|
36
|
+
batchSize: number;
|
|
37
|
+
timeoutMs: number;
|
|
38
|
+
}>;
|
|
39
|
+
index: Partial<{
|
|
40
|
+
includeGlobs: string[];
|
|
41
|
+
excludeGlobs: string[];
|
|
42
|
+
chunkMaxChars: number;
|
|
43
|
+
chunkOverlapChars: number;
|
|
44
|
+
maxFileBytes: number;
|
|
45
|
+
maxFiles: number;
|
|
46
|
+
}>;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
export interface SemanticScopedLoadResult {
|
|
50
|
+
scope: SemanticScope;
|
|
51
|
+
path: string;
|
|
52
|
+
file: SemanticConfigFile;
|
|
53
|
+
error?: Error;
|
|
54
|
+
}
|
|
55
|
+
export interface SemanticMergedConfig {
|
|
56
|
+
config?: SemanticSearchConfig;
|
|
57
|
+
errors: string[];
|
|
58
|
+
scoped: SemanticScopedLoadResult[];
|
|
59
|
+
}
|
|
60
|
+
export interface SemanticFileFingerprint {
|
|
61
|
+
path: string;
|
|
62
|
+
size: number;
|
|
63
|
+
mtimeMs: number;
|
|
64
|
+
hash: string;
|
|
65
|
+
chunks: string[];
|
|
66
|
+
}
|
|
67
|
+
export interface SemanticIndexMeta {
|
|
68
|
+
version: 1;
|
|
69
|
+
cwd: string;
|
|
70
|
+
projectHash: string;
|
|
71
|
+
providerFingerprint: string;
|
|
72
|
+
providerType: SemanticProviderType;
|
|
73
|
+
model: string;
|
|
74
|
+
dimension: number;
|
|
75
|
+
builtAt: string;
|
|
76
|
+
chunkConfigFingerprint: string;
|
|
77
|
+
indexFilterFingerprint: string;
|
|
78
|
+
fileMap: Record<string, SemanticFileFingerprint>;
|
|
79
|
+
}
|
|
80
|
+
export interface SemanticIndexedChunk {
|
|
81
|
+
id: string;
|
|
82
|
+
path: string;
|
|
83
|
+
lineStart: number;
|
|
84
|
+
lineEnd: number;
|
|
85
|
+
preview: string;
|
|
86
|
+
hash: string;
|
|
87
|
+
}
|
|
88
|
+
export interface SemanticIndexedVector {
|
|
89
|
+
id: string;
|
|
90
|
+
vector: number[];
|
|
91
|
+
norm: number;
|
|
92
|
+
}
|
|
93
|
+
export interface SemanticChunkForEmbedding extends SemanticIndexedChunk {
|
|
94
|
+
text: string;
|
|
95
|
+
}
|
|
96
|
+
export interface SemanticIndexOperationResult {
|
|
97
|
+
action: "index" | "rebuild";
|
|
98
|
+
indexPath: string;
|
|
99
|
+
durationMs: number;
|
|
100
|
+
processedFiles: number;
|
|
101
|
+
newFiles: number;
|
|
102
|
+
changedFiles: number;
|
|
103
|
+
removedFiles: number;
|
|
104
|
+
reusedFiles: number;
|
|
105
|
+
chunks: number;
|
|
106
|
+
dimension: number;
|
|
107
|
+
builtAt: string;
|
|
108
|
+
}
|
|
109
|
+
export interface SemanticStatusResult {
|
|
110
|
+
action: "status";
|
|
111
|
+
configured: boolean;
|
|
112
|
+
enabled: boolean;
|
|
113
|
+
indexed: boolean;
|
|
114
|
+
stale: boolean;
|
|
115
|
+
staleReason?: SemanticStaleReason;
|
|
116
|
+
provider?: SemanticProviderType;
|
|
117
|
+
model?: string;
|
|
118
|
+
files: number;
|
|
119
|
+
chunks: number;
|
|
120
|
+
dimension?: number;
|
|
121
|
+
ageSeconds?: number;
|
|
122
|
+
indexPath: string;
|
|
123
|
+
configPathUser: string;
|
|
124
|
+
configPathProject: string;
|
|
125
|
+
}
|
|
126
|
+
export interface SemanticQueryHit {
|
|
127
|
+
score: number;
|
|
128
|
+
path: string;
|
|
129
|
+
lineStart: number;
|
|
130
|
+
lineEnd: number;
|
|
131
|
+
snippet: string;
|
|
132
|
+
}
|
|
133
|
+
export interface SemanticQueryResult {
|
|
134
|
+
action: "query";
|
|
135
|
+
query: string;
|
|
136
|
+
topK: number;
|
|
137
|
+
autoRefreshed: boolean;
|
|
138
|
+
hits: SemanticQueryHit[];
|
|
139
|
+
}
|
|
140
|
+
export type SemanticToolResult = SemanticStatusResult | SemanticIndexOperationResult | SemanticQueryResult;
|
|
141
|
+
export declare class SemanticConfigError extends Error {
|
|
142
|
+
}
|
|
143
|
+
export declare class SemanticConfigMissingError extends Error {
|
|
144
|
+
readonly userConfigPath: string;
|
|
145
|
+
readonly projectConfigPath: string;
|
|
146
|
+
constructor(userConfigPath: string, projectConfigPath: string);
|
|
147
|
+
}
|
|
148
|
+
export declare class SemanticRebuildRequiredError extends Error {
|
|
149
|
+
constructor(message: string);
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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AAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;IACvB,IAAI,EAAE,gBAAgB,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,kBAAkB,GAC3B,oBAAoB,GACpB,4BAA4B,GAC5B,mBAAmB,CAAC;AAEvB,qBAAa,mBAAoB,SAAQ,KAAK;CAAG;AAEjD,qBAAa,0BAA2B,SAAQ,KAAK;IACpD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;gBAEvB,cAAc,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM;CAQ7D;AAED,qBAAa,4BAA6B,SAAQ,KAAK;gBAC1C,OAAO,EAAE,MAAM;CAI3B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class SemanticConfigError extends Error {
|
|
2
|
+
}
|
|
3
|
+
export class SemanticConfigMissingError extends Error {
|
|
4
|
+
constructor(userConfigPath, projectConfigPath) {
|
|
5
|
+
super(`Semantic search config not found. Create one with /semantic setup or write ${userConfigPath} (user) or ${projectConfigPath} (project).`);
|
|
6
|
+
this.name = "SemanticConfigMissingError";
|
|
7
|
+
this.userConfigPath = userConfigPath;
|
|
8
|
+
this.projectConfigPath = projectConfigPath;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export class SemanticRebuildRequiredError extends Error {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "SemanticRebuildRequiredError";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/semantic/types.ts"],"names":[],"mappings":"AAsKA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;CAAG;AAEjD,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAIpD,YAAY,cAAsB,EAAE,iBAAyB;QAC5D,KAAK,CACJ,8EAA8E,cAAc,cAAc,iBAAiB,aAAa,CACxI,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC5C,CAAC;CACD;AAED,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IACtD,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC5C,CAAC;CACD","sourcesContent":["export type SemanticScope = \"user\" | \"project\";\nexport type SemanticProviderType = \"openrouter\" | \"ollama\" | \"custom_openai\";\nexport type SemanticAction = \"status\" | \"index\" | \"rebuild\" | \"query\";\nexport type SemanticStaleReason =\n\t| \"missing_index\"\n\t| \"provider_changed\"\n\t| \"chunking_changed\"\n\t| \"index_filters_changed\"\n\t| \"files_changed\"\n\t| \"dimension_mismatch\";\n\nexport interface SemanticProviderConfig {\n\ttype: SemanticProviderType;\n\tmodel: string;\n\tbaseUrl?: string;\n\tapiKeyEnv?: string;\n\theaders?: Record<string, string>;\n\tbatchSize: number;\n\ttimeoutMs: number;\n}\n\nexport interface SemanticIndexConfig {\n\tincludeGlobs: string[];\n\texcludeGlobs: string[];\n\tchunkMaxChars: number;\n\tchunkOverlapChars: number;\n\tmaxFileBytes: number;\n\tmaxFiles: number;\n}\n\nexport interface SemanticSearchConfig {\n\tenabled: boolean;\n\tprovider: SemanticProviderConfig;\n\tindex: SemanticIndexConfig;\n}\n\nexport interface SemanticConfigFile {\n\tsemanticSearch?: Partial<{\n\t\tenabled: boolean;\n\t\tprovider: Partial<{\n\t\t\ttype: SemanticProviderType;\n\t\t\tmodel: string;\n\t\t\tbaseUrl: string;\n\t\t\tapiKeyEnv: string;\n\t\t\theaders: Record<string, string>;\n\t\t\tbatchSize: number;\n\t\t\ttimeoutMs: number;\n\t\t}>;\n\t\tindex: Partial<{\n\t\t\tincludeGlobs: string[];\n\t\t\texcludeGlobs: string[];\n\t\t\tchunkMaxChars: number;\n\t\t\tchunkOverlapChars: number;\n\t\t\tmaxFileBytes: number;\n\t\t\tmaxFiles: number;\n\t\t}>;\n\t}>;\n}\n\nexport interface SemanticScopedLoadResult {\n\tscope: SemanticScope;\n\tpath: string;\n\tfile: SemanticConfigFile;\n\terror?: Error;\n}\n\nexport interface SemanticMergedConfig {\n\tconfig?: SemanticSearchConfig;\n\terrors: string[];\n\tscoped: SemanticScopedLoadResult[];\n}\n\nexport interface SemanticFileFingerprint {\n\tpath: string;\n\tsize: number;\n\tmtimeMs: number;\n\thash: string;\n\tchunks: string[];\n}\n\nexport interface SemanticIndexMeta {\n\tversion: 1;\n\tcwd: string;\n\tprojectHash: string;\n\tproviderFingerprint: string;\n\tproviderType: SemanticProviderType;\n\tmodel: string;\n\tdimension: number;\n\tbuiltAt: string;\n\tchunkConfigFingerprint: string;\n\tindexFilterFingerprint: string;\n\tfileMap: Record<string, SemanticFileFingerprint>;\n}\n\nexport interface SemanticIndexedChunk {\n\tid: string;\n\tpath: string;\n\tlineStart: number;\n\tlineEnd: number;\n\tpreview: string;\n\thash: string;\n}\n\nexport interface SemanticIndexedVector {\n\tid: string;\n\tvector: number[];\n\tnorm: number;\n}\n\nexport interface SemanticChunkForEmbedding extends SemanticIndexedChunk {\n\ttext: string;\n}\n\nexport interface SemanticIndexOperationResult {\n\taction: \"index\" | \"rebuild\";\n\tindexPath: string;\n\tdurationMs: number;\n\tprocessedFiles: number;\n\tnewFiles: number;\n\tchangedFiles: number;\n\tremovedFiles: number;\n\treusedFiles: number;\n\tchunks: number;\n\tdimension: number;\n\tbuiltAt: string;\n}\n\nexport interface SemanticStatusResult {\n\taction: \"status\";\n\tconfigured: boolean;\n\tenabled: boolean;\n\tindexed: boolean;\n\tstale: boolean;\n\tstaleReason?: SemanticStaleReason;\n\tprovider?: SemanticProviderType;\n\tmodel?: string;\n\tfiles: number;\n\tchunks: number;\n\tdimension?: number;\n\tageSeconds?: number;\n\tindexPath: string;\n\tconfigPathUser: string;\n\tconfigPathProject: string;\n}\n\nexport interface SemanticQueryHit {\n\tscore: number;\n\tpath: string;\n\tlineStart: number;\n\tlineEnd: number;\n\tsnippet: string;\n}\n\nexport interface SemanticQueryResult {\n\taction: \"query\";\n\tquery: string;\n\ttopK: number;\n\tautoRefreshed: boolean;\n\thits: SemanticQueryHit[];\n}\n\nexport type SemanticToolResult =\n\t| SemanticStatusResult\n\t| SemanticIndexOperationResult\n\t| SemanticQueryResult;\n\nexport class SemanticConfigError extends Error {}\n\nexport class SemanticConfigMissingError extends Error {\n\treadonly userConfigPath: string;\n\treadonly projectConfigPath: string;\n\n\tconstructor(userConfigPath: string, projectConfigPath: string) {\n\t\tsuper(\n\t\t\t`Semantic search config not found. Create one with /semantic setup or write ${userConfigPath} (user) or ${projectConfigPath} (project).`,\n\t\t);\n\t\tthis.name = \"SemanticConfigMissingError\";\n\t\tthis.userConfigPath = userConfigPath;\n\t\tthis.projectConfigPath = projectConfigPath;\n\t}\n}\n\nexport class SemanticRebuildRequiredError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"SemanticRebuildRequiredError\";\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash-commands.d.ts","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAE/D,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"slash-commands.d.ts","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAE/D,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,mBAAmB,CA2ErE,CAAC"}
|
|
@@ -31,6 +31,10 @@ export const BUILTIN_SLASH_COMMANDS = [
|
|
|
31
31
|
name: "memory",
|
|
32
32
|
description: "Memory manager: /memory (interactive), /memory <text>, /memory edit <index> <text>, /memory rm <index>",
|
|
33
33
|
},
|
|
34
|
+
{
|
|
35
|
+
name: "semantic",
|
|
36
|
+
description: "Semantic search manager: /semantic (interactive UI), /semantic setup|status|index|rebuild|query <text> [--top-k N]",
|
|
37
|
+
},
|
|
34
38
|
{ name: "settings", description: "Open settings menu" },
|
|
35
39
|
{
|
|
36
40
|
name: "permissions",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACzE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,0EAA0E,EAAE;IACzG;QACC,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,0FAA0F;KACvG;IACD;QACC,IAAI,EAAE,aAAa;QACnB,WAAW,EACV,4MAA4M;KAC7M;IACD;QACC,IAAI,EAAE,QAAQ;QACd,WAAW,EACV,qHAAqH;KACtH;IACD,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,qDAAqD,EAAE;IAC7F;QACC,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,yGAAyG;KACtH;IACD,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,gEAAgE,EAAE;IACpG,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,0EAA0E,EAAE;IAChH,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE;IACvD,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,oEAAoE,EAAE;IACzG,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,kEAAkE,EAAE;IACzG,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,uDAAuD,EAAE;IAC9F;QACC,IAAI,EAAE,KAAK;QACX,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AAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE;IACjD,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mDAAmD,EAAE;IACpF,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE;IACnD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE;IAChD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACxE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC7D,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gDAAgD,EAAE;IACjF,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE;CAC1C,CAAC","sourcesContent":["export type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport type SlashCommandLocation = \"user\" | \"project\" | \"path\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tlocation?: SlashCommandLocation;\n\tpath?: string;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"init\", description: \"Initialize iosm.yaml and .iosm scaffold in current (or target) directory\" },\n\t{\n\t\tname: \"iosm\",\n\t\tdescription: \"Run IOSM auto-improvement loop: /iosm [target-index] [--max-iterations N] [--force-init]\",\n\t},\n\t{\n\t\tname: \"orchestrate\",\n\t\tdescription:\n\t\t\t\"Run orchestrated subagents: /orchestrate (--parallel|--sequential) --agents N [--max-parallel N] [--profile <name>|--profiles p1,p2] [--cwd p1,p2] [--locks l1,l2] [--worktree] [--depends 2>1,3>2] <task>\",\n\t},\n\t{\n\t\tname: \"agents\",\n\t\tdescription:\n\t\t\t\"Interactive agent menu: browse/use/create/edit/delete custom agents and inspect source precedence from .iosm/agents\",\n\t},\n\t{ name: \"subagent-runs\", description: \"List recent subagent runs from .iosm/subagents/runs\" },\n\t{\n\t\tname: \"subagent-resume\",\n\t\tdescription: \"Resume from prior subagent output: /subagent-resume [run-id] [extra instructions] (picker when omitted)\",\n\t},\n\t{ name: \"team-runs\", description: \"List recent team orchestration runs from .iosm/subagents/teams\" },\n\t{ name: \"team-status\", description: \"Show a team run status: /team-status [team-run-id] (picker when omitted)\" },\n\t{ name: \"cycle-list\", description: \"List IOSM cycles\" },\n\t{ name: \"cycle-plan\", description: \"Plan a new IOSM cycle: /cycle-plan [--id <id>] [--force] <goal...>\" },\n\t{ name: \"cycle-status\", description: \"Show IOSM cycle completeness and gates: /cycle-status [cycle-id]\" },\n\t{ name: \"cycle-report\", description: \"Show IOSM cycle report JSON: /cycle-report [cycle-id]\" },\n\t{\n\t\tname: \"mcp\",\n\t\tdescription:\n\t\t\t\"MCP server manager: /mcp (interactive UI), /mcp add <name> ..., /mcp list, /mcp tools [name], /mcp enable|disable|remove <name>\",\n\t},\n\t{\n\t\tname: \"memory\",\n\t\tdescription:\n\t\t\t\"Memory manager: /memory (interactive), /memory <text>, /memory edit <index> <text>, /memory rm <index>\",\n\t},\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{\n\t\tname: \"permissions\",\n\t\tdescription:\n\t\t\t\"Permission controls: /permissions (interactive menu) or /permissions [ask|auto|yolo|status|hooks] and /permissions [allow|deny] [list|add|remove] <tool:match>\",\n\t},\n\t{ name: \"yolo\", description: \"Toggle permission prompts: /yolo [on|off|status]\" },\n\t{ name: \"model\", description: \"Select model (provider-first selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session to HTML file: /export [output-path] (wizard when omitted)\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{\n\t\tname: \"doctor\",\n\t\tdescription: \"Run runtime diagnostics (model/auth/MCP/CLI tools/hooks/paths) with optional interactive fixes\",\n\t},\n\t{ name: \"checkpoint\", description: \"Create/list checkpoints for safe rollback\" },\n\t{ name: \"rollback\", description: \"Rollback session tree to a checkpoint (picker when omitted)\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous message\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Authenticate with provider (OAuth incl. Qwen + OpenRouter API key)\" },\n\t{ name: \"auth\", description: \"Alias for /login\" },\n\t{ name: \"logout\", description: \"Remove saved provider credentials (OAuth/API key)\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"clear\", description: \"Alias for /new\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload extensions, skills, prompts, and themes\" },\n\t{ name: \"quit\", description: \"Quit iosm\" },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/core/slash-commands.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,sBAAsB,GAAuC;IACzE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,0EAA0E,EAAE;IACzG;QACC,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,0FAA0F;KACvG;IACD;QACC,IAAI,EAAE,aAAa;QACnB,WAAW,EACV,4MAA4M;KAC7M;IACD;QACC,IAAI,EAAE,QAAQ;QACd,WAAW,EACV,qHAAqH;KACtH;IACD,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,qDAAqD,EAAE;IAC7F;QACC,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,yGAAyG;KACtH;IACD,EAAE,IAAI,E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,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,2CAA2C,EAAE;IAChF,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,6DAA6D,EAAE;IAChG,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,wBAAwB,EAAE;IAC5D,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,6BAA6B,EAAE;IAC/D,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,2CAA2C,EAAE;IAC1E,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,yCAAyC,EAAE;IACxE,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,oEAAoE,EAAE;IACpG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE;IACjD,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mDAAmD,EAAE;IACpF,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE;IACnD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE;IAChD,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,sCAAsC,EAAE;IACxE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC7D,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gDAAgD,EAAE;IACjF,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE;CAC1C,CAAC","sourcesContent":["export type SlashCommandSource = \"extension\" | \"prompt\" | \"skill\";\n\nexport type SlashCommandLocation = \"user\" | \"project\" | \"path\";\n\nexport interface SlashCommandInfo {\n\tname: string;\n\tdescription?: string;\n\tsource: SlashCommandSource;\n\tlocation?: SlashCommandLocation;\n\tpath?: string;\n}\n\nexport interface BuiltinSlashCommand {\n\tname: string;\n\tdescription: string;\n}\n\nexport const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand> = [\n\t{ name: \"init\", description: \"Initialize iosm.yaml and .iosm scaffold in current (or target) directory\" },\n\t{\n\t\tname: \"iosm\",\n\t\tdescription: \"Run IOSM auto-improvement loop: /iosm [target-index] [--max-iterations N] [--force-init]\",\n\t},\n\t{\n\t\tname: \"orchestrate\",\n\t\tdescription:\n\t\t\t\"Run orchestrated subagents: /orchestrate (--parallel|--sequential) --agents N [--max-parallel N] [--profile <name>|--profiles p1,p2] [--cwd p1,p2] [--locks l1,l2] [--worktree] [--depends 2>1,3>2] <task>\",\n\t},\n\t{\n\t\tname: \"agents\",\n\t\tdescription:\n\t\t\t\"Interactive agent menu: browse/use/create/edit/delete custom agents and inspect source precedence from .iosm/agents\",\n\t},\n\t{ name: \"subagent-runs\", description: \"List recent subagent runs from .iosm/subagents/runs\" },\n\t{\n\t\tname: \"subagent-resume\",\n\t\tdescription: \"Resume from prior subagent output: /subagent-resume [run-id] [extra instructions] (picker when omitted)\",\n\t},\n\t{ name: \"team-runs\", description: \"List recent team orchestration runs from .iosm/subagents/teams\" },\n\t{ name: \"team-status\", description: \"Show a team run status: /team-status [team-run-id] (picker when omitted)\" },\n\t{ name: \"cycle-list\", description: \"List IOSM cycles\" },\n\t{ name: \"cycle-plan\", description: \"Plan a new IOSM cycle: /cycle-plan [--id <id>] [--force] <goal...>\" },\n\t{ name: \"cycle-status\", description: \"Show IOSM cycle completeness and gates: /cycle-status [cycle-id]\" },\n\t{ name: \"cycle-report\", description: \"Show IOSM cycle report JSON: /cycle-report [cycle-id]\" },\n\t{\n\t\tname: \"mcp\",\n\t\tdescription:\n\t\t\t\"MCP server manager: /mcp (interactive UI), /mcp add <name> ..., /mcp list, /mcp tools [name], /mcp enable|disable|remove <name>\",\n\t},\n\t{\n\t\tname: \"memory\",\n\t\tdescription:\n\t\t\t\"Memory manager: /memory (interactive), /memory <text>, /memory edit <index> <text>, /memory rm <index>\",\n\t},\n\t{\n\t\tname: \"semantic\",\n\t\tdescription:\n\t\t\t\"Semantic search manager: /semantic (interactive UI), /semantic setup|status|index|rebuild|query <text> [--top-k N]\",\n\t},\n\t{ name: \"settings\", description: \"Open settings menu\" },\n\t{\n\t\tname: \"permissions\",\n\t\tdescription:\n\t\t\t\"Permission controls: /permissions (interactive menu) or /permissions [ask|auto|yolo|status|hooks] and /permissions [allow|deny] [list|add|remove] <tool:match>\",\n\t},\n\t{ name: \"yolo\", description: \"Toggle permission prompts: /yolo [on|off|status]\" },\n\t{ name: \"model\", description: \"Select model (provider-first selector UI)\" },\n\t{ name: \"scoped-models\", description: \"Enable/disable models for Ctrl+P cycling\" },\n\t{ name: \"export\", description: \"Export session to HTML file: /export [output-path] (wizard when omitted)\" },\n\t{ name: \"share\", description: \"Share session as a secret GitHub gist\" },\n\t{ name: \"copy\", description: \"Copy last agent message to clipboard\" },\n\t{ name: \"name\", description: \"Set session display name\" },\n\t{ name: \"session\", description: \"Show session info and stats\" },\n\t{\n\t\tname: \"doctor\",\n\t\tdescription: \"Run runtime diagnostics (model/auth/MCP/CLI tools/hooks/paths) with optional interactive fixes\",\n\t},\n\t{ name: \"checkpoint\", description: \"Create/list checkpoints for safe rollback\" },\n\t{ name: \"rollback\", description: \"Rollback session tree to a checkpoint (picker when omitted)\" },\n\t{ name: \"changelog\", description: \"Show changelog entries\" },\n\t{ name: \"hotkeys\", description: \"Show all keyboard shortcuts\" },\n\t{ name: \"fork\", description: \"Create a new fork from a previous message\" },\n\t{ name: \"tree\", description: \"Navigate session tree (switch branches)\" },\n\t{ name: \"login\", description: \"Authenticate with provider (OAuth incl. Qwen + OpenRouter API key)\" },\n\t{ name: \"auth\", description: \"Alias for /login\" },\n\t{ name: \"logout\", description: \"Remove saved provider credentials (OAuth/API key)\" },\n\t{ name: \"new\", description: \"Start a new session\" },\n\t{ name: \"clear\", description: \"Alias for /new\" },\n\t{ name: \"compact\", description: \"Manually compact the session context\" },\n\t{ name: \"resume\", description: \"Resume a different session\" },\n\t{ name: \"reload\", description: \"Reload extensions, skills, prompts, and themes\" },\n\t{ name: \"quit\", description: \"Quit iosm\" },\n];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAyB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAyB,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AA0BhE,MAAM,WAAW,wBAAwB;IACxC,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,yBAAyB;IACzB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;CACjB;AAED,kEAAkE;AAClE,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,MAAM,CAmRhF"}
|
|
@@ -12,14 +12,15 @@ const toolDescriptions = {
|
|
|
12
12
|
grep: "Search file contents for patterns (respects .gitignore)",
|
|
13
13
|
find: "Find files by glob pattern (respects .gitignore)",
|
|
14
14
|
ls: "List directory contents",
|
|
15
|
-
rg: "Run ripgrep directly for advanced regex search",
|
|
15
|
+
rg: "Run ripgrep directly for advanced regex search (prefer explicit path args, e.g. -n pattern .)",
|
|
16
16
|
fd: "Run fd directly for fast file discovery",
|
|
17
|
-
ast_grep: "Run ast-grep for AST/syntax-aware structural code search",
|
|
18
|
-
comby: "Run comby for structural pattern search/rewrite previews (no in-place edits)",
|
|
17
|
+
ast_grep: "Run ast-grep for AST/syntax-aware structural code search (prefer run --pattern; retry with scan/-p on older versions)",
|
|
18
|
+
comby: "Run comby for structural pattern search/rewrite previews (prefer explicit -matcher; no in-place edits)",
|
|
19
19
|
jq: "Run jq for JSON querying/transformation",
|
|
20
20
|
yq: "Run yq for YAML/JSON/TOML querying/transformation",
|
|
21
21
|
semgrep: "Run semgrep for structural/static security checks",
|
|
22
22
|
sed: "Run sed for stream editing/extraction previews (no in-place edits)",
|
|
23
|
+
semantic_search: "Semantic embeddings search over the project index (actions: status, index, rebuild, query)",
|
|
23
24
|
task: "Run a specialized subagent (supports profile, cwd, lock_key for optional write serialization, run_id/task_id, model override, background mode for detached runs, and agent=<custom name from .iosm/agents>)",
|
|
24
25
|
};
|
|
25
26
|
/** Build the system prompt with tools, guidelines, and context */
|
|
@@ -102,6 +103,7 @@ export function buildSystemPrompt(options = {}) {
|
|
|
102
103
|
const hasYq = tools.includes("yq");
|
|
103
104
|
const hasSemgrep = tools.includes("semgrep");
|
|
104
105
|
const hasSed = tools.includes("sed");
|
|
106
|
+
const hasSemanticSearch = tools.includes("semantic_search");
|
|
105
107
|
const hasRead = tools.includes("read");
|
|
106
108
|
// File exploration guidelines
|
|
107
109
|
if (hasBash && !hasGrep && !hasFind && !hasLs && !hasRg && !hasFd) {
|
|
@@ -110,6 +112,9 @@ export function buildSystemPrompt(options = {}) {
|
|
|
110
112
|
else if (hasBash && (hasGrep || hasFind || hasLs || hasRg || hasFd)) {
|
|
111
113
|
addGuideline("Prefer grep/find/ls/rg/fd tools over bash for codebase exploration (faster and less noisy)");
|
|
112
114
|
}
|
|
115
|
+
if (hasRg || hasFd || hasAstGrep || hasComby || hasJq || hasYq || hasSemgrep || hasSed || hasSemanticSearch) {
|
|
116
|
+
addGuideline("Route work to specialized tools first: rg/fd (search/discovery), semantic_search (concept-level retrieval), ast_grep/comby (structural code queries), jq/yq (data/config transforms), semgrep (risk scans), sed (stream extraction)");
|
|
117
|
+
}
|
|
113
118
|
if (hasAstGrep || hasComby) {
|
|
114
119
|
addGuideline("Use ast_grep/comby for syntax-aware structural queries before falling back to broad regex");
|
|
115
120
|
}
|
|
@@ -125,6 +130,17 @@ export function buildSystemPrompt(options = {}) {
|
|
|
125
130
|
if (hasSed) {
|
|
126
131
|
addGuideline("Use sed for preview/extraction workflows only; perform final file edits with edit/write");
|
|
127
132
|
}
|
|
133
|
+
if (hasSemanticSearch) {
|
|
134
|
+
addGuideline("Use semantic_search for intent/meaning queries that are hard to express with regex; use rg/ast_grep for exact symbol and syntax matches");
|
|
135
|
+
addGuideline("If semantic_search reports stale/missing index, run semantic_search status and then semantic_search index (or rebuild when required) before semantic queries");
|
|
136
|
+
}
|
|
137
|
+
if (hasRg || hasAstGrep || hasComby) {
|
|
138
|
+
addGuideline("For rg/ast_grep/comby, pass explicit target paths to avoid cwd ambiguity; if syntax errors occur (especially ast_grep), retry once with version-compatible command forms before concluding no matches");
|
|
139
|
+
}
|
|
140
|
+
if (hasBash &&
|
|
141
|
+
(hasRg || hasFd || hasAstGrep || hasComby || hasJq || hasYq || hasSemgrep || hasSed || hasSemanticSearch)) {
|
|
142
|
+
addGuideline("If a required CLI tool is missing, install it first when permitted (rg/fd can be auto-managed; others via brew/apt/pipx/npm), then continue with that tool instead of broad bash fallback. For semantic_search, configure provider/index first via /semantic setup.");
|
|
143
|
+
}
|
|
128
144
|
// Read before edit guideline
|
|
129
145
|
if (hasRead && hasEdit) {
|
|
130
146
|
addGuideline("Use read to examine files before editing. You must use this tool instead of cat or sed.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/core/system-pr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E,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAElE,IAAI,MAAM,GAAG;;;EAGZ,SAAS;;;;;EAKT,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+BY,UAAU;qBACb,QAAQ;cACf,YAAY;;yFAE+D,CAAC;IAEzF,IAAI,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,aAAa,CAAC;IACzB,CAAC;IAED,+BAA+B;IAC/B,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,2BAA2B,CAAC;QACtC,MAAM,IAAI,mDAAmD,CAAC;QAC9D,KAAK,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,YAAY,EAAE,CAAC;YACxD,MAAM,IAAI,MAAM,QAAQ,OAAO,OAAO,MAAM,CAAC;QAC9C,CAAC;IACF,CAAC;IAED,yDAAyD;IACzD,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,2CAA2C;IAC3C,MAAM,IAAI,4BAA4B,QAAQ,EAAE,CAAC;IACjD,MAAM,IAAI,gCAAgC,WAAW,EAAE,CAAC;IAExD,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["/**\n * System prompt construction and project context loading\n */\n\nimport { getDocsPath, getExamplesPath, getReadmePath } from \"../config.js\";\nimport { formatSkillsForPrompt, type Skill } from \"./skills.js\";\n\n/** Tool descriptions for system prompt */\nconst toolDescriptions: Record<string, string> = {\n\tread: \"Read file contents\",\n\tbash: \"Execute bash commands (ls, grep, find, etc.)\",\n\tedit: \"Make surgical edits to files (find exact text and replace)\",\n\twrite: \"Create or overwrite files\",\n\tgrep: \"Search file contents for patterns (respects .gitignore)\",\n\tfind: \"Find files by glob pattern (respects .gitignore)\",\n\tls: \"List directory contents\",\n\trg: \"Run ripgrep directly for advanced regex search\",\n\tfd: \"Run fd directly for fast file discovery\",\n\tast_grep: \"Run ast-grep for AST/syntax-aware structural code search\",\n\tcomby: \"Run comby for structural pattern search/rewrite previews (no in-place edits)\",\n\tjq: \"Run jq for JSON querying/transformation\",\n\tyq: \"Run yq for YAML/JSON/TOML querying/transformation\",\n\tsemgrep: \"Run semgrep for structural/static security checks\",\n\tsed: \"Run sed for stream editing/extraction previews (no in-place edits)\",\n\ttask: \"Run a specialized subagent (supports profile, cwd, lock_key for optional write serialization, run_id/task_id, model override, background mode for detached runs, and agent=<custom name from .iosm/agents>)\",\n};\n\nexport interface BuildSystemPromptOptions {\n\t/** Custom system prompt (replaces default). */\n\tcustomPrompt?: string;\n\t/** Tools to include in prompt. Default: [read, bash, edit, write] */\n\tselectedTools?: string[];\n\t/** Optional one-line tool snippets keyed by tool name. */\n\ttoolSnippets?: Record<string, string>;\n\t/** Additional guideline bullets appended to the default system prompt guidelines. */\n\tpromptGuidelines?: string[];\n\t/** Text to append to system prompt. */\n\tappendSystemPrompt?: string;\n\t/** Working directory. Default: process.cwd() */\n\tcwd?: string;\n\t/** Pre-loaded context files. */\n\tcontextFiles?: Array<{ path: string; content: string }>;\n\t/** Pre-loaded skills. */\n\tskills?: Skill[];\n}\n\n/** Build the system prompt with tools, guidelines, and context */\nexport function buildSystemPrompt(options: BuildSystemPromptOptions = {}): string {\n\tconst {\n\t\tcustomPrompt,\n\t\tselectedTools,\n\t\ttoolSnippets,\n\t\tpromptGuidelines,\n\t\tappendSystemPrompt,\n\t\tcwd,\n\t\tcontextFiles: providedContextFiles,\n\t\tskills: providedSkills,\n\t} = options;\n\tconst resolvedCwd = cwd ?? process.cwd();\n\n\tconst now = new Date();\n\tconst dateTime = now.toLocaleString(\"en-US\", {\n\t\tweekday: \"long\",\n\t\tyear: \"numeric\",\n\t\tmonth: \"long\",\n\t\tday: \"numeric\",\n\t\thour: \"2-digit\",\n\t\tminute: \"2-digit\",\n\t\tsecond: \"2-digit\",\n\t\ttimeZoneName: \"short\",\n\t});\n\n\tconst appendSection = appendSystemPrompt ? `\\n\\n${appendSystemPrompt}` : \"\";\n\n\tconst contextFiles = providedContextFiles ?? [];\n\tconst skills = providedSkills ?? [];\n\n\tif (customPrompt) {\n\t\tlet prompt = customPrompt;\n\n\t\tif (appendSection) {\n\t\t\tprompt += appendSection;\n\t\t}\n\n\t\t// Append project context files\n\t\tif (contextFiles.length > 0) {\n\t\t\tprompt += \"\\n\\n# Project Context\\n\\n\";\n\t\t\tprompt += \"Project-specific instructions and guidelines:\\n\\n\";\n\t\t\tfor (const { path: filePath, content } of contextFiles) {\n\t\t\t\tprompt += `## ${filePath}\\n\\n${content}\\n\\n`;\n\t\t\t}\n\t\t}\n\n\t\t// Append skills section (only if read tool is available)\n\t\tconst customPromptHasRead = !selectedTools || selectedTools.includes(\"read\");\n\t\tif (customPromptHasRead && skills.length > 0) {\n\t\t\tprompt += formatSkillsForPrompt(skills);\n\t\t}\n\n\t\t// Add date/time and working directory last\n\t\tprompt += `\\nCurrent date and time: ${dateTime}`;\n\t\tprompt += `\\nCurrent working directory: ${resolvedCwd}`;\n\n\t\treturn prompt;\n\t}\n\n\t// Get absolute paths to documentation and examples\n\tconst readmePath = getReadmePath();\n\tconst docsPath = getDocsPath();\n\tconst examplesPath = getExamplesPath();\n\n\t// Build tools list based on selected tools.\n\t// Built-ins use toolDescriptions. Custom tools can provide one-line snippets.\n\tconst tools = selectedTools || [\"read\", \"bash\", \"edit\", \"write\"];\n\tconst toolsList =\n\t\ttools.length > 0\n\t\t\t? tools\n\t\t\t\t\t.map((name) => {\n\t\t\t\t\t\tconst snippet = toolSnippets?.[name] ?? toolDescriptions[name] ?? name;\n\t\t\t\t\t\treturn `- ${name}: ${snippet}`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\"\\n\")\n\t\t\t: \"(none)\";\n\n\t// Build guidelines based on which tools are actually available\n\tconst guidelinesList: string[] = [];\n\tconst guidelinesSet = new Set<string>();\n\tconst addGuideline = (guideline: string): void => {\n\t\tif (guidelinesSet.has(guideline)) {\n\t\t\treturn;\n\t\t}\n\t\tguidelinesSet.add(guideline);\n\t\tguidelinesList.push(guideline);\n\t};\n\n\tconst hasBash = tools.includes(\"bash\");\n\tconst hasEdit = tools.includes(\"edit\");\n\tconst hasWrite = tools.includes(\"write\");\n\tconst hasGrep = tools.includes(\"grep\");\n\tconst hasFind = tools.includes(\"find\");\n\tconst hasLs = tools.includes(\"ls\");\n\tconst hasRg = tools.includes(\"rg\");\n\tconst hasFd = tools.includes(\"fd\");\n\tconst hasAstGrep = tools.includes(\"ast_grep\");\n\tconst hasComby = tools.includes(\"comby\");\n\tconst hasJq = tools.includes(\"jq\");\n\tconst hasYq = tools.includes(\"yq\");\n\tconst hasSemgrep = tools.includes(\"semgrep\");\n\tconst hasSed = tools.includes(\"sed\");\n\tconst hasRead = tools.includes(\"read\");\n\n\t// File exploration guidelines\n\tif (hasBash && !hasGrep && !hasFind && !hasLs && !hasRg && !hasFd) {\n\t\taddGuideline(\"Use bash for file operations like ls, rg, find; prefer rg for targeted search when available\");\n\t} else if (hasBash && (hasGrep || hasFind || hasLs || hasRg || hasFd)) {\n\t\taddGuideline(\"Prefer grep/find/ls/rg/fd tools over bash for codebase exploration (faster and less noisy)\");\n\t}\n\n\tif (hasAstGrep || hasComby) {\n\t\taddGuideline(\"Use ast_grep/comby for syntax-aware structural queries before falling back to broad regex\");\n\t}\n\n\tif (hasComby) {\n\t\taddGuideline(\"Use comby to preview structural rewrite matches first, then apply final changes via edit/write\");\n\t}\n\n\tif (hasJq || hasYq) {\n\t\taddGuideline(\"Prefer jq/yq over ad-hoc shell parsing when extracting or transforming JSON/YAML/TOML\");\n\t}\n\n\tif (hasSemgrep) {\n\t\taddGuideline(\"Use semgrep for rule-based risk scans and structural security checks when relevant\");\n\t}\n\n\tif (hasSed) {\n\t\taddGuideline(\"Use sed for preview/extraction workflows only; perform final file edits with edit/write\");\n\t}\n\n\t// Read before edit guideline\n\tif (hasRead && hasEdit) {\n\t\taddGuideline(\"Use read to examine files before editing. You must use this tool instead of cat or sed.\");\n\t}\n\n\t// Edit guideline\n\tif (hasEdit) {\n\t\taddGuideline(\"Use edit for precise changes (old text must match exactly)\");\n\t}\n\n\t// Write guideline\n\tif (hasWrite) {\n\t\taddGuideline(\"Use write only for new files or complete rewrites\");\n\t}\n\n\t// Output guideline (only when actually writing or executing)\n\tif (hasEdit || hasWrite) {\n\t\taddGuideline(\n\t\t\t\"When summarizing your actions, output plain text directly - do NOT use cat or bash to display what you did\",\n\t\t);\n\t}\n\n\taddGuideline(\"Inspect the relevant files before editing and keep exploration bounded to the task\");\n\taddGuideline(\"Make reasonable assumptions and continue unless a risky ambiguity blocks the work\");\n\taddGuideline(\"Classify requests as simple vs complex: execute simple work immediately, use a step plan for complex work\");\n\taddGuideline(\"For complex work, publish a short step plan before edits and keep step statuses current while executing\");\n\taddGuideline(\"If a meaningful architecture or product fork changes implementation, ask a concise clarification before editing\");\n\taddGuideline(\"After changes, run the smallest relevant verification and report the concrete result\");\n\taddGuideline(\"Do not claim success without evidence; if you could not verify, say so explicitly\");\n\taddGuideline(\"Complete the requested task end-to-end when possible instead of stopping at analysis\");\n\taddGuideline(\"For code review requests, lead with findings and risks before summaries\");\n\n\tfor (const guideline of promptGuidelines ?? []) {\n\t\tconst normalized = guideline.trim();\n\t\tif (normalized.length > 0) {\n\t\t\taddGuideline(normalized);\n\t\t}\n\t}\n\n\t// Always include these\n\taddGuideline(\"Be concise in your responses\");\n\taddGuideline(\"Show file paths clearly when working with files\");\n\n\tconst guidelines = guidelinesList.map((g) => `- ${g}`).join(\"\\n\");\n\n\tlet prompt = `You are a professional software engineering agent operating inside iosm-cli. Help users inspect systems, change code, run commands, maintain project artifacts when needed, and explain results clearly.\n\nAvailable tools:\n${toolsList}\n\nIn addition to the tools above, you may have access to other custom tools depending on the project.\n\nGuidelines:\n${guidelines}\n\nOperating defaults:\n- Summarize work in standard engineering language first: what you inspected, what you changed, what you verified, and any remaining risk or blocker.\n- Do NOT start by reading documentation unless the user asks for documentation help, asks about harness internals, or implementation is blocked without it.\n- Start implementation turns with a quick repository scan of the files most likely to matter before proposing or editing.\n- Prefer targeted reads and searches over broad dumps; keep command output bounded and focused.\n- For complex tasks, include a machine-readable plan block before edits and update it when statuses change:\n <task_plan complexity=\"complex\">\n - [in_progress] Current step\n - [pending] Next step\n </task_plan>\n- Skip plan blocks for simple one-shot tasks.\n- When a material architecture fork exists, pause and ask one concise clarification (or use ask_user when available) before implementation.\n- Treat verification as mandatory after edits: tests, type checks, linters, or a precise explanation of why verification was not possible.\n- For complex requests, execute plan steps in order, close each step explicitly, and finish the full plan unless blocked.\n- If the user explicitly asks for subagents/agents orchestration, you MUST use the task tool rather than doing all work in the main agent.\n- For explicit subagent/orchestration requests, execute at least one task tool call before giving a final prose-only answer.\n- Do not expose internal orchestration scaffolding to the user (for example: [ORCHESTRATION_DIRECTIVE], pseudo tool-call JSON, or raw task arguments).\n- When invoking tools, call them directly without preambles like \"I will now call tool X\"; only report outcomes that matter to the user.\n- Respect orchestration constraints from the user exactly: count, parallel vs sequential execution, per-agent profile, and per-agent working directory (cwd) when provided.\n- For explicit parallel orchestration requests, issue multiple independent task tool calls to match the requested agent count; do not collapse to a single subagent unless the user asks for one.\n- For explicit parallel orchestration requests, emit independent task calls in a single assistant turn whenever possible so they can be launched together.\n- Runtime note: when parallel orchestration is requested, emit independent task calls in one assistant turn so they can run concurrently; avoid background mode unless the user explicitly asks for detached async runs.\n- If orchestration constraints are ambiguous or conflict, ask one concise clarification (or use ask_user when available) before launching subagents.\n- When the user provides an <orchestrate ...>...</orchestrate> block, treat it as an execution contract and follow its mode/agents/profile/cwd assignments strictly.\n- When orchestration assignments include run_id/task_id/lock_key or depends_on, enforce them in task calls (run_id/task_id for team tracking, lock_key for serialization domains, depends_on for ordering).\n- For write-heavy parallel orchestration, prefer isolation=worktree to reduce cross-agent interference when the repository is git-backed.\n- If the user message includes @<custom-agent-name>, treat it as an explicit agent selection and call task with agent set to that custom agent name.\n\niosm-cli reference docs (use when needed):\n- Main documentation: ${readmePath}\n- Additional docs: ${docsPath}\n- Examples: ${examplesPath} (extensions, custom tools, SDK)\n- When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), package composition (docs/packages.md)\n- When working on harness internals, read the relevant docs/examples before implementing`;\n\n\tif (appendSection) {\n\t\tprompt += appendSection;\n\t}\n\n\t// Append project context files\n\tif (contextFiles.length > 0) {\n\t\tprompt += \"\\n\\n# Project Context\\n\\n\";\n\t\tprompt += \"Project-specific instructions and guidelines:\\n\\n\";\n\t\tfor (const { path: filePath, content } of contextFiles) {\n\t\t\tprompt += `## ${filePath}\\n\\n${content}\\n\\n`;\n\t\t}\n\t}\n\n\t// Append skills section (only if read tool is available)\n\tif (hasRead && skills.length > 0) {\n\t\tprompt += formatSkillsForPrompt(skills);\n\t}\n\n\t// Add date/time and working directory last\n\tprompt += `\\nCurrent date and time: ${dateTime}`;\n\tprompt += `\\nCurrent working directory: ${resolvedCwd}`;\n\n\treturn prompt;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/core/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAc,MAAM,aAAa,CAAC;AAEhE,0CAA0C;AAC1C,MAAM,gBAAgB,GAA2B;IAChD,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,8CAA8C;IACpD,IAAI,EAAE,4DAA4D;IAClE,KAAK,EAAE,2BAA2B;IAClC,IAAI,EAAE,yDAAyD;IAC/D,IAAI,EAAE,kDAAk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ading\n */\n\nimport { getDocsPath, getExamplesPath, getReadmePath } from \"../config.js\";\nimport { formatSkillsForPrompt, type Skill } from \"./skills.js\";\n\n/** Tool descriptions for system prompt */\nconst toolDescriptions: Record<string, string> = {\n\tread: \"Read file contents\",\n\tbash: \"Execute bash commands (ls, grep, find, etc.)\",\n\tedit: \"Make surgical edits to files (find exact text and replace)\",\n\twrite: \"Create or overwrite files\",\n\tgrep: \"Search file contents for patterns (respects .gitignore)\",\n\tfind: \"Find files by glob pattern (respects .gitignore)\",\n\tls: \"List directory contents\",\n\trg: \"Run ripgrep directly for advanced regex search (prefer explicit path args, e.g. -n pattern .)\",\n\tfd: \"Run fd directly for fast file discovery\",\n\tast_grep:\n\t\t\"Run ast-grep for AST/syntax-aware structural code search (prefer run --pattern; retry with scan/-p on older versions)\",\n\tcomby:\n\t\t\"Run comby for structural pattern search/rewrite previews (prefer explicit -matcher; no in-place edits)\",\n\tjq: \"Run jq for JSON querying/transformation\",\n\tyq: \"Run yq for YAML/JSON/TOML querying/transformation\",\n\tsemgrep: \"Run semgrep for structural/static security checks\",\n\tsed: \"Run sed for stream editing/extraction previews (no in-place edits)\",\n\tsemantic_search:\n\t\t\"Semantic embeddings search over the project index (actions: status, index, rebuild, query)\",\n\ttask: \"Run a specialized subagent (supports profile, cwd, lock_key for optional write serialization, run_id/task_id, model override, background mode for detached runs, and agent=<custom name from .iosm/agents>)\",\n};\n\nexport interface BuildSystemPromptOptions {\n\t/** Custom system prompt (replaces default). */\n\tcustomPrompt?: string;\n\t/** Tools to include in prompt. Default: [read, bash, edit, write] */\n\tselectedTools?: string[];\n\t/** Optional one-line tool snippets keyed by tool name. */\n\ttoolSnippets?: Record<string, string>;\n\t/** Additional guideline bullets appended to the default system prompt guidelines. */\n\tpromptGuidelines?: string[];\n\t/** Text to append to system prompt. */\n\tappendSystemPrompt?: string;\n\t/** Working directory. Default: process.cwd() */\n\tcwd?: string;\n\t/** Pre-loaded context files. */\n\tcontextFiles?: Array<{ path: string; content: string }>;\n\t/** Pre-loaded skills. */\n\tskills?: Skill[];\n}\n\n/** Build the system prompt with tools, guidelines, and context */\nexport function buildSystemPrompt(options: BuildSystemPromptOptions = {}): string {\n\tconst {\n\t\tcustomPrompt,\n\t\tselectedTools,\n\t\ttoolSnippets,\n\t\tpromptGuidelines,\n\t\tappendSystemPrompt,\n\t\tcwd,\n\t\tcontextFiles: providedContextFiles,\n\t\tskills: providedSkills,\n\t} = options;\n\tconst resolvedCwd = cwd ?? process.cwd();\n\n\tconst now = new Date();\n\tconst dateTime = now.toLocaleString(\"en-US\", {\n\t\tweekday: \"long\",\n\t\tyear: \"numeric\",\n\t\tmonth: \"long\",\n\t\tday: \"numeric\",\n\t\thour: \"2-digit\",\n\t\tminute: \"2-digit\",\n\t\tsecond: \"2-digit\",\n\t\ttimeZoneName: \"short\",\n\t});\n\n\tconst appendSection = appendSystemPrompt ? `\\n\\n${appendSystemPrompt}` : \"\";\n\n\tconst contextFiles = providedContextFiles ?? [];\n\tconst skills = providedSkills ?? [];\n\n\tif (customPrompt) {\n\t\tlet prompt = customPrompt;\n\n\t\tif (appendSection) {\n\t\t\tprompt += appendSection;\n\t\t}\n\n\t\t// Append project context files\n\t\tif (contextFiles.length > 0) {\n\t\t\tprompt += \"\\n\\n# Project Context\\n\\n\";\n\t\t\tprompt += \"Project-specific instructions and guidelines:\\n\\n\";\n\t\t\tfor (const { path: filePath, content } of contextFiles) {\n\t\t\t\tprompt += `## ${filePath}\\n\\n${content}\\n\\n`;\n\t\t\t}\n\t\t}\n\n\t\t// Append skills section (only if read tool is available)\n\t\tconst customPromptHasRead = !selectedTools || selectedTools.includes(\"read\");\n\t\tif (customPromptHasRead && skills.length > 0) {\n\t\t\tprompt += formatSkillsForPrompt(skills);\n\t\t}\n\n\t\t// Add date/time and working directory last\n\t\tprompt += `\\nCurrent date and time: ${dateTime}`;\n\t\tprompt += `\\nCurrent working directory: ${resolvedCwd}`;\n\n\t\treturn prompt;\n\t}\n\n\t// Get absolute paths to documentation and examples\n\tconst readmePath = getReadmePath();\n\tconst docsPath = getDocsPath();\n\tconst examplesPath = getExamplesPath();\n\n\t// Build tools list based on selected tools.\n\t// Built-ins use toolDescriptions. Custom tools can provide one-line snippets.\n\tconst tools = selectedTools || [\"read\", \"bash\", \"edit\", \"write\"];\n\tconst toolsList =\n\t\ttools.length > 0\n\t\t\t? tools\n\t\t\t\t\t.map((name) => {\n\t\t\t\t\t\tconst snippet = toolSnippets?.[name] ?? toolDescriptions[name] ?? name;\n\t\t\t\t\t\treturn `- ${name}: ${snippet}`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\"\\n\")\n\t\t\t: \"(none)\";\n\n\t// Build guidelines based on which tools are actually available\n\tconst guidelinesList: string[] = [];\n\tconst guidelinesSet = new Set<string>();\n\tconst addGuideline = (guideline: string): void => {\n\t\tif (guidelinesSet.has(guideline)) {\n\t\t\treturn;\n\t\t}\n\t\tguidelinesSet.add(guideline);\n\t\tguidelinesList.push(guideline);\n\t};\n\n\tconst hasBash = tools.includes(\"bash\");\n\tconst hasEdit = tools.includes(\"edit\");\n\tconst hasWrite = tools.includes(\"write\");\n\tconst hasGrep = tools.includes(\"grep\");\n\tconst hasFind = tools.includes(\"find\");\n\tconst hasLs = tools.includes(\"ls\");\n\tconst hasRg = tools.includes(\"rg\");\n\tconst hasFd = tools.includes(\"fd\");\n\tconst hasAstGrep = tools.includes(\"ast_grep\");\n\tconst hasComby = tools.includes(\"comby\");\n\tconst hasJq = tools.includes(\"jq\");\n\tconst hasYq = tools.includes(\"yq\");\n\tconst hasSemgrep = tools.includes(\"semgrep\");\n\tconst hasSed = tools.includes(\"sed\");\n\tconst hasSemanticSearch = tools.includes(\"semantic_search\");\n\tconst hasRead = tools.includes(\"read\");\n\n\t// File exploration guidelines\n\tif (hasBash && !hasGrep && !hasFind && !hasLs && !hasRg && !hasFd) {\n\t\taddGuideline(\"Use bash for file operations like ls, rg, find; prefer rg for targeted search when available\");\n\t} else if (hasBash && (hasGrep || hasFind || hasLs || hasRg || hasFd)) {\n\t\taddGuideline(\"Prefer grep/find/ls/rg/fd tools over bash for codebase exploration (faster and less noisy)\");\n\t}\n\n\tif (hasRg || hasFd || hasAstGrep || hasComby || hasJq || hasYq || hasSemgrep || hasSed || hasSemanticSearch) {\n\t\taddGuideline(\n\t\t\t\"Route work to specialized tools first: rg/fd (search/discovery), semantic_search (concept-level retrieval), ast_grep/comby (structural code queries), jq/yq (data/config transforms), semgrep (risk scans), sed (stream extraction)\",\n\t\t);\n\t}\n\n\tif (hasAstGrep || hasComby) {\n\t\taddGuideline(\"Use ast_grep/comby for syntax-aware structural queries before falling back to broad regex\");\n\t}\n\n\tif (hasComby) {\n\t\taddGuideline(\"Use comby to preview structural rewrite matches first, then apply final changes via edit/write\");\n\t}\n\n\tif (hasJq || hasYq) {\n\t\taddGuideline(\"Prefer jq/yq over ad-hoc shell parsing when extracting or transforming JSON/YAML/TOML\");\n\t}\n\n\tif (hasSemgrep) {\n\t\taddGuideline(\"Use semgrep for rule-based risk scans and structural security checks when relevant\");\n\t}\n\n\tif (hasSed) {\n\t\taddGuideline(\"Use sed for preview/extraction workflows only; perform final file edits with edit/write\");\n\t}\n\n\tif (hasSemanticSearch) {\n\t\taddGuideline(\n\t\t\t\"Use semantic_search for intent/meaning queries that are hard to express with regex; use rg/ast_grep for exact symbol and syntax matches\",\n\t\t);\n\t\taddGuideline(\n\t\t\t\"If semantic_search reports stale/missing index, run semantic_search status and then semantic_search index (or rebuild when required) before semantic queries\",\n\t\t);\n\t}\n\n\tif (hasRg || hasAstGrep || hasComby) {\n\t\taddGuideline(\n\t\t\t\"For rg/ast_grep/comby, pass explicit target paths to avoid cwd ambiguity; if syntax errors occur (especially ast_grep), retry once with version-compatible command forms before concluding no matches\",\n\t\t);\n\t}\n\n\tif (\n\t\thasBash &&\n\t\t(hasRg || hasFd || hasAstGrep || hasComby || hasJq || hasYq || hasSemgrep || hasSed || hasSemanticSearch)\n\t) {\n\t\taddGuideline(\n\t\t\t\"If a required CLI tool is missing, install it first when permitted (rg/fd can be auto-managed; others via brew/apt/pipx/npm), then continue with that tool instead of broad bash fallback. For semantic_search, configure provider/index first via /semantic setup.\",\n\t\t);\n\t}\n\n\t// Read before edit guideline\n\tif (hasRead && hasEdit) {\n\t\taddGuideline(\"Use read to examine files before editing. You must use this tool instead of cat or sed.\");\n\t}\n\n\t// Edit guideline\n\tif (hasEdit) {\n\t\taddGuideline(\"Use edit for precise changes (old text must match exactly)\");\n\t}\n\n\t// Write guideline\n\tif (hasWrite) {\n\t\taddGuideline(\"Use write only for new files or complete rewrites\");\n\t}\n\n\t// Output guideline (only when actually writing or executing)\n\tif (hasEdit || hasWrite) {\n\t\taddGuideline(\n\t\t\t\"When summarizing your actions, output plain text directly - do NOT use cat or bash to display what you did\",\n\t\t);\n\t}\n\n\taddGuideline(\"Inspect the relevant files before editing and keep exploration bounded to the task\");\n\taddGuideline(\"Make reasonable assumptions and continue unless a risky ambiguity blocks the work\");\n\taddGuideline(\"Classify requests as simple vs complex: execute simple work immediately, use a step plan for complex work\");\n\taddGuideline(\"For complex work, publish a short step plan before edits and keep step statuses current while executing\");\n\taddGuideline(\"If a meaningful architecture or product fork changes implementation, ask a concise clarification before editing\");\n\taddGuideline(\"After changes, run the smallest relevant verification and report the concrete result\");\n\taddGuideline(\"Do not claim success without evidence; if you could not verify, say so explicitly\");\n\taddGuideline(\"Complete the requested task end-to-end when possible instead of stopping at analysis\");\n\taddGuideline(\"For code review requests, lead with findings and risks before summaries\");\n\n\tfor (const guideline of promptGuidelines ?? []) {\n\t\tconst normalized = guideline.trim();\n\t\tif (normalized.length > 0) {\n\t\t\taddGuideline(normalized);\n\t\t}\n\t}\n\n\t// Always include these\n\taddGuideline(\"Be concise in your responses\");\n\taddGuideline(\"Show file paths clearly when working with files\");\n\n\tconst guidelines = guidelinesList.map((g) => `- ${g}`).join(\"\\n\");\n\n\tlet prompt = `You are a professional software engineering agent operating inside iosm-cli. Help users inspect systems, change code, run commands, maintain project artifacts when needed, and explain results clearly.\n\nAvailable tools:\n${toolsList}\n\nIn addition to the tools above, you may have access to other custom tools depending on the project.\n\nGuidelines:\n${guidelines}\n\nOperating defaults:\n- Summarize work in standard engineering language first: what you inspected, what you changed, what you verified, and any remaining risk or blocker.\n- Do NOT start by reading documentation unless the user asks for documentation help, asks about harness internals, or implementation is blocked without it.\n- Start implementation turns with a quick repository scan of the files most likely to matter before proposing or editing.\n- Prefer targeted reads and searches over broad dumps; keep command output bounded and focused.\n- For complex tasks, include a machine-readable plan block before edits and update it when statuses change:\n <task_plan complexity=\"complex\">\n - [in_progress] Current step\n - [pending] Next step\n </task_plan>\n- Skip plan blocks for simple one-shot tasks.\n- When a material architecture fork exists, pause and ask one concise clarification (or use ask_user when available) before implementation.\n- Treat verification as mandatory after edits: tests, type checks, linters, or a precise explanation of why verification was not possible.\n- For complex requests, execute plan steps in order, close each step explicitly, and finish the full plan unless blocked.\n- If the user explicitly asks for subagents/agents orchestration, you MUST use the task tool rather than doing all work in the main agent.\n- For explicit subagent/orchestration requests, execute at least one task tool call before giving a final prose-only answer.\n- Do not expose internal orchestration scaffolding to the user (for example: [ORCHESTRATION_DIRECTIVE], pseudo tool-call JSON, or raw task arguments).\n- When invoking tools, call them directly without preambles like \"I will now call tool X\"; only report outcomes that matter to the user.\n- Respect orchestration constraints from the user exactly: count, parallel vs sequential execution, per-agent profile, and per-agent working directory (cwd) when provided.\n- For explicit parallel orchestration requests, issue multiple independent task tool calls to match the requested agent count; do not collapse to a single subagent unless the user asks for one.\n- For explicit parallel orchestration requests, emit independent task calls in a single assistant turn whenever possible so they can be launched together.\n- Runtime note: when parallel orchestration is requested, emit independent task calls in one assistant turn so they can run concurrently; avoid background mode unless the user explicitly asks for detached async runs.\n- If orchestration constraints are ambiguous or conflict, ask one concise clarification (or use ask_user when available) before launching subagents.\n- When the user provides an <orchestrate ...>...</orchestrate> block, treat it as an execution contract and follow its mode/agents/profile/cwd assignments strictly.\n- When orchestration assignments include run_id/task_id/lock_key or depends_on, enforce them in task calls (run_id/task_id for team tracking, lock_key for serialization domains, depends_on for ordering).\n- For write-heavy parallel orchestration, prefer isolation=worktree to reduce cross-agent interference when the repository is git-backed.\n- If the user message includes @<custom-agent-name>, treat it as an explicit agent selection and call task with agent set to that custom agent name.\n\niosm-cli reference docs (use when needed):\n- Main documentation: ${readmePath}\n- Additional docs: ${docsPath}\n- Examples: ${examplesPath} (extensions, custom tools, SDK)\n- When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), package composition (docs/packages.md)\n- When working on harness internals, read the relevant docs/examples before implementing`;\n\n\tif (appendSection) {\n\t\tprompt += appendSection;\n\t}\n\n\t// Append project context files\n\tif (contextFiles.length > 0) {\n\t\tprompt += \"\\n\\n# Project Context\\n\\n\";\n\t\tprompt += \"Project-specific instructions and guidelines:\\n\\n\";\n\t\tfor (const { path: filePath, content } of contextFiles) {\n\t\t\tprompt += `## ${filePath}\\n\\n${content}\\n\\n`;\n\t\t}\n\t}\n\n\t// Append skills section (only if read tool is available)\n\tif (hasRead && skills.length > 0) {\n\t\tprompt += formatSkillsForPrompt(skills);\n\t}\n\n\t// Add date/time and working directory last\n\tprompt += `\\nCurrent date and time: ${dateTime}`;\n\tprompt += `\\nCurrent working directory: ${resolvedCwd}`;\n\n\treturn prompt;\n}\n"]}
|
|
@@ -3,7 +3,7 @@ export function createAstGrepTool(cwd) {
|
|
|
3
3
|
return createExternalCliTool(cwd, {
|
|
4
4
|
name: "ast_grep",
|
|
5
5
|
label: "ast-grep",
|
|
6
|
-
description: "Run ast-grep (sg) for syntax-aware code queries. Pass CLI
|
|
6
|
+
description: "Run ast-grep (sg) for syntax-aware code queries. Pass CLI args directly. Preferred form: [\"run\",\"--pattern\",\"console.log($A)\",\"--lang\",\"javascript\",\"src\"]. If version syntax differs, retry with scan/-p equivalents.",
|
|
7
7
|
commandCandidates: ["ast-grep", "sg"],
|
|
8
8
|
missingInstallHint: "Install ast-grep (brew install ast-grep or npm i -g @ast-grep/cli).",
|
|
9
9
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-grep.js","sourceRoot":"","sources":["../../../src/core/tools/ast-grep.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAqB,MAAM,mBAAmB,CAAC;AAI7E,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC5C,OAAO,qBAAqB,CAAC,GAAG,EAAE;QACjC,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,UAAU;QACjB,WAAW,EACV,
|
|
1
|
+
{"version":3,"file":"ast-grep.js","sourceRoot":"","sources":["../../../src/core/tools/ast-grep.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAqB,MAAM,mBAAmB,CAAC;AAI7E,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC5C,OAAO,qBAAqB,CAAC,GAAG,EAAE;QACjC,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,UAAU;QACjB,WAAW,EACV,oOAAoO;QACrO,iBAAiB,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC;QACrC,kBAAkB,EAAE,qEAAqE;KACzF,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { createExternalCliTool, externalCliSchema } from \"./external-cli.js\";\n\nexport type AstGrepToolInput = Static<typeof externalCliSchema>;\n\nexport function createAstGrepTool(cwd: string): AgentTool<typeof externalCliSchema> {\n\treturn createExternalCliTool(cwd, {\n\t\tname: \"ast_grep\",\n\t\tlabel: \"ast-grep\",\n\t\tdescription:\n\t\t\t\"Run ast-grep (sg) for syntax-aware code queries. Pass CLI args directly. Preferred form: [\\\"run\\\",\\\"--pattern\\\",\\\"console.log($A)\\\",\\\"--lang\\\",\\\"javascript\\\",\\\"src\\\"]. If version syntax differs, retry with scan/-p equivalents.\",\n\t\tcommandCandidates: [\"ast-grep\", \"sg\"],\n\t\tmissingInstallHint: \"Install ast-grep (brew install ast-grep or npm i -g @ast-grep/cli).\",\n\t});\n}\n\nexport const astGrepTool = createAstGrepTool(process.cwd());\n"]}
|
package/dist/core/tools/comby.js
CHANGED
|
@@ -3,7 +3,7 @@ export function createCombyTool(cwd) {
|
|
|
3
3
|
return createExternalCliTool(cwd, {
|
|
4
4
|
name: "comby",
|
|
5
5
|
label: "comby",
|
|
6
|
-
description: "Run comby for structural search/rewrite previews. In-place flags are blocked; use edit/write tools for actual file mutations.",
|
|
6
|
+
description: "Run comby for structural search/rewrite previews. Prefer explicit matcher when language is known (for example: [\"pattern\", \"rewrite\", \"-matcher\", \".python\", \"src\"]). In-place flags are blocked; use edit/write tools for actual file mutations.",
|
|
7
7
|
commandCandidates: ["comby"],
|
|
8
8
|
missingInstallHint: "Install comby (brew install comby).",
|
|
9
9
|
forbiddenArgs: ["-i", "--in-place", "-in-place"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comby.js","sourceRoot":"","sources":["../../../src/core/tools/comby.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAqB,MAAM,mBAAmB,CAAC;AAI7E,MAAM,UAAU,eAAe,CAAC,GAAW;IAC1C,OAAO,qBAAqB,CAAC,GAAG,EAAE;QACjC,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,WAAW,EACV
|
|
1
|
+
{"version":3,"file":"comby.js","sourceRoot":"","sources":["../../../src/core/tools/comby.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAqB,MAAM,mBAAmB,CAAC;AAI7E,MAAM,UAAU,eAAe,CAAC,GAAW;IAC1C,OAAO,qBAAqB,CAAC,GAAG,EAAE;QACjC,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,WAAW,EACV,6PAA6P;QAC9P,iBAAiB,EAAE,CAAC,OAAO,CAAC;QAC5B,kBAAkB,EAAE,qCAAqC;QACzD,aAAa,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,WAAW,CAAC;QAChD,oBAAoB,EAAE,CAAC,KAAK,CAAC;KAC7B,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport type { Static } from \"@sinclair/typebox\";\nimport { createExternalCliTool, externalCliSchema } from \"./external-cli.js\";\n\nexport type CombyToolInput = Static<typeof externalCliSchema>;\n\nexport function createCombyTool(cwd: string): AgentTool<typeof externalCliSchema> {\n\treturn createExternalCliTool(cwd, {\n\t\tname: \"comby\",\n\t\tlabel: \"comby\",\n\t\tdescription:\n\t\t\t\"Run comby for structural search/rewrite previews. Prefer explicit matcher when language is known (for example: [\\\"pattern\\\", \\\"rewrite\\\", \\\"-matcher\\\", \\\".python\\\", \\\"src\\\"]). In-place flags are blocked; use edit/write tools for actual file mutations.\",\n\t\tcommandCandidates: [\"comby\"],\n\t\tmissingInstallHint: \"Install comby (brew install comby).\",\n\t\tforbiddenArgs: [\"-i\", \"--in-place\", \"-in-place\"],\n\t\tforbiddenArgPrefixes: [\"-i=\"],\n\t});\n}\n\nexport const combyTool = createCombyTool(process.cwd());\n"]}
|
|
@@ -12,6 +12,7 @@ export { createReadTool, type ReadOperations, type ReadToolDetails, type ReadToo
|
|
|
12
12
|
export { createRgTool, type RgToolInput, rgTool, } from "./rg.js";
|
|
13
13
|
export { createSedTool, type SedToolInput, sedTool, } from "./sed.js";
|
|
14
14
|
export { createSemgrepTool, type SemgrepToolInput, semgrepTool, } from "./semgrep.js";
|
|
15
|
+
export { createSemanticSearchTool, type SemanticSearchToolInput, type SemanticSearchToolOptions, semanticSearchTool, } from "./semantic-search.js";
|
|
15
16
|
export { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, } from "./truncate.js";
|
|
16
17
|
export { createWriteTool, type WriteOperations, type WriteToolInput, type WriteToolOptions, writeTool, } from "./write.js";
|
|
17
18
|
export { type ToolPermissionGuard, type ToolPermissionRequest } from "./permissions.js";
|
|
@@ -22,6 +23,7 @@ import type { AgentTool } from "@mariozechner/pi-agent-core";
|
|
|
22
23
|
import { type BashToolOptions } from "./bash.js";
|
|
23
24
|
import { type EditToolOptions } from "./edit.js";
|
|
24
25
|
import { type ReadToolOptions } from "./read.js";
|
|
26
|
+
import { type SemanticSearchToolOptions } from "./semantic-search.js";
|
|
25
27
|
import { type WriteToolOptions } from "./write.js";
|
|
26
28
|
/** Tool type (AgentTool from pi-ai) */
|
|
27
29
|
export type Tool = AgentTool<any>;
|
|
@@ -112,6 +114,11 @@ export declare const allTools: {
|
|
|
112
114
|
stdin: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
113
115
|
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
114
116
|
}>, any>;
|
|
117
|
+
semantic_search: AgentTool<import("@sinclair/typebox").TObject<{
|
|
118
|
+
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"status">, import("@sinclair/typebox").TLiteral<"index">, import("@sinclair/typebox").TLiteral<"rebuild">, import("@sinclair/typebox").TLiteral<"query">]>;
|
|
119
|
+
query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
120
|
+
top_k: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
121
|
+
}>, any>;
|
|
115
122
|
todo_write: AgentTool<import("@sinclair/typebox").TObject<{
|
|
116
123
|
tasks: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
117
124
|
id: import("@sinclair/typebox").TString;
|
|
@@ -133,6 +140,8 @@ export interface ToolsOptions {
|
|
|
133
140
|
edit?: EditToolOptions;
|
|
134
141
|
/** Options for the write tool */
|
|
135
142
|
write?: WriteToolOptions;
|
|
143
|
+
/** Options for the semantic_search tool */
|
|
144
|
+
semantic?: SemanticSearchToolOptions;
|
|
136
145
|
}
|
|
137
146
|
/**
|
|
138
147
|
* Create coding tools configured for a specific working directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,EACR,cAAc,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,KAAK,cAAc,EACnB,SAAS,EACT,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,YAAY,EACZ,KAAK,WAAW,EAChB,MAAM,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,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Q,GAAG,MAAM,OAAO,QAAQ,CAAC;AAE7C,MAAM,WAAW,YAAY;IAC5B,gCAAgC;IAChC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,gCAAgC;IAChC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,gCAAgC;IAChC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,iCAAiC;IACjC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,yBAAyB,CAAC;CACrC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAO7E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAgB/E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAqB1F;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAKjG"}
|
package/dist/core/tools/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { createReadTool, readTool, } from "./read.js";
|
|
|
12
12
|
export { createRgTool, rgTool, } from "./rg.js";
|
|
13
13
|
export { createSedTool, sedTool, } from "./sed.js";
|
|
14
14
|
export { createSemgrepTool, semgrepTool, } from "./semgrep.js";
|
|
15
|
+
export { createSemanticSearchTool, semanticSearchTool, } from "./semantic-search.js";
|
|
15
16
|
export { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, truncateLine, truncateTail, } from "./truncate.js";
|
|
16
17
|
export { createWriteTool, writeTool, } from "./write.js";
|
|
17
18
|
export { createTodoWriteTool, createTodoReadTool, todoWriteTool, todoReadTool, getTaskFilePath, } from "./todo.js";
|
|
@@ -30,6 +31,7 @@ import { createReadTool, readTool } from "./read.js";
|
|
|
30
31
|
import { createRgTool, rgTool } from "./rg.js";
|
|
31
32
|
import { createSedTool, sedTool } from "./sed.js";
|
|
32
33
|
import { createSemgrepTool, semgrepTool } from "./semgrep.js";
|
|
34
|
+
import { createSemanticSearchTool, semanticSearchTool, } from "./semantic-search.js";
|
|
33
35
|
import { createWriteTool, writeTool } from "./write.js";
|
|
34
36
|
import { createYqTool, yqTool } from "./yq.js";
|
|
35
37
|
import { todoWriteTool, todoReadTool } from "./todo.js";
|
|
@@ -49,6 +51,7 @@ export const readOnlyTools = [
|
|
|
49
51
|
yqTool,
|
|
50
52
|
semgrepTool,
|
|
51
53
|
sedTool,
|
|
54
|
+
semanticSearchTool,
|
|
52
55
|
];
|
|
53
56
|
// All available tools (using process.cwd())
|
|
54
57
|
export const allTools = {
|
|
@@ -67,6 +70,7 @@ export const allTools = {
|
|
|
67
70
|
yq: yqTool,
|
|
68
71
|
semgrep: semgrepTool,
|
|
69
72
|
sed: sedTool,
|
|
73
|
+
semantic_search: semanticSearchTool,
|
|
70
74
|
todo_write: todoWriteTool,
|
|
71
75
|
todo_read: todoReadTool,
|
|
72
76
|
};
|
|
@@ -98,6 +102,7 @@ export function createReadOnlyTools(cwd, options) {
|
|
|
98
102
|
createYqTool(cwd),
|
|
99
103
|
createSemgrepTool(cwd),
|
|
100
104
|
createSedTool(cwd),
|
|
105
|
+
createSemanticSearchTool(cwd, options?.semantic),
|
|
101
106
|
];
|
|
102
107
|
}
|
|
103
108
|
/**
|
|
@@ -120,6 +125,7 @@ export function createAllTools(cwd, options) {
|
|
|
120
125
|
yq: createYqTool(cwd),
|
|
121
126
|
semgrep: createSemgrepTool(cwd),
|
|
122
127
|
sed: createSedTool(cwd),
|
|
128
|
+
semantic_search: createSemanticSearchTool(cwd, options?.semantic),
|
|
123
129
|
todo_write: todoWriteTool,
|
|
124
130
|
todo_read: todoReadTool,
|
|
125
131
|
};
|