@agentshouse/mdruntime-adapter 0.1.0-alpha.1 → 0.1.0-alpha.3
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 +78 -0
- package/dist/actions.d.ts +16 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +454 -0
- package/dist/actions.js.map +1 -0
- package/dist/adapter.d.ts +8 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +341 -0
- package/dist/adapter.js.map +1 -0
- package/dist/digest.d.ts +3 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +11 -0
- package/dist/digest.js.map +1 -0
- package/dist/discovery.d.ts +60 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +242 -0
- package/dist/discovery.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/map.d.ts +3 -0
- package/dist/map.d.ts.map +1 -0
- package/dist/map.js +15 -0
- package/dist/map.js.map +1 -0
- package/dist/read.d.ts +67 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +244 -0
- package/dist/read.js.map +1 -0
- package/dist/refusal.d.ts +8 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +65 -0
- package/dist/refusal.js.map +1 -0
- package/dist/stream.d.ts +10 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +239 -0
- package/dist/stream.js.map +1 -0
- package/dist/transport.d.ts +77 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +9 -0
- package/dist/transport.js.map +1 -0
- package/dist/write.d.ts +41 -0
- package/dist/write.d.ts.map +1 -0
- package/dist/write.js +377 -0
- package/dist/write.js.map +1 -0
- package/package.json +7 -2
package/AGENTS.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Instructions for the App Creator's agent
|
|
2
|
+
|
|
3
|
+
These instructions address an agent in an environment with Git. Obtain the
|
|
4
|
+
App Repository, change it, build, and push. They are documentation, not
|
|
5
|
+
enforcement.
|
|
6
|
+
|
|
7
|
+
## The MD Runtime API
|
|
8
|
+
|
|
9
|
+
App code reaches the MD Runtime through the remote client. The surfaces are
|
|
10
|
+
Rooms, Query, Observe, Types, Draft, Save, Queue, History, Call, Log,
|
|
11
|
+
storage loss, the reported persistence answer, Sync Status, reauthorization,
|
|
12
|
+
conversation, the unsent instruction, and Presentation State.
|
|
13
|
+
|
|
14
|
+
Rooms, Query, Observe, Types, Draft, and Save never touch the network.
|
|
15
|
+
History and Call go to the Provider through the Adapter. Every member of the
|
|
16
|
+
client is asynchronous. Results are detached snapshots. Nothing in this
|
|
17
|
+
surface returns the authorization, performs a request the App's code
|
|
18
|
+
composes, or exposes the browser store.
|
|
19
|
+
|
|
20
|
+
The in-memory Adapter at `@agentshouse/mdruntime/memory` is for tests and
|
|
21
|
+
ships in no bundle.
|
|
22
|
+
|
|
23
|
+
## Draft, Save, and outcome rules
|
|
24
|
+
|
|
25
|
+
A Draft is durable: it survives reload and navigation. Save takes structured
|
|
26
|
+
changes, validates locally, and on success appends one Change Batch to that
|
|
27
|
+
Room's queue. A local validation failure leaves the Draft and creates
|
|
28
|
+
nothing.
|
|
29
|
+
|
|
30
|
+
Outcomes follow the Provider's answer. Accepted advances the confirmed
|
|
31
|
+
layer. Conflicted and Rejected leave the head in place, carry the affected
|
|
32
|
+
current state and the Provider's structured refusal code and fields as
|
|
33
|
+
returned, and block that Room's queue. The App's code resolves a head by
|
|
34
|
+
discarding it or by saving a corrected Change Batch that replaces it in
|
|
35
|
+
place. Transport failure and Provider unavailability keep work Pending and
|
|
36
|
+
do not infer a rejection. A refusal the Provider marks retryable stays
|
|
37
|
+
Pending until the reset it names; the MD Runtime retries the same Change
|
|
38
|
+
Batch identity and payload and never infers an outcome from transport
|
|
39
|
+
uncertainty. The MD Runtime never combines, reorders, or rebases.
|
|
40
|
+
|
|
41
|
+
## The neutrality rule
|
|
42
|
+
|
|
43
|
+
No module outside an Adapter package imports, names, or special-cases a
|
|
44
|
+
Provider. MD UI and every App reach data only through the client entry.
|
|
45
|
+
|
|
46
|
+
## Content-safety rules
|
|
47
|
+
|
|
48
|
+
The Provider authorization belongs to the Runtime host and is never readable
|
|
49
|
+
by the App's code. The App's code reaches the network only at the external
|
|
50
|
+
origins its manifest declares, empty by default, and the Provider enforces
|
|
51
|
+
that set. Every request to the Provider itself goes through the MD Runtime.
|
|
52
|
+
Rendered Markdown never executes scripts, renders raw HTML only for the
|
|
53
|
+
details and summary elements, and loads images and other resources only from
|
|
54
|
+
origins the Provider's policy allows.
|
|
55
|
+
|
|
56
|
+
## Launch promises MD UI keeps
|
|
57
|
+
|
|
58
|
+
MD UI uses semantic HTML, is fully operable from a keyboard with visible
|
|
59
|
+
focus and labelled controls, and lays out from a 360 pixel wide viewport to
|
|
60
|
+
a desktop. Its strings are English only, dates and numbers follow the
|
|
61
|
+
browser locale, and content is never translated. Light and dark themes come
|
|
62
|
+
from CSS custom properties with the browser's preference as the default and
|
|
63
|
+
an App's override respected. What an App Creator's agent adds carries none
|
|
64
|
+
of these promises by itself. Reading and querying never wait for the
|
|
65
|
+
network. Data lives only in the App Creator's browser and with the Provider.
|
|
66
|
+
|
|
67
|
+
## App code imports only the client entry and never constructs a Runtime
|
|
68
|
+
|
|
69
|
+
App code imports only `@agentshouse/mdruntime/client` and calls
|
|
70
|
+
`connectMdRuntime` on the port the host hands it. It never constructs a
|
|
71
|
+
Runtime. It does not import the package main, the host entry, or the Adapter
|
|
72
|
+
package, and it does not call `createMdRuntime` or `serveMdRuntime`. Hosts
|
|
73
|
+
and tests use those entries; the served App does not.
|
|
74
|
+
|
|
75
|
+
## What an agent must never do
|
|
76
|
+
|
|
77
|
+
An agent must never read the authorization, load code from a Room, call the
|
|
78
|
+
Provider directly, or rebase a refused Change Batch.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ActionDeclaration, type ActionRequest, type ActionResult, type ConversationCards } from '@agentshouse/mdruntime';
|
|
2
|
+
import type { HouseDoorAnswer, HouseTransport } from './transport.js';
|
|
3
|
+
export declare const CONVERSATION_ACTIONS: readonly ['conversation.create', 'conversation.send', 'conversation.answer', 'conversation.interrupt', 'conversation.kill', 'conversation.cancel', 'conversation.delete', 'conversation.history'];
|
|
4
|
+
export declare const HOUSE_ACTS: readonly ['conversations/interaction/read', 'conversations/originals/read', 'apps/read', 'apps/customize', 'rooms/read', 'rooms/access/read', 'rooms/access/invitations', 'rooms/access/entries', 'rooms/access/invite', 'rooms/access/invitation-cancel', 'rooms/access/revoke', 'rooms/access/leave', 'rooms/roles/define', 'rooms/roles/remove', 'rooms/roles/assign', 'rooms/roles/unassign', 'rooms/settings/processing/read', 'rooms/settings/processing/write', 'profiles/create', 'profiles/read', 'profiles/edit', 'profiles/duplicate', 'profiles/delegate', 'agents/create', 'agents/read', 'routines/requests', 'routines/access', 'routines/owned', 'routines/granted', 'routines/grant', 'routines/send', 'routines/cancel', 'routines/start', 'routines/schedules', 'routines/schedules/create', 'routines/schedules/enabled', 'account/security/read', 'storage/inventory', 'storage/usage', 'usage/statement', 'storage/blob-store', 'storage/blob-store/select', 'storage/connections', 'storage/archive', 'storage/archive/status', 'environments/read', 'environments/create', 'environments/start', 'environments/stop', 'environments/delete', 'environments/renewals/read', 'environments/work/read', 'nodes/read'];
|
|
5
|
+
export declare const HOUSE_PROVIDER_ACTIONS: readonly ["conversation.create", "conversation.send", "conversation.answer", "conversation.interrupt", "conversation.kill", "conversation.cancel", "conversation.delete", "conversation.history", "conversations/interaction/read", "conversations/originals/read", "apps/read", "apps/customize", "rooms/read", "rooms/access/read", "rooms/access/invitations", "rooms/access/entries", "rooms/access/invite", "rooms/access/invitation-cancel", "rooms/access/revoke", "rooms/access/leave", "rooms/roles/define", "rooms/roles/remove", "rooms/roles/assign", "rooms/roles/unassign", "rooms/settings/processing/read", "rooms/settings/processing/write", "profiles/create", "profiles/read", "profiles/edit", "profiles/duplicate", "profiles/delegate", "agents/create", "agents/read", "routines/requests", "routines/access", "routines/owned", "routines/granted", "routines/grant", "routines/send", "routines/cancel", "routines/start", "routines/schedules", "routines/schedules/create", "routines/schedules/enabled", "account/security/read", "storage/inventory", "storage/usage", "usage/statement", "storage/blob-store", "storage/blob-store/select", "storage/connections", "storage/archive", "storage/archive/status", "environments/read", "environments/create", "environments/start", "environments/stop", "environments/delete", "environments/renewals/read", "environments/work/read", "nodes/read"];
|
|
6
|
+
export declare const HISTORY_PAGE = 100;
|
|
7
|
+
export declare const HOUSE_CONVERSATION_CARDS: ConversationCards;
|
|
8
|
+
export declare function declaredActions(): readonly ActionDeclaration[];
|
|
9
|
+
export declare function houseAction(transport: HouseTransport, request: ActionRequest): Promise<ActionResult>;
|
|
10
|
+
export declare function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult;
|
|
11
|
+
export declare function readConversationHistory(transport: HouseTransport, conversationId: string): Promise<{
|
|
12
|
+
messages: unknown[];
|
|
13
|
+
} | {
|
|
14
|
+
outcome: ActionResult;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEtE,eAAO,MAAM,oBAAoB,YAC/B,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,CACd,CAAC;AAEX,eAAO,MAAM,UAAU,YACrB,gCAAgC,EAChC,8BAA8B,EAC9B,WAAW,EACX,gB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,EAAE,YAAY,CAAA;CAAE,CAAC,CA4B9D"}
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { VERSION } from '@agentshouse/mdmodel';
|
|
2
|
+
import { changeBatchIdentity } from '@agentshouse/mdruntime';
|
|
3
|
+
import { doorRefusal } from './refusal.js';
|
|
4
|
+
import { PRIVATE_AUTHORITY } from './transport.js';
|
|
5
|
+
export const CONVERSATION_ACTIONS = [
|
|
6
|
+
'conversation.create',
|
|
7
|
+
'conversation.send',
|
|
8
|
+
'conversation.answer',
|
|
9
|
+
'conversation.interrupt',
|
|
10
|
+
'conversation.kill',
|
|
11
|
+
'conversation.cancel',
|
|
12
|
+
'conversation.delete',
|
|
13
|
+
'conversation.history'
|
|
14
|
+
];
|
|
15
|
+
export const HOUSE_ACTS = [
|
|
16
|
+
'conversations/interaction/read',
|
|
17
|
+
'conversations/originals/read',
|
|
18
|
+
'apps/read',
|
|
19
|
+
'apps/customize',
|
|
20
|
+
'rooms/read',
|
|
21
|
+
'rooms/access/read',
|
|
22
|
+
'rooms/access/invitations',
|
|
23
|
+
'rooms/access/entries',
|
|
24
|
+
'rooms/access/invite',
|
|
25
|
+
'rooms/access/invitation-cancel',
|
|
26
|
+
'rooms/access/revoke',
|
|
27
|
+
'rooms/access/leave',
|
|
28
|
+
'rooms/roles/define',
|
|
29
|
+
'rooms/roles/remove',
|
|
30
|
+
'rooms/roles/assign',
|
|
31
|
+
'rooms/roles/unassign',
|
|
32
|
+
'rooms/settings/processing/read',
|
|
33
|
+
'rooms/settings/processing/write',
|
|
34
|
+
'profiles/create',
|
|
35
|
+
'profiles/read',
|
|
36
|
+
'profiles/edit',
|
|
37
|
+
'profiles/duplicate',
|
|
38
|
+
'profiles/delegate',
|
|
39
|
+
'agents/create',
|
|
40
|
+
'agents/read',
|
|
41
|
+
'routines/requests',
|
|
42
|
+
'routines/access',
|
|
43
|
+
'routines/owned',
|
|
44
|
+
'routines/granted',
|
|
45
|
+
'routines/grant',
|
|
46
|
+
'routines/send',
|
|
47
|
+
'routines/cancel',
|
|
48
|
+
'routines/start',
|
|
49
|
+
'routines/schedules',
|
|
50
|
+
'routines/schedules/create',
|
|
51
|
+
'routines/schedules/enabled',
|
|
52
|
+
'account/security/read',
|
|
53
|
+
'storage/inventory',
|
|
54
|
+
'storage/usage',
|
|
55
|
+
'usage/statement',
|
|
56
|
+
'storage/blob-store',
|
|
57
|
+
'storage/blob-store/select',
|
|
58
|
+
'storage/connections',
|
|
59
|
+
'storage/archive',
|
|
60
|
+
'storage/archive/status',
|
|
61
|
+
'environments/read',
|
|
62
|
+
'environments/create',
|
|
63
|
+
'environments/start',
|
|
64
|
+
'environments/stop',
|
|
65
|
+
'environments/delete',
|
|
66
|
+
'environments/renewals/read',
|
|
67
|
+
'environments/work/read',
|
|
68
|
+
'nodes/read'
|
|
69
|
+
];
|
|
70
|
+
export const HOUSE_PROVIDER_ACTIONS = [
|
|
71
|
+
...CONVERSATION_ACTIONS,
|
|
72
|
+
...HOUSE_ACTS
|
|
73
|
+
];
|
|
74
|
+
const DECLARED = new Set(HOUSE_PROVIDER_ACTIONS);
|
|
75
|
+
export const HISTORY_PAGE = 100;
|
|
76
|
+
const OCTET_STREAM = 'application/octet-stream';
|
|
77
|
+
const CONVERSATION_ROUTES = {
|
|
78
|
+
'conversation.create': '/door/conversations/create',
|
|
79
|
+
'conversation.send': '/door/conversations/send',
|
|
80
|
+
'conversation.answer': '/door/conversations/interaction/answer',
|
|
81
|
+
'conversation.interrupt': '/door/conversations/interrupt',
|
|
82
|
+
'conversation.kill': '/door/conversations/kill',
|
|
83
|
+
'conversation.cancel': '/door/conversations/cancel',
|
|
84
|
+
'conversation.delete': '/door/conversations/delete',
|
|
85
|
+
'conversation.history': '/door/conversations/history',
|
|
86
|
+
'conversations/interaction/read': '/door/conversations/interaction/read',
|
|
87
|
+
'conversations/originals/read': '/door/conversations/originals/read'
|
|
88
|
+
};
|
|
89
|
+
export const HOUSE_CONVERSATION_CARDS = {
|
|
90
|
+
locator: PRIVATE_AUTHORITY,
|
|
91
|
+
type: 'conversation',
|
|
92
|
+
identity: 'conversation',
|
|
93
|
+
agent: 'agent'
|
|
94
|
+
};
|
|
95
|
+
export function declaredActions() {
|
|
96
|
+
return HOUSE_PROVIDER_ACTIONS.map((name)=>({
|
|
97
|
+
name,
|
|
98
|
+
inputShape: {},
|
|
99
|
+
resultKind: 'house'
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
export function houseAction(transport, request) {
|
|
103
|
+
if (!DECLARED.has(request.name)) {
|
|
104
|
+
return Promise.resolve({
|
|
105
|
+
kind: 'rejected',
|
|
106
|
+
code: 'action-unimplemented',
|
|
107
|
+
fields: {
|
|
108
|
+
name: request.name,
|
|
109
|
+
mdModel: VERSION
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (request.name === 'conversation.send') return sendAction(transport, request.input);
|
|
114
|
+
if (request.name === 'conversation.history') return historyAction(transport, request.input);
|
|
115
|
+
return carry(transport, request.name, request.input);
|
|
116
|
+
}
|
|
117
|
+
function routeOf(name) {
|
|
118
|
+
return CONVERSATION_ROUTES[name] ?? `/door/${name}`;
|
|
119
|
+
}
|
|
120
|
+
function record(value) {
|
|
121
|
+
return typeof value === 'object' && value !== null ? value : {};
|
|
122
|
+
}
|
|
123
|
+
function text(value, name) {
|
|
124
|
+
const held = record(value)[name];
|
|
125
|
+
return typeof held === 'string' ? held : undefined;
|
|
126
|
+
}
|
|
127
|
+
function operationId(input) {
|
|
128
|
+
return text(input, 'operation_id') ?? changeBatchIdentity();
|
|
129
|
+
}
|
|
130
|
+
function malformed() {
|
|
131
|
+
return {
|
|
132
|
+
kind: 'rejected',
|
|
133
|
+
code: 'invalid_request',
|
|
134
|
+
fields: {}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function bodyOf(name, input) {
|
|
138
|
+
if (name === 'conversation.create') {
|
|
139
|
+
return {
|
|
140
|
+
agent_id: text(input, 'agent_id'),
|
|
141
|
+
operation_id: operationId(input)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (name === 'conversation.interrupt' || name === 'conversation.kill' || name === 'conversation.delete') {
|
|
145
|
+
return {
|
|
146
|
+
conversation_id: text(input, 'conversation'),
|
|
147
|
+
operation_id: operationId(input)
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if (name === 'conversation.cancel') {
|
|
151
|
+
return {
|
|
152
|
+
conversation_id: text(input, 'conversation'),
|
|
153
|
+
message_id: text(input, 'turn'),
|
|
154
|
+
operation_id: operationId(input)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (name === 'conversation.answer') {
|
|
158
|
+
const nested = record(record(input).answer);
|
|
159
|
+
return {
|
|
160
|
+
conversation_id: text(input, 'conversation'),
|
|
161
|
+
operation_id: operationId(input),
|
|
162
|
+
interaction_id: text(nested, 'interaction_id'),
|
|
163
|
+
revision: nested.revision,
|
|
164
|
+
response: nested.response
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return input;
|
|
168
|
+
}
|
|
169
|
+
function withTurn(body) {
|
|
170
|
+
const held = record(body);
|
|
171
|
+
const turn = text(held, 'message_id');
|
|
172
|
+
return turn === undefined ? body : {
|
|
173
|
+
...held,
|
|
174
|
+
turn
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export function actionOutcome(answer, name) {
|
|
178
|
+
if (answer.status === 401) return {
|
|
179
|
+
kind: 'revoked-authorization'
|
|
180
|
+
};
|
|
181
|
+
const refusal = doorRefusal(answer.body);
|
|
182
|
+
if (refusal !== null) {
|
|
183
|
+
return {
|
|
184
|
+
kind: 'rejected',
|
|
185
|
+
code: refusal.code,
|
|
186
|
+
fields: refusal.fields
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
if (answer.status === 0 || answer.status >= 400) return {
|
|
190
|
+
kind: 'transport-uncertainty'
|
|
191
|
+
};
|
|
192
|
+
if (name === 'conversation.send') return {
|
|
193
|
+
kind: 'action',
|
|
194
|
+
result: withTurn(answer.body)
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
kind: 'action',
|
|
198
|
+
result: answer.body
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
async function carry(transport, name, input) {
|
|
202
|
+
const answer = await transport.door(routeOf(name), bodyOf(name, input));
|
|
203
|
+
return actionOutcome(answer, name);
|
|
204
|
+
}
|
|
205
|
+
function sendFile(entry) {
|
|
206
|
+
const file = record(entry);
|
|
207
|
+
const name = text(file, 'name');
|
|
208
|
+
const bytes = file.byteLength;
|
|
209
|
+
const sha256 = text(file, 'contentHash');
|
|
210
|
+
if (name === undefined || typeof bytes !== 'number' || sha256 === undefined) return null;
|
|
211
|
+
const mediaType = text(file, 'mediaType');
|
|
212
|
+
const width = file.width;
|
|
213
|
+
const height = file.height;
|
|
214
|
+
return {
|
|
215
|
+
name,
|
|
216
|
+
media_type: mediaType !== undefined && mediaType.length > 0 ? mediaType : OCTET_STREAM,
|
|
217
|
+
bytes,
|
|
218
|
+
sha256,
|
|
219
|
+
...typeof width === 'number' && typeof height === 'number' ? {
|
|
220
|
+
dimensions: {
|
|
221
|
+
width,
|
|
222
|
+
height
|
|
223
|
+
}
|
|
224
|
+
} : {}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function sendFiles(input) {
|
|
228
|
+
const files = record(input).files;
|
|
229
|
+
if (files === undefined) return [];
|
|
230
|
+
if (!Array.isArray(files)) return null;
|
|
231
|
+
const declared = [];
|
|
232
|
+
for (const entry of files){
|
|
233
|
+
const file = sendFile(entry);
|
|
234
|
+
if (file === null) return null;
|
|
235
|
+
declared.push(file);
|
|
236
|
+
}
|
|
237
|
+
return declared;
|
|
238
|
+
}
|
|
239
|
+
function sendBody(input) {
|
|
240
|
+
const files = sendFiles(input);
|
|
241
|
+
if (files === null) return null;
|
|
242
|
+
const textValue = text(input, 'text');
|
|
243
|
+
return {
|
|
244
|
+
conversation_id: text(input, 'conversation'),
|
|
245
|
+
operation_id: operationId(input),
|
|
246
|
+
...textValue !== undefined && textValue.length > 0 ? {
|
|
247
|
+
text: textValue
|
|
248
|
+
} : {},
|
|
249
|
+
...files.length === 0 ? {} : {
|
|
250
|
+
files
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
async function fileBytes(file) {
|
|
255
|
+
const blob = record(file).blob;
|
|
256
|
+
if (blob === undefined || typeof blob !== 'object' || blob === null) return null;
|
|
257
|
+
if (!('arrayBuffer' in blob) || typeof blob.arrayBuffer !== 'function') return null;
|
|
258
|
+
return new Uint8Array(await blob.arrayBuffer());
|
|
259
|
+
}
|
|
260
|
+
function uploadGrant(entry) {
|
|
261
|
+
if (!('upload' in record(entry))) return 'absent';
|
|
262
|
+
const upload = record(record(entry).upload);
|
|
263
|
+
if (upload.method !== 'POST') return null;
|
|
264
|
+
if (typeof upload.operation !== 'string' || typeof upload.url !== 'string') return null;
|
|
265
|
+
return {
|
|
266
|
+
method: 'POST',
|
|
267
|
+
operation: upload.operation,
|
|
268
|
+
url: upload.url
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
async function uploadOriginals(transport, input, result) {
|
|
272
|
+
const originals = record(result).originals;
|
|
273
|
+
if (!Array.isArray(originals) || originals.length === 0) return null;
|
|
274
|
+
const files = Array.isArray(record(input).files) ? record(input).files : [];
|
|
275
|
+
for (const [index, entry] of originals.entries()){
|
|
276
|
+
const grant = uploadGrant(entry);
|
|
277
|
+
if (grant === 'absent') continue;
|
|
278
|
+
if (grant === null) return malformed();
|
|
279
|
+
const bytes = index < files.length ? await fileBytes(files[index]) : null;
|
|
280
|
+
if (bytes === null) {
|
|
281
|
+
return {
|
|
282
|
+
kind: 'rejected',
|
|
283
|
+
code: 'conversation_original_descriptor_required',
|
|
284
|
+
fields: {}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
const delivered = await transport.transfer({
|
|
288
|
+
act: 'conversation_original_upload',
|
|
289
|
+
method: 'POST',
|
|
290
|
+
url: grant.url,
|
|
291
|
+
body: bytes,
|
|
292
|
+
operation: grant.operation
|
|
293
|
+
});
|
|
294
|
+
if (delivered.status === 200) continue;
|
|
295
|
+
return actionOutcome(delivered, 'conversation.send');
|
|
296
|
+
}
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
async function sendAction(transport, input) {
|
|
300
|
+
const body = sendBody(input);
|
|
301
|
+
if (body === null) return malformed();
|
|
302
|
+
const answer = await transport.door('/door/conversations/send', body);
|
|
303
|
+
const outcome = actionOutcome(answer, 'conversation.send');
|
|
304
|
+
if (outcome.kind !== 'action') return outcome;
|
|
305
|
+
const uploaded = await uploadOriginals(transport, input, outcome.result);
|
|
306
|
+
if (uploaded !== null) return uploaded;
|
|
307
|
+
return outcome;
|
|
308
|
+
}
|
|
309
|
+
function historyCursor(value) {
|
|
310
|
+
let parsed;
|
|
311
|
+
try {
|
|
312
|
+
parsed = JSON.parse(value);
|
|
313
|
+
} catch {
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
const acceptedAt = text(parsed, 'accepted_at');
|
|
317
|
+
const messageId = text(parsed, 'message_id');
|
|
318
|
+
if (acceptedAt === undefined || messageId === undefined) return null;
|
|
319
|
+
return {
|
|
320
|
+
accepted_at: acceptedAt,
|
|
321
|
+
message_id: messageId
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function turned(entry) {
|
|
325
|
+
const turn = text(entry, 'message_id');
|
|
326
|
+
if (turn === undefined) return null;
|
|
327
|
+
return {
|
|
328
|
+
turn,
|
|
329
|
+
message: structuredClone(entry)
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
function olderCursor(entry) {
|
|
333
|
+
const acceptedAt = text(entry.message, 'accepted_at');
|
|
334
|
+
const messageId = text(entry.message, 'message_id');
|
|
335
|
+
if (acceptedAt === undefined || messageId === undefined) return null;
|
|
336
|
+
return JSON.stringify({
|
|
337
|
+
accepted_at: acceptedAt,
|
|
338
|
+
message_id: messageId
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
export async function readConversationHistory(transport, conversationId) {
|
|
342
|
+
const messages = [];
|
|
343
|
+
let after;
|
|
344
|
+
for(;;){
|
|
345
|
+
const answer = await transport.door('/door/conversations/history', {
|
|
346
|
+
conversation_id: conversationId,
|
|
347
|
+
...after === undefined ? {} : {
|
|
348
|
+
after
|
|
349
|
+
},
|
|
350
|
+
limit: HISTORY_PAGE
|
|
351
|
+
});
|
|
352
|
+
const outcome = actionOutcome(answer, 'conversation.history');
|
|
353
|
+
if (outcome.kind !== 'action') return {
|
|
354
|
+
outcome
|
|
355
|
+
};
|
|
356
|
+
const held = record(outcome.result);
|
|
357
|
+
if (!Array.isArray(held.messages)) return {
|
|
358
|
+
outcome: {
|
|
359
|
+
kind: 'transport-uncertainty'
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
for (const entry of held.messages){
|
|
363
|
+
if (text(entry, 'message_id') === undefined) {
|
|
364
|
+
return {
|
|
365
|
+
outcome: {
|
|
366
|
+
kind: 'transport-uncertainty'
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
messages.push(entry);
|
|
371
|
+
}
|
|
372
|
+
if (held.next === null || held.next === undefined) return {
|
|
373
|
+
messages
|
|
374
|
+
};
|
|
375
|
+
const next = record(held.next);
|
|
376
|
+
const acceptedAt = text(next, 'accepted_at');
|
|
377
|
+
const messageId = text(next, 'message_id');
|
|
378
|
+
if (acceptedAt === undefined || messageId === undefined) {
|
|
379
|
+
return {
|
|
380
|
+
outcome: {
|
|
381
|
+
kind: 'transport-uncertainty'
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
after = {
|
|
386
|
+
accepted_at: acceptedAt,
|
|
387
|
+
message_id: messageId
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
function historyPage(conversationId, messages, until) {
|
|
392
|
+
const from = Math.max(0, until - HISTORY_PAGE);
|
|
393
|
+
const page = messages.slice(from, until);
|
|
394
|
+
const first = page[0];
|
|
395
|
+
const cursor = from === 0 || first === undefined ? null : olderCursor(first);
|
|
396
|
+
if (from > 0 && cursor === null) return {
|
|
397
|
+
kind: 'transport-uncertainty'
|
|
398
|
+
};
|
|
399
|
+
return {
|
|
400
|
+
kind: 'action',
|
|
401
|
+
result: {
|
|
402
|
+
conversation_id: conversationId,
|
|
403
|
+
messages: page,
|
|
404
|
+
...cursor === null ? {} : {
|
|
405
|
+
cursor
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
async function historyAction(transport, input) {
|
|
411
|
+
const conversationId = text(input, 'conversation');
|
|
412
|
+
if (conversationId === undefined) return malformed();
|
|
413
|
+
const cursorValue = text(input, 'cursor');
|
|
414
|
+
let olderThan;
|
|
415
|
+
if (cursorValue !== undefined) {
|
|
416
|
+
const parsed = historyCursor(cursorValue);
|
|
417
|
+
if (parsed === null) {
|
|
418
|
+
return {
|
|
419
|
+
kind: 'rejected',
|
|
420
|
+
code: 'unknown-cursor',
|
|
421
|
+
fields: {
|
|
422
|
+
cursor: cursorValue
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
olderThan = parsed;
|
|
427
|
+
}
|
|
428
|
+
const held = await readConversationHistory(transport, conversationId);
|
|
429
|
+
if ('outcome' in held) return held.outcome;
|
|
430
|
+
const messages = [];
|
|
431
|
+
for (const entry of held.messages){
|
|
432
|
+
const mapped = turned(entry);
|
|
433
|
+
if (mapped === null) return {
|
|
434
|
+
kind: 'transport-uncertainty'
|
|
435
|
+
};
|
|
436
|
+
messages.push(mapped);
|
|
437
|
+
}
|
|
438
|
+
if (olderThan === undefined) {
|
|
439
|
+
return historyPage(conversationId, messages, messages.length);
|
|
440
|
+
}
|
|
441
|
+
const at = messages.findIndex((entry)=>text(entry.message, 'accepted_at') === olderThan.accepted_at && text(entry.message, 'message_id') === olderThan.message_id);
|
|
442
|
+
if (at === -1) {
|
|
443
|
+
return {
|
|
444
|
+
kind: 'rejected',
|
|
445
|
+
code: 'unknown-cursor',
|
|
446
|
+
fields: {
|
|
447
|
+
cursor: cursorValue
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
return historyPage(conversationId, messages, at);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime-adapter/src/actions.ts"],"sourcesContent":["import { VERSION } from '@agentshouse/mdmodel';\nimport {\n changeBatchIdentity,\n type ActionDeclaration,\n type ActionRequest,\n type ActionResult,\n type ConversationCards,\n} from '@agentshouse/mdruntime';\nimport { doorRefusal } from './refusal.js';\nimport { PRIVATE_AUTHORITY } from './transport.js';\nimport type { HouseDoorAnswer, HouseTransport } from './transport.js';\n\nexport const CONVERSATION_ACTIONS = [\n 'conversation.create',\n 'conversation.send',\n 'conversation.answer',\n 'conversation.interrupt',\n 'conversation.kill',\n 'conversation.cancel',\n 'conversation.delete',\n 'conversation.history',\n] as const;\n\nexport const HOUSE_ACTS = [\n 'conversations/interaction/read',\n 'conversations/originals/read',\n 'apps/read',\n 'apps/customize',\n 'rooms/read',\n 'rooms/access/read',\n 'rooms/access/invitations',\n 'rooms/access/entries',\n 'rooms/access/invite',\n 'rooms/access/invitation-cancel',\n 'rooms/access/revoke',\n 'rooms/access/leave',\n 'rooms/roles/define',\n 'rooms/roles/remove',\n 'rooms/roles/assign',\n 'rooms/roles/unassign',\n 'rooms/settings/processing/read',\n 'rooms/settings/processing/write',\n 'profiles/create',\n 'profiles/read',\n 'profiles/edit',\n 'profiles/duplicate',\n 'profiles/delegate',\n 'agents/create',\n 'agents/read',\n 'routines/requests',\n 'routines/access',\n 'routines/owned',\n 'routines/granted',\n 'routines/grant',\n 'routines/send',\n 'routines/cancel',\n 'routines/start',\n 'routines/schedules',\n 'routines/schedules/create',\n 'routines/schedules/enabled',\n 'account/security/read',\n 'storage/inventory',\n 'storage/usage',\n 'usage/statement',\n 'storage/blob-store',\n 'storage/blob-store/select',\n 'storage/connections',\n 'storage/archive',\n 'storage/archive/status',\n 'environments/read',\n 'environments/create',\n 'environments/start',\n 'environments/stop',\n 'environments/delete',\n 'environments/renewals/read',\n 'environments/work/read',\n 'nodes/read',\n] as const;\n\nexport const HOUSE_PROVIDER_ACTIONS = [...CONVERSATION_ACTIONS, ...HOUSE_ACTS] as const;\n\nconst DECLARED = new Set<string>(HOUSE_PROVIDER_ACTIONS);\n\nexport const HISTORY_PAGE = 100;\n\nconst OCTET_STREAM = 'application/octet-stream';\n\nconst CONVERSATION_ROUTES: Readonly<Record<string, string>> = {\n 'conversation.create': '/door/conversations/create',\n 'conversation.send': '/door/conversations/send',\n 'conversation.answer': '/door/conversations/interaction/answer',\n 'conversation.interrupt': '/door/conversations/interrupt',\n 'conversation.kill': '/door/conversations/kill',\n 'conversation.cancel': '/door/conversations/cancel',\n 'conversation.delete': '/door/conversations/delete',\n 'conversation.history': '/door/conversations/history',\n 'conversations/interaction/read': '/door/conversations/interaction/read',\n 'conversations/originals/read': '/door/conversations/originals/read',\n};\n\nexport const HOUSE_CONVERSATION_CARDS: ConversationCards = {\n locator: PRIVATE_AUTHORITY,\n type: 'conversation',\n identity: 'conversation',\n agent: 'agent',\n};\n\nexport function declaredActions(): readonly ActionDeclaration[] {\n return HOUSE_PROVIDER_ACTIONS.map((name) => ({\n name,\n inputShape: {},\n resultKind: 'house',\n }));\n}\n\nexport function houseAction(\n transport: HouseTransport,\n request: ActionRequest,\n): Promise<ActionResult> {\n if (!DECLARED.has(request.name)) {\n return Promise.resolve({\n kind: 'rejected',\n code: 'action-unimplemented',\n fields: { name: request.name, mdModel: VERSION },\n });\n }\n if (request.name === 'conversation.send') return sendAction(transport, request.input);\n if (request.name === 'conversation.history') return historyAction(transport, request.input);\n return carry(transport, request.name, request.input);\n}\n\nfunction routeOf(name: string): string {\n return CONVERSATION_ROUTES[name] ?? `/door/${name}`;\n}\n\nfunction record(value: unknown): Record<string, unknown> {\n return typeof value === 'object' && value !== null ? (value as Record<string, unknown>) : {};\n}\n\nfunction text(value: unknown, name: string): string | undefined {\n const held = record(value)[name];\n return typeof held === 'string' ? held : undefined;\n}\n\nfunction operationId(input: unknown): string {\n return text(input, 'operation_id') ?? changeBatchIdentity();\n}\n\nfunction malformed(): ActionResult {\n return { kind: 'rejected', code: 'invalid_request', fields: {} };\n}\n\nfunction bodyOf(name: string, input: unknown): unknown {\n if (name === 'conversation.create') {\n return { agent_id: text(input, 'agent_id'), operation_id: operationId(input) };\n }\n if (\n name === 'conversation.interrupt' ||\n name === 'conversation.kill' ||\n name === 'conversation.delete'\n ) {\n return { conversation_id: text(input, 'conversation'), operation_id: operationId(input) };\n }\n if (name === 'conversation.cancel') {\n return {\n conversation_id: text(input, 'conversation'),\n message_id: text(input, 'turn'),\n operation_id: operationId(input),\n };\n }\n if (name === 'conversation.answer') {\n const nested = record(record(input).answer);\n return {\n conversation_id: text(input, 'conversation'),\n operation_id: operationId(input),\n interaction_id: text(nested, 'interaction_id'),\n revision: nested.revision,\n response: nested.response,\n };\n }\n return input;\n}\n\nfunction withTurn(body: unknown): unknown {\n const held = record(body);\n const turn = text(held, 'message_id');\n return turn === undefined ? body : { ...held, turn };\n}\n\nexport function actionOutcome(answer: HouseDoorAnswer, name: string): ActionResult {\n if (answer.status === 401) return { kind: 'revoked-authorization' };\n const refusal = doorRefusal(answer.body);\n if (refusal !== null) {\n return { kind: 'rejected', code: refusal.code, fields: refusal.fields };\n }\n if (answer.status === 0 || answer.status >= 400) return { kind: 'transport-uncertainty' };\n if (name === 'conversation.send') return { kind: 'action', result: withTurn(answer.body) };\n return { kind: 'action', result: answer.body };\n}\n\nasync function carry(\n transport: HouseTransport,\n name: string,\n input: unknown,\n): Promise<ActionResult> {\n const answer = await transport.door(routeOf(name), bodyOf(name, input));\n return actionOutcome(answer, name);\n}\n\nfunction sendFile(entry: unknown): Record<string, unknown> | null {\n const file = record(entry);\n const name = text(file, 'name');\n const bytes = file.byteLength;\n const sha256 = text(file, 'contentHash');\n if (name === undefined || typeof bytes !== 'number' || sha256 === undefined) return null;\n const mediaType = text(file, 'mediaType');\n const width = file.width;\n const height = file.height;\n return {\n name,\n media_type: mediaType !== undefined && mediaType.length > 0 ? mediaType : OCTET_STREAM,\n bytes,\n sha256,\n ...(typeof width === 'number' && typeof height === 'number'\n ? { dimensions: { width, height } }\n : {}),\n };\n}\n\nfunction sendFiles(input: unknown): readonly Record<string, unknown>[] | null {\n const files = record(input).files;\n if (files === undefined) return [];\n if (!Array.isArray(files)) return null;\n const declared: Record<string, unknown>[] = [];\n for (const entry of files) {\n const file = sendFile(entry);\n if (file === null) return null;\n declared.push(file);\n }\n return declared;\n}\n\nfunction sendBody(input: unknown): Record<string, unknown> | null {\n const files = sendFiles(input);\n if (files === null) return null;\n const textValue = text(input, 'text');\n return {\n conversation_id: text(input, 'conversation'),\n operation_id: operationId(input),\n ...(textValue !== undefined && textValue.length > 0 ? { text: textValue } : {}),\n ...(files.length === 0 ? {} : { files }),\n };\n}\n\nasync function fileBytes(file: unknown): Promise<Uint8Array | null> {\n const blob = record(file).blob;\n if (blob === undefined || typeof blob !== 'object' || blob === null) return null;\n if (!('arrayBuffer' in blob) || typeof blob.arrayBuffer !== 'function') return null;\n return new Uint8Array(await (blob as Blob).arrayBuffer());\n}\n\nfunction uploadGrant(\n entry: unknown,\n): { method: 'POST'; operation: string; url: string } | 'absent' | null {\n if (!('upload' in record(entry))) return 'absent';\n const upload = record(record(entry).upload);\n if (upload.method !== 'POST') return null;\n if (typeof upload.operation !== 'string' || typeof upload.url !== 'string') return null;\n return { method: 'POST', operation: upload.operation, url: upload.url };\n}\n\nasync function uploadOriginals(\n transport: HouseTransport,\n input: unknown,\n result: unknown,\n): Promise<ActionResult | null> {\n const originals = record(result).originals;\n if (!Array.isArray(originals) || originals.length === 0) return null;\n const files = Array.isArray(record(input).files) ? (record(input).files as unknown[]) : [];\n for (const [index, entry] of originals.entries()) {\n const grant = uploadGrant(entry);\n if (grant === 'absent') continue;\n if (grant === null) return malformed();\n const bytes = index < files.length ? await fileBytes(files[index]) : null;\n if (bytes === null) {\n return { kind: 'rejected', code: 'conversation_original_descriptor_required', fields: {} };\n }\n const delivered = await transport.transfer({\n act: 'conversation_original_upload',\n method: 'POST',\n url: grant.url,\n body: bytes,\n operation: grant.operation,\n });\n if (delivered.status === 200) continue;\n return actionOutcome(delivered, 'conversation.send');\n }\n return null;\n}\n\nasync function sendAction(transport: HouseTransport, input: unknown): Promise<ActionResult> {\n const body = sendBody(input);\n if (body === null) return malformed();\n const answer = await transport.door('/door/conversations/send', body);\n const outcome = actionOutcome(answer, 'conversation.send');\n if (outcome.kind !== 'action') return outcome;\n const uploaded = await uploadOriginals(transport, input, outcome.result);\n if (uploaded !== null) return uploaded;\n return outcome;\n}\n\ntype HistoryCursor = { accepted_at: string; message_id: string };\n\nfunction historyCursor(value: string): HistoryCursor | null {\n let parsed: unknown;\n try {\n parsed = JSON.parse(value) as unknown;\n } catch {\n return null;\n }\n const acceptedAt = text(parsed, 'accepted_at');\n const messageId = text(parsed, 'message_id');\n if (acceptedAt === undefined || messageId === undefined) return null;\n return { accepted_at: acceptedAt, message_id: messageId };\n}\n\nfunction turned(entry: unknown): { turn: string; message: unknown } | null {\n const turn = text(entry, 'message_id');\n if (turn === undefined) return null;\n return { turn, message: structuredClone(entry) };\n}\n\nfunction olderCursor(entry: { message: unknown }): string | null {\n const acceptedAt = text(entry.message, 'accepted_at');\n const messageId = text(entry.message, 'message_id');\n if (acceptedAt === undefined || messageId === undefined) return null;\n return JSON.stringify({ accepted_at: acceptedAt, message_id: messageId });\n}\n\nexport async function readConversationHistory(\n transport: HouseTransport,\n conversationId: string,\n): Promise<{ messages: unknown[] } | { outcome: ActionResult }> {\n const messages: unknown[] = [];\n let after: HistoryCursor | undefined;\n for (;;) {\n const answer = await transport.door('/door/conversations/history', {\n conversation_id: conversationId,\n ...(after === undefined ? {} : { after }),\n limit: HISTORY_PAGE,\n });\n const outcome = actionOutcome(answer, 'conversation.history');\n if (outcome.kind !== 'action') return { outcome };\n const held = record(outcome.result);\n if (!Array.isArray(held.messages)) return { outcome: { kind: 'transport-uncertainty' } };\n for (const entry of held.messages) {\n if (text(entry, 'message_id') === undefined) {\n return { outcome: { kind: 'transport-uncertainty' } };\n }\n messages.push(entry);\n }\n if (held.next === null || held.next === undefined) return { messages };\n const next = record(held.next);\n const acceptedAt = text(next, 'accepted_at');\n const messageId = text(next, 'message_id');\n if (acceptedAt === undefined || messageId === undefined) {\n return { outcome: { kind: 'transport-uncertainty' } };\n }\n after = { accepted_at: acceptedAt, message_id: messageId };\n }\n}\n\nfunction historyPage(\n conversationId: string,\n messages: readonly { turn: string; message: unknown }[],\n until: number,\n): ActionResult {\n const from = Math.max(0, until - HISTORY_PAGE);\n const page = messages.slice(from, until);\n const first = page[0];\n const cursor = from === 0 || first === undefined ? null : olderCursor(first);\n if (from > 0 && cursor === null) return { kind: 'transport-uncertainty' };\n return {\n kind: 'action',\n result: {\n conversation_id: conversationId,\n messages: page,\n ...(cursor === null ? {} : { cursor }),\n },\n };\n}\n\nasync function historyAction(transport: HouseTransport, input: unknown): Promise<ActionResult> {\n const conversationId = text(input, 'conversation');\n if (conversationId === undefined) return malformed();\n const cursorValue = text(input, 'cursor');\n let olderThan: HistoryCursor | undefined;\n if (cursorValue !== undefined) {\n const parsed = historyCursor(cursorValue);\n if (parsed === null) {\n return { kind: 'rejected', code: 'unknown-cursor', fields: { cursor: cursorValue } };\n }\n olderThan = parsed;\n }\n const held = await readConversationHistory(transport, conversationId);\n if ('outcome' in held) return held.outcome;\n const messages: { turn: string; message: unknown }[] = [];\n for (const entry of held.messages) {\n const mapped = turned(entry);\n if (mapped === null) return { kind: 'transport-uncertainty' };\n messages.push(mapped);\n }\n if (olderThan === undefined) {\n return historyPage(conversationId, messages, messages.length);\n }\n const at = messages.findIndex(\n (entry) =>\n text(entry.message, 'accepted_at') === olderThan.accepted_at &&\n text(entry.message, 'message_id') === olderThan.message_id,\n );\n if (at === -1) {\n return { kind: 'rejected', code: 'unknown-cursor', fields: { cursor: cursorValue } };\n }\n return historyPage(conversationId, messages, at);\n}\n"],"names":["VERSION","changeBatchIdentity","doorRefusal","PRIVATE_AUTHORITY","CONVERSATION_ACTIONS","HOUSE_ACTS","HOUSE_PROVIDER_ACTIONS","DECLARED","Set","HISTORY_PAGE","OCTET_STREAM","CONVERSATION_ROUTES","HOUSE_CONVERSATION_CARDS","locator","type","identity","agent","declaredActions","map","name","inputShape","resultKind","houseAction","transport","request","has","Promise","resolve","kind","code","fields","mdModel","sendAction","input","historyAction","carry","routeOf","record","value","text","held","undefined","operationId","malformed","bodyOf","agent_id","operation_id","conversation_id","message_id","nested","answer","interaction_id","revision","response","withTurn","body","turn","actionOutcome","status","refusal","result","door","sendFile","entry","file","bytes","byteLength","sha256","mediaType","width","height","media_type","length","dimensions","sendFiles","files","Array","isArray","declared","push","sendBody","textValue","fileBytes","blob","arrayBuffer","Uint8Array","uploadGrant","upload","method","operation","url","uploadOriginals","originals","index","entries","grant","delivered","transfer","act","outcome","uploaded","historyCursor","parsed","JSON","parse","acceptedAt","messageId","accepted_at","turned","message","structuredClone","olderCursor","stringify","readConversationHistory","conversationId","messages","after","limit","next","historyPage","until","from","Math","max","page","slice","first","cursor","cursorValue","olderThan","mapped","at","findIndex"],"mappings":"AAAA,SAASA,OAAO,QAAQ,uBAAuB;AAC/C,SACEC,mBAAmB,QAKd,yBAAyB;AAChC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,iBAAiB,QAAQ,iBAAiB;AAGnD,OAAO,MAAMC,uBAAuB;IAClC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAU;AAEX,OAAO,MAAMC,aAAa;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA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Transport } from './transport.js';
|
|
3
|
+
export type AgentsHouseAdapterOptions = {
|
|
4
|
+
transport: HouseTransport;
|
|
5
|
+
authorize(): Promise<Authorization>;
|
|
6
|
+
};
|
|
7
|
+
export declare function createAgentsHouseAdapter(options: AgentsHouseAdapterOptions): Adapter;
|
|
8
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,OAAO,EACP,aAAa,EAcd,MAAM,wBAAwB,CAAC;AA2BhC,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAexB,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACrC,CAAC;AAqCF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CA0RpF"}
|