@tangle-network/agent-profile-materialize 0.16.0 → 0.17.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/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { HARNESS_SKILL_DIRS, harnessAutoLoadsContextFile, harnessContextFile, is
7
7
  export type { OpenCodeMcpConfig } from "./mcp.js";
8
8
  export { openCodeMcpConfig } from "./mcp.js";
9
9
  export { modelIdsMatch, qualifyModelId } from "./model-id.js";
10
+ export { buildPiModelsConfig, buildPiModelsConfigFile, PI_MODELS_CONFIG_PATH, type PiModelsConfigFile, type PiModelsConfigInput, } from "./pi-models-config.js";
10
11
  export { applyWorkspacePlan, applyWorkspacePlanWithSecretProvider, } from "./plan-application.js";
11
12
  export { agentCandidateProfilePlanMaterial, canonicalizeAgentCandidateProfilePlan, captureAgentCandidateProfilePlan, hashWorkspacePlan, } from "./plan-digest.js";
12
13
  export { takeSystemPromptBinding } from "./plan-prompt.js";
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ export { OPENCODE_NATIVE_TOOL_IDS, openCodeNativeToolId, } from "./control-maps.
4
4
  export { HARNESS_SKILL_DIRS, harnessAutoLoadsContextFile, harnessContextFile, isMaterializerHarness, MATERIALIZER_HARNESSES, skillDirForHarness, } from "./harness.js";
5
5
  export { openCodeMcpConfig } from "./mcp.js";
6
6
  export { modelIdsMatch, qualifyModelId } from "./model-id.js";
7
+ export { buildPiModelsConfig, buildPiModelsConfigFile, PI_MODELS_CONFIG_PATH, } from "./pi-models-config.js";
7
8
  export { applyWorkspacePlan, applyWorkspacePlanWithSecretProvider, } from "./plan-application.js";
8
9
  export { agentCandidateProfilePlanMaterial, canonicalizeAgentCandidateProfilePlan, captureAgentCandidateProfilePlan, hashWorkspacePlan, } from "./plan-digest.js";
9
10
  export { takeSystemPromptBinding } from "./plan-prompt.js";
@@ -0,0 +1,30 @@
1
+ /**
2
+ * One custom-model shape for upstream Pi and the Prime fork.
3
+ *
4
+ * Both agents read the same `models.json` provider schema.
5
+ * Callers own the file lifecycle, but they must not build different payloads.
6
+ */
7
+ export interface PiModelsConfigInput {
8
+ /** Provider key in models.json and the matching `--provider` value. */
9
+ providerName: string;
10
+ /** Model id in models.json and the matching `--model` value. */
11
+ modelId: string;
12
+ /** Provider endpoint. OpenAI-compatible endpoints include `/v1`. */
13
+ baseUrl: string;
14
+ /** Literal in-box credential or an environment reference. */
15
+ apiKey: string;
16
+ /** Pi wire protocol. */
17
+ api?: "anthropic-messages" | "google-generative-ai" | "openai-completions" | "openai-responses";
18
+ contextWindow?: number;
19
+ maxTokens?: number;
20
+ reasoning?: boolean;
21
+ }
22
+ export interface PiModelsConfigFile {
23
+ path: string;
24
+ content: string;
25
+ mode: number;
26
+ }
27
+ export declare const PI_MODELS_CONFIG_PATH = ".pi/agent/models.json";
28
+ export declare function buildPiModelsConfig(input: PiModelsConfigInput): Record<string, unknown>;
29
+ /** Build the owner-only Pi file used by headless and interactive processes. */
30
+ export declare function buildPiModelsConfigFile(input: PiModelsConfigInput): PiModelsConfigFile;
@@ -0,0 +1,46 @@
1
+ export const PI_MODELS_CONFIG_PATH = ".pi/agent/models.json";
2
+ const DEFAULT_CONTEXT_WINDOW = 128_000;
3
+ export function buildPiModelsConfig(input) {
4
+ for (const [field, value] of [
5
+ ["providerName", input.providerName],
6
+ ["modelId", input.modelId],
7
+ ["baseUrl", input.baseUrl],
8
+ ["apiKey", input.apiKey],
9
+ ]) {
10
+ if (typeof value !== "string" || value.trim().length === 0) {
11
+ throw new Error(`pi models.json requires a non-empty "${field}"; ` +
12
+ "the caller must supply provider, model, baseUrl, and apiKey");
13
+ }
14
+ }
15
+ return {
16
+ providers: {
17
+ [input.providerName]: {
18
+ name: input.providerName,
19
+ baseUrl: input.baseUrl,
20
+ api: input.api ?? "openai-completions",
21
+ apiKey: input.apiKey,
22
+ models: [
23
+ {
24
+ id: input.modelId,
25
+ name: input.modelId,
26
+ reasoning: input.reasoning ?? false,
27
+ input: ["text", "image"],
28
+ contextWindow: input.contextWindow ?? DEFAULT_CONTEXT_WINDOW,
29
+ ...(input.maxTokens !== undefined
30
+ ? { maxTokens: input.maxTokens }
31
+ : {}),
32
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
33
+ },
34
+ ],
35
+ },
36
+ },
37
+ };
38
+ }
39
+ /** Build the owner-only Pi file used by headless and interactive processes. */
40
+ export function buildPiModelsConfigFile(input) {
41
+ return {
42
+ path: PI_MODELS_CONFIG_PATH,
43
+ content: `${JSON.stringify(buildPiModelsConfig(input), null, 2)}\n`,
44
+ mode: 0o600,
45
+ };
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-profile-materialize",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Materialize an AgentProfile into the native per-harness workspace files (the one shared materializer for cli-bridge, agent-dev-container, and VB).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",