hanoman 0.1.8 → 0.1.9

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.8",
3
- "sha": "a749553",
4
- "builtAt": "2026-07-31T17:13:08.743Z"
2
+ "version": "0.1.9",
3
+ "sha": "fbea930",
4
+ "builtAt": "2026-07-31T23:44:47.571Z"
5
5
  }
package/dist/cli.js CHANGED
@@ -155,81 +155,6 @@ var init_agent_cli = __esm({
155
155
  }
156
156
  });
157
157
 
158
- // ../runner/src/paths.ts
159
- import { homedir } from "node:os";
160
- import { dirname, isAbsolute, join, resolve } from "node:path";
161
- function resolveHome(env = process.env, home = homedir()) {
162
- const v = env.HANOMAN_HOME?.trim();
163
- return v ? v : join(home, ".hanoman");
164
- }
165
- function schemeOf(raw) {
166
- return raw.split("://")[0] ?? "?";
167
- }
168
- function resolveDbUrl(env, schemaDir) {
169
- const own = env.HANOMAN_DATABASE_URL?.trim();
170
- if (own) {
171
- if (!own.startsWith("file:")) {
172
- throw new Error(
173
- `HANOMAN_DATABASE_URL harus URL SQLite \`file:\u2026\` sejak ADR-0086 (dapat \`${schemeOf(own)}\`). Masih punya data Postgres? Pindahkan sekali: hanoman migrate-from-postgres --from "<url-postgres>"`
174
- );
175
- }
176
- return absoluteFileUrl(own, schemaDir);
177
- }
178
- const raw = env.DATABASE_URL?.trim();
179
- if (!raw || !raw.startsWith("file:")) return `file:${join(resolveHome(env), "hanoman.db")}`;
180
- return absoluteFileUrl(raw, schemaDir);
181
- }
182
- function absoluteFileUrl(raw, schemaDir) {
183
- const p = raw.slice("file:".length);
184
- if (p.startsWith(":")) return raw;
185
- return `file:${isAbsolute(p) ? p : resolve(schemaDir, p)}`;
186
- }
187
- function dbUrlNotice(env) {
188
- if (env.HANOMAN_DATABASE_URL?.trim()) return null;
189
- const raw = env.DATABASE_URL?.trim();
190
- if (!raw || raw.startsWith("file:")) return null;
191
- return `hanoman: DATABASE_URL bertipe \`${schemeOf(raw)}\` DIABAIKAN \u2014 hanoman memakai SQLite (ADR-0086), dan var itu biasanya milik project lain.
192
- \u2022 Punya data Postgres hanoman? Pindahkan sekali: hanoman migrate-from-postgres --from "<url>"
193
- \u2022 Mau menunjuk berkas DB tertentu? Pakai HANOMAN_DATABASE_URL=file:/path/hanoman.db (atau --db)`;
194
- }
195
- function dbFilePath(url) {
196
- if (!url.startsWith("file:")) throw new Error(`bukan URL SQLite: ${url}`);
197
- return url.slice("file:".length);
198
- }
199
- function prismaCliPath(resolver) {
200
- for (const spec of ["prisma/build/index.js", "prisma/package.json"]) {
201
- try {
202
- const p = resolver(spec);
203
- return spec.endsWith("package.json") ? join(dirname(p), "build", "index.js") : p;
204
- } catch {
205
- }
206
- }
207
- throw new Error("CLI prisma tak ditemukan \u2014 `prisma` wajib terpasang sebagai dependency");
208
- }
209
- var init_paths = __esm({
210
- "../runner/src/paths.ts"() {
211
- "use strict";
212
- }
213
- });
214
-
215
- // ../runner/src/index.ts
216
- var init_src = __esm({
217
- "../runner/src/index.ts"() {
218
- "use strict";
219
- init_types();
220
- init_prompt();
221
- init_reverse_standard();
222
- init_git();
223
- init_settings();
224
- init_goal();
225
- init_goal_spec();
226
- init_codex_settings();
227
- init_agent_cli();
228
- init_verify_scope();
229
- init_paths();
230
- }
231
- });
232
-
233
158
  // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
234
159
  var util, objectUtil, ZodParsedType, getParsedType;
