ocpipe 0.1.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.
@@ -34,7 +34,10 @@ export class MockAgentBackend {
34
34
  }
35
35
 
36
36
  /** addJsonResponse adds a mock JSON response. */
37
- addJsonResponse(data: Record<string, unknown>, options?: Partial<MockResponse>): this {
37
+ addJsonResponse(
38
+ data: Record<string, unknown>,
39
+ options?: Partial<MockResponse>,
40
+ ): this {
38
41
  return this.addResponse({
39
42
  response: JSON.stringify(data, null, 2),
40
43
  ...options,
@@ -76,7 +79,7 @@ export class MockAgentBackend {
76
79
  for (let i = 0; i < this.responses.length; i++) {
77
80
  const r = this.responses[i]
78
81
  if (!r) continue
79
-
82
+
80
83
  if (!r.match) {
81
84
  response = r
82
85
  responseIndex = i
@@ -116,7 +119,8 @@ export class MockAgentBackend {
116
119
 
117
120
  return {
118
121
  text: response.response ?? '',
119
- sessionId: response.sessionId ?? options.sessionId ?? this.defaultSessionId,
122
+ sessionId:
123
+ response.sessionId ?? options.sessionId ?? this.defaultSessionId,
120
124
  }
121
125
  }
122
126
 
@@ -127,12 +131,14 @@ export class MockAgentBackend {
127
131
  }
128
132
 
129
133
  /** createMockContext creates a test execution context. */
130
- export function createMockContext(overrides?: Partial<{
131
- sessionId: string
132
- defaultModel: { providerID: string; modelID: string }
133
- defaultAgent: string
134
- timeoutSec: number
135
- }>) {
134
+ export function createMockContext(
135
+ overrides?: Partial<{
136
+ sessionId: string
137
+ defaultModel: { providerID: string; modelID: string }
138
+ defaultAgent: string
139
+ timeoutSec: number
140
+ }>,
141
+ ) {
136
142
  return {
137
143
  sessionId: overrides?.sessionId,
138
144
  defaultModel: overrides?.defaultModel ?? {
@@ -145,12 +151,14 @@ export function createMockContext(overrides?: Partial<{
145
151
  }
146
152
 
147
153
  /** generateMockOutputs creates mock output data based on a schema. */
148
- export function generateMockOutputs(schema: Record<string, FieldConfig>): Record<string, unknown> {
154
+ export function generateMockOutputs(
155
+ schema: Record<string, FieldConfig>,
156
+ ): Record<string, unknown> {
149
157
  const result: Record<string, unknown> = {}
150
158
  for (const [name, config] of Object.entries(schema)) {
151
159
  // Use constructor name for type detection (works across zod versions)
152
160
  const typeName = config.type.constructor.name
153
-
161
+
154
162
  switch (typeName) {
155
163
  case 'ZodString':
156
164
  result[name] = `mock_${name}`
@@ -4,7 +4,7 @@
4
4
  * Core type definitions for the Declarative Self-Improving TypeScript SDK.
5
5
  */
6
6
 
7
- import type { z } from 'zod'
7
+ import type { z } from 'zod/v4'
8
8
 
9
9
  // ============================================================================
10
10
  // Model Configuration
@@ -132,15 +132,15 @@ export interface SignatureDef<
132
132
 
133
133
  /** Infer the input type from a signature definition. */
134
134
  export type InferInputs<S extends SignatureDef<any, any>> =
135
- S extends SignatureDef<infer I, any>
136
- ? { [K in keyof I]: z.infer<I[K]['type']> }
137
- : never
135
+ S extends SignatureDef<infer I, any> ?
136
+ { [K in keyof I]: z.infer<I[K]['type']> }
137
+ : never
138
138
 
139
139
  /** Infer the output type from a signature definition. */
140
140
  export type InferOutputs<S extends SignatureDef<any, any>> =
141
- S extends SignatureDef<any, infer O>
142
- ? { [K in keyof O]: z.infer<O[K]['type']> }
143
- : never
141
+ S extends SignatureDef<any, infer O> ?
142
+ { [K in keyof O]: z.infer<O[K]['type']> }
143
+ : never
144
144
 
145
145
  // ============================================================================
146
146
  // Retry Configuration
File without changes