@farmslot/agent-runtime 0.23.3 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/native/host-cleanup-recovery.d.ts.map +1 -1
- package/dist/native/host-cleanup-recovery.js +15 -3
- package/dist/native/host-cleanup-recovery.js.map +1 -1
- package/dist/native/process-tree.d.ts +1 -0
- package/dist/native/process-tree.d.ts.map +1 -1
- package/dist/native/process-tree.js +9 -4
- package/dist/native/process-tree.js.map +1 -1
- package/dist/task-init/execution-provenance.d.ts +47 -0
- package/dist/task-init/execution-provenance.d.ts.map +1 -0
- package/dist/task-init/execution-provenance.js +226 -0
- package/dist/task-init/execution-provenance.js.map +1 -0
- package/dist/task-init/index.d.ts +5 -0
- package/dist/task-init/index.d.ts.map +1 -1
- package/dist/task-init/index.js +25 -4
- package/dist/task-init/index.js.map +1 -1
- package/dist/task-init/pin.d.ts +6 -0
- package/dist/task-init/pin.d.ts.map +1 -0
- package/dist/task-init/pin.js +77 -0
- package/dist/task-init/pin.js.map +1 -0
- package/dist/task-init/runtime-command.d.ts +3 -1
- package/dist/task-init/runtime-command.d.ts.map +1 -1
- package/dist/task-init/runtime-command.js +7 -2
- package/dist/task-init/runtime-command.js.map +1 -1
- package/dist/task-init/task-document.d.ts +2 -0
- package/dist/task-init/task-document.d.ts.map +1 -1
- package/dist/task-init/task-document.js +12 -0
- package/dist/task-init/task-document.js.map +1 -1
- package/dist/task-init/write.d.ts +4 -2
- package/dist/task-init/write.d.ts.map +1 -1
- package/dist/task-init/write.js +7 -5
- package/dist/task-init/write.js.map +1 -1
- package/package.json +4 -4
- package/scripts/mark-checklist-step.cjs +60 -7
- package/scripts/mark-io.cjs +10 -0
- package/scripts/subtask-unit.cjs +5 -3
- package/scripts/task-init-cli.mjs +13 -8
|
@@ -96,10 +96,11 @@ function parseArgs(args) {
|
|
|
96
96
|
return { opts, catalog };
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
function gitOutput(args) {
|
|
99
|
+
function gitOutput(args, cwd = process.cwd()) {
|
|
100
100
|
try {
|
|
101
101
|
return execFileSync('git', args, {
|
|
102
102
|
encoding: 'utf8',
|
|
103
|
+
cwd,
|
|
103
104
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
104
105
|
}).trim();
|
|
105
106
|
} catch {
|
|
@@ -108,21 +109,23 @@ function gitOutput(args) {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
async function
|
|
112
|
-
|
|
112
|
+
export async function taskInitFromArgv(args, execution, suppliedRuntime) {
|
|
113
|
+
args = [...args];
|
|
113
114
|
if (args.length === 0 || args[0] === '-h' || args[0] === '--help') usage(0);
|
|
114
115
|
const { opts, catalog } = parseArgs(args);
|
|
115
|
-
const runtime = await loadRuntime();
|
|
116
|
+
const runtime = suppliedRuntime ?? (await loadRuntime());
|
|
116
117
|
|
|
117
118
|
const description = opts.taskFile
|
|
118
119
|
? readFileSync(path.resolve(opts.taskFile), 'utf8').trim()
|
|
119
120
|
: (opts.taskText ?? '').trim();
|
|
120
|
-
const
|
|
121
|
-
const
|
|
121
|
+
const target = execution?.bindingIdentity?.target ?? process.cwd();
|
|
122
|
+
const toplevel = gitOutput(['rev-parse', '--show-toplevel'], target);
|
|
123
|
+
const originUrl = gitOutput(['remote', 'get-url', 'origin'], target);
|
|
122
124
|
const repo = opts.repo ?? (originUrl ? runtime.portableRepoIdentity(originUrl) : undefined);
|
|
123
125
|
const project =
|
|
124
126
|
opts.project ??
|
|
125
|
-
|
|
127
|
+
execution?.bindingIdentity?.project ??
|
|
128
|
+
(repo ? repo.split('/').pop() : path.basename(toplevel || target)).toLowerCase();
|
|
126
129
|
// Rendered inside taskInit with the same vars as the checklist, so an addendum
|
|
127
130
|
// that works on the farm works here.
|
|
128
131
|
const addendum = opts.addendumFile ? readFileSync(path.resolve(opts.addendumFile), 'utf8') : null;
|
|
@@ -153,6 +156,7 @@ async function main() {
|
|
|
153
156
|
...(opts.modePreamble ? { modePreamble: opts.modePreamble } : {}),
|
|
154
157
|
addendum,
|
|
155
158
|
...(opts.markCommand ? { markCommand: opts.markCommand } : {}),
|
|
159
|
+
...(execution ? { execution } : {}),
|
|
156
160
|
});
|
|
157
161
|
|
|
158
162
|
if (opts.json) {
|
|
@@ -160,10 +164,11 @@ async function main() {
|
|
|
160
164
|
} else {
|
|
161
165
|
process.stdout.write(`Task document: ${result.taskDocument}\nChecklist: ${result.checklist}\n`);
|
|
162
166
|
}
|
|
167
|
+
return result;
|
|
163
168
|
}
|
|
164
169
|
|
|
165
170
|
if (process.argv[1] && pathToFileURL(process.argv[1]).href === import.meta.url) {
|
|
166
|
-
|
|
171
|
+
taskInitFromArgv(process.argv.slice(2)).catch((error) => {
|
|
167
172
|
console.error(error instanceof Error ? error.message : String(error));
|
|
168
173
|
process.exit(1);
|
|
169
174
|
});
|