@wirecat/cli-core 0.577.0 → 0.579.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 CHANGED
@@ -7,6 +7,16 @@ shape of this file.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.579.0 — 05.11.2026
11
+
12
+ ### Added
13
+
14
+ - **An agent's new organization is a proposal for the owner: the `organization` proposal kind and
15
+ `proposeOrganization(store, { name, kind, scope? }, by)`.** It is stored in `proposed_actions` as
16
+ `organization_add`, so no schema change; `proposalRegistry` lists it in `review`, and confirming it adds the
17
+ organization (`made: ["organization:<id>"]`), rejecting it adds nothing. The owner still adds one directly with
18
+ `knowledge.addOrganization`. `ORGANIZATION_ADD_KIND` and `OrganizationProposal` are exported from `services`.
19
+
10
20
  ## 0.577.0 — 05.11.2026
11
21
 
12
22
  ### Added
@@ -27,6 +37,19 @@ shape of this file.
27
37
  holder with no mark yet is `mail.no-mark`. `rewindMark` is the function under it, and `MailActivityStore` gets
28
38
  `emailsBefore`.
29
39
 
40
+ ### Changed — may break callers
41
+
42
+ - **`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
43
+ it was rows the owner would not call status. Each chat's row now carries what is said once per chat: `last` (the
44
+ newest message's ref, time and sender), `next`, `waiting_since`, `addressed`, `overdue`, and for a chat held in part
45
+ `held` and `sync_command`; the `last_message`, `reply_next` and `coverage` lists are gone, and the `last-message`
46
+ signal with them (reply-next already cites the newest message). Others' questions in a group with no role, and
47
+ others' promises found by words in a group or past the newest one per chat, are counted on the chat's row under
48
+ `unlisted` instead of listed. A listed item drops `signal` and `chat_title`, keeps `evidence` (now plain refs) only
49
+ when it cites more than `ref`, and `who` only when set. `signals` is `{ id: version }`; a chat row leaves out
50
+ `purpose` when one purpose was read, `project` when it is the root, and `attention` when it is 0. `--compact` leaves
51
+ out `project`, `window`, `purposes` and `signals` (new `RowShape.hidden`). The human form is unchanged.
52
+
30
53
  ## 0.576.0 — 05.11.2026
31
54
 
32
55
  ### Added
@@ -10,13 +10,13 @@ export declare const calendarTools: ({
10
10
  inputSchema: {
11
11
  type: string;
12
12
  properties: {
13
- limit?: undefined;
14
13
  account_id: {
15
14
  type: string;
16
15
  minimum: number;
17
16
  };
18
17
  query?: undefined;
19
18
  timezone?: undefined;
19
+ limit?: undefined;
20
20
  page?: undefined;
21
21
  event?: undefined;
22
22
  } | {
@@ -45,9 +45,9 @@ export declare const calendarTools: ({
45
45
  };
46
46
  event?: undefined;
47
47
  } | {
48
- limit?: undefined;
49
48
  query?: undefined;
50
49
  timezone?: undefined;
50
+ limit?: undefined;
51
51
  page?: undefined;
52
52
  event: {
53
53
  type: string;
@@ -58,9 +58,9 @@ export declare const calendarTools: ({
58
58
  minimum: number;
59
59
  };
60
60
  } | {
61
- limit?: undefined;
62
61
  query?: undefined;
63
62
  timezone?: undefined;
63
+ limit?: undefined;
64
64
  page?: undefined;
65
65
  event?: undefined;
66
66
  account_id?: undefined;
@@ -80,13 +80,13 @@ export declare const calendarTools: ({
80
80
  inputSchema: {
81
81
  type: string;
82
82
  properties: {
83
- limit?: undefined;
84
83
  account_id: {
85
84
  type: string;
86
85
  minimum: number;
87
86
  };
88
87
  query?: undefined;
89
88
  timezone?: undefined;
89
+ limit?: undefined;
90
90
  page?: undefined;
91
91
  event?: undefined;
92
92
  } | {
@@ -115,9 +115,9 @@ export declare const calendarTools: ({
115
115
  };
116
116
  event?: undefined;
117
117
  } | {
118
- limit?: undefined;
119
118
  query?: undefined;
120
119
  timezone?: undefined;
120
+ limit?: undefined;
121
121
  page?: undefined;
122
122
  event: {
123
123
  type: string;
@@ -128,9 +128,9 @@ export declare const calendarTools: ({
128
128
  minimum: number;
129
129
  };
130
130
  } | {
131
- limit?: undefined;
132
131
  query?: undefined;
133
132
  timezone?: undefined;
133
+ limit?: undefined;
134
134
  page?: undefined;
135
135
  event?: undefined;
136
136
  account_id?: undefined;
@@ -150,13 +150,13 @@ export declare const calendarTools: ({
150
150
  inputSchema: {
151
151
  type: string;
152
152
  properties: {
153
- limit?: undefined;
154
153
  account_id: {
155
154
  type: string;
156
155
  minimum: number;
157
156
  };
158
157
  query?: undefined;
159
158
  timezone?: undefined;
159
+ limit?: undefined;
160
160
  page?: undefined;
161
161
  event?: undefined;
162
162
  } | {
@@ -185,9 +185,9 @@ export declare const calendarTools: ({
185
185
  };
186
186
  event?: undefined;
187
187
  } | {
188
- limit?: undefined;
189
188
  query?: undefined;
190
189
  timezone?: undefined;
190
+ limit?: undefined;
191
191
  page?: undefined;
192
192
  event: {
193
193
  type: string;
@@ -198,9 +198,9 @@ export declare const calendarTools: ({
198
198
  minimum: number;
199
199
  };
200
200
  } | {
201
- limit?: undefined;
202
201
  query?: undefined;
203
202
  timezone?: undefined;
203
+ limit?: undefined;
204
204
  page?: undefined;
205
205
  event?: undefined;
206
206
  account_id?: undefined;
@@ -220,13 +220,13 @@ export declare const calendarTools: ({
220
220
  inputSchema: {
221
221
  type: string;
222
222
  properties: {
223
- limit?: undefined;
224
223
  account_id: {
225
224
  type: string;
226
225
  minimum: number;
227
226
  };
228
227
  query?: undefined;
229
228
  timezone?: undefined;
229
+ limit?: undefined;
230
230
  page?: undefined;
231
231
  event?: undefined;
232
232
  } | {
@@ -255,9 +255,9 @@ export declare const calendarTools: ({
255
255
  };
256
256
  event?: undefined;
257
257
  } | {
258
- limit?: undefined;
259
258
  query?: undefined;
260
259
  timezone?: undefined;
260
+ limit?: undefined;
261
261
  page?: undefined;
262
262
  event: {
263
263
  type: string;
@@ -268,9 +268,9 @@ export declare const calendarTools: ({
268
268
  minimum: number;
269
269
  };
270
270
  } | {
271
- limit?: undefined;
272
271
  query?: undefined;
273
272
  timezone?: undefined;
273
+ limit?: undefined;
274
274
  page?: undefined;
275
275
  event?: undefined;
276
276
  account_id?: undefined;
@@ -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. */
@@ -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 two
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" }, { field: ["chat_title", "chat"] }];
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 two
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" }, { field: "data.side" }, who],
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: "attention", as: "count", tag: "attention" },
88
- { field: "why" },
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's list with that signal's row. */
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
- readonly signals: v.ArraySchema<v.StrictObjectSchema<{
35
- readonly id: v.StringSchema<undefined>;
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.NullableSchema<v.StringSchema<undefined>, undefined>;
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
- id: string;
89
- version: number;
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: string;
103
- project: string;
121
+ purpose?: string | undefined;
122
+ project?: string | undefined;
104
123
  coverage: string;
105
- attention: number;
106
- why: string | null;
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's list with that signal's row. */
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.map(({ id }) => [listKey(id), `status.${id}`])),
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.nullable(v.strictObject({ ref: v.nullable(v.string()), name: v.nullable(v.string()), owner: v.boolean() })),
29
- evidence: v.array(v.strictObject({ ref: v.string(), fingerprint: v.nullable(v.string()) })),
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
- signals: v.array(v.strictObject({ id: v.string(), version: v.number() })),
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.nullable(v.string()),
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 withPlace = (found, hints) => {
134
- const titles = new Map(found.chats.map((chat) => [chat.ref, chat.title]));
135
- const sync = (one) => {
136
- const chat = found.chats.find((each) => each.ref === one.chat);
137
- const step = chat && partial(found, chat) ? hints.sync(chat, day(found.window.since)) : null;
138
- return step ? hints.line(step) : null;
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 weights = new Map(found.attention.map((one) => [one.chat, one]));
150
- const place = withPlace(found, hints);
217
+ const unlisted = unlistedOf(found);
151
218
  const lists = Object.fromEntries(found.signals.flatMap(({ id }) => {
152
- const items = found.items.filter((one) => one.signal === id).map(place);
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("last-message");
205
- const reply = of("reply-next")[0]?.data;
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
@@ -38,6 +38,7 @@ export declare const meetingTools: ({
38
38
  max_read_bytes?: undefined;
39
39
  cursor?: undefined;
40
40
  } | {
41
+ limit?: undefined;
41
42
  event_id?: undefined;
42
43
  series_id?: undefined;
43
44
  page?: undefined;
@@ -53,11 +54,11 @@ export declare const meetingTools: ({
53
54
  format?: undefined;
54
55
  transcript_id?: undefined;
55
56
  query?: undefined;
56
- limit?: undefined;
57
57
  scan_limit?: undefined;
58
58
  max_read_bytes?: undefined;
59
59
  cursor?: undefined;
60
60
  } | {
61
+ limit?: undefined;
61
62
  event_id?: undefined;
62
63
  series_id?: undefined;
63
64
  page?: undefined;
@@ -75,11 +76,11 @@ export declare const meetingTools: ({
75
76
  format?: undefined;
76
77
  transcript_id?: undefined;
77
78
  query?: undefined;
78
- limit?: undefined;
79
79
  scan_limit?: undefined;
80
80
  max_read_bytes?: undefined;
81
81
  cursor?: undefined;
82
82
  } | {
83
+ limit?: undefined;
83
84
  event_id?: undefined;
84
85
  series_id?: undefined;
85
86
  page?: undefined;
@@ -101,7 +102,6 @@ export declare const meetingTools: ({
101
102
  minimum: number;
102
103
  };
103
104
  query?: undefined;
104
- limit?: undefined;
105
105
  scan_limit?: undefined;
106
106
  max_read_bytes?: undefined;
107
107
  cursor?: undefined;
@@ -188,6 +188,7 @@ export declare const meetingTools: ({
188
188
  max_read_bytes?: undefined;
189
189
  cursor?: undefined;
190
190
  } | {
191
+ limit?: undefined;
191
192
  event_id?: undefined;
192
193
  series_id?: undefined;
193
194
  page?: undefined;
@@ -203,11 +204,11 @@ export declare const meetingTools: ({
203
204
  format?: undefined;
204
205
  transcript_id?: undefined;
205
206
  query?: undefined;
206
- limit?: undefined;
207
207
  scan_limit?: undefined;
208
208
  max_read_bytes?: undefined;
209
209
  cursor?: undefined;
210
210
  } | {
211
+ limit?: undefined;
211
212
  event_id?: undefined;
212
213
  series_id?: undefined;
213
214
  page?: undefined;
@@ -225,11 +226,11 @@ export declare const meetingTools: ({
225
226
  format?: undefined;
226
227
  transcript_id?: undefined;
227
228
  query?: undefined;
228
- limit?: undefined;
229
229
  scan_limit?: undefined;
230
230
  max_read_bytes?: undefined;
231
231
  cursor?: undefined;
232
232
  } | {
233
+ limit?: undefined;
233
234
  event_id?: undefined;
234
235
  series_id?: undefined;
235
236
  page?: undefined;
@@ -251,7 +252,6 @@ export declare const meetingTools: ({
251
252
  minimum: number;
252
253
  };
253
254
  query?: undefined;
254
- limit?: undefined;
255
255
  scan_limit?: undefined;
256
256
  max_read_bytes?: undefined;
257
257
  cursor?: undefined;
@@ -338,6 +338,7 @@ export declare const meetingTools: ({
338
338
  max_read_bytes?: undefined;
339
339
  cursor?: undefined;
340
340
  } | {
341
+ limit?: undefined;
341
342
  event_id?: undefined;
342
343
  series_id?: undefined;
343
344
  page?: undefined;
@@ -353,11 +354,11 @@ export declare const meetingTools: ({
353
354
  format?: undefined;
354
355
  transcript_id?: undefined;
355
356
  query?: undefined;
356
- limit?: undefined;
357
357
  scan_limit?: undefined;
358
358
  max_read_bytes?: undefined;
359
359
  cursor?: undefined;
360
360
  } | {
361
+ limit?: undefined;
361
362
  event_id?: undefined;
362
363
  series_id?: undefined;
363
364
  page?: undefined;
@@ -375,11 +376,11 @@ export declare const meetingTools: ({
375
376
  format?: undefined;
376
377
  transcript_id?: undefined;
377
378
  query?: undefined;
378
- limit?: undefined;
379
379
  scan_limit?: undefined;
380
380
  max_read_bytes?: undefined;
381
381
  cursor?: undefined;
382
382
  } | {
383
+ limit?: undefined;
383
384
  event_id?: undefined;
384
385
  series_id?: undefined;
385
386
  page?: undefined;
@@ -401,7 +402,6 @@ export declare const meetingTools: ({
401
402
  minimum: number;
402
403
  };
403
404
  query?: undefined;
404
- limit?: undefined;
405
405
  scan_limit?: undefined;
406
406
  max_read_bytes?: undefined;
407
407
  cursor?: undefined;
@@ -488,6 +488,7 @@ export declare const meetingTools: ({
488
488
  max_read_bytes?: undefined;
489
489
  cursor?: undefined;
490
490
  } | {
491
+ limit?: undefined;
491
492
  event_id?: undefined;
492
493
  series_id?: undefined;
493
494
  page?: undefined;
@@ -503,11 +504,11 @@ export declare const meetingTools: ({
503
504
  format?: undefined;
504
505
  transcript_id?: undefined;
505
506
  query?: undefined;
506
- limit?: undefined;
507
507
  scan_limit?: undefined;
508
508
  max_read_bytes?: undefined;
509
509
  cursor?: undefined;
510
510
  } | {
511
+ limit?: undefined;
511
512
  event_id?: undefined;
512
513
  series_id?: undefined;
513
514
  page?: undefined;
@@ -525,11 +526,11 @@ export declare const meetingTools: ({
525
526
  format?: undefined;
526
527
  transcript_id?: undefined;
527
528
  query?: undefined;
528
- limit?: undefined;
529
529
  scan_limit?: undefined;
530
530
  max_read_bytes?: undefined;
531
531
  cursor?: undefined;
532
532
  } | {
533
+ limit?: undefined;
533
534
  event_id?: undefined;
534
535
  series_id?: undefined;
535
536
  page?: undefined;
@@ -551,7 +552,6 @@ export declare const meetingTools: ({
551
552
  minimum: number;
552
553
  };
553
554
  query?: undefined;
554
- limit?: undefined;
555
555
  scan_limit?: undefined;
556
556
  max_read_bytes?: undefined;
557
557
  cursor?: undefined;
@@ -638,6 +638,7 @@ export declare const meetingTools: ({
638
638
  max_read_bytes?: undefined;
639
639
  cursor?: undefined;
640
640
  } | {
641
+ limit?: undefined;
641
642
  event_id?: undefined;
642
643
  series_id?: undefined;
643
644
  page?: undefined;
@@ -653,11 +654,11 @@ export declare const meetingTools: ({
653
654
  format?: undefined;
654
655
  transcript_id?: undefined;
655
656
  query?: undefined;
656
- limit?: undefined;
657
657
  scan_limit?: undefined;
658
658
  max_read_bytes?: undefined;
659
659
  cursor?: undefined;
660
660
  } | {
661
+ limit?: undefined;
661
662
  event_id?: undefined;
662
663
  series_id?: undefined;
663
664
  page?: undefined;
@@ -675,11 +676,11 @@ export declare const meetingTools: ({
675
676
  format?: undefined;
676
677
  transcript_id?: undefined;
677
678
  query?: undefined;
678
- limit?: undefined;
679
679
  scan_limit?: undefined;
680
680
  max_read_bytes?: undefined;
681
681
  cursor?: undefined;
682
682
  } | {
683
+ limit?: undefined;
683
684
  event_id?: undefined;
684
685
  series_id?: undefined;
685
686
  page?: undefined;
@@ -701,7 +702,6 @@ export declare const meetingTools: ({
701
702
  minimum: number;
702
703
  };
703
704
  query?: undefined;
704
- limit?: undefined;
705
705
  scan_limit?: undefined;
706
706
  max_read_bytes?: undefined;
707
707
  cursor?: undefined;
@@ -188,7 +188,7 @@ export { type PackageUpgradeOutcome, type PackageUpgradePorts, type PackageUpgra
188
188
  export { type PersonMeetingContext, type PersonMeetingContextItem, type PersonMeetingContextOptions, type PersonMeetingReadStore, personMeetingContext, } from "./person-meeting-context.js";
189
189
  export { privatePeopleService } from "./private-people.js";
190
190
  export { approveAsTask, type ProposalTaskStore, proposalSource } from "./proposal-tasks.js";
191
- export { type Decided, type Decision, emptyProposalRegistry, FACT_SUMMARIES, type ProposalFilter, type ProposalKind, type ProposalRegistry, type ProposalRow, parseProposalIds, proposalRegistry, } from "./proposals/index.js";
191
+ export { type Decided, type Decision, emptyProposalRegistry, FACT_SUMMARIES, ORGANIZATION_ADD_KIND, type OrganizationProposal, type ProposalFilter, type ProposalKind, type ProposalRegistry, type ProposalRow, parseProposalIds, proposalRegistry, proposeOrganization, } from "./proposals/index.js";
192
192
  export type { RetentionQuery, RetentionService } from "./retention.js";
193
193
  export { retentionService } from "./retention.js";
194
194
  export { RESOURCES_SEARCHED, type SearchAllFound, type SearchAllItem, type SearchAllMessenger, type SearchAllRequest, type SearchedResource, searchAll, } from "./search-all.js";
@@ -146,7 +146,7 @@ export { upgradePackage, } from "./package-upgrade.js";
146
146
  export { personMeetingContext, } from "./person-meeting-context.js";
147
147
  export { privatePeopleService } from "./private-people.js";
148
148
  export { approveAsTask, proposalSource } from "./proposal-tasks.js";
149
- export { emptyProposalRegistry, FACT_SUMMARIES, parseProposalIds, proposalRegistry, } from "./proposals/index.js";
149
+ export { emptyProposalRegistry, FACT_SUMMARIES, ORGANIZATION_ADD_KIND, parseProposalIds, proposalRegistry, proposeOrganization, } from "./proposals/index.js";
150
150
  export { retentionService } from "./retention.js";
151
151
  export { RESOURCES_SEARCHED, searchAll, } from "./search-all.js";
152
152
  export { RESOURCES_SEARCHED_WITH_MEETINGS, searchAllIncludingMeetings, searchAllWithMeetings, } from "./search-all-meetings.js";
@@ -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,
@@ -1,4 +1,5 @@
1
1
  export { parseProposalIds } from "./ids.js";
2
2
  export { FACT_SUMMARIES } from "./kinds/findings.js";
3
+ export { ORGANIZATION_ADD_KIND, type OrganizationProposal, proposeOrganization } from "./kinds/organization.js";
3
4
  export { emptyProposalRegistry, proposalRegistry } from "./registry.js";
4
5
  export type { Decided, Decision, ProposalFilter, ProposalKind, ProposalRegistry, ProposalRow } from "./types.js";
@@ -1,3 +1,4 @@
1
1
  export { parseProposalIds } from "./ids.js";
2
2
  export { FACT_SUMMARIES } from "./kinds/findings.js";
3
+ export { ORGANIZATION_ADD_KIND, proposeOrganization } from "./kinds/organization.js";
3
4
  export { emptyProposalRegistry, proposalRegistry } from "./registry.js";
@@ -0,0 +1,11 @@
1
+ import type { Author, MessageStore, Organization, ProposedAction } from "../../../store/index.js";
2
+ import type { ProposalKind } from "../types.js";
3
+ export declare const ORGANIZATION_ADD_KIND = "organization_add";
4
+ export interface OrganizationProposal {
5
+ name: string;
6
+ kind: Organization["kind"];
7
+ scope?: Organization["scope"];
8
+ }
9
+ /** An agent's new organization waits as a stored proposal; the organization exists only once it is confirmed. */
10
+ export declare const proposeOrganization: (store: Pick<MessageStore, "proposedActions">, input: OrganizationProposal, by: Author, reason?: string) => Promise<ProposedAction>;
11
+ export declare const organizationKind: (store: Pick<MessageStore, "proposedActions" | "knowledge">) => ProposalKind;
@@ -0,0 +1,53 @@
1
+ import { proposerOfAction } from "../../../store/index.js";
2
+ import { actionStatus, kept, pushed, storedStatus } from "./shared.js";
3
+ export const ORGANIZATION_ADD_KIND = "organization_add";
4
+ const rowOf = (action) => {
5
+ const { name, kind } = action.payload;
6
+ return {
7
+ id: action.id,
8
+ kind: "organization",
9
+ status: actionStatus(action.status),
10
+ project: null,
11
+ subject: `organization:new`,
12
+ object: null,
13
+ summary: `add ${kind} ${name}`,
14
+ proposedBy: proposerOfAction(action),
15
+ reason: action.reason,
16
+ evidence: [],
17
+ score: null,
18
+ signals: null,
19
+ parts: null,
20
+ createdAt: action.createdAt,
21
+ };
22
+ };
23
+ /** An agent's new organization waits as a stored proposal; the organization exists only once it is confirmed. */
24
+ export const proposeOrganization = (store, input, by, reason) => store.proposedActions.propose({
25
+ kind: ORGANIZATION_ADD_KIND,
26
+ by,
27
+ payload: input,
28
+ ...(reason === undefined ? {} : { reason }),
29
+ });
30
+ export const organizationKind = (store) => ({
31
+ kind: "organization",
32
+ stored: [ORGANIZATION_ADD_KIND],
33
+ list: async (filter) => {
34
+ const status = storedStatus(filter);
35
+ const actions = await store.proposedActions.list({
36
+ kinds: [ORGANIZATION_ADD_KIND],
37
+ ...(status === undefined ? {} : { status }),
38
+ ...pushed(filter),
39
+ });
40
+ return kept(actions.map(rowOf), filter);
41
+ },
42
+ get: async (id) => rowOf(await store.proposedActions.get(id)),
43
+ decide: async (id, { confirm, by, reason }) => {
44
+ if (!confirm) {
45
+ await store.proposedActions.reject(id, by, reason);
46
+ return { id, kind: "organization", status: "rejected", made: [] };
47
+ }
48
+ const { name, kind, scope } = (await store.proposedActions.get(id)).payload;
49
+ const made = await store.knowledge.addOrganization({ name, kind, ...(scope === undefined ? {} : { scope }) });
50
+ await store.proposedActions.approve(id, by, { organization: made.ref });
51
+ return { id, kind: "organization", status: "confirmed", made: [made.ref] };
52
+ },
53
+ });
@@ -9,6 +9,7 @@ import { mailFindingsKind } from "./kinds/mail-findings.js";
9
9
  import { meetingFindingsKind } from "./kinds/meeting-findings.js";
10
10
  import { memoryKind } from "./kinds/memory.js";
11
11
  import { orderKind } from "./kinds/orders.js";
12
+ import { organizationKind } from "./kinds/organization.js";
12
13
  import { relationshipKind } from "./kinds/relationship.js";
13
14
  import { relationshipUpdateKind } from "./kinds/relationship-update.js";
14
15
  import { taskCloseKind } from "./kinds/task-close.js";
@@ -134,6 +135,7 @@ export const proposalRegistry = (store) => {
134
135
  invoiceKind(store),
135
136
  paymentKind(store),
136
137
  orderKind(store),
138
+ organizationKind(store),
137
139
  memoryKind(store),
138
140
  findingsKind(store),
139
141
  mailFindingsKind(store),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.577.0",
3
+ "version": "0.579.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
- };