@agentshouse/mdruntime 0.1.0-cd507e16e5fc0 → 0.1.0-cd574a610e9c8
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 +21 -19
- package/dist/acceptance.d.ts +0 -3
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +75 -165
- package/dist/act-lanes.d.ts +30 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +225 -0
- package/dist/actions.d.ts +8 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +118 -67
- package/dist/adapter.d.ts +90 -58
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +0 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +0 -5
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +6 -19
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/change.d.ts +4 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +7 -2
- package/dist/chat-types.d.ts +0 -2
- package/dist/chat-types.d.ts.map +1 -1
- package/dist/chat-types.js +0 -2
- package/dist/client.d.ts +13 -20
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +36 -20
- package/dist/collection.d.ts +25 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +19 -2
- package/dist/column.d.ts +5 -0
- package/dist/column.d.ts.map +1 -0
- package/dist/column.js +9 -0
- package/dist/compile.d.ts +2 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +31 -25
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +31 -24
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +26 -12
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +23 -12
- package/dist/conversation-row.d.ts +8 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +20 -7
- package/dist/conversation.d.ts +37 -12
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +320 -234
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +19 -44
- package/dist/durability.d.ts +4 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +4 -0
- package/dist/entry.js +1 -1
- package/dist/expectation.d.ts +26 -13
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +72 -19
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -0
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/host.d.ts +18 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +59 -15
- package/dist/index.d.ts +16 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -7
- package/dist/install.d.ts +10 -6
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +92 -111
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +54 -40
- package/dist/listing.d.ts +11 -12
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +48 -72
- package/dist/live.d.ts +5 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +74 -33
- package/dist/loaded.d.ts +5 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +40 -0
- package/dist/locks.d.ts +2 -4
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +10 -39
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +11 -23
- package/dist/media.d.ts +6 -1
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +68 -17
- package/dist/memory.d.ts +8 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +92 -33
- package/dist/messages.d.ts +12 -6
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +30 -38
- package/dist/model.d.ts +0 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -5
- package/dist/models.d.ts +4 -8
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +97 -139
- package/dist/observation.d.ts +27 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +184 -85
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +5 -5
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +5 -9
- package/dist/outcome.d.ts +13 -1
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +32 -2
- package/dist/overlay.d.ts +6 -2
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +37 -24
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +3 -58
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +10 -115
- package/dist/preparation.d.ts +27 -6
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +156 -68
- package/dist/presence.d.ts +58 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +231 -0
- package/dist/queries.d.ts +2 -2
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +67 -31
- package/dist/query.d.ts +0 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/questions.d.ts +1 -5
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +1 -7
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +480 -0
- package/dist/reach.d.ts +2 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +88 -26
- package/dist/react.d.ts +8 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +33 -1
- package/dist/readiness.d.ts +9 -3
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +3 -5
- package/dist/reads.d.ts +4 -2
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +11 -4
- package/dist/recovery.d.ts +3 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +29 -7
- package/dist/refresh.js +2 -2
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +5 -6
- package/dist/replica.d.ts +5 -11
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +15 -17
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +31 -8
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +273 -66
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +22 -18
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +45 -0
- package/dist/rows.d.ts +2 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +9 -10
- package/dist/runtime.d.ts +9 -18
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +42 -90
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +327 -229
- package/dist/saves.d.ts +4 -40
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +143 -714
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +4 -5
- package/dist/shared.d.ts +0 -5
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +4 -90
- package/dist/shown.d.ts +7 -5
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +77 -63
- package/dist/socket/lanes.d.ts +12 -4
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +34 -8
- package/dist/socket/session.d.ts +0 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket.d.ts +3 -6
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +5 -16
- package/dist/source.d.ts +5 -7
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +18 -6
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +18 -7
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +58 -24
- package/dist/store/rooms-shown.d.ts +8 -0
- package/dist/store/rooms-shown.d.ts.map +1 -0
- package/dist/store/rooms-shown.js +13 -0
- package/dist/store/space.d.ts +1 -1
- package/dist/store/space.d.ts.map +1 -1
- package/dist/store/space.js +0 -2
- package/dist/store/watchers.js +1 -2
- package/dist/store.d.ts +23 -14
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +46 -17
- package/dist/stored.d.ts +25 -14
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +83 -32
- package/dist/surface.d.ts +5 -3
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +25 -23
- package/dist/sync.d.ts +1 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +96 -92
- package/dist/tables.d.ts +16 -57
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +91 -332
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +6 -7
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +4 -10
- package/dist/wire.d.ts +53 -7
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +17 -4
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/job.d.ts +0 -33
- package/dist/job.d.ts.map +0 -1
- package/dist/job.js +0 -54
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
- package/dist/socket/rooms.d.ts +0 -44
- package/dist/socket/rooms.d.ts.map +0 -1
- package/dist/socket/rooms.js +0 -90
- package/dist/store/fences.d.ts +0 -16
- package/dist/store/fences.d.ts.map +0 -1
- package/dist/store/fences.js +0 -26
package/dist/overlay.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { apply,
|
|
1
|
+
import { apply, create, documentValue, parse, serialize, TYPE_FIELD, } from '@agentshouse/mdmodel';
|
|
2
|
+
import { definitionsAt } from './collection.js';
|
|
3
|
+
import { isPart, } from './change.js';
|
|
2
4
|
import { drafted, entriesIn, settling } from './shared.js';
|
|
3
5
|
import { ROW_WEIGHT } from './turn.js';
|
|
4
6
|
export function* acceptedBinaries(files) {
|
|
@@ -24,10 +26,6 @@ export function sameChange(left, right) {
|
|
|
24
26
|
left.author?.id === right.author?.id &&
|
|
25
27
|
left.author?.name === right.author?.name);
|
|
26
28
|
}
|
|
27
|
-
const EMPTY_FRONTMATTER = '---\n---\n';
|
|
28
|
-
function isPart(change) {
|
|
29
|
-
return change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble';
|
|
30
|
-
}
|
|
31
29
|
function at(path, name) {
|
|
32
30
|
return `${path} ${name}`;
|
|
33
31
|
}
|
|
@@ -53,16 +51,27 @@ function* priorsOf(preconditions) {
|
|
|
53
51
|
preamble: (path) => preambles.get(path) ?? '',
|
|
54
52
|
};
|
|
55
53
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
export function composed(path, fields, sections, composition) {
|
|
55
|
+
const declared = fields[TYPE_FIELD];
|
|
56
|
+
const type = typeof declared === 'string' && declared !== '' ? declared : undefined;
|
|
57
|
+
const definition = definitionsAt(composition, path)(type);
|
|
58
|
+
return apply(create(type, definition), [
|
|
59
|
+
...Object.entries(fields).flatMap(([name, value]) => (name !== TYPE_FIELD || type === undefined) && documentValue(value)
|
|
60
|
+
? [{ kind: 'field', name, value, prior: undefined }]
|
|
61
|
+
: []),
|
|
62
|
+
...Object.entries(sections).map(([name, value]) => ({
|
|
63
|
+
kind: 'section',
|
|
64
|
+
name,
|
|
65
|
+
value,
|
|
66
|
+
prior: undefined,
|
|
67
|
+
})),
|
|
68
|
+
], definition);
|
|
69
|
+
}
|
|
70
|
+
export function compose(path, fields, sections, composition) {
|
|
71
|
+
const next = composed(path, fields, sections, composition);
|
|
72
|
+
if (next.outcome !== 'applied')
|
|
73
|
+
throw new Error(`the creation of ${path} writes no document`);
|
|
74
|
+
return serialize(next.document);
|
|
66
75
|
}
|
|
67
76
|
function edited(change, priors) {
|
|
68
77
|
if (change.kind === 'field')
|
|
@@ -81,17 +90,19 @@ function edited(change, priors) {
|
|
|
81
90
|
prior: priors.section(change.path, change.name),
|
|
82
91
|
};
|
|
83
92
|
}
|
|
84
|
-
function edit(staged, changes, priors) {
|
|
93
|
+
function edit(staged, changes, priors, composition) {
|
|
85
94
|
const path = changes[0].path;
|
|
86
95
|
delete staged.revisions[path];
|
|
87
96
|
const text = staged.documents[path];
|
|
88
97
|
if (text === undefined)
|
|
89
98
|
return changes.length;
|
|
90
|
-
const
|
|
99
|
+
const definitions = definitionsAt(composition, path);
|
|
100
|
+
const parsed = parse(text, path, definitions);
|
|
91
101
|
if (!parsed.ok)
|
|
92
102
|
return changes.length;
|
|
103
|
+
const definition = definitions(parsed.document.type);
|
|
93
104
|
const wanted = changes.map((change) => edited(change, priors));
|
|
94
|
-
const first = apply(parsed.document, wanted);
|
|
105
|
+
const first = apply(parsed.document, wanted, definition);
|
|
95
106
|
if (first.outcome === 'refuse')
|
|
96
107
|
return changes.length;
|
|
97
108
|
if (first.outcome === 'applied') {
|
|
@@ -100,7 +111,7 @@ function edit(staged, changes, priors) {
|
|
|
100
111
|
}
|
|
101
112
|
const stale = new Set(first.stale);
|
|
102
113
|
const kept = wanted.filter((_, at) => !stale.has(at));
|
|
103
|
-
const rest = apply(parsed.document, kept);
|
|
114
|
+
const rest = apply(parsed.document, kept, definition);
|
|
104
115
|
if (rest.outcome !== 'applied')
|
|
105
116
|
return changes.length;
|
|
106
117
|
staged.documents[path] = serialize(rest.document);
|
|
@@ -151,10 +162,12 @@ function erase(staged, path) {
|
|
|
151
162
|
delete staged.changes[path];
|
|
152
163
|
delete staged.binaries[path];
|
|
153
164
|
}
|
|
154
|
-
function stage(staged, change) {
|
|
165
|
+
function stage(staged, change, composition) {
|
|
155
166
|
if (change.kind === 'create') {
|
|
156
167
|
staged.documents[change.path] =
|
|
157
|
-
'content' in change
|
|
168
|
+
'content' in change
|
|
169
|
+
? change.content
|
|
170
|
+
: compose(change.path, change.fields, change.sections, composition);
|
|
158
171
|
delete staged.fileIds[change.path];
|
|
159
172
|
delete staged.created[change.path];
|
|
160
173
|
delete staged.changes[change.path];
|
|
@@ -206,7 +219,7 @@ function arrive(heads, change) {
|
|
|
206
219
|
if (change.change !== undefined)
|
|
207
220
|
heads.changes[change.path] = change.change;
|
|
208
221
|
}
|
|
209
|
-
export function* overlaying(base, queue, unapplied) {
|
|
222
|
+
export function* overlaying(base, queue, composition, unapplied) {
|
|
210
223
|
const staged = {
|
|
211
224
|
documents: drafted(base.documents),
|
|
212
225
|
binaries: drafted(base.binaries),
|
|
@@ -220,7 +233,7 @@ export function* overlaying(base, queue, unapplied) {
|
|
|
220
233
|
for (let index = 0; index < batch.changes.length; index += 1) {
|
|
221
234
|
const change = batch.changes[index];
|
|
222
235
|
if (!isPart(change)) {
|
|
223
|
-
if (!stage(staged, change))
|
|
236
|
+
if (!stage(staged, change, composition))
|
|
224
237
|
unapplied?.();
|
|
225
238
|
yield ROW_WEIGHT;
|
|
226
239
|
continue;
|
|
@@ -234,7 +247,7 @@ export function* overlaying(base, queue, unapplied) {
|
|
|
234
247
|
index += 1;
|
|
235
248
|
}
|
|
236
249
|
const text = staged.documents[change.path] ?? '';
|
|
237
|
-
for (let left = edit(staged, run, priors); left > 0; left -= 1)
|
|
250
|
+
for (let left = edit(staged, run, priors, composition); left > 0; left -= 1)
|
|
238
251
|
unapplied?.();
|
|
239
252
|
yield ROW_WEIGHT + text.length;
|
|
240
253
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PAGE_METADATA_WORDS: {
|
|
2
|
+
readonly heading: 'Page metadata';
|
|
3
|
+
readonly app: 'App';
|
|
4
|
+
readonly address: 'Address';
|
|
5
|
+
readonly queries: 'Local Queries';
|
|
6
|
+
};
|
|
7
|
+
export declare function pageMetadataBlock(app: string, address: string, queries: readonly unknown[]): string;
|
|
8
|
+
//# sourceMappingURL=page-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-metadata.d.ts","sourceRoot":"","sources":["../src/page-metadata.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;aAC9B,OAAO,EAAE,eAAe;aACxB,GAAG,EAAE,KAAK;aACV,OAAO,EAAE,SAAS;aAClB,OAAO,EAAE,eAAe;CAChB,CAAC;AAIX,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,OAAO,EAAE,GAC1B,MAAM,CAUR"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { queryKey } from '@agentshouse/mdmodel';
|
|
2
|
+
export const PAGE_METADATA_WORDS = {
|
|
3
|
+
heading: 'Page metadata',
|
|
4
|
+
app: 'App',
|
|
5
|
+
address: 'Address',
|
|
6
|
+
queries: 'Local Queries',
|
|
7
|
+
};
|
|
8
|
+
const PAGE_METADATA_QUERIES = 10;
|
|
9
|
+
export function pageMetadataBlock(app, address, queries) {
|
|
10
|
+
const held = [...new Set(queries.map(queryKey))];
|
|
11
|
+
return [
|
|
12
|
+
PAGE_METADATA_WORDS.heading,
|
|
13
|
+
`${PAGE_METADATA_WORDS.app}: ${app}`,
|
|
14
|
+
`${PAGE_METADATA_WORDS.address}: ${address}`,
|
|
15
|
+
...(held.length === 0 || held.length > PAGE_METADATA_QUERIES
|
|
16
|
+
? []
|
|
17
|
+
: [`${PAGE_METADATA_WORDS.queries}:`, ...held]),
|
|
18
|
+
].join('\n');
|
|
19
|
+
}
|
package/dist/parts.d.ts
CHANGED
|
@@ -1,59 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
readonly content: string;
|
|
5
|
-
readonly status: string;
|
|
6
|
-
};
|
|
7
|
-
export type Marker = 'mode' | 'compaction' | 'retry' | 'model' | 'job';
|
|
8
|
-
export type Part = {
|
|
9
|
-
readonly type: 'text';
|
|
10
|
-
readonly text: string;
|
|
11
|
-
} | {
|
|
12
|
-
readonly type: 'reasoning';
|
|
13
|
-
readonly text: string;
|
|
14
|
-
} | {
|
|
15
|
-
readonly type: 'commands';
|
|
16
|
-
readonly count: number;
|
|
17
|
-
} | {
|
|
18
|
-
readonly type: 'subagent';
|
|
19
|
-
readonly description: string;
|
|
20
|
-
readonly done: boolean;
|
|
21
|
-
readonly result: string | null;
|
|
22
|
-
} | {
|
|
23
|
-
readonly type: 'message';
|
|
24
|
-
readonly command: string;
|
|
25
|
-
readonly target: string | null;
|
|
26
|
-
} | {
|
|
27
|
-
readonly type: 'image';
|
|
28
|
-
readonly path: string;
|
|
29
|
-
readonly name: string;
|
|
30
|
-
readonly mediaType: string;
|
|
31
|
-
} | {
|
|
32
|
-
readonly type: 'marker';
|
|
33
|
-
readonly marker: Marker;
|
|
34
|
-
readonly text: string;
|
|
35
|
-
} | {
|
|
36
|
-
readonly type: 'plan';
|
|
37
|
-
readonly steps: readonly PlanStep[];
|
|
38
|
-
};
|
|
39
|
-
export declare function partsOf(raw: readonly unknown[]): readonly Part[];
|
|
40
|
-
export declare function contextIn(raw: unknown): TurnContext | null;
|
|
41
|
-
export type Turn = {
|
|
42
|
-
readonly turn: string;
|
|
43
|
-
readonly parts: readonly Part[];
|
|
44
|
-
readonly ended: boolean;
|
|
45
|
-
};
|
|
46
|
-
export type ChatWork = {
|
|
47
|
-
readonly kind: 'job' | 'schedule' | 'subagent';
|
|
48
|
-
readonly title: string;
|
|
49
|
-
readonly next: string | null;
|
|
50
|
-
readonly activity: string | null;
|
|
51
|
-
};
|
|
52
|
-
export declare function counted(count: number): string;
|
|
53
|
-
export declare function runningLine(raw: readonly unknown[]): string | null;
|
|
54
|
-
export declare function jobsOf(markers: readonly JobMarker[], turn: {
|
|
55
|
-
readonly started: string | null;
|
|
56
|
-
readonly parts: readonly unknown[];
|
|
57
|
-
} | null): readonly OpenJob[];
|
|
58
|
-
export declare function stillRunning(turns: readonly Turn[], subagents: readonly RunningSubagent[]): ReadonlyMap<string, readonly ChatWork[]>;
|
|
1
|
+
import { type Part } from '@agentshouse/session-content';
|
|
2
|
+
export declare function currentStep(parts: readonly Part[]): string | null;
|
|
3
|
+
export declare function runningLine(parts: readonly Part[]): string | null;
|
|
59
4
|
//# sourceMappingURL=parts.d.ts.map
|
package/dist/parts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../src/parts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../src/parts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGhE,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,GAAG,IAAI,CAGjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,GAAG,IAAI,CAKjE"}
|
package/dist/parts.js
CHANGED
|
@@ -1,118 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { excerpt
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return said === null ? null : { type: part.type, text: said };
|
|
11
|
-
}
|
|
12
|
-
case 'commands':
|
|
13
|
-
return typeof part.count === 'number' ? { type: 'commands', count: part.count } : null;
|
|
14
|
-
case 'subagent':
|
|
15
|
-
return {
|
|
16
|
-
type: 'subagent',
|
|
17
|
-
description: text(part, 'description') ?? '',
|
|
18
|
-
done: part.status === 'done',
|
|
19
|
-
result: text(part, 'result'),
|
|
20
|
-
};
|
|
21
|
-
case 'message': {
|
|
22
|
-
const command = text(part, 'command');
|
|
23
|
-
return command === null ? null : { type: 'message', command, target: text(part, 'target') };
|
|
24
|
-
}
|
|
25
|
-
case 'image': {
|
|
26
|
-
const path = text(part, 'file');
|
|
27
|
-
const name = text(part, 'name');
|
|
28
|
-
return path === null || name === null
|
|
29
|
-
? null
|
|
30
|
-
: { type: 'image', path, name, mediaType: text(part, 'media_type') ?? '' };
|
|
31
|
-
}
|
|
32
|
-
case 'marker': {
|
|
33
|
-
const marker = text(part, 'marker');
|
|
34
|
-
return marker === null || !MARKERS.includes(marker)
|
|
35
|
-
? null
|
|
36
|
-
: { type: 'marker', marker: marker, text: text(part, 'text') ?? '' };
|
|
37
|
-
}
|
|
38
|
-
case 'plan':
|
|
39
|
-
return {
|
|
40
|
-
type: 'plan',
|
|
41
|
-
steps: list(part, 'entries').flatMap((entry) => {
|
|
42
|
-
const step = record(entry);
|
|
43
|
-
const content = text(step, 'content');
|
|
44
|
-
return content === null ? [] : [{ content, status: text(step, 'status') ?? '' }];
|
|
45
|
-
}),
|
|
46
|
-
};
|
|
47
|
-
default:
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export function partsOf(raw) {
|
|
52
|
-
return raw.flatMap((one) => partOf(one) ?? []);
|
|
53
|
-
}
|
|
54
|
-
export function contextIn(raw) {
|
|
55
|
-
const held = record(raw);
|
|
56
|
-
return typeof held.used === 'number' && typeof held.window === 'number' && held.window > 0
|
|
57
|
-
? { used: held.used, window: held.window }
|
|
58
|
-
: null;
|
|
59
|
-
}
|
|
60
|
-
export function counted(count) {
|
|
61
|
-
return count === 1 ? '1 command' : `${count} commands`;
|
|
62
|
-
}
|
|
63
|
-
export function runningLine(raw) {
|
|
64
|
-
const parts = partsOf(raw);
|
|
65
|
-
const note = [...parts].reverse().find((part) => part.type === 'text' && part.text.trim() !== '');
|
|
1
|
+
import { isOwn } from '@agentshouse/session-content';
|
|
2
|
+
import { excerpt } from './read.js';
|
|
3
|
+
export function currentStep(parts) {
|
|
4
|
+
const call = [...parts].reverse().find((part) => part.type === 'call');
|
|
5
|
+
return call?.type === 'call' && call.line !== '' ? call.line : null;
|
|
6
|
+
}
|
|
7
|
+
export function runningLine(parts) {
|
|
8
|
+
const own = parts.filter(isOwn);
|
|
9
|
+
const note = [...own].reverse().find((part) => part.type === 'text' && part.text.trim() !== '');
|
|
66
10
|
if (note?.type === 'text')
|
|
67
11
|
return excerpt(note.text);
|
|
68
|
-
|
|
69
|
-
return commands === 0 ? null : counted(commands);
|
|
70
|
-
}
|
|
71
|
-
export function jobsOf(markers, turn) {
|
|
72
|
-
const running = (turn === null ? [] : partsOf(turn.parts)).flatMap((part) => part.type === 'marker' && part.marker === 'job'
|
|
73
|
-
? [{ said: part.text, at: turn?.started ?? null }]
|
|
74
|
-
: []);
|
|
75
|
-
return openJobs([...markers, ...running]);
|
|
76
|
-
}
|
|
77
|
-
export function stillRunning(turns, subagents) {
|
|
78
|
-
const open = [];
|
|
79
|
-
for (const { turn, parts, ended } of turns) {
|
|
80
|
-
for (const part of parts) {
|
|
81
|
-
if (part.type === 'subagent') {
|
|
82
|
-
const key = `subagent\u0000${part.description}`;
|
|
83
|
-
if (part.done)
|
|
84
|
-
closeLast(open, key);
|
|
85
|
-
else if (ended) {
|
|
86
|
-
open.push({
|
|
87
|
-
turn,
|
|
88
|
-
key,
|
|
89
|
-
work: { kind: 'subagent', title: part.description, next: null, activity: null },
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (part.type !== 'marker' || part.marker !== 'job')
|
|
95
|
-
continue;
|
|
96
|
-
markerMoved(open, part.text, (job, key) => ended
|
|
97
|
-
? {
|
|
98
|
-
turn,
|
|
99
|
-
key,
|
|
100
|
-
work: {
|
|
101
|
-
kind: job.kind === 'started' ? 'job' : 'schedule',
|
|
102
|
-
title: job.label,
|
|
103
|
-
next: job.next,
|
|
104
|
-
activity: null,
|
|
105
|
-
},
|
|
106
|
-
}
|
|
107
|
-
: null);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const doing = [...subagents];
|
|
111
|
-
const under = new Map();
|
|
112
|
-
for (const { turn, work } of open) {
|
|
113
|
-
const at = work.kind === 'subagent' ? doing.findIndex((one) => one.description === work.title) : -1;
|
|
114
|
-
const shown = at === -1 ? work : { ...work, activity: doing.splice(at, 1)[0].activity };
|
|
115
|
-
under.set(turn, [...(under.get(turn) ?? []), shown]);
|
|
116
|
-
}
|
|
117
|
-
return under;
|
|
12
|
+
return currentStep(own);
|
|
118
13
|
}
|
package/dist/preparation.d.ts
CHANGED
|
@@ -1,20 +1,41 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type InstallShare } from './install.js';
|
|
2
|
+
import { type ReadinessChange } from './observation.js';
|
|
2
3
|
import { type PortReach } from './reach.js';
|
|
3
|
-
import { type CodeAvailability, type ConnectionAvailability, type Readiness } from './readiness.js';
|
|
4
|
+
import { type CodeAvailability, type ConnectionAvailability, type Readiness, type RoomCoverage } from './readiness.js';
|
|
4
5
|
import type { Runtime } from './runtime.js';
|
|
5
6
|
export type ReadinessPort = {
|
|
6
7
|
readonly target: string;
|
|
7
8
|
readonly code: CodeAvailability;
|
|
8
9
|
};
|
|
10
|
+
export type ReadinessMessage = Readiness | ReadinessChange;
|
|
9
11
|
export type ReadinessWatch = {
|
|
10
12
|
readonly port: ReadinessPort;
|
|
11
13
|
readonly reach: PortReach | null;
|
|
12
|
-
readonly deliver: (readiness:
|
|
14
|
+
readonly deliver: (readiness: ReadinessMessage) => void;
|
|
15
|
+
};
|
|
16
|
+
type Share = InstallShare & {
|
|
17
|
+
readonly coverage: RoomCoverage;
|
|
18
|
+
};
|
|
19
|
+
type Totals = {
|
|
20
|
+
installing: number;
|
|
21
|
+
downloading: number;
|
|
22
|
+
acquiring: number;
|
|
23
|
+
unsettled: number;
|
|
24
|
+
done: number;
|
|
25
|
+
total: number;
|
|
26
|
+
};
|
|
27
|
+
export type ReadinessShowing = {
|
|
28
|
+
readonly listing: number;
|
|
29
|
+
readonly roomsListed: boolean;
|
|
30
|
+
readonly named: ReadonlySet<string> | null;
|
|
31
|
+
readonly rooms: Map<string, Share>;
|
|
32
|
+
readonly totals: Totals;
|
|
33
|
+
shown: string;
|
|
13
34
|
};
|
|
14
35
|
export declare function prepare(runtime: Runtime, locators?: readonly string[]): void;
|
|
15
|
-
export declare function roomsOfReach(reach: PlanReach): ReadonlySet<string>;
|
|
16
36
|
export declare function connectionNow(runtime: Runtime): Promise<ConnectionAvailability>;
|
|
17
|
-
export declare function deliverOwedReadiness(runtime: Runtime, owed: readonly ReadinessWatch[]): Promise<void>;
|
|
18
|
-
export declare function watchReadiness({ store }: Runtime, port: ReadinessPort, reach: PortReach | null, deliver: (readiness:
|
|
37
|
+
export declare function deliverOwedReadiness(runtime: Runtime, owed: readonly ReadinessWatch[], touched: ReadonlySet<string> | null): Promise<void>;
|
|
38
|
+
export declare function watchReadiness({ store }: Runtime, port: ReadinessPort, reach: PortReach | null, deliver: (readiness: ReadinessMessage) => void): () => void;
|
|
19
39
|
export declare function filled(runtime: Runtime): void;
|
|
40
|
+
export {};
|
|
20
41
|
//# sourceMappingURL=preparation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preparation.d.ts","sourceRoot":"","sources":["../src/preparation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"preparation.d.ts","sourceRoot":"","sources":["../src/preparation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAE3B,KAAK,SAAS,EAEd,KAAK,YAAY,EAElB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,eAAe,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACzD,CAAC;AAEF,KAAK,KAAK,GAAG,YAAY,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAC;AAEhE,KAAK,MAAM,GAAG;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwCF,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAE,SAAS,MAAM,EAAO,QA4BzE;AAuDD,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAMrF;AAkMD,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,SAAS,cAAc,EAAE,EAC/B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,iBAKpC;AAED,wBAAgB,cAAc,CAC5B,EAAE,KAAK,EAAE,EAAE,OAAO,EAClB,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,SAAS,GAAG,IAAI,EACvB,OAAO,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,IAAI,GAC7C,MAAM,IAAI,CAQZ;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,QAKtC"}
|