haansi 0.1.19 → 0.1.23

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 (2) hide show
  1. package/dist/haansi.js +164 -29
  2. package/package.json +1 -1
package/dist/haansi.js CHANGED
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  "package.json"(exports2, module2) {
40
40
  module2.exports = {
41
41
  name: "haansi",
42
- version: "0.1.19",
42
+ version: "0.1.23",
43
43
  description: "Haansi CLI - Session collector and MCP server for Claude Code",
44
44
  bin: {
45
45
  haansi: "./dist/haansi.js"
@@ -141,7 +141,7 @@ If the browser didn't open, visit this URL:
141
141
  );
142
142
  }
143
143
  console.log("Creating CLI token...");
144
- const tokenRes = await fetch(`${apiUrl}/api/v1/cli-tokens`, {
144
+ const tokenRes = await fetch(`${apiUrl}/api/v1/access/cli-tokens`, {
145
145
  method: "POST",
146
146
  headers: {
147
147
  Authorization: `Bearer ${jwt2}`,
@@ -206,9 +206,12 @@ function prompt(question) {
206
206
  });
207
207
  }
208
208
  async function validateToken(token, apiUrl) {
209
- const response = await fetch(`${apiUrl}/api/v1/sessions/recent?limit=1`, {
210
- headers: { Authorization: `Bearer ${token}` }
211
- });
209
+ const response = await fetch(
210
+ `${apiUrl}/api/v1/memory/solutions/recent?limit=1`,
211
+ {
212
+ headers: { Authorization: `Bearer ${token}` }
213
+ }
214
+ );
212
215
  if (!response.ok) {
213
216
  const body = await response.text().catch(() => "");
214
217
  throw new Error(
@@ -820,7 +823,11 @@ async function apiGet(path, apiUrl, token) {
820
823
  }
821
824
  async function getUploadedSessions(apiUrl, token) {
822
825
  try {
823
- const data = await apiGet("/sessions/uploaded", apiUrl, token);
826
+ const data = await apiGet(
827
+ "/capture/sessions/uploaded",
828
+ apiUrl,
829
+ token
830
+ );
824
831
  const map2 = /* @__PURE__ */ new Map();
825
832
  for (const s of data.sessions) {
826
833
  map2.set(s.sessionId, {
@@ -845,7 +852,7 @@ async function uploadSession(sessionId, content, apiUrl, token, gitInfo) {
845
852
  if (gitInfo?.gitRemoteUrl) headers["x-git-remote-url"] = gitInfo.gitRemoteUrl;
846
853
  if (gitInfo?.gitCommit) headers["x-git-commit"] = gitInfo.gitCommit;
847
854
  if (gitInfo?.gitBranch) headers["x-git-branch"] = gitInfo.gitBranch;
848
- const response = await fetch(`${apiUrl}/api/v1/sessions/raw`, {
855
+ const response = await fetch(`${apiUrl}/api/v1/capture/sessions/raw`, {
849
856
  method: "POST",
850
857
  headers,
851
858
  body: new Uint8Array(body)
@@ -2040,7 +2047,7 @@ function normalizeComplexity(raw) {
2040
2047
  if (lower in COMPLEXITIES) return lower;
2041
2048
  return "moderate";
2042
2049
  }
2043
- var SESSION_TYPES, SESSION_TYPE_ALIASES, COMPLEXITIES;
2050
+ var SESSION_TYPES, SESSION_TYPE_ALIASES, COMPLEXITIES, ARTIFACT_TYPES, __seenAliases, ALIAS_REVERSE_MAP, ARTIFACT_TYPE_IDS, AUTO_APPROVED_ARTIFACT_TYPES;
2044
2051
  var init_taxonomy = __esm({
2045
2052
  "../../packages/@company/types/src/taxonomy.ts"() {
2046
2053
  "use strict";
@@ -2098,6 +2105,122 @@ var init_taxonomy = __esm({
2098
2105
  description: "Involved task with many steps or deep analysis"
2099
2106
  }
2100
2107
  };
2108
+ ARTIFACT_TYPES = {
2109
+ report_incident: {
2110
+ category: "report",
2111
+ label: "Incident Report",
2112
+ description: "Production-incident record + post-incident writeup: detection, timeline, root cause, resolution, follow-ups.",
2113
+ icon: "AlertTriangle",
2114
+ aliases: ["incident_summary", "incident", "postmortem", "post-mortem"],
2115
+ autoApproved: false,
2116
+ producedBy: [
2117
+ "POST /api/v1/memory/processes/incidents",
2118
+ "POST /api/v1/memory/reports/incident",
2119
+ "POST /api/v1/memory/processes/incidents/:id/postmortem"
2120
+ ]
2121
+ },
2122
+ report_decision: {
2123
+ category: "report",
2124
+ label: "Decision Record",
2125
+ description: "Architectural / product decision record with context, options considered, decision, and rationale.",
2126
+ icon: "Scale",
2127
+ aliases: ["decision_record", "decision-record", "adr"],
2128
+ autoApproved: false,
2129
+ producedBy: ["POST /api/v1/memory"]
2130
+ },
2131
+ report_work: {
2132
+ category: "report",
2133
+ label: "Work Report",
2134
+ description: "Periodic or one-off work-progress report \u2014 status updates, weekly digests, project rollups, team-activity summaries.",
2135
+ icon: "CalendarDays",
2136
+ aliases: ["weekly_digest", "weekly-digest", "status_report"],
2137
+ autoApproved: true,
2138
+ producedBy: ["POST /api/v1/memory", "POST /api/v1/memory/reports/work"]
2139
+ },
2140
+ report_sop: {
2141
+ category: "report",
2142
+ label: "Standard Operating Procedure",
2143
+ description: "Reusable step-by-step procedure or runbook. Placeholder \u2014 surface not yet specialized; written via generic POST /memory until a dedicated producer ships.",
2144
+ icon: "FileText",
2145
+ aliases: ["sop", "runbook"],
2146
+ autoApproved: false,
2147
+ producedBy: ["POST /api/v1/memory"]
2148
+ },
2149
+ report_onboarding: {
2150
+ category: "report",
2151
+ label: "Onboarding Packet",
2152
+ description: "Onboarding guide assembled from team knowledge, scoped to a project or role.",
2153
+ icon: "GraduationCap",
2154
+ aliases: ["onboarding_packet", "onboarding-packet"],
2155
+ autoApproved: false,
2156
+ producedBy: ["POST /api/v1/memory/reports/onboarding"]
2157
+ },
2158
+ report_pr: {
2159
+ category: "report",
2160
+ label: "PR Context",
2161
+ description: "Enriched pull-request description with linked Jira/Slack context, recent decisions, and reviewer hints.",
2162
+ icon: "GitPullRequest",
2163
+ aliases: ["pr_context", "pr-context"],
2164
+ autoApproved: true,
2165
+ producedBy: ["POST /api/v1/memory/reports/pr"]
2166
+ },
2167
+ expert: {
2168
+ category: "expert",
2169
+ label: "Expert Profile",
2170
+ description: "Per-person expertise profile across platforms \u2014 areas of focus, recent contributions, identity links.",
2171
+ icon: "Users",
2172
+ aliases: ["expert_profile", "expert-profile"],
2173
+ autoApproved: false,
2174
+ producedBy: ["POST /api/v1/memory/experts"]
2175
+ },
2176
+ solution_mined: {
2177
+ category: "solution",
2178
+ label: "Mined Solution",
2179
+ description: "Problem + solution mined automatically from a developer coding session (the distilled-path pipeline).",
2180
+ icon: "Lightbulb",
2181
+ aliases: ["solution", "mined_solution", "distilled_path"],
2182
+ autoApproved: true,
2183
+ producedBy: ["POST /api/v1/memory/solutions/mined"]
2184
+ },
2185
+ solution_qna: {
2186
+ category: "solution",
2187
+ label: "Q&A Solution",
2188
+ description: "Q&A answer marked verified by a user and distilled into reusable knowledge \u2014 promoted out of a conversation thread.",
2189
+ icon: "ThumbsUp",
2190
+ aliases: ["verified_answer", "verified-answer"],
2191
+ autoApproved: true,
2192
+ producedBy: ["POST /api/v1/memory/recall/messages/:id/feedback"]
2193
+ }
2194
+ };
2195
+ __seenAliases = /* @__PURE__ */ new Set();
2196
+ for (const [id, meta3] of Object.entries(ARTIFACT_TYPES)) {
2197
+ for (const a of meta3.aliases) {
2198
+ if (__seenAliases.has(a)) {
2199
+ throw new Error(
2200
+ `[taxonomy] alias "${a}" declared on multiple artifact types; last seen on "${id}"`
2201
+ );
2202
+ }
2203
+ __seenAliases.add(a);
2204
+ }
2205
+ }
2206
+ ALIAS_REVERSE_MAP = Object.freeze(
2207
+ Object.fromEntries(
2208
+ Object.entries(ARTIFACT_TYPES).flatMap(
2209
+ ([id, meta3]) => meta3.aliases.map((a) => [a, id])
2210
+ )
2211
+ )
2212
+ );
2213
+ ARTIFACT_TYPE_IDS = Object.keys(
2214
+ ARTIFACT_TYPES
2215
+ );
2216
+ AUTO_APPROVED_ARTIFACT_TYPES = ARTIFACT_TYPE_IDS.filter((id) => ARTIFACT_TYPES[id].autoApproved);
2217
+ }
2218
+ });
2219
+
2220
+ // ../../packages/@company/types/src/embedding.ts
2221
+ var init_embedding = __esm({
2222
+ "../../packages/@company/types/src/embedding.ts"() {
2223
+ "use strict";
2101
2224
  }
2102
2225
  });
2103
2226
 
@@ -2110,6 +2233,7 @@ var init_src = __esm({
2110
2233
  init_timeline();
2111
2234
  init_artifact();
2112
2235
  init_taxonomy();
2236
+ init_embedding();
2113
2237
  }
2114
2238
  });
2115
2239
 
@@ -56865,11 +56989,11 @@ async function apiPost(path, body, options) {
56865
56989
  }
56866
56990
  async function main3() {
56867
56991
  try {
56868
- await apiGet2("/sessions/recent?limit=1");
56992
+ await apiGet2("/memory/solutions/recent?limit=1");
56869
56993
  } catch {
56870
56994
  }
56871
56995
  try {
56872
- await apiGet2("/users/me/preferences");
56996
+ await apiGet2("/workspace/users/me/preferences");
56873
56997
  } catch {
56874
56998
  }
56875
56999
  triggerCollectInBackground();
@@ -57081,7 +57205,7 @@ var init_mcp_server2 = __esm({
57081
57205
  extraHeaders["X-Session-Org-Id"] = String(_context.orgId);
57082
57206
  }
57083
57207
  const data = await apiGet2(
57084
- `/sessions/search?q=${encodeURIComponent(query)}&top_k=${k}`,
57208
+ `/memory/solutions/search?q=${encodeURIComponent(query)}&top_k=${k}`,
57085
57209
  { extraHeaders }
57086
57210
  );
57087
57211
  if (!data.results || data.results.length === 0) {
@@ -57113,7 +57237,7 @@ var init_mcp_server2 = __esm({
57113
57237
  if (_context?.orgId) {
57114
57238
  extraHeaders["X-Session-Org-Id"] = String(_context.orgId);
57115
57239
  }
57116
- const data = await apiGet2(`/sessions/recent?limit=${n}`, {
57240
+ const data = await apiGet2(`/memory/solutions/recent?limit=${n}`, {
57117
57241
  extraHeaders
57118
57242
  });
57119
57243
  if (!data.results || data.results.length === 0) {
@@ -57156,7 +57280,7 @@ var init_mcp_server2 = __esm({
57156
57280
  extraHeaders["X-Session-Org-Id"] = String(_context.orgId);
57157
57281
  }
57158
57282
  const data = await apiPost(
57159
- "/sessions/knowledge",
57283
+ "/memory/solutions/mined",
57160
57284
  {
57161
57285
  problem_description,
57162
57286
  solution_summary,
@@ -57270,7 +57394,7 @@ async function setupMcp(targetArg) {
57270
57394
  warnings.push(msg);
57271
57395
  } else {
57272
57396
  const apiUrl = process.env.HAANSI_API_URL ?? DEFAULT_API_URL5;
57273
- const exchangeUrl = `${apiUrl.replace(/\/+$/, "")}/api/v1/mcp/exchange`;
57397
+ const exchangeUrl = `${apiUrl.replace(/\/+$/, "")}/api/v1/access/exchange/mcp`;
57274
57398
  config6.mcpServers["haansi-exchange"] = {
57275
57399
  type: "http",
57276
57400
  url: exchangeUrl,
@@ -57423,9 +57547,12 @@ async function config5(args) {
57423
57547
  const subcommand = args[0];
57424
57548
  if (subcommand === "get") {
57425
57549
  const key = args[1];
57426
- const response = await fetch(`${apiUrl}/api/v1/users/me/preferences`, {
57427
- headers: { Authorization: `Bearer ${token}` }
57428
- });
57550
+ const response = await fetch(
57551
+ `${apiUrl}/api/v1/workspace/users/me/preferences`,
57552
+ {
57553
+ headers: { Authorization: `Bearer ${token}` }
57554
+ }
57555
+ );
57429
57556
  if (!response.ok) {
57430
57557
  const body = await response.text().catch(() => "");
57431
57558
  console.error(
@@ -57467,14 +57594,17 @@ async function config5(args) {
57467
57594
  process.exit(1);
57468
57595
  return;
57469
57596
  }
57470
- const response = await fetch(`${apiUrl}/api/v1/users/me/preferences`, {
57471
- method: "PATCH",
57472
- headers: {
57473
- Authorization: `Bearer ${token}`,
57474
- "Content-Type": "application/json"
57475
- },
57476
- body: JSON.stringify({ [key]: value })
57477
- });
57597
+ const response = await fetch(
57598
+ `${apiUrl}/api/v1/workspace/users/me/preferences`,
57599
+ {
57600
+ method: "PATCH",
57601
+ headers: {
57602
+ Authorization: `Bearer ${token}`,
57603
+ "Content-Type": "application/json"
57604
+ },
57605
+ body: JSON.stringify({ [key]: value })
57606
+ }
57607
+ );
57478
57608
  if (!response.ok) {
57479
57609
  const body = await response.text().catch(() => "");
57480
57610
  console.error(
@@ -57557,13 +57687,13 @@ async function list(options) {
57557
57687
  let data;
57558
57688
  if (options.search) {
57559
57689
  data = await apiGet3(
57560
- `/sessions/search?q=${encodeURIComponent(options.search)}&top_k=${options.limit}`,
57690
+ `/memory/solutions/search?q=${encodeURIComponent(options.search)}&top_k=${options.limit}`,
57561
57691
  token,
57562
57692
  apiUrl
57563
57693
  );
57564
57694
  } else {
57565
57695
  data = await apiGet3(
57566
- `/sessions/recent?limit=${options.limit}`,
57696
+ `/memory/solutions/recent?limit=${options.limit}`,
57567
57697
  token,
57568
57698
  apiUrl
57569
57699
  );
@@ -57580,7 +57710,7 @@ ${data.results.length} result(s)`);
57580
57710
  async function searchKnowledge(options) {
57581
57711
  const apiUrl = process.env.HAANSI_API_URL ?? DEFAULT_API_URL7;
57582
57712
  const token = resolveToken5();
57583
- let url2 = `/sessions/knowledge/search?q=${encodeURIComponent(options.query)}&limit=${options.limit}`;
57713
+ let url2 = `/memory/solutions/knowledge/search?q=${encodeURIComponent(options.query)}&limit=${options.limit}`;
57584
57714
  if (options.artifactType) {
57585
57715
  url2 += `&artifact_type=${encodeURIComponent(options.artifactType)}`;
57586
57716
  }
@@ -57605,7 +57735,12 @@ async function saveKnowledge(options) {
57605
57735
  if (options.sessionType) body.session_type = options.sessionType;
57606
57736
  if (options.complexity) body.complexity = options.complexity;
57607
57737
  if (options.tags) body.tags = options.tags;
57608
- const data = await apiPost2("/sessions/knowledge", body, token, apiUrl);
57738
+ const data = await apiPost2(
57739
+ "/memory/solutions/mined",
57740
+ body,
57741
+ token,
57742
+ apiUrl
57743
+ );
57609
57744
  console.log("Knowledge saved successfully.");
57610
57745
  console.log(` Problem: ${data.problem_description}`);
57611
57746
  console.log(` Solution: ${data.solution_summary}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haansi",
3
- "version": "0.1.19",
3
+ "version": "0.1.23",
4
4
  "description": "Haansi CLI - Session collector and MCP server for Claude Code",
5
5
  "bin": {
6
6
  "haansi": "./dist/haansi.js"