hanoman 0.1.10 → 0.1.11
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.
- package/dist/build-info.json +3 -3
- package/dist/cli.js +137 -3
- package/dist/server.js +1397 -76
- package/package.json +1 -1
- package/prisma/migrations/20260801180000_telegram_gateway/migration.sql +112 -0
- package/prisma/schema.prisma +110 -0
- package/web/assets/{index-CXJBr-3-.js → index-D8IVSqJP.js} +1551 -1551
- package/web/index.html +1 -1
package/dist/build-info.json
CHANGED
package/dist/cli.js
CHANGED
|
@@ -4281,6 +4281,105 @@ var init_enums = __esm({
|
|
|
4281
4281
|
}
|
|
4282
4282
|
});
|
|
4283
4283
|
|
|
4284
|
+
// ../shared/src/telegram.ts
|
|
4285
|
+
var zTelegramSettings, TELEGRAM_DEFAULTS, zTelegramReadiness, zTelegramGatewayStatus, zTelegramMemoryRecord, zTelegramChatContext, TELEGRAM_REPLY_KINDS, zTelegramReplyKind, zTelegramConfirmationRequest, zTelegramReplyInput, zTelegramAuditRecord, zTerminalSteerInput;
|
|
4286
|
+
var init_telegram = __esm({
|
|
4287
|
+
"../shared/src/telegram.ts"() {
|
|
4288
|
+
"use strict";
|
|
4289
|
+
init_zod();
|
|
4290
|
+
init_enums();
|
|
4291
|
+
zTelegramSettings = external_exports.object({
|
|
4292
|
+
enabled: external_exports.boolean().default(false),
|
|
4293
|
+
progress: external_exports.boolean().default(true)
|
|
4294
|
+
});
|
|
4295
|
+
TELEGRAM_DEFAULTS = zTelegramSettings.parse({});
|
|
4296
|
+
zTelegramReadiness = external_exports.enum([
|
|
4297
|
+
"disabled",
|
|
4298
|
+
"misconfigured",
|
|
4299
|
+
"ready",
|
|
4300
|
+
"running",
|
|
4301
|
+
"error"
|
|
4302
|
+
]);
|
|
4303
|
+
zTelegramGatewayStatus = external_exports.object({
|
|
4304
|
+
configured: external_exports.boolean(),
|
|
4305
|
+
enabled: external_exports.boolean(),
|
|
4306
|
+
running: external_exports.boolean(),
|
|
4307
|
+
readiness: zTelegramReadiness,
|
|
4308
|
+
botUsername: external_exports.string().min(1).nullable().default(null),
|
|
4309
|
+
allowlistCount: external_exports.number().int().min(0),
|
|
4310
|
+
agentTokenConfigured: external_exports.boolean(),
|
|
4311
|
+
missingCapabilities: external_exports.array(external_exports.string()).default([]),
|
|
4312
|
+
lastUpdateAt: external_exports.string().datetime().nullable().default(null),
|
|
4313
|
+
lastError: external_exports.string().nullable().default(null)
|
|
4314
|
+
});
|
|
4315
|
+
zTelegramMemoryRecord = external_exports.object({
|
|
4316
|
+
id: external_exports.string().min(1),
|
|
4317
|
+
chatId: external_exports.string().min(1),
|
|
4318
|
+
content: external_exports.string().trim().min(1).max(1e3),
|
|
4319
|
+
createdAt: external_exports.string().datetime(),
|
|
4320
|
+
updatedAt: external_exports.string().datetime()
|
|
4321
|
+
});
|
|
4322
|
+
zTelegramChatContext = external_exports.object({
|
|
4323
|
+
chatId: external_exports.string().min(1),
|
|
4324
|
+
userId: external_exports.string().min(1),
|
|
4325
|
+
sessionId: external_exports.string().nullable(),
|
|
4326
|
+
activeProjectId: external_exports.string().nullable(),
|
|
4327
|
+
activeSessionId: external_exports.string().nullable(),
|
|
4328
|
+
personalityAgentId: external_exports.string().nullable(),
|
|
4329
|
+
summary: external_exports.string().max(4e3).nullable(),
|
|
4330
|
+
agent: zAgent,
|
|
4331
|
+
model: external_exports.string().min(1),
|
|
4332
|
+
effort: external_exports.string().min(1),
|
|
4333
|
+
memories: external_exports.array(zTelegramMemoryRecord)
|
|
4334
|
+
});
|
|
4335
|
+
TELEGRAM_REPLY_KINDS = [
|
|
4336
|
+
"progress",
|
|
4337
|
+
"final",
|
|
4338
|
+
"decision",
|
|
4339
|
+
"failure",
|
|
4340
|
+
"confirmation"
|
|
4341
|
+
];
|
|
4342
|
+
zTelegramReplyKind = external_exports.enum(TELEGRAM_REPLY_KINDS);
|
|
4343
|
+
zTelegramConfirmationRequest = external_exports.object({
|
|
4344
|
+
description: external_exports.string().trim().min(1).max(500),
|
|
4345
|
+
method: external_exports.enum(["POST", "PATCH", "PUT", "DELETE"]),
|
|
4346
|
+
path: external_exports.string().startsWith("/api/").max(1e3)
|
|
4347
|
+
});
|
|
4348
|
+
zTelegramReplyInput = external_exports.object({
|
|
4349
|
+
chatId: external_exports.string().min(1),
|
|
4350
|
+
updateId: external_exports.number().int().nonnegative(),
|
|
4351
|
+
kind: zTelegramReplyKind,
|
|
4352
|
+
text: external_exports.string().trim().min(1).max(12e3),
|
|
4353
|
+
summary: external_exports.string().trim().min(1).max(4e3).optional(),
|
|
4354
|
+
remember: external_exports.array(external_exports.string().trim().min(1).max(1e3)).max(20).optional(),
|
|
4355
|
+
confirmation: zTelegramConfirmationRequest.optional()
|
|
4356
|
+
}).superRefine((value, ctx) => {
|
|
4357
|
+
if (value.kind === "confirmation" && !value.confirmation) {
|
|
4358
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["confirmation"], message: "confirmation required" });
|
|
4359
|
+
}
|
|
4360
|
+
if (value.kind !== "confirmation" && value.confirmation) {
|
|
4361
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["confirmation"], message: "confirmation only valid for confirmation replies" });
|
|
4362
|
+
}
|
|
4363
|
+
});
|
|
4364
|
+
zTelegramAuditRecord = external_exports.object({
|
|
4365
|
+
id: external_exports.string().min(1),
|
|
4366
|
+
chatId: external_exports.string().nullable(),
|
|
4367
|
+
userId: external_exports.string().nullable(),
|
|
4368
|
+
updateId: external_exports.number().int().nonnegative().nullable(),
|
|
4369
|
+
action: external_exports.string().min(1),
|
|
4370
|
+
outcome: external_exports.string().min(1),
|
|
4371
|
+
correlationId: external_exports.string().nullable(),
|
|
4372
|
+
method: external_exports.string().nullable(),
|
|
4373
|
+
path: external_exports.string().nullable(),
|
|
4374
|
+
statusCode: external_exports.number().int().nullable(),
|
|
4375
|
+
createdAt: external_exports.string().datetime()
|
|
4376
|
+
});
|
|
4377
|
+
zTerminalSteerInput = external_exports.object({
|
|
4378
|
+
text: external_exports.string().trim().min(1).max(16e3)
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4381
|
+
});
|
|
4382
|
+
|
|
4284
4383
|
// ../shared/src/entities.ts
|
|
4285
4384
|
var zProject, zBriefPayload, zQaPayload, zGoalPayload, zSpecBlocker, zSpec, NOTIFY_SOUNDS, zCodex, CODEX_DEFAULTS, zSourceCommon, zScheduler, SCHEDULER_DEFAULTS, zGoal, GOAL_DEFAULTS, zConflict, CONFLICT_DEFAULTS, zLeadEngine, zLead, LEAD_DEFAULTS, zSetting, zNotification, zDocFile, zDeviceTokenView;
|
|
4286
4385
|
var init_entities = __esm({
|
|
@@ -4288,6 +4387,7 @@ var init_entities = __esm({
|
|
|
4288
4387
|
"use strict";
|
|
4289
4388
|
init_zod();
|
|
4290
4389
|
init_enums();
|
|
4390
|
+
init_telegram();
|
|
4291
4391
|
zProject = external_exports.object({
|
|
4292
4392
|
id: external_exports.string(),
|
|
4293
4393
|
name: external_exports.string(),
|
|
@@ -4462,8 +4562,10 @@ var init_entities = __esm({
|
|
|
4462
4562
|
// SPEC-376 · ADR-0080 · scope verifikasi sesi
|
|
4463
4563
|
conflict: zConflict.default(CONFLICT_DEFAULTS),
|
|
4464
4564
|
// SPEC-383 · ADR-0081 · default sesi konflik rebase/merge
|
|
4465
|
-
lead: zLead.default(LEAD_DEFAULTS)
|
|
4565
|
+
lead: zLead.default(LEAD_DEFAULTS),
|
|
4466
4566
|
// SPEC-409 · ADR-0091 · hanoman-lead (default mati)
|
|
4567
|
+
telegram: zTelegramSettings.default(TELEGRAM_DEFAULTS)
|
|
4568
|
+
// SPEC-476 · ADR-0096 · gateway Telegram (default mati)
|
|
4467
4569
|
});
|
|
4468
4570
|
zNotification = external_exports.object({
|
|
4469
4571
|
id: external_exports.string(),
|
|
@@ -4532,7 +4634,11 @@ var init_agent = __esm({
|
|
|
4532
4634
|
// definisi agen mengubah apa yang dilihat SETIAP sesi baru di seluruh workspace, jadi izin
|
|
4533
4635
|
// baca tak pernah cukup untuk itu (kelas bug SPEC-405).
|
|
4534
4636
|
"agents:read",
|
|
4535
|
-
"agents:write"
|
|
4637
|
+
"agents:write",
|
|
4638
|
+
// SPEC-476 · ADR-0096 · context/memory/reply/audit kanal Telegram. Aksi produk tetap memakai
|
|
4639
|
+
// capability domain produk masing-masing; domain ini tidak memberi akses shell atau sesi.
|
|
4640
|
+
"telegram:read",
|
|
4641
|
+
"telegram:write"
|
|
4536
4642
|
];
|
|
4537
4643
|
zCapability = external_exports.enum(CAPABILITY_IDS);
|
|
4538
4644
|
zCapabilityInfo = external_exports.object({
|
|
@@ -5165,6 +5271,8 @@ var init_api = __esm({
|
|
|
5165
5271
|
fsBrowse: (path) => `${API}/fs/browse${path ? `?path=${encodeURIComponent(path)}` : ""}`,
|
|
5166
5272
|
terminalSessions: `${API}/terminal/sessions`,
|
|
5167
5273
|
terminalSession: (id) => `${API}/terminal/sessions/${id}`,
|
|
5274
|
+
terminalSteer: (id) => `${API}/terminal/sessions/${id}/steer`,
|
|
5275
|
+
terminalInterrupt: (id) => `${API}/terminal/sessions/${id}/interrupt`,
|
|
5168
5276
|
terminalPhases: (id) => `${API}/terminal/sessions/${id}/phases`,
|
|
5169
5277
|
// SPEC-230 · review + integrate ber-skop sesi (sesi project-level PRD, tanpa Spec).
|
|
5170
5278
|
sessionReview: (id) => `${API}/terminal/sessions/${id}/review`,
|
|
@@ -5219,6 +5327,13 @@ var init_api = __esm({
|
|
|
5219
5327
|
// SPEC-450 · ADR-0094 · katalog custom agent. `?projectId=` → himpunan EFEKTIF (global+project).
|
|
5220
5328
|
customAgents: `${API}/custom-agents`,
|
|
5221
5329
|
customAgent: (id) => `${API}/custom-agents/${encodeURIComponent(id)}`,
|
|
5330
|
+
// SPEC-476 · ADR-0096 · observability/context/reply kanal Telegram.
|
|
5331
|
+
telegramStatus: `${API}/telegram/status`,
|
|
5332
|
+
telegramContext: (chatId) => `${API}/telegram/chats/${encodeURIComponent(chatId)}/context`,
|
|
5333
|
+
telegramMemories: (chatId) => `${API}/telegram/chats/${encodeURIComponent(chatId)}/memories`,
|
|
5334
|
+
telegramMemory: (chatId, id) => `${API}/telegram/chats/${encodeURIComponent(chatId)}/memories/${encodeURIComponent(id)}`,
|
|
5335
|
+
telegramReplies: `${API}/telegram/replies`,
|
|
5336
|
+
telegramAudit: `${API}/telegram/audit`,
|
|
5222
5337
|
// SPEC-268 · ADR-0066 · pemicu sync manual (cookie-authed)
|
|
5223
5338
|
syncNow: `${API}/sync/now`,
|
|
5224
5339
|
// SPEC-270 · ADR-0067 · antrean konflik rekonsil (cookie-authed)
|
|
@@ -5331,7 +5446,8 @@ var init_session_kind = __esm({
|
|
|
5331
5446
|
"vps",
|
|
5332
5447
|
"shell",
|
|
5333
5448
|
"worktree",
|
|
5334
|
-
"terminal"
|
|
5449
|
+
"terminal",
|
|
5450
|
+
"telegram"
|
|
5335
5451
|
];
|
|
5336
5452
|
zSessionKind = external_exports.enum(SESSION_KINDS);
|
|
5337
5453
|
}
|
|
@@ -5535,6 +5651,7 @@ var init_src = __esm({
|
|
|
5535
5651
|
init_config();
|
|
5536
5652
|
init_config_registry();
|
|
5537
5653
|
init_semver();
|
|
5654
|
+
init_telegram();
|
|
5538
5655
|
}
|
|
5539
5656
|
});
|
|
5540
5657
|
|
|
@@ -5603,6 +5720,13 @@ var init_paths = __esm({
|
|
|
5603
5720
|
}
|
|
5604
5721
|
});
|
|
5605
5722
|
|
|
5723
|
+
// ../runner/src/telegram-operator.ts
|
|
5724
|
+
var init_telegram_operator = __esm({
|
|
5725
|
+
"../runner/src/telegram-operator.ts"() {
|
|
5726
|
+
"use strict";
|
|
5727
|
+
}
|
|
5728
|
+
});
|
|
5729
|
+
|
|
5606
5730
|
// ../runner/src/index.ts
|
|
5607
5731
|
var init_src2 = __esm({
|
|
5608
5732
|
"../runner/src/index.ts"() {
|
|
@@ -5619,6 +5743,7 @@ var init_src2 = __esm({
|
|
|
5619
5743
|
init_custom_agents();
|
|
5620
5744
|
init_verify_scope();
|
|
5621
5745
|
init_paths();
|
|
5746
|
+
init_telegram_operator();
|
|
5622
5747
|
}
|
|
5623
5748
|
});
|
|
5624
5749
|
|
|
@@ -6271,6 +6396,15 @@ var init_migrate_pg = __esm({
|
|
|
6271
6396
|
"SchedulerQueueItem",
|
|
6272
6397
|
"RuntimeConfig",
|
|
6273
6398
|
"LeadDecision",
|
|
6399
|
+
// SPEC-476 · ADR-0096 · tabel gateway LOCAL-only; sumber Postgres lama lazimnya tidak punya
|
|
6400
|
+
// tabel ini dan jalur 42P01 di bawah memperlakukannya sebagai nol baris.
|
|
6401
|
+
"TelegramGatewayState",
|
|
6402
|
+
"TelegramChat",
|
|
6403
|
+
"TelegramUpdate",
|
|
6404
|
+
"TelegramMemory",
|
|
6405
|
+
"TelegramOutbox",
|
|
6406
|
+
"TelegramConfirmation",
|
|
6407
|
+
"TelegramAudit",
|
|
6274
6408
|
"Ticket",
|
|
6275
6409
|
"TicketAttachment",
|
|
6276
6410
|
// SPEC-471 · ADR-0095 · GithubIssue sesudah Project (FK projectId) DAN sesudah Spec: `specId`
|