@celljs/ta-channels 4.26.0 → 4.28.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.
Files changed (2) hide show
  1. package/host/index.mjs +146 -1
  2. package/package.json +4 -4
package/host/index.mjs CHANGED
@@ -1927,6 +1927,28 @@ var TA_SIGN_IN_PATH = "/sign-in";
1927
1927
  var TA_DEVICE_SIGN_IN_PATH = `${TA_SIGN_IN_PATH}/device`;
1928
1928
  // ../ta-protocol/esm/common/account-protocol.js
1929
1929
  var TaAccountServer = Symbol("TaAccountServer");
1930
+ // ../ta-protocol/esm/common/agent-tool-util.js
1931
+ var TaAgentToolUtil;
1932
+ (function(TaAgentToolUtil2) {
1933
+ TaAgentToolUtil2.NAME = "agent_tool";
1934
+ const UNSHOWN = new Set(["content", "new_string", "old_string", "edits"]);
1935
+ function shownInput(input) {
1936
+ if (!Object.keys(input).some((key) => UNSHOWN.has(key))) {
1937
+ return input;
1938
+ }
1939
+ return Object.fromEntries(Object.entries(input).filter(([key]) => !UNSHOWN.has(key)));
1940
+ }
1941
+ TaAgentToolUtil2.shownInput = shownInput;
1942
+ function shownDetails(details) {
1943
+ const input = details === null || details === undefined ? undefined : details.input;
1944
+ if (!input || typeof input !== "object") {
1945
+ return details;
1946
+ }
1947
+ const shown = shownInput(input);
1948
+ return shown === input ? details : { ...details, input: shown };
1949
+ }
1950
+ TaAgentToolUtil2.shownDetails = shownDetails;
1951
+ })(TaAgentToolUtil || (TaAgentToolUtil = {}));
1930
1952
  // ../ta-protocol/esm/common/ta-extension-host.js
1931
1953
  var TA_WEBHOOK_MAX_BYTES = 256 * 1024;
1932
1954
  var TA_HOST_EVENT = "ta:host";
@@ -2282,6 +2304,73 @@ var TaAppUtil;
2282
2304
  })(TaAppUtil || (TaAppUtil = {}));
2283
2305
  // ../ta-protocol/esm/common/auth-protocol.js
2284
2306
  var TaAuthServer = Symbol("TaAuthServer");
