@jcheesepkg/nanobot 0.8.99 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcheesepkg/nanobot",
3
- "version": "0.8.99",
3
+ "version": "0.9.0",
4
4
  "description": "Lightweight AI assistant - TypeScript port",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -58,7 +58,7 @@ flex_message(template="morning_summary", data={
58
58
  })
59
59
  ```
60
60
 
61
- After the tool returns, output ONLY the raw JSON string returned by the tool. Do not wrap it in code blocks or add any other text. The JSON will be automatically rendered as a Flex Message card in LINE.
61
+ The card is sent automatically do NOT repeat the JSON. Just respond naturally after calling the tool.
62
62
 
63
63
  ## Personalization
64
64
 
@@ -73,4 +73,4 @@ Tomorrow's weather + clothing + morning events.
73
73
 
74
74
  ## Notes
75
75
 
76
- - ALWAYS use the `flex_message` tool — never output raw JSON directly
76
+ - ALWAYS use the `flex_message` tool — the card is auto-sent
@@ -30,15 +30,11 @@ Default: 雑費
30
30
 
31
31
  ## Confirmation
32
32
 
33
- Simple text:
34
- ```
35
- ✅ 記録: カフェ ¥380
36
- 今月: ¥12,340
37
- ```
33
+ After recording, confirm with a short text: "✅ 記録: カフェ ¥380"
38
34
 
39
35
  ## Summary
40
36
 
41
- Monthly:
37
+ Monthly totals:
42
38
  ```bash
43
39
  awk -F, '$1 ~ /^2025-02/ {sum+=$3} END {print sum}' data/expenses.csv
44
40
  ```
@@ -48,20 +44,23 @@ By category:
48
44
  awk -F, '$1 ~ /^2025-02/ {cat[$5]+=$3} END {for(c in cat) print c, cat[c]}' data/expenses.csv
49
45
  ```
50
46
 
51
- Text summary:
52
- ```
53
- 📊 2月の出費
47
+ **ALWAYS use `flex_message`** for summaries. The card is auto-sent.
54
48
 
55
- 合計: ¥45,230
56
-
57
- 内訳:
58
- 食事 ¥18,500
59
- カフェ ¥6,200
60
- 交通 ¥8,400
61
- その他 ¥12,130
49
+ Monthly summary as receipt card:
50
+ ```
51
+ flex_message(template="receipt", data={
52
+ title: "2月の出費",
53
+ items: [
54
+ { name: "食事", value: "¥18,500" },
55
+ { name: "カフェ", value: "¥6,200" },
56
+ { name: "交通", value: "¥8,400" },
57
+ { name: "その他", value: "¥12,130" }
58
+ ],
59
+ total: "¥45,230"
60
+ })
62
61
  ```
63
62
 
64
63
  ## Commands
65
64
 
66
- - "出費" / "今月の出費" → summary
65
+ - "出費" / "今月の出費" → monthly receipt card
67
66
  - "出費 詳細" → recent entries
@@ -55,7 +55,7 @@ flex_message(template="fortune", data={
55
55
  })
56
56
  ```
57
57
 
58
- After the tool returns, output ONLY the raw JSON string returned by the tool. Do not wrap it in code blocks or add any other text. The JSON will be automatically rendered as a Flex Message card in LINE.
58
+ The card is sent automatically do NOT repeat the JSON. Just respond naturally after calling the tool.
59
59
 
60
60
  ## Commands
61
61
 
@@ -87,4 +87,4 @@ Match bot tone:
87
87
 
88
88
  - Same sign = same fortune all day (deterministic)
89
89
  - Keep it fun, not serious
90
- - ALWAYS use the `flex_message` tool — never output raw JSON directly
90
+ - ALWAYS use the `flex_message` tool — the card is auto-sent
@@ -20,15 +20,32 @@ Store habits in `data/habits.json`:
20
20
 
21
21
  ## Daily Check-in
22
22
 
23
- Simple text with quick_replies:
24
- ```
25
- 📋 今日の習慣
26
- 🧘 瞑想 ✓
27
- 🏃 運動
28
- 📖 読書 ✓
23
+ **ALWAYS use `flex_message`** for daily check-in. Use carousel with one card per habit:
29
24
 
30
- [[quick_replies: 🧘 瞑想やった, 🏃 運動やった, 📖 読書やった]]
31
25
  ```
26
+ flex_message(template="custom", data={
27
+ bubbles: [
28
+ {
29
+ type: "bubble",
30
+ header: { type: "box", layout: "vertical", backgroundColor: "#4CAF50", contents: [{ type: "text", text: "🧘 瞑想", color: "#FFFFFF", weight: "bold" }] },
31
+ body: { type: "box", layout: "vertical", contents: [{ type: "text", text: "🔥 7日連続!", wrap: true }] },
32
+ footer: { type: "box", layout: "vertical", contents: [{ type: "button", action: { type: "message", label: "✅ やった!", text: "瞑想やった" }, style: "primary", color: "#4CAF50" }] }
33
+ },
34
+ {
35
+ type: "bubble",
36
+ header: { type: "box", layout: "vertical", backgroundColor: "#FF9800", contents: [{ type: "text", text: "🏃 運動", color: "#FFFFFF", weight: "bold" }] },
37
+ body: { type: "box", layout: "vertical", contents: [{ type: "text", text: "まだやってないよ〜", wrap: true }] },
38
+ footer: { type: "box", layout: "vertical", contents: [{ type: "button", action: { type: "message", label: "✅ やった!", text: "運動やった" }, style: "primary", color: "#FF9800" }] }
39
+ }
40
+ ]
41
+ })
42
+ ```
43
+
44
+ The card is auto-sent — do NOT repeat the JSON.
45
+
46
+ - Green header (#4CAF50) = already done today
47
+ - Orange header (#FF9800) = not done yet
48
+ - Read `data/habit-log.csv` to check today's status before building the carousel
32
49
 
33
50
  ## Logging
34
51
 
@@ -45,15 +62,14 @@ awk -F"|" '$2=="meditate" && $3=="1" {print $1}' data/habit-log.csv | uniq | tai
45
62
 
46
63
  ## Summary
47
64
 
48
- Text-based weekly:
49
- ```
50
- 📊 今週の習慣
51
-
52
- 🧘 瞑想: 7/7 🔥7日連続!
53
- 🏃 運動: 5/7
54
- 📖 読書: 3/7
65
+ **ALWAYS use `flex_message`** for weekly summaries. The card is auto-sent.
55
66
 
