@corbat-tech/coco 2.39.0 → 2.41.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/adapters/index.d.ts +93 -3
- package/dist/adapters/index.js +199 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/agent-runtime-BJeNjVuk.d.ts +71 -0
- package/dist/{blueprints-DYgm3K65.d.ts → blueprints-Dw5-uWU9.d.ts} +30 -4
- package/dist/cli/index.js +1436 -345
- package/dist/cli/index.js.map +1 -1
- package/dist/{agent-runtime-DJY9FzL_.d.ts → context-BLPsKYxc.d.ts} +500 -248
- package/dist/{index-Dp1o8c9g.d.ts → index-DhUKtM2p.d.ts} +2 -2
- package/dist/index.d.ts +10 -10
- package/dist/index.js +14887 -14117
- package/dist/index.js.map +1 -1
- package/dist/presets/index.d.ts +5 -5
- package/dist/presets/index.js +22778 -22952
- package/dist/presets/index.js.map +1 -1
- package/dist/{profiles-BcyL-gQ9.d.ts → profiles-GRoVNorK.d.ts} +7 -4
- package/dist/rag-B2oGudNb.d.ts +178 -0
- package/dist/runtime/index.d.ts +278 -8
- package/dist/runtime/index.js +7530 -24074
- package/dist/runtime/index.js.map +1 -1
- package/dist/tools/index.d.ts +4 -4
- package/dist/tools/index.js +10 -3
- package/dist/tools/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/extension-manifests-CAQQILhE.d.ts +0 -147
- package/dist/rag-BakFRE-u.d.ts +0 -31
- package/dist/registry-CEpl9Jq0.d.ts +0 -115
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as ToolRegistry } from './
|
|
2
|
-
import {
|
|
1
|
+
import { R as RuntimeRequestContext, T as ToolRegistry } from './context-BLPsKYxc.js';
|
|
2
|
+
import { R as RetrievedSource, K as KnowledgeRetriever } from './rag-B2oGudNb.js';
|
|
3
3
|
|
|
4
4
|
interface SupportDraftInput {
|
|
5
5
|
conversationId: string;
|
|
@@ -55,6 +55,7 @@ type SalesLeadSummaryHandler = (input: SalesLeadSummaryInput) => Promise<SalesLe
|
|
|
55
55
|
type InternalOpsDraftHandler = (input: InternalOpsDraftInput) => Promise<InternalOpsDraftOutput>;
|
|
56
56
|
interface SupportRagToolRegistryOptions {
|
|
57
57
|
retriever?: KnowledgeRetriever;
|
|
58
|
+
runtimeContext?: RuntimeRequestContext;
|
|
58
59
|
supportDraft?: SupportDraftHandler;
|
|
59
60
|
humanEscalation?: HumanEscalationHandler;
|
|
60
61
|
}
|
|
@@ -71,6 +72,8 @@ declare function createCustomerSupportToolRegistry(source?: ToolRegistry): ToolR
|
|
|
71
72
|
declare function createSupportRagToolRegistry(options?: SupportRagToolRegistryOptions): ToolRegistry;
|
|
72
73
|
declare function createSalesIntakeToolRegistry(options?: SalesIntakeToolRegistryOptions): ToolRegistry;
|
|
73
74
|
declare function createInternalOpsToolRegistry(options?: InternalOpsToolRegistryOptions): ToolRegistry;
|
|
74
|
-
declare function createRagToolRegistry(retriever?: KnowledgeRetriever
|
|
75
|
+
declare function createRagToolRegistry(retriever?: KnowledgeRetriever, options?: {
|
|
76
|
+
runtimeContext?: RuntimeRequestContext;
|
|
77
|
+
}): ToolRegistry;
|
|
75
78
|
|
|
76
|
-
export { type HumanEscalationHandler as H, type InternalOpsDraftHandler as I, type SupportDraftHandler as S, type
|
|
79
|
+
export { type HumanEscalationHandler as H, type InternalOpsDraftHandler as I, type SupportDraftHandler as S, type SalesLeadSummaryHandler as a, type HumanEscalationInput as b, type HumanEscalationOutput as c, type SupportDraftInput as d, type SupportDraftOutput as e, type SupportRagToolRegistryOptions as f, createCodingToolRegistry as g, createCustomerSupportToolRegistry as h, createNoToolRegistry as i, createPublicWebToolRegistry as j, createRagToolRegistry as k, createSupportRagToolRegistry as l, type InternalOpsDraftInput as m, type InternalOpsDraftOutput as n, type InternalOpsToolRegistryOptions as o, type SalesIntakeToolRegistryOptions as p, type SalesLeadSummaryInput as q, type SalesLeadSummaryOutput as r, createInternalOpsToolRegistry as s, createSalesIntakeToolRegistry as t };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { R as RuntimeRequestContext, D as DataBoundary } from './context-BLPsKYxc.js';
|
|
2
|
+
|
|
3
|
+
interface RetrievedSource {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
content: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
score: number;
|
|
9
|
+
metadata?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
interface RagDocument {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
content: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
tenantId?: string;
|
|
17
|
+
sourceId?: string;
|
|
18
|
+
acl?: DocumentAcl;
|
|
19
|
+
classification?: "public" | "internal" | "confidential" | "restricted";
|
|
20
|
+
version?: string;
|
|
21
|
+
updatedAt?: string;
|
|
22
|
+
deletedAt?: string;
|
|
23
|
+
metadata?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
interface RagChunk {
|
|
26
|
+
id: string;
|
|
27
|
+
documentId: string;
|
|
28
|
+
title: string;
|
|
29
|
+
content: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
tenantId?: string;
|
|
32
|
+
sourceId?: string;
|
|
33
|
+
acl?: DocumentAcl;
|
|
34
|
+
classification?: "public" | "internal" | "confidential" | "restricted";
|
|
35
|
+
version?: string;
|
|
36
|
+
updatedAt?: string;
|
|
37
|
+
deletedAt?: string;
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
interface DocumentAcl {
|
|
41
|
+
public?: boolean;
|
|
42
|
+
userIds?: string[];
|
|
43
|
+
roles?: string[];
|
|
44
|
+
groups?: string[];
|
|
45
|
+
}
|
|
46
|
+
interface Citation {
|
|
47
|
+
sourceId: string;
|
|
48
|
+
title: string;
|
|
49
|
+
url?: string;
|
|
50
|
+
score?: number;
|
|
51
|
+
}
|
|
52
|
+
interface RetrievalOptions {
|
|
53
|
+
limit?: number;
|
|
54
|
+
minScore?: number;
|
|
55
|
+
tenantId?: string;
|
|
56
|
+
userId?: string;
|
|
57
|
+
roles?: string[];
|
|
58
|
+
groups?: string[];
|
|
59
|
+
runtimeContext?: RuntimeRequestContext;
|
|
60
|
+
dataBoundary?: DataBoundary;
|
|
61
|
+
documentAccessPolicy?: DocumentAccessPolicy;
|
|
62
|
+
}
|
|
63
|
+
interface DocumentAccessPolicy {
|
|
64
|
+
canAccess(input: {
|
|
65
|
+
document: RagDocument | RagChunk | InMemoryKnowledgeDocument;
|
|
66
|
+
options: RetrievalOptions;
|
|
67
|
+
}): boolean;
|
|
68
|
+
}
|
|
69
|
+
interface DocumentLoader {
|
|
70
|
+
load(): Promise<RagDocument[]>;
|
|
71
|
+
}
|
|
72
|
+
interface Chunker {
|
|
73
|
+
chunk(document: RagDocument): Promise<RagChunk[]>;
|
|
74
|
+
}
|
|
75
|
+
interface EmbeddingProvider {
|
|
76
|
+
embed(texts: string[]): Promise<number[][]>;
|
|
77
|
+
}
|
|
78
|
+
interface VectorStore {
|
|
79
|
+
upsert(chunks: Array<RagChunk & {
|
|
80
|
+
embedding: number[];
|
|
81
|
+
}>): Promise<void>;
|
|
82
|
+
search(embedding: number[], options?: RetrievalOptions): Promise<RetrievedSource[]>;
|
|
83
|
+
}
|
|
84
|
+
interface Reranker {
|
|
85
|
+
rerank(query: string, sources: RetrievedSource[]): Promise<RetrievedSource[]>;
|
|
86
|
+
}
|
|
87
|
+
interface KnowledgeRetriever {
|
|
88
|
+
search(query: string, options?: RetrievalOptions): Promise<RetrievedSource[]>;
|
|
89
|
+
}
|
|
90
|
+
interface RagPipelineOptions {
|
|
91
|
+
loader?: DocumentLoader;
|
|
92
|
+
chunker?: Chunker;
|
|
93
|
+
embeddingProvider?: EmbeddingProvider;
|
|
94
|
+
vectorStore?: VectorStore;
|
|
95
|
+
retriever?: KnowledgeRetriever;
|
|
96
|
+
reranker?: Reranker;
|
|
97
|
+
runtimeContext?: RuntimeRequestContext;
|
|
98
|
+
}
|
|
99
|
+
interface RagPipeline {
|
|
100
|
+
ingest(): Promise<{
|
|
101
|
+
documents: number;
|
|
102
|
+
chunks: number;
|
|
103
|
+
}>;
|
|
104
|
+
retrieve(query: string, options?: RetrievalOptions): Promise<RetrievedSource[]>;
|
|
105
|
+
}
|
|
106
|
+
interface InMemoryKnowledgeDocument {
|
|
107
|
+
id: string;
|
|
108
|
+
title: string;
|
|
109
|
+
content: string;
|
|
110
|
+
url?: string;
|
|
111
|
+
tenantId?: string;
|
|
112
|
+
acl?: DocumentAcl;
|
|
113
|
+
deletedAt?: string;
|
|
114
|
+
metadata?: Record<string, unknown>;
|
|
115
|
+
}
|
|
116
|
+
interface RagIngestionJob {
|
|
117
|
+
id: string;
|
|
118
|
+
status: "pending" | "running" | "completed" | "failed";
|
|
119
|
+
startedAt?: string;
|
|
120
|
+
completedAt?: string;
|
|
121
|
+
result?: {
|
|
122
|
+
documents: number;
|
|
123
|
+
chunks: number;
|
|
124
|
+
};
|
|
125
|
+
error?: string;
|
|
126
|
+
run(): Promise<RagIngestionJob>;
|
|
127
|
+
}
|
|
128
|
+
interface CitationVerificationResult {
|
|
129
|
+
valid: boolean;
|
|
130
|
+
unsupportedCitations: Citation[];
|
|
131
|
+
missingSourceIds: string[];
|
|
132
|
+
}
|
|
133
|
+
interface GroundednessEvaluation {
|
|
134
|
+
grounded: boolean;
|
|
135
|
+
score: number;
|
|
136
|
+
blocked: boolean;
|
|
137
|
+
reasons: string[];
|
|
138
|
+
}
|
|
139
|
+
declare class InMemoryKnowledgeRetriever implements KnowledgeRetriever {
|
|
140
|
+
private readonly documents;
|
|
141
|
+
constructor(documents: InMemoryKnowledgeDocument[]);
|
|
142
|
+
search(query: string, options?: RetrievalOptions): Promise<RetrievedSource[]>;
|
|
143
|
+
}
|
|
144
|
+
declare class SimpleTextChunker implements Chunker {
|
|
145
|
+
private readonly options;
|
|
146
|
+
constructor(options?: {
|
|
147
|
+
maxChars?: number;
|
|
148
|
+
overlapChars?: number;
|
|
149
|
+
});
|
|
150
|
+
chunk(document: RagDocument): Promise<RagChunk[]>;
|
|
151
|
+
}
|
|
152
|
+
declare class InMemoryVectorStore implements VectorStore {
|
|
153
|
+
private chunks;
|
|
154
|
+
upsert(chunks: Array<RagChunk & {
|
|
155
|
+
embedding: number[];
|
|
156
|
+
}>): Promise<void>;
|
|
157
|
+
search(embedding: number[], options?: RetrievalOptions): Promise<RetrievedSource[]>;
|
|
158
|
+
}
|
|
159
|
+
declare function createDocumentAccessPolicy(input: {
|
|
160
|
+
tenantId?: string;
|
|
161
|
+
userId?: string;
|
|
162
|
+
roles?: string[];
|
|
163
|
+
groups?: string[];
|
|
164
|
+
requireAcl?: boolean;
|
|
165
|
+
}): DocumentAccessPolicy;
|
|
166
|
+
declare function createRagIngestionJob(id: string, pipeline: RagPipeline): RagIngestionJob;
|
|
167
|
+
declare function verifyCitations(citations: Citation[], sources: RetrievedSource[]): CitationVerificationResult;
|
|
168
|
+
declare function evaluateGroundedness(answer: string, sources: RetrievedSource[]): GroundednessEvaluation;
|
|
169
|
+
declare function createInMemoryKnowledgeRetriever(documents: InMemoryKnowledgeDocument[]): KnowledgeRetriever;
|
|
170
|
+
declare function createSimpleTextChunker(options?: {
|
|
171
|
+
maxChars?: number;
|
|
172
|
+
overlapChars?: number;
|
|
173
|
+
}): Chunker;
|
|
174
|
+
declare function createInMemoryVectorStore(): VectorStore;
|
|
175
|
+
declare function createRagPipeline(options: RagPipelineOptions): RagPipeline;
|
|
176
|
+
declare function formatRetrievedSourcesForPrompt(sources: RetrievedSource[]): string;
|
|
177
|
+
|
|
178
|
+
export { type Chunker as C, type DocumentAccessPolicy as D, type EmbeddingProvider as E, type GroundednessEvaluation as G, type InMemoryKnowledgeDocument as I, type KnowledgeRetriever as K, type RetrievedSource as R, SimpleTextChunker as S, type VectorStore as V, type Citation as a, type CitationVerificationResult as b, type DocumentAcl as c, type DocumentLoader as d, InMemoryKnowledgeRetriever as e, InMemoryVectorStore as f, type RagChunk as g, type RagDocument as h, type RagIngestionJob as i, type RagPipeline as j, type RagPipelineOptions as k, type Reranker as l, type RetrievalOptions as m, createDocumentAccessPolicy as n, createInMemoryKnowledgeRetriever as o, createInMemoryVectorStore as p, createRagIngestionJob as q, createRagPipeline as r, createSimpleTextChunker as s, evaluateGroundedness as t, formatRetrievedSourcesForPrompt as u, verifyCitations as v };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,11 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export { A as
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { A as AgentRuntime } from '../agent-runtime-BJeNjVuk.js';
|
|
2
|
+
export { P as ProviderRegistry, R as RuntimeRetentionCleanupOptions, a as RuntimeRetentionCleanupResult, c as createAgentRuntime, b as createProviderRegistry } from '../agent-runtime-BJeNjVuk.js';
|
|
3
|
+
import { c as RuntimeTurnRunner, f as RuntimeTurnInput, aD as RuntimeTurnContext, g as RuntimeTurnResult, E as EventLog, ax as RuntimeEventType, aw as RuntimeEvent, l as PermissionPolicy, r as RuntimeMode, bt as ToolDefinition, ap as PermissionDecision, ai as AsyncEventLog, ay as RuntimeHostMode, aj as AsyncRuntimeSessionStore, n as RuntimeSessionCreateOptions, e as RuntimeSession, k as RuntimeSessionStore, T as ToolRegistry, d as RuntimePolicy, q as RuntimeToolExecutionResult } from '../context-BLPsKYxc.js';
|
|
4
|
+
export { w as AGENT_MODES, x as AgentArtifact, y as AgentArtifactKind, z as AgentBudget, B as AgentCapability, F as AgentCard, G as AgentDefinition, H as AgentDefinitionRegistry, I as AgentGateDefinition, J as AgentGateKind, K as AgentGraphDefinition, N as AgentGraphEdge, O as AgentGraphEngine, Q as AgentGraphEngineOptions, U as AgentGraphNode, V as AgentGraphNodeExecution, X as AgentGraphNodeExecutor, Y as AgentGraphRunInput, Z as AgentGraphRunResult, _ as AgentGraphRunStatus, $ as AgentGraphValidationIssue, a0 as AgentGraphValidationResult, a1 as AgentGuardrailPolicy, a2 as AgentHandoff, a3 as AgentMessage, a4 as AgentMessageRole, a5 as AgentModeDefinition, a6 as AgentModeId, a7 as AgentRole, a8 as AgentRunResult, a9 as AgentRunStatus, aa as AgentRunner, ab as AgentRunnerExecutionContext, ac as AgentRunnerExecutionInput, ad as AgentRunnerExecutor, ae as AgentRunnerOptions, af as AgentRunnerRawResult, A as AgentRuntimeOptions, m as AgentRuntimeSnapshot, av as AgentTask, ag as AgentToolPolicyDecision, ah as AgentTraceContext, ak as CostBudget, al as DEFAULT_WORKFLOWS, D as DataBoundary, am as FileSharedWorkspaceStore, an as InMemorySharedWorkspaceStore, ao as LegacyAgentRoleMapping, aq as ProviderRuntimeSelection, ar as ReasoningEffort, as as RetentionPolicy, at as RuntimeAgentNodeExecutor, au as RuntimeAgentNodeExecutorOptions, az as RuntimePolicyViolation, aA as RuntimePolicyViolationCode, R as RuntimeRequestContext, aB as RuntimeSurface, aC as RuntimeTenantBoundary, p as RuntimeToolExecutionInput, a as RuntimeTurnStreamEvent, aE as SharedWorkspaceProvenance, aF as SharedWorkspaceRecord, aG as SharedWorkspaceRecordKind, aH as SharedWorkspaceState, aI as SharedWorkspaceStateSnapshot, aJ as SharedWorkspaceStore, aK as SharedWorkspaceWriteInput, aL as TenantContext, aM as ToolRiskLevel, aN as ToolRiskManifest, aO as ToolRiskManifestEntry, aP as UserContext, aQ as WorkflowCatalog, aR as WorkflowDefinition, W as WorkflowEngine, aS as WorkflowHandler, aT as WorkflowPlan, aU as WorkflowRegistry, aV as WorkflowRetryPolicy, aW as WorkflowRisk, aX as WorkflowRunContext, aY as WorkflowRunInput, aZ as WorkflowRunResult, a_ as WorkflowRunStatus, a$ as WorkflowStepDefinition, b0 as assertRuntimeTenantBoundary, b1 as assertRuntimeTurnWithinPolicy, b2 as createAgentArtifact, b3 as createAgentDefinitionRegistry, b4 as createAgentGraphEngine, b5 as createAgentRunner, b6 as createAgentTraceContext, o as createRetentionCutoffs, b8 as createRuntimeAgentNodeExecutor, b9 as createRuntimeRequestContext, ba as createRuntimeTenantBoundary, bb as createSummaryArtifact, bd as createWorkflowCatalog, be as createWorkflowEngine, bf as createWorkflowRegistry, bg as dryRunAgentGraphNodeExecutor, bh as evaluateAgentToolPolicy, bi as getAgentMode, bj as isAgentMode, bk as listAgentModes, bl as listLegacyAgentRoleMappings, bm as mapLegacyAgentRole, bn as mergeRuntimePolicy, bo as normalizeAgentRunResult, bp as runtimeContextToMetadata, bq as validateAgentCapabilities, br as validateAgentGraph, bs as workflowToAgentGraph } from '../context-BLPsKYxc.js';
|
|
5
|
+
import { Server } from 'node:http';
|
|
6
|
+
export { a as AgentActionMode, b as AgentBlueprint, c as AgentDeploymentSurface, d as AgentMaturity, A as AgentPreset, e as AgentRuntimeFactoryOptions, f as ApprovalPolicy, B as BlueprintAgent, G as GuardrailAction, g as GuardrailConfig, h as GuardrailFinding, i as GuardrailPipelineResult, j as GuardrailPipelineStep, k as GuardrailResult, l as GuardrailSeverity, m as GuardrailStage, M as MemoryConfig, O as ObservabilityConfig, P as PolicyAsCodeProvider, S as SecretRedactionConfig, T as TopicBoundaryConfig, n as createAgentFromBlueprint, o as createBaseBlueprint, p as createSafeToolRegistry, q as defaultPublicGuardrails, r as mapActionModeToRuntimeMode, s as redactSecrets, t as runGuardrailPipeline, u as runGuardrails, v as validateStructuredOutput } from '../blueprints-Dw5-uWU9.js';
|
|
7
|
+
export { C as Chunker, a as Citation, b as CitationVerificationResult, D as DocumentAccessPolicy, c as DocumentAcl, d as DocumentLoader, E as EmbeddingProvider, G as GroundednessEvaluation, I as InMemoryKnowledgeDocument, e as InMemoryKnowledgeRetriever, f as InMemoryVectorStore, K as KnowledgeRetriever, g as RagChunk, h as RagDocument, i as RagIngestionJob, j as RagPipeline, k as RagPipelineOptions, l as Reranker, m as RetrievalOptions, R as RetrievedSource, S as SimpleTextChunker, V as VectorStore, n as createDocumentAccessPolicy, o as createInMemoryKnowledgeRetriever, p as createInMemoryVectorStore, q as createRagIngestionJob, r as createRagPipeline, s as createSimpleTextChunker, t as evaluateGroundedness, u as formatRetrievedSourcesForPrompt, v as verifyCitations } from '../rag-B2oGudNb.js';
|
|
7
8
|
import 'zod';
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
declare class DefaultRuntimeTurnRunner implements RuntimeTurnRunner {
|
|
11
|
+
run(input: RuntimeTurnInput, context: RuntimeTurnContext): Promise<RuntimeTurnResult>;
|
|
12
|
+
}
|
|
13
|
+
declare function createDefaultRuntimeTurnRunner(): RuntimeTurnRunner;
|
|
14
|
+
|
|
15
|
+
interface ToolCallingRuntimeTurnRunnerOptions {
|
|
16
|
+
maxToolIterations?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Runtime turn runner that executes provider-requested tools through the
|
|
20
|
+
* reusable runtime permission and event pipeline.
|
|
21
|
+
*/
|
|
22
|
+
declare class ToolCallingRuntimeTurnRunner implements RuntimeTurnRunner {
|
|
23
|
+
private readonly maxToolIterations;
|
|
24
|
+
constructor(options?: ToolCallingRuntimeTurnRunnerOptions);
|
|
25
|
+
run(input: RuntimeTurnInput, context: RuntimeTurnContext): Promise<RuntimeTurnResult>;
|
|
26
|
+
}
|
|
27
|
+
declare function createToolCallingRuntimeTurnRunner(options?: ToolCallingRuntimeTurnRunnerOptions): RuntimeTurnRunner;
|
|
28
|
+
|
|
29
|
+
declare class InMemoryEventLog implements EventLog {
|
|
30
|
+
private events;
|
|
31
|
+
record(type: RuntimeEventType, data?: Record<string, unknown>): RuntimeEvent;
|
|
32
|
+
list(): RuntimeEvent[];
|
|
33
|
+
count(): number;
|
|
34
|
+
clear(): void;
|
|
35
|
+
}
|
|
36
|
+
declare class FileEventLog implements EventLog {
|
|
37
|
+
private readonly filePath;
|
|
38
|
+
private memory;
|
|
39
|
+
private writable;
|
|
40
|
+
constructor(filePath: string);
|
|
41
|
+
record(type: RuntimeEventType, data?: Record<string, unknown>): RuntimeEvent;
|
|
42
|
+
list(): RuntimeEvent[];
|
|
43
|
+
count(): number;
|
|
44
|
+
clear(): void;
|
|
45
|
+
}
|
|
46
|
+
declare function createEventLog(): EventLog;
|
|
47
|
+
declare function createFileEventLog(filePath: string): EventLog;
|
|
48
|
+
|
|
49
|
+
interface RuntimeHttpServerOptions {
|
|
50
|
+
maxBodyBytes?: number;
|
|
51
|
+
}
|
|
52
|
+
declare function createRuntimeHttpServer(runtime: AgentRuntime, options?: RuntimeHttpServerOptions): Server;
|
|
53
|
+
|
|
54
|
+
declare class DefaultPermissionPolicy implements PermissionPolicy {
|
|
55
|
+
canExecuteTool(mode: RuntimeMode, tool: ToolDefinition): PermissionDecision;
|
|
56
|
+
canExecuteToolInput(mode: RuntimeMode, tool: ToolDefinition, input: Record<string, unknown>): PermissionDecision;
|
|
57
|
+
}
|
|
58
|
+
declare function createPermissionPolicy(): PermissionPolicy;
|
|
9
59
|
|
|
10
60
|
interface PostgresQueryClient {
|
|
11
61
|
query<T = unknown>(sql: string, params?: unknown[]): Promise<{
|
|
@@ -15,6 +65,23 @@ interface PostgresQueryClient {
|
|
|
15
65
|
}
|
|
16
66
|
interface PostgresRuntimeStoreOptions {
|
|
17
67
|
tenantId?: string;
|
|
68
|
+
hostMode?: RuntimeHostMode;
|
|
69
|
+
}
|
|
70
|
+
interface RuntimeAuditRecord {
|
|
71
|
+
id: string;
|
|
72
|
+
tenantId: string;
|
|
73
|
+
type: string;
|
|
74
|
+
timestamp: string;
|
|
75
|
+
subject?: string;
|
|
76
|
+
data: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
interface RuntimeAuditStore {
|
|
79
|
+
record(input: {
|
|
80
|
+
type: string;
|
|
81
|
+
subject?: string;
|
|
82
|
+
data?: Record<string, unknown>;
|
|
83
|
+
}): Promise<RuntimeAuditRecord>;
|
|
84
|
+
list(): Promise<RuntimeAuditRecord[]>;
|
|
18
85
|
}
|
|
19
86
|
declare class PostgresRuntimeSessionStore implements RuntimeSessionStore {
|
|
20
87
|
private readonly client;
|
|
@@ -27,6 +94,16 @@ declare class PostgresRuntimeSessionStore implements RuntimeSessionStore {
|
|
|
27
94
|
list(): RuntimeSession[];
|
|
28
95
|
delete(id: string): boolean;
|
|
29
96
|
}
|
|
97
|
+
declare class AsyncPostgresRuntimeSessionStore implements AsyncRuntimeSessionStore {
|
|
98
|
+
private readonly client;
|
|
99
|
+
private readonly tenantId;
|
|
100
|
+
constructor(client: PostgresQueryClient, options: PostgresRuntimeStoreOptions);
|
|
101
|
+
create(options?: RuntimeSessionCreateOptions): Promise<RuntimeSession>;
|
|
102
|
+
get(id: string): Promise<RuntimeSession | undefined>;
|
|
103
|
+
update(session: RuntimeSession): Promise<RuntimeSession>;
|
|
104
|
+
list(): Promise<RuntimeSession[]>;
|
|
105
|
+
delete(id: string): Promise<boolean>;
|
|
106
|
+
}
|
|
30
107
|
/**
|
|
31
108
|
* Async helper for hosted products that need to inspect persisted sessions.
|
|
32
109
|
* RuntimeSessionStore remains sync for local runtime compatibility.
|
|
@@ -45,10 +122,203 @@ declare class PostgresEventLog implements EventLog {
|
|
|
45
122
|
count(): number;
|
|
46
123
|
clear(): void;
|
|
47
124
|
}
|
|
125
|
+
declare class AsyncPostgresEventLog implements AsyncEventLog {
|
|
126
|
+
private readonly client;
|
|
127
|
+
private readonly tenantId;
|
|
128
|
+
constructor(client: PostgresQueryClient, options: PostgresRuntimeStoreOptions);
|
|
129
|
+
record(type: RuntimeEventType, data?: Record<string, unknown>): Promise<RuntimeEvent>;
|
|
130
|
+
list(): Promise<RuntimeEvent[]>;
|
|
131
|
+
count(): Promise<number>;
|
|
132
|
+
clear(): Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
declare class PostgresRuntimeAuditStore implements RuntimeAuditStore {
|
|
135
|
+
private readonly client;
|
|
136
|
+
private readonly tenantId;
|
|
137
|
+
constructor(client: PostgresQueryClient, options: PostgresRuntimeStoreOptions);
|
|
138
|
+
record(input: {
|
|
139
|
+
type: string;
|
|
140
|
+
subject?: string;
|
|
141
|
+
data?: Record<string, unknown>;
|
|
142
|
+
}): Promise<RuntimeAuditRecord>;
|
|
143
|
+
list(): Promise<RuntimeAuditRecord[]>;
|
|
144
|
+
}
|
|
48
145
|
declare function createPostgresRuntimeSessionStore(client: PostgresQueryClient, options?: PostgresRuntimeStoreOptions): RuntimeSessionStore;
|
|
49
146
|
declare function createPostgresEventLog(client: PostgresQueryClient, options?: PostgresRuntimeStoreOptions): EventLog;
|
|
147
|
+
declare function createAsyncPostgresRuntimeSessionStore(client: PostgresQueryClient, options: PostgresRuntimeStoreOptions): AsyncRuntimeSessionStore;
|
|
148
|
+
declare function createAsyncPostgresEventLog(client: PostgresQueryClient, options: PostgresRuntimeStoreOptions): AsyncEventLog;
|
|
149
|
+
declare function createPostgresRuntimeAuditStore(client: PostgresQueryClient, options: PostgresRuntimeStoreOptions): RuntimeAuditStore;
|
|
50
150
|
declare function listPostgresRuntimeEvents(client: PostgresQueryClient, options?: PostgresRuntimeStoreOptions & {
|
|
51
151
|
sessionId?: string;
|
|
52
152
|
}): Promise<RuntimeEvent[]>;
|
|
53
153
|
|
|
54
|
-
|
|
154
|
+
interface TenantScopeOptions {
|
|
155
|
+
tenantId: string;
|
|
156
|
+
}
|
|
157
|
+
declare class TenantScopedRuntimeSessionStore implements RuntimeSessionStore {
|
|
158
|
+
private readonly inner;
|
|
159
|
+
private readonly options;
|
|
160
|
+
constructor(inner: RuntimeSessionStore, options: TenantScopeOptions);
|
|
161
|
+
create(options?: RuntimeSessionCreateOptions): RuntimeSession;
|
|
162
|
+
get(id: string): RuntimeSession | undefined;
|
|
163
|
+
update(session: RuntimeSession): RuntimeSession;
|
|
164
|
+
list(): RuntimeSession[];
|
|
165
|
+
delete(id: string): boolean;
|
|
166
|
+
private withTenant;
|
|
167
|
+
private belongsToTenant;
|
|
168
|
+
}
|
|
169
|
+
declare class TenantScopedEventLog implements EventLog {
|
|
170
|
+
private readonly inner;
|
|
171
|
+
private readonly options;
|
|
172
|
+
constructor(inner: EventLog, options: TenantScopeOptions);
|
|
173
|
+
record(type: RuntimeEventType, data?: Record<string, unknown>): RuntimeEvent;
|
|
174
|
+
list(): RuntimeEvent[];
|
|
175
|
+
count(): number;
|
|
176
|
+
clear(): void;
|
|
177
|
+
}
|
|
178
|
+
declare function createTenantScopedRuntimeSessionStore(inner: RuntimeSessionStore, tenantId: string): RuntimeSessionStore;
|
|
179
|
+
declare function createTenantScopedEventLog(inner: EventLog, tenantId: string): EventLog;
|
|
180
|
+
|
|
181
|
+
declare class InMemoryRuntimeSessionStore implements RuntimeSessionStore {
|
|
182
|
+
private sessions;
|
|
183
|
+
create(options?: RuntimeSessionCreateOptions): RuntimeSession;
|
|
184
|
+
get(id: string): RuntimeSession | undefined;
|
|
185
|
+
update(session: RuntimeSession): RuntimeSession;
|
|
186
|
+
list(): RuntimeSession[];
|
|
187
|
+
delete(id: string): boolean;
|
|
188
|
+
}
|
|
189
|
+
declare class FileRuntimeSessionStore implements RuntimeSessionStore {
|
|
190
|
+
private readonly filePath;
|
|
191
|
+
private sessions;
|
|
192
|
+
constructor(filePath: string);
|
|
193
|
+
create(options?: RuntimeSessionCreateOptions): RuntimeSession;
|
|
194
|
+
get(id: string): RuntimeSession | undefined;
|
|
195
|
+
update(session: RuntimeSession): RuntimeSession;
|
|
196
|
+
list(): RuntimeSession[];
|
|
197
|
+
delete(id: string): boolean;
|
|
198
|
+
private readSessionsFromDisk;
|
|
199
|
+
private persist;
|
|
200
|
+
}
|
|
201
|
+
declare function createRuntimeSessionStore(): RuntimeSessionStore;
|
|
202
|
+
declare function createFileRuntimeSessionStore(filePath: string): RuntimeSessionStore;
|
|
203
|
+
|
|
204
|
+
type ExtensionRisk = "read-only" | "write" | "network" | "destructive" | "secrets-sensitive";
|
|
205
|
+
type AgentSurface = "coco" | "claude" | "codex" | "gemini" | "opencode";
|
|
206
|
+
interface SkillManifest {
|
|
207
|
+
name: string;
|
|
208
|
+
description: string;
|
|
209
|
+
triggers: string[];
|
|
210
|
+
requiredTools: string[];
|
|
211
|
+
risk: ExtensionRisk;
|
|
212
|
+
compatibleAgents: AgentSurface[];
|
|
213
|
+
sourcePath?: string;
|
|
214
|
+
}
|
|
215
|
+
interface RecipeStep {
|
|
216
|
+
id: string;
|
|
217
|
+
description: string;
|
|
218
|
+
requiredTools?: string[];
|
|
219
|
+
check?: string;
|
|
220
|
+
}
|
|
221
|
+
interface RecipeManifest {
|
|
222
|
+
name: string;
|
|
223
|
+
description: string;
|
|
224
|
+
inputs: string[];
|
|
225
|
+
suggestedModels?: string[];
|
|
226
|
+
steps: RecipeStep[];
|
|
227
|
+
checks: string[];
|
|
228
|
+
risk: ExtensionRisk;
|
|
229
|
+
}
|
|
230
|
+
interface McpToolPolicy {
|
|
231
|
+
server: string;
|
|
232
|
+
tool: string;
|
|
233
|
+
risk: ExtensionRisk;
|
|
234
|
+
requiresConfirmation: boolean;
|
|
235
|
+
allowedModes: string[];
|
|
236
|
+
}
|
|
237
|
+
declare function createMcpToolPolicy(server: string, tool: string, risk: ExtensionRisk, allowedModes?: string[]): McpToolPolicy;
|
|
238
|
+
|
|
239
|
+
interface RuntimeToolExecutorOptions {
|
|
240
|
+
toolRegistry: ToolRegistry;
|
|
241
|
+
eventLog?: EventLog;
|
|
242
|
+
permissionPolicy?: PermissionPolicy;
|
|
243
|
+
mode?: RuntimeMode;
|
|
244
|
+
runtimePolicy?: RuntimePolicy;
|
|
245
|
+
}
|
|
246
|
+
interface RuntimeToolExecutorInput {
|
|
247
|
+
toolName: string;
|
|
248
|
+
input: Record<string, unknown>;
|
|
249
|
+
mode?: RuntimeMode;
|
|
250
|
+
allowedTools?: string[];
|
|
251
|
+
confirmed?: boolean;
|
|
252
|
+
metadata?: Record<string, unknown>;
|
|
253
|
+
}
|
|
254
|
+
declare class RuntimeToolExecutor {
|
|
255
|
+
private readonly toolRegistry;
|
|
256
|
+
private readonly eventLog;
|
|
257
|
+
private readonly permissionPolicy;
|
|
258
|
+
private readonly defaultMode;
|
|
259
|
+
private readonly runtimePolicy?;
|
|
260
|
+
constructor(options: RuntimeToolExecutorOptions);
|
|
261
|
+
execute(input: RuntimeToolExecutorInput): Promise<RuntimeToolExecutionResult>;
|
|
262
|
+
private block;
|
|
263
|
+
}
|
|
264
|
+
declare function createRuntimeToolExecutor(options: RuntimeToolExecutorOptions): RuntimeToolExecutor;
|
|
265
|
+
|
|
266
|
+
type RuntimeSpanKind = "workflow" | "agent" | "llm" | "tool" | "rag" | "gate" | "handoff" | "state" | "runtime";
|
|
267
|
+
interface RuntimeSpan {
|
|
268
|
+
id: string;
|
|
269
|
+
traceId: string;
|
|
270
|
+
spanId: string;
|
|
271
|
+
parentSpanId?: string;
|
|
272
|
+
kind: RuntimeSpanKind;
|
|
273
|
+
name: string;
|
|
274
|
+
timestamp: string;
|
|
275
|
+
attributes: Record<string, unknown>;
|
|
276
|
+
}
|
|
277
|
+
interface RuntimeTraceExporter {
|
|
278
|
+
export(span: RuntimeSpan): Promise<void>;
|
|
279
|
+
flush?(): Promise<void>;
|
|
280
|
+
}
|
|
281
|
+
interface RuntimeMetricsSnapshot {
|
|
282
|
+
events: number;
|
|
283
|
+
byKind: Record<RuntimeSpanKind, number>;
|
|
284
|
+
tokens: {
|
|
285
|
+
input: number;
|
|
286
|
+
output: number;
|
|
287
|
+
};
|
|
288
|
+
estimatedCostUsd: number;
|
|
289
|
+
retries: number;
|
|
290
|
+
policyBlocks: number;
|
|
291
|
+
errorsByClass: Record<string, number>;
|
|
292
|
+
toolsUsed: Record<string, number>;
|
|
293
|
+
gatesFailed: number;
|
|
294
|
+
tenantUsage: Record<string, {
|
|
295
|
+
events: number;
|
|
296
|
+
inputTokens: number;
|
|
297
|
+
outputTokens: number;
|
|
298
|
+
estimatedCostUsd: number;
|
|
299
|
+
}>;
|
|
300
|
+
}
|
|
301
|
+
declare class InMemoryTraceExporter implements RuntimeTraceExporter {
|
|
302
|
+
private spans;
|
|
303
|
+
export(span: RuntimeSpan): Promise<void>;
|
|
304
|
+
list(): RuntimeSpan[];
|
|
305
|
+
clear(): void;
|
|
306
|
+
}
|
|
307
|
+
declare class FileTraceExporter implements RuntimeTraceExporter {
|
|
308
|
+
private readonly filePath;
|
|
309
|
+
constructor(filePath: string);
|
|
310
|
+
export(span: RuntimeSpan): Promise<void>;
|
|
311
|
+
list(): RuntimeSpan[];
|
|
312
|
+
clear(): void;
|
|
313
|
+
}
|
|
314
|
+
declare class OpenTelemetryTraceExporter implements RuntimeTraceExporter {
|
|
315
|
+
private spans;
|
|
316
|
+
export(span: RuntimeSpan): Promise<void>;
|
|
317
|
+
toOtlpJson(): Record<string, unknown>;
|
|
318
|
+
}
|
|
319
|
+
declare function exportRuntimeEventsAsSpans(events: RuntimeEvent[], exporter: RuntimeTraceExporter): Promise<RuntimeSpan[]>;
|
|
320
|
+
declare function eventToSpan(event: RuntimeEvent): RuntimeSpan;
|
|
321
|
+
declare function collectRuntimeMetrics(events: RuntimeEvent[]): RuntimeMetricsSnapshot;
|
|
322
|
+
declare function redactTraceAttributes(input: Record<string, unknown>): Record<string, unknown>;
|
|
323
|
+
|
|
324
|
+
export { AgentRuntime, type AgentSurface, AsyncEventLog, AsyncPostgresEventLog, AsyncPostgresRuntimeSessionStore, AsyncRuntimeSessionStore, DefaultPermissionPolicy, DefaultRuntimeTurnRunner, EventLog, type ExtensionRisk, FileEventLog, FileRuntimeSessionStore, FileTraceExporter, InMemoryEventLog, InMemoryRuntimeSessionStore, InMemoryTraceExporter, type McpToolPolicy, OpenTelemetryTraceExporter, PermissionDecision, PermissionPolicy, PostgresEventLog, type PostgresQueryClient, PostgresRuntimeAuditStore, PostgresRuntimeSessionStore, type PostgresRuntimeStoreOptions, type RecipeManifest, type RecipeStep, type RuntimeAuditRecord, type RuntimeAuditStore, RuntimeEvent, RuntimeEventType, RuntimeHostMode, type RuntimeHttpServerOptions, type RuntimeMetricsSnapshot, RuntimeMode, RuntimePolicy, RuntimeSession, RuntimeSessionCreateOptions, RuntimeSessionStore, type RuntimeSpan, type RuntimeSpanKind, RuntimeToolExecutionResult, RuntimeToolExecutor, type RuntimeToolExecutorInput, type RuntimeToolExecutorOptions, type RuntimeTraceExporter, RuntimeTurnContext, RuntimeTurnInput, RuntimeTurnResult, RuntimeTurnRunner, type SkillManifest, type TenantScopeOptions, TenantScopedEventLog, TenantScopedRuntimeSessionStore, ToolCallingRuntimeTurnRunner, type ToolCallingRuntimeTurnRunnerOptions, collectRuntimeMetrics, createAsyncPostgresEventLog, createAsyncPostgresRuntimeSessionStore, createDefaultRuntimeTurnRunner, createEventLog, createFileEventLog, createFileRuntimeSessionStore, createMcpToolPolicy, createPermissionPolicy, createPostgresEventLog, createPostgresRuntimeAuditStore, createPostgresRuntimeSessionQueries, createPostgresRuntimeSessionStore, createRuntimeHttpServer, createRuntimeSessionStore, createRuntimeToolExecutor, createTenantScopedEventLog, createTenantScopedRuntimeSessionStore, createToolCallingRuntimeTurnRunner, eventToSpan, exportRuntimeEventsAsSpans, listPostgresRuntimeEvents, redactTraceAttributes };
|