@anureo/workflow 0.3.2 → 0.3.4

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,69 +1,32 @@
1
1
  import { mock } from 'bun:test'
2
2
  import * as fs from 'node:fs/promises'
3
- import { createClient, HarnessSdkError } from '@anureo/sdk'
3
+ import { randomUUID } from 'node:crypto'
4
+ import { createClient } from '@anureo/sdk'
4
5
  import { createScriptedAdapter } from '@anureo/conformance'
5
- import type { JournalEvent } from '../persistence/records'
6
6
 
7
7
  const [directory, phase] = process.argv.slice(2) as [string, string]
8
8
  const originalRename = fs.rename
9
- // workflow.test.ts spawns a fresh process per crash point. Install the mock before
10
- // importing workflow so atomic publication uses the injected rename in this process.
11
- mock.module('node:fs/promises', () => ({ ...fs, rename: renameAtCrashBoundary }))
12
- const { workflow, agent } = await import('../index')
13
-
14
- const adapter = createScriptedAdapter({
15
- async execute(call) {
16
- if (phase === 'unpublished-unknown' && call.method === 'input/submit' && 'submissionId' in call.params) {
17
- throw new HarnessSdkError('NATIVE_FAILED', 'unknown', false, true)
18
- }
19
- if (phase === 'after-later-result' && call.method === 'input/submit' && 'input' in call.params
20
- && call.params.input.some(part => part.type === 'text' && part.text === 'work')) {
21
- // Hold the first call at started while the second reaches durable completion.
22
- await new Promise<never>(() => {})
23
- }
24
- return undefined
25
- },
26
- })
27
- const client = await createClient({ adapter, identity: { adapterId: 'scripted', runtimeConfigId: 'crash-fixture' } })
28
- try {
29
- await workflow({ directory, name: 'crash-test', revision: '1', input: {}, runId: 'crashed',
30
- resumeFrom: phase === 'after-retry' ? 'source' : undefined }, async () => {
31
- if (phase === 'after-retry') {
32
- await agent('prefix', { client, cwd: directory })
33
- await agent('work', { client, cwd: directory })
34
- process.kill(process.pid, 'SIGKILL')
35
- }
36
- const first = agent('work', { client, cwd: directory })
37
- if (phase !== 'after-later-result') return first
38
- await agent('later', { client, cwd: directory })
39
- process.kill(process.pid, 'SIGKILL')
40
- return first
41
- })
42
- } catch (error) {
43
- const codes = error instanceof HarnessSdkError ? error.details?.failureCodes : undefined
44
- if (phase !== 'unpublished-unknown' || !(error instanceof HarnessSdkError)
45
- || !error.outcomeUnknown || !Array.isArray(codes) || !codes.includes('WORKFLOW_STORAGE_FAILED')) throw error
46
- } finally {
47
- await client.dispose()
48
- }
49
-
50
- /** Replace fs.rename for atomicPublish. Kill the process before the selected rename can
51
- * publish the started marker, agent result or completed manifest. Unselected renames
52
- * use the original operation and propagate its failures. */
53
- async function renameAtCrashBoundary(from: string, to: string): Promise<void> {
9
+ let journalPublishes = 0
10
+ mock.module('node:fs/promises', () => ({ ...fs, rename: async (from: string, to: string) => {
54
11
  const target = to.replaceAll('\\', '/')
55
12
  if (target.endsWith('/journal.json')) {
56
- const pending = JSON.parse(await fs.readFile(from, 'utf8')) as JournalEvent[]
57
- const event = pending.at(-1)
58
- if ((phase === 'before-started' && event?.type === 'started')
59
- || (phase === 'after-execute' && event?.type === 'result')) process.kill(process.pid, 'SIGKILL')
60
- if (phase === 'unpublished-unknown' && event?.type === 'failed' && event.outcomeUnknown) {
61
- throw new Error('Injected journal replacement failure')
62
- }
13
+ journalPublishes++
14
+ if (phase === 'before-started' && journalPublishes === 2) process.kill(process.pid, 'SIGKILL')
15
+ if (phase === 'after-execute' && journalPublishes === 3) process.kill(process.pid, 'SIGKILL')
63
16
  }
64
17
  if (phase === 'before-final' && target.endsWith('/run.json')) {
65
18
  const value = JSON.parse(await fs.readFile(from, 'utf8'))
66
19
  if (value.status === 'completed') process.kill(process.pid, 'SIGKILL')
67
20
  }
68
21
  await originalRename(from, to)
22
+ } }))
23
+ const { workflow, agent } = await import('../index')
24
+
25
+ const adapter = createScriptedAdapter()
26
+ const client = await createClient({ adapter, identity: { adapterId: 'scripted', runtimeConfigId: 'crash-fixture' } })
27
+ try {
28
+ await workflow({ directory, name: 'crash-test', revision: '1', input: {}, runId: 'crashed' }, async () =>
29
+ agent('work', { client, cwd: directory }))
30
+ } finally {
31
+ await client.dispose()
69
32
  }
package/src/index.ts CHANGED
@@ -1,9 +1,8 @@
1
- /** Application entry point for agent execution, concurrent composition, and durable runs. */
2
- export { agent } from './agent'
3
- export type { AgentOptions } from './agent-execution'
4
-
1
+ export { agent, type AgentOptions } from './agent'
5
2
  export { parallel } from './parallel'
6
3
  export { pipeline } from './pipeline'
7
-
8
4
  export { workflow } from './workflow'
9
- export type { WorkflowContext, WorkflowOptions, WorkflowResult } from './workflow-types'
5
+ export { journaledCall, type JournaledCall } from './journal-call'
6
+ export { prepareOutputSchema } from './output-schema'
7
+ export { isDroppedOutcome } from './agent-outcome'
8
+ export type { WorkflowOptions, WorkflowContext, WorkflowResult } from './workflow-types'
@@ -0,0 +1,68 @@
1
+ import { describe, expect, test } from 'bun:test'
2
+ import { journaledCall } from './journal-call'
3
+ import { workflow } from './workflow'
4
+ import { mkdtemp } from 'node:fs/promises'
5
+ import { tmpdir } from 'node:os'
6
+ import { join } from 'node:path'
7
+ import { HarnessSdkError } from '@anureo/sdk'
8
+
9
+ describe('journaledCall', () => {
10
+ test('executes unbundled outside workflow() and journals inside it', async () => {
11
+ const unbundled = await journaledCall({ prompt: 'p', canonical: { a: 1 } }, async agentId => {
12
+ expect(typeof agentId).toBe('string')
13
+ return 'outside'
14
+ })
15
+ expect(unbundled).toBe('outside')
16
+
17
+ let calls = 0
18
+ const outcome = await workflow({ name: 'wf', revision: '1', input: { n: 1 } }, async () => {
19
+ calls++
20
+ const first = await journaledCall({ prompt: 'p1', canonical: { a: 1 } }, async () => 'one')
21
+ const second = await journaledCall({ prompt: 'p2', canonical: { a: 2 } }, async () => 'two')
22
+ return [first, second]
23
+ })
24
+ expect(calls).toBe(1)
25
+ expect(outcome.status).toBe('completed')
26
+ expect(outcome.result).toEqual(['one', 'two'])
27
+ })
28
+
29
+ test('memorizes by prompt and canonical options inside one journal chain', async () => {
30
+ const directory = await mkdtemp(join(tmpdir(), 'wf-journal-'))
31
+ const executions: string[] = []
32
+ const body = async () => {
33
+ const a = await journaledCall({ prompt: 'same', canonical: { model: 'm1' } }, async () => { executions.push('m1'); return 'r1' })
34
+ const b = await journaledCall({ prompt: 'same', canonical: { model: 'm2' } }, async () => { executions.push('m2'); return 'r2' })
35
+ return [a, b]
36
+ }
37
+ const first = await workflow({ name: 'wf', revision: '1', directory, input: null }, body)
38
+ expect(first.result).toEqual(['r1', 'r2'])
39
+ expect(executions).toEqual(['m1', 'm2'])
40
+ // A fresh run in a new directory re-executes; the same directory resumed by
41
+ // runId replays both results without executing.
42
+ const second = await workflow({ name: 'wf', revision: '1', directory, input: null, runId: 'again' }, body)
43
+ expect(second.result).toEqual(['r1', 'r2'])
44
+ expect(executions).toEqual(['m1', 'm2', 'm1', 'm2'])
45
+ })
46
+
47
+ test('journals dropped null outcomes and thrown failures with their codes', async () => {
48
+ const directory = await mkdtemp(join(tmpdir(), 'wf-journal-'))
49
+ const outcome = await workflow({ name: 'wf', revision: '1', directory, input: null }, async () => {
50
+ const dropped = await journaledCall({ prompt: 'drop', canonical: {}, droppedCode: 'STEP_DROPPED' }, async () => null)
51
+ const failed = await journaledCall<string>({ prompt: 'fail', canonical: {}, failureCode: 'STEP_FAILED' }, async () => {
52
+ throw new HarnessSdkError('STEP_BOOM')
53
+ }).catch(cause => (cause as HarnessSdkError).code)
54
+ return { dropped, failed }
55
+ })
56
+ expect(outcome.status).toBe('incomplete')
57
+ expect(outcome.result).toEqual({ dropped: null, failed: 'STEP_BOOM' })
58
+ })
59
+ })
60
+
61
+ describe('memory-only workflow runs', () => {
62
+ test('complete without a directory and cannot be resumed', async () => {
63
+ const outcome = await workflow({ name: 'wf', revision: '1', input: { a: 1 } }, async run => run.input)
64
+ expect(outcome).toMatchObject({ status: 'completed', result: { a: 1 } })
65
+ const resume = workflow({ name: 'wf', revision: '1', input: null, resumeFrom: { directory: '', runId: outcome.runId } }, () => 'x')
66
+ await expect(resume).rejects.toThrow('WORKFLOW_RESUME_NOT_FOUND')
67
+ })
68
+ })
@@ -0,0 +1,93 @@
1
+ // Shared journaling for call-shaped workflow steps; agent() and adapter-owned primitives reuse it.
2
+ import { sdkError } from '@anureo/sdk'
3
+ import { currentRun, type RunContext } from './run-context'
4
+ import { isFatal } from './workflow-state'
5
+ import { jsonCopy, type JsonValue } from './persistence/json'
6
+ import { newAgentId, type JournalEvent } from './persistence/journal'
7
+
8
+ export interface JournaledCall {
9
+ /** The step prompt; participates in the journal chain key and cache identity. */
10
+ prompt: string
11
+ /** Canonical semantic options; presentation-only fields must never be included. */
12
+ canonical: JsonValue
13
+ /** Client input-hook revision recorded on started records. */
14
+ inputHookRevision?: string
15
+ /** Journal failure code for a null (dropped) outcome; defaults to AGENT_DROPPED. */
16
+ droppedCode?: string
17
+ /** Journal failure code fallback when a cause carries no SDK error; defaults to AGENT_FAILED. */
18
+ failureCode?: string
19
+ }
20
+
21
+ type JournalKey = ReturnType<import('./persistence/journal').AgentJournal['nextKey']>
22
+
23
+ /**
24
+ * Execute one journaled workflow step. Inside a workflow() body the call is
25
+ * memoized by prompt plus canonical options and chained onto the run journal;
26
+ * outside a body it executes unbundled. Mirrors agent() journaling exactly.
27
+ */
28
+ export function journaledCall<T extends JsonValue>(
29
+ call: JournaledCall,
30
+ execute: (agentId: string) => Promise<T | null>,
31
+ ): Promise<T | null>
32
+ export function journaledCall<T extends JsonValue, R>(
33
+ call: JournaledCall,
34
+ execute: (agentId: string) => Promise<T | null>,
35
+ revive: (stored: JsonValue) => R,
36
+ ): Promise<R | null>
37
+ export async function journaledCall<T extends JsonValue, R = T>(
38
+ call: JournaledCall,
39
+ execute: (agentId: string) => Promise<T | null>,
40
+ revive?: (stored: JsonValue) => R,
41
+ ): Promise<(T | R) | null> {
42
+ const run = currentRun()
43
+ if (!run) return execute(newAgentId())
44
+ // The key advances synchronously here: host invocation order fixes the chain.
45
+ const key = run.journal.nextKey(call.prompt, call.canonical)
46
+ return memoized(run, key, call, execute, revive)
47
+ }
48
+
49
+ async function memoized<T extends JsonValue, R>(
50
+ run: RunContext,
51
+ key: JournalKey,
52
+ call: JournaledCall,
53
+ execute: (agentId: string) => Promise<T | null>,
54
+ revive?: (stored: JsonValue) => R,
55
+ ): Promise<(T | R) | null> {
56
+ const { journal, state } = run
57
+ return state.track(async () => {
58
+ state.assertDispatch()
59
+ const conflict = journal.resumeConflict(key, call.inputHookRevision)
60
+ if (conflict) {
61
+ state.stop(conflict)
62
+ throw conflict
63
+ }
64
+ const hit = journal.resultFor(key)
65
+ if (hit !== undefined) {
66
+ return revive ? revive(hit) : (hit as T)
67
+ }
68
+ journal.beginExecution(key)
69
+ const agentId = newAgentId()
70
+ await journal.append({ type: 'started', key, agentId, ...(call.inputHookRevision === undefined ? {} : { inputHookRevision: call.inputHookRevision }) } satisfies JournalEvent)
71
+ state.assertDispatch()
72
+ try {
73
+ const value = await execute(agentId)
74
+ if (value === null) {
75
+ await journal.append({ type: 'failed', key, agentId, code: call.droppedCode ?? 'AGENT_DROPPED', outcomeUnknown: false } satisfies JournalEvent)
76
+ state.noteIncomplete()
77
+ return null
78
+ }
79
+ const stored = jsonCopy(value) as JsonValue
80
+ await journal.append({ type: 'result', key, agentId, result: stored } satisfies JournalEvent)
81
+ return revive ? revive(stored) : (jsonCopy(stored) as T)
82
+ } catch (cause) {
83
+ const error = sdkError(cause, call.failureCode ?? 'AGENT_FAILED')
84
+ if (isFatal(error)) state.stop(error)
85
+ // The storage layer may have published a terminal record already; never
86
+ // append a contradictory failure after a storage error.
87
+ if (error.code !== 'WORKFLOW_STORAGE_FAILED') {
88
+ await journal.append({ type: 'failed', key, agentId, code: error.code, outcomeUnknown: error.outcomeUnknown === true } satisfies JournalEvent)
89
+ }
90
+ throw error
91
+ }
92
+ }) as Promise<(T | R) | null>
93
+ }
@@ -0,0 +1,71 @@
1
+ import { expect, test } from 'bun:test'
2
+ import { mkdtemp, readFile, rm } from 'node:fs/promises'
3
+ import { tmpdir } from 'node:os'
4
+ import { join } from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+ import { z } from 'zod'
7
+ import { createClient } from '@anureo/sdk'
8
+ import { createClaudeAdapter } from '@anureo/adapter-claude'
9
+ import { createCodexAdapter } from '@anureo/adapter-codex'
10
+ import { agent, parallel } from './index'
11
+
12
+ test('Zod agent crosses the official Claude SDK and a real JSONL process in fresh native sessions', async () => {
13
+ const cwd = await mkdtemp(join(tmpdir(), 'anureo-workflow-native-'))
14
+ const log = join(cwd, 'initialize.jsonl')
15
+ const client = await createClient({ adapter: createClaudeAdapter({
16
+ command: fileURLToPath(new URL('../../adapter/claude/tests/fixtures/fake-claude.mjs', import.meta.url)),
17
+ executableRuntime: 'node', stateDir: join(cwd, 'state'), env: { FAKE_SCHEMA_PROBE: '1', FAKE_SCHEMA_LOG: log },
18
+ }), identity: { adapterId: 'claude', runtimeConfigId: 'workflow' } })
19
+ try {
20
+ const schema = z.object({ answer: z.literal(42) })
21
+ expect(await parallel([
22
+ () => agent('first', { client, cwd, schema }),
23
+ () => agent('second', { client, cwd, schema }),
24
+ ])).toEqual([{ answer: 42 }, { answer: 42 }])
25
+ const records = (await readFile(log, 'utf8')).trim().split('\n').map(line => JSON.parse(line))
26
+ const structured = records.filter(record => record.schema)
27
+ expect(structured).toHaveLength(2)
28
+ expect(new Set(structured.map(record => record.sessionId)).size).toBe(2)
29
+ expect(structured[0].schema).toMatchObject({ type: 'object', properties: { answer: { const: 42 } } })
30
+ } finally {
31
+ await client.dispose()
32
+ await rm(cwd, { recursive: true, force: true, maxRetries: 20, retryDelay: 100 })
33
+ }
34
+ }, 15_000)
35
+
36
+ test('Claude nominal success without native structured_output never falls back to prose', async () => {
37
+ const cwd = await mkdtemp(join(tmpdir(), 'anureo-workflow-missing-'))
38
+ const client = await createClient({ adapter: createClaudeAdapter({
39
+ command: fileURLToPath(new URL('../../adapter/claude/tests/fixtures/fake-claude.mjs', import.meta.url)), executableRuntime: 'node', stateDir: cwd,
40
+ }), identity: { adapterId: 'claude', runtimeConfigId: 'missing' } })
41
+ try {
42
+ await expect(agent('missing', { client, cwd, schema: z.object({ answer: z.number() }) })).rejects.toMatchObject({ code: 'CLAUDE_STRUCTURED_OUTPUT_MISSING' })
43
+ } finally {
44
+ await client.dispose()
45
+ await rm(cwd, { recursive: true, force: true, maxRetries: 20, retryDelay: 100 })
46
+ }
47
+ }, 15_000)
48
+
49
+ const codexCases = [
50
+ { scenario: 'workflow-schema', expected: { answer: 42 }, description: 'returns a successful structured result' },
51
+ { scenario: 'auth-expired', expected: null, description: 'returns null when authentication expires' },
52
+ ] as const
53
+
54
+ for (const { scenario, expected, description } of codexCases) test(`Zod agent crosses Codex native process: ${description}`, async () => {
55
+ const cwd = await mkdtemp(join(tmpdir(), 'anureo-workflow-codex-'))
56
+ const log = join(cwd, 'requests.jsonl')
57
+ const client = await createClient({ adapter: createCodexAdapter({ command: process.execPath,
58
+ args: [fileURLToPath(new URL('../../adapter/codex/tests/fake-app-server.mjs', import.meta.url))],
59
+ version: '0.164.0', env: { FAKE_SCENARIO: scenario, FAKE_LOG_FILE: log },
60
+ }), identity: { adapterId: 'codex', runtimeConfigId: scenario } })
61
+ try {
62
+ const value = await agent('answer', { client, cwd, schema: z.object({ answer: z.literal(42) }) })
63
+ expect(value).toEqual(expected)
64
+ const starts = (await readFile(log, 'utf8')).trim().split('\n').map(line => JSON.parse(line)).filter(frame => frame.method === 'turn/start')
65
+ expect(starts).toHaveLength(1)
66
+ expect(starts[0].params.outputSchema).toMatchObject({ type: 'object', properties: { answer: { const: 42 } } })
67
+ } finally {
68
+ await client.dispose()
69
+ await rm(cwd, { recursive: true, force: true, maxRetries: 20, retryDelay: 100 })
70
+ }
71
+ }, 15_000)
@@ -64,29 +64,11 @@ test('schema-like keys in business enum and default data are not treated as sche
64
64
  test('raw JSON is validated before Zod can strip extra fields or supply defaults', async () => {
65
65
  const output = prepareOutputSchema(z.object({ count: z.number().default(3) }))
66
66
  expect(await output.parse('{"count":4}')).toEqual({ count: 4 })
67
- await expect(output.parse('{}')).rejects.toMatchObject({
68
- code: 'AGENT_STRUCTURED_OUTPUT_INVALID',
69
- retryable: false,
70
- outcomeUnknown: false,
71
- details: { issues: [{ path: '/count', code: 'required' }] },
72
- })
73
- for (const text of ['{"count":4,"extra":1}', '{"count":"4"}', 'null', '[]']) {
67
+ for (const text of ['{}', '{"count":4,"extra":1}', '{"count":"4"}', 'null', '[]']) {
74
68
  await expect(output.parse(text)).rejects.toMatchObject({ code: 'AGENT_STRUCTURED_OUTPUT_INVALID', retryable: false, outcomeUnknown: false })
75
69
  }
76
70
  })
77
71
 
78
- test('raw JSON issues identify missing and extra fields with escaped pointer segments', async () => {
79
- const output = prepareOutputSchema(z.object({ nested: z.object({ 'a/b': z.number(), 'a~b': z.number() }) }))
80
- await expect(output.parse('{"nested":{"extra~/":"private value"}}')).rejects.toMatchObject({
81
- code: 'AGENT_STRUCTURED_OUTPUT_INVALID',
82
- details: { issues: [
83
- { path: '/nested/a~1b', code: 'required' },
84
- { path: '/nested/a~0b', code: 'required' },
85
- { path: '/nested/extra~0~1', code: 'additionalProperties' },
86
- ] },
87
- })
88
- })
89
-
90
72
  test('missing and malformed output remain distinct failures without recovering prose', async () => {
91
73
  const output = prepareOutputSchema(z.object({ count: z.number() }))
92
74
  await expect(output.parse(' ')).rejects.toMatchObject({ code: 'AGENT_STRUCTURED_OUTPUT_MISSING' })
@@ -108,11 +90,7 @@ test('sync and async refinements and formats validate locally and sanitize custo
108
90
  } catch (error) {
109
91
  failure = error
110
92
  }
111
- expect(failure).toMatchObject({
112
- code: 'AGENT_STRUCTURED_OUTPUT_INVALID',
113
- outcomeUnknown: false,
114
- details: { issues: [{ path: [], code: 'custom' }] },
115
- })
93
+ expect(failure).toMatchObject({ code: 'AGENT_STRUCTURED_OUTPUT_INVALID', outcomeUnknown: false })
116
94
  expect(JSON.stringify(failure)).not.toContain('private-')
117
95
  }
118
96
  await expect(output.parse('{"count":1,"email":"bad"}')).rejects.toMatchObject({ code: 'AGENT_STRUCTURED_OUTPUT_INVALID' })
@@ -121,21 +99,15 @@ test('sync and async refinements and formats validate locally and sanitize custo
121
99
  })
122
100
 
123
101
  test('definite generated contradictions and external references are rejected', () => {
124
- const cases: Array<{ schema: z.ZodObject; rule: string }> = [
125
- { schema: z.object({ a: z.string().meta({ minLength: 5, maxLength: 1 }) }), rule: 'unsatisfiableBounds' },
126
- { schema: z.object({ a: z.number().meta({ minimum: 5, maximum: 1 }) }), rule: 'unsatisfiableBounds' },
127
- { schema: z.object({ a: z.number().meta({ minimum: 1, exclusiveMaximum: 1 }) }), rule: 'unsatisfiableBounds' },
128
- { schema: z.object({ a: z.array(z.string()).meta({ minItems: 3, maxItems: 1 }) }), rule: 'unsatisfiableBounds' },
129
- { schema: z.object({ a: z.string().meta({ $ref: 'https://private.example/schema' }) }), rule: 'externalOrAsyncSchema' },
130
- { schema: z.object({ a: z.string() }).meta({ required: ['missing'] }), rule: 'optionalProperty' },
131
- {
132
- schema: z.object({}).meta({ required: ['missing'], patternProperties: { '^allowed$': { type: 'string' } } }),
133
- rule: 'unsatisfiableRequired',
134
- },
135
- ]
136
- for (const { schema, rule } of cases) {
137
- expect(() => prepareOutputSchema(schema)).toThrow(expect.objectContaining({ code: 'INVALID_PARAMS', details: { rule } }))
138
- }
102
+ for (const schema of [
103
+ z.object({ a: z.string().meta({ minLength: 5, maxLength: 1 }) }),
104
+ z.object({ a: z.number().meta({ minimum: 5, maximum: 1 }) }),
105
+ z.object({ a: z.number().meta({ minimum: 1, exclusiveMaximum: 1 }) }),
106
+ z.object({ a: z.array(z.string()).meta({ minItems: 3, maxItems: 1 }) }),
107
+ z.object({ a: z.string().meta({ $ref: 'https://private.example/schema' }) }),
108
+ z.object({ a: z.string() }).meta({ required: ['missing'] }),
109
+ z.object({}).meta({ required: ['missing'], patternProperties: { '^allowed$': { type: 'string' } } }),
110
+ ]) expect(() => prepareOutputSchema(schema)).toThrow(expect.objectContaining({ code: 'INVALID_PARAMS' }))
139
111
  // Numeric bounds do not contradict a string instance.
140
112
  expect(prepareOutputSchema(z.object({ a: z.string().meta({ minimum: 5, maximum: 1 }) })).schema.type).toBe('object')
141
113
  expect(prepareOutputSchema(z.object({}).meta({ required: ['allowed'], patternProperties: { '^allowed$': { type: 'string' } } })).schema.type).toBe('object')
@@ -149,11 +121,6 @@ test('user schema callbacks cannot expose their exception or claim execution unc
149
121
  } catch (cause) {
150
122
  failure = cause
151
123
  }
152
- expect(failure).toMatchObject({
153
- code: 'INVALID_PARAMS',
154
- retryable: false,
155
- outcomeUnknown: false,
156
- details: { rule: 'invalidOrUnrepresentableSchema' },
157
- })
124
+ expect(failure).toMatchObject({ code: 'INVALID_PARAMS', retryable: false, outcomeUnknown: false })
158
125
  expect(String(failure)).not.toContain('private value')
159
126
  })