@cultured_computer/sight 0.8.4 → 0.9.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.
package/dist/index.d.cts CHANGED
@@ -2353,4 +2353,591 @@ type SightAiTelemetry = {
2353
2353
  */
2354
2354
  declare function sightTelemetry(options?: SightAiTelemetryOptions): SightAiTelemetry;
2355
2355
 
2356
- export { type AlignmentProvenance, type CaptureTurnInput, type CapturedTurn, type EnvironmentEventInput, type OutcomeEventEmit, type OutcomeHook, type OutcomeResult, type PersonaConfig, Probe, type ProbeConfig, type ProbeConfigInput, SPAN_INTERVAL_KINDS, SPAN_PAYLOAD_STATES, SPAN_STATUSES, SPAN_TYPES, SPAN_V2_STATUSES, Probe as Sight, type SightAiTelemetry, type SightAiTelemetryOptions, type AlignmentProvenance as SightAlignmentProvenance, type CaptureTurnInput as SightCaptureTurnInput, type CapturedTurn as SightCapturedTurn, type ProbeConfig as SightConfig, type ProbeConfigInput as SightConfigInput, type EnvironmentEventInput as SightEnvironmentEventInput, type OutcomeEventEmit as SightOutcomeEventEmit, type OutcomeHook as SightOutcomeHook, type OutcomeResult as SightOutcomeResult, type PersonaConfig as SightPersonaConfig, type SpanInput as SightSpanInput, type SpanInputV2 as SightSpanInputV2, type SpansBatch as SightSpansBatch, type SpanInput, SpanInputSchema, type SpanInputV1, SpanInputV1Schema, type SpanInputV2, SpanInputV2Schema, type SpanInterval, type SpanIntervalKind, SpanIntervalSchema, type SpanPayload, SpanPayloadSchema, type SpanPayloadState, type SpanStatus, type SpanType, type SpansBatch, SpansBatchSchema, sightTelemetry, wrapOpenAI };
2356
+ /**
2357
+ * The serving client: a typed client for the Field API, the routes that put
2358
+ * a profile (a SOUL.md) at a name, serve it turn by turn and read its
2359
+ * record. It is separate from the capture API (`Sight`) and shares nothing
2360
+ * with it: its own key, its own requests, no process state.
2361
+ *
2362
+ * import { createFieldClient } from '@cultured_computer/sight';
2363
+ *
2364
+ * const field = createFieldClient({ apiKey: process.env.SIGHT_APP_KEY! });
2365
+ * await field.profiles.put('listener', soulMarkdown);
2366
+ * await field.conversations.start('listener', { conversation: 'c-1', user: 'u-1' });
2367
+ * const { reply } = await field.turns.send('listener', { conversation: 'c-1', message: 'Hi' });
2368
+ *
2369
+ * Every refused request throws a `FieldRefusal` carrying the HTTP status,
2370
+ * the refusal `code` and, when the answer has one, the `reason`. Nothing is
2371
+ * retried: a turn is not idempotent, and a refusal names what to do.
2372
+ *
2373
+ * Server-side only: the key it holds can rewrite the profile.
2374
+ */
2375
+ /** The API host. Every machine call, capture and serving, goes to it. */
2376
+ declare const DEFAULT_FIELD_ENDPOINT = "https://api.cultured.computer";
2377
+ /**
2378
+ * Every refusal code the routes this client calls can answer: the
2379
+ * conversation and turn routes, the rate limit, the profile put and the
2380
+ * profile read. A refusal with no code (a 401, a 403 for a key that lacks a
2381
+ * permission, a 413) carries `code: null`.
2382
+ */
2383
+ declare const FIELD_REFUSAL_CODES: readonly ["invalid_body", "forbidden", "not_enabled", "no_such_profile", "no_such_endpoint", "no_such_conversation", "conversation_unknown", "archived", "revoked", "link_inactive", "conversation_conflict", "opening_forbidden", "opening_conflict", "runtime_forbidden", "invalid_reasoning_effort", "invalid_max_output_tokens", "conversation_ended", "no_live_version", "no_owner", "model_unavailable", "daily_cap", "link_session_cap", "rate_limited", "turn_cap", "stale_turn_index", "record_gap", "busy", "interrupted", "not_connected", "budget", "provider_error", "provider_timeout", "turn_failed", "request_unknown", "request_conflict", "request_pending", "request_interrupted", "replay_expired", "put_in_progress", "scene_live", "precondition_failed", "invalid_consent", "invalid_safeguards", "invalid_scrub", "invalid_fallback", "invalid_scene", "not_a_soul_md", "not_a_scene"];
2384
+ type FieldRefusalCode = (typeof FIELD_REFUSAL_CODES)[number];
2385
+ /**
2386
+ * The reasoning efforts a profile or a conversation can ask for. `none`
2387
+ * asks for no reasoning. An effort is sent only where the model's
2388
+ * catalogue entry lists it; elsewhere it is left out.
2389
+ */
2390
+ declare const FIELD_REASONING_EFFORTS: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
2391
+ type FieldReasoningEffort = (typeof FIELD_REASONING_EFFORTS)[number];
2392
+ /**
2393
+ * Why a model finished a turn with no reply text, on a `provider_error`:
2394
+ * `empty_completion`, or `empty_completion_length` when the output limit
2395
+ * ended it before any reply text (a reasoning model that spent
2396
+ * `maxOutputTokens` reasoning).
2397
+ */
2398
+ type FieldEmptyCompletionReason = 'empty_completion' | 'empty_completion_length';
2399
+ /**
2400
+ * Where a resolved runtime setting came from: the conversation's own
2401
+ * `runtime` (the request), the profile's, or the house default for the
2402
+ * model.
2403
+ */
2404
+ type FieldRuntimeSource = 'request' | 'profile' | 'default';
2405
+ /** The sources the profile read names: no request is in play there. */
2406
+ type FieldProfileRuntimeSource = Extract<FieldRuntimeSource, 'profile' | 'default'>;
2407
+ /** Why an ended conversation ended, on a `conversation_ended` refusal. */
2408
+ type FieldEndedReason = 'idle' | 'turn_cap' | 'floor' | 'failed' | 'ended';
2409
+ /**
2410
+ * The served runtime record: what the reply call is sent. Every key is
2411
+ * optional; a key left out keeps the profile's value (or, on a profile,
2412
+ * the default).
2413
+ */
2414
+ type FieldRuntime = {
2415
+ /** An OpenRouter model id the model catalogue routes, `vendor/model`. */
2416
+ model?: string;
2417
+ /** 0 to 2. Default 0.7. Sent unless the model's route takes none. */
2418
+ temperature?: number;
2419
+ /**
2420
+ * The reply's output budget in tokens: an integer from 256 to the
2421
+ * model's catalogue max_completion_tokens (16384 when it states none),
2422
+ * else `invalid_max_output_tokens`. A reasoning model's reasoning tokens
2423
+ * count inside it, with the answer. Default: the
2424
+ * smaller of 16384 and the model's catalogue max_completion_tokens;
2425
+ * 4096 when the catalogue says nothing of the model.
2426
+ */
2427
+ maxOutputTokens?: number;
2428
+ /**
2429
+ * Default: `low` where the model's catalogue lists it, else the lowest
2430
+ * effort it lists; nothing when it lists none.
2431
+ */
2432
+ reasoningEffort?: FieldReasoningEffort;
2433
+ };
2434
+ /** A fixed platform text you must show the person, before the reply. */
2435
+ type FieldNotice = {
2436
+ kind: string;
2437
+ text: string;
2438
+ };
2439
+ /** One frame of a turn, as the JSON answer collects it. */
2440
+ type FieldEventRecord = {
2441
+ event: string;
2442
+ data: unknown;
2443
+ };
2444
+ /**
2445
+ * A request the Field API refused: any answer that is not a 2xx. Branch on
2446
+ * `code`, not on the message.
2447
+ */
2448
+ declare class FieldRefusal extends Error {
2449
+ readonly name = "FieldRefusal";
2450
+ /** The HTTP status. */
2451
+ readonly status: number;
2452
+ /**
2453
+ * The refusal's stable code, one of `FIELD_REFUSAL_CODES` from this
2454
+ * version; a newer API may answer a code this version does not list.
2455
+ * `null` when the answer carries none (401, a 403 for a missing
2456
+ * permission, 413, a 503 while the service drains).
2457
+ */
2458
+ readonly code: FieldRefusalCode | (string & {}) | null;
2459
+ /**
2460
+ * Why, when the answer says: the ended reason of a `conversation_ended`,
2461
+ * or the empty-completion reason of a `provider_error`. Otherwise null.
2462
+ */
2463
+ readonly reason: FieldEndedReason | FieldEmptyCompletionReason | (string & {}) | null;
2464
+ /** `Retry-After` in seconds, when the answer carries one (429, 503, a busy put). */
2465
+ readonly retryAfter: number | null;
2466
+ /** A failed turn still answers its notices; show them. Empty otherwise. */
2467
+ readonly notices: FieldNotice[];
2468
+ /** A failed turn's frames, collected before it failed. Empty otherwise. */
2469
+ readonly events: FieldEventRecord[];
2470
+ /** A failed turn's index, when the answer names one. */
2471
+ readonly turnIndex: number | null;
2472
+ /** The answer's body as sent: parsed JSON, or the text when it is not JSON. */
2473
+ readonly body: unknown;
2474
+ constructor(init: {
2475
+ status: number;
2476
+ message: string;
2477
+ code: string | null;
2478
+ reason: string | null;
2479
+ retryAfter: number | null;
2480
+ notices: FieldNotice[];
2481
+ events: FieldEventRecord[];
2482
+ turnIndex: number | null;
2483
+ body: unknown;
2484
+ });
2485
+ }
2486
+ type FieldVersionRef = {
2487
+ id: string;
2488
+ contentHash: string;
2489
+ configHash: string;
2490
+ label: string;
2491
+ };
2492
+ type FieldLimits = {
2493
+ idleMinutes: number;
2494
+ turnsPerConversation: number;
2495
+ conversationsPerDay: number;
2496
+ };
2497
+ type FieldSafeguards = {
2498
+ crisis: boolean;
2499
+ disclosure: boolean;
2500
+ policy: string;
2501
+ };
2502
+ type FieldConnection = {
2503
+ openrouter: 'connected';
2504
+ via: 'project' | 'operator';
2505
+ } | {
2506
+ openrouter: 'missing';
2507
+ connect: string;
2508
+ };
2509
+ type FieldProfileLinks = {
2510
+ profile: string;
2511
+ conversations: string;
2512
+ turns: string;
2513
+ sessions: string;
2514
+ versions: string;
2515
+ reviews: string;
2516
+ };
2517
+ type FieldProfileEndpoint = {
2518
+ id: string;
2519
+ name: string;
2520
+ versionMode: 'live' | 'pinned';
2521
+ guestsAllowed: boolean;
2522
+ idleMinutes: number;
2523
+ turnsPerConversation: number;
2524
+ conversationsPerDay: number;
2525
+ };
2526
+ /** The answer to `profiles.put`. */
2527
+ type FieldProfilePut = {
2528
+ profile: string;
2529
+ floor: 'steer' | 'exit';
2530
+ outcome: 'created' | 'new version, pointer moved' | 'settings changed' | 'no change';
2531
+ /** What moved: `file`, `model`, `temperature`, `reasoningEffort`, a limit, ... */
2532
+ changed: string[];
2533
+ format: 'soul-md' | 'scene';
2534
+ dryRun?: true;
2535
+ replaced?: {
2536
+ id: string;
2537
+ label: string;
2538
+ };
2539
+ version: FieldVersionRef;
2540
+ endpoint: FieldProfileEndpoint;
2541
+ limits: FieldLimits;
2542
+ core: Array<{
2543
+ heading: string;
2544
+ chars: number;
2545
+ }>;
2546
+ detectors: {
2547
+ active: string[];
2548
+ classifier: string;
2549
+ } | {
2550
+ active: string[];
2551
+ note: string;
2552
+ };
2553
+ /** Parts of the file left out, each with why. Check it after every put. */
2554
+ refused: Array<{
2555
+ heading: string;
2556
+ reason: string;
2557
+ }>;
2558
+ runtime: {
2559
+ model: string;
2560
+ provider: 'openrouter';
2561
+ temperature: number;
2562
+ reasoningEffort?: FieldReasoningEffort;
2563
+ /** The output budget the saved version asks for; absent when it names none. */
2564
+ maxOutputTokens?: number;
2565
+ consent: boolean;
2566
+ fallback: string | null;
2567
+ fallbackNote?: string;
2568
+ };
2569
+ safeguards: FieldSafeguards;
2570
+ scrub: string;
2571
+ connection: FieldConnection;
2572
+ links: FieldProfileLinks;
2573
+ /** The `ETag` header: the live version's id, quoted. Send it as `ifMatch`. */
2574
+ etag: string | null;
2575
+ };
2576
+ /** The answer to `profiles.get`. */
2577
+ type FieldProfile = {
2578
+ profile: string;
2579
+ floor: 'steer' | 'exit';
2580
+ archived: boolean;
2581
+ archivedAt: string | null;
2582
+ version: {
2583
+ id: string;
2584
+ configHash: string;
2585
+ label: string;
2586
+ } | null;
2587
+ endpoint: (FieldProfileEndpoint & {
2588
+ revokedAt: string | null;
2589
+ }) | null;
2590
+ limits: FieldLimits | null;
2591
+ links: FieldProfileLinks;
2592
+ runtime: {
2593
+ model: string;
2594
+ provider: string;
2595
+ temperature: number;
2596
+ /**
2597
+ * The output budget the replies are sent with: the live version's own,
2598
+ * else the house default.
2599
+ */
2600
+ maxOutputTokens?: number;
2601
+ maxOutputTokensSource?: FieldProfileRuntimeSource;
2602
+ /**
2603
+ * The effort the replies ask for: the live version's own, else the
2604
+ * house default; null when nothing is asked (the catalogue lists no
2605
+ * efforts).
2606
+ */
2607
+ reasoningEffort?: FieldReasoningEffort | null;
2608
+ reasoningEffortSource?: FieldProfileRuntimeSource;
2609
+ readerModel: string | null;
2610
+ fallback: string | null;
2611
+ } | null;
2612
+ consent: boolean;
2613
+ safeguards: FieldSafeguards;
2614
+ scrub: string;
2615
+ connection: FieldConnection;
2616
+ /** The `ETag` header: the live version's id, quoted. Send it as `ifMatch`. */
2617
+ etag: string | null;
2618
+ };
2619
+ /** One session as the sessions list answers it. */
2620
+ type FieldSessionSummary = {
2621
+ id: string;
2622
+ /** Your own conversation id, as the start sent it. */
2623
+ conversation: string | null;
2624
+ runId: string;
2625
+ user: string | null;
2626
+ startedAt: string | null;
2627
+ endedAt: string | null;
2628
+ ended: boolean;
2629
+ endedReason: string | null;
2630
+ status: string;
2631
+ error?: string;
2632
+ turns: number;
2633
+ rehearsal: boolean;
2634
+ origin: 'observed' | 'constructed';
2635
+ opening: {
2636
+ turns: number;
2637
+ } | null;
2638
+ version: FieldVersionRef;
2639
+ flags: number;
2640
+ shapes: Record<string, number>;
2641
+ path: string;
2642
+ };
2643
+ /** The answer to `profiles.sessions`: one page, newest first. */
2644
+ type FieldSessionsPage = {
2645
+ profile: string;
2646
+ archived: boolean;
2647
+ limit: number;
2648
+ sessions: FieldSessionSummary[];
2649
+ /** Pass as `cursor` for the next page; null on the last page. */
2650
+ nextBefore: string | null;
2651
+ links: {
2652
+ profile: string;
2653
+ sessions: string;
2654
+ versions: string;
2655
+ };
2656
+ };
2657
+ /** One turn of a session's record. */
2658
+ type FieldSessionTurn = {
2659
+ index: number;
2660
+ at?: string;
2661
+ pending?: true;
2662
+ text: 'stored' | 'pending';
2663
+ message: string | null;
2664
+ reply: string | null;
2665
+ outcome: 'floor' | 'error' | 'reply';
2666
+ error?: string;
2667
+ version: FieldVersionRef | null;
2668
+ model: {
2669
+ id: string;
2670
+ provider: string;
2671
+ } | null;
2672
+ fallbackFrom?: string;
2673
+ sent?: {
2674
+ temperature: number | null;
2675
+ seed: number | null;
2676
+ reasoning?: {
2677
+ effort: string;
2678
+ };
2679
+ maxOutputTokens?: number;
2680
+ };
2681
+ detectors: Array<{
2682
+ statement: string;
2683
+ flagged: boolean;
2684
+ verdict: string;
2685
+ score: string | null;
2686
+ bar: number | null;
2687
+ phase: 'before' | 'after';
2688
+ steers: boolean;
2689
+ consequence?: string;
2690
+ entered?: {
2691
+ heading: string;
2692
+ replyTurn: number;
2693
+ };
2694
+ }>;
2695
+ entered: Array<{
2696
+ heading: string;
2697
+ detector: string;
2698
+ flaggedOnTurn: number | null;
2699
+ }>;
2700
+ shapes: Array<{
2701
+ shape: string;
2702
+ evidence: Record<string, unknown>;
2703
+ version: string | null;
2704
+ }>;
2705
+ moves: unknown[];
2706
+ floor?: unknown;
2707
+ notices?: FieldNotice[];
2708
+ storedHistoryTurns?: number;
2709
+ usage: {
2710
+ model: string | null;
2711
+ tokensIn: number | null;
2712
+ tokensOut: number | null;
2713
+ latencyMs: number | null;
2714
+ costUsd: number | null;
2715
+ } | null;
2716
+ };
2717
+ /** The answer to `sessions.get`: the header and its turns in order. */
2718
+ type FieldSessionRecord = {
2719
+ profile: string;
2720
+ session: Omit<FieldSessionSummary, 'path'> & {
2721
+ usage: {
2722
+ model: string | null;
2723
+ tokensIn: number | null;
2724
+ tokensOut: number | null;
2725
+ costUsd: number | null;
2726
+ };
2727
+ };
2728
+ text: 'stored';
2729
+ opening: {
2730
+ constructed: true;
2731
+ text: 'as-sent';
2732
+ turns: Array<{
2733
+ role: 'person' | 'assistant';
2734
+ text: string;
2735
+ }>;
2736
+ } | null;
2737
+ turns: FieldSessionTurn[];
2738
+ readsTruncated?: true;
2739
+ links: {
2740
+ profile: string;
2741
+ sessions: string;
2742
+ versions: string;
2743
+ };
2744
+ };
2745
+ /** The answer to `conversations.start`. */
2746
+ type FieldConversation = {
2747
+ runId: string;
2748
+ sessionId: string;
2749
+ version: number | null;
2750
+ /** The path of the session's record (`GET` it with the same key). */
2751
+ record: string;
2752
+ };
2753
+ /** The answer to `turns.send`. */
2754
+ type FieldTurnAnswer = {
2755
+ reply: string;
2756
+ /** Show these to the person, before the reply. Empty when none. */
2757
+ notices: FieldNotice[];
2758
+ /** Every other frame of the turn, in order. */
2759
+ events: FieldEventRecord[];
2760
+ turnIndex: number;
2761
+ };
2762
+ type FieldRunFrame = {
2763
+ runId: string;
2764
+ sessionId: string;
2765
+ model: string;
2766
+ provider: string;
2767
+ modelKey?: string;
2768
+ /** What the reply call sent; null when the route takes none. */
2769
+ temperature: number | null;
2770
+ seed: number | null;
2771
+ /** Present only when an effort was sent. */
2772
+ reasoning?: {
2773
+ effort: string;
2774
+ };
2775
+ /** The output budget the call sent (reasoning and answer together). */
2776
+ maxOutputTokens?: number;
2777
+ opening?: {
2778
+ turns: number;
2779
+ };
2780
+ /** The conversation's runtime override, as its start sent it. */
2781
+ override?: FieldRuntime;
2782
+ };
2783
+ type FieldReadFrame = {
2784
+ statement: string;
2785
+ score?: number;
2786
+ bar?: number;
2787
+ moment?: string;
2788
+ phase: string;
2789
+ };
2790
+ type FieldDoneFrame = {
2791
+ status: string;
2792
+ turnIndex: number;
2793
+ };
2794
+ type FieldErrorFrame = {
2795
+ message: string;
2796
+ code: FieldRefusalCode | (string & {});
2797
+ /** On a `provider_error` with no reply text: why. */
2798
+ reason?: FieldEmptyCompletionReason | (string & {});
2799
+ turnIndex?: number;
2800
+ };
2801
+ /**
2802
+ * One server-sent frame of a streamed turn, in order: `run`, then any
2803
+ * `notice` and `reads` before the first `delta`, the `delta`s, `events`,
2804
+ * and `done` or `error`. A frame this version does not know arrives as
2805
+ * `other`, with its name.
2806
+ */
2807
+ type FieldTurnFrame = {
2808
+ event: 'run';
2809
+ data: FieldRunFrame;
2810
+ } | {
2811
+ event: 'notice';
2812
+ data: FieldNotice;
2813
+ } | {
2814
+ event: 'reads';
2815
+ data: FieldReadFrame[];
2816
+ } | {
2817
+ event: 'delta';
2818
+ data: {
2819
+ text: string;
2820
+ };
2821
+ } | {
2822
+ event: 'events';
2823
+ data: unknown[];
2824
+ } | {
2825
+ event: 'done';
2826
+ data: FieldDoneFrame;
2827
+ } | {
2828
+ event: 'error';
2829
+ data: FieldErrorFrame;
2830
+ } | {
2831
+ event: 'other';
2832
+ name: string;
2833
+ data: unknown;
2834
+ };
2835
+ type FieldClientOptions = {
2836
+ /** An App key (`studio:serve` and `profiles:write`). Keep it on a server. */
2837
+ apiKey: string;
2838
+ /** The API host. Default `https://api.cultured.computer`. */
2839
+ endpoint?: string;
2840
+ };
2841
+ /** Options of `profiles.put`. Each overrides the file's frontmatter for this put. */
2842
+ type FieldPutOptions = FieldRuntime & {
2843
+ /** A model id that answers when the model fails before its reply started, or `none`. */
2844
+ fallback?: string;
2845
+ consent?: boolean;
2846
+ /** `crisis`, `disclosure`, both, or `none`. */
2847
+ safeguards?: Array<'crisis' | 'disclosure'> | 'none';
2848
+ scrub?: 'identifiers-only' | 'standard';
2849
+ idleMinutes?: number;
2850
+ turnsPerConversation?: number;
2851
+ conversationsPerDay?: number;
2852
+ /** Answer what the put would do and store nothing. */
2853
+ dryRun?: boolean;
2854
+ /** Replace a live stepped scene with the file. */
2855
+ force?: boolean;
2856
+ /** A conditional put: the `etag` a read or the last put answered. */
2857
+ ifMatch?: string;
2858
+ signal?: AbortSignal;
2859
+ };
2860
+ type FieldStartOptions = {
2861
+ /** Your own id for the conversation, at most 200 characters. One per thread. */
2862
+ conversation: string;
2863
+ /**
2864
+ * Your own opaque, stable id for the person, at most 200 characters: a
2865
+ * hash or your internal id, never an email or a name. A conversation
2866
+ * belongs to the person it was started for.
2867
+ */
2868
+ user: string;
2869
+ /**
2870
+ * This conversation's runtime, over the profile's. Only a key holding
2871
+ * `profiles:write` may send one (`runtime_forbidden` otherwise). A
2872
+ * repeated start must send the same (`opening_conflict` otherwise).
2873
+ */
2874
+ runtime?: FieldRuntime;
2875
+ /** A constructed opening: earlier exchanges, the person first and the assistant last. */
2876
+ opening?: Array<{
2877
+ role: 'person' | 'assistant';
2878
+ text: string;
2879
+ }>;
2880
+ /** A signed 32-bit integer; each turn sends the seed plus its index where the route takes one. */
2881
+ seed?: number;
2882
+ signal?: AbortSignal;
2883
+ };
2884
+ type FieldTurnOptions = {
2885
+ conversation: string;
2886
+ message: string;
2887
+ /** The turn index you expect to be next; a stale one is refused with `stale_turn_index`. */
2888
+ resume?: {
2889
+ turnIndex: number;
2890
+ };
2891
+ signal?: AbortSignal;
2892
+ };
2893
+ type FieldSessionsOptions = {
2894
+ /** Your own conversation id, exact match. */
2895
+ conversation?: string;
2896
+ /** The `nextBefore` of the previous page. */
2897
+ cursor?: string;
2898
+ /** Default 50, at most 200. */
2899
+ limit?: number;
2900
+ /** A content hash, a config hash or a version id. */
2901
+ version?: string;
2902
+ ended?: boolean;
2903
+ signal?: AbortSignal;
2904
+ };
2905
+ type FieldClient = {
2906
+ profiles: {
2907
+ /** Put a SOUL.md at a name: creates the profile, or saves a new version or new settings. */
2908
+ put(name: string, soulMarkdown: string, options?: FieldPutOptions): Promise<FieldProfilePut>;
2909
+ /** Read a profile: its live version, runtime, limits, safeguards and connection. */
2910
+ get(name: string, options?: {
2911
+ signal?: AbortSignal;
2912
+ }): Promise<FieldProfile>;
2913
+ /** List a profile's served sessions, newest first, one page at a time. */
2914
+ sessions(name: string, options?: FieldSessionsOptions): Promise<FieldSessionsPage>;
2915
+ };
2916
+ conversations: {
2917
+ /** Start a conversation, or answer the running one under the same id. */
2918
+ start(profile: string, options: FieldStartOptions): Promise<FieldConversation>;
2919
+ };
2920
+ turns: {
2921
+ /** Serve one turn and answer it as one JSON body. Throws `FieldRefusal` when the turn fails. */
2922
+ send(profile: string, options: FieldTurnOptions): Promise<FieldTurnAnswer>;
2923
+ /**
2924
+ * Serve one turn as a stream of frames. A refusal before the stream
2925
+ * starts throws `FieldRefusal` from the loop; a failure once it has
2926
+ * started arrives as an `error` frame and ends the stream.
2927
+ */
2928
+ stream(profile: string, options: FieldTurnOptions): AsyncGenerator<FieldTurnFrame, void, undefined>;
2929
+ };
2930
+ sessions: {
2931
+ /** Read one session's record, turn by turn. */
2932
+ get(id: string, options?: {
2933
+ signal?: AbortSignal;
2934
+ }): Promise<FieldSessionRecord>;
2935
+ };
2936
+ };
2937
+ /**
2938
+ * Create a serving client. It holds the key and the host, nothing else: no
2939
+ * state between calls, no retries, no timeout of its own (pass `signal`).
2940
+ */
2941
+ declare function createFieldClient(options: FieldClientOptions): FieldClient;
2942
+
2943
+ export { type AlignmentProvenance, type CaptureTurnInput, type CapturedTurn, DEFAULT_FIELD_ENDPOINT, type EnvironmentEventInput, FIELD_REASONING_EFFORTS, FIELD_REFUSAL_CODES, type FieldClient, type FieldClientOptions, type FieldConnection, type FieldConversation, type FieldDoneFrame, type FieldEmptyCompletionReason, type FieldEndedReason, type FieldErrorFrame, type FieldEventRecord, type FieldLimits, type FieldNotice, type FieldProfile, type FieldProfileEndpoint, type FieldProfileLinks, type FieldProfilePut, type FieldProfileRuntimeSource, type FieldPutOptions, type FieldReadFrame, type FieldReasoningEffort, FieldRefusal, type FieldRefusalCode, type FieldRunFrame, type FieldRuntime, type FieldRuntimeSource, type FieldSafeguards, type FieldSessionRecord, type FieldSessionSummary, type FieldSessionTurn, type FieldSessionsOptions, type FieldSessionsPage, type FieldStartOptions, type FieldTurnAnswer, type FieldTurnFrame, type FieldTurnOptions, type FieldVersionRef, type OutcomeEventEmit, type OutcomeHook, type OutcomeResult, type PersonaConfig, Probe, type ProbeConfig, type ProbeConfigInput, SPAN_INTERVAL_KINDS, SPAN_PAYLOAD_STATES, SPAN_STATUSES, SPAN_TYPES, SPAN_V2_STATUSES, Probe as Sight, type SightAiTelemetry, type SightAiTelemetryOptions, type AlignmentProvenance as SightAlignmentProvenance, type CaptureTurnInput as SightCaptureTurnInput, type CapturedTurn as SightCapturedTurn, type ProbeConfig as SightConfig, type ProbeConfigInput as SightConfigInput, type EnvironmentEventInput as SightEnvironmentEventInput, type OutcomeEventEmit as SightOutcomeEventEmit, type OutcomeHook as SightOutcomeHook, type OutcomeResult as SightOutcomeResult, type PersonaConfig as SightPersonaConfig, type SpanInput as SightSpanInput, type SpanInputV2 as SightSpanInputV2, type SpansBatch as SightSpansBatch, type SpanInput, SpanInputSchema, type SpanInputV1, SpanInputV1Schema, type SpanInputV2, SpanInputV2Schema, type SpanInterval, type SpanIntervalKind, SpanIntervalSchema, type SpanPayload, SpanPayloadSchema, type SpanPayloadState, type SpanStatus, type SpanType, type SpansBatch, SpansBatchSchema, createFieldClient, sightTelemetry, wrapOpenAI };