@autumn-dev/autumn-bus 0.1.0-next.2
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 +201 -0
- package/README.md +60 -0
- package/dist/client.d.ts +48 -0
- package/dist/client.js +173 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +26 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +141 -0
- package/dist/protocol.js +2 -0
- package/dist/protocol.js.map +1 -0
- package/dist/session.d.ts +46 -0
- package/dist/session.js +176 -0
- package/dist/session.js.map +1 -0
- package/package.json +73 -0
- package/src/client.ts +255 -0
- package/src/errors.ts +38 -0
- package/src/index.ts +4 -0
- package/src/protocol.ts +161 -0
- package/src/session.ts +216 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export declare const AUTUMN_BUS_PROTOCOL_VERSION: '0.1';
|
|
2
|
+
export type ScopeId = string;
|
|
3
|
+
export type AgentId = string;
|
|
4
|
+
export type ExecutionId = string;
|
|
5
|
+
export type MessageId = string;
|
|
6
|
+
export type TaskId = string;
|
|
7
|
+
export type AgentLifecycle = 'starting' | 'ready' | 'working' | 'idle' | 'needs_input' | 'offline';
|
|
8
|
+
export type MessageMode = 'notify' | 'request' | 'response';
|
|
9
|
+
export type DeliveryState = 'queued' | 'reserved' | 'delivered' | 'acknowledged' | 'expired';
|
|
10
|
+
export type TaskStatus = 'open' | 'claimed' | 'done';
|
|
11
|
+
export type EscalationStatus = 'pending' | 'resolved';
|
|
12
|
+
export interface AgentCapability {
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AgentIdentity {
|
|
17
|
+
scopeId: ScopeId;
|
|
18
|
+
agentId: AgentId;
|
|
19
|
+
executionId: ExecutionId;
|
|
20
|
+
}
|
|
21
|
+
export interface Agent {
|
|
22
|
+
id: AgentId;
|
|
23
|
+
displayName: string;
|
|
24
|
+
capabilities: AgentCapability[];
|
|
25
|
+
lifecycle: AgentLifecycle;
|
|
26
|
+
ready: boolean;
|
|
27
|
+
reachable: boolean;
|
|
28
|
+
executionId: ExecutionId;
|
|
29
|
+
registeredAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ContextItem {
|
|
33
|
+
kind: 'text' | 'file' | 'url' | 'reference';
|
|
34
|
+
title: string;
|
|
35
|
+
text?: string;
|
|
36
|
+
uri?: string;
|
|
37
|
+
mediaType?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface BusMessage {
|
|
40
|
+
id: MessageId;
|
|
41
|
+
scopeId: ScopeId;
|
|
42
|
+
from: AgentId;
|
|
43
|
+
to: AgentId;
|
|
44
|
+
mode: MessageMode;
|
|
45
|
+
body: string;
|
|
46
|
+
context: ContextItem[];
|
|
47
|
+
responseTo?: MessageId;
|
|
48
|
+
state: DeliveryState;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
expiresAt?: string;
|
|
51
|
+
deliveredAt?: string;
|
|
52
|
+
acknowledgedAt?: string;
|
|
53
|
+
repliedAt?: string;
|
|
54
|
+
responseMessageId?: MessageId;
|
|
55
|
+
}
|
|
56
|
+
export interface DeliveryReceipt {
|
|
57
|
+
messageId: MessageId;
|
|
58
|
+
state: DeliveryState;
|
|
59
|
+
acceptedAt: string;
|
|
60
|
+
deliveredAt?: string;
|
|
61
|
+
acknowledgedAt?: string;
|
|
62
|
+
repliedAt?: string;
|
|
63
|
+
responseMessageId?: MessageId;
|
|
64
|
+
}
|
|
65
|
+
export interface InboxReservation {
|
|
66
|
+
id: string;
|
|
67
|
+
expiresAt: string;
|
|
68
|
+
messages: BusMessage[];
|
|
69
|
+
}
|
|
70
|
+
export interface BusTask {
|
|
71
|
+
id: TaskId;
|
|
72
|
+
scopeId: ScopeId;
|
|
73
|
+
description: string;
|
|
74
|
+
createdBy: AgentId;
|
|
75
|
+
claimedBy?: AgentId;
|
|
76
|
+
status: TaskStatus;
|
|
77
|
+
dependencies: TaskId[];
|
|
78
|
+
note?: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
updatedAt: string;
|
|
81
|
+
}
|
|
82
|
+
export interface HumanEscalation {
|
|
83
|
+
id: string;
|
|
84
|
+
scopeId: ScopeId;
|
|
85
|
+
agentId: AgentId;
|
|
86
|
+
question: string;
|
|
87
|
+
options: string[];
|
|
88
|
+
status: EscalationStatus;
|
|
89
|
+
answer?: string;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
resolvedAt?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface CreateScopeInput {
|
|
94
|
+
id?: ScopeId;
|
|
95
|
+
}
|
|
96
|
+
export interface CreateScopeResult {
|
|
97
|
+
scopeId: ScopeId;
|
|
98
|
+
scopeToken: string;
|
|
99
|
+
}
|
|
100
|
+
export interface RegisterAgentInput {
|
|
101
|
+
id?: AgentId;
|
|
102
|
+
displayName: string;
|
|
103
|
+
capabilities?: AgentCapability[];
|
|
104
|
+
connectTo?: AgentId[];
|
|
105
|
+
leaseMs?: number;
|
|
106
|
+
}
|
|
107
|
+
export interface RegisterAgentResult extends AgentIdentity {
|
|
108
|
+
agentToken: string;
|
|
109
|
+
leaseExpiresAt: string;
|
|
110
|
+
}
|
|
111
|
+
export interface SendMessageInput {
|
|
112
|
+
to: AgentId;
|
|
113
|
+
body: string;
|
|
114
|
+
mode?: MessageMode;
|
|
115
|
+
responseTo?: MessageId;
|
|
116
|
+
idempotencyKey?: string;
|
|
117
|
+
expiresInMs?: number;
|
|
118
|
+
context?: ContextItem[];
|
|
119
|
+
}
|
|
120
|
+
export interface AddTaskInput {
|
|
121
|
+
description: string;
|
|
122
|
+
dependencies?: TaskId[];
|
|
123
|
+
}
|
|
124
|
+
export interface AskHumanInput {
|
|
125
|
+
question: string;
|
|
126
|
+
options?: string[];
|
|
127
|
+
}
|
|
128
|
+
export interface BusRunFile {
|
|
129
|
+
protocolVersion: string;
|
|
130
|
+
address: string;
|
|
131
|
+
pid: number;
|
|
132
|
+
startedAt: string;
|
|
133
|
+
adminToken: string;
|
|
134
|
+
}
|
|
135
|
+
export interface BusHealth {
|
|
136
|
+
name: 'autumn-bus';
|
|
137
|
+
protocolVersion: string;
|
|
138
|
+
runtimeVersion: string;
|
|
139
|
+
status: 'ready';
|
|
140
|
+
startedAt: string;
|
|
141
|
+
}
|
package/dist/protocol.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAc,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AutumnBusClient } from './client.js';
|
|
2
|
+
import type { Agent, AgentLifecycle, BusMessage, BusTask, RegisterAgentInput, RegisterAgentResult } from './protocol.js';
|
|
3
|
+
export interface AgentSessionOptions {
|
|
4
|
+
address: string;
|
|
5
|
+
scopeToken: string;
|
|
6
|
+
registration: RegisterAgentInput;
|
|
7
|
+
heartbeatIntervalMs?: number;
|
|
8
|
+
initialLifecycle?: AgentLifecycle;
|
|
9
|
+
initialReady?: boolean;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export interface InboxPollingOptions {
|
|
13
|
+
limit?: number;
|
|
14
|
+
intervalMs?: number;
|
|
15
|
+
maxIntervalMs?: number;
|
|
16
|
+
backoffFactor?: number;
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
}
|
|
19
|
+
export interface ClaimedTaskResult<T> {
|
|
20
|
+
task: BusTask;
|
|
21
|
+
value: T;
|
|
22
|
+
}
|
|
23
|
+
export declare function requiredEnvironmentValue(environment: Readonly<Record<string, string | undefined>>, name: string): string;
|
|
24
|
+
export declare function newIdempotencyKey(): string;
|
|
25
|
+
export declare class AutumnBusAgentSession {
|
|
26
|
+
readonly client: AutumnBusClient;
|
|
27
|
+
readonly registration: RegisterAgentResult;
|
|
28
|
+
readonly done: Promise<void>;
|
|
29
|
+
private readonly leaseMs;
|
|
30
|
+
private readonly heartbeatIntervalMs;
|
|
31
|
+
private lifecycle;
|
|
32
|
+
private ready;
|
|
33
|
+
private timer;
|
|
34
|
+
private pendingHeartbeat;
|
|
35
|
+
private resolveDone;
|
|
36
|
+
private closed;
|
|
37
|
+
private sessionError;
|
|
38
|
+
private constructor();
|
|
39
|
+
static start(options: AgentSessionOptions): Promise<AutumnBusAgentSession>;
|
|
40
|
+
get error(): unknown;
|
|
41
|
+
setState(lifecycle: AgentLifecycle, ready: boolean): Promise<Agent>;
|
|
42
|
+
close(): Promise<void>;
|
|
43
|
+
private scheduleHeartbeat;
|
|
44
|
+
}
|
|
45
|
+
export declare function pollInbox(client: AutumnBusClient, options?: InboxPollingOptions): AsyncGenerator<BusMessage[]>;
|
|
46
|
+
export declare function withClaimedTask<T>(client: AutumnBusClient, taskId: string, work: (task: BusTask) => Promise<T>, completionNote?: (value: T) => string | undefined): Promise<ClaimedTaskResult<T>>;
|
package/dist/session.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { AutumnBusClient, AutumnBusScopeClient } from './client.js';
|
|
2
|
+
function delay(milliseconds, signal) {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
if (signal?.aborted) {
|
|
5
|
+
reject(signal.reason ?? new Error('Operation aborted'));
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const onAbort = () => {
|
|
9
|
+
clearTimeout(timer);
|
|
10
|
+
reject(signal?.reason ?? new Error('Operation aborted'));
|
|
11
|
+
};
|
|
12
|
+
const timer = setTimeout(() => {
|
|
13
|
+
signal?.removeEventListener('abort', onAbort);
|
|
14
|
+
resolve();
|
|
15
|
+
}, milliseconds);
|
|
16
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export function requiredEnvironmentValue(environment, name) {
|
|
20
|
+
const value = environment[name];
|
|
21
|
+
if (!value)
|
|
22
|
+
throw new Error(`${name} is required`);
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
export function newIdempotencyKey() {
|
|
26
|
+
return crypto.randomUUID();
|
|
27
|
+
}
|
|
28
|
+
export class AutumnBusAgentSession {
|
|
29
|
+
client;
|
|
30
|
+
registration;
|
|
31
|
+
done;
|
|
32
|
+
leaseMs;
|
|
33
|
+
heartbeatIntervalMs;
|
|
34
|
+
lifecycle;
|
|
35
|
+
ready;
|
|
36
|
+
timer;
|
|
37
|
+
pendingHeartbeat;
|
|
38
|
+
resolveDone;
|
|
39
|
+
closed = false;
|
|
40
|
+
sessionError;
|
|
41
|
+
constructor(options, registration) {
|
|
42
|
+
this.registration = registration;
|
|
43
|
+
this.client = new AutumnBusClient(options.address, registration.agentToken);
|
|
44
|
+
this.leaseMs = options.registration.leaseMs || 300_000;
|
|
45
|
+
this.heartbeatIntervalMs = options.heartbeatIntervalMs ?? Math.floor(this.leaseMs / 3);
|
|
46
|
+
this.lifecycle = options.initialLifecycle ?? 'starting';
|
|
47
|
+
this.ready = options.initialReady ?? false;
|
|
48
|
+
this.done = new Promise((resolve) => {
|
|
49
|
+
this.resolveDone = resolve;
|
|
50
|
+
});
|
|
51
|
+
options.signal?.addEventListener('abort', () => void this.close(), { once: true });
|
|
52
|
+
}
|
|
53
|
+
static async start(options) {
|
|
54
|
+
if (options.signal?.aborted) {
|
|
55
|
+
throw options.signal.reason ?? new Error('Operation aborted');
|
|
56
|
+
}
|
|
57
|
+
const leaseMs = options.registration.leaseMs || 300_000;
|
|
58
|
+
const interval = options.heartbeatIntervalMs ?? Math.floor(leaseMs / 3);
|
|
59
|
+
const lifecycle = options.initialLifecycle ?? 'starting';
|
|
60
|
+
const ready = options.initialReady ?? false;
|
|
61
|
+
if (interval <= 0 || interval >= leaseMs) {
|
|
62
|
+
throw new Error('heartbeatIntervalMs must be shorter than the execution lease');
|
|
63
|
+
}
|
|
64
|
+
if (lifecycle === 'offline' && ready) {
|
|
65
|
+
throw new Error('offline agents cannot be ready');
|
|
66
|
+
}
|
|
67
|
+
const scope = new AutumnBusScopeClient(options.address, options.scopeToken);
|
|
68
|
+
const registration = await scope.registerAgent({ ...options.registration, leaseMs });
|
|
69
|
+
if (options.signal?.aborted) {
|
|
70
|
+
const client = new AutumnBusClient(options.address, registration.agentToken);
|
|
71
|
+
try {
|
|
72
|
+
await client.heartbeat('offline', false, leaseMs);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// The lease remains the cleanup fallback if the execution was replaced.
|
|
76
|
+
}
|
|
77
|
+
throw options.signal.reason ?? new Error('Operation aborted');
|
|
78
|
+
}
|
|
79
|
+
const session = new AutumnBusAgentSession(options, registration);
|
|
80
|
+
await session.client.heartbeat(session.lifecycle, session.ready, session.leaseMs);
|
|
81
|
+
session.scheduleHeartbeat();
|
|
82
|
+
return session;
|
|
83
|
+
}
|
|
84
|
+
get error() {
|
|
85
|
+
return this.sessionError;
|
|
86
|
+
}
|
|
87
|
+
async setState(lifecycle, ready) {
|
|
88
|
+
if (this.closed)
|
|
89
|
+
throw new Error('agent session is closed');
|
|
90
|
+
if (lifecycle === 'offline' && ready)
|
|
91
|
+
throw new Error('offline agents cannot be ready');
|
|
92
|
+
this.lifecycle = lifecycle;
|
|
93
|
+
this.ready = ready;
|
|
94
|
+
return this.client.heartbeat(lifecycle, ready, this.leaseMs);
|
|
95
|
+
}
|
|
96
|
+
async close() {
|
|
97
|
+
if (this.closed)
|
|
98
|
+
return;
|
|
99
|
+
this.closed = true;
|
|
100
|
+
if (this.timer !== undefined)
|
|
101
|
+
clearTimeout(this.timer);
|
|
102
|
+
try {
|
|
103
|
+
await this.pendingHeartbeat;
|
|
104
|
+
await this.client.heartbeat('offline', false, this.leaseMs);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
if (this.sessionError === undefined)
|
|
108
|
+
this.sessionError = error;
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
this.resolveDone();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
scheduleHeartbeat() {
|
|
115
|
+
if (this.closed)
|
|
116
|
+
return;
|
|
117
|
+
this.timer = setTimeout(() => {
|
|
118
|
+
this.pendingHeartbeat = this.client.heartbeat(this.lifecycle, this.ready, this.leaseMs);
|
|
119
|
+
void this.pendingHeartbeat.then(() => {
|
|
120
|
+
this.pendingHeartbeat = undefined;
|
|
121
|
+
this.scheduleHeartbeat();
|
|
122
|
+
}, (error) => {
|
|
123
|
+
this.pendingHeartbeat = undefined;
|
|
124
|
+
this.sessionError = error;
|
|
125
|
+
this.closed = true;
|
|
126
|
+
this.resolveDone();
|
|
127
|
+
});
|
|
128
|
+
}, this.heartbeatIntervalMs);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
export async function* pollInbox(client, options = {}) {
|
|
132
|
+
const limit = options.limit ?? 50;
|
|
133
|
+
const intervalMs = options.intervalMs ?? 1_000;
|
|
134
|
+
const maxIntervalMs = options.maxIntervalMs ?? 10_000;
|
|
135
|
+
const backoffFactor = options.backoffFactor ?? 1.5;
|
|
136
|
+
if (limit < 1 || limit > 100)
|
|
137
|
+
throw new Error('limit must be between 1 and 100');
|
|
138
|
+
if (intervalMs < 1)
|
|
139
|
+
throw new Error('intervalMs must be positive');
|
|
140
|
+
if (maxIntervalMs < intervalMs)
|
|
141
|
+
throw new Error('maxIntervalMs must not be shorter than intervalMs');
|
|
142
|
+
if (backoffFactor < 1 || !Number.isFinite(backoffFactor)) {
|
|
143
|
+
throw new Error('backoffFactor must be a finite number of at least 1');
|
|
144
|
+
}
|
|
145
|
+
let nextIntervalMs = intervalMs;
|
|
146
|
+
while (!options.signal?.aborted) {
|
|
147
|
+
const messages = await client.pullInbox(limit, options.signal ? { signal: options.signal } : undefined);
|
|
148
|
+
if (messages.length > 0) {
|
|
149
|
+
nextIntervalMs = intervalMs;
|
|
150
|
+
yield messages;
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
nextIntervalMs = Math.min(maxIntervalMs, Math.ceil(nextIntervalMs * backoffFactor));
|
|
154
|
+
}
|
|
155
|
+
if (!options.signal?.aborted)
|
|
156
|
+
await delay(nextIntervalMs, options.signal);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
export async function withClaimedTask(client, taskId, work, completionNote) {
|
|
160
|
+
const claimed = await client.claimTask(taskId);
|
|
161
|
+
try {
|
|
162
|
+
const value = await work(claimed);
|
|
163
|
+
const task = await client.completeTask(taskId, completionNote?.(value));
|
|
164
|
+
return { task, value };
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
try {
|
|
168
|
+
await client.releaseTask(taskId);
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
// Preserve the work error. Lease recovery remains the final fallback.
|
|
172
|
+
}
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAiCnE,SAAS,KAAK,CAAC,YAAoB,EAAE,MAAoB;IACvD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAA;YACvD,OAAM;QACR,CAAC;QACD,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,YAAY,CAAC,KAAK,CAAC,CAAA;YACnB,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAA;QAC1D,CAAC,CAA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,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,cAAc,GAAG,UAAU,CAAA;YAC3B,MAAM,QAAQ,CAAA;QAChB,CAAC;aAAM,CAAC;YACN,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC,CAAC,CAAA;QACrF,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO;YAAE,MAAM,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IAC3E,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAuB,EACvB,MAAc,EACd,IAAmC,EACnC,cAAiD;IAEjD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IAC9C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,CAAA;QACjC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;QACvE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,sEAAsE;QACxE,CAAC;QACD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@autumn-dev/autumn-bus",
|
|
3
|
+
"version": "0.1.0-next.2",
|
|
4
|
+
"description": "TypeScript client for Autumn Bus.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"author": "Autumn",
|
|
9
|
+
"homepage": "https://github.com/Adi103-ETAI/autumn-bus#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/Adi103-ETAI/autumn-bus.git",
|
|
13
|
+
"directory": "sdk/typescript"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/Adi103-ETAI/autumn-bus/issues"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=20.0.0"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"ai-agents",
|
|
23
|
+
"agent-communication",
|
|
24
|
+
"coordination",
|
|
25
|
+
"mcp",
|
|
26
|
+
"multi-agent"
|
|
27
|
+
],
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./client": {
|
|
36
|
+
"types": "./dist/client.d.ts",
|
|
37
|
+
"import": "./dist/client.js"
|
|
38
|
+
},
|
|
39
|
+
"./protocol": {
|
|
40
|
+
"types": "./dist/protocol.d.ts",
|
|
41
|
+
"import": "./dist/protocol.js"
|
|
42
|
+
},
|
|
43
|
+
"./session": {
|
|
44
|
+
"types": "./dist/session.d.ts",
|
|
45
|
+
"import": "./dist/session.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist/*.js",
|
|
50
|
+
"dist/*.js.map",
|
|
51
|
+
"dist/*.d.ts",
|
|
52
|
+
"src/*.ts",
|
|
53
|
+
"LICENSE",
|
|
54
|
+
"README.md"
|
|
55
|
+
],
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public",
|
|
58
|
+
"provenance": true,
|
|
59
|
+
"registry": "https://registry.npmjs.org/",
|
|
60
|
+
"tag": "next"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsc -p tsconfig.json",
|
|
64
|
+
"prepack": "npm run build",
|
|
65
|
+
"prepublishOnly": "npm run typecheck && npm run build && npm run test:errors",
|
|
66
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
67
|
+
"test:errors": "node test/errors.mjs",
|
|
68
|
+
"test:integration": "node test/integration.mjs"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"typescript": "^7.0.2"
|
|
72
|
+
}
|
|
73
|
+
}
|