dsh-xinghe-view 1.0.0 → 1.0.1
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/client.js +6 -3
- package/index.js +36 -18
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -345,7 +345,7 @@ const rnd01 = (i) => {
|
|
|
345
345
|
g.z = globeR * sr * Math.sin(theta);
|
|
346
346
|
});
|
|
347
347
|
|
|
348
|
-
/* 球壳网格:6 条纬线 + 6
|
|
348
|
+
/* 球壳网格:6 条纬线 + 12 条经线半圈(合起来是 6 条完整大圆),每帧投影成 path。
|
|
349
349
|
每条线拆成远/近两条:背面的线淡、正面的线亮,球体前后才分得开。 */
|
|
350
350
|
const rings = [];
|
|
351
351
|
for (const lat of [-66, -40, -14, 14, 40, 66]) {
|
|
@@ -359,7 +359,7 @@ const rnd01 = (i) => {
|
|
|
359
359
|
}
|
|
360
360
|
rings.push(pts);
|
|
361
361
|
}
|
|
362
|
-
for (let k = 0; k <
|
|
362
|
+
for (let k = 0; k < 12; k += 1) {
|
|
363
363
|
const lo = (k * 30 * Math.PI) / 180;
|
|
364
364
|
const pts = [];
|
|
365
365
|
for (let i = 0; i < 60; i += 1) {
|
|
@@ -388,6 +388,9 @@ const rnd01 = (i) => {
|
|
|
388
388
|
z: globeR * sr2 * Math.sin(theta),
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
+
/* 南北极:12 条经线都从这里出发,不点个记号,线看着就像散的。 */
|
|
392
|
+
dots.push({ x: 0, y: globeR, z: 0, big: true });
|
|
393
|
+
dots.push({ x: 0, y: -globeR, z: 0, big: true });
|
|
391
394
|
const globe = { R: globeR, rings, dots };
|
|
392
395
|
|
|
393
396
|
const byId = new Map();
|
|
@@ -1103,7 +1106,7 @@ const rnd01 = (i) => {
|
|
|
1103
1106
|
for (let i = 0; i < globe.dots.length; i += 1) {
|
|
1104
1107
|
const q = globe.dots[i];
|
|
1105
1108
|
const pp = projectMat(qm, q.x, q.y, q.z, cv, cv.k, b0.w, b0.h);
|
|
1106
|
-
const rr = (0.85 + pp.s * 0.55).toFixed(2);
|
|
1109
|
+
const rr = (q.big ? 3.4 * pp.s : 0.85 + pp.s * 0.55).toFixed(2);
|
|
1107
1110
|
const stamp =
|
|
1108
1111
|
'M' + (pp.x - rr).toFixed(1) + ' ' + pp.y.toFixed(1) +
|
|
1109
1112
|
'a' + rr + ' ' + rr + ' 0 1 0 ' + (2 * rr).toFixed(2) + ' 0' +
|
package/index.js
CHANGED
|
@@ -268,13 +268,22 @@ export function apply(ctx) {
|
|
|
268
268
|
const target = ctx.sessions.get(id)
|
|
269
269
|
if (!target) continue
|
|
270
270
|
try {
|
|
271
|
+
/* 旁注,不是指令:developer 角色进上下文但不触发执行。
|
|
272
|
+
早先写成 user/message,等于把这条指令在对端又下了一遍。 */
|
|
271
273
|
target.append(
|
|
272
|
-
'
|
|
274
|
+
'developer/message',
|
|
273
275
|
{
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
message: {
|
|
277
|
+
id: `xinghe-${session.id}-${event.seq}`,
|
|
278
|
+
role: 'developer',
|
|
279
|
+
content: [
|
|
280
|
+
{
|
|
281
|
+
type: 'text',
|
|
282
|
+
text: `${TAG} 来自会话 ${label}(旁注,不是给你的任务):\n${text}`,
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
source: { kind: 'xinghe-link', sessionId: session.id },
|
|
286
|
+
},
|
|
278
287
|
},
|
|
279
288
|
{ surfaceOp: 'append' },
|
|
280
289
|
)
|
|
@@ -301,21 +310,30 @@ export function apply(ctx) {
|
|
|
301
310
|
turnSeen.add(stamp)
|
|
302
311
|
if (turnSeen.size > MAX_SEEN) turnSeen.clear()
|
|
303
312
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
313
|
+
/* 同样只写旁注,不塞进本轮 messages:pre-step 的 messages 类型只能是
|
|
314
|
+
UserMessage,塞进去就等于把邻居的动态当成用户指令执行一轮。 */
|
|
315
|
+
try {
|
|
316
|
+
const self = ctx.sessions.get(id)
|
|
317
|
+
self?.append(
|
|
318
|
+
'developer/message',
|
|
308
319
|
{
|
|
309
|
-
|
|
310
|
-
|
|
320
|
+
message: {
|
|
321
|
+
id: `xinghe-turn-${id}-${payload.turn}`,
|
|
322
|
+
role: 'developer',
|
|
323
|
+
content: [
|
|
324
|
+
{
|
|
325
|
+
type: 'text',
|
|
326
|
+
text: `${TAG} 与你链接的会话最近动态(旁注,仅供了解):\n${digest}`,
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
source: { kind: 'xinghe-link', sessionId: id },
|
|
330
|
+
},
|
|
311
331
|
},
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
kind: 'enter',
|
|
317
|
-
messages: [...decision.messages, injected],
|
|
318
|
-
...(decision.startsRequestSeries ? { startsRequestSeries: true } : {}),
|
|
332
|
+
{ surfaceOp: 'append' },
|
|
333
|
+
)
|
|
334
|
+
} catch (error) {
|
|
335
|
+
ctx.logger?.warn?.(`[xinghe-view] 每轮旁注写入失败: ${String(error)}`)
|
|
319
336
|
}
|
|
337
|
+
return decision
|
|
320
338
|
})
|
|
321
339
|
}
|
package/package.json
CHANGED