@theoremjs/studio 0.3.4-next.508.geda6db0 → 0.3.4-next.522.g9e684cd

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.
Files changed (61) hide show
  1. package/compile.js +44 -2
  2. package/draft.d.ts +54 -1
  3. package/draft.js +14 -0
  4. package/mod.d.ts +1 -1
  5. package/mod.js +1 -1
  6. package/package.json +4 -4
  7. package/page/assets/{Banner-BcHZFaJb.js → Banner-UZW6WFTG.js} +2 -2
  8. package/page/assets/{ConsoleFrame-Byq_hSpu.js → ConsoleFrame-C6ZxuLse.js} +1 -1
  9. package/page/assets/{ContextMenu-C6S-GYrc.js → ContextMenu-ClIUDzvK.js} +2 -2
  10. package/page/assets/{ToolResultCharts-CkEf5ub5.js → ToolResultCharts-COgqvWEu.js} +1 -1
  11. package/page/assets/{TraceInspector-BsYHHhGv.js → TraceInspector-D2unePaa.js} +1 -1
  12. package/page/assets/{TraceOverview-CMFfbfGM.js → TraceOverview-CCA1iUNg.js} +1 -1
  13. package/page/assets/{_virtual_studio-type-sources-CTIGQ210.js → _virtual_studio-type-sources-DfyVGpe8.js} +47 -17
  14. package/page/assets/browser-engine-CRGnAh9x.js +11 -0
  15. package/page/assets/browser-transport-CgmN-3Ia.js +47 -0
  16. package/page/assets/{compile-egress-BSxOdX4K.js → compile-egress-BRGW9qfO.js} +2 -2
  17. package/page/assets/{crypto-DAIn4qnM.js → crypto-BoqeX_71.js} +1 -1
  18. package/page/assets/{encode-files-oYzzs_iG.js → encode-files-DFrbgXms.js} +1 -1
  19. package/page/assets/{export-agent-BeUTYowB.js → export-agent-U8qRBuhg.js} +1 -1
  20. package/page/assets/{guardrail-tester-DLT99rnO.js → guardrail-tester-DASanQyo.js} +1 -1
  21. package/page/assets/host-patterns-cSf1U25G.js +1 -0
  22. package/page/assets/{index-DNA-Y8Mp.js → index-CGN6iWF2.js} +71 -71
  23. package/page/assets/{live-ingress-lDUGPwth.js → live-ingress-qi-y5uvH.js} +1 -1
  24. package/page/assets/{live-messages-BnBioidx.js → live-messages-cl-CI8gZ.js} +1 -1
  25. package/page/assets/reader-IkImpzZF.js +7 -0
  26. package/page/assets/shaped-data-CITXsEfw.js +21 -0
  27. package/page/assets/{stub-B3GersQP.js → stub-Ccyi1ZiM.js} +1 -1
  28. package/page/assets/studio-code-pane-AoMu0cGy.js +8 -0
  29. package/page/assets/{studio-console-CJT5FkWm.js → studio-console-JNYkyQ0E.js} +1 -1
  30. package/page/assets/{studio-decision-DhHdHb7Z.js → studio-decision-BRJuvgS3.js} +1 -1
  31. package/page/assets/{studio-embedding-B8vBhuZU.js → studio-embedding-D-r2kuz3.js} +1 -1
  32. package/page/assets/{studio-host-console-CE_5_tEn.js → studio-host-console-HoLSpRVk.js} +2 -2
  33. package/page/assets/{studio-labels-C2SI_T2p.js → studio-labels-CBcjlfH4.js} +1 -1
  34. package/page/assets/studio-live-DtywUIK2.js +5 -0
  35. package/page/assets/{studio-map-CKm_FCd9.js → studio-map-BIJ-S7br.js} +1 -1
  36. package/page/assets/{studio-trace-replay-BRMD6pex.js → studio-trace-replay-BuOKQwlj.js} +1 -1
  37. package/page/assets/{studio-type-checker-DoaPHYNy.js → studio-type-checker-C8qG2W9D.js} +1 -1
  38. package/page/assets/tool-schema-DDkOMTMz.js +17 -0
  39. package/page/assets/{trace-record-DWxIfO7D.js → trace-record-Dqvj9bhx.js} +1 -1
  40. package/page/assets/tree-jmLWUWxQ.js +3 -0
  41. package/page/assets/{turn-client-DF0ije7A.js → turn-client-DSatougR.js} +1 -1
  42. package/page/assets/types-4jMDDudJ.js +1 -0
  43. package/page/assets/{use-one-call-Bhnpve1Y.js → use-one-call-BcTU9gJ9.js} +1 -1
  44. package/page/assets/workspace-B2bnm5qv.js +1 -0
  45. package/page/index.html +17 -17
  46. package/read-source.js +10 -1
  47. package/registrations.d.ts +6 -0
  48. package/tools.js +3 -0
  49. package/types.d.ts +6 -0
  50. package/ui/profile-editor.js +21 -5
  51. package/page/assets/browser-engine-DjYv346h.js +0 -11
  52. package/page/assets/browser-transport-Bm3uY9Fj.js +0 -47
  53. package/page/assets/host-patterns-C9RMP16Q.js +0 -1
  54. package/page/assets/reader-BFYIhA73.js +0 -7
  55. package/page/assets/shaped-data-1Qn2111E.js +0 -16
  56. package/page/assets/studio-code-pane-CCi7-lyE.js +0 -8
  57. package/page/assets/studio-live-CKSSyYZj.js +0 -5
  58. package/page/assets/tool-schema-DXYwL5aE.js +0 -18
  59. package/page/assets/tree-Chi6mqzx.js +0 -3
  60. package/page/assets/types-2I4NfLiS.js +0 -1
  61. package/page/assets/workspace-U3w2ELtN.js +0 -1
