@teamclaws/teamclaw 2026.11.0 → 2026.11.1

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.
Files changed (120) hide show
  1. package/cli.mjs +272 -2
  2. package/dist/index.js +54 -32
  3. package/dist/src/config.js +24 -0
  4. package/dist/src/controller/auth-routes.js +129 -0
  5. package/dist/src/controller/clarification-routes.js +1 -1
  6. package/dist/src/controller/controller-planning.js +1 -0
  7. package/dist/src/controller/controller-routes.js +195 -0
  8. package/dist/src/controller/controller-service.js +67 -10
  9. package/dist/src/controller/controller-tools.js +3 -1
  10. package/dist/src/controller/github-auth.js +2 -1
  11. package/dist/src/controller/http-server.js +51 -16
  12. package/dist/src/controller/kickoff-orchestrator.js +3 -39
  13. package/dist/src/controller/message-delivery.js +4 -1
  14. package/dist/src/controller/orchestration-manifest.js +5 -65
  15. package/dist/src/controller/preview-manager.js +51 -3
  16. package/dist/src/controller/profile-switch.js +42 -22
  17. package/dist/src/controller/provisioning/backend-contract.js +9 -0
  18. package/dist/src/controller/provisioning/container-shared.js +64 -0
  19. package/dist/src/controller/provisioning/docker.js +214 -0
  20. package/dist/src/controller/provisioning/kubernetes.js +244 -0
  21. package/dist/src/controller/provisioning/plugin-root.js +41 -0
  22. package/dist/src/controller/provisioning/process-supervisor.js +190 -0
  23. package/dist/src/controller/provisioning-config.js +239 -0
  24. package/dist/src/controller/repo-routes.js +70 -4
  25. package/dist/src/controller/report-routes.js +56 -0
  26. package/dist/src/controller/route-table.js +67 -1045
  27. package/dist/src/controller/security.js +775 -0
  28. package/dist/src/controller/status-routes.js +287 -0
  29. package/dist/src/controller/task-assignment.js +5 -2
  30. package/dist/src/controller/task-execution.js +31 -0
  31. package/dist/src/controller/task-results.js +10 -0
  32. package/dist/src/controller/tunnel-manager.js +41 -8
  33. package/dist/src/controller/tunnel-routes.js +225 -0
  34. package/dist/src/controller/websocket.js +6 -2
  35. package/dist/src/controller/webui-routes.js +49 -0
  36. package/dist/src/controller/worker-provisioning.js +39 -949
  37. package/dist/src/controller/workflow-routes.js +407 -0
  38. package/dist/src/controller/workspace-routes.js +200 -0
  39. package/dist/src/git-collaboration.js +4 -9
  40. package/dist/src/identity.js +12 -1
  41. package/dist/src/profile-loader.js +119 -1
  42. package/dist/src/profiles/banking.json +26 -2
  43. package/dist/src/profiles/schema.json +82 -2
  44. package/dist/src/prompt-policy.js +18 -6
  45. package/dist/src/protocol.js +66 -3
  46. package/dist/src/shared/clarification-schema.js +65 -0
  47. package/dist/src/shared/github-auth.js +15 -0
  48. package/dist/src/shared/kickoff-prompt.js +37 -0
  49. package/dist/src/shared/utils.js +47 -0
  50. package/dist/src/state.js +89 -3
  51. package/dist/src/types.js +15 -1
  52. package/dist/src/ui/app.js +846 -62
  53. package/dist/src/ui/github-login.html +1 -0
  54. package/dist/src/ui/index.html +102 -36
  55. package/dist/src/worker/http-handler.js +59 -0
  56. package/dist/src/worker/skill-installer.js +3 -9
  57. package/dist/src/worker/tools.js +20 -10
  58. package/dist/src/worker/worker-service.js +17 -4
  59. package/index.ts +61 -32
  60. package/openclaw.plugin.json +23 -2
  61. package/package.json +1 -1
  62. package/src/config.ts +24 -0
  63. package/src/controller/auth-routes.ts +157 -0
  64. package/src/controller/clarification-routes.ts +1 -1
  65. package/src/controller/controller-planning.ts +8 -0
  66. package/src/controller/controller-routes.ts +237 -0
  67. package/src/controller/controller-service.ts +128 -10
  68. package/src/controller/controller-tools.ts +5 -2
  69. package/src/controller/github-auth.ts +28 -63
  70. package/src/controller/http-server.ts +66 -17
  71. package/src/controller/kickoff-orchestrator.ts +3 -42
  72. package/src/controller/message-delivery.ts +4 -1
  73. package/src/controller/orchestration-manifest.ts +8 -71
  74. package/src/controller/preview-manager.ts +53 -3
  75. package/src/controller/profile-switch.ts +53 -23
  76. package/src/controller/provisioning/backend-contract.ts +51 -0
  77. package/src/controller/provisioning/container-shared.ts +84 -0
  78. package/src/controller/provisioning/docker.ts +260 -0
  79. package/src/controller/provisioning/kubernetes.ts +263 -0
  80. package/src/controller/provisioning/plugin-root.ts +42 -0
  81. package/src/controller/provisioning/process-supervisor.ts +214 -0
  82. package/src/controller/provisioning-config.ts +289 -0
  83. package/src/controller/repo-routes.ts +84 -12
  84. package/src/controller/report-routes.ts +64 -0
  85. package/src/controller/route-table.ts +133 -1152
  86. package/src/controller/security.ts +899 -0
  87. package/src/controller/status-routes.ts +354 -0
  88. package/src/controller/task-assignment.ts +5 -1
  89. package/src/controller/task-execution.ts +43 -0
  90. package/src/controller/task-results.ts +12 -0
  91. package/src/controller/tunnel-manager.ts +45 -8
  92. package/src/controller/tunnel-routes.ts +231 -0
  93. package/src/controller/websocket.ts +19 -3
  94. package/src/controller/webui-routes.ts +55 -0
  95. package/src/controller/worker-provisioning.ts +51 -1117
  96. package/src/controller/workflow-routes.ts +498 -0
  97. package/src/controller/workspace-routes.ts +222 -0
  98. package/src/git-collaboration.ts +4 -9
  99. package/src/identity.ts +13 -1
  100. package/src/profile-loader.ts +167 -1
  101. package/src/profiles/banking.json +26 -2
  102. package/src/profiles/schema.json +82 -2
  103. package/src/prompt-policy.ts +19 -6
  104. package/src/protocol.ts +72 -2
  105. package/src/shared/clarification-schema.ts +81 -0
  106. package/src/shared/github-auth.ts +92 -0
  107. package/src/shared/kickoff-prompt.ts +47 -0
  108. package/src/shared/utils.ts +51 -0
  109. package/src/state.ts +92 -3
  110. package/src/teamauto/github-client.ts +2 -1
  111. package/src/teamauto/repo-sync.ts +2 -1
  112. package/src/teamauto/scheduler.ts +2 -1
  113. package/src/types.ts +130 -1
  114. package/src/ui/app.js +846 -62
  115. package/src/ui/github-login.html +1 -0
  116. package/src/ui/index.html +102 -36
  117. package/src/worker/http-handler.ts +64 -1
  118. package/src/worker/skill-installer.ts +3 -9
  119. package/src/worker/tools.ts +21 -10
  120. package/src/worker/worker-service.ts +18 -4
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TEAMCLAW_PUBLISHED_RUNTIME_IMAGE } from "./install-defaults.js";
2
- import { DEFAULT_GITHUB_CLIENT_ID } from "./controller/github-auth.js";
2
+ import { DEFAULT_GITHUB_CLIENT_ID } from "./shared/github-auth.js";
3
3
  // Safe value import: roles.js only pulls prompt-policy.js -> openclaw-workspace.js
