@agentshouse/mdruntime 0.1.0-cee9c8aa4cd86 → 0.1.0-cf1e7fdb9c600
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 +96 -63
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +2 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +28 -4
- 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/client.d.ts +12 -12
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -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 +1 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +118 -247
- package/dist/connection.d.ts +11 -11
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1602 -1147
- 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 -14
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +266 -150
- package/dist/durability.d.ts +1 -5
- 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 +15 -6
- 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 -6
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +49 -35
- 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 +11 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +178 -100
- package/dist/messages.d.ts +2 -2
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +15 -16
- package/dist/model.d.ts +7 -3
- 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 -205
- 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 +81 -71
- package/dist/react.d.ts +3 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +13 -16
- 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 +104 -30
- package/dist/replica.d.ts +6 -5
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +8 -7
- package/dist/room-draft.d.ts +20 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +131 -51
- package/dist/rows.d.ts +8 -15
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +51 -151
- 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 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- 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 +32 -30
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +64 -58
- package/dist/stored.d.ts +42 -18
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +193 -194
- package/dist/tables.d.ts +60 -39
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +77 -59
- 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 +6 -9
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +3 -3
- package/package.json +11 -18
- package/AGENTS.md +0 -320
- 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 -254
- package/dist/chat/messages.d.ts +0 -35
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -210
- 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 -307
- package/dist/chat.d.ts +0 -15
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -368
- package/dist/reads.d.ts +0 -11
- package/dist/reads.d.ts.map +0 -1
- package/dist/reads.js +0 -98
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/durability.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import type { Persistence } from './readiness.js';
|
|
2
|
-
export type StorageEstimate = {
|
|
3
|
-
readonly usage: number;
|
|
4
|
-
readonly total: number;
|
|
5
|
-
};
|
|
6
2
|
export type RuntimeShell = {
|
|
7
3
|
persistence: Persistence;
|
|
8
4
|
generation: string | null;
|
|
9
5
|
keepGeneration(value: string): void | Promise<void>;
|
|
10
6
|
dropGeneration(): void | Promise<void>;
|
|
11
|
-
estimate?(): Promise<StorageEstimate | null>;
|
|
12
7
|
cleanUp?(): Promise<number>;
|
|
13
8
|
};
|
|
9
|
+
export declare function refusedForSpace(error: unknown): boolean;
|
|
14
10
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
15
11
|
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
|
16
12
|
//# 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,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;CAC7B,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;AAK9B,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAEnE,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,CAoDZ"}
|
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
4
|
import { NO_MODEL } from './model.js';
|
|
4
|
-
import {
|
|
5
|
+
import { planWithin } from './query.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) {
|
|
@@ -123,14 +131,15 @@ export function entryScope(rooms, roomTypes, connection) {
|
|
|
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
|
+
outline: null,
|
|
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,21 +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
27
|
export type { RuntimePort } from './wire.js';
|
|
31
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,iBA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AS,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,5 +1,6 @@
|
|
|
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
5
|
import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
|
|
5
6
|
const NARROWED = new Set(['within', 'whole']);
|
|
@@ -25,8 +26,10 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
25
26
|
return md.binaryFile.read(input[0], input[1], input[2]);
|
|
26
27
|
case 'binaryFile.link':
|
|
27
28
|
return md.binaryFile.link(input[0], input[1], input[2]);
|
|
28
|
-
case 'binaryFile.
|
|
29
|
-
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]);
|
|
30
33
|
case 'binaryFile.part':
|
|
31
34
|
return md.binaryFile.part(input[0], input[1]);
|
|
32
35
|
case 'call':
|
|
@@ -48,7 +51,7 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
48
51
|
case 'roomDraft.read':
|
|
49
52
|
return md.roomDraft.read(input[0], input[1]);
|
|
50
53
|
case 'roomDraft.write':
|
|
51
|
-
return md.roomDraft.write(input[0], input[1], input[2], input[3]);
|
|
54
|
+
return md.roomDraft.write(input[0], input[1], input[2], input[3], input[4]);
|
|
52
55
|
case 'roomDraft.discard':
|
|
53
56
|
return md.roomDraft.discard(input[0], input[1], input[2]);
|
|
54
57
|
case 'presentation.read':
|
|
@@ -65,16 +68,12 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
65
68
|
return md.conversation.create(input[0]);
|
|
66
69
|
case 'conversation.send':
|
|
67
70
|
return md.conversation.send(input[0], input[1], input[2]);
|
|
68
|
-
case 'conversation.attach':
|
|
69
|
-
return md.conversation.attach(input[0], input[1]);
|
|
70
71
|
case 'conversation.answer':
|
|
71
72
|
return md.conversation.answer(input[0], input[1]);
|
|
72
73
|
case 'conversation.interrupt':
|
|
73
74
|
return md.conversation.interrupt(input[0]);
|
|
74
75
|
case 'conversation.kill':
|
|
75
76
|
return md.conversation.kill(input[0]);
|
|
76
|
-
case 'conversation.cancel':
|
|
77
|
-
return md.conversation.cancel(input[0], input[1]);
|
|
78
77
|
case 'conversation.delete':
|
|
79
78
|
return md.conversation.delete(input[0]);
|
|
80
79
|
case 'chatDraft.write':
|
|
@@ -85,6 +84,14 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
85
84
|
return md.chatDraft.discard(input[0]);
|
|
86
85
|
}
|
|
87
86
|
}
|
|
87
|
+
function attempted(work) {
|
|
88
|
+
try {
|
|
89
|
+
return Promise.resolve(work());
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
return Promise.reject(error);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
88
95
|
function answeredResult(value) {
|
|
89
96
|
return typeof value === 'object' && value !== null && !('pending' in value);
|
|
90
97
|
}
|
|
@@ -106,16 +113,17 @@ export function serveMdRuntime(options) {
|
|
|
106
113
|
const { md } = runtime;
|
|
107
114
|
const attachments = new Map();
|
|
108
115
|
let authorized = true;
|
|
116
|
+
let opening = null;
|
|
117
|
+
const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal));
|
|
109
118
|
const watchFacts = (deliver) => {
|
|
110
119
|
deliver(structuredClone(deploymentFacts));
|
|
111
120
|
return () => { };
|
|
112
121
|
};
|
|
113
|
-
function attach(port, app, release, reach, code = 'stored'
|
|
122
|
+
function attach(port, app, release, reach, code = 'stored') {
|
|
114
123
|
if (!authorized)
|
|
115
124
|
throw new Error(AUTHORIZATION_ENDED);
|
|
116
125
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
117
|
-
|
|
118
|
-
const view = runtime.within(reach ?? null, facts);
|
|
126
|
+
const view = runtime.within(reach ?? null, { target: app, code });
|
|
119
127
|
const observations = new Map();
|
|
120
128
|
const followed = new Set();
|
|
121
129
|
const answeredKeys = new Set();
|
|
@@ -153,9 +161,30 @@ export function serveMdRuntime(options) {
|
|
|
153
161
|
if (topic === 'query' && answeredMessage(value))
|
|
154
162
|
answeredQuery(input[0]);
|
|
155
163
|
};
|
|
164
|
+
const fail = (error) => {
|
|
165
|
+
if (!serving || resolved)
|
|
166
|
+
return;
|
|
167
|
+
observations.get(id)?.();
|
|
168
|
+
observations.delete(id);
|
|
169
|
+
send({ kind: 'failure', id, ...described(error) });
|
|
170
|
+
};
|
|
156
171
|
observations.set(id, topic === 'deployment-facts'
|
|
157
172
|
? watchFacts(deliver)
|
|
158
|
-
: (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
|
|
173
|
+
: (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver, fail));
|
|
174
|
+
};
|
|
175
|
+
const reply = async (id, query, pending) => {
|
|
176
|
+
try {
|
|
177
|
+
const value = await pending;
|
|
178
|
+
if (!serving)
|
|
179
|
+
return;
|
|
180
|
+
send({ kind: 'result', id, value });
|
|
181
|
+
if (query !== undefined && answeredResult(value))
|
|
182
|
+
answeredQuery(query);
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
if (serving)
|
|
186
|
+
send({ kind: 'failure', id, ...described(error) });
|
|
187
|
+
}
|
|
159
188
|
};
|
|
160
189
|
const serve = async (message) => {
|
|
161
190
|
if (message.kind === 'hello')
|
|
@@ -166,24 +195,24 @@ export function serveMdRuntime(options) {
|
|
|
166
195
|
return;
|
|
167
196
|
}
|
|
168
197
|
try {
|
|
169
|
-
if (message.kind !== 'observe'
|
|
198
|
+
if (message.kind !== 'observe')
|
|
170
199
|
await md.loaded();
|
|
200
|
+
else if (message.topic !== 'room-drafts')
|
|
201
|
+
await opened();
|
|
171
202
|
if (message.kind === 'observe') {
|
|
172
203
|
if (serving)
|
|
173
204
|
observe(message.id, message.topic, message.input);
|
|
174
205
|
return;
|
|
175
206
|
}
|
|
176
|
-
const value = await answered(NARROWED.has(WIRE.members[message.member].reach) ? view.md : md, app, writtenBy, message.member, message.input);
|
|
177
|
-
if (!serving)
|
|
178
|
-
return;
|
|
179
|
-
send({ kind: 'result', id: message.id, value });
|
|
180
|
-
if (message.member === 'query' && answeredResult(value))
|
|
181
|
-
answeredQuery(message.input[0]);
|
|
182
207
|
}
|
|
183
208
|
catch (error) {
|
|
184
209
|
if (serving)
|
|
185
210
|
send({ kind: 'failure', id: message.id, ...described(error) });
|
|
211
|
+
return;
|
|
186
212
|
}
|
|
213
|
+
const { id, member, input } = message;
|
|
214
|
+
const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? view.md : md, app, writtenBy, member, input));
|
|
215
|
+
return reply(id, member === 'query' ? input[0] : undefined, pending);
|
|
187
216
|
};
|
|
188
217
|
port.addEventListener('message', (event) => {
|
|
189
218
|
if (!serving)
|
|
@@ -202,18 +231,6 @@ export function serveMdRuntime(options) {
|
|
|
202
231
|
if (serving)
|
|
203
232
|
view.narrow(next);
|
|
204
233
|
},
|
|
205
|
-
code(next, capacity) {
|
|
206
|
-
if (!serving)
|
|
207
|
-
return;
|
|
208
|
-
facts = { ...facts, code: next, capacity };
|
|
209
|
-
view.facts(facts);
|
|
210
|
-
},
|
|
211
|
-
search(next) {
|
|
212
|
-
if (!serving)
|
|
213
|
-
return;
|
|
214
|
-
facts = { ...facts, search: next };
|
|
215
|
-
view.facts(facts);
|
|
216
|
-
},
|
|
217
234
|
answered(queries, done) {
|
|
218
235
|
const keys = queries.map(queryKey);
|
|
219
236
|
if (keys.every((key) => answeredKeys.has(key)))
|
|
@@ -227,7 +244,7 @@ export function serveMdRuntime(options) {
|
|
|
227
244
|
const stop = view.watch('readiness', [], (value) => {
|
|
228
245
|
if (serving)
|
|
229
246
|
deliver(value);
|
|
230
|
-
});
|
|
247
|
+
}, () => { });
|
|
231
248
|
const end = () => {
|
|
232
249
|
followed.delete(end);
|
|
233
250
|
stop();
|
|
@@ -256,9 +273,6 @@ export function serveMdRuntime(options) {
|
|
|
256
273
|
await options.shell.dropGeneration();
|
|
257
274
|
}
|
|
258
275
|
},
|
|
259
|
-
lose(locators) {
|
|
260
|
-
return runtime.lose(locators);
|
|
261
|
-
},
|
|
262
276
|
stop() {
|
|
263
277
|
return runtime.stop();
|
|
264
278
|
},
|
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, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldContent, HeldFile, HeldRoom, ListedAgent, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, Outline, 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 } 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":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,OAAO,EACP,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACp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AE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,SAAS,EACT,aAAa,EACb,MAAM,EACN,UAAU,EACV,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
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"}
|
package/dist/live.js
CHANGED
|
@@ -38,7 +38,7 @@ export function createLiveQueries(run) {
|
|
|
38
38
|
for (const listener of entry.ready)
|
|
39
39
|
listener(change);
|
|
40
40
|
}
|
|
41
|
-
for (const listener of entry.fresh) {
|
|
41
|
+
for (const listener of entry.fresh.keys()) {
|
|
42
42
|
entry.ready.add(listener);
|
|
43
43
|
listener(next);
|
|
44
44
|
}
|
|
@@ -64,8 +64,12 @@ export function createLiveQueries(run) {
|
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
catch {
|
|
67
|
+
catch (error) {
|
|
68
68
|
entry.dirty = false;
|
|
69
|
+
const unanswered = [...entry.fresh.values()];
|
|
70
|
+
entry.fresh.clear();
|
|
71
|
+
for (const failed of unanswered)
|
|
72
|
+
failed(error);
|
|
69
73
|
}
|
|
70
74
|
finally {
|
|
71
75
|
entry.running = false;
|
|
@@ -87,14 +91,14 @@ export function createLiveQueries(run) {
|
|
|
87
91
|
schedule(entry);
|
|
88
92
|
}
|
|
89
93
|
},
|
|
90
|
-
watch(plan, identity, cover, listener) {
|
|
94
|
+
watch(plan, identity, cover, listener, failed) {
|
|
91
95
|
let entry = entries.get(identity);
|
|
92
96
|
if (entry === undefined) {
|
|
93
97
|
entry = {
|
|
94
98
|
plan,
|
|
95
99
|
cover,
|
|
96
100
|
listeners: new Set(),
|
|
97
|
-
fresh: new
|
|
101
|
+
fresh: new Map(),
|
|
98
102
|
ready: new Set(),
|
|
99
103
|
digest: undefined,
|
|
100
104
|
covered: '',
|
|
@@ -105,7 +109,7 @@ export function createLiveQueries(run) {
|
|
|
105
109
|
}
|
|
106
110
|
const held = entry;
|
|
107
111
|
held.listeners.add(listener);
|
|
108
|
-
held.fresh.
|
|
112
|
+
held.fresh.set(listener, failed);
|
|
109
113
|
schedule(held);
|
|
110
114
|
return () => {
|
|
111
115
|
held.listeners.delete(listener);
|
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MdRuntimeClient } from './client.js';
|
|
2
|
+
import { type ShownAnswer } from './outcome.js';
|
|
3
|
+
export declare const ROOM_MEDIA = "room-media";
|
|
4
|
+
type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
|
|
5
|
+
export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
|
|
6
|
+
export declare function defineRoomMedia(client: Promise<MdRuntimeClient> | MdRuntimeClient, registry?: CustomElementRegistry): void;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D,eAAO,MAAM,UAAU,eAAe,CAAC;AAwBvC,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAIpF,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,GAAG,eAAe,CAG5E;AAsBD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,EAClD,QAAQ,GAAE,qBAAsC,GAC/C,IAAI,CA0LN"}
|