235
160
  var init_util = __esm({
@@ -4602,7 +4527,12 @@ var init_agent = __esm({
4602
4527
  // baris jejak & bisa menggerakkan sesi), dan SPEC-405 sudah membuktikan apa yang terjadi saat
4603
4528
  // endpoint tulis menumpang prefix status yang dipetakan tanpa melihat method (AC-5).
4604
4529
  "lead:read",
4605
- "lead:write"
4530
+ "lead:write",
4531
+ // SPEC-450 · ADR-0094 · custom agent. Domain TERSENDIRI, dipetakan MENURUT METHOD: menulis
4532
+ // definisi agen mengubah apa yang dilihat SETIAP sesi baru di seluruh workspace, jadi izin
4533
+ // baca tak pernah cukup untuk itu (kelas bug SPEC-405).
4534
+ "agents:read",
4535
+ "agents:write"
4606
4536
  ];
4607
4537
  zCapability = external_exports.enum(CAPABILITY_IDS);
4608
4538
  zCapabilityInfo = external_exports.object({
@@ -4636,6 +4566,40 @@ var init_agent = __esm({
4636
4566
  }
4637
4567
  });
4638
4568
 
4569
+ // ../shared/src/custom-agent.ts
4570
+ var AGENT_NAME_RE, zCustomAgent, zCreateCustomAgent, zUpdateCustomAgent;
4571
+ var init_custom_agent = __esm({
4572
+ "../shared/src/custom-agent.ts"() {
4573
+ "use strict";
4574
+ init_zod();
4575
+ AGENT_NAME_RE = /^[a-z][a-z0-9-]{1,39}$/;
4576
+ zCustomAgent = external_exports.object({
4577
+ id: external_exports.string(),
4578
+ projectId: external_exports.string().nullable(),
4579
+ name: external_exports.string().regex(AGENT_NAME_RE),
4580
+ description: external_exports.string(),
4581
+ instructions: external_exports.string(),
4582
+ tools: external_exports.array(external_exports.string()).nullable(),
4583
+ model: external_exports.string().nullable(),
4584
+ mentions: external_exports.array(external_exports.string()).nullable(),
4585
+ enabled: external_exports.boolean(),
4586
+ createdAt: external_exports.string(),
4587
+ updatedAt: external_exports.string()
4588
+ });
4589
+ zCreateCustomAgent = external_exports.object({
4590
+ projectId: external_exports.string().nullable().optional(),
4591
+ name: external_exports.string().regex(AGENT_NAME_RE),
4592
+ description: external_exports.string().trim().min(1).max(500),
4593
+ instructions: external_exports.string().trim().min(1).max(2e4),
4594
+ tools: external_exports.array(external_exports.string()).nullable().optional(),
4595
+ model: external_exports.string().nullable().optional(),
4596
+ mentions: external_exports.array(external_exports.string()).nullable().optional(),
4597
+ enabled: external_exports.boolean().optional()
4598
+ });
4599
+ zUpdateCustomAgent = zCreateCustomAgent.omit({ name: true, projectId: true }).partial();
4600
+ }
4601
+ });
4602
+
4639
4603
  // ../shared/src/lead.ts
4640
4604
  var zLeadGate, zLeadKind, zLeadConfidence, zLeadStatus, LEAD_ACTIONS, zLeadAction, zLeadVerdict, zLeadAsk, zLeadOverride;
4641
4605
  var init_lead = __esm({
@@ -5222,6 +5186,9 @@ var init_api = __esm({
5222
5186
  leadDecisions: `${API}/lead/decisions`,
5223
5187
  leadDecisionOverride: (id) => `${API}/lead/decisions/${encodeURIComponent(id)}/override`,
5224
5188
  leadDecisionCancel: (id) => `${API}/lead/decisions/${encodeURIComponent(id)}/cancel`,
5189
+ // SPEC-450 · ADR-0094 · katalog custom agent. `?projectId=` → himpunan EFEKTIF (global+project).
5190
+ customAgents: `${API}/custom-agents`,
5191
+ customAgent: (id) => `${API}/custom-agents/${encodeURIComponent(id)}`,
5225
5192
  // SPEC-268 · ADR-0066 · pemicu sync manual (cookie-authed)
5226
5193
  syncNow: `${API}/sync/now`,
5227
5194
  // SPEC-270 · ADR-0067 · antrean konflik rekonsil (cookie-authed)
@@ -5491,12 +5458,13 @@ var init_semver = __esm({
5491
5458
  });
5492
5459
 
5493
5460
  // ../shared/src/index.ts
5494
- var init_src2 = __esm({
5461
+ var init_src = __esm({
5495
5462
  "../shared/src/index.ts"() {
5496
5463
  "use strict";
5497
5464
  init_enums();
5498
5465
  init_entities();
5499
5466
  init_agent();
5467
+ init_custom_agent();
5500
5468
  init_lead();
5501
5469
  init_dto();
5502
5470
  init_api();
@@ -5509,6 +5477,90 @@ var init_src2 = __esm({
5509
5477
  }
5510
5478
  });
5511
5479
 
5480
+ // ../runner/src/custom-agents.ts
5481
+ var init_custom_agents = __esm({
5482
+ "../runner/src/custom-agents.ts"() {
5483
+ "use strict";
5484
+ init_src();
5485
+ }
5486
+ });
5487
+
5488
+ // ../runner/src/paths.ts
5489
+ import { homedir } from "node:os";
5490
+ import { dirname, isAbsolute, join, resolve } from "node:path";
5491
+ function resolveHome(env = process.env, home = homedir()) {
5492
+ const v = env.HANOMAN_HOME?.trim();
5493
+ return v ? v : join(home, ".hanoman");
5494
+ }
5495
+ function schemeOf(raw) {
5496
+ return raw.split("://")[0] ?? "?";
5497
+ }
5498
+ function resolveDbUrl(env, schemaDir) {
5499
+ const own = env.HANOMAN_DATABASE_URL?.trim();
5500
+ if (own) {
5501
+ if (!own.startsWith("file:")) {
5502
+ throw new Error(
5503
+ `HANOMAN_DATABASE_URL harus URL SQLite \`file:\u2026\` sejak ADR-0086 (dapat \`${schemeOf(own)}\`). Masih punya data Postgres? Pindahkan sekali: hanoman migrate-from-postgres --from "<url-postgres>"`
5504
+ );
5505
+ }
5506
+ return absoluteFileUrl(own, schemaDir);
5507
+ }
5508
+ const raw = env.DATABASE_URL?.trim();
5509
+ if (!raw || !raw.startsWith("file:")) return `file:${join(resolveHome(env), "hanoman.db")}`;
5510
+ return absoluteFileUrl(raw, schemaDir);
5511
+ }
5512
+ function absoluteFileUrl(raw, schemaDir) {
5513
+ const p = raw.slice("file:".length);
5514
+ if (p.startsWith(":")) return raw;
5515
+ return `file:${isAbsolute(p) ? p : resolve(schemaDir, p)}`;
5516
+ }
5517
+ function dbUrlNotice(env) {
5518
+ if (env.HANOMAN_DATABASE_URL?.trim()) return null;
5519
+ const raw = env.DATABASE_URL?.trim();
5520
+ if (!raw || raw.startsWith("file:")) return null;
5521
+ return `hanoman: DATABASE_URL bertipe \`${schemeOf(raw)}\` DIABAIKAN \u2014 hanoman memakai SQLite (ADR-0086), dan var itu biasanya milik project lain.
5522
+ \u2022 Punya data Postgres hanoman? Pindahkan sekali: hanoman migrate-from-postgres --from "<url>"
5523
+ \u2022 Mau menunjuk berkas DB tertentu? Pakai HANOMAN_DATABASE_URL=file:/path/hanoman.db (atau --db)`;
5524
+ }
5525
+ function dbFilePath(url) {
5526
+ if (!url.startsWith("file:")) throw new Error(`bukan URL SQLite: ${url}`);
5527
+ return url.slice("file:".length);
5528
+ }
5529
+ function prismaCliPath(resolver) {
5530
+ for (const spec of ["prisma/build/index.js", "prisma/package.json"]) {
5531
+ try {
5532
+ const p = resolver(spec);
5533
+ return spec.endsWith("package.json") ? join(dirname(p), "build", "index.js") : p;
5534
+ } catch {
5535
+ }
5536
+ }
5537
+ throw new Error("CLI prisma tak ditemukan \u2014 `prisma` wajib terpasang sebagai dependency");
5538
+ }
5539
+ var init_paths = __esm({
5540
+ "../runner/src/paths.ts"() {
5541
+ "use strict";
5542
+ }
5543
+ });
5544
+
5545
+ // ../runner/src/index.ts
5546
+ var init_src2 = __esm({
5547
+ "../runner/src/index.ts"() {
5548
+ "use strict";
5549
+ init_types();
5550
+ init_prompt();
5551
+ init_reverse_standard();
5552
+ init_git();
5553
+ init_settings();
5554
+ init_goal();
5555
+ init_goal_spec();
5556
+ init_codex_settings();
5557
+ init_agent_cli();
5558
+ init_custom_agents();
5559
+ init_verify_scope();
5560
+ init_paths();
5561
+ }
5562
+ });
5563
+
5512
5564
  // src/layout.ts
5513
5565
  import { join as join2, resolve as resolve2 } from "node:path";
5514
5566
  function resolveLayout(distDir2, exists) {
@@ -5597,7 +5649,7 @@ var PKG, INSTALL_ARGS, DEFAULT_REGISTRY;
5597
5649
  var init_update = __esm({
5598
5650
  "src/commands/update.ts"() {
5599
5651
  "use strict";
5600
- init_src2();
5652
+ init_src();
5601
5653
  init_router();
5602
5654
  PKG = "hanoman";
5603
5655
  INSTALL_ARGS = ["i", "-g", `${PKG}@latest`];
@@ -5883,8 +5935,8 @@ var MAX_UPDATE_RESTARTS;
5883
5935
  var init_start = __esm({
5884
5936
  "src/commands/start.ts"() {
5885
5937
  "use strict";
5886
- init_src();
5887
5938
  init_src2();
5939
+ init_src();
5888
5940
  init_layout();
5889
5941
  init_update();
5890
5942
  MAX_UPDATE_RESTARTS = 5;
@@ -5965,7 +6017,7 @@ ${notice}
5965
6017
  var init_doctor = __esm({
5966
6018
  "src/commands/doctor.ts"() {
5967
6019
  "use strict";
5968
- init_src();
6020
+ init_src2();
5969
6021
  init_layout();
5970
6022
  init_start();
5971
6023
  }
@@ -6124,12 +6176,14 @@ var PG_ORDER, CHUNK, INT8_OID, delegateKey;
6124
6176
  var init_migrate_pg = __esm({
6125
6177
  "src/commands/migrate-pg.ts"() {
6126
6178
  "use strict";
6127
- init_src();
6179
+ init_src2();
6128
6180
  init_layout();
6129
6181
  init_start();
6130
6182
  PG_ORDER = [
6183
+ // SPEC-450 · ADR-0094 · CustomAgent sesudah Project (FK projectId nullable → cascade).
6131
6184
  "Project",
6132
6185
  "Spec",
6186
+ "CustomAgent",
6133
6187
  "Setting",
6134
6188
  "Notification",
6135
6189
  "User",
@@ -6169,7 +6223,7 @@ function loadConfig(repoRoot) {
6169
6223
  var init_config2 = __esm({
6170
6224
  "src/config.ts"() {
6171
6225
  "use strict";
6172
- init_src2();
6226
+ init_src();
6173
6227
  }
6174
6228
  });
6175
6229
 
@@ -6264,7 +6318,7 @@ function scanCoverage(cwd) {
6264
6318
  var init_verify = __esm({
6265
6319
  "src/verify.ts"() {
6266
6320
  "use strict";
6267
- init_src2();
6321
+ init_src();
6268
6322
  init_repo();
6269
6323
  init_docs_model();
6270
6324
  }
@@ -6358,7 +6412,7 @@ async function docs_index_default(args, ctx) {
6358
6412
  var init_docs_index = __esm({
6359
6413
  "src/commands/docs-index.ts"() {
6360
6414
  "use strict";
6361
- init_src2();
6415
+ init_src();
6362
6416
  init_repo();
6363
6417
  init_docs_model();
6364
6418
  init_index_edit();