@@ -4416,9 +4416,6 @@ interface HostMatcher {
4416
4416
  }
4417
4417
  /** Bumped whenever the compiled table's layout or meaning changes. */
4418
4418
  declare const PATTERN_COMPILER_VERSION = 3;
4419
- /** The most patterns one detector takes, and the longest each may be once written as a regular expression. */
4420
- declare const MAX_PATTERNS = 64;
4421
- declare const MAX_PATTERN_LENGTH = 1024;
4422
4419
  /** The patterns as a compiled table records them. */
4423
4420
  declare function patternSources(patterns: readonly HostPattern[]): PatternSource[];
4424
4421
  /** What is wrong with one pattern, or \`undefined\` when it runs. */
@@ -4439,7 +4436,7 @@ declare function listsPatterns(detect: unknown): boolean;
4439
4436
  /** \`patterns\`, valid, ready to run. */
4440
4437
  declare function matchersOf(patterns: readonly HostPattern[]): readonly HostMatcher[];
4441
4438
  export type { AutomatonData, CompiledPatterns, HostMatcher, HostPattern, PatternSource };
4442
- export { listsPatterns, MAX_PATTERN_LENGTH, MAX_PATTERNS, matchersOf, PATTERN_COMPILER_VERSION, patternListProblem, patternProblem, patternSources, patternsProblem, };
4439
+ export { listsPatterns, matchersOf, PATTERN_COMPILER_VERSION, patternListProblem, patternProblem, patternSources, patternsProblem, };
4443
4440
  `,"file:///node_modules/@theoremjs/agents/src/guardrails/detectors.d.ts":`/** labels-exempt-file: authoring labels, descriptions and profile-registration diagnostics for detectors — not runtime user or model copy (P2) */
4444
4441
  import { type Boundary } from './boundaries.js';
4445
4442
  import { type CompiledPatterns, type HostMatcher, type HostPattern } from './host-patterns.js';
