@christang/keel 5.96.1 → 5.97.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/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.97.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.97.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.97.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.97.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",
|
|
@@ -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.97.0"
|
|
51
|
+
PROTOCOL_VERSION = "5.97.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
|
|
@@ -3708,6 +3708,73 @@ def validate_chat_role_direct_scenario() -> int:
|
|
|
3708
3708
|
return 0
|
|
3709
3709
|
|
|
3710
3710
|
|
|
3711
|
+
def validate_chat_shared_app_direct_scenario() -> int:
|
|
3712
|
+
"""Owner's decision of 2026-10-05: the shared app may serve one role.
|
|
3713
|
+
|
|
3714
|
+
Mapping the shared app's own bot user to a role in `slack.bots` makes it
|
|
3715
|
+
take that role's direct messages on its existing connection, without a
|
|
3716
|
+
second one, and post the role's answers as itself.
|
|
3717
|
+
"""
|
|
3718
|
+
label = "chat-shared-app-direct:"
|
|
3719
|
+
if chat_bridge_node_missing("chat-shared-app-direct"):
|
|
3720
|
+
return 3
|
|
3721
|
+
FakeSlack = fake_slack_class()
|
|
3722
|
+
with tempfile.TemporaryDirectory(prefix="keel-chat-shared-direct-") as raw, FakeSlack() as slack:
|
|
3723
|
+
base = Path(raw)
|
|
3724
|
+
rtl, _verify, env = chat_scratch_group(base)
|
|
3725
|
+
chat_slack_config(rtl, {"soc": "CSOC"}, bots={"UBOT": "rtl"})
|
|
3726
|
+
benv = chat_bridge_environment(env, base / "home", slack)
|
|
3727
|
+
run_keel(rtl, "chat", "bridge", "add", env=benv)
|
|
3728
|
+
bridge = start_chat_bridge(rtl, benv)
|
|
3729
|
+
try:
|
|
3730
|
+
if not slack.wait_for(lambda: slack.sockets_for("xapp-test-app"), 10):
|
|
3731
|
+
report(f"{label} the shared app never connected: {stop_chat_bridge(bridge).strip()}")
|
|
3732
|
+
return 1
|
|
3733
|
+
slack.push(slack_event("DUOWNER", channel_type="im", user="UOWNER", text="status?", ts="1800000001.000100"), app="xapp-test-app")
|
|
3734
|
+
if not slack.wait_for(lambda: chat_records_with(rtl, "dm-owner--rtl", "status?")):
|
|
3735
|
+
report(f"{label} the owner's direct message to the shared app did not reach dm-owner--rtl.")
|
|
3736
|
+
return 1
|
|
3737
|
+
if "from: owner" not in chat_records_with(rtl, "dm-owner--rtl", "status?")[0]:
|
|
3738
|
+
report(f"{label} the direct message was not recorded from owner.")
|
|
3739
|
+
return 1
|
|
3740
|
+
answered = run_keel(rtl, "chat", "dm", "owner", "all green", env=benv)
|
|
3741
|
+
if answered.returncode != 0:
|
|
3742
|
+
report(f"{label} keel chat dm owner failed: {answered.stderr.strip()}")
|
|
3743
|
+
return 1
|
|
3744
|
+
if not slack.wait_for(lambda: any("all green" in m.get("text", "") for m in slack.messages.get("DUOWNER", []))):
|
|
3745
|
+
report(f"{label} rtl's answer never reached the owner's direct-message channel.")
|
|
3746
|
+
return 1
|
|
3747
|
+
sent = [c["params"] for c in slack.calls_to("chat.postMessage") if "all green" in c["params"].get("text", "")]
|
|
3748
|
+
if len(sent) != 1:
|
|
3749
|
+
report(f"{label} rtl's answer was posted {len(sent)} times, not once.")
|
|
3750
|
+
return 1
|
|
3751
|
+
if sent[0].get("_auth") != "Bearer xoxb-test-bot":
|
|
3752
|
+
report(f"{label} rtl's answer did not use the shared token: {sent[0].get('_auth')!r}")
|
|
3753
|
+
return 1
|
|
3754
|
+
if len(slack.sockets_for("xapp-test-app")) != 1:
|
|
3755
|
+
report(f"{label} the shared app token holds {len(slack.sockets_for('xapp-test-app'))} connections, not one.")
|
|
3756
|
+
return 1
|
|
3757
|
+
if bot_status(rtl, benv, "shared").get("direct") is not True:
|
|
3758
|
+
report(f"{label} status does not report the shared app's direct messages as connected: {bot_status(rtl, benv, 'shared')!r}")
|
|
3759
|
+
return 1
|
|
3760
|
+
finally:
|
|
3761
|
+
stop_chat_bridge(bridge)
|
|
3762
|
+
|
|
3763
|
+
for relative in ("docs/chat-slack-setup.md", "docs/chat-slack-setup.zh-CN.md"):
|
|
3764
|
+
text = (ROOT / relative).read_text(encoding="utf-8")
|
|
3765
|
+
if "im:history" not in text:
|
|
3766
|
+
report(f"{label} {relative} does not name the im:history scope direct messages need.")
|
|
3767
|
+
return 1
|
|
3768
|
+
if not any(phrase in text for phrase in ("shared app's own bot user", "共用 app 自己的 bot 用户")):
|
|
3769
|
+
report(f"{label} {relative} does not describe direct messages through the shared app.")
|
|
3770
|
+
return 1
|
|
3771
|
+
if "chat-shared-app-direct" not in {name for name, _ in SCENARIOS}:
|
|
3772
|
+
report(f"{label} scenario is not registered.")
|
|
3773
|
+
return 1
|
|
3774
|
+
report("chat-shared-app-direct scenario passed.")
|
|
3775
|
+
return 0
|
|
3776
|
+
|
|
3777
|
+
|
|
3711
3778
|
def validate_chat_shared_bots_scenario() -> int:
|
|
3712
3779
|
"""Issue #187: one registered bot is a different role in each project.
|
|
3713
3780
|
|
|
@@ -36571,6 +36638,10 @@ SCENARIOS: tuple = (
|
|
|
36571
36638
|
"chat-role-direct",
|
|
36572
36639
|
validate_chat_role_direct_scenario,
|
|
36573
36640
|
),
|
|
36641
|
+
(
|
|
36642
|
+
"chat-shared-app-direct",
|
|
36643
|
+
validate_chat_shared_app_direct_scenario,
|
|
36644
|
+
),
|
|
36574
36645
|
(
|
|
36575
36646
|
"chat-role-apps-are-documented",
|
|
36576
36647
|
validate_chat_role_apps_are_documented_scenario,
|
package/src/core/chat/bridge.js
CHANGED
|
@@ -582,6 +582,10 @@ async function handleEvent(ctx, event) {
|
|
|
582
582
|
return;
|
|
583
583
|
}
|
|
584
584
|
if (event.type !== "message") return;
|
|
585
|
+
if (event.channel_type === "im") {
|
|
586
|
+
if (ctx.sharedDirect) handleDirectEvent(ctx, ctx.sharedDirect, event);
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
585
589
|
const channel = event.channel;
|
|
586
590
|
if (!projectsFor(ctx, channel).length) return;
|
|
587
591
|
switch (event.subtype) {
|
|
@@ -753,13 +757,13 @@ function botReport(ctx) {
|
|
|
753
757
|
return [...(ctx.bots || new Map()).values()].map((app) => {
|
|
754
758
|
let directNote = null;
|
|
755
759
|
if (app.state === "verified" && app.appToken && app.serves.length > 1) directNote = `off: serves ${app.serves.length} roles, and a direct message cannot say which project it is for`;
|
|
756
|
-
else if (app.state === "verified" && !app.appToken) directNote = `off: no app:${app.name} token`;
|
|
760
|
+
else if (app.state === "verified" && !app.appToken) directNote = app.shared ? "off: no shared app-level token" : `off: no app:${app.name} token`;
|
|
757
761
|
return {
|
|
758
762
|
bot: app.name,
|
|
759
763
|
state: app.state,
|
|
760
764
|
...(app.reason ? { reason: app.reason } : {}),
|
|
761
765
|
roles: app.serves.map((entry) => entry.label),
|
|
762
|
-
direct: Boolean(app.connected),
|
|
766
|
+
direct: Boolean(app.shared ? app.serves.length === 1 && ctx.connected : app.connected),
|
|
763
767
|
...(directNote ? { direct_note: directNote } : {}),
|
|
764
768
|
invite: [...app.invite].sort(),
|
|
765
769
|
};
|
|
@@ -787,6 +791,14 @@ async function verifyBots(ctx) {
|
|
|
787
791
|
}
|
|
788
792
|
bots.set(name, app);
|
|
789
793
|
}
|
|
794
|
+
// The shared app serves a role too when a project maps its own bot user to
|
|
795
|
+
// one (chat-shared-app-direct D1). Its tokens and connection are ctx's.
|
|
796
|
+
if (ctx.self.user_id && ctx.projects.some((project) => project.settings.bots[ctx.self.user_id])) {
|
|
797
|
+
bots.set("shared", {
|
|
798
|
+
name: "shared", shared: true, role: null, token: ctx.token, appToken: ctx.appToken, state: "verified", reason: null,
|
|
799
|
+
user_id: ctx.self.user_id, bot_id: ctx.self.bot_id, serves: [], invite: new Set(), connected: false, socket: null, ims: new Map(),
|
|
800
|
+
});
|
|
801
|
+
}
|
|
790
802
|
for (const project of ctx.projects) {
|
|
791
803
|
project.roleBots = new Map();
|
|
792
804
|
for (const app of bots.values()) {
|
|
@@ -886,9 +898,18 @@ async function createContext(log, { needApp }) {
|
|
|
886
898
|
ctx.bots = await verifyBots(ctx);
|
|
887
899
|
for (const project of ctx.projects) project.directApps = directApps(ctx).filter((app) => app.serves[0].project === project);
|
|
888
900
|
for (const app of directApps(ctx)) {
|
|
901
|
+
if (app.shared) continue;
|
|
889
902
|
app.onHello = () => catchUpDirect(ctx, app);
|
|
890
903
|
app.onEvent = (event) => handleDirectEvent(ctx, app, event);
|
|
891
904
|
}
|
|
905
|
+
// Direct messages to the shared app arrive on its one connection (D3).
|
|
906
|
+
ctx.sharedDirect = directApps(ctx).find((app) => app.shared) || null;
|
|
907
|
+
if (ctx.sharedDirect) {
|
|
908
|
+
ctx.onHello = async () => {
|
|
909
|
+
await catchUp(ctx);
|
|
910
|
+
await catchUpDirect(ctx, ctx.sharedDirect);
|
|
911
|
+
};
|
|
912
|
+
}
|
|
892
913
|
// Posts and actions through a verified role app are this bridge's own (D5).
|
|
893
914
|
const verified = [...ctx.bots.values()].filter((app) => app.state === "verified");
|
|
894
915
|
ctx.ownBots = new Set([ctx.self.bot_id, ...verified.map((app) => app.bot_id)].filter(Boolean));
|
|
@@ -971,7 +992,7 @@ async function keepConnected(ctx, conn) {
|
|
|
971
992
|
}
|
|
972
993
|
|
|
973
994
|
function connections(ctx) {
|
|
974
|
-
return [ctx, ...directApps(ctx)];
|
|
995
|
+
return [ctx, ...directApps(ctx).filter((app) => !app.shared)];
|
|
975
996
|
}
|
|
976
997
|
|
|
977
998
|
function packageVersion() {
|