ocuclaw 1.2.4 → 1.3.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/README.md +18 -5
- package/dist/config/runtime-config.js +81 -3
- package/dist/domain/activity-status-adapter.js +138 -605
- package/dist/domain/activity-status-arbiter.js +109 -0
- package/dist/domain/activity-status-labels.js +906 -0
- package/dist/domain/code-span-regions.js +103 -0
- package/dist/domain/conversation-state.js +14 -1
- package/dist/domain/debug-store.js +38 -182
- package/dist/domain/glasses-ui-content-summary.js +62 -0
- package/dist/domain/glasses-ui-system-prompt.js +28 -0
- package/dist/domain/message-emoji-allowlist.js +16 -0
- package/dist/domain/message-emoji-filter.js +33 -55
- package/dist/domain/neural-emoji-reactor-system-prompt.js +43 -0
- package/dist/domain/neural-emoji-reactor-tag-config.js +56 -0
- package/dist/domain/neural-pace-modulator-system-prompt.js +32 -0
- package/dist/domain/neural-pace-modulator-tag-config.js +51 -0
- package/dist/domain/tagged-span-parser.js +121 -0
- package/dist/domain/tagged-span-strip.js +38 -0
- package/dist/even-ai/even-ai-endpoint.js +91 -0
- package/dist/even-ai/even-ai-run-waiter.js +14 -0
- package/dist/even-ai/even-ai-settings-store.js +14 -0
- package/dist/gateway/gateway-bridge.js +14 -2
- package/dist/gateway/gateway-timing-ledger.js +457 -0
- package/dist/gateway/openclaw-client.js +462 -38
- package/dist/index.js +28 -1
- package/dist/runtime/downstream-handler.js +754 -83
- package/dist/runtime/downstream-server.js +700 -534
- package/dist/runtime/ocuclaw-settings-store.js +74 -31
- package/dist/runtime/plugin-update-service.js +216 -0
- package/dist/runtime/protocol-adapter.js +9 -0
- package/dist/runtime/provider-usage-select.js +168 -0
- package/dist/runtime/relay-client-nudge-controller.js +553 -0
- package/dist/runtime/relay-core.js +1209 -204
- package/dist/runtime/relay-health-monitor.js +172 -0
- package/dist/runtime/relay-operation-registry.js +263 -0
- package/dist/runtime/relay-service.js +201 -1
- package/dist/runtime/relay-worker-approval-replay-cache.js +68 -0
- package/dist/runtime/relay-worker-entry.js +32 -0
- package/dist/runtime/relay-worker-health.js +272 -0
- package/dist/runtime/relay-worker-protocol.js +285 -0
- package/dist/runtime/relay-worker-queue.js +202 -0
- package/dist/runtime/relay-worker-supervisor.js +1081 -0
- package/dist/runtime/relay-worker-transport.js +1051 -0
- package/dist/runtime/session-context-service.js +189 -0
- package/dist/runtime/session-service.js +615 -24
- package/dist/runtime/upstream-runtime.js +1167 -60
- package/dist/tools/device-info-tool.js +242 -0
- package/dist/tools/glasses-ui-cron.js +427 -0
- package/dist/tools/glasses-ui-descriptors.js +261 -0
- package/dist/tools/glasses-ui-limits.js +21 -0
- package/dist/tools/glasses-ui-paint-floor.js +99 -0
- package/dist/tools/glasses-ui-recipes.js +746 -0
- package/dist/tools/glasses-ui-surfaces.js +278 -0
- package/dist/tools/glasses-ui-template.js +182 -0
- package/dist/tools/glasses-ui-tool.js +1147 -0
- package/dist/tools/session-title-tool.js +209 -0
- package/dist/version.js +2 -0
- package/openclaw.plugin.json +163 -15
- package/package.json +12 -4
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Pure ladder-ranking logic for the activity-status arbiter (Plan 2 core).
|
|
2
|
+
//
|
|
3
|
+
// LEAF MODULE: it may import small shared leaf helpers, but nothing it imports
|
|
4
|
+
// may import it back. The CJS build (scripts/build.mjs#emitCjsFile) appends
|
|
5
|
+
// `module.exports = {...}` at EOF and converts imports to eager in-place
|
|
6
|
+
// requires, so a bidirectional import would resolve to `{}` mid-cycle and
|
|
7
|
+
// crash at call time. Keep this module a strict leaf.
|
|
8
|
+
|
|
9
|
+
const RANK_INTERVENTION = "intervention";
|
|
10
|
+
const RANK_GENERATED_SUMMARY = "generated_summary";
|
|
11
|
+
const RANK_TOOL = "tool";
|
|
12
|
+
const RANK_GENERIC_THINKING = "generic_thinking";
|
|
13
|
+
const RANK_QUIET = "quiet";
|
|
14
|
+
|
|
15
|
+
// Ladder order, highest first. Matches spec §5.
|
|
16
|
+
const RANKS = [
|
|
17
|
+
RANK_INTERVENTION,
|
|
18
|
+
RANK_GENERATED_SUMMARY,
|
|
19
|
+
RANK_TOOL,
|
|
20
|
+
RANK_GENERIC_THINKING,
|
|
21
|
+
RANK_QUIET,
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
function isInterventionSignal(s) {
|
|
25
|
+
return (
|
|
26
|
+
s.isError === true ||
|
|
27
|
+
s.phaseIsError === true ||
|
|
28
|
+
s.hasRateLimitInfo === true ||
|
|
29
|
+
s.failoverPending === true
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Classify an already-resolved activity into its ladder rank.
|
|
34
|
+
// The branch order IS the ladder order. `intervention` and `tool` are
|
|
35
|
+
// rankable regardless of includeThinking; the two thinking-derived ranks
|
|
36
|
+
// (`generated_summary` and `generic_thinking`) are both gated by
|
|
37
|
+
// `includeThinking === true` (spec §7.4: `includeThinking = false` →
|
|
38
|
+
// no `generated_summary` override and no `generic_thinking` fallback).
|
|
39
|
+
//
|
|
40
|
+
// NOTE: the guard here enforces spec §7.4 directly — callers may pass
|
|
41
|
+
// any value for `thinkingSummarySource` regardless of `includeThinking`
|
|
42
|
+
// and will always get the correct answer.
|
|
43
|
+
function classifyRank(signals) {
|
|
44
|
+
const s = signals || {};
|
|
45
|
+
if (isInterventionSignal(s)) return RANK_INTERVENTION;
|
|
46
|
+
if (
|
|
47
|
+
s.isThinking === true &&
|
|
48
|
+
s.includeThinking === true &&
|
|
49
|
+
evaluateSummaryEligibility(s.thinkingSummarySource, s.label)
|
|
50
|
+
) {
|
|
51
|
+
return RANK_GENERATED_SUMMARY;
|
|
52
|
+
}
|
|
53
|
+
if (s.hasTool === true) return RANK_TOOL;
|
|
54
|
+
if (s.isThinking === true && s.includeThinking === true) {
|
|
55
|
+
return RANK_GENERIC_THINKING;
|
|
56
|
+
}
|
|
57
|
+
return RANK_QUIET;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Exact generic stems that must never outrank a tool, even from a
|
|
61
|
+
// summary/bold source. Compared against the normalized whole label.
|
|
62
|
+
const GENERIC_SUMMARY_DENYLIST = new Set([
|
|
63
|
+
"thinking",
|
|
64
|
+
"working",
|
|
65
|
+
"planning",
|
|
66
|
+
"analyzing",
|
|
67
|
+
"considering",
|
|
68
|
+
"checking",
|
|
69
|
+
"reasoning",
|
|
70
|
+
"looking into it",
|
|
71
|
+
"let me check",
|
|
72
|
+
"let me think",
|
|
73
|
+
"hmm",
|
|
74
|
+
]);
|
|
75
|
+
|
|
76
|
+
function normalizeSummaryLabel(label) {
|
|
77
|
+
if (typeof label !== "string") return "";
|
|
78
|
+
return label
|
|
79
|
+
.replace(/\*\*/g, "")
|
|
80
|
+
.replace(/[.…]+$/g, "") // trailing dots / ellipsis
|
|
81
|
+
.trim() // leading/trailing whitespace
|
|
82
|
+
.toLowerCase();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// A summary may outrank a tool only if it is an authored, concise, specific
|
|
86
|
+
// signal: source ∈ {summary, bold}, non-empty, not a generic stem, and not a
|
|
87
|
+
// bare verb with no object.
|
|
88
|
+
function evaluateSummaryEligibility(thinkingSummarySource, label) {
|
|
89
|
+
if (thinkingSummarySource !== "summary" && thinkingSummarySource !== "bold") {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
const normalized = normalizeSummaryLabel(label);
|
|
93
|
+
if (!normalized) return false;
|
|
94
|
+
if (GENERIC_SUMMARY_DENYLIST.has(normalized)) return false;
|
|
95
|
+
// bare verb / single token = no object
|
|
96
|
+
if (!/\s/.test(normalized)) return false;
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
RANKS,
|
|
102
|
+
RANK_INTERVENTION,
|
|
103
|
+
RANK_GENERATED_SUMMARY,
|
|
104
|
+
RANK_TOOL,
|
|
105
|
+
RANK_GENERIC_THINKING,
|
|
106
|
+
RANK_QUIET,
|
|
107
|
+
evaluateSummaryEligibility,
|
|
108
|
+
classifyRank,
|
|
109
|
+
};
|