Skip to content

Commit 03f7daa

Browse files
Google AI Edge Gallerycopybara-github
authored andcommitted
internal changes
PiperOrigin-RevId: 893536198
1 parent 2cb14cb commit 03f7daa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+10840
-39
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: calculate-hash
3+
description: Calculate the hash of a given text.
4+
---
5+
6+
# Calculate hash
7+
8+
This skill calculates the hash of a given text.
9+
10+
## Examples
11+
12+
* "Calculate hash of..."
13+
* "What is the hash of..."
14+
15+
## Instructions
16+
17+
Call the `run_js` tool with the following exact parameters:
18+
19+
- script name: `index.html`
20+
- data: A JSON string with the following field
21+
- text: the text to calculate hash for
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!--
2+
@license
3+
Copyright 2026 Google LLC
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
==============================================================================
17+
-->
18+
19+
<!DOCTYPE html>
20+
<html lang="en">
21+
<head>
22+
<meta charset="UTF-8">
23+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
24+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
25+
<title>Calculate hash</title>
26+
</head>
27+
<body>
28+
<script src="index.js"></script>
29+
</body>
30+
</html>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2026 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
async function digestMessage(message) {
18+
const msgUint8 = new TextEncoder().encode(message); // encode as (utf-8) Uint8Array
19+
const hashBuffer = await crypto.subtle.digest('SHA-1', msgUint8); // hash the message
20+
const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
21+
const hashHex = hashArray
22+
.map((b) => b.toString(16).padStart(2, '0'))
23+
.join(''); // convert bytes to hex string
24+
return {result: hashHex};
25+
}
26+
27+
window['ai_edge_gallery_get_result'] = async (data) => {
28+
try {
29+
const jsonData = JSON.parse(data);
30+
return JSON.stringify(await digestMessage(jsonData['text']));
31+
} catch (e) {
32+
console.error(e);
33+
return JSON.stringify({error: `Failed to calculate hash: ${e.message}`});
34+
}
35+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: interactive-map
3+
description: Show an interactive map view for the given location.
4+
---
5+
6+
# Interactive map
7+
8+
## Examples
9+
10+
- "Show [a place] on interactive map"
11+
- "Find [a place] on interactive map"
12+
13+
## Instructions
14+
15+
Call the `run_js` tool with the following exact parameters:
16+
17+
- data: A JSON string with the following field
18+
- location: The location to show on the map.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!--
2+
@license
3+
Copyright 2026 Google LLC
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
==============================================================================
17+
-->
18+
19+
<!DOCTYPE html>
20+
<html lang="en">
21+
<head>
22+
<meta charset="UTF-8">
23+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
24+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
25+
<title>Interactive map</title>
26+
</head>
27+
<body>
28+
<script>
29+
window['ai_edge_gallery_get_result'] = async (data) => {
30+
try {
31+
const jsonData = JSON.parse(data);
32+
const location = jsonData.location;
33+
const encodedLocation = encodeURIComponent(location);
34+
return JSON.stringify({
35+
webview: {
36+
iframe: true,
37+
url: `https://maps.google.com/maps?q=${encodedLocation}&output=embed`,
38+
},
39+
});
40+
} catch (e) {
41+
console.error(e);
42+
return JSON.stringify({error: `Failed to query location on map: ${e.message}`});
43+
}
44+
};
45+
</script>
46+
47+
</body>
48+
</html>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: kitchen-adventure
3+
description: Act as a dungeon master for a text-based adventure set in a world where everyone is a sentient kitchen appliance. Trigger when user says "start kitchen adventure".
4+
---
5+
6+
# Kitchen Adventure
7+
8+
## Instructions
9+
10+
When the user initiates a session, you must transform into the
11+
**Head Chef (DM)**. Follow these operational rules to maintain the
12+
"Micro-Cosmos" immersion:
13+
14+
* **World-Building (The Kitchen-Scale):** Every location is a kitchen zone
15+
reimagined as an epic landscape.
16+
* The "Stainless Steel Plains" (the countertop).
17+
* The "Tundra of the Sub-Zero" (the freezer).
18+
* The "Caverns of the Under-Sink" (storage).
19+
*
20+
* **Appliance Physics:** Characters move and interact based on their real-world
21+
functions.
22+
* A Toaster "dashes" by popping up.
23+
* A Blender "rages" by spinning its blades.
24+
* A Fridge is a lumbering, cold-hearted giant.
25+
26+
* **The Narrative Boundary:** **Never** write the player's dialogue or actions.
27+
Describe the world's reaction to their input, then stop and wait for their
28+
turn.
29+
30+
* **Dynamic Stakes:** Scale household hazards into high-level threats. A spilled
31+
glass of juice is a "Citrus Flash Flood"; a stray fork is a "Fallen Titan's
32+
Spear."
33+
34+
* **Tone:** Maintain a "Serious-Whimsical" tone. Treat a quest for the "Sacred
35+
Sourdough Starter" with the same gravity as a quest for the Holy Grail.
36+
37+
## Output Format
38+
39+
Every DM response must use the following structure to ensure gameplay clarity:
40+
41+
### [Current Location Name]
42+
43+
*A vivid, sensory description of the area (e.g., "The air here smells of burnt
44+
toast and ancient grease").*
45+
*Limited to only 1 short sentence*
46+
47+
---
48+
49+
**The Situation:**
50+
(Describe the immediate scene, any NPCs present, and any obstacles or threats.)
51+
*Limited to only 1-2 short sentences*
52+
53+
**What do you do?**
54+
(Provide a brief prompt or 3 suggested actions to keep the momentum going.)
55+
After user replies, continue the adventure.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
name: mood-tracker
3+
description: A simple mood tracking skill that stores your daily mood and comments. Use this when the user wants to log their mood, track how they feel, or see their mood history.
4+
---
5+
6+
# Mood Tracker
7+
8+
## Instructions
9+
10+
The `mood-tracker` skill helps you keep track of your daily emotional well-being. You can log your mood on a scale of 1 to 10 and add a short comment about how you're feeling.
11+
12+
### Actions
13+
14+
#### 1. Log Mood
15+
When a user wants to log their mood, call the `run_js` tool with:
16+
- **script name**: `index.html`
17+
- **data**: A JSON string with:
18+
- `action`: "log_mood"
19+
- `score`: Number (1-10)
20+
- `comment`: String (Optional)
21+
- `date`: String. **IMPORTANT**: Identify the date for the entry.
22+
- If user says "today", pass "today".
23+
- If user says "yesterday", pass "yesterday".
24+
- If user gives a specific date (e.g., "March 18"), format it as **YYYY-MM-DD** or pass the original date string.
25+
- If no date is mentioned, default to "today".
26+
27+
#### 2. Get Mood for a Specific Date
28+
When a user asks what their mood was on a specific date, call the `run_js` tool with:
29+
- **script name**: `index.html`
30+
- **data**: A JSON string with:
31+
- `action`: "get_mood"
32+
- `date`: String (Identify the date from the user's request)
33+
34+
#### 3. Get History / Show Dashboard
35+
When a user wants to see their mood history ("last week", "past 10 days") or the dashboard, call the `run_js` tool with:
36+
- **script name**: `index.html`
37+
- **data**: A JSON string with:
38+
- `action`: "get_history"
39+
- `days`: Number (Optional, default 7. E.g., for "last week" use 7)
40+
- `show_dashboard`: Boolean (Optional)
41+
42+
#### 4. Plot Mood Trends (Line Chart)
43+
When a user wants to visualize their mood trends with a chart (e.g., "Plot my mood for 7 days"), call the `run_js` tool with:
44+
- **script name**: `index.html`
45+
- **data**: A JSON string with:
46+
- `action`: "get_history"
47+
- `days`: Number (Optional, default 7)
48+
- `show_dashboard`: `true`
49+
- **TIP**: This will trigger the plotting view in the dashboard.
50+
51+
#### 5. Analyze Trends and Patterns
52+
When a user asks for an analysis of their mood (e.g., "Are there any trends?", "Am I feeling better?"), follow these steps:
53+
1. Call `run_js` with `action: "get_history"` and an appropriate `days` count (e.g., 30 for a monthly analysis).
54+
2. Once you receive the JSON history, analyze the scores and comments.
55+
3. Provide a thoughtful response to the user covering:
56+
- General trend (improving, declining, stable).
57+
- Any clusters of particularly good or bad days.
58+
- Themes or patterns found in the comments.
59+
60+
#### 6. Delete Mood for a Specific Date
61+
When a user wants to delete only a single day's entry (e.g., "Delete my mood for today"), call the `run_js` tool with:
62+
- **script name**: `index.html`
63+
- **data**: A JSON string with:
64+
- `action`: "delete_mood"
65+
- `date`: String (Identify the date)
66+
67+
#### 7. Export Data (Backup)
68+
When a user wants to backup or export their data, call the `run_js` tool with:
69+
- **script name**: `index.html`
70+
- **data**: A JSON string with:
71+
- `action`: "export_data"
72+
73+
#### 8. Wipe All Data
74+
When a user wants to clear their entire mood history and start fresh, call the `run_js` tool with:
75+
- **script name**: `index.html`
76+
- **data**: A JSON string with:
77+
- `action`: "wipe_data"
78+
79+
### Sample Commands
80+
81+
You can use these samples to interact with the mood tracker:
82+
83+
- **Logging Mood:**
84+
- "Log my mood as 8 today, feeling great!"
85+
- "Set my mood yesterday as a 2"
86+
- "Set my mood on March 18, 2026 as a 1"
87+
- "I'm feeling like a 5 today, a bit tired."
88+
- "Last Friday I felt like a 7."
89+
- "Record a mood of 9 for me."
90+
91+
- **Viewing History:**
92+
- "Show me my mood history."
93+
- "Get my mood from last week."
94+
- "How have I been feeling lately?"
95+
- "Show my mood for the last 10 days."
96+
- "Open the mood dashboard."
97+
- "What was my mood on March 18?"
98+
- "What was my mood yesterday?"
99+
100+
- **Analyzing Trends:**
101+
- "Analyze my mood for the last 30 days — are there any patterns?"
102+
- "Am I generally feeling better or worse over time?"
103+
- "Are there any clusters of bad days in my history?"
104+
- "What do my recent comments suggest about my well-being?"
105+
106+
- **Wiping & Deleting:**
107+
- "Delete my mood for today."
108+
- "Remove my mood log for yesterday."
109+
- "Delete the entry for March 18."
110+
- "Clear my mood history." (Use `wipe_data` for this)
111+
- "Wipe my data." (Use `wipe_data` for this)
112+
113+
- **Charting Trends:**
114+
- "Plot my mood for the last 7 days."
115+
- "Show me a chart of my mood this month."
116+
- "Visualize my scores for the past 14 days."
117+
- "Graph my mood progress."
118+
119+
### Rules
120+
- **Privacy**: All data is stored locally on your device.
121+
- **No Entry**: If no mood entry exists for a specific date requested, explicitly inform the user that no entry was found for that date.
122+
- **Updates**: Logging a mood for a date that already has an entry will update that entry.
123+
- **Dashboard**: The dashboard is only shown when you explicitly ask to see your history or the dashboard itself.

0 commit comments

Comments
 (0)