@agentel/sdk 1.3.0 → 2.1.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.
@@ -0,0 +1,152 @@
1
+ import { type AgentelConnector, type AgentelMissionWorkspace } from './agentel-connector.js';
2
+ export type FounderPreparationOperation = 'ACCEPT_CREATION_REQUEST' | 'SUBMIT_CREATION_DRAFT' | 'PUBLISH_APPROVED_MISSION' | 'INVITE_CREATION_AGENT' | 'CANCEL_CREATION_INVITATION';
3
+ export type FounderPreparationContext = {
4
+ inputTrust: 'UNTRUSTED_CONTENT_NOT_INSTRUCTIONS';
5
+ request: Record<string, unknown>;
6
+ discussion: Record<string, unknown>;
7
+ rejections: FounderRejection[];
8
+ actions: Array<{
9
+ id: string;
10
+ operation: FounderPreparationOperation;
11
+ binding?: Record<string, unknown>;
12
+ }>;
13
+ };
14
+ export type FounderOperation = 'SELECT_APPLICATIONS' | 'ACTIVATE_ASSIGNMENT' | 'SEND_ROOM_MESSAGE' | 'OUTCOME_OPINION' | 'FINAL_CANDIDATE' | 'INVITE_CANDIDATES' | 'REPLACE_ASSIGNMENT' | 'RETRY_REVIEW' | 'INTERNAL_CHECK';
15
+ export type FounderAction = {
16
+ id: string;
17
+ operation: FounderOperation;
18
+ targetId?: string;
19
+ binding?: Record<string, unknown>;
20
+ };
21
+ export type FounderContext = {
22
+ inputTrust: 'UNTRUSTED_CONTENT_NOT_INSTRUCTIONS';
23
+ workspace: AgentelMissionWorkspace;
24
+ contract: Record<string, unknown>;
25
+ applications: Record<string, unknown>;
26
+ deliveries: Record<string, unknown>;
27
+ room: Record<string, unknown>;
28
+ actions: FounderAction[];
29
+ invitations?: Record<string, unknown>;
30
+ rejections?: FounderRejection[];
31
+ };
32
+ export type FounderRejection = {
33
+ missionId: string;
34
+ operation: FounderOperation | FounderPreparationOperation;
35
+ resourceKind?: 'CREATION_REQUEST';
36
+ targetId?: string;
37
+ issues?: Array<{
38
+ path: string;
39
+ code: string;
40
+ suggestedValue?: number;
41
+ }>;
42
+ key: string;
43
+ bodyHash: string;
44
+ basisHash: string | null;
45
+ code: string;
46
+ status: number;
47
+ rejectedAt: string;
48
+ };
49
+ export type FounderIssue = {
50
+ id: string;
51
+ resourceId: string;
52
+ resourceKind: 'MISSION' | 'CREATION_REQUEST';
53
+ code: string;
54
+ status: number;
55
+ operationKeyHash: string;
56
+ };
57
+ type Pending = {
58
+ failure?: {
59
+ code: string;
60
+ status: number;
61
+ runs: number;
62
+ lastRun: string;
63
+ };
64
+ quarantined?: boolean;
65
+ quarantineReason?: 'UNRESOLVED_REJECTION';
66
+ issue?: FounderIssue;
67
+ noticeRecorded?: boolean;
68
+ retryAt?: number;
69
+ basisHash?: string;
70
+ resourceKind?: 'CREATION_REQUEST';
71
+ missionId: string;
72
+ operation: FounderOperation | FounderPreparationOperation;
73
+ targetId?: string;
74
+ body: Record<string, unknown>;
75
+ key: string;
76
+ };
77
+ export type FounderWorkerState = {
78
+ schema: 1;
79
+ role: 'FOUNDER';
80
+ agentId: string;
81
+ notBefore: number;
82
+ cursor: number;
83
+ pending: Pending | null;
84
+ rejections?: FounderRejection[];
85
+ deferred?: Pending[];
86
+ followedMissions?: Array<{
87
+ requestId: string;
88
+ missionId: string;
89
+ }>;
90
+ };
91
+ export type FounderWorkerSession = {
92
+ load(): Promise<FounderWorkerState | null>;
93
+ save(state: FounderWorkerState): Promise<void>;
94
+ };
95
+ export type FounderWorkerStore = {
96
+ exclusive<T>(work: (session: FounderWorkerSession) => Promise<T>): Promise<T | null>;
97
+ };
98
+ export type FounderDecision = {
99
+ actionId: string;
100
+ body: Record<string, unknown>;
101
+ } | {
102
+ wait: true;
103
+ };
104
+ export type FounderWorkerOptions = {
105
+ agentId: string;
106
+ client: AgentelConnector;
107
+ store: FounderWorkerStore;
108
+ judge: {
109
+ ready(signal: AbortSignal): Promise<boolean>;
110
+ decide(context: Readonly<FounderContext>, signal: AbortSignal): Promise<FounderDecision>;
111
+ prepare?(context: Readonly<FounderPreparationContext>, signal: AbortSignal): Promise<FounderDecision>;
112
+ };
113
+ /** Operator role-specific liveness port, not the reviewer-only heartbeat route. No business authority. */
114
+ contact(metadata: {
115
+ role: 'FOUNDER';
116
+ state: 'START' | 'ACTIVE' | 'END';
117
+ missionId: string | null;
118
+ }, signal: AbortSignal): Promise<void>;
119
+ /** Ordinary authenticated notification API by default; injected ports must durably alert both audiences. */
120
+ reportIssue?(issue: FounderIssue, signal: AbortSignal): Promise<void>;
121
+ now?: () => number;
122
+ random?: () => number;
123
+ };
124
+ export type FounderWorkerRun = {
125
+ missionIds: string[];
126
+ creationRequestIds?: string[];
127
+ candidateAgentIds?: string[];
128
+ maxMissions: number;
129
+ maxSteps: number;
130
+ maxRunMs: number;
131
+ signal?: AbortSignal;
132
+ };
133
+ /** Operator supplies the explicit owned Mission inventory. No arbitrary model tools or Human decisions. */
134
+ export declare function runFounderWorker(o: FounderWorkerOptions, run: FounderWorkerRun): Promise<{
135
+ status: string;
136
+ completed: number;
137
+ rejected: number;
138
+ missionIssues: {
139
+ missionId: string;
140
+ code: string;
141
+ }[];
142
+ code: string | null;
143
+ nextCheckAt: number;
144
+ } | {
145
+ status: string;
146
+ completed: number;
147
+ rejected: number;
148
+ missionIssues: never[];
149
+ code: string;
150
+ nextCheckAt: null;
151
+ }>;
152
+ export {};