@principles/workbuddy-adapter 0.2.4 → 0.2.6

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.
@@ -180,6 +180,18 @@ export function decodeWorkbuddyInput(raw) {
180
180
  // is ever fabricated when missing (rc-6).
181
181
  const turnId = consumedOptionalString(raw, 'generation_id');
182
182
  const base = { sessionId, ...(turnId !== undefined ? { turnId } : {}) };
183
+ // SPEC-PD-MODEL-AWARE-PROMPT-BUDGET-001 §5.3: `model` is an OBSERVED
184
+ // OPTIONAL field of the frozen host contract — the only model identity
185
+ // this host exposes (no capacity field exists). Consumed SOFTLY (absent or
186
+ // malformed → undefined, fixed-budget fallback) rather than
187
+ // consumedOptionalString's fail-loud: SPEC §8.6 forbids metadata failure
188
+ // from blocking the host conversation, and a bad model string degrades to
189
+ // the legacy budget instead of erroring the hook. Dynamic support is
190
+ // therefore catalog-unambiguous-match-only — never a guessed capacity.
191
+ const rawModel = own(raw, 'model');
192
+ const modelId = typeof rawModel === 'string' && rawModel.trim().length > 0 ? rawModel : undefined;
193
+ const modelContext = modelId !== undefined ? { modelId } : undefined;
194
+ const baseWithContext = modelContext !== undefined ? { ...base, modelContext } : base;
183
195
  let context;
184
196
  let rawPayload = raw;
185
197
  if (kind === 'session_start') {
@@ -190,12 +202,12 @@ export function decodeWorkbuddyInput(raw) {
190
202
  requiredString(raw, 'permission_mode');
191
203
  requiredString(raw, 'client');
192
204
  requiredString(raw, 'version');
193
- context = { ...base, workspaceDir: '', source };
205
+ context = { ...baseWithContext, workspaceDir: '', source };
194
206
  }
195
207
  else if (kind === 'before_prompt_build') {
196
208
  const cwd = requiredAbsoluteCwd(raw);
197
209
  validateOptionalStringType(raw, 'permission_mode');
198
- context = { ...base, workspaceDir: cwd, promptContent: requiredString(raw, 'prompt') };
210
+ context = { ...baseWithContext, workspaceDir: cwd, promptContent: requiredString(raw, 'prompt') };
199
211
  }
200
212
  else {
201
213
  const cwd = requiredAbsoluteCwd(raw);
@@ -218,10 +230,10 @@ export function decodeWorkbuddyInput(raw) {
218
230
  const thrownError = requiredString(raw, 'error');
219
231
  toolOutput = { result: raw, error: thrownError };
220
232
  }
221
- context = { ...base, workspaceDir: cwd, toolName, ...(callId !== undefined ? { toolCallId: callId } : {}), toolInput, toolOutput };
233
+ context = { ...baseWithContext, workspaceDir: cwd, toolName, ...(callId !== undefined ? { toolCallId: callId } : {}), toolInput, toolOutput };
222
234
  }
223
235
  else {
224
- context = { ...base, workspaceDir: cwd, toolName, ...(callId !== undefined ? { toolCallId: callId } : {}), toolInput };
236
+ context = { ...baseWithContext, workspaceDir: cwd, toolName, ...(callId !== undefined ? { toolCallId: callId } : {}), toolInput };
225
237
  }
226
238
  // The shared production gate reads its tool tuple from rawPayload.toolInput
227
239
  // (production-rulehost-gate readToolInput contract).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/workbuddy-adapter",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "WorkBuddy host adapter for Principles Disciple — implements the HostAdapter interface for WorkBuddy's Git Bash command-hook model (ADR-0020 third host, SPEC workbuddy-host-adapter v0.3.0).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,8 +42,8 @@
42
42
  "lint": "eslint \"src/**/*.ts\""
43
43
  },
44
44
  "dependencies": {
45
- "@principles/core": "^1.294.1",
46
- "@principles/host-runtime": "^0.10.4",
45
+ "@principles/core": "^1.295.0",
46
+ "@principles/host-runtime": "^0.12.0",
47
47
  "@principles/install-layout": "^0.4.0"
48
48
  },
49
49
  "devDependencies": {