@tangle-network/agent-profile-materialize 1.1.118 → 1.1.120
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 +9 -3
- package/dist/index.js +26 -25
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -532,6 +532,12 @@ declare function applyWorkspacePlan(plan: WorkspacePlan, workspaceDir: string, o
|
|
|
532
532
|
declare function applyWorkspacePlanWithSecretProvider(plan: WorkspacePlan, workspaceDir: string, secretProvider: AgentProfileSecretProvider, options?: ApplyWorkspacePlanOptions): Promise<WorkspacePlanApplication>;
|
|
533
533
|
//#endregion
|
|
534
534
|
//#region src/plan-digest.d.ts
|
|
535
|
+
/** A launch variable name: `prefix`, then 24 upper-case hex digits of the SHA-256 of `seed`. */
|
|
536
|
+
declare const digestEnvName: (prefix: string, seed: string) => string;
|
|
537
|
+
/** Names the variable behind a `{env:NAME}` reference to a value the executor holds. */
|
|
538
|
+
declare const SECRET_REFERENCE_PREFIX = "TANGLE_PROFILE_SECRET_";
|
|
539
|
+
/** Every such reference in a config; group 1 is NAME. */
|
|
540
|
+
declare const SECRET_REFERENCE: RegExp;
|
|
535
541
|
declare function hashWorkspacePlan(plan: WorkspacePlan): string;
|
|
536
542
|
/** Build the exact digest-free identity document required by agent-interface. */
|
|
537
543
|
declare function agentCandidateProfilePlanMaterial(plan: AgentCandidateWorkspacePlan): AgentCandidateProfilePlanMaterial;
|
|
@@ -1082,9 +1088,9 @@ declare function evictProfileBundles(root: string, maxBytes: number): Promise<vo
|
|
|
1082
1088
|
* already present are re-verified against the incoming bytes, then the temp
|
|
1083
1089
|
* copy is dropped — the existing object was verified when it was admitted.
|
|
1084
1090
|
* The manifest is written LAST as the commit point, followed by lru update
|
|
1085
|
-
* and eviction down to
|
|
1091
|
+
* and eviction down to `maxBytes`, a cap `openProfileBundleCache` checked.
|
|
1086
1092
|
*/
|
|
1087
|
-
declare function admitProfileBundle(root: string, manifest: ProfileBundleManifest, readObject: (sha256: string) => Promise<Uint8Array> | Uint8Array): Promise<void>;
|
|
1093
|
+
declare function admitProfileBundle(root: string, manifest: ProfileBundleManifest, readObject: (sha256: string) => Promise<Uint8Array> | Uint8Array, maxBytes?: number): Promise<void>;
|
|
1088
1094
|
/**
|
|
1089
1095
|
* Claim a bundle from a (possibly read-only mounted) cache. Verify-on-read:
|
|
1090
1096
|
* every object's bytes are re-hashed and compared to BOTH the manifest entry
|
|
@@ -1223,4 +1229,4 @@ declare function parseSandboxToolBinDirs(value: string | undefined): string[];
|
|
|
1223
1229
|
*/
|
|
1224
1230
|
declare function bindLaunchToolBinDirs(env: Readonly<Record<string, string | undefined>>, toolBinDirs: readonly string[], appToolBinDirs?: readonly string[]): Record<string, string | undefined>;
|
|
1225
1231
|
//#endregion
|
|
1226
|
-
export { type AgentCandidateWorkspacePlan, type AgentCandidateWorkspacePlanReceipt, type ApplyAgentCandidateWorkspacePlanOptions, type ApplyWorkspacePlanOptions, BINDABLE_LAUNCH_CONTROLS, type BindableLaunchControl, CODEX_DISABLED_FEATURE_ARGS, type ConcurrentProfileRevision, EXECUTOR_SYSTEM_PROMPT_BINDINGS, type ExecutorSystemPromptBinding, HARNESS_LAUNCH_MATERIALIZE_OPTIONS, HARNESS_SKILL_DIRS, type HarnessId, MATERIALIZER_CONTEXT_PATHS, MATERIALIZER_HARNESSES, type ManagedWorkspaceFileDigest, type ManagedWorkspaceManifest, type MaterializeCandidateProfileOptions, OPENCODE_NATIVE_TOOL_IDS, type OpenCodeMcpConfig, PI_MODELS_CONFIG_PATH, PRIME_AGENT_DIR_ENV_VAR, PRIME_AGENT_DIR_ENV_VARS, PRIME_HARNESS_STATE_ENV_DENYLIST, PRIME_KERNEL_DEAD_MARKERS, PRIME_KERNEL_ENV_PASSTHROUGH, PRIME_MCP_UNSUPPORTED_REASON, PRIME_THINKING_LEVELS, PROFILE_BUNDLE_DEFAULT_MAX_BYTES, PROFILE_BUNDLE_MAX_BYTES, PROFILE_BUNDLE_MAX_FILES, PROFILE_BUNDLE_MAX_FILE_BYTES, PROFILE_BUNDLE_SCHEMA, type PiModelsConfigFile, type PiModelsConfigInput, type PiRuntimePaths, type PlanFile, type PlanFileRoot, type PlanFileSecretSlot, type PlanRequirement, PrimeHarnessStateError, type PrimeMaterializeOptions, type PrimeProfileControls, PrimeProfileError, type PrimeProfileErrorKind, type PrimeProfileSkill, type PrimeProfileSubagent, type PrimeThinkingLevel, ProfileBundleCache, ProfileBundleClaim, ProfileBundleClaimResult, ProfileBundleFileEntry, ProfileBundleManifest, ProfileUnsupportedError, type ResolveAgentProfileResourcesOptions, SANDBOX_TOOL_BIN_DIRS_ENV, SKIPPABLE_DIMENSIONS, type SkippableDimension, UNAVAILABLE_AGENT_PROFILE_SECRET_PROVIDER, type Unsupported, type WorkspacePlan, type WorkspacePlanApplication, type WorkspacePlanArgument, type WorkspacePlanArgumentTemplate, WorkspacePlanCleanupError, type WorkspacePlanConfigValue, type WorkspacePlanReceipt, type WorkspacePlanSecretSegment, type WorkspacePlanSpawnInputs, type WorkspacePlanSystemPromptBinding, type WorkspacePlanWrittenFile, admitProfileBundle, agentCandidateProfilePlanMaterial, applyAgentCandidateWorkspacePlan, applyWorkspacePlan, applyWorkspacePlanWithSecretProvider, assertPrimeModelAgreement, assertWorkspacePlanSupported, bindLaunchToolBinDirs, bindSecretSessionView, buildPiModelsConfig, buildPiModelsConfigFile, canonicalizeAgentCandidateProfilePlan, captureAgentCandidateProfilePlan, claimProfileBundle, codexDeveloperInstructionArgs, enforceWorkspacePlanSupport, ensurePublicConcurrentProfileRoots, evictProfileBundles, executionControlConflict, harnessAutoLoadsAgentContextFile, hasPrimeProfileMaterial, hashWorkspacePlan, isExecutableProfileFile, isMaterializerHarness, isMaterializerMcpConfig, isSkippableDimension, joinSystemPromptAdditions, keepsHarnessSystemPrompt, markMaterializerContextFile, matchPrimeKernelDeadMarker, materializeCandidateProfile, materializePrimeProfileControls, materializeProfile, modelIdsMatch, normalizeSkillMd, openCodeMcpConfig, openCodeNativeToolId, openProfileBundleCache, parsePrimeModelsJson, parseSandboxToolBinDirs, preparePublicConcurrentProfileRevision, prepareSecretConcurrentProfileRevision, primeAgentDirEnv, primeApiKeyEnvNames, primeHarnessStatePath, primeProfileNeedsAgentDir, primeSubagentEntryId, primeThinkingLevel, profileBundleFileEntry, profileBundleFileTable, profileBundleManifestPath, profileFileBundleKey, prunePrimeProfileMaterial, qualifyModelId, readPrimeProfileControls, resolveAgentProfileResources, resolvePiRuntimePaths, secretSessionViewWorkspace, seedPrimeProfileSubagents, skillDirForHarness, stripPrimeJsonComments, sweepProfileBundleCache, takeSystemPromptBinding, unqualifyModelId, writePrimeAgentFile };
|
|
1232
|
+
export { type AgentCandidateWorkspacePlan, type AgentCandidateWorkspacePlanReceipt, type ApplyAgentCandidateWorkspacePlanOptions, type ApplyWorkspacePlanOptions, BINDABLE_LAUNCH_CONTROLS, type BindableLaunchControl, CODEX_DISABLED_FEATURE_ARGS, type ConcurrentProfileRevision, EXECUTOR_SYSTEM_PROMPT_BINDINGS, type ExecutorSystemPromptBinding, HARNESS_LAUNCH_MATERIALIZE_OPTIONS, HARNESS_SKILL_DIRS, type HarnessId, MATERIALIZER_CONTEXT_PATHS, MATERIALIZER_HARNESSES, type ManagedWorkspaceFileDigest, type ManagedWorkspaceManifest, type MaterializeCandidateProfileOptions, OPENCODE_NATIVE_TOOL_IDS, type OpenCodeMcpConfig, PI_MODELS_CONFIG_PATH, PRIME_AGENT_DIR_ENV_VAR, PRIME_AGENT_DIR_ENV_VARS, PRIME_HARNESS_STATE_ENV_DENYLIST, PRIME_KERNEL_DEAD_MARKERS, PRIME_KERNEL_ENV_PASSTHROUGH, PRIME_MCP_UNSUPPORTED_REASON, PRIME_THINKING_LEVELS, PROFILE_BUNDLE_DEFAULT_MAX_BYTES, PROFILE_BUNDLE_MAX_BYTES, PROFILE_BUNDLE_MAX_FILES, PROFILE_BUNDLE_MAX_FILE_BYTES, PROFILE_BUNDLE_SCHEMA, type PiModelsConfigFile, type PiModelsConfigInput, type PiRuntimePaths, type PlanFile, type PlanFileRoot, type PlanFileSecretSlot, type PlanRequirement, PrimeHarnessStateError, type PrimeMaterializeOptions, type PrimeProfileControls, PrimeProfileError, type PrimeProfileErrorKind, type PrimeProfileSkill, type PrimeProfileSubagent, type PrimeThinkingLevel, ProfileBundleCache, ProfileBundleClaim, ProfileBundleClaimResult, ProfileBundleFileEntry, ProfileBundleManifest, ProfileUnsupportedError, type ResolveAgentProfileResourcesOptions, SANDBOX_TOOL_BIN_DIRS_ENV, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SKIPPABLE_DIMENSIONS, type SkippableDimension, UNAVAILABLE_AGENT_PROFILE_SECRET_PROVIDER, type Unsupported, type WorkspacePlan, type WorkspacePlanApplication, type WorkspacePlanArgument, type WorkspacePlanArgumentTemplate, WorkspacePlanCleanupError, type WorkspacePlanConfigValue, type WorkspacePlanReceipt, type WorkspacePlanSecretSegment, type WorkspacePlanSpawnInputs, type WorkspacePlanSystemPromptBinding, type WorkspacePlanWrittenFile, admitProfileBundle, agentCandidateProfilePlanMaterial, applyAgentCandidateWorkspacePlan, applyWorkspacePlan, applyWorkspacePlanWithSecretProvider, assertPrimeModelAgreement, assertWorkspacePlanSupported, bindLaunchToolBinDirs, bindSecretSessionView, buildPiModelsConfig, buildPiModelsConfigFile, canonicalizeAgentCandidateProfilePlan, captureAgentCandidateProfilePlan, claimProfileBundle, codexDeveloperInstructionArgs, digestEnvName, enforceWorkspacePlanSupport, ensurePublicConcurrentProfileRoots, evictProfileBundles, executionControlConflict, harnessAutoLoadsAgentContextFile, hasPrimeProfileMaterial, hashWorkspacePlan, isExecutableProfileFile, isMaterializerHarness, isMaterializerMcpConfig, isSkippableDimension, joinSystemPromptAdditions, keepsHarnessSystemPrompt, markMaterializerContextFile, matchPrimeKernelDeadMarker, materializeCandidateProfile, materializePrimeProfileControls, materializeProfile, modelIdsMatch, normalizeSkillMd, openCodeMcpConfig, openCodeNativeToolId, openProfileBundleCache, parsePrimeModelsJson, parseSandboxToolBinDirs, preparePublicConcurrentProfileRevision, prepareSecretConcurrentProfileRevision, primeAgentDirEnv, primeApiKeyEnvNames, primeHarnessStatePath, primeProfileNeedsAgentDir, primeSubagentEntryId, primeThinkingLevel, profileBundleFileEntry, profileBundleFileTable, profileBundleManifestPath, profileFileBundleKey, prunePrimeProfileMaterial, qualifyModelId, readPrimeProfileControls, resolveAgentProfileResources, resolvePiRuntimePaths, secretSessionViewWorkspace, seedPrimeProfileSubagents, skillDirForHarness, stripPrimeJsonComments, sweepProfileBundleCache, takeSystemPromptBinding, unqualifyModelId, writePrimeAgentFile };
|
package/dist/index.js
CHANGED
|
@@ -489,6 +489,12 @@ function takeSystemPromptBinding(spawn, control) {
|
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/plan-digest.ts
|
|
491
491
|
const sha256 = (value) => createHash("sha256").update(value, "utf8").digest("hex");
|
|
492
|
+
/** A launch variable name: `prefix`, then 24 upper-case hex digits of the SHA-256 of `seed`. */
|
|
493
|
+
const digestEnvName = (prefix, seed) => `${prefix}${sha256(seed).slice(0, 24).toUpperCase()}`;
|
|
494
|
+
/** Names the variable behind a `{env:NAME}` reference to a value the executor holds. */
|
|
495
|
+
const SECRET_REFERENCE_PREFIX = "TANGLE_PROFILE_SECRET_";
|
|
496
|
+
/** Every such reference in a config; group 1 is NAME. */
|
|
497
|
+
const SECRET_REFERENCE = new RegExp(`\\{env:(${SECRET_REFERENCE_PREFIX}[0-9A-F]{24})\\}`, "g");
|
|
492
498
|
function hashWorkspacePlan(plan) {
|
|
493
499
|
const files = normalizePlanFiles(plan.files).map((file) => ({
|
|
494
500
|
relPath: file.relPath,
|
|
@@ -1094,7 +1100,7 @@ function materializedHookCommand(event, command, add, plan) {
|
|
|
1094
1100
|
}).slice(7);
|
|
1095
1101
|
const path = `.tangle/profile-hooks/${wrapperId}.mjs`;
|
|
1096
1102
|
const envSources = Object.fromEntries(Object.entries(command.env).sort(([left], [right]) => compareStrings(left, right)).map(([name, value]) => {
|
|
1097
|
-
const sourceName =
|
|
1103
|
+
const sourceName = digestEnvName("TANGLE_PROFILE_HOOK_", `${wrapperId}\0${name}`);
|
|
1098
1104
|
setPlanEnvironment(plan, sourceName, value);
|
|
1099
1105
|
return [name, sourceName];
|
|
1100
1106
|
}));
|
|
@@ -1642,9 +1648,6 @@ function resolvePublicWorkspacePlan(plan) {
|
|
|
1642
1648
|
*/
|
|
1643
1649
|
const SUBSTITUTABLE_SECRET_VALUE = /^[\x20-\x7e]+$/;
|
|
1644
1650
|
const UNSUBSTITUTABLE_SECRET_CHARACTERS = /["\\{}]/;
|
|
1645
|
-
function secretSlotEnvironmentName(ref) {
|
|
1646
|
-
return `TANGLE_PROFILE_SECRET_${createHash("sha256").update(ref.key, "utf8").digest("hex").slice(0, 24).toUpperCase()}`;
|
|
1647
|
-
}
|
|
1648
1651
|
async function resolvePrivateWorkspacePlan(plan, secretProvider, fileSlotReferences) {
|
|
1649
1652
|
if (!secretProvider || typeof secretProvider.get !== "function") throw new Error("AgentProfileSecretProvider.get is required");
|
|
1650
1653
|
const pending = /* @__PURE__ */ new Map();
|
|
@@ -1674,7 +1677,7 @@ async function resolvePrivateWorkspacePlan(plan, secretProvider, fileSlotReferen
|
|
|
1674
1677
|
const value = await resolveRawRef(ref);
|
|
1675
1678
|
if (!fileSlotReferences) return ref.format === "bearer" ? `Bearer ${value}` : value;
|
|
1676
1679
|
if (!SUBSTITUTABLE_SECRET_VALUE.test(value) || UNSUBSTITUTABLE_SECRET_CHARACTERS.test(value)) throw new Error(`AgentProfile secret ${secretRefLabel(ref)} has a value that cannot be referenced from a secret OpenCode config: it may hold only printable ASCII without quotes, backslashes or braces`);
|
|
1677
|
-
const name =
|
|
1680
|
+
const name = digestEnvName(SECRET_REFERENCE_PREFIX, ref.key);
|
|
1678
1681
|
fileSlotReferences[name] = value;
|
|
1679
1682
|
return ref.format === "bearer" ? `Bearer {env:${name}}` : `{env:${name}}`;
|
|
1680
1683
|
};
|
|
@@ -1791,9 +1794,6 @@ function openCodeNativeToolId(name) {
|
|
|
1791
1794
|
if (normalized === "patch") return "apply_patch";
|
|
1792
1795
|
return OPENCODE_NATIVE_TOOL_ID_SET.has(normalized) ? normalized : void 0;
|
|
1793
1796
|
}
|
|
1794
|
-
function openCodeToolName(name) {
|
|
1795
|
-
return openCodeNativeToolId(name);
|
|
1796
|
-
}
|
|
1797
1797
|
function openCodePermissionName(name) {
|
|
1798
1798
|
if (name === "*") return "*";
|
|
1799
1799
|
if (name.includes("*") || name.includes("?")) return void 0;
|
|
@@ -1992,7 +1992,7 @@ function materializeOpenCodeControls(toolEntries, permissionEntries, add, unsupp
|
|
|
1992
1992
|
if (!permissionAllowsEverything(policy)) unsupported("permissions", "opencode: read access cannot be denied or approval-gated");
|
|
1993
1993
|
return false;
|
|
1994
1994
|
});
|
|
1995
|
-
const nativeTools = mapSupportedBooleanEntries(enforceableTools,
|
|
1995
|
+
const nativeTools = mapSupportedBooleanEntries(enforceableTools, openCodeNativeToolId, (name) => unsupported("tools", `opencode: no verified native tool mapping for "${name}". Accepted: ${OPENCODE_NATIVE_TOOL_IDS.join(", ")}`));
|
|
1996
1996
|
const nativePermissions = mapSupportedPermissionEntries(enforceablePermissions, (name) => openCodeDeclaredMcpPermissionName(name, mcpAliases) ?? openCodePermissionName(name), (name) => unsupported("permissions", `opencode: no verified native permission mapping for "${name}". Accepted: ${OPENCODE_NATIVE_PERMISSION_IDS.join(", ")}`), "opencode permission");
|
|
1997
1997
|
if (enforceableTools.length > 0 || permissionEntries.length > 0) add(OPENCODE_CONFIG_FILE, serializeWorkspacePlanJson({
|
|
1998
1998
|
$schema: OPENCODE_CONFIG_SCHEMA,
|
|
@@ -2293,7 +2293,7 @@ function codexMcpServerToml(name, server, plan, toolTimeoutMs) {
|
|
|
2293
2293
|
if (headers && Object.keys(headers).length > 0) {
|
|
2294
2294
|
const envHeaders = {};
|
|
2295
2295
|
for (const [header, value] of Object.entries(headers).sort(([left], [right]) => compareStrings(left, right))) {
|
|
2296
|
-
const envName =
|
|
2296
|
+
const envName = digestEnvName("TANGLE_MCP_HEADER_", `${name}\0${header}`);
|
|
2297
2297
|
setPlanEnvironment(plan, envName, value);
|
|
2298
2298
|
envHeaders[header] = envName;
|
|
2299
2299
|
}
|
|
@@ -4458,9 +4458,13 @@ async function evictUnlocked(root, maxBytes) {
|
|
|
4458
4458
|
* never touched.
|
|
4459
4459
|
*/
|
|
4460
4460
|
async function evictProfileBundles(root, maxBytes) {
|
|
4461
|
-
|
|
4461
|
+
assertProfileBundleMaxBytes(maxBytes);
|
|
4462
4462
|
await withRootLock(root, () => evictUnlocked(root, maxBytes));
|
|
4463
4463
|
}
|
|
4464
|
+
/** Refuse a cache cap that is not a finite, non-negative byte count. */
|
|
4465
|
+
function assertProfileBundleMaxBytes(maxBytes) {
|
|
4466
|
+
if (!Number.isFinite(maxBytes) || maxBytes < 0) throw new Error(`Profile bundle cache maxBytes must be >= 0: ${maxBytes}`);
|
|
4467
|
+
}
|
|
4464
4468
|
//#endregion
|
|
4465
4469
|
//#region src/profile-bundle-cache.ts
|
|
4466
4470
|
const SHA256_HEX_RE = /^[0-9a-f]{64}$/;
|
|
@@ -4538,9 +4542,9 @@ function validateManifestFiles(manifest) {
|
|
|
4538
4542
|
* already present are re-verified against the incoming bytes, then the temp
|
|
4539
4543
|
* copy is dropped — the existing object was verified when it was admitted.
|
|
4540
4544
|
* The manifest is written LAST as the commit point, followed by lru update
|
|
4541
|
-
* and eviction down to
|
|
4545
|
+
* and eviction down to `maxBytes`, a cap `openProfileBundleCache` checked.
|
|
4542
4546
|
*/
|
|
4543
|
-
async function admitProfileBundle(root, manifest, readObject) {
|
|
4547
|
+
async function admitProfileBundle(root, manifest, readObject, maxBytes = PROFILE_BUNDLE_DEFAULT_MAX_BYTES) {
|
|
4544
4548
|
validateManifestShape(manifest);
|
|
4545
4549
|
const entries = validateManifestFiles(manifest);
|
|
4546
4550
|
await mkdir(join(root, "objects"), { recursive: true });
|
|
@@ -4608,7 +4612,7 @@ async function admitProfileBundle(root, manifest, readObject) {
|
|
|
4608
4612
|
force: true
|
|
4609
4613
|
});
|
|
4610
4614
|
}
|
|
4611
|
-
await evictUnlocked(root,
|
|
4615
|
+
await evictUnlocked(root, maxBytes);
|
|
4612
4616
|
});
|
|
4613
4617
|
}
|
|
4614
4618
|
/**
|
|
@@ -4674,7 +4678,7 @@ async function claimProfileBundle(root, claim, linkFile) {
|
|
|
4674
4678
|
*/
|
|
4675
4679
|
function openProfileBundleCache(root, options) {
|
|
4676
4680
|
const maxBytes = options?.maxBytes ?? 1073741824;
|
|
4677
|
-
|
|
4681
|
+
assertProfileBundleMaxBytes(maxBytes);
|
|
4678
4682
|
mkdirSync(join(root, "objects"), { recursive: true });
|
|
4679
4683
|
mkdirSync(join(root, "bundles"), { recursive: true });
|
|
4680
4684
|
const incoming = join(root, "incoming");
|
|
@@ -4686,7 +4690,7 @@ function openProfileBundleCache(root, options) {
|
|
|
4686
4690
|
return {
|
|
4687
4691
|
root,
|
|
4688
4692
|
maxBytes,
|
|
4689
|
-
admit: (manifest, readObject) => admitProfileBundle(root, manifest, readObject),
|
|
4693
|
+
admit: (manifest, readObject) => admitProfileBundle(root, manifest, readObject, maxBytes),
|
|
4690
4694
|
evict: () => evictProfileBundles(root, maxBytes),
|
|
4691
4695
|
sweep: () => sweepProfileBundleCache(root)
|
|
4692
4696
|
};
|
|
@@ -4736,7 +4740,7 @@ async function secretCodexPlan(plan, references, provider) {
|
|
|
4736
4740
|
const ref = typeof value === "string" ? void 0 : agentProfileSecretRefSchema.parse(value);
|
|
4737
4741
|
const raw = ref ? await provider.get(ref.key) : value;
|
|
4738
4742
|
if (typeof raw !== "string" || !raw.trim()) throw new Error("Secret Codex MCP value is unavailable");
|
|
4739
|
-
const name =
|
|
4743
|
+
const name = digestEnvName(SECRET_REFERENCE_PREFIX, `codex-mcp-env\0${variable}`);
|
|
4740
4744
|
references[name] = ref?.format === "bearer" ? `Bearer ${raw}` : raw;
|
|
4741
4745
|
env[variable] = `{env:${name}}`;
|
|
4742
4746
|
}
|
|
@@ -4785,9 +4789,6 @@ async function prepareSecretConcurrentProfileRevision(input) {
|
|
|
4785
4789
|
secretReferences
|
|
4786
4790
|
};
|
|
4787
4791
|
}
|
|
4788
|
-
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4789
|
-
/** How `servableMcpServer` recognizes a header value the executor holds. */
|
|
4790
|
-
const HELD_VALUE_PREFIX = "TANGLE_PROFILE_SECRET_";
|
|
4791
4792
|
/**
|
|
4792
4793
|
* A remote MCP server's public header values never reach the sealed launch:
|
|
4793
4794
|
* the executor's loopback proxy replaces the server's url and headers there.
|
|
@@ -4803,14 +4804,14 @@ function referencePublicMcpHeaders(plan, references) {
|
|
|
4803
4804
|
const configFile = plan.files.find((file) => file.relPath === "opencode.json" && file.source === "generated" && (file.root ?? "workspace") === "workspace");
|
|
4804
4805
|
if (!configFile) return plan;
|
|
4805
4806
|
const config = JSON.parse(configFile.content);
|
|
4806
|
-
if (!
|
|
4807
|
+
if (!isPlainRecord(config) || !isPlainRecord(config.mcp)) return plan;
|
|
4807
4808
|
let changed = false;
|
|
4808
4809
|
for (const [server, entry] of Object.entries(config.mcp)) {
|
|
4809
|
-
if (!
|
|
4810
|
-
if (!
|
|
4810
|
+
if (!isPlainRecord(entry) || entry.type !== "remote") continue;
|
|
4811
|
+
if (!isPlainRecord(entry.headers)) continue;
|
|
4811
4812
|
for (const [header, value] of Object.entries(entry.headers)) {
|
|
4812
4813
|
if (typeof value !== "string" || value === "") continue;
|
|
4813
|
-
const name =
|
|
4814
|
+
const name = digestEnvName(SECRET_REFERENCE_PREFIX, `public-mcp-header\0${server}\0${header}`);
|
|
4814
4815
|
references[name] = value;
|
|
4815
4816
|
entry.headers[header] = `{env:${name}}`;
|
|
4816
4817
|
changed = true;
|
|
@@ -5022,4 +5023,4 @@ function bindLaunchToolBinDirs(env, toolBinDirs, appToolBinDirs = parseSandboxTo
|
|
|
5022
5023
|
};
|
|
5023
5024
|
}
|
|
5024
5025
|
//#endregion
|
|
5025
|
-
export { BINDABLE_LAUNCH_CONTROLS, CODEX_DISABLED_FEATURE_ARGS, EXECUTOR_SYSTEM_PROMPT_BINDINGS, HARNESS_LAUNCH_MATERIALIZE_OPTIONS, HARNESS_SKILL_DIRS, MATERIALIZER_CONTEXT_PATHS, MATERIALIZER_HARNESSES, OPENCODE_NATIVE_TOOL_IDS, PI_MODELS_CONFIG_PATH, PRIME_AGENT_DIR_ENV_VAR, PRIME_AGENT_DIR_ENV_VARS, PRIME_HARNESS_STATE_ENV_DENYLIST, PRIME_KERNEL_DEAD_MARKERS, PRIME_KERNEL_ENV_PASSTHROUGH, PRIME_MCP_UNSUPPORTED_REASON, PRIME_THINKING_LEVELS, PROFILE_BUNDLE_DEFAULT_MAX_BYTES, PROFILE_BUNDLE_MAX_BYTES, PROFILE_BUNDLE_MAX_FILES, PROFILE_BUNDLE_MAX_FILE_BYTES, PROFILE_BUNDLE_SCHEMA, PrimeHarnessStateError, PrimeProfileError, ProfileUnsupportedError, SANDBOX_TOOL_BIN_DIRS_ENV, SKIPPABLE_DIMENSIONS, UNAVAILABLE_AGENT_PROFILE_SECRET_PROVIDER, WorkspacePlanCleanupError, admitProfileBundle, agentCandidateProfilePlanMaterial, applyAgentCandidateWorkspacePlan, applyWorkspacePlan, applyWorkspacePlanWithSecretProvider, assertPrimeModelAgreement, assertWorkspacePlanSupported, bindLaunchToolBinDirs, bindSecretSessionView, buildPiModelsConfig, buildPiModelsConfigFile, canonicalizeAgentCandidateProfilePlan, captureAgentCandidateProfilePlan, claimProfileBundle, codexDeveloperInstructionArgs, enforceWorkspacePlanSupport, ensurePublicConcurrentProfileRoots, evictProfileBundles, executionControlConflict, harnessAutoLoadsAgentContextFile, hasPrimeProfileMaterial, hashWorkspacePlan, isExecutableProfileFile, isMaterializerHarness, isMaterializerMcpConfig, isSkippableDimension, joinSystemPromptAdditions, keepsHarnessSystemPrompt, markMaterializerContextFile, matchPrimeKernelDeadMarker, materializeCandidateProfile, materializePrimeProfileControls, materializeProfile, modelIdsMatch, normalizeSkillMd, openCodeMcpConfig, openCodeNativeToolId, openProfileBundleCache, parsePrimeModelsJson, parseSandboxToolBinDirs, preparePublicConcurrentProfileRevision, prepareSecretConcurrentProfileRevision, primeAgentDirEnv, primeApiKeyEnvNames, primeHarnessStatePath, primeProfileNeedsAgentDir, primeSubagentEntryId, primeThinkingLevel, profileBundleFileEntry, profileBundleFileTable, profileBundleManifestPath, profileFileBundleKey, prunePrimeProfileMaterial, qualifyModelId, readPrimeProfileControls, resolveAgentProfileResources, resolvePiRuntimePaths, secretSessionViewWorkspace, seedPrimeProfileSubagents, skillDirForHarness, stripPrimeJsonComments, sweepProfileBundleCache, takeSystemPromptBinding, unqualifyModelId, writePrimeAgentFile };
|
|
5026
|
+
export { BINDABLE_LAUNCH_CONTROLS, CODEX_DISABLED_FEATURE_ARGS, EXECUTOR_SYSTEM_PROMPT_BINDINGS, HARNESS_LAUNCH_MATERIALIZE_OPTIONS, HARNESS_SKILL_DIRS, MATERIALIZER_CONTEXT_PATHS, MATERIALIZER_HARNESSES, OPENCODE_NATIVE_TOOL_IDS, PI_MODELS_CONFIG_PATH, PRIME_AGENT_DIR_ENV_VAR, PRIME_AGENT_DIR_ENV_VARS, PRIME_HARNESS_STATE_ENV_DENYLIST, PRIME_KERNEL_DEAD_MARKERS, PRIME_KERNEL_ENV_PASSTHROUGH, PRIME_MCP_UNSUPPORTED_REASON, PRIME_THINKING_LEVELS, PROFILE_BUNDLE_DEFAULT_MAX_BYTES, PROFILE_BUNDLE_MAX_BYTES, PROFILE_BUNDLE_MAX_FILES, PROFILE_BUNDLE_MAX_FILE_BYTES, PROFILE_BUNDLE_SCHEMA, PrimeHarnessStateError, PrimeProfileError, ProfileUnsupportedError, SANDBOX_TOOL_BIN_DIRS_ENV, SECRET_REFERENCE, SECRET_REFERENCE_PREFIX, SKIPPABLE_DIMENSIONS, UNAVAILABLE_AGENT_PROFILE_SECRET_PROVIDER, WorkspacePlanCleanupError, admitProfileBundle, agentCandidateProfilePlanMaterial, applyAgentCandidateWorkspacePlan, applyWorkspacePlan, applyWorkspacePlanWithSecretProvider, assertPrimeModelAgreement, assertWorkspacePlanSupported, bindLaunchToolBinDirs, bindSecretSessionView, buildPiModelsConfig, buildPiModelsConfigFile, canonicalizeAgentCandidateProfilePlan, captureAgentCandidateProfilePlan, claimProfileBundle, codexDeveloperInstructionArgs, digestEnvName, enforceWorkspacePlanSupport, ensurePublicConcurrentProfileRoots, evictProfileBundles, executionControlConflict, harnessAutoLoadsAgentContextFile, hasPrimeProfileMaterial, hashWorkspacePlan, isExecutableProfileFile, isMaterializerHarness, isMaterializerMcpConfig, isSkippableDimension, joinSystemPromptAdditions, keepsHarnessSystemPrompt, markMaterializerContextFile, matchPrimeKernelDeadMarker, materializeCandidateProfile, materializePrimeProfileControls, materializeProfile, modelIdsMatch, normalizeSkillMd, openCodeMcpConfig, openCodeNativeToolId, openProfileBundleCache, parsePrimeModelsJson, parseSandboxToolBinDirs, preparePublicConcurrentProfileRevision, prepareSecretConcurrentProfileRevision, primeAgentDirEnv, primeApiKeyEnvNames, primeHarnessStatePath, primeProfileNeedsAgentDir, primeSubagentEntryId, primeThinkingLevel, profileBundleFileEntry, profileBundleFileTable, profileBundleManifestPath, profileFileBundleKey, prunePrimeProfileMaterial, qualifyModelId, readPrimeProfileControls, resolveAgentProfileResources, resolvePiRuntimePaths, secretSessionViewWorkspace, seedPrimeProfileSubagents, skillDirForHarness, stripPrimeJsonComments, sweepProfileBundleCache, takeSystemPromptBinding, unqualifyModelId, writePrimeAgentFile };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-profile-materialize",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.120",
|
|
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": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@tangle-network/agent-interface": "^5.10.23"
|
|
38
38
|
},
|
|
39
39
|
"tangleRelease": {
|
|
40
|
-
"sourceSha": "
|
|
41
|
-
"mergedAt": "2026-11-
|
|
40
|
+
"sourceSha": "ab34bf1ff5768f8016d9dc772fd0e9cad38eb402",
|
|
41
|
+
"mergedAt": "2026-11-16T03:50:33-08:00"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsdown",
|