@theoremjs/agents 0.3.4-next.853.gebc3c60 → 0.3.4-next.863.gb601f58

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,7 +1,7 @@
1
1
  /** Values that fill a label template's `{param}` placeholders. */
2
2
  export type LabelParams = Record<string, string | number>;
3
3
  /** Keys are stable API. */
4
- export declare const LABEL_KEYS: readonly ["provider.decision_failed", "provider.decision_unavailable", "provider.decision_model_missing", "provider.decision_ended", "provider.decision_images_off", "provider.decision_box_model", "provider.budget_exhausted", "provider.adapter_version", "provider.adapter_methods", "provider.adapter_schemas", "provider.fallback_slot", "provider.model_fallback_slot", "provider.host_model", "turn.media_refused_image", "turn.media_refused_video", "turn.media_refused_file", "provider.turn_profile", "provider.model_binding_missing", "provider.session_closed", "provider.settled_call", "provider.session_unavailable", "provider.live_input", "provider.tool_cancel_missing", "provider.kernel_gate", "provider.event_invalid", "provider.response_identity", "provider.credential_resolution", "provider.credential_shape", "provider.stored_continuation", "provider.continuation_mismatch", "provider.continuation_contract", "provider.stateless_history", "provider.events_after_completion", "provider.duplicate_call", "provider.tool_cancel_live", "provider.complete_unavailable", "provider.parallel_tools", "provider.binding_identity", "provider.profile_type", "provider.event_type", "provider.feature", "provider.input_kind", "provider.output_kind", "provider.builtin", "provider.credential_missing", "provider.profile_configuration", "continue.instruction", "canary.bind_note", "user_data.note", "context.note", "taint.blocked", "taint.reason_steered", "taint.reason_tainted", "taint.destination_blocked", "taint.destination_confirm", "advisory.notice_elevated", "advisory.notice_high", "advisory.guidance", "attachments.too_many_files", "attachments.too_many_of_kind", "attachments.file_too_large", "attachments.turn_too_large", "attachments.not_accepted", "attachments.mime_not_allowed", "attachments.limits_unconfigured", "quota.exhausted", "quota.busy", "error.config", "error.request", "error.conflict", "error.not_found", "error.input", "error.action", "error.auth", "error.rate_limit", "error.busy", "error.unsupported", "error.unavailable", "error.bad_response", "error.network", "error.timeout", "error.safety", "error.blocked", "error.declined", "error.failed", "error.cancelled", "error.internal", "repair.default_guidance", "repair.items_guidance", "repair.cut_off_guidance", "repair.prompt_header", "repair.prompt_intro", "repair.prompt_instructions", "repair.history_heading", "repair.section_previous_output", "repair.section_validator_rejection", "repair.section_repair_guidance", "repair.section_instructions", "structured.answer_tool", "structured.answer_missing", "structured.cut_off", "structured.not_json", "compaction.request", "compaction.tool_call", "compaction.tool_result", "compaction.tool_files", "decision.box_image", "detect.blocked", "detect.call_blocked", "detect.output_blocked", "detect.shown_blocked", "detect.hint.ids", "detect.hint.financial", "detect.hint.network", "detect.hint.credentials", "detect.hint.email", "detect.hint.phone", "detect.hint.bank_account", "detect.hint.injection", "detect.hint.canary_leak", "detect.hint.prompt_leak", "detect.hint.marker_leak", "detect.hint.ungiven_images", "detect.hint.ungiven_links", "detect.hint.tool_leak", "detect.hint.own", "egress.default_repair_guidance", "egress.refusal", "egress.refusal_cut", "egress.rejection", "egress.rejection_found", "egress.hint_unscannable", "egress.hint_provider_tool_leak", "thought.omitted_image", "thought.omitted_link", "thought.omitted_instructions", "session.abandon_gated", "session.tool_denied", "session.tool_aborted", "session.sign_in", "sign_in.link", "sign_in.pending", "sign_in.done", "sign_in.declined", "sign_in.expired", "sign_in.out_of_scope", "session.gate_expired", "session.provider_state_unowned", "session.conversation_unknown", "session.full", "session.busy", "session.turn_ended", "session.gate_pending", "session.part_skipped", "live.session_ended", "voice.unsupported", "voice.permission", "voice.unavailable", "voice.failed", "voice.empty", "stop.cancelled", "stop.interrupted", "stop.length", "stop.filtered", "stop.provider_error", "stop.stream_incomplete", "stop.step_limit", "composer.model", "composer.effort", "tool.awaiting_user", "tool.completed_hidden", "tool.t2_loader_needs_snapshot", "tool.t2_loader_shape", "tool.t2_loader_output_invalid", "tool.execution_uncertain", "tool.input_invalid", "tool.input_invalid_after_mutate", "tool.output_invalid_after_mutate", "tool.handler_no_output", "tool.did_not_run", "tool.unreachable", "tool.page_no_answer", "tool.page_timed_out", "tool.output_invalid", "tool.not_loaded_t2", "tool.wait_unknown", "tool.wait_cycle", "tool.after_field", "tool.background_field", "tool.background_started", "tool.late_result", "tool.not_visible", "tool.builtin_not_enabled", "tool.provider_native", "tool.not_registered", "tool.builtin_needs_snapshot", "tool.not_allowed", "tool.not_eligible", "tool.unsupported_type", "tool.agent_call_limit", "tool.agent_failed", "tool.activity_failed", "protocol.not_served", "protocol.profile_type", "protocol.options", "protocol.option_clash", "protocol.base_options", "protocol.id_clash", "protocol.ws_headers", "protocol.builtin_unwritten", "protocol.provider_missing", "protocol.connection", "protocol.part_schema", "protocol.part_invalid", "protocol.key_invalid", "protocol.no_key", "protocol.reply_shape", "protocol.endpoint_url", "protocol.endpoint_host", "protocol.http", "protocol.no_operation", "protocol.definition", "protocol.provider_id_clash", "protocol.history_needed"];
4
+ export declare const LABEL_KEYS: readonly ["provider.decision_failed", "provider.decision_unavailable", "provider.decision_model_missing", "provider.decision_ended", "provider.decision_images_off", "provider.decision_box_model", "provider.budget_exhausted", "provider.adapter_version", "provider.adapter_methods", "provider.adapter_schemas", "provider.fallback_slot", "provider.model_fallback_slot", "provider.host_model", "turn.media_refused_image", "turn.media_refused_video", "turn.media_refused_file", "provider.turn_profile", "provider.model_binding_missing", "provider.session_closed", "provider.settled_call", "provider.session_unavailable", "provider.live_input", "provider.tool_cancel_missing", "provider.kernel_gate", "provider.event_invalid", "provider.response_identity", "provider.credential_resolution", "provider.credential_shape", "provider.stored_continuation", "provider.continuation_mismatch", "provider.continuation_contract", "provider.stateless_history", "provider.events_after_completion", "provider.duplicate_call", "provider.tool_cancel_live", "provider.complete_unavailable", "provider.parallel_tools", "provider.binding_identity", "provider.profile_type", "provider.event_type", "provider.feature", "provider.input_kind", "provider.output_kind", "provider.builtin", "provider.credential_missing", "provider.profile_configuration", "continue.instruction", "canary.bind_note", "user_data.note", "context.note", "taint.blocked", "taint.reason_steered", "taint.reason_tainted", "taint.destination_blocked", "taint.destination_confirm", "advisory.notice_elevated", "advisory.notice_high", "advisory.guidance", "attachments.too_many_files", "attachments.too_many_of_kind", "attachments.file_too_large", "attachments.turn_too_large", "attachments.not_accepted", "attachments.mime_not_allowed", "attachments.limits_unconfigured", "quota.exhausted", "quota.busy", "error.config", "error.request", "error.conflict", "error.not_found", "error.input", "error.action", "error.auth", "error.rate_limit", "error.busy", "error.unsupported", "error.unavailable", "error.bad_response", "error.network", "error.timeout", "error.safety", "error.blocked", "error.declined", "error.failed", "error.cancelled", "error.internal", "repair.default_guidance", "repair.items_guidance", "repair.cut_off_guidance", "repair.prompt_header", "repair.prompt_intro", "repair.prompt_instructions", "repair.history_heading", "repair.section_previous_output", "repair.section_validator_rejection", "repair.section_repair_guidance", "repair.section_instructions", "structured.answer_tool", "structured.answer_missing", "structured.cut_off", "structured.not_json", "compaction.request", "compaction.tool_call", "compaction.tool_result", "compaction.tool_files", "decision.box_image", "detect.blocked", "detect.call_blocked", "detect.output_blocked", "detect.shown_blocked", "detect.hint.ids", "detect.hint.financial", "detect.hint.network", "detect.hint.credentials", "detect.hint.email", "detect.hint.phone", "detect.hint.bank_account", "detect.hint.injection", "detect.hint.canary_leak", "detect.hint.prompt_leak", "detect.hint.marker_leak", "detect.hint.ungiven_images", "detect.hint.ungiven_links", "detect.hint.tool_leak", "detect.hint.own", "egress.default_repair_guidance", "egress.refusal", "egress.refusal_cut", "egress.rejection", "egress.rejection_found", "egress.hint_unscannable", "egress.hint_provider_tool_leak", "thought.omitted_image", "thought.omitted_link", "thought.omitted_instructions", "session.abandon_gated", "session.tool_denied", "session.tool_aborted", "session.sign_in", "sign_in.link", "sign_in.pending", "sign_in.done", "sign_in.declined", "sign_in.expired", "sign_in.out_of_scope", "session.gate_expired", "session.provider_state_unowned", "session.conversation_unknown", "session.full", "session.busy", "session.turn_ended", "session.gate_pending", "session.part_skipped", "live.session_ended", "voice.unsupported", "voice.permission", "voice.unavailable", "voice.failed", "voice.empty", "stop.cancelled", "stop.interrupted", "stop.length", "stop.filtered", "stop.provider_error", "stop.stream_incomplete", "stop.step_limit", "stop.answer_missing", "composer.model", "composer.effort", "tool.awaiting_user", "tool.completed_hidden", "tool.t2_loader_needs_snapshot", "tool.t2_loader_shape", "tool.t2_loader_output_invalid", "tool.execution_uncertain", "tool.input_invalid", "tool.input_invalid_after_mutate", "tool.output_invalid_after_mutate", "tool.handler_no_output", "tool.did_not_run", "tool.unreachable", "tool.page_no_answer", "tool.page_timed_out", "tool.output_invalid", "tool.not_loaded_t2", "tool.wait_unknown", "tool.wait_cycle", "tool.after_field", "tool.background_field", "tool.background_started", "tool.late_result", "tool.not_visible", "tool.builtin_not_enabled", "tool.provider_native", "tool.not_registered", "tool.builtin_needs_snapshot", "tool.not_allowed", "tool.not_eligible", "tool.unsupported_type", "tool.agent_call_limit", "tool.agent_failed", "tool.activity_failed", "protocol.not_served", "protocol.profile_type", "protocol.options", "protocol.option_clash", "protocol.base_options", "protocol.id_clash", "protocol.ws_headers", "protocol.builtin_unwritten", "protocol.provider_missing", "protocol.connection", "protocol.part_schema", "protocol.part_invalid", "protocol.key_invalid", "protocol.no_key", "protocol.reply_shape", "protocol.endpoint_url", "protocol.endpoint_host", "protocol.http", "protocol.no_operation", "protocol.definition", "protocol.provider_id_clash", "protocol.history_needed"];
5
5
  /** One of {@linkcode LABEL_KEYS}. */
