@tangle-network/agent-profile-materialize 0.4.0 → 0.5.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +43 -10
  2. package/dist/index.js +1028 -189
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -21,7 +21,7 @@
21
21
  * `node:fs` IO consumer. It was previously copied byte-for-byte into both
22
22
  * cli-bridge and agent-dev-container — this is the single source those re-export.
23
23
  */
24
- import type { AgentCandidateConfigValue, AgentCandidateProfile, AgentCandidateProfileApplication, AgentCandidateProfilePlanEvidence, AgentProfile, Sha256Digest } from "@tangle-network/agent-interface";
24
+ import type { AgentCandidateConfigValue, AgentCandidateProfile, AgentCandidateProfileActivation, AgentCandidateProfileApplication, AgentCandidateProfilePlanEvidence, AgentCandidateProfilePlanMaterial, AgentProfile, AgentProfileMcpServer, Sha256Digest } from "@tangle-network/agent-interface";
25
25
  export type HarnessId = "claude-code" | "claude" | "claudish" | "nanoclaw" | "codex" | "opencode" | "kimi-code" | "kimi" | "pi" | "gemini" | "hermes" | "openclaw";
26
26
  export interface PlanFile {
27
27
  relPath: string;
@@ -30,7 +30,7 @@ export interface PlanFile {
30
30
  mode?: number;
31
31
  }
32
32
  export interface Unsupported {
33
- dimension: "files" | "skills" | "mcp" | "hooks" | "subagents" | "commands" | "instructions" | "systemPrompt" | "permissions" | "tools";
33
+ dimension: "files" | "skills" | "mcp" | "hooks" | "subagents" | "commands" | "instructions" | "systemPrompt" | "connections" | "confidential" | "permissions" | "tools" | "modes" | "extensions";
34
34
  reason: string;
35
35
  }
36
36
  /** The plan a caller writes into the run cwd, then applies to the spawn. */
@@ -42,6 +42,8 @@ export interface WorkspacePlan {
42
42
  env: Record<string, string>;
43
43
  /** Extra CLI flags to pass (e.g. kimi --mcp-config-file <path>). */
44
44
  flags: string[];
45
+ /** Exact system-prompt replacement supplied to the harness. */
46
+ systemPrompt?: string;
45
47
  /** Dimensions requested but with NO cwd path on this harness — fail-closed record. */
46
48
  unsupported: Unsupported[];
47
49
  }
@@ -54,31 +56,49 @@ export interface WorkspacePlanReceipt {
54
56
  workspacePlanDigest: string;
55
57
  env: Record<string, string>;
56
58
  flags: string[];
59
+ systemPrompt?: string;
57
60
  unsupported: Unsupported[];
58
61
  written: string[];
59
62
  }
63
+ export interface ApplyWorkspacePlanOptions {
64
+ /** Plan files consumed in memory by the runtime and never persisted to cwd. */
65
+ runtimeOnlyFiles?: readonly string[];
66
+ }
67
+ /** Fail when a profile asks for controls the chosen harness cannot execute. */
68
+ export declare function assertWorkspacePlanSupported(plan: Pick<WorkspacePlan, "unsupported">): void;
60
69
  /**
61
70
  * Candidate-safe workspace plan. Spawn values remain typed until the runtime
62
71
  * resolves them; the materializer never joins argv into a shell command.
63
72
  */
64
73
  export interface AgentCandidateWorkspacePlan {
74
+ sourceProfileDigest: Sha256Digest;
65
75
  harness: HarnessId;
66
76
  files: PlanFile[];
67
77
  env: Record<string, AgentCandidateConfigValue>;
68
78
  flags: AgentCandidateConfigValue[];
79
+ systemPrompt?: AgentCandidateConfigValue;
69
80
  unsupported: Unsupported[];
70
81
  }
71
82
  export interface AgentCandidateWorkspacePlanReceipt {
72
- profilePlan: AgentCandidateProfilePlanEvidence;
83
+ profileActivation: AgentCandidateProfileActivation;
73
84
  application: AgentCandidateProfileApplication;
74
85
  env: Record<string, AgentCandidateConfigValue>;
75
86
  flags: AgentCandidateConfigValue[];
87
+ systemPrompt?: AgentCandidateConfigValue;
76
88
  unsupported: Unsupported[];
77
89
  }
78
90
  export interface MaterializeCandidateProfileOptions {
79
91
  /** Exact text fetched from pinned resource refs, keyed by declared SHA-256. */
80
92
  resolvedResources?: ReadonlyMap<Sha256Digest, string>;
81
93
  }
94
+ export interface ResolveAgentProfileResourcesOptions {
95
+ /** Repository used when a GitHub resource omits its own `repository`. */
96
+ repository?: string;
97
+ fetch?: typeof globalThis.fetch;
98
+ timeoutMs?: number;
99
+ }
100
+ /** Resolve every GitHub resource to exact inline bytes before materialization. */
101
+ export declare function resolveAgentProfileResources(inputProfile: AgentProfile, options?: ResolveAgentProfileResourcesOptions): Promise<AgentProfile>;
82
102
  /** Normalize any skill markdown (VB frontmatter `skill:`/`description:`, or raw) into a
83
103
  * harness SKILL.md with `name:`/`description:` frontmatter the harnesses require. */
84
104
  export declare function normalizeSkillMd(name: string, raw: string): string;
@@ -86,14 +106,13 @@ export declare function normalizeSkillMd(name: string, raw: string): string;
86
106
  * Build the WorkspacePlan for `profile` on `harness`. Pure — no IO. The caller
87
107
  * writes plan.files into the run cwd and applies plan.env/plan.flags to the spawn.
88
108
  */
89
- export declare function materializeProfile(profile: AgentProfile, harness: HarnessId, opts?: {
109
+ export declare function materializeProfile(inputProfile: AgentProfile, harness: HarnessId, opts?: {
90
110
  skip?: Unsupported["dimension"][];
91
111
  }): WorkspacePlan;
92
112
  /**
93
113
  * Materialize a sealed candidate profile without weakening its process values.
94
- * Candidate hooks deliberately fail closed because the currently supported
95
- * native hook formats accept a shell command string rather than executable +
96
- * argv + env as separate fields.
114
+ * Codex and Claude hooks use generated no-shell wrappers to preserve executable,
115
+ * argv, and environment values separately. Other hook formats fail closed.
97
116
  */
98
117
  export declare function materializeCandidateProfile(profile: AgentCandidateProfile, harness: HarnessId, opts?: MaterializeCandidateProfileOptions): AgentCandidateWorkspacePlan;
99
118
  /**
@@ -103,13 +122,13 @@ export declare function materializeCandidateProfile(profile: AgentCandidateProfi
103
122
  */
104
123
  export declare function hashWorkspacePlan(plan: WorkspacePlan): string;
105
124
  /** Build the exact digest-free identity document required by agent-interface. */
106
- export declare function agentCandidateProfilePlanMaterial(plan: AgentCandidateWorkspacePlan): AgentCandidateProfilePlanEvidence["material"];
125
+ export declare function agentCandidateProfilePlanMaterial(plan: AgentCandidateWorkspacePlan): AgentCandidateProfilePlanMaterial;
107
126
  /**
108
127
  * Return the RFC 8785 UTF-8 bytes and SHA-256 identity of a candidate profile
109
128
  * plan. The returned bytes are the exact bytes embedded in receipt evidence.
110
129
  */
111
130
  export declare function canonicalizeAgentCandidateProfilePlan(plan: AgentCandidateWorkspacePlan): {
112
- material: AgentCandidateProfilePlanEvidence["material"];
131
+ material: AgentCandidateProfilePlanMaterial;
113
132
  bytes: Uint8Array;
114
133
  digest: Sha256Digest;
115
134
  };
@@ -126,4 +145,18 @@ export declare function applyAgentCandidateWorkspacePlan(plan: AgentCandidateWor
126
145
  * consumer of the pure `materializeProfile` — used by the cli-bridge host spawn, the
127
146
  * agent-dev-container box, and VB. Returns `unsupported` so the caller can log/fail.
128
147
  */
129
- export declare function applyWorkspacePlan(plan: WorkspacePlan, workspaceDir: string): WorkspacePlanReceipt;
148
+ export declare function applyWorkspacePlan(plan: WorkspacePlan, workspaceDir: string, options?: ApplyWorkspacePlanOptions): WorkspacePlanReceipt;
149
+ /** OpenCode-native MCP configuration used by workspace and startup paths. */
150
+ export type OpenCodeMcpConfig = Record<string, {
151
+ type: "remote";
152
+ url: string;
153
+ enabled: boolean;
154
+ headers?: Record<string, string>;
155
+ } | {
156
+ type: "local";
157
+ command: string[];
158
+ enabled: boolean;
159
+ environment?: Record<string, string>;
160
+ }>;
161
+ /** Lower canonical MCP definitions to OpenCode's native startup configuration. */
162
+ export declare function openCodeMcpConfig(mcp: Record<string, AgentProfileMcpServer>): OpenCodeMcpConfig;