@11agents/cli 0.1.17 → 0.1.18
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/package.json +1 -1
- package/src/commands/runtime.js +37 -5
package/package.json
CHANGED
package/src/commands/runtime.js
CHANGED
|
@@ -772,7 +772,15 @@ async function materializeSkillsIfChanged({ task, workdir, flags, deps }) {
|
|
|
772
772
|
const statePath = path.join(skillsDir, 'skills-state.json')
|
|
773
773
|
const nextHash = stableHash(skills)
|
|
774
774
|
const current = await readJsonFile(statePath, {})
|
|
775
|
-
if (current.hash === nextHash)
|
|
775
|
+
if (current.hash === nextHash) {
|
|
776
|
+
const allExist = (await Promise.all(
|
|
777
|
+
skills.map(skill =>
|
|
778
|
+
readFile(path.join(skillsDir, slugify(skill.name, 'skill'), 'SKILL.md'), 'utf8')
|
|
779
|
+
.then(() => true).catch(() => false)
|
|
780
|
+
)
|
|
781
|
+
)).every(Boolean)
|
|
782
|
+
if (allExist) return { changed: false, count: skills.length }
|
|
783
|
+
}
|
|
776
784
|
|
|
777
785
|
await mkdir(skillsDir, { recursive: true })
|
|
778
786
|
for (const skill of skills) {
|
|
@@ -886,10 +894,16 @@ function agentEnvironment(task) {
|
|
|
886
894
|
|
|
887
895
|
async function prepareRuntimeTask(task, flags, deps, config) {
|
|
888
896
|
const workdir = flag(flags, 'codex-workdir') || projectDirForTask(task, flags, deps)
|
|
889
|
-
const
|
|
897
|
+
const agentDir = path.join(workdir, 'agents', slugify(agentNameForTask(task), 'agent'))
|
|
898
|
+
const agentSkillsDir = path.join(agentDir, 'skills')
|
|
899
|
+
const agentMemoryDir = path.join(agentDir, 'memory')
|
|
900
|
+
const agentResultsDir = path.join(agentDir, 'results')
|
|
901
|
+
const tmpDir = path.join(agentDir, 'tmp', sanitizeTaskId(task.id))
|
|
890
902
|
const runDir = path.join(workdir, 'runs', sanitizeTaskId(task.id))
|
|
891
903
|
await mkdir(tmpDir, { recursive: true })
|
|
892
904
|
await mkdir(runDir, { recursive: true })
|
|
905
|
+
await mkdir(agentResultsDir, { recursive: true })
|
|
906
|
+
await mkdir(agentMemoryDir, { recursive: true })
|
|
893
907
|
|
|
894
908
|
const database = await syncDatabaseIfNeeded({ task, workdir, config, flags, deps })
|
|
895
909
|
const skills = await materializeSkillsIfChanged({ task, workdir, flags, deps })
|
|
@@ -901,6 +915,10 @@ async function prepareRuntimeTask(task, flags, deps, config) {
|
|
|
901
915
|
...process.env,
|
|
902
916
|
...agentEnvironment(task),
|
|
903
917
|
ELEVENAGENTS_PROJECT_DIR: workdir,
|
|
918
|
+
ELEVENAGENTS_AGENT_DIR: agentDir,
|
|
919
|
+
ELEVENAGENTS_AGENT_SKILLS_DIR: agentSkillsDir,
|
|
920
|
+
ELEVENAGENTS_AGENT_MEMORY_DIR: agentMemoryDir,
|
|
921
|
+
ELEVENAGENTS_AGENT_RESULTS_DIR: agentResultsDir,
|
|
904
922
|
ELEVENAGENTS_TASK_TMP: tmpDir,
|
|
905
923
|
ELEVENAGENTS_TASK_ID: String(task.id || ''),
|
|
906
924
|
...(projectToken ? { GTM_SWARM_TOKEN: projectToken } : {}),
|
|
@@ -908,6 +926,10 @@ async function prepareRuntimeTask(task, flags, deps, config) {
|
|
|
908
926
|
|
|
909
927
|
return {
|
|
910
928
|
workdir,
|
|
929
|
+
agent_dir: agentDir,
|
|
930
|
+
agent_skills_dir: agentSkillsDir,
|
|
931
|
+
agent_memory_dir: agentMemoryDir,
|
|
932
|
+
agent_results_dir: agentResultsDir,
|
|
911
933
|
tmp_dir: tmpDir,
|
|
912
934
|
run_dir: runDir,
|
|
913
935
|
project_slug: projectSlugForTask(task, flags),
|
|
@@ -926,13 +948,23 @@ function buildCodexPrompt(task) {
|
|
|
926
948
|
'Execution workspace:',
|
|
927
949
|
compactJson({
|
|
928
950
|
workdir: task.execution_context?.workdir,
|
|
951
|
+
agent_skills_dir: task.execution_context?.agent_skills_dir,
|
|
952
|
+
agent_memory_dir: task.execution_context?.agent_memory_dir,
|
|
953
|
+
agent_results_dir: task.execution_context?.agent_results_dir,
|
|
929
954
|
tmp_dir: task.execution_context?.tmp_dir,
|
|
930
955
|
project_slug: task.execution_context?.project_slug,
|
|
931
|
-
knowledge_base: './knowledge_base
|
|
932
|
-
rule: 'Treat the project directory as read-only project context except ./knowledge_base/ for durable project knowledge updates and ./tmp/<taskId>/ for temporary scratch files.',
|
|
933
|
-
cleanup: 'Temporary files under ./tmp/<taskId>/ are removed by the CLI after the task finishes.',
|
|
956
|
+
knowledge_base: task.execution_context?.workdir ? path.join(task.execution_context.workdir, 'knowledge_base') : './knowledge_base',
|
|
934
957
|
}),
|
|
935
958
|
'',
|
|
959
|
+
'Directory rules — follow strictly:',
|
|
960
|
+
'1. agent_skills_dir: BEFORE starting work, list files here to see which skills are installed.',
|
|
961
|
+
' Each skill is a subdirectory with a SKILL.md. If a skill you need is present, read its SKILL.md and follow it.',
|
|
962
|
+
'2. agent_results_dir: Write all final deliverables and task outputs here (generated content, reports, files).',
|
|
963
|
+
'3. agent_memory_dir: After completing work, record key decisions, facts, and learned context here.',
|
|
964
|
+
' Append to index.qmd or create new .qmd files. This memory persists across future task runs.',
|
|
965
|
+
'4. tmp_dir: Scratch/working files only. This directory is deleted by the CLI after the task finishes — do NOT put deliverables here.',
|
|
966
|
+
'5. workdir: Treat as read-only project context except for the four agent directories and knowledge_base above.',
|
|
967
|
+
'',
|
|
936
968
|
'Task context:',
|
|
937
969
|
compactJson({
|
|
938
970
|
queue_event: task.queue_event,
|