@peakflo/agent-harness 0.2.21 → 0.2.22-rc.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.
|
@@ -668,7 +668,7 @@ class ClaudeCodeAdapter {
|
|
|
668
668
|
cwd: config.workspaceDir,
|
|
669
669
|
pathToClaudeCodeExecutable: claudePath,
|
|
670
670
|
env: this.buildClaudeEnvironment(config),
|
|
671
|
-
settingSources: [],
|
|
671
|
+
settingSources: ['project'],
|
|
672
672
|
mcpServers: config.mcpServers,
|
|
673
673
|
model: config.model,
|
|
674
674
|
effort,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.syncLeasedSkills = syncLeasedSkills;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const START = '<!-- workflo leased skills start -->';
|
|
7
|
+
const END = '<!-- workflo leased skills end -->';
|
|
8
|
+
const MANIFEST = '.workflo-leased-skills.json';
|
|
9
|
+
function slug(name) {
|
|
10
|
+
return (name
|
|
11
|
+
.toLowerCase()
|
|
12
|
+
.replace(/[^a-z0-9-]+/g, '-')
|
|
13
|
+
.replace(/^-|-$/g, '') || 'skill');
|
|
14
|
+
}
|
|
15
|
+
function yaml(value) {
|
|
16
|
+
return JSON.stringify(value.replace(/[\r\n]+/g, ' ').trim());
|
|
17
|
+
}
|
|
18
|
+
async function documentation(path, section) {
|
|
19
|
+
const old = await (0, promises_1.readFile)(path, 'utf8').catch(() => '');
|
|
20
|
+
const start = old.indexOf(START);
|
|
21
|
+
const end = old.indexOf(END);
|
|
22
|
+
const base = start >= 0 && end > start
|
|
23
|
+
? old.slice(0, start) + old.slice(end + END.length)
|
|
24
|
+
: old;
|
|
25
|
+
await (0, promises_1.writeFile)(path, `${base.trimEnd()}\n\n${START}\n${section}${END}\n`, 'utf8');
|
|
26
|
+
}
|
|
27
|
+
/** Install only the published skills in this lease. Prior leased files are removed. */
|
|
28
|
+
async function syncLeasedSkills(workspace, _backend, skills) {
|
|
29
|
+
const roots = ['.claude', '.agents'];
|
|
30
|
+
const manifestPath = (0, node_path_1.join)(workspace, MANIFEST);
|
|
31
|
+
const manifest = await (0, promises_1.readFile)(manifestPath, 'utf8').catch(() => null);
|
|
32
|
+
if (skills.length === 0 && manifest === null)
|
|
33
|
+
return;
|
|
34
|
+
const previous = JSON.parse(manifest ?? '[]');
|
|
35
|
+
const names = new Set();
|
|
36
|
+
const entries = [];
|
|
37
|
+
for (const root of roots)
|
|
38
|
+
await (0, promises_1.mkdir)((0, node_path_1.join)(workspace, root, 'skills'), { recursive: true });
|
|
39
|
+
for (const skill of skills) {
|
|
40
|
+
const name = slug(skill.name);
|
|
41
|
+
if (names.has(name))
|
|
42
|
+
throw new Error(`Duplicate leased skill: ${name}`);
|
|
43
|
+
names.add(name);
|
|
44
|
+
if (/-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----|\b(?:sk-proj-|sk_live_)[A-Za-z0-9_-]+/.test(skill.content))
|
|
45
|
+
throw new Error(`Leased skill ${name} contains a secret`);
|
|
46
|
+
const description = name === 'reuse-candidates'
|
|
47
|
+
? 'Read this list before each default-agent turn; RUN THIS marks the best active workflow.'
|
|
48
|
+
: name === 'reuse-first'
|
|
49
|
+
? 'Use on every default-agent turn to check and run an existing workflow first.'
|
|
50
|
+
: name === 'find-and-automate'
|
|
51
|
+
? 'Use first for requests about automating, finding problems, or building workflows.'
|
|
52
|
+
: name === 'automation-memory'
|
|
53
|
+
? 'Use for a repeat automation run to check approved company memory.'
|
|
54
|
+
: name === 'self-improving-workflows'
|
|
55
|
+
? 'Use when a person creates or improves a workflow.'
|
|
56
|
+
: `Use for tasks about ${skill.name}.`;
|
|
57
|
+
for (const root of roots) {
|
|
58
|
+
const directory = (0, node_path_1.join)(workspace, root, 'skills', name);
|
|
59
|
+
await (0, promises_1.mkdir)(directory, { recursive: true });
|
|
60
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(directory, 'SKILL.md'), `---\nname: ${yaml(skill.name)}\ndescription: ${yaml(description)}\n---\n\n${skill.content}\n`, 'utf8');
|
|
61
|
+
}
|
|
62
|
+
entries.push({ name: skill.name, description });
|
|
63
|
+
}
|
|
64
|
+
for (const old of previous) {
|
|
65
|
+
if (/^[a-z0-9-]+$/.test(old) && !names.has(old))
|
|
66
|
+
for (const root of roots)
|
|
67
|
+
await (0, promises_1.rm)((0, node_path_1.join)(workspace, root, 'skills', old), {
|
|
68
|
+
recursive: true,
|
|
69
|
+
force: true
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
for (const root of roots) {
|
|
73
|
+
const lines = entries.map((entry) => `- [${entry.name}](${root}/skills/${slug(entry.name)}/SKILL.md) — ${entry.description}`);
|
|
74
|
+
const section = `## Skills Reference\n\n${lines.join('\n') || 'No skills in this lease.'}\n\n`;
|
|
75
|
+
await documentation((0, node_path_1.join)(workspace, root === '.claude' ? 'CLAUDE.md' : 'AGENTS.md'), section);
|
|
76
|
+
}
|
|
77
|
+
await (0, promises_1.writeFile)(manifestPath, JSON.stringify([...names]), 'utf8');
|
|
78
|
+
}
|
|
@@ -40,6 +40,7 @@ const cold_start_steps_1 = require("./cold-start-steps");
|
|
|
40
40
|
const conversation_1 = require("./conversation");
|
|
41
41
|
const credential_proxy_1 = require("./credential-proxy");
|
|
42
42
|
const knowledge_tools_1 = require("./knowledge-tools");
|
|
43
|
+
const leased_skills_1 = require("./leased-skills");
|
|
43
44
|
const mcp_preflight_1 = require("./mcp-preflight");
|
|
44
45
|
const mcp_tool_store_1 = require("./mcp-tool-store");
|
|
45
46
|
const mcp_toolset_1 = require("./mcp-toolset");
|
|
@@ -895,6 +896,7 @@ class SessionRunner {
|
|
|
895
896
|
const endSpaceFiles = coldStart.begin('space_files_sync');
|
|
896
897
|
try {
|
|
897
898
|
await this.syncSpaceFilesForTurn(session, workspaceDir);
|
|
899
|
+
await (0, leased_skills_1.syncLeasedSkills)(workspaceDir, session.agent.backend, session.agent.skills);
|
|
898
900
|
}
|
|
899
901
|
finally {
|
|
900
902
|
endSpaceFiles();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peakflo/agent-harness",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22-rc.1",
|
|
4
4
|
"description": "Headless Peakflo coding-agent harness. One codebase, three hosting modes: a Daytona cloud sandbox, a customer VM, and the 20x desktop.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|