@theoremjs/agents 0.3.4-next.647.g436b659 → 0.3.4-next.649.gf83cea1

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.
@@ -11,6 +11,11 @@ export type LabelKey = (typeof LABEL_KEYS)[number];
11
11
  * (repair prompts, canary, taint, egress) stay on the host.
12
12
  */
13
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", "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"];
14
+ /**
15
+ * Lines only {@linkcode overrideLabels} changes: builder and host errors from providers and
16
+ * protocols, and the decision box hint. A profile's `labels` never reach them.
17
+ */
18
+ export declare const HOST_LABEL_KEYS: readonly LabelKey[];
14
19
  /** One of {@linkcode CLIENT_LABEL_KEYS}. */
15
20
  export type ClientLabelKey = (typeof CLIENT_LABEL_KEYS)[number];
16
21
  /** Host-supplied replacement templates, `{param}` placeholders included. */
@@ -278,6 +278,11 @@ export const CLIENT_LABEL_KEYS = [
278
278
  'composer.model',
279
279
  'composer.effort',
280
280
  ];
281
+ /**
282
+ * Lines only {@linkcode overrideLabels} changes: builder and host errors from providers and
283
+ * protocols, and the decision box hint. A profile's `labels` never reach them.
284
+ */
285
+ export const HOST_LABEL_KEYS = LABEL_KEYS.filter((key) => key.startsWith('provider.') || key.startsWith('protocol.') || key === 'decision.box_image');
281
286
  const KIB = 1024;
282
287
  /** A size limit as people read it: `1 byte`, `500 KB`, `4 MB`, `1.5 MB`. Never `0.0 MB`. */
283
288
  function formatSize(bytes) {
@@ -28,7 +28,7 @@ export type { CompiledPatterns, HostPattern } from './host-patterns.js';
28
28
  export { listsPatterns, patternListProblem, } from './host-patterns.js';
29
29
  export { injectionSpans } from './injection.js';
30
30
  export type { ClientLabelKey, LabelKey, LabelOverrides, LabelParams } from './labels.js';
31
- export { CLIENT_LABEL_KEYS, LABEL_KEYS, labelCatalogRows, labelDefault, labelText, overrideLabels, resetLabels, validateLabelOverrides, } from './labels.js';
31
+ export { CLIENT_LABEL_KEYS, HOST_LABEL_KEYS, LABEL_KEYS, labelCatalogRows, labelDefault, labelText, overrideLabels, resetLabels, validateLabelOverrides, } from './labels.js';
32
32
  export type { LiveHeldOutput, LiveOutboundBatchResult, LiveOutboundGateSession, } from './live-outbound-gate.js';
33
33
  export { abortLiveOutboundTurn, createLiveOutboundGateSession, finalizeLiveOutboundTurn, processLiveOutboundBatch, } from './live-outbound-gate.js';
34
34
  export { resolveGuardrailPolicy } from './policy.js';
@@ -18,7 +18,7 @@ export { guardrailFromHits, guardrailFromVerdict, guardrailTurnEvent, projectGua
18
18
  export { hitFromSpan, projectGuardrailEvent, } from './hits.js';
19
19
  export { listsPatterns, patternListProblem, } from './host-patterns.js';
20
20
  export { injectionSpans } from './injection.js';
21
- export { CLIENT_LABEL_KEYS, LABEL_KEYS, labelCatalogRows, labelDefault, labelText, overrideLabels, resetLabels, validateLabelOverrides, } from './labels.js';
21
+ export { CLIENT_LABEL_KEYS, HOST_LABEL_KEYS, LABEL_KEYS, labelCatalogRows, labelDefault, labelText, overrideLabels, resetLabels, validateLabelOverrides, } from './labels.js';
22
22
  export { abortLiveOutboundTurn, createLiveOutboundGateSession, finalizeLiveOutboundTurn, processLiveOutboundBatch, } from './live-outbound-gate.js';
23
23
  export { resolveGuardrailPolicy } from './policy.js';
24
24
  export { createOutboundProgressiveGate, createProgressiveYieldGate } from './progressive-yield.js';
@@ -842,7 +842,9 @@ function buildLiveSession(args) {
842
842
  const { tool } = event;
843
843
  if (tool.phase === undefined) {
844
844
  if (calls.has(tool.callId) || identities.has(tool.callId)) {
845
- throw new TheoremError('bad_response', labelText('provider.duplicate_call', {}, profile.labels), { cause: { code: 'duplicate_pending_call' } });
845
+ throw new TheoremError('bad_response', labelText('provider.duplicate_call'), {
846
+ cause: { code: 'duplicate_pending_call' },
847
+ });
846
848
  }
847
849
  identities.set(tool.callId, crypto.randomUUID());
848
850
  }
@@ -1,7 +1,7 @@
1
1
  import { TOOL_BOUNDARIES } from '../../guardrails/boundaries.js';
2
2
  import { detectProblem } from '../../guardrails/detectors.js';
3
3
  import { errorKind, TheoremError } from '../../guardrails/error.js';
4
- import { labelText, validateLabelOverrides } from '../../guardrails/labels.js';
4
+ import { HOST_LABEL_KEYS, labelText, validateLabelOverrides, } from '../../guardrails/labels.js';
5
5
  import { BLOCKED_REPLY_ON_BLOCK, } from '../../guardrails/types.js';
6
6
  import { resolveObservabilityPolicy } from '../../observability/resolve-policy.js';
7
7
  import { providerContinuationSchema } from '../checkpoint.js';
@@ -361,6 +361,11 @@ function defineProfile(input) {
361
361
  assertNameLengths(input);
362
362
  if (input.labels)
363
363
  validateLabelOverrides(input.labels, `Profile ${input.id}`);
364
+ for (const key of HOST_LABEL_KEYS) {
365
+ if (input.labels?.[key] !== undefined) {
366
+ throw new TheoremError('config', `Profile ${input.id}: labels '${key}' is a host line, which a profile cannot change; set it with overrideLabels`);
367
+ }
368
+ }
364
369
  assertIdentitySystem(input);
365
370
  assertDetect(input);
366
371
  if (input.type === 'host') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/agents",
3
- "version": "0.3.4-next.647.g436b659",
3
+ "version": "0.3.4-next.649.gf83cea1",
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",