@harness-kernel/core 0.1.0-beta.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/NOTICE +3 -0
- package/README.md +12 -0
- package/dist/agent/context.d.ts +5 -0
- package/dist/agent/context.js +11 -0
- package/dist/agent/context.js.map +1 -0
- package/dist/agent/event.d.ts +3 -0
- package/dist/agent/event.js +50 -0
- package/dist/agent/event.js.map +1 -0
- package/dist/agent/hook.d.ts +6 -0
- package/dist/agent/hook.js +7 -0
- package/dist/agent/hook.js.map +1 -0
- package/dist/agent/mode.d.ts +5 -0
- package/dist/agent/mode.js +7 -0
- package/dist/agent/mode.js.map +1 -0
- package/dist/agent/role.d.ts +1 -0
- package/dist/agent/role.js +27 -0
- package/dist/agent/role.js.map +1 -0
- package/dist/agent/session.d.ts +6 -0
- package/dist/agent/session.js +13 -0
- package/dist/agent/session.js.map +1 -0
- package/dist/agent/tool.d.ts +5 -0
- package/dist/agent/tool.js +7 -0
- package/dist/agent/tool.js.map +1 -0
- package/dist/agent.d.ts +12 -0
- package/dist/agent.js +7 -0
- package/dist/agent.js.map +1 -0
- package/dist/approval-DfvjpbFs.d.ts +247 -0
- package/dist/chunk-4A2P4QU5.js +179 -0
- package/dist/chunk-4A2P4QU5.js.map +1 -0
- package/dist/chunk-4SYLFKIX.js +207 -0
- package/dist/chunk-4SYLFKIX.js.map +1 -0
- package/dist/chunk-4WWSQAWA.js +3778 -0
- package/dist/chunk-4WWSQAWA.js.map +1 -0
- package/dist/chunk-AD3BCYWU.js +37 -0
- package/dist/chunk-AD3BCYWU.js.map +1 -0
- package/dist/chunk-AZVA22HW.js +135 -0
- package/dist/chunk-AZVA22HW.js.map +1 -0
- package/dist/chunk-OBKS4AJR.js +529 -0
- package/dist/chunk-OBKS4AJR.js.map +1 -0
- package/dist/chunk-Q44U2CMM.js +239 -0
- package/dist/chunk-Q44U2CMM.js.map +1 -0
- package/dist/chunk-Q73WH5D7.js +54 -0
- package/dist/chunk-Q73WH5D7.js.map +1 -0
- package/dist/chunk-RRWJUHJG.js +9 -0
- package/dist/chunk-RRWJUHJG.js.map +1 -0
- package/dist/context-75mlon5x.d.ts +394 -0
- package/dist/event-CKV4EeZ3.d.ts +230 -0
- package/dist/events-D4xcDi53.d.ts +69 -0
- package/dist/hook-DMb9fw9Z.d.ts +20 -0
- package/dist/index.d.ts +164 -0
- package/dist/index.js +174 -0
- package/dist/index.js.map +1 -0
- package/dist/model-provider-BrZ2RRmS.d.ts +130 -0
- package/dist/role-BN6KhQxx.d.ts +68 -0
- package/dist/runner/approval.d.ts +9 -0
- package/dist/runner/approval.js +1 -0
- package/dist/runner/approval.js.map +1 -0
- package/dist/runner/event.d.ts +3 -0
- package/dist/runner/event.js +50 -0
- package/dist/runner/event.js.map +1 -0
- package/dist/runner/logging.d.ts +31 -0
- package/dist/runner/logging.js +15 -0
- package/dist/runner/logging.js.map +1 -0
- package/dist/runner/model-provider.d.ts +8 -0
- package/dist/runner/model-provider.js +11 -0
- package/dist/runner/model-provider.js.map +1 -0
- package/dist/runner/sandbox.d.ts +47 -0
- package/dist/runner/sandbox.js +13 -0
- package/dist/runner/sandbox.js.map +1 -0
- package/dist/runner/storage.d.ts +6 -0
- package/dist/runner/storage.js +17 -0
- package/dist/runner/storage.js.map +1 -0
- package/dist/runner-Dxo7ALtp.d.ts +87 -0
- package/dist/runner.d.ts +10 -0
- package/dist/runner.js +18 -0
- package/dist/runner.js.map +1 -0
- package/dist/schema.d.ts +146 -0
- package/dist/schema.js +39 -0
- package/dist/schema.js.map +1 -0
- package/dist/storage-BmOEwW-p.d.ts +118 -0
- package/dist/tool-errors-CygY1Nba.d.ts +27 -0
- package/dist/types-BPmsw-mF.d.ts +80 -0
- package/package.json +114 -0
package/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @harness-kernel/core
|
|
2
|
+
|
|
3
|
+
Zero-dependency runtime contracts and session kernel for Harness Kernel.
|
|
4
|
+
|
|
5
|
+
Use this package for agent definitions, modes, tools, roles, hooks, context
|
|
6
|
+
providers, events, schemas, session stores, and runtime contracts.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pnpm add @harness-kernel/core
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Docs: <https://ducks-software-ai-infrastructure.github.io/harness-kernel/docs/packages/core/>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { c as HarnessRoleSelector } from '../role-BN6KhQxx.js';
|
|
2
|
+
export { a as AgentContextProvider, b as AgentContextReader, c as AgentContextSession, C as ContextConsume, z as ContextContribution, B as ContextContributionInput, D as ContextEntry, E as ContextEntryFilter, F as ContextProviderBinding, G as ContextProviderOutput, H as ContextProviderReference, I as ContextProviderRenderResult, J as ContextProviderSummary, K as ContextRegistrationOptions, L as ContextScopes, M as ContextSnapshot, N as HarnessContextProvider, O as HarnessContextProviderClass, P as HarnessContextProviderSelector } from '../context-75mlon5x.js';
|
|
3
|
+
import '../events-D4xcDi53.js';
|
|
4
|
+
import '../types-BPmsw-mF.js';
|
|
5
|
+
import '../runner/sandbox.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { H as HarnessEvent, a as HarnessEventClass, b as HarnessEventEmitOptions, c as HarnessEventMetadata, d as HarnessEventQuery, e as HarnessEventRecord, f as HarnessEventSource } from '../events-D4xcDi53.js';
|
|
2
|
+
export { C as ContextReadyEvent, E as ErrorEvent, M as MessageDeltaEvent, a as MessageEndEvent, b as MessageStartEvent, c as ModeChangedEvent, d as ModelAfterEvent, e as ModelBeforeEvent, R as RunEndEvent, f as RunStartEvent, S as SnapshotCreatedEvent, g as SnapshotDeletedEvent, h as SnapshotRestoredEvent, T as ToolApprovalRequestedEvent, i as ToolApprovalResolvedEvent, j as ToolEndEvent, k as ToolStartEvent, l as TranscriptCursorChangedEvent, m as TurnEndEvent, n as TurnStartEvent } from '../event-CKV4EeZ3.js';
|
|
3
|
+
import '../schema.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContextReadyEvent,
|
|
3
|
+
ErrorEvent,
|
|
4
|
+
MessageDeltaEvent,
|
|
5
|
+
MessageEndEvent,
|
|
6
|
+
MessageStartEvent,
|
|
7
|
+
ModeChangedEvent,
|
|
8
|
+
ModelAfterEvent,
|
|
9
|
+
ModelBeforeEvent,
|
|
10
|
+
RunEndEvent,
|
|
11
|
+
RunStartEvent,
|
|
12
|
+
SnapshotCreatedEvent,
|
|
13
|
+
SnapshotDeletedEvent,
|
|
14
|
+
SnapshotRestoredEvent,
|
|
15
|
+
ToolApprovalRequestedEvent,
|
|
16
|
+
ToolApprovalResolvedEvent,
|
|
17
|
+
ToolEndEvent,
|
|
18
|
+
ToolStartEvent,
|
|
19
|
+
TranscriptCursorChangedEvent,
|
|
20
|
+
TurnEndEvent,
|
|
21
|
+
TurnStartEvent
|
|
22
|
+
} from "../chunk-4SYLFKIX.js";
|
|
23
|
+
import "../chunk-OBKS4AJR.js";
|
|
24
|
+
import {
|
|
25
|
+
HarnessEvent
|
|
26
|
+
} from "../chunk-4A2P4QU5.js";
|
|
27
|
+
export {
|
|
28
|
+
ContextReadyEvent,
|
|
29
|
+
ErrorEvent,
|
|
30
|
+
HarnessEvent,
|
|
31
|
+
MessageDeltaEvent,
|
|
32
|
+
MessageEndEvent,
|
|
33
|
+
MessageStartEvent,
|
|
34
|
+
ModeChangedEvent,
|
|
35
|
+
ModelAfterEvent,
|
|
36
|
+
ModelBeforeEvent,
|
|
37
|
+
RunEndEvent,
|
|
38
|
+
RunStartEvent,
|
|
39
|
+
SnapshotCreatedEvent,
|
|
40
|
+
SnapshotDeletedEvent,
|
|
41
|
+
SnapshotRestoredEvent,
|
|
42
|
+
ToolApprovalRequestedEvent,
|
|
43
|
+
ToolApprovalResolvedEvent,
|
|
44
|
+
ToolEndEvent,
|
|
45
|
+
ToolStartEvent,
|
|
46
|
+
TranscriptCursorChangedEvent,
|
|
47
|
+
TurnEndEvent,
|
|
48
|
+
TurnStartEvent
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { H as HarnessEvent, a as HarnessEventClass } from '../events-D4xcDi53.js';
|
|
2
|
+
export { H as HarnessHook, a as HarnessHookEventClass } from '../hook-DMb9fw9Z.js';
|
|
3
|
+
import '../context-75mlon5x.js';
|
|
4
|
+
import '../role-BN6KhQxx.js';
|
|
5
|
+
import '../types-BPmsw-mF.js';
|
|
6
|
+
import '../runner/sandbox.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { m as AgentModeDefinition, H as ContextProviderReference, Q as HarnessMode, R as HarnessModeClass, S as HarnessModeSelector, T as HarnessModeSummary, a3 as ToolApprovalMode } from '../context-75mlon5x.js';
|
|
2
|
+
import '../role-BN6KhQxx.js';
|
|
3
|
+
import '../events-D4xcDi53.js';
|
|
4
|
+
import '../types-BPmsw-mF.js';
|
|
5
|
+
import '../runner/sandbox.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { A as AssistantRole, H as HarnessRole, a as HarnessRoleClass, b as HarnessRoleDefinition, c as HarnessRoleSelector, N as NativeRoles, R as RoleTargets, S as SystemRole, T as ToolRole, U as UserRole, e as assistantRole, s as systemRole, t as toolRole, u as userRole } from '../role-BN6KhQxx.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AssistantRole,
|
|
3
|
+
HarnessRole,
|
|
4
|
+
NativeRoles,
|
|
5
|
+
RoleTargets,
|
|
6
|
+
SystemRole,
|
|
7
|
+
ToolRole,
|
|
8
|
+
UserRole,
|
|
9
|
+
assistantRole,
|
|
10
|
+
systemRole,
|
|
11
|
+
toolRole,
|
|
12
|
+
userRole
|
|
13
|
+
} from "../chunk-4A2P4QU5.js";
|
|
14
|
+
export {
|
|
15
|
+
AssistantRole,
|
|
16
|
+
HarnessRole,
|
|
17
|
+
NativeRoles,
|
|
18
|
+
RoleTargets,
|
|
19
|
+
SystemRole,
|
|
20
|
+
ToolRole,
|
|
21
|
+
UserRole,
|
|
22
|
+
assistantRole,
|
|
23
|
+
systemRole,
|
|
24
|
+
toolRole,
|
|
25
|
+
userRole
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=role.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { E as EventCursor, d as HarnessEventQuery, e as HarnessEventRecord } from '../events-D4xcDi53.js';
|
|
2
|
+
export { A as AgentActionSession, b as AgentContextReader, c as AgentContextSession, d as AgentEventReader, e as AgentEventSession, f as AgentHistorySession, g as AgentLogSession, h as AgentMessage, i as AgentMessageEnqueueOptions, j as AgentMessageInput, l as AgentMessageSession, n as AgentModeReader, o as AgentModeSession, p as AgentReadSession, t as AgentStateReader, u as AgentStateSession, w as AgentToolResult, x as AgentToolSession, C as ContextConsume, D as ContextEntry, E as ContextEntryFilter, K as ContextRegistrationOptions, L as ContextScopes, T as HarnessModeSummary, U as HarnessSnapshot, V as HarnessSnapshotCreator, W as HarnessSnapshotInput, X as HarnessSnapshotSession, Y as HarnessSnapshotSummary, a0 as HarnessTranscriptSession, aa as TranscriptBranch, ab as TranscriptCursor, ac as TranscriptQuery, ad as TranscriptSeekTarget } from '../context-75mlon5x.js';
|
|
3
|
+
export { c as HarnessRoleSelector, N as NativeRoles, R as RoleTargets } from '../role-BN6KhQxx.js';
|
|
4
|
+
export { T as ToolErrorCode, a as ToolErrorPayload, b as ToolInvalidField } from '../tool-errors-CygY1Nba.js';
|
|
5
|
+
import '../types-BPmsw-mF.js';
|
|
6
|
+
import '../runner/sandbox.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { v as AgentToolDefinition, w as AgentToolResult, y as AgentToolSource, Z as HarnessTool, _ as HarnessToolClass, $ as HarnessToolSelector, a5 as ToolApprovalResolver, a6 as ToolCatalogEntry, a7 as ToolPermission, a8 as ToolRef, a9 as ToolRisk } from '../context-75mlon5x.js';
|
|
2
|
+
import '../role-BN6KhQxx.js';
|
|
3
|
+
import '../events-D4xcDi53.js';
|
|
4
|
+
import '../types-BPmsw-mF.js';
|
|
5
|
+
import '../runner/sandbox.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { A as AgentDefinition } from './model-provider-BrZ2RRmS.js';
|
|
2
|
+
export { J as JsonObject } from './events-D4xcDi53.js';
|
|
3
|
+
export { r as AgentSharedState, s as AgentSharedStateDefinition } from './context-75mlon5x.js';
|
|
4
|
+
import './role-BN6KhQxx.js';
|
|
5
|
+
import './runner/sandbox.js';
|
|
6
|
+
import './storage-BmOEwW-p.js';
|
|
7
|
+
import './hook-DMb9fw9Z.js';
|
|
8
|
+
import './types-BPmsw-mF.js';
|
|
9
|
+
|
|
10
|
+
declare function defineAgent(definition: AgentDefinition): AgentDefinition;
|
|
11
|
+
|
|
12
|
+
export { AgentDefinition, defineAgent };
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { A as AgentDefinition, H as HarnessModelProvider, e as ModelProviderInfo } from './model-provider-BrZ2RRmS.js';
|
|
2
|
+
import { j as HarnessLoggingConfig } from './types-BPmsw-mF.js';
|
|
3
|
+
import { e as HarnessEventRecord, a as HarnessEventClass, d as HarnessEventQuery, H as HarnessEvent } from './events-D4xcDi53.js';
|
|
4
|
+
import { T as HarnessModeSummary, J as ContextProviderSummary, a6 as ToolCatalogEntry, S as HarnessModeSelector, a3 as ToolApprovalMode, h as AgentMessage, a9 as ToolRisk, a7 as ToolPermission, w as AgentToolResult, r as AgentSharedState, a0 as HarnessTranscriptSession, X as HarnessSnapshotSession, M as ContextSnapshot } from './context-75mlon5x.js';
|
|
5
|
+
import { d as HarnessRoleSummary, c as HarnessRoleSelector } from './role-BN6KhQxx.js';
|
|
6
|
+
import { H as HarnessRunStorage, d as RunMetrics } from './storage-BmOEwW-p.js';
|
|
7
|
+
import { b as HarnessHookSummary } from './hook-DMb9fw9Z.js';
|
|
8
|
+
import { HarnessSandbox } from './runner/sandbox.js';
|
|
9
|
+
|
|
10
|
+
interface HarnessEventSummary {
|
|
11
|
+
type: string;
|
|
12
|
+
label: string;
|
|
13
|
+
className: string;
|
|
14
|
+
builtIn?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface HarnessAgentManifest {
|
|
18
|
+
key: string;
|
|
19
|
+
label: string;
|
|
20
|
+
initialMode: string;
|
|
21
|
+
currentMode?: string;
|
|
22
|
+
modes: HarnessModeSummary[];
|
|
23
|
+
roles: HarnessRoleSummary[];
|
|
24
|
+
hooks: HarnessHookSummary[];
|
|
25
|
+
contextProviders: ContextProviderSummary[];
|
|
26
|
+
tools: ToolCatalogEntry[];
|
|
27
|
+
events: HarnessEventSummary[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type HarnessAgentInput = {
|
|
31
|
+
definition: AgentDefinition;
|
|
32
|
+
};
|
|
33
|
+
type HarnessStorageConfig = HarnessRunStorage;
|
|
34
|
+
interface HarnessAppConfig {
|
|
35
|
+
agent: HarnessAgentInput;
|
|
36
|
+
providers: HarnessModelProvider[];
|
|
37
|
+
defaultModel: string;
|
|
38
|
+
workDir?: string;
|
|
39
|
+
storage?: HarnessStorageConfig;
|
|
40
|
+
sandbox?: HarnessSandbox;
|
|
41
|
+
initialMode?: HarnessModeSelector | string;
|
|
42
|
+
toolApproval?: ToolApprovalMode;
|
|
43
|
+
maxTurns?: number;
|
|
44
|
+
services?: Record<string, unknown>;
|
|
45
|
+
logging?: HarnessLoggingConfig;
|
|
46
|
+
sessionTtlMs?: number;
|
|
47
|
+
toolApprovalTimeoutMs?: number;
|
|
48
|
+
}
|
|
49
|
+
interface HarnessUserInput {
|
|
50
|
+
id?: string;
|
|
51
|
+
content: string;
|
|
52
|
+
metadata?: Record<string, unknown>;
|
|
53
|
+
role?: HarnessRoleSelector;
|
|
54
|
+
}
|
|
55
|
+
interface SendOptions {
|
|
56
|
+
signal?: AbortSignal;
|
|
57
|
+
model?: string;
|
|
58
|
+
after?: HarnessEventClass;
|
|
59
|
+
}
|
|
60
|
+
interface StreamOptions extends SendOptions {
|
|
61
|
+
}
|
|
62
|
+
interface WaitForEventOptions {
|
|
63
|
+
signal?: AbortSignal;
|
|
64
|
+
timeoutMs?: number;
|
|
65
|
+
}
|
|
66
|
+
interface SendResult {
|
|
67
|
+
sessionId: string;
|
|
68
|
+
runId: string;
|
|
69
|
+
answer: string;
|
|
70
|
+
agentKey: string;
|
|
71
|
+
mode: string;
|
|
72
|
+
outputDir?: string;
|
|
73
|
+
metrics: RunMetrics;
|
|
74
|
+
transcript: AgentMessage[];
|
|
75
|
+
events: HarnessEventRecord[];
|
|
76
|
+
}
|
|
77
|
+
interface ToolApprovalHandle {
|
|
78
|
+
id: string;
|
|
79
|
+
sessionId: string;
|
|
80
|
+
runId: string;
|
|
81
|
+
toolCallId: string;
|
|
82
|
+
name: string;
|
|
83
|
+
args: unknown;
|
|
84
|
+
modeId: string;
|
|
85
|
+
risk?: ToolRisk;
|
|
86
|
+
permissions?: ToolPermission[];
|
|
87
|
+
createdAt: string;
|
|
88
|
+
expiresAt?: string;
|
|
89
|
+
approve(): Promise<void>;
|
|
90
|
+
deny(reason?: string): Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
interface HarnessErrorShape {
|
|
93
|
+
name?: string;
|
|
94
|
+
message: string;
|
|
95
|
+
stack?: string;
|
|
96
|
+
cause?: unknown;
|
|
97
|
+
}
|
|
98
|
+
type HarnessStreamEvent = {
|
|
99
|
+
type: "run.started";
|
|
100
|
+
sessionId: string;
|
|
101
|
+
runId: string;
|
|
102
|
+
mode: string;
|
|
103
|
+
} | {
|
|
104
|
+
type: "session.status";
|
|
105
|
+
status: HarnessSessionStatus;
|
|
106
|
+
} | {
|
|
107
|
+
type: "user.message";
|
|
108
|
+
message: AgentMessage;
|
|
109
|
+
} | {
|
|
110
|
+
type: "assistant.delta";
|
|
111
|
+
text: string;
|
|
112
|
+
event: HarnessEventRecord;
|
|
113
|
+
} | {
|
|
114
|
+
type: "assistant.message";
|
|
115
|
+
message: AgentMessage;
|
|
116
|
+
} | {
|
|
117
|
+
type: "tool.started";
|
|
118
|
+
toolCallId: string;
|
|
119
|
+
name: string;
|
|
120
|
+
args: unknown;
|
|
121
|
+
} | {
|
|
122
|
+
type: "tool.approval.requested";
|
|
123
|
+
approval: ToolApprovalHandle;
|
|
124
|
+
} | {
|
|
125
|
+
type: "tool.approval.resolved";
|
|
126
|
+
approvalId: string;
|
|
127
|
+
approved: boolean;
|
|
128
|
+
} | {
|
|
129
|
+
type: "tool.ended";
|
|
130
|
+
toolCallId: string;
|
|
131
|
+
name: string;
|
|
132
|
+
result: AgentToolResult;
|
|
133
|
+
} | {
|
|
134
|
+
type: "mode.changed";
|
|
135
|
+
previousMode: string;
|
|
136
|
+
mode: string;
|
|
137
|
+
} | {
|
|
138
|
+
type: "event";
|
|
139
|
+
event: HarnessEventRecord;
|
|
140
|
+
} | {
|
|
141
|
+
type: "run.completed";
|
|
142
|
+
result: SendResult;
|
|
143
|
+
} | {
|
|
144
|
+
type: "error";
|
|
145
|
+
error: HarnessErrorShape;
|
|
146
|
+
};
|
|
147
|
+
interface HarnessRunStream extends AsyncIterable<HarnessStreamEvent> {
|
|
148
|
+
readonly id: string;
|
|
149
|
+
readonly result: Promise<SendResult>;
|
|
150
|
+
cancel(reason?: string): Promise<void>;
|
|
151
|
+
}
|
|
152
|
+
type HarnessSessionListener = (event: HarnessStreamEvent) => void | Promise<void>;
|
|
153
|
+
type HarnessSessionEventListener<TEvent extends HarnessEvent = HarnessEvent> = (event: TEvent) => void | Promise<void>;
|
|
154
|
+
declare enum HarnessSessionPhase {
|
|
155
|
+
Idle = "idle",
|
|
156
|
+
Queued = "queued",
|
|
157
|
+
Starting = "starting",
|
|
158
|
+
BuildingContext = "building_context",
|
|
159
|
+
WaitingModel = "waiting_model",
|
|
160
|
+
RunningTool = "running_tool",
|
|
161
|
+
WaitingApproval = "waiting_approval",
|
|
162
|
+
ClosingTurn = "closing_turn",
|
|
163
|
+
Completed = "completed",
|
|
164
|
+
Error = "error",
|
|
165
|
+
Closed = "closed"
|
|
166
|
+
}
|
|
167
|
+
interface HarnessSessionStatus {
|
|
168
|
+
sessionId: string;
|
|
169
|
+
agentKey: string;
|
|
170
|
+
mode: string;
|
|
171
|
+
model: string;
|
|
172
|
+
provider: ModelProviderInfo | undefined;
|
|
173
|
+
createdAt: string;
|
|
174
|
+
lastActiveAt: string;
|
|
175
|
+
running: boolean;
|
|
176
|
+
phase: HarnessSessionPhase;
|
|
177
|
+
queuedInputCount: number;
|
|
178
|
+
currentTurnId?: string;
|
|
179
|
+
activeTool?: {
|
|
180
|
+
id: string;
|
|
181
|
+
name: string;
|
|
182
|
+
};
|
|
183
|
+
lastEventAt?: string;
|
|
184
|
+
lastError?: HarnessErrorShape;
|
|
185
|
+
pendingApprovalCount: number;
|
|
186
|
+
runId?: string;
|
|
187
|
+
outputDir?: string;
|
|
188
|
+
metrics?: RunMetrics;
|
|
189
|
+
}
|
|
190
|
+
interface HarnessSession {
|
|
191
|
+
readonly id: string;
|
|
192
|
+
send(input: string | HarnessUserInput, options?: SendOptions): Promise<SendResult>;
|
|
193
|
+
stream(input: string | HarnessUserInput, options?: StreamOptions): HarnessRunStream;
|
|
194
|
+
getStatus(): HarnessSessionStatus;
|
|
195
|
+
getModel(): string;
|
|
196
|
+
setModel(model: string): void;
|
|
197
|
+
clearModelOverride(): void;
|
|
198
|
+
getMode(): string;
|
|
199
|
+
switchMode(mode: HarnessModeSelector | string, input?: unknown): Promise<void>;
|
|
200
|
+
getState(): AgentSharedState;
|
|
201
|
+
updateState(patch: unknown): void;
|
|
202
|
+
replaceState(next: AgentSharedState): void;
|
|
203
|
+
transcript: HarnessTranscriptSession;
|
|
204
|
+
snapshots: HarnessSnapshotSession;
|
|
205
|
+
getEvents(filter?: HarnessEventQuery): HarnessEventRecord[];
|
|
206
|
+
getContextSnapshot(): ContextSnapshot | undefined;
|
|
207
|
+
getAgentManifest(): HarnessAgentManifest;
|
|
208
|
+
getPendingApprovals(): ToolApprovalHandle[];
|
|
209
|
+
approveTool(approvalId: string): Promise<void>;
|
|
210
|
+
denyTool(approvalId: string, reason?: string): Promise<void>;
|
|
211
|
+
on(listener: HarnessSessionListener): () => void;
|
|
212
|
+
onEvent<TPayload, TEvent extends HarnessEvent<TPayload>>(eventClass: HarnessEventClass<TPayload, TEvent>, listener: HarnessSessionEventListener<TEvent>): () => void;
|
|
213
|
+
waitForEvent<TPayload, TEvent extends HarnessEvent<TPayload>>(eventClass: HarnessEventClass<TPayload, TEvent>, options?: WaitForEventOptions): Promise<TEvent>;
|
|
214
|
+
close(): Promise<void>;
|
|
215
|
+
}
|
|
216
|
+
type HarnessSessionStoreEvent = {
|
|
217
|
+
type: "session.created";
|
|
218
|
+
sessionId: string;
|
|
219
|
+
status: HarnessSessionStatus;
|
|
220
|
+
} | {
|
|
221
|
+
type: "session.deleted";
|
|
222
|
+
sessionId: string;
|
|
223
|
+
} | {
|
|
224
|
+
type: "session.cleared";
|
|
225
|
+
} | {
|
|
226
|
+
type: "session.event";
|
|
227
|
+
sessionId: string;
|
|
228
|
+
event: HarnessStreamEvent;
|
|
229
|
+
};
|
|
230
|
+
type HarnessSessionStoreListener = (event: HarnessSessionStoreEvent) => void | Promise<void>;
|
|
231
|
+
interface HarnessSessionStore {
|
|
232
|
+
getOrCreate(sessionId?: string, overrides?: Partial<HarnessAppConfig>): Promise<HarnessSession>;
|
|
233
|
+
get(sessionId: string): HarnessSession | undefined;
|
|
234
|
+
list(): HarnessSessionStatus[];
|
|
235
|
+
delete(sessionId: string): Promise<boolean>;
|
|
236
|
+
clear(): Promise<void>;
|
|
237
|
+
send(sessionId: string | undefined, input: string | HarnessUserInput, options?: SendOptions): Promise<SendResult>;
|
|
238
|
+
stream(sessionId: string | undefined, input: string | HarnessUserInput, options?: StreamOptions): Promise<HarnessRunStream>;
|
|
239
|
+
getPendingApprovals(sessionId?: string): ToolApprovalHandle[];
|
|
240
|
+
approveTool(sessionId: string, approvalId: string): Promise<void>;
|
|
241
|
+
denyTool(sessionId: string, approvalId: string, reason?: string): Promise<void>;
|
|
242
|
+
getAgentManifest(sessionId: string): HarnessAgentManifest | undefined;
|
|
243
|
+
on(listener: HarnessSessionStoreListener): () => void;
|
|
244
|
+
close(): Promise<void>;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export { type HarnessAgentInput as H, type SendOptions as S, type ToolApprovalHandle as T, type WaitForEventOptions as W, type HarnessAgentManifest as a, type HarnessAppConfig as b, type HarnessErrorShape as c, type HarnessEventSummary as d, type HarnessRunStream as e, type HarnessSession as f, type HarnessSessionEventListener as g, type HarnessSessionListener as h, HarnessSessionPhase as i, type HarnessSessionStatus as j, type HarnessSessionStore as k, type HarnessSessionStoreEvent as l, type HarnessSessionStoreListener as m, type HarnessStorageConfig as n, type HarnessStreamEvent as o, type HarnessUserInput as p, type SendResult as q, type StreamOptions as r };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// src/runtime/types/events.ts
|
|
2
|
+
var HarnessEvent = class {
|
|
3
|
+
constructor(record) {
|
|
4
|
+
this.record = record;
|
|
5
|
+
}
|
|
6
|
+
record;
|
|
7
|
+
static type;
|
|
8
|
+
static schema;
|
|
9
|
+
get id() {
|
|
10
|
+
return this.record.id;
|
|
11
|
+
}
|
|
12
|
+
get type() {
|
|
13
|
+
return this.record.type;
|
|
14
|
+
}
|
|
15
|
+
get payload() {
|
|
16
|
+
return this.record.payload;
|
|
17
|
+
}
|
|
18
|
+
get at() {
|
|
19
|
+
return this.record.at;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// src/runtime/types/naming.ts
|
|
24
|
+
function constructorOf(value) {
|
|
25
|
+
return value.constructor;
|
|
26
|
+
}
|
|
27
|
+
function constructTypeOf(value) {
|
|
28
|
+
const ctor = constructorOf(value);
|
|
29
|
+
return ctor.type ?? ctor.name ?? "AnonymousConstruct";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/runtime/types/roles.ts
|
|
33
|
+
var RoleTargets = /* @__PURE__ */ ((RoleTargets2) => {
|
|
34
|
+
RoleTargets2["System"] = "system";
|
|
35
|
+
RoleTargets2["Messages"] = "messages";
|
|
36
|
+
RoleTargets2["Hidden"] = "hidden";
|
|
37
|
+
return RoleTargets2;
|
|
38
|
+
})(RoleTargets || {});
|
|
39
|
+
var NativeRoles = /* @__PURE__ */ ((NativeRoles2) => {
|
|
40
|
+
NativeRoles2["System"] = "system";
|
|
41
|
+
NativeRoles2["User"] = "user";
|
|
42
|
+
NativeRoles2["Assistant"] = "assistant";
|
|
43
|
+
NativeRoles2["Tool"] = "tool";
|
|
44
|
+
return NativeRoles2;
|
|
45
|
+
})(NativeRoles || {});
|
|
46
|
+
var HarnessRole = class {
|
|
47
|
+
label;
|
|
48
|
+
name;
|
|
49
|
+
nativeRole;
|
|
50
|
+
default;
|
|
51
|
+
description;
|
|
52
|
+
get type() {
|
|
53
|
+
return constructTypeOf(this);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var SystemRole = class extends HarnessRole {
|
|
57
|
+
static type = "system";
|
|
58
|
+
label = "System";
|
|
59
|
+
name = "system";
|
|
60
|
+
target = "system" /* System */;
|
|
61
|
+
nativeRole = "system" /* System */;
|
|
62
|
+
default = true;
|
|
63
|
+
};
|
|
64
|
+
var UserRole = class extends HarnessRole {
|
|
65
|
+
static type = "user";
|
|
66
|
+
label = "User";
|
|
67
|
+
name = "user";
|
|
68
|
+
target = "messages" /* Messages */;
|
|
69
|
+
nativeRole = "user" /* User */;
|
|
70
|
+
};
|
|
71
|
+
var AssistantRole = class extends HarnessRole {
|
|
72
|
+
static type = "assistant";
|
|
73
|
+
label = "Assistant";
|
|
74
|
+
name = "assistant";
|
|
75
|
+
target = "messages" /* Messages */;
|
|
76
|
+
nativeRole = "assistant" /* Assistant */;
|
|
77
|
+
};
|
|
78
|
+
var ToolRole = class extends HarnessRole {
|
|
79
|
+
static type = "tool";
|
|
80
|
+
label = "Tool";
|
|
81
|
+
name = "tool";
|
|
82
|
+
target = "messages" /* Messages */;
|
|
83
|
+
nativeRole = "tool" /* Tool */;
|
|
84
|
+
};
|
|
85
|
+
var systemRole = new SystemRole();
|
|
86
|
+
var userRole = new UserRole();
|
|
87
|
+
var assistantRole = new AssistantRole();
|
|
88
|
+
var toolRole = new ToolRole();
|
|
89
|
+
|
|
90
|
+
// src/runtime/types/tools.ts
|
|
91
|
+
var HarnessTool = class {
|
|
92
|
+
label;
|
|
93
|
+
schema;
|
|
94
|
+
risk;
|
|
95
|
+
permissions;
|
|
96
|
+
requiresApproval;
|
|
97
|
+
get type() {
|
|
98
|
+
return constructTypeOf(this);
|
|
99
|
+
}
|
|
100
|
+
get inputSchema() {
|
|
101
|
+
return this.schema;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// src/runtime/types/context.ts
|
|
106
|
+
var ContextScopes = /* @__PURE__ */ ((ContextScopes2) => {
|
|
107
|
+
ContextScopes2["Turn"] = "turn";
|
|
108
|
+
ContextScopes2["Run"] = "run";
|
|
109
|
+
ContextScopes2["Session"] = "session";
|
|
110
|
+
return ContextScopes2;
|
|
111
|
+
})(ContextScopes || {});
|
|
112
|
+
var ContextConsume = /* @__PURE__ */ ((ContextConsume2) => {
|
|
113
|
+
ContextConsume2["Once"] = "once";
|
|
114
|
+
ContextConsume2["WhileActive"] = "while_active";
|
|
115
|
+
return ContextConsume2;
|
|
116
|
+
})(ContextConsume || {});
|
|
117
|
+
var HarnessContextProvider = class {
|
|
118
|
+
label;
|
|
119
|
+
priority;
|
|
120
|
+
role;
|
|
121
|
+
get type() {
|
|
122
|
+
return constructTypeOf(this);
|
|
123
|
+
}
|
|
124
|
+
with(options) {
|
|
125
|
+
return { provider: this, options };
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// src/runtime/types/modes.ts
|
|
130
|
+
var HarnessMode = class {
|
|
131
|
+
label;
|
|
132
|
+
model;
|
|
133
|
+
prompt;
|
|
134
|
+
providers;
|
|
135
|
+
excludeProviders;
|
|
136
|
+
tools;
|
|
137
|
+
maxTurns;
|
|
138
|
+
toolApproval;
|
|
139
|
+
get type() {
|
|
140
|
+
return constructTypeOf(this);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// src/runtime/types/hooks.ts
|
|
145
|
+
var HarnessHook = class _HarnessHook {
|
|
146
|
+
label;
|
|
147
|
+
eventClass;
|
|
148
|
+
static for(eventClass) {
|
|
149
|
+
class BoundHarnessHook extends _HarnessHook {
|
|
150
|
+
eventClass = eventClass;
|
|
151
|
+
}
|
|
152
|
+
return BoundHarnessHook;
|
|
153
|
+
}
|
|
154
|
+
get type() {
|
|
155
|
+
return constructTypeOf(this);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export {
|
|
160
|
+
HarnessEvent,
|
|
161
|
+
RoleTargets,
|
|
162
|
+
NativeRoles,
|
|
163
|
+
HarnessRole,
|
|
164
|
+
SystemRole,
|
|
165
|
+
UserRole,
|
|
166
|
+
AssistantRole,
|
|
167
|
+
ToolRole,
|
|
168
|
+
systemRole,
|
|
169
|
+
userRole,
|
|
170
|
+
assistantRole,
|
|
171
|
+
toolRole,
|
|
172
|
+
HarnessTool,
|
|
173
|
+
ContextScopes,
|
|
174
|
+
ContextConsume,
|
|
175
|
+
HarnessContextProvider,
|
|
176
|
+
HarnessMode,
|
|
177
|
+
HarnessHook
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=chunk-4A2P4QU5.js.map
|