@shgroup/dsh-serenity-hooks 1.138.2 → 1.139.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/dsh.plugin.json +1 -1
- package/lib/browser/domain-skill.d.ts +56 -0
- package/lib/index.js +212 -113
- package/package.json +1 -1
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-serenity-hooks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.139.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"description": "宁静号 ACC harness(Native Cordis 插件):给 DSH 装一个「AI 工作区」——13 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin/browser_slot;另两个 im-bridge/diagram 按条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表 + 浏览器槽位管理(≤20 个独立 profile 的 Chrome 槽位,带占用归属与异常时向所属会话反向注入提醒)。轨迹声明 = 轨迹目录下的 trajectory.json(约束面 + 旧标识 uid + CRO 机器绑定 cro.host;旧名 trajectory-constraint.json / skiff.json 仍在读取族里);轨迹提示词 = 轨迹目录下的 PROMPT.md(一条轨迹「是谁、按什么章程工作」,所有轨迹通用,追加在容器层与质量层之后,不替换它们)。适配 DSH 0.1.7-rc.1 / 0.2.0-rc.1 / 0.2.1-rc.1(三档,deepseek-ai/deepseek-harness)。",
|
|
6
6
|
"engines": {
|
|
@@ -36,6 +36,42 @@ export declare function domainDir(cccRoot: string, urlOrHost: string): string |
|
|
|
36
36
|
export declare function domainSkillPath(cccRoot: string, urlOrHost: string): string | null;
|
|
37
37
|
/** 该域名是否已有说明书(**永远现算**,⛔ 不缓存进台账 —— 设计 §5.3) */
|
|
38
38
|
export declare function hasDomainSkill(cccRoot: string, urlOrHost: string): boolean;
|
|
39
|
+
/** 单个片段的体量上限(设计 §改动 3:⛔ 防止有人把整个库塞进来,那等于绕过 skill 体系) */
|
|
40
|
+
export declare const SNIPPET_MAX_BYTES: number;
|
|
41
|
+
/** 片段目录名(站点目录下) */
|
|
42
|
+
export declare const SNIPPET_DIR = "snippets";
|
|
43
|
+
export interface DomainSnippet {
|
|
44
|
+
/** 文件名(含扩展名) */
|
|
45
|
+
name: string;
|
|
46
|
+
/** 绝对路径 */
|
|
47
|
+
path: string;
|
|
48
|
+
/** 字节数 */
|
|
49
|
+
bytes: number;
|
|
50
|
+
}
|
|
51
|
+
/** 片段目录(站点目录下) */
|
|
52
|
+
export declare function snippetDir(cccRoot: string, urlOrHost: string): string | null;
|
|
53
|
+
/**
|
|
54
|
+
* 列出该站可用的片段(**只读目录,不读内容**)。
|
|
55
|
+
*
|
|
56
|
+
* ## 只收 `.js`(owner 2026-11-24 裁「就是供 eval 用的 js 片段」)
|
|
57
|
+
*
|
|
58
|
+
* 🔴 **其它后缀一律不列** —— 不是说"跳过",是**结构性不认**:
|
|
59
|
+
* 设计稿那条裁决把"操作序列文档"整类删掉了 ⇒ 若这里放行 `.md`/`.txt`,
|
|
60
|
+
* 那类东西会借片段目录复活。
|
|
61
|
+
*
|
|
62
|
+
* ## 超限的不列,并**单独报出来**
|
|
63
|
+
*
|
|
64
|
+
* 一个 200 KB 的片段不该静默消失 —— 那与"我忘了写"在读数上同形。
|
|
65
|
+
* ⇒ 返回 `oversize` 列表,由调用方在回执里点名(⛔ 静默丢)。
|
|
66
|
+
*
|
|
67
|
+
* ⚠️ 排序:按文件名,稳定(⛔ 按 mtime —— 那会让回执在两次调用间变化而无语义)。
|
|
68
|
+
*/
|
|
69
|
+
export declare function listSnippets(cccRoot: string, urlOrHost: string): {
|
|
70
|
+
items: DomainSnippet[];
|
|
71
|
+
oversize: DomainSnippet[];
|
|
72
|
+
};
|
|
73
|
+
/** 读一个片段(供参考;**⛔ 本模块不执行它** —— 执行永远走既有的 `eval` 动作) */
|
|
74
|
+
export declare function loadSnippet(cccRoot: string, urlOrHost: string, name: string): string | null;
|
|
39
75
|
export interface DomainSkillHit {
|
|
40
76
|
/** 要追加到回执里的整段文本(含抬头与可能的截断记号) */
|
|
41
77
|
text: string;
|
|
@@ -49,6 +85,26 @@ export interface DomainSkillHit {
|
|
|
49
85
|
* 读失败(权限、半写状态)也返回 `null` —— 打开页面的主流程**不因说明书而失败**。
|
|
50
86
|
*/
|
|
51
87
|
export declare function loadDomainSkill(cccRoot: string, urlOrHost: string): DomainSkillHit | null;
|
|
88
|
+
/**
|
|
89
|
+
* 片段的注入尾巴(设计 §改动 3)—— **只列清单,⛔ 不注入内容、⛔ 不执行**。
|
|
90
|
+
*
|
|
91
|
+
* ## 为什么只给清单而不给内容
|
|
92
|
+
*
|
|
93
|
+
* owner 裁决原话:「就是供 eval 用的 js 片段」。片段的价值是**可复用的认知**
|
|
94
|
+
* (下次不用重新摸索选择器),而它的用法是:模型读了说明书 → 看到这里有几支片段 →
|
|
95
|
+
* **自己决定**要不要 `eval` 其中一支。
|
|
96
|
+
*
|
|
97
|
+
* 🔴 若把内容也注进去,回执体量会失控(一支片段可达 16 KB),
|
|
98
|
+
* 而且**等于替它做了"要不要用"的决定** —— 那不该由注入层替它做。
|
|
99
|
+
*
|
|
100
|
+
* ## 为什么超限的要单独点名
|
|
101
|
+
*
|
|
102
|
+
* 一支 200 KB 的片段若静默消失,与「我忘了写」在读数上同形。
|
|
103
|
+
* ⇒ 明确告诉它"有这么个文件,但它太大没被采用",并给路径。
|
|
104
|
+
*
|
|
105
|
+
* @returns 追加文本;无片段 ⇒ **空串**(未命中零噪声,与说明书同一口径)
|
|
106
|
+
*/
|
|
107
|
+
export declare function snippetTail(cccRoot: string, urlOrHost: string): string;
|
|
52
108
|
export interface DomainVisit {
|
|
53
109
|
/** 累计打开次数 */
|
|
54
110
|
opens: number;
|
package/lib/index.js
CHANGED
|
@@ -6594,15 +6594,15 @@ function createCognitiveTrajectoryTool(ctx) {
|
|
|
6594
6594
|
});
|
|
6595
6595
|
return [
|
|
6596
6596
|
message,
|
|
6597
|
-
`✓
|
|
6598
|
-
`
|
|
6597
|
+
`✓ Auto-activated (it had **no binding** before): ${active.dir} — subsequent work writes back to that trajectory's SESSION.md.`,
|
|
6598
|
+
` (Rule: no binding before create ⇒ activate; with a binding we only create, never take over — see below.)`
|
|
6599
6599
|
].join("\n");
|
|
6600
6600
|
}
|
|
6601
6601
|
return [
|
|
6602
6602
|
message,
|
|
6603
|
-
`⚠
|
|
6604
|
-
`
|
|
6605
|
-
`
|
|
6603
|
+
`⚠ This trajectory was NOT activated — currently bound to ${priorBound}; the existing binding wins (we do not take over the one you are using).`,
|
|
6604
|
+
` To activate it (and open a session under its name): use cognitive_trajectory send-now to send a message to ${result.dirName} —`,
|
|
6605
|
+
` if the target has no live dsh session, one is created and bound, with the usage prompt and your message injected together.`
|
|
6606
6606
|
].join("\n");
|
|
6607
6607
|
}
|
|
6608
6608
|
case "use": {
|
|
@@ -6740,7 +6740,7 @@ function createCognitiveTrajectoryTool(ctx) {
|
|
|
6740
6740
|
code: parseTrajectoryCode(entry.dirName),
|
|
6741
6741
|
uid: cur,
|
|
6742
6742
|
retired: true,
|
|
6743
|
-
note: cur === null ?
|
|
6743
|
+
note: cur === null ? `No legacy UID set ⇒ identify it by code (${parseTrajectoryCode(entry.dirName) ?? "no code"}).UID writing is retired; for a handle you can name, start a new trajectory with create --id.` : `Legacy UID = ${cur} (file ${UID_FILENAME}, read-only compat) — still usable to name this trajectory.⚠️ Writing it is retired: give new trajectories a code via create --id.`
|
|
6744
6744
|
};
|
|
6745
6745
|
}
|
|
6746
6746
|
case "send-later": {
|
|
@@ -18236,10 +18236,10 @@ function deriveSlotState(lease, proc, now, policy = DEFAULT_POLICY) {
|
|
|
18236
18236
|
reasons: ["进程已退出"]
|
|
18237
18237
|
};
|
|
18238
18238
|
const idle = now - lease.lastActionAt;
|
|
18239
|
-
if (!(lease.holdUntil > now) && idle > policy.idleMs) reasons.push(
|
|
18240
|
-
if (now - lease.leasedAt > policy.leaseMaxMs) reasons.push(
|
|
18241
|
-
if (proc && proc.cpuPct >= policy.cpuPct) reasons.push(`CPU ${proc.cpuPct.toFixed(0)}%
|
|
18242
|
-
if (proc && proc.rssMb >= policy.rssMb) reasons.push(
|
|
18239
|
+
if (!(lease.holdUntil > now) && idle > policy.idleMs) reasons.push(`idle ${Math.round(idle / 6e4)}m`);
|
|
18240
|
+
if (now - lease.leasedAt > policy.leaseMaxMs) reasons.push(`held over ${Math.round(policy.leaseMaxMs / 6e4)}m cap`);
|
|
18241
|
+
if (proc && proc.cpuPct >= policy.cpuPct) reasons.push(`CPU ${proc.cpuPct.toFixed(0)}% over threshold`);
|
|
18242
|
+
if (proc && proc.rssMb >= policy.rssMb) reasons.push(`rss ${proc.rssMb.toFixed(0)}MB over threshold`);
|
|
18243
18243
|
return reasons.length > 0 ? {
|
|
18244
18244
|
state: "stale",
|
|
18245
18245
|
reasons
|
|
@@ -18271,10 +18271,10 @@ function shouldNudge(lease, state, now, policy) {
|
|
|
18271
18271
|
* 而它真正该做的是 `release`。⇒ 每条文本都把**具体动作**写明。
|
|
18272
18272
|
*/
|
|
18273
18273
|
function nudgeText(slot, state, reasons, policy) {
|
|
18274
|
-
const head = `[
|
|
18275
|
-
const rel = `
|
|
18276
|
-
if (state === "orphaned") return `${head}\n
|
|
18277
|
-
return `${head}\n
|
|
18274
|
+
const head = `[slot-watchman] slot ${slotLabel(slot)} (port ${slotPort(slot)}) needs your action.`;
|
|
18275
|
+
const rel = ` You hold it — **release as soon as you are done**: \`browser_slot release ${slotLabel(slot)}\``;
|
|
18276
|
+
if (state === "orphaned") return `${head}\n What: the Chrome process for this slot is gone.\n ⚠️ If you still need it, further calls will fail — it will NOT recover by itself.\n ⇒ Do this: \`browser_slot release ${slotLabel(slot)}\` to hand it back, then \`acquire\` a fresh slot.\n${rel}`;
|
|
18277
|
+
return `${head}\n What: ${reasons.length > 0 ? reasons.join("; ") : "abnormal state"}\n${` Thresholds (which line you crossed): idle ${Math.round(policy.idleMs / 6e4)}m / CPU ${policy.cpuPct}% / rss ${policy.rssMb}MB / held cap ${Math.round(policy.leaseMaxMs / 6e4)}m.`}\n Why you: **you** leased this slot; only you know whether it is still needed.\n ⇒ Still using it: perform any action below the idle threshold, or release and re-acquire (resets the timer).\n ⇒ Done with it: if you no longer need it, just release — that is the cheapest step.\n${rel}`;
|
|
18278
18278
|
}
|
|
18279
18279
|
/**
|
|
18280
18280
|
* 🔴 **强关判定(纯函数,owner 2026-11-24 令)**。
|
|
@@ -18318,7 +18318,7 @@ function shouldForceReap(lease, proc, now, policy = DEFAULT_POLICY) {
|
|
|
18318
18318
|
* ⛔ 不写"你的槽位异常了" —— 那是无法行动的话。
|
|
18319
18319
|
*/
|
|
18320
18320
|
function forceReapText(slot, idleMin, nudges, policy = DEFAULT_POLICY) {
|
|
18321
|
-
return `[
|
|
18321
|
+
return `[slot-watchman] slot ${slotLabel(slot)} was **force-reclaimed** (idle ${idleMin}m, nudged ${nudges}x before).\n · Your browser is closed. **The profile dir is kept** ⇒ login sessions survive; re-acquire without re-login.\n · If this was a false kill (long download, slow query), hold it next time:\n \`browser_slot hold --slot ${slotLabel(slot)} --reason "<what you are doing>" --holdFor <minutes>\`\n · To continue: just \`acquire\` again.\n Why me: the idle threshold is ${Math.round(policy.idleKillMs / 6e4)}m — a browser actually doing work does not go silent that long.`;
|
|
18322
18322
|
}
|
|
18323
18323
|
/**
|
|
18324
18324
|
* 选一个空槽。⛔ 不做"最久未用优先"这类聪明事 —— 20 个槽位装得下,选择规则越简单越可预测。
|
|
@@ -21626,7 +21626,7 @@ async function acquireSlot(input) {
|
|
|
21626
21626
|
slot: existing.slot,
|
|
21627
21627
|
state: "leased",
|
|
21628
21628
|
reused: true,
|
|
21629
|
-
detail:
|
|
21629
|
+
detail: `You already hold slot ${slotLabel(existing.slot)} (port ${slotPort(existing.slot)}); reusing it.\n ⛔ Do not lease a second one — two slots per session is exactly the shape of the incident (leased and forgotten).\n` + launched.detail
|
|
21630
21630
|
};
|
|
21631
21631
|
}
|
|
21632
21632
|
const picked = withLedger((lg) => {
|
|
@@ -21662,14 +21662,14 @@ async function acquireSlot(input) {
|
|
|
21662
21662
|
slot: 0,
|
|
21663
21663
|
state: "free",
|
|
21664
21664
|
reused: false,
|
|
21665
|
-
detail: "20
|
|
21665
|
+
detail: "All 20 slots are taken, ⛔ refusing to lease another.\n ⇒ See who holds them: `browser_slot list`; hand one back with `release <slot>`.\n ⚠️ A full house is usually not \"high demand\" but **someone forgot to release** — look at the largest idleMin row."
|
|
21666
21666
|
};
|
|
21667
21667
|
if (picked < 0) return {
|
|
21668
21668
|
ok: false,
|
|
21669
21669
|
slot: -picked,
|
|
21670
21670
|
state: "leased",
|
|
21671
21671
|
reused: false,
|
|
21672
|
-
detail:
|
|
21672
|
+
detail: `Slot ${slotLabel(-picked)} is taken (⛔ not preempting). Use \`browser_slot list\` to see the owner, or omit --slot to let the system pick.`
|
|
21673
21673
|
};
|
|
21674
21674
|
const n = picked;
|
|
21675
21675
|
const launched = ensureRunning(input.root, n, 0);
|
|
@@ -21681,7 +21681,6 @@ async function acquireSlot(input) {
|
|
|
21681
21681
|
result: null
|
|
21682
21682
|
};
|
|
21683
21683
|
});
|
|
21684
|
-
const r = SLOT_RESOLUTION(n);
|
|
21685
21684
|
if (!launched.ok) {
|
|
21686
21685
|
withLedger((lg) => {
|
|
21687
21686
|
delete lg.leases[String(n)];
|
|
@@ -21705,7 +21704,7 @@ async function acquireSlot(input) {
|
|
|
21705
21704
|
slot: n,
|
|
21706
21705
|
state: "leased",
|
|
21707
21706
|
reused: false,
|
|
21708
|
-
detail:
|
|
21707
|
+
detail: `${launched.detail}\n🔴 **You must hand it back**: \`browser_slot release ${slotLabel(n)}\`\n If you forget, the watchman will nudge you once it sits idle — by then you may have moved on.`
|
|
21709
21708
|
};
|
|
21710
21709
|
}
|
|
21711
21710
|
/** 启动退避:连续失败按指数推迟(G9)。返回 0 = 可以尝试,>0 = 还需等待的毫秒 */
|
|
@@ -21748,18 +21747,18 @@ function ensureRunning(root, n, pidHint) {
|
|
|
21748
21747
|
if (live.length > 0) return {
|
|
21749
21748
|
ok: true,
|
|
21750
21749
|
pid: live[0],
|
|
21751
|
-
detail:
|
|
21750
|
+
detail: `Slot ${slotLabel(n)} already running (pid ${live[0]})`
|
|
21752
21751
|
};
|
|
21753
21752
|
if (pidHint > 0 && existsSync(`/proc/${pidHint}`)) return {
|
|
21754
21753
|
ok: true,
|
|
21755
21754
|
pid: pidHint,
|
|
21756
|
-
detail:
|
|
21755
|
+
detail: `Slot ${slotLabel(n)} already running (pid ${pidHint})`
|
|
21757
21756
|
};
|
|
21758
21757
|
const wait = backoffWaitMs(root, n, Date.now());
|
|
21759
21758
|
if (wait > 0) return {
|
|
21760
21759
|
ok: false,
|
|
21761
21760
|
pid: 0,
|
|
21762
|
-
detail:
|
|
21761
|
+
detail: `Slot ${slotLabel(n)} is in **launch backoff** (${Math.ceil(wait / 1e3)}s left).\n 🔴 Cause: this slot failed to start repeatedly. ⇒ Retrying pays a full re-check again (seconds) and **is indistinguishable in the readings**.\n ⇒ Find the root cause first: \`browser_slot doctor\` for pidDrift and log paths; or use another slot.`
|
|
21763
21762
|
};
|
|
21764
21763
|
const launched = launchSlot(n);
|
|
21765
21764
|
if (!launched.ok) {
|
|
@@ -21767,7 +21766,7 @@ function ensureRunning(root, n, pidHint) {
|
|
|
21767
21766
|
return {
|
|
21768
21767
|
ok: false,
|
|
21769
21768
|
pid: 0,
|
|
21770
|
-
detail: `${launched.detail}\n ⇒
|
|
21769
|
+
detail: `${launched.detail}\n ⇒ One launch failure recorded; next attempt allowed in ${Math.ceil(w / 1e3)}s.`
|
|
21771
21770
|
};
|
|
21772
21771
|
}
|
|
21773
21772
|
clearLaunchFailure(root, n);
|
|
@@ -21810,12 +21809,12 @@ function releaseSlot(root, sessionId, target) {
|
|
|
21810
21809
|
const lease = readLedger().leases[String(target)];
|
|
21811
21810
|
if (!lease) return {
|
|
21812
21811
|
ok: true,
|
|
21813
|
-
detail:
|
|
21812
|
+
detail: `Slot ${slotLabel(target)} was already free (nothing to release).`,
|
|
21814
21813
|
released: false
|
|
21815
21814
|
};
|
|
21816
21815
|
if (sessionId && lease.sessionId && lease.sessionId !== sessionId) return {
|
|
21817
21816
|
ok: false,
|
|
21818
|
-
detail:
|
|
21817
|
+
detail: `Slot ${slotLabel(target)} is not yours (owner: ${lease.trajectory || lease.sessionId || "unknown"}).\n ⛔ Not releasing on someone else's behalf — they may be using it. If you are sure it is abandoned, use \`browser_slot reap <slot>\` (watchman action, records a reason).`,
|
|
21819
21818
|
released: false
|
|
21820
21819
|
};
|
|
21821
21820
|
const destroyed = destroySlot(target, lease.pid);
|
|
@@ -21830,7 +21829,7 @@ function releaseSlot(root, sessionId, target) {
|
|
|
21830
21829
|
sampleCache.delete(target);
|
|
21831
21830
|
return {
|
|
21832
21831
|
ok: true,
|
|
21833
|
-
detail:
|
|
21832
|
+
detail: `Released slot ${slotLabel(target)}. ${destroyed.detail}`,
|
|
21834
21833
|
released: true
|
|
21835
21834
|
};
|
|
21836
21835
|
}
|
|
@@ -21884,7 +21883,7 @@ function reapSlot(root, target, reason) {
|
|
|
21884
21883
|
sampleCache.delete(target);
|
|
21885
21884
|
return {
|
|
21886
21885
|
ok: true,
|
|
21887
|
-
detail:
|
|
21886
|
+
detail: `Reclaimed slot ${slotLabel(target)} (reason: ${reason}). ${destroyed.detail}`
|
|
21888
21887
|
};
|
|
21889
21888
|
}
|
|
21890
21889
|
/**
|
|
@@ -21914,7 +21913,7 @@ async function forceReapIdleSlots(root, inject, policy = policyFromEnv()) {
|
|
|
21914
21913
|
scanned += 1;
|
|
21915
21914
|
const verdict = shouldForceReap(lease, readProcFor(root, lease.slot, now, lease.pid), now, policy);
|
|
21916
21915
|
if (!verdict) continue;
|
|
21917
|
-
const res = reapSlot(root, lease.slot,
|
|
21916
|
+
const res = reapSlot(root, lease.slot, `idle ${verdict.idleMin}m (nudged ${verdict.nudges}x)`);
|
|
21918
21917
|
recordRecentKill(lease.slot, lease.trajectory, verdict.idleMin, verdict.nudges, res.ok);
|
|
21919
21918
|
const target = lease.trajectory || lease.sessionId;
|
|
21920
21919
|
let delivered = false;
|
|
@@ -21928,7 +21927,7 @@ async function forceReapIdleSlots(root, inject, policy = policyFromEnv()) {
|
|
|
21928
21927
|
} catch (err) {
|
|
21929
21928
|
deliverDetail = String(err?.message ?? err);
|
|
21930
21929
|
}
|
|
21931
|
-
} else deliverDetail = "
|
|
21930
|
+
} else deliverDetail = "This slot has no owning trajectory (sessionId and trajectory both empty) ⇒ cannot notify; the kill is still recorded in the ledger";
|
|
21932
21931
|
out.push({
|
|
21933
21932
|
slot: lease.slot,
|
|
21934
21933
|
trajectory: lease.trajectory,
|
|
@@ -21962,20 +21961,20 @@ async function forceReapIdleSlots(root, inject, policy = policyFromEnv()) {
|
|
|
21962
21961
|
function holdSlot(root, sessionId, target, minutes, reason) {
|
|
21963
21962
|
if (!Number.isFinite(minutes) || minutes <= 0) return {
|
|
21964
21963
|
ok: false,
|
|
21965
|
-
detail: `hold
|
|
21964
|
+
detail: `hold needs a positive number of minutes (got ${minutes})`
|
|
21966
21965
|
};
|
|
21967
21966
|
if (minutes > 240) return {
|
|
21968
21967
|
ok: false,
|
|
21969
|
-
detail: `hold
|
|
21968
|
+
detail: `hold is capped at 240 minutes per call (got ${minutes}).\n ⛔ Never a permanent exemption — that would defeat idle reclaim. Renew before it expires if you need longer.`
|
|
21970
21969
|
};
|
|
21971
21970
|
const lease = readLedger().leases[String(target)];
|
|
21972
21971
|
if (!lease) return {
|
|
21973
21972
|
ok: false,
|
|
21974
|
-
detail:
|
|
21973
|
+
detail: `Slot ${slotLabel(target)} is not leased (nothing to hold).`
|
|
21975
21974
|
};
|
|
21976
21975
|
if (sessionId && lease.sessionId && lease.sessionId !== sessionId) return {
|
|
21977
21976
|
ok: false,
|
|
21978
|
-
detail:
|
|
21977
|
+
detail: `Slot ${slotLabel(target)} is not yours; ⛔ cannot hold on someone else's behalf.`
|
|
21979
21978
|
};
|
|
21980
21979
|
const until = Date.now() + minutes * 6e4;
|
|
21981
21980
|
withLedger((lg) => {
|
|
@@ -21988,7 +21987,7 @@ function holdSlot(root, sessionId, target, minutes, reason) {
|
|
|
21988
21987
|
});
|
|
21989
21988
|
return {
|
|
21990
21989
|
ok: true,
|
|
21991
|
-
detail:
|
|
21990
|
+
detail: `Held slot ${slotLabel(target)} until ${new Date(until).toLocaleTimeString("en-GB")} (${minutes} min).\n · Idle is NOT judged while held, but process liveness / CPU / rss still are.\n · Reason: ${reason || "(none given)"}\n · If still idle when it expires, the normal nudge→force-reclaim flow resumes.`
|
|
21992
21991
|
};
|
|
21993
21992
|
}
|
|
21994
21993
|
/**
|
|
@@ -22035,7 +22034,7 @@ async function nudgeStaleSlots(root, inject, policy = policyFromEnv()) {
|
|
|
22035
22034
|
state,
|
|
22036
22035
|
trajectory: "",
|
|
22037
22036
|
delivered: false,
|
|
22038
|
-
detail: "
|
|
22037
|
+
detail: "This slot has no owning trajectory (sessionId and trajectory both empty) ⇒ cannot inject; needs manual handling"
|
|
22039
22038
|
});
|
|
22040
22039
|
continue;
|
|
22041
22040
|
}
|
|
@@ -22122,8 +22121,8 @@ function doctorSlots(root, policy = policyFromEnv()) {
|
|
|
22122
22121
|
*/
|
|
22123
22122
|
function assertSlotOwned(root, slot, sessionId) {
|
|
22124
22123
|
const lease = readLedger().leases[String(slot)];
|
|
22125
|
-
if (!lease) throw new Error(
|
|
22126
|
-
if (sessionId === "" || lease.sessionId !== sessionId) throw new Error(
|
|
22124
|
+
if (!lease) throw new Error(`Slot ${slotLabel(slot)} is not leased right now ⇒ \`browser_slot acquire\` one first.\n ⛔ Not auto-leasing for you: lease-and-forget is exactly the shape of the 2026-11-09 36-hour power incident.`);
|
|
22125
|
+
if (sessionId === "" || lease.sessionId !== sessionId) throw new Error(`Slot ${slotLabel(slot)} is not yours (owner ${lease.sessionId || "(none)"}) ⇒ refusing the operation.\n ⇒ Find your own with \`browser_slot list\`; to open a new one use \`browser_slot acquire\`.\n ⚠️ A hard refusal is deliberate: allowing it would make "who drives whose browser" unanswerable.`);
|
|
22127
22126
|
}
|
|
22128
22127
|
/** 把页面上一次成功的操作推进 lastActionAt(这就是"长期不动作"判据的来源) */
|
|
22129
22128
|
function pageTouched(root, slot) {
|
|
@@ -22142,14 +22141,14 @@ function pageTouched(root, slot) {
|
|
|
22142
22141
|
* @returns 解析好的 targetId(**唯一**),或抛出可读错误(0 命中 / 多命中都把候选列全)
|
|
22143
22142
|
*/
|
|
22144
22143
|
async function resolveTarget(root, slot, sessionId, opts) {
|
|
22145
|
-
if (!opts.target && !opts.match) throw new Error("⛔
|
|
22144
|
+
if (!opts.target && !opts.match) throw new Error("⛔ needs --target=<targetId> or --match=<URL or title substring>.\n ⇒ Run `browser_slot targets --slot b1` to see what is there, or just pass --match=example.com");
|
|
22146
22145
|
if (opts.target) return opts.target;
|
|
22147
22146
|
const list = await slotTargets(root, slot, sessionId);
|
|
22148
22147
|
const res = pickTarget(list, { match: opts.match });
|
|
22149
22148
|
if (res.ok) return res.target.id;
|
|
22150
22149
|
const pages = list.filter((t) => t.type === "page");
|
|
22151
|
-
if (res.reason === "not-found") throw new Error(`⛔
|
|
22152
|
-
throw new Error(`⛔
|
|
22150
|
+
if (res.reason === "not-found") throw new Error(`⛔ No page matches "${opts.match}" (matches url or title, case-insensitive).\n ⇒ ${pages.length} page(s) currently:\n${renderHits(pages)}`);
|
|
22151
|
+
throw new Error(`⛔ "${opts.match}" matched ${res.hits.length} pages — refusing to pick one for you (a wrong pick yields an image that looks right but belongs to someone else).\n ⇒ Use a longer substring, or name one with --target=<id>:\n${renderHits(res.hits)}`);
|
|
22153
22152
|
}
|
|
22154
22153
|
/**
|
|
22155
22154
|
* 语义化点击:`--text` 子串或 `--xy` 坐标。
|
|
@@ -22162,11 +22161,11 @@ async function resolveTarget(root, slot, sessionId, opts) {
|
|
|
22162
22161
|
*/
|
|
22163
22162
|
async function slotClick(root, slot, sessionId, targetId, opts) {
|
|
22164
22163
|
assertSlotOwned(root, slot, sessionId);
|
|
22165
|
-
if (!opts.text && !opts.xy) throw new Error("⛔
|
|
22164
|
+
if (!opts.text && !opts.xy) throw new Error("⛔ needs --text=<visible label> or coordinates (run targets first for a targetId)");
|
|
22166
22165
|
if (opts.xy) {
|
|
22167
22166
|
const hit = judgeHit(await hitTestAt(slot, targetId, opts.xy.x, opts.xy.y), opts.ref !== void 0 ? { backendNodeId: opts.ref } : void 0);
|
|
22168
|
-
if (hit.kind === "offscreen" || hit.kind === "blank") throw new Error(`⛔
|
|
22169
|
-
if (hit.kind === "blocked") throw new Error(`⛔
|
|
22167
|
+
if (hit.kind === "offscreen" || hit.kind === "blank") throw new Error(`⛔ Not clicking: ${renderHit(hit)}\n ⇒ coords ${opts.xy.x},${opts.xy.y}. Get a ref via \`ax\` first (more reliable), or \`scroll\` the target into the viewport.`);
|
|
22168
|
+
if (hit.kind === "blocked") throw new Error(`⛔ Not clicking: ${renderHit(hit)}\n ⇒ When something covers it, the click runs ANOTHER element's handler (and a receipt saying "clicked" would never reveal it).\n ⇒ Fix: use \`ax\` to see what that layer is (overlay / sticky header / mask) and close it; or name the target with \`--ref\`.`);
|
|
22170
22169
|
const r = await clickAt(slot, targetId, opts.xy.x, opts.xy.y);
|
|
22171
22170
|
pageTouched(root, slot);
|
|
22172
22171
|
return {
|
|
@@ -22192,12 +22191,12 @@ async function slotClick(root, slot, sessionId, targetId, opts) {
|
|
|
22192
22191
|
const res = pickClickable(list, { text: opts.text });
|
|
22193
22192
|
if (!res.ok) {
|
|
22194
22193
|
const visible = list.filter((e) => e.w > 0 && e.h > 0);
|
|
22195
|
-
if (res.reason === "ambiguous") throw new Error(`⛔
|
|
22196
|
-
if (res.reason === "not-clickable") throw new Error(`⛔
|
|
22197
|
-
throw new Error(`⛔
|
|
22194
|
+
if (res.reason === "ambiguous") throw new Error(`⛔ "${opts.text}" matched ${res.hits.length} clickable elements — refusing to pick (a wrong click has already happened and will not undo itself).\n ⇒ Use a longer label, or name it with --xy=<x,y>:\n${renderClickables(res.hits)}`);
|
|
22195
|
+
if (res.reason === "not-clickable") throw new Error(`⛔ "${opts.text}" was found, but ${res.why}.\n ⇒ This is not a "try clicking anyway" situation: a dead click and no click read the same.\n${renderClickables(res.hits)}`);
|
|
22196
|
+
throw new Error(`⛔ No clickable element on the page matches "${opts.text}" (matches rendered visible text, incl. value/aria-label/title).\n ⇒ ${visible.length} visible clickable element(s) right now:\n${renderClickables(visible)}`);
|
|
22198
22197
|
}
|
|
22199
22198
|
const hit = judgeHit(await hitTestAt(slot, targetId, res.el.x, res.el.y));
|
|
22200
|
-
if (hit.kind === "offscreen" || hit.kind === "blank") throw new Error(`⛔
|
|
22199
|
+
if (hit.kind === "offscreen" || hit.kind === "blank") throw new Error(`⛔ Not clicking "${opts.text}": ${renderHit(hit)}\n ⇒ "Found" and "can be clicked" are two different things: visible and clickable in the DOM does not mean this click lands on it.`);
|
|
22201
22200
|
const clicked = await clickAt(slot, targetId, res.el.x, res.el.y);
|
|
22202
22201
|
pageTouched(root, slot);
|
|
22203
22202
|
return {
|
|
@@ -22279,9 +22278,9 @@ async function slotClose(root, slot, sessionId, targetId, all = false) {
|
|
|
22279
22278
|
*/
|
|
22280
22279
|
function needBackendId(args) {
|
|
22281
22280
|
const ref = typeof args.ref === "string" ? args.ref : "";
|
|
22282
|
-
if (!ref) throw new Error("⛔
|
|
22281
|
+
if (!ref) throw new Error("⛔ needs --ref=<eNNN> (run `browser_slot ax` to get a ref first).\n ⇒ A ref comes from an accessibility-tree snapshot; ⛔ it is not a DOM selector or CSS path.");
|
|
22283
22282
|
const id = refToBackendId(ref);
|
|
22284
|
-
if (id === null) throw new Error(`⛔ --ref
|
|
22283
|
+
if (id === null) throw new Error(`⛔ malformed --ref: ${JSON.stringify(ref)} (expected e12345, as printed by \`ax\`).\n ⛔ CSS selectors / text are not accepted — those need guessing, and a wrong guess drives another element with no signal.`);
|
|
22285
22284
|
return id;
|
|
22286
22285
|
}
|
|
22287
22286
|
/** AX 快照 */
|
|
@@ -22299,7 +22298,7 @@ async function slotAx(root, slot, sessionId, targetId, limit = 200) {
|
|
|
22299
22298
|
async function slotPress(root, slot, sessionId, targetId, keyDesc, times = 1) {
|
|
22300
22299
|
assertSlotOwned(root, slot, sessionId);
|
|
22301
22300
|
const stroke = parseKeyStroke(keyDesc);
|
|
22302
|
-
if (!stroke) throw new Error(`⛔
|
|
22301
|
+
if (!stroke) throw new Error(`⛔ Cannot parse key: ${JSON.stringify(keyDesc)}.\n ⇒ Accepted forms: Enter / Escape / Tab / ArrowUp|Down|Left|Right / Home / End / PageUp / PageDown / Space / Backspace / Delete; join modifiers with + (Control+A / Meta+Shift+Enter); single chars limited to a-z 0-9.\n ⇒ To type free text into a field use type (goes through Input.insertText, no key guessing): --text=<text>`);
|
|
22303
22302
|
const sent = await pressKey(slot, targetId, stroke, times);
|
|
22304
22303
|
pageTouched(root, slot);
|
|
22305
22304
|
return {
|
|
@@ -22360,7 +22359,7 @@ async function slotScroll(root, slot, sessionId, targetId, opts) {
|
|
|
22360
22359
|
async function slotWait(root, slot, sessionId, targetId, raw, timeoutMs) {
|
|
22361
22360
|
assertSlotOwned(root, slot, sessionId);
|
|
22362
22361
|
const spec = parseWaitSpec(raw);
|
|
22363
|
-
if (!spec) throw new Error(`⛔
|
|
22362
|
+
if (!spec) throw new Error(`⛔ Cannot parse wait condition: ${JSON.stringify(raw)}.\n ⇒ Accepted forms (prefix required; a bare value is ambiguous and may wait for something that never comes):\n selector:<CSS> text:<substring> url:<substring> gone:<CSS> js:<expression>`);
|
|
22364
22363
|
const r = await waitForInPage(slot, targetId, spec.expression, timeoutMs);
|
|
22365
22364
|
pageTouched(root, slot);
|
|
22366
22365
|
if (!r.ok) throw new Error(explainWaitTimeout(spec, r.waitedMs, r.last));
|
|
@@ -22388,9 +22387,9 @@ function resolveUploadPath(cccRoot, relOrAbs) {
|
|
|
22388
22387
|
try {
|
|
22389
22388
|
st = statSync(abs);
|
|
22390
22389
|
} catch {
|
|
22391
|
-
throw new Error(`⛔
|
|
22390
|
+
throw new Error(`⛔ File does not exist: ${relOrAbs} (resolved to ${abs}).\n ⚠️ This refusal is necessary: DOM.setFileInputFiles SILENTLY SUCCEEDS on a missing path, the form field stays empty, and the page looks exactly like "uploading".`);
|
|
22392
22391
|
}
|
|
22393
|
-
if (!st.isFile()) throw new Error(`⛔
|
|
22392
|
+
if (!st.isFile()) throw new Error(`⛔ Not a regular file (directory/device/symlink): ${relOrAbs}`);
|
|
22394
22393
|
return abs;
|
|
22395
22394
|
}
|
|
22396
22395
|
async function slotUpload(root, slot, sessionId, targetId, backendNodeId, absPaths) {
|
|
@@ -22448,7 +22447,7 @@ async function slotExt(root, slot, sessionId, name, args) {
|
|
|
22448
22447
|
return {
|
|
22449
22448
|
ok: false,
|
|
22450
22449
|
code: "ext-not-found",
|
|
22451
|
-
error:
|
|
22450
|
+
error: `No extension named "${name}".\n` + (known.length > 0 ? ` ⇒ Extensions in this CCC: ${known.join(", ")}` : ` ⇒ This CCC has no extensions yet (no .ts files under <CCC root>/${EXT_DIR_REL}/).\n To add one: stdin gets {slot,port,cccRoot,args}; the last stdout line returns {"ok":true,"result":…}`)
|
|
22452
22451
|
};
|
|
22453
22452
|
}
|
|
22454
22453
|
const res = await runExtension(entry, buildExtPayload({
|
|
@@ -22590,6 +22589,73 @@ function hasDomainSkill(cccRoot, urlOrHost) {
|
|
|
22590
22589
|
const p = domainSkillPath(cccRoot, urlOrHost);
|
|
22591
22590
|
return !!p && existsSync(p);
|
|
22592
22591
|
}
|
|
22592
|
+
/** 单个片段的体量上限(设计 §改动 3:⛔ 防止有人把整个库塞进来,那等于绕过 skill 体系) */
|
|
22593
|
+
const SNIPPET_MAX_BYTES = 16384;
|
|
22594
|
+
/** 片段目录名(站点目录下) */
|
|
22595
|
+
const SNIPPET_DIR = "snippets";
|
|
22596
|
+
/** 片段目录(站点目录下) */
|
|
22597
|
+
function snippetDir(cccRoot, urlOrHost) {
|
|
22598
|
+
const d = domainDir(cccRoot, urlOrHost);
|
|
22599
|
+
return d ? join(d, SNIPPET_DIR) : null;
|
|
22600
|
+
}
|
|
22601
|
+
/**
|
|
22602
|
+
* 列出该站可用的片段(**只读目录,不读内容**)。
|
|
22603
|
+
*
|
|
22604
|
+
* ## 只收 `.js`(owner 2026-11-24 裁「就是供 eval 用的 js 片段」)
|
|
22605
|
+
*
|
|
22606
|
+
* 🔴 **其它后缀一律不列** —— 不是说"跳过",是**结构性不认**:
|
|
22607
|
+
* 设计稿那条裁决把"操作序列文档"整类删掉了 ⇒ 若这里放行 `.md`/`.txt`,
|
|
22608
|
+
* 那类东西会借片段目录复活。
|
|
22609
|
+
*
|
|
22610
|
+
* ## 超限的不列,并**单独报出来**
|
|
22611
|
+
*
|
|
22612
|
+
* 一个 200 KB 的片段不该静默消失 —— 那与"我忘了写"在读数上同形。
|
|
22613
|
+
* ⇒ 返回 `oversize` 列表,由调用方在回执里点名(⛔ 静默丢)。
|
|
22614
|
+
*
|
|
22615
|
+
* ⚠️ 排序:按文件名,稳定(⛔ 按 mtime —— 那会让回执在两次调用间变化而无语义)。
|
|
22616
|
+
*/
|
|
22617
|
+
function listSnippets(cccRoot, urlOrHost) {
|
|
22618
|
+
const dir = snippetDir(cccRoot, urlOrHost);
|
|
22619
|
+
if (!dir || !existsSync(dir)) return {
|
|
22620
|
+
items: [],
|
|
22621
|
+
oversize: []
|
|
22622
|
+
};
|
|
22623
|
+
let names;
|
|
22624
|
+
try {
|
|
22625
|
+
names = readdirSync(dir);
|
|
22626
|
+
} catch {
|
|
22627
|
+
return {
|
|
22628
|
+
items: [],
|
|
22629
|
+
oversize: []
|
|
22630
|
+
};
|
|
22631
|
+
}
|
|
22632
|
+
const items = [];
|
|
22633
|
+
const oversize = [];
|
|
22634
|
+
for (const name of names.sort()) {
|
|
22635
|
+
if (!name.endsWith(".js")) continue;
|
|
22636
|
+
if (name.startsWith(".")) continue;
|
|
22637
|
+
const p = join(dir, name);
|
|
22638
|
+
let bytes;
|
|
22639
|
+
try {
|
|
22640
|
+
const st = statSync(p);
|
|
22641
|
+
if (!st.isFile()) continue;
|
|
22642
|
+
bytes = st.size;
|
|
22643
|
+
} catch {
|
|
22644
|
+
continue;
|
|
22645
|
+
}
|
|
22646
|
+
const rec = {
|
|
22647
|
+
name,
|
|
22648
|
+
path: p,
|
|
22649
|
+
bytes
|
|
22650
|
+
};
|
|
22651
|
+
if (bytes > 16384) oversize.push(rec);
|
|
22652
|
+
else items.push(rec);
|
|
22653
|
+
}
|
|
22654
|
+
return {
|
|
22655
|
+
items,
|
|
22656
|
+
oversize
|
|
22657
|
+
};
|
|
22658
|
+
}
|
|
22593
22659
|
/**
|
|
22594
22660
|
* 读该域名的说明书;未命中 ⇒ `null`(调用方**原样返回**回执,⛔ 不加任何噪声)。
|
|
22595
22661
|
*
|
|
@@ -22617,6 +22683,38 @@ function loadDomainSkill(cccRoot, urlOrHost) {
|
|
|
22617
22683
|
truncated
|
|
22618
22684
|
};
|
|
22619
22685
|
}
|
|
22686
|
+
/**
|
|
22687
|
+
* 片段的注入尾巴(设计 §改动 3)—— **只列清单,⛔ 不注入内容、⛔ 不执行**。
|
|
22688
|
+
*
|
|
22689
|
+
* ## 为什么只给清单而不给内容
|
|
22690
|
+
*
|
|
22691
|
+
* owner 裁决原话:「就是供 eval 用的 js 片段」。片段的价值是**可复用的认知**
|
|
22692
|
+
* (下次不用重新摸索选择器),而它的用法是:模型读了说明书 → 看到这里有几支片段 →
|
|
22693
|
+
* **自己决定**要不要 `eval` 其中一支。
|
|
22694
|
+
*
|
|
22695
|
+
* 🔴 若把内容也注进去,回执体量会失控(一支片段可达 16 KB),
|
|
22696
|
+
* 而且**等于替它做了"要不要用"的决定** —— 那不该由注入层替它做。
|
|
22697
|
+
*
|
|
22698
|
+
* ## 为什么超限的要单独点名
|
|
22699
|
+
*
|
|
22700
|
+
* 一支 200 KB 的片段若静默消失,与「我忘了写」在读数上同形。
|
|
22701
|
+
* ⇒ 明确告诉它"有这么个文件,但它太大没被采用",并给路径。
|
|
22702
|
+
*
|
|
22703
|
+
* @returns 追加文本;无片段 ⇒ **空串**(未命中零噪声,与说明书同一口径)
|
|
22704
|
+
*/
|
|
22705
|
+
function snippetTail(cccRoot, urlOrHost) {
|
|
22706
|
+
try {
|
|
22707
|
+
const { items, oversize } = listSnippets(cccRoot, urlOrHost);
|
|
22708
|
+
if (items.length === 0 && oversize.length === 0) return "";
|
|
22709
|
+
const lines = [`\n──── 本站可用片段(snippets/,供 eval 用)────`];
|
|
22710
|
+
for (const it of items) lines.push(` · ${it.name} ${(it.bytes / 1024).toFixed(1)} KB → ${it.path}`);
|
|
22711
|
+
for (const it of oversize) lines.push(` ⚠️ ${it.name} ${(it.bytes / 1024).toFixed(0)} KB —— 超过 ${SNIPPET_MAX_BYTES / 1024} KB 上限,**未采用**(⛔ 不是不存在)`);
|
|
22712
|
+
lines.push(" 用法:读一份说明书里对它的说明,再自己决定要不要 `browser_slot eval --js \"<片段内容>\"`。\n ⛔ 片段**不会自动执行** —— 它只是文本。");
|
|
22713
|
+
return lines.join("\n") + "\n";
|
|
22714
|
+
} catch {
|
|
22715
|
+
return "";
|
|
22716
|
+
}
|
|
22717
|
+
}
|
|
22620
22718
|
function visitLedgerPath(cccRoot) {
|
|
22621
22719
|
return join(browserRoot(cccRoot), VISIT_LEDGER_FILENAME);
|
|
22622
22720
|
}
|
|
@@ -22808,9 +22906,9 @@ function trajectoryNameFromCwd(root, cwd) {
|
|
|
22808
22906
|
*/
|
|
22809
22907
|
function row(v) {
|
|
22810
22908
|
const g = STATE_GLYPH[v.state] ?? "?";
|
|
22811
|
-
const who = v.state === "free" ? "" : ` ${v.trajectory || v.sessionId || "(
|
|
22812
|
-
const res = v.sampled ? `cpu${v.cpuPct}%
|
|
22813
|
-
const extra = v.state === "free" ? "" : `
|
|
22909
|
+
const who = v.state === "free" ? "" : ` ${v.trajectory || v.sessionId || "(unowned)"}`;
|
|
22910
|
+
const res = v.sampled ? `cpu${v.cpuPct}% rss${v.rssMb}M` : "cpu— rss—(not sampled on this platform)";
|
|
22911
|
+
const extra = v.state === "free" ? "" : ` held${v.heldMin}m idle${v.idleMin}m ${res}`;
|
|
22814
22912
|
const why = v.reasons.length > 0 ? `\n ↳ ${v.reasons.join(";")}` : "";
|
|
22815
22913
|
return ` ${g} ${v.label.padEnd(3)} :${v.port} ${v.resolution.padEnd(9)} ${v.state.padEnd(8)}${who}${extra}${why}`;
|
|
22816
22914
|
}
|
|
@@ -22823,7 +22921,7 @@ function row(v) {
|
|
|
22823
22921
|
*/
|
|
22824
22922
|
function needSlot(args) {
|
|
22825
22923
|
const n = normalizeSlotId(String(args.slot ?? ""));
|
|
22826
|
-
if (n === 0) throw new Error(`⛔
|
|
22924
|
+
if (n === 0) throw new Error(`⛔ needs --slot <b1..b20> (got ${JSON.stringify(args.slot)}).\n ⇒ Page actions must name the slot: run \`browser_slot list\` to see which one you hold.`);
|
|
22827
22925
|
return n;
|
|
22828
22926
|
}
|
|
22829
22927
|
/**
|
|
@@ -22835,7 +22933,7 @@ function needSlot(args) {
|
|
|
22835
22933
|
async function needTarget(root, n, sessionId, args) {
|
|
22836
22934
|
const target = str(args.target);
|
|
22837
22935
|
const match = str(args.match);
|
|
22838
|
-
if (!target && !match) throw new Error("⛔
|
|
22936
|
+
if (!target && !match) throw new Error("⛔ needs --target=<targetId> or --match=<URL/title substring> (run targets first).\n ⇒ --match is a substring match: it acts only on a unique hit; multiple hits are rejected with all candidates listed.");
|
|
22839
22937
|
return resolveTarget(root, n, sessionId, {
|
|
22840
22938
|
target,
|
|
22841
22939
|
match
|
|
@@ -22884,7 +22982,8 @@ function domainSkillTail(root, url, sessionId, slot) {
|
|
|
22884
22982
|
try {
|
|
22885
22983
|
recordVisit(root, url, sessionId, slot);
|
|
22886
22984
|
const hit = loadDomainSkill(root, url);
|
|
22887
|
-
|
|
22985
|
+
const snip = snippetTail(root, url);
|
|
22986
|
+
return (hit ? hit.text : "") + snip;
|
|
22888
22987
|
} catch {
|
|
22889
22988
|
return "";
|
|
22890
22989
|
}
|
|
@@ -22899,7 +22998,7 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
22899
22998
|
trajectory,
|
|
22900
22999
|
want: typeof args.slot === "string" ? normalizeSlotId(args.slot) : 0
|
|
22901
23000
|
});
|
|
22902
|
-
if (!res.ok) return `⛔
|
|
23001
|
+
if (!res.ok) return `⛔ acquire failed.\n${res.detail}`;
|
|
22903
23002
|
if (args.wait === true) {
|
|
22904
23003
|
const ready = await waitSlotReady(root, res.slot);
|
|
22905
23004
|
return `${res.detail}\n${ready.ok ? "✓ " + ready.detail : "⚠️ " + ready.detail}`;
|
|
@@ -22908,27 +23007,27 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
22908
23007
|
}
|
|
22909
23008
|
case "release": {
|
|
22910
23009
|
const n = normalizeSlotId(String(args.slot ?? ""));
|
|
22911
|
-
if (n === 0) return "⛔
|
|
23010
|
+
if (n === 0) return "⛔ release needs --slot <b1..b20>";
|
|
22912
23011
|
const r = releaseSlot(root, sessionId, n);
|
|
22913
23012
|
return r.detail + (r.released && r.ok ? domainSkillPrompt(root) : "");
|
|
22914
23013
|
}
|
|
22915
23014
|
case "reap": {
|
|
22916
23015
|
const n = normalizeSlotId(String(args.slot ?? ""));
|
|
22917
|
-
if (n === 0) return "⛔
|
|
23016
|
+
if (n === 0) return "⛔ reap needs --slot <b1..b20>";
|
|
22918
23017
|
return reapSlot(root, n, typeof args.reason === "string" && args.reason ? args.reason : "manual reaping").detail;
|
|
22919
23018
|
}
|
|
22920
23019
|
case "hold": {
|
|
22921
23020
|
const n = normalizeSlotId(String(args.slot ?? ""));
|
|
22922
|
-
if (n === 0) return "⛔
|
|
23021
|
+
if (n === 0) return "⛔ hold needs --slot <b1..b20>";
|
|
22923
23022
|
const mins = num(args.holdFor);
|
|
22924
|
-
if (mins === void 0) return "⛔
|
|
23023
|
+
if (mins === void 0) return "⛔ hold needs --holdFor=<minutes> (e.g. --holdFor 60). No permanent hold — that would defeat idle reclaim.";
|
|
22925
23024
|
const r = holdSlot(root, sessionId, n, mins, typeof args.reason === "string" ? args.reason : "");
|
|
22926
23025
|
return r.ok ? r.detail : `⛔ ${r.detail}`;
|
|
22927
23026
|
}
|
|
22928
23027
|
case "status": {
|
|
22929
23028
|
const n = normalizeSlotId(String(args.slot ?? ""));
|
|
22930
23029
|
const v = n > 0 ? slotStatus(root, n) : null;
|
|
22931
|
-
if (!v) return `⛔
|
|
23030
|
+
if (!v) return `⛔ invalid slot (1..20)`;
|
|
22932
23031
|
return row(v).trimStart();
|
|
22933
23032
|
}
|
|
22934
23033
|
case "list":
|
|
@@ -22937,24 +23036,24 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
22937
23036
|
const occupied = views.filter((v) => v.state !== "free");
|
|
22938
23037
|
const bad = views.filter((v) => v.state === "stale" || v.state === "orphaned");
|
|
22939
23038
|
const lines = [];
|
|
22940
|
-
lines.push(
|
|
22941
|
-
lines.push(" ·
|
|
22942
|
-
if (occupied.length === 0) lines.push("
|
|
23039
|
+
lines.push(`slots ${views.length} (busy ${occupied.length}, free ${views.length - occupied.length}, bad ${bad.length})` + (ledgerAgeMin > 0 ? ` ledger ${ledgerAgeMin}m old` : ""));
|
|
23040
|
+
lines.push(" · free ✓ leased ! stale(act) ✗ orphaned");
|
|
23041
|
+
if (occupied.length === 0) lines.push(" (all free)");
|
|
22943
23042
|
else for (const v of occupied) lines.push(row(v));
|
|
22944
23043
|
if (bad.length > 0) {
|
|
22945
23044
|
lines.push("");
|
|
22946
|
-
lines.push("🔴
|
|
23045
|
+
lines.push("🔴 The watchman notifies the OWNING session; if the owner is gone, reap it:");
|
|
22947
23046
|
for (const v of bad) lines.push(` browser_slot reap --slot ${v.label}`);
|
|
22948
23047
|
}
|
|
22949
23048
|
lines.push("");
|
|
22950
|
-
lines.push("
|
|
23049
|
+
lines.push("usage: acquire (auto-picks, or --slot) · release (always when done) · status --slot b1");
|
|
22951
23050
|
const visits = Object.entries(readVisits(root).domains).sort((a, b) => b[1].opens - a[1].opens || b[1].lastAt - a[1].lastAt);
|
|
22952
23051
|
if (visits.length > 0) {
|
|
22953
23052
|
const missing = visits.filter(([h]) => !hasDomainSkill(root, h)).length;
|
|
22954
23053
|
lines.push("");
|
|
22955
|
-
lines.push(
|
|
22956
|
-
for (const [h, v] of visits.slice(0, 5)) lines.push(` ${hasDomainSkill(root, h) ? "✓" : "·"} ${h.padEnd(28)} ${v.opens}
|
|
22957
|
-
if (visits.length > 5) lines.push(`
|
|
23054
|
+
lines.push(`domains ${visits.length}${missing > 0 ? ` (${missing} without notes)` : " (all documented)"}:`);
|
|
23055
|
+
for (const [h, v] of visits.slice(0, 5)) lines.push(` ${hasDomainSkill(root, h) ? "✓" : "·"} ${h.padEnd(28)} ${v.opens}x`);
|
|
23056
|
+
if (visits.length > 5) lines.push(` …${visits.length - 5} more (BROWSER/_index.json)`);
|
|
22958
23057
|
}
|
|
22959
23058
|
return lines.join("\n");
|
|
22960
23059
|
}
|
|
@@ -22962,13 +23061,13 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
22962
23061
|
case "targets": {
|
|
22963
23062
|
const n = needSlot(args);
|
|
22964
23063
|
const list = await slotTargets(root, n, sessionId);
|
|
22965
|
-
if (list.length === 0) return
|
|
22966
|
-
return `[browser_slot] ${list.length}
|
|
23064
|
+
if (list.length === 0) return `no targets on ${slotLabel(n)} (port ${slotPort(n)})`;
|
|
23065
|
+
return `[browser_slot] ${list.length} target(s) on ${slotLabel(n)} (port ${slotPort(n)})\n` + list.map((t) => ` ${t.type.padEnd(10)} ${t.id} ${t.title.slice(0, 40)} ${t.url.slice(0, 90)}`).join("\n");
|
|
22967
23066
|
}
|
|
22968
23067
|
case "open": {
|
|
22969
23068
|
const n = needSlot(args);
|
|
22970
23069
|
const url = str(args.url);
|
|
22971
|
-
if (!url) return "⛔
|
|
23070
|
+
if (!url) return "⛔ needs --url=<address>";
|
|
22972
23071
|
return `[browser_slot] targetId=${await slotOpen(root, n, sessionId, url)}` + domainSkillTail(root, url, sessionId, n);
|
|
22973
23072
|
}
|
|
22974
23073
|
case "goto": {
|
|
@@ -22978,9 +23077,9 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
22978
23077
|
const match = str(args.match);
|
|
22979
23078
|
const missing = [];
|
|
22980
23079
|
if (n === 0) missing.push("--slot <b1..b20>");
|
|
22981
|
-
if (!target && !match) missing.push("--target <targetId>
|
|
22982
|
-
if (!url) missing.push("--url
|
|
22983
|
-
if (missing.length > 0) return `⛔ goto
|
|
23080
|
+
if (!target && !match) missing.push("--target <targetId> or --match <URL/title substring> (run targets first)");
|
|
23081
|
+
if (!url) missing.push("--url <destination>");
|
|
23082
|
+
if (missing.length > 0) return `⛔ goto missing ${missing.length} arg(s), all listed at once:\n` + missing.map((m) => ` · ${m}`).join("\n") + `\n ⚠️ goto differs from open: open needs only --slot + --url; goto also needs WHICH tab to navigate.`;
|
|
22984
23083
|
const slotN = n;
|
|
22985
23084
|
const destUrl = url;
|
|
22986
23085
|
const tgt = target ?? await needTarget(root, slotN, sessionId, args);
|
|
@@ -22991,7 +23090,7 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
22991
23090
|
const n = needSlot(args);
|
|
22992
23091
|
const js = str(args.js);
|
|
22993
23092
|
const target = await needTarget(root, n, sessionId, args);
|
|
22994
|
-
if (!js) return "⛔
|
|
23093
|
+
if (!js) return "⛔ needs --js=<expression> (e.g. document.title)";
|
|
22995
23094
|
const v = await slotEval(root, n, sessionId, target, js, num(args.timeout));
|
|
22996
23095
|
return typeof v === "string" ? v : JSON.stringify(v, null, 2);
|
|
22997
23096
|
}
|
|
@@ -23010,59 +23109,59 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
23010
23109
|
}
|
|
23011
23110
|
case "reload": {
|
|
23012
23111
|
const n = needSlot(args);
|
|
23013
|
-
return `[browser_slot] reload
|
|
23112
|
+
return `[browser_slot] reload done (readyState=${await slotReload(root, n, sessionId, await needTarget(root, n, sessionId, args), str(args.script)) || "?"})`;
|
|
23014
23113
|
}
|
|
23015
23114
|
case "click": {
|
|
23016
23115
|
const n = needSlot(args);
|
|
23017
23116
|
const target = await needTarget(root, n, sessionId, args);
|
|
23018
23117
|
const text = str(args.text);
|
|
23019
23118
|
const xy = parseXY(args.xy);
|
|
23020
|
-
if (!text && !xy) return `⛔
|
|
23119
|
+
if (!text && !xy) return `⛔ needs --text=<visible label> or coordinates (all three forms accepted):\n${xyFormHint("xy")}\n e.g. --text=Sign in`;
|
|
23021
23120
|
const refRaw = str(args.ref);
|
|
23022
23121
|
const refId = refRaw === void 0 ? void 0 : refToBackendId(refRaw) ?? void 0;
|
|
23023
|
-
if (refRaw !== void 0 && refId === void 0) return `⛔ --ref
|
|
23122
|
+
if (refRaw !== void 0 && refId === void 0) return `⛔ malformed --ref: ${JSON.stringify(refRaw)} (want eNNN from \`ax\`)`;
|
|
23024
23123
|
const { picked, dialogs, hit } = await slotClick(root, n, sessionId, target, {
|
|
23025
23124
|
text,
|
|
23026
23125
|
xy,
|
|
23027
23126
|
ref: refId
|
|
23028
23127
|
});
|
|
23029
|
-
const base = `[browser_slot] clicked ${xy ? `@${xy.x},${xy.y}` : `<${picked.tag}> "${picked.text.slice(0, 60)}" @${picked.x},${picked.y}`}
|
|
23128
|
+
const base = `[browser_slot] clicked ${xy ? `@${xy.x},${xy.y}` : `<${picked.tag}> "${picked.text.slice(0, 60)}" @${picked.x},${picked.y}`}|hit: ${renderHit(hit)}`;
|
|
23030
23129
|
if (dialogs.length === 0) return base;
|
|
23031
|
-
return `${base}\n${dialogs.map((d) => ` ⚠️
|
|
23130
|
+
return `${base}\n${dialogs.map((d) => ` ⚠️ auto-handled dialog ${d.type || "(unknown)"}: ${JSON.stringify(d.message.slice(0, 100))} ⇒ ${d.accepted ? "accepted" : "dismissed"}`).join("\n")}\n (default = dismiss; use dialog --accept to confirm — OK often means delete/pay/publish)`;
|
|
23032
23131
|
}
|
|
23033
23132
|
case "ax": {
|
|
23034
23133
|
const n = needSlot(args);
|
|
23035
23134
|
const target = await needTarget(root, n, sessionId, args);
|
|
23036
23135
|
const { lines, total } = await slotAx(root, n, sessionId, target, num(args.limit) ?? 200);
|
|
23037
|
-
if (lines.length === 0) return `[browser_slot] ax
|
|
23038
|
-
return `[browser_slot] ax
|
|
23136
|
+
if (lines.length === 0) return `[browser_slot] ax — no interactive elements in the a11y tree (target=${target}).\n ⇒ maybe not rendered yet (wait first), or the page is genuinely static text (use text).`;
|
|
23137
|
+
return `[browser_slot] ax — ${lines.length} interactive element(s) (of ${total}; ref stays stable across snapshots)\n${renderAx(lines, total)}`;
|
|
23039
23138
|
}
|
|
23040
23139
|
case "press": {
|
|
23041
23140
|
const n = needSlot(args);
|
|
23042
23141
|
const target = await needTarget(root, n, sessionId, args);
|
|
23043
23142
|
const k = str(args.key);
|
|
23044
|
-
if (!k) return "⛔
|
|
23143
|
+
if (!k) return "⛔ needs --key=<key> (e.g. Enter / Escape / Control+A / Meta+Shift+Enter)";
|
|
23045
23144
|
const { stroke, sent } = await slotPress(root, n, sessionId, target, k, num(args.times) ?? 1);
|
|
23046
|
-
return `[browser_slot] press ${stroke.key}
|
|
23145
|
+
return `[browser_slot] press ${stroke.key} (code=${stroke.code}, modifiers=${stroke.modifiers}) × ${sent}\n ⚠️ This only reports keys SENT, ⛔ not that the UI responded — re-read with ax / eval.`;
|
|
23047
23146
|
}
|
|
23048
23147
|
case "type": {
|
|
23049
23148
|
const n = needSlot(args);
|
|
23050
23149
|
const target = await needTarget(root, n, sessionId, args);
|
|
23051
23150
|
const text = typeof args.text === "string" ? args.text : void 0;
|
|
23052
|
-
if (text === void 0 || text === "") return "⛔
|
|
23151
|
+
if (text === void 0 || text === "") return "⛔ needs --text=<exact text> (acts on current focus; use fill to set a value)";
|
|
23053
23152
|
await slotType(root, n, sessionId, target, text);
|
|
23054
|
-
return `[browser_slot] type ${JSON.stringify(text.slice(0, 40))}
|
|
23153
|
+
return `[browser_slot] type ${JSON.stringify(text.slice(0, 40))} (inserted ${[...text].length} chars; ⛔ no change event — blur triggers it)`;
|
|
23055
23154
|
}
|
|
23056
23155
|
case "fill": {
|
|
23057
23156
|
const n = needSlot(args);
|
|
23058
23157
|
const target = await needTarget(root, n, sessionId, args);
|
|
23059
23158
|
const id = needBackendId(args);
|
|
23060
23159
|
const value = typeof args.value === "string" ? args.value : void 0;
|
|
23061
|
-
if (value === void 0) return "⛔
|
|
23160
|
+
if (value === void 0) return "⛔ needs --value=<value> (empty string allowed: --value=)";
|
|
23062
23161
|
const r = await slotFill(root, n, sessionId, target, id, value);
|
|
23063
|
-
if (!r.ok) return `⛔ fill
|
|
23162
|
+
if (!r.ok) return `⛔ fill failed (<${r.tag || "?"}>): ${r.why ?? "unknown reason"}`;
|
|
23064
23163
|
const same = r.readBack === value;
|
|
23065
|
-
return `[browser_slot] fill <${r.tag}>
|
|
23164
|
+
return `[browser_slot] fill <${r.tag}> read-back=${JSON.stringify(r.readBack.slice(0, 80))}` + (same ? " ✓ matches the value given" : " ⚠️ does NOT match — the control may reformat or reject it");
|
|
23066
23165
|
}
|
|
23067
23166
|
case "scroll": {
|
|
23068
23167
|
const n = needSlot(args);
|
|
@@ -23071,55 +23170,55 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
23071
23170
|
const xy = parseXY(args.xy);
|
|
23072
23171
|
const toRaw = str(args.to);
|
|
23073
23172
|
const to = toRaw === "top" || toRaw === "bottom" ? toRaw : void 0;
|
|
23074
|
-
if (!refStr && !xy && !to) return "⛔
|
|
23173
|
+
if (!refStr && !xy && !to) return "⛔ needs one of --ref=<eNNN> / --xy=<x,y> / --to=<top|bottom>";
|
|
23075
23174
|
const { scrolledY, via, why } = await slotScroll(root, n, sessionId, target, {
|
|
23076
23175
|
ref: refStr ? needBackendId(args) : void 0,
|
|
23077
23176
|
xy,
|
|
23078
23177
|
to,
|
|
23079
23178
|
deltaY: num(args.delta)
|
|
23080
23179
|
});
|
|
23081
|
-
const viaLine = via === "wheel" ? "
|
|
23082
|
-
return `[browser_slot] scroll → scrollY
|
|
23180
|
+
const viaLine = via === "wheel" ? "(real wheel event)" : `(⚠️ fell back to JS scroll — ${why ?? ""}; NO wheel event was emitted, so wheel-triggered lazy loading will not start)`;
|
|
23181
|
+
return `[browser_slot] scroll → scrollY ${scrolledY > 0 ? "+" : ""}${scrolledY}px ${viaLine}`;
|
|
23083
23182
|
}
|
|
23084
23183
|
case "wait": {
|
|
23085
23184
|
const n = needSlot(args);
|
|
23086
23185
|
const target = await needTarget(root, n, sessionId, args);
|
|
23087
23186
|
const forRaw = str(args.for);
|
|
23088
|
-
if (!forRaw) return "⛔
|
|
23187
|
+
if (!forRaw) return "⛔ needs --for=<selector:…|text:…|url:…|gone:…|js:…> (prefix required)";
|
|
23089
23188
|
const { spec, waitedMs } = await slotWait(root, n, sessionId, target, forRaw, num(args.timeout) ?? 15e3);
|
|
23090
|
-
return `[browser_slot] wait ${spec.kind}
|
|
23189
|
+
return `[browser_slot] wait ${spec.kind} satisfied (waited ${waitedMs}ms)`;
|
|
23091
23190
|
}
|
|
23092
23191
|
case "drag": {
|
|
23093
23192
|
const n = needSlot(args);
|
|
23094
23193
|
const target = await needTarget(root, n, sessionId, args);
|
|
23095
23194
|
const from = parseXY(args.from);
|
|
23096
23195
|
const to = parseXY(args.to);
|
|
23097
|
-
if (!from || !to) return `⛔
|
|
23196
|
+
if (!from || !to) return `⛔ needs --from and --to (all three coordinate forms accepted):\n${xyFormHint("from")}${xyFormHint("to")}\n get a ref via ax, then measure coords with scroll/eval`;
|
|
23098
23197
|
const steps = num(args.steps) ?? 12;
|
|
23099
23198
|
await slotDrag(root, n, sessionId, target, from, to, steps);
|
|
23100
|
-
return `[browser_slot] drag ${from.x},${from.y} → ${to.x},${to.y}
|
|
23199
|
+
return `[browser_slot] drag ${from.x},${from.y} → ${to.x},${to.y} (${steps} steps; ⛔ this does not report success)`;
|
|
23101
23200
|
}
|
|
23102
23201
|
case "upload": {
|
|
23103
23202
|
const n = needSlot(args);
|
|
23104
23203
|
const target = await needTarget(root, n, sessionId, args);
|
|
23105
23204
|
const id = needBackendId(args);
|
|
23106
23205
|
const list = Array.isArray(args.file) ? args.file : typeof args.file === "string" ? [args.file] : [];
|
|
23107
|
-
if (list.length === 0) return "⛔
|
|
23206
|
+
if (list.length === 0) return "⛔ needs --file=<path inside CCC> (repeatable; paths outside the CCC root are refused)";
|
|
23108
23207
|
const abs = list.filter((x) => typeof x === "string" && x !== "").map((f) => resolveUploadPath(root, f));
|
|
23109
|
-
if (abs.length === 0) return "⛔ --file
|
|
23208
|
+
if (abs.length === 0) return "⛔ no usable path in --file";
|
|
23110
23209
|
const r = await slotUpload(root, n, sessionId, target, id, abs);
|
|
23111
|
-
return `[browser_slot] upload ${r.files.length}
|
|
23210
|
+
return `[browser_slot] upload ${r.files.length} file(s) → ref ${str(args.ref) ?? ""}\n ${r.files.map((f) => f.replace(root + "/", "")).join("\n ")}`;
|
|
23112
23211
|
}
|
|
23113
23212
|
case "downloads": {
|
|
23114
23213
|
const n = needSlot(args);
|
|
23115
23214
|
const { dir, files } = await slotDownloads(root, n, sessionId, await needTarget(root, n, sessionId, args));
|
|
23116
|
-
return `[browser_slot]
|
|
23215
|
+
return `[browser_slot] download capture dir: ${dir}\n${files.length === 0 ? "(directory is empty)" : files.map((f) => ` ${f.name} ${Math.round(f.bytes / 1024)} KB`).join("\n")}\n ⇒ trigger a download with click (links with download attr are refused) or eval; then call downloads again to see new files.\n ⚠️ The dir is never auto-cleaned — cleaning it destroys evidence.`;
|
|
23117
23216
|
}
|
|
23118
23217
|
case "dialog": {
|
|
23119
23218
|
const n = needSlot(args);
|
|
23120
23219
|
const r = await slotDialog(root, n, sessionId, await needTarget(root, n, sessionId, args), args.accept === true, str(args.prompt));
|
|
23121
|
-
if (!r.hadDialog) return "[browser_slot] dialog
|
|
23122
|
-
return `[browser_slot] dialog ${r.type || "(
|
|
23220
|
+
if (!r.hadDialog) return "[browser_slot] dialog — no dialog open right now (normal, not an error)";
|
|
23221
|
+
return `[browser_slot] dialog ${r.type || "(unknown)"}: ${JSON.stringify(r.message.slice(0, 120))}\n ${r.accepted ? "✓ accepted (OK)" : "✓ dismissed (Cancel)"}`;
|
|
23123
23222
|
}
|
|
23124
23223
|
case "close": {
|
|
23125
23224
|
const n = needSlot(args);
|
|
@@ -23128,15 +23227,15 @@ async function run(ctx, root, sessionId, trajectory, action, args) {
|
|
|
23128
23227
|
}
|
|
23129
23228
|
case "ext-list": {
|
|
23130
23229
|
const exts = slotExtList(root);
|
|
23131
|
-
if (exts.length === 0) return
|
|
23132
|
-
return
|
|
23230
|
+
if (exts.length === 0) return `No browser extensions in this CCC yet.\n To add one: drop a .ts file under <CCC root>/${EXT_DIR_REL}/ — the filename is the extension name.\n Contract: stdin gets {slot,port,cccRoot,args}; stdout's LAST non-empty line must be {"ok":true,"result":…}.\n ⚠️ ACC only spawns, ⛔ never imports — your syntax error cannot take down the host.`;
|
|
23231
|
+
return `browser extensions in this CCC: ${exts.length} (<CCC root>/${EXT_DIR_REL}/):\n` + exts.map((e) => ` · ${e.name}`).join("\n") + `\n\ncall: browser_slot ext --slot b1 --name <name> [--earg key=value … (repeatable)]`;
|
|
23133
23232
|
}
|
|
23134
23233
|
case "ext": {
|
|
23135
23234
|
const n = needSlot(args);
|
|
23136
23235
|
const name = str(args.name);
|
|
23137
|
-
if (!name) return "⛔
|
|
23236
|
+
if (!name) return "⛔ needs --name=<extension> (run ext-list first)";
|
|
23138
23237
|
const res = await slotExt(root, n, sessionId, name, extArgs(args));
|
|
23139
|
-
if (!res.ok) return `⛔
|
|
23238
|
+
if (!res.ok) return `⛔ extension "${name}" failed (${res.code ?? "unknown"}):\n${res.error ?? ""}`;
|
|
23140
23239
|
return typeof res.result === "string" ? res.result : JSON.stringify(res.result ?? null, null, 2);
|
|
23141
23240
|
}
|
|
23142
23241
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgroup/dsh-serenity-hooks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.139.0",
|
|
4
4
|
"description": "宁静号 ACC harness(Native Cordis 插件)——给 DeepSeek Harness 装一个「AI 工作区」:13 个工具(container_fs/cognitive_trajectory/dashboard/container_git/msm/praxis/ontology/serenity-skill-creator/localstore/container_admin/browser_slot;另两个 im-bridge/diagram 按条件出现)+ 机械约束(安全模式/工作区围墙/密钥守卫/对外输出守卫)+ 认知轨迹日志与原地重建 + 网页登录入口/IM 桥/认知轨迹唤醒注册表 + 浏览器槽位管理(≤20 个独立 profile 的 Chrome 槽位,带占用归属与异常时向所属会话反向注入提醒)。轨迹声明 = 轨迹目录下的 trajectory.json(约束面 + 旧标识 uid + CRO 机器绑定 cro.host;旧名 trajectory-constraint.json / skiff.json 仍在读取族里);轨迹提示词 = 轨迹目录下的 PROMPT.md(一条轨迹「是谁、按什么章程工作」,所有轨迹通用,追加在容器层与质量层之后,不替换它们)。适配 DSH 0.1.7-rc.1 / 0.2.0-rc.1 / 0.2.1-rc.1(三档)。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|