wendkeep 0.37.0 → 0.38.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.
@@ -8,17 +8,17 @@ import { createHash } from 'node:crypto';
8
8
  import { join } from 'node:path';
9
9
  import { pathToFileURL } from 'node:url';
10
10
  import {
11
- findActiveSessionByTranscript,
12
11
  formatDate,
13
12
  getVaultBase,
14
- readControl,
15
13
  readHookInput,
16
14
  slugify,
15
+ upsertSessionRegistry,
17
16
  wikilinkFromRel,
18
17
  writeHookOutput,
19
18
  } from './obsidian-common.mjs';
20
19
  import { activeChange, newChange } from './change-core.mjs';
21
20
  import { getLocale } from './locale.mjs';
21
+ import { resolveSessionEntry } from './session-identity.mjs';
22
22
 
23
23
  // O plano aprovado chega por um de três canais, conforme a versão do Claude Code:
24
24
  // tool_input.plan (legado), o bloco "## Approved Plan" do tool_response, ou o arquivo de plano
@@ -94,15 +94,15 @@ export function capturePlan(vaultBase, input) {
94
94
  const en = loc.id === 'en';
95
95
  const dateStr = formatDate(new Date());
96
96
  const rawNote = `---\ntype: plan\ndate: ${dateStr}\ntags:\n - plano\n---\n\n${plan.trim()}\n`;
97
- const transcriptPath = input?.transcript_path ?? input?.transcriptPath ?? '';
98
- const sessionRel = findActiveSessionByTranscript(vaultBase, transcriptPath)?.session_file
99
- || readControl(vaultBase).session_file
100
- || '';
97
+ const { identity, entry } = resolveSessionEntry(vaultBase, input, 'claude');
98
+ if (identity.state !== 'resolved') return null;
99
+ const sessionRel = entry?.session_file || '';
101
100
 
102
- const active = activeChange(vaultBase);
101
+ const active = entry?.change_slug || activeChange(vaultBase);
103
102
  if (active) {
104
103
  const dir = join(vaultBase, loc.folders.changes, active);
105
104
  persistApprovedPlan(dir, active, rawNote, plan, dateStr);
105
+ upsertSessionRegistry(vaultBase, identity.canonicalConversationId, { change_slug: active });
106
106
  return {
107
107
  slug: active, created: false,
108
108
  context: `<plan_captured>\n${en
@@ -113,6 +113,7 @@ export function capturePlan(vaultBase, input) {
113
113
 
114
114
  const slug = planSlug(plan);
115
115
  newChange(vaultBase, slug, { dateStr, sessionRel });
116
+ upsertSessionRegistry(vaultBase, identity.canonicalConversationId, { change_slug: slug });
116
117
  const dir = join(vaultBase, loc.folders.changes, slug);
117
118
  const ctx = sectionBody(plan, ['Contexto', 'Context']) || plan.trim().split('\n').slice(0, 6).join('\n');
118
119
  const source = sessionRel ? `\n - "${wikilinkFromRel(sessionRel)}"` : ' []';
@@ -1,58 +1,58 @@
1
- {
2
- "_nota": "Preços API por milhão de tokens. cachedInput = cache read. Cache write aplica multiplicador no código: 5m = 1.25x input, 1h = 2x input. Editar aqui quando o provedor mudar preços (sem mexer no .mjs). Se o arquivo sumir ou ficar inválido, o hook usa a tabela embutida em token-usage.mjs.",
1
+ {
2
+ "_nota": "Preços API por milhão de tokens. cachedInput = cache read. Cache write aplica multiplicador no código: 5m = 1.25x input, 1h = 2x input. Editar aqui quando o provedor mudar preços (sem mexer no .mjs). Se o arquivo sumir ou ficar inválido, o hook usa a tabela embutida em token-usage.mjs.",
3
3
  "_fonte": "OpenAI https://openai.com/index/gpt-5-6/ e https://help.openai.com/en/articles/20001325-a-preview-of-gpt-56-sol-terra-and-luna; Anthropic https://www.anthropic.com/pricing — conferido 2026-07-11",
4
4
  "models": {
5
5
  "gpt-5.6-sol": { "label": "GPT-5.6 Sol API", "provider": "openai", "input": 5, "cachedInput": 0.5, "output": 30 },
6
6
  "gpt-5.6-terra": { "label": "GPT-5.6 Terra API", "provider": "openai", "input": 2.5, "cachedInput": 0.25, "output": 15 },
7
7
  "gpt-5.6-luna": { "label": "GPT-5.6 Luna API", "provider": "openai", "input": 1, "cachedInput": 0.1, "output": 6 },
8
- "gpt-5.5": {
9
- "label": "GPT-5.5 API",
10
- "provider": "openai",
11
- "input": 5,
12
- "cachedInput": 0.5,
13
- "output": 30
14
- },
15
- "claude-opus-4.7": {
16
- "label": "Claude Opus 4.7 API",
17
- "provider": "anthropic",
18
- "input": 5,
19
- "cachedInput": 0.5,
20
- "output": 25
21
- },
22
- "claude-opus-4.8": {
23
- "label": "Claude Opus 4.8 API",
24
- "provider": "anthropic",
25
- "input": 5,
26
- "cachedInput": 0.5,
27
- "output": 25
28
- },
29
- "claude-sonnet-4.6": {
30
- "label": "Claude Sonnet 4.6 API",
31
- "provider": "anthropic",
32
- "input": 3,
33
- "cachedInput": 0.3,
34
- "output": 15
35
- },
36
- "claude-sonnet-5": {
37
- "label": "Claude Sonnet 5 API",
38
- "provider": "anthropic",
39
- "input": 3,
40
- "cachedInput": 0.3,
41
- "output": 15
42
- },
43
- "claude-haiku-4.5": {
44
- "label": "Claude Haiku 4.5 API",
45
- "provider": "anthropic",
46
- "input": 1,
47
- "cachedInput": 0.1,
48
- "output": 5
49
- },
50
- "claude-fable-5": {
51
- "label": "Claude Fable 5 API",
52
- "provider": "anthropic",
53
- "input": 10,
54
- "cachedInput": 1,
55
- "output": 50
56
- }
57
- }
58
- }
8
+ "gpt-5.5": {
9
+ "label": "GPT-5.5 API",
10
+ "provider": "openai",
11
+ "input": 5,
12
+ "cachedInput": 0.5,
13
+ "output": 30
14
+ },
15
+ "claude-opus-4.7": {
16
+ "label": "Claude Opus 4.7 API",
17
+ "provider": "anthropic",
18
+ "input": 5,
19
+ "cachedInput": 0.5,
20
+ "output": 25
21
+ },
22
+ "claude-opus-4.8": {
23
+ "label": "Claude Opus 4.8 API",
24
+ "provider": "anthropic",
25
+ "input": 5,
26
+ "cachedInput": 0.5,
27
+ "output": 25
28
+ },
29
+ "claude-sonnet-4.6": {
30
+ "label": "Claude Sonnet 4.6 API",
31
+ "provider": "anthropic",
32
+ "input": 3,
33
+ "cachedInput": 0.3,
34
+ "output": 15
35
+ },
36
+ "claude-sonnet-5": {
37
+ "label": "Claude Sonnet 5 API",
38
+ "provider": "anthropic",
39
+ "input": 3,
40
+ "cachedInput": 0.3,
41
+ "output": 15
42
+ },
43
+ "claude-haiku-4.5": {
44
+ "label": "Claude Haiku 4.5 API",
45
+ "provider": "anthropic",
46
+ "input": 1,
47
+ "cachedInput": 0.1,
48
+ "output": 5
49
+ },
50
+ "claude-fable-5": {
51
+ "label": "Claude Fable 5 API",
52
+ "provider": "anthropic",
53
+ "input": 10,
54
+ "cachedInput": 1,
55
+ "output": 50
56
+ }
57
+ }
58
+ }