6
6
  export type LabelKey = (typeof LABEL_KEYS)[number];
7
7
  /**
@@ -10,7 +10,7 @@ export type LabelKey = (typeof LABEL_KEYS)[number];
10
10
  * puts into history. Only these overrides travel to the browser; the rest
11
11
  * (repair prompts, canary, taint, egress) stay on the host.
12
12
  */
13
- export declare const CLIENT_LABEL_KEYS: readonly ["attachments.too_many_files", "attachments.too_many_of_kind", "attachments.file_too_large", "attachments.turn_too_large", "attachments.not_accepted", "attachments.mime_not_allowed", "attachments.limits_unconfigured", "detect.blocked", "error.config", "error.request", "error.conflict", "error.not_found", "error.input", "error.action", "error.auth", "error.rate_limit", "error.busy", "error.unsupported", "error.unavailable", "error.bad_response", "error.network", "error.timeout", "error.safety", "error.blocked", "error.declined", "error.failed", "error.cancelled", "error.internal", "session.abandon_gated", "session.tool_denied", "session.sign_in", "session.gate_expired", "session.turn_ended", "session.gate_pending", "session.part_skipped", "live.session_ended", "tool.awaiting_user", "tool.completed_hidden", "tool.execution_uncertain", "tool.unreachable", "voice.unsupported", "voice.permission", "voice.unavailable", "voice.failed", "voice.empty", "stop.cancelled", "stop.interrupted", "stop.length", "stop.filtered", "stop.provider_error", "stop.stream_incomplete", "stop.step_limit", "composer.model", "composer.effort"];
13
+ export declare const CLIENT_LABEL_KEYS: readonly ["attachments.too_many_files", "attachments.too_many_of_kind", "attachments.file_too_large", "attachments.turn_too_large", "attachments.not_accepted", "attachments.mime_not_allowed", "attachments.limits_unconfigured", "detect.blocked", "error.config", "error.request", "error.conflict", "error.not_found", "error.input", "error.action", "error.auth", "error.rate_limit", "error.busy", "error.unsupported", "error.unavailable", "error.bad_response", "error.network", "error.timeout", "error.safety", "error.blocked", "error.declined", "error.failed", "error.cancelled", "error.internal", "session.abandon_gated", "session.tool_denied", "session.sign_in", "session.gate_expired", "session.turn_ended", "session.gate_pending", "session.part_skipped", "live.session_ended", "tool.awaiting_user", "tool.completed_hidden", "tool.execution_uncertain", "tool.unreachable", "voice.unsupported", "voice.permission", "voice.unavailable", "voice.failed", "voice.empty", "stop.cancelled", "stop.interrupted", "stop.length", "stop.filtered", "stop.provider_error", "stop.stream_incomplete", "stop.step_limit", "stop.answer_missing", "composer.model", "composer.effort"];
14
14
  /**
15
15
  * Lines only {@linkcode overrideLabels} changes: builder and host errors from providers and
16
16
  * protocols, and the decision box hint. A profile's `labels` never reach them.
@@ -170,6 +170,7 @@ export const LABEL_KEYS = [
170
170
  'stop.provider_error',
171
171
  'stop.stream_incomplete',
172
172
  'stop.step_limit',
173
+ 'stop.answer_missing',
173
174
  'composer.model',
174
175
  'composer.effort',
175
176
  'tool.awaiting_user',
@@ -287,6 +288,7 @@ export const CLIENT_LABEL_KEYS = [
287
288
  'stop.provider_error',
288
289
  'stop.stream_incomplete',
289
290
  'stop.step_limit',
291
+ 'stop.answer_missing',
290
292
  'composer.model',
291
293
  'composer.effort',
292
294
  ];
@@ -515,6 +517,7 @@ const DEFAULTS = {
515
517
  'stop.provider_error': 'the model stopped with an error',
516
518
  'stop.stream_incomplete': 'the connection dropped before the reply finished',
517
519
  'stop.step_limit': 'stopped at the step limit, before an answer',
520
+ 'stop.answer_missing': 'the model finished without giving its answer',
518
521
  'composer.model': 'Model',
519
522
  'composer.effort': 'Effort',
520
523
  'tool.awaiting_user': 'Awaiting user input ({kind}): {prompt}',
@@ -745,6 +748,7 @@ export const LABEL_NOTES = {
745
748
  'stop.provider_error': 'Status on a reply the provider ended with an error and no error message.',
746
749
  'stop.stream_incomplete': 'Status on a reply whose stream ended before the model finished.',
747
750
  'stop.step_limit': 'Status on a turn that made its last allowed model call and got no answer.',
751
+ 'stop.answer_missing': 'Status on a turn whose model finished without calling the answer tool, with no repair left.',
748
752
  'composer.model': 'Title of the model picker beside the composer.',
749
753
  'composer.effort': 'Title of the effort picker beside the composer.',
750
754
  'tool.awaiting_user': 'Told to the model when a tool is waiting on the user. Takes {kind} and {prompt}.',
@@ -2,7 +2,7 @@ import { type LabelOverrides } from '../guardrails/labels.js';
2
2
  import type { TurnStop } from '../kernel/types.js';
3
3
  import type { TranscriptBlock } from './types.js';
4
4
  /** The stops that end a reply short of a whole answer. Each is worded by its `stop.<kind>` label. */