2307
+ // ../ta-protocol/esm/common/call-scene.js
2308
+ var TaCallSceneUtil;
2309
+ (function(TaCallSceneUtil2) {
2310
+ const VIEWS = {
2311
+ full: "the call fills their screen",
2312
+ mini: "the call is a small floating window while they look at other pages",
2313
+ window: "the call is a window of its own on their computer",
2314
+ panel: "the call is a panel of the page"
2315
+ };
2316
+ function text(scene, sees) {
2317
+ const from = scene.device ? `, from the user's ${scene.device}` : "";
2318
+ if (!scene.video) {
2319
+ return `Voice call${from}: they only hear you.`;
2320
+ }
2321
+ const view = scene.view ? `, ${VIEWS[scene.view]}` : "";
2322
+ const you = "They see you as a lifelike person made by AI, who says your words with face and expressions: they watch you as you talk.";
2323
+ const them = !scene.camera ? "Their camera is off: you cannot see them; never act as if you could." : sees ? "Their camera is on: what they say may come with a picture of them now." : "Their camera is on, but no picture of it reaches you: you cannot see them.";
2324
+ return `Video call${from}${view}. ${you} ${them}`;
2325
+ }
2326
+ TaCallSceneUtil2.text = text;
2327
+ function minutes(scene, now) {
2328
+ return Math.max(0, Math.floor((now - scene.since) / 60000));
2329
+ }
2330
+ TaCallSceneUtil2.minutes = minutes;
2331
+ function length(scene, now) {
2332
+ const minutes2 = TaCallSceneUtil2.minutes(scene, now);
2333
+ return minutes2 < 1 ? "Begun just now" : minutes2 < 60 ? `${minutes2} min so far` : `${Math.floor(minutes2 / 60)} h ${minutes2 % 60} min so far`;
2334
+ }
2335
+ TaCallSceneUtil2.length = length;
2336
+ function next(scene, told, sees, now) {
2337
+ const key2 = TaCallSceneUtil2.key(scene);
2338
+ const minutes2 = TaCallSceneUtil2.minutes(scene, now);
2339
+ if (key2 !== told.key) {
2340
+ const first = told.key === undefined;
2341
+ told.key = key2;
2342
+ told.minutes = minutes2;
2343
+ return `${first ? "The call" : "The call changed"}: ${text(scene, sees)} ${length(scene, now)}.`;
2344
+ }
2345
+ if (minutes2 !== told.minutes) {
2346
+ told.minutes = minutes2;
2347
+ return `The call: ${length(scene, now)}.`;
2348
+ }
2349
+ return;
2350
+ }
2351
+ TaCallSceneUtil2.next = next;
2352
+ function key(scene) {
2353
+ var _a, _b;
2354
+ return [scene.video ? "video" : "voice", scene.camera ? "camera" : "", (_a = scene.view) !== null && _a !== undefined ? _a : "", (_b = scene.device) !== null && _b !== undefined ? _b : ""].join(":");
2355
+ }
2356
+ TaCallSceneUtil2.key = key;
2357
+ function of(value) {
2358
+ const scene = value;
2359
+ if (!scene || typeof scene !== "object" || typeof scene.video !== "boolean" || typeof scene.since !== "number" || !Number.isFinite(scene.since)) {
2360
+ return;
2361
+ }
2362
+ const view = typeof scene.view === "string" && Object.keys(VIEWS).includes(scene.view) ? scene.view : undefined;
2363
+ const device = scene.device === "phone" || scene.device === "tablet" || scene.device === "computer" ? scene.device : undefined;
2364
+ return {
2365
+ video: scene.video,
2366
+ ...scene.camera === true ? { camera: true } : {},
2367
+ ...view ? { view } : {},
2368
+ ...device ? { device } : {},
2369
+ since: scene.since
2370
+ };
2371
+ }
2372
+ TaCallSceneUtil2.of = of;
2373
+ })(TaCallSceneUtil || (TaCallSceneUtil = {}));
2285
2374
  // ../ta-protocol/esm/common/confine-protocol.js
2286
2375
  var TA_CONFINED_MARK = "[ta:confined]";
2287
2376
  var AT = String.raw`(?:^|[;&|(\`]|\$\()\s*(?:sudo\s+|env\s+(?:\S+=\S*\s+)*|npx\s+|bunx\s+|pnpm\s+(?:exec|dlx)\s+|yarn\s+dlx\s+|exec\s+|xargs\s+(?:-\S+\s+)*)*`;
@@ -2529,6 +2618,27 @@ var TaErrorUtil;
2529
2618
  }
2530
2619
  TaErrorUtil2.code = code;
2531
2620
  })(TaErrorUtil || (TaErrorUtil = {}));
2621
+ // ../ta-protocol/esm/common/figure-protocol.js
2622
+ var TaFigure;
2623
+ (function(TaFigure2) {
2624
+ TaFigure2.DEFAULT_LANGUAGE = "ta-plot";
2625
+ function markdown(value) {
2626
+ if (typeof value === "string") {
2627
+ return value.trim() || undefined;
2628
+ }
2629
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
2630
+ return;
2631
+ }
2632
+ const keys = Object.keys(value);
2633
+ const wrapped = keys.length === 1 && /^ta-[a-z0-9-]+$/.test(keys[0]);
2634
+ const language = wrapped ? keys[0] : TaFigure2.DEFAULT_LANGUAGE;
2635
+ const spec = wrapped ? value[language] : value;
2636
+ return spec && typeof spec === "object" && Object.keys(spec).length ? `\`\`\`${language}
2637
+ ${JSON.stringify(spec)}
2638
+ \`\`\`` : undefined;
2639
+ }
2640
+ TaFigure2.markdown = markdown;
2641
+ })(TaFigure || (TaFigure = {}));
2532
2642
  // ../ta-protocol/esm/common/gateway-protocol.js
2533
2643
  var TaGatewayServer = Symbol("TaGatewayServer");
2534
2644
  // ../ta-protocol/esm/common/location.js
@@ -2931,6 +3041,41 @@ var TaRoomWatchUtil;
2931
3041
  }