@@ -6858,6 +6855,8 @@ export interface CompactionFailure {
6858
6855
  stop?: TurnStopKind;
6859
6856
  /** The error it reported, when it reported one. */
6860
6857
  error?: ErrorKind;
6858
+ /** Why it failed, for the builder only: \`forClient\` strips it for a visitor. */
6859
+ errorInternal?: string;
6861
6860
  /** It completed without a summary. */
6862
6861
  empty?: true;
6863
6862
  /** Nothing in \`toCompact\` was left for it to read, so it did not run. */
@@ -8945,12 +8944,25 @@ export interface ToolOutputHooks<TOut = unknown> {
8945
8944
  /** For a tool whose result names pictures by address; function tools return the bytes themselves as \`parts\`. */
8946
8945
  export interface ToolImageHooks<TOut = unknown> {
8947
8946
  /**
8948
- * The https addresses of pictures in \`output\` the model should see, at most \`MAX_TOOL_IMAGES\`
8949
- * of them. After the result passes the output guard, the kernel fetches each one through the
8950
- * profile's network policy, without the tool's credentials, and hands the model the image as a
8951
- * part; one it cannot fetch is an \`images_unfetched\` warning, never a failed call.
8947
+ * The https addresses of pictures in \`output\` the model should see. After the result passes the
8948
+ * output guard, the kernel fetches each one through the profile's network policy, without the
8949
+ * tool's credentials, and hands the model the image as a part; one it cannot fetch is an
8950
+ * \`images_unfetched\` warning, never a failed call.
8952
8951
  */
8953
8952
  images?: (output: TOut) => string[];
8953
+ /** How many of those pictures the kernel fetches, how large, and how slowly. Left out, there is no limit. */
8954
+ imageLimits?: ToolImageLimits;
8955
+ }
8956
+ /** Each limit left out is no limit. A picture past one is left out, not cut. */
8957
+ export interface ToolImageLimits {
8958
+ /** The most pictures one call hands the model; the first ones named are kept. */
8959
+ count?: number;
8960
+ /** The largest picture fetched. */
8961
+ bytes?: number;
8962
+ /** The most one call hands the model in all. */
8963
+ totalBytes?: number;
8964
+ /** How long each picture may take. */
8965
+ timeoutMs?: number;
8954
8966
  }
8955
8967
  export interface FunctionToolDef<TIn = unknown, TOut = unknown> extends ToolBase, ToolHostHooks<TIn>, ToolOutputHooks<TOut> {
8956
8968
  type: 'function';
@@ -9008,6 +9020,8 @@ export interface HttpToolDef<TIn = unknown, TOut = unknown> extends ToolBase, To
9008
9020
  };
9009
9021
  /** The service's own limit for one key; the kernel keeps this tool's requests within it. */
9010
9022
  limit?: HttpToolLimit;
9023
+ /** The most of a response body the kernel reads; past it the call fails \`response_too_large\`. Left out, there is no limit. */
9024
+ maxResponseBytes?: number;
9011
9025
  /**
9012
9026
  * How long the service may take to answer, its body read included. Past it the call
9013
9027
  * fails \`timeout\` and frees its place in the limit. Left out, a call waits as long as
@@ -9028,6 +9042,17 @@ export interface McpToolDef<TIn = unknown, TOut = unknown> extends ToolBase, Too
9028
9042
  mcpToolName: string;
9029
9043
  headers?: Record<string, string>;
9030
9044
  auth?: ToolAuthConfig;
9045
+ /** The most of a response body the kernel reads; past it the call fails \`response_too_large\`. Left out, there is no limit. */
9046
+ maxResponseBytes?: number;
9047
+ /** How long and how many of this tool's server sessions the kernel keeps. Left out, there is no limit. */
9048
+ session?: McpSessionLimits;
9049
+ }
9050
+ /** The sessions an MCP tool keeps: each field left out is no limit. */
9051
+ export interface McpSessionLimits {
9052
+ /** How long a session may sit unused before the next call opens a new one, in milliseconds. */
9053
+ idleMs?: number;
9054
+ /** The most sessions the tool keeps open; past it the least recently used is dropped. */
9055
+ max?: number;
9031
9056
  }
9032
9057
  /**
9033
9058
  * What an agent tool call carries: the text, and whatever else the called
@@ -9656,7 +9681,7 @@ declare function kindOfHttpStatus(status: number): ErrorKind;
9656
9681
  declare function errorCopyText(copy: ErrorCopies, labels?: LabelOverrides): string;
9657
9682
  /** Pass the profile's \`labels\`, or the profile's wording is skipped. */
9658
9683
  declare function publicError(err: unknown, labels?: LabelOverrides): string;
9659
- /** Raw diagnostic for hosts, traces, and logs; never shown to end users. */
9684
+ /** Raw diagnostic for hosts, traces, and logs; never shown to end users. Each cause that says something new follows on its own line. */
9660
9685
  declare function describeError(err: unknown): string;
9661
9686
  type ProducedError = TurnEventOf<'error'> & {
9662
9687
  errorInternal: string;
@@ -10643,14 +10668,19 @@ export { createToolRegistry };
10643
10668
  * Sessions for MCP servers that refuse a call without one. A session is a cache, not state: it
10644
10669
  * lives in memory on one tool registry, is never persisted, and losing it costs one reopen.
10645
10670
  */
10671
+ import type { McpSessionLimits } from './types.js';
10646
10672
  export type McpSession = {
10647
10673
  id: string;
10648
10674
  protocolVersion: string;
10649
10675
  };
10676
+ /** The tool a session is used for, and that tool's own \`session\` limits. */
10677
+ export interface McpSessionUse extends McpSessionLimits {
10678
+ tool: string;
10679
+ }
10650
10680
  export interface McpSessionCache {
10651
- get(key: string): McpSession | undefined;
10681
+ get(key: string, use: McpSessionUse): McpSession | undefined;
10652
10682
  /** Parallel callers for one key share a single \`open\`. */
10653
- open(key: string, open: () => Promise<McpSession>): Promise<McpSession>;
10683
+ open(key: string, use: McpSessionUse, open: () => Promise<McpSession>): Promise<McpSession>;
10654
10684
  /** Only drops the session if it's still \`id\`, so a late expiry can't evict a newer one. */
10655
10685
  drop(key: string, id: string): void;
10656
10686
  clear(): void;
@@ -10801,8 +10831,6 @@ export declare function refusedCredentialOutcome(tool: {
10801
10831
  name: string;
10802
10832
  auth?: ToolAuthConfig;
10803
10833
  }, refusal: CredentialRefusal | undefined, carried: boolean, ctx: ToolContext, base: ToolCallBase): Generator<TurnEvent, ToolBodyOutcome | undefined>;
10804
- /** The most of a tool's response body the kernel reads; past it the call fails instead of exhausting the host's memory. */
10805
- export declare const MAX_TOOL_RESPONSE_BYTES: number;
10806
10834
  /** Every string in \`value\` with the credential replaced. */
10807
10835
  export declare function omitSecret(value: unknown, secret: string): unknown;
10808
10836
  /** A failure's message and details with the credential replaced. */
@@ -11553,6 +11581,8 @@ interface Detection {
11553
11581
  text?: string;
11554
11582
  /** Every match, each named for its detector. */
11555
11583
  hits: GuardrailHit[];
11584
+ /** Why a host's \`find\` failed, for the builder only: it reaches \`guardrail.errorInternal\`. */
11585
+ errorInternal?: string;
11556
11586
  }
11557
11587
  declare function stronger(left: DetectOutcome, right: DetectOutcome | 'ignore'): DetectOutcome;
11558
11588
  /**
@@ -11632,7 +11662,7 @@ declare function storedHostSpans(text: string, detect?: ResolvedDetect): RedactS
11632
11662
  interface BoundaryReader {
11633
11663
  /** The text to let through, or \`''\` once a match blocks: the caller reads \`found().action\`. */
11634
11664
  read(text: string): string;
11635
- found(): Pick<Detection, 'action' | 'hits'>;
11665
+ found(): Pick<Detection, 'action' | 'hits' | 'errorInternal'>;
11636
11666
  }
11637
11667
  /** A reader for everything crossing \`boundary\` in one request. */
11638
11668
  declare function boundaryReader(boundary: Boundary, detect: ResolvedDetect): BoundaryReader;
@@ -11640,7 +11670,7 @@ declare function boundaryReader(boundary: Boundary, detect: ResolvedDetect): Bou
11640
11670
  * The guardrail event for what was found at a boundary, or \`undefined\` when nothing matched.
11641
11671
  * \`stage\` is the boundary's own unless the text was read as it streamed.
11642
11672
  */
11643
- declare function detectEvent(boundary: Boundary, found: Pick<Detection, 'action' | 'hits'>, provenance?: Provenance, stage?: GuardrailStage): GuardrailEvent | undefined;
11673
+ declare function detectEvent(boundary: Boundary, found: Pick<Detection, 'action' | 'hits' | 'errorInternal'>, provenance?: Provenance, stage?: GuardrailStage): GuardrailEvent | undefined;
11644
11674
  export type { BoundaryReader, Detection, DetectOutcome, DetectScope, Release, StoredSides, StreamRead, Stretch, };
11645
11675
  export { boundaryReader, detectAt, detectEvent, detectorsAt, detectReads, detectRelease, hostAt, isScoped, leakScopeOf, redactDetectors, scopeOf, storedHostSpans, storedSpans, stronger, };
11646
11676
  `,"file:///node_modules/@theoremjs/agents/src/guardrails/egress.d.ts":`import type { ModelEvent } from '../kernel/types.js';
@@ -12165,7 +12195,7 @@ declare function sanitizeProjectId(id: string | undefined): string | undefined;
12165
12195
  */
12166
12196
  declare function sanitizeHistory(history: TurnHistoryMessage[], reader: BoundaryReader): TurnHistoryMessage[];
12167
12197
  /** The error a turn ends on when a detector set to \`block\` matched at \`boundary\`. */
12168
- declare function requestRefused(boundary: Boundary): TheoremError;
12198
+ declare function requestRefused(boundary: Boundary, reason?: string): TheoremError;
12169
12199
  /** A turn request read at each boundary it crosses. */
12170
12200
  interface SanitizedTurnRequest {
12171
12201
  request: NormalizedTurnRequest;
@@ -12233,7 +12263,7 @@ export { errorCopiesSchema, errorKindSchema, guardrailEventSchema } from './even
12233
12263
  export { guardrailFromHits, guardrailFromVerdict, guardrailTurnEvent, projectGuardrailTurnEvent, } from './events.js';
12234
12264
  export { hitFromSpan, projectGuardrailEvent, } from './hits.js';
12235
12265
  export type { CompiledPatterns, HostPattern } from './host-patterns.js';
12236
- export { listsPatterns, MAX_PATTERN_LENGTH, MAX_PATTERNS, patternListProblem, } from './host-patterns.js';
12266
+ export { listsPatterns, patternListProblem, } from './host-patterns.js';
12237
12267
  export { injectionSpans } from './injection.js';
12238
12268
  export type { ClientLabelKey, LabelKey, LabelOverrides, LabelParams } from './labels.js';
12239
12269
  export { CLIENT_LABEL_KEYS, LABEL_KEYS, labelCatalogRows, labelDefault, labelText, overrideLabels, resetLabels, validateLabelOverrides, } from './labels.js';