@celljs/ta-initiative 4.13.0 → 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 +1 -0
- package/README.md +1 -0
- package/extension/index.mjs +24 -3
- package/host/index.mjs +3 -0
- package/package.json +5 -5
- package/web/index.js +10 -7
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/extension/index.mjs
CHANGED
|
@@ -27,6 +27,27 @@ var TaHostUtil;
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
TaHostUtil2.reach = reach;
|
|
30
|
+
function marked(systemPrompt, mark) {
|
|
31
|
+
return role(systemPrompt).includes(mark);
|
|
32
|
+
}
|
|
33
|
+
TaHostUtil2.marked = marked;
|
|
34
|
+
function role(systemPrompt) {
|
|
35
|
+
if (!systemPrompt) {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
const open = `<addendum>
|
|
39
|
+
`;
|
|
40
|
+
const start = systemPrompt.indexOf(open);
|
|
41
|
+
const context = systemPrompt.indexOf(`<project_context>
|
|
42
|
+
`);
|
|
43
|
+
if (start < 0 || context >= 0 && context < start) {
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
const end = systemPrompt.indexOf(`
|
|
47
|
+
</addendum>`, start);
|
|
48
|
+
return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
|
|
49
|
+
}
|
|
50
|
+
TaHostUtil2.role = role;
|
|
30
51
|
})(TaHostUtil || (TaHostUtil = {}));
|
|
31
52
|
var TA_WITH_OTHERS_MARK = "[ta:speaks-with-others]";
|
|
32
53
|
var TA_ASK_ENTRY = "ta-ask";
|
|
@@ -560,11 +581,11 @@ function activate(pi) {
|
|
|
560
581
|
const status = await found?.service?.reviewStatus();
|
|
561
582
|
const file = ctx.sessionManager.getSessionFile();
|
|
562
583
|
const here = !!file && status?.file === file;
|
|
563
|
-
const
|
|
584
|
+
const role = TaHostUtil.role(ctx.getSystemPrompt?.());
|
|
564
585
|
shown = [];
|
|
565
586
|
proposed = 0;
|
|
566
587
|
reviewing = here;
|
|
567
|
-
proposing = !!found?.service && !!file && !
|
|
588
|
+
proposing = !!found?.service && !!file && !role.includes(CRON_RUN_MARK) && !role.includes(TA_WITH_OTHERS_MARK);
|
|
568
589
|
tool(ProposeTool.NAME, here || proposing);
|
|
569
590
|
tool(PaceTool.NAME, here && !!status?.settings.auto);
|
|
570
591
|
tool(ProfileTool.NAME, here && !!status?.settings.learn);
|
|
@@ -572,7 +593,7 @@ function activate(pi) {
|
|
|
572
593
|
if (!status || !found?.service) {
|
|
573
594
|
return;
|
|
574
595
|
}
|
|
575
|
-
const profile = status.settings.learn && since === undefined && status.profile && !ctx.getSystemPrompt?.()
|
|
596
|
+
const profile = status.settings.learn && since === undefined && status.profile && !TaHostUtil.marked(ctx.getSystemPrompt?.(), TA_WITH_OTHERS_MARK);
|
|
576
597
|
if (profile) {
|
|
577
598
|
event.systemPromptOptions.sections = {
|
|
578
599
|
...event.systemPromptOptions.sections,
|
package/host/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-initiative",
|
|
3
|
-
"version": "4.
|
|
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/
|
|
8
|
+
"homepage": "https://github.com/cellbang/ta",
|
|
9
9
|
"bugs": {
|
|
10
|
-
"url": "https://github.com/cellbang/
|
|
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.
|
|
31
|
-
"@celljs/ta-web": "4.
|
|
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: "
|
|
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: "
|
|
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(
|
|
661
|
-
|
|
662
|
-
|
|
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); }
|