5
- export declare const WORDED_STOP_KINDS: readonly ["cancelled", "interrupted", "length", "filtered", "provider_error", "stream_incomplete", "step_limit"];
5
+ export declare const WORDED_STOP_KINDS: readonly ["cancelled", "interrupted", "length", "filtered", "provider_error", "stream_incomplete", "step_limit", "answer_missing"];
6
6
  /** One of {@linkcode WORDED_STOP_KINDS}. */
7
7
  export type WordedStopKind = (typeof WORDED_STOP_KINDS)[number];
8
8
  /**
@@ -9,6 +9,7 @@ export const WORDED_STOP_KINDS = [
9
9
  'provider_error',
10
10
  'stream_incomplete',
11
11
  'step_limit',
12
+ 'answer_missing',
12
13
  ];
13
14
  const WORDED = new Set(WORDED_STOP_KINDS);
14
15
  function isWorded(kind) {
@@ -454,7 +454,7 @@ held) {
454
454
  }
455
455
  const failure = toErrorEvent(new TheoremError('bad_response', `the model ended without calling ${ANSWER_TOOL}`));
456
456
  recordStepEvent(failure, state);
457
- state.lastStop = { kind: 'provider_error' };
457
+ state.lastStop = { kind: 'answer_missing' };
458
458
  if (!held)
459
459
  yield failure;
460
460
  return 'pass';
@@ -1,7 +1,7 @@
1
1
  import { describeError, errorKind } from '../../guardrails/error.js';
2
2
  import { traceBytes, traceContent, traceJson, } from '../../observability/trace-span.js';
3
3
  import { historyMessageParts } from '../interaction-parts.js';
4
- import { isFailedStopKind } from '../stop.js';
4
+ import { isFailedTurnStop } from '../stop.js';
5
5
  import { findLast } from '../util/find-last.js';
6
6
  import { asRecord } from './record.js';
7
7
  import { sumEventTokens } from './usage.js';
@@ -836,7 +836,7 @@ function endTurnSpan(root, end) {
836
836
  const threw = end.thrown !== undefined;
837
837
  if (threw)
838
838
  recordException(root, end.thrown);
839
- const failed = threw || (stop !== undefined && isFailedStopKind(stop));
839
+ const failed = threw || (stop !== undefined && isFailedTurnStop(stop));
840
840
  const failure = threw ? errorKind(end.thrown) : (errorEvent?.errorKind ?? stop);
841
841
  // why: What the host received, beside each call's `output.messages` (what the model produced).
842
842
  const delivered = {
@@ -80,8 +80,8 @@ export const PROFILE_FIELD_PRESENCE = {
80
80
  'outputs.streaming.mode': { unset: 'sse', value: 'sse' },
81
81
  'outputs.streaming.streamThoughts': { unset: 'On', value: true },
82
82
  'turnBehaviour.resumption.allowContinue': {
83
- unset: 'All three',
84
- value: ['length', 'stream_incomplete', 'provider_error'],
83
+ unset: 'All four',
84
+ value: ['length', 'stream_incomplete', 'provider_error', 'answer_missing'],
85
85
  },
86
86
  'turnBehaviour.resumption.autoContinue': {
87
87
  unset: 'length and stream_incomplete',
@@ -9,7 +9,7 @@ import { assertLiveIngressConfigured } from '../engine/live-ingress.js';
9
9
  import { itemSchemaAt, schemaReaches } from '../engine/runner/schema-validation.js';
10
10
  import { outOfScopeFields, profileKeysOf, profileTypesForField } from '../profile-scope.js';
11
11
  import { checkBinding, decisionModelBindingSchema, modelBindingSchema, } from '../protocols/binding.js';
12
- import { CONTEXT_SENDERS, IMAGE_ATTACHMENT_ACCEPT_MIMES, PROFILE_FIELDS, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, PROFILE_TYPES, profileFieldProblems, THINKING_LEVELS, } from '../schema.js';
12
+ import { CONTEXT_SENDERS, CONTINUE_STOP_KINDS, IMAGE_ATTACHMENT_ACCEPT_MIMES, PROFILE_FIELDS, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, PROFILE_TYPES, profileFieldProblems, THINKING_LEVELS, } from '../schema.js';
13
13
  import { isContinueStopKind } from '../stop.js';
14
14
  import { assertSystemLines, systemLinesProblem } from '../system-lines.js';
15
15
  import { profileToolAllow, profileToolsSpec } from '../tools/resolve.js';
@@ -188,7 +188,7 @@ function assertContinueKindList(profileId, path, kinds) {
188
188
  for (const kind of kinds) {
189
189
  if (!isContinueStopKind(kind)) {
190
190
  throw new TheoremError('config', `Profile ${profileId}: turnBehaviour.resumption.${path} may only include ContinueStopKind ` + // labels-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
191
- `(length | stream_incomplete | provider_error); got '${kind}'`);
191
+ `(${CONTINUE_STOP_KINDS.join(' | ')}); got '${kind}'`);
192
192
  }
193
193
  }
194
194
  }
@@ -86,7 +86,7 @@ export declare const CACHE_TTLS: readonly ["5m", "1h"];
86
86
  /** One of {@linkcode CACHE_TTLS}. */