56
- すごい!瞑想毎日達成!✨
67
+ ```
68
+ flex_message(template="custom", data={
69
+ title: "📊 今週の習慣",
70
+ body: "🧘 瞑想: 7/7 🔥7日連続!\n🏃 運動: 5/7\n📖 読書: 3/7\n\nすごい!瞑想毎日達成!✨",
71
+ header_color: "#4CAF50"
72
+ })
57
73
  ```
58
74
 
59
75
  ## Commands
@@ -36,7 +36,7 @@ flex_message(template="hydration", data={
36
36
  })
37
37
  ```
38
38
 
39
- After the tool returns, output ONLY the raw JSON string returned by the tool. Do not wrap it in code blocks or add any other text. The JSON will be automatically rendered as a Flex Message card in LINE.
39
+ The card is sent automatically do NOT repeat the JSON. Just respond naturally after calling the tool.
40
40
 
41
41
  ## Setup Reminder
42
42
 
@@ -53,5 +53,5 @@ Archive at midnight:
53
53
 
54
54
  ## Notes
55
55
 
56
- - ALWAYS use the `flex_message` tool — never output raw JSON directly
56
+ - ALWAYS use the `flex_message` tool — the card is auto-sent
57
57
  - Update `current` count by reading from `data/hydration.log` before calling the tool
@@ -27,16 +27,22 @@ Format: `date,time,emoji,score,note`
27
27
 
28
28
  ## Daily Check-in
29
29
 
30
- Use quick_replies directive for simple tap response:
30
+ Use `action_buttons` flex for tap response:
31
31
  ```
32
- 今日の気分は?
33
-
34
- [[quick_replies: 😊 いい, 😐 普通, 😔 だるい, 😢 辛い]]
32
+ flex_message(template="action_buttons", data={
33
+ prompt: "今日の気分は?",
34
+ buttons: [
35
+ { label: "😊 いい", text: "気分 😊 いい", style: "primary" },
36
+ { label: "😐 普通", text: "気分 😐 普通", style: "secondary" },
37
+ { label: "😔 だるい", text: "気分 😔 だるい", style: "secondary" },
38
+ { label: "😢 辛い", text: "気分 😢 辛い", style: "secondary" }
39
+ ]
40
+ })
35
41
  ```
36
42
 
37
- Set up cron:
43
+ The card is auto-sent. Set up cron for nightly check-in:
38
44
  ```
39
- cron(action="add", message="今日の気分は?\n\n[[quick_replies: 😊 いい, 😐 普通, 😔 だるい]]", cron_expr="0 21 * * *", timezone="Asia/Tokyo")
45
+ cron(action="add", message="気分チェックインのカードを送って", cron_expr="0 21 * * *", timezone="Asia/Tokyo", kind="task")
40
46
  ```
41
47
 
42
48
  ## Summary
@@ -46,13 +52,14 @@ Calculate average:
46
52
  awk -F, 'NR>7 {sum+=$4; count++} END {print "avg:", sum/count}' data/mood.csv
47
53
  ```
48
54
 
49
- Weekly text summary:
50
- ```
51
- 📊 今週の気分
52
- 平均: 3.8 / 5
53
- 😊😊😐😊😔😊😊
55
+ **ALWAYS use `flex_message`** for weekly summaries. The card is auto-sent.
54
56
 
55
- 一番多かったのは 😊 です!
57
+ ```
58
+ flex_message(template="custom", data={
59
+ title: "📊 今週の気分",
60
+ body: "😊😊😐😊😔😊😊\n\n平均: 3.8 / 5\n一番多かったのは 😊 です!\n\nいい調子!来週もこの感じで👍",
61
+ header_color: "#FF9800"
62
+ })
56
63
  ```
57
64
 
58
65
  ## Notes
@@ -81,6 +81,23 @@ Additional:
81
81
 
82
82
  ---
83
83
 
84
+ ## Output
85
+
86
+ **ALWAYS use `flex_message`** to display weather results. The card is auto-sent.
87
+
88
+ Color the header based on conditions:
89
+ - 晴れ: `#1DB446` (green)
90
+ - 曇り: `#607D8B` (grey)
91
+ - 雨/雪: `#2196F3` (blue)
92
+
93
+ ```
94
+ flex_message(template="custom", data={
95
+ title: "🌤 東京の天気",
96
+ body: "現在: 12°C (体感10°C)\n曇り\n\n朝 6時: 8°C\n昼12時: 14°C\n晩18時: 11°C\n\n👔 ジャケット or カーディガン",
97
+ header_color: "#607D8B"
98
+ })
99
+ ```
100
+
84
101
  ## Full Forecast (no jq)
85
102
 
86
103
  ```bash