@inixiative/foundry-core 0.2.0 → 0.3.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/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { TokenCounts } from "./token-counts";
1
+ import type { TokenCounts } from './token-counts';
2
2
  // ---------------------------------------------------------------------------
3
3
  // Shared types — used by harness for conditional invocation/activation
4
4
  // ---------------------------------------------------------------------------
@@ -21,7 +21,7 @@ export interface InvocationCondition {
21
21
  * Full AgentSettingsConfig lives in @inixiative/foundry.
22
22
  */
23
23
  export interface AgentModeConfig {
24
- invocation?: "always" | "on-demand" | "conditional";
24
+ invocation?: 'always' | 'on-demand' | 'conditional';
25
25
  condition?: InvocationCondition;
26
26
  }
27
27
 
@@ -30,7 +30,7 @@ export interface AgentModeConfig {
30
30
  * Full LayerSettingsConfig lives in @inixiative/foundry.
31
31
  */
32
32
  export interface LayerModeConfig {
33
- activation?: "always" | "on-demand" | "conditional";
33
+ activation?: 'always' | 'on-demand' | 'conditional';
34
34
  condition?: InvocationCondition;
35
35
  }
36
36
 
@@ -39,7 +39,7 @@ export interface LayerModeConfig {
39
39
  // ---------------------------------------------------------------------------
40
40
 
41
41
  export interface LLMMessage {
42
- readonly role: "system" | "user" | "assistant";
42
+ readonly role: 'system' | 'user' | 'assistant';
43
43
  readonly content: string;
44
44
  }
45
45
 
@@ -82,7 +82,7 @@ export interface CompletionOpts {
82
82
  /** Max agentic turns (for runtimes that support tool use). */
83
83
  maxTurns?: number | null;
84
84
  /** Additive native ownership contract; optional for standalone/legacy providers. */
85
- nativeObservation?: import("./native-evidence").NativeObservation;
85
+ nativeObservation?: import('./native-evidence').NativeObservation;
86
86
  /** Enable/disable tool use. False = pure text completion. */
87
87
  tools?: boolean;
88
88
  /** Tool definitions for the LLM to call. Providers map to native format. */
@@ -95,9 +95,9 @@ export interface CompletionOpts {
95
95
  * Providers translate: Anthropic → thinking.budget_tokens, OpenAI → reasoning_effort.
96
96
  * "none" = no thinking, "low"/"medium"/"high" = increasing effort, number = explicit budget tokens.
97
97
  */
98
- thinking?: "none" | "low" | "medium" | "high" | number;
98
+ thinking?: 'none' | 'low' | 'medium' | 'high' | number;
99
99
  /** Permission level for code execution runtimes (claude-code, codex). */
100
- permissions?: "bypass" | "supervised" | "restricted";
100
+ permissions?: 'bypass' | 'restricted';
101
101
  /** Per-call timeout in ms. Provider uses its own default if omitted. */
102
102
  timeout?: number;
103
103
  /** Enable prompt caching where supported. */
@@ -108,10 +108,16 @@ export interface CompletionOpts {
108
108
  cwd?: string;
109
109
  /** Scheduling hint for providers that queue calls: higher runs first. Default 0. Others ignore it. */
110
110
  priority?: number;
111
+ /**
112
+ * Leading text of the final user message that stays the same across calls
113
+ * (owned layer content). Session providers may prime it once and reuse the
114
+ * cached prefix; others ignore it. Messages are sent unchanged either way.
115
+ */
116
+ stablePrefix?: string;
111
117
  }
112
118
 
113
119
  export interface CompletionResult {
114
- readonly native?: import("./native-evidence").NativeEvidence;
120
+ readonly native?: import('./native-evidence').NativeEvidence;
115
121
  readonly content: string;
116
122
  readonly model: string;
117
123
  readonly tokens?: TokenCounts;
@@ -127,7 +133,7 @@ export interface EmbeddingResult {
127
133
  }
128
134
 
129
135
  export interface LLMStreamEvent {
130
- type: "text" | "usage" | "done" | "error";
136
+ type: 'text' | 'usage' | 'done' | 'error';
131
137
  text?: string;
132
138
  tokens?: TokenCounts;
133
139
  error?: string;
@@ -137,27 +143,30 @@ export interface LLMStreamEvent {
137
143
  export interface LLMProvider {
138
144
  readonly id: string;
139
145
  /** Native callback support, distinct from stateless/legacy serializable options. */
140
- readonly nativeOwnership?: "required-prewrite";
146
+ readonly nativeOwnership?: 'required-prewrite';
141
147
  /** Optional owned-call evidence. A rejected waiter alone never proves remote settlement. */
142
148
  readonly completionLifecycle?: {
143
- readonly kind: "request" | "session";
144
- settlement(outcome: { result?: CompletionResult; error?: unknown }): "settled" | "unknown";
145
- admission?(outcome: { result?: CompletionResult; error?: unknown }): "not-admitted" | "attempted" | "unknown";
149
+ readonly kind: 'request' | 'session';
150
+ settlement(outcome: { result?: CompletionResult; error?: unknown }): 'settled' | 'unknown';
151
+ admission?(outcome: {
152
+ result?: CompletionResult;
153
+ error?: unknown;
154
+ }): 'not-admitted' | 'attempted' | 'unknown';
146
155
  /** Read only the original registered admission. Never sends, resumes or replaces work. */
147
- inspectOwnedAdmission?(owner: import("./native-evidence").NativeOwner, admissionId: string): Promise<import("./native-evidence").OwnedAdmissionInspection | undefined>;
156
+ inspectOwnedAdmission?(
157
+ owner: import('./native-evidence').NativeOwner,
158
+ admissionId: string,
159
+ ): Promise<import('./native-evidence').OwnedAdmissionInspection | undefined>;
148
160
  /** Cleanup of that original, confirmed idle pool entry; never a current-scope lookup. */
149
- releaseOwnedAdmission?(owner: import("./native-evidence").NativeOwner, admissionId: string): Promise<"released" | "unknown" | "unavailable">;
161
+ releaseOwnedAdmission?(
162
+ owner: import('./native-evidence').NativeOwner,
163
+ admissionId: string,
164
+ ): Promise<'released' | 'unknown' | 'unavailable'>;
150
165
  /** Release only a confirmed idle owned resource; never clear its resume binding. */
151
- releaseIdle?(opts: CompletionOpts): Promise<"released" | "unknown" | "unavailable">;
166
+ releaseIdle?(opts: CompletionOpts): Promise<'released' | 'unknown' | 'unavailable'>;
152
167
  };
153
- complete(
154
- messages: LLMMessage[],
155
- opts?: CompletionOpts
156
- ): Promise<CompletionResult>;
157
- stream?(
158
- messages: LLMMessage[],
159
- opts?: CompletionOpts
160
- ): AsyncGenerator<LLMStreamEvent>;
168
+ complete(messages: LLMMessage[], opts?: CompletionOpts): Promise<CompletionResult>;
169
+ stream?(messages: LLMMessage[], opts?: CompletionOpts): AsyncGenerator<LLMStreamEvent>;
161
170
  }
162
171
 
163
172
  export interface EmbeddingProvider {