4
4
  // at runtime (its types.js import is type-only), so no module cycle is formed.
5
5
  import { DEFAULT_ROLE } from "./roles.js";
@@ -158,6 +158,37 @@ export type TaskInfo = {
158
158
  /** Surviving progress snapshot for interrupted executions (resume support). */
159
159
  checkpoint?: TaskCheckpoint;
160
160
  resumeAttempt?: number;
161
+ /**
162
+ * Design 2.4 workflow-chain membership: set ONLY by the workflow engine
163
+ * (controller/workflow-routes.ts) when it creates a step task, never by
164
+ * client task creation (the create route builds TaskInfo field-by-field
165
+ * and does not accept this field). The task-completion hook reads it to
166
+ * route the chain by the step's conclusion. The task chain itself is the
167
+ * workflow run state - there is no separate run registry by design.
168
+ */
169
+ workflow?: TaskWorkflowContext;
170
+ };
171
+
172
+ /**
173
+ * Workflow-chain context carried on each design-2.4 step task. `visitCounts`
174
+ * is the loop guard for return edges (e.g. 退回补充材料 -> step 0) and the
175
+ * routed* fields are the once-only routing latch: exactly one completion of
176
+ * a step task may spawn the follow-up task.
177
+ */
178
+ export type TaskWorkflowContext = {
179
+ /** Profile workflow template id (e.g. "credit-approval"). */
180
+ workflowId: string;
181
+ /** Run nonce shared by every task of one started workflow instance. */
182
+ runId: string;
183
+ /** String form of the executed step's id (numeric spine or branch key). */
184
+ stepKey: string;
185
+ /** Visits per step key so return edges cannot loop forever. */
186
+ visitCounts?: Record<string, number>;
187
+ /** Routing latch: step key the completion hook routed to (chain end = ""). */
188
+ routedToStepKey?: string;
189
+ routedAt?: number;
190
+ /** Conclusion phrase that drove the routing (observability/audit). */
191
+ routedConclusion?: string;
161
192
  };
