@agent-smith/core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +378 -0
  2. package/dist/actions/cmd.d.ts +5 -0
  3. package/dist/actions/cmd.js +135 -0
  4. package/dist/actions/read.d.ts +3 -0
  5. package/dist/actions/read.js +17 -0
  6. package/dist/adaptaters/cmd.d.ts +2 -0
  7. package/dist/adaptaters/cmd.js +39 -0
  8. package/dist/agents/cmd.d.ts +3 -0
  9. package/dist/agents/cmd.js +10 -0
  10. package/dist/agents/conf.d.ts +3 -0
  11. package/dist/agents/conf.js +9 -0
  12. package/dist/agents/files.d.ts +3 -0
  13. package/dist/agents/files.js +40 -0
  14. package/dist/agents/read.d.ts +11 -0
  15. package/dist/agents/read.js +241 -0
  16. package/dist/agents/useagent.d.ts +13 -0
  17. package/dist/agents/useagent.js +395 -0
  18. package/dist/conf.d.ts +14 -0
  19. package/dist/conf.js +160 -0
  20. package/dist/const.d.ts +3 -0
  21. package/dist/const.js +10 -0
  22. package/dist/db/db.d.ts +3 -0
  23. package/dist/db/db.js +24 -0
  24. package/dist/db/read.d.ts +45 -0
  25. package/dist/db/read.js +280 -0
  26. package/dist/db/schemas.d.ts +2 -0
  27. package/dist/db/schemas.js +141 -0
  28. package/dist/db/write.d.ts +23 -0
  29. package/dist/db/write.js +570 -0
  30. package/dist/features/actions/load-skill.d.ts +2 -0
  31. package/dist/features/actions/load-skill.js +37 -0
  32. package/dist/features/actions/notify-user.d.ts +2 -0
  33. package/dist/features/actions/notify-user.js +25 -0
  34. package/dist/features/actions/read-feature.d.ts +2 -0
  35. package/dist/features/actions/read-feature.js +25 -0
  36. package/dist/features/actions/run-agent.d.ts +2 -0
  37. package/dist/features/actions/run-agent.js +34 -0
  38. package/dist/features/actions/run-collaborator.d.ts +1 -0
  39. package/dist/features/actions/run-collaborator.js +42 -0
  40. package/dist/features/actions/run-worker.d.ts +2 -0
  41. package/dist/features/actions/run-worker.js +34 -0
  42. package/dist/features/adaptaters/agent-smith-db-getschema.d.ts +4 -0
  43. package/dist/features/adaptaters/agent-smith-db-getschema.js +62 -0
  44. package/dist/features/adaptaters/imgs2base64.d.ts +1 -0
  45. package/dist/features/adaptaters/imgs2base64.js +13 -0
  46. package/dist/features/adaptaters/prequery.d.ts +4 -0
  47. package/dist/features/adaptaters/prequery.js +5 -0
  48. package/dist/features/agents/agent-smith-colab.yml +37 -0
  49. package/dist/features/agents/agent-smith-doc.yml +50 -0
  50. package/dist/features/agents/agent-smith-help.yml +35 -0
  51. package/dist/features/agents/agent-smith-search.yml +41 -0
  52. package/dist/features/agents/agent-smith-sql.yml +31 -0
  53. package/dist/features/agents/agent-smith.yml +37 -0
  54. package/dist/features/agents/collaborator.yml +15 -0
  55. package/dist/features/agents/infer.yml +12 -0
  56. package/dist/features/fragments/ctx-helper-files.md +4 -0
  57. package/dist/features/fragments/workspace.txt +6 -0
  58. package/dist/features/skills/create-package-readme/SKILL.md +66 -0
  59. package/dist/features/skills/document-package/SKILL.md +83 -0
  60. package/dist/features/skills/t/SKILL.md +26 -0
  61. package/dist/features/skills/update-codebase-summary/SKILL.md +45 -0
  62. package/dist/features/skills/update-doc-map/SKILL.md +8 -0
  63. package/dist/features/skills/update-doc-map/scripts/generate-doc-map.mjs +196 -0
  64. package/dist/features/workflows/agent-smith-db.yml +9 -0
  65. package/dist/features/workflows/q.yml +3 -0
  66. package/dist/features/workflows/vision.yml +3 -0
  67. package/dist/main.d.ts +127 -0
  68. package/dist/main.js +80 -0
  69. package/dist/mcp.d.ts +16 -0
  70. package/dist/mcp.js +110 -0
  71. package/dist/state/backends.d.ts +7 -0
  72. package/dist/state/backends.js +96 -0
  73. package/dist/state/features.d.ts +10 -0
  74. package/dist/state/features.js +42 -0
  75. package/dist/state/plugins.d.ts +6 -0
  76. package/dist/state/plugins.js +27 -0
  77. package/dist/state/state.d.ts +18 -0
  78. package/dist/state/state.js +79 -0
  79. package/dist/state/tasks.d.ts +6 -0
  80. package/dist/state/tasks.js +33 -0
  81. package/dist/tools.d.ts +15 -0
  82. package/dist/tools.js +149 -0
  83. package/dist/updateconf.d.ts +5 -0
  84. package/dist/updateconf.js +124 -0
  85. package/dist/utils/io.d.ts +10 -0
  86. package/dist/utils/io.js +98 -0
  87. package/dist/utils/perf.d.ts +9 -0
  88. package/dist/utils/perf.js +63 -0
  89. package/dist/utils/sys/clipboard.d.ts +3 -0
  90. package/dist/utils/sys/clipboard.js +33 -0
  91. package/dist/utils/sys/delete_file.d.ts +2 -0
  92. package/dist/utils/sys/delete_file.js +10 -0
  93. package/dist/utils/sys/dirs.d.ts +2 -0
  94. package/dist/utils/sys/dirs.js +9 -0
  95. package/dist/utils/sys/execute.d.ts +13 -0
  96. package/dist/utils/sys/execute.js +48 -0
  97. package/dist/utils/sys/read.d.ts +3 -0
  98. package/dist/utils/sys/read.js +21 -0
  99. package/dist/utils/sys/read_agent.d.ts +6 -0
  100. package/dist/utils/sys/read_agent.js +23 -0
  101. package/dist/utils/sys/read_cmds.d.ts +7 -0
  102. package/dist/utils/sys/read_cmds.js +37 -0
  103. package/dist/utils/sys/read_conf.d.ts +6 -0
  104. package/dist/utils/sys/read_conf.js +12 -0
  105. package/dist/utils/sys/read_features.d.ts +3 -0
  106. package/dist/utils/sys/read_features.js +134 -0
  107. package/dist/utils/sys/read_yml_file.d.ts +5 -0
  108. package/dist/utils/sys/read_yml_file.js +11 -0
  109. package/dist/utils/sys/run_python.d.ts +6 -0
  110. package/dist/utils/sys/run_python.js +39 -0
  111. package/dist/utils/text.d.ts +2 -0
  112. package/dist/utils/text.js +28 -0
  113. package/dist/utils/user_msgs.d.ts +5 -0
  114. package/dist/utils/user_msgs.js +19 -0
  115. package/dist/workflows/cmd.d.ts +3 -0
  116. package/dist/workflows/cmd.js +189 -0
  117. package/dist/workflows/read.d.ts +6 -0
  118. package/dist/workflows/read.js +61 -0
  119. package/package.json +45 -0
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: document-package
3
+ description: use when asked to create or update package documentation in the docsite
4
+ ---
5
+
6
+ This skill describes the workflow to document a package for the Agent Smith CLI.
7
+
8
+ ## Workflow
9
+
10
+ Execute this one step after the other:
11
+
12
+ 1. **Locate the package** — Read `.agents/documentation/codebase-summary.md` to find the package path
13
+
14
+ 2. **Read codebase summary** — Read `[package-path].agents/documentation/codebase-summary.md` (e.g., `agent-smith-plugins/system/shell/.agents/documentation/codebase-summary.md`). This provides a quick overview of tools, agents, dependencies, and architecture.
15
+
16
+ 3. **Read source code** — Inspect `src/actions/`, `dist/agents/*.yml`, `dist/tasks/*.yml` to identify tools, agents, and capabilities.
17
+
18
+ 4. **Find next number** — List existing docs in `agent-smith/docsite/public/doc/plugins/`. Use the next available number (e.g., if 1-8 exist, use 9).
19
+
20
+ 5. **Write the doc** at `agent-smith/docsite/public/doc/plugins/<N>.<name>.md` using this exact structure:
21
+
22
+ ```markdown
23
+ # <PackageName>
24
+
25
+ ![pub package](https://img.shields.io/npm/v/@agent-smith/feat-<name>)
26
+
27
+ One-line description of what the package does.
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ npm i -g @agent-smith/feat-<name>
33
+ ```
34
+
35
+ Add the package to your `config.yml` file and run the `conf` command:
36
+
37
+ ```yml
38
+ plugins:
39
+ - "@agent-smith/feat-<name>"
40
+ ```
41
+
42
+ ```bash
43
+ lm conf
44
+ ```
45
+
46
+ ## Actions and tools
47
+
48
+ ### <category>
49
+
50
+ Available tools:
51
+
52
+ - <kbd>tool-name</kbd> one-line description of what it does (include container image if applicable)
53
+
54
+ ## Agents
55
+
56
+ Available agents:
57
+
58
+ - <kbd>agent-name</kbd> one-line description. Lists tools used:
59
+ - `tool-a` — purpose
60
+ - `tool-b` — purpose
61
+
62
+ ## Example agent
63
+
64
+ ```yaml
65
+ description: A brief description
66
+ model: qwen4b
67
+ toolsList:
68
+ - agent-name # this tool is a subagent
69
+ ```
70
+
71
+ ## Links
72
+
73
+ Add a next page link. All internal links must be of this form:
74
+
75
+ <a href="javascript:openLink('/plugins/overview')">Back: Overview</a>
76
+ ```
77
+
78
+ ## Rules
79
+
80
+ - Keep it short and information-dense — match the style of `6.filesystem.md` and `8.search.md`
81
+ - Use `<kbd>tool-name</kbd>` for all tools/agents
82
+ - Use backticks `for tool names in prose
83
+ - End with navigation link to overview (or next package if known)
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: t
3
+ description: describes how agent tasks work
4
+ ---
5
+
6
+ # Tasks
7
+
8
+ The tasks are located in an `.agents/tasks` directory, or `[project-name].agents/tasks` for projects
9
+
10
+ ## Read a task
11
+
12
+ Read `.agents/tasks/[task-name]` to list the task files. If a `state.md` file is there read it: it details the task progression.
13
+
14
+ ## Write to a task
15
+
16
+ Check if an `.agents/tasks/[task-name]` directory exists, if not create it. You can write markdown files in it.
17
+
18
+ ## Execute or continue a task
19
+
20
+ Check what is remaining to do. Avoid verifying previous phases and execute the next phase directly. Always execute the phases one by one. Update the sate after each phase to mark it done.
21
+
22
+ ## After a task is executed or created: manage the state
23
+
24
+ If the task is completed ask the user to confirm if everything is all right. If yes delete the task directory.
25
+
26
+ If the task is not completed create or update`.agents/tasks/[task-name]/state.md` to indicate briefly what was done and what remains to do to complete the quickstart task. This file should contains step by step instructions and their state.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: update-codebase-summary
3
+ description: use when asked to create or update the codebase summary documentation
4
+ ---
5
+
6
+ This skill describes the workflow to create or update a codebase documentation file (`[project-path].agents/documentation/codebase-summary.md`).
7
+
8
+ ## Workflow
9
+
10
+ 1. **Explore the project** — Walk the directory tree, identify package/module boundaries, read manifest files (e.g., `package.json`), locate entry points, and understand inter-module dependencies.
11
+
12
+ 2. **Check for existing file** — Look for `[project-path].agents/documentation/codebase-summary.md` in the project directory. If it exists, update it. If not, create it.
13
+
14
+ 3. **Write the file** using exactly these 7 sections in this order:
15
+
16
+ ### Section Format
17
+
18
+ ```markdown
19
+ # <module-name>
20
+
21
+ ## Summary
22
+ One sentence: what the module does and why it exists.
23
+
24
+ ## Dependencies
25
+ - `<dep-module>` — key types, functions, or services used
26
+ - External: `<library>` (<purpose>)
27
+
28
+ ## Used By
29
+ - `<consumer-module>` — why it uses this module
30
+
31
+ ## Entry Point
32
+ - `<path>` — one-line description of what it exports or provides
33
+
34
+ ## Key Files
35
+ | File | Purpose |
36
+ |------|---------|
37
+ | `<src/path>` | One-line: what the file does conceptually |
38
+
39
+ ## Architecture
40
+ - 2–4 bullet points on main design patterns and data flow.
41
+
42
+ ## Related
43
+ - See `<related-module>` — how they work together
44
+
45
+ Keep the file as short and condensed as possible
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: update-doc-map
3
+ description: read this only when instructed to update the documentation map
4
+ ---
5
+
6
+ Run the `agent-smith/packages/core/src/features/skills/update-doc-map/scripts/generate-doc-map.mjs` Nodejs script.
7
+
8
+ Report only the end result: if the script has run ok or not.
@@ -0,0 +1,196 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * generate-doc-map.mjs
5
+ *
6
+ * Scans the project for all documentation files and generates a doc-map.md
7
+ * file that helps AI agents navigate the codebase documentation.
8
+ */
9
+
10
+ import { readdir, stat, writeFile } from 'node:fs/promises';
11
+ import { join, relative, dirname, basename } from 'node:path';
12
+ import { fileURLToPath } from 'node:url';
13
+
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ // The script is in .agents/, so the project root is one level up
16
+ const PROJECT_ROOT = join(__dirname, '../../../../../../../');
17
+
18
+ // Packages that have their own .agents/documentation
19
+ const PACKAGES = [
20
+ 'core', 'agent', 'cli', 'wscli', 'types', 'smem', 'tmem', 'server'
21
+ ];
22
+
23
+ /**
24
+ * Recursively find all markdown files in a directory
25
+ */
26
+ async function findMarkdownFiles(dir, baseDir) {
27
+ const files = [];
28
+ try {
29
+ const entries = await readdir(dir, { withFileTypes: true });
30
+ for (const entry of entries) {
31
+ const fullPath = join(dir, entry.name);
32
+ if (entry.isDirectory()) {
33
+ // Skip node_modules and other non-doc directories
34
+ if (!['node_modules', '.git', 'dist', 'build', '__pycache__'].includes(entry.name)) {
35
+ files.push(...await findMarkdownFiles(fullPath, baseDir));
36
+ }
37
+ } else if (entry.isFile() && entry.name.endsWith('.md')) {
38
+ const relPath = relative(baseDir, fullPath);
39
+ files.push({ path: fullPath, relative: relPath });
40
+ }
41
+ }
42
+ } catch (err) {
43
+ // Skip directories we can't read
44
+ }
45
+ return files;
46
+ }
47
+
48
+ /**
49
+ * Extract a human-readable title from the filename
50
+ */
51
+ function extractTitle(fileRelative) {
52
+ const parts = fileRelative.split('/');
53
+ const filename = basename(fileRelative, '.md');
54
+
55
+ // Try to get a better name from the path segments
56
+ if (parts.length > 1) {
57
+ return parts.slice(0, -1).join('/') + '/' + filename;
58
+ }
59
+ return filename;
60
+ }
61
+
62
+ /**
63
+ * Format a file path for display and linking using full workspace-relative path
64
+ */
65
+ function formatLink(fileRelative, basePath) {
66
+ // Return full path from workspace root with .md extension preserved
67
+ return `${basePath}/${fileRelative}`;
68
+ }
69
+
70
+ /**
71
+ * Generate the documentation map markdown content
72
+ */
73
+ async function generateDocMap() {
74
+ const docSections = [];
75
+
76
+ // Scan public documentation (docsite/public/doc)
77
+ const publicDocPath = join(PROJECT_ROOT, 'docsite/public/doc');
78
+ try {
79
+ await stat(publicDocPath);
80
+ const files = await findMarkdownFiles(publicDocPath, publicDocPath);
81
+
82
+ if (files.length > 0) {
83
+ // Group by top-level category
84
+ const grouped = {};
85
+ for (const file of files) {
86
+ const parts = file.relative.split('/');
87
+ const category = parts[0] || 'root';
88
+ if (!grouped[category]) grouped[category] = [];
89
+ grouped[category].push(file);
90
+ }
91
+
92
+ docSections.push({
93
+ title: '📚 Public Documentation',
94
+ description: 'Main project documentation hosted in the docsite.',
95
+ files: grouped,
96
+ basePath: 'docsite/public/doc'
97
+ });
98
+ }
99
+ } catch (err) {
100
+ // Skip if directory doesn't exist
101
+ }
102
+
103
+ // Scan root .agents/documentation
104
+ const rootAgentsPath = join(PROJECT_ROOT, '.agents/documentation');
105
+ try {
106
+ await stat(rootAgentsPath);
107
+ const files = await findMarkdownFiles(rootAgentsPath, rootAgentsPath);
108
+
109
+ if (files.length > 0) {
110
+ docSections.push({
111
+ title: '🤖 Root Agent Documentation',
112
+ description: 'Documentation for the agent system itself.',
113
+ files: { '': files },
114
+ basePath: '.agents'
115
+ });
116
+ }
117
+ } catch (err) {
118
+ // Skip if directory doesn't exist
119
+ }
120
+
121
+ // Scan each package's .agents/documentation
122
+ for (const pkg of PACKAGES) {
123
+ const pkgAgentsPath = join(PROJECT_ROOT, `packages/${pkg}/.agents/documentation`);
124
+ try {
125
+ await stat(pkgAgentsPath);
126
+ const files = await findMarkdownFiles(pkgAgentsPath, pkgAgentsPath);
127
+
128
+ if (files.length > 0) {
129
+ docSections.push({
130
+ title: `📦 Package: @agent-smith/${pkg}`,
131
+ description: `Documentation for the ${pkg} package.`,
132
+ files: { '': files },
133
+ basePath: `packages/${pkg}/.agents`
134
+ });
135
+ }
136
+ } catch (err) {
137
+ // Skip if directory doesn't exist or has no docs
138
+ }
139
+ }
140
+
141
+ // Generate the markdown content - compact format for AI agents
142
+ const lines = [
143
+ '# 🗺️ Documentation Map',
144
+ '',
145
+ ];
146
+
147
+ // Detailed sections only (no summary table, no horizontal rules)
148
+ for (const section of docSections) {
149
+ lines.push(`## ${section.title}`);
150
+ lines.push('');
151
+
152
+ for (const [category, files] of Object.entries(section.files)) {
153
+ if (files.length === 0) continue;
154
+
155
+ if (category) {
156
+ lines.push(`### ${category}`);
157
+ lines.push('');
158
+ }
159
+
160
+ // Sort files: files starting with numbers come first, then alphabetical
161
+ const sortedFiles = [...files].sort((a, b) => {
162
+ const aName = basename(a.relative, '.md');
163
+ const bName = basename(b.relative, '.md');
164
+ return aName.localeCompare(bName, undefined, { numeric: true });
165
+ });
166
+
167
+ for (const file of sortedFiles) {
168
+ const fullPath = formatLink(file.relative, section.basePath);
169
+ const workspacePath = `agent-smith/${fullPath}`;
170
+ lines.push(`- [\`${workspacePath}\`](${workspacePath})`);
171
+ }
172
+
173
+ lines.push('');
174
+ }
175
+ }
176
+
177
+ return lines.join('\n');
178
+ }
179
+
180
+ // Main execution
181
+ async function main() {
182
+ console.log('🔍 Scanning for documentation files...');
183
+
184
+ const content = await generateDocMap();
185
+ const outputPath = join(PROJECT_ROOT, '.agents/documentation/documentation-map.md');
186
+
187
+ // Write the file
188
+ await writeFile(outputPath, content, 'utf-8');
189
+
190
+ console.log(`✅ Documentation map generated: ${outputPath}`);
191
+ }
192
+
193
+ main().catch(err => {
194
+ console.error('❌ Error generating doc-map:', err);
195
+ process.exit(1);
196
+ });
@@ -0,0 +1,9 @@
1
+ tool:
2
+ description: and sql agent to retrieve data in the Agent Smith database by asking a question in natural language and get the data back
3
+ arguments:
4
+ prompt:
5
+ description: the question to ask about the data
6
+ steps:
7
+ - adaptater: agent-smith-db-getschema
8
+ - agent: agent-smith-sql
9
+ - action: db-execute-read-query
@@ -0,0 +1,3 @@
1
+ steps:
2
+ - adaptater: prequery
3
+ - agent: infer
@@ -0,0 +1,3 @@
1
+ steps:
2
+ - action: imgs2base64
3
+ - task: infer
package/dist/main.d.ts ADDED
@@ -0,0 +1,127 @@
1
+ import { executeAction } from "./actions/cmd.js";
2
+ import { McpClient } from "./mcp.js";
3
+ import { extractToolDoc } from "./tools.js";
4
+ import { executeWorkflow } from "./workflows/cmd.js";
5
+ import { readWorkflow } from "./workflows/read.js";
6
+ import { writeToClipboard } from "./utils/sys/clipboard.js";
7
+ import { execute, runShellCmd } from "./utils/sys/execute.js";
8
+ import { readConf } from "./utils/sys/read_conf.js";
9
+ import { createConfigFileIfNotExists, getConfigPath, processConfPath, updateConfigFile } from "./conf.js";
10
+ import { initDb } from "./db/db.js";
11
+ import { deleteFileIfExists } from "./utils/sys/delete_file.js";
12
+ import { getAgentPrompt, getInputFromOptions, openAgentSpec } from "./utils/io.js";
13
+ import { getFeatureSpec } from "./state/features.js";
14
+ import * as dbw from "./db/write.js";
15
+ import * as dbr from "./db/read.js";
16
+ import { init, initFilepaths, initState, pluginDataDir } from "./state/state.js";
17
+ import { initBackends, listBackends, setBackend } from "./state/backends.js";
18
+ import { initAgentSettings, getAgentSettings } from "./state/tasks.js";
19
+ import { readAgent, readAgentsDir } from "./utils/sys/read_agent.js";
20
+ import { extractBetweenTags } from "./utils/text.js";
21
+ import { recreateDbFromConf, updateConfCmd, updateFeaturesCmd } from "./updateconf.js";
22
+ import { useAgentExecutor } from "./agents/useagent.js";
23
+ import { executeAgent } from "./agents/cmd.js";
24
+ declare const db: {
25
+ db: any;
26
+ readAgentSettings: typeof dbr.readAgentSettings;
27
+ readAliases: typeof dbr.readAliases;
28
+ readBackends: typeof dbr.readBackends;
29
+ readFeature: typeof dbr.readFeature;
30
+ readFeaturePaths: typeof dbr.readFeaturePaths;
31
+ readFeatures: typeof dbr.readFeatures;
32
+ readFeaturesType: typeof dbr.readFeaturesType;
33
+ readFilePath: typeof dbr.readFilePath;
34
+ readFilePaths: typeof dbr.readFilePaths;
35
+ readPlugins: typeof dbr.readPlugins;
36
+ readSetting: typeof dbr.readSetting;
37
+ readSettings: typeof dbr.readSettings;
38
+ readSkillsFromList: typeof dbr.readSkillsFromList;
39
+ readAgentSetting: typeof dbr.readAgentSetting;
40
+ readTool: typeof dbr.readTool;
41
+ readWorkspaces: typeof dbr.readWorkspaces;
42
+ readSamplingPreset: typeof dbr.readSamplingPreset;
43
+ readSamplingPresets: typeof dbr.readSamplingPresets;
44
+ readAllSkills: typeof dbr.readAllSkills;
45
+ updatePromptfilePath: typeof dbw.updatePromptfilePath;
46
+ updateWorkspacePath: typeof dbw.updateWorkspacePath;
47
+ updateDataDirPath: typeof dbw.updateDataDirPath;
48
+ upsertBackends: typeof dbw.upsertBackends;
49
+ upsertSetting: typeof dbw.upsertSetting;
50
+ upsertWorkspace: typeof dbw.upsertWorkspace;
51
+ upsertAndCleanWorkspaces: typeof dbw.upsertAndCleanWorkspaces;
52
+ setDefaultBackend: typeof dbw.setDefaultBackend;
53
+ insertFeaturesPathIfNotExists: typeof dbw.insertFeaturesPathIfNotExists;
54
+ insertPluginIfNotExists: typeof dbw.insertPluginIfNotExists;
55
+ updateFeatures: typeof dbw.updateFeatures;
56
+ updateAliases: typeof dbw.updateAliases;
57
+ cleanupFeaturePaths: typeof dbw.cleanupFeaturePaths;
58
+ upsertFilePath: typeof dbw.upsertFilePath;
59
+ upsertAgentSettings: typeof dbw.upsertAgentSettings;
60
+ deleteAgentSettings: typeof dbw.deleteAgentSettings;
61
+ deleteAgentSetting: typeof dbw.deleteAgentSetting;
62
+ deleteWorkspace: typeof dbw.deleteWorkspace;
63
+ upsertSamplingPresets: typeof dbw.upsertSamplingPresets;
64
+ upsertSamplingPreset: typeof dbw.upsertSamplingPreset;
65
+ deleteSamplingPreset: typeof dbw.deleteSamplingPreset;
66
+ init: typeof initDb;
67
+ };
68
+ declare const fs: {
69
+ openAgentSpec: typeof openAgentSpec;
70
+ readWorkflow: typeof readWorkflow;
71
+ };
72
+ declare const conf: {
73
+ getConfigPath: typeof getConfigPath;
74
+ processConfPath: typeof processConfPath;
75
+ readConf: typeof readConf;
76
+ updateConfigFile: typeof updateConfigFile;
77
+ createConfigFileIfNotExists: typeof createConfigFileIfNotExists;
78
+ updateConfCmd: typeof updateConfCmd;
79
+ updateFeaturesCmd: typeof updateFeaturesCmd;
80
+ recreateDbFromConf: typeof recreateDbFromConf;
81
+ confDir: string;
82
+ dbPath: string;
83
+ };
84
+ declare const utils: {
85
+ execute: typeof execute;
86
+ runShellCmd: typeof runShellCmd;
87
+ deleteFileIfExists: typeof deleteFileIfExists;
88
+ readAgent: typeof readAgent;
89
+ readAgentsDir: typeof readAgentsDir;
90
+ extractBetweenTags: typeof extractBetweenTags;
91
+ writeToClipboard: typeof writeToClipboard;
92
+ usePerfTimer: (startTimer?: boolean) => {
93
+ start: () => void;
94
+ time: () => string;
95
+ timeRaw: () => string | number;
96
+ printTime: () => void;
97
+ measure: (name: string) => void;
98
+ final: (name?: string) => void;
99
+ };
100
+ };
101
+ declare const state: {
102
+ dataDirPath: import("@vue/reactivity").Ref<string, string>;
103
+ formatMode: import("@vue/reactivity").Ref<import("@agent-smith/types/dist/core.js").FormatMode, import("@agent-smith/types/dist/core.js").FormatMode>;
104
+ init: typeof init;
105
+ initFilepaths: typeof initFilepaths;
106
+ initState: typeof initState;
107
+ inputMode: import("@vue/reactivity").Ref<import("@agent-smith/types/dist/core.js").InputMode, import("@agent-smith/types/dist/core.js").InputMode>;
108
+ isStateReady: import("@vue/reactivity").Ref<boolean, boolean>;
109
+ lastCmd: {
110
+ name: string;
111
+ args: Array<string>;
112
+ };
113
+ outputMode: import("@vue/reactivity").Ref<import("@agent-smith/types/dist/core.js").OutputMode, import("@agent-smith/types/dist/core.js").OutputMode>;
114
+ pluginDataDir: typeof pluginDataDir;
115
+ promptfilePath: import("@vue/reactivity").Ref<string, string>;
116
+ pyShell: import("python-shell/index.js").PythonShell;
117
+ agentSettings: Record<string, import("@agent-smith/types/dist/agent.js").AgentSettings>;
118
+ isAgentSettingsInitialized: import("@vue/reactivity").Ref<boolean, boolean>;
119
+ initAgentSettings: typeof initAgentSettings;
120
+ getAgentSettings: typeof getAgentSettings;
121
+ backend: import("@vue/reactivity").Ref<import("@agent-smith/agent/dist/client.js").Lm | undefined, import("@agent-smith/agent/dist/client.js").Lm | undefined>;
122
+ backends: Record<string, import("@agent-smith/agent/dist/client.js").Lm>;
123
+ initBackends: typeof initBackends;
124
+ listBackends: typeof listBackends;
125
+ setBackend: typeof setBackend;
126
+ };
127
+ export { db, fs, conf, utils, state, executeAction, executeWorkflow, getAgentPrompt, getInputFromOptions, getFeatureSpec, extractToolDoc, McpClient, openAgentSpec, useAgentExecutor, executeAgent, };
package/dist/main.js ADDED
@@ -0,0 +1,80 @@
1
+ import { executeAction } from "./actions/cmd.js";
2
+ import { McpClient } from "./mcp.js";
3
+ import { extractToolDoc } from "./tools.js";
4
+ import { executeWorkflow } from "./workflows/cmd.js";
5
+ import { readWorkflow } from "./workflows/read.js";
6
+ import { writeToClipboard } from "./utils/sys/clipboard.js";
7
+ import { execute, runShellCmd } from "./utils/sys/execute.js";
8
+ import { readConf } from "./utils/sys/read_conf.js";
9
+ import { confDir, createConfigFileIfNotExists, dbPath, getConfigPath, processConfPath, updateConfigFile } from "./conf.js";
10
+ import { initDb, db as cdb } from "./db/db.js";
11
+ import { usePerfTimer } from "./utils/perf.js";
12
+ import { deleteFileIfExists } from "./utils/sys/delete_file.js";
13
+ import { getAgentPrompt, getInputFromOptions, openAgentSpec } from "./utils/io.js";
14
+ import { getFeatureSpec } from "./state/features.js";
15
+ import * as dbw from "./db/write.js";
16
+ import * as dbr from "./db/read.js";
17
+ import { dataDirPath, formatMode, init, initFilepaths, initState, inputMode, isStateReady, lastCmd, outputMode, pluginDataDir, promptfilePath, pyShell, } from "./state/state.js";
18
+ import { backend, backends, initBackends, listBackends, setBackend, } from "./state/backends.js";
19
+ import { agentSettings, isAgentSettingsInitialized, initAgentSettings, getAgentSettings } from "./state/tasks.js";
20
+ import { readAgent, readAgentsDir, } from "./utils/sys/read_agent.js";
21
+ import { extractBetweenTags } from "./utils/text.js";
22
+ import { recreateDbFromConf, updateConfCmd, updateFeaturesCmd, } from "./updateconf.js";
23
+ import { useAgentExecutor } from "./agents/useagent.js";
24
+ import { executeAgent } from "./agents/cmd.js";
25
+ const db = {
26
+ init: initDb,
27
+ ...dbw,
28
+ ...dbr,
29
+ db: cdb,
30
+ };
31
+ const fs = {
32
+ openAgentSpec,
33
+ readWorkflow,
34
+ };
35
+ const conf = {
36
+ getConfigPath,
37
+ processConfPath,
38
+ readConf,
39
+ updateConfigFile,
40
+ createConfigFileIfNotExists,
41
+ updateConfCmd,
42
+ updateFeaturesCmd,
43
+ recreateDbFromConf,
44
+ confDir,
45
+ dbPath,
46
+ };
47
+ const utils = {
48
+ execute,
49
+ runShellCmd,
50
+ deleteFileIfExists,
51
+ readAgent,
52
+ readAgentsDir,
53
+ extractBetweenTags,
54
+ writeToClipboard,
55
+ usePerfTimer,
56
+ };
57
+ const state = {
58
+ dataDirPath,
59
+ formatMode,
60
+ init,
61
+ initFilepaths,
62
+ initState,
63
+ inputMode,
64
+ isStateReady,
65
+ lastCmd,
66
+ outputMode,
67
+ pluginDataDir,
68
+ promptfilePath,
69
+ pyShell,
70
+ agentSettings,
71
+ isAgentSettingsInitialized,
72
+ initAgentSettings,
73
+ getAgentSettings,
74
+ backend,
75
+ backends,
76
+ initBackends,
77
+ listBackends,
78
+ setBackend,
79
+ };
80
+ export { db, fs, conf, utils, state, executeAction, executeWorkflow, getAgentPrompt, getInputFromOptions, getFeatureSpec, extractToolDoc, McpClient, openAgentSpec, useAgentExecutor, executeAgent, };
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
+ import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
3
+ import type { ToolSpec } from "@agent-smith/types";
4
+ declare class McpClient {
5
+ name: string;
6
+ transport: StdioClientTransport;
7
+ client: Client;
8
+ authorizedTools: Array<string> | null;
9
+ askUserTools: Array<string> | null;
10
+ tools: Record<string, ToolSpec>;
11
+ constructor(servername: string, command: string, args: Array<string>, authorizedTools?: Array<string> | null, askUserTools?: Array<string> | null);
12
+ start(): Promise<void>;
13
+ stop(): Promise<void>;
14
+ extractTools(options: Record<string, any>): Promise<Array<ToolSpec>>;
15
+ }
16
+ export { McpClient, };