87
87
  export type CacheTtl = (typeof CACHE_TTLS)[number];
88
88
  /** Why a turn stopped, as `done.stop.kind` reports it. */
89
- export declare const TURN_STOP_KINDS: readonly ["completed", "length", "tool", "gate", "filtered", "provider_error", "cancelled", "stream_incomplete", "step_limit", "interrupted", "generation_complete"];
89
+ export declare const TURN_STOP_KINDS: readonly ["completed", "length", "tool", "gate", "filtered", "provider_error", "cancelled", "stream_incomplete", "step_limit", "answer_missing", "interrupted", "generation_complete"];
90
90
  /** One of {@linkcode TURN_STOP_KINDS}. */
91
91
  export type TurnStopKind = (typeof TURN_STOP_KINDS)[number];
92
92
  /** What a text turn's last allowed model call may do, as `turnBehaviour.atStepLimit` sets it. */
@@ -96,7 +96,7 @@ export declare const ITEM_FAIL_ACTIONS: readonly ["drop", "fix"];
96
96
  /** One of {@linkcode STEP_LIMIT_MODES}. */
97
97
  export type StepLimitMode = (typeof STEP_LIMIT_MODES)[number];
98
98
  /** Every other stop resumes by another host path, or not at all. */
99
- export declare const CONTINUE_STOP_KINDS: readonly ["length", "stream_incomplete", "provider_error"];
99
+ export declare const CONTINUE_STOP_KINDS: readonly ["length", "stream_incomplete", "provider_error", "answer_missing"];
100
100
  /** One of {@linkcode CONTINUE_STOP_KINDS}. */
