context-mode 1.0.135 → 1.0.137
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/.codex-plugin/hooks.json +65 -0
- package/.codex-plugin/mcp.json +9 -0
- package/.codex-plugin/plugin.json +31 -0
- package/.openclaw-plugin/openclaw.plugin.json +1 -1
- package/.openclaw-plugin/package.json +1 -1
- package/README.md +53 -24
- package/build/adapters/codex/index.js +24 -3
- package/build/adapters/opencode/index.d.ts +1 -0
- package/build/adapters/opencode/index.js +25 -0
- package/build/adapters/opencode/plugin.d.ts +22 -0
- package/build/adapters/opencode/plugin.js +52 -0
- package/build/adapters/pi/extension.js +20 -4
- package/build/adapters/pi/mcp-bridge.d.ts +39 -2
- package/build/adapters/pi/mcp-bridge.js +184 -24
- package/build/lifecycle.d.ts +2 -51
- package/build/lifecycle.js +3 -67
- package/build/server.d.ts +19 -0
- package/build/server.js +141 -58
- package/build/session/db.d.ts +6 -0
- package/build/session/db.js +17 -3
- package/build/session/extract.js +39 -1
- package/build/util/sibling-mcp.d.ts +0 -40
- package/build/util/sibling-mcp.js +11 -116
- package/cli.bundle.mjs +131 -129
- package/configs/kilo/kilo.json +3 -7
- package/configs/opencode/opencode.json +3 -7
- package/hooks/codex/platform.mjs +1 -0
- package/hooks/codex/posttooluse.mjs +1 -0
- package/hooks/codex/precompact.mjs +1 -0
- package/hooks/codex/pretooluse.mjs +1 -0
- package/hooks/codex/sessionstart.mjs +1 -0
- package/hooks/codex/stop.mjs +1 -0
- package/hooks/codex/userpromptsubmit.mjs +1 -0
- package/hooks/core/routing.mjs +112 -10
- package/hooks/ensure-deps.mjs +14 -3
- package/hooks/normalize-hooks.mjs +101 -19
- package/hooks/session-db.bundle.mjs +3 -3
- package/hooks/session-extract.bundle.mjs +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -1
- package/server.bundle.mjs +112 -110
- package/build/openclaw-plugin.d.ts +0 -130
- package/build/openclaw-plugin.js +0 -626
- package/build/opencode-plugin.d.ts +0 -122
- package/build/opencode-plugin.js +0 -372
- package/build/pi-extension.d.ts +0 -14
- package/build/pi-extension.js +0 -451
- package/build/util/db-lock.d.ts +0 -65
- package/build/util/db-lock.js +0 -166
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenClaw TypeScript plugin entry point for context-mode.
|
|
3
|
-
*
|
|
4
|
-
* Exports an object with { id, name, configSchema, register(api) } for
|
|
5
|
-
* declarative metadata and config validation before code execution.
|
|
6
|
-
*
|
|
7
|
-
* register(api) registers:
|
|
8
|
-
* - before_tool_call hook — Routing enforcement (deny/modify/passthrough)
|
|
9
|
-
* - after_tool_call hook — Session event capture
|
|
10
|
-
* - command:new hook — Session initialization and cleanup
|
|
11
|
-
* - session_start hook — Re-key DB session to OpenClaw's session ID
|
|
12
|
-
* - before_compaction hook — Flush events to resume snapshot
|
|
13
|
-
* - after_compaction hook — Increment compact count
|
|
14
|
-
* - before_prompt_build (p=10) — Resume snapshot injection into system context
|
|
15
|
-
* - before_prompt_build (p=5) — Routing instruction injection into system context
|
|
16
|
-
* - context-mode engine — Context engine with compaction management
|
|
17
|
-
* - /ctx-stats command — Auto-reply command for session statistics
|
|
18
|
-
* - /ctx-doctor command — Auto-reply command for diagnostics
|
|
19
|
-
* - /ctx-upgrade command — Auto-reply command for upgrade
|
|
20
|
-
*
|
|
21
|
-
* Loaded by OpenClaw via: openclaw.extensions entry in package.json
|
|
22
|
-
*
|
|
23
|
-
* OpenClaw plugin paradigm:
|
|
24
|
-
* - Plugins export { id, name, configSchema, register(api) } for metadata
|
|
25
|
-
* - api.registerHook() for event-driven hooks
|
|
26
|
-
* - api.on() for typed lifecycle hooks
|
|
27
|
-
* - api.registerContextEngine() for compaction ownership
|
|
28
|
-
* - api.registerCommand() for auto-reply slash commands
|
|
29
|
-
* - Plugins run in-process with the Gateway (trusted code)
|
|
30
|
-
*/
|
|
31
|
-
import type { OpenClawToolDef } from "./openclaw/mcp-tools.js";
|
|
32
|
-
/** Context for auto-reply command handlers. */
|
|
33
|
-
interface CommandContext {
|
|
34
|
-
senderId?: string;
|
|
35
|
-
channel?: string;
|
|
36
|
-
isAuthorizedSender?: boolean;
|
|
37
|
-
args?: string;
|
|
38
|
-
commandBody?: string;
|
|
39
|
-
config?: Record<string, unknown>;
|
|
40
|
-
}
|
|
41
|
-
/** OpenClaw plugin API provided to the register function. */
|
|
42
|
-
interface OpenClawPluginApi {
|
|
43
|
-
registerHook(event: string, handler: (...args: unknown[]) => unknown, meta: {
|
|
44
|
-
name: string;
|
|
45
|
-
description: string;
|
|
46
|
-
}): void;
|
|
47
|
-
/**
|
|
48
|
-
* Register a typed lifecycle hook.
|
|
49
|
-
* Supported names: "session_start", "before_compaction", "after_compaction",
|
|
50
|
-
* "before_prompt_build"
|
|
51
|
-
*/
|
|
52
|
-
on(event: string, handler: (...args: unknown[]) => unknown, opts?: {
|
|
53
|
-
priority?: number;
|
|
54
|
-
}): void;
|
|
55
|
-
registerContextEngine(id: string, factory: () => ContextEngineInstance): void;
|
|
56
|
-
registerCommand?(cmd: {
|
|
57
|
-
name: string;
|
|
58
|
-
description: string;
|
|
59
|
-
acceptsArgs?: boolean;
|
|
60
|
-
requireAuth?: boolean;
|
|
61
|
-
handler: (ctx: CommandContext) => {
|
|
62
|
-
text: string;
|
|
63
|
-
} | Promise<{
|
|
64
|
-
text: string;
|
|
65
|
-
}>;
|
|
66
|
-
}): void;
|
|
67
|
-
registerCli?(factory: (ctx: {
|
|
68
|
-
program: unknown;
|
|
69
|
-
}) => void, meta: {
|
|
70
|
-
commands: string[];
|
|
71
|
-
}): void;
|
|
72
|
-
/**
|
|
73
|
-
* Register an agent tool (OpenClaw native registerTool) — see
|
|
74
|
-
* refs/platforms/openclaw/docs/plugins/building-plugins.md:116. Optional in
|
|
75
|
-
* the type so we degrade silently on legacy hosts that pre-date this API.
|
|
76
|
-
*/
|
|
77
|
-
registerTool?(tool: OpenClawToolDef, opts?: {
|
|
78
|
-
optional?: boolean;
|
|
79
|
-
}): void;
|
|
80
|
-
logger?: {
|
|
81
|
-
info: (...args: unknown[]) => void;
|
|
82
|
-
error: (...args: unknown[]) => void;
|
|
83
|
-
debug?: (...args: unknown[]) => void;
|
|
84
|
-
warn?: (...args: unknown[]) => void;
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
/** Context engine instance returned by the factory. */
|
|
88
|
-
interface ContextEngineInstance {
|
|
89
|
-
info: {
|
|
90
|
-
id: string;
|
|
91
|
-
name: string;
|
|
92
|
-
ownsCompaction: boolean;
|
|
93
|
-
};
|
|
94
|
-
ingest(data: unknown): Promise<{
|
|
95
|
-
ingested: boolean;
|
|
96
|
-
}>;
|
|
97
|
-
assemble(ctx: {
|
|
98
|
-
messages: unknown[];
|
|
99
|
-
}): Promise<{
|
|
100
|
-
messages: unknown[];
|
|
101
|
-
estimatedTokens: number;
|
|
102
|
-
}>;
|
|
103
|
-
compact(): Promise<{
|
|
104
|
-
ok: boolean;
|
|
105
|
-
compacted: boolean;
|
|
106
|
-
}>;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* OpenClaw plugin definition. The object form provides declarative metadata
|
|
110
|
-
* (id, name, configSchema) that OpenClaw can read without executing code.
|
|
111
|
-
* register() is called once per agent session with a fresh api object.
|
|
112
|
-
* Each call creates isolated closures (db, sessionId, hooks) — no shared state.
|
|
113
|
-
*/
|
|
114
|
-
declare const _default: {
|
|
115
|
-
id: string;
|
|
116
|
-
name: string;
|
|
117
|
-
configSchema: {
|
|
118
|
-
type: "object";
|
|
119
|
-
properties: {
|
|
120
|
-
enabled: {
|
|
121
|
-
type: "boolean";
|
|
122
|
-
default: boolean;
|
|
123
|
-
description: string;
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
additionalProperties: boolean;
|
|
127
|
-
};
|
|
128
|
-
register(api: OpenClawPluginApi): void;
|
|
129
|
-
};
|
|
130
|
-
export default _default;
|