@agent-relay/agent 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.
- package/dist/burn.d.ts +10 -0
- package/dist/burn.d.ts.map +1 -0
- package/dist/burn.js +139 -0
- package/dist/burn.js.map +1 -0
- package/dist/context.d.ts +28 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +170 -0
- package/dist/context.js.map +1 -0
- package/dist/deploy.d.ts +6 -0
- package/dist/deploy.d.ts.map +1 -0
- package/dist/deploy.js +209 -0
- package/dist/deploy.js.map +1 -0
- package/dist/dispatcher.d.ts +20 -0
- package/dist/dispatcher.d.ts.map +1 -0
- package/dist/dispatcher.js +101 -0
- package/dist/dispatcher.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +606 -0
- package/dist/index.js.map +1 -0
- package/dist/policy.d.ts +13 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +152 -0
- package/dist/policy.js.map +1 -0
- package/dist/types.d.ts +387 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +42 -0
package/dist/policy.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export function createPolicyGate(options) {
|
|
2
|
+
return {
|
|
3
|
+
run: async (actionType, action, execute) => {
|
|
4
|
+
if (!options.policy) {
|
|
5
|
+
return await execute();
|
|
6
|
+
}
|
|
7
|
+
const mode = resolveActionMode(options.policy, actionType);
|
|
8
|
+
const id = globalThis.crypto.randomUUID();
|
|
9
|
+
const timestamp = new Date().toISOString();
|
|
10
|
+
if (mode === 'suggest') {
|
|
11
|
+
const suggestion = buildSuggestion(options, id, timestamp, actionType, action);
|
|
12
|
+
await writeAuditLog(options, suggestion.id, {
|
|
13
|
+
id: suggestion.id,
|
|
14
|
+
decision: suggestion.decision,
|
|
15
|
+
actionType,
|
|
16
|
+
workspace: options.workspace,
|
|
17
|
+
agentId: options.agentId,
|
|
18
|
+
createdAt: timestamp,
|
|
19
|
+
action,
|
|
20
|
+
});
|
|
21
|
+
return suggestion;
|
|
22
|
+
}
|
|
23
|
+
if (mode === 'approval-required') {
|
|
24
|
+
if (typeof options.awaitApproval !== 'function') {
|
|
25
|
+
throw new Error('policy approval flow is unavailable without a gateway approval coordinator');
|
|
26
|
+
}
|
|
27
|
+
await safeRelayfileWrite(options.relayfile, `/pending-approvals/${id}.json`, {
|
|
28
|
+
id,
|
|
29
|
+
workspace: options.workspace,
|
|
30
|
+
agentId: options.agentId,
|
|
31
|
+
actionType,
|
|
32
|
+
createdAt: timestamp,
|
|
33
|
+
action,
|
|
34
|
+
});
|
|
35
|
+
const verdict = normalizeApprovalVerdict(id, await options.awaitApproval(id));
|
|
36
|
+
try {
|
|
37
|
+
await writeAuditLog(options, id, {
|
|
38
|
+
id,
|
|
39
|
+
decision: verdict.verdict === 'approved' ? 'approved' : 'rejected',
|
|
40
|
+
actionType,
|
|
41
|
+
workspace: options.workspace,
|
|
42
|
+
agentId: options.agentId,
|
|
43
|
+
createdAt: timestamp,
|
|
44
|
+
approval: verdict.raw,
|
|
45
|
+
action,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
await safeRelayfileDelete(options.relayfile, `/pending-approvals/${id}.json`);
|
|
50
|
+
}
|
|
51
|
+
if (verdict.verdict !== 'approved') {
|
|
52
|
+
throw new Error(verdict.reason?.trim()
|
|
53
|
+
? `policy approval rejected: ${verdict.reason.trim()}`
|
|
54
|
+
: `policy approval rejected for ${actionType}`);
|
|
55
|
+
}
|
|
56
|
+
return await execute();
|
|
57
|
+
}
|
|
58
|
+
await writeAuditLog(options, id, {
|
|
59
|
+
id,
|
|
60
|
+
decision: 'auto',
|
|
61
|
+
actionType,
|
|
62
|
+
workspace: options.workspace,
|
|
63
|
+
agentId: options.agentId,
|
|
64
|
+
createdAt: timestamp,
|
|
65
|
+
action,
|
|
66
|
+
});
|
|
67
|
+
return await execute();
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function resolveActionMode(policy, actionType) {
|
|
72
|
+
const mode = policy?.mode ?? 'auto';
|
|
73
|
+
if (policy?.approvals?.includes(actionType)) {
|
|
74
|
+
return 'approval-required';
|
|
75
|
+
}
|
|
76
|
+
return mode;
|
|
77
|
+
}
|
|
78
|
+
function buildSuggestion(options, id, createdAt, actionType, action) {
|
|
79
|
+
return {
|
|
80
|
+
id,
|
|
81
|
+
decision: 'suggested',
|
|
82
|
+
actionType,
|
|
83
|
+
workspace: options.workspace,
|
|
84
|
+
agentId: options.agentId,
|
|
85
|
+
createdAt,
|
|
86
|
+
action,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
async function writeAuditLog(options, id, payload) {
|
|
90
|
+
await safeRelayfileWrite(options.relayfile, `/_policy-log/${options.workspace}/${id}.json`, payload);
|
|
91
|
+
}
|
|
92
|
+
async function safeRelayfileWrite(relayfile, path, body) {
|
|
93
|
+
try {
|
|
94
|
+
await relayfile.write(path, body);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
if (isUnavailableRelayfileError(error)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async function safeRelayfileDelete(relayfile, path) {
|
|
104
|
+
try {
|
|
105
|
+
await relayfile.delete(path);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
if (isUnavailableRelayfileError(error)) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function isUnavailableRelayfileError(error) {
|
|
115
|
+
return error instanceof Error && error.message === 'relayfile control plane is not ready yet';
|
|
116
|
+
}
|
|
117
|
+
function normalizeApprovalVerdict(id, value) {
|
|
118
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
119
|
+
throw new Error(`approval ${id} returned an invalid verdict payload`);
|
|
120
|
+
}
|
|
121
|
+
const record = value;
|
|
122
|
+
const verdict = normalizeVerdict(record);
|
|
123
|
+
if (!verdict) {
|
|
124
|
+
throw new Error(`approval ${id} is missing a supported verdict`);
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
id,
|
|
128
|
+
verdict,
|
|
129
|
+
approvedBy: typeof record.approvedBy === 'string' ? record.approvedBy : undefined,
|
|
130
|
+
reason: typeof record.reason === 'string' ? record.reason : undefined,
|
|
131
|
+
raw: record,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function normalizeVerdict(record) {
|
|
135
|
+
if (typeof record.verdict === 'string') {
|
|
136
|
+
const normalized = record.verdict.trim().toLowerCase();
|
|
137
|
+
if (normalized === 'approved' || normalized === 'approve') {
|
|
138
|
+
return 'approved';
|
|
139
|
+
}
|
|
140
|
+
if (normalized === 'rejected' ||
|
|
141
|
+
normalized === 'reject' ||
|
|
142
|
+
normalized === 'denied' ||
|
|
143
|
+
normalized === 'deny') {
|
|
144
|
+
return 'rejected';
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (typeof record.approved === 'boolean') {
|
|
148
|
+
return record.approved ? 'approved' : 'rejected';
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,gBAAgB,CAAC,OAA0B;IACzD,OAAO;QACL,GAAG,EAAE,KAAK,EACR,UAA4B,EAC5B,MAA+B,EAC/B,OAAyB,EACM,EAAE;YACjC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBACpB,OAAO,MAAM,OAAO,EAAE,CAAC;YACzB,CAAC;YAED,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,C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AAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import type { AgentEvent, LogFields, LogLevel, Logger, StructuredLogEntry } from '@agent-relay/events';
|
|
2
|
+
/**
|
|
3
|
+
* Cron or one-shot trigger definition accepted by `agent()`.
|
|
4
|
+
*/
|
|
5
|
+
export type ScheduleSpec = string | {
|
|
6
|
+
cron: string;
|
|
7
|
+
tz?: string;
|
|
8
|
+
} | {
|
|
9
|
+
at: string | Date;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Hosted-agent approval policy modes parsed from agent definitions.
|
|
13
|
+
*/
|
|
14
|
+
export type AgentPolicyMode = 'suggest' | 'auto' | 'approval-required';
|
|
15
|
+
export type PolicyActionType = 'external-message' | 'write' | 'delete' | 'schedule';
|
|
16
|
+
/**
|
|
17
|
+
* Action policy definition enforced by the agent context helpers.
|
|
18
|
+
*/
|
|
19
|
+
export interface AgentPolicy {
|
|
20
|
+
/** Approval mode to associate with the agent. */
|
|
21
|
+
mode: AgentPolicyMode;
|
|
22
|
+
/** Action classes that should require explicit approval before execution. */
|
|
23
|
+
approvals?: PolicyActionType[];
|
|
24
|
+
}
|
|
25
|
+
export interface AgentProviderConfig {
|
|
26
|
+
/** Whether hosted execution should use Relay-managed credentials or BYOK. */
|
|
27
|
+
mode: 'managed' | 'byok';
|
|
28
|
+
/** Secret reference used when `mode === "byok"`. */
|
|
29
|
+
secretRef?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Replay bootstrap options reserved for M2 file triggers.
|
|
33
|
+
*/
|
|
34
|
+
export type ReplayOnStart = 'none' | `last:${number}` | `since:${string}`;
|
|
35
|
+
/**
|
|
36
|
+
* Missed-tick policy for downtime recovery.
|
|
37
|
+
*/
|
|
38
|
+
export type CoalesceMissedTicksMode = 'drop' | 'fire-once';
|
|
39
|
+
/**
|
|
40
|
+
* Runtime tuning options for the layered agent SDK.
|
|
41
|
+
*/
|
|
42
|
+
export interface AgentOptions {
|
|
43
|
+
/** Optional API key override. Falls back to `RELAY_API_KEY`. */
|
|
44
|
+
apiKey?: string;
|
|
45
|
+
/** Optional event gateway websocket URL. */
|
|
46
|
+
gatewayUrl?: string;
|
|
47
|
+
/** Optional direct relayfile base URL for local/offline helper calls. */
|
|
48
|
+
relayfileUrl?: string;
|
|
49
|
+
/** Optional direct relaycast base URL for local/offline helper calls. */
|
|
50
|
+
relaycastUrl?: string;
|
|
51
|
+
/** Deprecated HTTP scheduler base URL kept for compatibility with legacy tests. */
|
|
52
|
+
relaycronBaseUrl?: string;
|
|
53
|
+
/** Maximum number of concurrent handlers for the workspace. */
|
|
54
|
+
concurrency?: number;
|
|
55
|
+
/** Maximum queued backlog before the remote runtime should start dropping events. */
|
|
56
|
+
maxBacklog?: number;
|
|
57
|
+
/** Graceful shutdown drain timeout in milliseconds. Defaults to `30000`. */
|
|
58
|
+
drainMs?: number;
|
|
59
|
+
/** Per-handler timeout in milliseconds. Defaults to `300000`. */
|
|
60
|
+
handlerTimeoutMs?: number;
|
|
61
|
+
/** Whether SIGTERM and SIGINT should call `handle.stop()`. */
|
|
62
|
+
handleSignals?: boolean;
|
|
63
|
+
/** Replay bootstrap mode reserved for M2. `since:` values must be ISO-8601 timestamps. */
|
|
64
|
+
replayOnStart?: ReplayOnStart;
|
|
65
|
+
/** Default watch-event coalescing window in milliseconds. Defaults to `200`. */
|
|
66
|
+
coalesceMs?: number;
|
|
67
|
+
/** Missed-tick coalescing mode reserved for gateway enforcement. */
|
|
68
|
+
coalesceMissedTicks?: CoalesceMissedTicksMode;
|
|
69
|
+
/** Minimum structured log level emitted by `ctx.logger`. Defaults to `info`. */
|
|
70
|
+
logLevel?: LogLevel;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Workspace file materialized through the gateway relayfile proxy.
|
|
74
|
+
*/
|
|
75
|
+
export interface WorkspaceFile {
|
|
76
|
+
/** Workspace-relative or absolute path for the file. */
|
|
77
|
+
path: string;
|
|
78
|
+
/** Parsed file body when available. */
|
|
79
|
+
body: unknown;
|
|
80
|
+
/** Optional relayfile revision returned by the backend. */
|
|
81
|
+
revision?: string;
|
|
82
|
+
/** Optional content-type metadata. */
|
|
83
|
+
contentType?: string;
|
|
84
|
+
/** Optional text/binary encoding marker. */
|
|
85
|
+
encoding?: 'utf-8' | 'base64';
|
|
86
|
+
/** Optional relayfile semantics payload. */
|
|
87
|
+
semantics?: Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Optional write metadata forwarded to the relayfile proxy.
|
|
91
|
+
*/
|
|
92
|
+
export interface WriteMeta {
|
|
93
|
+
/** Optional content-type override. */
|
|
94
|
+
contentType?: string;
|
|
95
|
+
/** Optional text/binary encoding marker. */
|
|
96
|
+
encoding?: 'utf-8' | 'base64';
|
|
97
|
+
/** Optional relayfile semantics payload. */
|
|
98
|
+
semantics?: Record<string, unknown>;
|
|
99
|
+
/** Optional compare-and-swap base revision. */
|
|
100
|
+
baseRevision?: string;
|
|
101
|
+
/** Optional idempotency identity forwarded to relayfile. */
|
|
102
|
+
contentIdentity?: {
|
|
103
|
+
kind: string;
|
|
104
|
+
key: string;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* File list entry returned by the relayfile proxy.
|
|
109
|
+
*/
|
|
110
|
+
export interface FileSummary {
|
|
111
|
+
/** File path. */
|
|
112
|
+
path: string;
|
|
113
|
+
/** Optional node type. */
|
|
114
|
+
type?: 'file' | 'dir';
|
|
115
|
+
/** Optional relayfile revision. */
|
|
116
|
+
revision?: string;
|
|
117
|
+
/** Optional provider namespace. */
|
|
118
|
+
provider?: string;
|
|
119
|
+
/** Optional provider object id. */
|
|
120
|
+
providerObjectId?: string;
|
|
121
|
+
/** Optional size in bytes. */
|
|
122
|
+
size?: number;
|
|
123
|
+
/** Optional update timestamp. */
|
|
124
|
+
updatedAt?: string;
|
|
125
|
+
/** Optional projected property count. */
|
|
126
|
+
propertyCount?: number;
|
|
127
|
+
/** Optional projected relation count. */
|
|
128
|
+
relationCount?: number;
|
|
129
|
+
/** Optional projected permission count. */
|
|
130
|
+
permissionCount?: number;
|
|
131
|
+
/** Optional projected comment count. */
|
|
132
|
+
commentCount?: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Outbound relaycast message options.
|
|
136
|
+
*/
|
|
137
|
+
export interface PostOpts {
|
|
138
|
+
/** Optional application-level idempotency key. */
|
|
139
|
+
idempotencyKey?: string;
|
|
140
|
+
}
|
|
141
|
+
export type PolicyDecision = 'auto' | 'suggested' | 'approved' | 'rejected';
|
|
142
|
+
export interface PolicySuggestion {
|
|
143
|
+
/** Stable policy event id used for audit and approval artifacts. */
|
|
144
|
+
id: string;
|
|
145
|
+
/** Decision produced by the policy gate. */
|
|
146
|
+
decision: 'suggested';
|
|
147
|
+
/** Action class evaluated by the gate. */
|
|
148
|
+
actionType: PolicyActionType;
|
|
149
|
+
/** Workspace associated with the action. */
|
|
150
|
+
workspace: string;
|
|
151
|
+
/** Agent associated with the action. */
|
|
152
|
+
agentId: string;
|
|
153
|
+
/** ISO timestamp when the suggestion was created. */
|
|
154
|
+
createdAt: string;
|
|
155
|
+
/** Structured action payload. */
|
|
156
|
+
action: Record<string, unknown>;
|
|
157
|
+
}
|
|
158
|
+
export interface ApprovalVerdictRecord {
|
|
159
|
+
/** Stable approval id matching `/pending-approvals/<id>.json`. */
|
|
160
|
+
id: string;
|
|
161
|
+
/** Human verdict value. */
|
|
162
|
+
verdict: 'approved' | 'rejected';
|
|
163
|
+
/** Optional approver metadata. */
|
|
164
|
+
approvedBy?: string;
|
|
165
|
+
/** Optional decision rationale. */
|
|
166
|
+
reason?: string;
|
|
167
|
+
/** Full raw payload written by the approver. */
|
|
168
|
+
raw: Record<string, unknown>;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Raw relayfile client surface exposed through `ctx.raw`.
|
|
172
|
+
*/
|
|
173
|
+
export interface RelayfileClient {
|
|
174
|
+
/** Whether the runtime has a live relayfile binding behind this client. */
|
|
175
|
+
available?: boolean;
|
|
176
|
+
/** Reads a workspace file. */
|
|
177
|
+
read(path: string): Promise<WorkspaceFile | null>;
|
|
178
|
+
/** Writes a workspace file. */
|
|
179
|
+
write(path: string, body: unknown, meta?: WriteMeta): Promise<void>;
|
|
180
|
+
/** Deletes a workspace file. */
|
|
181
|
+
delete(path: string): Promise<void>;
|
|
182
|
+
/** Lists files matching a glob. */
|
|
183
|
+
list(glob: string): Promise<FileSummary[]>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Raw relaycast client surface exposed through `ctx.raw`.
|
|
187
|
+
*/
|
|
188
|
+
export interface RelaycastClient {
|
|
189
|
+
/** Whether the runtime has a live relaycast binding behind this client. */
|
|
190
|
+
available?: boolean;
|
|
191
|
+
/** Posts a message to a channel. */
|
|
192
|
+
post(channel: string, text: string, opts?: PostOpts): Promise<{
|
|
193
|
+
id: string;
|
|
194
|
+
} | PolicySuggestion>;
|
|
195
|
+
/** Replies to a thread. */
|
|
196
|
+
reply(threadId: string, text: string, opts?: PostOpts): Promise<{
|
|
197
|
+
id: string;
|
|
198
|
+
} | PolicySuggestion>;
|
|
199
|
+
/** Sends a direct message. */
|
|
200
|
+
dm(agentOrUser: string, text: string, opts?: PostOpts): Promise<{
|
|
201
|
+
id: string;
|
|
202
|
+
} | PolicySuggestion>;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Raw relaycron schedule registration payload.
|
|
206
|
+
*/
|
|
207
|
+
export interface RelaycronScheduleDefinition {
|
|
208
|
+
/** Cron expression for a recurring schedule. */
|
|
209
|
+
cron?: string;
|
|
210
|
+
/** ISO timestamp or `Date` for a one-shot schedule. */
|
|
211
|
+
at?: string | Date;
|
|
212
|
+
/** Optional timezone for recurring schedules. */
|
|
213
|
+
tz?: string;
|
|
214
|
+
/** Optional payload to associate with the schedule. */
|
|
215
|
+
payload?: unknown;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Schedule handle returned by the M1 relaycron wrapper.
|
|
219
|
+
*/
|
|
220
|
+
export interface RelaycronScheduleHandle {
|
|
221
|
+
/** Stable schedule identifier. */
|
|
222
|
+
id: string;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Raw relaycron client surface exposed through `ctx.raw`.
|
|
226
|
+
*/
|
|
227
|
+
export interface RelaycronClient {
|
|
228
|
+
/** Whether the runtime has a live relaycron binding behind this client. */
|
|
229
|
+
available?: boolean;
|
|
230
|
+
/** Registers a recurring or one-shot schedule. */
|
|
231
|
+
register(definition: RelaycronScheduleDefinition): Promise<RelaycronScheduleHandle>;
|
|
232
|
+
/** Cancels a schedule by id. */
|
|
233
|
+
cancel(id: string): Promise<void>;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Runtime context delivered to agent event handlers.
|
|
237
|
+
*/
|
|
238
|
+
export interface Context {
|
|
239
|
+
/** Workspace associated with the running agent. */
|
|
240
|
+
workspace: string;
|
|
241
|
+
/** Stable runtime agent identifier. */
|
|
242
|
+
agentId: string;
|
|
243
|
+
/** Structured logger surface. */
|
|
244
|
+
logger: Logger;
|
|
245
|
+
/** Handler-scoped abort signal for timeout and shutdown propagation. */
|
|
246
|
+
signal: AbortSignal;
|
|
247
|
+
/** Applies burn tagging to a fetch function or compatible LLM client. */
|
|
248
|
+
tagged<T>(value: T): T;
|
|
249
|
+
/** Relayfile helpers backed by the runtime gateway. */
|
|
250
|
+
files: {
|
|
251
|
+
/** Reads a workspace file. */
|
|
252
|
+
read(path: string): Promise<WorkspaceFile | null>;
|
|
253
|
+
/** Writes a workspace file. */
|
|
254
|
+
write(path: string, body: unknown, meta?: WriteMeta): Promise<void | PolicySuggestion>;
|
|
255
|
+
/** Deletes a workspace file. */
|
|
256
|
+
delete(path: string): Promise<void | PolicySuggestion>;
|
|
257
|
+
/** Lists matching files. */
|
|
258
|
+
list(glob: string): Promise<FileSummary[]>;
|
|
259
|
+
};
|
|
260
|
+
/** Relaycast helpers. */
|
|
261
|
+
messages: {
|
|
262
|
+
/** Posts a message to a channel. */
|
|
263
|
+
post(channel: string, text: string, opts?: PostOpts): Promise<{
|
|
264
|
+
id: string;
|
|
265
|
+
} | PolicySuggestion>;
|
|
266
|
+
/** Replies to an existing thread. */
|
|
267
|
+
reply(threadId: string, text: string, opts?: PostOpts): Promise<{
|
|
268
|
+
id: string;
|
|
269
|
+
} | PolicySuggestion>;
|
|
270
|
+
/** Sends a direct message to an agent or user. */
|
|
271
|
+
dm(agentOrUser: string, text: string, opts?: PostOpts): Promise<{
|
|
272
|
+
id: string;
|
|
273
|
+
} | PolicySuggestion>;
|
|
274
|
+
};
|
|
275
|
+
/** Relaycron helpers available in M1. */
|
|
276
|
+
schedule: {
|
|
277
|
+
/** Creates a one-shot wakeup. */
|
|
278
|
+
at(when: string | Date, payload?: unknown): Promise<{
|
|
279
|
+
id: string;
|
|
280
|
+
} | PolicySuggestion>;
|
|
281
|
+
/** Creates a recurring cron trigger. */
|
|
282
|
+
every(cron: string, payload?: unknown, opts?: {
|
|
283
|
+
tz?: string;
|
|
284
|
+
}): Promise<{
|
|
285
|
+
id: string;
|
|
286
|
+
} | PolicySuggestion>;
|
|
287
|
+
/** Cancels a previously created schedule. */
|
|
288
|
+
cancel(id: string): Promise<void | PolicySuggestion>;
|
|
289
|
+
};
|
|
290
|
+
/** Underlying raw primitive clients. */
|
|
291
|
+
raw: {
|
|
292
|
+
relayfile: RelayfileClient;
|
|
293
|
+
relaycron: RelaycronClient;
|
|
294
|
+
relaycast: RelaycastClient;
|
|
295
|
+
};
|
|
296
|
+
/** Application-level idempotency helper for non-event side effects. */
|
|
297
|
+
once<T>(key: string, fn: () => Promise<T>): Promise<T>;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Declarative agent definition for the layered SDK.
|
|
301
|
+
*/
|
|
302
|
+
export interface AgentDefinition {
|
|
303
|
+
/** Unified workspace name across runtime primitives. */
|
|
304
|
+
workspace: string;
|
|
305
|
+
/** Optional human-readable agent name. Defaults to the workspace. */
|
|
306
|
+
name?: string;
|
|
307
|
+
/** Optional time triggers. */
|
|
308
|
+
schedule?: ScheduleSpec | ScheduleSpec[];
|
|
309
|
+
/** Optional relayfile watch globs. */
|
|
310
|
+
watch?: string | string[];
|
|
311
|
+
/** Optional relaycast inbox subscriptions. */
|
|
312
|
+
inbox?: string | string[];
|
|
313
|
+
/** Single event handler for all normalized event types. */
|
|
314
|
+
onEvent: (ctx: Context, event: AgentEvent) => Promise<void> | void;
|
|
315
|
+
/** Optional startup hook invoked once the runtime is registered. */
|
|
316
|
+
onStart?: (ctx: Context) => Promise<void> | void;
|
|
317
|
+
/** Optional shutdown hook invoked during `handle.stop()`. */
|
|
318
|
+
onStop?: (ctx: Context) => Promise<void> | void;
|
|
319
|
+
/** Optional error hook for final delivery failures. */
|
|
320
|
+
onError?: (ctx: Context, error: Error, event: AgentEvent) => Promise<void> | void;
|
|
321
|
+
/** Action policy metadata enforced by the runtime helpers. */
|
|
322
|
+
policy?: AgentPolicy;
|
|
323
|
+
/** Hosted runtime model/provider configuration. */
|
|
324
|
+
provider?: AgentProviderConfig;
|
|
325
|
+
/** Runtime tuning options. */
|
|
326
|
+
options?: AgentOptions;
|
|
327
|
+
}
|
|
328
|
+
export type HostedAgentHandler = (ctx: Context, event: AgentEvent) => Promise<void> | void;
|
|
329
|
+
/**
|
|
330
|
+
* Declarative hosted-agent definition accepted by `deployAgent(...)`.
|
|
331
|
+
*/
|
|
332
|
+
export interface HostedAgentDefinition {
|
|
333
|
+
/** Unified workspace name across runtime primitives. */
|
|
334
|
+
workspace: string;
|
|
335
|
+
/** Human-readable deployment name. */
|
|
336
|
+
name: string;
|
|
337
|
+
/** Hosted default runtime model identifier. */
|
|
338
|
+
model: string;
|
|
339
|
+
/** Hosted default runtime system instructions. */
|
|
340
|
+
instructions: string;
|
|
341
|
+
/** Optional time triggers. */
|
|
342
|
+
schedule?: ScheduleSpec | ScheduleSpec[];
|
|
343
|
+
/** Optional relayfile watch globs. */
|
|
344
|
+
watch?: string | string[];
|
|
345
|
+
/** Optional relaycast inbox subscriptions. */
|
|
346
|
+
inbox?: string | string[];
|
|
347
|
+
/** Optional custom runtime override for the managed sandbox. */
|
|
348
|
+
onEvent?: HostedAgentHandler;
|
|
349
|
+
/** Optional action policy metadata enforced by the runtime helpers. */
|
|
350
|
+
policy?: AgentPolicy;
|
|
351
|
+
/** Hosted runtime provider configuration. */
|
|
352
|
+
provider: AgentProviderConfig;
|
|
353
|
+
}
|
|
354
|
+
export interface HostedAgentStatus {
|
|
355
|
+
/** Stable runtime agent identifier. */
|
|
356
|
+
agentId: string;
|
|
357
|
+
/** Stable deployment identifier. */
|
|
358
|
+
deployId: string;
|
|
359
|
+
/** Current deployment state as reported by the control plane. */
|
|
360
|
+
state: string;
|
|
361
|
+
[key: string]: unknown;
|
|
362
|
+
}
|
|
363
|
+
export interface DeployHandle {
|
|
364
|
+
/** Stable runtime agent identifier. */
|
|
365
|
+
agentId: string;
|
|
366
|
+
/** Stable deployment identifier. */
|
|
367
|
+
deployId: string;
|
|
368
|
+
/** Reads the current control-plane deployment status. */
|
|
369
|
+
status(): Promise<HostedAgentStatus>;
|
|
370
|
+
/** Tears down the hosted deployment. */
|
|
371
|
+
undeploy(): Promise<void>;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Handle returned by `agent(...)`.
|
|
375
|
+
*/
|
|
376
|
+
export interface AgentHandle {
|
|
377
|
+
/** Resolves once the agent is registered and ready to receive events. */
|
|
378
|
+
ready: Promise<void>;
|
|
379
|
+
/** Stops the event stream, drains in-flight work, and tears down lifecycle hooks. */
|
|
380
|
+
stop(): Promise<void>;
|
|
381
|
+
/** Imperatively injects an event into the local dispatcher. */
|
|
382
|
+
trigger(event: Partial<AgentEvent>): Promise<void>;
|
|
383
|
+
/** Shared agent context outside an event scope. */
|
|
384
|
+
ctx: Context;
|
|
385
|
+
}
|
|
386
|
+
export type { LogFields, LogLevel, Logger, StructuredLogEntry };
|
|
387
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEvG;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAE1F;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,mBAAmB,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iDAAiD;IACjD,IAAI,EAAE,eAAe,CAAC;IACtB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IACzB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,WAAW,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,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CAAC;IAC7B,uEAAuE;IACvE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,6CAA6C;IAC7C,QAAQ,EAAE,mBAAmB,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,MAAM,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrC,wCAAwC;IACxC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,yEAAyE;IACzE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,qFAAqF;IACrF,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,+DAA+D;IAC/D,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,mDAAmD;IACnD,GAAG,EAAE,OAAO,CAAC;CACd;AAED,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agent-relay/agent",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"clean": "rm -rf dist",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@agent-relay/events": "^0.1.0",
|
|
23
|
+
"@relaycast/sdk": "1.1.2",
|
|
24
|
+
"@relayfile/sdk": "^0.7.2"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^25.5.0",
|
|
28
|
+
"typescript": "^5.7.0"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/AgentWorkforce/relay.git",
|
|
33
|
+
"directory": "packages/agent-relay-agent"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md"
|
|
41
|
+
]
|
|
42
|
+
}
|