@qilin-agent/tmux-context 0.0.0-stage → 3.1.3
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/LICENSE +21 -0
- package/README.i18n.yaml +67 -0
- package/README.md +139 -2
- package/README.zh.md +140 -0
- package/lib/index.js +2254 -0
- package/lib/types/index.d.ts +65 -0
- package/package.json +50 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in request-preparation tmux-location context. Eligible step attempts
|
|
3
|
+
* append durable, source-attributed context naming the tmux session, window,
|
|
4
|
+
* and pane this agent process runs in, plus the window's pane-tree layout.
|
|
5
|
+
*
|
|
6
|
+
* The plugin pulls state once per turn, for the first request (`step === 1`), by
|
|
7
|
+
* running one `tmux display-message` through the `ctx.shell` executor service. It
|
|
8
|
+
* confirms this process genuinely runs inside the pane `$TMUX_PANE` names by
|
|
9
|
+
* matching the pane's `#{pane_tty}` against this process's controlling terminal,
|
|
10
|
+
* so a terminal that merely inherited `$TMUX`/`$TMUX_PANE` from a tmux ancestor
|
|
11
|
+
* (e.g. a VS Code integrated terminal) reads as "not in tmux". It re-injects
|
|
12
|
+
* only when the rendered tmux state changes since the last injection (a moved,
|
|
13
|
+
* renamed, or re-laid-out pane), with an optional `refreshIntervalMs` floor
|
|
14
|
+
* between injections. Absent tmux environment, an inherited-only environment,
|
|
15
|
+
* absent `ctx.shell`, or a failed query is a no-op, never an error: an executor
|
|
16
|
+
* rejection is contained and logged as a warning so the turn continues.
|
|
17
|
+
*
|
|
18
|
+
* @module @qilin-agent/tmux-context
|
|
19
|
+
*/
|
|
20
|
+
import type { Context } from '@qilin-agent/kylin';
|
|
21
|
+
import z from '@qilin-agent/schemastery';
|
|
22
|
+
import { z as zod } from 'zod';
|
|
23
|
+
import type { ContextFormed } from '@qilin-agent/llm';
|
|
24
|
+
declare module '@qilin-agent/llm' {
|
|
25
|
+
interface MessageSourceMap {
|
|
26
|
+
/** Location attribution; readers preserve the content without this producer.
|
|
27
|
+
* Its projection uses the kind to avoid repeated injection.
|
|
28
|
+
* @persistenceAttribution
|
|
29
|
+
*/
|
|
30
|
+
'tmux-context': {
|
|
31
|
+
kind: 'tmux-context';
|
|
32
|
+
} & ContextFormed;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Cordis plugin name used by loader diagnostics. */
|
|
36
|
+
export declare const name = "tmux-context";
|
|
37
|
+
/** The agent registry that owns pre-step processing. */
|
|
38
|
+
export declare const inject: string[];
|
|
39
|
+
/** Per-turn tmux-location scheduling. Invalid values fail plugin load. */
|
|
40
|
+
export interface Config {
|
|
41
|
+
/** Minimum milliseconds between durable injections in one session. Omit or set to 0 to inject on every eligible change. */
|
|
42
|
+
refreshIntervalMs?: number;
|
|
43
|
+
}
|
|
44
|
+
/** Schemastery validation for {@link Config}. */
|
|
45
|
+
export declare const Config: z<Config>;
|
|
46
|
+
declare const tmuxContextStateSchema: zod.ZodNullable<zod.ZodObject<{
|
|
47
|
+
state: zod.ZodString;
|
|
48
|
+
time: zod.ZodNumber;
|
|
49
|
+
}, zod.core.$strip>>;
|
|
50
|
+
type TmuxContextState = zod.infer<typeof tmuxContextStateSchema>;
|
|
51
|
+
/**
|
|
52
|
+
* Register a prepended pre-step listener for the lifetime of `ctx`.
|
|
53
|
+
* @param ctx - plugin context; the listener is disposed with it.
|
|
54
|
+
* @param config - durable refresh scheduling configuration.
|
|
55
|
+
* @throws when the refresh interval is invalid.
|
|
56
|
+
*/
|
|
57
|
+
declare module '@qilin-agent/session-projection/types' {
|
|
58
|
+
interface SessionProjectionStateMap {
|
|
59
|
+
/** The stable state block of this plugin's latest durable injection, or null. */
|
|
60
|
+
tmuxContext: TmuxContextState;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export declare function apply(ctx: Context, config: Config): void;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/tmux-context",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Opt-in durable per-step context with this agent's tmux pane and window location",
|
|
4
|
+
"version": "3.1.3",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/kkutysllb/QiLin.git",
|
|
11
|
+
"directory": "packages/context/tmux-context"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "lib/index.js",
|
|
18
|
+
"types": "lib/types/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./lib/types/index.d.ts",
|
|
22
|
+
"default": "./lib/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./src/*": "./src/*",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"lib/index.js",
|
|
29
|
+
"lib/types/**/*.d.ts"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"zod": "^4.4.3",
|
|
34
|
+
"@qilin-agent/schemastery": "~3.18.3"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@qilin-agent/agent": "3.1.3",
|
|
38
|
+
"@qilin-agent/shell": "3.1.3",
|
|
39
|
+
"@qilin-agent/session": "3.1.3",
|
|
40
|
+
"@qilin-agent/kylin": "~4.0.3",
|
|
41
|
+
"@qilin-agent/session-projection": "3.1.3"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@qilin-agent/agent": "3.1.3",
|
|
45
|
+
"@qilin-agent/agent-loop-testkit": "3.1.3",
|
|
46
|
+
"@qilin-agent/shell": "3.1.3",
|
|
47
|
+
"@qilin-agent/llm": "3.1.3",
|
|
48
|
+
"@qilin-agent/session": "3.1.3",
|
|
49
|
+
"@qilin-agent/system-prompt": "3.1.3",
|
|
50
|
+
"@qilin-agent/kylin": "~4.0.3",
|
|
51
|
+
"@qilin-agent/session-projection": "3.1.3"
|
|
52
|
+
}
|
|
6
53
|
}
|