2932
3042
  TaRoomWatchUtil2.hears = hears;
2933
3043
  })(TaRoomWatchUtil || (TaRoomWatchUtil = {}));
3044
+ // ../ta-protocol/esm/common/saved-session-util.js
3045
+ var TaSavedSessionUtil;
3046
+ (function(TaSavedSessionUtil2) {
3047
+ let next = 0;
3048
+ function changes(given, after, query, list) {
3049
+ const of = JSON.stringify(query !== null && query !== undefined ? query : {});
3050
+ const byFile = new Map(list.map((session) => [session.sessionFile, JSON.stringify(session)]));
3051
+ const known = given && after !== undefined && given.version === after && given.of === of ? given : undefined;
3052
+ if (!known) {
3053
+ const version2 = String(++next);
3054
+ return { changes: { version: version2, whole: true, sessions: [...list] }, given: { version: version2, of, byFile } };
3055
+ }
3056
+ const sessions = list.filter((session) => known.byFile.get(session.sessionFile) !== byFile.get(session.sessionFile));
3057
+ const gone = [...known.byFile.keys()].filter((file) => !byFile.has(file));
3058
+ if (!sessions.length && !gone.length) {
3059
+ return { changes: { version: known.version, sessions: [] }, given: known };
3060
+ }
3061
+ const version = String(++next);
3062
+ return { changes: { version, sessions, ...gone.length ? { gone } : {} }, given: { version, of, byFile } };
3063
+ }
3064
+ TaSavedSessionUtil2.changes = changes;
3065
+ function apply(before, changes2) {
3066
+ var _a;
3067
+ if (changes2.whole) {
3068
+ return changes2.sessions;
3069
+ }
3070
+ const left = new Set([...(_a = changes2.gone) !== null && _a !== undefined ? _a : [], ...changes2.sessions.map((session) => session.sessionFile)]);
3071
+ return [...before.filter((session) => !left.has(session.sessionFile)), ...changes2.sessions].sort(newestFirst);
3072
+ }
3073
+ TaSavedSessionUtil2.apply = apply;
3074
+ function newestFirst(a, b) {
3075
+ return b.updatedAt - a.updatedAt || (a.sessionFile < b.sessionFile ? -1 : a.sessionFile > b.sessionFile ? 1 : 0);
3076
+ }
3077
+ TaSavedSessionUtil2.newestFirst = newestFirst;
3078
+ })(TaSavedSessionUtil || (TaSavedSessionUtil = {}));
2934
3079
  // ../ta-protocol/esm/common/screen-share-protocol.js
2935
3080
  var TaScreenShareServer = Symbol("TaScreenShareServer");
2936
3081
  var TaDesktopUtil;
@@ -3099,7 +3244,7 @@ var TaUsageServer = Symbol("TaUsageServer");
3099
3244
  var TaVoiceServer = Symbol("TaVoiceServer");
3100
3245
  var TaBargeIn;
3101
3246
  (function(TaBargeIn2) {
3102
- TaBargeIn2.DEFAULTS = { duck: 0.2, speechMs: 500, level: 0.02, words: 2, waitMs: 1500, echo: 0.3, joinMs: 300, tap: false };
3247
+ TaBargeIn2.DEFAULTS = { duck: 0.35, speechMs: 500, level: 0.02, words: 2, waitMs: 1500, echo: 0.3, joinMs: 300, tap: false };
3103
3248
  TaBargeIn2.SENSITIVITY = [
3104
3249
  { speechMs: 1000, level: 0.05 },
3105
3250
  { speechMs: 750, level: 0.035 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-channels",
3
- "version": "4.26.0",
3
+ "version": "4.28.0",
4
4
  "description": "A pi package for Ta: agents with roles of their own and channels where the user, Ta and the agents talk; Ta builds the team for what the user wants",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.26.0",
31
- "@celljs/ta-relay": "4.26.0",
32
- "@celljs/ta-web": "4.26.0",
30
+ "@celljs/ta-protocol": "4.28.0",
31
+ "@celljs/ta-relay": "4.28.0",
32
+ "@celljs/ta-web": "4.28.0",
33
33
  "@types/react": "^19.3.0"
34
34
  },
35
35
  "publishConfig": {