@teamclaws/teamclaw 2026.8.0 → 2026.11.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/cli.mjs +46 -15
- package/dist/api.js +1 -0
- package/dist/index.js +325 -0
- package/dist/src/config.js +412 -0
- package/dist/src/controller/clarification-routes.js +315 -0
- package/dist/src/controller/controller-capacity.js +14 -0
- package/dist/src/controller/controller-intake.js +895 -0
- package/dist/src/controller/controller-planning.js +813 -0
- package/dist/src/controller/controller-runs.js +175 -0
- package/dist/src/controller/controller-service.js +624 -0
- package/dist/src/controller/controller-tools.js +587 -0
- package/dist/src/controller/delivery-report.js +458 -0
- package/dist/src/controller/github-auth.js +564 -0
- package/dist/src/controller/http-server.js +284 -0
- package/dist/src/controller/kickoff-orchestrator.js +246 -0
- package/dist/src/controller/managed-gateway-process.js +286 -0
- package/dist/src/controller/message-delivery.js +28 -0
- package/dist/src/controller/message-router.js +38 -0
- package/dist/src/controller/message-routes.js +114 -0
- package/dist/src/controller/orchestration-manifest.js +151 -0
- package/dist/src/controller/preview-manager.js +586 -0
- package/dist/src/controller/preview-proxy.js +98 -0
- package/dist/src/controller/profile-switch.js +289 -0
- package/dist/src/controller/project-registry.js +294 -0
- package/dist/src/controller/prompt-injector.js +197 -0
- package/dist/src/controller/repo-routes.js +63 -0
- package/dist/src/controller/role-inference.js +246 -0
- package/dist/src/controller/route-table.js +1353 -0
- package/dist/src/controller/task-assignment.js +508 -0
- package/dist/src/controller/task-cleanup.js +258 -0
- package/dist/src/controller/task-execution.js +240 -0
- package/dist/src/controller/task-results.js +461 -0
- package/dist/src/controller/task-router.js +137 -0
- package/dist/src/controller/task-routes.js +703 -0
- package/dist/src/controller/teamauto-routes.js +124 -0
- package/dist/src/controller/tunnel-manager.js +548 -0
- package/dist/src/controller/ui-assets.js +68 -0
- package/dist/src/controller/websocket.js +42 -0
- package/dist/src/controller/worker-provisioning.js +1674 -0
- package/dist/src/controller/worker-routes.js +188 -0
- package/dist/src/discovery.js +86 -0
- package/dist/src/git-collaboration.js +694 -0
- package/dist/src/identity.js +132 -0
- package/dist/src/install-defaults.js +1 -0
- package/dist/src/interaction-contracts.js +531 -0
- package/dist/src/networking.js +91 -0
- package/dist/src/openclaw-workspace.js +925 -0
- package/dist/src/profile-loader.js +486 -0
- package/dist/src/profiles/banking.json +178 -0
- package/dist/src/profiles/crossborder-ecom.json +253 -0
- package/dist/src/profiles/insurance.json +157 -0
- package/dist/src/profiles/knowledge/hs-structure.md +97 -0
- package/dist/src/profiles/knowledge/incoterms-2020.md +188 -0
- package/dist/src/profiles/knowledge/vat-principles.md +85 -0
- package/dist/src/profiles/schema.json +201 -0
- package/dist/src/profiles/securities.json +137 -0
- package/dist/src/profiles/software-rd.json +264 -0
- package/dist/src/profiles/trading-co.json +200 -0
- package/dist/src/prompt-policy.js +386 -0
- package/dist/src/protocol.js +58 -0
- package/dist/src/role-ids.js +29 -0
- package/dist/src/roles.js +390 -0
- package/dist/src/session-roles.js +14 -0
- package/dist/src/state.js +361 -0
- package/dist/src/task-executor.js +1023 -0
- package/dist/src/teamauto/github-client.js +210 -0
- package/dist/src/teamauto/norms.js +85 -0
- package/dist/src/teamauto/repo-sync.js +423 -0
- package/dist/src/teamauto/scanner.js +207 -0
- package/dist/src/teamauto/schedule.js +123 -0
- package/dist/src/teamauto/scheduler.js +907 -0
- package/dist/src/teamauto/store.js +133 -0
- package/dist/src/types.js +290 -0
- package/dist/src/ui/app.js +4860 -0
- package/dist/src/ui/assets/teamclaw-app-icon.png +0 -0
- package/dist/src/ui/github-login.html +296 -0
- package/dist/src/ui/index.html +447 -0
- package/dist/src/ui/style.css +2805 -0
- package/dist/src/worker/http-handler.js +146 -0
- package/dist/src/worker/message-queue.js +24 -0
- package/dist/src/worker/prompt-injector.js +78 -0
- package/dist/src/worker/skill-installer.js +255 -0
- package/dist/src/worker/tools.js +541 -0
- package/dist/src/worker/worker-service.js +307 -0
- package/dist/src/workspace-browser.js +269 -0
- package/openclaw.plugin.json +28 -1
- package/package.json +3 -2
- package/src/config.ts +33 -2
- package/src/controller/clarification-routes.ts +404 -0
- package/src/controller/controller-intake.ts +1113 -0
- package/src/controller/controller-planning.ts +1029 -0
- package/src/controller/controller-runs.ts +239 -0
- package/src/controller/controller-service.ts +295 -41
- package/src/controller/controller-tools.ts +11 -7
- package/src/controller/http-server.ts +294 -6971
- package/src/controller/kickoff-orchestrator.ts +70 -7
- package/src/controller/message-delivery.ts +49 -0
- package/src/controller/message-routes.ts +137 -0
- package/src/controller/orchestration-manifest.ts +6 -29
- package/src/controller/preview-proxy.ts +127 -0
- package/src/controller/profile-switch.ts +366 -0
- package/src/controller/project-registry.ts +361 -0
- package/src/controller/prompt-injector.ts +23 -8
- package/src/controller/repo-routes.ts +91 -0
- package/src/controller/role-inference.ts +260 -22
- package/src/controller/route-table.ts +1616 -0
- package/src/controller/task-assignment.ts +618 -0
- package/src/controller/task-cleanup.ts +344 -0
- package/src/controller/task-execution.ts +356 -0
- package/src/controller/task-results.ts +544 -0
- package/src/controller/task-router.ts +98 -6
- package/src/controller/task-routes.ts +812 -0
- package/src/controller/teamauto-routes.ts +121 -0
- package/src/controller/ui-assets.ts +70 -0
- package/src/controller/websocket.ts +13 -1
- package/src/controller/worker-provisioning.ts +32 -4
- package/src/controller/worker-routes.ts +241 -0
- package/src/identity.ts +3 -2
- package/src/interaction-contracts.ts +7 -7
- package/src/openclaw-workspace.ts +44 -18
- package/src/profile-loader.ts +650 -0
- package/src/profiles/banking.json +178 -0
- package/src/profiles/crossborder-ecom.json +253 -0
- package/src/profiles/insurance.json +157 -0
- package/src/profiles/knowledge/hs-structure.md +97 -0
- package/src/profiles/knowledge/incoterms-2020.md +188 -0
- package/src/profiles/knowledge/vat-principles.md +85 -0
- package/src/profiles/schema.json +201 -0
- package/src/profiles/securities.json +137 -0
- package/src/profiles/software-rd.json +264 -0
- package/src/profiles/trading-co.json +200 -0
- package/src/prompt-policy.ts +27 -13
- package/src/role-ids.ts +31 -0
- package/src/roles.ts +60 -14
- package/src/session-roles.ts +14 -0
- package/src/state.ts +236 -9
- package/src/task-executor.ts +7 -18
- package/src/teamauto/github-client.ts +21 -0
- package/src/teamauto/repo-sync.ts +246 -6
- package/src/teamauto/scanner.ts +47 -13
- package/src/teamauto/scheduler.ts +259 -16
- package/src/teamauto/store.ts +12 -0
- package/src/types.ts +133 -16
- package/src/ui/app.js +592 -24
- package/src/ui/index.html +44 -11
- package/src/ui/style.css +194 -0
- package/src/worker/prompt-injector.ts +48 -8
- package/src/worker/skill-installer.ts +3 -1
- package/src/worker/worker-service.ts +83 -3
package/src/types.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { TEAMCLAW_PUBLISHED_RUNTIME_IMAGE } from "./install-defaults.js";
|
|
2
2
|
import { DEFAULT_GITHUB_CLIENT_ID } from "./controller/github-auth.js";
|
|
3
|
+
// Safe value import: roles.js only pulls prompt-policy.js -> openclaw-workspace.js
|
|
4
|
+
// at runtime (its types.js import is type-only), so no module cycle is formed.
|
|
5
|
+
import { DEFAULT_ROLE } from "./roles.js";
|
|
6
|
+
import { validateRoleId, validateRoleIdList } from "./roles.js";
|
|
7
|
+
import { ROLE_IDS } from "./roles.js";
|
|
8
|
+
// Phase 1.6: profile-loader has no runtime edge back into this module (its
|
|
9
|
+
// types.js import is type-only), so the software-rd baseline id stays a
|
|
10
|
+
// single literal shared with the loader.
|
|
11
|
+
import { SOFTWARE_RD_PROFILE_ID } from "./profile-loader.js";
|
|
3
12
|
|
|
4
13
|
export type TeamClawMode = "controller" | "worker";
|
|
5
14
|
|
|
@@ -64,6 +73,22 @@ export type RepoSyncInfo = {
|
|
|
64
73
|
headSummary?: string;
|
|
65
74
|
};
|
|
66
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Phase 1.1 (vertical-team-profiles-design.md v1.3): RoleId is an open
|
|
78
|
+
* branded string so future TeamProfiles can carry arbitrary role sets;
|
|
79
|
+
* runtime legitimacy of a role id is enforced by validateRoleId/
|
|
80
|
+
* validateRoleIdList in roles.ts (Phase 0.3), not by the compiler.
|
|
81
|
+
*
|
|
82
|
+
* Hybrid form ruling (design v1.3, section 1.5 errata + section 6
|
|
83
|
+
* decision): TS 5.9 - the repo-locked compiler - rejects direct assignment
|
|
84
|
+
* of string literals to `string & { __roleId: true }` (the #33050
|
|
85
|
+
* unsoundness fix), while the role definitions in roles.ts/role-ids.ts
|
|
86
|
+
* are pure JS array literals that the manifest generator regex-extracts
|
|
87
|
+
* and evaluates, and their RoleId[] annotations are pinned by
|
|
88
|
+
* tests/test-role-single-source.mjs. The software-rd seed ids therefore
|
|
89
|
+
* stay as a literal arm; any other string must pass validateRoleId or an
|
|
90
|
+
* explicit cast to enter the branded arm.
|
|
91
|
+
*/
|
|
67
92
|
export type RoleId =
|
|
68
93
|
| "pm"
|
|
69
94
|
| "architect"
|
|
@@ -75,7 +100,8 @@ export type RoleId =
|
|
|
75
100
|
| "security-engineer"
|
|
76
101
|
| "designer"
|
|
77
102
|
| "marketing"
|
|
78
|
-
| "data-engineer"
|
|
103
|
+
| "data-engineer"
|
|
104
|
+
| (string & { __roleId: true });
|
|
79
105
|
|
|
80
106
|
export type RoleDefinition = {
|
|
81
107
|
id: RoleId;
|
|
@@ -494,9 +520,23 @@ export type TeamProvisioningState = {
|
|
|
494
520
|
export type PluginConfig = {
|
|
495
521
|
mode: TeamClawMode;
|
|
496
522
|
port: number;
|
|
523
|
+
/**
|
|
524
|
+
* Issue #27: explicit HTTP listen host override for the worker HTTP server.
|
|
525
|
+
* Empty/undefined = follow the default policy (127.0.0.1 on hosts,
|
|
526
|
+
* 0.0.0.0 inside containers) - same resolution the controller applies.
|
|
527
|
+
*/
|
|
528
|
+
listenHost?: string;
|
|
497
529
|
role: RoleId;
|
|
498
530
|
controllerUrl: string;
|
|
499
531
|
teamName: string;
|
|
532
|
+
/**
|
|
533
|
+
* Phase 1.6 (vertical-team-profiles-design.md section 2.3): the team
|
|
534
|
+
* profile package id. Bootstrap value for FIRST initialization only -
|
|
535
|
+
* once a TeamState exists, TeamState.profileId is the single runtime
|
|
536
|
+
* truth and config changes have no effect (profile switching lands in
|
|
537
|
+
* Phase 2).
|
|
538
|
+
*/
|
|
539
|
+
teamProfile: string;
|
|
500
540
|
heartbeatIntervalMs: number;
|
|
501
541
|
processModel: ProcessModel;
|
|
502
542
|
/**
|
|
@@ -506,6 +546,12 @@ export type PluginConfig = {
|
|
|
506
546
|
*/
|
|
507
547
|
roleModelOverrides?: Partial<Record<RoleId, string>>;
|
|
508
548
|
taskTimeoutMs: number;
|
|
549
|
+
/**
|
|
550
|
+
* Phase 2.1 (design section 2.3, switch step 2): how long a profile switch
|
|
551
|
+
* drains in-flight tasks (assigned/in_progress) before force-collecting
|
|
552
|
+
* them and terminating the workers.
|
|
553
|
+
*/
|
|
554
|
+
teamSwitchDrainTimeoutMs: number;
|
|
509
555
|
gitEnabled: boolean;
|
|
510
556
|
gitRemoteUrl: string;
|
|
511
557
|
gitDefaultBranch: string;
|
|
@@ -551,9 +597,36 @@ export type WorkerIdentity = {
|
|
|
551
597
|
registeredAt: number;
|
|
552
598
|
};
|
|
553
599
|
|
|
600
|
+
/**
|
|
601
|
+
* Phase 2.1 (vertical-team-profiles-design.md section 2.3): the transition
|
|
602
|
+
* state machine for an in-flight team profile switch. Persisted inside
|
|
603
|
+
* TeamState so a controller crash can resume idempotently (archive file
|
|
604
|
+
* exists -> rebuild the new team; otherwise re-drain from scratch).
|
|
605
|
+
*/
|
|
606
|
+
export type TeamSwitchTransitionPhase = "draining" | "archiving" | "warming";
|
|
607
|
+
|
|
608
|
+
export type TeamSwitchTransition = {
|
|
609
|
+
phase: TeamSwitchTransitionPhase;
|
|
610
|
+
targetProfileId: string;
|
|
611
|
+
startedAt: number;
|
|
612
|
+
};
|
|
613
|
+
|
|
554
614
|
export type TeamState = {
|
|
555
615
|
/** Schema version for forward-compatible state migration. */
|
|
556
616
|
version?: number;
|
|
617
|
+
/**
|
|
618
|
+
* Phase 1.6 (design section 2.3): the active TeamProfile id. Single
|
|
619
|
+
* runtime truth - config teamProfile only seeds first initialization.
|
|
620
|
+
* Legacy states without this field migrate to the software-rd baseline.
|
|
621
|
+
*/
|
|
622
|
+
profileId: string;
|
|
623
|
+
/**
|
|
624
|
+
* Phase 2.1 (design section 2.3): set while a profile switch is in
|
|
625
|
+
* progress (drain -> archive -> rebuild -> warmup). Absent on a settled
|
|
626
|
+
* team. Its presence drives the 409/503 concurrency matrix and the
|
|
627
|
+
* crash-resume path in the controller startup chain.
|
|
628
|
+
*/
|
|
629
|
+
transition?: TeamSwitchTransition;
|
|
557
630
|
teamName: string;
|
|
558
631
|
workers: Record<string, WorkerInfo>;
|
|
559
632
|
tasks: Record<string, TaskInfo>;
|
|
@@ -621,8 +694,9 @@ function parseRoleModelOverrides(raw: unknown): Partial<Record<RoleId, string>>
|
|
|
621
694
|
const result: Partial<Record<RoleId, string>> = {};
|
|
622
695
|
let hasAny = false;
|
|
623
696
|
for (const [key, value] of Object.entries(raw as Record<string, unknown>)) {
|
|
624
|
-
|
|
625
|
-
|
|
697
|
+
const roleKey = validateRoleId(key);
|
|
698
|
+
if (roleKey && typeof value === "string" && value.trim()) {
|
|
699
|
+
result[roleKey] = value.trim();
|
|
626
700
|
hasAny = true;
|
|
627
701
|
}
|
|
628
702
|
}
|
|
@@ -638,9 +712,39 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
|
|
|
638
712
|
? raw.port
|
|
639
713
|
: 9527;
|
|
640
714
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
715
|
+
// Issue #27: explicit listen-host override for the worker HTTP server.
|
|
716
|
+
// Empty/absent keeps the default policy (loopback on hosts, all interfaces
|
|
717
|
+
// in containers) resolved in worker-service.ts.
|
|
718
|
+
const listenHost = typeof raw.listenHost === "string" && raw.listenHost.trim()
|
|
719
|
+
? raw.listenHost.trim()
|
|
720
|
+
: undefined;
|
|
721
|
+
|
|
722
|
+
// Issue #27: 9527 is ALSO the controller's default port. A controller and a
|
|
723
|
+
// worker on the same host both defaulting to it collide with a confusing
|
|
724
|
+
// EADDRINUSE at startup. Only the same-host dual-process case is a problem -
|
|
725
|
+
// an external worker legitimately using 9527 must keep working - so this
|
|
726
|
+
// stays a parse-time warning, never an error.
|
|
727
|
+
if (mode === "worker" && port === 9527) {
|
|
728
|
+
console.warn(
|
|
729
|
+
"[teamclaw] config warning: worker mode uses port 9527, which is also the controller default. " +
|
|
730
|
+
"Running a controller and this worker on the same host will conflict (EADDRINUSE); set this worker's `port` config key to another value in that topology.",
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
// Issue #192 (Phase 3 prerequisite): lenient worker-side role parsing.
|
|
735
|
+
// The registry validateRoleId folded any unknown role string (e.g. a
|
|
736
|
+
// minimal-bank "credit-officer") to developer, so a worker provisioned
|
|
737
|
+
// under an industry profile registered with the WRONG role against its
|
|
738
|
+
// controller (mismatch or 400). A non-empty string role is now preserved
|
|
739
|
+
// as written - RoleId is an open branded string and this explicit cast is
|
|
740
|
+
// the documented way for non-seed ids to enter (see the RoleId ruling
|
|
741
|
+
// above) - and legitimacy is finally adjudicated by the controller's
|
|
742
|
+
// validateActiveRoleId at registration, where the ACTIVE profile is the
|
|
743
|
+
// single source of truth. DEFAULT_ROLE still applies only when the role
|
|
744
|
+
// is missing, not a string, or blank.
|
|
745
|
+
const role = typeof raw.role === "string" && raw.role.trim()
|
|
746
|
+
? (raw.role.trim() as RoleId)
|
|
747
|
+
: DEFAULT_ROLE;
|
|
644
748
|
|
|
645
749
|
const controllerUrl = typeof raw.controllerUrl === "string"
|
|
646
750
|
? raw.controllerUrl.trim()
|
|
@@ -650,6 +754,13 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
|
|
|
650
754
|
? raw.teamName.trim()
|
|
651
755
|
: "TeamClaw";
|
|
652
756
|
|
|
757
|
+
// Phase 1.6: first-initialization bootstrap value. Existence of the id is
|
|
758
|
+
// checked by the controller startup chain (unknown ids fall back to the
|
|
759
|
+
// software-rd baseline with a warning); here we only normalize the shape.
|
|
760
|
+
const teamProfile = typeof raw.teamProfile === "string" && raw.teamProfile.trim()
|
|
761
|
+
? raw.teamProfile.trim()
|
|
762
|
+
: SOFTWARE_RD_PROFILE_ID;
|
|
763
|
+
|
|
653
764
|
const heartbeatIntervalMs = typeof raw.heartbeatIntervalMs === "number" && raw.heartbeatIntervalMs >= 1000
|
|
654
765
|
? raw.heartbeatIntervalMs
|
|
655
766
|
: 10000;
|
|
@@ -660,6 +771,11 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
|
|
|
660
771
|
? raw.taskTimeoutMs
|
|
661
772
|
: 600_000;
|
|
662
773
|
|
|
774
|
+
// Phase 2.1: graceful-drain budget for a team profile switch (design 2.3).
|
|
775
|
+
const teamSwitchDrainTimeoutMs = typeof raw.teamSwitchDrainTimeoutMs === "number" && raw.teamSwitchDrainTimeoutMs >= 1000
|
|
776
|
+
? raw.teamSwitchDrainTimeoutMs
|
|
777
|
+
: 30_000;
|
|
778
|
+
|
|
663
779
|
const gitEnabled = typeof raw.gitEnabled === "boolean" ? raw.gitEnabled : true;
|
|
664
780
|
|
|
665
781
|
const gitRemoteUrl = typeof raw.gitRemoteUrl === "string"
|
|
@@ -780,13 +896,16 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
|
|
|
780
896
|
return {
|
|
781
897
|
mode,
|
|
782
898
|
port,
|
|
899
|
+
listenHost,
|
|
783
900
|
role,
|
|
784
901
|
controllerUrl,
|
|
785
902
|
teamName,
|
|
903
|
+
teamProfile,
|
|
786
904
|
heartbeatIntervalMs,
|
|
787
905
|
processModel,
|
|
788
906
|
roleModelOverrides: parseRoleModelOverrides(raw.roleModelOverrides),
|
|
789
907
|
taskTimeoutMs,
|
|
908
|
+
teamSwitchDrainTimeoutMs,
|
|
790
909
|
gitEnabled,
|
|
791
910
|
gitRemoteUrl,
|
|
792
911
|
gitDefaultBranch,
|
|
@@ -822,11 +941,9 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
|
|
|
822
941
|
}
|
|
823
942
|
|
|
824
943
|
function parseRoleList(raw: unknown): RoleId[] {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
.map((entry) => entry as RoleId))]
|
|
829
|
-
: [];
|
|
944
|
+
// Phase 0.3: delegates to the shared validateRoleIdList guard in roles.ts
|
|
945
|
+
// (same filter + first-occurrence dedup semantics as before).
|
|
946
|
+
return validateRoleIdList(raw);
|
|
830
947
|
}
|
|
831
948
|
|
|
832
949
|
function parseProvisioningType(raw: unknown): WorkerProvisioningType {
|
|
@@ -877,8 +994,8 @@ const VALID_PROVISIONING_TYPES: WorkerProvisioningType[] = [
|
|
|
877
994
|
"kubernetes",
|
|
878
995
|
];
|
|
879
996
|
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
];
|
|
997
|
+
// Not referenced at runtime anymore: role validation goes through
|
|
998
|
+
// validateRoleId/validateRoleIdList in roles.ts (Phase 0.3). Phase 1.2 folds
|
|
999
|
+
// the former hand-written copy into the registry: the value now derives from
|
|
1000
|
+
// roles.ts ROLE_IDS so it can never drift from the single source of truth.
|
|
1001
|
+
const VALID_ROLES: RoleId[] = ROLE_IDS;
|