101
101
  export type ContinueStopKind = (typeof CONTINUE_STOP_KINDS)[number];
102
102
  /** The points in a turn where a stage handler runs. */
@@ -92,6 +92,8 @@ export const TURN_STOP_KINDS = [
92
92
  'stream_incomplete',
93
93
  /** The turn made its last allowed model call and that call asked for tools: there is no answer. */
94
94
  'step_limit',
95
+ /** The model finished without calling the answer tool, and no repair was left. */
96
+ 'answer_missing',
95
97
  'interrupted',
96
98
  /** Live: model finished generating audio/text for this utterance; turn may still be open. */
97
99
  'generation_complete',
@@ -101,7 +103,12 @@ export const STEP_LIMIT_MODES = ['stop', 'answer'];
101
103
  /** What happens to a list item its check refuses, as `outputs.validation.items.*.onFail` sets it. */
102
104
  export const ITEM_FAIL_ACTIONS = ['drop', 'fix'];
103
105
  /** Every other stop resumes by another host path, or not at all. */
104
- export const CONTINUE_STOP_KINDS = ['length', 'stream_incomplete', 'provider_error'];
106
+ export const CONTINUE_STOP_KINDS = [
107
+ 'length',
108
+ 'stream_incomplete',
109
+ 'provider_error',
110
+ 'answer_missing',
111
+ ];
105
112
  /** The points in a turn where a stage handler runs. */
106
113
  export const TURN_STAGES = [
107
114
  'pre_turn',
@@ -76,6 +76,8 @@ export interface TurnContinueFrom {
76
76
  export declare function isResumeableStop(stop: TurnStop | undefined, allowContinue?: readonly ContinueStopKind[]): boolean;
77
77
  /** True for a stop where the model call failed; the rest either finished or were stopped on purpose. */
78
78
  export declare function isFailedStopKind(kind: TurnStop['kind']): boolean;
79
+ /** True for a turn that ended in failure: its model call failed, or the model never gave its answer. */
80
+ export declare function isFailedTurnStop(kind: TurnStop['kind']): boolean;
79
81
  export declare function stageAbortStop(abort: true | {
80
82
  reason?: string;
81
83
  }): TurnStop & {
@@ -41,6 +41,10 @@ const FAILED_STOP_KINDS = new Set(['provider_error', 'stream_incomplete']);
41
41
  export function isFailedStopKind(kind) {
42
42
  return FAILED_STOP_KINDS.has(kind);
43
43
  }
44
+ /** True for a turn that ended in failure: its model call failed, or the model never gave its answer. */
45
+ export function isFailedTurnStop(kind) {
46
+ return isFailedStopKind(kind) || kind === 'answer_missing';
47
+ }
44
48
  export function stageAbortStop(abort) {
45
49
  return typeof abort === 'object' && abort.reason
46
50
  ? { kind: 'cancelled', native: abort.reason }
@@ -88,6 +88,7 @@ export declare const turnStopSchema: z.ZodObject<{
88
88
  interrupted: "interrupted";
89
89
  stream_incomplete: "stream_incomplete";
90
90
  provider_error: "provider_error";
91
+ answer_missing: "answer_missing";
91
92
  completed: "completed";
92
93
  gate: "gate";
93
94
  filtered: "filtered";
@@ -71,6 +71,10 @@ const STOP_KINDS = {
71
71
  label: 'Ran out of steps',
72
72
  doc: 'The last model call the profile allows asked for tools, so the turn ended without an answer.',
73
73
  },
74
+ answer_missing: {
75
+ label: 'No answer',
76
+ doc: 'The model finished without calling the answer tool, and no repair was left.',
77
+ },
74
78
  stream_incomplete: {
75
79
  label: 'Stream cut off',
76
80
  doc: "The provider's stream ended before the answer was complete.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/agents",
3
- "version": "0.3.4-next.853.gebc3c60",
3
+ "version": "0.3.4-next.863.gb601f58",
4
4
  "description": "A flat TypeScript agent kernel for typed profiles, deterministic turn execution, registered tools, provider adapters, guardrails, and host-injected traces.",
5
5
  "keywords": [
6
6
  "agent",