jfl 0.7.2 → 0.8.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.
Files changed (93) hide show
  1. package/dist/commands/context-hub.d.ts.map +1 -1
  2. package/dist/commands/context-hub.js +26 -0
  3. package/dist/commands/context-hub.js.map +1 -1
  4. package/dist/commands/migrate-tenet.d.ts +25 -0
  5. package/dist/commands/migrate-tenet.d.ts.map +1 -0
  6. package/dist/commands/migrate-tenet.js +252 -0
  7. package/dist/commands/migrate-tenet.js.map +1 -0
  8. package/dist/commands/peter.d.ts.map +1 -1
  9. package/dist/commands/peter.js +47 -5
  10. package/dist/commands/peter.js.map +1 -1
  11. package/dist/commands/pi.d.ts +1 -0
  12. package/dist/commands/pi.d.ts.map +1 -1
  13. package/dist/commands/pi.js +5 -1
  14. package/dist/commands/pi.js.map +1 -1
  15. package/dist/commands/pivot.d.ts +28 -0
  16. package/dist/commands/pivot.d.ts.map +1 -0
  17. package/dist/commands/pivot.js +219 -0
  18. package/dist/commands/pivot.js.map +1 -0
  19. package/dist/commands/services-create.js +348 -0
  20. package/dist/commands/services-create.js.map +1 -1
  21. package/dist/dashboard-static/assets/index-BVrmW-ZI.js +154 -0
  22. package/dist/dashboard-static/assets/{index-CW8oWAdr.css → index-DtruPD44.css} +1 -1
  23. package/dist/dashboard-static/index.html +2 -2
  24. package/dist/index.js +24 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/lib/agent-generator.d.ts.map +1 -1
  27. package/dist/lib/agent-generator.js +15 -0
  28. package/dist/lib/agent-generator.js.map +1 -1
  29. package/dist/lib/counterfactual-engine.d.ts +136 -0
  30. package/dist/lib/counterfactual-engine.d.ts.map +1 -0
  31. package/dist/lib/counterfactual-engine.js +417 -0
  32. package/dist/lib/counterfactual-engine.js.map +1 -0
  33. package/dist/lib/dynamics-model.d.ts +107 -0
  34. package/dist/lib/dynamics-model.d.ts.map +1 -0
  35. package/dist/lib/dynamics-model.js +363 -0
  36. package/dist/lib/dynamics-model.js.map +1 -0
  37. package/dist/lib/eval-snapshot.d.ts.map +1 -1
  38. package/dist/lib/eval-snapshot.js +15 -4
  39. package/dist/lib/eval-snapshot.js.map +1 -1
  40. package/dist/lib/invariant-monitor.d.ts +50 -0
  41. package/dist/lib/invariant-monitor.d.ts.map +1 -0
  42. package/dist/lib/invariant-monitor.js +400 -0
  43. package/dist/lib/invariant-monitor.js.map +1 -0
  44. package/dist/lib/meta-orchestrator.d.ts +40 -3
  45. package/dist/lib/meta-orchestrator.d.ts.map +1 -1
  46. package/dist/lib/meta-orchestrator.js +181 -2
  47. package/dist/lib/meta-orchestrator.js.map +1 -1
  48. package/dist/lib/openclaw-sdk.d.ts +8 -0
  49. package/dist/lib/openclaw-sdk.d.ts.map +1 -1
  50. package/dist/lib/openclaw-sdk.js +11 -0
  51. package/dist/lib/openclaw-sdk.js.map +1 -1
  52. package/dist/lib/peter-parker-bridge.d.ts +37 -1
  53. package/dist/lib/peter-parker-bridge.d.ts.map +1 -1
  54. package/dist/lib/peter-parker-bridge.js +201 -1
  55. package/dist/lib/peter-parker-bridge.js.map +1 -1
  56. package/dist/lib/service-detector.d.ts +1 -1
  57. package/dist/lib/service-detector.d.ts.map +1 -1
  58. package/dist/lib/service-detector.js +26 -6
  59. package/dist/lib/service-detector.js.map +1 -1
  60. package/dist/lib/service-gtm.d.ts +1 -1
  61. package/dist/lib/service-gtm.d.ts.map +1 -1
  62. package/dist/lib/state-capture.d.ts +36 -0
  63. package/dist/lib/state-capture.d.ts.map +1 -0
  64. package/dist/lib/state-capture.js +541 -0
  65. package/dist/lib/state-capture.js.map +1 -0
  66. package/dist/lib/stratus-client.d.ts +78 -2
  67. package/dist/lib/stratus-client.d.ts.map +1 -1
  68. package/dist/lib/stratus-client.js +432 -1
  69. package/dist/lib/stratus-client.js.map +1 -1
  70. package/dist/lib/world-model-store.d.ts +172 -0
  71. package/dist/lib/world-model-store.d.ts.map +1 -0
  72. package/dist/lib/world-model-store.js +487 -0
  73. package/dist/lib/world-model-store.js.map +1 -0
  74. package/dist/types/world-model.d.ts +478 -0
  75. package/dist/types/world-model.d.ts.map +1 -0
  76. package/dist/types/world-model.js +80 -0
  77. package/dist/types/world-model.js.map +1 -0
  78. package/dist/utils/jfl-config.d.ts +5 -0
  79. package/dist/utils/jfl-config.d.ts.map +1 -1
  80. package/dist/utils/jfl-config.js +13 -1
  81. package/dist/utils/jfl-config.js.map +1 -1
  82. package/package.json +1 -1
  83. package/packages/pi/extensions/hud-tool.ts +2 -24
  84. package/packages/pi/extensions/index.ts +48 -25
  85. package/packages/pi/extensions/onboarding-v1.ts +455 -0
  86. package/packages/pi/extensions/onboarding-v2.ts +516 -0
  87. package/packages/pi/extensions/onboarding-v3.ts +675 -0
  88. package/packages/pi/extensions/pivot-tool.ts +59 -0
  89. package/packages/pi/extensions/session.ts +58 -0
  90. package/packages/pi/extensions/types.ts +2 -0
  91. package/packages/pi/skills/pivot/SKILL.md +91 -0
  92. package/template/.claude/settings.json +9 -0
  93. package/dist/dashboard-static/assets/index-Ck8f9dcM.js +0 -121
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Pivot Tool Extension
3
+ *
4
+ * Registers jfl_pivot tool and /pivot command.
5
+ * Checkpoints current work to journals/memory without ending the session.
6
+ *
7
+ * @purpose Pivot tool — flush context to durable stores, stay on same branch
8
+ */
9
+
10
+ import type { PiContext } from "./types.js"
11
+ import { pivot } from "./session.js"
12
+
13
+ export function setupPivotTool(ctx: PiContext): void {
14
+ ctx.registerTool({
15
+ name: "jfl_pivot",
16
+ description:
17
+ "Checkpoint current work — commit, write pivot journal entry, index memory. " +
18
+ "Stays on the same branch. Use when switching topics or the context window is full.",
19
+ inputSchema: {
20
+ type: "object",
21
+ properties: {
22
+ summary: {
23
+ type: "string",
24
+ description: "Summary of what was being worked on (required for good handoff)",
25
+ },
26
+ },
27
+ required: ["summary"],
28
+ },
29
+ async handler(args: { summary?: string }) {
30
+ const result = await pivot(ctx, args.summary)
31
+ if (!result.ok) {
32
+ return "Pivot failed. Work is still safe on the current branch."
33
+ }
34
+ const lines = [
35
+ `Pivot #${result.pivotNumber} complete.`,
36
+ result.committed ? `Committed: ${result.commitHash} (${result.filesChanged} files)` : "No uncommitted changes.",
37
+ `Journal entry written.`,
38
+ result.indexed ? "Memory indexed." : "Memory index skipped (hub unavailable).",
39
+ "",
40
+ "Context has been saved. Ready for a new topic.",
41
+ ]
42
+ return lines.join("\n")
43
+ },
44
+ })
45
+
46
+ ctx.registerCommand({
47
+ name: "pivot",
48
+ description: "Checkpoint current work and reset context — same branch, no restart hooks",
49
+ async handler(args, ctx) {
50
+ const summary = args || "Topic transition"
51
+ const result = await pivot(ctx, summary)
52
+ if (result.ok) {
53
+ ctx.ui.notify(`Pivot #${result.pivotNumber} saved. Ready for new topic.`, { level: "info" })
54
+ } else {
55
+ ctx.ui.notify("Pivot failed — work is still safe on current branch.", { level: "warn" })
56
+ }
57
+ },
58
+ })
59
+ }
@@ -88,6 +88,64 @@ export function getSessionBranch(): string {
88
88
  return sessionBranch
89
89
  }
