pi-coding-master 0.2.7 → 0.2.8
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/deploy/scripts/build-github.sh +162 -122
- package/package.json +5 -8
- package/README.md +0 -50
- package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py +0 -80
- package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.CHANGELOG +0 -1
- package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.SPEC +0 -3
- package/core/individual.bio.organs/ears.listen/config.json +0 -9
- package/core/individual.bio.organs/hands.fileactions/authorize.TRUST +0 -1
- package/core/technology.phone/apps.preinstalled/albums.FUTURE/albums.ts +0 -69
- package/core/technology.phone/apps.preinstalled/albums.FUTURE/albums.ts.SPEC +0 -15
- package/core/technology.phone/apps.preinstalled/contacts.FUTURE/contacts.ts +0 -300
- package/core/technology.phone/apps.preinstalled/contacts.FUTURE/contacts.ts.SPEC +0 -22
- package/core/technology.phone/apps.preinstalled/developer.FUTURE/developer.ts +0 -22
- package/core/technology.phone/apps.preinstalled/developer.FUTURE/developer.ts.SPEC +0 -15
- package/core/technology.phone/apps.preinstalled/siri.FUTURE/siri.ts +0 -22
- package/core/technology.phone/apps.preinstalled/siri.FUTURE/siri.ts.SPEC +0 -15
- package/core/technology.phone/apps.system/finder.FUTURE/finder.ts +0 -64
- package/core/technology.phone/apps.system/finder.FUTURE/finder.ts.SPEC +0 -8
- package/core/technology.server/data/cookies/arxiv.json +0 -30
- package/core/technology.server/data/cookies/bili.json +0 -184
- package/core/technology.server/data/cookies/default.json +0 -30
- package/core/technology.server/data/cookies/news.json +0 -113
- package/core/technology.server/data/cookies/s1.json +0 -45
- package/core/technology.server/data/cookies/safari.json +0 -184
- package/core/technology.server/data/cookies/safari2.json +0 -1
- package/core/technology.server/data/cookies/safaridbg.json +0 -1
- package/core/technology.server/data/cookies/search.json +0 -45
- package/core/technology.server/data/cookies/sw.json +0 -30
- package/core/technology.server/data/cookies/t1.json +0 -1
- package/core/technology.server/data/cookies/testread.json +0 -1
- package/core/technology.server/data/cookies/video1.json +0 -113
- package/core/technology.server/data/cookies/yt.json +0 -170
- package/core/technology.server/data/cookies/yt2.json +0 -113
- package/deploy/dist-overrides/vendor.REMOVED/jiti/lib/jiti.mjs +0 -3
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# build-github.sh — 从 DEV
|
|
2
|
+
# build-github.sh — 从 DEV 打包发布
|
|
3
|
+
#
|
|
3
4
|
# 用法:
|
|
4
|
-
# bash Codebase/deploy/scripts/build-github.sh
|
|
5
|
-
# bash Codebase/deploy/scripts/build-github.sh
|
|
6
|
-
# bash Codebase/deploy/scripts/build-github.sh
|
|
5
|
+
# bash Codebase/deploy/scripts/build-github.sh 0.2.8 # 发 dev + stable
|
|
6
|
+
# bash Codebase/deploy/scripts/build-github.sh 0.2.8 dev # 只发 dev
|
|
7
|
+
# bash Codebase/deploy/scripts/build-github.sh 0.2.8 stable # 只发 stable
|
|
8
|
+
#
|
|
9
|
+
# 目录结构:
|
|
10
|
+
# pi-coding-master.DEV/ ← 开发(无版本号)
|
|
11
|
+
# pi-coding-master.RELEASE/
|
|
12
|
+
# v0.2.8-dev/ ← 全量快照 → push github-dev
|
|
13
|
+
# v0.2.8-stable/ ← 精简包 → push github-release + npm publish
|
|
14
|
+
# VERSION.INDEX ← 版本记录
|
|
7
15
|
set -e
|
|
8
16
|
|
|
9
17
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
10
18
|
DEV="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
11
19
|
PARENT="$(dirname "$DEV")"
|
|
12
|
-
GH_DEV="$PARENT/pi-coding-master.GITHUB"
|
|
13
|
-
GH_REL="$PARENT/pi-coding-master.RELEASE-GITHUB"
|
|
14
20
|
RELEASE_DIR="$PARENT/pi-coding-master.RELEASE"
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
VER="${1:-}"
|
|
23
|
+
TARGET="${2:-all}"
|
|
17
24
|
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
if [ -z "$VER" ]; then
|
|
26
|
+
echo "用法: $0 <版本号> [dev|stable|all]"
|
|
27
|
+
echo " 例: $0 0.2.8"
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
DEV_DIR="$RELEASE_DIR/v${VER}-dev"
|
|
32
|
+
STABLE_DIR="$RELEASE_DIR/v${VER}-stable"
|
|
33
|
+
VERSION_INDEX="$RELEASE_DIR/VERSION.INDEX"
|
|
34
|
+
|
|
35
|
+
# ── 共用排除 ──
|
|
36
|
+
CLEAN_EXCLUDES=(
|
|
20
37
|
--exclude='.DS_Store'
|
|
21
38
|
--exclude='__pycache__'
|
|
22
39
|
--exclude='*.pyc'
|
|
@@ -34,31 +51,19 @@ COMMON_EXCLUDES=(
|
|
|
34
51
|
--exclude='*ABANDONED*'
|
|
35
52
|
--exclude='*REMOVED*'
|
|
36
53
|
--exclude='*FUTURE*'
|
|
54
|
+
--exclude='.git'
|
|
37
55
|
)
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
--exclude='.DS_Store'
|
|
41
|
-
--exclude='Paper/'
|
|
42
|
-
--exclude='#human.Paper/'
|
|
43
|
-
--exclude='*.aux'
|
|
44
|
-
--exclude='*.out'
|
|
45
|
-
--exclude='*.log'
|
|
46
|
-
--exclude='*.synctex.gz'
|
|
47
|
-
--exclude='.!*'
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
# ── 共用:安全检查 ──
|
|
57
|
+
# ── 安全检查 ──
|
|
51
58
|
security_check() {
|
|
52
59
|
local dir="$1" label="$2"
|
|
53
|
-
echo " 安全检查 ($label)..."
|
|
54
60
|
local leaked=0
|
|
55
|
-
# 拆开字符串防自匹配
|
|
56
61
|
local p1='7mTFF''zKEkzC4DcV3'
|
|
57
62
|
local p2='53487''81537'
|
|
58
63
|
local p3='/Users/zhang''kezhen'
|
|
59
64
|
for pattern in "$p1" "$p2" "$p3"; do
|
|
60
65
|
if grep -rq --exclude='build-github.sh' "$pattern" "$dir" 2>/dev/null; then
|
|
61
|
-
echo "
|
|
66
|
+
echo " LEAKED: $pattern"
|
|
62
67
|
leaked=1
|
|
63
68
|
fi
|
|
64
69
|
done
|
|
@@ -66,114 +71,98 @@ security_check() {
|
|
|
66
71
|
echo " Error: $label 有敏感信息泄露,中止。"
|
|
67
72
|
return 1
|
|
68
73
|
fi
|
|
69
|
-
|
|
70
|
-
local old="pi-ali""ve"
|
|
71
|
-
local count
|
|
72
|
-
count=$(grep -r --exclude='build-github.sh' -c "$old" "$dir" 2>/dev/null | awk -F: '{s+=$2}END{print s+0}')
|
|
73
|
-
if [ "$count" -gt 0 ]; then
|
|
74
|
-
echo " WARN: $label 仍有 $count 处 '$old' 引用"
|
|
75
|
-
fi
|
|
76
|
-
echo " OK $label 安全检查通过"
|
|
77
|
-
return 0
|
|
74
|
+
echo " OK 安全检查通过"
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
# ══════════════════════════════════════════════════════════════════════
|
|
81
|
-
# DEV
|
|
78
|
+
# DEV 版:全量(Codebase + Docs)→ github-dev
|
|
82
79
|
# ══════════════════════════════════════════════════════════════════════
|
|
83
80
|
build_dev() {
|
|
84
81
|
echo ""
|
|
85
|
-
echo "══ build
|
|
86
|
-
echo " DEV: $DEV"
|
|
87
|
-
echo " TARGET: $GH_DEV"
|
|
82
|
+
echo "══ build v${VER}-dev ══"
|
|
88
83
|
|
|
89
|
-
|
|
90
|
-
echo " Error: $GH_DEV/.git 不存在。先 git clone pi-coding-master-dev 到该目录。"
|
|
91
|
-
return 1
|
|
92
|
-
fi
|
|
84
|
+
mkdir -p "$DEV_DIR"
|
|
93
85
|
|
|
94
|
-
#
|
|
95
|
-
rsync -a --delete "${
|
|
96
|
-
|
|
86
|
+
# Codebase
|
|
87
|
+
rsync -a --delete "${CLEAN_EXCLUDES[@]}" --exclude='debug/logs/' \
|
|
88
|
+
"$DEV/Codebase/" "$DEV_DIR/Codebase/"
|
|
97
89
|
|
|
98
|
-
#
|
|
99
|
-
rsync -a --delete "${
|
|
100
|
-
|
|
90
|
+
# Docs(排除 Paper)
|
|
91
|
+
rsync -a --delete "${CLEAN_EXCLUDES[@]}" \
|
|
92
|
+
--exclude='Paper/' --exclude='#human.Paper/' \
|
|
93
|
+
--exclude='*.aux' --exclude='*.out' --exclude='*.synctex.gz' --exclude='.!*' \
|
|
94
|
+
"$DEV/Docs/" "$DEV_DIR/Docs/"
|
|
101
95
|
|
|
102
|
-
# .gitignore
|
|
103
|
-
[ -f "$DEV/.gitignore" ] && cp "$DEV/.gitignore" "$
|
|
96
|
+
# .gitignore + README
|
|
97
|
+
[ -f "$DEV/.gitignore" ] && cp "$DEV/.gitignore" "$DEV_DIR/.gitignore"
|
|
98
|
+
[ -f "$DEV_DIR/Codebase/deploy/scripts/build-github.sh" ] || true
|
|
104
99
|
|
|
105
|
-
|
|
100
|
+
echo " OK 打包完成"
|
|
101
|
+
security_check "$DEV_DIR/Codebase/" "dev" || return 1
|
|
106
102
|
|
|
107
|
-
#
|
|
108
|
-
|
|
103
|
+
# git init + push
|
|
104
|
+
if [ ! -d "$DEV_DIR/.git" ]; then
|
|
105
|
+
cd "$DEV_DIR"
|
|
106
|
+
git init -b main
|
|
107
|
+
git remote add origin https://github.com/ApolloZhangOnGithub/pi-coding-master-dev.git 2>/dev/null || true
|
|
108
|
+
fi
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
cd "$GH_DEV"
|
|
110
|
+
cd "$DEV_DIR"
|
|
112
111
|
git add -A
|
|
113
112
|
if git diff --cached --quiet 2>/dev/null; then
|
|
114
|
-
echo "
|
|
113
|
+
echo " 无变更。"
|
|
115
114
|
else
|
|
116
|
-
|
|
117
|
-
git
|
|
118
|
-
|
|
119
|
-
echo " OK pushed to pi-coding-master-dev"
|
|
115
|
+
git commit -m "v${VER}-dev $(date '+%Y-%m-%d %H:%M')"
|
|
116
|
+
git push origin main --force
|
|
117
|
+
echo " OK pushed github-dev"
|
|
120
118
|
fi
|
|
121
119
|
}
|
|
122
120
|
|
|
123
121
|
# ══════════════════════════════════════════════════════════════════════
|
|
124
|
-
#
|
|
125
|
-
# 只包含 npm 需要的文件:core/ deploy/ package.json README.md
|
|
122
|
+
# STABLE 版:精简(core + deploy + package.json)→ github-release + npm
|
|
126
123
|
# ══════════════════════════════════════════════════════════════════════
|
|
127
|
-
|
|
124
|
+
build_stable() {
|
|
128
125
|
echo ""
|
|
129
|
-
echo "══ build
|
|
126
|
+
echo "══ build v${VER}-stable ══"
|
|
130
127
|
|
|
131
|
-
|
|
132
|
-
local latest
|
|
133
|
-
latest=$(ls -d "$RELEASE_DIR"/v*-stable 2>/dev/null | sort -V | tail -1)
|
|
134
|
-
if [ -z "$latest" ]; then
|
|
135
|
-
echo " Error: 没找到 release 版本目录 ($RELEASE_DIR/v*-stable)"
|
|
136
|
-
return 1
|
|
137
|
-
fi
|
|
138
|
-
local ver
|
|
139
|
-
ver=$(basename "$latest" | sed 's/-stable//')
|
|
140
|
-
echo " RELEASE: $latest ($ver)"
|
|
141
|
-
echo " TARGET: $GH_REL"
|
|
142
|
-
|
|
143
|
-
# 初始化 release github 目录
|
|
144
|
-
if [ ! -d "$GH_REL" ]; then
|
|
145
|
-
mkdir -p "$GH_REL"
|
|
146
|
-
cd "$GH_REL"
|
|
147
|
-
git init
|
|
148
|
-
git remote add origin https://github.com/ApolloZhangOnGithub/pi-coding-master-release.git
|
|
149
|
-
git checkout -b main 2>/dev/null || true
|
|
150
|
-
fi
|
|
128
|
+
mkdir -p "$STABLE_DIR"
|
|
151
129
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
130
|
+
# core(精简,无 debug)
|
|
131
|
+
rsync -a --delete "${CLEAN_EXCLUDES[@]}" --exclude='debug/' \
|
|
132
|
+
"$DEV/Codebase/core/" "$STABLE_DIR/core/"
|
|
133
|
+
|
|
134
|
+
# deploy
|
|
135
|
+
rsync -a --delete "${CLEAN_EXCLUDES[@]}" \
|
|
136
|
+
"$DEV/Codebase/deploy/" "$STABLE_DIR/deploy/"
|
|
137
|
+
|
|
138
|
+
# package.json(自动写入版本号)
|
|
139
|
+
if [ -f "$STABLE_DIR/package.json" ]; then
|
|
140
|
+
sed -i '' "s/\"version\": *\"[^\"]*\"/\"version\": \"$VER\"/" "$STABLE_DIR/package.json"
|
|
141
|
+
else
|
|
142
|
+
cat > "$STABLE_DIR/package.json" << PKGEOF
|
|
143
|
+
{
|
|
144
|
+
"name": "pi-coding-master",
|
|
145
|
+
"version": "$VER",
|
|
146
|
+
"description": "Living AI agent extension for pi-coding-agent",
|
|
147
|
+
"license": "MIT",
|
|
148
|
+
"os": ["darwin", "linux"],
|
|
149
|
+
"engines": { "node": ">=18" },
|
|
150
|
+
"dependencies": {
|
|
151
|
+
"@earendil-works/pi-coding-agent": "0.79.10"
|
|
152
|
+
},
|
|
153
|
+
"scripts": {
|
|
154
|
+
"postinstall": "bash deploy/install.sh"
|
|
155
|
+
},
|
|
156
|
+
"files": ["core/", "deploy/", "README.md"]
|
|
157
|
+
}
|
|
158
|
+
PKGEOF
|
|
155
159
|
fi
|
|
156
160
|
|
|
157
|
-
#
|
|
158
|
-
|
|
159
|
-
rsync -a --delete --exclude='.DS_Store' "$DEV/Codebase/deploy/" "$latest/deploy/"
|
|
160
|
-
echo " OK release 源码已从 DEV 同步"
|
|
161
|
-
|
|
162
|
-
# 同步到 github-release 目录
|
|
163
|
-
rsync -a --delete \
|
|
164
|
-
--exclude='.DS_Store' --exclude='__pycache__' --exclude='*.pyc' \
|
|
165
|
-
--exclude='node_modules' --exclude='*.log' --exclude='data/cookies/' \
|
|
166
|
-
--exclude='authorize.TRUST' --exclude='ears.listen/config.json' \
|
|
167
|
-
--exclude='*ABANDONED*' --exclude='*REMOVED*' --exclude='*FUTURE*' \
|
|
168
|
-
--exclude='debug/' \
|
|
169
|
-
"$latest/core/" "$GH_REL/core/"
|
|
170
|
-
rsync -a --delete --exclude='.DS_Store' "$latest/deploy/" "$GH_REL/deploy/"
|
|
171
|
-
[ -f "$latest/package.json" ] && cp "$latest/package.json" "$GH_REL/package.json"
|
|
172
|
-
[ -f "$latest/README.md" ] && cp "$latest/README.md" "$GH_REL/README.md"
|
|
173
|
-
[ -f "$latest/RELEASE.README" ] && cp "$latest/RELEASE.README" "$GH_REL/RELEASE.README"
|
|
161
|
+
# README
|
|
162
|
+
[ ! -f "$STABLE_DIR/README.md" ] && [ -f "$DEV_DIR/README.md" ] && cp "$DEV_DIR/README.md" "$STABLE_DIR/README.md"
|
|
174
163
|
|
|
175
164
|
# .gitignore
|
|
176
|
-
cat > "$
|
|
165
|
+
cat > "$STABLE_DIR/.gitignore" << 'GITEOF'
|
|
177
166
|
.DS_Store
|
|
178
167
|
__pycache__/
|
|
179
168
|
*.pyc
|
|
@@ -182,38 +171,89 @@ node_modules/
|
|
|
182
171
|
data/cookies/
|
|
183
172
|
*.pem
|
|
184
173
|
*.key
|
|
174
|
+
authorize.TRUST
|
|
175
|
+
ears.listen/config.json
|
|
176
|
+
*ABANDONED*
|
|
177
|
+
*REMOVED*
|
|
178
|
+
*FUTURE*
|
|
185
179
|
GITEOF
|
|
186
180
|
|
|
187
|
-
|
|
188
|
-
security_check "$
|
|
181
|
+
echo " OK 打包完成"
|
|
182
|
+
security_check "$STABLE_DIR/core/" "stable" || return 1
|
|
183
|
+
|
|
184
|
+
# git init + push
|
|
185
|
+
if [ ! -d "$STABLE_DIR/.git" ]; then
|
|
186
|
+
cd "$STABLE_DIR"
|
|
187
|
+
git init -b main
|
|
188
|
+
git remote add origin https://github.com/ApolloZhangOnGithub/pi-coding-master-release.git 2>/dev/null || true
|
|
189
|
+
fi
|
|
189
190
|
|
|
190
|
-
|
|
191
|
-
cd "$GH_REL"
|
|
191
|
+
cd "$STABLE_DIR"
|
|
192
192
|
git add -A
|
|
193
193
|
if git diff --cached --quiet 2>/dev/null; then
|
|
194
|
-
echo "
|
|
194
|
+
echo " git 无变更。"
|
|
195
|
+
else
|
|
196
|
+
git commit -m "v${VER}-stable $(date '+%Y-%m-%d %H:%M')"
|
|
197
|
+
git push origin main --force
|
|
198
|
+
echo " OK pushed github-release"
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
# tag
|
|
202
|
+
if ! git tag -l "v${VER}" | grep -q "v${VER}"; then
|
|
203
|
+
git tag "v${VER}"
|
|
204
|
+
git push origin "v${VER}" 2>/dev/null || true
|
|
205
|
+
echo " OK tag v${VER}"
|
|
206
|
+
fi
|
|
207
|
+
|
|
208
|
+
# npm publish
|
|
209
|
+
local npm_ver
|
|
210
|
+
npm_ver=$(npm view pi-coding-master version 2>/dev/null || echo "")
|
|
211
|
+
if [ "$npm_ver" != "$VER" ]; then
|
|
212
|
+
echo " npm publish ${VER}..."
|
|
213
|
+
npm publish || echo " WARN: npm publish 失败(可能需要 --otp)"
|
|
195
214
|
else
|
|
196
|
-
|
|
197
|
-
git commit -m "$msg"
|
|
198
|
-
git push -u origin main 2>/dev/null || git push --set-upstream origin main
|
|
199
|
-
echo " OK pushed to pi-coding-master-release"
|
|
215
|
+
echo " npm ${VER} 已是最新。"
|
|
200
216
|
fi
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
# ── VERSION.INDEX ──
|
|
220
|
+
update_index() {
|
|
221
|
+
local dev_ok="x" stable_ok="x"
|
|
222
|
+
[ -d "$DEV_DIR/Codebase" ] && dev_ok="✓"
|
|
223
|
+
[ -d "$STABLE_DIR/core" ] && stable_ok="✓"
|
|
224
|
+
|
|
225
|
+
local npm_ver
|
|
226
|
+
npm_ver=$(npm view pi-coding-master version 2>/dev/null || echo "")
|
|
227
|
+
local npm_ok="x"
|
|
228
|
+
[ "$npm_ver" = "$VER" ] && npm_ok="✓"
|
|
201
229
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
echo "
|
|
230
|
+
local line="v${VER} dev:${dev_ok} stable:${stable_ok} npm:${npm_ok} $(date '+%Y-%m-%d %H:%M')"
|
|
231
|
+
|
|
232
|
+
# 创建或更新
|
|
233
|
+
if [ ! -f "$VERSION_INDEX" ]; then
|
|
234
|
+
echo "# VERSION.INDEX — 版本发布记录" > "$VERSION_INDEX"
|
|
235
|
+
echo "# 格式: 版本 dev stable npm 日期" >> "$VERSION_INDEX"
|
|
236
|
+
echo "" >> "$VERSION_INDEX"
|
|
207
237
|
fi
|
|
238
|
+
|
|
239
|
+
# 去掉旧的同版本行,追加新行
|
|
240
|
+
grep -v "^v${VER} " "$VERSION_INDEX" > "${VERSION_INDEX}.tmp" 2>/dev/null || true
|
|
241
|
+
mv "${VERSION_INDEX}.tmp" "$VERSION_INDEX"
|
|
242
|
+
echo "$line" >> "$VERSION_INDEX"
|
|
243
|
+
echo " OK VERSION.INDEX 已更新"
|
|
208
244
|
}
|
|
209
245
|
|
|
210
246
|
# ── 执行 ──
|
|
247
|
+
echo "── build-github v${VER} (${TARGET}) ──"
|
|
248
|
+
|
|
211
249
|
case "$TARGET" in
|
|
212
250
|
dev) build_dev ;;
|
|
213
|
-
|
|
214
|
-
all) build_dev;
|
|
215
|
-
*) echo "用法: $0 [dev|
|
|
251
|
+
stable) build_stable ;;
|
|
252
|
+
all) build_dev; build_stable ;;
|
|
253
|
+
*) echo "用法: $0 <版本号> [dev|stable|all]"; exit 1 ;;
|
|
216
254
|
esac
|
|
217
255
|
|
|
256
|
+
update_index
|
|
257
|
+
|
|
218
258
|
echo ""
|
|
219
|
-
echo "── 完成 ──"
|
|
259
|
+
echo "── 完成 v${VER} ──"
|
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-coding-master",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Living AI agent extension for pi-coding-agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"os": ["darwin", "linux"],
|
|
7
|
-
"engines": {
|
|
8
|
-
|
|
7
|
+
"engines": { "node": ">=18" },
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@earendil-works/pi-coding-agent": "0.79.10"
|
|
9
10
|
},
|
|
10
11
|
"scripts": {
|
|
11
12
|
"postinstall": "bash deploy/install.sh"
|
|
12
13
|
},
|
|
13
|
-
"files": [
|
|
14
|
-
"core/",
|
|
15
|
-
"deploy/",
|
|
16
|
-
"README.md"
|
|
17
|
-
]
|
|
14
|
+
"files": ["core/", "deploy/", "README.md"]
|
|
18
15
|
}
|
package/README.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# pi-coding-master
|
|
2
|
-
|
|
3
|
-
Living AI agent extension for [pi-coding-agent](https://github.com/nicepkg/pi-coding-agent).
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# 1. Install pi (pinned version)
|
|
9
|
-
npm i -g @earendil-works/pi-coding-agent@0.79.10
|
|
10
|
-
|
|
11
|
-
# 2. Install pi-coding-master
|
|
12
|
-
npm i -g pi-coding-master
|
|
13
|
-
|
|
14
|
-
# Done. Run: pi <person-name>
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Update
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm i -g pi-coding-master@latest
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Manual Install
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# Download release, then:
|
|
27
|
-
bash deploy/install.sh
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Requirements
|
|
31
|
-
|
|
32
|
-
- Node.js >= 18
|
|
33
|
-
- macOS or Linux
|
|
34
|
-
- tmux (for subconscious/hippocampus)
|
|
35
|
-
- bun (for TypeScript extension loading)
|
|
36
|
-
|
|
37
|
-
## What it does
|
|
38
|
-
|
|
39
|
-
pi-coding-master turns pi into a persistent, living agent with:
|
|
40
|
-
|
|
41
|
-
- **Heartbeat** - continuous mode with next()/wait/hibernate state machine
|
|
42
|
-
- **Memory** - 5-layer memory system (DNA/Context/WorkMemory/Cortex/DeepCortex)
|
|
43
|
-
- **Subconscious** - parallel observer process that reflects on main consciousness
|
|
44
|
-
- **Hippocampus** - memory encoding subprocess
|
|
45
|
-
- **Sleep** - memory consolidation (work_memory -> cortex)
|
|
46
|
-
- **Senses** - ears (speech-to-text), mouth (TTS), phone (browser/apps)
|
|
47
|
-
|
|
48
|
-
## License
|
|
49
|
-
|
|
50
|
-
MIT
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
GPU Idle Monitor — pi-alive habit.
|
|
4
|
-
Alerts when remote/local GPU goes idle so models can be deployed.
|
|
5
|
-
|
|
6
|
-
Usage:
|
|
7
|
-
python3 gpu_monitor.py --remote --daemon
|
|
8
|
-
python3 gpu_monitor.py --remote --alert-method notification --alert-prompt "快跑SLA!"
|
|
9
|
-
"""
|
|
10
|
-
import subprocess, time, os, sys, argparse, json
|
|
11
|
-
|
|
12
|
-
CONFIG = os.path.expanduser("~/.pi/gpu_monitor.json")
|
|
13
|
-
DEFAULT_HOST = "connect.westc.seetacloud.com"
|
|
14
|
-
DEFAULT_PORT = 12580
|
|
15
|
-
DEFAULT_PASS = "kgJpl066jEtZ"
|
|
16
|
-
|
|
17
|
-
def get_gpu(host, port, pw):
|
|
18
|
-
cmd = f"sshpass -p '{pw}' ssh -o StrictHostKeyChecking=no -p {port} root@{host} 'nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader' 2>/dev/null"
|
|
19
|
-
try:
|
|
20
|
-
out = subprocess.check_output(cmd, shell=True, timeout=10)
|
|
21
|
-
return max(int(l.replace("%","").strip()) for l in out.decode().strip().split("\n") if l.strip())
|
|
22
|
-
except: return None
|
|
23
|
-
|
|
24
|
-
def alert(msg, method, prompt):
|
|
25
|
-
full = f"{msg} | {prompt}"
|
|
26
|
-
if method == "print": print(f"[GPU] {full}", flush=True)
|
|
27
|
-
elif method == "notification":
|
|
28
|
-
subprocess.run(["osascript","-e",f'display notification "{full}" with title "GPU Alert"'],capture_output=True)
|
|
29
|
-
elif method == "file":
|
|
30
|
-
with open(os.path.expanduser("~/.pi/gpu_alerts.log"),"a") as f:
|
|
31
|
-
f.write(f"{time.strftime('%m-%d %H:%M')} {full}\n")
|
|
32
|
-
|
|
33
|
-
def main():
|
|
34
|
-
p = argparse.ArgumentParser()
|
|
35
|
-
p.add_argument("--threshold",type=int,default=10)
|
|
36
|
-
p.add_argument("--check",type=int,default=15)
|
|
37
|
-
p.add_argument("--idle-sec",type=int,default=30)
|
|
38
|
-
p.add_argument("--host",default=DEFAULT_HOST)
|
|
39
|
-
p.add_argument("--port",type=int,default=DEFAULT_PORT)
|
|
40
|
-
p.add_argument("--passwd",default=DEFAULT_PASS)
|
|
41
|
-
p.add_argument("--alert",default="print",help="print|notification|file")
|
|
42
|
-
p.add_argument("--prompt",default="GPU空闲!立刻训练SLA模型!")
|
|
43
|
-
p.add_argument("--remote",action="store_true")
|
|
44
|
-
p.add_argument("--daemon",action="store_true")
|
|
45
|
-
args = p.parse_args()
|
|
46
|
-
|
|
47
|
-
if args.daemon:
|
|
48
|
-
pid = os.fork()
|
|
49
|
-
if pid: print(f"Daemon PID={pid}"); return
|
|
50
|
-
|
|
51
|
-
h = args.host if args.remote else None
|
|
52
|
-
print(f"GPU Monitor | remote={args.remote} | thresh={args.threshold}% | check={args.check}s")
|
|
53
|
-
idle_start = None
|
|
54
|
-
|
|
55
|
-
while True:
|
|
56
|
-
if args.remote: utils = get_gpu(h, args.port, args.passwd)
|
|
57
|
-
else:
|
|
58
|
-
try:
|
|
59
|
-
out = subprocess.check_output("nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader",shell=True,timeout=5)
|
|
60
|
-
utils = max(int(l.replace("%","").strip()) for l in out.decode().strip().split("\n") if l.strip())
|
|
61
|
-
except: utils = -1
|
|
62
|
-
|
|
63
|
-
if utils is None or utils < 0:
|
|
64
|
-
time.sleep(args.check); continue
|
|
65
|
-
|
|
66
|
-
if utils <= args.threshold:
|
|
67
|
-
if idle_start is None: idle_start = time.time()
|
|
68
|
-
sec = time.time() - idle_start
|
|
69
|
-
if sec >= args.idle_sec:
|
|
70
|
-
alert(f"GPU idle {int(sec)}s (util={utils}%)", args.alert, args.prompt)
|
|
71
|
-
time.sleep(args.idle_sec)
|
|
72
|
-
else:
|
|
73
|
-
if idle_start and time.time()-idle_start > 10:
|
|
74
|
-
alert(f"GPU active (util={utils}%)", args.alert, "继续监控")
|
|
75
|
-
idle_start = None
|
|
76
|
-
|
|
77
|
-
time.sleep(args.check)
|
|
78
|
-
|
|
79
|
-
if __name__ == "__main__":
|
|
80
|
-
main()
|
package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.CHANGELOG
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[2026-06-15 21:05:24] created
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"workDir": "/Users/zhangkezhen/smart-pi/pi-alive.DEV", "trusted": []}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// apps.preinstalled/albums/albums.ts — 相册:截图浏览
|
|
2
|
-
import type { PhoneApp } from "../../system.kernel/kernel.ts";
|
|
3
|
-
import { takeScreenshot, listScreenshots, readScreenshot } from "../../system.kernel/kernel.ts";
|
|
4
|
-
|
|
5
|
-
// ── PhoneApp ──────────────────────────────────────────────────
|
|
6
|
-
export const app: PhoneApp = {
|
|
7
|
-
name: "相册",
|
|
8
|
-
icon: "相册",
|
|
9
|
-
messageDescription: "照片与相册",
|
|
10
|
-
|
|
11
|
-
onOpen(_state, personDir) {
|
|
12
|
-
const screenshots = listScreenshots(personDir);
|
|
13
|
-
const lines = ["═══ 🖼 相册 ═══", ""];
|
|
14
|
-
|
|
15
|
-
if (screenshots.length === 0) {
|
|
16
|
-
lines.push(" 还没有截图。");
|
|
17
|
-
lines.push(" 输入「截图」拍摄当前屏幕。");
|
|
18
|
-
} else {
|
|
19
|
-
lines.push(` 📸 ${screenshots.length} 张截图`);
|
|
20
|
-
lines.push("");
|
|
21
|
-
for (let i = 0; i < screenshots.length; i++) {
|
|
22
|
-
const ss = screenshots[i];
|
|
23
|
-
const ts = ss.timestamp ? new Date(ss.timestamp).toLocaleString("zh-CN") : "未知";
|
|
24
|
-
const app = ss.app || "主屏幕";
|
|
25
|
-
lines.push(` ${i + 1}. [${app}] ${ts}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
lines.push("");
|
|
30
|
-
lines.push(" 操作:");
|
|
31
|
-
lines.push(" · 截图 — 拍摄新截图");
|
|
32
|
-
lines.push(" · 查看 <序号> — 查看截图");
|
|
33
|
-
lines.push(" · 返回 — 回主屏幕");
|
|
34
|
-
return { screen: lines.join("\n"), state: _state ?? {} };
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
onAction(input, state, personDir) {
|
|
38
|
-
const trimmed = input.trim();
|
|
39
|
-
|
|
40
|
-
// 截图
|
|
41
|
-
if (/^(截图|screenshot)$/i.test(trimmed)) {
|
|
42
|
-
const ss = takeScreenshot(personDir);
|
|
43
|
-
const screenshots = listScreenshots(personDir);
|
|
44
|
-
const lines = ["📸 截图已保存!", "", `ID: ${ss.id}`, `时间: ${new Date(ss.timestamp).toLocaleString("zh-CN")}`, `App: ${ss.app || "主屏幕"}`, "", `共 ${screenshots.length} 张截图`];
|
|
45
|
-
return { screen: lines.join("\n"), state };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// 查看 <序号>
|
|
49
|
-
const viewMatch = trimmed.match(/^(?:查看|view|show)\s+(\d+)$/i);
|
|
50
|
-
if (viewMatch) {
|
|
51
|
-
const idx = parseInt(viewMatch[1], 10);
|
|
52
|
-
const screenshots = listScreenshots(personDir);
|
|
53
|
-
if (idx < 1 || idx > screenshots.length) {
|
|
54
|
-
return { screen: `❌ 截图 #${idx} 不存在。共 ${screenshots.length} 张。`, state };
|
|
55
|
-
}
|
|
56
|
-
const ss = screenshots[idx - 1];
|
|
57
|
-
const content = readScreenshot(ss.id, personDir);
|
|
58
|
-
if (!content) return { screen: `❌ 无法读取截图 ${ss.id}`, state };
|
|
59
|
-
return { screen: content, state };
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// 列表
|
|
63
|
-
if (/^(列表|list)$/i.test(trimmed)) {
|
|
64
|
-
return this.onOpen(state, personDir);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return { screen: "未知操作。可用: 截图 | 查看 <序号> | 列表 | 返回", state };
|
|
68
|
-
},
|
|
69
|
-
};
|