@celljs/ta-moments 4.13.0 → 4.13.1

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.
@@ -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";
@@ -1672,7 +1693,7 @@ function activate(pi) {
1672
1693
  let briefing = false;
1673
1694
  let answering;
1674
1695
  const answers = async (ctx) => {
1675
- answering ??= !!ctx.getSystemPrompt?.().includes(ANSWER_MARK) || !!await (await reach())?.service?.answering(ctx.sessionManager?.getSessionFile())?.catch(() => false);
1696
+ answering ??= TaHostUtil.marked(ctx.getSystemPrompt?.(), ANSWER_MARK) || !!await (await reach())?.service?.answering(ctx.sessionManager?.getSessionFile())?.catch(() => false);
1676
1697
  return answering;
1677
1698
  };
1678
1699
  pi.on("session_start", () => {
@@ -1685,7 +1706,7 @@ function activate(pi) {
1685
1706
  pi.setActiveTools([]);
1686
1707
  return;
1687
1708
  }
1688
- if (event.messageType === "custom" || ctx.getSystemPrompt?.().includes(TA_WITH_OTHERS_MARK)) {
1709
+ if (event.messageType === "custom" || TaHostUtil.marked(ctx.getSystemPrompt?.(), TA_WITH_OTHERS_MARK)) {
1689
1710
  return;
1690
1711
  }
1691
1712
  const level = await (await reach())?.service?.level().catch(() => "ask");
package/host/index.mjs CHANGED
@@ -46,6 +46,27 @@ var TaHostUtil;
46
46
  });
47
47
  }
48
48
  TaHostUtil2.reach = reach;
49
+ function marked(systemPrompt, mark) {
50
+ return role(systemPrompt).includes(mark);
51
+ }
52
+ TaHostUtil2.marked = marked;
53
+ function role(systemPrompt) {
54
+ if (!systemPrompt) {
55
+ return "";
56
+ }
57
+ const open = `<addendum>
58
+ `;
59
+ const start = systemPrompt.indexOf(open);
60
+ const context = systemPrompt.indexOf(`<project_context>
61
+ `);
62
+ if (start < 0 || context >= 0 && context < start) {
63
+ return "";
64
+ }
65
+ const end = systemPrompt.indexOf(`
66
+ </addendum>`, start);
67
+ return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
68
+ }
69
+ TaHostUtil2.role = role;
49
70
  })(TaHostUtil || (TaHostUtil = {}));
50
71
  var TA_WITH_OTHERS_MARK = "[ta:speaks-with-others]";
51
72
  var TA_BRIEF_SOURCE = "brief";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-moments",
3
- "version": "4.13.0",
3
+ "version": "4.13.1",
4
4
  "description": "A pi package for Ta: Moments, what friends made with Ta that one can take and use. Ta drafts a post of what you made and you post it; your Ta friends see it, like it and take it, their Ta reading the code first",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.13.0",
31
- "@celljs/ta-relay": "4.13.0",
32
- "@celljs/ta-web": "4.13.0",
30
+ "@celljs/ta-protocol": "4.13.1",
31
+ "@celljs/ta-relay": "4.13.1",
32
+ "@celljs/ta-web": "4.13.1",
33
33
  "@types/react": "^19.3.0"
34
34
  },
35
35
  "publishConfig": {
package/web/index.js CHANGED
@@ -539,6 +539,27 @@ var TaHostUtil;
539
539
  });
540
540
  }
541
541
  TaHostUtil2.reach = reach;
542
+ function marked(systemPrompt, mark) {
543
+ return role(systemPrompt).includes(mark);
544
+ }
545
+ TaHostUtil2.marked = marked;
546
+ function role(systemPrompt) {
547
+ if (!systemPrompt) {
548
+ return "";
549
+ }
550
+ const open = `<addendum>
551
+ `;
552
+ const start = systemPrompt.indexOf(open);
553
+ const context = systemPrompt.indexOf(`<project_context>
554
+ `);
555
+ if (start < 0 || context >= 0 && context < start) {
556
+ return "";
557
+ }
558
+ const end = systemPrompt.indexOf(`
559
+ </addendum>`, start);
560
+ return systemPrompt.slice(start + open.length, end < 0 ? undefined : end);
561
+ }
562
+ TaHostUtil2.role = role;
542
563
  })(TaHostUtil || (TaHostUtil = {}));
543
564
  var TA_ASK_ENTRY = "ta-ask";
544
565
  var TaAskUtil;