@tangle-network/agent-profile-materialize 0.25.3 → 0.25.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/dist/index.d.ts +2 -4
- package/dist/index.js +1 -1
- package/dist/prime-agent-dir.d.ts +18 -1
- package/dist/prime-agent-dir.js +20 -11
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,7 @@ export type { HarnessId } from "./harness.js";
|
|
|
5
5
|
export { HARNESS_SKILL_DIRS, harnessAutoLoadsAgentContextFile, harnessAutoLoadsContextFile, harnessContextFile, isMaterializerHarness, MATERIALIZER_CONTEXT_PATHS, MATERIALIZER_HARNESSES, markMaterializerContextFile, skillDirForHarness, } from "./harness.js";
|
|
6
6
|
export * from "./harness-prompt.js";
|
|
7
7
|
export { type ConcurrentProfileRevision, ensurePublicConcurrentProfileRoots, type ManagedWorkspaceFileDigest, type ManagedWorkspaceManifest, preparePublicConcurrentProfileRevision, } from "./managed-workspace.js";
|
|
8
|
-
export type
|
|
9
|
-
export { openCodeMcpConfig } from "./mcp.js";
|
|
8
|
+
export { type OpenCodeMcpConfig, openCodeMcpConfig } from "./mcp.js";
|
|
10
9
|
export { isMaterializerMcpConfig } from "./mcp-config-ownership.js";
|
|
11
10
|
export { modelIdsMatch, qualifyModelId, unqualifyModelId, } from "./model-id.js";
|
|
12
11
|
export { buildPiModelsConfig, buildPiModelsConfigFile, PI_MODELS_CONFIG_PATH, type PiModelsConfigFile, type PiModelsConfigInput, type PiRuntimePaths, resolvePiRuntimePaths, } from "./pi-models-config.js";
|
|
@@ -16,8 +15,7 @@ export { takeSystemPromptBinding } from "./plan-prompt.js";
|
|
|
16
15
|
export { assertWorkspacePlanSupported, enforceWorkspacePlanSupport, } from "./plan-support.js";
|
|
17
16
|
export type { ApplyWorkspacePlanOptions, BindableLaunchControl, ExecutorSystemPromptBinding, PlanFile, PlanFileRoot, PlanFileSecretSlot, PlanRequirement, SkippableDimension, Unsupported, WorkspacePlan, WorkspacePlanApplication, WorkspacePlanArgument, WorkspacePlanArgumentTemplate, WorkspacePlanConfigValue, WorkspacePlanReceipt, WorkspacePlanSecretSegment, WorkspacePlanSpawnInputs, WorkspacePlanSystemPromptBinding, WorkspacePlanWrittenFile, } from "./plan-types.js";
|
|
18
17
|
export { BINDABLE_LAUNCH_CONTROLS, EXECUTOR_SYSTEM_PROMPT_BINDINGS, isExecutorSystemPromptBinding, isSkippableDimension, SKIPPABLE_DIMENSIONS, WorkspacePlanCleanupError, } from "./plan-types.js";
|
|
19
|
-
export type
|
|
20
|
-
export { materializePrimeProfileControls, prunePrimeProfileMaterial, seedPrimeProfileSubagents, writePrimeAgentFile, } from "./prime-agent-dir.js";
|
|
18
|
+
export { materializePrimeProfileControls, type PrimeMaterializeOptions, primeHarnessStatePath, prunePrimeProfileMaterial, seedPrimeProfileSubagents, writePrimeAgentFile, } from "./prime-agent-dir.js";
|
|
21
19
|
export type { PrimeProfileErrorKind, PrimeThinkingLevel, } from "./prime-fork.js";
|
|
22
20
|
export { matchPrimeKernelDeadMarker, PRIME_AGENT_DIR_ENV_VAR, PRIME_AGENT_DIR_ENV_VARS, PRIME_FORK_INSTALL, PRIME_FORK_PIN, PRIME_HARNESS_STATE_ENV_DENYLIST, PRIME_KERNEL_DEAD_MARKERS, PRIME_KERNEL_ENV_PASSTHROUGH, PRIME_MCP_UNSUPPORTED_REASON, PRIME_THINKING_LEVELS, PrimeHarnessStateError, PrimeProfileError, parsePrimeModelsJson, primeAgentDirEnv, primeApiKeyEnvNames, primeThinkingLevel, stripPrimeJsonComments, } from "./prime-fork.js";
|
|
23
21
|
export type { PrimeProfileControls, PrimeProfileSkill, PrimeProfileSubagent, } from "./prime-profile.js";
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { agentCandidateProfilePlanMaterial, canonicalizeAgentCandidateProfilePla
|
|
|
12
12
|
export { takeSystemPromptBinding } from "./plan-prompt.js";
|
|
13
13
|
export { assertWorkspacePlanSupported, enforceWorkspacePlanSupport, } from "./plan-support.js";
|
|
14
14
|
export { BINDABLE_LAUNCH_CONTROLS, EXECUTOR_SYSTEM_PROMPT_BINDINGS, isExecutorSystemPromptBinding, isSkippableDimension, SKIPPABLE_DIMENSIONS, WorkspacePlanCleanupError, } from "./plan-types.js";
|
|
15
|
-
export { materializePrimeProfileControls, prunePrimeProfileMaterial, seedPrimeProfileSubagents, writePrimeAgentFile, } from "./prime-agent-dir.js";
|
|
15
|
+
export { materializePrimeProfileControls, primeHarnessStatePath, prunePrimeProfileMaterial, seedPrimeProfileSubagents, writePrimeAgentFile, } from "./prime-agent-dir.js";
|
|
16
16
|
export { matchPrimeKernelDeadMarker, PRIME_AGENT_DIR_ENV_VAR, PRIME_AGENT_DIR_ENV_VARS, PRIME_FORK_INSTALL, PRIME_FORK_PIN, PRIME_HARNESS_STATE_ENV_DENYLIST, PRIME_KERNEL_DEAD_MARKERS, PRIME_KERNEL_ENV_PASSTHROUGH, PRIME_MCP_UNSUPPORTED_REASON, PRIME_THINKING_LEVELS, PrimeHarnessStateError, PrimeProfileError, parsePrimeModelsJson, primeAgentDirEnv, primeApiKeyEnvNames, primeThinkingLevel, stripPrimeJsonComments, } from "./prime-fork.js";
|
|
17
17
|
export { assertPrimeModelAgreement, hasPrimeProfileMaterial, primeProfileNeedsAgentDir, primeSubagentEntryId, readPrimeProfileControls, } from "./prime-profile.js";
|
|
18
18
|
export * from "./profile-bundle-cache.js";
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
export declare function writePrimeAgentFile(path: string, data: string, mode?: number): void;
|
|
2
|
+
/**
|
|
3
|
+
* File access on a prime agent dir. The default reads and writes the local
|
|
4
|
+
* filesystem as the calling process. An executor whose agent dir belongs to
|
|
5
|
+
* another user (a root sidecar that demotes prime-agent) passes reads it took
|
|
6
|
+
* as that user and replays the writes as that user, so it never touches the
|
|
7
|
+
* agent's files with its own rights.
|
|
8
|
+
*/
|
|
9
|
+
export interface PrimeAgentDirIo {
|
|
10
|
+
/** The file's text, or undefined when it does not exist. */
|
|
11
|
+
read(path: string): string | undefined;
|
|
12
|
+
/** Replace the whole file: atomic and owner-only. */
|
|
13
|
+
write(path: string, data: string): void;
|
|
14
|
+
}
|
|
15
|
+
/** The fork's continual-harness store, the only agent-dir file a materialization reads. */
|
|
16
|
+
export declare function primeHarnessStatePath(agentDir: string): string;
|
|
2
17
|
export interface PrimeMaterializeOptions {
|
|
3
18
|
/**
|
|
4
19
|
* Where the FLAG-NAMED files go — the prompt files and the skills root.
|
|
@@ -14,6 +29,8 @@ export interface PrimeMaterializeOptions {
|
|
|
14
29
|
* (currently: adopting entries a pre-shared executor left behind).
|
|
15
30
|
*/
|
|
16
31
|
warn?: (msg: string, meta?: Record<string, unknown>) => void;
|
|
32
|
+
/** Agent-dir file access; the local filesystem when omitted. */
|
|
33
|
+
io?: PrimeAgentDirIo;
|
|
17
34
|
}
|
|
18
35
|
/**
|
|
19
36
|
* Materialize the validated controls and return the extra spawn args that bind
|
|
@@ -43,5 +60,5 @@ export declare function prunePrimeProfileMaterial(agentDir: string, options?: Pi
|
|
|
43
60
|
* {@link PrimeHarnessStateError}: the file is the agent's own self-modification
|
|
44
61
|
* state, and overwriting it destroys what the run was supposed to observe.
|
|
45
62
|
*/
|
|
46
|
-
export declare function seedPrimeProfileSubagents(agentDir: string, subagents: PrimeProfileSubagent[], warn?: (msg: string, meta?: Record<string, unknown>) => void): void;
|
|
63
|
+
export declare function seedPrimeProfileSubagents(agentDir: string, subagents: PrimeProfileSubagent[], warn?: (msg: string, meta?: Record<string, unknown>) => void, io?: PrimeAgentDirIo): void;
|
|
47
64
|
import type { PrimeProfileControls, PrimeProfileSubagent } from "./prime-profile.js";
|
package/dist/prime-agent-dir.js
CHANGED
|
@@ -4,6 +4,14 @@ export function writePrimeAgentFile(path, data, mode = 0o600) {
|
|
|
4
4
|
writeFileSync(temp, data, { mode });
|
|
5
5
|
renameSync(temp, path);
|
|
6
6
|
}
|
|
7
|
+
const localPrimeAgentDirIo = {
|
|
8
|
+
read: (path) => (existsSync(path) ? readFileSync(path, "utf8") : undefined),
|
|
9
|
+
write: (path, data) => writePrimeAgentFile(path, data),
|
|
10
|
+
};
|
|
11
|
+
/** The fork's continual-harness store, the only agent-dir file a materialization reads. */
|
|
12
|
+
export function primeHarnessStatePath(agentDir) {
|
|
13
|
+
return join(agentDir, PRIME_HARNESS_DIR_NAME, PRIME_HARNESS_STATE_FILE);
|
|
14
|
+
}
|
|
7
15
|
/**
|
|
8
16
|
* Materialize the validated controls and return the extra spawn args that bind
|
|
9
17
|
* them. Runs before every spawn (same place models.json is materialized), so a
|
|
@@ -11,30 +19,30 @@ export function writePrimeAgentFile(path, data, mode = 0o600) {
|
|
|
11
19
|
* process.
|
|
12
20
|
*/
|
|
13
21
|
export function materializePrimeProfileControls(agentDir, controls, options = {}) {
|
|
14
|
-
const { flagFileRoot = agentDir, warn } = options;
|
|
22
|
+
const { flagFileRoot = agentDir, warn, io = localPrimeAgentDirIo } = options;
|
|
15
23
|
const args = [];
|
|
16
24
|
const profileDir = join(flagFileRoot, PRIME_PROFILE_DIR_NAME);
|
|
17
25
|
if (controls.systemPrompt !== undefined) {
|
|
18
26
|
const promptPath = join(profileDir, PRIME_SYSTEM_PROMPT_FILE);
|
|
19
|
-
|
|
27
|
+
io.write(promptPath, controls.systemPrompt);
|
|
20
28
|
args.push("--system-prompt", promptPath);
|
|
21
29
|
}
|
|
22
30
|
if (controls.appendSystemPrompt !== undefined) {
|
|
23
31
|
const appendPath = join(profileDir, PRIME_APPEND_SYSTEM_PROMPT_FILE);
|
|
24
|
-
|
|
32
|
+
io.write(appendPath, controls.appendSystemPrompt);
|
|
25
33
|
args.push("--append-system-prompt", appendPath);
|
|
26
34
|
}
|
|
27
35
|
if (controls.instructions !== undefined) {
|
|
28
|
-
|
|
36
|
+
io.write(join(agentDir, PRIME_CONTEXT_FILE), `${controls.instructions}\n`);
|
|
29
37
|
}
|
|
30
38
|
if (controls.skills.length > 0) {
|
|
31
39
|
const skillsRoot = join(profileDir, PRIME_SKILLS_DIR_NAME);
|
|
32
40
|
for (const skill of controls.skills) {
|
|
33
|
-
|
|
41
|
+
io.write(join(skillsRoot, skill.name, "SKILL.md"), normalizeSkillMd(skill.name, skill.content));
|
|
34
42
|
}
|
|
35
43
|
args.push("--skill", skillsRoot);
|
|
36
44
|
}
|
|
37
|
-
seedPrimeProfileSubagents(agentDir, controls.subagents, warn);
|
|
45
|
+
seedPrimeProfileSubagents(agentDir, controls.subagents, warn, io);
|
|
38
46
|
return args;
|
|
39
47
|
}
|
|
40
48
|
/**
|
|
@@ -65,13 +73,14 @@ export function prunePrimeProfileMaterial(agentDir, options = {}) {
|
|
|
65
73
|
* {@link PrimeHarnessStateError}: the file is the agent's own self-modification
|
|
66
74
|
* state, and overwriting it destroys what the run was supposed to observe.
|
|
67
75
|
*/
|
|
68
|
-
export function seedPrimeProfileSubagents(agentDir, subagents, warn) {
|
|
69
|
-
const statePath =
|
|
76
|
+
export function seedPrimeProfileSubagents(agentDir, subagents, warn, io = localPrimeAgentDirIo) {
|
|
77
|
+
const statePath = primeHarnessStatePath(agentDir);
|
|
70
78
|
let state = {};
|
|
71
|
-
|
|
79
|
+
const stored = io.read(statePath);
|
|
80
|
+
if (stored !== undefined) {
|
|
72
81
|
let parsed;
|
|
73
82
|
try {
|
|
74
|
-
parsed = JSON.parse(
|
|
83
|
+
parsed = JSON.parse(stored);
|
|
75
84
|
}
|
|
76
85
|
catch (err) {
|
|
77
86
|
throw new PrimeHarnessStateError(statePath, err instanceof Error ? err.message : String(err));
|
|
@@ -149,7 +158,7 @@ export function seedPrimeProfileSubagents(agentDir, subagents, warn) {
|
|
|
149
158
|
}
|
|
150
159
|
if (!changed)
|
|
151
160
|
return;
|
|
152
|
-
|
|
161
|
+
io.write(statePath, `${JSON.stringify({
|
|
153
162
|
...state,
|
|
154
163
|
schema: typeof state.schema === "number" ? state.schema : 1,
|
|
155
164
|
entries,
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-profile-materialize",
|
|
3
|
-
"version": "0.25.
|
|
4
|
-
"description": "Materialize an AgentProfile into the native per-harness workspace files (the one shared materializer for cli-bridge, agent-
|
|
3
|
+
"version": "0.25.4",
|
|
4
|
+
"description": "Materialize an AgentProfile into the native per-harness workspace files (the one shared materializer for cli-bridge, agent-container, and VB).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/tangle-network/agent-
|
|
8
|
+
"url": "git+https://github.com/tangle-network/agent-container.git",
|
|
9
9
|
"directory": "packages/agent-profile-materialize"
|
|
10
10
|
},
|
|
11
11
|
"main": "./dist/index.js",
|