@inixiative/foundry-core 0.1.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/package.json +1 -6
- package/src/action-prompt.ts +47 -28
- package/src/adapters/file-memory.ts +314 -122
- package/src/adapters/http-memory.ts +19 -24
- package/src/adapters/index.ts +4 -4
- package/src/adapters/markdown-docs.ts +15 -15
- package/src/adapters/sqlite-memory.ts +29 -27
- package/src/base-agent.ts +5 -7
- package/src/cache-lifecycle.ts +14 -14
- package/src/capability.ts +76 -83
- package/src/clarifier.ts +46 -0
- package/src/classifier.ts +6 -9
- package/src/context-layer.ts +125 -78
- package/src/context-stack.ts +15 -14
- package/src/credentials.ts +4 -2
- package/src/decider.ts +7 -8
- package/src/delivery-evidence.ts +206 -55
- package/src/event-stream.ts +34 -20
- package/src/executor.ts +81 -43
- package/src/harness.ts +225 -126
- package/src/hooks.ts +26 -26
- package/src/hydrator.ts +6 -8
- package/src/id.ts +3 -3
- package/src/index.ts +248 -218
- package/src/intervention.ts +21 -12
- package/src/messages.ts +73 -62
- package/src/middleware.ts +9 -19
- package/src/model-registry.ts +1587 -0
- package/src/native-evidence.ts +124 -30
- package/src/permission-middleware.ts +16 -28
- package/src/retry.ts +6 -6
- package/src/router.ts +5 -5
- package/src/signal.ts +16 -11
- package/src/thread.ts +138 -61
- package/src/token-counts.ts +9 -1
- package/src/token-tracker.ts +43 -34
- package/src/tools.ts +138 -95
- package/src/trace.ts +44 -23
- package/src/types.ts +33 -24
package/src/hooks.ts
CHANGED
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
// ---------------------------------------------------------------------------
|
|
4
4
|
|
|
5
5
|
export type HookPoint =
|
|
6
|
-
|
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
6
|
+
| 'pre:dispatch'
|
|
7
|
+
| 'post:dispatch'
|
|
8
|
+
| 'pre:classify'
|
|
9
|
+
| 'post:classify'
|
|
10
|
+
| 'pre:route'
|
|
11
|
+
| 'post:route'
|
|
12
|
+
| 'pre:compact'
|
|
13
|
+
| 'post:compact'
|
|
14
|
+
| 'session:create'
|
|
15
|
+
| 'session:archive'
|
|
16
|
+
| 'budget:warning'
|
|
17
|
+
| 'budget:exceeded'
|
|
18
|
+
| 'plan:enter'
|
|
19
|
+
| 'plan:exit'
|
|
20
|
+
| 'error:agent'
|
|
21
|
+
| 'error:provider';
|
|
22
22
|
|
|
23
23
|
export interface HookContext {
|
|
24
24
|
hookPoint: HookPoint;
|
|
@@ -31,7 +31,7 @@ export interface HookContext {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface HookResult {
|
|
34
|
-
action:
|
|
34
|
+
action: 'continue' | 'skip' | 'abort' | 'redirect';
|
|
35
35
|
redirectTo?: string;
|
|
36
36
|
modified?: Partial<HookContext>;
|
|
37
37
|
annotations?: Record<string, unknown>;
|
|
@@ -45,7 +45,7 @@ export interface HookHandler {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface PlanModeTrigger {
|
|
48
|
-
kind:
|
|
48
|
+
kind: 'complexity' | 'newDomain' | 'largeDiff' | 'custom';
|
|
49
49
|
threshold?: number;
|
|
50
50
|
detect?: (ctx: HookContext) => boolean;
|
|
51
51
|
}
|
|
@@ -67,7 +67,9 @@ export class HookRegistry {
|
|
|
67
67
|
|
|
68
68
|
register(handler: HookHandler): () => void {
|
|
69
69
|
this._handlers.set(handler.id, handler);
|
|
70
|
-
return () => {
|
|
70
|
+
return () => {
|
|
71
|
+
this._handlers.delete(handler.id);
|
|
72
|
+
};
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
unregister(id: string): boolean {
|
|
@@ -76,11 +78,11 @@ export class HookRegistry {
|
|
|
76
78
|
|
|
77
79
|
async execute(
|
|
78
80
|
point: HookPoint,
|
|
79
|
-
ctx: HookContext
|
|
80
|
-
): Promise<HookContext & { action: HookResult[
|
|
81
|
+
ctx: HookContext,
|
|
82
|
+
): Promise<HookContext & { action: HookResult['action'] }> {
|
|
81
83
|
const handlers = this.forPoint(point);
|
|
82
84
|
let current = { ...ctx };
|
|
83
|
-
let action: HookResult[
|
|
85
|
+
let action: HookResult['action'] = 'continue';
|
|
84
86
|
|
|
85
87
|
for (const handler of handlers) {
|
|
86
88
|
const result = await handler.handler(current);
|
|
@@ -102,7 +104,7 @@ export class HookRegistry {
|
|
|
102
104
|
current.meta = { ...current.meta, redirectTo: result.redirectTo };
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
if (action ===
|
|
107
|
+
if (action === 'abort' || action === 'skip' || action === 'redirect') {
|
|
106
108
|
break;
|
|
107
109
|
}
|
|
108
110
|
}
|
|
@@ -117,9 +119,7 @@ export class HookRegistry {
|
|
|
117
119
|
matching.push(handler);
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
|
-
matching.sort(
|
|
121
|
-
(a, b) => (a.priority ?? DEFAULT_PRIORITY) - (b.priority ?? DEFAULT_PRIORITY)
|
|
122
|
-
);
|
|
122
|
+
matching.sort((a, b) => (a.priority ?? DEFAULT_PRIORITY) - (b.priority ?? DEFAULT_PRIORITY));
|
|
123
123
|
return matching;
|
|
124
124
|
}
|
|
125
125
|
|
package/src/hydrator.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContextSource } from
|
|
1
|
+
import type { ContextSource } from './context-layer';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A ref is a pointer into a knowledge system.
|
|
@@ -106,7 +106,7 @@ export class HydrationRegistry {
|
|
|
106
106
|
* Returns concatenated content in ref order.
|
|
107
107
|
*/
|
|
108
108
|
async hydrateAll(refs: ContextRef[]): Promise<string> {
|
|
109
|
-
if (refs.length === 0) return
|
|
109
|
+
if (refs.length === 0) return '';
|
|
110
110
|
|
|
111
111
|
// Group by system
|
|
112
112
|
const bySystem = new Map<string, { idx: number; ref: ContextRef }[]>();
|
|
@@ -127,9 +127,7 @@ export class HydrationRegistry {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
if (adapter.hydrateBatch && entries.length > 1) {
|
|
130
|
-
const batchResults = await adapter.hydrateBatch(
|
|
131
|
-
entries.map((e) => e.ref)
|
|
132
|
-
);
|
|
130
|
+
const batchResults = await adapter.hydrateBatch(entries.map((e) => e.ref));
|
|
133
131
|
for (let i = 0; i < entries.length; i++) {
|
|
134
132
|
results[entries[i].idx] = batchResults[i];
|
|
135
133
|
}
|
|
@@ -137,12 +135,12 @@ export class HydrationRegistry {
|
|
|
137
135
|
await Promise.all(
|
|
138
136
|
entries.map(async (entry) => {
|
|
139
137
|
results[entry.idx] = await adapter.hydrate(entry.ref);
|
|
140
|
-
})
|
|
138
|
+
}),
|
|
141
139
|
);
|
|
142
140
|
}
|
|
143
|
-
})
|
|
141
|
+
}),
|
|
144
142
|
);
|
|
145
143
|
|
|
146
|
-
return results.join(
|
|
144
|
+
return results.join('\n\n');
|
|
147
145
|
}
|
|
148
146
|
}
|
package/src/id.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { uuidv7 } from
|
|
1
|
+
import { uuidv7 } from 'uuidv7';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Mint a new UUID v7 identifier, optionally prefixed.
|
|
@@ -26,14 +26,14 @@ export function idAtTime(prefix: string | undefined, date: Date): string {
|
|
|
26
26
|
if (ms < 0 || ms > 0xffffffffffff) {
|
|
27
27
|
throw new RangeError(`timestamp ${ms} out of UUID v7 range`);
|
|
28
28
|
}
|
|
29
|
-
const hex = ms.toString(16).padStart(12,
|
|
29
|
+
const hex = ms.toString(16).padStart(12, '0');
|
|
30
30
|
const uuid = `${hex.slice(0, 8)}-${hex.slice(8, 12)}-7000-8000-000000000000`;
|
|
31
31
|
return prefix ? `${prefix}_${uuid}` : uuid;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/** Extract the millisecond timestamp encoded in a UUID v7 id (with or without prefix). */
|
|
35
35
|
export function timeFromId(id: string): number {
|
|
36
|
-
const uuid = id.includes(
|
|
36
|
+
const uuid = id.includes('_') ? id.slice(id.lastIndexOf('_') + 1) : id;
|
|
37
37
|
const hex = uuid.slice(0, 8) + uuid.slice(9, 13);
|
|
38
38
|
return parseInt(hex, 16);
|
|
39
39
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,272 +2,302 @@
|
|
|
2
2
|
// @inixiative/foundry-core — the engine
|
|
3
3
|
// ---------------------------------------------------------------------------
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
export type {
|
|
7
|
-
InvocationCondition,
|
|
8
|
-
AgentModeConfig,
|
|
9
|
-
LayerModeConfig,
|
|
10
|
-
LLMMessage,
|
|
11
|
-
CompletionOpts,
|
|
12
|
-
CompletionResult,
|
|
13
|
-
ToolDefinition,
|
|
14
|
-
ToolCall,
|
|
15
|
-
ToolCallResult,
|
|
16
|
-
EmbeddingResult,
|
|
17
|
-
LLMStreamEvent,
|
|
18
|
-
LLMProvider,
|
|
19
|
-
EmbeddingProvider,
|
|
20
|
-
} from "./types";
|
|
21
|
-
|
|
22
|
-
// Ownership scope — which thread/project owns a source read or tool call
|
|
23
|
-
export { normalizeScope, type OwnershipScope } from "./scope";
|
|
24
|
-
|
|
25
|
-
// Message utilities
|
|
5
|
+
// Action Prompts (agent→human interaction)
|
|
26
6
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type
|
|
31
|
-
type
|
|
32
|
-
type
|
|
33
|
-
type
|
|
34
|
-
type
|
|
35
|
-
type
|
|
36
|
-
type
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
7
|
+
type ActionOption,
|
|
8
|
+
type ActionPrompt,
|
|
9
|
+
ActionQueue,
|
|
10
|
+
type ActionResolution,
|
|
11
|
+
type PromptKind,
|
|
12
|
+
type PromptListener,
|
|
13
|
+
type PromptOpts,
|
|
14
|
+
type PromptPolicy,
|
|
15
|
+
type PromptStatus,
|
|
16
|
+
type PromptUrgency,
|
|
17
|
+
} from './action-prompt';
|
|
18
|
+
// Lightweight adapters (zero external deps)
|
|
19
|
+
export {
|
|
20
|
+
DEFAULT_MEMORY_SELECTION,
|
|
21
|
+
entryVisibleTo,
|
|
22
|
+
FileMemory,
|
|
23
|
+
fileSource,
|
|
24
|
+
focusTerms,
|
|
25
|
+
inlineSource,
|
|
26
|
+
type MemoryEntry,
|
|
27
|
+
type MemoryReadScope,
|
|
28
|
+
type MemorySelectionPolicy,
|
|
29
|
+
type MemorySelectionReport,
|
|
30
|
+
type MemorySourceOpts,
|
|
31
|
+
MemoryView,
|
|
32
|
+
selectMemory,
|
|
33
|
+
validateMemorySelection,
|
|
34
|
+
} from './adapters/file-memory';
|
|
35
|
+
export { HttpMemory } from './adapters/http-memory';
|
|
36
|
+
export { claudemdSource, MarkdownDocs } from './adapters/markdown-docs';
|
|
37
|
+
export { type SqliteEntry, SqliteMemory } from './adapters/sqlite-memory';
|
|
38
|
+
// Agent primitives
|
|
39
|
+
export {
|
|
40
|
+
type AgentConfig,
|
|
41
|
+
type AgentLLMConfig,
|
|
42
|
+
BaseAgent,
|
|
43
|
+
type ExecutionResult,
|
|
44
|
+
} from './base-agent';
|
|
45
|
+
// Bounded data structures
|
|
46
|
+
export { BoundedSet } from './bounded-set';
|
|
47
|
+
export {
|
|
48
|
+
CacheLifecycle,
|
|
49
|
+
type LifecycleEvent,
|
|
50
|
+
type LifecycleHandler,
|
|
51
|
+
type LifecycleRule,
|
|
52
|
+
} from './cache-lifecycle';
|
|
53
|
+
// Capabilities (permission flags + gating)
|
|
54
|
+
export {
|
|
55
|
+
BROWSER_POLICY,
|
|
56
|
+
type BuiltinCapability,
|
|
57
|
+
type Capability,
|
|
58
|
+
CapabilityDeniedError,
|
|
59
|
+
CapabilityGate,
|
|
60
|
+
type GateContext,
|
|
61
|
+
type PermissionLevel,
|
|
62
|
+
type PermissionPolicy,
|
|
63
|
+
RESTRICTED_POLICY,
|
|
64
|
+
} from './capability';
|
|
65
|
+
export {
|
|
66
|
+
type ClarificationResult,
|
|
67
|
+
Clarifier,
|
|
68
|
+
type ClarifierConfig,
|
|
69
|
+
type ClarifyHandler,
|
|
70
|
+
type ClarifyPayload,
|
|
71
|
+
} from './clarifier';
|
|
72
|
+
export {
|
|
73
|
+
type Classification,
|
|
74
|
+
Classifier,
|
|
75
|
+
type ClassifierConfig,
|
|
76
|
+
type ClassifyHandler,
|
|
77
|
+
} from './classifier';
|
|
40
78
|
// Context primitives
|
|
41
79
|
export {
|
|
42
80
|
ContextLayer,
|
|
81
|
+
type ContextLayerConfig,
|
|
82
|
+
type ContextSource,
|
|
43
83
|
computeHash,
|
|
44
84
|
copyMessageIdentity,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
type ContextLayerConfig,
|
|
85
|
+
isLayerSegment,
|
|
86
|
+
LAYER_SEGMENTS,
|
|
48
87
|
type LayerDefinition,
|
|
49
88
|
type LayerInstanceState,
|
|
50
|
-
type LayerVersionMark,
|
|
51
|
-
type LayerSegment,
|
|
52
|
-
LAYER_SEGMENTS,
|
|
53
|
-
isLayerSegment,
|
|
54
89
|
type LayerMutationEvent,
|
|
90
|
+
type LayerSegment,
|
|
55
91
|
type LayerSelectionState,
|
|
56
92
|
type LayerState,
|
|
93
|
+
type LayerVersionMark,
|
|
94
|
+
type LogicalMessageIdentity,
|
|
95
|
+
REQUIRED_CONTEXT_BLOCKED,
|
|
57
96
|
type SourceLoadHint,
|
|
58
97
|
type SourceSelectionReport,
|
|
59
98
|
type VersionEntry,
|
|
60
99
|
type VersionLog,
|
|
61
|
-
} from
|
|
62
|
-
|
|
100
|
+
} from './context-layer';
|
|
63
101
|
export {
|
|
64
|
-
|
|
65
|
-
type LayerFilter,
|
|
102
|
+
type AssembledContext,
|
|
66
103
|
type ContextSnapshot,
|
|
104
|
+
ContextStack,
|
|
67
105
|
type ContextStackView,
|
|
106
|
+
type LayerFilter,
|
|
68
107
|
type PromptBlock,
|
|
69
|
-
|
|
70
|
-
} from
|
|
71
|
-
|
|
108
|
+
} from './context-stack';
|
|
109
|
+
export type { CredentialReference, CredentialResolver, CredentialScope } from './credentials';
|
|
110
|
+
export { type DecideHandler, Decider, type DeciderConfig, type Decision } from './decider';
|
|
111
|
+
export type {
|
|
112
|
+
DeliveryOwner,
|
|
113
|
+
ExpertDeliveryProof,
|
|
114
|
+
ProviderBoundaryReceipt,
|
|
115
|
+
} from './delivery-evidence';
|
|
72
116
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} from
|
|
117
|
+
assemblyDigest,
|
|
118
|
+
boundaryReceipt,
|
|
119
|
+
evidenceDigest,
|
|
120
|
+
verifyExpertDelivery,
|
|
121
|
+
} from './delivery-evidence';
|
|
122
|
+
// Observability
|
|
123
|
+
export { EventStream, type SessionEvent, type StreamEvent } from './event-stream';
|
|
124
|
+
export { type ExecuteHandler, type ExecuteMeta, Executor, type ExecutorConfig } from './executor';
|
|
125
|
+
export {
|
|
126
|
+
type FlowConfig,
|
|
127
|
+
type FlowStage,
|
|
128
|
+
Harness,
|
|
129
|
+
type HarnessResult,
|
|
130
|
+
type Message,
|
|
131
|
+
matchesCondition,
|
|
132
|
+
type PipelineStep,
|
|
133
|
+
type RequestContext,
|
|
134
|
+
} from './harness';
|
|
78
135
|
|
|
136
|
+
// Lifecycle Hooks (registry only — built-in hooks in @inixiative/foundry)
|
|
137
|
+
export {
|
|
138
|
+
type HookContext,
|
|
139
|
+
type HookHandler,
|
|
140
|
+
type HookPoint,
|
|
141
|
+
HookRegistry,
|
|
142
|
+
type HookResult,
|
|
143
|
+
type PlanModeConfig,
|
|
144
|
+
type PlanModeTrigger,
|
|
145
|
+
} from './hooks';
|
|
79
146
|
export {
|
|
80
|
-
HydrationRegistry,
|
|
81
|
-
RefSource,
|
|
82
147
|
type ContextRef,
|
|
83
148
|
type HydrationAdapter,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
149
|
+
HydrationRegistry,
|
|
150
|
+
RefSource,
|
|
151
|
+
} from './hydrator';
|
|
152
|
+
// IDs (UUID v7 — carries its own creation timestamp)
|
|
153
|
+
export { idAtTime, newId, timeFromId } from './id';
|
|
154
|
+
// Interventions
|
|
155
|
+
export { type Intervention, InterventionLog, type InterventionThread } from './intervention';
|
|
156
|
+
// Message utilities
|
|
87
157
|
export {
|
|
88
|
-
|
|
89
|
-
type
|
|
90
|
-
|
|
91
|
-
type
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
158
|
+
assembledToMessages,
|
|
159
|
+
type BuildInjectionArtifactOpts,
|
|
160
|
+
buildInjectionArtifact,
|
|
161
|
+
type DecorationParticipant,
|
|
162
|
+
type DeliveryRecord,
|
|
163
|
+
type InjectionArtifact,
|
|
164
|
+
type InjectionBlock,
|
|
165
|
+
type InjectionSegmentKind,
|
|
166
|
+
type MessageDecoration,
|
|
167
|
+
type ParticipantRequest,
|
|
168
|
+
splitSystemMessage,
|
|
169
|
+
} from './messages';
|
|
99
170
|
// Middleware
|
|
100
171
|
export {
|
|
101
|
-
MiddlewareChain,
|
|
102
|
-
type Middleware,
|
|
103
|
-
type MiddlewareTier,
|
|
104
|
-
type MiddlewareEntry,
|
|
105
172
|
type DispatchContext,
|
|
106
173
|
type DispatchOutcome,
|
|
174
|
+
type Middleware,
|
|
175
|
+
MiddlewareChain,
|
|
176
|
+
type MiddlewareEntry,
|
|
107
177
|
type MiddlewareNext,
|
|
108
|
-
|
|
109
|
-
|
|
178
|
+
type MiddlewareTier,
|
|
179
|
+
} from './middleware';
|
|
180
|
+
export {
|
|
181
|
+
type CostTier,
|
|
182
|
+
DECISION_MODEL,
|
|
183
|
+
DECISION_PROVIDER,
|
|
184
|
+
type DecisionModelDefaults,
|
|
185
|
+
type FoundryModelInfo,
|
|
186
|
+
type FoundryProviderInfo,
|
|
187
|
+
MODEL_CAPABILITIES,
|
|
188
|
+
MODEL_REGISTRY,
|
|
189
|
+
MODEL_REGISTRY_UPDATED_AT,
|
|
190
|
+
type ModelCapability,
|
|
191
|
+
type ModelReasoning,
|
|
192
|
+
type ModelSweepOption,
|
|
193
|
+
type ModelTier,
|
|
194
|
+
modelCapabilities,
|
|
195
|
+
modelHasCapability,
|
|
196
|
+
modelOptionsByCapability,
|
|
197
|
+
type ProviderCredential,
|
|
198
|
+
type ProviderType,
|
|
199
|
+
providersWithCapability,
|
|
200
|
+
type ReasoningEffort,
|
|
201
|
+
type RuntimeKind,
|
|
202
|
+
registryModel,
|
|
203
|
+
resolveDecisionModel,
|
|
204
|
+
} from './model-registry';
|
|
205
|
+
export * from './native-evidence';
|
|
206
|
+
// Permission middleware
|
|
207
|
+
export {
|
|
208
|
+
type PermissionCheck,
|
|
209
|
+
type PermissionCheckResult,
|
|
210
|
+
type PermissionMiddlewareConfig,
|
|
211
|
+
permissionMiddleware,
|
|
212
|
+
} from './permission-middleware';
|
|
213
|
+
// Retry middleware
|
|
214
|
+
export { type RetryConfig, retryMiddleware } from './retry';
|
|
215
|
+
export { type Route, type RouteHandler, Router, type RouterConfig } from './router';
|
|
216
|
+
// Ownership scope — which thread/project owns a source read or tool call
|
|
217
|
+
export { normalizeScope, type OwnershipScope } from './scope';
|
|
110
218
|
// Signals
|
|
111
|
-
export {
|
|
112
|
-
|
|
219
|
+
export { type Signal, SignalBus, type SignalHandler, type SignalKind } from './signal';
|
|
113
220
|
// Orchestration
|
|
114
221
|
export {
|
|
115
|
-
Thread,
|
|
116
|
-
type ThreadStatus,
|
|
117
|
-
type ThreadMeta,
|
|
118
|
-
type ThreadConfig,
|
|
119
222
|
type Dispatch,
|
|
120
|
-
type DispatchOptions,
|
|
121
223
|
type DispatchObservation,
|
|
224
|
+
type DispatchOptions,
|
|
122
225
|
type FanResult,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
type
|
|
129
|
-
type
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
type RequestContext,
|
|
134
|
-
} from "./harness";
|
|
135
|
-
|
|
136
|
-
// Tracing
|
|
137
|
-
export { Trace, type Span, type SpanKind, type SpanStatus, type TraceSummary, type StageSummary } from "./trace";
|
|
138
|
-
|
|
139
|
-
// Interventions
|
|
140
|
-
export { InterventionLog, type Intervention } from "./intervention";
|
|
141
|
-
|
|
142
|
-
// Observability
|
|
143
|
-
export { EventStream, type StreamEvent, type SessionEvent } from "./event-stream";
|
|
144
|
-
|
|
226
|
+
Thread,
|
|
227
|
+
type ThreadConfig,
|
|
228
|
+
type ThreadContext,
|
|
229
|
+
type ThreadMeta,
|
|
230
|
+
type ThreadName,
|
|
231
|
+
type ThreadReference,
|
|
232
|
+
type ThreadStatus,
|
|
233
|
+
threadTitle,
|
|
234
|
+
} from './thread';
|
|
235
|
+
export { sumTokenCounts, type TokenCounts, totalTokenCount } from './token-counts';
|
|
145
236
|
// Token & Cost Tracking
|
|
146
237
|
export {
|
|
147
|
-
|
|
238
|
+
type BudgetConfig,
|
|
148
239
|
BudgetExceededError,
|
|
149
|
-
|
|
240
|
+
type BudgetStatus,
|
|
241
|
+
type CostTable,
|
|
150
242
|
DEFAULT_COST_TABLE,
|
|
151
|
-
|
|
152
|
-
type UsageEntry,
|
|
243
|
+
estimateTokens,
|
|
153
244
|
type ModelPricing,
|
|
154
|
-
|
|
155
|
-
type
|
|
156
|
-
type BudgetStatus,
|
|
245
|
+
TokenTracker,
|
|
246
|
+
type TokenUsage,
|
|
157
247
|
type UsageBreakdown,
|
|
248
|
+
type UsageEntry,
|
|
158
249
|
type UsageSummary,
|
|
159
|
-
} from
|
|
160
|
-
|
|
161
|
-
// Lifecycle Hooks (registry only — built-in hooks in @inixiative/foundry)
|
|
162
|
-
export {
|
|
163
|
-
HookRegistry,
|
|
164
|
-
type HookPoint,
|
|
165
|
-
type HookContext,
|
|
166
|
-
type HookResult,
|
|
167
|
-
type HookHandler,
|
|
168
|
-
type PlanModeConfig,
|
|
169
|
-
type PlanModeTrigger,
|
|
170
|
-
} from "./hooks";
|
|
171
|
-
|
|
172
|
-
// Action Prompts (agent→human interaction)
|
|
173
|
-
export {
|
|
174
|
-
ActionQueue,
|
|
175
|
-
type ActionPrompt,
|
|
176
|
-
type ActionResolution,
|
|
177
|
-
type ActionOption,
|
|
178
|
-
type PromptKind,
|
|
179
|
-
type PromptUrgency,
|
|
180
|
-
type PromptStatus,
|
|
181
|
-
type PromptOpts,
|
|
182
|
-
type PromptListener,
|
|
183
|
-
type PromptPolicy,
|
|
184
|
-
} from "./action-prompt";
|
|
185
|
-
|
|
186
|
-
// Capabilities (permission flags + gating)
|
|
187
|
-
export {
|
|
188
|
-
CapabilityGate,
|
|
189
|
-
CapabilityDeniedError,
|
|
190
|
-
UNATTENDED_POLICY,
|
|
191
|
-
SUPERVISED_POLICY,
|
|
192
|
-
RESTRICTED_POLICY,
|
|
193
|
-
BROWSER_POLICY,
|
|
194
|
-
type Capability,
|
|
195
|
-
type BuiltinCapability,
|
|
196
|
-
type PermissionLevel,
|
|
197
|
-
type PermissionPolicy,
|
|
198
|
-
type GateContext,
|
|
199
|
-
} from "./capability";
|
|
200
|
-
|
|
201
|
-
// Lightweight adapters (zero external deps)
|
|
202
|
-
export {
|
|
203
|
-
FileMemory,
|
|
204
|
-
MemoryView,
|
|
205
|
-
entryVisibleTo,
|
|
206
|
-
inlineSource,
|
|
207
|
-
fileSource,
|
|
208
|
-
selectMemory,
|
|
209
|
-
focusTerms,
|
|
210
|
-
DEFAULT_MEMORY_SELECTION, validateMemorySelection,
|
|
211
|
-
type MemoryEntry,
|
|
212
|
-
type MemoryReadScope,
|
|
213
|
-
type MemorySourceOpts,
|
|
214
|
-
type MemorySelectionPolicy,
|
|
215
|
-
type MemorySelectionReport,
|
|
216
|
-
} from "./adapters/file-memory";
|
|
217
|
-
|
|
218
|
-
export { SqliteMemory, type SqliteEntry } from "./adapters/sqlite-memory";
|
|
219
|
-
export { HttpMemory } from "./adapters/http-memory";
|
|
220
|
-
export { MarkdownDocs, claudemdSource } from "./adapters/markdown-docs";
|
|
221
|
-
|
|
250
|
+
} from './token-tracker';
|
|
222
251
|
// Tools — typed execution interfaces
|
|
223
252
|
export {
|
|
224
|
-
ToolRegistry,
|
|
225
|
-
type Tool,
|
|
226
|
-
type ToolKind,
|
|
227
|
-
type ToolInfo,
|
|
228
|
-
type ToolResult,
|
|
229
|
-
type ToolCallObservation,
|
|
230
|
-
type BrowserTool,
|
|
231
|
-
type PageSnapshot,
|
|
232
|
-
type PageElement,
|
|
233
|
-
type NavigateOpts,
|
|
234
|
-
type ApiTool,
|
|
235
253
|
type ApiRequest,
|
|
236
254
|
type ApiResponse,
|
|
255
|
+
type ApiTool,
|
|
237
256
|
type ApiToolConfig,
|
|
238
|
-
type
|
|
239
|
-
type ShellResult,
|
|
240
|
-
type ShellOpts,
|
|
241
|
-
type OutputFilter,
|
|
242
|
-
type ScriptTool,
|
|
243
|
-
type ScriptResult,
|
|
244
|
-
type ScriptOpts,
|
|
245
|
-
type MemoryTool,
|
|
257
|
+
type BrowserTool,
|
|
246
258
|
type MemoryEntry as ToolMemoryEntry,
|
|
247
|
-
type MemoryVisibility,
|
|
248
259
|
type MemorySearchOpts,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
type MemoryTool,
|
|
261
|
+
type MemoryVisibility,
|
|
262
|
+
type NavigateOpts,
|
|
263
|
+
type OutputFilter,
|
|
264
|
+
type PageElement,
|
|
265
|
+
type PageSnapshot,
|
|
266
|
+
type ScriptOpts,
|
|
267
|
+
type ScriptResult,
|
|
268
|
+
type ScriptTool,
|
|
269
|
+
type ShellOpts,
|
|
270
|
+
type ShellResult,
|
|
271
|
+
type ShellTool,
|
|
272
|
+
type Tool,
|
|
273
|
+
type ToolCallObservation,
|
|
274
|
+
type ToolInfo,
|
|
275
|
+
type ToolKind,
|
|
276
|
+
ToolRegistry,
|
|
277
|
+
type ToolResult,
|
|
278
|
+
} from './tools';
|
|
279
|
+
// Tracing
|
|
261
280
|
export {
|
|
262
|
-
|
|
263
|
-
type
|
|
264
|
-
type
|
|
265
|
-
type
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
export type {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
281
|
+
type Span,
|
|
282
|
+
type SpanKind,
|
|
283
|
+
type SpanStatus,
|
|
284
|
+
type StageSummary,
|
|
285
|
+
Trace,
|
|
286
|
+
type TraceSummary,
|
|
287
|
+
} from './trace';
|
|
288
|
+
// Shared types
|
|
289
|
+
export type {
|
|
290
|
+
AgentModeConfig,
|
|
291
|
+
CompletionOpts,
|
|
292
|
+
CompletionResult,
|
|
293
|
+
EmbeddingProvider,
|
|
294
|
+
EmbeddingResult,
|
|
295
|
+
InvocationCondition,
|
|
296
|
+
LayerModeConfig,
|
|
297
|
+
LLMMessage,
|
|
298
|
+
LLMProvider,
|
|
299
|
+
LLMStreamEvent,
|
|
300
|
+
ToolCall,
|
|
301
|
+
ToolCallResult,
|
|
302
|
+
ToolDefinition,
|
|
303
|
+
} from './types';
|