@poncho-ai/harness 0.4.1 → 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.
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +26 -0
- package/dist/index.d.ts +48 -50
- package/dist/index.js +356 -487
- package/package.json +5 -3
- package/scripts/update-test-mocks.js +49 -0
- package/src/harness.ts +176 -74
- package/src/index.ts +1 -2
- package/src/latitude-capture.ts +25 -74
- package/src/model-factory.ts +22 -10
- package/src/schema-converter.ts +107 -0
- package/test/harness.test.ts +2 -427
- package/test/harness.test.ts.backup +2387 -0
- package/test/model-factory.test.ts +34 -9
- package/test/schema-converter.test.ts +477 -0
- package/src/anthropic-client.ts +0 -134
- package/src/model-client.ts +0 -44
- package/src/openai-client.ts +0 -169
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/harness@0.
|
|
2
|
+
> @poncho-ai/harness@0.5.0 build /Users/cesar/Dev/latitude/poncho-ai/packages/harness
|
|
3
3
|
> tsup src/index.ts --format esm --dts
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/index.ts
|
|
@@ -7,8 +7,8 @@ CLI Using tsconfig: tsconfig.json
|
|
|
7
7
|
CLI tsup v8.5.1
|
|
8
8
|
CLI Target: es2022
|
|
9
9
|
ESM Build start
|
|
10
|
-
ESM dist/index.js
|
|
11
|
-
ESM ⚡️ Build success in
|
|
10
|
+
ESM dist/index.js 112.34 KB
|
|
11
|
+
ESM ⚡️ Build success in 66ms
|
|
12
12
|
DTS Build start
|
|
13
|
-
DTS ⚡️ Build success in
|
|
14
|
-
DTS dist/index.d.ts 15.
|
|
13
|
+
DTS ⚡️ Build success in 2273ms
|
|
14
|
+
DTS dist/index.d.ts 15.87 KB
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @poncho-ai/harness
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d6256b2: Migrate to Vercel AI SDK for unified model provider support
|
|
8
|
+
|
|
9
|
+
This major refactoring replaces separate OpenAI and Anthropic client implementations with Vercel AI SDK's unified interface, simplifying the codebase by ~1,265 lines and enabling easier addition of new model providers.
|
|
10
|
+
|
|
11
|
+
**Key improvements:**
|
|
12
|
+
- Unified model provider interface via Vercel AI SDK
|
|
13
|
+
- JSON Schema to Zod converter for tool definitions
|
|
14
|
+
- Fixed tool call preservation in multi-step agent loops
|
|
15
|
+
- Simplified architecture with better maintainability
|
|
16
|
+
- Added comprehensive error handling for step execution
|
|
17
|
+
|
|
18
|
+
**Breaking changes (internal API only):**
|
|
19
|
+
- `ModelClient` interface removed (use Vercel AI SDK directly)
|
|
20
|
+
- `OpenAiModelClient` and `AnthropicModelClient` classes removed
|
|
21
|
+
- `createModelClient()` replaced with `createModelProvider()`
|
|
22
|
+
|
|
23
|
+
**User-facing API unchanged:**
|
|
24
|
+
- AGENT.md format unchanged
|
|
25
|
+
- Tool definitions unchanged (JSON Schema still works)
|
|
26
|
+
- Model provider names unchanged (`openai`, `anthropic`)
|
|
27
|
+
- Agent behavior unchanged from user perspective
|
|
28
|
+
|
|
3
29
|
## 0.4.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Message, ToolDefinition, RunInput, AgentEvent, RunResult, ToolContext } from '@poncho-ai/sdk';
|
|
1
|
+
import { Message, ToolDefinition, RunInput, AgentEvent, RunResult, JsonSchema, ToolContext } from '@poncho-ai/sdk';
|
|
2
2
|
export { ToolDefinition, defineTool } from '@poncho-ai/sdk';
|
|
3
|
+
import { LanguageModelV1 } from 'ai';
|
|
4
|
+
import { z } from 'zod';
|
|
3
5
|
|
|
4
6
|
interface AgentModelConfig {
|
|
5
7
|
provider: string;
|
|
@@ -261,6 +263,14 @@ declare const loadPonchoConfig: (workingDir: string) => Promise<PonchoConfig | u
|
|
|
261
263
|
declare const createDefaultTools: (workingDir: string) => ToolDefinition[];
|
|
262
264
|
declare const createWriteTool: (workingDir: string) => ToolDefinition;
|
|
263
265
|
|
|
266
|
+
type ModelProviderFactory = (modelName: string) => LanguageModelV1;
|
|
267
|
+
/**
|
|
268
|
+
* Creates a model provider factory for the specified AI provider
|
|
269
|
+
* @param provider - The provider name ('openai' or 'anthropic')
|
|
270
|
+
* @returns A function that takes a model name and returns a LanguageModelV1 instance
|
|
271
|
+
*/
|
|
272
|
+
declare const createModelProvider: (provider?: string) => ModelProviderFactory;
|
|
273
|
+
|
|
264
274
|
interface HarnessOptions {
|
|
265
275
|
workingDir?: string;
|
|
266
276
|
environment?: "development" | "staging" | "production";
|
|
@@ -272,6 +282,7 @@ interface HarnessOptions {
|
|
|
272
282
|
step: number;
|
|
273
283
|
approvalId: string;
|
|
274
284
|
}) => Promise<boolean> | boolean;
|
|
285
|
+
modelProvider?: ModelProviderFactory;
|
|
275
286
|
}
|
|
276
287
|
interface HarnessRunOutput {
|
|
277
288
|
runId: string;
|
|
@@ -282,7 +293,8 @@ interface HarnessRunOutput {
|
|
|
282
293
|
declare class AgentHarness {
|
|
283
294
|
private readonly workingDir;
|
|
284
295
|
private readonly environment;
|
|
285
|
-
private
|
|
296
|
+
private modelProvider;
|
|
297
|
+
private readonly modelProviderInjected;
|
|
286
298
|
private readonly dispatcher;
|
|
287
299
|
private readonly approvalHandler?;
|
|
288
300
|
private skillContextWindow;
|
|
@@ -315,67 +327,53 @@ declare class AgentHarness {
|
|
|
315
327
|
runToCompletion(input: RunInput): Promise<HarnessRunOutput>;
|
|
316
328
|
}
|
|
317
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Latitude telemetry integration for Vercel AI SDK
|
|
332
|
+
*
|
|
333
|
+
* TODO: Implement proper Vercel AI SDK telemetry integration using:
|
|
334
|
+
* - LatitudeTelemetry.capture() wrapper around streamText()
|
|
335
|
+
* - experimental_telemetry: { isEnabled: true } in streamText() options
|
|
336
|
+
*
|
|
337
|
+
* This requires @latitude-data/telemetry package which has official
|
|
338
|
+
* Vercel AI SDK support.
|
|
339
|
+
*/
|
|
318
340
|
interface LatitudeCaptureConfig {
|
|
319
341
|
apiKey?: string;
|
|
320
342
|
projectId?: string | number;
|
|
321
343
|
path?: string;
|
|
322
344
|
defaultPath?: string;
|
|
323
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* Placeholder for Latitude telemetry integration
|
|
348
|
+
* This will be properly implemented once Vercel AI SDK migration is complete
|
|
349
|
+
*/
|
|
324
350
|
declare class LatitudeCapture {
|
|
325
351
|
private readonly apiKey?;
|
|
326
|
-
private telemetryPromise?;
|
|
327
352
|
private readonly projectId?;
|
|
328
353
|
private readonly path?;
|
|
329
354
|
constructor(config?: LatitudeCaptureConfig);
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
text: string;
|
|
336
|
-
toolCalls: Array<{
|
|
337
|
-
id: string;
|
|
338
|
-
name: string;
|
|
339
|
-
input: Record<string, unknown>;
|
|
340
|
-
}>;
|
|
341
|
-
usage: {
|
|
342
|
-
input: number;
|
|
343
|
-
output: number;
|
|
355
|
+
isConfigured(): boolean;
|
|
356
|
+
getConfig(): {
|
|
357
|
+
apiKey: string | undefined;
|
|
358
|
+
projectId: number | undefined;
|
|
359
|
+
path: string | undefined;
|
|
344
360
|
};
|
|
345
|
-
rawContent: unknown[];
|
|
346
|
-
}
|
|
347
|
-
interface ModelCallInput {
|
|
348
|
-
systemPrompt: string;
|
|
349
|
-
messages: Message[];
|
|
350
|
-
tools: ToolDefinition[];
|
|
351
|
-
modelName: string;
|
|
352
|
-
temperature?: number;
|
|
353
|
-
maxTokens?: number;
|
|
354
|
-
}
|
|
355
|
-
interface ModelClientOptions {
|
|
356
|
-
latitudeCapture?: LatitudeCapture;
|
|
357
|
-
}
|
|
358
|
-
type ModelStreamEvent = {
|
|
359
|
-
type: "chunk";
|
|
360
|
-
content: string;
|
|
361
|
-
} | {
|
|
362
|
-
type: "final";
|
|
363
|
-
response: ModelResponse;
|
|
364
|
-
};
|
|
365
|
-
interface ModelClient {
|
|
366
|
-
generate(input: ModelCallInput): Promise<ModelResponse>;
|
|
367
|
-
generateStream?(input: ModelCallInput): AsyncGenerator<ModelStreamEvent>;
|
|
368
361
|
}
|
|
369
362
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Converts a JSON Schema object to a Zod schema
|
|
365
|
+
*
|
|
366
|
+
* Supports:
|
|
367
|
+
* - Primitives: string, number, integer, boolean, null
|
|
368
|
+
* - Objects with properties
|
|
369
|
+
* - Arrays
|
|
370
|
+
* - Enums
|
|
371
|
+
* - Required/optional fields
|
|
372
|
+
* - Nested structures
|
|
373
|
+
*
|
|
374
|
+
* Falls back to z.any() for unsupported patterns
|
|
375
|
+
*/
|
|
376
|
+
declare function jsonSchemaToZod(schema: JsonSchema): z.ZodType;
|
|
379
377
|
|
|
380
378
|
/**
|
|
381
379
|
* Resolve the full list of skill directories to scan.
|
|
@@ -467,4 +465,4 @@ declare class ToolDispatcher {
|
|
|
467
465
|
executeBatch(calls: ToolCall[], context: ToolContext): Promise<ToolExecutionResult[]>;
|
|
468
466
|
}
|
|
469
467
|
|
|
470
|
-
export { type AgentFrontmatter, AgentHarness, type AgentLimitsConfig, type AgentModelConfig, type BuiltInToolToggles, type Conversation, type ConversationState, type ConversationStore, type HarnessOptions, type HarnessRunOutput, InMemoryConversationStore, InMemoryStateStore, LatitudeCapture, type LatitudeCaptureConfig, LocalMcpBridge, type MainMemory, type McpConfig, type MemoryConfig, type MemoryStore, type
|
|
468
|
+
export { type AgentFrontmatter, AgentHarness, type AgentLimitsConfig, type AgentModelConfig, type BuiltInToolToggles, type Conversation, type ConversationState, type ConversationStore, type HarnessOptions, type HarnessRunOutput, InMemoryConversationStore, InMemoryStateStore, LatitudeCapture, type LatitudeCaptureConfig, LocalMcpBridge, type MainMemory, type McpConfig, type MemoryConfig, type MemoryStore, type ModelProviderFactory, type ParsedAgent, type PonchoConfig, type RemoteMcpServerConfig, type RuntimeRenderContext, type SkillContextEntry, type SkillMetadata, type StateConfig, type StateProviderName, type StateStore, type StorageConfig, type TelemetryConfig, TelemetryEmitter, type ToolCall, ToolDispatcher, type ToolExecutionResult, buildSkillContextWindow, createConversationStore, createDefaultTools, createMemoryStore, createMemoryTools, createModelProvider, createSkillTools, createStateStore, createWriteTool, jsonSchemaToZod, loadPonchoConfig, loadSkillContext, loadSkillInstructions, loadSkillMetadata, parseAgentFile, parseAgentMarkdown, readSkillResource, renderAgentPrompt, resolveMemoryConfig, resolveSkillDirs, resolveStateConfig };
|