anolisa-tokenless 0.7.7

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 (70) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +770 -0
  3. package/adapters/tokenless/claude-code/.claude-plugin/marketplace.json +15 -0
  4. package/adapters/tokenless/claude-code/.claude-plugin/plugin.json +9 -0
  5. package/adapters/tokenless/claude-code/hooks/hooks.json +38 -0
  6. package/adapters/tokenless/claude-code/scripts/detect.sh +193 -0
  7. package/adapters/tokenless/claude-code/scripts/install.sh +92 -0
  8. package/adapters/tokenless/claude-code/scripts/uninstall.sh +50 -0
  9. package/adapters/tokenless/codex/.codex-plugin/plugin.json +20 -0
  10. package/adapters/tokenless/codex/README.md +160 -0
  11. package/adapters/tokenless/codex/hooks/hooks.json +52 -0
  12. package/adapters/tokenless/codex/scripts/_common.sh +25 -0
  13. package/adapters/tokenless/codex/scripts/check-tokenless +94 -0
  14. package/adapters/tokenless/codex/scripts/compress-response +441 -0
  15. package/adapters/tokenless/codex/scripts/detect.sh +61 -0
  16. package/adapters/tokenless/codex/scripts/install.sh +151 -0
  17. package/adapters/tokenless/codex/scripts/rewrite-hook +282 -0
  18. package/adapters/tokenless/codex/scripts/tool-ready +303 -0
  19. package/adapters/tokenless/codex/scripts/uninstall.sh +78 -0
  20. package/adapters/tokenless/common/commands/tokenless-stats.toml +2 -0
  21. package/adapters/tokenless/common/cosh-extension.json +65 -0
  22. package/adapters/tokenless/common/hooks/compress_response_hook.py +487 -0
  23. package/adapters/tokenless/common/hooks/compress_schema_hook.py +144 -0
  24. package/adapters/tokenless/common/hooks/compress_toon_hook.py +160 -0
  25. package/adapters/tokenless/common/hooks/hook_utils.py +584 -0
  26. package/adapters/tokenless/common/hooks/rewrite_hook.py +223 -0
  27. package/adapters/tokenless/common/hooks/run-hook.sh +62 -0
  28. package/adapters/tokenless/common/hooks/tool_categories.json +99 -0
  29. package/adapters/tokenless/common/hooks/tool_ready_hook.sh +571 -0
  30. package/adapters/tokenless/common/tokenless-env-fix.sh +730 -0
  31. package/adapters/tokenless/common/tool-ready-spec.json +113 -0
  32. package/adapters/tokenless/dsh/cordis.patch.yml +8 -0
  33. package/adapters/tokenless/dsh/dist/index.js +399 -0
  34. package/adapters/tokenless/dsh/package.json +26 -0
  35. package/adapters/tokenless/hermes/__init__.py +572 -0
  36. package/adapters/tokenless/hermes/plugin.yaml +9 -0
  37. package/adapters/tokenless/hermes/scripts/detect.sh +80 -0
  38. package/adapters/tokenless/hermes/scripts/install.sh +60 -0
  39. package/adapters/tokenless/hermes/scripts/uninstall.sh +45 -0
  40. package/adapters/tokenless/manifest.json +147 -0
  41. package/adapters/tokenless/openclaw/dist/index.d.ts +27 -0
  42. package/adapters/tokenless/openclaw/dist/index.js +598 -0
  43. package/adapters/tokenless/openclaw/dist/tool_categories.json +99 -0
  44. package/adapters/tokenless/openclaw/index.ts +720 -0
  45. package/adapters/tokenless/openclaw/openclaw.plugin.json +40 -0
  46. package/adapters/tokenless/openclaw/package.json +24 -0
  47. package/adapters/tokenless/openclaw/scripts/detect.sh +102 -0
  48. package/adapters/tokenless/openclaw/scripts/install.sh +75 -0
  49. package/adapters/tokenless/openclaw/scripts/uninstall.sh +46 -0
  50. package/adapters/tokenless/openclaw/tsconfig.json +13 -0
  51. package/adapters/tokenless/opencode/plugin.js +246 -0
  52. package/adapters/tokenless/opencode/scripts/detect.sh +38 -0
  53. package/adapters/tokenless/opencode/scripts/install.sh +56 -0
  54. package/adapters/tokenless/opencode/scripts/uninstall.sh +29 -0
  55. package/adapters/tokenless/qoder/.qoder-plugin/plugin.json +11 -0
  56. package/adapters/tokenless/qoder/commands/tokenless-stats.md +8 -0
  57. package/adapters/tokenless/qoder/hooks/hooks.json +36 -0
  58. package/adapters/tokenless/qoder/hooks/run-hook.sh +51 -0
  59. package/adapters/tokenless/qoder/scripts/detect.sh +35 -0
  60. package/adapters/tokenless/qoder/scripts/install.sh +136 -0
  61. package/adapters/tokenless/qoder/scripts/uninstall.sh +106 -0
  62. package/adapters/tokenless/qwencode/qwen-extension.json +69 -0
  63. package/adapters/tokenless/qwencode/scripts/detect.sh +125 -0
  64. package/adapters/tokenless/qwencode/scripts/install.sh +128 -0
  65. package/adapters/tokenless/qwencode/scripts/uninstall.sh +62 -0
  66. package/bin/rtk +6 -0
  67. package/bin/tokenless +6 -0
  68. package/bin/toon +6 -0
  69. package/package.json +57 -0
  70. package/scripts/postinstall.js +208 -0
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bash
2
+ # install.sh — Install tokenless plugin into Hermes Agent via symlink + enable.
3
+ set -euo pipefail
4
+
5
+ AGENT="${ANOLISA_TARGET:-hermes}"
6
+ COMPONENT="${ANOLISA_COMPONENT:-tokenless}"
7
+ ADAPTER_DIR="${ANOLISA_ADAPTER_DIR:-$(cd "$(dirname "$0")/../.." && pwd)}"
8
+ HERMES_HOME="${HERMES_HOME:-$HOME/.hermes}"
9
+ HERMES_BIN="${HERMES_BIN:-}"
10
+ DRY_RUN="${ANOLISA_DRY_RUN:-0}"
11
+ export PATH="$HOME/.local/bin:${HERMES_HOME%/}/bin:/usr/local/bin:$PATH"
12
+
13
+ PLUGIN_SRC="$ADAPTER_DIR/hermes"
14
+ PLUGIN_DST="${HERMES_HOME%/}/plugins/tokenless"
15
+
16
+ echo "[${COMPONENT}] Installing ${AGENT} plugin..."
17
+
18
+ if [ ! -d "$PLUGIN_SRC" ]; then
19
+ echo "[${COMPONENT}] Plugin source not found: $PLUGIN_SRC" >&2
20
+ exit 1
21
+ fi
22
+
23
+ if [ -z "$HERMES_BIN" ]; then
24
+ HERMES_BIN="$(command -v hermes 2>/dev/null || true)"
25
+ fi
26
+
27
+ if [ ! -f "$PLUGIN_SRC/plugin.yaml" ] || [ ! -f "$PLUGIN_SRC/__init__.py" ]; then
28
+ echo "[${COMPONENT}] Missing plugin.yaml or __init__.py in $PLUGIN_SRC" >&2
29
+ exit 1
30
+ fi
31
+
32
+ if [ "$DRY_RUN" = "1" ]; then
33
+ echo "DRY-RUN: mkdir -p $PLUGIN_DST"
34
+ echo "DRY-RUN: ln -sfn $PLUGIN_SRC/__init__.py $PLUGIN_DST/__init__.py"
35
+ echo "DRY-RUN: ln -sfn $PLUGIN_SRC/plugin.yaml $PLUGIN_DST/plugin.yaml"
36
+ if [ -n "$HERMES_BIN" ] && [ -x "$HERMES_BIN" ]; then
37
+ echo "DRY-RUN: HERMES_HOME=${HERMES_HOME%/} $HERMES_BIN plugins enable tokenless"
38
+ else
39
+ echo "DRY-RUN: hermes CLI not found; plugin would need manual enable"
40
+ fi
41
+ exit 0
42
+ fi
43
+
44
+ mkdir -p "$PLUGIN_DST"
45
+
46
+ # Use symlinks so plugin stays synced with system install
47
+ ln -sfn "$PLUGIN_SRC/__init__.py" "$PLUGIN_DST/__init__.py"
48
+ ln -sfn "$PLUGIN_SRC/plugin.yaml" "$PLUGIN_DST/plugin.yaml"
49
+
50
+ echo "[${COMPONENT}] ${AGENT} plugin linked to $PLUGIN_DST (from $PLUGIN_SRC)."
51
+
52
+ # Enable via hermes CLI if available (adds to plugins.enabled in config.yaml)
53
+ if [ -n "$HERMES_BIN" ] && [ -x "$HERMES_BIN" ]; then
54
+ echo "[${COMPONENT}] Enabling ${AGENT} plugin..."
55
+ HERMES_HOME="${HERMES_HOME%/}" "$HERMES_BIN" plugins enable tokenless || {
56
+ echo "[${COMPONENT}] Warning: hermes plugins enable failed — enable manually via config.yaml."
57
+ }
58
+ else
59
+ echo "[${COMPONENT}] hermes CLI not found — add 'tokenless' to plugins.enabled in ${HERMES_HOME%/}/config.yaml."
60
+ fi
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env bash
2
+ # uninstall.sh — Disable and remove tokenless plugin from Hermes Agent.
3
+ set -euo pipefail
4
+
5
+ AGENT="${ANOLISA_TARGET:-hermes}"
6
+ COMPONENT="${ANOLISA_COMPONENT:-tokenless}"
7
+ HERMES_HOME="${HERMES_HOME:-$HOME/.hermes}"
8
+ HERMES_BIN="${HERMES_BIN:-}"
9
+ DRY_RUN="${ANOLISA_DRY_RUN:-0}"
10
+ export PATH="$HOME/.local/bin:${HERMES_HOME%/}/bin:/usr/local/bin:$PATH"
11
+
12
+ PLUGIN_DST="${HERMES_HOME%/}/plugins/tokenless"
13
+
14
+ echo "[${COMPONENT}] Uninstalling ${AGENT} plugin..."
15
+
16
+ if [ -z "$HERMES_BIN" ]; then
17
+ HERMES_BIN="$(command -v hermes 2>/dev/null || true)"
18
+ fi
19
+
20
+ if [ "$DRY_RUN" = "1" ]; then
21
+ if [ -n "$HERMES_BIN" ] && [ -x "$HERMES_BIN" ]; then
22
+ echo "DRY-RUN: HERMES_HOME=${HERMES_HOME%/} $HERMES_BIN plugins disable tokenless"
23
+ echo "DRY-RUN: HERMES_HOME=${HERMES_HOME%/} $HERMES_BIN plugins remove tokenless"
24
+ else
25
+ echo "DRY-RUN: hermes CLI not found; skip CLI disable/remove"
26
+ fi
27
+ echo "DRY-RUN: rm -f $PLUGIN_DST/__init__.py $PLUGIN_DST/plugin.yaml"
28
+ echo "DRY-RUN: rmdir $PLUGIN_DST || rm -rf $PLUGIN_DST"
29
+ exit 0
30
+ fi
31
+
32
+ # Disable via hermes CLI if available (removes from plugins.enabled in config.yaml)
33
+ if [ -n "$HERMES_BIN" ] && [ -x "$HERMES_BIN" ]; then
34
+ HERMES_HOME="${HERMES_HOME%/}" "$HERMES_BIN" plugins disable tokenless || true
35
+ HERMES_HOME="${HERMES_HOME%/}" "$HERMES_BIN" plugins remove tokenless || true
36
+ fi
37
+
38
+ # Always clean up filesystem artifacts (the CLI may leave the symlink behind
39
+ # when the plugin wasn't fully registered, e.g. partial install).
40
+ if [ -d "$PLUGIN_DST" ] || [ -L "$PLUGIN_DST" ]; then
41
+ rm -f "$PLUGIN_DST/__init__.py" "$PLUGIN_DST/plugin.yaml" 2>/dev/null || true
42
+ rmdir "$PLUGIN_DST" 2>/dev/null || rm -rf "$PLUGIN_DST" 2>/dev/null || true
43
+ fi
44
+
45
+ echo "[${COMPONENT}] ${AGENT} plugin uninstalled."
@@ -0,0 +1,147 @@
1
+ {
2
+ "component": "tokenless",
3
+ "version": "0.7.7",
4
+ "targets": {
5
+ "cosh": {
6
+ "compatibleVersions": "*",
7
+ "method": "extension",
8
+ "extensionFile": "common/cosh-extension.json",
9
+ "extensionDir": "extensions/tokenless",
10
+ "capabilities": {
11
+ "hooks": [
12
+ "tool-ready",
13
+ "rewrite",
14
+ "compress-response",
15
+ "compress-toon",
16
+ "compress-schema"
17
+ ],
18
+ "commands": ["tokenless-stats"]
19
+ }
20
+ },
21
+ "openclaw": {
22
+ "compatibleVersions": ">=5.0.0",
23
+ "capabilities": {
24
+ "plugins": ["tokenless"]
25
+ },
26
+ "actions": {
27
+ "detect": "openclaw/scripts/detect.sh",
28
+ "install": "openclaw/scripts/install.sh",
29
+ "uninstall": "openclaw/scripts/uninstall.sh"
30
+ }
31
+ },
32
+ "dsh": {
33
+ "compatibleVersions": ">=0.1.0-rc.2 <0.2.0",
34
+ "method": "plugin",
35
+ "pluginId": "@anolisa/dsh-tokenless",
36
+ "capabilities": {
37
+ "seams": ["tools/post-execute"],
38
+ "features": ["compress-response", "error-attribution", "stats"]
39
+ },
40
+ "bundle": {
41
+ "entry": "package.json",
42
+ "patch": "cordis.patch.yml",
43
+ "pluginEntry": "dist/index.js"
44
+ }
45
+ },
46
+ "hermes": {
47
+ "compatibleVersions": ">=1.0.0",
48
+ "capabilities": {
49
+ "hooks": [
50
+ "compress-response",
51
+ "compress-toon",
52
+ "rewrite",
53
+ "tool-ready"
54
+ ]
55
+ },
56
+ "actions": {
57
+ "detect": "hermes/scripts/detect.sh",
58
+ "install": "hermes/scripts/install.sh",
59
+ "uninstall": "hermes/scripts/uninstall.sh"
60
+ }
61
+ },
62
+ "qoder": {
63
+ "compatibleVersions": ">=0.2.0",
64
+ "capabilities": {
65
+ "hooks": [
66
+ "tool-ready",
67
+ "rewrite",
68
+ "compress-response"
69
+ ]
70
+ },
71
+ "actions": {
72
+ "detect": "qoder/scripts/detect.sh",
73
+ "install": "qoder/scripts/install.sh",
74
+ "uninstall": "qoder/scripts/uninstall.sh"
75
+ }
76
+ },
77
+ "claude-code": {
78
+ "compatibleVersions": ">=2.0.0",
79
+ "method": "plugin",
80
+ "marketplace": "anolisa-tokenless",
81
+ "pluginId": "tokenless@anolisa-tokenless",
82
+ "capabilities": {
83
+ "hooks": [
84
+ "rewrite",
85
+ "compress-response",
86
+ "compress-toon",
87
+ "tool-ready"
88
+ ]
89
+ },
90
+ "actions": {
91
+ "detect": "claude-code/scripts/detect.sh",
92
+ "install": "claude-code/scripts/install.sh",
93
+ "uninstall": "claude-code/scripts/uninstall.sh"
94
+ }
95
+ },
96
+ "codex": {
97
+ "compatibleVersions": "*",
98
+ "capabilities": {
99
+ "hooks": [
100
+ "tool-ready",
101
+ "rewrite",
102
+ "compress-response",
103
+ "compress-toon"
104
+ ]
105
+ },
106
+ "actions": {
107
+ "detect": "codex/scripts/detect.sh",
108
+ "install": "codex/scripts/install.sh",
109
+ "uninstall": "codex/scripts/uninstall.sh"
110
+ }
111
+ },
112
+ "opencode": {
113
+ "compatibleVersions": ">=1.0.0",
114
+ "capabilities": {
115
+ "hooks": [
116
+ "tool-ready",
117
+ "rewrite",
118
+ "compress-response",
119
+ "compress-toon",
120
+ "compress-schema"
121
+ ]
122
+ },
123
+ "actions": {
124
+ "detect": "opencode/scripts/detect.sh",
125
+ "install": "opencode/scripts/install.sh",
126
+ "uninstall": "opencode/scripts/uninstall.sh"
127
+ }
128
+ },
129
+ "qwencode": {
130
+ "compatibleVersions": ">=0.17.0",
131
+ "capabilities": {
132
+ "hooks": [
133
+ "rewrite",
134
+ "compress-response",
135
+ "compress-toon",
136
+ "compress-schema",
137
+ "tool-ready"
138
+ ]
139
+ },
140
+ "actions": {
141
+ "detect": "qwencode/scripts/detect.sh",
142
+ "install": "qwencode/scripts/install.sh",
143
+ "uninstall": "qwencode/scripts/uninstall.sh"
144
+ }
145
+ }
146
+ }
147
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Token-Less Unified Plugin for OpenClaw v5
3
+ *
4
+ * Combines multiple complementary optimisation strategies into a single plugin:
5
+ *
6
+ * 1. RTK command rewriting — transparently rewrites exec tool commands to
7
+ * their RTK equivalents (delegated to `rtk rewrite`).
8
+ * 2. Tokenless response compression — compresses tool responses via
9
+ * `tokenless compress-response` (removes debug/null/empty values).
10
+ * 3. TOON context compression — encodes JSON tool responses to TOON format
11
+ * via `tokenless compress-toon`, reducing token usage for structured data. When both
12
+ * response and TOON compression are enabled, they run sequentially:
13
+ * Response Compression strips noise → TOON eliminates JSON format overhead.
14
+ *
15
+ * Stats are recorded automatically by tokenless compress-response.
16
+ * RTK rewrite and proxy processes receive the same per-call context snapshot;
17
+ * the rewrite-context file remains a compatibility fallback for launch paths
18
+ * that do not preserve exec environment overrides.
19
+ */
20
+ declare const _default: {
21
+ id: string;
22
+ name: string;
23
+ version: string;
24
+ description: string;
25
+ register(api: any): void;
26
+ };
27
+ export default _default;