@strands-agents/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +175 -0
- package/NOTICE +1 -0
- package/README.md +576 -0
- package/bin/strands.js +256 -0
- package/dist/src/cli/arguments.js +198 -0
- package/dist/src/cli/arguments.js.map +1 -0
- package/dist/src/cli/invocation.js +124 -0
- package/dist/src/cli/invocation.js.map +1 -0
- package/dist/src/cli/run.js +252 -0
- package/dist/src/cli/run.js.map +1 -0
- package/dist/src/console.js +235 -0
- package/dist/src/console.js.map +1 -0
- package/dist/src/logging.js +103 -0
- package/dist/src/logging.js.map +1 -0
- package/dist/src/main.js +7 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/tui/acp/projection.js +276 -0
- package/dist/src/tui/acp/projection.js.map +1 -0
- package/dist/src/tui/acp/server.js +263 -0
- package/dist/src/tui/acp/server.js.map +1 -0
- package/dist/src/tui/agent-configuration.js +335 -0
- package/dist/src/tui/agent-configuration.js.map +1 -0
- package/dist/src/tui/agent-setup.js +80 -0
- package/dist/src/tui/agent-setup.js.map +1 -0
- package/dist/src/tui/background/activity.js +273 -0
- package/dist/src/tui/background/activity.js.map +1 -0
- package/dist/src/tui/background/inbox.js +120 -0
- package/dist/src/tui/background/inbox.js.map +1 -0
- package/dist/src/tui/background/tasks.js +98 -0
- package/dist/src/tui/background/tasks.js.map +1 -0
- package/dist/src/tui/builtin-tools.js +65 -0
- package/dist/src/tui/builtin-tools.js.map +1 -0
- package/dist/src/tui/chat/commands.js +98 -0
- package/dist/src/tui/chat/commands.js.map +1 -0
- package/dist/src/tui/chat/controller-helpers.js +62 -0
- package/dist/src/tui/chat/controller-helpers.js.map +1 -0
- package/dist/src/tui/chat/controller.js +1913 -0
- package/dist/src/tui/chat/controller.js.map +1 -0
- package/dist/src/tui/chat/help.js +94 -0
- package/dist/src/tui/chat/help.js.map +1 -0
- package/dist/src/tui/chat/panels.js +418 -0
- package/dist/src/tui/chat/panels.js.map +1 -0
- package/dist/src/tui/chat/projector.js +443 -0
- package/dist/src/tui/chat/projector.js.map +1 -0
- package/dist/src/tui/chat/sdk-projector.js +194 -0
- package/dist/src/tui/chat/sdk-projector.js.map +1 -0
- package/dist/src/tui/chat/shell.js +263 -0
- package/dist/src/tui/chat/shell.js.map +1 -0
- package/dist/src/tui/chat/types.js +2 -0
- package/dist/src/tui/chat/types.js.map +1 -0
- package/dist/src/tui/config.js +497 -0
- package/dist/src/tui/config.js.map +1 -0
- package/dist/src/tui/configuration-instructions.js +14 -0
- package/dist/src/tui/configuration-instructions.js.map +1 -0
- package/dist/src/tui/mcp/config.js +370 -0
- package/dist/src/tui/mcp/config.js.map +1 -0
- package/dist/src/tui/mcp.js +98 -0
- package/dist/src/tui/mcp.js.map +1 -0
- package/dist/src/tui/memory-options.js +10 -0
- package/dist/src/tui/memory-options.js.map +1 -0
- package/dist/src/tui/messaging.js +193 -0
- package/dist/src/tui/messaging.js.map +1 -0
- package/dist/src/tui/model/context.js +13 -0
- package/dist/src/tui/model/context.js.map +1 -0
- package/dist/src/tui/model/display.js +59 -0
- package/dist/src/tui/model/display.js.map +1 -0
- package/dist/src/tui/model/runtime.js +365 -0
- package/dist/src/tui/model/runtime.js.map +1 -0
- package/dist/src/tui/model/selection.js +160 -0
- package/dist/src/tui/model/selection.js.map +1 -0
- package/dist/src/tui/package-version.js +47 -0
- package/dist/src/tui/package-version.js.map +1 -0
- package/dist/src/tui/permissions/file-change-preview.js +182 -0
- package/dist/src/tui/permissions/file-change-preview.js.map +1 -0
- package/dist/src/tui/permissions/policy.js +223 -0
- package/dist/src/tui/permissions/policy.js.map +1 -0
- package/dist/src/tui/permissions/settings.js +21 -0
- package/dist/src/tui/permissions/settings.js.map +1 -0
- package/dist/src/tui/project/acp.js +93 -0
- package/dist/src/tui/project/acp.js.map +1 -0
- package/dist/src/tui/project/archive.js +239 -0
- package/dist/src/tui/project/archive.js.map +1 -0
- package/dist/src/tui/project/configuration-secrets.js +107 -0
- package/dist/src/tui/project/configuration-secrets.js.map +1 -0
- package/dist/src/tui/project/configuration.js +201 -0
- package/dist/src/tui/project/configuration.js.map +1 -0
- package/dist/src/tui/project/export.js +560 -0
- package/dist/src/tui/project/export.js.map +1 -0
- package/dist/src/tui/project/import.js +75 -0
- package/dist/src/tui/project/import.js.map +1 -0
- package/dist/src/tui/project/module-loader.js +157 -0
- package/dist/src/tui/project/module-loader.js.map +1 -0
- package/dist/src/tui/project/packaging.js +53 -0
- package/dist/src/tui/project/packaging.js.map +1 -0
- package/dist/src/tui/project/portable-dependencies.js +34 -0
- package/dist/src/tui/project/portable-dependencies.js.map +1 -0
- package/dist/src/tui/project/portable-mcp.js +118 -0
- package/dist/src/tui/project/portable-mcp.js.map +1 -0
- package/dist/src/tui/project/python.js +414 -0
- package/dist/src/tui/project/python.js.map +1 -0
- package/dist/src/tui/project/run.js +118 -0
- package/dist/src/tui/project/run.js.map +1 -0
- package/dist/src/tui/project/source.js +307 -0
- package/dist/src/tui/project/source.js.map +1 -0
- package/dist/src/tui/project/typescript.js +135 -0
- package/dist/src/tui/project/typescript.js.map +1 -0
- package/dist/src/tui/project/worker.py +731 -0
- package/dist/src/tui/provider/aws-client.js +67 -0
- package/dist/src/tui/provider/aws-client.js.map +1 -0
- package/dist/src/tui/provider/aws-config.js +66 -0
- package/dist/src/tui/provider/aws-config.js.map +1 -0
- package/dist/src/tui/provider/bedrock-catalog.js +87 -0
- package/dist/src/tui/provider/bedrock-catalog.js.map +1 -0
- package/dist/src/tui/provider/discovery.js +323 -0
- package/dist/src/tui/provider/discovery.js.map +1 -0
- package/dist/src/tui/provider/environment.js +138 -0
- package/dist/src/tui/provider/environment.js.map +1 -0
- package/dist/src/tui/provider/packages.js +42 -0
- package/dist/src/tui/provider/packages.js.map +1 -0
- package/dist/src/tui/run.js +257 -0
- package/dist/src/tui/run.js.map +1 -0
- package/dist/src/tui/runtime.js +520 -0
- package/dist/src/tui/runtime.js.map +1 -0
- package/dist/src/tui/session/agent-definition.js +100 -0
- package/dist/src/tui/session/agent-definition.js.map +1 -0
- package/dist/src/tui/session/catalog.js +159 -0
- package/dist/src/tui/session/catalog.js.map +1 -0
- package/dist/src/tui/session/context.js +118 -0
- package/dist/src/tui/session/context.js.map +1 -0
- package/dist/src/tui/session/conversation-helpers.js +46 -0
- package/dist/src/tui/session/conversation-helpers.js.map +1 -0
- package/dist/src/tui/session/conversations.js +456 -0
- package/dist/src/tui/session/conversations.js.map +1 -0
- package/dist/src/tui/session/desktop-profile.js +80 -0
- package/dist/src/tui/session/desktop-profile.js.map +1 -0
- package/dist/src/tui/session/options.js +44 -0
- package/dist/src/tui/session/options.js.map +1 -0
- package/dist/src/tui/session/sessions.js +251 -0
- package/dist/src/tui/session/sessions.js.map +1 -0
- package/dist/src/tui/session/voice.js +353 -0
- package/dist/src/tui/session/voice.js.map +1 -0
- package/dist/src/tui/settings.js +362 -0
- package/dist/src/tui/settings.js.map +1 -0
- package/dist/src/tui/setup/questions.js +277 -0
- package/dist/src/tui/setup/questions.js.map +1 -0
- package/dist/src/tui/skills.js +135 -0
- package/dist/src/tui/skills.js.map +1 -0
- package/dist/src/tui/steering.js +67 -0
- package/dist/src/tui/steering.js.map +1 -0
- package/dist/src/tui/strands-backend.js +368 -0
- package/dist/src/tui/strands-backend.js.map +1 -0
- package/dist/src/tui/stream-presentation.js +138 -0
- package/dist/src/tui/stream-presentation.js.map +1 -0
- package/dist/src/tui/telemetry.js +46 -0
- package/dist/src/tui/telemetry.js.map +1 -0
- package/dist/src/tui/terminal/composer.js +237 -0
- package/dist/src/tui/terminal/composer.js.map +1 -0
- package/dist/src/tui/terminal/directory-picker.js +76 -0
- package/dist/src/tui/terminal/directory-picker.js.map +1 -0
- package/dist/src/tui/terminal/ink.js +94 -0
- package/dist/src/tui/terminal/ink.js.map +1 -0
- package/dist/src/tui/terminal/mouse-input.js +83 -0
- package/dist/src/tui/terminal/mouse-input.js.map +1 -0
- package/dist/src/tui/terminal/open-url.js +21 -0
- package/dist/src/tui/terminal/open-url.js.map +1 -0
- package/dist/src/tui/terminal/process-tree.js +132 -0
- package/dist/src/tui/terminal/process-tree.js.map +1 -0
- package/dist/src/tui/terminal/sanitize.js +71 -0
- package/dist/src/tui/terminal/sanitize.js.map +1 -0
- package/dist/src/tui/terminal/shell-output.js +43 -0
- package/dist/src/tui/terminal/shell-output.js.map +1 -0
- package/dist/src/tui/terminal/terminal.js +39 -0
- package/dist/src/tui/terminal/terminal.js.map +1 -0
- package/dist/src/tui/view/agents-panel.js +21 -0
- package/dist/src/tui/view/agents-panel.js.map +1 -0
- package/dist/src/tui/view/app.js +1068 -0
- package/dist/src/tui/view/app.js.map +1 -0
- package/dist/src/tui/view/chat-root.js +88 -0
- package/dist/src/tui/view/chat-root.js.map +1 -0
- package/dist/src/tui/view/chat-view.js +185 -0
- package/dist/src/tui/view/chat-view.js.map +1 -0
- package/dist/src/tui/view/command-palette.js +18 -0
- package/dist/src/tui/view/command-palette.js.map +1 -0
- package/dist/src/tui/view/custom-theme-editor.js +301 -0
- package/dist/src/tui/view/custom-theme-editor.js.map +1 -0
- package/dist/src/tui/view/export-panel.js +14 -0
- package/dist/src/tui/view/export-panel.js.map +1 -0
- package/dist/src/tui/view/fade-in.js +106 -0
- package/dist/src/tui/view/fade-in.js.map +1 -0
- package/dist/src/tui/view/frog-canvas.js +375 -0
- package/dist/src/tui/view/frog-canvas.js.map +1 -0
- package/dist/src/tui/view/frog-drawing.js +415 -0
- package/dist/src/tui/view/frog-drawing.js.map +1 -0
- package/dist/src/tui/view/frog-easter-egg.js +53 -0
- package/dist/src/tui/view/frog-easter-egg.js.map +1 -0
- package/dist/src/tui/view/frog-intro-renderer.js +634 -0
- package/dist/src/tui/view/frog-intro-renderer.js.map +1 -0
- package/dist/src/tui/view/help-footer.js +36 -0
- package/dist/src/tui/view/help-footer.js.map +1 -0
- package/dist/src/tui/view/interaction.js +349 -0
- package/dist/src/tui/view/interaction.js.map +1 -0
- package/dist/src/tui/view/intro.js +35 -0
- package/dist/src/tui/view/intro.js.map +1 -0
- package/dist/src/tui/view/markdown.js +99 -0
- package/dist/src/tui/view/markdown.js.map +1 -0
- package/dist/src/tui/view/media.js +70 -0
- package/dist/src/tui/view/media.js.map +1 -0
- package/dist/src/tui/view/model-panel.js +65 -0
- package/dist/src/tui/view/model-panel.js.map +1 -0
- package/dist/src/tui/view/panel-components.js +17 -0
- package/dist/src/tui/view/panel-components.js.map +1 -0
- package/dist/src/tui/view/panels.js +129 -0
- package/dist/src/tui/view/panels.js.map +1 -0
- package/dist/src/tui/view/presentation.js +382 -0
- package/dist/src/tui/view/presentation.js.map +1 -0
- package/dist/src/tui/view/prompt-editor.js +74 -0
- package/dist/src/tui/view/prompt-editor.js.map +1 -0
- package/dist/src/tui/view/provider-list.js +14 -0
- package/dist/src/tui/view/provider-list.js.map +1 -0
- package/dist/src/tui/view/sessions-panel.js +15 -0
- package/dist/src/tui/view/sessions-panel.js.map +1 -0
- package/dist/src/tui/view/settings-panel.js +146 -0
- package/dist/src/tui/view/settings-panel.js.map +1 -0
- package/dist/src/tui/view/setup-question.js +90 -0
- package/dist/src/tui/view/setup-question.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/brand.js +18 -0
- package/dist/src/tui/view/setup-wizard/brand.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/index.js +1557 -0
- package/dist/src/tui/view/setup-wizard/index.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/opening-menu.js +88 -0
- package/dist/src/tui/view/setup-wizard/opening-menu.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/path-completion.js +53 -0
- package/dist/src/tui/view/setup-wizard/path-completion.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/profile-fields.js +29 -0
- package/dist/src/tui/view/setup-wizard/profile-fields.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/progress.js +42 -0
- package/dist/src/tui/view/setup-wizard/progress.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/providers.js +344 -0
- package/dist/src/tui/view/setup-wizard/providers.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/settings-panel.js +74 -0
- package/dist/src/tui/view/setup-wizard/settings-panel.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/steps.js +544 -0
- package/dist/src/tui/view/setup-wizard/steps.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/types.js +2 -0
- package/dist/src/tui/view/setup-wizard/types.js.map +1 -0
- package/dist/src/tui/view/setup-wizard/use-provider-discovery.js +145 -0
- package/dist/src/tui/view/setup-wizard/use-provider-discovery.js.map +1 -0
- package/dist/src/tui/view/startup-view.js +42 -0
- package/dist/src/tui/view/startup-view.js.map +1 -0
- package/dist/src/tui/view/text-input.js +33 -0
- package/dist/src/tui/view/text-input.js.map +1 -0
- package/dist/src/tui/view/theme-detection.js +45 -0
- package/dist/src/tui/view/theme-detection.js.map +1 -0
- package/dist/src/tui/view/theme.js +127 -0
- package/dist/src/tui/view/theme.js.map +1 -0
- package/dist/src/tui/view/transcript-layout.js +60 -0
- package/dist/src/tui/view/transcript-layout.js.map +1 -0
- package/dist/src/tui/view/transcript-turn.js +135 -0
- package/dist/src/tui/view/transcript-turn.js.map +1 -0
- package/dist/src/tui/view/transcript.js +138 -0
- package/dist/src/tui/view/transcript.js.map +1 -0
- package/dist/src/tui/view/use-party-frame.js +15 -0
- package/dist/src/tui/view/use-party-frame.js.map +1 -0
- package/dist/src/tui/view/use-spinner.js +14 -0
- package/dist/src/tui/view/use-spinner.js.map +1 -0
- package/dist/src/tui/voice/session.js +515 -0
- package/dist/src/tui/voice/session.js.map +1 -0
- package/dist/src/tui/workspace/sandbox.js +156 -0
- package/dist/src/tui/workspace/sandbox.js.map +1 -0
- package/dist/src/tui/workspace/trust.js +147 -0
- package/dist/src/tui/workspace/trust.js.map +1 -0
- package/dist/src/usage.js +187 -0
- package/dist/src/usage.js.map +1 -0
- package/package.json +97 -0
- package/src/tui/voice/sidecar.py +606 -0
package/bin/strands.js
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createHash } from 'node:crypto'
|
|
4
|
+
import {
|
|
5
|
+
closeSync,
|
|
6
|
+
existsSync,
|
|
7
|
+
mkdirSync,
|
|
8
|
+
openSync,
|
|
9
|
+
readFileSync,
|
|
10
|
+
realpathSync,
|
|
11
|
+
readdirSync,
|
|
12
|
+
renameSync,
|
|
13
|
+
rmSync,
|
|
14
|
+
statSync,
|
|
15
|
+
unlinkSync,
|
|
16
|
+
writeFileSync,
|
|
17
|
+
writeSync,
|
|
18
|
+
} from 'node:fs'
|
|
19
|
+
import { dirname, join, relative, resolve } from 'node:path'
|
|
20
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
21
|
+
import { spawnSync } from 'node:child_process'
|
|
22
|
+
|
|
23
|
+
const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
24
|
+
const BUILD_INPUT_DIRECTORIES = ['strands-cli/src', 'harness-ts/src', 'harness-py/src']
|
|
25
|
+
const BUILD_INPUT_FILES = [
|
|
26
|
+
'package.json',
|
|
27
|
+
'package-lock.json',
|
|
28
|
+
'strands-cli/package.json',
|
|
29
|
+
'strands-cli/scripts/bundle-python.js',
|
|
30
|
+
'strands-cli/tsconfig.base.json',
|
|
31
|
+
'strands-cli/src/tsconfig.json',
|
|
32
|
+
'harness-ts/package.json',
|
|
33
|
+
'harness-ts/tsconfig.base.json',
|
|
34
|
+
'harness-ts/src/tsconfig.json',
|
|
35
|
+
'harness-py/pyproject.toml',
|
|
36
|
+
'harness-py/README.md',
|
|
37
|
+
'harness-py/LICENSE',
|
|
38
|
+
'harness-py/NOTICE',
|
|
39
|
+
]
|
|
40
|
+
const BUILD_LOCK_TIMEOUT_MS = 120_000
|
|
41
|
+
const BUILD_LOCK_STALE_MS = 300_000
|
|
42
|
+
|
|
43
|
+
export function isSourceCheckout(packageRoot = PACKAGE_ROOT) {
|
|
44
|
+
return (
|
|
45
|
+
existsSync(join(packageRoot, 'src', 'main.ts')) &&
|
|
46
|
+
existsSync(join(packageRoot, '..', 'harness-ts', 'src', 'index.ts'))
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function sourceBuildFingerprint(repositoryRoot) {
|
|
51
|
+
const hash = createHash('sha256')
|
|
52
|
+
const paths = []
|
|
53
|
+
|
|
54
|
+
for (const directory of BUILD_INPUT_DIRECTORIES) {
|
|
55
|
+
collectFiles(join(repositoryRoot, directory), paths)
|
|
56
|
+
}
|
|
57
|
+
for (const file of BUILD_INPUT_FILES) {
|
|
58
|
+
const path = join(repositoryRoot, file)
|
|
59
|
+
if (existsSync(path)) {
|
|
60
|
+
paths.push(path)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
paths.sort((left, right) => left.localeCompare(right))
|
|
65
|
+
for (const path of paths) {
|
|
66
|
+
hash.update(relative(repositoryRoot, path))
|
|
67
|
+
hash.update('\0')
|
|
68
|
+
hash.update(readFileSync(path))
|
|
69
|
+
hash.update('\0')
|
|
70
|
+
}
|
|
71
|
+
return hash.digest('hex')
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function sourceBuildRequired(repositoryRoot, stateFile, fingerprint) {
|
|
75
|
+
try {
|
|
76
|
+
const state = JSON.parse(readFileSync(stateFile, 'utf8'))
|
|
77
|
+
return (
|
|
78
|
+
state.fingerprint !== fingerprint ||
|
|
79
|
+
!state.outputs.length ||
|
|
80
|
+
state.outputs.some((path) => !existsSync(join(repositoryRoot, path)))
|
|
81
|
+
)
|
|
82
|
+
} catch {
|
|
83
|
+
return true
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export async function ensureSourceBuild(packageRoot = PACKAGE_ROOT) {
|
|
88
|
+
if (!isSourceCheckout(packageRoot)) {
|
|
89
|
+
return false
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const repositoryRoot = resolve(packageRoot, '..')
|
|
93
|
+
const entrypoint = join(packageRoot, 'dist', 'src', 'main.js')
|
|
94
|
+
const stateDirectory = join(repositoryRoot, 'node_modules', '.cache', 'strands-cli')
|
|
95
|
+
const stateFile = join(stateDirectory, 'source-build.json')
|
|
96
|
+
const lockFile = join(stateDirectory, 'source-build.lock')
|
|
97
|
+
mkdirSync(stateDirectory, { recursive: true })
|
|
98
|
+
|
|
99
|
+
let fingerprint = sourceBuildFingerprint(repositoryRoot)
|
|
100
|
+
if (!sourceBuildRequired(repositoryRoot, stateFile, fingerprint)) {
|
|
101
|
+
return false
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const lock = await acquireBuildLock(lockFile)
|
|
105
|
+
try {
|
|
106
|
+
fingerprint = sourceBuildFingerprint(repositoryRoot)
|
|
107
|
+
if (!sourceBuildRequired(repositoryRoot, stateFile, fingerprint)) {
|
|
108
|
+
return false
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
112
|
+
rmSync(join(repositoryRoot, 'harness-ts', 'dist'), { recursive: true, force: true })
|
|
113
|
+
rmSync(join(repositoryRoot, 'strands-cli', 'dist'), { recursive: true, force: true })
|
|
114
|
+
runSourceBuild(repositoryRoot)
|
|
115
|
+
|
|
116
|
+
const completedFingerprint = sourceBuildFingerprint(repositoryRoot)
|
|
117
|
+
if (completedFingerprint === fingerprint) {
|
|
118
|
+
if (!existsSync(entrypoint)) {
|
|
119
|
+
throw new Error(`Build completed without creating ${entrypoint}.`)
|
|
120
|
+
}
|
|
121
|
+
const paths = []
|
|
122
|
+
for (const directory of ['harness-ts/dist', 'strands-cli/dist']) {
|
|
123
|
+
collectFiles(join(repositoryRoot, directory), paths)
|
|
124
|
+
}
|
|
125
|
+
const outputs = paths.map((path) => relative(repositoryRoot, path))
|
|
126
|
+
const temporary = `${stateFile}.${process.pid}.tmp`
|
|
127
|
+
writeFileSync(temporary, `${JSON.stringify({ fingerprint: completedFingerprint, outputs })}\n`)
|
|
128
|
+
renameSync(temporary, stateFile)
|
|
129
|
+
return true
|
|
130
|
+
}
|
|
131
|
+
fingerprint = completedFingerprint
|
|
132
|
+
}
|
|
133
|
+
throw new Error('The source checkout changed while it was being built. Run `strands` again.')
|
|
134
|
+
} finally {
|
|
135
|
+
releaseBuildLock(lockFile, lock)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export async function launch(packageRoot = PACKAGE_ROOT) {
|
|
140
|
+
await ensureSourceBuild(packageRoot)
|
|
141
|
+
const entrypoint = join(packageRoot, 'dist', 'src', 'main.js')
|
|
142
|
+
if (!existsSync(entrypoint)) {
|
|
143
|
+
throw new Error(`The CLI is not built. From the repository root, run: npm run setup`)
|
|
144
|
+
}
|
|
145
|
+
await import(pathToFileURL(entrypoint).href)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function collectFiles(directory, paths) {
|
|
149
|
+
if (!existsSync(directory)) {
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
153
|
+
if (entry.name === '__pycache__') {
|
|
154
|
+
continue
|
|
155
|
+
}
|
|
156
|
+
const path = join(directory, entry.name)
|
|
157
|
+
if (entry.isDirectory()) {
|
|
158
|
+
collectFiles(path, paths)
|
|
159
|
+
} else if (entry.isFile()) {
|
|
160
|
+
paths.push(path)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function runSourceBuild(repositoryRoot) {
|
|
166
|
+
const windows = process.platform === 'win32'
|
|
167
|
+
const command = windows ? (process.env.ComSpec ?? 'cmd.exe') : 'npm'
|
|
168
|
+
const args = windows ? ['/d', '/s', '/c', 'npm run build'] : ['run', 'build']
|
|
169
|
+
const result = spawnSync(command, args, {
|
|
170
|
+
cwd: repositoryRoot,
|
|
171
|
+
encoding: 'utf8',
|
|
172
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
173
|
+
})
|
|
174
|
+
if (result.status === 0) {
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const output = [result.stdout, result.stderr].filter(Boolean).join('\n').trim()
|
|
179
|
+
const detail = output ? `\n\n${output}` : result.error ? `\n\n${result.error.message}` : ''
|
|
180
|
+
throw new Error(`Unable to build the CLI from this checkout.${detail}\n\nRun npm run setup and try again.`)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async function acquireBuildLock(lockFile) {
|
|
184
|
+
const deadline = Date.now() + BUILD_LOCK_TIMEOUT_MS
|
|
185
|
+
for (;;) {
|
|
186
|
+
try {
|
|
187
|
+
const descriptor = openSync(lockFile, 'wx')
|
|
188
|
+
writeSync(descriptor, `${process.pid}\n`)
|
|
189
|
+
return descriptor
|
|
190
|
+
} catch (error) {
|
|
191
|
+
if (error?.code !== 'EEXIST') {
|
|
192
|
+
throw error
|
|
193
|
+
}
|
|
194
|
+
if (lockIsStale(lockFile)) {
|
|
195
|
+
try {
|
|
196
|
+
unlinkSync(lockFile)
|
|
197
|
+
} catch (unlinkError) {
|
|
198
|
+
if (unlinkError?.code !== 'ENOENT') {
|
|
199
|
+
throw unlinkError
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
continue
|
|
203
|
+
}
|
|
204
|
+
if (Date.now() >= deadline) {
|
|
205
|
+
throw new Error('Timed out waiting for another source build to finish.', { cause: error })
|
|
206
|
+
}
|
|
207
|
+
await new Promise((resolveDelay) => setTimeout(resolveDelay, 100))
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function lockIsStale(lockFile) {
|
|
213
|
+
try {
|
|
214
|
+
const owner = Number(readFileSync(lockFile, 'utf8').trim())
|
|
215
|
+
if (Number.isSafeInteger(owner) && owner > 0) {
|
|
216
|
+
try {
|
|
217
|
+
process.kill(owner, 0)
|
|
218
|
+
return false
|
|
219
|
+
} catch (error) {
|
|
220
|
+
return error?.code === 'ESRCH'
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return Date.now() - statSync(lockFile).mtimeMs > BUILD_LOCK_STALE_MS
|
|
224
|
+
} catch {
|
|
225
|
+
return false
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function releaseBuildLock(lockFile, descriptor) {
|
|
230
|
+
closeSync(descriptor)
|
|
231
|
+
try {
|
|
232
|
+
unlinkSync(lockFile)
|
|
233
|
+
} catch (error) {
|
|
234
|
+
if (error?.code !== 'ENOENT') {
|
|
235
|
+
throw error
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function isMainModule() {
|
|
241
|
+
if (!process.argv[1]) {
|
|
242
|
+
return false
|
|
243
|
+
}
|
|
244
|
+
try {
|
|
245
|
+
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))
|
|
246
|
+
} catch {
|
|
247
|
+
return false
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (isMainModule()) {
|
|
252
|
+
launch().catch((error) => {
|
|
253
|
+
process.stderr.write(`error: ${error instanceof Error ? error.message : String(error)}\n`)
|
|
254
|
+
process.exitCode = 1
|
|
255
|
+
})
|
|
256
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { DEFAULT_HARNESS_AGENT_CONFIG } from '@strands-agents/harness';
|
|
3
|
+
import { EFFORT_LEVELS, normalizeHarnessAgentConfig } from '@strands-agents/harness/internal';
|
|
4
|
+
import { readCliVersion } from '../tui/package-version.js';
|
|
5
|
+
const DIRECT_CONFIG_FLAGS = ['name', 'description', 'effort', 'instructions', 'interventions'];
|
|
6
|
+
export function parseArgs(argv) {
|
|
7
|
+
const collect = (value, previous) => [...previous, value];
|
|
8
|
+
const program = new Command();
|
|
9
|
+
program
|
|
10
|
+
.name('strands')
|
|
11
|
+
.description('Chat with a Strands harness agent.')
|
|
12
|
+
.version(readCliVersion())
|
|
13
|
+
.argument('[request]', 'an initial request to answer')
|
|
14
|
+
.option('-p, --print', 'answer the request and exit, without entering the chat loop')
|
|
15
|
+
.option('--prompt <text>', 'initial request (equivalent to the positional request)')
|
|
16
|
+
.option('--acp-server', 'serve the agent over ACP on stdin/stdout')
|
|
17
|
+
.option('--setup', 'open the interactive provider and agent setup wizard')
|
|
18
|
+
.option('--agent <path>', 'load an agent project ZIP, folder, or agent.ts/agent.py')
|
|
19
|
+
.option('--set <field=value>', 'override any portable agent config field (repeatable)', collect, [])
|
|
20
|
+
.option('--env-file <path>', 'load an explicitly trusted env file (repeatable)', collect, [])
|
|
21
|
+
.option('--name <name>', 'agent name')
|
|
22
|
+
.option('--description <text>', 'agent description')
|
|
23
|
+
.option('--model <model>', 'provider/model string, or a bare Bedrock model id')
|
|
24
|
+
.option('--effort <level>', `reasoning effort: ${EFFORT_LEVELS.join(', ')}`)
|
|
25
|
+
.option('--instructions <text>', 'domain instructions appended to the system prompt')
|
|
26
|
+
.option('--builtin-tools <tools>', "comma-separated built-in tools, or '' for none")
|
|
27
|
+
.option('--builtin-plugins <plugins>', "comma-separated built-in plugins, or '' for none")
|
|
28
|
+
.option('--caching <mode>', "prompt caching: 'auto' (on) or 'off'")
|
|
29
|
+
.option('--context-manager <mode>', "context management: 'auto', 'agentic', or 'off'")
|
|
30
|
+
.option('--session <mode>', "conversation persistence: 'on' or 'off'")
|
|
31
|
+
.option('--session-id <id>', 'persist and resume this conversation by id')
|
|
32
|
+
.option('--skills <dirs>', "comma-separated directories to load skills from, or 'off' to disable")
|
|
33
|
+
.option('--memory <mode>', "long-term memory: 'on' or 'off'")
|
|
34
|
+
.option('--interventions <policy>', "gate tool calls: 'ask', 'smart', a .cedar file path, or a natural-language rule")
|
|
35
|
+
.option('--mcp-config <path>', 'additional MCP configuration file (repeatable)', collect, [])
|
|
36
|
+
.allowExcessArguments(false)
|
|
37
|
+
.exitOverride();
|
|
38
|
+
program.parse(argv, { from: 'user' });
|
|
39
|
+
const opts = program.opts();
|
|
40
|
+
if (opts.prompt !== undefined && program.args[0] !== undefined) {
|
|
41
|
+
program.error('error: pass the initial request either positionally or with --prompt, not both.');
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
request: opts.prompt ?? program.args[0],
|
|
45
|
+
oneShot: Boolean(opts.print),
|
|
46
|
+
acpServer: Boolean(opts.acpServer),
|
|
47
|
+
setup: Boolean(opts.setup),
|
|
48
|
+
agent: opts.agent,
|
|
49
|
+
configSet: opts.set,
|
|
50
|
+
envFiles: opts.envFile,
|
|
51
|
+
name: opts.name,
|
|
52
|
+
description: opts.description,
|
|
53
|
+
model: opts.model,
|
|
54
|
+
effort: opts.effort,
|
|
55
|
+
instructions: opts.instructions,
|
|
56
|
+
builtinTools: opts.builtinTools,
|
|
57
|
+
builtinPlugins: opts.builtinPlugins,
|
|
58
|
+
caching: opts.caching,
|
|
59
|
+
contextManager: opts.contextManager,
|
|
60
|
+
session: opts.session,
|
|
61
|
+
sessionId: opts.sessionId,
|
|
62
|
+
skills: opts.skills,
|
|
63
|
+
memory: opts.memory,
|
|
64
|
+
interventions: opts.interventions,
|
|
65
|
+
mcpConfig: opts.mcpConfig,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Apply arbitrary portable config values, followed by the dedicated CLI flag shorthands. */
|
|
69
|
+
export function agentConfig(args, defaults) {
|
|
70
|
+
const config = globalThis.structuredClone(defaults);
|
|
71
|
+
for (const assignment of args.configSet) {
|
|
72
|
+
applyConfigAssignment(config, assignment);
|
|
73
|
+
}
|
|
74
|
+
for (const key of DIRECT_CONFIG_FLAGS) {
|
|
75
|
+
if (args[key] !== undefined) {
|
|
76
|
+
config[key] = args[key];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (args.model !== undefined) {
|
|
80
|
+
config.model = modelSpecifier(args.model, '--model');
|
|
81
|
+
}
|
|
82
|
+
if (args.builtinTools !== undefined) {
|
|
83
|
+
config.builtinTools = commaSeparated(args.builtinTools);
|
|
84
|
+
}
|
|
85
|
+
if (args.builtinPlugins !== undefined) {
|
|
86
|
+
config.builtinPlugins = commaSeparated(args.builtinPlugins);
|
|
87
|
+
}
|
|
88
|
+
if (args.caching !== undefined) {
|
|
89
|
+
config.caching = args.caching !== 'off';
|
|
90
|
+
}
|
|
91
|
+
if (args.contextManager !== undefined) {
|
|
92
|
+
config.contextManager = args.contextManager === 'off' ? false : args.contextManager;
|
|
93
|
+
}
|
|
94
|
+
// `on` keeps an object form already present (a saved `dir`, a `--set` sub-key) rather than flattening it.
|
|
95
|
+
for (const key of ['session', 'memory']) {
|
|
96
|
+
if (args[key] === undefined)
|
|
97
|
+
continue;
|
|
98
|
+
if (args[key] === 'off') {
|
|
99
|
+
config[key] = false;
|
|
100
|
+
}
|
|
101
|
+
else if (args[key] === 'on') {
|
|
102
|
+
config[key] ||= true;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
throw new Error(`--${key} must be 'on' or 'off'.`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// `--session off` (or a disabled saved profile) wins over the id.
|
|
109
|
+
if (args.sessionId !== undefined && config.session !== false) {
|
|
110
|
+
const session = config.session;
|
|
111
|
+
config.session = { ...(typeof session === 'object' && session !== null ? session : {}), id: args.sessionId };
|
|
112
|
+
}
|
|
113
|
+
if (args.skills !== undefined) {
|
|
114
|
+
config.skills = args.skills === 'off' ? false : commaSeparated(args.skills);
|
|
115
|
+
}
|
|
116
|
+
return normalizeHarnessAgentConfig(config);
|
|
117
|
+
}
|
|
118
|
+
export function projectConfigOverrides(args) {
|
|
119
|
+
const fields = new Set(args.configSet.map((assignment) => assignment.split('=')[0].split('.')[0]));
|
|
120
|
+
for (const key of [
|
|
121
|
+
...DIRECT_CONFIG_FLAGS,
|
|
122
|
+
'model',
|
|
123
|
+
'builtinTools',
|
|
124
|
+
'builtinPlugins',
|
|
125
|
+
'caching',
|
|
126
|
+
'contextManager',
|
|
127
|
+
'session',
|
|
128
|
+
'skills',
|
|
129
|
+
'memory',
|
|
130
|
+
]) {
|
|
131
|
+
if (args[key] !== undefined)
|
|
132
|
+
fields.add(key);
|
|
133
|
+
}
|
|
134
|
+
if (args.sessionId !== undefined)
|
|
135
|
+
fields.add('session');
|
|
136
|
+
const config = agentConfig(args, DEFAULT_HARNESS_AGENT_CONFIG);
|
|
137
|
+
return Object.fromEntries(Object.entries(config).filter(([key]) => fields.has(key)));
|
|
138
|
+
}
|
|
139
|
+
export function shouldPersistModelChanges(args) {
|
|
140
|
+
const assignedFields = args.configSet.map((assignment) => assignment.slice(0, assignment.indexOf('=')));
|
|
141
|
+
return (!args.agent &&
|
|
142
|
+
args.model === undefined &&
|
|
143
|
+
args.effort === undefined &&
|
|
144
|
+
!assignedFields.some((field) => field === 'model' || field === 'effort'));
|
|
145
|
+
}
|
|
146
|
+
function applyConfigAssignment(config, assignment) {
|
|
147
|
+
const separator = assignment.indexOf('=');
|
|
148
|
+
if (separator <= 0) {
|
|
149
|
+
throw new Error(`--set expects field=value; received ${JSON.stringify(assignment)}.`);
|
|
150
|
+
}
|
|
151
|
+
const path = assignment.slice(0, separator);
|
|
152
|
+
const keys = path.split('.');
|
|
153
|
+
if (keys.some((key) => !/^[A-Za-z_][A-Za-z0-9_-]*$/u.test(key) || key === '__proto__' || key === 'prototype' || key === 'constructor')) {
|
|
154
|
+
throw new Error(`--set contains an invalid config field ${JSON.stringify(path)}.`);
|
|
155
|
+
}
|
|
156
|
+
if (!(keys[0] in DEFAULT_HARNESS_AGENT_CONFIG)) {
|
|
157
|
+
throw new Error(`--set contains an unknown agent config field ${JSON.stringify(keys[0])}.`);
|
|
158
|
+
}
|
|
159
|
+
let target = config;
|
|
160
|
+
for (const key of keys.slice(0, -1)) {
|
|
161
|
+
const value = target[key];
|
|
162
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
163
|
+
target[key] = {};
|
|
164
|
+
}
|
|
165
|
+
target = target[key];
|
|
166
|
+
}
|
|
167
|
+
const raw = assignment.slice(separator + 1);
|
|
168
|
+
try {
|
|
169
|
+
target[keys.at(-1)] = JSON.parse(raw);
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
target[keys.at(-1)] = raw;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function commaSeparated(value) {
|
|
176
|
+
return value.split(',').filter(Boolean);
|
|
177
|
+
}
|
|
178
|
+
function modelSpecifier(value, option) {
|
|
179
|
+
const trimmed = value.trim();
|
|
180
|
+
if (!trimmed) {
|
|
181
|
+
throw new Error(`${option} requires a model ID.`);
|
|
182
|
+
}
|
|
183
|
+
const separator = trimmed.indexOf('/');
|
|
184
|
+
if (separator === -1) {
|
|
185
|
+
return trimmed;
|
|
186
|
+
}
|
|
187
|
+
const provider = trimmed.slice(0, separator);
|
|
188
|
+
const model = trimmed.slice(separator + 1);
|
|
189
|
+
if (!/^[a-z][a-z0-9_-]*$/i.test(provider)) {
|
|
190
|
+
return trimmed;
|
|
191
|
+
}
|
|
192
|
+
const providers = ['bedrock', 'bedrock-mantle', 'anthropic', 'openai', 'google', 'ollama', 'litellm'];
|
|
193
|
+
if (!providers.includes(provider) || !model) {
|
|
194
|
+
throw new Error(`${option} must use a supported provider/model string: ${providers.slice(0, -1).join(', ')}, or ${providers.at(-1)}.`);
|
|
195
|
+
}
|
|
196
|
+
return trimmed;
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=arguments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arguments.js","sourceRoot":"","sources":["../../../src/cli/arguments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,4BAA4B,EAA2B,MAAM,yBAAyB,CAAA;AAC/F,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AAE7F,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AA6B1D,MA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C,GAAG,CAAC,CAAA;IACtC,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;QACrB,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;IAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAA;IAC1C,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;IACrG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,gDAAgD,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CACtH,CAAA;IACH,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { DEFAULT_HARNESS_AGENT_CONFIG, harnessAgentOptionsFromConfig, } from '@strands-agents/harness';
|
|
4
|
+
import { AgentSkills } from '@strands-agents/sdk/vended-plugins/skills';
|
|
5
|
+
import { agentConfig, projectConfigOverrides } from './arguments.js';
|
|
6
|
+
import { restoreSessionAgentDefinition } from '../tui/session/agent-definition.js';
|
|
7
|
+
import { importAgentProject } from '../tui/project/import.js';
|
|
8
|
+
import { requireBedrockRegion } from '../tui/provider/aws-config.js';
|
|
9
|
+
export async function invocationAgentForRun(args, config, cwd = process.cwd(), project, restoreDefinition = false) {
|
|
10
|
+
const snapshot = config.snapshot();
|
|
11
|
+
const projectPath = args.agent ?? snapshot.agentProject;
|
|
12
|
+
if (projectPath) {
|
|
13
|
+
project ??= importAgentProject(projectPath);
|
|
14
|
+
if (args.agent)
|
|
15
|
+
args.agent = project.entrypoint;
|
|
16
|
+
if (project.language !== 'typescript') {
|
|
17
|
+
throw new Error('Python agents must run with the Python runtime.');
|
|
18
|
+
}
|
|
19
|
+
const { loadTypescriptProject } = await import('../tui/project/typescript.js');
|
|
20
|
+
const authored = await loadTypescriptProject(project, () => config.applyProviderEnvironment());
|
|
21
|
+
const options = {
|
|
22
|
+
...authored.options,
|
|
23
|
+
...(await projectOverrides(args, cwd, authored.options)),
|
|
24
|
+
printer: false,
|
|
25
|
+
};
|
|
26
|
+
requireBedrockRegion(options.model);
|
|
27
|
+
return {
|
|
28
|
+
options,
|
|
29
|
+
buildAgent: authored.createAgent,
|
|
30
|
+
project,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const baseDir = snapshot.profileBaseDir ?? cwd;
|
|
34
|
+
const profile = agentConfig(args, snapshot.profile);
|
|
35
|
+
config.applyProviderEnvironment();
|
|
36
|
+
requireBedrockRegion(profile.model);
|
|
37
|
+
const options = {
|
|
38
|
+
...(await harnessAgentOptionsFromConfig(profile, baseDir)),
|
|
39
|
+
printer: false,
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
profile,
|
|
43
|
+
options: restoreDefinition ? await restoreSessionAgentDefinition(options, cwd) : options,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
async function projectOverrides(args, root, authored) {
|
|
47
|
+
const fields = new Set(Object.keys(projectConfigOverrides(args)));
|
|
48
|
+
const base = { ...DEFAULT_HARNESS_AGENT_CONFIG };
|
|
49
|
+
for (const assignment of args.configSet) {
|
|
50
|
+
const path = assignment.slice(0, assignment.indexOf('=')).split('.');
|
|
51
|
+
const field = path[0];
|
|
52
|
+
const option = field === 'agentConfig' ? path[1] : field;
|
|
53
|
+
if (path.length > (field === 'agentConfig' ? 2 : 1) &&
|
|
54
|
+
option &&
|
|
55
|
+
option in authored &&
|
|
56
|
+
field !== 'agentConfigModules') {
|
|
57
|
+
let value = authored[option];
|
|
58
|
+
if (field === 'mcpServers' && typeof value === 'string') {
|
|
59
|
+
const document = JSON.parse(await readFile(resolve(root, value), 'utf8'));
|
|
60
|
+
value = document.mcpServers ?? document;
|
|
61
|
+
}
|
|
62
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
63
|
+
if (field === 'agentConfig') {
|
|
64
|
+
base.agentConfig = { ...base.agentConfig, [option]: globalThis.structuredClone(value) };
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
Object.assign(base, { [field]: globalThis.structuredClone(value) });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const config = agentConfig(args, base);
|
|
73
|
+
const options = await harnessAgentOptionsFromConfig(config, root);
|
|
74
|
+
for (const key of ['builtinTools', 'builtinPlugins', 'caching', 'description', 'instructions']) {
|
|
75
|
+
if (fields.has(key))
|
|
76
|
+
Object.assign(options, { [key]: config[key] });
|
|
77
|
+
}
|
|
78
|
+
const aliases = {
|
|
79
|
+
subagents: 'tools',
|
|
80
|
+
modelModule: 'model',
|
|
81
|
+
memoryStores: 'memory',
|
|
82
|
+
interventionModules: 'interventions',
|
|
83
|
+
};
|
|
84
|
+
const keys = new Set([...fields].map((field) => aliases[field] ?? field));
|
|
85
|
+
keys.delete('dependencies');
|
|
86
|
+
keys.delete('agentConfig');
|
|
87
|
+
keys.delete('agentConfigModules');
|
|
88
|
+
if (fields.has('agentConfig')) {
|
|
89
|
+
for (const key of Object.keys(config.agentConfig))
|
|
90
|
+
keys.add(key);
|
|
91
|
+
}
|
|
92
|
+
if (fields.has('agentConfigModules')) {
|
|
93
|
+
for (const key of Object.keys(config.agentConfigModules))
|
|
94
|
+
keys.add(key);
|
|
95
|
+
}
|
|
96
|
+
return Object.fromEntries([...keys].map((key) => [key, options[key]]));
|
|
97
|
+
}
|
|
98
|
+
export async function pythonInvocationOptions(args, cwd, settings, mcp) {
|
|
99
|
+
const [{ readMcpDefinitions }, { resolveSkillPaths }] = await Promise.all([
|
|
100
|
+
import('../tui/mcp.js'),
|
|
101
|
+
import('../tui/skills.js'),
|
|
102
|
+
]);
|
|
103
|
+
const { definitions } = await readMcpDefinitions({
|
|
104
|
+
cwd,
|
|
105
|
+
paths: mcp.paths,
|
|
106
|
+
strictPaths: mcp.strictPaths,
|
|
107
|
+
...(mcp.expectedDigests ? { expectedDigests: mcp.expectedDigests } : {}),
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
cwd,
|
|
111
|
+
overrides: projectConfigOverrides(args),
|
|
112
|
+
assignments: args.configSet,
|
|
113
|
+
mcpServers: definitions,
|
|
114
|
+
skillPaths: resolveSkillPaths(undefined, cwd, settings.skillDiscovery),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export async function withDiscoveredSkills(options, discovery) {
|
|
118
|
+
const cwd = process.cwd();
|
|
119
|
+
const { resolveSkillPaths } = await import('../tui/skills.js');
|
|
120
|
+
const skills = options.skills instanceof AgentSkills ? undefined : options.skills;
|
|
121
|
+
const skillPaths = resolveSkillPaths(skills, cwd, discovery);
|
|
122
|
+
return { ...options, skills: skillPaths.length > 0 ? skillPaths : false };
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=invocation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation.js","sourceRoot":"","sources":["../../../src/cli/invocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,GAG9B,MAAM,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