@jaxonshaw/multi-model-kit 0.1.1 → 0.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/INSTALL-AGENT.md +36 -6
- package/README.md +4 -4
- package/bin/model-route +9 -2
- package/bin/quota-status +15 -8
- package/config/defaults.json +1 -0
- package/config/paseo-agent-profiles.json +63 -0
- package/install.sh +320 -31
- package/package.json +4 -1
- package/plugins/paseo-fork/index.server.ts +48 -0
- package/plugins/paseo-fork/paseo-plugin.json +8 -0
- package/skills/dispatch/SKILL.md +6 -5
- package/skills/dispatch/references/brief-template.md +1 -0
- package/skills/dispatch/references/paseo.md +6 -3
- package/skills/dispatch/references/watch-paseo.md +57 -43
- package/skills/dispatch/references/watch.md +1 -1
- package/skills/task-handoff/SKILL.md +103 -30
- package/skills/task-handoff/references/handoff-template.md +8 -7
- package/skills/task-handoff/references/takeover-prompt.md +3 -3
package/install.sh
CHANGED
|
@@ -30,6 +30,7 @@ import stat
|
|
|
30
30
|
import subprocess
|
|
31
31
|
import sys
|
|
32
32
|
import tempfile
|
|
33
|
+
import time
|
|
33
34
|
|
|
34
35
|
ERROR, DECISION, CONFLICT = 1, 2, 3
|
|
35
36
|
NAME = "multi-model-kit"
|
|
@@ -50,8 +51,14 @@ RECEIPT = CONFIG.with_name("install-receipt.json")
|
|
|
50
51
|
STORE = HOME / ".local/share" / NAME
|
|
51
52
|
CURRENT = STORE / "current"
|
|
52
53
|
AGY = GEMINI / "antigravity-cli/settings.json"
|
|
54
|
+
PASEO_CONFIG = Path(os.environ.get("PASEO_HOME") or HOME / ".paseo").expanduser() / "config.json"
|
|
55
|
+
PROFILE_TEMPLATES = ROOT / "config/paseo-agent-profiles.json"
|
|
56
|
+
PASEO_RELOAD_MINIMUM = (0, 5, 0) # Paseo CHANGELOG.md, PR #3365
|
|
57
|
+
PASEO_PROFILE_PROMPT_MINIMUM = (0, 18, 0) # Paseo CHANGELOG.md, PR #10996
|
|
53
58
|
QUOTA_ID = "multi-model-kit-usage"
|
|
59
|
+
FORK_ID = "multi-model-kit-fork"
|
|
54
60
|
ZERO_SUB_URL = "https://github.com/kapybara-org/zerosub"
|
|
61
|
+
ZEROSUB_STATES = ("absent", "fork-off", "fork-on")
|
|
55
62
|
PATHS = {
|
|
56
63
|
"claude": (CLAUDE / "CLAUDE.md", CLAUDE / "skills"),
|
|
57
64
|
"codex": (CODEX / "AGENTS.md", HOME / ".agents/skills"),
|
|
@@ -356,14 +363,171 @@ def connection_info():
|
|
|
356
363
|
"gemini": bool(shutil.which("agy") or shutil.which("gemini"))}
|
|
357
364
|
|
|
358
365
|
|
|
359
|
-
def
|
|
360
|
-
output = checked([str(ROOT / "bin/model-route"),
|
|
366
|
+
def model_route(config, *args):
|
|
367
|
+
output = checked([str(ROOT / "bin/model-route"), *args, "--config-stdin"],
|
|
361
368
|
capture=True, input_text=json.dumps(config))
|
|
362
|
-
|
|
369
|
+
return json.loads(output)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def role_preview(config):
|
|
373
|
+
routes = model_route(config, "--preview")
|
|
363
374
|
return {role: {key: route[key] for key in ("primary", "alternatives")}
|
|
364
375
|
for role, route in routes.items()}
|
|
365
376
|
|
|
366
377
|
|
|
378
|
+
def agent_profiles(config, routes):
|
|
379
|
+
enabled = config.get("enabled", DEFAULTS["enabled"])
|
|
380
|
+
roles = {
|
|
381
|
+
"implement-design": "implement", "backend-debug-research": "backend",
|
|
382
|
+
"writing": "write", "long-form-writing": "write-long", "quick-tasks": "search",
|
|
383
|
+
"locate-mechanical": "mechanical", "translation": "translate",
|
|
384
|
+
}
|
|
385
|
+
candidates = {key: routes[role]["primary"] for key, role in roles.items()}
|
|
386
|
+
leads = {}
|
|
387
|
+
for provider in enabled:
|
|
388
|
+
# Lead profiles use provider tiers, independent of the routed lead's role overrides.
|
|
389
|
+
lead_config = {**config,
|
|
390
|
+
"roles": {**config.get("roles", {}), "lead": {
|
|
391
|
+
"provider": provider, "effort": "high", "fallback": []}},
|
|
392
|
+
"roleModels": {**config.get("roleModels", {}), "lead": {}}}
|
|
393
|
+
leads[provider] = model_route(lead_config, "lead", "--tier", "large")["primary"]
|
|
394
|
+
candidates[f"lead-{provider}"] = leads[provider]
|
|
395
|
+
|
|
396
|
+
reviews = []
|
|
397
|
+
for slot, author in (("review-codex", "claude"), ("review-claude", "codex")):
|
|
398
|
+
# The actual author model is unavailable at install time. Use the lead
|
|
399
|
+
# model to resolve the second read if the author and reviewer share a provider.
|
|
400
|
+
author_model = (leads.get(author) or next(iter(leads.values())))["model"]
|
|
401
|
+
review = model_route(config, "review", "--author", author, "--author-model", author_model)
|
|
402
|
+
if review["primary"]:
|
|
403
|
+
reviews.append((slot, author, review["primary"], review["reviewMode"]))
|
|
404
|
+
distinct_reviewers = {(route["provider"], route["model"]) for _, _, route, _ in reviews}
|
|
405
|
+
collapsed = len(reviews) > 1 and (len(leads) == 1 or len(distinct_reviewers) == 1)
|
|
406
|
+
template_reviewers = len(reviews) == 2 and all(slot == f"review-{route['provider']}"
|
|
407
|
+
for slot, _, route, _ in reviews)
|
|
408
|
+
authors = dict.fromkeys(author for _, author, _, _ in reviews)
|
|
409
|
+
if len(leads) == 1:
|
|
410
|
+
authors.update(dict.fromkeys(leads))
|
|
411
|
+
if collapsed:
|
|
412
|
+
reviews = [next((review for review in reviews if review[3] in ("same-provider", "same-model")),
|
|
413
|
+
reviews[0])]
|
|
414
|
+
review_notes = {}
|
|
415
|
+
for slot, author, route, mode in reviews:
|
|
416
|
+
candidates[slot] = route
|
|
417
|
+
provider = route["provider"]
|
|
418
|
+
if not template_reviewers:
|
|
419
|
+
who = ", ".join(LABELS[name] for name in authors) if collapsed else LABELS[author]
|
|
420
|
+
notes = f"Role: review. Use to review diffs authored by {who}; read-only, report blocking issues with how they happen."
|
|
421
|
+
if collapsed or mode in ("same-provider", "same-model"):
|
|
422
|
+
notes += " For a same-provider second read, use a different model when available; otherwise this is a same-model second read."
|
|
423
|
+
review_notes[slot] = notes + " If this conflicts with `model-route review --author <provider>`, follow model-route."
|
|
424
|
+
|
|
425
|
+
profiles = []
|
|
426
|
+
for template in json.loads(PROFILE_TEMPLATES.read_text(encoding="utf-8")):
|
|
427
|
+
key = template["id"][len("mmk-"):]
|
|
428
|
+
route = candidates.get(key)
|
|
429
|
+
if not route or route["provider"] not in enabled:
|
|
430
|
+
continue
|
|
431
|
+
provider = route["provider"]
|
|
432
|
+
mode = {"claude": "auto", "codex": "auto-review",
|
|
433
|
+
"gemini": config.get("paseoAgyMode", DEFAULTS["paseoAgyMode"])}[provider]
|
|
434
|
+
profile = {**template, "provider": "antigravity" if provider == "gemini" else provider,
|
|
435
|
+
"model": route["model"], "modeId": mode, "thinkingOptionId": route["effort"]}
|
|
436
|
+
if key in review_notes:
|
|
437
|
+
profile.update(name=f"Review ({LABELS[provider]})", notes=review_notes[key])
|
|
438
|
+
profiles.append(profile)
|
|
439
|
+
return profiles
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
def is_mmk_profile(profile):
|
|
443
|
+
return profile["id"].startswith("mmk-")
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
def read_paseo_profiles():
|
|
447
|
+
try:
|
|
448
|
+
config = read_object(PASEO_CONFIG)
|
|
449
|
+
daemon = config.get("daemon", {})
|
|
450
|
+
profiles = daemon.get("agentProfiles", []) if isinstance(daemon, dict) else None
|
|
451
|
+
if isinstance(profiles, list) and all(isinstance(item, dict) and isinstance(item.get("id"), str)
|
|
452
|
+
for item in profiles):
|
|
453
|
+
return config, profiles
|
|
454
|
+
except (InstallError, ValueError, OSError):
|
|
455
|
+
pass
|
|
456
|
+
# Never surface parser errors or values from the Paseo config.
|
|
457
|
+
raise InstallError(f"Cannot read Paseo agent profiles from {PASEO_CONFIG}.", CONFLICT)
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
def paseo_profile_conflict(profiles=()):
|
|
461
|
+
if not shutil.which("paseo"):
|
|
462
|
+
return "Paseo CLI is required to change agent profiles."
|
|
463
|
+
needs_prompt = any("systemPrompt" in profile for profile in profiles)
|
|
464
|
+
unknown = "Cannot determine Paseo version." if needs_prompt else None
|
|
465
|
+
try:
|
|
466
|
+
result = run(["paseo", "--version"], capture=True, timeout=5)
|
|
467
|
+
if result.returncode != 0:
|
|
468
|
+
return unknown
|
|
469
|
+
version = re.fullmatch(r"(?:paseo\s+)?v?(\d+)\.(\d+)\.(\d+)(?:([-+])[^\s]+)?", result.stdout.strip())
|
|
470
|
+
if not version:
|
|
471
|
+
return unknown
|
|
472
|
+
release = tuple(int(part) for part in version.groups()[:3])
|
|
473
|
+
except (OSError, ValueError, subprocess.TimeoutExpired):
|
|
474
|
+
return unknown
|
|
475
|
+
minimum = PASEO_PROFILE_PROMPT_MINIMUM if needs_prompt else PASEO_RELOAD_MINIMUM
|
|
476
|
+
if release < minimum or (release == minimum and version[4] == "-"):
|
|
477
|
+
supported = ".".join(map(str, minimum))
|
|
478
|
+
return f"Paseo {supported} or later is required to change these agent profiles."
|
|
479
|
+
return None
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
def update_paseo_profiles(profiles, approved_config):
|
|
483
|
+
config, existing = read_paseo_profiles()
|
|
484
|
+
if fingerprint(PASEO_CONFIG) != approved_config:
|
|
485
|
+
raise InstallError("Paseo config changed after planning. Request a fresh plan.", CONFLICT)
|
|
486
|
+
desired = [profile for profile in existing if not is_mmk_profile(profile)] + profiles
|
|
487
|
+
backup = None
|
|
488
|
+
if approved_config is not None:
|
|
489
|
+
candidate = PASEO_CONFIG.with_name(f"config.json.mmk-backup-{time.time_ns()}")
|
|
490
|
+
try:
|
|
491
|
+
original = PASEO_CONFIG.read_bytes()
|
|
492
|
+
with os.fdopen(os.open(candidate, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600), "wb") as stream:
|
|
493
|
+
backup = candidate
|
|
494
|
+
stream.write(original)
|
|
495
|
+
os.fchmod(stream.fileno(), 0o600)
|
|
496
|
+
except OSError:
|
|
497
|
+
if backup is not None:
|
|
498
|
+
backup.unlink(missing_ok=True)
|
|
499
|
+
raise InstallError(f"Cannot back up Paseo config to {candidate}.") from None
|
|
500
|
+
if fingerprint(PASEO_CONFIG) != approved_config:
|
|
501
|
+
raise InstallError("Paseo config changed before writing. Request a fresh plan.", CONFLICT)
|
|
502
|
+
config.setdefault("daemon", {})["agentProfiles"] = desired
|
|
503
|
+
recovery = f"Backup: {backup}." if backup else "No original config was available to back up."
|
|
504
|
+
try:
|
|
505
|
+
atomic_json(PASEO_CONFIG, config)
|
|
506
|
+
except (OSError, ValueError):
|
|
507
|
+
raise InstallError(f"Cannot write Paseo agent profiles to {PASEO_CONFIG}. {recovery}") from None
|
|
508
|
+
try:
|
|
509
|
+
subprocess.run(["paseo", "reload"], stdin=subprocess.DEVNULL,
|
|
510
|
+
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=60, check=True)
|
|
511
|
+
except (OSError, subprocess.SubprocessError):
|
|
512
|
+
raise InstallError(f"paseo reload failed; profiles are written. Start Paseo and run `paseo reload`. {recovery}") from None
|
|
513
|
+
try:
|
|
514
|
+
persisted, reloaded = read_paseo_profiles()
|
|
515
|
+
retained = "agentProfiles" in persisted.get("daemon", {}) and reloaded == desired
|
|
516
|
+
except InstallError:
|
|
517
|
+
retained = False
|
|
518
|
+
if not retained:
|
|
519
|
+
raise InstallError(f"Paseo did not retain the updated agent profiles after reload. {recovery}")
|
|
520
|
+
backups = []
|
|
521
|
+
for path in PASEO_CONFIG.parent.glob("config.json.mmk-backup-*"):
|
|
522
|
+
stamp = re.fullmatch(r"config\.json\.mmk-backup-([0-9]+)", path.name)
|
|
523
|
+
if stamp and not path.is_symlink() and path.is_file():
|
|
524
|
+
backups.append((int(stamp[1]), path))
|
|
525
|
+
for _, path in sorted(backups, reverse=True)[3:]:
|
|
526
|
+
path.unlink(missing_ok=True)
|
|
527
|
+
if backup is not None:
|
|
528
|
+
print(backup, file=sys.stderr)
|
|
529
|
+
|
|
530
|
+
|
|
367
531
|
def configured(args, config):
|
|
368
532
|
proposal = dict(config)
|
|
369
533
|
if args.providers is not None:
|
|
@@ -391,6 +555,10 @@ def configured(args, config):
|
|
|
391
555
|
proposal.update(workflow=workflow)
|
|
392
556
|
if args.enable_takeover:
|
|
393
557
|
proposal["takeover"] = "on"
|
|
558
|
+
if args.zerosub is not None:
|
|
559
|
+
proposal["zerosub"] = args.zerosub
|
|
560
|
+
if args.paseo_agy_mode is not None:
|
|
561
|
+
proposal["paseoAgyMode"] = args.paseo_agy_mode
|
|
394
562
|
routes = role_preview(proposal)
|
|
395
563
|
enabled = proposal.get("enabled", DEFAULTS["enabled"])
|
|
396
564
|
suggestions = {}
|
|
@@ -458,7 +626,7 @@ def catalog_conflict(path, manifest):
|
|
|
458
626
|
|
|
459
627
|
|
|
460
628
|
def uses_store(args, native):
|
|
461
|
-
return (PACKAGED or native or args.quota_plugin or args.agy_snapshot) and bool(PACKAGE)
|
|
629
|
+
return (PACKAGED or native or args.quota_plugin or args.fork_plugin or args.agy_snapshot) and bool(PACKAGE)
|
|
462
630
|
|
|
463
631
|
|
|
464
632
|
def matches_payload(target, files, expected):
|
|
@@ -589,12 +757,25 @@ def make_plan(args):
|
|
|
589
757
|
|
|
590
758
|
if args.quota_plugin and not shutil.which("paseo"):
|
|
591
759
|
conflicts.append("Paseo CLI is required to install the optional quota plugin.")
|
|
760
|
+
if args.fork_plugin and not shutil.which("paseo"):
|
|
761
|
+
conflicts.append("Paseo CLI is required to install the optional fork plugin.")
|
|
592
762
|
if args.agy_snapshot:
|
|
593
763
|
paths.append(AGY)
|
|
594
764
|
inspect_agy(receipt)
|
|
595
|
-
if args.quota_plugin or args.agy_snapshot:
|
|
765
|
+
if args.quota_plugin or args.fork_plugin or args.agy_snapshot or args.agent_profiles or args.paseo_agy_mode:
|
|
596
766
|
if host not in ("paseo", "all"):
|
|
597
767
|
conflicts.append("Paseo options require --host paseo or --host all.")
|
|
768
|
+
profiles, paseo_before = None, None
|
|
769
|
+
if args.agent_profiles and host in ("paseo", "all"):
|
|
770
|
+
paseo_before = fingerprint(PASEO_CONFIG)
|
|
771
|
+
try:
|
|
772
|
+
read_paseo_profiles()
|
|
773
|
+
except InstallError as error:
|
|
774
|
+
conflicts.append(str(error))
|
|
775
|
+
profiles = agent_profiles(proposal, routes)
|
|
776
|
+
conflict = paseo_profile_conflict(profiles)
|
|
777
|
+
if conflict:
|
|
778
|
+
conflicts.append(conflict)
|
|
598
779
|
|
|
599
780
|
files = list(payload_files()) if uses_store(args, native) else []
|
|
600
781
|
package_hash = payload_digest(ROOT, files) if files else None
|
|
@@ -625,9 +806,15 @@ def make_plan(args):
|
|
|
625
806
|
actions.append({"action": "updateConfig", "path": str(CONFIG), "changes": changes})
|
|
626
807
|
if args.quota_plugin:
|
|
627
808
|
actions.append({"action": "installPaseoQuotaPlugin"})
|
|
809
|
+
if args.fork_plugin:
|
|
810
|
+
actions.append({"action": "installPaseoForkPlugin", "plugin": FORK_ID})
|
|
628
811
|
if args.agy_snapshot:
|
|
629
812
|
actions.append({"action": "captureAgyQuota", "path": str(AGY),
|
|
630
813
|
"preserveExistingStatusLine": True})
|
|
814
|
+
if profiles is not None:
|
|
815
|
+
actions.append({"action": "installAgentProfiles", "path": str(PASEO_CONFIG),
|
|
816
|
+
"profiles": [profile["name"] for profile in profiles],
|
|
817
|
+
"backup": paseo_before is not None, "reload": "paseo reload"})
|
|
631
818
|
|
|
632
819
|
previous_version = CURRENT.resolve().name if CURRENT.is_symlink() and CURRENT.is_dir() else None
|
|
633
820
|
native_upgrade = any(receipt.get("native", {}).get(target, {}).get("version", VERSION) != VERSION
|
|
@@ -636,7 +823,8 @@ def make_plan(args):
|
|
|
636
823
|
or bool(files and previous_version and previous_version != VERSION))
|
|
637
824
|
if upgrade:
|
|
638
825
|
actions.insert(0, {"action": "reviewActivePaseoSessions"})
|
|
639
|
-
|
|
826
|
+
settings = model_route(proposal, "--settings")
|
|
827
|
+
takeover = settings["takeover"]
|
|
640
828
|
result = {
|
|
641
829
|
"host": host,
|
|
642
830
|
"targets": targets,
|
|
@@ -654,6 +842,7 @@ def make_plan(args):
|
|
|
654
842
|
},
|
|
655
843
|
"fallbackSuggestions": suggestions,
|
|
656
844
|
"rolePreview": routes,
|
|
845
|
+
"settings": settings,
|
|
657
846
|
"takeover": {
|
|
658
847
|
"setting": takeover,
|
|
659
848
|
"missingHosts": [provider for provider in PROVIDERS
|
|
@@ -661,15 +850,22 @@ def make_plan(args):
|
|
|
661
850
|
if takeover == "on" else [],
|
|
662
851
|
},
|
|
663
852
|
}
|
|
853
|
+
if args.fork_plugin and args.zerosub is None:
|
|
854
|
+
result["zeroSubRecommendation"] = (
|
|
855
|
+
"Enable automatic forks in ZeroSub, then pass --zerosub fork-on to record the setting."
|
|
856
|
+
)
|
|
664
857
|
digest_input = {"plan": result, "destinations": snapshot(paths), "package": package_hash,
|
|
665
858
|
"source": snapshot([ROOT / "install.sh", ROOT / "bin/model-route",
|
|
666
859
|
ROOT / "config/defaults.json", ROOT / "rules/multi-model.md"])}
|
|
667
860
|
# Source inode numbers differ when the same archive is unpacked again.
|
|
668
861
|
digest_input["source"] = {Path(path).name: value[-1] if value else None
|
|
669
862
|
for path, value in digest_input["source"].items()}
|
|
863
|
+
if profiles is not None:
|
|
864
|
+
digest_input["destinations"][str(PASEO_CONFIG)] = paseo_before
|
|
865
|
+
digest_input["agentProfiles"] = profiles
|
|
670
866
|
result["digest"] = hashlib.sha256(json.dumps(digest_input, sort_keys=True).encode()).hexdigest()
|
|
671
867
|
return (result, proposal, receipt, native, global_targets, files, package_hash, upgrade,
|
|
672
|
-
owned_root, legacy_root, migrations, decision, retargets)
|
|
868
|
+
owned_root, legacy_root, migrations, decision, retargets, profiles, paseo_before)
|
|
673
869
|
|
|
674
870
|
|
|
675
871
|
def tty():
|
|
@@ -721,12 +917,24 @@ def wizard(args, terminal):
|
|
|
721
917
|
config = read_object(CONFIG)
|
|
722
918
|
if args.providers is None:
|
|
723
919
|
args.providers = ask(terminal, "Enter subscribed providers (claude,codex,gemini), or Enter to keep current settings") or None
|
|
920
|
+
if args.host in ("paseo", "all"):
|
|
921
|
+
args.agent_profiles = args.agent_profiles or confirm(terminal, "Install Multi-Model Kit agent profiles in Paseo?")
|
|
922
|
+
has_zerosub = zerosub_detected()
|
|
923
|
+
if has_zerosub and not args.fork_plugin:
|
|
924
|
+
args.fork_plugin = choose(terminal, "Install the bundled Paseo fork plugin?", ("y", "n"), "y") == "y"
|
|
724
925
|
if args.host == "paseo":
|
|
725
926
|
print(f"ZeroSub is optional for Claude accounts and Claude↔GPT forks. See ZeroSub’s installation guide: {ZERO_SUB_URL}",
|
|
726
927
|
file=sys.stderr)
|
|
928
|
+
if args.zerosub is None and has_zerosub:
|
|
929
|
+
answer = choose(terminal,
|
|
930
|
+
"ZeroSub 的 ‘When every account is out, fork the chat to the other provider’ 是否打开?",
|
|
931
|
+
("关", "开", "不确定"), "不确定")
|
|
932
|
+
args.zerosub = {"关": "fork-off", "开": "fork-on"}.get(answer)
|
|
727
933
|
args.quota_plugin = args.quota_plugin or confirm(terminal, "Install the bundled Paseo quota plugin?")
|
|
728
934
|
args.agy_snapshot = args.agy_snapshot or confirm(terminal, "Change agy settings to capture status-line quota?")
|
|
729
935
|
if config.get("takeover", "off") == "off":
|
|
936
|
+
print("In Paseo, enabling automatic takeover grants standing consent. T3 still requires consent for each unit.",
|
|
937
|
+
file=sys.stderr)
|
|
730
938
|
args.enable_takeover = args.enable_takeover or confirm(terminal, "Enable automatic cross-provider takeover?")
|
|
731
939
|
print("3/5 Role assignments.", file=sys.stderr)
|
|
732
940
|
_, _, suggestions = configured(args, config)
|
|
@@ -839,27 +1047,48 @@ def install_native(host, receipt, upgrade):
|
|
|
839
1047
|
atomic_json(RECEIPT, receipt)
|
|
840
1048
|
|
|
841
1049
|
|
|
842
|
-
def
|
|
843
|
-
data = json.loads(checked(["paseo", "plugin", "ls", "--json"], capture=True))
|
|
844
|
-
|
|
1050
|
+
def paseo_plugins(*, timeout=25):
|
|
1051
|
+
data = json.loads(checked(["paseo", "plugin", "ls", "--json"], capture=True, timeout=timeout))
|
|
1052
|
+
if isinstance(data, dict):
|
|
1053
|
+
data = data.get("plugins", data.get("data"))
|
|
1054
|
+
entries = data.get("plugins") if isinstance(data, dict) else data
|
|
845
1055
|
if not isinstance(entries, list):
|
|
846
1056
|
raise InstallError("Paseo returned an unrecognized plugin list.")
|
|
847
|
-
return
|
|
1057
|
+
return [entry for entry in entries if isinstance(entry, dict)]
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
def zerosub_detected():
|
|
1061
|
+
if not shutil.which("paseo"):
|
|
1062
|
+
return False
|
|
1063
|
+
try:
|
|
1064
|
+
return any(entry.get("id") == "zerosub" for entry in paseo_plugins(timeout=5))
|
|
1065
|
+
except (InstallError, OSError, ValueError, subprocess.SubprocessError):
|
|
1066
|
+
return False
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
def installed_paseo_plugin(plugin_id, *, timeout=25):
|
|
1070
|
+
return next((entry for entry in paseo_plugins(timeout=timeout) if entry.get("id") == plugin_id), None)
|
|
848
1071
|
|
|
849
1072
|
|
|
850
1073
|
def install_optional(args, receipt, upgrade):
|
|
851
|
-
|
|
852
|
-
|
|
1074
|
+
for enabled, name, plugin_id, directory in (
|
|
1075
|
+
(args.quota_plugin, "quota", QUOTA_ID, "paseo-usage"),
|
|
1076
|
+
(args.fork_plugin, "fork", FORK_ID, "paseo-fork"),
|
|
1077
|
+
):
|
|
1078
|
+
if not enabled:
|
|
1079
|
+
continue
|
|
1080
|
+
key = f"{name}Plugin"
|
|
1081
|
+
plugin = installed_paseo_plugin(plugin_id)
|
|
853
1082
|
if not plugin:
|
|
854
|
-
checked(["paseo", "plugin", "install", str(CURRENT / "plugins/
|
|
855
|
-
"--id",
|
|
856
|
-
plugin =
|
|
1083
|
+
checked(["paseo", "plugin", "install", str(CURRENT / "plugins" / directory),
|
|
1084
|
+
"--id", plugin_id], timeout=60)
|
|
1085
|
+
plugin = installed_paseo_plugin(plugin_id)
|
|
857
1086
|
if not plugin or not plugin.get("path"):
|
|
858
|
-
raise InstallError("Paseo did not report the
|
|
859
|
-
receipt[
|
|
1087
|
+
raise InstallError(f"Paseo did not report the {name} plugin path after installation.")
|
|
1088
|
+
receipt[key] = plugin["path"]
|
|
860
1089
|
atomic_json(RECEIPT, receipt)
|
|
861
|
-
elif upgrade and plugin.get("path") == receipt.get(
|
|
862
|
-
checked(["paseo", "plugin", "reload",
|
|
1090
|
+
elif upgrade and plugin.get("path") == receipt.get(key):
|
|
1091
|
+
checked(["paseo", "plugin", "reload", plugin_id], timeout=60)
|
|
863
1092
|
if args.agy_snapshot:
|
|
864
1093
|
settings, installed = inspect_agy(receipt)
|
|
865
1094
|
if settings.get("statusLine") != installed:
|
|
@@ -871,7 +1100,7 @@ def install_optional(args, receipt, upgrade):
|
|
|
871
1100
|
|
|
872
1101
|
def apply_plan(args, terminal, details):
|
|
873
1102
|
(plan, proposal, receipt, native, global_targets, files, package_hash, upgrade,
|
|
874
|
-
owned_root, legacy_root, migrations, decision, retargets) = details
|
|
1103
|
+
owned_root, legacy_root, migrations, decision, retargets, profiles, paseo_before) = details
|
|
875
1104
|
if args.apply and args.digest != plan["digest"]:
|
|
876
1105
|
raise InstallError("Install plan has changed. Request a fresh --plan --json.", CONFLICT)
|
|
877
1106
|
if plan["conflicts"]:
|
|
@@ -901,6 +1130,8 @@ def apply_plan(args, terminal, details):
|
|
|
901
1130
|
if config_before != fingerprint(CONFIG):
|
|
902
1131
|
raise InstallError("Routing config changed during installation. Request a fresh plan.", CONFLICT)
|
|
903
1132
|
atomic_json(CONFIG, proposal)
|
|
1133
|
+
if profiles is not None:
|
|
1134
|
+
update_paseo_profiles(profiles, paseo_before)
|
|
904
1135
|
|
|
905
1136
|
|
|
906
1137
|
def installed_root():
|
|
@@ -922,6 +1153,8 @@ def make_uninstall_plan(args):
|
|
|
922
1153
|
actions = []
|
|
923
1154
|
conflicts = []
|
|
924
1155
|
global_targets = []
|
|
1156
|
+
paseo_before = None
|
|
1157
|
+
remove_profiles = False
|
|
925
1158
|
for target in targets:
|
|
926
1159
|
if has_global_install(target, (ROOT, owned_root, legacy_root)):
|
|
927
1160
|
result = global_removals(target, owned_root, legacy_root)
|
|
@@ -943,8 +1176,24 @@ def make_uninstall_plan(args):
|
|
|
943
1176
|
actions.append({"action": "removeLocalMarketplace", "host": target, "marketplace": NAME})
|
|
944
1177
|
|
|
945
1178
|
if args.host in (None, "all", "paseo"):
|
|
1179
|
+
paseo_before = fingerprint(PASEO_CONFIG)
|
|
1180
|
+
try:
|
|
1181
|
+
_, existing = read_paseo_profiles()
|
|
1182
|
+
except InstallError as error:
|
|
1183
|
+
conflicts.append(str(error))
|
|
1184
|
+
else:
|
|
1185
|
+
owned_profiles = [profile for profile in existing if is_mmk_profile(profile)]
|
|
1186
|
+
if owned_profiles:
|
|
1187
|
+
conflict = paseo_profile_conflict()
|
|
1188
|
+
if conflict:
|
|
1189
|
+
conflicts.append(conflict)
|
|
1190
|
+
remove_profiles = True
|
|
1191
|
+
actions.append({"action": "removeAgentProfiles", "path": str(PASEO_CONFIG),
|
|
1192
|
+
"count": len(owned_profiles), "backup": True, "reload": "paseo reload"})
|
|
946
1193
|
if receipt.get("quotaPlugin"):
|
|
947
1194
|
actions.append({"action": "removeOwnedPaseoQuotaPlugin", "plugin": QUOTA_ID})
|
|
1195
|
+
if receipt.get("forkPlugin"):
|
|
1196
|
+
actions.append({"action": "removeOwnedPaseoForkPlugin", "plugin": FORK_ID})
|
|
948
1197
|
if receipt.get("agy"):
|
|
949
1198
|
paths.append(AGY)
|
|
950
1199
|
if read_object(AGY).get("statusLine") == receipt["agy"]["installed"]:
|
|
@@ -960,12 +1209,16 @@ def make_uninstall_plan(args):
|
|
|
960
1209
|
|
|
961
1210
|
plan = {"operation": "uninstall", "host": host, "actions": actions,
|
|
962
1211
|
"conflicts": conflicts, "sessions": args.sessions, "needsDecision": decision}
|
|
963
|
-
|
|
964
|
-
|
|
1212
|
+
destinations = snapshot(paths)
|
|
1213
|
+
if remove_profiles:
|
|
1214
|
+
destinations[str(PASEO_CONFIG)] = paseo_before
|
|
1215
|
+
plan["digest"] = identity({"plan": plan, "destinations": destinations})
|
|
1216
|
+
return plan, receipt, targets, global_targets, owned_root, legacy_root, remove_profiles, paseo_before
|
|
965
1217
|
|
|
966
1218
|
|
|
967
1219
|
def uninstall(args, terminal):
|
|
968
|
-
plan, receipt, targets, global_targets, owned_root, legacy_root
|
|
1220
|
+
(plan, receipt, targets, global_targets, owned_root, legacy_root,
|
|
1221
|
+
remove_profiles, paseo_before) = make_uninstall_plan(args)
|
|
969
1222
|
if args.plan:
|
|
970
1223
|
dump(plan)
|
|
971
1224
|
return 0
|
|
@@ -1006,11 +1259,13 @@ def uninstall(args, terminal):
|
|
|
1006
1259
|
print_global(global_command(ROOT, "--remove-target", LABELS[host],
|
|
1007
1260
|
existing=owned_root, legacy=legacy_root))
|
|
1008
1261
|
if args.host in (None, "all", "paseo"):
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1262
|
+
for key, plugin_id in (("quotaPlugin", QUOTA_ID), ("forkPlugin", FORK_ID)):
|
|
1263
|
+
if not receipt.get(key):
|
|
1264
|
+
continue
|
|
1265
|
+
plugin = installed_paseo_plugin(plugin_id)
|
|
1266
|
+
if plugin and plugin.get("path") == receipt[key]:
|
|
1267
|
+
checked(["paseo", "plugin", "remove", plugin_id])
|
|
1268
|
+
receipt.pop(key)
|
|
1014
1269
|
atomic_json(RECEIPT, receipt)
|
|
1015
1270
|
if receipt.get("agy"):
|
|
1016
1271
|
settings = read_object(AGY)
|
|
@@ -1028,11 +1283,15 @@ def uninstall(args, terminal):
|
|
|
1028
1283
|
atomic_json(RECEIPT, receipt)
|
|
1029
1284
|
if RECEIPT.is_file() and not any(receipt.values()):
|
|
1030
1285
|
RECEIPT.unlink()
|
|
1286
|
+
if remove_profiles:
|
|
1287
|
+
update_paseo_profiles([], paseo_before)
|
|
1031
1288
|
return 0
|
|
1032
1289
|
|
|
1033
1290
|
|
|
1034
1291
|
def check_installation(args):
|
|
1035
1292
|
host, targets, detected, decision = target_hosts(args)
|
|
1293
|
+
if (args.agent_profiles or args.fork_plugin or args.paseo_agy_mode) and host not in ("paseo", "all"):
|
|
1294
|
+
raise InstallError("Paseo options require --host paseo or --host all.", CONFLICT)
|
|
1036
1295
|
reachable = None
|
|
1037
1296
|
if shutil.which("paseo"):
|
|
1038
1297
|
try:
|
|
@@ -1056,6 +1315,23 @@ def check_installation(args):
|
|
|
1056
1315
|
"skills": {target: visible_skills(target) for target in targets},
|
|
1057
1316
|
"commands": legacy_status(None, existing=installed_root(), legacy=legacy_checkout()),
|
|
1058
1317
|
}
|
|
1318
|
+
if host in ("paseo", "all") or (not args.host and ("paseo" in detected or PASEO_CONFIG.is_file())):
|
|
1319
|
+
_, profiles = read_paseo_profiles()
|
|
1320
|
+
managed = [profile for profile in profiles if is_mmk_profile(profile)]
|
|
1321
|
+
status = "missing"
|
|
1322
|
+
if managed:
|
|
1323
|
+
config = read_object(CONFIG)
|
|
1324
|
+
expected = agent_profiles(config, role_preview(config))
|
|
1325
|
+
status = "installed" if managed == expected else "outdated"
|
|
1326
|
+
result["paseoAgentProfiles"] = status
|
|
1327
|
+
result["paseoForkPlugin"] = "missing"
|
|
1328
|
+
if shutil.which("paseo"):
|
|
1329
|
+
try:
|
|
1330
|
+
plugin = installed_paseo_plugin(FORK_ID, timeout=5)
|
|
1331
|
+
if plugin:
|
|
1332
|
+
result["paseoForkPlugin"] = "installed" if plugin.get("enabled", True) else "disabled"
|
|
1333
|
+
except (InstallError, OSError, ValueError, subprocess.SubprocessError):
|
|
1334
|
+
result["paseoForkPlugin"] = "unknown"
|
|
1059
1335
|
if args.json:
|
|
1060
1336
|
dump(result)
|
|
1061
1337
|
else:
|
|
@@ -1065,6 +1341,10 @@ def check_installation(args):
|
|
|
1065
1341
|
print(f"{target} skill {name}: {'installed' if visible else 'missing'}")
|
|
1066
1342
|
for name, status in result["commands"].items():
|
|
1067
1343
|
print(f"{name}: {status}")
|
|
1344
|
+
if "paseoAgentProfiles" in result:
|
|
1345
|
+
print(f"paseo agent profiles: {result['paseoAgentProfiles']}")
|
|
1346
|
+
if "paseoForkPlugin" in result:
|
|
1347
|
+
print(f"paseo fork plugin: {result['paseoForkPlugin']}")
|
|
1068
1348
|
return DECISION if decision else 0
|
|
1069
1349
|
|
|
1070
1350
|
|
|
@@ -1088,8 +1368,15 @@ def arguments():
|
|
|
1088
1368
|
parser.add_argument("--workflow", choices=("keep", "ce", "custom", "direct"))
|
|
1089
1369
|
parser.add_argument("--workflow-skill", action="append", default=[], metavar="STAGE=SKILL")
|
|
1090
1370
|
parser.add_argument("--enable-takeover", action="store_true")
|
|
1371
|
+
parser.add_argument("--zerosub", choices=ZEROSUB_STATES, help="Record the verified ZeroSub fork setting")
|
|
1091
1372
|
parser.add_argument("--quota-plugin", action="store_true")
|
|
1373
|
+
parser.add_argument("--fork-plugin", action="store_true",
|
|
1374
|
+
help="Install the bundled ZeroSub fork companion in Paseo")
|
|
1092
1375
|
parser.add_argument("--agy-snapshot", action="store_true")
|
|
1376
|
+
parser.add_argument("--paseo-agy-mode", choices=("auto", "full-access"),
|
|
1377
|
+
help="Set the mode used for Antigravity sessions launched in Paseo")
|
|
1378
|
+
parser.add_argument("--agent-profiles", action="store_true",
|
|
1379
|
+
help="Install model-route agent profiles into Paseo")
|
|
1093
1380
|
parser.add_argument("--upgrade", action="store_true")
|
|
1094
1381
|
parser.add_argument("--sessions", choices=("keep", "stop"))
|
|
1095
1382
|
args = parser.parse_args(sys.argv[2:])
|
|
@@ -1100,8 +1387,9 @@ def arguments():
|
|
|
1100
1387
|
if args.yes and not args.apply:
|
|
1101
1388
|
raise InstallError("Use --plan --json and --apply --digest for unattended changes.", DECISION)
|
|
1102
1389
|
if args.uninstall and (args.check or args.global_install or args.providers or args.role
|
|
1103
|
-
or args.use_fallbacks or args.workflow or args.enable_takeover
|
|
1104
|
-
or args.agy_snapshot or args.quota_plugin or args.
|
|
1390
|
+
or args.use_fallbacks or args.workflow or args.enable_takeover or args.zerosub
|
|
1391
|
+
or args.agy_snapshot or args.quota_plugin or args.fork_plugin
|
|
1392
|
+
or args.agent_profiles or args.paseo_agy_mode or args.upgrade):
|
|
1105
1393
|
parser.error("--uninstall accepts host, plan, approval, and session options")
|
|
1106
1394
|
if args.workflow_skill and args.workflow != "custom":
|
|
1107
1395
|
parser.error("--workflow-skill requires --workflow custom")
|
|
@@ -1173,6 +1461,7 @@ case ${1-} in
|
|
|
1173
1461
|
case "$*" in
|
|
1174
1462
|
--check)
|
|
1175
1463
|
if [ "${MMK_PACKAGED-}" = 1 ] ||
|
|
1464
|
+
[ -f "${PASEO_HOME:-$HOME/.paseo}/config.json" ] ||
|
|
1176
1465
|
[ -e "$HOME/.local/share/multi-model-kit/current" ] ||
|
|
1177
1466
|
[ -L "$HOME/.local/share/multi-model-kit/current" ]; then
|
|
1178
1467
|
run_wizard "$@"; exit $?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaxonshaw/multi-model-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Route coding work across models and keep handoffs recoverable.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"multi-model-kit": "bin/multi-model-kit"
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
".codex-plugin",
|
|
12
12
|
"bin",
|
|
13
13
|
"config/defaults.json",
|
|
14
|
+
"config/paseo-agent-profiles.json",
|
|
14
15
|
"hooks",
|
|
15
16
|
"install.sh",
|
|
16
17
|
"INSTALL-AGENT.md",
|
|
@@ -19,6 +20,8 @@
|
|
|
19
20
|
"mods/org-switch/hooks/register.ts",
|
|
20
21
|
"mods/org-switch/tsconfig.json",
|
|
21
22
|
"orgs.example.json",
|
|
23
|
+
"plugins/paseo-fork/index.server.ts",
|
|
24
|
+
"plugins/paseo-fork/paseo-plugin.json",
|
|
22
25
|
"plugins/paseo-usage/bridge/capture-quota.cjs",
|
|
23
26
|
"plugins/paseo-usage/index.server.ts",
|
|
24
27
|
"plugins/paseo-usage/paseo-plugin.json",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import type { PluginServerContext } from "@getpaseo/plugin/server";
|
|
4
|
+
|
|
5
|
+
const SELF_CLAIM = "You are a ZeroSub fork of a multi-model-kit lead. Before any other work, follow the 'ZeroSub fork self-claim' section of the task-handoff skill: read .handoff.md, verify, claim, then continue. If any check fails, do not edit files; tell the user.";
|
|
6
|
+
// Injected into every ZeroSub cross-provider Codex fork, board or not, so a
|
|
7
|
+
// subtask fork in a worktree without .handoff.md still waits before writing.
|
|
8
|
+
const SUBTASK_GUARD = "If the session you were forked from carries multi-model-kit labels (mmk.role) and is not the lead, do not edit files: tell the lead named in its mmk.lead label that a fork candidate exists and wait for the lead to register you and say continue. If it has no mmk labels, ignore this note.";
|
|
9
|
+
|
|
10
|
+
export default function contribute(server: PluginServerContext) {
|
|
11
|
+
return server.addHook("agent.create.before", async ({ request }, { paseo }) => {
|
|
12
|
+
const { config, metadata, workspaceId } = request;
|
|
13
|
+
// ZeroSub v1.35.0 server/handoff.ts:382–419. Same-provider account moves also
|
|
14
|
+
// carry the transient account marker, but use "(continued)" as the suffix.
|
|
15
|
+
// Paseo 0.18.1 runs multi-model-kit-fork before zerosub by ID, so the
|
|
16
|
+
// marker is still present here. Leave it in place for ZeroSub to consume.
|
|
17
|
+
const account = metadata?.["zerosub.handoff-account"];
|
|
18
|
+
if (config.provider !== "codex" || !workspaceId ||
|
|
19
|
+
typeof account !== "string" || !account.trim() ||
|
|
20
|
+
!config.title?.endsWith(" (continued on ChatGPT)")) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const guarded = {
|
|
25
|
+
...request,
|
|
26
|
+
config: { ...config, systemPrompt: [config.systemPrompt, SUBTASK_GUARD].filter(Boolean).join("\n\n") },
|
|
27
|
+
};
|
|
28
|
+
// A throwing hook fails the whole create, so ZeroSub's fork would be lost.
|
|
29
|
+
// ZeroSub already maps an explicitly chosen Claude bypass mode to Full Access.
|
|
30
|
+
// Preserve that choice without promoting a request in any other mode.
|
|
31
|
+
const modeId = config.modeId === "full-access" ? "full-access" : "auto-review";
|
|
32
|
+
const { modes = [] } = await paseo.providers.listModes("codex").catch(() => ({ modes: [] }));
|
|
33
|
+
if (!modes.some((mode) => mode.id === modeId)) return guarded;
|
|
34
|
+
const workspace = await paseo.workspaces.ref(workspaceId).refresh().catch(() => null);
|
|
35
|
+
if (!workspace?.workspaceDirectory) return guarded;
|
|
36
|
+
const handoff = await stat(join(workspace.workspaceDirectory, ".handoff.md")).catch(() => undefined);
|
|
37
|
+
if (!handoff?.isFile()) return guarded;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
...request,
|
|
41
|
+
config: {
|
|
42
|
+
...config,
|
|
43
|
+
modeId,
|
|
44
|
+
systemPrompt: [config.systemPrompt, SUBTASK_GUARD, SELF_CLAIM].filter(Boolean).join("\n\n"),
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}
|