@adhdev/mesh-shared 1.0.82-rc.47 → 1.0.82-rc.48

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.
@@ -87,3 +87,10 @@ export interface LightLandRequest {
87
87
  partial?: boolean;
88
88
  approvedPublishShas?: string[];
89
89
  }
90
+ /**
91
+ * True when a session record/state (or a bare settings object) belongs to a light-task worker, i.e.
92
+ * it was launched with `settings.lightWorkspaceId`. A light session is bound to ONE task's scratch
93
+ * workspace and, by the central claim rule, can never claim any other row — so it is never "the
94
+ * node's worker" for duplicate-launch guards, auto-launch gating or concurrency counts.
95
+ */
96
+ export declare function isLightWorkerSession(session: unknown): boolean;
@@ -63,6 +63,11 @@ export interface WorkerProtocolFooterInput {
63
63
  ossBaseSha?: string;
64
64
  ownedPaths: string[];
65
65
  };
66
+ /**
67
+ * Code-changing task on a shared (non-worktree) node checkout, not a light task: the worker commits on the
68
+ * branch that is currently checked out. Renders the "do not create or switch branches" rule.
69
+ */
70
+ commitOnCurrentBranch?: boolean;
66
71
  /**
67
72
  * Review-in-task (docs/design/2026-11-01-review-in-task.md §9.3): present when this
68
73
  * dispatch is one stage of a stage pipeline. `workspace` is the reviewer's pinned
@@ -77,6 +82,8 @@ export interface WorkerProtocolFooterInput {
77
82
  }
78
83
  /** Light-workspace worker rules (design §9). */
79
84
  export declare function renderLightWorkspaceRules(light: NonNullable<WorkerProtocolFooterInput['light']>): string[];
85
+ /** Base-node code changes land on the branch the coordinator and review expect: the one already checked out. */
86
+ export declare const WORKER_CURRENT_BRANCH_RULE: string;
80
87
  export declare function hasWorkerProtocolFooter(body: string): boolean;
81
88
  /**
82
89
  * The protocol block appended to a dispatched task. Written for the model that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/mesh-shared",
3
- "version": "1.0.82-rc.47",
3
+ "version": "1.0.82-rc.48",
4
4
  "description": "ADHDev mesh-shared — pure mesh/git status normalizers shared by daemon-core and web-core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/light-task.ts CHANGED
@@ -101,3 +101,16 @@ export interface LightLandRequest {
101
101
  partial?: boolean
102
102
  approvedPublishShas?: string[]
103
103
  }
104
+
105
+ /**
106
+ * True when a session record/state (or a bare settings object) belongs to a light-task worker, i.e.
107
+ * it was launched with `settings.lightWorkspaceId`. A light session is bound to ONE task's scratch
108
+ * workspace and, by the central claim rule, can never claim any other row — so it is never "the
109
+ * node's worker" for duplicate-launch guards, auto-launch gating or concurrency counts.
110
+ */
111
+ export function isLightWorkerSession(session: unknown): boolean {
112
+ const s = session as any
113
+ if (!s || typeof s !== 'object') return false
114
+ const has = (o: any): boolean => !!o && typeof o === 'object' && typeof o.lightWorkspaceId === 'string' && o.lightWorkspaceId.trim() !== ''
115
+ return has(s.settings) || has(s.launchRecord?.settings) || has(s)
116
+ }
@@ -91,6 +91,11 @@ export interface WorkerProtocolFooterInput {
91
91
  * Renders the light-workspace rules (stay inside, commit there, no installs).
92
92
  */
93
93
  light?: { workspace: string; baseSha: string; ossBaseSha?: string; ownedPaths: string[] }
94
+ /**
95
+ * Code-changing task on a shared (non-worktree) node checkout, not a light task: the worker commits on the
96
+ * branch that is currently checked out. Renders the "do not create or switch branches" rule.
97
+ */
98
+ commitOnCurrentBranch?: boolean
94
99
  /**
95
100
  * Review-in-task (docs/design/2026-11-01-review-in-task.md §9.3): present when this
96
101
  * dispatch is one stage of a stage pipeline. `workspace` is the reviewer's pinned
@@ -115,6 +120,11 @@ export function renderLightWorkspaceRules(light: NonNullable<WorkerProtocolFoote
115
120
  ]
116
121
  }
117
122
 
123
+ /** Base-node code changes land on the branch the coordinator and review expect: the one already checked out. */
124
+ export const WORKER_CURRENT_BRANCH_RULE =
125
+ 'Commit your change on the branch that is currently checked out in this workspace. Do not create or switch '
126
+ + 'branches (no `git checkout -b` / `git switch`) unless the task explicitly says to; report the branch you committed on.'
127
+
118
128
  export function hasWorkerProtocolFooter(body: string): boolean {
119
129
  return typeof body === 'string' && body.includes(WORKER_PROTOCOL_FOOTER_MARKER)
120
130
  }
@@ -151,6 +161,7 @@ export function renderWorkerProtocolFooter(input: WorkerProtocolFooterInput = {}
151
161
  if (scope.length) lines.push(`You are a delegated worker (${scope.join(', ')}).`)
152
162
  else lines.push('You are a delegated worker.')
153
163
  if (input.light) lines.push(...renderLightWorkspaceRules(input.light))
164
+ else if (input.commitOnCurrentBranch && input.stage?.role !== 'review') lines.push(WORKER_CURRENT_BRANCH_RULE)
154
165
  if (input.workerMcp === false) {
155
166
  lines.push(
156
167
  'This session has NO adhdev worker tools (`report_completion`, `progress_update`, `peer_context_pull`, '