90
90
 
91
+ export async function pivot(ctx: PiContext, summary?: string): Promise<{
92
+ ok: boolean
93
+ pivotNumber: number
94
+ committed: boolean
95
+ commitHash: string | null
96
+ filesChanged: number
97
+ indexed: boolean
98
+ }> {
99
+ const root = ctx.session.projectRoot
100
+
101
+ try {
102
+ const resp = await fetch(`${hubUrl}/api/session/pivot`, {
103
+ method: "POST",
104
+ headers: {
105
+ "Content-Type": "application/json",
106
+ ...(authToken ? { Authorization: `Bearer ${authToken}` } : {}),
107
+ },
108
+ body: JSON.stringify({ summary }),
109
+ signal: AbortSignal.timeout(30000),
110
+ })
111
+
112
+ if (resp.ok) {
113
+ const data = await resp.json() as any
114
+ ctx.emit("hook:session-pivot", {
115
+ session: ctx.session.id,
116
+ branch: sessionBranch,
117
+ pivotNumber: data.pivotNumber,
118
+ summary: summary || "",
119
+ ts: new Date().toISOString(),
120
+ })
121
+ ctx.log(`Pivot #${data.pivotNumber} via Hub`, "debug")
122
+ return data
123
+ }
124
+ } catch {
125
+ ctx.log("Hub unavailable for pivot, falling back to CLI", "debug")
126
+ }
127
+
128
+ // Fallback: shell out to jfl pivot
129
+ try {
130
+ const result = execSync(
131
+ `jfl pivot --json${summary ? ` --summary "${summary.replace(/"/g, '\\"')}"` : ""}`,
132
+ { cwd: root, encoding: "utf-8", timeout: 30000, stdio: ["pipe", "pipe", "pipe"] },
133
+ )
134
+ const parsed = JSON.parse(result)
135
+ ctx.emit("hook:session-pivot", {
136
+ session: ctx.session.id,
137
+ branch: sessionBranch,
138
+ pivotNumber: parsed.pivotNumber,
139
+ summary: summary || "",
140
+ ts: new Date().toISOString(),
141
+ })
142
+ return parsed
143
+ } catch (err) {
144
+ ctx.log(`Pivot fallback failed: ${err}`, "warn")
145
+ return { ok: false, pivotNumber: 0, committed: false, commitHash: null, filesChanged: 0, indexed: false }
146
+ }
147
+ }
148
+
91
149
  export async function onShutdown(ctx: PiContext): Promise<void> {
92
150
  const root = ctx.session.projectRoot
93
151
 
@@ -158,6 +158,8 @@ export interface JflConfig {
158
158
  disable_footer?: boolean
159
159
  disable_shortcuts?: boolean
160
160
  disable_notifications?: boolean
161
+ disable_onboarding?: boolean
162
+ onboarding_variant?: "v1" | "v2" | "v3"
161
163
  auto_start?: boolean
162
164
  }
163
165
  }
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: pivot
3
+ description: Checkpoint current work to journals/memory and reset context — same branch, no restart hooks. Use when switching topics mid-session or context window is getting full.
4
+ triggers:
5
+ - /pivot
6
+ - let's switch gears
7
+ - new topic
8
+ - context reset
9
+ - pivot
10
+ - change of plans
11
+ - let's do something else
12
+ - fresh start
13
+ ---
14
+
15
+ # /pivot - Session Checkpoint & Context Reset
16
+
17
+ Save everything you're working on to durable stores (journal, git, memory), then start fresh on a new topic — without ending the session or triggering startup hooks.
18
+
19
+ ---
20
+
21
+ ## When to Use
22
+
23
+ | Situation | Use /pivot? |
24
+ |-----------|------------|
25
+ | Switching from feature work to bug fixing | ✅ Yes |
26
+ | Context window getting full, need to continue | ✅ Yes |
27
+ | Done with topic A, starting topic B | ✅ Yes |
28
+ | Done for the day | ❌ Use /end instead |
29
+ | Just finished one file, continuing same feature | ❌ No, keep going |
30
+
31
+ ## What It Does
32
+
33
+ 1. **Writes pivot journal entry** — captures what you were working on, files touched
34
+ 2. **Commits all work** — `git add -A && git commit` on the SAME branch
35
+ 3. **Indexes to memory** — makes the pivot entry searchable for future context
36
+ 4. **Emits event** — `session:pivoted` so other systems know
37
+ 5. **Tracks pivot count** — stored in `.jfl/session-state.json`
38
+
39
+ ## What It Does NOT Do
40
+
41
+ - ❌ Merge to working branch (stays on session branch)
42
+ - ❌ Create a new branch
43
+ - ❌ Push to remote (unless `--push` flag)
44
+ - ❌ Stop auto-commit or Context Hub
45
+ - ❌ Run session-sync or doctor
46
+ - ❌ Trigger SessionStart hooks
47
+
48
+ ## How to Invoke
49
+
50
+ **As a tool** (agent calls it):
51
+ ```
52
+ jfl_pivot({ summary: "Finished agent service type integration" })
53
+ ```
54
+
55
+ **As a command** (user types it):
56
+ ```
57
+ /pivot Finished agent service type integration
58
+ ```
59
+
60
+ **From CLI**:
61
+ ```bash
62
+ jfl pivot --summary "Finished agent service type integration"
63
+ jfl pivot --summary "switching to bug fixes" --push
64
+ jfl pivot --json
65
+ ```
66
+
67
+ ## After Pivot
68
+
69
+ The agent should:
70
+ 1. Show the pivot summary to the user
71
+ 2. Ask "What do you want to work on next?"
72
+ 3. Use the pivot journal entry as primary context (not full startup reload)
73
+ 4. Continue on the same branch
74
+
75
+ ## Journal Entry Format
76
+
77
+ Pivot entries use type `"pivot"`:
78
+
79
+ ```json
80
+ {
81
+ "v": 1,
82
+ "ts": "2026-03-17T10:30:00.000Z",
83
+ "session": "session-hath-20260317-1000-abc123",
84
+ "type": "pivot",
85
+ "status": "complete",
86
+ "title": "Pivot #1: Finished agent service type integration",
87
+ "summary": "Finished agent service type integration",
88
+ "files": ["src/lib/service-detector.ts", "src/commands/services-create.ts"],
89
+ "pivot_number": 1
90
+ }
91
+ ```
@@ -60,6 +60,15 @@
60
60
  "command": "BRANCH=$(cat .jfl/current-session-branch.txt 2>/dev/null || git branch --show-current); echo ''; echo '═══════════════════════════════════════════════════════════'; echo '📝 JOURNAL CHECK: User approved/confirmed something'; echo '═══════════════════════════════════════════════════════════'; echo 'If a decision or feature was just approved, write journal entry.'; echo 'File: .jfl/journal/'\"${BRANCH}\"'.jsonl'; echo '═══════════════════════════════════════════════════════════'"
61
61
  }
62
62
  ]
63
+ },
64
+ {
65
+ "matcher": "pivot|switch gears|new topic|context reset|change of plans|let's do something else|fresh start|different topic",
66
+ "hooks": [
67
+ {
68
+ "type": "command",
69
+ "command": "echo ''; echo '═══════════════════════════════════════════════════════════'; echo '🔄 PIVOT DETECTED: Run jfl pivot to checkpoint current work'; echo '═══════════════════════════════════════════════════════════'; echo 'Save current context before switching topics:'; echo ' jfl pivot --summary \"<what you were working on>\"'; echo '═══════════════════════════════════════════════════════════'"
70
+ }
71
+ ]
63
72
  }
64
73
  ],
65
74
  "Stop": [