@poncho-ai/harness 0.2.0 → 0.3.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.
@@ -1,14 +1,14 @@
1
1
 
2
- > @poncho-ai/harness@0.2.0 build /Users/cesar/Dev/latitude/poncho-ai/packages/harness
2
+ > @poncho-ai/harness@0.3.0 build /Users/cesar/Dev/latitude/poncho-ai/packages/harness
3
3
  > tsup src/index.ts --format esm --dts
4
4
 
5
- CLI Building entry: src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Target: es2022
9
- ESM Build start
10
- ESM dist/index.js 93.22 KB
11
- ESM ⚡️ Build success in 31ms
12
- DTS Build start
13
- DTS ⚡️ Build success in 2649ms
14
- DTS dist/index.d.ts 13.93 KB
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.1
8
+ CLI Target: es2022
9
+ ESM Build start
10
+ ESM dist/index.js 115.76 KB
11
+ ESM ⚡️ Build success in 66ms
12
+ DTS Build start
13
+ DTS ⚡️ Build success in 2501ms
14
+ DTS dist/index.d.ts 15.69 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @poncho-ai/harness
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Implement tool policy and declarative intent system
8
+
9
+ Add comprehensive tool policy framework for MCP and script tools with pattern matching, environment-based configuration, and declarative tool intent in AGENT.md and SKILL.md frontmatter.
10
+
3
11
  ## 0.2.0
4
12
 
5
13
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -16,6 +16,10 @@ interface AgentFrontmatter {
16
16
  description?: string;
17
17
  model?: AgentModelConfig;
18
18
  limits?: AgentLimitsConfig;
19
+ tools?: {
20
+ mcp?: string[];
21
+ scripts?: string[];
22
+ };
19
23
  }
