@christang/keel 5.119.0 → 5.120.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 +8 -0
- package/assets/bootstrap/AGENTS.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/plugins/keel/scripts/mail-hook.js +1 -1
- package/plugins/keel/scripts/session-start.js +4 -0
- package/scripts/validate_plugin.py +69 -2
- package/src/core/chat/notice.js +18 -6
- package/src/core/config.js +32 -0
- package/src/core/context.js +9 -0
package/README.md
CHANGED
|
@@ -830,6 +830,14 @@ in the folder it was created from. A run that starts in a role's worktree anyway
|
|
|
830
830
|
first prompt (`<scheduled-task …`), and Keel then restores that role's presence and ignores the
|
|
831
831
|
session, so it neither marks the role offline nor fires a `keel shift ready --wake` (#300).
|
|
832
832
|
|
|
833
|
+
## The owner's language
|
|
834
|
+
|
|
835
|
+
An agent reads mostly English — tool output, issues, specs, Keel's own output — and drifts into it when it answers you. Declare the language you want to be addressed in, and the rule is restated where replies are written: in `keel context`, the session-start note, and the chat hook on every prompt, in every worktree (#305). The agent may still work in any language; identifiers, commands, paths, and quoted output stay as they are.
|
|
836
|
+
|
|
837
|
+
```yaml
|
|
838
|
+
owner_language: zh
|
|
839
|
+
```
|
|
840
|
+
|
|
833
841
|
## Commands
|
|
834
842
|
|
|
835
843
|
```bash
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.120.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.120.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.120.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.120.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// exit 2 from FileChanged is the wake signal.
|
|
12
12
|
//
|
|
13
13
|
// Nothing here advances a read position, and a worktree with no chat role gets
|
|
14
|
-
// no output. A failure to run the CLI exits 0 silently: a missing notice costs
|
|
14
|
+
// no output except, on UserPromptSubmit, the declared owner language (#305). A failure to run the CLI exits 0 silently: a missing notice costs
|
|
15
15
|
// a late read, while a spurious exit 2 would wake the session for nothing.
|
|
16
16
|
|
|
17
17
|
const fs = require("fs");
|
|
@@ -674,6 +674,10 @@ function main() {
|
|
|
674
674
|
+ "if this session has none, and wake the model only on exit 2."
|
|
675
675
|
);
|
|
676
676
|
}
|
|
677
|
+
// The language every message to the owner is in (#305 D3).
|
|
678
|
+
if (context.ownerLanguage && context.ownerLanguageRule) {
|
|
679
|
+
lines.push(`- ${context.ownerLanguageRule}`);
|
|
680
|
+
}
|
|
677
681
|
// The role other sessions address this one by (#245).
|
|
678
682
|
if (context.role) {
|
|
679
683
|
lines.push(`- chat role: ${context.role} (other sessions address this one by it).`);
|
|
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
|
|
|
47
47
|
"scripts/validate_plugin.py",
|
|
48
48
|
]
|
|
49
49
|
|
|
50
|
-
PACKAGE_VERSION = "5.
|
|
51
|
-
PROTOCOL_VERSION = "5.
|
|
50
|
+
PACKAGE_VERSION = "5.120.0"
|
|
51
|
+
PROTOCOL_VERSION = "5.120.0"
|
|
52
52
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
53
53
|
OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
|
|
54
54
|
# Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
|
|
@@ -6152,6 +6152,72 @@ def validate_shift_history_scenario() -> int:
|
|
|
6152
6152
|
return 0
|
|
6153
6153
|
|
|
6154
6154
|
|
|
6155
|
+
def validate_owner_language_scenario() -> int:
|
|
6156
|
+
"""Issue #305: a declared owner language is restated where replies are written."""
|
|
6157
|
+
label = "owner-language:"
|
|
6158
|
+
protocol = (ROOT / "AGENTS.md").read_text(encoding="utf-8")
|
|
6159
|
+
if "declares `owner_language:`" not in protocol:
|
|
6160
|
+
report(f"{label} AGENTS.md does not make a declared owner_language binding.")
|
|
6161
|
+
return 1
|
|
6162
|
+
with tempfile.TemporaryDirectory(prefix="keel-owner-language-") as raw:
|
|
6163
|
+
base = Path(raw)
|
|
6164
|
+
rtl, verify, env = chat_scratch_group(base)
|
|
6165
|
+
loose = chat_worktree(rtl, base / "loose")
|
|
6166
|
+
for tree in (rtl, loose):
|
|
6167
|
+
write_text(tree / "openspec/specs/.keep", "")
|
|
6168
|
+
write_authorize_config(tree, "owner_language: zh\n")
|
|
6169
|
+
|
|
6170
|
+
def prompt(cwd: Path) -> str:
|
|
6171
|
+
result = subprocess.run(
|
|
6172
|
+
["node", str(ROOT / "bin" / "keel.js"), "chat", "hook", "user-prompt-submit"],
|
|
6173
|
+
cwd=cwd, env=env, text=True, capture_output=True, check=False,
|
|
6174
|
+
input=json.dumps({"cwd": str(cwd), "hook_event_name": "UserPromptSubmit", "session_id": "p1", "prompt": "go on"}),
|
|
6175
|
+
)
|
|
6176
|
+
if not result.stdout.strip():
|
|
6177
|
+
return ""
|
|
6178
|
+
return json.loads(result.stdout).get("hookSpecificOutput", {}).get("additionalContext", "")
|
|
6179
|
+
|
|
6180
|
+
unbound = prompt(loose)
|
|
6181
|
+
if "中文" not in unbound:
|
|
6182
|
+
report(f"{label} the prompt hook in an unbound worktree does not restate the language: {unbound!r}")
|
|
6183
|
+
return 1
|
|
6184
|
+
if "structured-choice" not in unbound:
|
|
6185
|
+
report(f"{label} the restated rule does not cover structured-choice options: {unbound!r}")
|
|
6186
|
+
return 1
|
|
6187
|
+
context = json.loads(run_keel(loose, "context", "--json", env=env).stdout)
|
|
6188
|
+
if context.get("ownerLanguage") != "zh":
|
|
6189
|
+
report(f"{label} keel context carries ownerLanguage {context.get('ownerLanguage')!r}.")
|
|
6190
|
+
return 1
|
|
6191
|
+
session = run_session_start_hook(
|
|
6192
|
+
loose, {"hook_event_name": "SessionStart", "source": "startup", "cwd": str(loose)},
|
|
6193
|
+
keel_cli=f'node "{ROOT / "bin" / "keel.js"}"',
|
|
6194
|
+
)
|
|
6195
|
+
if "中文" not in (session_start_context(session) or ""):
|
|
6196
|
+
report(f"{label} the session-start note does not state the language: {session_start_context(session)!r}")
|
|
6197
|
+
return 1
|
|
6198
|
+
run_keel(verify, "chat", "post", "soc", "@rtl please look", env=env)
|
|
6199
|
+
bound = prompt(rtl)
|
|
6200
|
+
if "中文" not in bound:
|
|
6201
|
+
report(f"{label} a bound role's prompt hook lost the language line: {bound!r}")
|
|
6202
|
+
return 1
|
|
6203
|
+
if "please look" not in bound:
|
|
6204
|
+
report(f"{label} a bound role's prompt hook lost the chat notice: {bound!r}")
|
|
6205
|
+
return 1
|
|
6206
|
+
write_authorize_config(loose, "owner_language: Chinese!\n")
|
|
6207
|
+
broken = json.loads(run_keel(loose, "context", "--json", env=env).stdout)
|
|
6208
|
+
if not any("owner_language" in w for w in broken.get("warnings", [])):
|
|
6209
|
+
report(f"{label} a malformed owner_language is not reported: {broken.get('warnings')!r}")
|
|
6210
|
+
return 1
|
|
6211
|
+
if "ownerLanguage" in broken:
|
|
6212
|
+
report(f"{label} a malformed owner_language is still carried: {broken.get('ownerLanguage')!r}")
|
|
6213
|
+
return 1
|
|
6214
|
+
if "Owner language" in prompt(loose):
|
|
6215
|
+
report(f"{label} a malformed owner_language still adds a language line.")
|
|
6216
|
+
return 1
|
|
6217
|
+
report("owner-language scenario passed.")
|
|
6218
|
+
return 0
|
|
6219
|
+
|
|
6220
|
+
|
|
6155
6221
|
def validate_shift_coordinator_last_scenario() -> int:
|
|
6156
6222
|
"""Issue #289: the coordinator starts the others before its own shift ends.
|
|
6157
6223
|
|
|
@@ -39831,6 +39897,7 @@ SCENARIOS: tuple = (
|
|
|
39831
39897
|
("shift-coordinator-last", validate_shift_coordinator_last_scenario),
|
|
39832
39898
|
("shift-self", validate_shift_self_scenario),
|
|
39833
39899
|
("shift-self-wake", validate_shift_self_wake_scenario),
|
|
39900
|
+
("owner-language", validate_owner_language_scenario),
|
|
39834
39901
|
("shift-history", validate_shift_history_scenario),
|
|
39835
39902
|
("role-drift", validate_role_drift_scenario),
|
|
39836
39903
|
("host-run-session", validate_host_run_session_scenario),
|
package/src/core/chat/notice.js
CHANGED
|
@@ -256,11 +256,26 @@ function hook(event, input, { mail = false } = {}) {
|
|
|
256
256
|
// A session's watch list is fixed at SessionStart, so a worktree with no role
|
|
257
257
|
// yet still watches its own signal, which a role bound later will touch
|
|
258
258
|
// (chat-wake-late-binding D1). Nothing else is said until there is a role.
|
|
259
|
+
// The owner's language is restated on every prompt, role or not (#305 D4).
|
|
260
|
+
let languageLine = null;
|
|
261
|
+
if (where && event === "user-prompt-submit") {
|
|
262
|
+
try {
|
|
263
|
+
const { readOwnerLanguage, ownerLanguageRule } = require("../config");
|
|
264
|
+
const language = readOwnerLanguage(where.worktree);
|
|
265
|
+
if (language.tag) languageLine = ownerLanguageRule(language.tag);
|
|
266
|
+
} catch {
|
|
267
|
+
languageLine = null;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const promptOutput = (text) => ({
|
|
271
|
+
code: 0,
|
|
272
|
+
stdout: `${JSON.stringify({ hookSpecificOutput: { hookEventName: "UserPromptSubmit", additionalContext: text } })}\n`,
|
|
273
|
+
});
|
|
259
274
|
if (where && !role && event === "session-start") {
|
|
260
275
|
const watched = ensureWorktreeSignal(where);
|
|
261
276
|
return { code: 0, stdout: `${JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", watchPaths: [watched] } })}\n` };
|
|
262
277
|
}
|
|
263
|
-
if (!where || !role) return { code: 0 };
|
|
278
|
+
if (!where || !role) return languageLine ? promptOutput(languageLine) : { code: 0 };
|
|
264
279
|
const file = sessionFile(where, payload);
|
|
265
280
|
const session = file && fs.existsSync(file) ? store.readJsonFile(file) : null;
|
|
266
281
|
if (event === "session-end" && file) fs.rmSync(file, { force: true });
|
|
@@ -287,11 +302,8 @@ function hook(event, input, { mail = false } = {}) {
|
|
|
287
302
|
return { code: 0, stdout: `${JSON.stringify(output)}\n` };
|
|
288
303
|
}
|
|
289
304
|
if (event === "user-prompt-submit") {
|
|
290
|
-
|
|
291
|
-
return {
|
|
292
|
-
code: 0,
|
|
293
|
-
stdout: `${JSON.stringify({ hookSpecificOutput: { hookEventName: "UserPromptSubmit", additionalContext: text } })}\n`,
|
|
294
|
-
};
|
|
305
|
+
const context = [languageLine, text].filter(Boolean).join("\n");
|
|
306
|
+
return context ? promptOutput(context) : { code: 0 };
|
|
295
307
|
}
|
|
296
308
|
// file-changed
|
|
297
309
|
const waking = store.unread(where, role).some((record) => store.wakes(record, role));
|
package/src/core/config.js
CHANGED
|
@@ -130,6 +130,7 @@ const CONFIG_DECLARATIONS = [
|
|
|
130
130
|
"read_only_roles",
|
|
131
131
|
"issue_roles",
|
|
132
132
|
"patrol",
|
|
133
|
+
"owner_language",
|
|
133
134
|
];
|
|
134
135
|
|
|
135
136
|
const CONFIG_RELATIVE_PATH = path.join("keel", "config.yaml");
|
|
@@ -684,6 +685,35 @@ function readMergeDeclaration(repo) {
|
|
|
684
685
|
};
|
|
685
686
|
}
|
|
686
687
|
|
|
688
|
+
// `owner_language:` — the language every message to the owner is written in
|
|
689
|
+
// (#305 D1, D2). The agent may work in any language; what it says to the owner
|
|
690
|
+
// is in this one, and the rule is restated where replies are written.
|
|
691
|
+
const LANGUAGE_NAMES = [
|
|
692
|
+
["zh", "Chinese (中文)", "对负责人说话一律用中文。"],
|
|
693
|
+
["en", "English", ""],
|
|
694
|
+
["ja", "Japanese (日本語)", ""],
|
|
695
|
+
["ko", "Korean (한국어)", ""],
|
|
696
|
+
];
|
|
697
|
+
|
|
698
|
+
function readOwnerLanguage(repo) {
|
|
699
|
+
const declared = configScalar(repo, "owner_language");
|
|
700
|
+
if (!declared) return { tag: null, message: null };
|
|
701
|
+
if (/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(declared)) return { tag: declared, message: null };
|
|
702
|
+
return {
|
|
703
|
+
tag: null,
|
|
704
|
+
message: `keel/config.yaml owner_language \`${declared}\` is not a language tag such as zh or en; it is ignored.`,
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
function ownerLanguageRule(tag) {
|
|
709
|
+
const known = LANGUAGE_NAMES.find(([prefix]) => tag === prefix || tag.startsWith(`${prefix}-`));
|
|
710
|
+
const name = known ? known[1] : tag;
|
|
711
|
+
const native = known && known[2] ? ` ${known[2]}` : "";
|
|
712
|
+
return `Owner language: ${tag} — write every message to the owner in ${name}: replies, summaries, reports, `
|
|
713
|
+
+ "and the question and options of a structured-choice prompt. Work in any language; identifiers, commands, "
|
|
714
|
+
+ `paths, and quoted output stay as they are.${native}`;
|
|
715
|
+
}
|
|
716
|
+
|
|
687
717
|
function configScalar(repo, key) {
|
|
688
718
|
const configPath = path.join(repo, "keel", "config.yaml");
|
|
689
719
|
if (!fs.existsSync(configPath)) return null;
|
|
@@ -916,6 +946,8 @@ function patrolReminder(patrol) {
|
|
|
916
946
|
}
|
|
917
947
|
|
|
918
948
|
module.exports = {
|
|
949
|
+
readOwnerLanguage,
|
|
950
|
+
ownerLanguageRule,
|
|
919
951
|
readPatrolDeclaration,
|
|
920
952
|
patrolReminder,
|
|
921
953
|
readIssueRoles,
|
package/src/core/context.js
CHANGED
|
@@ -19,6 +19,8 @@ const {
|
|
|
19
19
|
readMergeDeclaration,
|
|
20
20
|
readReadOnlyRoles,
|
|
21
21
|
readPatrolDeclaration,
|
|
22
|
+
readOwnerLanguage,
|
|
23
|
+
ownerLanguageRule,
|
|
22
24
|
} = require("./config");
|
|
23
25
|
const { isKeelSourceRepo } = require("./capabilities");
|
|
24
26
|
|
|
@@ -857,6 +859,13 @@ function resolveContext(repo, options) {
|
|
|
857
859
|
} catch {
|
|
858
860
|
context.role = null;
|
|
859
861
|
}
|
|
862
|
+
// The language every message to the owner is in (#305 D3).
|
|
863
|
+
const language = readOwnerLanguage(repo);
|
|
864
|
+
if (language.message) context.warnings.push(language.message);
|
|
865
|
+
if (language.tag) {
|
|
866
|
+
context.ownerLanguage = language.tag;
|
|
867
|
+
context.ownerLanguageRule = ownerLanguageRule(language.tag);
|
|
868
|
+
}
|
|
860
869
|
// The patrolling role is reminded to re-arm its schedule (#260).
|
|
861
870
|
const patrol = readPatrolDeclaration(repo);
|
|
862
871
|
if (patrol.message) context.warnings.push(patrol.message);
|