cotutor 0.2.0 → 0.4.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/LICENSE +249 -21
- package/NOTICE +42 -0
- package/README.md +115 -20
- package/avatars/chinese.webp +0 -0
- package/avatars/english.webp +0 -0
- package/avatars/math.webp +0 -0
- package/bin/cotutor.js +15 -5
- package/cards/canvas/card.css +8 -0
- package/cards/canvas/card.md +68 -0
- package/cards/choice/card.css +18 -0
- package/cards/choice/card.md +55 -0
- package/cards/code/card.css +5 -0
- package/cards/code/card.md +46 -0
- package/cards/dictation/card.css +10 -0
- package/cards/dictation/card.md +97 -0
- package/cards/image/card.css +10 -0
- package/cards/image/card.md +52 -0
- package/cards/lecture/card.css +9 -0
- package/cards/lecture/card.md +69 -0
- package/cards/paint/card.css +20 -0
- package/cards/paint/card.md +77 -0
- package/cards/photo/card.css +22 -0
- package/cards/photo/card.md +61 -0
- package/cards/read/card.css +6 -0
- package/cards/read/card.md +51 -0
- package/cards/text/card.css +3 -0
- package/cards/text/card.md +69 -0
- package/cards/tianzige/card.css +17 -0
- package/cards/tianzige/card.md +78 -0
- package/cards/tutor/card.css +79 -0
- package/cards/tutor/card.md +149 -0
- package/cards/word/card.css +24 -0
- package/cards/word/card.md +91 -0
- package/cards//346/235/277/344/271/246/346/200/216/344/271/210/345/206/231.md +159 -0
- package/dist/app/activity-eval-rules.d.ts +62 -0
- package/dist/app/activity-eval-rules.js +276 -0
- package/dist/app/activity-eval.d.ts +65 -0
- package/dist/app/activity-eval.js +159 -0
- package/dist/app/build.d.ts +11 -0
- package/dist/app/build.js +45 -0
- package/dist/app/cli/activities.d.ts +70 -0
- package/dist/app/cli/activities.js +196 -0
- package/dist/app/cli/cert.d.ts +12 -0
- package/dist/app/cli/cert.js +49 -0
- package/dist/app/cli/chalk/bake.d.ts +10 -0
- package/dist/app/cli/chalk/bake.js +58 -0
- package/dist/app/cli/chalk/browser.d.ts +16 -0
- package/dist/app/cli/chalk/browser.js +157 -0
- package/dist/app/cli/chalk/build.d.ts +14 -0
- package/dist/app/cli/chalk/build.js +100 -0
- package/dist/app/cli/chalk/dub.d.ts +51 -0
- package/dist/app/cli/chalk/dub.js +106 -0
- package/dist/app/cli/chalk/load-scene.d.ts +34 -0
- package/dist/app/cli/chalk/load-scene.js +117 -0
- package/dist/app/cli/chalk/main.d.ts +7 -0
- package/dist/app/cli/chalk/main.js +199 -0
- package/dist/app/cli/chalk/serve.d.ts +4 -0
- package/dist/app/cli/chalk/serve.js +28 -0
- package/dist/app/cli/chalk/snap.d.ts +65 -0
- package/dist/app/cli/chalk/snap.js +103 -0
- package/dist/app/cli/chalk/typecheck.d.ts +7 -0
- package/dist/app/cli/chalk/typecheck.js +51 -0
- package/dist/app/cli/doctor.d.ts +24 -0
- package/dist/app/cli/doctor.js +553 -0
- package/dist/app/cli/firewall.d.ts +24 -0
- package/dist/app/cli/firewall.js +79 -0
- package/dist/app/cli/grades.d.ts +14 -0
- package/dist/app/cli/grades.js +44 -0
- package/dist/{cli → app/cli}/init.d.ts +3 -1
- package/dist/app/cli/init.js +158 -0
- package/dist/app/cli/main.js +1038 -0
- package/dist/app/cli/migrate.d.ts +49 -0
- package/dist/app/cli/migrate.js +195 -0
- package/dist/app/cli/port-holder.d.ts +16 -0
- package/dist/app/cli/port-holder.js +34 -0
- package/dist/app/cli/port.d.ts +37 -0
- package/dist/app/cli/port.js +116 -0
- package/dist/app/cli/sandbox.d.ts +25 -0
- package/dist/app/cli/sandbox.js +166 -0
- package/dist/app/cli/serve-log.d.ts +13 -0
- package/dist/app/cli/serve-log.js +90 -0
- package/dist/app/cli/serve.d.ts +51 -0
- package/dist/app/cli/serve.js +168 -0
- package/dist/app/cli/service-windows.d.ts +50 -0
- package/dist/app/cli/service-windows.js +117 -0
- package/dist/app/cli/service.d.ts +138 -0
- package/dist/app/cli/service.js +429 -0
- package/dist/app/cli/shipped.d.ts +30 -0
- package/dist/app/cli/shipped.js +47 -0
- package/dist/app/cli/skeleton.d.ts +38 -0
- package/dist/app/cli/skeleton.js +161 -0
- package/dist/app/cli/skills.d.ts +59 -0
- package/dist/app/cli/skills.js +199 -0
- package/dist/app/cli/themes.d.ts +52 -0
- package/dist/app/cli/themes.js +148 -0
- package/dist/app/cli/tray-icons.d.ts +11 -0
- package/dist/app/cli/tray-icons.js +87 -0
- package/dist/app/cli/tray-ids.d.ts +6 -0
- package/dist/app/cli/tray-ids.js +6 -0
- package/dist/app/cli/tray-mac.d.ts +8 -0
- package/dist/app/cli/tray-mac.js +140 -0
- package/dist/app/cli/tray-run.d.ts +1 -0
- package/dist/app/cli/tray-run.js +33 -0
- package/dist/app/cli/tray-windows.d.ts +5 -0
- package/dist/app/cli/tray-windows.js +166 -0
- package/dist/app/cli/tray.d.ts +205 -0
- package/dist/app/cli/tray.js +618 -0
- package/dist/{cli → app/cli}/tutors.d.ts +15 -26
- package/dist/{cli → app/cli}/tutors.js +86 -110
- package/dist/app/cli/usage.d.ts +2 -0
- package/dist/app/cli/usage.js +35 -0
- package/dist/app/dictation/recognize.d.ts +18 -0
- package/dist/app/dictation/recognize.js +6 -0
- package/dist/app/dictation/route.d.ts +52 -0
- package/dist/app/dictation/route.js +511 -0
- package/dist/app/diff.d.ts +11 -0
- package/dist/app/diff.js +71 -0
- package/dist/app/http/access.d.ts +62 -0
- package/dist/app/http/access.js +180 -0
- package/dist/app/http/app.d.ts +241 -0
- package/dist/app/http/app.js +1159 -0
- package/dist/app/http/avatars.d.ts +17 -0
- package/dist/app/http/avatars.js +35 -0
- package/dist/app/http/dev-activities.d.ts +115 -0
- package/dist/app/http/dev-activities.js +193 -0
- package/dist/app/http/dev-overview.d.ts +108 -0
- package/dist/app/http/dev-overview.js +209 -0
- package/dist/app/http/dev-tutor-files.d.ts +80 -0
- package/dist/app/http/dev-tutor-files.js +151 -0
- package/dist/app/http/parent-home.d.ts +51 -0
- package/dist/app/http/parent-home.js +266 -0
- package/dist/app/http/parent-look.d.ts +2 -0
- package/dist/app/http/parent-look.js +151 -0
- package/dist/app/http/range.d.ts +9 -0
- package/dist/app/http/range.js +19 -0
- package/dist/app/http/raw-view.d.ts +117 -0
- package/dist/app/http/raw-view.js +149 -0
- package/dist/app/http/send-file.d.ts +7 -0
- package/dist/app/http/send-file.js +29 -0
- package/dist/{server → app/http}/stage.d.ts +9 -0
- package/dist/{server → app/http}/stage.js +34 -6
- package/dist/app/http/theme.d.ts +13 -0
- package/dist/app/http/theme.js +41 -0
- package/dist/app/http/voice-preview.d.ts +4 -0
- package/dist/app/http/voice-preview.js +34 -0
- package/dist/app/machine/bailian.d.ts +26 -0
- package/dist/app/machine/bailian.js +87 -0
- package/dist/app/mock/mock-live.d.ts +16 -0
- package/dist/app/mock/mock-live.js +140 -0
- package/dist/{server → app/mock}/mock.d.ts +38 -5
- package/dist/app/mock/mock.js +1125 -0
- package/dist/app/replay.d.ts +94 -0
- package/dist/app/replay.js +170 -0
- package/dist/app/skills/analyze-doc.d.ts +3 -0
- package/dist/app/skills/analyze-doc.js +47 -0
- package/dist/app/skills/home-doc.d.ts +5 -0
- package/dist/app/skills/home-doc.js +112 -0
- package/dist/app/skills/tune-doc.d.ts +3 -0
- package/dist/app/skills/tune-doc.js +80 -0
- package/dist/app/talk/list.d.ts +11 -0
- package/dist/app/talk/list.js +9 -0
- package/dist/app/talk/route.d.ts +16 -0
- package/dist/app/talk/route.js +142 -0
- package/dist/app/workspace.d.ts +63 -0
- package/dist/{cli → app}/workspace.js +100 -52
- package/dist/app/ws/route.d.ts +31 -0
- package/dist/app/ws/route.js +33 -0
- package/dist/app/ws/ws.d.ts +31 -0
- package/dist/app/ws/ws.js +169 -0
- package/dist/board/canvas-chat.d.ts +97 -0
- package/dist/board/canvas-chat.js +175 -0
- package/dist/board/card-guards.d.ts +15 -0
- package/dist/board/card-guards.js +38 -0
- package/dist/board/cards/canvas.d.ts +41 -0
- package/dist/board/cards/canvas.js +83 -0
- package/dist/{cards → board/cards}/choice.js +0 -12
- package/dist/{cards → board/cards}/code.js +0 -3
- package/dist/board/cards/dictation.d.ts +42 -0
- package/dist/board/cards/dictation.js +105 -0
- package/dist/board/cards/docs.d.ts +47 -0
- package/dist/board/cards/docs.js +152 -0
- package/dist/{cards → board/cards}/image.js +1 -10
- package/dist/board/cards/index.d.ts +62 -0
- package/dist/board/cards/index.js +144 -0
- package/dist/{cards → board/cards}/kind.d.ts +10 -4
- package/dist/board/cards/kind.js +9 -0
- package/dist/board/cards/lecture.d.ts +26 -0
- package/dist/board/cards/lecture.js +62 -0
- package/dist/board/cards/paint.d.ts +38 -0
- package/dist/board/cards/paint.js +85 -0
- package/dist/board/cards/photo.d.ts +15 -0
- package/dist/board/cards/photo.js +29 -0
- package/dist/{cards → board/cards}/read.js +1 -10
- package/dist/board/cards/text.d.ts +20 -0
- package/dist/board/cards/text.js +59 -0
- package/dist/board/cards/tianzige.d.ts +16 -0
- package/dist/board/cards/tianzige.js +64 -0
- package/dist/board/cards/tutor.d.ts +72 -0
- package/dist/board/cards/tutor.js +134 -0
- package/dist/board/cards/word.d.ts +20 -0
- package/dist/board/cards/word.js +76 -0
- package/dist/board/lecture.d.ts +100 -0
- package/dist/board/lecture.js +204 -0
- package/dist/board/paper.d.ts +20 -0
- package/dist/board/paper.js +76 -0
- package/dist/board/parse.d.ts +118 -0
- package/dist/board/parse.js +324 -0
- package/dist/board/presentation.d.ts +289 -0
- package/dist/board/presentation.js +613 -0
- package/dist/board/sections.d.ts +16 -0
- package/dist/board/sections.js +130 -0
- package/dist/brain/api-tools.d.ts +8 -0
- package/dist/brain/api-tools.js +191 -0
- package/dist/brain/api.d.ts +57 -0
- package/dist/brain/api.js +394 -0
- package/dist/brain/index.d.ts +97 -0
- package/dist/brain/index.js +11 -0
- package/dist/brain/log.d.ts +5 -0
- package/dist/brain/log.js +22 -0
- package/dist/brain/runtime.d.ts +30 -0
- package/dist/brain/runtime.js +23 -0
- package/dist/brain/stream-json.d.ts +16 -0
- package/dist/brain/stream-json.js +82 -0
- package/dist/brain/stream.d.ts +20 -0
- package/dist/brain/stream.js +70 -0
- package/dist/brain/transcript.d.ts +45 -0
- package/dist/brain/transcript.js +132 -0
- package/dist/brain/types.d.ts +99 -0
- package/dist/brain/types.js +14 -0
- package/dist/chalk/actions.d.ts +37 -0
- package/dist/chalk/actions.js +69 -0
- package/dist/chalk/bundle.d.ts +26 -0
- package/dist/chalk/bundle.js +69 -0
- package/dist/chalk/check.d.ts +28 -0
- package/dist/chalk/check.js +291 -0
- package/dist/chalk/circle.d.ts +64 -0
- package/dist/chalk/circle.js +193 -0
- package/dist/chalk/clock.d.ts +84 -0
- package/dist/chalk/clock.js +84 -0
- package/dist/chalk/geometry.d.ts +44 -0
- package/dist/chalk/geometry.js +139 -0
- package/dist/chalk/glyphs/capitals.d.ts +12 -0
- package/dist/chalk/glyphs/capitals.js +264 -0
- package/dist/chalk/glyphs/index.d.ts +21 -0
- package/dist/chalk/glyphs/index.js +18 -0
- package/dist/chalk/glyphs/letters.d.ts +13 -0
- package/dist/chalk/glyphs/letters.js +280 -0
- package/dist/chalk/glyphs/metrics.d.ts +33 -0
- package/dist/chalk/glyphs/metrics.js +28 -0
- package/dist/chalk/glyphs/registry.d.ts +7 -0
- package/dist/chalk/glyphs/registry.js +8 -0
- package/dist/chalk/glyphs/sample.d.ts +32 -0
- package/dist/chalk/glyphs/sample.js +102 -0
- package/dist/chalk/glyphs/skeleton.d.ts +64 -0
- package/dist/chalk/glyphs/skeleton.js +126 -0
- package/dist/chalk/glyphs/types.d.ts +58 -0
- package/dist/chalk/glyphs/types.js +17 -0
- package/dist/chalk/index.d.ts +23 -0
- package/dist/chalk/index.js +15 -0
- package/dist/chalk/manifest.d.ts +41 -0
- package/dist/chalk/manifest.js +6 -0
- package/dist/chalk/paint.d.ts +180 -0
- package/dist/chalk/paint.js +210 -0
- package/dist/chalk/pointer.d.ts +8 -0
- package/dist/chalk/pointer.js +21 -0
- package/dist/chalk/prepare.d.ts +11 -0
- package/dist/chalk/prepare.js +15 -0
- package/dist/chalk/scene-schema.d.ts +199 -0
- package/dist/chalk/scene-schema.js +91 -0
- package/dist/chalk/seed.d.ts +3 -0
- package/dist/chalk/seed.js +10 -0
- package/dist/chalk/text-metrics.d.ts +8 -0
- package/dist/chalk/text-metrics.js +156 -0
- package/dist/chalk/timeline.d.ts +47 -0
- package/dist/chalk/timeline.js +84 -0
- package/dist/chalk/types.d.ts +150 -0
- package/dist/chalk/types.js +8 -0
- package/dist/lib/index.d.ts +14 -12
- package/dist/lib/index.js +14 -12
- package/dist/media/draw.d.ts +23 -0
- package/dist/media/draw.js +44 -0
- package/dist/media/mp3.d.ts +6 -0
- package/dist/media/mp3.js +58 -0
- package/dist/media/mp4.d.ts +1 -0
- package/dist/media/mp4.js +58 -0
- package/dist/media/tts-voices.d.ts +18 -0
- package/dist/media/tts-voices.js +606 -0
- package/dist/media/tts.d.ts +56 -0
- package/dist/media/tts.js +174 -0
- package/dist/media/vision.d.ts +25 -0
- package/dist/media/vision.js +71 -0
- package/dist/memory/commit.d.ts +67 -0
- package/dist/memory/commit.js +130 -0
- package/dist/memory/context.d.ts +86 -0
- package/dist/memory/context.js +97 -0
- package/dist/memory/diary.d.ts +84 -0
- package/dist/memory/diary.js +183 -0
- package/dist/memory/grade.d.ts +2 -0
- package/dist/memory/grade.js +7 -0
- package/dist/{lib → memory}/plan.d.ts +1 -1
- package/dist/{lib → memory}/plan.js +1 -1
- package/dist/memory/proposals.d.ts +11 -0
- package/dist/memory/proposals.js +43 -0
- package/dist/memory/retrieval.d.ts +44 -0
- package/dist/memory/retrieval.js +157 -0
- package/dist/{lib → memory}/timetable.d.ts +0 -3
- package/dist/{lib → memory}/timetable.js +0 -11
- package/dist/memory/vault-notes.d.ts +165 -0
- package/dist/memory/vault-notes.js +359 -0
- package/dist/memory/vault.d.ts +70 -0
- package/dist/memory/vault.js +169 -0
- package/dist/realtime/bailian.d.ts +120 -0
- package/dist/realtime/bailian.js +289 -0
- package/dist/realtime/cues.d.ts +51 -0
- package/dist/realtime/cues.js +94 -0
- package/dist/realtime/listen.d.ts +32 -0
- package/dist/realtime/listen.js +53 -0
- package/dist/realtime/preview.d.ts +23 -0
- package/dist/realtime/preview.js +38 -0
- package/dist/realtime/prompt.d.ts +8 -0
- package/dist/realtime/prompt.js +13 -0
- package/dist/realtime/voices.d.ts +21 -0
- package/dist/realtime/voices.js +71 -0
- package/dist/runtime/activities.d.ts +29 -0
- package/dist/runtime/activities.js +72 -0
- package/dist/runtime/activity-state.d.ts +22 -0
- package/dist/runtime/activity-state.js +83 -0
- package/dist/runtime/activity.d.ts +63 -0
- package/dist/runtime/activity.js +428 -0
- package/dist/runtime/agent-file.d.ts +24 -0
- package/dist/runtime/agent-file.js +59 -0
- package/dist/runtime/auto-bookkeep.d.ts +30 -0
- package/dist/runtime/auto-bookkeep.js +84 -0
- package/dist/{lib → runtime/context}/context-pack.d.ts +3 -3
- package/dist/runtime/context/context-pack.js +182 -0
- package/dist/runtime/context/thread-digest.d.ts +4 -0
- package/dist/runtime/context/thread-digest.js +35 -0
- package/dist/runtime/context/tutor-rules.d.ts +25 -0
- package/dist/runtime/context/tutor-rules.js +47 -0
- package/dist/runtime/delivery/delivery.d.ts +94 -0
- package/dist/runtime/delivery/delivery.js +145 -0
- package/dist/runtime/delivery/playback.d.ts +25 -0
- package/dist/runtime/delivery/playback.js +29 -0
- package/dist/runtime/delivery/player.d.ts +145 -0
- package/dist/runtime/delivery/player.js +221 -0
- package/dist/runtime/delivery/queue.d.ts +89 -0
- package/dist/runtime/delivery/queue.js +59 -0
- package/dist/runtime/home/edit.d.ts +39 -0
- package/dist/runtime/home/edit.js +132 -0
- package/dist/runtime/home/home.d.ts +191 -0
- package/dist/runtime/home/home.js +318 -0
- package/dist/runtime/home/store.d.ts +142 -0
- package/dist/runtime/home/store.js +455 -0
- package/dist/runtime/journal/conversation.d.ts +46 -0
- package/dist/runtime/journal/conversation.js +89 -0
- package/dist/runtime/journal/events.d.ts +27 -0
- package/dist/runtime/journal/events.js +136 -0
- package/dist/runtime/journal/kid-log.d.ts +105 -0
- package/dist/runtime/journal/kid-log.js +133 -0
- package/dist/runtime/journal/ledger.d.ts +17 -0
- package/dist/{lib → runtime/journal}/ledger.js +7 -40
- package/dist/runtime/journal/mix.d.ts +42 -0
- package/dist/runtime/journal/mix.js +129 -0
- package/dist/runtime/journal/mouth-index.d.ts +26 -0
- package/dist/runtime/journal/mouth-index.js +34 -0
- package/dist/runtime/journal/mouth.d.ts +54 -0
- package/dist/runtime/journal/mouth.js +102 -0
- package/dist/runtime/journal/recorder.d.ts +91 -0
- package/dist/runtime/journal/recorder.js +148 -0
- package/dist/runtime/journal/store.d.ts +123 -0
- package/dist/runtime/journal/store.js +316 -0
- package/dist/runtime/kid-input.d.ts +16 -0
- package/dist/runtime/kid-input.js +194 -0
- package/dist/runtime/kid-view.d.ts +124 -0
- package/dist/runtime/kid-view.js +157 -0
- package/dist/runtime/lecture.d.ts +86 -0
- package/dist/runtime/lecture.js +237 -0
- package/dist/runtime/live/call.d.ts +231 -0
- package/dist/runtime/live/call.js +1244 -0
- package/dist/runtime/live/turns.d.ts +48 -0
- package/dist/runtime/live/turns.js +102 -0
- package/dist/runtime/runner.d.ts +243 -0
- package/dist/runtime/runner.js +777 -0
- package/dist/runtime/talk-run.d.ts +21 -0
- package/dist/runtime/talk-run.js +34 -0
- package/dist/scenes/dictation/match.d.ts +57 -0
- package/dist/scenes/dictation/match.js +255 -0
- package/dist/scenes/dictation/recognize.d.ts +86 -0
- package/dist/scenes/dictation/recognize.js +163 -0
- package/dist/scenes/dictation/store.d.ts +112 -0
- package/dist/scenes/dictation/store.js +99 -0
- package/dist/scenes/look.d.ts +26 -0
- package/dist/scenes/look.js +1 -0
- package/dist/scenes/paint/painter.d.ts +84 -0
- package/dist/scenes/paint/painter.js +171 -0
- package/dist/scenes/paint/prompt.d.ts +23 -0
- package/dist/scenes/paint/prompt.js +36 -0
- package/dist/scenes/talk/en-words.d.ts +8 -0
- package/dist/scenes/talk/en-words.js +44 -0
- package/dist/scenes/talk/list.d.ts +44 -0
- package/dist/scenes/talk/list.js +88 -0
- package/dist/scenes/talk/store.d.ts +27 -0
- package/dist/scenes/talk/store.js +61 -0
- package/dist/scenes/talk/warmup.d.ts +16 -0
- package/dist/scenes/talk/warmup.js +39 -0
- package/dist/schema/activity.d.ts +149 -0
- package/dist/schema/activity.js +113 -0
- package/dist/schema/board.d.ts +143 -2
- package/dist/schema/board.js +15 -3
- package/dist/schema/config.d.ts +339 -103
- package/dist/schema/config.js +269 -84
- package/dist/schema/context-pack.d.ts +76 -14
- package/dist/schema/context-pack.js +91 -10
- package/dist/{lib/conversation.d.ts → schema/conversation-files.d.ts} +11 -33
- package/dist/schema/conversation-files.js +26 -0
- package/dist/schema/conversation.d.ts +391 -49
- package/dist/schema/conversation.js +135 -19
- package/dist/schema/events.d.ts +138 -0
- package/dist/schema/events.js +1 -0
- package/dist/schema/home.d.ts +56 -0
- package/dist/schema/home.js +35 -0
- package/dist/schema/index.d.ts +14 -3
- package/dist/schema/index.js +14 -3
- package/dist/schema/kid-device.d.ts +20 -0
- package/dist/schema/kid-device.js +32 -0
- package/dist/schema/ledger.d.ts +8 -63
- package/dist/schema/ledger.js +7 -31
- package/dist/schema/memory.d.ts +73 -0
- package/dist/schema/memory.js +47 -0
- package/dist/schema/plan.d.ts +2 -2
- package/dist/schema/plan.js +2 -2
- package/dist/schema/sections.d.ts +32 -25
- package/dist/schema/sections.js +21 -22
- package/dist/schema/theme.d.ts +25 -0
- package/dist/schema/theme.js +26 -0
- package/dist/schema/timetable.d.ts +2 -2
- package/dist/schema/timetable.js +2 -2
- package/dist/schema/workspace.d.ts +68 -0
- package/dist/schema/workspace.js +37 -0
- package/dist/shared/default-port.d.ts +2 -0
- package/dist/shared/default-port.js +2 -0
- package/dist/shared/errors.d.ts +8 -0
- package/dist/shared/errors.js +13 -0
- package/dist/shared/home.d.ts +2 -0
- package/dist/shared/home.js +16 -0
- package/dist/shared/human-notes.d.ts +5 -0
- package/dist/shared/human-notes.js +7 -0
- package/dist/shared/qianwen.d.ts +54 -0
- package/dist/shared/qianwen.js +113 -0
- package/dist/shared/site-url.d.ts +2 -0
- package/dist/shared/site-url.js +5 -0
- package/dist/shared/time.d.ts +9 -0
- package/dist/shared/time.js +22 -0
- package/dist/shared/tokens.d.ts +18 -0
- package/dist/shared/tokens.js +11 -0
- package/dist/shared/wav.d.ts +10 -0
- package/dist/shared/wav.js +50 -0
- package/dist/stage/chunk-226TNLQA.js +129 -0
- package/dist/stage/chunk-24LGQEKE.js +1 -0
- package/dist/stage/chunk-25XV6UY3.js +10 -0
- package/dist/stage/chunk-2AZI3NHJ.js +1 -0
- package/dist/stage/chunk-2BQZTTBE.js +1 -0
- package/dist/stage/chunk-2M7CGY3Y.js +11 -0
- package/dist/stage/chunk-2VR4WFQ7.js +10 -0
- package/dist/stage/chunk-2ZYXBUWG.js +9 -0
- package/dist/stage/chunk-32LAWMGY.js +1 -0
- package/dist/stage/chunk-3LEMTSOO.js +11 -0
- package/dist/stage/chunk-3QCKGZYE.js +32 -0
- package/dist/stage/chunk-44P66WFA.js +1 -0
- package/dist/stage/chunk-4AM6FRR6.js +7 -0
- package/dist/stage/chunk-4QDE4SUK.js +1 -0
- package/dist/stage/chunk-4QESHV3U.js +1 -0
- package/dist/stage/chunk-4SG5QPHB.js +2 -0
- package/dist/stage/chunk-4T4UVCOC.js +1 -0
- package/dist/stage/chunk-4WUEPPG3.js +34 -0
- package/dist/stage/chunk-4YCN6UZ5.js +99 -0
- package/dist/stage/chunk-5V7ZY2AP.js +1 -0
- package/dist/stage/chunk-5VS5Y2VJ.js +6 -0
- package/dist/stage/chunk-5W4NO2ZD.js +62 -0
- package/dist/stage/chunk-65CRNICM.js +1 -0
- package/dist/stage/chunk-66MULO7F.js +5 -0
- package/dist/stage/chunk-6COFQTBS.js +162 -0
- package/dist/stage/chunk-6VZG3M3I.js +8 -0
- package/dist/stage/chunk-7HVDH43T.js +1 -0
- package/dist/stage/chunk-7JLJN4EZ.js +8 -0
- package/dist/stage/chunk-7QDSP4LN.js +1 -0
- package/dist/stage/chunk-7R6OQAO3.js +1 -0
- package/dist/stage/chunk-7VTTHZKW.js +7 -0
- package/dist/stage/chunk-ATHR5KEN.js +10 -0
- package/dist/stage/chunk-B6R5LTP2.js +36 -0
- package/dist/stage/chunk-BD4WE264.js +1 -0
- package/dist/stage/chunk-BONANU47.js +206 -0
- package/dist/stage/chunk-BTVW7OFK.js +89 -0
- package/dist/stage/chunk-BUTJIDHG.js +8 -0
- package/dist/stage/chunk-C2IPYMML.js +84 -0
- package/dist/stage/chunk-C54FTPPV.js +9 -0
- package/dist/stage/chunk-C6LOUF2Z.js +90 -0
- package/dist/stage/chunk-CFF3PILO.js +339 -0
- package/dist/stage/chunk-CI2FQ2JY.js +9 -0
- package/dist/stage/chunk-CW5O4RV7.js +12 -0
- package/dist/stage/chunk-CYABNQYD.js +1 -0
- package/dist/stage/chunk-D7FFA4NS.js +15 -0
- package/dist/stage/chunk-DUNNXU6Z.js +8 -0
- package/dist/stage/chunk-E3E4Q6JF.js +6 -0
- package/dist/stage/chunk-EB3U3LH7.js +9 -0
- package/dist/stage/chunk-EGSZ736B.js +8 -0
- package/dist/stage/chunk-EOBXW5VQ.js +2 -0
- package/dist/stage/chunk-ERZC3B7Y.js +11 -0
- package/dist/stage/chunk-ESDOOBIH.js +11 -0
- package/dist/stage/chunk-EVU4QAL4.js +178 -0
- package/dist/stage/chunk-EVVZI2NY.js +39 -0
- package/dist/stage/chunk-FBKAZUKD.js +39 -0
- package/dist/stage/chunk-FDVKYQJN.js +1 -0
- package/dist/stage/chunk-FGPVYHVR.js +5 -0
- package/dist/stage/chunk-FHUD4AZC.js +1 -0
- package/dist/stage/chunk-FKUJ2DMY.js +96 -0
- package/dist/stage/chunk-FNZGVIJV.js +1 -0
- package/dist/stage/chunk-GBYSEGYM.js +78 -0
- package/dist/stage/chunk-GCO4TDHX.js +1 -0
- package/dist/stage/chunk-GKTML2LG.js +10 -0
- package/dist/stage/chunk-GMDIHHXQ.js +11 -0
- package/dist/stage/chunk-GOUNACI3.js +10 -0
- package/dist/stage/chunk-GXAYATPF.js +3 -0
- package/dist/stage/chunk-H2K2DDXV.js +8 -0
- package/dist/stage/chunk-H3UJI6ZY.js +13 -0
- package/dist/stage/chunk-H6PUGCME.js +7 -0
- package/dist/stage/chunk-HNBUIMIG.js +1 -0
- package/dist/stage/chunk-HRZY2BJQ.js +10 -0
- package/dist/stage/chunk-HSPJGALW.js +30 -0
- package/dist/stage/chunk-IBYORHIP.js +25 -0
- package/dist/stage/chunk-IHF4EWTY.js +1 -0
- package/dist/stage/chunk-ISBRPNKI.js +1 -0
- package/dist/stage/chunk-IZ3OI3C2.js +2 -0
- package/dist/stage/chunk-JEFZAC2R.js +1 -0
- package/dist/stage/chunk-JFIGRDPO.js +1 -0
- package/dist/stage/chunk-JFVYBOOC.js +9 -0
- package/dist/stage/chunk-JGD4TUTQ.js +1 -0
- package/dist/stage/chunk-JO4BEHDH.js +4 -0
- package/dist/stage/chunk-JOWBS42C.js +1 -0
- package/dist/stage/chunk-JP3TM2TG.js +1 -0
- package/dist/stage/chunk-JVK2C52O.js +1 -0
- package/dist/stage/chunk-K4I76XBX.js +14 -0
- package/dist/stage/chunk-KA6CZZ4M.js +1 -0
- package/dist/stage/chunk-KESSJ36M.js +1 -0
- package/dist/stage/chunk-LKATEVRU.js +1 -0
- package/dist/stage/chunk-LS4EJ2EI.js +1 -0
- package/dist/stage/chunk-LUKJQC2X.js +70 -0
- package/dist/stage/chunk-LWULR3SM.js +1 -0
- package/dist/stage/chunk-LWVRFMKX.js +2 -0
- package/dist/stage/chunk-LXC4ZBPZ.js +1 -0
- package/dist/stage/chunk-M2UP255H.js +1 -0
- package/dist/stage/chunk-MAPPXUZQ.js +231 -0
- package/dist/stage/chunk-MBMPW7Z5.js +1 -0
- package/dist/stage/chunk-MD3HMMTK.js +1 -0
- package/dist/stage/chunk-MLPCUIKR.js +17 -0
- package/dist/stage/chunk-MNQIRPDQ.js +8 -0
- package/dist/stage/chunk-MRG7MJVS.js +1 -0
- package/dist/stage/chunk-MU6EXW72.js +10 -0
- package/dist/stage/chunk-MVU2X6LU.js +4 -0
- package/dist/stage/chunk-N6UA5CZV.js +36 -0
- package/dist/stage/chunk-NLZIT2TJ.js +7 -0
- package/dist/stage/chunk-NOJR3J7M.js +1 -0
- package/dist/stage/chunk-NT7ARDOL.js +1 -0
- package/dist/stage/chunk-NWOGMPZH.js +1 -0
- package/dist/stage/chunk-NXE4KMG3.js +40 -0
- package/dist/stage/chunk-O4YCZXD2.js +257 -0
- package/dist/stage/chunk-OAJZ7HLK.js +1 -0
- package/dist/stage/chunk-OCFCFASO.js +1 -0
- package/dist/stage/chunk-ODGPG5RY.js +7 -0
- package/dist/stage/chunk-ODUEA52Q.js +3 -0
- package/dist/stage/chunk-OGDJ3FCI.js +1 -0
- package/dist/stage/chunk-OLDJ55TT.js +1 -0
- package/dist/stage/chunk-OOCL4ATI.js +2 -0
- package/dist/stage/chunk-OQEFDUDV.js +1 -0
- package/dist/stage/chunk-OQWVEWG7.js +4 -0
- package/dist/stage/chunk-OUIX6BGK.js +1 -0
- package/dist/stage/chunk-OV7OZYUO.js +7 -0
- package/dist/stage/chunk-PFGDY33O.js +1 -0
- package/dist/stage/chunk-PFJDUJB3.js +139 -0
- package/dist/stage/chunk-PGEW76ER.js +1 -0
- package/dist/stage/chunk-PP76TAQX.js +32 -0
- package/dist/stage/chunk-PTBOP4OT.js +2 -0
- package/dist/stage/chunk-PX2RVHCK.js +1 -0
- package/dist/stage/chunk-Q7K3PNAD.js +1 -0
- package/dist/stage/chunk-QDDPLZDB.js +1 -0
- package/dist/stage/chunk-QLGLZ77F.js +1 -0
- package/dist/stage/chunk-QOPFDFHI.js +1 -0
- package/dist/stage/chunk-QXT4KAEJ.js +1 -0
- package/dist/stage/chunk-R4YVZCIT.js +1 -0
- package/dist/stage/chunk-R6P6EHWA.js +62 -0
- package/dist/stage/chunk-RCH3OXBI.js +9 -0
- package/dist/stage/chunk-RHPE44I2.js +1 -0
- package/dist/stage/chunk-RJ2R4FVC.js +1 -0
- package/dist/stage/chunk-RJH2YVTD.js +1 -0
- package/dist/stage/chunk-RLWWW5OB.js +6 -0
- package/dist/stage/chunk-S3WO35Z7.js +120 -0
- package/dist/stage/chunk-S7ZGX6MW.js +1 -0
- package/dist/stage/chunk-SIAWX27B.js +1 -0
- package/dist/stage/chunk-SLG4X622.js +1 -0
- package/dist/stage/chunk-SLJRBC77.js +168 -0
- package/dist/stage/chunk-SRORWQJZ.js +1 -0
- package/dist/stage/chunk-STZTUIIF.js +2 -0
- package/dist/stage/chunk-SVQ6MWNV.js +9 -0
- package/dist/stage/chunk-TL3HLL2S.js +132 -0
- package/dist/stage/chunk-U3DOE6SF.js +24 -0
- package/dist/stage/chunk-UABQIZKW.js +6 -0
- package/dist/stage/chunk-UDK3R764.js +1 -0
- package/dist/stage/chunk-UFF4E54B.js +41 -0
- package/dist/stage/chunk-UFP5Q4AY.js +1 -0
- package/dist/stage/chunk-UMH2TSW2.js +72 -0
- package/dist/stage/chunk-UTASVNF5.js +10 -0
- package/dist/stage/chunk-UW7ML5ML.js +88 -0
- package/dist/stage/chunk-V3J7F6OP.js +1 -0
- package/dist/stage/chunk-VEHP5B5Q.js +5 -0
- package/dist/stage/chunk-VRXWB733.js +9 -0
- package/dist/stage/chunk-VVDHBBS5.js +5 -0
- package/dist/stage/chunk-VYFOH6FU.js +106 -0
- package/dist/stage/chunk-W3VZTLQS.js +3 -0
- package/dist/stage/chunk-W7WNRWTZ.js +8 -0
- package/dist/stage/chunk-WHUCV53C.js +1 -0
- package/dist/stage/chunk-WULMYHIF.js +1 -0
- package/dist/stage/chunk-X54EX7AW.js +9 -0
- package/dist/stage/chunk-X565ISZM.js +1 -0
- package/dist/stage/chunk-XGZMDECB.js +1 -0
- package/dist/stage/chunk-XHONC4RF.js +172 -0
- package/dist/stage/chunk-XIK4XQ6E.js +24 -0
- package/dist/stage/chunk-XJQQWFTE.js +1 -0
- package/dist/stage/chunk-XM4WOU3I.js +13 -0
- package/dist/stage/chunk-XM7Y5HP5.js +38 -0
- package/dist/stage/chunk-XNYYRGD5.js +292 -0
- package/dist/stage/chunk-XOYVR3SV.js +1 -0
- package/dist/stage/chunk-XQIW5HCE.js +1 -0
- package/dist/stage/chunk-YEWL7FUW.js +8 -0
- package/dist/stage/chunk-YI55PY3V.js +1 -0
- package/dist/stage/chunk-YM63HI6W.js +1 -0
- package/dist/stage/chunk-YNLGLU4P.js +9 -0
- package/dist/stage/chunk-YTNMNOWP.js +1 -0
- package/dist/stage/chunk-YV62XKTC.js +1 -0
- package/dist/stage/chunk-YVBA3QW6.js +1 -0
- package/dist/stage/chunk-Z2SY2HOC.js +1 -0
- package/dist/stage/chunk-ZBTCQEBK.js +10 -0
- package/dist/stage/chunk-ZCUFN74D.js +1 -0
- package/dist/stage/chunk-ZHOULXEJ.js +11 -0
- package/dist/stage/chunk-ZTRZIET2.js +1 -0
- package/dist/stage/index.html +1 -0
- package/dist/stage/stage.css +1 -1
- package/dist/stage/stage.js +1 -4383
- package/dist/ui/dev/dev-page.d.ts +1 -0
- package/dist/ui/dev/dev-page.js +2021 -0
- package/dist/ui/dev/dev-theme.d.ts +6 -0
- package/dist/ui/dev/dev-theme.js +67 -0
- package/dist/ui/dev/voice-gallery-page.d.ts +1 -0
- package/dist/ui/dev/voice-gallery-page.js +121 -0
- package/dist/ui/dev/voice-scenes.d.ts +21 -0
- package/dist/ui/dev/voice-scenes.js +30 -0
- package/dist/ui/dictation/en-box.d.ts +2 -0
- package/dist/ui/dictation/en-box.js +86 -0
- package/dist/ui/dictation/en-page.d.ts +1 -0
- package/dist/ui/dictation/en-page.js +484 -0
- package/dist/ui/dictation/page.d.ts +1 -0
- package/dist/ui/dictation/page.js +1084 -0
- package/dist/ui/dictation/parent-page.d.ts +1 -0
- package/dist/ui/dictation/parent-page.js +234 -0
- package/dist/ui/dictation/reel-mode.d.ts +1 -0
- package/dist/ui/dictation/reel-mode.js +87 -0
- package/dist/ui/dictation/reel-page.d.ts +1 -0
- package/dist/ui/dictation/reel-page.js +62 -0
- package/dist/ui/dictation/reel.d.ts +163 -0
- package/dist/ui/dictation/reel.js +436 -0
- package/dist/ui/dictation/ui.d.ts +44 -0
- package/dist/ui/dictation/ui.js +80 -0
- package/dist/ui/dictation/unlock.d.ts +7 -0
- package/dist/ui/dictation/unlock.js +16 -0
- package/dist/ui/kid/audio-client.d.ts +11 -0
- package/dist/ui/kid/audio-client.js +74 -0
- package/dist/ui/kid/board-mark-art.d.ts +37 -0
- package/dist/ui/kid/board-mark-art.js +5 -0
- package/dist/ui/kid/board-mark.d.ts +24 -0
- package/dist/ui/kid/board-mark.js +58 -0
- package/dist/ui/kid/home-tiles.d.ts +14 -0
- package/dist/ui/kid/home-tiles.js +44 -0
- package/dist/ui/kid/kid-log.d.ts +15 -0
- package/dist/ui/kid/kid-log.js +87 -0
- package/dist/ui/kid/kid-nav.d.ts +11 -0
- package/dist/ui/kid/kid-nav.js +22 -0
- package/dist/ui/kid/kid-page.d.ts +9 -0
- package/dist/ui/kid/kid-page.js +3684 -0
- package/dist/ui/kid/letters.d.ts +26 -0
- package/dist/ui/kid/letters.js +51 -0
- package/dist/ui/kid/photo-edit.d.ts +83 -0
- package/dist/ui/kid/photo-edit.js +106 -0
- package/dist/ui/kid/photo-ui.d.ts +23 -0
- package/dist/ui/kid/photo-ui.js +60 -0
- package/dist/ui/kid/reel.d.ts +419 -0
- package/dist/ui/kid/reel.js +648 -0
- package/dist/ui/kid/tianzige.d.ts +8 -0
- package/dist/ui/kid/tianzige.js +45 -0
- package/dist/ui/kid/tutor-face.d.ts +35 -0
- package/dist/ui/kid/tutor-face.js +84 -0
- package/dist/ui/kid/voice-ui.d.ts +70 -0
- package/dist/ui/kid/voice-ui.js +316 -0
- package/dist/ui/kid/voice-view.d.ts +71 -0
- package/dist/ui/kid/voice-view.js +75 -0
- package/dist/ui/kid/word-draw.d.ts +2 -0
- package/dist/ui/kid/word-draw.js +107 -0
- package/dist/ui/kid/word-emoji.d.ts +10 -0
- package/dist/ui/kid/word-emoji.js +68 -0
- package/dist/ui/kid/word-layout.d.ts +25 -0
- package/dist/ui/kid/word-layout.js +29 -0
- package/dist/ui/parent/parent-home-page.d.ts +1 -0
- package/dist/ui/parent/parent-home-page.js +722 -0
- package/dist/ui/parent/parent-page.d.ts +2 -0
- package/dist/ui/parent/parent-page.js +511 -0
- package/dist/ui/parent/parent-settings-page.d.ts +1 -0
- package/dist/ui/parent/parent-settings-page.js +133 -0
- package/dist/ui/parent/qr-page.d.ts +8 -0
- package/dist/ui/parent/qr-page.js +66 -0
- package/dist/ui/shared/brand.d.ts +38 -0
- package/dist/ui/shared/brand.js +53 -0
- package/dist/ui/shared/favicon.d.ts +12 -0
- package/dist/ui/shared/favicon.js +96 -0
- package/dist/ui/shared/icon.d.ts +9 -0
- package/dist/ui/shared/icon.js +35 -0
- package/dist/ui/shared/inline-lib.d.ts +1 -0
- package/dist/ui/shared/inline-lib.js +28 -0
- package/dist/ui/shared/logo.d.ts +31 -0
- package/dist/ui/shared/logo.js +43 -0
- package/dist/ui/shared/page-dom.d.ts +12 -0
- package/dist/ui/shared/page-dom.js +36 -0
- package/dist/ui/shared/png.d.ts +1 -0
- package/dist/ui/shared/png.js +45 -0
- package/dist/ui/shared/qr-svg.d.ts +3 -0
- package/dist/ui/shared/qr-svg.js +32 -0
- package/dist/ui/shared/qr.d.ts +14 -0
- package/dist/ui/shared/qr.js +281 -0
- package/dist/ui/shared/reel-dock.d.ts +22 -0
- package/dist/ui/shared/reel-dock.js +365 -0
- package/dist/ui/shared/tutor-color.d.ts +15 -0
- package/dist/ui/shared/tutor-color.js +47 -0
- package/dist/ui/talk/page.d.ts +6 -0
- package/dist/ui/talk/page.js +294 -0
- package/grades/grade-2/README.md +11 -0
- package/grades/grade-2/VALIDATION.md +41 -0
- package/grades/grade-2/agents/chinese-tutor/activities//344/275/240/350/257/264/346/210/221/347/224/273.md +157 -0
- package/grades/grade-2/agents/chinese-tutor/activities//344/275/240/350/257/264/346/210/221/347/224/273./344/276/213/345/255/220.md +78 -0
- package/grades/grade-2/agents/chinese-tutor/activities//344/276/213/345/255/220/345/233/276//345/200/237/344/274/236.jpg +0 -0
- package/grades/grade-2/agents/chinese-tutor/activities//344/276/213/345/255/220/345/233/276//345/260/217/347/214/264/346/221/230/346/241/203.jpg +0 -0
- package/grades/grade-2/agents/chinese-tutor/activities//345/206/231/350/257/235.md +64 -0
- package/grades/grade-2/agents/chinese-tutor/activities//345/206/231/350/257/235./344/276/213/345/255/220.md +31 -0
- package/grades/grade-2/agents/chinese-tutor/activities//345/220/254/345/206/231.md +48 -0
- package/grades/grade-2/agents/chinese-tutor/activities//345/244/215/344/271/240.md +79 -0
- package/grades/grade-2/agents/chinese-tutor/activities//345/244/215/344/271/240./344/276/213/345/255/220.md +35 -0
- package/grades/grade-2/agents/chinese-tutor/activities//345/260/217/350/257/276/345/240/202.md +53 -0
- package/grades/grade-2/agents/chinese-tutor/activities//346/243/200/346/237/245/344/275/234/344/270/232.md +81 -0
- package/grades/grade-2/agents/chinese-tutor/activities//346/243/200/346/237/245/344/275/234/344/270/232./344/276/213/345/255/220.md +35 -0
- package/grades/grade-2/agents/chinese-tutor/activities//347/234/213/345/233/276/350/257/264/350/257/235.md +94 -0
- package/grades/grade-2/agents/chinese-tutor/activities//347/234/213/345/233/276/350/257/264/350/257/235./344/276/213/345/255/220.md +63 -0
- package/grades/grade-2/agents/chinese-tutor/activities//351/242/204/344/271/240.md +82 -0
- package/grades/grade-2/agents/chinese-tutor/activities//351/242/204/344/271/240./344/276/213/345/255/220.md +35 -0
- package/grades/grade-2/agents/chinese-tutor.md +59 -0
- package/grades/grade-2/agents/english-tutor/activities//345/217/243/350/257/255/350/257/276.md +149 -0
- package/grades/grade-2/agents/english-tutor/activities//345/217/243/350/257/255/350/257/276./344/276/213/345/255/220.md +13 -0
- package/grades/grade-2/agents/english-tutor/activities//345/220/254/345/206/231.md +47 -0
- package/grades/grade-2/agents/english-tutor/activities//345/244/215/344/271/240.md +78 -0
- package/grades/grade-2/agents/english-tutor/activities//345/244/215/344/271/240./344/276/213/345/255/220.md +35 -0
- package/grades/grade-2/agents/english-tutor/activities//345/260/217/350/257/276/345/240/202.md +53 -0
- package/grades/grade-2/agents/english-tutor/activities//346/243/200/346/237/245/344/275/234/344/270/232.md +80 -0
- package/grades/grade-2/agents/english-tutor/activities//346/243/200/346/237/245/344/275/234/344/270/232./344/276/213/345/255/220.md +35 -0
- package/grades/grade-2/agents/english-tutor/activities//351/242/204/344/271/240.md +86 -0
- package/grades/grade-2/agents/english-tutor/activities//351/242/204/344/271/240./344/276/213/345/255/220.md +35 -0
- package/grades/grade-2/agents/english-tutor.md +57 -0
- package/grades/grade-2/agents/math-tutor/activities//345/244/215/344/271/240.md +78 -0
- package/grades/grade-2/agents/math-tutor/activities//345/244/215/344/271/240./344/276/213/345/255/220.md +35 -0
- package/grades/grade-2/agents/math-tutor/activities//345/260/217/350/257/276/345/240/202.md +56 -0
- package/grades/grade-2/agents/math-tutor/activities//345/260/217/350/257/276/345/240/202./344/276/213/345/255/220.md +52 -0
- package/grades/grade-2/agents/math-tutor/activities//346/243/200/346/237/245/344/275/234/344/270/232.md +80 -0
- package/grades/grade-2/agents/math-tutor/activities//346/243/200/346/237/245/344/275/234/344/270/232./344/276/213/345/255/220.md +35 -0
- package/grades/grade-2/agents/math-tutor/activities//351/242/204/344/271/240.md +81 -0
- package/grades/grade-2/agents/math-tutor/activities//351/242/204/344/271/240./344/276/213/345/255/220.md +35 -0
- package/grades/grade-2/agents/math-tutor.md +51 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen/audio/index.json +44 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen/audio/step-1.mp3 +0 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen/audio/step-2.mp3 +0 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen/audio/step-3.mp3 +0 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen/audio/step-4.mp3 +0 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen/audio/step-5.mp3 +0 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen/bake.json +1 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen/manifest.json +63 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen/scene.json +247 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen.md +40 -0
- package/grades/grade-2/examples/2026-10-27-pingjunfen.ts +26 -0
- package/grades/grade-2/examples//345/271/263/345/235/207/345/210/206./344/276/213/345/255/220.md +24 -0
- package/grades/grade-2/examples//346/225/260/345/255/246/345/271/263/345/235/207/345/210/206.md +42 -0
- package/grades/grade-2/validation/2026-10-27.json +4410 -0
- package/package.json +27 -15
- package/skills/chalk-cli/SKILL.md +62 -0
- package/skills/chalk-scene/SKILL.md +91 -0
- package/skills/chalk-teaching/SKILL.md +82 -0
- package/skills/chalk-teaching/models//344/272/244/351/224/231/346/225/260/345/210/227/345/210/206/350/241/214.md +8 -0
- package/skills/chalk-teaching/models//345/207/221/345/215/201.md +7 -0
- package/skills/chalk-teaching/models//345/221/250/346/234/237/350/247/204/345/276/213.md +6 -0
- package/skills/chalk-teaching/models//345/256/236/347/211/251/345/233/276-/345/242/236/345/207/217.md +6 -0
- package/skills/chalk-teaching/models//345/256/236/347/211/251/345/233/276-/346/257/224/345/244/232/345/260/221-/346/261/202/345/244/247/346/225/260/346/261/202/345/260/217/346/225/260.md +7 -0
- package/skills/chalk-teaching/models//345/256/236/347/211/251/345/233/276-/346/257/224/345/244/232/345/260/221-/346/261/202/345/267/256.md +6 -0
- package/skills/chalk-teaching/models//345/260/217/346/243/222/350/277/233/344/275/215/345/212/240.md +7 -0
- package/skills/chalk-teaching/models//345/260/217/346/243/222/351/200/200/344/275/215/345/207/217.md +6 -0
- package/skills/chalk-teaching/models//346/216/222/351/230/237/347/202/271/351/230/265.md +7 -0
- package/skills/chalk-teaching/models//346/227/266/351/227/264/346/225/260/350/275/264.md +6 -0
- package/skills/chalk-teaching/models//346/245/274/345/261/202/351/227/264/351/232/224/345/233/276.md +7 -0
- package/skills/chalk-teaching/models//347/240/264/345/215/201.md +7 -0
- package/skills/chalk-teaching/models//347/253/226/345/274/217/351/200/200/344/275/215.md +6 -0
- package/skills/chalk-teaching/models//347/272/277/346/256/265/345/233/276.md +7 -0
- package/skills/chalk-teaching/models-index.md +24 -0
- package/skills/chalk-teaching/references//350/256/262/350/247/243/346/250/241/346/235/277/344/270/211/346/241/243.md +32 -0
- package/skills/chalk-teaching/references//350/257/264/346/230/216/346/226/207/344/273/266.md +102 -0
- package/skills/chalk-verify/SKILL.md +57 -0
- package/skills/chalk-verify/references//350/257/204/345/210/244/346/240/207/345/207/206.md +69 -0
- package/skills/cotutor-analyze/SKILL.md +106 -0
- package/skills/cotutor-analyze/references//345/221/275/344/273/244/344/270/216/346/226/207/344/273/266.md +31 -0
- package/skills/cotutor-board/SKILL.md +373 -0
- package/skills/cotutor-board/references/README.md +38 -0
- package/skills/cotutor-board/references/canvas.md +68 -0
- package/skills/cotutor-board/references/choice.md +55 -0
- package/skills/cotutor-board/references/code.md +46 -0
- package/skills/cotutor-board/references/image.md +52 -0
- package/skills/cotutor-board/references/lecture.md +69 -0
- package/skills/cotutor-board/references/paint.md +77 -0
- package/skills/cotutor-board/references/photo.md +61 -0
- package/skills/cotutor-board/references/read.md +51 -0
- package/skills/cotutor-board/references/text.md +69 -0
- package/skills/cotutor-board/references/tianzige.md +78 -0
- package/skills/cotutor-board/references/word.md +91 -0
- package/skills/cotutor-home/SKILL.md +170 -0
- package/skills/cotutor-home/references/dictation.md +97 -0
- package/skills/cotutor-home/references/tutor.md +149 -0
- package/skills/cotutor-home/references//345/221/275/344/273/244.md +21 -0
- package/skills/cotutor-home/references//351/246/226/351/241/265/350/257/255/346/263/225.md +143 -0
- package/skills/cotutor-tune/SKILL.md +147 -0
- package/skills/cotutor-tune/references//345/255/227/346/256/265.md +53 -0
- package/skills/cotutor-tutor/SKILL.md +253 -0
- package/skills/cotutor-tutor/references//344/270/212/344/270/213/346/226/207/345/214/205.md +78 -0
- package/themes/default/kid.css +86 -0
- package/themes/default/theme.json +26 -0
- package/agents/chinese-tutor.md +0 -67
- package/agents/homework-tutor.md +0 -17
- package/agents/math-tutor.md +0 -68
- package/agents/planner.md +0 -18
- package/agents/reading-tutor.md +0 -65
- package/agents/scene-maker.md +0 -41
- package/dist/cards/canvas.d.ts +0 -22
- package/dist/cards/canvas.js +0 -65
- package/dist/cards/fill.d.ts +0 -14
- package/dist/cards/fill.js +0 -64
- package/dist/cards/index.d.ts +0 -48
- package/dist/cards/index.js +0 -115
- package/dist/cards/kind.js +0 -7
- package/dist/cards/scene.d.ts +0 -24
- package/dist/cards/scene.js +0 -67
- package/dist/cards/text.d.ts +0 -18
- package/dist/cards/text.js +0 -41
- package/dist/cli/cert.d.ts +0 -7
- package/dist/cli/cert.js +0 -36
- package/dist/cli/doctor.d.ts +0 -22
- package/dist/cli/doctor.js +0 -355
- package/dist/cli/init.js +0 -116
- package/dist/cli/main.js +0 -243
- package/dist/cli/serve.d.ts +0 -30
- package/dist/cli/serve.js +0 -56
- package/dist/cli/skeleton.d.ts +0 -39
- package/dist/cli/skeleton.js +0 -184
- package/dist/cli/skills.d.ts +0 -40
- package/dist/cli/skills.js +0 -170
- package/dist/cli/workspace.d.ts +0 -69
- package/dist/lib/agent-file.d.ts +0 -10
- package/dist/lib/agent-file.js +0 -16
- package/dist/lib/board.d.ts +0 -15
- package/dist/lib/board.js +0 -107
- package/dist/lib/context-pack.js +0 -55
- package/dist/lib/conversation.js +0 -88
- package/dist/lib/kid-board.d.ts +0 -148
- package/dist/lib/kid-board.js +0 -294
- package/dist/lib/kid-view.d.ts +0 -63
- package/dist/lib/kid-view.js +0 -93
- package/dist/lib/ledger.d.ts +0 -29
- package/dist/lib/run-plan.d.ts +0 -30
- package/dist/lib/run-plan.js +0 -32
- package/dist/lib/sections.d.ts +0 -12
- package/dist/lib/sections.js +0 -151
- package/dist/lib/stream.d.ts +0 -15
- package/dist/lib/stream.js +0 -69
- package/dist/lib/transcript.d.ts +0 -36
- package/dist/lib/transcript.js +0 -95
- package/dist/server/app.d.ts +0 -74
- package/dist/server/app.js +0 -406
- package/dist/server/kid-page.d.ts +0 -1
- package/dist/server/kid-page.js +0 -768
- package/dist/server/mock.js +0 -403
- package/dist/server/parent-page.d.ts +0 -8
- package/dist/server/parent-page.js +0 -393
- package/dist/server/runner.d.ts +0 -64
- package/dist/server/runner.js +0 -277
- package/dist/server/scene-props.d.ts +0 -16
- package/dist/server/scene-props.js +0 -39
- package/dist/server/store.d.ts +0 -43
- package/dist/server/store.js +0 -210
- package/dist/server/tts.d.ts +0 -51
- package/dist/server/tts.js +0 -99
- /package/dist/{cli → app/cli}/main.d.ts +0 -0
- /package/dist/{cards → board/cards}/choice.d.ts +0 -0
- /package/dist/{cards → board/cards}/code.d.ts +0 -0
- /package/dist/{cards → board/cards}/image.d.ts +0 -0
- /package/dist/{cards → board/cards}/read.d.ts +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 托盘图标的 PNG:现画,不往仓里塞图片文件(同 favicon.ts);几何都来自 logo.ts 的双 C,16、18 px 这种小尺寸用小号那档。
|
|
3
|
+
* 正常时只有 logo;有事在右边缺口放状态点,橙 = 要处理,红 = 没在跑(同时 logo 变淡,不只靠颜色区分)。
|
|
4
|
+
* macOS:logo 一张模板图(系统按菜单栏深浅着色),状态点一张模板图(叠在上面单独着色),18 pt @2x
|
|
5
|
+
* Windows:没有底色,white 给深色任务栏、ink 给浅色任务栏,每种状态各画几档尺寸,按系统要的尺寸挑;变淡后对比度要过 3:1
|
|
6
|
+
* 菜单第一行的小圆点两边共用。
|
|
7
|
+
*/
|
|
8
|
+
import { LOGO_INK, LOGO_SMALL, logoHit } from "../../ui/shared/logo.js";
|
|
9
|
+
import { encodePng } from "../../ui/shared/png.js";
|
|
10
|
+
const rgb = (hex) => {
|
|
11
|
+
const v = parseInt(hex.slice(1), 16);
|
|
12
|
+
return [(v >> 16) & 0xff, (v >> 8) & 0xff, v & 0xff];
|
|
13
|
+
};
|
|
14
|
+
export const TRAY_DOT = { r: 14, cx: 85.5 };
|
|
15
|
+
/** 没在跑时 logo 的不透明度(#F3F3F3 上墨色对比度 3.3,#202020 上白色 5.8) */
|
|
16
|
+
export const TRAY_DIM = 0.55;
|
|
17
|
+
export const TRAY_WIN_SIZES = [16, 20, 24, 32, 40, 48];
|
|
18
|
+
const SS = 8;
|
|
19
|
+
/** at 返回这一点的颜色与不透明度,null = 透明 */
|
|
20
|
+
function draw(n, at) {
|
|
21
|
+
const px = Buffer.alloc(n * n * 4);
|
|
22
|
+
const unit = 100 / n;
|
|
23
|
+
for (let y = 0; y < n; y++) {
|
|
24
|
+
for (let x = 0; x < n; x++) {
|
|
25
|
+
let r = 0;
|
|
26
|
+
let g = 0;
|
|
27
|
+
let b = 0;
|
|
28
|
+
let a = 0;
|
|
29
|
+
for (let sy = 0; sy < SS; sy++) {
|
|
30
|
+
for (let sx = 0; sx < SS; sx++) {
|
|
31
|
+
const p = at((x + (sx + 0.5) / SS) * unit, (y + (sy + 0.5) / SS) * unit);
|
|
32
|
+
if (!p)
|
|
33
|
+
continue;
|
|
34
|
+
r += p.c[0] * p.a;
|
|
35
|
+
g += p.c[1] * p.a;
|
|
36
|
+
b += p.c[2] * p.a;
|
|
37
|
+
a += p.a;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (a <= 0)
|
|
41
|
+
continue;
|
|
42
|
+
const off = (y * n + x) * 4;
|
|
43
|
+
px[off] = Math.round(r / a);
|
|
44
|
+
px[off + 1] = Math.round(g / a);
|
|
45
|
+
px[off + 2] = Math.round(b / a);
|
|
46
|
+
px[off + 3] = Math.round((255 * a) / (SS * SS));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return encodePng(n, px, 4);
|
|
50
|
+
}
|
|
51
|
+
const inDot = (u, v) => Math.hypot(u - TRAY_DOT.cx, v - 50) <= TRAY_DOT.r;
|
|
52
|
+
const BLACK = [0, 0, 0];
|
|
53
|
+
/** 菜单里的小圆点(10 pt @2x) */
|
|
54
|
+
const MENU_DOT = { ok: '#1F9D55', warn: '#E8830C', bad: '#D92D20' };
|
|
55
|
+
const menuDot = (hex) => draw(20, (u, v) => (Math.hypot(u - 50, v - 50) <= 42 ? { c: rgb(hex), a: 1 } : null));
|
|
56
|
+
/** 文件名 → 内容:macOS 那几张 */
|
|
57
|
+
export function macTrayIcons() {
|
|
58
|
+
const out = {
|
|
59
|
+
'logo.png': draw(36, (u, v) => (logoHit(u, v, LOGO_SMALL) ? { c: BLACK, a: 1 } : null)),
|
|
60
|
+
'dotmark.png': draw(36, (u, v) => (inDot(u, v) ? { c: BLACK, a: 1 } : null)),
|
|
61
|
+
};
|
|
62
|
+
for (const [s, c] of Object.entries(MENU_DOT))
|
|
63
|
+
out[`dot-${s}.png`] = menuDot(c);
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
const WIN_THEMES = {
|
|
67
|
+
white: { fg: [255, 255, 255], warn: rgb('#FFA938'), bad: rgb('#FF5A4F') },
|
|
68
|
+
ink: { fg: rgb(LOGO_INK), warn: rgb('#C96A00'), bad: rgb('#D92D20') },
|
|
69
|
+
};
|
|
70
|
+
/** 文件名 → 内容:Windows 那几张(<white|ink>-<ok|warn|bad>-<尺寸>.png、dot-<状态>.png) */
|
|
71
|
+
export function windowsTrayIcons() {
|
|
72
|
+
const out = {};
|
|
73
|
+
for (const [name, t] of Object.entries(WIN_THEMES)) {
|
|
74
|
+
for (const s of ['ok', 'warn', 'bad']) {
|
|
75
|
+
for (const n of TRAY_WIN_SIZES) {
|
|
76
|
+
out[`${name}-${s}-${n}.png`] = draw(n, (u, v) => {
|
|
77
|
+
if (s !== 'ok' && inDot(u, v))
|
|
78
|
+
return { c: t[s], a: 1 };
|
|
79
|
+
return logoHit(u, v, LOGO_SMALL) ? { c: t.fg, a: s === 'bad' ? TRAY_DIM : 1 } : null;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
for (const [s, c] of Object.entries(MENU_DOT))
|
|
85
|
+
out[`dot-${s}.png`] = menuDot(c);
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** 托盘的几个名字。不和后台服务撞:服务的 Label 是 com.tarslab.cotutor.<名>、Run 项是 cotutor-<名>,workspace 叫 tray 也不会认错 */
|
|
2
|
+
export declare const TRAY_LABEL = "com.tarslab.cotutor-tray";
|
|
3
|
+
export declare const TRAY_RUN_VALUE = "cotutorTray";
|
|
4
|
+
export declare const TRAY_AUMID = "cotutor.tray";
|
|
5
|
+
/** 显示脚本发现没有桌面(ssh 进来的会话)时的退出码:node 不再起它 */
|
|
6
|
+
export declare const HELPER_NO_SESSION = 3;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** 托盘的几个名字。不和后台服务撞:服务的 Label 是 com.tarslab.cotutor.<名>、Run 项是 cotutor-<名>,workspace 叫 tray 也不会认错 */
|
|
2
|
+
export const TRAY_LABEL = 'com.tarslab.cotutor-tray';
|
|
3
|
+
export const TRAY_RUN_VALUE = 'cotutorTray';
|
|
4
|
+
export const TRAY_AUMID = 'cotutor.tray';
|
|
5
|
+
/** 显示脚本发现没有桌面(ssh 进来的会话)时的退出码:node 不再起它 */
|
|
6
|
+
export const HELPER_NO_SESSION = 3;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* macOS 菜单栏图标的显示脚本:osascript -l JavaScript 跑,系统自带,不用签名、不用装东西(tray.ts 每次起来写到托盘目录再跑)。
|
|
3
|
+
* 这里只管画和回报,不判断状态:从 stdin 收一行一条 JSON(show / notify / confirm / inspect / press / quit),从 stdout 回一行一条 JSON(ready / click / confirm / state)。
|
|
4
|
+
* stdin 断了就退:看护它的 node 没了,图标也不该留着。
|
|
5
|
+
* JXA 的坑(2026-11-06 在 macOS 27.2 上试的):$.NSAttributedString.alloc.initWithStringAttributes 不存在,要 NSMutableAttributedString.alloc.init 再填;枚举常量取不到值,写数字(NSImageScaleProportionallyUpOrDown = 3);返回整数的方法给的是字符串,比较前要 Number()。
|
|
6
|
+
* 状态点是叠在按钮上的一层,系统的模板图才能继续跟着菜单栏深浅变;试过不挡点击。
|
|
7
|
+
*/
|
|
8
|
+
export declare const MAC_TRAY_SCRIPT: string;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* macOS 菜单栏图标的显示脚本:osascript -l JavaScript 跑,系统自带,不用签名、不用装东西(tray.ts 每次起来写到托盘目录再跑)。
|
|
3
|
+
* 这里只管画和回报,不判断状态:从 stdin 收一行一条 JSON(show / notify / confirm / inspect / press / quit),从 stdout 回一行一条 JSON(ready / click / confirm / state)。
|
|
4
|
+
* stdin 断了就退:看护它的 node 没了,图标也不该留着。
|
|
5
|
+
* JXA 的坑(2026-11-06 在 macOS 27.2 上试的):$.NSAttributedString.alloc.initWithStringAttributes 不存在,要 NSMutableAttributedString.alloc.init 再填;枚举常量取不到值,写数字(NSImageScaleProportionallyUpOrDown = 3);返回整数的方法给的是字符串,比较前要 Number()。
|
|
6
|
+
* 状态点是叠在按钮上的一层,系统的模板图才能继续跟着菜单栏深浅变;试过不挡点击。
|
|
7
|
+
*/
|
|
8
|
+
export const MAC_TRAY_SCRIPT = String.raw `ObjC.import('Cocoa');
|
|
9
|
+
const app = Application.currentApplication();
|
|
10
|
+
app.includeStandardAdditions = true;
|
|
11
|
+
const dir = $.NSProcessInfo.processInfo.environment.objectForKey('COTUTOR_TRAY_DIR').js;
|
|
12
|
+
const stdout = $.NSFileHandle.fileHandleWithStandardOutput;
|
|
13
|
+
const stdin = $.NSFileHandle.fileHandleWithStandardInput;
|
|
14
|
+
const emit = (o) => stdout.writeData($(JSON.stringify(o) + '\n').dataUsingEncoding($.NSUTF8StringEncoding));
|
|
15
|
+
let item, menu, tray, dotView, current = 'ok', pending = $.NSMutableData.alloc.init;
|
|
16
|
+
let ids = [];
|
|
17
|
+
|
|
18
|
+
const image = (name, size, template) => {
|
|
19
|
+
const i = $.NSImage.alloc.initWithContentsOfFile($(dir + '/icons/' + name));
|
|
20
|
+
i.setSize($.NSMakeSize(size, size));
|
|
21
|
+
if (template) i.setTemplate(true);
|
|
22
|
+
return i;
|
|
23
|
+
};
|
|
24
|
+
const styled = (text, font, color) => {
|
|
25
|
+
const t = $.NSMutableAttributedString.alloc.init;
|
|
26
|
+
t.replaceCharactersInRangeWithString($.NSMakeRange(0, 0), $(text));
|
|
27
|
+
t.setAttributesRange($.NSDictionary.dictionaryWithObjectsForKeys($([font, color]), $([$.NSFontAttributeName, $.NSForegroundColorAttributeName])), $.NSMakeRange(0, text.length));
|
|
28
|
+
return t;
|
|
29
|
+
};
|
|
30
|
+
function center() {
|
|
31
|
+
const b = item.button.bounds;
|
|
32
|
+
dotView.frame = $.NSMakeRect((b.size.width - 18) / 2, (b.size.height - 18) / 2, 18, 18);
|
|
33
|
+
}
|
|
34
|
+
function fill(entries) {
|
|
35
|
+
menu.removeAllItems;
|
|
36
|
+
ids = [];
|
|
37
|
+
for (const e of entries) {
|
|
38
|
+
if (e.kind === 'sep') { menu.addItem($.NSMenuItem.separatorItem); continue; }
|
|
39
|
+
const m = $.NSMenuItem.alloc.initWithTitleActionKeyEquivalent($(e.title), e.kind === 'action' ? 'clicked:' : null, $(''));
|
|
40
|
+
if (e.kind === 'action') {
|
|
41
|
+
m.target = tray;
|
|
42
|
+
m.enabled = true;
|
|
43
|
+
// 标号从 1 起:别的行缺省是 0,按标号找会找到它们
|
|
44
|
+
ids.push(e.id);
|
|
45
|
+
m.tag = ids.length;
|
|
46
|
+
if (e.primary) m.attributedTitle = styled(e.title, $.NSFont.boldSystemFontOfSize(13), $.NSColor.labelColor);
|
|
47
|
+
} else if (e.kind === 'info') {
|
|
48
|
+
m.enabled = false;
|
|
49
|
+
m.attributedTitle = styled(e.title, $.NSFont.boldSystemFontOfSize(13), $.NSColor.labelColor);
|
|
50
|
+
if (e.level) m.image = image('dot-' + e.level + '.png', 10, false);
|
|
51
|
+
} else {
|
|
52
|
+
m.enabled = false;
|
|
53
|
+
m.attributedTitle = styled(e.title, $.NSFont.systemFontOfSize(11), $.NSColor.secondaryLabelColor);
|
|
54
|
+
}
|
|
55
|
+
menu.addItem(m);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function show(m) {
|
|
59
|
+
current = m.icon;
|
|
60
|
+
dotView.setHidden(m.icon === 'ok');
|
|
61
|
+
dotView.contentTintColor = m.icon === 'warn' ? $.NSColor.systemOrangeColor : $.NSColor.systemRedColor;
|
|
62
|
+
item.button.appearsDisabled = m.icon === 'bad';
|
|
63
|
+
item.button.toolTip = $(m.tip);
|
|
64
|
+
fill(m.menu);
|
|
65
|
+
center();
|
|
66
|
+
}
|
|
67
|
+
function quit() {
|
|
68
|
+
$.NSStatusBar.systemStatusBar.removeStatusItem(item);
|
|
69
|
+
$.NSApp.terminate(null);
|
|
70
|
+
}
|
|
71
|
+
function confirm(m) {
|
|
72
|
+
const a = $.NSAlert.alloc.init;
|
|
73
|
+
a.messageText = $(m.title);
|
|
74
|
+
a.informativeText = $(m.body);
|
|
75
|
+
// 第一个按钮是回车默认的那个:默认不退出
|
|
76
|
+
a.addButtonWithTitle($(m.no));
|
|
77
|
+
a.addButtonWithTitle($(m.yes));
|
|
78
|
+
$.NSApp.activateIgnoringOtherApps(true);
|
|
79
|
+
// 桥接把整数返回成字符串("1001"),不转就永远不等
|
|
80
|
+
emit({ type: 'confirm', id: m.id, yes: Number(a.runModal) === 1001 });
|
|
81
|
+
}
|
|
82
|
+
function handle(m) {
|
|
83
|
+
if (m.type === 'show') show(m);
|
|
84
|
+
else if (m.type === 'notify') { try { app.displayNotification(m.body, { withTitle: m.title }); } catch (e) { emit({ type: 'error', message: String(e) }); } }
|
|
85
|
+
else if (m.type === 'confirm') confirm(m);
|
|
86
|
+
else if (m.type === 'quit') quit();
|
|
87
|
+
else if (m.type === 'inspect') {
|
|
88
|
+
const titles = [];
|
|
89
|
+
for (let i = 0; i < menu.numberOfItems; i++) titles.push(menu.itemAtIndex(i).title.js);
|
|
90
|
+
emit({ type: 'state', icon: current, dot: !dotView.isHidden, dim: item.button.appearsDisabled, visible: (item.button.window.occlusionState & 2) === 2, appearance: item.button.effectiveAppearance.name.js, menu: titles });
|
|
91
|
+
} else if (m.type === 'press') {
|
|
92
|
+
const n = ids.indexOf(m.id);
|
|
93
|
+
if (n >= 0) { const at = menu.indexOfItemWithTag(n + 1); if (at >= 0) menu.performActionForItemAtIndex(at); }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function received() {
|
|
97
|
+
const data = stdin.availableData;
|
|
98
|
+
if (Number(data.length) === 0) { quit(); return; }
|
|
99
|
+
pending.appendData(data);
|
|
100
|
+
const text = $.NSString.alloc.initWithDataEncoding(pending, $.NSUTF8StringEncoding);
|
|
101
|
+
// 一个汉字被切在两块之间时解不出来:等下一块
|
|
102
|
+
if (!text.isNil()) {
|
|
103
|
+
const lines = text.js.split('\n');
|
|
104
|
+
const rest = lines.pop();
|
|
105
|
+
pending = $.NSMutableData.alloc.init;
|
|
106
|
+
if (rest) pending.appendData($(rest).dataUsingEncoding($.NSUTF8StringEncoding));
|
|
107
|
+
for (const line of lines) {
|
|
108
|
+
if (!line) continue;
|
|
109
|
+
try { handle(JSON.parse(line)); } catch (e) { emit({ type: 'error', message: String(e) }); }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
stdin.waitForDataInBackgroundAndNotify;
|
|
113
|
+
}
|
|
114
|
+
ObjC.registerSubclass({
|
|
115
|
+
name: 'CotutorTray',
|
|
116
|
+
methods: {
|
|
117
|
+
'clicked:': { types: ['void', ['id']], implementation: function (sender) { emit({ type: 'click', id: ids[Number(sender.tag) - 1] }); } },
|
|
118
|
+
'received:': { types: ['void', ['id']], implementation: function () { received(); } },
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
const nsapp = $.NSApplication.sharedApplication;
|
|
122
|
+
nsapp.setActivationPolicy($.NSApplicationActivationPolicyAccessory);
|
|
123
|
+
tray = $.CotutorTray.alloc.init;
|
|
124
|
+
item = $.NSStatusBar.systemStatusBar.statusItemWithLength(28);
|
|
125
|
+
item.button.image = image('logo.png', 18, true);
|
|
126
|
+
item.button.setAccessibilityLabel($('cotutor'));
|
|
127
|
+
dotView = $.NSImageView.alloc.initWithFrame($.NSMakeRect(5, 2, 18, 18));
|
|
128
|
+
dotView.image = image('dotmark.png', 18, true);
|
|
129
|
+
dotView.imageScaling = 3;
|
|
130
|
+
dotView.setHidden(true);
|
|
131
|
+
item.button.addSubview(dotView);
|
|
132
|
+
menu = $.NSMenu.alloc.init;
|
|
133
|
+
menu.autoenablesItems = false;
|
|
134
|
+
item.menu = menu;
|
|
135
|
+
center();
|
|
136
|
+
$.NSNotificationCenter.defaultCenter.addObserverSelectorNameObject(tray, 'received:', $.NSFileHandleDataAvailableNotification, stdin);
|
|
137
|
+
stdin.waitForDataInBackgroundAndNotify;
|
|
138
|
+
emit({ type: 'ready' });
|
|
139
|
+
nsapp.run;
|
|
140
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function main(argv: string[]): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cotutor tray run 的轻入口:bin/cotutor.js 直接到这里,不经 main.ts。
|
|
3
|
+
* 托盘进程一直开着,main.ts 把所有命令都加载进来要多占近一百 MB(2026-11-06 量的,源码直跑 140 MB 对 63 MB);这里和 tray.ts 引的东西都不带 zod。
|
|
4
|
+
*/
|
|
5
|
+
import { mkdirSync, readFileSync } from 'node:fs';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { realHost } from "./service.js";
|
|
8
|
+
import { realTrayDeps, runTray, trayDir, trayNote, traySupported, writeTrayFiles } from "./tray.js";
|
|
9
|
+
const version = () => JSON.parse(readFileSync(fileURLToPath(new URL('../../../package.json', import.meta.url)), 'utf8')).version;
|
|
10
|
+
export async function main(argv) {
|
|
11
|
+
const host = realHost();
|
|
12
|
+
if (!traySupported(host.platform)) {
|
|
13
|
+
process.stderr.write(`${host.platform} 上没做托盘图标\n`);
|
|
14
|
+
process.exitCode = 0;
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const at = argv.indexOf('--dir');
|
|
18
|
+
const dir = at >= 0 && argv[at + 1] ? argv[at + 1] : trayDir(host);
|
|
19
|
+
mkdirSync(dir, { recursive: true });
|
|
20
|
+
const note = trayNote(dir);
|
|
21
|
+
// 没接住的错误:记一笔再以非 0 退(macOS 上 launchd 隔 10 秒再起)
|
|
22
|
+
const fatal = (what) => (err) => {
|
|
23
|
+
note(`${what}:${err instanceof Error ? err.stack : String(err)}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
};
|
|
26
|
+
process.on('uncaughtException', fatal('没接住的错误'));
|
|
27
|
+
process.on('unhandledRejection', fatal('没接住的 Promise 错误'));
|
|
28
|
+
const file = await writeTrayFiles(host.platform, dir);
|
|
29
|
+
note(`起来了,node ${process.versions.node},pid ${process.pid}`);
|
|
30
|
+
const code = await runTray(realTrayDeps(host, dir, file, version()));
|
|
31
|
+
note(`退出 ${code}`);
|
|
32
|
+
process.exit(code);
|
|
33
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const WINDOWS_TRAY_SCRIPT: string;
|
|
2
|
+
/** 找这台电脑上这个用户的托盘进程(命令行里带 tray run 和这个用户自己的托盘目录) */
|
|
3
|
+
export declare function findTrayScript(dir: string): string;
|
|
4
|
+
/** 启动器:wscript 跑它,藏着窗口起 node(和后台服务同一个办法,见 service-windows.ts) */
|
|
5
|
+
export declare function trayLauncher(commandLine: string): string;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Windows 托盘图标的显示脚本:Windows PowerShell + WinForms 的 NotifyIcon,系统自带,不用装东西(tray.ts 每次起来写到托盘目录再跑,存 UTF-8 带 BOM,不然中文按系统代码页读)。
|
|
3
|
+
* 这里只管画和回报,不判断状态:从 stdin 收一行一条 JSON(show / notify / confirm / inspect / press / quit),从 stdout 回一行一条 JSON(ready / click / confirm / state)。
|
|
4
|
+
* stdin 断了就退:看护它的 node 没了,图标也不该留着。没有桌面的会话(ssh 进来)里图标没人看得见,以 3 退,node 也不再起。
|
|
5
|
+
* 深浅自己看:每两秒读一次 SystemUsesLightTheme(任务栏跟它走,不是 AppsUseLightTheme;在深色任务栏上用白色 logo,浅色用墨色)。
|
|
6
|
+
* 通知走 WinRT 的 ToastNotifier + 注册的应用 ID,来源才写 cotutor;直接用 NotifyIcon 的气泡,来源是 Windows PowerShell(2026-11-06 build 26300 上都试过)。不行就退回气泡。
|
|
7
|
+
* 点通知没有动作:PowerShell 5.1 接不了 WinRT 的事件(Register-ObjectEvent 报 INVALID_REGISTRATION,脚本块直接接又在别的线程上没有 runspace),所以文案同 macOS,请家长点图标。
|
|
8
|
+
*/
|
|
9
|
+
import { TRAY_AUMID } from "./tray-ids.js";
|
|
10
|
+
export const WINDOWS_TRAY_SCRIPT = String.raw `Add-Type -AssemblyName System.Windows.Forms, System.Drawing
|
|
11
|
+
$dir = $env:COTUTOR_TRAY_DIR
|
|
12
|
+
$aumid = '${TRAY_AUMID}'
|
|
13
|
+
if ((Get-Process -Id $PID).SessionId -eq 0) { exit 3 }
|
|
14
|
+
$utf8 = New-Object System.Text.UTF8Encoding($false)
|
|
15
|
+
# stderr 进 tray.log:不设的话是系统代码页,中文 Windows 上读出来是乱码
|
|
16
|
+
try { [Console]::OutputEncoding = $utf8 } catch { }
|
|
17
|
+
$stdin = New-Object System.IO.StreamReader([Console]::OpenStandardInput(), $utf8)
|
|
18
|
+
$stdout = [Console]::OpenStandardOutput()
|
|
19
|
+
function Emit($o) {
|
|
20
|
+
$b = $utf8.GetBytes((ConvertTo-Json -Compress -InputObject $o) + [char]10)
|
|
21
|
+
$stdout.Write($b, 0, $b.Length)
|
|
22
|
+
$stdout.Flush()
|
|
23
|
+
}
|
|
24
|
+
$want = [System.Windows.Forms.SystemInformation]::SmallIconSize.Width
|
|
25
|
+
$size = (@(16, 20, 24, 32, 40, 48) | Where-Object { $_ -ge $want } | Select-Object -First 1)
|
|
26
|
+
if (-not $size) { $size = 48 }
|
|
27
|
+
$icons = @{}; $dots = @{}
|
|
28
|
+
foreach ($t in 'white', 'ink') { foreach ($s in 'ok', 'warn', 'bad') { $icons["$t-$s"] = [System.Drawing.Icon]::FromHandle(([System.Drawing.Bitmap]::new("$dir\icons\$t-$s-$size.png")).GetHicon()) } }
|
|
29
|
+
foreach ($s in 'ok', 'warn', 'bad') { $dots[$s] = [System.Drawing.Bitmap]::new("$dir\icons\dot-$s.png") }
|
|
30
|
+
$themeKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize'
|
|
31
|
+
function ThemeNow { try { if ((Get-ItemProperty $themeKey).SystemUsesLightTheme -eq 1) { 'ink' } else { 'white' } } catch { 'white' } }
|
|
32
|
+
$amKey = "HKCU:\Software\Classes\AppUserModelId\$aumid"
|
|
33
|
+
$script:toastReady = $false
|
|
34
|
+
$script:theme = ThemeNow
|
|
35
|
+
function RegisterToast {
|
|
36
|
+
New-Item $amKey -Force | Out-Null
|
|
37
|
+
Set-ItemProperty $amKey -Name DisplayName -Value 'cotutor'
|
|
38
|
+
Set-ItemProperty $amKey -Name IconUri -Value "$dir\icons\$($script:theme)-ok-48.png"
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
RegisterToast
|
|
42
|
+
[void][Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
|
|
43
|
+
[void][Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
|
|
44
|
+
$script:toastReady = $true
|
|
45
|
+
} catch { Emit @{ type = 'error'; message = "toast: $_" } }
|
|
46
|
+
$ni = New-Object System.Windows.Forms.NotifyIcon
|
|
47
|
+
$script:level = 'ok'
|
|
48
|
+
$ni.Icon = $icons["$($script:theme)-ok"]; $ni.Text = 'cotutor'; $ni.Visible = $true
|
|
49
|
+
$menu = New-Object System.Windows.Forms.ContextMenuStrip
|
|
50
|
+
$menu.ShowImageMargin = $false
|
|
51
|
+
$menu.Font = New-Object System.Drawing.Font('Microsoft YaHei UI', 9)
|
|
52
|
+
$bold = New-Object System.Drawing.Font('Microsoft YaHei UI', 9, [System.Drawing.FontStyle]::Bold)
|
|
53
|
+
$tiny = New-Object System.Drawing.Font('Microsoft YaHei UI', 8)
|
|
54
|
+
$grey = [System.Drawing.Color]::FromArgb(90, 90, 90)
|
|
55
|
+
$ni.ContextMenuStrip = $menu
|
|
56
|
+
$showMenu = [System.Windows.Forms.NotifyIcon].GetMethod('ShowContextMenu', [Reflection.BindingFlags]'Instance,NonPublic')
|
|
57
|
+
$ni.add_MouseUp({ param($s, $e) if ($e.Button -eq 'Left') { try { $showMenu.Invoke($ni, $null) | Out-Null } catch { } } })
|
|
58
|
+
function Quit {
|
|
59
|
+
$ni.Visible = $false
|
|
60
|
+
$ni.Dispose()
|
|
61
|
+
[System.Windows.Forms.Application]::Exit()
|
|
62
|
+
}
|
|
63
|
+
function Fill($entries) {
|
|
64
|
+
while ($menu.Items.Count) { $x = $menu.Items[0]; $menu.Items.RemoveAt(0); $x.Dispose() }
|
|
65
|
+
foreach ($e in $entries) {
|
|
66
|
+
if ($e.kind -eq 'sep') { [void]$menu.Items.Add((New-Object System.Windows.Forms.ToolStripSeparator)); continue }
|
|
67
|
+
if ($e.kind -eq 'action') {
|
|
68
|
+
$i = New-Object System.Windows.Forms.ToolStripMenuItem $e.title
|
|
69
|
+
$i.Tag = $e.id
|
|
70
|
+
if ($e.primary) { $i.Font = $bold }
|
|
71
|
+
$i.add_Click({ param($s, $a) Emit @{ type = 'click'; id = $s.Tag } })
|
|
72
|
+
} elseif ($e.kind -eq 'info') {
|
|
73
|
+
$i = New-Object System.Windows.Forms.ToolStripLabel $e.title
|
|
74
|
+
$i.Font = $bold
|
|
75
|
+
if ($e.level) { $i.Image = $dots[$e.level]; $i.ImageAlign = 'MiddleLeft' }
|
|
76
|
+
$i.TextAlign = 'MiddleLeft'
|
|
77
|
+
} else {
|
|
78
|
+
$i = New-Object System.Windows.Forms.ToolStripLabel $e.title
|
|
79
|
+
$i.Font = $tiny
|
|
80
|
+
$i.ForeColor = $grey
|
|
81
|
+
$i.TextAlign = 'MiddleLeft'
|
|
82
|
+
}
|
|
83
|
+
[void]$menu.Items.Add($i)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function Show($m) {
|
|
87
|
+
$script:level = $m.icon
|
|
88
|
+
$ni.Icon = $icons["$($script:theme)-$($m.icon)"]
|
|
89
|
+
$t = [string]$m.tip
|
|
90
|
+
if ($t.Length -gt 63) { $t = $t.Substring(0, 63) }
|
|
91
|
+
$ni.Text = $t
|
|
92
|
+
Fill $m.menu
|
|
93
|
+
}
|
|
94
|
+
function Notify($title, $body) {
|
|
95
|
+
if ($script:toastReady) {
|
|
96
|
+
try {
|
|
97
|
+
$esc = { param($v) [System.Security.SecurityElement]::Escape([string]$v) }
|
|
98
|
+
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
|
99
|
+
$xml.LoadXml("<toast><visual><binding template='ToastGeneric'><text>$(& $esc $title)</text><text>$(& $esc $body)</text></binding></visual></toast>")
|
|
100
|
+
$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)
|
|
101
|
+
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($aumid).Show($toast)
|
|
102
|
+
return
|
|
103
|
+
} catch { Emit @{ type = 'error'; message = "toast: $_" } }
|
|
104
|
+
}
|
|
105
|
+
$ni.ShowBalloonTip(8000, $title, $body, [System.Windows.Forms.ToolTipIcon]::None)
|
|
106
|
+
}
|
|
107
|
+
function Confirm($m) {
|
|
108
|
+
$owner = New-Object System.Windows.Forms.Form
|
|
109
|
+
$owner.TopMost = $true
|
|
110
|
+
$answer = [System.Windows.Forms.MessageBox]::Show($owner, $m.body, $m.title, 'YesNo', 'Warning', 'Button2')
|
|
111
|
+
$owner.Dispose()
|
|
112
|
+
Emit @{ type = 'confirm'; id = $m.id; yes = ($answer -eq 'Yes') }
|
|
113
|
+
}
|
|
114
|
+
function Handle($m) {
|
|
115
|
+
switch ($m.type) {
|
|
116
|
+
'show' { Show $m }
|
|
117
|
+
'notify' { Notify $m.title $m.body }
|
|
118
|
+
'confirm' { Confirm $m }
|
|
119
|
+
'quit' { Quit }
|
|
120
|
+
'inspect' {
|
|
121
|
+
$titles = @(); foreach ($i in $menu.Items) { $titles += [string]$i.Text }
|
|
122
|
+
$p = Get-Process -Id $PID
|
|
123
|
+
Emit @{ type = 'state'; icon = $script:level; theme = $script:theme; size = $size; privateMb = [int]($p.PrivateMemorySize64 / 1MB); workingMb = [int]($p.WorkingSet64 / 1MB); menu = $titles }
|
|
124
|
+
}
|
|
125
|
+
'press' { foreach ($i in $menu.Items) { if ($i.Tag -eq $m.id) { $i.PerformClick(); break } } }
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
$script:reading = $stdin.ReadLineAsync()
|
|
129
|
+
$script:themeAt = Get-Date
|
|
130
|
+
$timer = New-Object System.Windows.Forms.Timer
|
|
131
|
+
$timer.Interval = 200
|
|
132
|
+
$timer.add_Tick({
|
|
133
|
+
while ($script:reading.IsCompleted) {
|
|
134
|
+
$line = $script:reading.Result
|
|
135
|
+
if ($null -eq $line) { $timer.Stop(); Quit; return }
|
|
136
|
+
$script:reading = $stdin.ReadLineAsync()
|
|
137
|
+
if ($line) { try { Handle (ConvertFrom-Json $line) } catch { Emit @{ type = 'error'; message = [string]$_ } } }
|
|
138
|
+
}
|
|
139
|
+
if (((Get-Date) - $script:themeAt).TotalSeconds -ge 2) {
|
|
140
|
+
$script:themeAt = Get-Date
|
|
141
|
+
$t = ThemeNow
|
|
142
|
+
if ($t -ne $script:theme) {
|
|
143
|
+
$script:theme = $t
|
|
144
|
+
$ni.Icon = $icons["$t-$($script:level)"]
|
|
145
|
+
if ($script:toastReady) { try { RegisterToast } catch { } }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
$timer.Start()
|
|
150
|
+
Emit @{ type = 'ready' }
|
|
151
|
+
[System.Windows.Forms.Application]::Run()
|
|
152
|
+
`;
|
|
153
|
+
/** 找这台电脑上这个用户的托盘进程(命令行里带 tray run 和这个用户自己的托盘目录) */
|
|
154
|
+
export function findTrayScript(dir) {
|
|
155
|
+
return [
|
|
156
|
+
`$dir = '${dir.replaceAll("'", "''")}'`,
|
|
157
|
+
"$found = @(Get-CimInstance Win32_Process -Filter \"Name='node.exe'\" | Where-Object { $c = $_.CommandLine; $c -and $c.Contains($dir) -and $c.Contains(' tray run ') })",
|
|
158
|
+
'ConvertTo-Json -Compress -InputObject @($found | ForEach-Object { @{ pid = $_.ProcessId; keeper = $true } })',
|
|
159
|
+
].join('\n');
|
|
160
|
+
}
|
|
161
|
+
/** 启动器:wscript 跑它,藏着窗口起 node(和后台服务同一个办法,见 service-windows.ts) */
|
|
162
|
+
export function trayLauncher(commandLine) {
|
|
163
|
+
return `// cotutor tray on 写的;改了会被下次盖掉。关掉:cotutor tray off
|
|
164
|
+
new ActiveXObject("WScript.Shell").Run(${JSON.stringify(commandLine)}, 0, false);
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { type Health, type InstalledService, type ServiceHost } from './service.ts';
|
|
2
|
+
import { HELPER_NO_SESSION, TRAY_AUMID, TRAY_LABEL, TRAY_RUN_VALUE } from './tray-ids.ts';
|
|
3
|
+
export { HELPER_NO_SESSION, TRAY_AUMID, TRAY_LABEL, TRAY_RUN_VALUE };
|
|
4
|
+
/** 多久问一次 */
|
|
5
|
+
export declare const TRAY_POLL_MS = 5000;
|
|
6
|
+
/** 连着几次问不到才算没在跑:重起一下、网络抖一下不报 */
|
|
7
|
+
export declare const TRAY_STRIKES = 2;
|
|
8
|
+
/** 图标刚起来时服务可能还没起来:这么久里问不到算「正在启动」(Windows 登录后约一分钟才跑 Run 项) */
|
|
9
|
+
export declare const TRAY_START_GRACE_MS = 90000;
|
|
10
|
+
/** 点了启动、重启以后等多久 */
|
|
11
|
+
export declare const TRAY_RESTART_GRACE_MS = 30000;
|
|
12
|
+
/** 两次问之间隔太久 = 刚睡醒:网络还没回来,先别报 */
|
|
13
|
+
export declare const TRAY_WAKE_GAP_MS = 30000;
|
|
14
|
+
export declare const TRAY_WAKE_GRACE_MS = 30000;
|
|
15
|
+
export type TrayLevel = 'ok' | 'warn' | 'bad';
|
|
16
|
+
export type RowLevel = TrayLevel | 'starting';
|
|
17
|
+
export type TrayFix = {
|
|
18
|
+
kind: 'open';
|
|
19
|
+
target: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'restart';
|
|
22
|
+
};
|
|
23
|
+
/** 一个服务这一轮问到的 */
|
|
24
|
+
export interface TrayProbe {
|
|
25
|
+
name: string;
|
|
26
|
+
kid: string;
|
|
27
|
+
root: string;
|
|
28
|
+
logDir: string | null;
|
|
29
|
+
port: number;
|
|
30
|
+
health: Health | null;
|
|
31
|
+
/** 问不到时端口被谁占着(「nginx」);不知道 → null */
|
|
32
|
+
holder: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** 一个服务现在的样子 */
|
|
35
|
+
export interface TrayRow {
|
|
36
|
+
name: string;
|
|
37
|
+
kid: string;
|
|
38
|
+
logDir: string | null;
|
|
39
|
+
level: RowLevel;
|
|
40
|
+
/** 家长端地址;服务没答应 → null */
|
|
41
|
+
url: string | null;
|
|
42
|
+
/** 第二行小字 */
|
|
43
|
+
detail: string;
|
|
44
|
+
/** 有几件事要处理 */
|
|
45
|
+
issues: number;
|
|
46
|
+
fix: TrayFix | null;
|
|
47
|
+
calls: number;
|
|
48
|
+
}
|
|
49
|
+
export type TrayEntry = {
|
|
50
|
+
kind: 'info';
|
|
51
|
+
title: string;
|
|
52
|
+
level?: TrayLevel;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'sub';
|
|
55
|
+
title: string;
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'sep';
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'action';
|
|
60
|
+
id: string;
|
|
61
|
+
title: string;
|
|
62
|
+
primary?: boolean;
|
|
63
|
+
};
|
|
64
|
+
export interface TrayShow {
|
|
65
|
+
type: 'show';
|
|
66
|
+
icon: TrayLevel;
|
|
67
|
+
tip: string;
|
|
68
|
+
menu: TrayEntry[];
|
|
69
|
+
}
|
|
70
|
+
export interface TrayNote {
|
|
71
|
+
type: 'notify';
|
|
72
|
+
title: string;
|
|
73
|
+
body: string;
|
|
74
|
+
}
|
|
75
|
+
/** 跑了多久,给家长看 */
|
|
76
|
+
export declare function uptimeText(startedMs: number, now: number): string;
|
|
77
|
+
/** 服务在跑,但有事要家长处理:先后就是轻重,菜单上只说第一件 */
|
|
78
|
+
export declare function issuesOf(p: TrayProbe, o: {
|
|
79
|
+
platform: NodeJS.Platform;
|
|
80
|
+
version: string;
|
|
81
|
+
}): {
|
|
82
|
+
text: string;
|
|
83
|
+
fix: TrayFix;
|
|
84
|
+
}[];
|
|
85
|
+
/** 记着每个服务上一轮的样子,算这一轮的样子和要不要通知;不碰任何系统,测试直接喂 */
|
|
86
|
+
export declare class TrayModel {
|
|
87
|
+
private readonly mem;
|
|
88
|
+
private last;
|
|
89
|
+
private readonly o;
|
|
90
|
+
constructor(o: {
|
|
91
|
+
platform: NodeJS.Platform;
|
|
92
|
+
version: string;
|
|
93
|
+
});
|
|
94
|
+
/** 刚点了启动、重启:这一阵问不到是正常的 */
|
|
95
|
+
expect(name: string, now: number): void;
|
|
96
|
+
update(probes: TrayProbe[], now: number): {
|
|
97
|
+
rows: TrayRow[];
|
|
98
|
+
notes: TrayNote[];
|
|
99
|
+
};
|
|
100
|
+
private healthy;
|
|
101
|
+
private placeholder;
|
|
102
|
+
}
|
|
103
|
+
/** 这一轮显示什么 */
|
|
104
|
+
export declare function trayShow(rows: TrayRow[]): TrayShow;
|
|
105
|
+
export interface HelperMessage {
|
|
106
|
+
type: string;
|
|
107
|
+
id?: string;
|
|
108
|
+
yes?: boolean;
|
|
109
|
+
message?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface TrayHelper {
|
|
112
|
+
send(m: unknown): void;
|
|
113
|
+
/** 关 stdin:显示脚本读到头自己退 */
|
|
114
|
+
close(): void;
|
|
115
|
+
}
|
|
116
|
+
export interface TrayDeps {
|
|
117
|
+
platform: NodeJS.Platform;
|
|
118
|
+
version: string;
|
|
119
|
+
now(): number;
|
|
120
|
+
list(): Promise<InstalledService[]>;
|
|
121
|
+
/** 读 cotutor.json:孩子叫什么、哪个端口 */
|
|
122
|
+
inspect(s: InstalledService): Promise<{
|
|
123
|
+
kid: string;
|
|
124
|
+
port: number;
|
|
125
|
+
}>;
|
|
126
|
+
probe(port: number): Promise<Health | null>;
|
|
127
|
+
holder(port: number): Promise<string | null>;
|
|
128
|
+
control(root: string, what: 'start' | 'stop' | 'restart'): Promise<unknown>;
|
|
129
|
+
open(target: string): void;
|
|
130
|
+
spawnHelper(on: {
|
|
131
|
+
message(m: HelperMessage): void;
|
|
132
|
+
exit(code: number | null): void;
|
|
133
|
+
}): TrayHelper;
|
|
134
|
+
note(text: string): void;
|
|
135
|
+
pollMs?: number;
|
|
136
|
+
helperRestartMs?: number;
|
|
137
|
+
}
|
|
138
|
+
export declare const QUIT_CONFIRM: {
|
|
139
|
+
id: string;
|
|
140
|
+
title: string;
|
|
141
|
+
body: string;
|
|
142
|
+
yes: string;
|
|
143
|
+
no: string;
|
|
144
|
+
};
|
|
145
|
+
/** 主循环:问状态、发给显示脚本、接点击;都退了才返回退出码。0 = 不用再起(点了退出、没有服务了、没有桌面) */
|
|
146
|
+
export declare function runTray(d: TrayDeps): Promise<number>;
|
|
147
|
+
export declare const traySupported: (platform: NodeJS.Platform) => boolean;
|
|
148
|
+
type HostPaths = Pick<ServiceHost, 'platform' | 'home' | 'env'>;
|
|
149
|
+
/** 显示脚本、图标、日志放哪 */
|
|
150
|
+
export declare function trayDir(host: HostPaths): string;
|
|
151
|
+
/** 写显示脚本(每次起来都写,升级后马上生效)和图标(版本变了才画,画一次要几百毫秒) */
|
|
152
|
+
export declare function writeTrayFiles(platform: NodeJS.Platform, dir: string): Promise<string>;
|
|
153
|
+
/** 起显示脚本 */
|
|
154
|
+
export declare function spawnTrayHelper(platform: NodeJS.Platform, file: string, dir: string, note: (t: string) => void, on: {
|
|
155
|
+
message(m: HelperMessage): void;
|
|
156
|
+
exit(code: number | null): void;
|
|
157
|
+
}): TrayHelper;
|
|
158
|
+
/** 打开地址或目录(Windows 不弹黑窗口) */
|
|
159
|
+
export declare function openTarget(platform: NodeJS.Platform, target: string): void;
|
|
160
|
+
/** 日志:一个文件,过 1 MB 换一次,只留上一份 */
|
|
161
|
+
export declare function trayNote(dir: string): (text: string) => void;
|
|
162
|
+
/** 孩子叫什么、哪个端口:只读这两样,不加载 zod(托盘进程常驻,要轻);读不了就用服务名和缺省端口 */
|
|
163
|
+
export declare function inspectService(s: InstalledService): Promise<{
|
|
164
|
+
kid: string;
|
|
165
|
+
port: number;
|
|
166
|
+
}>;
|
|
167
|
+
/** 真的依赖,给 runTray */
|
|
168
|
+
export declare function realTrayDeps(host: ServiceHost, dir: string, file: string, version: string): TrayDeps;
|
|
169
|
+
/** 登录项跑的命令 */
|
|
170
|
+
export declare const trayArgs: (host: HostPaths, o?: {
|
|
171
|
+
node?: string;
|
|
172
|
+
bin?: string;
|
|
173
|
+
}) => string[];
|
|
174
|
+
/** macOS 的 LaunchAgent:登录就起,崩了拉起,以 0 退(点了退出)不拉 */
|
|
175
|
+
export declare function trayPlist(args: string[], dir: string, path: string): string;
|
|
176
|
+
/** 装上并起来;已经装过就照现在的 node、bin 重写一遍再起(升级后新代码才生效)。started = false:登录项写好了,这个会话里起不来,下次登录出现 */
|
|
177
|
+
export declare function installTray(host: ServiceHost, o?: {
|
|
178
|
+
node?: string;
|
|
179
|
+
bin?: string;
|
|
180
|
+
}): Promise<{
|
|
181
|
+
file: string;
|
|
182
|
+
started: boolean;
|
|
183
|
+
}>;
|
|
184
|
+
/** 卸掉:停下、删登录项。remember = 家长说不要(以后 service install 也不再装) */
|
|
185
|
+
export declare function removeTray(host: ServiceHost, o?: {
|
|
186
|
+
remember?: boolean;
|
|
187
|
+
}): Promise<boolean>;
|
|
188
|
+
export interface TrayStatus {
|
|
189
|
+
supported: boolean;
|
|
190
|
+
installed: boolean;
|
|
191
|
+
running: boolean;
|
|
192
|
+
pid: number | null;
|
|
193
|
+
/** 家长关掉过(cotutor tray off) */
|
|
194
|
+
off: boolean;
|
|
195
|
+
/** Windows:下次登录还会不会起来;别的系统 null */
|
|
196
|
+
autostart: boolean | null;
|
|
197
|
+
}
|
|
198
|
+
export declare function trayStatus(host: ServiceHost): Promise<TrayStatus>;
|
|
199
|
+
/** service install 时跟着装:没做的系统、家长关掉过都跳过;返回给人看的结果 */
|
|
200
|
+
export declare function ensureTray(host: ServiceHost, o?: {
|
|
201
|
+
node?: string;
|
|
202
|
+
bin?: string;
|
|
203
|
+
}): Promise<'unsupported' | 'off' | 'started' | 'later'>;
|
|
204
|
+
/** 服务卸完了:图标也撤(不算家长说不要,以后再装服务还会带上) */
|
|
205
|
+
export declare function dropTrayIfNoServices(host: ServiceHost): Promise<boolean>;
|