@agentshouse/mdruntime-adapter 0.1.0-cd59fd8945dcb → 0.1.0-cda5b3be3317e
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/AGENTS.md +271 -262
- package/dist/actions.d.ts +23 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +68 -31
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +261 -64
- package/dist/discovery.d.ts +2 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +10 -6
- package/dist/handed.d.ts +15 -0
- package/dist/handed.d.ts.map +1 -0
- package/dist/handed.js +38 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/model.d.ts +0 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -3
- package/dist/read.d.ts +29 -6
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +150 -52
- package/dist/referrer.d.ts +7 -0
- package/dist/referrer.d.ts.map +1 -0
- package/dist/referrer.js +35 -0
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +2 -1
- package/dist/site.d.ts +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +174 -47
- package/dist/stream.d.ts +3 -2
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +325 -16
- package/dist/transport.d.ts +62 -6
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +3 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/write.d.ts +2 -9
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +61 -8
- package/package.json +2 -3
- package/dist/links.d.ts +0 -20
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js +0 -104
package/dist/actions.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export type AppInputs = {
|
|
|
24
24
|
readonly 'conversation.interrupt': ConversationControl;
|
|
25
25
|
readonly 'conversation.kill': ConversationControl;
|
|
26
26
|
readonly 'conversation.send': ConversationControl & {
|
|
27
|
+
readonly operation_id: string;
|
|
27
28
|
readonly text?: string;
|
|
28
29
|
readonly files?: readonly SentFile[];
|
|
29
30
|
};
|
|
@@ -32,11 +33,33 @@ export type AppAnswers = {
|
|
|
32
33
|
readonly 'conversation.history': ConversationHistories;
|
|
33
34
|
};
|
|
34
35
|
export type AppAnswerAdditions = {
|
|
36
|
+
readonly 'conversation.create': {
|
|
37
|
+
readonly conversation: string;
|
|
38
|
+
};
|
|
35
39
|
readonly 'conversation.send': {
|
|
36
40
|
readonly turn: string;
|
|
37
41
|
};
|
|
42
|
+
readonly 'record.list': {
|
|
43
|
+
readonly attachments: readonly {
|
|
44
|
+
readonly referrer: {
|
|
45
|
+
readonly room_ref: string;
|
|
46
|
+
readonly record: string;
|
|
47
|
+
};
|
|
48
|
+
}[];
|
|
49
|
+
readonly records: readonly {
|
|
50
|
+
readonly attachments: readonly {
|
|
51
|
+
readonly referrer: {
|
|
52
|
+
readonly room_ref: string;
|
|
53
|
+
readonly record: string;
|
|
54
|
+
};
|
|
55
|
+
}[];
|
|
56
|
+
}[];
|
|
57
|
+
};
|
|
38
58
|
};
|
|
39
59
|
export declare const HOUSE_APP_ACTS: Readonly<Record<string, string>>;
|
|
60
|
+
export declare const SITE_SUBMIT = "submit";
|
|
61
|
+
export declare const HOUSE_SITE_ACTS: Readonly<Record<string, string>>;
|
|
62
|
+
export declare const HOUSE_APP_BATCHES: Readonly<Partial<Record<string, readonly string[]>>>;
|
|
40
63
|
export declare function houseConversationAgents(locator: string): ConversationAgents;
|
|
41
64
|
export declare function declaredActions(routes: readonly string[]): readonly ActionDeclaration[];
|
|
42
65
|
export declare function houseAction(transport: HouseTransport, request: ActionRequest): Promise<ActionResult>;
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","s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AC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE3D,CAAC;AAEF,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE5D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAKhF,CAAC;AAMJ,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAE3E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,iBAAiB,EAAE,CAMvF;AAED,wBAAgB,WAAW,CACzB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAQvB;AA6ED,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAQjF;AAuKD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAiBtE"}
|
package/dist/actions.js
CHANGED
|
@@ -11,9 +11,10 @@ function mapped(door, input = (given) => given) {
|
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function carried(door, carry) {
|
|
14
|
+
function carried(door, carry, batched) {
|
|
15
15
|
return {
|
|
16
16
|
door,
|
|
17
|
+
...(batched === undefined ? {} : { batched }),
|
|
17
18
|
carry: (transport, input, name) => carry(transport, `/door/${door}`, input, name),
|
|
18
19
|
};
|
|
19
20
|
}
|
|
@@ -22,11 +23,12 @@ const APP_ACTS = {
|
|
|
22
23
|
'conversation.answer': mapped('conversations/interaction/answer', answerBody),
|
|
23
24
|
'conversation.create': carried('conversations/create', createAction),
|
|
24
25
|
'conversation.delete': mapped('conversations/delete', controlBody),
|
|
25
|
-
'conversation.history': carried('conversations/history', historyAction),
|
|
26
|
+
'conversation.history': carried('conversations/history', historyAction, ['conversations']),
|
|
26
27
|
'conversation.interrupt': mapped('conversations/interrupt', controlBody),
|
|
27
28
|
'conversation.kill': mapped('conversations/kill', controlBody),
|
|
28
29
|
'conversation.markDone': mapped('conversations/done'),
|
|
29
30
|
'conversation.rename': mapped('conversations/rename'),
|
|
31
|
+
'conversation.retry': mapped('conversations/retry'),
|
|
30
32
|
'conversation.send': carried('conversations/send', sendAction),
|
|
31
33
|
'conversation.setOption': mapped('conversations/option'),
|
|
32
34
|
'feature.list': mapped('apps/features/read'),
|
|
@@ -35,7 +37,7 @@ const APP_ACTS = {
|
|
|
35
37
|
'member.list': mapped('rooms/members'),
|
|
36
38
|
'message.send': mapped('apps/messages/send'),
|
|
37
39
|
'processing.read': mapped('rooms/settings/processing/read'),
|
|
38
|
-
'record.list':
|
|
40
|
+
'record.list': carried('records/read', recordsAction),
|
|
39
41
|
'relay.read': mapped('apps/relay'),
|
|
40
42
|
'routine.list': mapped('routines/access'),
|
|
41
43
|
'routineAccess.list': mapped('routines/granted'),
|
|
@@ -46,6 +48,11 @@ const APP_ACTS = {
|
|
|
46
48
|
'triggerOccurrence.list': mapped('triggers/fired'),
|
|
47
49
|
};
|
|
48
50
|
export const HOUSE_APP_ACTS = Object.fromEntries(Object.entries(APP_ACTS).map(([name, act]) => [name, act.door]));
|
|
51
|
+
export const SITE_SUBMIT = 'submit';
|
|
52
|
+
export const HOUSE_SITE_ACTS = {
|
|
53
|
+
[SITE_SUBMIT]: 'site/submission',
|
|
54
|
+
};
|
|
55
|
+
export const HOUSE_APP_BATCHES = Object.fromEntries(Object.entries(APP_ACTS).flatMap(([name, act]) => act.batched === undefined ? [] : [[name, act.batched]]));
|
|
49
56
|
const APP_NAMES = new Map(Object.entries(APP_ACTS).map(([name, act]) => [act.door, name]));
|
|
50
57
|
export function houseConversationAgents(locator) {
|
|
51
58
|
return { locator, type: 'house-agent', identity: 'agent', name: 'name', retired: 'retired' };
|
|
@@ -116,7 +123,12 @@ async function createAction(transport, route, input, name) {
|
|
|
116
123
|
return outcome;
|
|
117
124
|
const held = record(outcome.result);
|
|
118
125
|
const conversation = text(held, 'conversation_id');
|
|
119
|
-
return conversation === undefined
|
|
126
|
+
return conversation === undefined
|
|
127
|
+
? outcome
|
|
128
|
+
: {
|
|
129
|
+
...outcome,
|
|
130
|
+
result: { ...held, conversation },
|
|
131
|
+
};
|
|
120
132
|
}
|
|
121
133
|
function withTurn(body) {
|
|
122
134
|
const held = record(body);
|
|
@@ -129,6 +141,8 @@ export function actionOutcome(answer, name) {
|
|
|
129
141
|
if (answer.status === 401)
|
|
130
142
|
return { kind: 'revoked-authorization' };
|
|
131
143
|
const refusal = doorRefusal(answer.body);
|
|
144
|
+
if (refusal?.code === 'operation_contended')
|
|
145
|
+
return { kind: 'transport-uncertainty' };
|
|
132
146
|
if (refusal !== null)
|
|
133
147
|
return { kind: 'rejected', ...refusal };
|
|
134
148
|
if (answer.status === 404)
|
|
@@ -137,6 +151,32 @@ export function actionOutcome(answer, name) {
|
|
|
137
151
|
return { kind: 'transport-uncertainty' };
|
|
138
152
|
return { kind: 'action', result: answer.body };
|
|
139
153
|
}
|
|
154
|
+
function referredRecord(view, roomRef) {
|
|
155
|
+
const held = record(view);
|
|
156
|
+
if (roomRef === undefined || typeof held.record !== 'string' || !Array.isArray(held.attachments))
|
|
157
|
+
return view;
|
|
158
|
+
const referrer = {
|
|
159
|
+
room_ref: roomRef,
|
|
160
|
+
record: held.record,
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
...held,
|
|
164
|
+
attachments: held.attachments.map((attachment) => ({ ...record(attachment), referrer })),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
async function recordsAction(transport, route, input, name) {
|
|
168
|
+
const outcome = actionOutcome(await transport.door(route, input), name);
|
|
169
|
+
if (outcome.kind !== 'action')
|
|
170
|
+
return outcome;
|
|
171
|
+
const roomRef = text(input, 'room_ref');
|
|
172
|
+
const read = record(outcome.result);
|
|
173
|
+
return {
|
|
174
|
+
...outcome,
|
|
175
|
+
result: Array.isArray(read.records)
|
|
176
|
+
? { ...read, records: read.records.map((view) => referredRecord(view, roomRef)) }
|
|
177
|
+
: referredRecord(outcome.result, roomRef),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
140
180
|
async function carry(transport, route, name, input) {
|
|
141
181
|
return actionOutcome(await transport.door(route, input), name);
|
|
142
182
|
}
|
|
@@ -177,12 +217,13 @@ function sendFiles(input) {
|
|
|
177
217
|
}
|
|
178
218
|
function sendBody(input) {
|
|
179
219
|
const files = sendFiles(input);
|
|
180
|
-
|
|
220
|
+
const operation = text(input, 'operation_id');
|
|
221
|
+
if (files === null || operation === undefined)
|
|
181
222
|
return null;
|
|
182
223
|
const textValue = text(input, 'text');
|
|
183
224
|
return {
|
|
184
225
|
conversation_id: text(input, 'conversation'),
|
|
185
|
-
operation_id:
|
|
226
|
+
operation_id: operation,
|
|
186
227
|
...(textValue !== undefined && textValue.length > 0 ? { text: textValue } : {}),
|
|
187
228
|
...(files.length === 0 ? {} : { files }),
|
|
188
229
|
};
|
|
@@ -195,9 +236,6 @@ async function fileBytes(file) {
|
|
|
195
236
|
return null;
|
|
196
237
|
return new Uint8Array(await blob.arrayBuffer());
|
|
197
238
|
}
|
|
198
|
-
function delivered(answer, name) {
|
|
199
|
-
return answer.status === 200 ? null : actionOutcome(answer, name);
|
|
200
|
-
}
|
|
201
239
|
function uploadGrant(entry) {
|
|
202
240
|
if (!('upload' in record(entry)))
|
|
203
241
|
return 'absent';
|
|
@@ -208,36 +246,28 @@ function uploadGrant(entry) {
|
|
|
208
246
|
return null;
|
|
209
247
|
return { method: 'POST', operation: upload.operation, url: upload.url };
|
|
210
248
|
}
|
|
211
|
-
async function uploadFiles(transport, input, result
|
|
249
|
+
async function uploadFiles(transport, input, result) {
|
|
212
250
|
const sent = record(result).files;
|
|
213
|
-
if (!Array.isArray(sent)
|
|
214
|
-
return
|
|
251
|
+
if (!Array.isArray(sent))
|
|
252
|
+
return true;
|
|
215
253
|
const files = Array.isArray(record(input).files) ? record(input).files : [];
|
|
216
254
|
for (const [index, entry] of sent.entries()) {
|
|
217
255
|
const grant = uploadGrant(entry);
|
|
218
256
|
if (grant === 'absent')
|
|
219
257
|
continue;
|
|
220
|
-
if (grant === null)
|
|
221
|
-
return malformed();
|
|
222
258
|
const bytes = index < files.length ? await fileBytes(files[index]) : null;
|
|
223
|
-
if (bytes === null)
|
|
224
|
-
return
|
|
225
|
-
|
|
226
|
-
code: 'conversation_file_descriptor_required',
|
|
227
|
-
fields: {},
|
|
228
|
-
retryable: false,
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
const failed = delivered(await transport.transfer({
|
|
259
|
+
if (grant === null || bytes === null)
|
|
260
|
+
return false;
|
|
261
|
+
const answer = await transport.transfer({
|
|
232
262
|
act: 'conversation_file_upload',
|
|
233
263
|
url: grant.url,
|
|
234
264
|
body: bytes,
|
|
235
265
|
operation: grant.operation,
|
|
236
|
-
})
|
|
237
|
-
if (
|
|
238
|
-
return
|
|
266
|
+
});
|
|
267
|
+
if (answer.status !== 200)
|
|
268
|
+
return false;
|
|
239
269
|
}
|
|
240
|
-
return
|
|
270
|
+
return true;
|
|
241
271
|
}
|
|
242
272
|
async function sendAction(transport, route, input, name) {
|
|
243
273
|
const body = sendBody(input);
|
|
@@ -246,9 +276,9 @@ async function sendAction(transport, route, input, name) {
|
|
|
246
276
|
const outcome = actionOutcome(await transport.door(route, body), name);
|
|
247
277
|
if (outcome.kind !== 'action')
|
|
248
278
|
return outcome;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
279
|
+
if (!(await uploadFiles(transport, input, outcome.result))) {
|
|
280
|
+
return { kind: 'transport-uncertainty' };
|
|
281
|
+
}
|
|
252
282
|
return { ...outcome, result: withTurn(outcome.result) };
|
|
253
283
|
}
|
|
254
284
|
function historyCursor(value) {
|
|
@@ -273,12 +303,19 @@ export function acceptedMessage(entry) {
|
|
|
273
303
|
const cursor = historyCursor(entry);
|
|
274
304
|
if (cursor === null)
|
|
275
305
|
return null;
|
|
306
|
+
const message = structuredClone(record(entry));
|
|
307
|
+
const referrer = { message: cursor.message_id };
|
|
276
308
|
return {
|
|
277
309
|
identity: cursor.message_id,
|
|
278
310
|
turn: text(entry, 'turn_id') ?? cursor.message_id,
|
|
279
311
|
position: position(cursor),
|
|
280
312
|
text: text(entry, 'text') ?? '',
|
|
281
|
-
message:
|
|
313
|
+
message: Array.isArray(message.files)
|
|
314
|
+
? {
|
|
315
|
+
...message,
|
|
316
|
+
files: message.files.map((file) => ({ ...record(file), referrer })),
|
|
317
|
+
}
|
|
318
|
+
: message,
|
|
282
319
|
};
|
|
283
320
|
}
|
|
284
321
|
function historyPage(entry) {
|
package/dist/adapter.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type AgentsHouseAdapterOptions = {
|
|
|
5
5
|
authorize(): Promise<Authorization>;
|
|
6
6
|
} | {
|
|
7
7
|
site: HouseSiteTransport;
|
|
8
|
+
snapshot?: boolean;
|
|
8
9
|
};
|
|
9
10
|
export declare function createAgentsHouseAdapter(options: AgentsHouseAdapterOptions): Adapter;
|
|
10
11
|
//# sourceMappingURL=adapter.d.ts.map
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,OAAO,EACP,aAAa,EAmBd,MAAM,wBAAwB,CAAC;AA4ChC,OAAO,EASL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAyBxB,MAAM,MAAM,yBAAyB,GACjC;IACE,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,GACD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAsErD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAsjBpF"}
|