@celljs/ta-initiative 4.13.1 → 4.14.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/README.en.md CHANGED
@@ -61,6 +61,7 @@ The hosts of other packages call it with `callPackageHost('@celljs/ta-initiative
61
61
  - `offer({ kind, title, why, evidence?, cwd?, key?, action?, undo?, expiresAt?, kindTitle?, inTurn?, done? })` → `{ id, delivered, state }`: `action` is `{ type: 'call', package, method, params }`, `{ type: 'prompt', prompt, cwd? }` (run in a new conversation) or `{ type: 'session', sessionFile, prompt }` (sent to that conversation as the user's message; `inTurn`: the turn that offers it does it itself at Do it, tell me; `done`: it did already); `undo` is `{ package, method, params }` or `{ type: 'session', sessionFile, prompt }`, a param `"$result.id"` being the `id` of what the action returned. Offered again with the same `key` while one waits, it is not repeated. A proposal without `action` is never done on its own.
62
62
  - `record({ kind, title, why, outcome: 'accepted' | 'declined' })`: what the user decided in a card of your own (the skill card of ta-recall says so this way).
63
63
  - `decide(id, 'accept' | 'decline' | 'always' | 'never')`, `undo(id)`, `setLevel(kind, level | null)`, `setMode(mode)`, `kinds()`.
64
+ - `proposals()`: the proposals kept and how each ended, newest last. Another package (the brief of ta-recall) reads them so, not by the data of this package.
64
65
  - The review: `reviewStatus()`, `reviewNow()`, `setPace(days, reason)`, `setProfile(profile)`.
65
66
 
66
67
  Design records: `docs/design/ta-initiative.md` (the whole), `docs/design/ta-evolve.md` (the weekly review and what Ta learns of you).
package/README.md CHANGED
@@ -61,6 +61,7 @@ Ta 自带的 pi 包(默认开启,可在 Web 客户端的 设置 → 扩展
61
61
  - `offer({ kind, title, why, evidence?, cwd?, key?, action?, undo?, expiresAt?, kindTitle?, inTurn?, done? })` → `{ id, delivered, state }`:`action` 是 `{ type: 'call', package, method, params }`、`{ type: 'prompt', prompt, cwd? }`(在新对话里运行)或 `{ type: 'session', sessionFile, prompt }`(作为用户消息发进那个对话;`inTurn` 表示提出它的这一轮在"先做后报"时自己做,`done` 表示已经做了);`undo` 是 `{ package, method, params }` 或 `{ type: 'session', sessionFile, prompt }`,参数里的 `"$result.id"` 换成 action 返回值的 `id`。同一个 `key` 还在等时再提不会重复。没有 `action` 的提议不会被直接做。
62
62
  - `record({ kind, title, why, outcome: 'accepted' | 'declined' })`:用户在你自己的卡片上做了决定(ta-recall 的技能卡就这样回报)。
63
63
  - `decide(id, 'accept' | 'decline' | 'always' | 'never')`、`undo(id)`、`setLevel(kind, level | null)`、`setMode(mode)`、`kinds()`。
64
+ - `proposals()`:保留的提议及结局,新的在后。别的包(ta-recall 的简报)这样读,不读本包的数据。
64
65
  - 回顾:`reviewStatus()`、`reviewNow()`、`setPace(days, reason)`、`setProfile(profile)`。
65
66
 
66
67
  设计记录:`docs/design/ta-initiative.md`(整体)、`docs/design/ta-evolve.md`(每周回顾与用户画像)。
package/host/index.mjs CHANGED
@@ -1123,6 +1123,9 @@ class InitiativeHost {
1123
1123
  setMode(mode) {
1124
1124
  return this.book.setMode(mode);
1125
1125
  }
1126
+ async proposals() {
1127
+ return this.book.list();
1128
+ }
1126
1129
  reviewStatus() {
1127
1130
  return this.review.reviewStatus();
1128
1131
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@celljs/ta-initiative",
3
- "version": "4.13.1",
3
+ "version": "4.14.0",
4
4
  "description": "A pi package for Ta: what Ta does on its own and how far, by kind and by the user's trust; proposals other packages offer, the user's suggestions to decide or undo, and a weekly review that keeps the scheduled tasks and learns the user",
5
5
  "keywords": [
6
6
  "pi-package"
7
7
  ],
8
- "homepage": "https://github.com/cellbang/cell",
8
+ "homepage": "https://github.com/cellbang/ta",
9
9
  "bugs": {
10
- "url": "https://github.com/cellbang/cell/issues"
10
+ "url": "https://github.com/cellbang/ta/issues"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
@@ -27,8 +27,8 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.13.1",
31
- "@celljs/ta-web": "4.13.1",
30
+ "@celljs/ta-protocol": "4.14.0",
31
+ "@celljs/ta-web": "4.14.0",
32
32
  "@types/react": "^19.3.0"
33
33
  },
34
34
  "publishConfig": {
package/web/index.js CHANGED
@@ -25,7 +25,8 @@ var en = {
25
25
  inboxTitle: "Suggestions",
26
26
  inboxWaiting: "Waiting for you",
27
27
  inboxDone: "Done on its own",
28
- inboxEmpty: "Nothing waits. When Ta finds work you ask for again and again, it suggests it here.",
28
+ inboxEmpty: "No suggestions yet",
29
+ inboxEmptyHint: "When Ta finds work you ask for again and again, it suggests it here.",
29
30
  accept: "OK",
30
31
  decline: "No",
31
32
  always: "Always do it",
@@ -97,7 +98,8 @@ var zh = {
97
98
  inboxTitle: "Ta 的建议",
98
99
  inboxWaiting: "等你决定",
99
100
  inboxDone: "已替你做",
100
- inboxEmpty: "暂时没有建议。Ta 发现你反复交代的事,会在这里提出。",
101
+ inboxEmpty: "暂时没有建议",
102
+ inboxEmptyHint: "Ta 发现你反复交代的事,会在这里提出。",
101
103
  accept: "好",
102
104
  decline: "不用",
103
105
  always: "以后直接做",
@@ -410,7 +412,7 @@ class InitiativeStore {
410
412
  const newest = this.current.proposals.reduce((at, proposal) => Math.max(at, proposal.at, proposal.decidedAt ?? 0), 0);
411
413
  if (newest > this.current.seen) {
412
414
  this.set({ ...this.current, seen: newest });
413
- this.pi.storage.set(Keys.SEEN, newest).catch(() => {
415
+ this.pi.storage.get(Keys.SEEN).then((kept) => typeof kept === "number" && kept >= newest ? undefined : this.pi.storage.set(Keys.SEEN, newest)).catch(() => {
414
416
  return;
415
417
  });
416
418
  }
@@ -657,9 +659,10 @@ function Inbox({ pi, store }) {
657
659
  }, [store, state.loaded, state.proposals]);
658
660
  return /* @__PURE__ */ React.createElement("div", {
659
661
  className: "tin-inbox"
660
- }, waiting.length === 0 && done.length === 0 && state.loaded && /* @__PURE__ */ React.createElement("div", {
661
- className: "tin-empty"
662
- }, words.inboxEmpty), waiting.length > 0 && /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h3", {
662
+ }, waiting.length === 0 && done.length === 0 && state.loaded && /* @__PURE__ */ React.createElement(pi.ui.Empty, {
663
+ title: words.inboxEmpty,
664
+ hint: words.inboxEmptyHint
665
+ }), waiting.length > 0 && /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement("h3", {
663
666
  className: "tin-head"
664
667
  }, words.inboxWaiting), /* @__PURE__ */ React.createElement("ul", {
665
668
  className: "tin-list"
@@ -1089,7 +1092,7 @@ var STYLE = `
1089
1092
  .tev-profile-text { width: 100%; height: auto; min-height: 160px; padding: 8px; box-sizing: border-box; line-height: 1.55; resize: vertical; font-size: calc(13px * var(--ta-font-scale)); }
1090
1093
  [data-touch] .tev-profile-text { font-size: 16px; }
1091
1094
  /* The suggestions: a card each, its kind, what and why, the answers */
1092
- .tin-inbox { max-width: 680px; margin: 0 auto; padding: 12px 16px 32px; }
1095
+ .tin-inbox { display: flex; flex-direction: column; min-height: 100%; max-width: 680px; margin: 0 auto; padding: 12px 16px 32px; box-sizing: border-box; }
1093
1096
  .tin-head { margin: 16px 2px 8px; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); font-weight: 500; }
1094
1097
  .tin-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
1095
1098
  .tin-card { padding: 12px 14px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: var(--ta-card); }