@almadar/agent 1.6.4 → 2.0.1
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/LICENSE +21 -72
- package/README.md +25 -0
- package/dist/agent/event-budget.d.ts +28 -0
- package/dist/agent/experimental/hitl-v2.d.ts +161 -0
- package/dist/agent/experimental/hitl-workflow-integration.d.ts +182 -0
- package/dist/agent/index.d.ts +14 -13
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/interrupt-config.d.ts +51 -0
- package/dist/agent/session-manager.d.ts +204 -0
- package/dist/agent/skill-agent.d.ts +182 -0
- package/dist/agent/workflow-middleware.d.ts +63 -0
- package/dist/agent/workflow-tool-wrapper.d.ts +87 -0
- package/dist/{api-types-CXrq-fts.d.ts → api-types.d.ts} +85 -51
- package/dist/context/compaction.d.ts +191 -0
- package/dist/context-compaction.d.ts +55 -0
- package/dist/evals/online-sampling.d.ts +114 -0
- package/dist/evals/utils/compact-orbital.d.ts +100 -0
- package/dist/event-transformer/event-transformer.d.ts +120 -0
- package/dist/event-transformer/index.d.ts +4 -122
- package/dist/events.d.ts +85 -0
- package/dist/index.d.ts +58 -1678
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/dist/memory/MemoryManager.d.ts +243 -0
- package/dist/memory/PreferenceLearner.d.ts +59 -0
- package/dist/memory/agentic-search.d.ts +116 -0
- package/dist/memory/index.d.ts +14 -0
- package/dist/memory/memory-orbital.d.ts +66 -0
- package/dist/memory/types.d.ts +143 -0
- package/dist/metrics.d.ts +77 -0
- package/dist/multi-user.d.ts +155 -0
- package/dist/observability/index.d.ts +14 -0
- package/dist/observability/langsmith-integration.d.ts +203 -0
- package/dist/observability.d.ts +196 -0
- package/dist/orbitals/archive/sanitize.d.ts +24 -0
- package/dist/orbitals/batch/batch-generator.d.ts +41 -0
- package/dist/orbitals/batch/concurrency.d.ts +54 -0
- package/dist/orbitals/batch/index.d.ts +14 -0
- package/dist/orbitals/batch/prompt-assembler.d.ts +92 -0
- package/dist/orbitals/batch/types.d.ts +103 -0
- package/dist/orbitals/cache/index.d.ts +11 -0
- package/dist/orbitals/cache/orbital-fingerprint.d.ts +37 -0
- package/dist/orbitals/cache/prompt-assembler.d.ts +65 -0
- package/dist/orbitals/cache/structural-templates.d.ts +33 -0
- package/dist/orbitals/combiner/index.d.ts +102 -0
- package/dist/orbitals/domain-language/index.d.ts +9 -0
- package/dist/orbitals/domain-language/prompts/index.d.ts +11 -0
- package/dist/orbitals/domain-language/prompts/odl-examples.d.ts +8 -0
- package/dist/orbitals/domain-language/prompts/odl-patterns.d.ts +8 -0
- package/dist/orbitals/domain-language/prompts/odl-syntax.d.ts +8 -0
- package/dist/orbitals/domain-language/prompts/odl-to-schema.d.ts +8 -0
- package/dist/orbitals/generation/index.d.ts +10 -0
- package/dist/orbitals/generation/orbital-generator.d.ts +120 -0
- package/dist/orbitals/shared/constants.d.ts +65 -0
- package/dist/orbitals/shared/index.d.ts +11 -0
- package/dist/orbitals/shared/types.d.ts +187 -0
- package/dist/orbitals/shared/utils.d.ts +97 -0
- package/dist/orchestration/complexity-classifier.d.ts +38 -0
- package/dist/orchestration/fixing-orchestrator.d.ts +53 -0
- package/dist/orchestration/index.d.ts +31 -0
- package/dist/orchestration/provider-router.d.ts +45 -0
- package/dist/{firestore-checkpointer-CkNKXoun.d.ts → persistence/firestore-checkpointer.d.ts} +13 -58
- package/dist/persistence/firestore-session-store.d.ts +75 -0
- package/dist/persistence/firestore-store.d.ts +86 -0
- package/dist/persistence/index.d.ts +7 -198
- package/dist/persistence/memory-backend.d.ts +33 -0
- package/dist/persistence/types.d.ts +40 -0
- package/dist/security/audit-log.d.ts +44 -0
- package/dist/state-sync.d.ts +171 -0
- package/dist/subagents.d.ts +38 -0
- package/dist/tools/combine-schemas.d.ts +154 -0
- package/dist/tools/composition.d.ts +119 -0
- package/dist/{orbital-subagent-BdFuf77p.d.ts → tools/domain-orbital.d.ts} +22 -461
- package/dist/tools/execute.d.ts +38 -0
- package/dist/tools/finish-task.d.ts +56 -0
- package/dist/tools/generate-schema.d.ts +53 -0
- package/dist/tools/github.d.ts +297 -0
- package/dist/tools/index.d.ts +1318 -8
- package/dist/tools/orbital-batch-subagent.d.ts +85 -0
- package/dist/tools/orbital-subagent.d.ts +454 -0
- package/dist/tools/orchestrated-fixing.d.ts +74 -0
- package/dist/tools/orchestrated-generation.d.ts +75 -0
- package/dist/tools/sandbox-executor.d.ts +31 -0
- package/dist/tools/schema-chunking.d.ts +117 -0
- package/dist/tools/trait-subagent.d.ts +179 -0
- package/dist/tools/validate-schema.d.ts +17 -0
- package/dist/types.d.ts +14 -17
- package/dist/utils/safety/capability-token.d.ts +50 -0
- package/dist/utils/safety/circuit-breaker.d.ts +71 -0
- package/dist/utils/safety/index.d.ts +19 -0
- package/dist/utils/safety/rate-limiter.d.ts +39 -0
- package/dist/utils/safety/threshold-auth.d.ts +70 -0
- package/dist/workspace/git-client.d.ts +51 -0
- package/dist/workspace/index.d.ts +29 -346
- package/dist/workspace/index.js +39 -0
- package/dist/workspace/index.js.map +1 -1
- package/dist/workspace/memory-files.d.ts +31 -0
- package/dist/workspace/sink-manager.d.ts +26 -0
- package/dist/workspace/sinks/firestore-sink.d.ts +41 -0
- package/dist/workspace/sinks/git-sink.d.ts +47 -0
- package/dist/workspace/sinks/index.d.ts +9 -0
- package/dist/workspace/templates.d.ts +32 -0
- package/dist/workspace/types.d.ts +86 -0
- package/dist/workspace/workspace-manager.d.ts +57 -0
- package/package.json +12 -10
- package/dist/index-DW3F-Ihx.d.ts +0 -2501
- package/dist/index-DZn69no8.d.ts +0 -1014
package/LICENSE
CHANGED
|
@@ -1,72 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
23
|
-
available distribution of a specific version of the Licensed Work under this
|
|
24
|
-
License, whichever comes first, the Licensor hereby grants you rights under
|
|
25
|
-
the terms of the Change License, and the rights granted in the paragraph
|
|
26
|
-
above terminate.
|
|
27
|
-
|
|
28
|
-
If your use of the Licensed Work does not comply with the requirements
|
|
29
|
-
currently in effect as described in this License, you must purchase a
|
|
30
|
-
commercial license from the Licensor, its affiliated entities, or authorized
|
|
31
|
-
resellers, or you must refrain from using the Licensed Work.
|
|
32
|
-
|
|
33
|
-
All copies of the original and modified Licensed Work, and derivative works
|
|
34
|
-
of the Licensed Work, are subject to this License. This License applies
|
|
35
|
-
separately for each version of the Licensed Work and the Change Date may vary
|
|
36
|
-
for each version of the Licensed Work released by Licensor.
|
|
37
|
-
|
|
38
|
-
You must conspicuously display this License on each original or modified copy
|
|
39
|
-
of the Licensed Work. If you receive the Licensed Work in original or
|
|
40
|
-
modified form from a third party, the terms and conditions set forth in this
|
|
41
|
-
License apply to your use of that work.
|
|
42
|
-
|
|
43
|
-
Any use of the Licensed Work in violation of this License will automatically
|
|
44
|
-
terminate your rights under this License for the current and all other
|
|
45
|
-
versions of the Licensed Work.
|
|
46
|
-
|
|
47
|
-
This License does not grant you any right in any trademark or logo of
|
|
48
|
-
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
49
|
-
Licensor as expressly required by this License).
|
|
50
|
-
|
|
51
|
-
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
52
|
-
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
53
|
-
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
54
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
55
|
-
TITLE.
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
60
|
-
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
61
|
-
|
|
62
|
-
ADDITIONAL TERMS:
|
|
63
|
-
|
|
64
|
-
Documentation (builder/packages/website/docs/) is licensed under CC BY 4.0.
|
|
65
|
-
|
|
66
|
-
TRADEMARKS:
|
|
67
|
-
|
|
68
|
-
"Orbital", "KFlow", "Almadar", and the Almadar logo are trademarks of
|
|
69
|
-
Almadar FZE. You may not use these trademarks without prior written
|
|
70
|
-
permission from Almadar FZE.
|
|
71
|
-
|
|
72
|
-
For licensing inquiries: licensing@almadar.io
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Almadar Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @almadar/agent
|
|
2
|
+
|
|
3
|
+
> AI agent infrastructure for Almadar orbital schema generation
|
|
4
|
+
|
|
5
|
+
Part of the [Almadar](https://github.com/almadar-io/almadar) platform.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @almadar/agent
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { /* ... */ } from '@almadar/agent';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## API
|
|
20
|
+
|
|
21
|
+
<!-- Document public exports here -->
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
MIT
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Budget Configuration
|
|
3
|
+
*
|
|
4
|
+
* Prevents runaway agent loops with soft/hard event limits per skill.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Event budget limits for different skills.
|
|
8
|
+
* - soft: Warning threshold (agent reminded to finish up)
|
|
9
|
+
* - hard: Maximum events before forced completion
|
|
10
|
+
*/
|
|
11
|
+
export declare const EVENT_BUDGETS: Record<string, {
|
|
12
|
+
soft: number;
|
|
13
|
+
hard: number;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Get event budget for a skill.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getEventBudget(skillName: string): {
|
|
19
|
+
soft: number;
|
|
20
|
+
hard: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Generate a budget warning message to inject into the agent.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getBudgetWarningMessage(eventCount: number, budget: {
|
|
26
|
+
soft: number;
|
|
27
|
+
hard: number;
|
|
28
|
+
}): string | null;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-in-the-Loop v2 - Phase 2.3
|
|
3
|
+
*
|
|
4
|
+
* Structured interrupts with memory and time-travel debugging.
|
|
5
|
+
* Interrupt types: confirm, edit, select, text
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type { MemoryManager } from '../../memory/MemoryManager.js';
|
|
10
|
+
export type InterruptType = 'confirm' | 'edit' | 'select' | 'text';
|
|
11
|
+
export interface InterruptRequest<T = unknown> {
|
|
12
|
+
interruptId: string;
|
|
13
|
+
sessionId: string;
|
|
14
|
+
type: InterruptType;
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
context: InterruptContext;
|
|
18
|
+
payload: T;
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
}
|
|
22
|
+
export interface InterruptContext {
|
|
23
|
+
checkpointId: string;
|
|
24
|
+
currentState: string;
|
|
25
|
+
previousActions: string[];
|
|
26
|
+
relevantMemory?: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface InterruptResponse<T = unknown> {
|
|
29
|
+
interruptId: string;
|
|
30
|
+
response: T;
|
|
31
|
+
respondedAt: Date;
|
|
32
|
+
userId?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ConfirmPayload {
|
|
35
|
+
question: string;
|
|
36
|
+
defaultValue?: boolean;
|
|
37
|
+
severity: 'info' | 'warning' | 'critical';
|
|
38
|
+
}
|
|
39
|
+
export interface EditPayload {
|
|
40
|
+
content: string;
|
|
41
|
+
format: 'json' | 'text' | 'code';
|
|
42
|
+
schema?: Record<string, unknown>;
|
|
43
|
+
validationRules?: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface SelectPayload {
|
|
46
|
+
options: Array<{
|
|
47
|
+
id: string;
|
|
48
|
+
label: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
multiple?: boolean;
|
|
53
|
+
maxSelections?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface TextPayload {
|
|
56
|
+
placeholder?: string;
|
|
57
|
+
multiline?: boolean;
|
|
58
|
+
maxLength?: number;
|
|
59
|
+
validation?: 'email' | 'url' | 'regex';
|
|
60
|
+
validationRegex?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface HITLv2Options {
|
|
63
|
+
memoryManager?: MemoryManager;
|
|
64
|
+
defaultTimeoutMs?: number;
|
|
65
|
+
onInterrupt?: (request: InterruptRequest) => void;
|
|
66
|
+
onResponse?: (request: InterruptRequest, response: InterruptResponse) => void;
|
|
67
|
+
}
|
|
68
|
+
export declare class HITLv2Manager {
|
|
69
|
+
private options;
|
|
70
|
+
private pendingInterrupts;
|
|
71
|
+
private responses;
|
|
72
|
+
private checkpoints;
|
|
73
|
+
constructor(options?: HITLv2Options);
|
|
74
|
+
/**
|
|
75
|
+
* Create a confirmation interrupt
|
|
76
|
+
*/
|
|
77
|
+
confirm(sessionId: string, question: string, options?: {
|
|
78
|
+
severity?: 'info' | 'warning' | 'critical';
|
|
79
|
+
defaultValue?: boolean;
|
|
80
|
+
timeoutMs?: number;
|
|
81
|
+
context?: Partial<InterruptContext>;
|
|
82
|
+
}): Promise<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* Create an edit interrupt
|
|
85
|
+
*/
|
|
86
|
+
edit(sessionId: string, content: string, options?: {
|
|
87
|
+
format?: 'json' | 'text' | 'code';
|
|
88
|
+
title?: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
schema?: Record<string, unknown>;
|
|
91
|
+
timeoutMs?: number;
|
|
92
|
+
context?: Partial<InterruptContext>;
|
|
93
|
+
}): Promise<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Create a selection interrupt
|
|
96
|
+
*/
|
|
97
|
+
select<T extends string>(sessionId: string, options: Array<{
|
|
98
|
+
id: T;
|
|
99
|
+
label: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
}>, config?: {
|
|
102
|
+
title?: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
multiple?: boolean;
|
|
105
|
+
timeoutMs?: number;
|
|
106
|
+
context?: Partial<InterruptContext>;
|
|
107
|
+
}): Promise<T | T[]>;
|
|
108
|
+
/**
|
|
109
|
+
* Create a text input interrupt
|
|
110
|
+
*/
|
|
111
|
+
text(sessionId: string, options?: {
|
|
112
|
+
title?: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
placeholder?: string;
|
|
115
|
+
multiline?: boolean;
|
|
116
|
+
maxLength?: number;
|
|
117
|
+
timeoutMs?: number;
|
|
118
|
+
context?: Partial<InterruptContext>;
|
|
119
|
+
}): Promise<string>;
|
|
120
|
+
/**
|
|
121
|
+
* Submit a response to an interrupt
|
|
122
|
+
*/
|
|
123
|
+
submitResponse<T>(interruptId: string, response: T, userId?: string): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Cancel an interrupt
|
|
126
|
+
*/
|
|
127
|
+
cancelInterrupt(interruptId: string, reason?: string): void;
|
|
128
|
+
/**
|
|
129
|
+
* Save a checkpoint for time-travel
|
|
130
|
+
*/
|
|
131
|
+
saveCheckpoint(checkpointId: string, state: unknown): void;
|
|
132
|
+
/**
|
|
133
|
+
* Restore a checkpoint
|
|
134
|
+
*/
|
|
135
|
+
restoreCheckpoint<T>(checkpointId: string): T | null;
|
|
136
|
+
/**
|
|
137
|
+
* List available checkpoints
|
|
138
|
+
*/
|
|
139
|
+
listCheckpoints(): string[];
|
|
140
|
+
/**
|
|
141
|
+
* Rewind to checkpoint and continue
|
|
142
|
+
*/
|
|
143
|
+
rewindToCheckpoint<T>(checkpointId: string, sessionId: string, modifyFn?: (state: T) => T): Promise<T | null>;
|
|
144
|
+
/**
|
|
145
|
+
* Get interrupt statistics
|
|
146
|
+
*/
|
|
147
|
+
getStats(): {
|
|
148
|
+
pendingCount: number;
|
|
149
|
+
totalHandled: number;
|
|
150
|
+
checkpointsCount: number;
|
|
151
|
+
averageResponseTimeMs: number;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Get pending interrupts for a session
|
|
155
|
+
*/
|
|
156
|
+
getPendingForSession(sessionId: string): InterruptRequest[];
|
|
157
|
+
private createInterrupt;
|
|
158
|
+
private waitForResponse;
|
|
159
|
+
private storeInteraction;
|
|
160
|
+
}
|
|
161
|
+
export declare function createHITLv2Manager(options?: HITLv2Options): HITLv2Manager;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HITL Workflow Integration - Phase 3.4
|
|
3
|
+
*
|
|
4
|
+
* Human-in-the-Loop with workflow-based conditional branching.
|
|
5
|
+
* Enables complex approval flows with human gates.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { HITLv2Manager } from './hitl-v2.js';
|
|
10
|
+
import type { MemoryManager } from '../../memory/MemoryManager.js';
|
|
11
|
+
/**
|
|
12
|
+
* Human gate types
|
|
13
|
+
*/
|
|
14
|
+
export type HumanGateType = 'approval' | 'edit' | 'select' | 'custom';
|
|
15
|
+
/**
|
|
16
|
+
* Human gate configuration
|
|
17
|
+
*/
|
|
18
|
+
export interface HumanGate {
|
|
19
|
+
/** Gate ID */
|
|
20
|
+
id: string;
|
|
21
|
+
/** Gate type */
|
|
22
|
+
type: HumanGateType;
|
|
23
|
+
/** Display title */
|
|
24
|
+
title: string;
|
|
25
|
+
/** Description */
|
|
26
|
+
description: string;
|
|
27
|
+
/** Gate condition - when to show */
|
|
28
|
+
condition?: (context: unknown) => boolean;
|
|
29
|
+
/** Timeout in ms */
|
|
30
|
+
timeoutMs?: number;
|
|
31
|
+
/** Auto-approve if condition met */
|
|
32
|
+
autoApprove?: {
|
|
33
|
+
condition: (context: unknown) => boolean;
|
|
34
|
+
reason: string;
|
|
35
|
+
};
|
|
36
|
+
/** Gate-specific payload */
|
|
37
|
+
payload?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Human gate result
|
|
41
|
+
*/
|
|
42
|
+
export interface HumanGateResult {
|
|
43
|
+
gateId: string;
|
|
44
|
+
approved: boolean;
|
|
45
|
+
response: unknown;
|
|
46
|
+
respondedAt: number;
|
|
47
|
+
userId?: string;
|
|
48
|
+
autoApproved: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Workflow branch definition
|
|
52
|
+
*/
|
|
53
|
+
export interface WorkflowBranch {
|
|
54
|
+
/** Branch ID */
|
|
55
|
+
id: string;
|
|
56
|
+
/** Branch condition */
|
|
57
|
+
condition: (context: unknown) => boolean;
|
|
58
|
+
/** Steps to execute */
|
|
59
|
+
steps: Array<{
|
|
60
|
+
tool: string;
|
|
61
|
+
input: Record<string, unknown>;
|
|
62
|
+
}>;
|
|
63
|
+
/** Human gate before branch */
|
|
64
|
+
gate?: HumanGate;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* HITL workflow definition
|
|
68
|
+
*/
|
|
69
|
+
export interface HITLWorkflowDefinition {
|
|
70
|
+
/** Workflow name */
|
|
71
|
+
name: string;
|
|
72
|
+
/** Initial steps (before any gates) */
|
|
73
|
+
initialSteps: Array<{
|
|
74
|
+
tool: string;
|
|
75
|
+
input: Record<string, unknown>;
|
|
76
|
+
}>;
|
|
77
|
+
/** Human gates with conditional branches */
|
|
78
|
+
gates: HumanGate[];
|
|
79
|
+
/** Branches based on gate outcomes */
|
|
80
|
+
branches: WorkflowBranch[];
|
|
81
|
+
/** Fallback if no branches match */
|
|
82
|
+
fallbackBranch?: WorkflowBranch;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* HITL workflow result
|
|
86
|
+
*/
|
|
87
|
+
export interface HITLWorkflowResult {
|
|
88
|
+
success: boolean;
|
|
89
|
+
output: unknown;
|
|
90
|
+
gatesPassed: HumanGateResult[];
|
|
91
|
+
branchesTaken: string[];
|
|
92
|
+
durationMs: number;
|
|
93
|
+
wasInterrupted: boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* HITL workflow options
|
|
97
|
+
*/
|
|
98
|
+
export interface HITLWorkflowOptions {
|
|
99
|
+
/** HITL manager */
|
|
100
|
+
hitlManager: HITLv2Manager;
|
|
101
|
+
/** Tool executor */
|
|
102
|
+
toolExecutor: {
|
|
103
|
+
execute(tool: string, input: Record<string, unknown>): Promise<unknown>;
|
|
104
|
+
};
|
|
105
|
+
/** Memory manager */
|
|
106
|
+
memoryManager?: MemoryManager;
|
|
107
|
+
/** Default gate timeout */
|
|
108
|
+
defaultTimeoutMs?: number;
|
|
109
|
+
/** Enable auto-approval learning */
|
|
110
|
+
enableAutoApprove?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export declare class HITLWorkflowEngine {
|
|
113
|
+
private workflowEngine;
|
|
114
|
+
private hitlManager;
|
|
115
|
+
private options;
|
|
116
|
+
private gateHistory;
|
|
117
|
+
constructor(options: HITLWorkflowOptions);
|
|
118
|
+
/**
|
|
119
|
+
* Execute a workflow with human gates
|
|
120
|
+
*/
|
|
121
|
+
executeWorkflow(sessionId: string, workflow: HITLWorkflowDefinition, initialContext: Record<string, unknown>): Promise<HITLWorkflowResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Execute initial workflow steps
|
|
124
|
+
*/
|
|
125
|
+
private executeInitialSteps;
|
|
126
|
+
/**
|
|
127
|
+
* Execute a human gate
|
|
128
|
+
*/
|
|
129
|
+
private executeHumanGate;
|
|
130
|
+
/**
|
|
131
|
+
* Execute approval gate
|
|
132
|
+
*/
|
|
133
|
+
private executeApprovalGate;
|
|
134
|
+
/**
|
|
135
|
+
* Execute edit gate
|
|
136
|
+
*/
|
|
137
|
+
private executeEditGate;
|
|
138
|
+
/**
|
|
139
|
+
* Execute select gate
|
|
140
|
+
*/
|
|
141
|
+
private executeSelectGate;
|
|
142
|
+
/**
|
|
143
|
+
* Execute custom gate
|
|
144
|
+
*/
|
|
145
|
+
private executeCustomGate;
|
|
146
|
+
/**
|
|
147
|
+
* Execute branch steps
|
|
148
|
+
*/
|
|
149
|
+
private executeBranchSteps;
|
|
150
|
+
/**
|
|
151
|
+
* Wait for interrupt response
|
|
152
|
+
*/
|
|
153
|
+
private waitForResponse;
|
|
154
|
+
/**
|
|
155
|
+
* Interpolate input with context
|
|
156
|
+
*/
|
|
157
|
+
private interpolateInput;
|
|
158
|
+
/**
|
|
159
|
+
* Get value from path
|
|
160
|
+
*/
|
|
161
|
+
private getValueFromPath;
|
|
162
|
+
/**
|
|
163
|
+
* Get gate history for a session
|
|
164
|
+
*/
|
|
165
|
+
getGateHistory(sessionId: string): HumanGateResult[];
|
|
166
|
+
/**
|
|
167
|
+
* Clear gate history
|
|
168
|
+
*/
|
|
169
|
+
clearGateHistory(sessionId?: string): void;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Schema generation with human review
|
|
173
|
+
*/
|
|
174
|
+
export declare function createSchemaGenerationHITLWorkflow(complexity: 'simple' | 'medium' | 'complex'): HITLWorkflowDefinition;
|
|
175
|
+
/**
|
|
176
|
+
* Multi-stage approval workflow
|
|
177
|
+
*/
|
|
178
|
+
export declare function createMultiStageApprovalWorkflow(stages: Array<{
|
|
179
|
+
name: string;
|
|
180
|
+
approver: string;
|
|
181
|
+
}>): HITLWorkflowDefinition;
|
|
182
|
+
export declare function createHITLWorkflowEngine(options: HITLWorkflowOptions): HITLWorkflowEngine;
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Agent Module
|
|
3
|
+
*
|
|
4
|
+
* Agent factory, session management, event budgets, and interrupt configuration.
|
|
5
|
+
*/
|
|
6
|
+
export { createSkillAgent, resumeSkillAgent, Command, } from './skill-agent.js';
|
|
7
|
+
export type { Skill, SkillLoader, SkillRefLoader, SkillAgentOptions, SkillAgentResult, SkillAgent, } from './skill-agent.js';
|
|
8
|
+
export { SessionManager, } from './session-manager.js';
|
|
9
|
+
export type { SessionMetadata, SessionRecord, PersistenceMode, SessionManagerOptions, } from './session-manager.js';
|
|
10
|
+
export { EVENT_BUDGETS, getEventBudget, getBudgetWarningMessage, } from './event-budget.js';
|
|
11
|
+
export { getInterruptConfig, } from './interrupt-config.js';
|
|
12
|
+
export type { SkillMeta, } from './interrupt-config.js';
|
|
13
|
+
export { createWorkflowToolWrapper, createEvalWorkflowWrapper, } from './workflow-tool-wrapper.js';
|
|
14
|
+
export type { WorkflowToolWrapperOptions, ToolTelemetry, WorkflowToolWrapper, } from './workflow-tool-wrapper.js';
|