@agentropy/core 0.0.0-bootstrap.0 → 0.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 @@
1
+ export {};
package/dist/cron.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Next occurrence strictly after `afterIso`. Only the UTC timezone is supported in v1. */
2
+ export declare function nextOccurrence(cron: string, timezone: string, afterIso: string): string;
package/dist/cron.js ADDED
@@ -0,0 +1,55 @@
1
+ /** Minimal 5-field cron (minute hour day-of-month month day-of-week), UTC only, for schedule wake-ups. */
2
+ import { AgentropyError } from './errors.js';
3
+ const RANGES = [
4
+ [0, 59],
5
+ [0, 23],
6
+ [1, 31],
7
+ [1, 12],
8
+ [0, 6],
9
+ ];
10
+ function parseField(field, [min, max]) {
11
+ const out = new Set();
12
+ for (const part of field.split(',')) {
13
+ const [range, stepText] = part.split('/');
14
+ const step = stepText === undefined ? 1 : Number(stepText);
15
+ const [lo, rawHi] = range === '*'
16
+ ? [min, max]
17
+ : range.split('-').map(Number);
18
+ const hi = rawHi ?? (stepText === undefined ? lo : max);
19
+ if (![lo, hi, step].every(Number.isInteger) ||
20
+ lo < min ||
21
+ hi > max ||
22
+ lo > hi ||
23
+ step < 1) {
24
+ throw new AgentropyError('SchemaViolation', `Invalid cron field "${field}"`, { details: { reason: 'cron' } });
25
+ }
26
+ for (let v = lo; v <= hi; v += step)
27
+ out.add(v);
28
+ }
29
+ return out;
30
+ }
31
+ /** Next occurrence strictly after `afterIso`. Only the UTC timezone is supported in v1. */
32
+ export function nextOccurrence(cron, timezone, afterIso) {
33
+ if (timezone !== 'UTC')
34
+ throw new AgentropyError('UnsupportedOperation', 'Only UTC schedules are supported in v1', { details: { feature: 'timezone' } });
35
+ const fields = cron.trim().split(/\s+/);
36
+ if (fields.length !== 5)
37
+ throw new AgentropyError('SchemaViolation', 'Cron needs 5 fields', {
38
+ details: { reason: 'cron' },
39
+ });
40
+ const [mi, ho, dom, mo, dow] = fields.map((f, i) => parseField(f, RANGES[i]));
41
+ const t = new Date(afterIso);
42
+ t.setUTCSeconds(0, 0);
43
+ t.setUTCMinutes(t.getUTCMinutes() + 1);
44
+ for (let i = 0; i < 366 * 24 * 60; i++) {
45
+ if (mo.has(t.getUTCMonth() + 1) &&
46
+ dom.has(t.getUTCDate()) &&
47
+ dow.has(t.getUTCDay()) &&
48
+ ho.has(t.getUTCHours()) &&
49
+ mi.has(t.getUTCMinutes())) {
50
+ return t.toISOString();
51
+ }
52
+ t.setUTCMinutes(t.getUTCMinutes() + 1);
53
+ }
54
+ throw new AgentropyError('SchemaViolation', 'Cron has no occurrence within a year', { details: { reason: 'cron' } });
55
+ }
@@ -0,0 +1,326 @@
1
+ /** Errors v1 (docs/contracts/errors-v1.md). The catalog is data; tests check it against the contract table. */
2
+ export type ErrorCategory = 'validation' | 'authorization' | 'lifecycle' | 'idempotency' | 'capability' | 'transport' | 'limit' | 'human-action' | 'internal';
3
+ export declare const ERROR_CATALOG: {
4
+ readonly SchemaViolation: {
5
+ readonly category: "validation";
6
+ readonly retryable: false;
7
+ };
8
+ readonly InvalidConfiguration: {
9
+ readonly category: "validation";
10
+ readonly retryable: false;
11
+ };
12
+ readonly NotFound: {
13
+ readonly category: "validation";
14
+ readonly retryable: false;
15
+ };
16
+ readonly Unauthenticated: {
17
+ readonly category: "authorization";
18
+ readonly retryable: false;
19
+ };
20
+ readonly PermissionDenied: {
21
+ readonly category: "authorization";
22
+ readonly retryable: false;
23
+ };
24
+ readonly TenantMismatch: {
25
+ readonly category: "authorization";
26
+ readonly retryable: false;
27
+ };
28
+ readonly AuthorityExpired: {
29
+ readonly category: "authorization";
30
+ readonly retryable: false;
31
+ };
32
+ readonly PolicyDecisionUnavailable: {
33
+ readonly category: "authorization";
34
+ readonly retryable: false;
35
+ };
36
+ readonly InvalidState: {
37
+ readonly category: "lifecycle";
38
+ readonly retryable: false;
39
+ };
40
+ readonly StaleRevision: {
41
+ readonly category: "lifecycle";
42
+ readonly retryable: true;
43
+ };
44
+ readonly NotReady: {
45
+ readonly category: "lifecycle";
46
+ readonly retryable: true;
47
+ };
48
+ readonly TaskFailed: {
49
+ readonly category: "lifecycle";
50
+ readonly retryable: false;
51
+ };
52
+ readonly TaskCancelled: {
53
+ readonly category: "lifecycle";
54
+ readonly retryable: false;
55
+ };
56
+ readonly InstanceUnavailable: {
57
+ readonly category: "lifecycle";
58
+ readonly retryable: true;
59
+ };
60
+ readonly IncompatibleVersion: {
61
+ readonly category: "lifecycle";
62
+ readonly retryable: false;
63
+ };
64
+ readonly IdempotencyConflict: {
65
+ readonly category: "idempotency";
66
+ readonly retryable: false;
67
+ };
68
+ readonly CapabilityNotDeclared: {
69
+ readonly category: "capability";
70
+ readonly retryable: false;
71
+ };
72
+ readonly CapabilityUnavailable: {
73
+ readonly category: "capability";
74
+ readonly retryable: false;
75
+ };
76
+ readonly UnsupportedOperation: {
77
+ readonly category: "capability";
78
+ readonly retryable: false;
79
+ };
80
+ readonly GuaranteeUnavailable: {
81
+ readonly category: "capability";
82
+ readonly retryable: false;
83
+ };
84
+ readonly ProviderUnavailable: {
85
+ readonly category: "transport";
86
+ readonly retryable: true;
87
+ };
88
+ readonly Timeout: {
89
+ readonly category: "transport";
90
+ readonly retryable: true;
91
+ };
92
+ readonly UnknownAcceptance: {
93
+ readonly category: "transport";
94
+ readonly retryable: true;
95
+ };
96
+ readonly NoCompatibleRoute: {
97
+ readonly category: "transport";
98
+ readonly retryable: false;
99
+ };
100
+ readonly RemoteUnavailable: {
101
+ readonly category: "transport";
102
+ readonly retryable: true;
103
+ };
104
+ readonly QuotaExceeded: {
105
+ readonly category: "limit";
106
+ readonly retryable: true;
107
+ };
108
+ readonly BudgetExceeded: {
109
+ readonly category: "limit";
110
+ readonly retryable: false;
111
+ };
112
+ readonly DelegationDepthExceeded: {
113
+ readonly category: "limit";
114
+ readonly retryable: false;
115
+ };
116
+ readonly FanOutExceeded: {
117
+ readonly category: "limit";
118
+ readonly retryable: false;
119
+ };
120
+ readonly ActionExpired: {
121
+ readonly category: "human-action";
122
+ readonly retryable: false;
123
+ };
124
+ readonly ActionRevoked: {
125
+ readonly category: "human-action";
126
+ readonly retryable: false;
127
+ };
128
+ readonly ActionConflict: {
129
+ readonly category: "human-action";
130
+ readonly retryable: false;
131
+ };
132
+ readonly NotAssignee: {
133
+ readonly category: "human-action";
134
+ readonly retryable: false;
135
+ };
136
+ readonly Internal: {
137
+ readonly category: "internal";
138
+ readonly retryable: false;
139
+ };
140
+ readonly AuditCommitUnavailable: {
141
+ readonly category: "internal";
142
+ readonly retryable: false;
143
+ };
144
+ };
145
+ export type ErrorCode = keyof typeof ERROR_CATALOG;
146
+ /** Serialized shape on public boundaries. */
147
+ export interface AgentropyErrorShape {
148
+ code: ErrorCode;
149
+ category: ErrorCategory;
150
+ retryable: boolean;
151
+ message: string;
152
+ correlationId?: string;
153
+ details?: Record<string, unknown>;
154
+ }
155
+ /** Remove secret-looking keys and payload-sized values from details before they leave a trust boundary. */
156
+ export declare function redactDetails(details: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
157
+ export declare class AgentropyError extends Error {
158
+ readonly code: ErrorCode;
159
+ readonly category: ErrorCategory;
160
+ readonly retryable: boolean;
161
+ readonly correlationId?: string;
162
+ readonly details?: Record<string, unknown>;
163
+ constructor(code: ErrorCode, message: string, options?: {
164
+ details?: Record<string, unknown>;
165
+ correlationId?: string;
166
+ cause?: unknown;
167
+ });
168
+ /** Public serialization: redacted details, no stack, no cause. */
169
+ toJSON(): AgentropyErrorShape;
170
+ }
171
+ export declare function isAgentropyError(value: unknown, code?: ErrorCode): value is AgentropyError;
172
+ export declare function isErrorCode(value: string): value is ErrorCode;
173
+ /** Maps any thrown value to an AgentropyError; unknown errors become Internal without leaking their message. */
174
+ export declare function toAgentropyError(value: unknown, correlationId?: string): AgentropyError;
175
+ /** Catalog alias kept for the original error-contract branch API. */
176
+ export declare const ERROR_DEFINITIONS: {
177
+ readonly SchemaViolation: {
178
+ readonly category: "validation";
179
+ readonly retryable: false;
180
+ };
181
+ readonly InvalidConfiguration: {
182
+ readonly category: "validation";
183
+ readonly retryable: false;
184
+ };
185
+ readonly NotFound: {
186
+ readonly category: "validation";
187
+ readonly retryable: false;
188
+ };
189
+ readonly Unauthenticated: {
190
+ readonly category: "authorization";
191
+ readonly retryable: false;
192
+ };
193
+ readonly PermissionDenied: {
194
+ readonly category: "authorization";
195
+ readonly retryable: false;
196
+ };
197
+ readonly TenantMismatch: {
198
+ readonly category: "authorization";
199
+ readonly retryable: false;
200
+ };
201
+ readonly AuthorityExpired: {
202
+ readonly category: "authorization";
203
+ readonly retryable: false;
204
+ };
205
+ readonly PolicyDecisionUnavailable: {
206
+ readonly category: "authorization";
207
+ readonly retryable: false;
208
+ };
209
+ readonly InvalidState: {
210
+ readonly category: "lifecycle";
211
+ readonly retryable: false;
212
+ };
213
+ readonly StaleRevision: {
214
+ readonly category: "lifecycle";
215
+ readonly retryable: true;
216
+ };
217
+ readonly NotReady: {
218
+ readonly category: "lifecycle";
219
+ readonly retryable: true;
220
+ };
221
+ readonly TaskFailed: {
222
+ readonly category: "lifecycle";
223
+ readonly retryable: false;
224
+ };
225
+ readonly TaskCancelled: {
226
+ readonly category: "lifecycle";
227
+ readonly retryable: false;
228
+ };
229
+ readonly InstanceUnavailable: {
230
+ readonly category: "lifecycle";
231
+ readonly retryable: true;
232
+ };
233
+ readonly IncompatibleVersion: {
234
+ readonly category: "lifecycle";
235
+ readonly retryable: false;
236
+ };
237
+ readonly IdempotencyConflict: {
238
+ readonly category: "idempotency";
239
+ readonly retryable: false;
240
+ };
241
+ readonly CapabilityNotDeclared: {
242
+ readonly category: "capability";
243
+ readonly retryable: false;
244
+ };
245
+ readonly CapabilityUnavailable: {
246
+ readonly category: "capability";
247
+ readonly retryable: false;
248
+ };
249
+ readonly UnsupportedOperation: {
250
+ readonly category: "capability";
251
+ readonly retryable: false;
252
+ };
253
+ readonly GuaranteeUnavailable: {
254
+ readonly category: "capability";
255
+ readonly retryable: false;
256
+ };
257
+ readonly ProviderUnavailable: {
258
+ readonly category: "transport";
259
+ readonly retryable: true;
260
+ };
261
+ readonly Timeout: {
262
+ readonly category: "transport";
263
+ readonly retryable: true;
264
+ };
265
+ readonly UnknownAcceptance: {
266
+ readonly category: "transport";
267
+ readonly retryable: true;
268
+ };
269
+ readonly NoCompatibleRoute: {
270
+ readonly category: "transport";
271
+ readonly retryable: false;
272
+ };
273
+ readonly RemoteUnavailable: {
274
+ readonly category: "transport";
275
+ readonly retryable: true;
276
+ };
277
+ readonly QuotaExceeded: {
278
+ readonly category: "limit";
279
+ readonly retryable: true;
280
+ };
281
+ readonly BudgetExceeded: {
282
+ readonly category: "limit";
283
+ readonly retryable: false;
284
+ };
285
+ readonly DelegationDepthExceeded: {
286
+ readonly category: "limit";
287
+ readonly retryable: false;
288
+ };
289
+ readonly FanOutExceeded: {
290
+ readonly category: "limit";
291
+ readonly retryable: false;
292
+ };
293
+ readonly ActionExpired: {
294
+ readonly category: "human-action";
295
+ readonly retryable: false;
296
+ };
297
+ readonly ActionRevoked: {
298
+ readonly category: "human-action";
299
+ readonly retryable: false;
300
+ };
301
+ readonly ActionConflict: {
302
+ readonly category: "human-action";
303
+ readonly retryable: false;
304
+ };
305
+ readonly NotAssignee: {
306
+ readonly category: "human-action";
307
+ readonly retryable: false;
308
+ };
309
+ readonly Internal: {
310
+ readonly category: "internal";
311
+ readonly retryable: false;
312
+ };
313
+ readonly AuditCommitUnavailable: {
314
+ readonly category: "internal";
315
+ readonly retryable: false;
316
+ };
317
+ };
318
+ /** Plain serialized error value, as carried across transports. Same shape as `AgentropyErrorShape`. */
319
+ export type AgentropyErrorValue = AgentropyErrorShape;
320
+ /** Never include untrusted input or provider errors in a public error message. */
321
+ export declare function agentropyError(code: ErrorCode, message: string, options?: {
322
+ correlationId?: string;
323
+ details?: Record<string, unknown>;
324
+ }): AgentropyErrorValue;
325
+ /** Validates an error value received from a transport: known code, catalog-consistent category and retryability. */
326
+ export declare function isAgentropyErrorValue(value: unknown): value is AgentropyErrorValue;
package/dist/errors.js ADDED
@@ -0,0 +1,150 @@
1
+ /** Errors v1 (docs/contracts/errors-v1.md). The catalog is data; tests check it against the contract table. */
2
+ export const ERROR_CATALOG = {
3
+ SchemaViolation: { category: 'validation', retryable: false },
4
+ InvalidConfiguration: { category: 'validation', retryable: false },
5
+ NotFound: { category: 'validation', retryable: false },
6
+ Unauthenticated: { category: 'authorization', retryable: false },
7
+ PermissionDenied: { category: 'authorization', retryable: false },
8
+ TenantMismatch: { category: 'authorization', retryable: false },
9
+ AuthorityExpired: { category: 'authorization', retryable: false },
10
+ PolicyDecisionUnavailable: { category: 'authorization', retryable: false },
11
+ InvalidState: { category: 'lifecycle', retryable: false },
12
+ StaleRevision: { category: 'lifecycle', retryable: true },
13
+ NotReady: { category: 'lifecycle', retryable: true },
14
+ TaskFailed: { category: 'lifecycle', retryable: false },
15
+ TaskCancelled: { category: 'lifecycle', retryable: false },
16
+ InstanceUnavailable: { category: 'lifecycle', retryable: true },
17
+ IncompatibleVersion: { category: 'lifecycle', retryable: false },
18
+ IdempotencyConflict: { category: 'idempotency', retryable: false },
19
+ CapabilityNotDeclared: { category: 'capability', retryable: false },
20
+ CapabilityUnavailable: { category: 'capability', retryable: false },
21
+ UnsupportedOperation: { category: 'capability', retryable: false },
22
+ GuaranteeUnavailable: { category: 'capability', retryable: false },
23
+ ProviderUnavailable: { category: 'transport', retryable: true },
24
+ Timeout: { category: 'transport', retryable: true },
25
+ UnknownAcceptance: { category: 'transport', retryable: true },
26
+ NoCompatibleRoute: { category: 'transport', retryable: false },
27
+ RemoteUnavailable: { category: 'transport', retryable: true },
28
+ QuotaExceeded: { category: 'limit', retryable: true },
29
+ BudgetExceeded: { category: 'limit', retryable: false },
30
+ DelegationDepthExceeded: { category: 'limit', retryable: false },
31
+ FanOutExceeded: { category: 'limit', retryable: false },
32
+ ActionExpired: { category: 'human-action', retryable: false },
33
+ ActionRevoked: { category: 'human-action', retryable: false },
34
+ ActionConflict: { category: 'human-action', retryable: false },
35
+ NotAssignee: { category: 'human-action', retryable: false },
36
+ Internal: { category: 'internal', retryable: false },
37
+ AuditCommitUnavailable: { category: 'internal', retryable: false },
38
+ };
39
+ const SECRET_KEY = /(secret|token|password|credential|authorization|apikey|api_key|bearer|cookie)/i;
40
+ /** Remove secret-looking keys and payload-sized values from details before they leave a trust boundary. */
41
+ export function redactDetails(details) {
42
+ if (!details)
43
+ return undefined;
44
+ const out = {};
45
+ for (const [key, value] of Object.entries(details)) {
46
+ if (SECRET_KEY.test(key))
47
+ continue;
48
+ if (value === null ||
49
+ ['string', 'number', 'boolean'].includes(typeof value)) {
50
+ out[key] =
51
+ typeof value === 'string' && value.length > 200
52
+ ? `${value.slice(0, 200)}…`
53
+ : value;
54
+ }
55
+ else if (Array.isArray(value) &&
56
+ value.every((v) => ['string', 'number', 'boolean'].includes(typeof v))) {
57
+ out[key] = value.slice(0, 20);
58
+ }
59
+ // Objects and other values are dropped: they may carry payload data.
60
+ }
61
+ return out;
62
+ }
63
+ export class AgentropyError extends Error {
64
+ code;
65
+ category;
66
+ retryable;
67
+ correlationId;
68
+ details;
69
+ constructor(code, message, options = {}) {
70
+ super(message, options.cause === undefined ? undefined : { cause: options.cause });
71
+ this.name = 'AgentropyError';
72
+ this.code = code;
73
+ this.category = ERROR_CATALOG[code].category;
74
+ this.retryable = ERROR_CATALOG[code].retryable;
75
+ this.correlationId = options.correlationId;
76
+ this.details = options.details;
77
+ }
78
+ /** Public serialization: redacted details, no stack, no cause. */
79
+ toJSON() {
80
+ const shape = {
81
+ code: this.code,
82
+ category: this.category,
83
+ retryable: this.retryable,
84
+ message: this.message,
85
+ };
86
+ if (this.correlationId)
87
+ shape.correlationId = this.correlationId;
88
+ const details = redactDetails(this.details);
89
+ if (details && Object.keys(details).length)
90
+ shape.details = details;
91
+ return shape;
92
+ }
93
+ }
94
+ export function isAgentropyError(value, code) {
95
+ return (value instanceof AgentropyError &&
96
+ (code === undefined || value.code === code));
97
+ }
98
+ export function isErrorCode(value) {
99
+ return Object.prototype.hasOwnProperty.call(ERROR_CATALOG, value);
100
+ }
101
+ /** Maps any thrown value to an AgentropyError; unknown errors become Internal without leaking their message. */
102
+ export function toAgentropyError(value, correlationId) {
103
+ if (value instanceof AgentropyError)
104
+ return value;
105
+ return new AgentropyError('Internal', 'Internal error', {
106
+ correlationId,
107
+ cause: value,
108
+ });
109
+ }
110
+ // --- Wire-level values (merged from feat/core-error-contract) ---------------------------------------------
111
+ /** Catalog alias kept for the original error-contract branch API. */
112
+ export const ERROR_DEFINITIONS = ERROR_CATALOG;
113
+ /** Never include untrusted input or provider errors in a public error message. */
114
+ export function agentropyError(code, message, options = {}) {
115
+ const metadata = ERROR_CATALOG[code];
116
+ const result = {
117
+ code,
118
+ category: metadata.category,
119
+ retryable: metadata.retryable,
120
+ message,
121
+ };
122
+ if (options.correlationId !== undefined)
123
+ result.correlationId = options.correlationId;
124
+ if (options.details !== undefined)
125
+ result.details = options.details;
126
+ return result;
127
+ }
128
+ /** Validates an error value received from a transport: known code, catalog-consistent category and retryability. */
129
+ export function isAgentropyErrorValue(value) {
130
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
131
+ return false;
132
+ const record = value;
133
+ if (typeof record.code !== 'string' || !isErrorCode(record.code))
134
+ return false;
135
+ const metadata = ERROR_CATALOG[record.code];
136
+ if (record.category !== metadata.category ||
137
+ record.retryable !== metadata.retryable)
138
+ return false;
139
+ if (typeof record.message !== 'string')
140
+ return false;
141
+ if (record.correlationId !== undefined &&
142
+ typeof record.correlationId !== 'string')
143
+ return false;
144
+ if (record.details !== undefined &&
145
+ (record.details === null ||
146
+ typeof record.details !== 'object' ||
147
+ Array.isArray(record.details)))
148
+ return false;
149
+ return true;
150
+ }
@@ -0,0 +1,31 @@
1
+ /** Agent Implementation v1 (docs/contracts/agent-implementation-v1.md). */
2
+ import type { Agent, AgentImplementationRef, Version, VersionedRef } from './agent.js';
3
+ export interface ImplementationFeatures {
4
+ checkpointResume: boolean;
5
+ cooperativeCancellation: boolean;
6
+ progressReporting: boolean;
7
+ isolation: 'in-process' | 'process' | 'sandbox';
8
+ remoteAuthority: boolean;
9
+ }
10
+ export interface ImplementationBinding {
11
+ providerId: string;
12
+ providerVersion: Version;
13
+ artifact: VersionedRef;
14
+ artifactDigest?: string;
15
+ features: ImplementationFeatures;
16
+ }
17
+ export interface ImplementationResolveContext {
18
+ tenantId: string;
19
+ signal?: AbortSignal;
20
+ }
21
+ export interface AgentImplementationProvider {
22
+ readonly id: string;
23
+ readonly version: Version;
24
+ readonly features: ImplementationFeatures;
25
+ resolve(ref: AgentImplementationRef, ctx: ImplementationResolveContext): Promise<ImplementationBinding>;
26
+ createAgent(binding: ImplementationBinding): Agent;
27
+ }
28
+ export interface ImplementationProviderRegistry {
29
+ register(provider: AgentImplementationProvider): void;
30
+ get(providerId: string, providerVersion: Version): AgentImplementationProvider;
31
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ /** @agentropy/core — contract types, schemas, error catalog and transition tables. No I/O. */
2
+ export declare const AGENTROPY_CONTRACT_VERSION: "v1";
3
+ export * from './agent.js';
4
+ export * from './capability.js';
5
+ export * from './communication.js';
6
+ export * from './messaging.js';
7
+ export * from './telemetry.js';
8
+ export * from './providers.js';
9
+ export * from './errors.js';
10
+ export * from './implementation.js';
11
+ export * from './lifecycle.js';
12
+ export * from './schemas.js';
13
+ export * from './security.js';
14
+ export * from './skill.js';
15
+ export * from './tool.js';
16
+ export * from './acceptance.js';
17
+ export * from './catalog.js';
18
+ export * from './resolver.js';
19
+ export * from './store.js';
20
+ export * from './cron.js';
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ /** @agentropy/core — contract types, schemas, error catalog and transition tables. No I/O. */
2
+ export const AGENTROPY_CONTRACT_VERSION = 'v1';
3
+ export * from './agent.js';
4
+ export * from './capability.js';
5
+ export * from './communication.js';
6
+ export * from './messaging.js';
7
+ export * from './telemetry.js';
8
+ export * from './providers.js';
9
+ export * from './errors.js';
10
+ export * from './implementation.js';
11
+ export * from './lifecycle.js';
12
+ export * from './schemas.js';
13
+ export * from './security.js';
14
+ export * from './skill.js';
15
+ export * from './tool.js';
16
+ export * from './acceptance.js';
17
+ export * from './catalog.js';
18
+ export * from './resolver.js';
19
+ export * from './store.js';
20
+ export * from './cron.js';
@@ -0,0 +1,26 @@
1
+ export type TaskStatus = 'created' | 'assigned' | 'running' | 'waiting' | 'completed' | 'failed' | 'cancelled';
2
+ export type ExecutionState = 'queued' | 'leased' | 'running' | 'succeeded' | 'yielded' | 'failed' | 'aborted' | 'lost';
3
+ export type InstanceState = 'available' | 'suspended' | 'retired';
4
+ export type HumanActionState = 'pending' | 'claimed' | 'resolved' | 'expired' | 'revoked';
5
+ export interface Transition<S extends string> {
6
+ /** Edge ID from the contract table (e.g. "T4", "E7b"); instance and human-action edges use descriptive IDs. */
7
+ id: string;
8
+ /** `null` is the creation edge. */
9
+ from: S | null;
10
+ to: S;
11
+ trigger: string;
12
+ }
13
+ export interface StateMachine<S extends string> {
14
+ name: 'task' | 'execution' | 'instance' | 'human-action';
15
+ states: readonly S[];
16
+ terminal: readonly S[];
17
+ transitions: readonly Transition<S>[];
18
+ }
19
+ export declare const TASK_MACHINE: StateMachine<TaskStatus>;
20
+ export declare const EXECUTION_MACHINE: StateMachine<ExecutionState>;
21
+ export declare const INSTANCE_MACHINE: StateMachine<InstanceState>;
22
+ export declare const HUMAN_ACTION_MACHINE: StateMachine<HumanActionState>;
23
+ export declare function findTransition<S extends string>(machine: StateMachine<S>, from: S | null, to: S): Transition<S> | undefined;
24
+ /** Returns the edge or throws InvalidState for any edge not listed in the contract table. */
25
+ export declare function assertTransition<S extends string>(machine: StateMachine<S>, from: S | null, to: S, edgeId?: string): Transition<S>;
26
+ export declare function isTerminal<S extends string>(machine: StateMachine<S>, state: S): boolean;