20
24
  interface ParsedAgent {
21
25
  frontmatter: AgentFrontmatter;
@@ -128,10 +132,28 @@ declare const createMemoryTools: (store: MemoryStore, options?: {
128
132
  maxRecallConversations?: number;
129
133
  }) => ToolDefinition[];
130
134
 
135
+ type RuntimeEnvironment = "development" | "staging" | "production";
136
+ type ToolPolicyMode = "all" | "allowlist" | "denylist";
137
+ interface ToolPatternPolicy {
138
+ mode?: ToolPolicyMode;
139
+ include?: string[];
140
+ exclude?: string[];
141
+ byEnvironment?: {
142
+ development?: Omit<ToolPatternPolicy, "byEnvironment">;
143
+ staging?: Omit<ToolPatternPolicy, "byEnvironment">;
144
+ production?: Omit<ToolPatternPolicy, "byEnvironment">;
145
+ };
146
+ }
147
+
131
148
  interface RemoteMcpServerConfig {
132
149
  name?: string;
133
150
  url: string;
134
151
  env?: string[];
152
+ auth?: {
153
+ type: "bearer";
154
+ tokenEnv?: string;
155
+ };
156
+ tools?: ToolPatternPolicy;
135
157
  timeoutMs?: number;
136
158
  reconnectAttempts?: number;
137
159
  reconnectDelayMs?: number;
@@ -142,8 +164,14 @@ interface McpConfig {
142
164
  declare class LocalMcpBridge {
143
165
  private readonly remoteServers;
144
166
  private readonly rpcClients;
167
+ private readonly toolCatalog;
168
+ private readonly unavailableServers;
169
+ private readonly authFailedServers;
145
170
  constructor(config: McpConfig | undefined);
146
- loadTools(): Promise<ToolDefinition[]>;
171
+ private validatePolicy;
172
+ private getServerName;
173
+ private log;
174
+ discoverTools(): Promise<void>;
147
175
  startLocalServers(): Promise<void>;
148
176
  stopLocalServers(): Promise<void>;
149
177
  listServers(): RemoteMcpServerConfig[];
@@ -155,6 +183,8 @@ declare class LocalMcpBridge {
155
183
  }>>;
156
184
  toSerializableConfig(): McpConfig;
157
185
  getLocalServers(): never[];
186
+ listDiscoveredTools(serverName?: string): string[];
187
+ loadTools(requestedPatterns: string[], environment?: RuntimeEnvironment): Promise<ToolDefinition[]>;
158
188
  private toToolDefinitions;
159
189
  }
160
190
 
@@ -213,6 +243,7 @@ interface PonchoConfig extends McpConfig {
213
243
  handler?: (event: unknown) => Promise<void> | void;
214
244
  };
215
245
  skills?: Record<string, Record<string, unknown>>;
246
+ scripts?: ToolPatternPolicy;
216
247
  /** Extra directories (relative to project root) to scan for skills.
217
248
  * `skills/` and `.poncho/skills/` are always scanned. */
218
249
  skillPaths?: string[];
@@ -256,6 +287,10 @@ declare class AgentHarness {
256
287
  private readonly approvalHandler?;
257
288
  private skillContextWindow;
258
289
  private memoryStore?;
290
+ private loadedConfig?;
291
+ private loadedSkills;
292
+ private readonly activeSkillNames;
293
+ private readonly registeredMcpToolNames;
259
294
  private parsedAgent?;
260
295
  private mcpBridge?;
261
296
  private getConfiguredToolFlag;
@@ -264,6 +299,15 @@ declare class AgentHarness {
264
299
  private registerConfiguredBuiltInTools;
265
300
  private shouldEnableWriteTool;
266
301
  constructor(options?: HarnessOptions);
302
+ private runtimeEnvironment;
303
+ private listActiveSkills;
304
+ private getAgentMcpIntent;
305
+ private getAgentScriptIntent;
306
+ private getRequestedMcpPatterns;
307
+ private getRequestedScriptPatterns;
308
+ private isScriptAllowedByPolicy;
309
+ private refreshMcpTools;
310
+ private validateScriptPolicyConfig;
267
311
  initialize(): Promise<void>;
268
312
  shutdown(): Promise<void>;
269
313
  listTools(): ToolDefinition[];
@@ -343,8 +387,11 @@ interface SkillMetadata {
343
387
  name: string;
344
388
  /** What the skill does and when to use it. */
345
389
  description: string;
346
- /** Tool hints declared in frontmatter (spec `allowed-tools` or legacy `tools`). */
347
- tools: string[];
390
+ /** Tool intent declared in frontmatter. */
391
+ tools: {
392
+ mcp: string[];
393
+ scripts: string[];
394
+ };
348
395
  /** Absolute path to the skill directory. */
349
396
  skillDir: string;
350
397
  /** Absolute path to the SKILL.md file. */
@@ -371,7 +418,12 @@ declare const loadSkillContext: (workingDir: string) => Promise<SkillContextEntr
371
418
  * - `list_skill_scripts` — lists runnable JavaScript/TypeScript scripts under scripts/
372
419
  * - `run_skill_script` — executes a JavaScript/TypeScript module under scripts/
373
420
  */
374
- declare const createSkillTools: (skills: SkillMetadata[]) => ToolDefinition[];
421
+ declare const createSkillTools: (skills: SkillMetadata[], options?: {
422
+ onActivateSkill?: (name: string) => Promise<string[]> | string[];
423
+ onDeactivateSkill?: (name: string) => Promise<string[]> | string[];
424
+ onListActiveSkills?: () => string[];
425
+ isScriptAllowed?: (skill: string, scriptPath: string) => boolean;
426
+ }) => ToolDefinition[];
375
427
 
376
428
  interface TelemetryConfig {
377
429
  enabled?: boolean;
@@ -407,6 +459,8 @@ declare class ToolDispatcher {
407
459
  private readonly tools;
408
460
  register(tool: ToolDefinition): void;
409
461
  registerMany(tools: ToolDefinition[]): void;
462
+ unregister(name: string): void;
463
+ unregisterMany(names: Iterable<string>): void;
410
464
  list(): ToolDefinition[];
411
465
  get(name: string): ToolDefinition | undefined;
412
466
  execute(call: ToolCall, context: ToolContext): Promise<ToolExecutionResult>;