opencharm 0.7.1 → 0.8.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/dist/main.mjs +21 -17
- package/package.json +1 -1
- package/sim/charm_sim.wasm +0 -0
package/dist/main.mjs
CHANGED
|
@@ -406,6 +406,25 @@ const ACP_AGENTS = {
|
|
|
406
406
|
};
|
|
407
407
|
const ACP_AGENT_NAMES = Object.keys(ACP_AGENTS);
|
|
408
408
|
//#endregion
|
|
409
|
+
//#region ../design/src/own-colour.ts
|
|
410
|
+
const OWN_COLOUR = /^#[0-9A-Fa-f]{6}$/;
|
|
411
|
+
function linear(v) {
|
|
412
|
+
return v <= .04045 ? v / 12.92 : ((v + .055) / 1.055) ** 2.4;
|
|
413
|
+
}
|
|
414
|
+
function ownColourProblem(hex) {
|
|
415
|
+
const [r, g, b] = [
|
|
416
|
+
1,
|
|
417
|
+
3,
|
|
418
|
+
5
|
|
419
|
+
].map((at) => Number.parseInt(hex.slice(at, at + 2), 16) / 255);
|
|
420
|
+
if (.2126 * linear(r) + .7152 * linear(g) + .0722 * linear(b) < .05) return "too dark to see on black";
|
|
421
|
+
const max = Math.max(r, g, b);
|
|
422
|
+
const spread = max - Math.min(r, g, b);
|
|
423
|
+
if (max !== r || max < .5 || spread / max < .5) return void 0;
|
|
424
|
+
const hue = 60 * (g - b) / spread;
|
|
425
|
+
return hue >= 6 && hue <= 40 ? "too close to the orange that means 'it needs you'" : void 0;
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
409
428
|
//#region ../protocol/src/constants.ts
|
|
410
429
|
const AUDIO_DOWN = {
|
|
411
430
|
format: "opus",
|
|
@@ -629,22 +648,7 @@ const MAX_NAME_CHARS = 12;
|
|
|
629
648
|
const MAX_NAME_BYTES = 24;
|
|
630
649
|
const MAX_GREETING_BYTES = 40;
|
|
631
650
|
const COLOUR_IDS = facesData.colours.map((colour) => colour.id);
|
|
632
|
-
const OWN_COLOUR = /^#[0-9A-Fa-f]{6}$/;
|
|
633
651
|
const lookName = z.string().min(1, "the name can't be empty").refine((name) => [...name].length <= MAX_NAME_CHARS && utf8Length(name) <= MAX_NAME_BYTES, { message: `at most ${MAX_NAME_CHARS} characters` });
|
|
634
|
-
function ownColourProblem(hex) {
|
|
635
|
-
const [r, g, b] = [
|
|
636
|
-
1,
|
|
637
|
-
3,
|
|
638
|
-
5
|
|
639
|
-
].map((at) => Number.parseInt(hex.slice(at, at + 2), 16) / 255);
|
|
640
|
-
const linear = (v) => v <= .04045 ? v / 12.92 : ((v + .055) / 1.055) ** 2.4;
|
|
641
|
-
if (.2126 * linear(r) + .7152 * linear(g) + .0722 * linear(b) < .05) return "too dark to see on black";
|
|
642
|
-
const max = Math.max(r, g, b);
|
|
643
|
-
const spread = max - Math.min(r, g, b);
|
|
644
|
-
if (max !== r || max < .5 || spread / max < .5) return void 0;
|
|
645
|
-
const hue = 60 * (g - b) / spread;
|
|
646
|
-
return hue >= 6 && hue <= 40 ? "too close to the orange that means 'it needs you'" : void 0;
|
|
647
|
-
}
|
|
648
652
|
const colour = z.string().superRefine((value, context) => {
|
|
649
653
|
if (COLOUR_IDS.includes(value)) return;
|
|
650
654
|
const problem = OWN_COLOUR.test(value) ? ownColourProblem(value) : `the colour is one of ${COLOUR_IDS.join(", ")}, or your own as #RRGGBB`;
|
|
@@ -993,7 +997,7 @@ function sendAdmin(socketPath, request) {
|
|
|
993
997
|
}
|
|
994
998
|
//#endregion
|
|
995
999
|
//#region package.json
|
|
996
|
-
var version = "0.
|
|
1000
|
+
var version = "0.8.0";
|
|
997
1001
|
function channelToCube(value) {
|
|
998
1002
|
if (value < 48) return 0;
|
|
999
1003
|
if (value < 115) return 1;
|
|
@@ -4965,7 +4969,7 @@ function formatIdentity(unit, version, commit) {
|
|
|
4965
4969
|
let cached;
|
|
4966
4970
|
function identity() {
|
|
4967
4971
|
if (cached) return cached;
|
|
4968
|
-
const commit = "
|
|
4972
|
+
const commit = "bf6c38c";
|
|
4969
4973
|
cached = {
|
|
4970
4974
|
version: `cli@${version}`,
|
|
4971
4975
|
commit,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencharm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "An open-source body for the AI agent you already run: a face, a voice, one key. Claude Code, Codex, Gemini CLI, Hermes, OpenClaw or any ACP or OpenAI-compatible agent; on a small board, your Mac's notch or the browser.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/sim/charm_sim.wasm
CHANGED
|
Binary file
|