@agentshouse/mdruntime 0.1.0-c2e8a6f99866d → 0.1.0-c2ef9303a058d
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/README.md +11 -9
- package/dist/adapter.d.ts +95 -67
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +5 -11
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +36 -47
- package/dist/binary.d.ts +0 -5
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/bootstrap.d.ts +17 -9
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +143 -94
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change-set.d.ts +1 -7
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +1 -4
- package/dist/client.d.ts +15 -12
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +56 -8
- package/dist/collection.d.ts +7 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +24 -19
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +117 -243
- package/dist/connection.d.ts +14 -12
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1466 -1431
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/{chat/context.js → context.js} +1 -4
- package/dist/conversation.d.ts +18 -15
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +273 -185
- package/dist/durability.d.ts +6 -4
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +3 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +17 -8
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/host.d.ts +3 -7
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +55 -38
- package/dist/identity.d.ts +0 -2
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -6
- package/dist/index.d.ts +15 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/job.d.ts +14 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +28 -0
- package/dist/live.d.ts +2 -1
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +9 -5
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +12 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +209 -101
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +89 -0
- package/dist/model.d.ts +8 -8
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -13
- package/dist/observation.d.ts +3 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +8 -3
- package/dist/outcome.d.ts +13 -6
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +16 -5
- package/dist/overlay.js +1 -1
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +10 -206
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -494
- package/dist/reach.d.ts +14 -9
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +84 -72
- package/dist/react.d.ts +3 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +14 -17
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +2 -8
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +26 -0
- package/dist/refresh.d.ts +10 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +88 -30
- package/dist/replica.d.ts +11 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +30 -15
- package/dist/room-draft.d.ts +22 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +131 -51
- package/dist/rows.d.ts +18 -16
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +45 -153
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +13 -7
- package/dist/search.d.ts +12 -95
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +10 -349
- package/dist/shared.d.ts +0 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +0 -10
- package/dist/status.d.ts +4 -3
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +25 -62
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +43 -282
- package/dist/stored.d.ts +12 -26
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +189 -226
- package/dist/tables.d.ts +55 -48
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +107 -57
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +39 -97
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +14 -9
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +5 -3
- package/package.json +14 -18
- package/AGENTS.md +0 -312
- package/dist/chat/acts.d.ts +0 -33
- package/dist/chat/acts.d.ts.map +0 -1
- package/dist/chat/acts.js +0 -36
- package/dist/chat/context.d.ts +0 -3
- package/dist/chat/context.d.ts.map +0 -1
- package/dist/chat/earlier.d.ts +0 -10
- package/dist/chat/earlier.d.ts.map +0 -1
- package/dist/chat/earlier.js +0 -54
- package/dist/chat/house.d.ts +0 -25
- package/dist/chat/house.d.ts.map +0 -1
- package/dist/chat/house.js +0 -38
- package/dist/chat/input.d.ts +0 -11
- package/dist/chat/input.d.ts.map +0 -1
- package/dist/chat/input.js +0 -92
- package/dist/chat/kit.d.ts +0 -61
- package/dist/chat/kit.d.ts.map +0 -1
- package/dist/chat/kit.js +0 -123
- package/dist/chat/lasting.d.ts +0 -6
- package/dist/chat/lasting.d.ts.map +0 -1
- package/dist/chat/lasting.js +0 -19
- package/dist/chat/list.d.ts +0 -28
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -103
- package/dist/chat/markdown.d.ts +0 -21
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -246
- package/dist/chat/message.d.ts +0 -7
- package/dist/chat/message.d.ts.map +0 -1
- package/dist/chat/message.js +0 -244
- package/dist/chat/messages.d.ts +0 -30
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -198
- package/dist/chat/name.d.ts +0 -7
- package/dist/chat/name.d.ts.map +0 -1
- package/dist/chat/name.js +0 -37
- package/dist/chat/opened.d.ts +0 -12
- package/dist/chat/opened.d.ts.map +0 -1
- package/dist/chat/opened.js +0 -19
- package/dist/chat/overlay.d.ts +0 -32
- package/dist/chat/overlay.d.ts.map +0 -1
- package/dist/chat/overlay.js +0 -103
- package/dist/chat/parts.d.ts +0 -58
- package/dist/chat/parts.d.ts.map +0 -1
- package/dist/chat/parts.js +0 -120
- package/dist/chat/pieces.d.ts +0 -62
- package/dist/chat/pieces.d.ts.map +0 -1
- package/dist/chat/pieces.js +0 -1110
- package/dist/chat/process.d.ts +0 -20
- package/dist/chat/process.d.ts.map +0 -1
- package/dist/chat/process.js +0 -32
- package/dist/chat/provider.d.ts +0 -70
- package/dist/chat/provider.d.ts.map +0 -1
- package/dist/chat/provider.js +0 -635
- package/dist/chat/question.d.ts +0 -9
- package/dist/chat/question.d.ts.map +0 -1
- package/dist/chat/question.js +0 -69
- package/dist/chat/questions.d.ts +0 -31
- package/dist/chat/questions.d.ts.map +0 -1
- package/dist/chat/questions.js +0 -111
- package/dist/chat/read.d.ts +0 -5
- package/dist/chat/read.d.ts.map +0 -1
- package/dist/chat/read.js +0 -13
- package/dist/chat/ready.d.ts +0 -37
- package/dist/chat/ready.d.ts.map +0 -1
- package/dist/chat/ready.js +0 -93
- package/dist/chat/room-file.d.ts +0 -8
- package/dist/chat/room-file.d.ts.map +0 -1
- package/dist/chat/room-file.js +0 -72
- package/dist/chat/steady.d.ts +0 -3
- package/dist/chat/steady.d.ts.map +0 -1
- package/dist/chat/steady.js +0 -26
- package/dist/chat/style.d.ts +0 -4
- package/dist/chat/style.d.ts.map +0 -1
- package/dist/chat/style.js +0 -306
- package/dist/chat.d.ts +0 -15
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
- package/dist/reads.d.ts +0 -11
- package/dist/reads.d.ts.map +0 -1
- package/dist/reads.js +0 -98
package/dist/durability.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import type { Persistence } from './readiness.js';
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
readonly
|
|
2
|
+
export type UnsentKind = 'pending-change' | 'call' | 'room-draft' | 'chat-draft';
|
|
3
|
+
export type UnsentWork = {
|
|
4
|
+
readonly kind: UnsentKind;
|
|
5
|
+
readonly count: number;
|
|
5
6
|
};
|
|
6
7
|
export type RuntimeShell = {
|
|
7
8
|
persistence: Persistence;
|
|
8
9
|
generation: string | null;
|
|
9
10
|
keepGeneration(value: string): void | Promise<void>;
|
|
10
11
|
dropGeneration(): void | Promise<void>;
|
|
11
|
-
estimate?(): Promise<StorageEstimate | null>;
|
|
12
12
|
cleanUp?(): Promise<number>;
|
|
13
|
+
reset(): Promise<void>;
|
|
13
14
|
};
|
|
15
|
+
export declare function refusedForSpace(error: unknown): boolean;
|
|
14
16
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
15
17
|
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
|
16
18
|
//# sourceMappingURL=durability.d.ts.map
|
package/dist/durability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["../src/durability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["../src/durability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AAEjF,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMvD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAG/F;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGrF"}
|
package/dist/durability.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
const STORAGE_LOSS_CODE = 'storage-loss';
|
|
2
|
+
export function refusedForSpace(error) {
|
|
3
|
+
return (typeof error === 'object' &&
|
|
4
|
+
error !== null &&
|
|
5
|
+
error.name === 'QuotaExceededError');
|
|
6
|
+
}
|
|
2
7
|
export function detectStorageLoss(stored, reported) {
|
|
3
8
|
if (reported === null || reported === stored)
|
|
4
9
|
return null;
|
package/dist/entry.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type VerifiedModel } from '@agentshouse/mdmodel';
|
|
2
2
|
import { type QueryRows } from './query.js';
|
|
3
3
|
import type { Connection } from './tables.js';
|
|
4
|
-
export { QueryError } from '
|
|
4
|
+
export { QueryError } from '@agentshouse/mdmodel';
|
|
5
5
|
export type EntryRoom = {
|
|
6
6
|
locator: string;
|
|
7
7
|
schema: string | null;
|
|
8
8
|
documents: Readonly<Record<string, string>>;
|
|
9
|
+
revisions?: Readonly<Record<string, string>>;
|
|
9
10
|
};
|
|
10
11
|
export type EntryArguments = Readonly<Record<string, string>>;
|
|
11
12
|
export type EntryParameterKind = 'string' | 'integer' | 'number' | 'boolean';
|
package/dist/entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AA0D7E,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAE3E;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAMpE;AAyCD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQ7D;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACzF,CAAC;AAEF,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,UAAU,GACrB,UAAU,CAmDZ"}
|
package/dist/entry.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { invalid, plain, QueryError, } from '@agentshouse/mdmodel';
|
|
1
2
|
import { attachedModel } from './attached-model.js';
|
|
2
3
|
import { answerQuery } from './compile.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { planWithin } from './query.js';
|
|
5
|
+
import { writtenFacts } from './rows.js';
|
|
5
6
|
import { entered, REPLICA_TABLES } from './stored.js';
|
|
6
|
-
export { QueryError } from '
|
|
7
|
+
export { QueryError } from '@agentshouse/mdmodel';
|
|
7
8
|
const PARAMETER = '$param';
|
|
8
9
|
const KIND = 'as';
|
|
9
10
|
const INTEGER = /^-?(?:0|[1-9][0-9]*)$/u;
|
|
@@ -83,6 +84,7 @@ const SAMPLED = {
|
|
|
83
84
|
$all: 'entry',
|
|
84
85
|
$size: 0,
|
|
85
86
|
$exists: true,
|
|
87
|
+
$prefix: 'entry',
|
|
86
88
|
$gt: 0,
|
|
87
89
|
$gte: 0,
|
|
88
90
|
$lt: 0,
|
|
@@ -98,9 +100,15 @@ function sampled(template, key) {
|
|
|
98
100
|
}
|
|
99
101
|
return template;
|
|
100
102
|
}
|
|
103
|
+
function entryPlan(query, facts) {
|
|
104
|
+
const plan = planWithin(query, facts);
|
|
105
|
+
if (plan.fileIds !== null)
|
|
106
|
+
invalid('fileIds', 'an entry Room holds no file IDs');
|
|
107
|
+
return plan;
|
|
108
|
+
}
|
|
101
109
|
export function entryRefusal(template) {
|
|
102
110
|
try {
|
|
103
|
-
|
|
111
|
+
entryPlan(sampled(template, ''), { listed: false, rooms: [] });
|
|
104
112
|
return null;
|
|
105
113
|
}
|
|
106
114
|
catch (error) {
|
|
@@ -117,20 +125,21 @@ export function entryScope(rooms, roomTypes, connection) {
|
|
|
117
125
|
const model = attachedModel({
|
|
118
126
|
kind: 'model',
|
|
119
127
|
snapshot: { identity: room.locator, version: '', schema: room.schema, revision: null },
|
|
120
|
-
},
|
|
128
|
+
}, roomTypes);
|
|
121
129
|
held.push({
|
|
122
130
|
locator: room.locator,
|
|
123
131
|
available: model.status !== 'unavailable',
|
|
124
132
|
types: model.status === 'unavailable' ? [] : Object.values(model.types),
|
|
125
133
|
});
|
|
126
|
-
const composition = { model, selection: null };
|
|
134
|
+
const composition = { model, selection: null, typedPaths: [] };
|
|
127
135
|
const key = entered(connection, room.locator, composition, Object.keys(room.documents)
|
|
128
136
|
.sort()
|
|
129
137
|
.map((path) => ({
|
|
130
138
|
path,
|
|
131
139
|
content: room.documents[path],
|
|
140
|
+
facts: writtenFacts(path, room.documents[path], composition),
|
|
132
141
|
binary: null,
|
|
133
|
-
revision: null,
|
|
142
|
+
revision: room.revisions?.[path] ?? null,
|
|
134
143
|
fileId: null,
|
|
135
144
|
change: null,
|
|
136
145
|
written: null,
|
|
@@ -142,7 +151,7 @@ export function entryScope(rooms, roomTypes, connection) {
|
|
|
142
151
|
async results(queries) {
|
|
143
152
|
const results = {};
|
|
144
153
|
for (const [name, query] of Object.entries(queries)) {
|
|
145
|
-
const plan =
|
|
154
|
+
const plan = entryPlan(query, planned);
|
|
146
155
|
results[name] = answerQuery(connection, plan, keys.filter(({ locator }) => plan.rooms === null || plan.rooms.includes(locator)));
|
|
147
156
|
}
|
|
148
157
|
return results;
|
package/dist/file.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
blob: Blob;
|
|
4
|
-
};
|
|
5
|
-
export type FileDeclaration = {
|
|
6
|
-
name: string;
|
|
7
|
-
mediaType: string;
|
|
8
|
-
byteLength: number;
|
|
9
|
-
contentHash: string;
|
|
10
|
-
};
|
|
11
|
-
export declare function declaredFile(file: ChosenFile): Promise<FileDeclaration>;
|
|
1
|
+
import type { AttachRequest } from './adapter.js';
|
|
2
|
+
export declare function attachedFile(locator: string, file: File): Promise<AttachRequest>;
|
|
12
3
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAStF"}
|
package/dist/file.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { sha256 } from './digest.js';
|
|
2
|
-
export async function
|
|
2
|
+
export async function attachedFile(locator, file) {
|
|
3
3
|
return {
|
|
4
|
+
locator,
|
|
4
5
|
name: file.name,
|
|
5
|
-
mediaType: file.
|
|
6
|
-
byteLength: file.
|
|
7
|
-
|
|
6
|
+
mediaType: file.type,
|
|
7
|
+
byteLength: file.size,
|
|
8
|
+
sha256: await sha256(file),
|
|
9
|
+
blob: file,
|
|
8
10
|
};
|
|
9
11
|
}
|
package/dist/host.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MdRuntimeOptions } from './connection.js';
|
|
2
2
|
import type { PortReach } from './reach.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { CodeAvailability, Persistence, Readiness } from './readiness.js';
|
|
4
4
|
import type { EntrySeed } from './seed.js';
|
|
5
5
|
import { type RuntimePort } from './wire.js';
|
|
6
6
|
export type MdRuntimeHostOptions = MdRuntimeOptions & {
|
|
@@ -11,22 +11,18 @@ export type AttachedPort = {
|
|
|
11
11
|
narrow(reach: PortReach): void;
|
|
12
12
|
readiness(deliver: (readiness: Readiness) => void): () => void;
|
|
13
13
|
answered(queries: readonly unknown[], done: () => void): void;
|
|
14
|
-
code(code: CodeAvailability, capacity: CapacityCause | null): void;
|
|
15
|
-
search(search: SearchObligation): void;
|
|
16
14
|
};
|
|
17
15
|
export type MdRuntimeHost = {
|
|
18
|
-
attach(port: RuntimePort, app: string, release?: string, reach?: PortReach, code?: CodeAvailability
|
|
16
|
+
attach(port: RuntimePort, app: string, release?: string, reach?: PortReach, code?: CodeAvailability): AttachedPort;
|
|
19
17
|
seed(entry: EntrySeed): void;
|
|
20
18
|
persisted(answer: Persistence): void;
|
|
21
19
|
endAuthorization(holder?: string): Promise<void>;
|
|
22
|
-
lose(locators: readonly string[]): Promise<void>;
|
|
23
20
|
stop(): Promise<void>;
|
|
24
21
|
};
|
|
25
22
|
export declare function serveMdRuntime(options: MdRuntimeHostOptions): MdRuntimeHost;
|
|
26
23
|
export { entrySeedOf, type EntrySeed } from './seed.js';
|
|
27
24
|
export type { PortReach, ReachedDocument } from './reach.js';
|
|
28
|
-
export type {
|
|
25
|
+
export type { CodeAvailability, Persistence, Space } from './readiness.js';
|
|
29
26
|
export { createRecovery, retryDelay, type Attempt, type Attempted, type AttemptOptions, type Recovery, type RecoveryOptions, } from './recovery.js';
|
|
30
|
-
export { openDatabase, STORE_SCHEMA, transacted } from './store.js';
|
|
31
27
|
export type { RuntimePort } from './wire.js';
|
|
32
28
|
//# sourceMappingURL=host.d.ts.map
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EAGtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAGL,KAAK,WAAW,EAOjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CACJ,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,SAAS,EACjB,IAAI,CAAC,EAAE,gBAAgB,GACtB,YAAY,CAAC;IAChB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB,CAAC;AAwIF,wBAAgB,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAoL3E;AAED,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EACL,cAAc,EACd,UAAU,EACV,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/host.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { queryKey } from '@agentshouse/mdmodel';
|
|
1
2
|
import { composeRuntime, } from './connection.js';
|
|
2
|
-
import {
|
|
3
|
+
import { untilAnswered } from './recovery.js';
|
|
3
4
|
import { described } from './failure.js';
|
|
4
|
-
import { endRuntimeStore } from './store.js';
|
|
5
5
|
import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
|
|
6
6
|
const NARROWED = new Set(['within', 'whole']);
|
|
7
7
|
function answered(md, app, writtenBy, member, input) {
|
|
@@ -26,8 +26,10 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
26
26
|
return md.binaryFile.read(input[0], input[1], input[2]);
|
|
27
27
|
case 'binaryFile.link':
|
|
28
28
|
return md.binaryFile.link(input[0], input[1], input[2]);
|
|
29
|
-
case 'binaryFile.
|
|
30
|
-
return md.binaryFile.
|
|
29
|
+
case 'binaryFile.show':
|
|
30
|
+
return md.binaryFile.show(input[0], input[1], input[2]);
|
|
31
|
+
case 'binaryFile.attach':
|
|
32
|
+
return md.binaryFile.attach(input[0], input[1]);
|
|
31
33
|
case 'binaryFile.part':
|
|
32
34
|
return md.binaryFile.part(input[0], input[1]);
|
|
33
35
|
case 'call':
|
|
@@ -38,6 +40,10 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
38
40
|
return md.log();
|
|
39
41
|
case 'cleanUp':
|
|
40
42
|
return md.cleanUp();
|
|
43
|
+
case 'unsent':
|
|
44
|
+
return md.unsent();
|
|
45
|
+
case 'reset':
|
|
46
|
+
return md.reset();
|
|
41
47
|
case 'persistence':
|
|
42
48
|
return md.persistence();
|
|
43
49
|
case 'retry':
|
|
@@ -49,7 +55,7 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
49
55
|
case 'roomDraft.read':
|
|
50
56
|
return md.roomDraft.read(input[0], input[1]);
|
|
51
57
|
case 'roomDraft.write':
|
|
52
|
-
return md.roomDraft.write(input[0], input[1], input[2], input[3]);
|
|
58
|
+
return md.roomDraft.write(input[0], input[1], input[2], input[3], input[4]);
|
|
53
59
|
case 'roomDraft.discard':
|
|
54
60
|
return md.roomDraft.discard(input[0], input[1], input[2]);
|
|
55
61
|
case 'presentation.read':
|
|
@@ -66,16 +72,12 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
66
72
|
return md.conversation.create(input[0]);
|
|
67
73
|
case 'conversation.send':
|
|
68
74
|
return md.conversation.send(input[0], input[1], input[2]);
|
|
69
|
-
case 'conversation.attach':
|
|
70
|
-
return md.conversation.attach(input[0], input[1]);
|
|
71
75
|
case 'conversation.answer':
|
|
72
76
|
return md.conversation.answer(input[0], input[1]);
|
|
73
77
|
case 'conversation.interrupt':
|
|
74
78
|
return md.conversation.interrupt(input[0]);
|
|
75
79
|
case 'conversation.kill':
|
|
76
80
|
return md.conversation.kill(input[0]);
|
|
77
|
-
case 'conversation.cancel':
|
|
78
|
-
return md.conversation.cancel(input[0], input[1]);
|
|
79
81
|
case 'conversation.delete':
|
|
80
82
|
return md.conversation.delete(input[0]);
|
|
81
83
|
case 'chatDraft.write':
|
|
@@ -86,6 +88,14 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
86
88
|
return md.chatDraft.discard(input[0]);
|
|
87
89
|
}
|
|
88
90
|
}
|
|
91
|
+
function attempted(work) {
|
|
92
|
+
try {
|
|
93
|
+
return Promise.resolve(work());
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
return Promise.reject(error);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
89
99
|
function answeredResult(value) {
|
|
90
100
|
return typeof value === 'object' && value !== null && !('pending' in value);
|
|
91
101
|
}
|
|
@@ -107,16 +117,17 @@ export function serveMdRuntime(options) {
|
|
|
107
117
|
const { md } = runtime;
|
|
108
118
|
const attachments = new Map();
|
|
109
119
|
let authorized = true;
|
|
120
|
+
let opening = null;
|
|
121
|
+
const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal));
|
|
110
122
|
const watchFacts = (deliver) => {
|
|
111
123
|
deliver(structuredClone(deploymentFacts));
|
|
112
124
|
return () => { };
|
|
113
125
|
};
|
|
114
|
-
function attach(port, app, release, reach, code = 'stored'
|
|
126
|
+
function attach(port, app, release, reach, code = 'stored') {
|
|
115
127
|
if (!authorized)
|
|
116
128
|
throw new Error(AUTHORIZATION_ENDED);
|
|
117
129
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
118
|
-
|
|
119
|
-
const view = runtime.within(reach ?? null, facts);
|
|
130
|
+
const view = runtime.within(reach ?? null, { target: app, code });
|
|
120
131
|
const observations = new Map();
|
|
121
132
|
const followed = new Set();
|
|
122
133
|
const answeredKeys = new Set();
|
|
@@ -154,9 +165,30 @@ export function serveMdRuntime(options) {
|
|
|
154
165
|
if (topic === 'query' && answeredMessage(value))
|
|
155
166
|
answeredQuery(input[0]);
|
|
156
167
|
};
|
|
168
|
+
const fail = (error) => {
|
|
169
|
+
if (!serving || resolved)
|
|
170
|
+
return;
|
|
171
|
+
observations.get(id)?.();
|
|
172
|
+
observations.delete(id);
|
|
173
|
+
send({ kind: 'failure', id, ...described(error) });
|
|
174
|
+
};
|
|
157
175
|
observations.set(id, topic === 'deployment-facts'
|
|
158
176
|
? watchFacts(deliver)
|
|
159
|
-
: (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
|
|
177
|
+
: (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver, fail));
|
|
178
|
+
};
|
|
179
|
+
const reply = async (id, query, pending) => {
|
|
180
|
+
try {
|
|
181
|
+
const value = await pending;
|
|
182
|
+
if (!serving)
|
|
183
|
+
return;
|
|
184
|
+
send({ kind: 'result', id, value });
|
|
185
|
+
if (query !== undefined && answeredResult(value))
|
|
186
|
+
answeredQuery(query);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
if (serving)
|
|
190
|
+
send({ kind: 'failure', id, ...described(error) });
|
|
191
|
+
}
|
|
160
192
|
};
|
|
161
193
|
const serve = async (message) => {
|
|
162
194
|
if (message.kind === 'hello')
|
|
@@ -167,24 +199,24 @@ export function serveMdRuntime(options) {
|
|
|
167
199
|
return;
|
|
168
200
|
}
|
|
169
201
|
try {
|
|
170
|
-
if (message.kind !== 'observe'
|
|
202
|
+
if (message.kind !== 'observe')
|
|
171
203
|
await md.loaded();
|
|
204
|
+
else if (message.topic !== 'room-drafts')
|
|
205
|
+
await opened();
|
|
172
206
|
if (message.kind === 'observe') {
|
|
173
207
|
if (serving)
|
|
174
208
|
observe(message.id, message.topic, message.input);
|
|
175
209
|
return;
|
|
176
210
|
}
|
|
177
|
-
const value = await answered(NARROWED.has(WIRE.members[message.member].reach) ? view.md : md, app, writtenBy, message.member, message.input);
|
|
178
|
-
if (!serving)
|
|
179
|
-
return;
|
|
180
|
-
send({ kind: 'result', id: message.id, value });
|
|
181
|
-
if (message.member === 'query' && answeredResult(value))
|
|
182
|
-
answeredQuery(message.input[0]);
|
|
183
211
|
}
|
|
184
212
|
catch (error) {
|
|
185
213
|
if (serving)
|
|
186
214
|
send({ kind: 'failure', id: message.id, ...described(error) });
|
|
215
|
+
return;
|
|
187
216
|
}
|
|
217
|
+
const { id, member, input } = message;
|
|
218
|
+
const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? view.md : md, app, writtenBy, member, input));
|
|
219
|
+
return reply(id, member === 'query' ? input[0] : undefined, pending);
|
|
188
220
|
};
|
|
189
221
|
port.addEventListener('message', (event) => {
|
|
190
222
|
if (!serving)
|
|
@@ -203,18 +235,6 @@ export function serveMdRuntime(options) {
|
|
|
203
235
|
if (serving)
|
|
204
236
|
view.narrow(next);
|
|
205
237
|
},
|
|
206
|
-
code(next, capacity) {
|
|
207
|
-
if (!serving)
|
|
208
|
-
return;
|
|
209
|
-
facts = { ...facts, code: next, capacity };
|
|
210
|
-
view.facts(facts);
|
|
211
|
-
},
|
|
212
|
-
search(next) {
|
|
213
|
-
if (!serving)
|
|
214
|
-
return;
|
|
215
|
-
facts = { ...facts, search: next };
|
|
216
|
-
view.facts(facts);
|
|
217
|
-
},
|
|
218
238
|
answered(queries, done) {
|
|
219
239
|
const keys = queries.map(queryKey);
|
|
220
240
|
if (keys.every((key) => answeredKeys.has(key)))
|
|
@@ -228,7 +248,7 @@ export function serveMdRuntime(options) {
|
|
|
228
248
|
const stop = view.watch('readiness', [], (value) => {
|
|
229
249
|
if (serving)
|
|
230
250
|
deliver(value);
|
|
231
|
-
});
|
|
251
|
+
}, () => { });
|
|
232
252
|
const end = () => {
|
|
233
253
|
followed.delete(end);
|
|
234
254
|
stop();
|
|
@@ -253,11 +273,9 @@ export function serveMdRuntime(options) {
|
|
|
253
273
|
detach();
|
|
254
274
|
}
|
|
255
275
|
close();
|
|
256
|
-
if (!(await
|
|
276
|
+
if (!(await options.database.ask({ kind: 'authored.end', holder: holder ?? null }))) {
|
|
257
277
|
await options.shell.dropGeneration();
|
|
258
|
-
|
|
259
|
-
lose(locators) {
|
|
260
|
-
return runtime.lose(locators);
|
|
278
|
+
}
|
|
261
279
|
},
|
|
262
280
|
stop() {
|
|
263
281
|
return runtime.stop();
|
|
@@ -266,4 +284,3 @@ export function serveMdRuntime(options) {
|
|
|
266
284
|
}
|
|
267
285
|
export { entrySeedOf } from './seed.js';
|
|
268
286
|
export { createRecovery, retryDelay, } from './recovery.js';
|
|
269
|
-
export { openDatabase, STORE_SCHEMA, transacted } from './store.js';
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export declare function changeBatchIdentity(at?: number): string;
|
|
2
|
-
export declare function identityTime(identity: string): number;
|
|
3
2
|
export declare function roomDraftRevision(): string;
|
|
4
3
|
export declare function chatDraftRevision(): string;
|
|
5
4
|
export declare function transferIdentity(): string;
|
|
6
|
-
export declare function indexGeneration(): string;
|
|
7
5
|
export declare function binaryLocalId(): string;
|
|
8
6
|
//# sourceMappingURL=identity.d.ts.map
|
package/dist/identity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/identity.js
CHANGED
|
@@ -10,9 +10,6 @@ export function changeBatchIdentity(at = Date.now()) {
|
|
|
10
10
|
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
11
11
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
12
12
|
}
|
|
13
|
-
export function identityTime(identity) {
|
|
14
|
-
return Number.parseInt(identity.replaceAll('-', '').slice(0, 12), 16);
|
|
15
|
-
}
|
|
16
13
|
function randomIdentity() {
|
|
17
14
|
const bytes = new Uint8Array(16);
|
|
18
15
|
crypto.getRandomValues(bytes);
|
|
@@ -27,9 +24,6 @@ export function chatDraftRevision() {
|
|
|
27
24
|
export function transferIdentity() {
|
|
28
25
|
return randomIdentity();
|
|
29
26
|
}
|
|
30
|
-
export function indexGeneration() {
|
|
31
|
-
return randomIdentity();
|
|
32
|
-
}
|
|
33
27
|
export function binaryLocalId() {
|
|
34
28
|
return randomIdentity();
|
|
35
29
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult,
|
|
1
|
+
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, AuthorityChange, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, SavedFacts, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldContent, HeldFile, HeldRoom, ListedAgent, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomChange, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, SearchAnswer, SearchAsk, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedPath, TypedSelection, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
|
|
3
|
-
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
4
|
-
export type { ChosenFile, FileDeclaration } from './file.js';
|
|
3
|
+
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
5
4
|
export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
6
5
|
export type { Observation } from './observation.js';
|
|
7
|
-
export type { BinaryAnswer, BinaryLinkAnswer, CallResult, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
8
|
-
export type { BinaryFileRecord
|
|
6
|
+
export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
7
|
+
export type { BinaryFileRecord } from './binary.js';
|
|
9
8
|
export type { RuntimeError } from './failure.js';
|
|
10
9
|
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
|
|
11
10
|
export type { SaveRefusal } from './save.js';
|
|
12
|
-
export type {
|
|
11
|
+
export type { SearchFound, SearchHit, SearchRequest, SearchResult } from './search.js';
|
|
13
12
|
export { departure } from './change.js';
|
|
14
|
-
export { partsAfter } from './room-draft.js';
|
|
13
|
+
export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
|
|
15
14
|
export { cutName, nameFrom, transliterated } from './name.js';
|
|
16
|
-
export { SESSION_STARTED } from './conversation.js';
|
|
15
|
+
export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
|
|
16
|
+
export { contextFigure } from './context.js';
|
|
17
|
+
export { jobOf, jobsRunning, sessionEnded, type Job, type RunningJob } from './job.js';
|
|
17
18
|
export { changeBatchIdentity } from './identity.js';
|
|
18
|
-
export { ROW_WEIGHT, stepped } from './turn.js';
|
|
19
|
+
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
20
|
+
export { untilAnswered } from './recovery.js';
|
|
19
21
|
export { entriesIn, patching, sortedKeys } from './shared.js';
|
|
20
22
|
export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
|
|
21
23
|
export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
|
|
22
|
-
export type { RuntimeShell,
|
|
23
|
-
export type {
|
|
24
|
+
export type { RuntimeShell, UnsentKind, UnsentWork } from './durability.js';
|
|
25
|
+
export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationStep, Persistence, Readiness, ReadinessStatus, RoomCoverage, RoomPreparation, Space, TargetCoverage, } from './readiness.js';
|
|
24
26
|
export type { AttentionEntry, SyncStatus } from './status.js';
|
|
25
|
-
export type {
|
|
27
|
+
export type { Direction, DocumentQuery, Filter, GroupQuery, Key, LocalQuery, OrderOptions, Predicate, Related, Select, Value, Where, } from '@agentshouse/mdmodel';
|
|
28
|
+
export type { Awaits, Backlink, CoveredRoom, DocumentResult, GroupResult, PendingResult, PendingRoom, QueryCoverage, QueryDocument, QueryGroup, QueryResult, QueryRows, } from './query.js';
|
|
26
29
|
export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.js';
|
|
27
30
|
export type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';
|
|
28
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { departure } from './change.js';
|
|
2
|
-
export { partsAfter } from './room-draft.js';
|
|
2
|
+
export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
|
|
3
3
|
export { cutName, nameFrom, transliterated } from './name.js';
|
|
4
|
-
export { SESSION_STARTED } from './conversation.js';
|
|
4
|
+
export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
|
|
5
|
+
export { contextFigure } from './context.js';
|
|
6
|
+
export { jobOf, jobsRunning, sessionEnded } from './job.js';
|
|
5
7
|
export { changeBatchIdentity } from './identity.js';
|
|
6
|
-
export { ROW_WEIGHT, stepped } from './turn.js';
|
|
8
|
+
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
9
|
+
export { untilAnswered } from './recovery.js';
|
|
7
10
|
export { entriesIn, patching, sortedKeys } from './shared.js';
|
|
8
11
|
export { attempts, identities, intentOf, } from './attempt.js';
|
|
9
12
|
export { expectedList, expecting } from './expectation.js';
|
package/dist/job.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Job = {
|
|
2
|
+
readonly label: string;
|
|
3
|
+
readonly kind: 'started' | 'scheduled' | 'ended';
|
|
4
|
+
readonly state: string;
|
|
5
|
+
readonly next: string | null;
|
|
6
|
+
};
|
|
7
|
+
export type RunningJob = {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly running_since: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function jobOf(said: string): Job;
|
|
12
|
+
export declare function jobsRunning(jobs: readonly RunningJob[], now: number): string[];
|
|
13
|
+
export declare function sessionEnded(jobs: readonly RunningJob[], now: number): string;
|
|
14
|
+
//# sourceMappingURL=job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,GAAG;IAChB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,CAAC;AAQF,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CASvC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAM9E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7E"}
|
package/dist/job.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const NEXT_RUN = 'next run ';
|
|
2
|
+
const MINUTE = 60_000;
|
|
3
|
+
const ENDED = 'Session ended.';
|
|
4
|
+
export function jobOf(said) {
|
|
5
|
+
const at = said.lastIndexOf(': ');
|
|
6
|
+
const label = at === -1 ? said : said.slice(0, at);
|
|
7
|
+
const state = at === -1 ? '' : said.slice(at + 2);
|
|
8
|
+
if (state === 'running')
|
|
9
|
+
return { label, kind: 'started', state, next: null };
|
|
10
|
+
if (state === 'scheduled')
|
|
11
|
+
return { label, kind: 'scheduled', state, next: null };
|
|
12
|
+
return state.startsWith(NEXT_RUN)
|
|
13
|
+
? { label, kind: 'scheduled', state, next: state.slice(NEXT_RUN.length) }
|
|
14
|
+
: { label, kind: 'ended', state, next: null };
|
|
15
|
+
}
|
|
16
|
+
export function jobsRunning(jobs, now) {
|
|
17
|
+
return jobs.map((job) => {
|
|
18
|
+
const since = Date.parse(job.running_since);
|
|
19
|
+
const ran = Number.isNaN(since) ? 0 : Math.floor((now - since) / MINUTE);
|
|
20
|
+
return ran >= 1 ? `${job.name} (${ran} min)` : job.name;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function sessionEnded(jobs, now) {
|
|
24
|
+
if (jobs.length === 0)
|
|
25
|
+
return ENDED;
|
|
26
|
+
const counted = jobs.length === 1 ? '1 background job' : `${jobs.length} background jobs`;
|
|
27
|
+
return `${ENDED} ${counted} stopped: ${jobsRunning(jobs, now).join(', ')}`;
|
|
28
|
+
}
|
package/dist/live.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ChangeSet } from './change-set.js';
|
|
2
2
|
import { type KeyedResult, type QueryMessage } from './observation.js';
|
|
3
3
|
import type { PendingResult, Plan, QueryCoverage } from './query.js';
|
|
4
|
+
import type { Fail } from './reach.js';
|
|
4
5
|
import type { QueryRoom } from './tables.js';
|
|
5
6
|
export type Cover = {
|
|
6
7
|
coverage: QueryCoverage;
|
|
@@ -14,7 +15,7 @@ type Listener = (message: QueryMessage) => void;
|
|
|
14
15
|
export type LiveQueries = {
|
|
15
16
|
touched(set: ChangeSet): void;
|
|
16
17
|
recover(): void;
|
|
17
|
-
watch(plan: Plan, identity: string, cover: () => Cover, deliver: Listener): () => void;
|
|
18
|
+
watch(plan: Plan, identity: string, cover: () => Cover, deliver: Listener, failed: Fail): () => void;
|
|
18
19
|
close(): void;
|
|
19
20
|
};
|
|
20
21
|
export declare function createLiveQueries(run: Run): LiveQueries;
|
package/dist/live.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,KAAK,GAAG;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,GAAG,aAAa,CAAC;AAE7F,MAAM,MAAM,GAAG,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEnE,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;AAchD,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,CACH,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,KAAK,EAClB,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,IAAI,GACX,MAAM,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAmCF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CA0FvD"}
|