@liy/agent-runner 0.2.1 → 0.2.4
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/README.md +5 -5
- package/dist/bin/agent-runner.js +49 -32
- package/dist/bin/agent-runner.js.map +3 -3
- package/dist/index.js +49 -32
- package/dist/index.js.map +3 -3
- package/dist/prompt.d.ts +10 -0
- package/dist/prompts/execute-task.md +26 -0
- package/dist/runner.d.ts +1 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -146,8 +146,9 @@ The runner validates:
|
|
|
146
146
|
- configured runner endpoints are HTTP(S) URLs
|
|
147
147
|
- secret-like keys do not appear in the spec
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
specs may include `endpoints.mcpBaseUrl` again when MCP integration
|
|
149
|
+
Provisioned Fly Sprite Pi baselines install the Pi MCP adapter extension.
|
|
150
|
+
Task specs may include `endpoints.mcpBaseUrl` again when MCP integration
|
|
151
|
+
returns to the host-side task contract.
|
|
151
152
|
|
|
152
153
|
## Harness Options
|
|
153
154
|
|
|
@@ -164,7 +165,7 @@ Required fields:
|
|
|
164
165
|
- `driver`: `"pi-rpc"`
|
|
165
166
|
- `command`: executable name or absolute path, usually `"pi"`
|
|
166
167
|
- `provider`: provider passed to Pi, for example `"deepseek"`
|
|
167
|
-
- `
|
|
168
|
+
- `defaultModel`: model passed to Pi when the task spec does not select one, for example `"deepseek-v4-flash"`
|
|
168
169
|
|
|
169
170
|
Optional fields:
|
|
170
171
|
|
|
@@ -179,7 +180,6 @@ The Pi RPC driver owns these flags and rejects duplicates in `args`:
|
|
|
179
180
|
--provider
|
|
180
181
|
--model
|
|
181
182
|
--thinking
|
|
182
|
-
--no-extensions
|
|
183
183
|
--no-prompt-templates
|
|
184
184
|
--no-themes
|
|
185
185
|
```
|
|
@@ -187,7 +187,7 @@ The Pi RPC driver owns these flags and rejects duplicates in `args`:
|
|
|
187
187
|
It currently spawns Pi like:
|
|
188
188
|
|
|
189
189
|
```text
|
|
190
|
-
pi --mode rpc --provider deepseek --model deepseek-v4-flash --thinking high --no-
|
|
190
|
+
pi --mode rpc --provider deepseek --model deepseek-v4-flash --thinking high --no-prompt-templates --no-themes
|
|
191
191
|
```
|
|
192
192
|
|
|
193
193
|
The driver writes one Pi RPC `prompt` command to stdin, parses Pi stdout as
|
package/dist/bin/agent-runner.js
CHANGED
|
@@ -15461,7 +15461,6 @@ var driverOwnedPiFlags = /* @__PURE__ */ new Set([
|
|
|
15461
15461
|
"--provider",
|
|
15462
15462
|
"--model",
|
|
15463
15463
|
"--thinking",
|
|
15464
|
-
"--no-extensions",
|
|
15465
15464
|
"--no-prompt-templates",
|
|
15466
15465
|
"--no-themes"
|
|
15467
15466
|
]);
|
|
@@ -15507,7 +15506,6 @@ function buildPiRpcArgs(harness) {
|
|
|
15507
15506
|
"--thinking",
|
|
15508
15507
|
thinking,
|
|
15509
15508
|
"--no-session",
|
|
15510
|
-
"--no-extensions",
|
|
15511
15509
|
"--no-prompt-templates",
|
|
15512
15510
|
"--no-themes",
|
|
15513
15511
|
...extraArgs
|
|
@@ -15670,6 +15668,9 @@ function validateExtraPiArgs(args) {
|
|
|
15670
15668
|
if (driverOwnedPiFlags.has(flag)) {
|
|
15671
15669
|
throw new Error(`pi-rpc harness args cannot include driver-owned Pi flag: ${flag}`);
|
|
15672
15670
|
}
|
|
15671
|
+
if (flag === "--no-extensions") {
|
|
15672
|
+
throw new Error("pi-rpc harness args cannot disable Pi extensions");
|
|
15673
|
+
}
|
|
15673
15674
|
if (blockedPiFlags.has(flag)) {
|
|
15674
15675
|
throw new Error(`pi-rpc harness args cannot include unsupported Pi flag: ${flag}`);
|
|
15675
15676
|
}
|
|
@@ -15692,6 +15693,52 @@ function formatPiRpcError(parsed, redactText) {
|
|
|
15692
15693
|
return "unknown error";
|
|
15693
15694
|
}
|
|
15694
15695
|
|
|
15696
|
+
// src/prompt.ts
|
|
15697
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
15698
|
+
var harnessPromptTemplateFileName = "execute-task.md";
|
|
15699
|
+
function buildHarnessPrompt(spec) {
|
|
15700
|
+
return renderHarnessPromptTemplate({
|
|
15701
|
+
template: loadDefaultHarnessPromptTemplate(),
|
|
15702
|
+
values: {
|
|
15703
|
+
workspaceDir: spec.workspaceDir,
|
|
15704
|
+
completionFile: `${spec.workspaceDir}/state/completion.json`,
|
|
15705
|
+
artifactRoot: `${spec.workspaceDir}/artifacts`,
|
|
15706
|
+
taskTitle: spec.task.title,
|
|
15707
|
+
taskContext: spec.task.context,
|
|
15708
|
+
intentJson: JSON.stringify(spec.intent, null, 2),
|
|
15709
|
+
userQueryJson: JSON.stringify(spec.userQuery, null, 2),
|
|
15710
|
+
approvedToolsJson: JSON.stringify(spec.toolProvisioning.tools, null, 2)
|
|
15711
|
+
}
|
|
15712
|
+
});
|
|
15713
|
+
}
|
|
15714
|
+
function resolveAgentRunnerPromptDir(importUrl = import.meta.url) {
|
|
15715
|
+
const candidates = [
|
|
15716
|
+
new URL("../prompts/", importUrl),
|
|
15717
|
+
new URL("./prompts/", importUrl)
|
|
15718
|
+
];
|
|
15719
|
+
return candidates.find(hasHarnessPromptTemplate) ?? candidates[0];
|
|
15720
|
+
}
|
|
15721
|
+
function hasHarnessPromptTemplate(promptDir) {
|
|
15722
|
+
return existsSync(new URL(harnessPromptTemplateFileName, promptDir));
|
|
15723
|
+
}
|
|
15724
|
+
function loadDefaultHarnessPromptTemplate() {
|
|
15725
|
+
return readFileSync(new URL(harnessPromptTemplateFileName, resolveAgentRunnerPromptDir()), "utf8");
|
|
15726
|
+
}
|
|
15727
|
+
function renderHarnessPromptTemplate(input) {
|
|
15728
|
+
let rendered = input.template;
|
|
15729
|
+
const placeholders = new Set(
|
|
15730
|
+
Array.from(input.template.matchAll(/{{([a-zA-Z0-9_]+)}}/g), (match) => match[1])
|
|
15731
|
+
);
|
|
15732
|
+
for (const placeholder of placeholders) {
|
|
15733
|
+
const value = input.values[placeholder];
|
|
15734
|
+
if (value === void 0) {
|
|
15735
|
+
throw new Error(`missing harness prompt template value: ${placeholder}`);
|
|
15736
|
+
}
|
|
15737
|
+
rendered = rendered.replaceAll(`{{${placeholder}}}`, value);
|
|
15738
|
+
}
|
|
15739
|
+
return rendered.trimEnd();
|
|
15740
|
+
}
|
|
15741
|
+
|
|
15695
15742
|
// src/runtime.ts
|
|
15696
15743
|
import { mkdir, readFile as readFile2, stat, writeFile } from "node:fs/promises";
|
|
15697
15744
|
import { dirname, join } from "node:path";
|
|
@@ -15868,36 +15915,6 @@ function createHarnessEnvironment(input) {
|
|
|
15868
15915
|
assertNoForbiddenHarnessEnv(harnessEnv, allowedForbiddenKeys);
|
|
15869
15916
|
return harnessEnv;
|
|
15870
15917
|
}
|
|
15871
|
-
function buildHarnessPrompt(spec) {
|
|
15872
|
-
return [
|
|
15873
|
-
"You are the Mote execute_task Task Agent.",
|
|
15874
|
-
"",
|
|
15875
|
-
"Use only the configured model and tool endpoints. A direct provider token may be present temporarily; never log it, persist it, print it, or write it to artifacts.",
|
|
15876
|
-
`Workspace: ${spec.workspaceDir}`,
|
|
15877
|
-
`State file: ${spec.workspaceDir}/state/completion.json`,
|
|
15878
|
-
`Artifact root: ${spec.workspaceDir}/artifacts`,
|
|
15879
|
-
"",
|
|
15880
|
-
"Task",
|
|
15881
|
-
`Title: ${spec.task.title}`,
|
|
15882
|
-
spec.task.context,
|
|
15883
|
-
"",
|
|
15884
|
-
"Intent",
|
|
15885
|
-
JSON.stringify(spec.intent, null, 2),
|
|
15886
|
-
"",
|
|
15887
|
-
"User Query",
|
|
15888
|
-
JSON.stringify(spec.userQuery, null, 2),
|
|
15889
|
-
"",
|
|
15890
|
-
"Approved Tools",
|
|
15891
|
-
JSON.stringify(spec.toolProvisioning.tools, null, 2),
|
|
15892
|
-
"",
|
|
15893
|
-
"Artifact contract",
|
|
15894
|
-
"- Allocate a UUID directory under artifacts for each artifact.",
|
|
15895
|
-
"- Write artifact.json in that directory using the TaskArtifactDraft contract.",
|
|
15896
|
-
"- Dataset artifacts must put schema and preview rows in artifact.json and the full CSV in data.csv.",
|
|
15897
|
-
"- Write terminal status to state/completion.json with status, summary, and artifactIds.",
|
|
15898
|
-
"- Never include secrets, tokens, provider keys, DB credentials, or OSS credentials in artifacts, logs, or completion."
|
|
15899
|
-
].join("\n");
|
|
15900
|
-
}
|
|
15901
15918
|
async function readTaskRunnerSpec(path) {
|
|
15902
15919
|
return JSON.parse(await readFile3(path, "utf8"));
|
|
15903
15920
|
}
|