162
193
 
163
194
  export type TaskExecutionEvent = {
@@ -565,6 +596,19 @@ export type PluginConfig = {
565
596
  */
566
597
  githubClientSecret: string;
567
598
  agentIsolationMode: AgentIsolationMode;
599
+ /**
600
+ * Issue #23: controller device-pairing security options. Parsed with
601
+ * safe defaults (autoPair: true) so hand-built configs without the key
602
+ * keep the L1 zero-input LAN pairing behavior.
603
+ */
604
+ security?: SecurityConfig;
605
+ /**
606
+ * Issue #23 (client wave): device token this instance presents to a
607
+ * protected controller (X-TeamClaw-Token on every API call). Written by
608
+ * `teamclaw pair` / the desktop pairing flow; empty string = unpaired L0
609
+ * behavior. NEVER logged or echoed back through config UIs.
610
+ */
611
+ securityToken: string;
568
612
  workerProvisioningType: WorkerProvisioningType;
569
613
  workerProvisioningDisabled: boolean;
570
614
  workerProvisioningControllerUrl: string;
@@ -597,6 +641,68 @@ export type WorkerIdentity = {
597
641
  registeredAt: number;
598
642
  };
599
643
 
644
+ // ===========================================================================
645
+ // Device pairing security (issue #23, backend wave).
646
+ //
647
+ // Zero-friction ladder (product semantics, FIXED):
648
+ // L0 local - no devices persisted => no authentication at all (the
649
+ // historical behavior; a state without `security` is L0)
650
+ // L1 LAN - LAN peers (loopback / RFC1918 / ULA / link-local) may
651
+ // self-pair via POST /api/v1/security/pair-auto while
652
+ // config.security.autoPair is true (default)
653
+ // L2 exposed - one-shot 60s pairing codes minted by an authenticated
654
+ // device or the loopback console
655
+ // The user never configures a token and the UI never shows a login page.
656
+ // Tokens are 32-byte hex secrets returned to the pairing caller EXACTLY
657
+ // ONCE; only their sha256 hex digest is persisted.
658
+ // ===========================================================================
659
+
660
+ export type SecurityDeviceKind = "web" | "worker" | "desktop" | "cli";
661
+
662
+ export type SecurityDevice = {
663
+ id: string;
664
+ name: string;
665
+ kind: SecurityDeviceKind;
666
+ /** sha256 hex of the device token. The plaintext token is never persisted. */
667
+ tokenHash: string;
668
+ createdAt: number;
669
+ /** Epoch ms of the last authenticated request (throttled persistence). */
670
+ lastSeenAt?: number;
671
+ /** Where the device paired from (peer IP, or "loopback" for the console). */
672
+ origin?: string;
673
+ };
674
+
675
+ export type SecurityPairingCode = {
676
+ /** 8-character uppercase base32 (RFC 4648) code, displayed once to a human. */
677
+ code: string;
678
+ /** Absolute expiry (epoch ms); pairing codes live 60 seconds. */
679
+ expiresAt: number;
680
+ purpose: string;
681
+ /** Set when consumed; a used code can never pair a second device. */
682
+ usedAt?: number;
683
+ };
684
+
685
+ export type NonLanPeerObservation = {
686
+ ip: string;
687
+ at: number;
688
+ path: string;
689
+ };
690
+
691
+ export type TeamSecurityState = {
692
+ /** Set when protection was first enabled (first device minted); the suggestion signal below may exist without it while still L0. */
693
+ enabledAt?: number;
694
+ /** Protection is ON iff this array is non-empty (the L0/L1/L2 ladder switch). */
695
+ devices: SecurityDevice[];
696
+ pairingCode?: SecurityPairingCode;
697
+ /** Suggestion signal: latest non-LAN peer observed while protection is off. */
698
+ lastNonLanPeer?: NonLanPeerObservation;
699
+ };
700
+
701
+ export type SecurityConfig = {
702
+ /** Allow zero-input pairing from LAN peers (POST /api/v1/security/pair-auto). */
703
+ autoPair: boolean;
704
+ };
705
+
600
706
  /**
601
707
  * Phase 2.1 (vertical-team-profiles-design.md section 2.3): the transition
602
708
  * state machine for an in-flight team profile switch. Persisted inside
@@ -638,6 +744,13 @@ export type TeamState = {
638
744
  provisioning?: TeamProvisioningState;
639
745
  previews?: Record<string, DynamicPreviewRecord>;
640
746
  reports?: Record<string, DeliveryReportRecord>;
747
+ /**
748
+ * Issue #23: device-pairing security state. ABSENT or carrying an empty
749
+ * devices array = protection off (L0 zero-friction default, the exact
750
+ * pre-issue behavior); a non-empty devices array turns the auth
751
+ * middleware on (see controller/security.ts).
752
+ */
753
+ security?: TeamSecurityState;
641
754
  createdAt: number;
642
755
  updatedAt: number;
643
756
  };
@@ -807,6 +920,20 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
807
920
  ? raw.agentIsolationMode
808
921
  : "independent";
809
922
 
923
+ // Issue #23: security.autoPair defaults to true (L1 zero-input LAN
924
+ // pairing); only an explicit boolean false disables pair-auto.
925
+ const rawSecurity = raw.security;
926
+ const rawAutoPair = rawSecurity && typeof rawSecurity === "object" && !Array.isArray(rawSecurity)
927
+ ? (rawSecurity as { autoPair?: unknown }).autoPair
928
+ : undefined;
929
+ const security: SecurityConfig = {
930
+ autoPair: typeof rawAutoPair === "boolean" ? rawAutoPair : true,
931
+ };
932
+
933
+ // Issue #23 (client wave): the paired device token, if this instance
934
+ // paired with a protected controller. Empty/absent keeps L0 behavior.
935
+ const securityToken = typeof raw.securityToken === "string" ? raw.securityToken.trim() : "";
936
+
810
937
  const rawWorkerProvisioningType = parseProvisioningType(raw.workerProvisioningType);
811
938
  const workerProvisioningDisabled = raw.workerProvisioningDisabled === true;
812
939
  // Legacy local installs often persisted workerProvisioningType="none" without
@@ -914,6 +1041,8 @@ export function parsePluginConfig(raw: Record<string, unknown> = {}): PluginConf
914
1041
  githubClientId,
915
1042
  githubClientSecret,
916
1043
  agentIsolationMode,
1044
+ security,
1045
+ securityToken,
917
1046
  workerProvisioningType,
918
1047
  workerProvisioningDisabled,
919
1048
  workerProvisioningControllerUrl,