@wirecat/cli-core 0.577.0 → 0.578.0
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/CHANGELOG.md +13 -2
- package/dist/cli/compact.d.ts +2 -0
- package/dist/cli/compact.js +1 -1
- package/dist/cli/messenger/projects-command.js +2 -0
- package/dist/cli/project-status-rows.d.ts +4 -2
- package/dist/cli/project-status-rows.js +13 -29
- package/dist/cli/project-status.d.ts +59 -16
- package/dist/cli/project-status.js +101 -42
- package/dist/services/project-status/signals/index.js +0 -2
- package/package.json +1 -1
- package/dist/services/project-status/signals/last-message.d.ts +0 -4
- package/dist/services/project-status/signals/last-message.js +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -5,8 +5,6 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
|
|
|
5
5
|
minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
|
|
6
6
|
shape of this file.
|
|
7
7
|
|
|
8
|
-
## Unreleased
|
|
9
|
-
|
|
10
8
|
## 0.577.0 — 05.11.2026
|
|
11
9
|
|
|
12
10
|
### Added
|
|
@@ -27,6 +25,19 @@ shape of this file.
|
|
|
27
25
|
holder with no mark yet is `mail.no-mark`. `rewindMark` is the function under it, and `MailActivityStore` gets
|
|
28
26
|
`emailsBefore`.
|
|
29
27
|
|
|
28
|
+
### Changed — may break callers
|
|
29
|
+
|
|
30
|
+
- **`projects status` fits 4 KB of JSON and 1.5 KB compact on the status fixture (was 11.2 KB and 3.6 KB).** Most of
|
|
31
|
+
it was rows the owner would not call status. Each chat's row now carries what is said once per chat: `last` (the
|
|
32
|
+
newest message's ref, time and sender), `next`, `waiting_since`, `addressed`, `overdue`, and for a chat held in part
|
|
33
|
+
`held` and `sync_command`; the `last_message`, `reply_next` and `coverage` lists are gone, and the `last-message`
|
|
34
|
+
signal with them (reply-next already cites the newest message). Others' questions in a group with no role, and
|
|
35
|
+
others' promises found by words in a group or past the newest one per chat, are counted on the chat's row under
|
|
36
|
+
`unlisted` instead of listed. A listed item drops `signal` and `chat_title`, keeps `evidence` (now plain refs) only
|
|
37
|
+
when it cites more than `ref`, and `who` only when set. `signals` is `{ id: version }`; a chat row leaves out
|
|
38
|
+
`purpose` when one purpose was read, `project` when it is the root, and `attention` when it is 0. `--compact` leaves
|
|
39
|
+
out `project`, `window`, `purposes` and `signals` (new `RowShape.hidden`). The human form is unchanged.
|
|
40
|
+
|
|
30
41
|
## 0.576.0 — 05.11.2026
|
|
31
42
|
|
|
32
43
|
### Added
|
package/dist/cli/compact.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface RowShape {
|
|
|
20
20
|
sections?: Readonly<Record<string, string>>;
|
|
21
21
|
/** An item answer's fields printed whole, never cut: a cursor that is pasted back. */
|
|
22
22
|
whole?: readonly string[];
|
|
23
|
+
/** An item answer's fields left out: bookkeeping an agent reads in `--json` if it ever needs it. */
|
|
24
|
+
hidden?: readonly string[];
|
|
23
25
|
}
|
|
24
26
|
export interface CompactOptions {
|
|
25
27
|
/** IANA zone for times; the answer's `meta.timezone` wins. */
|
package/dist/cli/compact.js
CHANGED
|
@@ -357,7 +357,7 @@ export const compactText = (body, shape, options, rowsOf = rowsOfEntity()) => {
|
|
|
357
357
|
}
|
|
358
358
|
else if (isFields(body.item)) {
|
|
359
359
|
const sections = shape.sections ?? {};
|
|
360
|
-
const rest = Object.fromEntries(Object.entries(body.item).filter(([name]) => !Object.hasOwn(sections, name)));
|
|
360
|
+
const rest = Object.fromEntries(Object.entries(body.item).filter(([name]) => !Object.hasOwn(sections, name) && !shape.hidden?.includes(name)));
|
|
361
361
|
lines = blockOf(rest, chars, "", shape.whole).map(guarded);
|
|
362
362
|
for (const [name, entity] of Object.entries(sections)) {
|
|
363
363
|
const list = body.item[name];
|
|
@@ -161,6 +161,8 @@ const statusCommand = (messenger) => answerEntity(annotate(new Command("status")
|
|
|
161
161
|
"who replies next, open questions both ways, promises, amounts with their direction, payments recorded, " +
|
|
162
162
|
"how long each --context-query has been quiet on their side, and how much of the chat is held. Amounts, " +
|
|
163
163
|
"directions and promises found by words are marked pattern: read the cited message before trusting one. " +
|
|
164
|
+
"Others' questions in a group with no role, and others' word-found promises in a group, are counted on " +
|
|
165
|
+
"the chat's row as unlisted, not listed. " +
|
|
164
166
|
"Only this profile's account is read; the other linked chats are named, and memo projects status reads them")
|
|
165
167
|
.argument("<project>", "an existing project's id, key, exact name or alias")
|
|
166
168
|
.option("--since-time <time>", "how far back: days (60d, at most 730d) or a start date (2026-09-01)", "60d")
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { RowShape } from "./compact.js";
|
|
2
|
+
/** Signals of one item per chat, drawn on the chat's row rather than as a list of their own. */
|
|
3
|
+
export declare const ON_CHAT_ROW: ReadonlySet<string>;
|
|
2
4
|
/**
|
|
3
|
-
* The compact row of each status signal's items, by `status.<signal id>`; a signal's file and its row are the
|
|
4
|
-
* places a new signal touches. They live here because a service may not import the CLI's row type.
|
|
5
|
+
* The compact row of each listed status signal's items, by `status.<signal id>`; a signal's file and its row are the
|
|
6
|
+
* two places a new signal touches. They live here because a service may not import the CLI's row type.
|
|
5
7
|
*/
|
|
6
8
|
export declare const STATUS_SIGNAL_ROWS: Readonly<Record<string, RowShape>>;
|
|
7
9
|
/** The rest of a `project_status` answer: its chats, open money, chats left out, and failed signals. */
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
const where = [{ field: "ref" }
|
|
1
|
+
const where = [{ field: "ref" }];
|
|
2
2
|
const who = { field: ["who.owner", "who.name"], tag: "you" };
|
|
3
|
+
/** Signals of one item per chat, drawn on the chat's row rather than as a list of their own. */
|
|
4
|
+
export const ON_CHAT_ROW = new Set(["reply-next", "coverage"]);
|
|
3
5
|
/**
|
|
4
|
-
* The compact row of each status signal's items, by `status.<signal id>`; a signal's file and its row are the
|
|
5
|
-
* places a new signal touches. They live here because a service may not import the CLI's row type.
|
|
6
|
+
* The compact row of each listed status signal's items, by `status.<signal id>`; a signal's file and its row are the
|
|
7
|
+
* two places a new signal touches. They live here because a service may not import the CLI's row type.
|
|
6
8
|
*/
|
|
7
9
|
export const STATUS_SIGNAL_ROWS = {
|
|
8
|
-
"status.last-message": { columns: [...where, { field: "at", as: "time" }, who] },
|
|
9
|
-
"status.reply-next": {
|
|
10
|
-
columns: [
|
|
11
|
-
...where,
|
|
12
|
-
{ field: "data.next" },
|
|
13
|
-
{ field: "data.addressed.name" },
|
|
14
|
-
{ field: "data.waiting_since", as: "day" },
|
|
15
|
-
{ field: "data.overdue", tag: "overdue" },
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
10
|
"status.questions": {
|
|
19
|
-
columns: [...where, { field: "at", as: "day" },
|
|
11
|
+
columns: [...where, { field: "at", as: "day" }, who],
|
|
20
12
|
text: ["data.excerpt"],
|
|
21
13
|
},
|
|
22
14
|
"status.promises": {
|
|
@@ -50,21 +42,10 @@ export const STATUS_SIGNAL_ROWS = {
|
|
|
50
42
|
columns: [
|
|
51
43
|
...where,
|
|
52
44
|
{ field: "data.query" },
|
|
53
|
-
{ field: "data.theirs_last", as: "day" },
|
|
54
45
|
{ field: "data.yours_last", as: "day" },
|
|
55
46
|
{ field: "data.silent_since", as: "day" },
|
|
56
47
|
],
|
|
57
48
|
},
|
|
58
|
-
"status.coverage": {
|
|
59
|
-
columns: [
|
|
60
|
-
{ field: "chat" },
|
|
61
|
-
{ field: "chat_title" },
|
|
62
|
-
{ field: "data.state" },
|
|
63
|
-
{ field: "data.held.messages", as: "count", tag: "held" },
|
|
64
|
-
{ field: "data.held.oldest_at", as: "day" },
|
|
65
|
-
{ field: "sync_command" },
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
49
|
"status.children": {
|
|
69
50
|
columns: [
|
|
70
51
|
{ field: "data.child" },
|
|
@@ -82,10 +63,14 @@ export const STATUS_ROWS = {
|
|
|
82
63
|
columns: [
|
|
83
64
|
{ field: "chat" },
|
|
84
65
|
{ field: "title" },
|
|
85
|
-
{ field: "kind" },
|
|
86
66
|
{ field: "role" },
|
|
87
|
-
{ field: "
|
|
88
|
-
{ field: "
|
|
67
|
+
{ field: "next", prefix: "next" },
|
|
68
|
+
{ field: "addressed.name" },
|
|
69
|
+
{ field: "waiting_since", as: "day" },
|
|
70
|
+
{ field: "overdue", tag: "overdue" },
|
|
71
|
+
{ field: "held.messages", as: "count", tag: "held" },
|
|
72
|
+
{ field: "unlisted.questions", as: "count", tag: "questions unlisted" },
|
|
73
|
+
{ field: "unlisted.promises", as: "count", tag: "promises unlisted" },
|
|
89
74
|
],
|
|
90
75
|
},
|
|
91
76
|
"status.money": {
|
|
@@ -96,7 +81,6 @@ export const STATUS_ROWS = {
|
|
|
96
81
|
{ field: "rows", as: "count", tag: "rows" },
|
|
97
82
|
],
|
|
98
83
|
},
|
|
99
|
-
"status.signal": { columns: [{ field: "id" }, { field: "version" }] },
|
|
100
84
|
"status.out-of-scope": {
|
|
101
85
|
columns: [
|
|
102
86
|
{ field: "chat" },
|
|
@@ -18,7 +18,7 @@ export interface ProjectStatusHints {
|
|
|
18
18
|
chatId: Id;
|
|
19
19
|
}, since: string) => NextStep | null;
|
|
20
20
|
}
|
|
21
|
-
/** The `project_status` answer drawn by `--compact`: each signal
|
|
21
|
+
/** The `project_status` answer drawn by `--compact`: a row per chat, then each listed signal with its own row. */
|
|
22
22
|
export declare const projectStatusRow: (signals: readonly {
|
|
23
23
|
id: string;
|
|
24
24
|
}[]) => RowShape;
|
|
@@ -31,10 +31,8 @@ export declare const projectStatusSchema: v.LooseObjectSchema<{
|
|
|
31
31
|
readonly since: v.StringSchema<undefined>;
|
|
32
32
|
readonly until: v.StringSchema<undefined>;
|
|
33
33
|
}, undefined>;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
readonly version: v.NumberSchema<undefined>;
|
|
37
|
-
}, undefined>, undefined>;
|
|
34
|
+
/** Each signal's version, so a saved answer says which rules made it. */
|
|
35
|
+
readonly signals: v.RecordSchema<v.StringSchema<undefined>, v.NumberSchema<undefined>, undefined>;
|
|
38
36
|
readonly money: v.ArraySchema<v.StrictObjectSchema<{
|
|
39
37
|
readonly direction: v.StringSchema<undefined>;
|
|
40
38
|
readonly currency: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -46,11 +44,33 @@ export declare const projectStatusSchema: v.LooseObjectSchema<{
|
|
|
46
44
|
readonly title: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
47
45
|
readonly kind: v.StringSchema<undefined>;
|
|
48
46
|
readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
49
|
-
readonly purpose: v.StringSchema<undefined>;
|
|
50
|
-
readonly project: v.StringSchema<undefined>;
|
|
47
|
+
readonly purpose: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
48
|
+
readonly project: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
51
49
|
readonly coverage: v.StringSchema<undefined>;
|
|
52
|
-
readonly attention: v.NumberSchema<undefined>;
|
|
53
|
-
readonly why: v.
|
|
50
|
+
readonly attention: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
51
|
+
readonly why: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
52
|
+
readonly last: v.OptionalSchema<v.StrictObjectSchema<{
|
|
53
|
+
readonly ref: v.StringSchema<undefined>;
|
|
54
|
+
readonly at: v.StringSchema<undefined>;
|
|
55
|
+
readonly who: v.StrictObjectSchema<{
|
|
56
|
+
readonly ref: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
57
|
+
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
58
|
+
readonly owner: v.BooleanSchema<undefined>;
|
|
59
|
+
}, undefined>;
|
|
60
|
+
}, undefined>, undefined>;
|
|
61
|
+
readonly next: v.OptionalSchema<v.PicklistSchema<["owner", "them", "named", "nobody"], undefined>, undefined>;
|
|
62
|
+
readonly waiting_since: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
63
|
+
readonly addressed: v.OptionalSchema<v.StrictObjectSchema<{
|
|
64
|
+
readonly ref: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
65
|
+
readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
66
|
+
}, undefined>, undefined>;
|
|
67
|
+
readonly overdue: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
68
|
+
readonly held: v.OptionalSchema<v.StrictObjectSchema<{
|
|
69
|
+
readonly messages: v.NumberSchema<undefined>;
|
|
70
|
+
readonly oldest_at: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
71
|
+
}, undefined>, undefined>;
|
|
72
|
+
readonly sync_command: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
73
|
+
readonly unlisted: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.NumberSchema<undefined>, undefined>, undefined>;
|
|
54
74
|
}, undefined>, undefined>;
|
|
55
75
|
readonly purposes: v.UnionSchema<[v.LiteralSchema<"all", undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
56
76
|
readonly out_of_scope: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
@@ -85,9 +105,8 @@ export declare const projectStatusAnswer: (found: ProjectStatus, hints: ProjectS
|
|
|
85
105
|
until: string;
|
|
86
106
|
};
|
|
87
107
|
signals: {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}[];
|
|
108
|
+
[x: string]: number;
|
|
109
|
+
};
|
|
91
110
|
money: {
|
|
92
111
|
direction: string;
|
|
93
112
|
currency: string | null;
|
|
@@ -99,11 +118,35 @@ export declare const projectStatusAnswer: (found: ProjectStatus, hints: ProjectS
|
|
|
99
118
|
title: string | null;
|
|
100
119
|
kind: string;
|
|
101
120
|
role: string | null;
|
|
102
|
-
purpose
|
|
103
|
-
project
|
|
121
|
+
purpose?: string | undefined;
|
|
122
|
+
project?: string | undefined;
|
|
104
123
|
coverage: string;
|
|
105
|
-
attention
|
|
106
|
-
why
|
|
124
|
+
attention?: number | undefined;
|
|
125
|
+
why?: string | undefined;
|
|
126
|
+
last?: {
|
|
127
|
+
ref: string;
|
|
128
|
+
at: string;
|
|
129
|
+
who: {
|
|
130
|
+
ref?: string | undefined;
|
|
131
|
+
name: string | null;
|
|
132
|
+
owner: boolean;
|
|
133
|
+
};
|
|
134
|
+
} | undefined;
|
|
135
|
+
next?: "named" | "nobody" | "owner" | "them" | undefined;
|
|
136
|
+
waiting_since?: string | null | undefined;
|
|
137
|
+
addressed?: {
|
|
138
|
+
ref: string | null;
|
|
139
|
+
name: string | null;
|
|
140
|
+
} | undefined;
|
|
141
|
+
overdue?: boolean | undefined;
|
|
142
|
+
held?: {
|
|
143
|
+
messages: number;
|
|
144
|
+
oldest_at: string | null;
|
|
145
|
+
} | undefined;
|
|
146
|
+
sync_command?: string | null | undefined;
|
|
147
|
+
unlisted?: {
|
|
148
|
+
[x: string]: number;
|
|
149
|
+
} | undefined;
|
|
107
150
|
}[];
|
|
108
151
|
purposes: "all" | string[];
|
|
109
152
|
out_of_scope?: {
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { snakeKeys } from "./envelope.js";
|
|
3
3
|
import { heldPhrase } from "./messenger/search-answers.js";
|
|
4
|
-
import { STATUS_SIGNAL_ROWS } from "./project-status-rows.js";
|
|
4
|
+
import { ON_CHAT_ROW, STATUS_SIGNAL_ROWS } from "./project-status-rows.js";
|
|
5
5
|
const day = (at) => new Date(at).toISOString().slice(0, 10);
|
|
6
6
|
const listKey = (signal) => signal.replaceAll("-", "_");
|
|
7
7
|
const SECTIONS = {
|
|
8
|
-
signals: "status.signal",
|
|
9
8
|
money: "status.money",
|
|
10
9
|
chats: "status.chat",
|
|
11
10
|
out_of_scope: "status.out-of-scope",
|
|
12
11
|
failed: "status.failed",
|
|
13
12
|
};
|
|
14
|
-
/** The `project_status` answer drawn by `--compact`: each signal
|
|
13
|
+
/** The `project_status` answer drawn by `--compact`: a row per chat, then each listed signal with its own row. */
|
|
15
14
|
export const projectStatusRow = (signals) => ({
|
|
16
15
|
columns: [],
|
|
16
|
+
hidden: ["project", "window", "purposes", "signals"],
|
|
17
17
|
sections: {
|
|
18
18
|
...SECTIONS,
|
|
19
|
-
...Object.fromEntries(signals.
|
|
19
|
+
...Object.fromEntries(signals.flatMap(({ id }) => (ON_CHAT_ROW.has(id) ? [] : [[listKey(id), `status.${id}`]]))),
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
|
+
const who = v.strictObject({ ref: v.optional(v.string()), name: v.nullable(v.string()), owner: v.boolean() });
|
|
22
23
|
const statusItem = v.looseObject({
|
|
23
|
-
signal: v.string(),
|
|
24
24
|
ref: v.nullable(v.string()),
|
|
25
25
|
chat: v.nullable(v.string()),
|
|
26
|
-
chat_title: v.nullable(v.string()),
|
|
27
26
|
at: v.nullable(v.string()),
|
|
28
|
-
who: v.
|
|
29
|
-
|
|
27
|
+
who: v.optional(who),
|
|
28
|
+
/** Every ref the item cites, when it cites more than `ref`. */
|
|
29
|
+
evidence: v.optional(v.array(v.string())),
|
|
30
30
|
basis: v.picklist(["store", "fact", "task", "pattern"]),
|
|
31
31
|
data: v.record(v.string(), v.unknown()),
|
|
32
32
|
});
|
|
@@ -36,18 +36,27 @@ export const projectStatusSchema = v.looseObject({
|
|
|
36
36
|
key: v.nullable(v.string()),
|
|
37
37
|
name: v.string(),
|
|
38
38
|
window: v.strictObject({ since: v.string(), until: v.string() }),
|
|
39
|
-
|
|
39
|
+
/** Each signal's version, so a saved answer says which rules made it. */
|
|
40
|
+
signals: v.record(v.string(), v.number()),
|
|
40
41
|
money: v.array(v.strictObject({ direction: v.string(), currency: v.nullable(v.string()), amount: v.string(), rows: v.number() })),
|
|
41
42
|
chats: v.array(v.strictObject({
|
|
42
43
|
chat: v.string(),
|
|
43
44
|
title: v.nullable(v.string()),
|
|
44
45
|
kind: v.string(),
|
|
45
46
|
role: v.nullable(v.string()),
|
|
46
|
-
purpose: v.string(),
|
|
47
|
-
project: v.string(),
|
|
47
|
+
purpose: v.optional(v.string()),
|
|
48
|
+
project: v.optional(v.string()),
|
|
48
49
|
coverage: v.string(),
|
|
49
|
-
attention: v.number(),
|
|
50
|
-
why: v.
|
|
50
|
+
attention: v.optional(v.number()),
|
|
51
|
+
why: v.optional(v.string()),
|
|
52
|
+
last: v.optional(v.strictObject({ ref: v.string(), at: v.string(), who })),
|
|
53
|
+
next: v.optional(v.picklist(["owner", "them", "named", "nobody"])),
|
|
54
|
+
waiting_since: v.optional(v.nullable(v.string())),
|
|
55
|
+
addressed: v.optional(v.strictObject({ ref: v.nullable(v.string()), name: v.nullable(v.string()) })),
|
|
56
|
+
overdue: v.optional(v.boolean()),
|
|
57
|
+
held: v.optional(v.strictObject({ messages: v.number(), oldest_at: v.nullable(v.string()) })),
|
|
58
|
+
sync_command: v.optional(v.nullable(v.string())),
|
|
59
|
+
unlisted: v.optional(v.record(v.string(), v.number())),
|
|
51
60
|
})),
|
|
52
61
|
purposes: v.union([v.literal("all"), v.array(v.string())]),
|
|
53
62
|
out_of_scope: v.optional(v.array(v.strictObject({
|
|
@@ -130,26 +139,86 @@ const missingOf = (found, hints) => {
|
|
|
130
139
|
...found.failed.map((one) => ({ field: `signal:${one.signal}`, why: one.why })),
|
|
131
140
|
];
|
|
132
141
|
};
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
const whoOf = (one) => one === null ? {} : { who: { ...(one.ref === null ? {} : { ref: one.ref }), name: one.name, owner: one.owner } };
|
|
143
|
+
/** An item as listed: its first ref, every ref only when there are more. */
|
|
144
|
+
const listed = ({ signal: _signal, who, evidence, ...one }) => ({
|
|
145
|
+
...one,
|
|
146
|
+
ref: evidence[0]?.ref ?? one.chat,
|
|
147
|
+
...whoOf(who),
|
|
148
|
+
...(evidence.length > 1 ? { evidence: evidence.map((each) => each.ref) } : {}),
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* Low signal items, counted on their chat's row instead of listed: questions others ask in a group with no role (a
|
|
152
|
+
* leads group's requests), promises found by words that others wrote in a group, and past the newest one per chat.
|
|
153
|
+
*/
|
|
154
|
+
const unlistedOf = (found) => {
|
|
155
|
+
const chats = new Map(found.chats.map((chat) => [chat.ref, chat]));
|
|
156
|
+
const patterned = new Set();
|
|
157
|
+
return new Set(found.items.filter((one) => {
|
|
158
|
+
const chat = one.chat === null ? undefined : chats.get(one.chat);
|
|
159
|
+
if (!chat)
|
|
160
|
+
return false;
|
|
161
|
+
if (one.signal === "questions")
|
|
162
|
+
return one.data.side === "theirs" && chat.role === null && chat.kind !== "dialog";
|
|
163
|
+
if (one.signal !== "promises" || one.basis !== "pattern")
|
|
164
|
+
return false;
|
|
165
|
+
if (chat.kind !== "dialog" && !one.who?.owner)
|
|
166
|
+
return true;
|
|
167
|
+
if (!patterned.has(chat.ref)) {
|
|
168
|
+
patterned.add(chat.ref);
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
}));
|
|
173
|
+
};
|
|
174
|
+
const counted = (items) => {
|
|
175
|
+
const counts = {};
|
|
176
|
+
for (const one of items)
|
|
177
|
+
counts[one.signal] = (counts[one.signal] ?? 0) + 1;
|
|
178
|
+
return counts;
|
|
179
|
+
};
|
|
180
|
+
// The newest held message is the row's `last`.
|
|
181
|
+
const heldOf = (one) => {
|
|
182
|
+
const { messages, oldestAt } = one.data.held;
|
|
183
|
+
return { messages, oldestAt };
|
|
184
|
+
};
|
|
185
|
+
/** A chat with what is said once per chat: its newest message, whose move it is, and how much of it is held. */
|
|
186
|
+
const chatRow = (found, hints, chat, unlisted) => {
|
|
187
|
+
const weight = found.attention.find((one) => one.chat === chat.ref);
|
|
188
|
+
const of = (signal) => found.items.find((one) => one.signal === signal && one.chat === chat.ref);
|
|
189
|
+
const reply = of("reply-next");
|
|
190
|
+
const held = of("coverage");
|
|
191
|
+
const sync = held && partial(found, chat) ? hints.sync(chat, day(found.window.since)) : null;
|
|
192
|
+
const replied = reply?.data;
|
|
193
|
+
return {
|
|
194
|
+
chat: chat.ref,
|
|
195
|
+
title: chat.title,
|
|
196
|
+
kind: chat.kind,
|
|
197
|
+
role: chat.role,
|
|
198
|
+
...(Array.isArray(found.purposes) && found.purposes.length === 1 ? {} : { purpose: chat.purpose }),
|
|
199
|
+
...(chat.project === found.project.ref ? {} : { project: chat.project }),
|
|
200
|
+
coverage: chat.coverage.completeness.state,
|
|
201
|
+
...(weight ? { attention: weight.weight, why: weight.why } : {}),
|
|
202
|
+
...(reply && replied
|
|
203
|
+
? {
|
|
204
|
+
last: { ref: reply.evidence[0]?.ref, at: reply.at, ...whoOf(reply.who) },
|
|
205
|
+
next: replied.next,
|
|
206
|
+
...(replied.next === "nobody" ? {} : { waitingSince: replied.waitingSince }),
|
|
207
|
+
...(replied.addressed ? { addressed: replied.addressed } : {}),
|
|
208
|
+
...(replied.overdue ? { overdue: true } : {}),
|
|
209
|
+
}
|
|
210
|
+
: {}),
|
|
211
|
+
...(held ? { held: heldOf(held), syncCommand: sync ? hints.line(sync) : null } : {}),
|
|
212
|
+
...(unlisted.length ? { unlisted: counted(unlisted) } : {}),
|
|
139
213
|
};
|
|
140
|
-
return (one) => ({
|
|
141
|
-
...one,
|
|
142
|
-
ref: one.evidence[0]?.ref ?? one.chat,
|
|
143
|
-
chatTitle: one.chat === null ? null : (titles.get(one.chat) ?? null),
|
|
144
|
-
...(one.signal === "coverage" ? { syncCommand: sync(one) } : {}),
|
|
145
|
-
});
|
|
146
214
|
};
|
|
147
215
|
/** The answer of `projects status`: the item, two steps at most, what is missing, and the window. */
|
|
148
216
|
export const projectStatusAnswer = (found, hints) => {
|
|
149
|
-
const
|
|
150
|
-
const place = withPlace(found, hints);
|
|
217
|
+
const unlisted = unlistedOf(found);
|
|
151
218
|
const lists = Object.fromEntries(found.signals.flatMap(({ id }) => {
|
|
152
|
-
|
|
219
|
+
if (ON_CHAT_ROW.has(id))
|
|
220
|
+
return [];
|
|
221
|
+
const items = found.items.filter((one) => one.signal === id && !unlisted.has(one)).map(listed);
|
|
153
222
|
return items.length ? [[listKey(id), items]] : [];
|
|
154
223
|
}));
|
|
155
224
|
const item = snakeKeys({
|
|
@@ -157,19 +226,9 @@ export const projectStatusAnswer = (found, hints) => {
|
|
|
157
226
|
key: found.project.key,
|
|
158
227
|
name: found.project.name,
|
|
159
228
|
window: found.window,
|
|
160
|
-
signals: found.signals,
|
|
229
|
+
signals: Object.fromEntries(found.signals.map(({ id, version }) => [id, version])),
|
|
161
230
|
money: found.money.open,
|
|
162
|
-
chats: found.chats.map((chat) => (
|
|
163
|
-
chat: chat.ref,
|
|
164
|
-
title: chat.title,
|
|
165
|
-
kind: chat.kind,
|
|
166
|
-
role: chat.role,
|
|
167
|
-
purpose: chat.purpose,
|
|
168
|
-
project: chat.project,
|
|
169
|
-
coverage: chat.coverage.completeness.state,
|
|
170
|
-
attention: weights.get(chat.ref)?.weight ?? 0,
|
|
171
|
-
why: weights.get(chat.ref)?.why ?? null,
|
|
172
|
-
})),
|
|
231
|
+
chats: found.chats.map((chat) => chatRow(found, hints, chat, [...unlisted].filter((one) => one.chat === chat.ref))),
|
|
173
232
|
purposes: found.purposes,
|
|
174
233
|
...(found.outOfScope.length
|
|
175
234
|
? {
|
|
@@ -201,8 +260,8 @@ export const projectStatusAnswer = (found, hints) => {
|
|
|
201
260
|
const NEXT_WORDS = { owner: "YOU", them: "them", nobody: "nobody" };
|
|
202
261
|
const chatLine = (found, chat) => {
|
|
203
262
|
const of = (signal) => found.items.filter((one) => one.signal === signal && one.chat === chat.ref);
|
|
204
|
-
const [last] = of("
|
|
205
|
-
const reply =
|
|
263
|
+
const [last] = of("reply-next");
|
|
264
|
+
const reply = last?.data;
|
|
206
265
|
const head = [
|
|
207
266
|
`${chat.title ?? chat.ref} (${[chat.role ?? "no role", chat.kind].join(", ")})`,
|
|
208
267
|
last
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { amounts } from "./amounts.js";
|
|
2
2
|
import { children } from "./children.js";
|
|
3
3
|
import { coverage } from "./coverage.js";
|
|
4
|
-
import { lastMessage } from "./last-message.js";
|
|
5
4
|
import { payments } from "./payments.js";
|
|
6
5
|
import { promises } from "./promises.js";
|
|
7
6
|
import { questions } from "./questions.js";
|
|
@@ -9,7 +8,6 @@ import { replyNext } from "./reply-next.js";
|
|
|
9
8
|
import { topics } from "./topics.js";
|
|
10
9
|
/** The registry; its order is the answer's order. A new signal is one file here and its row in the CLI. */
|
|
11
10
|
export const STATUS_SIGNALS = [
|
|
12
|
-
lastMessage,
|
|
13
11
|
replyNext,
|
|
14
12
|
questions,
|
|
15
13
|
promises,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.578.0",
|
|
4
4
|
"description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { StatusSignal } from "../types.js";
|
|
2
|
-
export type LastMessageData = Record<string, never>;
|
|
3
|
-
/** The newest stored message in the window: when, and who wrote it. A chat held in part says so through `coverage`. */
|
|
4
|
-
export declare const lastMessage: StatusSignal<LastMessageData>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { evidenceOf, whoOf } from "../items.js";
|
|
2
|
-
/** The newest stored message in the window: when, and who wrote it. A chat held in part says so through `coverage`. */
|
|
3
|
-
export const lastMessage = {
|
|
4
|
-
id: "last-message",
|
|
5
|
-
version: 1,
|
|
6
|
-
scope: "chat",
|
|
7
|
-
read: async (_context, chat) => {
|
|
8
|
-
const last = chat?.messages.at(-1);
|
|
9
|
-
if (!chat || !last)
|
|
10
|
-
return [];
|
|
11
|
-
const item = {
|
|
12
|
-
signal: "last-message",
|
|
13
|
-
chat: chat.ref,
|
|
14
|
-
at: last.timestamp,
|
|
15
|
-
who: whoOf(last),
|
|
16
|
-
evidence: evidenceOf(chat, last),
|
|
17
|
-
basis: "store",
|
|
18
|
-
data: {},
|
|
19
|
-
};
|
|
20
|
-
return [item];
|
|
21
|
-
},
|
|
22
|
-
};
|