@cleocode/adapters 2026.10.1 → 2026.10.2
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/index.js +1073 -262
- package/dist/index.js.map +3 -3
- package/dist/providers/claude-code/install.d.ts +6 -0
- package/dist/providers/claude-code/install.d.ts.map +1 -1
- package/dist/providers/claude-code/paths.d.ts +1 -78
- package/dist/providers/claude-code/paths.d.ts.map +1 -1
- package/dist/providers/codex/install.d.ts +8 -2
- package/dist/providers/codex/install.d.ts.map +1 -1
- package/dist/providers/kimi/install.d.ts +15 -0
- package/dist/providers/kimi/install.d.ts.map +1 -1
- package/dist/providers/opencode/install.d.ts +2 -0
- package/dist/providers/opencode/install.d.ts.map +1 -1
- package/dist/providers/shared/heavy-command-hook-install.d.ts +173 -0
- package/dist/providers/shared/heavy-command-hook-install.d.ts.map +1 -0
- package/dist/providers/shared/hook-config.d.ts +94 -0
- package/dist/providers/shared/hook-config.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/providers/claude-code/install.ts +29 -1
- package/src/providers/claude-code/paths.ts +9 -131
- package/src/providers/codex/install.ts +27 -3
- package/src/providers/kimi/install.ts +15 -0
- package/src/providers/opencode/install.ts +24 -1
- package/src/providers/shared/__tests__/heavy-command-hook-install.test.ts +621 -0
- package/src/providers/shared/heavy-command-hook-install.ts +562 -0
- package/src/providers/shared/hook-config.ts +145 -0
package/dist/index.js
CHANGED
|
@@ -14216,6 +14216,326 @@ var init_adr_073_saga = __esm({
|
|
|
14216
14216
|
}
|
|
14217
14217
|
});
|
|
14218
14218
|
|
|
14219
|
+
// packages/contracts/src/invariants/sync-write-invariants.ts
|
|
14220
|
+
function checkPending(task) {
|
|
14221
|
+
return { task, reason: "the post-apply check is not implemented yet (T12344 item)" };
|
|
14222
|
+
}
|
|
14223
|
+
function rulePending(task) {
|
|
14224
|
+
return { task, reason: "the typed merge-rule registry does not define it yet (T12344 item)" };
|
|
14225
|
+
}
|
|
14226
|
+
function trigger(id, tables, triggers, inventory, reason) {
|
|
14227
|
+
return { id, class: "trigger-covered", tables, sites: [], triggers, inventory, reason };
|
|
14228
|
+
}
|
|
14229
|
+
function pac(id, item, task, tables, footprint, reason) {
|
|
14230
|
+
return {
|
|
14231
|
+
id,
|
|
14232
|
+
class: "post-apply-check",
|
|
14233
|
+
tables,
|
|
14234
|
+
sites: [],
|
|
14235
|
+
check: { footprint },
|
|
14236
|
+
inventory: [item],
|
|
14237
|
+
pending: checkPending(task),
|
|
14238
|
+
reason
|
|
14239
|
+
};
|
|
14240
|
+
}
|
|
14241
|
+
function rule(id, task, table, columns, inventory, reason, tables = [table]) {
|
|
14242
|
+
return {
|
|
14243
|
+
id,
|
|
14244
|
+
class: "monotonic-merge-rule",
|
|
14245
|
+
tables,
|
|
14246
|
+
sites: [],
|
|
14247
|
+
mergeRule: { table, columns },
|
|
14248
|
+
inventory,
|
|
14249
|
+
pending: rulePending(task),
|
|
14250
|
+
reason
|
|
14251
|
+
};
|
|
14252
|
+
}
|
|
14253
|
+
var SYNC_WRITE_INVARIANTS;
|
|
14254
|
+
var init_sync_write_invariants = __esm({
|
|
14255
|
+
"packages/contracts/src/invariants/sync-write-invariants.ts"() {
|
|
14256
|
+
"use strict";
|
|
14257
|
+
SYNC_WRITE_INVARIANTS = Object.freeze([
|
|
14258
|
+
// §3.6.2: RAISE guards and UNIQUE indexes a migration creates on synced tables.
|
|
14259
|
+
trigger(
|
|
14260
|
+
"task.parent.no-cycle",
|
|
14261
|
+
["tasks_tasks"],
|
|
14262
|
+
["tasks_tasks_parent_cycle_guard_insert", "tasks_tasks_parent_cycle_guard_update"],
|
|
14263
|
+
["V10", "V11"],
|
|
14264
|
+
"the parent chain is acyclic (the INSERT variant misses a self-parent, \xA73.6.3 item 2)"
|
|
14265
|
+
),
|
|
14266
|
+
trigger(
|
|
14267
|
+
"task.parent.type-matrix",
|
|
14268
|
+
["tasks_tasks"],
|
|
14269
|
+
["tasks_tasks_parent_type_matrix_insert", "tasks_tasks_parent_type_matrix_update"],
|
|
14270
|
+
["X1"],
|
|
14271
|
+
"parent/child type matrix; weaker than TypeScript (\xA73.6.3 item 1), the rest is PAC-01"
|
|
14272
|
+
),
|
|
14273
|
+
trigger(
|
|
14274
|
+
"task.status.pipeline-consistency",
|
|
14275
|
+
["tasks_tasks"],
|
|
14276
|
+
["trg_tasks_tasks_status_pipeline_insert", "trg_tasks_tasks_status_pipeline_update"],
|
|
14277
|
+
["V19", "C21"],
|
|
14278
|
+
"T877: status and pipeline_stage agree on one row"
|
|
14279
|
+
),
|
|
14280
|
+
trigger(
|
|
14281
|
+
"task.relation.non-containment",
|
|
14282
|
+
["tasks_task_relations"],
|
|
14283
|
+
["tasks_task_relations_non_containment_insert", "tasks_task_relations_non_containment_update"],
|
|
14284
|
+
["V31"],
|
|
14285
|
+
"no relation between a parent and its child, on relation writes only (\xA73.6.3 item 4)"
|
|
14286
|
+
),
|
|
14287
|
+
trigger(
|
|
14288
|
+
"task.ac.child-target",
|
|
14289
|
+
["tasks_task_acceptance_criteria"],
|
|
14290
|
+
["tasks_task_acceptance_child_target_insert", "tasks_task_acceptance_child_target_update"],
|
|
14291
|
+
["C28"],
|
|
14292
|
+
"a child_task AC targets a direct child, on AC writes only (\xA73.6.3 item 4)"
|
|
14293
|
+
),
|
|
14294
|
+
trigger(
|
|
14295
|
+
"session.handoff.append-only",
|
|
14296
|
+
["tasks_session_handoff_entries"],
|
|
14297
|
+
["trg_tasks_session_handoff_no_update"],
|
|
14298
|
+
["H2"],
|
|
14299
|
+
"handoff entries are never updated"
|
|
14300
|
+
),
|
|
14301
|
+
trigger(
|
|
14302
|
+
"task.claim.lease-iso",
|
|
14303
|
+
["tasks_tasks"],
|
|
14304
|
+
["tasks_tasks_lease_iso_insert", "tasks_tasks_lease_iso_update"],
|
|
14305
|
+
[],
|
|
14306
|
+
"claim lease timestamps are ISO-8601 (t12736)"
|
|
14307
|
+
),
|
|
14308
|
+
trigger(
|
|
14309
|
+
"task.ac-binding.unique",
|
|
14310
|
+
["tasks_evidence_ac_bindings"],
|
|
14311
|
+
["uq_tasks_evidence_ac_bindings_atom_ac_type"],
|
|
14312
|
+
["C31"],
|
|
14313
|
+
"one binding per (evidence atom, AC, binding type)"
|
|
14314
|
+
),
|
|
14315
|
+
trigger(
|
|
14316
|
+
"release.version.unique",
|
|
14317
|
+
["tasks_releases"],
|
|
14318
|
+
["uq_tasks_releases_version"],
|
|
14319
|
+
["REL-1"],
|
|
14320
|
+
"one release row per version"
|
|
14321
|
+
),
|
|
14322
|
+
trigger(
|
|
14323
|
+
"selfimprove.dhq.one-open",
|
|
14324
|
+
["selfimprove_dhq"],
|
|
14325
|
+
["ux_selfimprove_dhq_open"],
|
|
14326
|
+
["D49"],
|
|
14327
|
+
"at most one open DHQ entry per question_hash"
|
|
14328
|
+
),
|
|
14329
|
+
trigger(
|
|
14330
|
+
"account.one-active-per-provider",
|
|
14331
|
+
["accounts"],
|
|
14332
|
+
["ux_accounts_active_provider"],
|
|
14333
|
+
["A40"],
|
|
14334
|
+
"at most one active account per provider (partial UNIQUE)"
|
|
14335
|
+
),
|
|
14336
|
+
// §3.6.5: post-apply check families (T12344 items).
|
|
14337
|
+
pac(
|
|
14338
|
+
"task.tree.shape",
|
|
14339
|
+
"PAC-01",
|
|
14340
|
+
"T12922",
|
|
14341
|
+
["tasks_tasks"],
|
|
14342
|
+
["rows with a changed parent_id or type", "their direct children and ancestor chain"],
|
|
14343
|
+
"saga\u2192epic\u2192task\u2192subtask matrix, non-saga has a parent, depth \u2264 3, no self-parent"
|
|
14344
|
+
),
|
|
14345
|
+
pac(
|
|
14346
|
+
"task.terminal-parent.live-children",
|
|
14347
|
+
"PAC-02",
|
|
14348
|
+
"T12923",
|
|
14349
|
+
["tasks_tasks"],
|
|
14350
|
+
["rows whose status, stage or parent changed", "their parent and siblings"],
|
|
14351
|
+
"no terminal parent with a live child; epic stage \u2265 children; rollup re-evaluated"
|
|
14352
|
+
),
|
|
14353
|
+
pac(
|
|
14354
|
+
"task.dependency.graph",
|
|
14355
|
+
"PAC-03",
|
|
14356
|
+
"T12924",
|
|
14357
|
+
["tasks_task_dependencies", "tasks_tasks"],
|
|
14358
|
+
["dependency edges inserted in the page", "reachability from each depends_on"],
|
|
14359
|
+
"dependencies are acyclic, with no self-edge"
|
|
14360
|
+
),
|
|
14361
|
+
pac(
|
|
14362
|
+
"task.done.evidence",
|
|
14363
|
+
"PAC-04",
|
|
14364
|
+
"T12925",
|
|
14365
|
+
["tasks_tasks", "tasks_task_acceptance_criteria", "tasks_evidence_ac_bindings"],
|
|
14366
|
+
["done rows in the page", "their AC rows, bindings, acceptance_json and verification_json"],
|
|
14367
|
+
"a done task has passed verification and every AC bound or waived"
|
|
14368
|
+
),
|
|
14369
|
+
pac(
|
|
14370
|
+
"task.ac.integrity",
|
|
14371
|
+
"PAC-05",
|
|
14372
|
+
"T12926",
|
|
14373
|
+
["tasks_tasks", "tasks_task_acceptance_criteria", "tasks_evidence_ac_bindings"],
|
|
14374
|
+
["tasks whose AC rows, bindings, acceptance_json, parent_id or relations changed"],
|
|
14375
|
+
"acceptance_json \u21D4 AC rows, child_task ACs match children, bindings resolve"
|
|
14376
|
+
),
|
|
14377
|
+
pac(
|
|
14378
|
+
"lifecycle.rows",
|
|
14379
|
+
"PAC-06",
|
|
14380
|
+
"T12927",
|
|
14381
|
+
["tasks_lifecycle_pipelines", "tasks_lifecycle_stages", "tasks_tasks"],
|
|
14382
|
+
["lifecycle pipeline, stage and gate rows in the page", "the owning task row"],
|
|
14383
|
+
"one pipeline per task, one stage row per name, pipeline_stage \u2265 completed stages"
|
|
14384
|
+
),
|
|
14385
|
+
pac(
|
|
14386
|
+
"derived.mirrors",
|
|
14387
|
+
"PAC-07",
|
|
14388
|
+
"T12928",
|
|
14389
|
+
["tasks_task_labels", "brain_sticky_tags", "docs_wikilinks", "tasks_tasks"],
|
|
14390
|
+
["owning rows whose JSON or junction changed"],
|
|
14391
|
+
"junction tables equal their JSON source"
|
|
14392
|
+
),
|
|
14393
|
+
pac(
|
|
14394
|
+
"session.goal.singletons",
|
|
14395
|
+
"PAC-08",
|
|
14396
|
+
"T12929",
|
|
14397
|
+
["tasks_sessions", "tasks_task_work_history", "tasks_goal"],
|
|
14398
|
+
["session rows whose status, scope or chain changed", "work-history rows per session"],
|
|
14399
|
+
"one active session per scope, reciprocal chain, one open interval, one live goal"
|
|
14400
|
+
),
|
|
14401
|
+
pac(
|
|
14402
|
+
"audit.uniqueness",
|
|
14403
|
+
"PAC-09",
|
|
14404
|
+
"T12930",
|
|
14405
|
+
["tasks_audit_log"],
|
|
14406
|
+
["audit rows with a non-null idempotency key", "rollback audit rows"],
|
|
14407
|
+
"idempotency keys are unique across replicas; at most one rollback per receipt"
|
|
14408
|
+
),
|
|
14409
|
+
pac(
|
|
14410
|
+
"identity.collisions",
|
|
14411
|
+
"PAC-10",
|
|
14412
|
+
"T12931",
|
|
14413
|
+
["tasks_tasks", "tasks_sessions", "brain_observations", "docs_attachments"],
|
|
14414
|
+
["inserted rows", "the natural key's index"],
|
|
14415
|
+
"display-id and natural-key clashes become an alias or re-mint (T12341)"
|
|
14416
|
+
),
|
|
14417
|
+
pac(
|
|
14418
|
+
"dedupe.at-most-one",
|
|
14419
|
+
"PAC-11",
|
|
14420
|
+
"T12932",
|
|
14421
|
+
["brain_decisions", "brain_learnings", "tasks_external_task_links"],
|
|
14422
|
+
["inserted rows grouped by the natural key"],
|
|
14423
|
+
"duplicates created on two devices are merged"
|
|
14424
|
+
),
|
|
14425
|
+
pac(
|
|
14426
|
+
"ref.soft-orphans",
|
|
14427
|
+
"PAC-12",
|
|
14428
|
+
"T12933",
|
|
14429
|
+
["brain_memory_links", "brain_page_edges", "docs_attachment_refs", "tasks_task_commits"],
|
|
14430
|
+
["reference columns of the rows in the page", "their targets"],
|
|
14431
|
+
"cross-DB and polymorphic references resolve"
|
|
14432
|
+
),
|
|
14433
|
+
pac(
|
|
14434
|
+
"supersession.graph",
|
|
14435
|
+
"PAC-13",
|
|
14436
|
+
"T12934",
|
|
14437
|
+
["brain_decisions", "docs_attachments", "tasks_architecture_decisions"],
|
|
14438
|
+
["rows whose supersession columns changed", "a chain walk"],
|
|
14439
|
+
"supersession chains are acyclic with at most one successor"
|
|
14440
|
+
),
|
|
14441
|
+
pac(
|
|
14442
|
+
"derived.counters",
|
|
14443
|
+
"PAC-14",
|
|
14444
|
+
"T12935",
|
|
14445
|
+
["docs_attachments", "conduit_attachments", "docs_pipeline_manifest"],
|
|
14446
|
+
["the owning rows"],
|
|
14447
|
+
"derived counters and cross-column facts agree with their rows"
|
|
14448
|
+
),
|
|
14449
|
+
pac(
|
|
14450
|
+
"apply.preconditions",
|
|
14451
|
+
"PAC-15",
|
|
14452
|
+
"T12936",
|
|
14453
|
+
["tasks_tasks"],
|
|
14454
|
+
["the whole page"],
|
|
14455
|
+
"no apply while the local twin collapse has failed; restore is a re-baseline"
|
|
14456
|
+
),
|
|
14457
|
+
// §3.6.6: typed merge rules (T12344).
|
|
14458
|
+
rule(
|
|
14459
|
+
"task.status.absorbing",
|
|
14460
|
+
"T12937",
|
|
14461
|
+
"tasks_tasks",
|
|
14462
|
+
["status", "completed_at", "cancelled_at", "cancellation_reason", "pipeline_stage"],
|
|
14463
|
+
["V18", "V20", "C22", "P40", "P46", "P47"],
|
|
14464
|
+
"done, cancelled and archived are absorbing; leaving them needs an explicit op"
|
|
14465
|
+
),
|
|
14466
|
+
rule(
|
|
14467
|
+
"task.pipeline-stage.max",
|
|
14468
|
+
"T12938",
|
|
14469
|
+
"tasks_tasks",
|
|
14470
|
+
["pipeline_stage"],
|
|
14471
|
+
["V21", "C20", "P01", "F3"],
|
|
14472
|
+
"pipeline_stage is the maximum by STAGE_ORDER, except an explicit restore"
|
|
14473
|
+
),
|
|
14474
|
+
rule(
|
|
14475
|
+
"task.verification.frozen-on-done",
|
|
14476
|
+
"T12939",
|
|
14477
|
+
"tasks_tasks",
|
|
14478
|
+
["verification_json"],
|
|
14479
|
+
["C01", "C02", "C03", "C17"],
|
|
14480
|
+
"verification is frozen once done; otherwise merged per gate"
|
|
14481
|
+
),
|
|
14482
|
+
rule(
|
|
14483
|
+
"session.status.terminal",
|
|
14484
|
+
"T12940",
|
|
14485
|
+
"tasks_sessions",
|
|
14486
|
+
["status", "ended_at"],
|
|
14487
|
+
["S7", "S8", "S9", "S10", "S11", "S17", "S18", "SC2", "N1", "SK5", "P32"],
|
|
14488
|
+
"ended and orphaned are terminal except on an explicit resume"
|
|
14489
|
+
),
|
|
14490
|
+
rule("audit.immutable", "T12941", "tasks_audit_log", ["*"], ["SA3"], "audit rows are immutable", [
|
|
14491
|
+
"tasks_audit_log",
|
|
14492
|
+
"audit_log"
|
|
14493
|
+
]),
|
|
14494
|
+
rule(
|
|
14495
|
+
"sticky.status.one-way",
|
|
14496
|
+
"T12942",
|
|
14497
|
+
"brain_sticky_notes",
|
|
14498
|
+
["status", "converted_to_json"],
|
|
14499
|
+
["SK2", "SK3", "B24"],
|
|
14500
|
+
"active\u2192{converted, archived} is one-way; converted_to_json is write-once"
|
|
14501
|
+
),
|
|
14502
|
+
rule(
|
|
14503
|
+
"release.status.absorbing",
|
|
14504
|
+
"T12943",
|
|
14505
|
+
"tasks_releases",
|
|
14506
|
+
["status"],
|
|
14507
|
+
["REL-2", "REL-3", "REL-4", "REL-5", "REL-6", "REL-7", "REL-8"],
|
|
14508
|
+
"shipped release statuses are absorbing"
|
|
14509
|
+
),
|
|
14510
|
+
rule(
|
|
14511
|
+
"playbook.approval.once",
|
|
14512
|
+
"T12944",
|
|
14513
|
+
"tasks_playbook_approvals",
|
|
14514
|
+
["status"],
|
|
14515
|
+
["PB-1", "PB-4", "PB-7", "P33"],
|
|
14516
|
+
"an approval goes pending\u2192decided once"
|
|
14517
|
+
),
|
|
14518
|
+
rule(
|
|
14519
|
+
"docs.lifecycle.transitions",
|
|
14520
|
+
"T12945",
|
|
14521
|
+
"docs_attachments",
|
|
14522
|
+
["lifecycle_status"],
|
|
14523
|
+
["D04", "D05", "D31", "D32", "D39", "D50"],
|
|
14524
|
+
"superseded is sticky; lifecycle transitions follow a matrix"
|
|
14525
|
+
),
|
|
14526
|
+
// §3.6.0 identity-layer rows.
|
|
14527
|
+
{
|
|
14528
|
+
id: "identity.local-minting",
|
|
14529
|
+
class: "identity-layer",
|
|
14530
|
+
tables: ["tasks_tasks", "tasks_sessions"],
|
|
14531
|
+
sites: [],
|
|
14532
|
+
inventory: ["V12", "B07", "B12"],
|
|
14533
|
+
reason: "ids minted from local state (display ids, integer PKs, device-derived ids) collide across replicas; T12341 uids and re-minting own it, no validator port can"
|
|
14534
|
+
}
|
|
14535
|
+
]);
|
|
14536
|
+
}
|
|
14537
|
+
});
|
|
14538
|
+
|
|
14219
14539
|
// packages/contracts/src/invariants/index.ts
|
|
14220
14540
|
function buildKey(invariant) {
|
|
14221
14541
|
return `${invariant.adr}.${invariant.code}`;
|
|
@@ -14246,6 +14566,7 @@ var init_invariants = __esm({
|
|
|
14246
14566
|
init_adr_056_release();
|
|
14247
14567
|
init_adr_070_orchestration();
|
|
14248
14568
|
init_adr_073_saga();
|
|
14569
|
+
init_sync_write_invariants();
|
|
14249
14570
|
INVARIANTS_REGISTRY = buildRegistry();
|
|
14250
14571
|
}
|
|
14251
14572
|
});
|
|
@@ -16638,8 +16959,8 @@ var init_taxonomy = __esm({
|
|
|
16638
16959
|
normalizeSet(labels) {
|
|
16639
16960
|
const result = /* @__PURE__ */ new Set();
|
|
16640
16961
|
for (const label of labels) {
|
|
16641
|
-
const
|
|
16642
|
-
result.add(
|
|
16962
|
+
const canonical2 = this.normalize(label);
|
|
16963
|
+
result.add(canonical2 ?? label);
|
|
16643
16964
|
}
|
|
16644
16965
|
return [...result];
|
|
16645
16966
|
}
|
|
@@ -17671,7 +17992,7 @@ var init_nexus_account = __esm({
|
|
|
17671
17992
|
|
|
17672
17993
|
// packages/contracts/src/nexus-cloud.ts
|
|
17673
17994
|
import { z as z26 } from "zod";
|
|
17674
|
-
var NEXUS_DEVICE_STATES, NEXUS_CLOUD_PROFILES, NEXUS_DEVICE_STATE_UNKNOWN, isoTime, profile, deviceState, nexusCloudCredentialSchema, nexusCloudDeviceSchema, nexusCloudOrganizationSchema, nexusCloudUserSchema, nexusCloudWhoamiSchema, nexusCloudDevicePageSchema, nexusCloudPresenceSchema, nexusCloudReplicaSchema, nexusCloudDeviceCountsSchema, projectFields, nexusCloudProjectListItemSchema, nexusCloudProjectPageSchema, nexusCloudProjectDetailSchema, nexusCloudReplicaPageSchema, NEXUS_STATUS_CHECK_IDS, NEXUS_STATUS_VERDICTS, CLOUD_STATUS_VERDICTS, knownCheckId, nexusCloudStatusCheckSchema, nexusCloudStatusSchema;
|
|
17995
|
+
var NEXUS_DEVICE_STATES, NEXUS_CLOUD_PROFILES, NEXUS_DEVICE_STATE_UNKNOWN, isoTime, profile, deviceState, nexusCloudCredentialSchema, nexusCloudDeviceSchema, nexusCloudOrganizationSchema, nexusCloudUserSchema, nexusCloudWhoamiSchema, nexusCloudDevicePageSchema, nexusCloudPresenceSchema, nexusCloudReplicaSchema, nexusCloudDeviceCountsSchema, projectFields, nexusCloudProjectListItemSchema, nexusCloudProjectPageSchema, nexusCloudProjectDetailSchema, nexusCloudReplicaPageSchema, NEXUS_STATUS_CHECK_IDS, NEXUS_STATUS_VERDICTS, CLOUD_STATUS_VERDICTS, knownCheckId, nexusCloudStatusCheckSchema, nexusCloudStatusSchema, LOGIN, SESSION_EXPIRED_LOGIN, SERVER_REFUSED, NEXUS_FORBIDDEN_ERRORS;
|
|
17675
17996
|
var init_nexus_cloud = __esm({
|
|
17676
17997
|
"packages/contracts/src/nexus-cloud.ts"() {
|
|
17677
17998
|
"use strict";
|
|
@@ -17870,6 +18191,107 @@ var init_nexus_cloud = __esm({
|
|
|
17870
18191
|
/** A verdict added by a newer server reads as `attention`: never `ok` by accident. */
|
|
17871
18192
|
verdict: z26.enum(NEXUS_STATUS_VERDICTS).catch("attention")
|
|
17872
18193
|
});
|
|
18194
|
+
LOGIN = "run `cleo login nexus`";
|
|
18195
|
+
SESSION_EXPIRED_LOGIN = {
|
|
18196
|
+
code: "E_NEXUS_SESSION_EXPIRED",
|
|
18197
|
+
message: "the session is too old for this request",
|
|
18198
|
+
fix: "run `cleo login nexus` (needs a browser: on a headless machine a human must complete the login)"
|
|
18199
|
+
};
|
|
18200
|
+
SERVER_REFUSED = {
|
|
18201
|
+
code: "E_NEXUS_REQUEST_FAILED",
|
|
18202
|
+
message: null,
|
|
18203
|
+
fix: null
|
|
18204
|
+
};
|
|
18205
|
+
NEXUS_FORBIDDEN_ERRORS = {
|
|
18206
|
+
"insufficient-scope": {
|
|
18207
|
+
code: "E_NEXUS_INSUFFICIENT_SCOPE",
|
|
18208
|
+
message: "this device's credential lacks the scope for that request",
|
|
18209
|
+
fix: "run `cleo login nexus` without --read-only to enrol with the full device profile"
|
|
18210
|
+
},
|
|
18211
|
+
"session-required": SERVER_REFUSED,
|
|
18212
|
+
"device-required": SERVER_REFUSED,
|
|
18213
|
+
"device-mismatch": SERVER_REFUSED,
|
|
18214
|
+
"not-self": SERVER_REFUSED,
|
|
18215
|
+
"project-role": SERVER_REFUSED,
|
|
18216
|
+
"route-undeclared": SERVER_REFUSED,
|
|
18217
|
+
"bearer-session-required": SESSION_EXPIRED_LOGIN,
|
|
18218
|
+
"session-not-fresh": SESSION_EXPIRED_LOGIN,
|
|
18219
|
+
"device-limit": {
|
|
18220
|
+
code: "E_NEXUS_REQUEST_FAILED",
|
|
18221
|
+
message: "the account has reached its device limit",
|
|
18222
|
+
fix: "revoke unused devices on cleocode.dev, then retry"
|
|
18223
|
+
},
|
|
18224
|
+
"device-flow-session-required": {
|
|
18225
|
+
code: "E_NEXUS_SESSION_EXPIRED",
|
|
18226
|
+
message: "this session was not issued to the CLI by `cleo login nexus`, so it cannot enrol a device",
|
|
18227
|
+
fix: SESSION_EXPIRED_LOGIN.fix
|
|
18228
|
+
},
|
|
18229
|
+
"device-not-enrolled": {
|
|
18230
|
+
code: "E_NEXUS_NOT_SIGNED_IN",
|
|
18231
|
+
message: "this device is not enrolled with Cleo Nexus",
|
|
18232
|
+
fix: LOGIN
|
|
18233
|
+
}
|
|
18234
|
+
};
|
|
18235
|
+
}
|
|
18236
|
+
});
|
|
18237
|
+
|
|
18238
|
+
// packages/contracts/src/nexus-vault.ts
|
|
18239
|
+
import { z as z27 } from "zod";
|
|
18240
|
+
var isoTime2, uuid, nexusUserKeysSchema, nexusProjectKeysSchema, nexusLeaseSchema, nexusLeaseAcquireSchema, nexusStreamHeadSchema, nexusActivityEventSchema, nexusActivityPageSchema;
|
|
18241
|
+
var init_nexus_vault = __esm({
|
|
18242
|
+
"packages/contracts/src/nexus-vault.ts"() {
|
|
18243
|
+
"use strict";
|
|
18244
|
+
isoTime2 = z27.iso.datetime({ offset: true });
|
|
18245
|
+
uuid = z27.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
|
|
18246
|
+
nexusUserKeysSchema = z27.looseObject({
|
|
18247
|
+
keyVersion: z27.number().int().positive(),
|
|
18248
|
+
masterKeyVerifier: z27.string()
|
|
18249
|
+
});
|
|
18250
|
+
nexusProjectKeysSchema = z27.looseObject({
|
|
18251
|
+
keys: z27.array(
|
|
18252
|
+
z27.looseObject({ wrappedProjectKey: z27.string(), keyVersion: z27.number().int().positive() })
|
|
18253
|
+
)
|
|
18254
|
+
});
|
|
18255
|
+
nexusLeaseSchema = z27.looseObject({
|
|
18256
|
+
streamId: z27.string(),
|
|
18257
|
+
role: z27.string(),
|
|
18258
|
+
replicaId: uuid,
|
|
18259
|
+
expiresAt: isoTime2,
|
|
18260
|
+
forkedFromReplicaId: uuid.nullable().optional()
|
|
18261
|
+
});
|
|
18262
|
+
nexusLeaseAcquireSchema = z27.looseObject({ lease: nexusLeaseSchema });
|
|
18263
|
+
nexusStreamHeadSchema = z27.looseObject({
|
|
18264
|
+
streamId: z27.string(),
|
|
18265
|
+
kind: z27.string().optional(),
|
|
18266
|
+
headSeq: z27.number().int().nonnegative(),
|
|
18267
|
+
headCheckpointId: z27.string().nullable(),
|
|
18268
|
+
/**
|
|
18269
|
+
* The highest segment `schemaVersion` the stream holds (the server raises it on every append).
|
|
18270
|
+
* Absent from an older server.
|
|
18271
|
+
*/
|
|
18272
|
+
maxSchemaVersion: z27.number().int().nonnegative().optional()
|
|
18273
|
+
});
|
|
18274
|
+
nexusActivityEventSchema = z27.looseObject({
|
|
18275
|
+
id: z27.union([z27.string(), z27.number()]),
|
|
18276
|
+
at: isoTime2,
|
|
18277
|
+
actorUserId: z27.string().nullable().optional(),
|
|
18278
|
+
actorDeviceId: z27.string().nullable().optional(),
|
|
18279
|
+
requestId: z27.string().nullable().optional(),
|
|
18280
|
+
action: z27.string(),
|
|
18281
|
+
target: z27.string().nullable().optional(),
|
|
18282
|
+
detail: z27.unknown().optional()
|
|
18283
|
+
});
|
|
18284
|
+
nexusActivityPageSchema = z27.looseObject({
|
|
18285
|
+
events: z27.array(nexusActivityEventSchema),
|
|
18286
|
+
nextBefore: z27.union([z27.string(), z27.number()]).nullable().optional()
|
|
18287
|
+
});
|
|
18288
|
+
}
|
|
18289
|
+
});
|
|
18290
|
+
|
|
18291
|
+
// packages/contracts/src/sync-schema.ts
|
|
18292
|
+
var init_sync_schema = __esm({
|
|
18293
|
+
"packages/contracts/src/sync-schema.ts"() {
|
|
18294
|
+
"use strict";
|
|
17873
18295
|
}
|
|
17874
18296
|
});
|
|
17875
18297
|
|
|
@@ -17958,6 +18380,8 @@ var init_src = __esm({
|
|
|
17958
18380
|
init_decide_sites();
|
|
17959
18381
|
init_nexus_account();
|
|
17960
18382
|
init_nexus_cloud();
|
|
18383
|
+
init_nexus_vault();
|
|
18384
|
+
init_sync_schema();
|
|
17961
18385
|
init_task_id();
|
|
17962
18386
|
}
|
|
17963
18387
|
});
|
|
@@ -19470,7 +19894,7 @@ __export(regexes_exports, {
|
|
|
19470
19894
|
undefined: () => _undefined,
|
|
19471
19895
|
unicodeEmail: () => unicodeEmail,
|
|
19472
19896
|
uppercase: () => uppercase,
|
|
19473
|
-
uuid: () =>
|
|
19897
|
+
uuid: () => uuid2,
|
|
19474
19898
|
uuid4: () => uuid4,
|
|
19475
19899
|
uuid6: () => uuid6,
|
|
19476
19900
|
uuid7: () => uuid7,
|
|
@@ -19503,7 +19927,7 @@ function fixedBase64(bodyLength, padding) {
|
|
|
19503
19927
|
function fixedBase64url(length) {
|
|
19504
19928
|
return new RegExp(`^[A-Za-z0-9_-]{${length}}$`);
|
|
19505
19929
|
}
|
|
19506
|
-
var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, extendedDuration, guid,
|
|
19930
|
+
var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, extendedDuration, guid, uuid2, uuid4, uuid6, uuid7, email, html5Email, rfc5322Email, unicodeEmail, idnEmail, browserEmail, _emoji, ipv4, ipv6, mac, cidrv4, cidrv6, base64, base64url, hostname, domain, e164, dateSource, date, string, bigint, integer, number, boolean, _null, _undefined, lowercase, uppercase, hex, md5_hex, md5_base64, md5_base64url, sha1_hex, sha1_base64, sha1_base64url, sha256_hex, sha256_base64, sha256_base64url, sha384_hex, sha384_base64, sha384_base64url, sha512_hex, sha512_base64, sha512_base64url;
|
|
19507
19931
|
var init_regexes = __esm({
|
|
19508
19932
|
"node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js"() {
|
|
19509
19933
|
init_util();
|
|
@@ -19516,14 +19940,14 @@ var init_regexes = __esm({
|
|
|
19516
19940
|
duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
19517
19941
|
extendedDuration = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
19518
19942
|
guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
19519
|
-
|
|
19943
|
+
uuid2 = (version2) => {
|
|
19520
19944
|
if (!version2)
|
|
19521
19945
|
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
19522
19946
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
19523
19947
|
};
|
|
19524
|
-
uuid4 = /* @__PURE__ */
|
|
19525
|
-
uuid6 = /* @__PURE__ */
|
|
19526
|
-
uuid7 = /* @__PURE__ */
|
|
19948
|
+
uuid4 = /* @__PURE__ */ uuid2(4);
|
|
19949
|
+
uuid6 = /* @__PURE__ */ uuid2(6);
|
|
19950
|
+
uuid7 = /* @__PURE__ */ uuid2(7);
|
|
19527
19951
|
email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
19528
19952
|
html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
19529
19953
|
rfc5322Email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
@@ -20707,9 +21131,9 @@ var init_schemas = __esm({
|
|
|
20707
21131
|
const v = versionMap[def.version];
|
|
20708
21132
|
if (v === void 0)
|
|
20709
21133
|
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
20710
|
-
def.pattern ?? (def.pattern =
|
|
21134
|
+
def.pattern ?? (def.pattern = uuid2(v));
|
|
20711
21135
|
} else
|
|
20712
|
-
def.pattern ?? (def.pattern =
|
|
21136
|
+
def.pattern ?? (def.pattern = uuid2());
|
|
20713
21137
|
$ZodStringFormat.init(inst, def);
|
|
20714
21138
|
});
|
|
20715
21139
|
$ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
@@ -30813,7 +31237,7 @@ __export(schemas_exports2, {
|
|
|
30813
31237
|
union: () => union,
|
|
30814
31238
|
unknown: () => unknown,
|
|
30815
31239
|
url: () => url,
|
|
30816
|
-
uuid: () =>
|
|
31240
|
+
uuid: () => uuid3,
|
|
30817
31241
|
uuidv4: () => uuidv4,
|
|
30818
31242
|
uuidv6: () => uuidv6,
|
|
30819
31243
|
uuidv7: () => uuidv7,
|
|
@@ -30830,7 +31254,7 @@ function email2(params) {
|
|
|
30830
31254
|
function guid2(params) {
|
|
30831
31255
|
return _guid(ZodGUID, params);
|
|
30832
31256
|
}
|
|
30833
|
-
function
|
|
31257
|
+
function uuid3(params) {
|
|
30834
31258
|
return _uuid(ZodUUID, params);
|
|
30835
31259
|
}
|
|
30836
31260
|
function uuidv4(params) {
|
|
@@ -31978,7 +32402,7 @@ function resolveRef(ref, ctx) {
|
|
|
31978
32402
|
function convertBaseSchema(schema, ctx) {
|
|
31979
32403
|
if (schema.not !== void 0) {
|
|
31980
32404
|
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
31981
|
-
return
|
|
32405
|
+
return z28.never();
|
|
31982
32406
|
}
|
|
31983
32407
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
31984
32408
|
}
|
|
@@ -32000,7 +32424,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32000
32424
|
return ctx.refs.get(refPath);
|
|
32001
32425
|
}
|
|
32002
32426
|
if (ctx.processing.has(refPath)) {
|
|
32003
|
-
return
|
|
32427
|
+
return z28.lazy(() => {
|
|
32004
32428
|
if (!ctx.refs.has(refPath)) {
|
|
32005
32429
|
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
32006
32430
|
}
|
|
@@ -32017,25 +32441,25 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32017
32441
|
if (schema.enum !== void 0) {
|
|
32018
32442
|
const enumValues = schema.enum;
|
|
32019
32443
|
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
32020
|
-
return
|
|
32444
|
+
return z28.null();
|
|
32021
32445
|
}
|
|
32022
32446
|
if (enumValues.length === 0) {
|
|
32023
|
-
return
|
|
32447
|
+
return z28.never();
|
|
32024
32448
|
}
|
|
32025
32449
|
if (enumValues.length === 1) {
|
|
32026
|
-
return
|
|
32450
|
+
return z28.literal(enumValues[0]);
|
|
32027
32451
|
}
|
|
32028
32452
|
if (enumValues.every((v) => typeof v === "string")) {
|
|
32029
|
-
return
|
|
32453
|
+
return z28.enum(enumValues);
|
|
32030
32454
|
}
|
|
32031
|
-
const literalSchemas = enumValues.map((v) =>
|
|
32455
|
+
const literalSchemas = enumValues.map((v) => z28.literal(v));
|
|
32032
32456
|
if (literalSchemas.length < 2) {
|
|
32033
32457
|
return literalSchemas[0];
|
|
32034
32458
|
}
|
|
32035
|
-
return
|
|
32459
|
+
return z28.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
32036
32460
|
}
|
|
32037
32461
|
if (schema.const !== void 0) {
|
|
32038
|
-
return
|
|
32462
|
+
return z28.literal(schema.const);
|
|
32039
32463
|
}
|
|
32040
32464
|
const type = schema.type;
|
|
32041
32465
|
if (Array.isArray(type)) {
|
|
@@ -32044,68 +32468,68 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32044
32468
|
return convertBaseSchema(typeSchema, ctx);
|
|
32045
32469
|
});
|
|
32046
32470
|
if (typeSchemas.length === 0) {
|
|
32047
|
-
return
|
|
32471
|
+
return z28.never();
|
|
32048
32472
|
}
|
|
32049
32473
|
if (typeSchemas.length === 1) {
|
|
32050
32474
|
return typeSchemas[0];
|
|
32051
32475
|
}
|
|
32052
|
-
return
|
|
32476
|
+
return z28.union(typeSchemas);
|
|
32053
32477
|
}
|
|
32054
32478
|
if (!type) {
|
|
32055
|
-
return
|
|
32479
|
+
return z28.any();
|
|
32056
32480
|
}
|
|
32057
32481
|
let zodSchema2;
|
|
32058
32482
|
switch (type) {
|
|
32059
32483
|
case "string": {
|
|
32060
|
-
let stringSchema =
|
|
32484
|
+
let stringSchema = z28.string();
|
|
32061
32485
|
if (schema.format) {
|
|
32062
32486
|
const format = schema.format;
|
|
32063
32487
|
if (format === "email") {
|
|
32064
|
-
stringSchema = stringSchema.check(
|
|
32488
|
+
stringSchema = stringSchema.check(z28.email());
|
|
32065
32489
|
} else if (format === "uri" || format === "uri-reference") {
|
|
32066
|
-
stringSchema = stringSchema.check(
|
|
32490
|
+
stringSchema = stringSchema.check(z28.url());
|
|
32067
32491
|
} else if (format === "uuid" || format === "guid") {
|
|
32068
|
-
stringSchema = stringSchema.check(
|
|
32492
|
+
stringSchema = stringSchema.check(z28.uuid());
|
|
32069
32493
|
} else if (format === "date-time") {
|
|
32070
|
-
stringSchema = stringSchema.check(
|
|
32494
|
+
stringSchema = stringSchema.check(z28.iso.datetime());
|
|
32071
32495
|
} else if (format === "date") {
|
|
32072
|
-
stringSchema = stringSchema.check(
|
|
32496
|
+
stringSchema = stringSchema.check(z28.iso.date());
|
|
32073
32497
|
} else if (format === "time") {
|
|
32074
|
-
stringSchema = stringSchema.check(
|
|
32498
|
+
stringSchema = stringSchema.check(z28.iso.time());
|
|
32075
32499
|
} else if (format === "duration") {
|
|
32076
|
-
stringSchema = stringSchema.check(
|
|
32500
|
+
stringSchema = stringSchema.check(z28.iso.duration());
|
|
32077
32501
|
} else if (format === "ipv4") {
|
|
32078
|
-
stringSchema = stringSchema.check(
|
|
32502
|
+
stringSchema = stringSchema.check(z28.ipv4());
|
|
32079
32503
|
} else if (format === "ipv6") {
|
|
32080
|
-
stringSchema = stringSchema.check(
|
|
32504
|
+
stringSchema = stringSchema.check(z28.ipv6());
|
|
32081
32505
|
} else if (format === "mac") {
|
|
32082
|
-
stringSchema = stringSchema.check(
|
|
32506
|
+
stringSchema = stringSchema.check(z28.mac());
|
|
32083
32507
|
} else if (format === "cidr") {
|
|
32084
|
-
stringSchema = stringSchema.check(
|
|
32508
|
+
stringSchema = stringSchema.check(z28.cidrv4());
|
|
32085
32509
|
} else if (format === "cidr-v6") {
|
|
32086
|
-
stringSchema = stringSchema.check(
|
|
32510
|
+
stringSchema = stringSchema.check(z28.cidrv6());
|
|
32087
32511
|
} else if (format === "base64") {
|
|
32088
|
-
stringSchema = stringSchema.check(
|
|
32512
|
+
stringSchema = stringSchema.check(z28.base64());
|
|
32089
32513
|
} else if (format === "base64url") {
|
|
32090
|
-
stringSchema = stringSchema.check(
|
|
32514
|
+
stringSchema = stringSchema.check(z28.base64url());
|
|
32091
32515
|
} else if (format === "e164") {
|
|
32092
|
-
stringSchema = stringSchema.check(
|
|
32516
|
+
stringSchema = stringSchema.check(z28.e164());
|
|
32093
32517
|
} else if (format === "jwt") {
|
|
32094
|
-
stringSchema = stringSchema.check(
|
|
32518
|
+
stringSchema = stringSchema.check(z28.jwt());
|
|
32095
32519
|
} else if (format === "emoji") {
|
|
32096
|
-
stringSchema = stringSchema.check(
|
|
32520
|
+
stringSchema = stringSchema.check(z28.emoji());
|
|
32097
32521
|
} else if (format === "nanoid") {
|
|
32098
|
-
stringSchema = stringSchema.check(
|
|
32522
|
+
stringSchema = stringSchema.check(z28.nanoid());
|
|
32099
32523
|
} else if (format === "cuid") {
|
|
32100
|
-
stringSchema = stringSchema.check(
|
|
32524
|
+
stringSchema = stringSchema.check(z28.cuid());
|
|
32101
32525
|
} else if (format === "cuid2") {
|
|
32102
|
-
stringSchema = stringSchema.check(
|
|
32526
|
+
stringSchema = stringSchema.check(z28.cuid2());
|
|
32103
32527
|
} else if (format === "ulid") {
|
|
32104
|
-
stringSchema = stringSchema.check(
|
|
32528
|
+
stringSchema = stringSchema.check(z28.ulid());
|
|
32105
32529
|
} else if (format === "xid") {
|
|
32106
|
-
stringSchema = stringSchema.check(
|
|
32530
|
+
stringSchema = stringSchema.check(z28.xid());
|
|
32107
32531
|
} else if (format === "ksuid") {
|
|
32108
|
-
stringSchema = stringSchema.check(
|
|
32532
|
+
stringSchema = stringSchema.check(z28.ksuid());
|
|
32109
32533
|
}
|
|
32110
32534
|
}
|
|
32111
32535
|
if (typeof schema.minLength === "number") {
|
|
@@ -32122,7 +32546,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32122
32546
|
}
|
|
32123
32547
|
case "number":
|
|
32124
32548
|
case "integer": {
|
|
32125
|
-
let numberSchema = type === "integer" ?
|
|
32549
|
+
let numberSchema = type === "integer" ? z28.number().int() : z28.number();
|
|
32126
32550
|
if (typeof schema.minimum === "number") {
|
|
32127
32551
|
numberSchema = numberSchema.min(schema.minimum);
|
|
32128
32552
|
}
|
|
@@ -32146,11 +32570,11 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32146
32570
|
break;
|
|
32147
32571
|
}
|
|
32148
32572
|
case "boolean": {
|
|
32149
|
-
zodSchema2 =
|
|
32573
|
+
zodSchema2 = z28.boolean();
|
|
32150
32574
|
break;
|
|
32151
32575
|
}
|
|
32152
32576
|
case "null": {
|
|
32153
|
-
zodSchema2 =
|
|
32577
|
+
zodSchema2 = z28.null();
|
|
32154
32578
|
break;
|
|
32155
32579
|
}
|
|
32156
32580
|
case "object": {
|
|
@@ -32163,14 +32587,14 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32163
32587
|
}
|
|
32164
32588
|
if (schema.propertyNames) {
|
|
32165
32589
|
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
32166
|
-
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) :
|
|
32590
|
+
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z28.any();
|
|
32167
32591
|
if (Object.keys(shape).length === 0) {
|
|
32168
|
-
zodSchema2 =
|
|
32592
|
+
zodSchema2 = z28.record(keySchema, valueSchema);
|
|
32169
32593
|
break;
|
|
32170
32594
|
}
|
|
32171
|
-
const objectSchema2 =
|
|
32172
|
-
const recordSchema =
|
|
32173
|
-
zodSchema2 =
|
|
32595
|
+
const objectSchema2 = z28.object(shape).passthrough();
|
|
32596
|
+
const recordSchema = z28.looseRecord(keySchema, valueSchema);
|
|
32597
|
+
zodSchema2 = z28.intersection(objectSchema2, recordSchema);
|
|
32174
32598
|
break;
|
|
32175
32599
|
}
|
|
32176
32600
|
if (schema.patternProperties) {
|
|
@@ -32179,28 +32603,28 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32179
32603
|
const looseRecords = [];
|
|
32180
32604
|
for (const pattern of patternKeys) {
|
|
32181
32605
|
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
32182
|
-
const keySchema =
|
|
32183
|
-
looseRecords.push(
|
|
32606
|
+
const keySchema = z28.string().regex(new RegExp(pattern));
|
|
32607
|
+
looseRecords.push(z28.looseRecord(keySchema, patternValue));
|
|
32184
32608
|
}
|
|
32185
32609
|
const schemasToIntersect = [];
|
|
32186
32610
|
if (Object.keys(shape).length > 0) {
|
|
32187
|
-
schemasToIntersect.push(
|
|
32611
|
+
schemasToIntersect.push(z28.object(shape).passthrough());
|
|
32188
32612
|
}
|
|
32189
32613
|
schemasToIntersect.push(...looseRecords);
|
|
32190
32614
|
if (schemasToIntersect.length === 0) {
|
|
32191
|
-
zodSchema2 =
|
|
32615
|
+
zodSchema2 = z28.object({}).passthrough();
|
|
32192
32616
|
} else if (schemasToIntersect.length === 1) {
|
|
32193
32617
|
zodSchema2 = schemasToIntersect[0];
|
|
32194
32618
|
} else {
|
|
32195
|
-
let result =
|
|
32619
|
+
let result = z28.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
32196
32620
|
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
32197
|
-
result =
|
|
32621
|
+
result = z28.intersection(result, schemasToIntersect[i]);
|
|
32198
32622
|
}
|
|
32199
32623
|
zodSchema2 = result;
|
|
32200
32624
|
}
|
|
32201
32625
|
break;
|
|
32202
32626
|
}
|
|
32203
|
-
const objectSchema =
|
|
32627
|
+
const objectSchema = z28.object(shape);
|
|
32204
32628
|
if (schema.additionalProperties === false) {
|
|
32205
32629
|
zodSchema2 = objectSchema.strict();
|
|
32206
32630
|
} else if (typeof schema.additionalProperties === "object") {
|
|
@@ -32217,33 +32641,33 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32217
32641
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
32218
32642
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
32219
32643
|
if (rest) {
|
|
32220
|
-
zodSchema2 =
|
|
32644
|
+
zodSchema2 = z28.tuple(tupleItems).rest(rest);
|
|
32221
32645
|
} else {
|
|
32222
|
-
zodSchema2 =
|
|
32646
|
+
zodSchema2 = z28.tuple(tupleItems);
|
|
32223
32647
|
}
|
|
32224
32648
|
if (typeof schema.minItems === "number") {
|
|
32225
|
-
zodSchema2 = zodSchema2.check(
|
|
32649
|
+
zodSchema2 = zodSchema2.check(z28.minLength(schema.minItems));
|
|
32226
32650
|
}
|
|
32227
32651
|
if (typeof schema.maxItems === "number") {
|
|
32228
|
-
zodSchema2 = zodSchema2.check(
|
|
32652
|
+
zodSchema2 = zodSchema2.check(z28.maxLength(schema.maxItems));
|
|
32229
32653
|
}
|
|
32230
32654
|
} else if (Array.isArray(items)) {
|
|
32231
32655
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
32232
32656
|
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
32233
32657
|
if (rest) {
|
|
32234
|
-
zodSchema2 =
|
|
32658
|
+
zodSchema2 = z28.tuple(tupleItems).rest(rest);
|
|
32235
32659
|
} else {
|
|
32236
|
-
zodSchema2 =
|
|
32660
|
+
zodSchema2 = z28.tuple(tupleItems);
|
|
32237
32661
|
}
|
|
32238
32662
|
if (typeof schema.minItems === "number") {
|
|
32239
|
-
zodSchema2 = zodSchema2.check(
|
|
32663
|
+
zodSchema2 = zodSchema2.check(z28.minLength(schema.minItems));
|
|
32240
32664
|
}
|
|
32241
32665
|
if (typeof schema.maxItems === "number") {
|
|
32242
|
-
zodSchema2 = zodSchema2.check(
|
|
32666
|
+
zodSchema2 = zodSchema2.check(z28.maxLength(schema.maxItems));
|
|
32243
32667
|
}
|
|
32244
32668
|
} else if (items !== void 0) {
|
|
32245
32669
|
const element = convertSchema(items, ctx);
|
|
32246
|
-
let arraySchema =
|
|
32670
|
+
let arraySchema = z28.array(element);
|
|
32247
32671
|
if (typeof schema.minItems === "number") {
|
|
32248
32672
|
arraySchema = arraySchema.min(schema.minItems);
|
|
32249
32673
|
}
|
|
@@ -32252,7 +32676,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32252
32676
|
}
|
|
32253
32677
|
zodSchema2 = arraySchema;
|
|
32254
32678
|
} else {
|
|
32255
|
-
zodSchema2 =
|
|
32679
|
+
zodSchema2 = z28.array(z28.any());
|
|
32256
32680
|
}
|
|
32257
32681
|
break;
|
|
32258
32682
|
}
|
|
@@ -32269,37 +32693,37 @@ function convertBaseSchema(schema, ctx) {
|
|
|
32269
32693
|
}
|
|
32270
32694
|
function convertSchema(schema, ctx) {
|
|
32271
32695
|
if (typeof schema === "boolean") {
|
|
32272
|
-
return schema ?
|
|
32696
|
+
return schema ? z28.any() : z28.never();
|
|
32273
32697
|
}
|
|
32274
32698
|
let baseSchema = convertBaseSchema(schema, ctx);
|
|
32275
32699
|
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
32276
32700
|
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
32277
32701
|
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
32278
|
-
const anyOfUnion =
|
|
32279
|
-
baseSchema = hasExplicitType ?
|
|
32702
|
+
const anyOfUnion = z28.union(options);
|
|
32703
|
+
baseSchema = hasExplicitType ? z28.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
32280
32704
|
}
|
|
32281
32705
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
32282
32706
|
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
32283
|
-
const oneOfUnion =
|
|
32284
|
-
baseSchema = hasExplicitType ?
|
|
32707
|
+
const oneOfUnion = z28.xor(options);
|
|
32708
|
+
baseSchema = hasExplicitType ? z28.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
32285
32709
|
}
|
|
32286
32710
|
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
32287
32711
|
if (schema.allOf.length === 0) {
|
|
32288
|
-
baseSchema = hasExplicitType ? baseSchema :
|
|
32712
|
+
baseSchema = hasExplicitType ? baseSchema : z28.any();
|
|
32289
32713
|
} else {
|
|
32290
32714
|
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
32291
32715
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
32292
32716
|
for (let i = startIdx; i < schema.allOf.length; i++) {
|
|
32293
|
-
result =
|
|
32717
|
+
result = z28.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
32294
32718
|
}
|
|
32295
32719
|
baseSchema = result;
|
|
32296
32720
|
}
|
|
32297
32721
|
}
|
|
32298
32722
|
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
32299
|
-
baseSchema =
|
|
32723
|
+
baseSchema = z28.nullable(baseSchema);
|
|
32300
32724
|
}
|
|
32301
32725
|
if (schema.readOnly === true) {
|
|
32302
|
-
baseSchema =
|
|
32726
|
+
baseSchema = z28.readonly(baseSchema);
|
|
32303
32727
|
}
|
|
32304
32728
|
const extraMeta = {};
|
|
32305
32729
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
@@ -32326,7 +32750,7 @@ function convertSchema(schema, ctx) {
|
|
|
32326
32750
|
}
|
|
32327
32751
|
function fromJSONSchema(schema, params) {
|
|
32328
32752
|
if (typeof schema === "boolean") {
|
|
32329
|
-
return schema ?
|
|
32753
|
+
return schema ? z28.any() : z28.never();
|
|
32330
32754
|
}
|
|
32331
32755
|
const version2 = detectVersion(schema, params?.defaultTarget);
|
|
32332
32756
|
const defs = schema.$defs || schema.definitions || {};
|
|
@@ -32340,14 +32764,14 @@ function fromJSONSchema(schema, params) {
|
|
|
32340
32764
|
};
|
|
32341
32765
|
return convertSchema(schema, ctx);
|
|
32342
32766
|
}
|
|
32343
|
-
var
|
|
32767
|
+
var z28, RECOGNIZED_KEYS;
|
|
32344
32768
|
var init_from_json_schema = __esm({
|
|
32345
32769
|
"node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
|
|
32346
32770
|
init_registries();
|
|
32347
32771
|
init_checks2();
|
|
32348
32772
|
init_iso();
|
|
32349
32773
|
init_schemas2();
|
|
32350
|
-
|
|
32774
|
+
z28 = {
|
|
32351
32775
|
...schemas_exports2,
|
|
32352
32776
|
...checks_exports2,
|
|
32353
32777
|
iso: iso_exports
|
|
@@ -32689,7 +33113,7 @@ __export(external_exports, {
|
|
|
32689
33113
|
uppercase: () => _uppercase,
|
|
32690
33114
|
url: () => url,
|
|
32691
33115
|
util: () => util_exports,
|
|
32692
|
-
uuid: () =>
|
|
33116
|
+
uuid: () => uuid3,
|
|
32693
33117
|
uuidv4: () => uuidv4,
|
|
32694
33118
|
uuidv6: () => uuidv6,
|
|
32695
33119
|
uuidv7: () => uuidv7,
|
|
@@ -43986,12 +44410,7 @@ var init_spawn = __esm({
|
|
|
43986
44410
|
}
|
|
43987
44411
|
});
|
|
43988
44412
|
|
|
43989
|
-
// packages/adapters/src/providers/
|
|
43990
|
-
import { homedir as homedir2 } from "node:os";
|
|
43991
|
-
import { join as join3 } from "node:path";
|
|
43992
|
-
function claudeSettingsPath() {
|
|
43993
|
-
return new ClaudeCodePathProvider().getSettingsPath() ?? join3(homedir2(), ".claude", "settings.json");
|
|
43994
|
-
}
|
|
44413
|
+
// packages/adapters/src/providers/shared/hook-config.ts
|
|
43995
44414
|
function isPlainObject2(value) {
|
|
43996
44415
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
43997
44416
|
}
|
|
@@ -44035,10 +44454,25 @@ function removeCleoHookEntries(hooks) {
|
|
|
44035
44454
|
}
|
|
44036
44455
|
return changed;
|
|
44037
44456
|
}
|
|
44038
|
-
var
|
|
44457
|
+
var CLEO_HOOK_MARKER;
|
|
44458
|
+
var init_hook_config = __esm({
|
|
44459
|
+
"packages/adapters/src/providers/shared/hook-config.ts"() {
|
|
44460
|
+
"use strict";
|
|
44461
|
+
CLEO_HOOK_MARKER = "# cleo-hook";
|
|
44462
|
+
}
|
|
44463
|
+
});
|
|
44464
|
+
|
|
44465
|
+
// packages/adapters/src/providers/claude-code/paths.ts
|
|
44466
|
+
import { homedir as homedir2 } from "node:os";
|
|
44467
|
+
import { join as join3 } from "node:path";
|
|
44468
|
+
function claudeSettingsPath() {
|
|
44469
|
+
return new ClaudeCodePathProvider().getSettingsPath() ?? join3(homedir2(), ".claude", "settings.json");
|
|
44470
|
+
}
|
|
44471
|
+
var ClaudeCodePathProvider;
|
|
44039
44472
|
var init_paths = __esm({
|
|
44040
44473
|
"packages/adapters/src/providers/claude-code/paths.ts"() {
|
|
44041
44474
|
"use strict";
|
|
44475
|
+
init_hook_config();
|
|
44042
44476
|
ClaudeCodePathProvider = class {
|
|
44043
44477
|
/** Get the provider's root configuration directory. */
|
|
44044
44478
|
getProviderDir() {
|
|
@@ -44057,7 +44491,6 @@ var init_paths = __esm({
|
|
|
44057
44491
|
return process.env["CLAUDE_MEM_DB"] ?? join3(homedir2(), ".claude-mem", "claude-mem.db");
|
|
44058
44492
|
}
|
|
44059
44493
|
};
|
|
44060
|
-
CLEO_HOOK_MARKER = "# cleo-hook";
|
|
44061
44494
|
}
|
|
44062
44495
|
});
|
|
44063
44496
|
|
|
@@ -44418,12 +44851,12 @@ var init_hooks = __esm({
|
|
|
44418
44851
|
* @returns Claude Code native event name or null
|
|
44419
44852
|
* @task T164
|
|
44420
44853
|
*/
|
|
44421
|
-
async toNativeEvent(
|
|
44854
|
+
async toNativeEvent(canonical2) {
|
|
44422
44855
|
try {
|
|
44423
44856
|
const { toNative } = await import("@cleocode/caamp");
|
|
44424
|
-
return toNative(
|
|
44857
|
+
return toNative(canonical2, PROVIDER_ID);
|
|
44425
44858
|
} catch {
|
|
44426
|
-
const entry = Object.entries(CLAUDE_CODE_EVENT_MAP).find(([, v]) => v ===
|
|
44859
|
+
const entry = Object.entries(CLAUDE_CODE_EVENT_MAP).find(([, v]) => v === canonical2);
|
|
44427
44860
|
return entry?.[0] ?? null;
|
|
44428
44861
|
}
|
|
44429
44862
|
}
|
|
@@ -44518,23 +44951,354 @@ var init_hooks = __esm({
|
|
|
44518
44951
|
}
|
|
44519
44952
|
});
|
|
44520
44953
|
|
|
44954
|
+
// packages/adapters/src/providers/shared/heavy-command-hook-install.ts
|
|
44955
|
+
import { execFileSync } from "node:child_process";
|
|
44956
|
+
import {
|
|
44957
|
+
existsSync as existsSync5,
|
|
44958
|
+
mkdirSync,
|
|
44959
|
+
readdirSync as readdirSync2,
|
|
44960
|
+
readFileSync as readFileSync4,
|
|
44961
|
+
realpathSync,
|
|
44962
|
+
rmSync,
|
|
44963
|
+
writeFileSync as writeFileSync2
|
|
44964
|
+
} from "node:fs";
|
|
44965
|
+
import { homedir as homedir4, tmpdir } from "node:os";
|
|
44966
|
+
import { dirname as dirname2, isAbsolute, join as join6, resolve as resolve2 } from "node:path";
|
|
44967
|
+
import { updateJsonConfigFile as updateJsonConfigFile2 } from "@cleocode/caamp";
|
|
44968
|
+
function canonical(path) {
|
|
44969
|
+
try {
|
|
44970
|
+
return realpathSync(path);
|
|
44971
|
+
} catch {
|
|
44972
|
+
return resolve2(path);
|
|
44973
|
+
}
|
|
44974
|
+
}
|
|
44975
|
+
function isUserHomeDir(projectDir, home = homedir4()) {
|
|
44976
|
+
return canonical(projectDir) === canonical(home);
|
|
44977
|
+
}
|
|
44978
|
+
function clearOlderCleoMarkers(dir = process.env.XDG_RUNTIME_DIR || tmpdir()) {
|
|
44979
|
+
let removed = 0;
|
|
44980
|
+
let names;
|
|
44981
|
+
try {
|
|
44982
|
+
names = readdirSync2(dir);
|
|
44983
|
+
} catch {
|
|
44984
|
+
return 0;
|
|
44985
|
+
}
|
|
44986
|
+
for (const name15 of names) {
|
|
44987
|
+
if (!name15.startsWith(OLDER_CLEO_MARKER_PREFIX)) continue;
|
|
44988
|
+
try {
|
|
44989
|
+
rmSync(join6(dir, name15), { force: true });
|
|
44990
|
+
removed++;
|
|
44991
|
+
} catch {
|
|
44992
|
+
}
|
|
44993
|
+
}
|
|
44994
|
+
return removed;
|
|
44995
|
+
}
|
|
44996
|
+
function shellWord(text) {
|
|
44997
|
+
return `'${text.replace(/'/g, `'\\''`)}'`;
|
|
44998
|
+
}
|
|
44999
|
+
function heavyCommandGuardScript(provider) {
|
|
45000
|
+
const words = HEAVY_TOOL_WORDS.join("|");
|
|
45001
|
+
const old = `printf '%s\\n' '${OLDER_CLEO_HOOK_ANSWER}'`;
|
|
45002
|
+
return [
|
|
45003
|
+
"command -v cleo >/dev/null 2>&1 || exit 0",
|
|
45004
|
+
'in="$(cat)"',
|
|
45005
|
+
"set -f",
|
|
45006
|
+
"hit=",
|
|
45007
|
+
// `[\]` (not `\\`) matches a backslash: it survives fish's quoting under Codex.
|
|
45008
|
+
`for w in $(printf '%s' "$in" | sed 's/[\\][nrt]/ /g; s/[^A-Za-z0-9_./@+-]/ /g'); do case "\${w##*/}" in ${words}) hit=1; break;; esac; done`,
|
|
45009
|
+
'[ -n "$hit" ] || exit 0',
|
|
45010
|
+
'p="$(command -v cleo)"',
|
|
45011
|
+
`d="\${XDG_RUNTIME_DIR:-\${TMPDIR:-/tmp}}"`,
|
|
45012
|
+
`k="$d/${OLDER_CLEO_MARKER_PREFIX}$(printf '%s|%s' "$p" "$PWD" | cksum | tr -c '0-9' '-')"`,
|
|
45013
|
+
`if [ -f "$k" ] && [ ! -L "$k" ] && [ -O "$k" ] && ! [ "$p" -nt "$k" ] && [ -n "$(find "$k" -mmin -60 2>/dev/null)" ]; then ${old}; exit 0; fi`,
|
|
45014
|
+
'e="$(mktemp 2>/dev/null)" || e=',
|
|
45015
|
+
// Only the older-CLEO signature (exit 127, "Unknown command hook") writes the
|
|
45016
|
+
// marker; a crash or kill of a current CLEO fails open and asks again next time.
|
|
45017
|
+
`if out="$(printf '%s' "$in" | ${HEAVY_COMMAND_HOOK_ID} --provider ${provider} 2>"\${e:-/dev/null}")"; then case "$out" in "{"*) printf '%s\\n' "$out";; esac; else rc=$?; if [ "$rc" = 127 ] && [ -n "$e" ] && grep -q 'Unknown command' "$e" 2>/dev/null; then t="$(mktemp "$k.XXXXXX" 2>/dev/null)" && mv -f "$t" "$k"; ${old}; fi; fi`,
|
|
45018
|
+
'[ -z "$e" ] || rm -f "$e"',
|
|
45019
|
+
"exit 0"
|
|
45020
|
+
].join("; ");
|
|
45021
|
+
}
|
|
45022
|
+
function heavyCommandHookCommand(provider) {
|
|
45023
|
+
const script = heavyCommandGuardScript(provider);
|
|
45024
|
+
const line = provider === "codex" ? `/bin/sh -c ${shellWord(script)}` : script;
|
|
45025
|
+
return `${line} ${CLEO_HOOK_MARKER}`;
|
|
45026
|
+
}
|
|
45027
|
+
function heavyCommandHookObject(provider) {
|
|
45028
|
+
return {
|
|
45029
|
+
type: "command",
|
|
45030
|
+
command: heavyCommandHookCommand(provider),
|
|
45031
|
+
timeout: HEAVY_COMMAND_HOOK_TIMEOUT_SEC
|
|
45032
|
+
};
|
|
45033
|
+
}
|
|
45034
|
+
function heavyCommandHookEntry(provider) {
|
|
45035
|
+
return { matcher: "Bash", hooks: [heavyCommandHookObject(provider)] };
|
|
45036
|
+
}
|
|
45037
|
+
function isHeavyHookObject(hook) {
|
|
45038
|
+
return isPlainObject2(hook) && typeof hook.command === "string" && hook.command.includes(CLEO_HOOK_MARKER) && hook.command.includes(HEAVY_COMMAND_HOOK_ID);
|
|
45039
|
+
}
|
|
45040
|
+
function placeHeavyHook(hooks, desired) {
|
|
45041
|
+
const groups = hooks.PreToolUse;
|
|
45042
|
+
if (groups === void 0) return { changed: false, found: false };
|
|
45043
|
+
if (!Array.isArray(groups)) {
|
|
45044
|
+
throw new Error('hooks "PreToolUse" is not an array; not modifying it');
|
|
45045
|
+
}
|
|
45046
|
+
let changed = false;
|
|
45047
|
+
let found = false;
|
|
45048
|
+
const next = [];
|
|
45049
|
+
for (const group of groups) {
|
|
45050
|
+
if (!isPlainObject2(group) || !Array.isArray(group.hooks)) {
|
|
45051
|
+
next.push(group);
|
|
45052
|
+
continue;
|
|
45053
|
+
}
|
|
45054
|
+
const kept = [];
|
|
45055
|
+
let groupChanged = false;
|
|
45056
|
+
for (const hook of group.hooks) {
|
|
45057
|
+
if (!isHeavyHookObject(hook)) {
|
|
45058
|
+
kept.push(hook);
|
|
45059
|
+
} else if (desired !== null && !found) {
|
|
45060
|
+
found = true;
|
|
45061
|
+
if (JSON.stringify(hook) !== JSON.stringify(desired)) groupChanged = true;
|
|
45062
|
+
kept.push(desired);
|
|
45063
|
+
} else {
|
|
45064
|
+
groupChanged = true;
|
|
45065
|
+
}
|
|
45066
|
+
}
|
|
45067
|
+
if (!groupChanged) {
|
|
45068
|
+
next.push(group);
|
|
45069
|
+
continue;
|
|
45070
|
+
}
|
|
45071
|
+
changed = true;
|
|
45072
|
+
if (kept.length > 0) next.push({ ...group, hooks: kept });
|
|
45073
|
+
}
|
|
45074
|
+
if (changed) hooks.PreToolUse = next;
|
|
45075
|
+
return { changed, found };
|
|
45076
|
+
}
|
|
45077
|
+
async function syncJsonHeavyCommandHook(configPath, provider, mode) {
|
|
45078
|
+
if (mode === "off") {
|
|
45079
|
+
if (!existsSync5(configPath)) return "unchanged";
|
|
45080
|
+
const removed = await updateJsonConfigFile2(configPath, (config2) => {
|
|
45081
|
+
if (config2.hooks === void 0) return false;
|
|
45082
|
+
return placeHeavyHook(hookMap(config2), null).changed;
|
|
45083
|
+
});
|
|
45084
|
+
return removed ? "removed" : "unchanged";
|
|
45085
|
+
}
|
|
45086
|
+
mkdirSync(dirname2(configPath), { recursive: true });
|
|
45087
|
+
clearOlderCleoMarkers();
|
|
45088
|
+
let result = "unchanged";
|
|
45089
|
+
await updateJsonConfigFile2(configPath, (config2) => {
|
|
45090
|
+
const hooks = hookMap(config2);
|
|
45091
|
+
const placed = placeHeavyHook(hooks, heavyCommandHookObject(provider));
|
|
45092
|
+
if (placed.found) {
|
|
45093
|
+
if (placed.changed) result = "updated";
|
|
45094
|
+
return placed.changed;
|
|
45095
|
+
}
|
|
45096
|
+
const existing = hooks.PreToolUse;
|
|
45097
|
+
hooks.PreToolUse = [
|
|
45098
|
+
...Array.isArray(existing) ? existing : [],
|
|
45099
|
+
heavyCommandHookEntry(provider)
|
|
45100
|
+
];
|
|
45101
|
+
result = "installed";
|
|
45102
|
+
return true;
|
|
45103
|
+
});
|
|
45104
|
+
return result;
|
|
45105
|
+
}
|
|
45106
|
+
function gitOutput(projectDir, args) {
|
|
45107
|
+
try {
|
|
45108
|
+
return execFileSync("git", ["-C", projectDir, ...args], {
|
|
45109
|
+
encoding: "utf-8",
|
|
45110
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
45111
|
+
timeout: 5e3
|
|
45112
|
+
}).trim();
|
|
45113
|
+
} catch {
|
|
45114
|
+
return null;
|
|
45115
|
+
}
|
|
45116
|
+
}
|
|
45117
|
+
function excludeFile(projectDir) {
|
|
45118
|
+
if (gitOutput(projectDir, ["rev-parse", "--is-inside-work-tree"]) !== "true") return null;
|
|
45119
|
+
const path = gitOutput(projectDir, ["rev-parse", "--git-path", "info/exclude"]);
|
|
45120
|
+
if (path === null || path === "") return null;
|
|
45121
|
+
return isAbsolute(path) ? path : join6(projectDir, path);
|
|
45122
|
+
}
|
|
45123
|
+
function excludeLine(projectDir) {
|
|
45124
|
+
const prefix = gitOutput(projectDir, ["rev-parse", "--show-prefix"]) ?? "";
|
|
45125
|
+
return `/${prefix}${CLAUDE_LOCAL_SETTINGS}`;
|
|
45126
|
+
}
|
|
45127
|
+
function excludeLocalSettingsFromGit(projectDir) {
|
|
45128
|
+
const exclude = excludeFile(projectDir);
|
|
45129
|
+
if (exclude === null) return false;
|
|
45130
|
+
if (gitOutput(projectDir, ["check-ignore", CLAUDE_LOCAL_SETTINGS]) !== null) return false;
|
|
45131
|
+
const line = excludeLine(projectDir);
|
|
45132
|
+
const text = existsSync5(exclude) ? readFileSync4(exclude, "utf-8") : "";
|
|
45133
|
+
if (text.split("\n").includes(line)) return false;
|
|
45134
|
+
const block = `${LOCAL_SETTINGS_EXCLUDE_MARKER}
|
|
45135
|
+
${line}
|
|
45136
|
+
`;
|
|
45137
|
+
mkdirSync(dirname2(exclude), { recursive: true });
|
|
45138
|
+
writeFileSync2(exclude, text === "" || text.endsWith("\n") ? text + block : `${text}
|
|
45139
|
+
${block}`);
|
|
45140
|
+
return true;
|
|
45141
|
+
}
|
|
45142
|
+
function unexcludeLocalSettingsFromGit(projectDir) {
|
|
45143
|
+
const exclude = excludeFile(projectDir);
|
|
45144
|
+
if (exclude === null || !existsSync5(exclude)) return false;
|
|
45145
|
+
const lines = readFileSync4(exclude, "utf-8").split("\n");
|
|
45146
|
+
const at = lines.indexOf(excludeLine(projectDir));
|
|
45147
|
+
if (at < 1 || lines[at - 1] !== LOCAL_SETTINGS_EXCLUDE_MARKER) return false;
|
|
45148
|
+
lines.splice(at - 1, 2);
|
|
45149
|
+
writeFileSync2(exclude, lines.join("\n"));
|
|
45150
|
+
return true;
|
|
45151
|
+
}
|
|
45152
|
+
async function syncClaudeCodeHeavyCommandHook(projectDir, mode) {
|
|
45153
|
+
const result = await syncJsonHeavyCommandHook(
|
|
45154
|
+
join6(projectDir, CLAUDE_LOCAL_SETTINGS),
|
|
45155
|
+
"claude-code",
|
|
45156
|
+
mode
|
|
45157
|
+
);
|
|
45158
|
+
if (mode === "off") unexcludeLocalSettingsFromGit(projectDir);
|
|
45159
|
+
else excludeLocalSettingsFromGit(projectDir);
|
|
45160
|
+
await syncJsonHeavyCommandHook(
|
|
45161
|
+
join6(projectDir, ".claude", "settings.json"),
|
|
45162
|
+
"claude-code",
|
|
45163
|
+
"off"
|
|
45164
|
+
);
|
|
45165
|
+
return result;
|
|
45166
|
+
}
|
|
45167
|
+
function opencodeHeavyCommandPluginSource() {
|
|
45168
|
+
return [
|
|
45169
|
+
"// CLEO heavy-command plugin for OpenCode (generated by @cleocode/adapters, T12983).",
|
|
45170
|
+
"// Routes heavy shell commands (tests, builds, typechecks, installs) through",
|
|
45171
|
+
"// `cleo run`, the machine-wide resource budget. Opt out with",
|
|
45172
|
+
'// CLEO_HEAVY_COMMAND_HOOK=off, or set resources.heavyCommandHook to "off" and',
|
|
45173
|
+
"// run `cleo upgrade` (which deletes this file). Fails open: on any error the",
|
|
45174
|
+
"// command runs unchanged.",
|
|
45175
|
+
"",
|
|
45176
|
+
"import { execFile } from 'node:child_process';",
|
|
45177
|
+
"",
|
|
45178
|
+
`const HEAVY = /(?:^|[^A-Za-z0-9_.@+-])(?:${HEAVY_TOOL_WORDS.join("|")})(?=$|[^A-Za-z0-9_.@+-])/;`,
|
|
45179
|
+
"const contexts = new Map();",
|
|
45180
|
+
"",
|
|
45181
|
+
"function ask(payload) {",
|
|
45182
|
+
" return new Promise((done) => {",
|
|
45183
|
+
" const child = execFile(",
|
|
45184
|
+
" 'cleo',",
|
|
45185
|
+
" ['hook', 'heavy-command', '--provider', 'opencode'],",
|
|
45186
|
+
` { timeout: ${HEAVY_COMMAND_HOOK_TIMEOUT_SEC * 1e3} },`,
|
|
45187
|
+
" (err, stdout) => done(err ? '' : stdout),",
|
|
45188
|
+
" );",
|
|
45189
|
+
" child.on('error', () => done(''));",
|
|
45190
|
+
" child.stdin?.end(JSON.stringify(payload));",
|
|
45191
|
+
" });",
|
|
45192
|
+
"}",
|
|
45193
|
+
"",
|
|
45194
|
+
"export const CleoHeavyCommand = async ({ directory }) => ({",
|
|
45195
|
+
" 'tool.execute.before': async (input, output) => {",
|
|
45196
|
+
" if (input?.tool !== 'bash' || typeof output?.args?.command !== 'string') return;",
|
|
45197
|
+
" if (process.env.CLEO_HEAVY_COMMAND_HOOK === 'off') return;",
|
|
45198
|
+
" if (!HEAVY.test(output.args.command)) return;",
|
|
45199
|
+
" try {",
|
|
45200
|
+
" const text = await ask({ tool_name: 'bash', tool_input: output.args, cwd: directory });",
|
|
45201
|
+
" const answer = JSON.parse(text || '{}');",
|
|
45202
|
+
" if (typeof answer.command === 'string') output.args.command = answer.command;",
|
|
45203
|
+
" if (typeof answer.timeout === 'number') output.args.timeout = answer.timeout;",
|
|
45204
|
+
" if (typeof answer.context === 'string' && input.callID) contexts.set(input.callID, answer.context);",
|
|
45205
|
+
" } catch {",
|
|
45206
|
+
" // Fail open.",
|
|
45207
|
+
" }",
|
|
45208
|
+
" },",
|
|
45209
|
+
" 'tool.execute.after': async (input, output) => {",
|
|
45210
|
+
" const context = input?.callID ? contexts.get(input.callID) : undefined;",
|
|
45211
|
+
" if (context === undefined) return;",
|
|
45212
|
+
" contexts.delete(input.callID);",
|
|
45213
|
+
" if (typeof output?.output === 'string') output.output += '\\n\\n' + context;",
|
|
45214
|
+
" },",
|
|
45215
|
+
"});",
|
|
45216
|
+
""
|
|
45217
|
+
].join("\n");
|
|
45218
|
+
}
|
|
45219
|
+
function syncOpencodeHeavyCommandPlugin(projectDir, mode) {
|
|
45220
|
+
const pluginPath = join6(projectDir, ".opencode", "plugins", OPENCODE_HEAVY_COMMAND_PLUGIN);
|
|
45221
|
+
const exists = existsSync5(pluginPath);
|
|
45222
|
+
if (mode === "off") {
|
|
45223
|
+
if (!exists) return "unchanged";
|
|
45224
|
+
rmSync(pluginPath, { force: true });
|
|
45225
|
+
return "removed";
|
|
45226
|
+
}
|
|
45227
|
+
const source = opencodeHeavyCommandPluginSource();
|
|
45228
|
+
if (exists && readFileSync4(pluginPath, "utf-8") === source) return "unchanged";
|
|
45229
|
+
mkdirSync(dirname2(pluginPath), { recursive: true });
|
|
45230
|
+
writeFileSync2(pluginPath, source, "utf-8");
|
|
45231
|
+
return exists ? "updated" : "installed";
|
|
45232
|
+
}
|
|
45233
|
+
var HEAVY_COMMAND_HOOK_ID, HEAVY_COMMAND_HOOK_TIMEOUT_SEC, OPENCODE_HEAVY_COMMAND_PLUGIN, HEAVY_TOOL_WORDS, OLDER_CLEO_HOOK_ANSWER, OLDER_CLEO_MARKER_PREFIX, CLAUDE_LOCAL_SETTINGS, LOCAL_SETTINGS_EXCLUDE_MARKER;
|
|
45234
|
+
var init_heavy_command_hook_install = __esm({
|
|
45235
|
+
"packages/adapters/src/providers/shared/heavy-command-hook-install.ts"() {
|
|
45236
|
+
"use strict";
|
|
45237
|
+
init_hook_config();
|
|
45238
|
+
HEAVY_COMMAND_HOOK_ID = "cleo hook heavy-command";
|
|
45239
|
+
HEAVY_COMMAND_HOOK_TIMEOUT_SEC = 20;
|
|
45240
|
+
OPENCODE_HEAVY_COMMAND_PLUGIN = "cleo-heavy-command.js";
|
|
45241
|
+
HEAVY_TOOL_WORDS = Object.freeze([
|
|
45242
|
+
"vitest",
|
|
45243
|
+
"jest",
|
|
45244
|
+
"mocha",
|
|
45245
|
+
"ava",
|
|
45246
|
+
"tap",
|
|
45247
|
+
"playwright",
|
|
45248
|
+
"pytest",
|
|
45249
|
+
"rspec",
|
|
45250
|
+
"phpunit",
|
|
45251
|
+
"tsc",
|
|
45252
|
+
"tsup",
|
|
45253
|
+
"turbo",
|
|
45254
|
+
"vite",
|
|
45255
|
+
"esbuild",
|
|
45256
|
+
"webpack",
|
|
45257
|
+
"rollup",
|
|
45258
|
+
"next",
|
|
45259
|
+
"nx",
|
|
45260
|
+
"biome",
|
|
45261
|
+
"eslint",
|
|
45262
|
+
"svelte-check",
|
|
45263
|
+
"npm",
|
|
45264
|
+
"pnpm",
|
|
45265
|
+
"yarn",
|
|
45266
|
+
"bun",
|
|
45267
|
+
"npx",
|
|
45268
|
+
"pnpx",
|
|
45269
|
+
"bunx",
|
|
45270
|
+
"cargo",
|
|
45271
|
+
"go"
|
|
45272
|
+
]);
|
|
45273
|
+
OLDER_CLEO_HOOK_ANSWER = JSON.stringify({
|
|
45274
|
+
hookSpecificOutput: {
|
|
45275
|
+
hookEventName: "PreToolUse",
|
|
45276
|
+
additionalContext: "[cleo] This may be a heavy command, but the cleo on PATH predates cleo hook and cleo run, so it runs outside the machine-wide resource budget. Upgrade CLEO to govern it."
|
|
45277
|
+
}
|
|
45278
|
+
});
|
|
45279
|
+
OLDER_CLEO_MARKER_PREFIX = "cleo-hook-unsupported-";
|
|
45280
|
+
CLAUDE_LOCAL_SETTINGS = ".claude/settings.local.json";
|
|
45281
|
+
LOCAL_SETTINGS_EXCLUDE_MARKER = "# cleo-hook: keep the per-machine heavy-command hook settings out of git (T12983)";
|
|
45282
|
+
}
|
|
45283
|
+
});
|
|
45284
|
+
|
|
44521
45285
|
// packages/adapters/src/providers/shared/hook-template-installer.ts
|
|
44522
|
-
import { copyFileSync, existsSync as
|
|
44523
|
-
import { dirname as
|
|
45286
|
+
import { copyFileSync, existsSync as existsSync6, mkdirSync as mkdirSync2, statSync } from "node:fs";
|
|
45287
|
+
import { dirname as dirname3, join as join7 } from "node:path";
|
|
44524
45288
|
import { fileURLToPath } from "node:url";
|
|
44525
45289
|
function resolveProviderCandidates() {
|
|
44526
|
-
const thisDir =
|
|
44527
|
-
const here =
|
|
44528
|
-
const fromDist =
|
|
45290
|
+
const thisDir = dirname3(fileURLToPath(import.meta.url));
|
|
45291
|
+
const here = dirname3(thisDir);
|
|
45292
|
+
const fromDist = join7(here, "..", "..", "src", "providers");
|
|
44529
45293
|
return [here, fromDist];
|
|
44530
45294
|
}
|
|
44531
45295
|
function findTemplateFile(relativeSegments) {
|
|
44532
45296
|
for (const base of resolveProviderCandidates()) {
|
|
44533
|
-
const candidate =
|
|
44534
|
-
if (
|
|
45297
|
+
const candidate = join7(base, ...relativeSegments);
|
|
45298
|
+
if (existsSync6(candidate)) return candidate;
|
|
44535
45299
|
}
|
|
44536
45300
|
const [first] = resolveProviderCandidates();
|
|
44537
|
-
return
|
|
45301
|
+
return join7(first ?? "", ...relativeSegments);
|
|
44538
45302
|
}
|
|
44539
45303
|
function providerShimSource(provider) {
|
|
44540
45304
|
return findTemplateFile([provider, "templates", "hooks", PROVIDER_SHIM[provider]]);
|
|
@@ -44543,17 +45307,17 @@ function sharedCoreSource() {
|
|
|
44543
45307
|
return findTemplateFile(["shared", "templates", "hooks", SHARED_CORE_FILE]);
|
|
44544
45308
|
}
|
|
44545
45309
|
function copyTemplate(src, dest, force) {
|
|
44546
|
-
if (!
|
|
45310
|
+
if (!existsSync6(src)) {
|
|
44547
45311
|
throw new Error(`CLEO hook template missing at source: ${src}`);
|
|
44548
45312
|
}
|
|
44549
|
-
if (!force &&
|
|
45313
|
+
if (!force && existsSync6(dest)) {
|
|
44550
45314
|
const srcStat = statSync(src);
|
|
44551
45315
|
const destStat = statSync(dest);
|
|
44552
45316
|
if (srcStat.size === destStat.size && srcStat.mtimeMs <= destStat.mtimeMs) {
|
|
44553
45317
|
return { wrote: false };
|
|
44554
45318
|
}
|
|
44555
45319
|
}
|
|
44556
|
-
|
|
45320
|
+
mkdirSync2(dirname3(dest), { recursive: true });
|
|
44557
45321
|
copyFileSync(src, dest);
|
|
44558
45322
|
return { wrote: true };
|
|
44559
45323
|
}
|
|
@@ -44565,13 +45329,13 @@ function installProviderHookTemplates(options) {
|
|
|
44565
45329
|
installedFiles: [],
|
|
44566
45330
|
skipped: []
|
|
44567
45331
|
};
|
|
44568
|
-
|
|
44569
|
-
const coreDest =
|
|
45332
|
+
mkdirSync2(targetDir, { recursive: true });
|
|
45333
|
+
const coreDest = join7(targetDir, SHARED_CORE_FILE);
|
|
44570
45334
|
const coreOutcome = copyTemplate(sharedCoreSource(), coreDest, force);
|
|
44571
45335
|
if (coreOutcome.wrote) result.installedFiles.push(coreDest);
|
|
44572
45336
|
else result.skipped.push(coreDest);
|
|
44573
45337
|
const shimName = PROVIDER_SHIM[provider];
|
|
44574
|
-
const shimDest =
|
|
45338
|
+
const shimDest = join7(targetDir, shimName);
|
|
44575
45339
|
const shimOutcome = copyTemplate(providerShimSource(provider), shimDest, force);
|
|
44576
45340
|
if (shimOutcome.wrote) result.installedFiles.push(shimDest);
|
|
44577
45341
|
else result.skipped.push(shimDest);
|
|
@@ -44598,22 +45362,23 @@ var init_hook_template_installer = __esm({
|
|
|
44598
45362
|
});
|
|
44599
45363
|
|
|
44600
45364
|
// packages/adapters/src/providers/claude-code/install.ts
|
|
44601
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
44602
|
-
import { homedir as
|
|
44603
|
-
import { dirname as
|
|
45365
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync7, mkdirSync as mkdirSync3, readdirSync as readdirSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
45366
|
+
import { homedir as homedir5 } from "node:os";
|
|
45367
|
+
import { dirname as dirname4, join as join8, resolve as resolve3 } from "node:path";
|
|
44604
45368
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
44605
|
-
import { ensureProviderInstructionFile, updateJsonConfigFile as
|
|
45369
|
+
import { ensureProviderInstructionFile, updateJsonConfigFile as updateJsonConfigFile3 } from "@cleocode/caamp";
|
|
44606
45370
|
function getClaudeConfigDir() {
|
|
44607
|
-
return process.env["CLAUDE_HOME"] ??
|
|
45371
|
+
return process.env["CLAUDE_HOME"] ?? join8(homedir5(), ".claude");
|
|
44608
45372
|
}
|
|
44609
45373
|
function getAdapterCommandsDir() {
|
|
44610
|
-
const thisDir =
|
|
44611
|
-
return
|
|
45374
|
+
const thisDir = dirname4(fileURLToPath2(import.meta.url));
|
|
45375
|
+
return join8(thisDir, "commands");
|
|
44612
45376
|
}
|
|
44613
45377
|
var ClaudeCodeInstallProvider;
|
|
44614
45378
|
var init_install = __esm({
|
|
44615
45379
|
"packages/adapters/src/providers/claude-code/install.ts"() {
|
|
44616
45380
|
"use strict";
|
|
45381
|
+
init_heavy_command_hook_install();
|
|
44617
45382
|
init_hook_template_installer();
|
|
44618
45383
|
init_paths();
|
|
44619
45384
|
ClaudeCodeInstallProvider = class {
|
|
@@ -44654,6 +45419,21 @@ var init_install = __esm({
|
|
|
44654
45419
|
} catch (err) {
|
|
44655
45420
|
settingsErrors.push(err instanceof Error ? err.message : String(err));
|
|
44656
45421
|
}
|
|
45422
|
+
if (options.heavyCommandHook !== void 0) {
|
|
45423
|
+
const projectSettings = join8(projectDir, ".claude", "settings.json");
|
|
45424
|
+
if (isUserHomeDir(projectDir) || resolve3(projectSettings) === resolve3(claudeSettingsPath())) {
|
|
45425
|
+
details.heavyCommandHook = "skipped";
|
|
45426
|
+
} else {
|
|
45427
|
+
try {
|
|
45428
|
+
details.heavyCommandHook = await syncClaudeCodeHeavyCommandHook(
|
|
45429
|
+
projectDir,
|
|
45430
|
+
options.heavyCommandHook
|
|
45431
|
+
);
|
|
45432
|
+
} catch (err) {
|
|
45433
|
+
settingsErrors.push(err instanceof Error ? err.message : String(err));
|
|
45434
|
+
}
|
|
45435
|
+
}
|
|
45436
|
+
}
|
|
44657
45437
|
if (settingsErrors.length > 0) {
|
|
44658
45438
|
details.settingsErrors = settingsErrors;
|
|
44659
45439
|
}
|
|
@@ -44678,9 +45458,9 @@ var init_install = __esm({
|
|
|
44678
45458
|
*/
|
|
44679
45459
|
async isInstalled() {
|
|
44680
45460
|
const settingsPath = claudeSettingsPath();
|
|
44681
|
-
if (
|
|
45461
|
+
if (existsSync7(settingsPath)) {
|
|
44682
45462
|
try {
|
|
44683
|
-
const settings = JSON.parse(
|
|
45463
|
+
const settings = JSON.parse(readFileSync5(settingsPath, "utf-8"));
|
|
44684
45464
|
const plugins = settings.enabledPlugins;
|
|
44685
45465
|
if (plugins && plugins["cleo@cleocode"] === true) {
|
|
44686
45466
|
return true;
|
|
@@ -44712,16 +45492,16 @@ var init_install = __esm({
|
|
|
44712
45492
|
*/
|
|
44713
45493
|
installCommands(projectDir) {
|
|
44714
45494
|
const adapterCommandsDir = getAdapterCommandsDir();
|
|
44715
|
-
if (!
|
|
45495
|
+
if (!existsSync7(adapterCommandsDir)) {
|
|
44716
45496
|
return [];
|
|
44717
45497
|
}
|
|
44718
|
-
const targetDir =
|
|
44719
|
-
|
|
45498
|
+
const targetDir = join8(projectDir, ".claude", "commands");
|
|
45499
|
+
mkdirSync3(targetDir, { recursive: true });
|
|
44720
45500
|
const installed = [];
|
|
44721
|
-
const files =
|
|
45501
|
+
const files = readdirSync3(adapterCommandsDir).filter((f) => f.endsWith(".md"));
|
|
44722
45502
|
for (const file2 of files) {
|
|
44723
|
-
const src =
|
|
44724
|
-
const dest =
|
|
45503
|
+
const src = join8(adapterCommandsDir, file2);
|
|
45504
|
+
const dest = join8(targetDir, file2);
|
|
44725
45505
|
copyFileSync2(src, dest);
|
|
44726
45506
|
installed.push(file2);
|
|
44727
45507
|
}
|
|
@@ -44734,7 +45514,7 @@ var init_install = __esm({
|
|
|
44734
45514
|
*/
|
|
44735
45515
|
async registerPlugin() {
|
|
44736
45516
|
const pluginKey = "cleo@cleocode";
|
|
44737
|
-
const wrote = await
|
|
45517
|
+
const wrote = await updateJsonConfigFile3(claudeSettingsPath(), (settings) => {
|
|
44738
45518
|
const enabledPlugins = settings.enabledPlugins ?? {};
|
|
44739
45519
|
if (!isPlainObject2(enabledPlugins)) {
|
|
44740
45520
|
throw new Error('settings.json "enabledPlugins" is not an object; not modifying it');
|
|
@@ -44773,7 +45553,7 @@ var init_install = __esm({
|
|
|
44773
45553
|
*/
|
|
44774
45554
|
async installHookTemplates() {
|
|
44775
45555
|
const claudeDir = getClaudeConfigDir();
|
|
44776
|
-
const hooksDir =
|
|
45556
|
+
const hooksDir = join8(claudeDir, "hooks");
|
|
44777
45557
|
let templates;
|
|
44778
45558
|
try {
|
|
44779
45559
|
templates = installProviderHookTemplates({
|
|
@@ -44784,7 +45564,7 @@ var init_install = __esm({
|
|
|
44784
45564
|
return null;
|
|
44785
45565
|
}
|
|
44786
45566
|
const settingsEntryAdded = await this.registerPreCompactHook(
|
|
44787
|
-
|
|
45567
|
+
join8(hooksDir, "precompact-safestop.sh")
|
|
44788
45568
|
);
|
|
44789
45569
|
if (templates.installedFiles.length === 0 && !settingsEntryAdded) {
|
|
44790
45570
|
return null;
|
|
@@ -44806,7 +45586,7 @@ var init_install = __esm({
|
|
|
44806
45586
|
* @task T1013
|
|
44807
45587
|
*/
|
|
44808
45588
|
async registerPreCompactHook(shimPath) {
|
|
44809
|
-
return
|
|
45589
|
+
return updateJsonConfigFile3(claudeSettingsPath(), (settings) => {
|
|
44810
45590
|
const hooks = hookMap(settings);
|
|
44811
45591
|
if (hasCleoHook(hooks.PreCompact, "precompact-safestop.sh")) {
|
|
44812
45592
|
return false;
|
|
@@ -44830,7 +45610,7 @@ var init_install = __esm({
|
|
|
44830
45610
|
|
|
44831
45611
|
// packages/adapters/src/providers/shared/agent-spawn-wrapper.ts
|
|
44832
45612
|
import { spawnSync } from "node:child_process";
|
|
44833
|
-
import { readFileSync as
|
|
45613
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
44834
45614
|
import { resolveSpawnInvocation } from "@cleocode/paths";
|
|
44835
45615
|
function hasSystemdRun() {
|
|
44836
45616
|
if (_systemdRunAvailable !== void 0) return _systemdRunAvailable;
|
|
@@ -44845,7 +45625,7 @@ function hasSystemdRun() {
|
|
|
44845
45625
|
function readMemTotalBytes() {
|
|
44846
45626
|
if (process.platform !== "linux") return 32 * 1024 * 1024 * 1024;
|
|
44847
45627
|
try {
|
|
44848
|
-
const raw =
|
|
45628
|
+
const raw = readFileSync6("/proc/meminfo", "utf8");
|
|
44849
45629
|
const m = raw.match(/^MemTotal:\s+(\d+)\s+kB/m);
|
|
44850
45630
|
if (m?.[1]) return parseInt(m[1], 10) * 1024;
|
|
44851
45631
|
} catch {
|
|
@@ -44928,16 +45708,16 @@ var init_agent_spawn_wrapper = __esm({
|
|
|
44928
45708
|
|
|
44929
45709
|
// packages/adapters/src/providers/shared/prompt-file.ts
|
|
44930
45710
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
44931
|
-
import { tmpdir } from "node:os";
|
|
44932
|
-
import { dirname as
|
|
45711
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
45712
|
+
import { dirname as dirname5, join as join9 } from "node:path";
|
|
44933
45713
|
async function writeSpawnPromptFile(prefix, prompt) {
|
|
44934
|
-
const dir = await mkdtemp(
|
|
44935
|
-
const file2 =
|
|
45714
|
+
const dir = await mkdtemp(join9(tmpdir2(), `cleo-${prefix}-`));
|
|
45715
|
+
const file2 = join9(dir, "prompt.txt");
|
|
44936
45716
|
await writeFile(file2, prompt, "utf-8");
|
|
44937
45717
|
return file2;
|
|
44938
45718
|
}
|
|
44939
45719
|
async function removeSpawnPromptFile(file2) {
|
|
44940
|
-
await rm(
|
|
45720
|
+
await rm(dirname5(file2), { recursive: true, force: true }).catch(() => void 0);
|
|
44941
45721
|
}
|
|
44942
45722
|
var init_prompt_file = __esm({
|
|
44943
45723
|
"packages/adapters/src/providers/shared/prompt-file.ts"() {
|
|
@@ -45029,7 +45809,7 @@ function isEsrch(err) {
|
|
|
45029
45809
|
return false;
|
|
45030
45810
|
}
|
|
45031
45811
|
function sleep(ms) {
|
|
45032
|
-
return new Promise((
|
|
45812
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
45033
45813
|
}
|
|
45034
45814
|
var SIGTERM_GRACE_MS;
|
|
45035
45815
|
var init_suite_reaper = __esm({
|
|
@@ -45230,7 +46010,7 @@ var init_spawn2 = __esm({
|
|
|
45230
46010
|
|
|
45231
46011
|
// packages/adapters/src/providers/claude-code/task-sync.ts
|
|
45232
46012
|
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
45233
|
-
import { join as
|
|
46013
|
+
import { join as join10 } from "node:path";
|
|
45234
46014
|
function parseTaskId(content) {
|
|
45235
46015
|
const match = content.match(/^\[T(\d+)\]/);
|
|
45236
46016
|
return match ? `T${match[1]}` : null;
|
|
@@ -45251,7 +46031,7 @@ function mapStatus(twStatus) {
|
|
|
45251
46031
|
}
|
|
45252
46032
|
}
|
|
45253
46033
|
function getTodoWriteFilePath(projectDir) {
|
|
45254
|
-
return
|
|
46034
|
+
return join10(projectDir, ".cleo", "sync", "todowrite-state.json");
|
|
45255
46035
|
}
|
|
45256
46036
|
var ClaudeCodeTaskSyncProvider;
|
|
45257
46037
|
var init_task_sync = __esm({
|
|
@@ -45322,9 +46102,9 @@ var init_transport = __esm({
|
|
|
45322
46102
|
});
|
|
45323
46103
|
|
|
45324
46104
|
// packages/adapters/src/providers/claude-code/adapter.ts
|
|
45325
|
-
import { existsSync as
|
|
45326
|
-
import { homedir as
|
|
45327
|
-
import { join as
|
|
46105
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
46106
|
+
import { homedir as homedir6 } from "node:os";
|
|
46107
|
+
import { join as join11 } from "node:path";
|
|
45328
46108
|
import { findOnPath as findOnPath2 } from "@cleocode/paths";
|
|
45329
46109
|
var ClaudeCodeAdapter;
|
|
45330
46110
|
var init_adapter = __esm({
|
|
@@ -45477,8 +46257,8 @@ var init_adapter = __esm({
|
|
|
45477
46257
|
cliAvailable = resolvedCli !== null;
|
|
45478
46258
|
if (resolvedCli) details.cliPath = resolvedCli;
|
|
45479
46259
|
else details.cliAvailable = false;
|
|
45480
|
-
const claudeConfigDir =
|
|
45481
|
-
const configExists =
|
|
46260
|
+
const claudeConfigDir = join11(homedir6(), ".claude");
|
|
46261
|
+
const configExists = existsSync8(claudeConfigDir);
|
|
45482
46262
|
details.configDirExists = configExists;
|
|
45483
46263
|
const entrypointSet = process.env.CLAUDE_CODE_ENTRYPOINT !== void 0;
|
|
45484
46264
|
details.entrypointEnvSet = entrypointSet;
|
|
@@ -45507,17 +46287,17 @@ var init_adapter = __esm({
|
|
|
45507
46287
|
});
|
|
45508
46288
|
|
|
45509
46289
|
// packages/adapters/src/providers/claude-code/statusline.ts
|
|
45510
|
-
import { existsSync as
|
|
45511
|
-
import { homedir as
|
|
45512
|
-
import { join as
|
|
46290
|
+
import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
|
|
46291
|
+
import { homedir as homedir7 } from "node:os";
|
|
46292
|
+
import { join as join12 } from "node:path";
|
|
45513
46293
|
function getClaudeSettingsPath() {
|
|
45514
|
-
return process.env["CLAUDE_SETTINGS"] ??
|
|
46294
|
+
return process.env["CLAUDE_SETTINGS"] ?? join12(process.env["CLAUDE_HOME"] ?? join12(homedir7(), ".claude"), "settings.json");
|
|
45515
46295
|
}
|
|
45516
46296
|
function checkStatuslineIntegration() {
|
|
45517
46297
|
const settingsPath = getClaudeSettingsPath();
|
|
45518
|
-
if (!
|
|
46298
|
+
if (!existsSync9(settingsPath)) return "no_settings";
|
|
45519
46299
|
try {
|
|
45520
|
-
const settings = JSON.parse(
|
|
46300
|
+
const settings = JSON.parse(readFileSync7(settingsPath, "utf-8"));
|
|
45521
46301
|
const statusLine = settings.statusLine;
|
|
45522
46302
|
if (!statusLine?.type) return "not_configured";
|
|
45523
46303
|
if (statusLine.type !== "command") return "custom_no_cleo";
|
|
@@ -45525,10 +46305,10 @@ function checkStatuslineIntegration() {
|
|
|
45525
46305
|
if (cmd.includes("context-monitor.sh") || cmd.includes("cleo-statusline") || cmd.includes(".context-state.json") || cmd.includes("context-states")) {
|
|
45526
46306
|
return "configured";
|
|
45527
46307
|
}
|
|
45528
|
-
const scriptPath = cmd.startsWith("~") ? cmd.replace("~",
|
|
45529
|
-
if (
|
|
46308
|
+
const scriptPath = cmd.startsWith("~") ? cmd.replace("~", homedir7()) : cmd;
|
|
46309
|
+
if (existsSync9(scriptPath)) {
|
|
45530
46310
|
try {
|
|
45531
|
-
const content =
|
|
46311
|
+
const content = readFileSync7(scriptPath, "utf-8");
|
|
45532
46312
|
if (content.includes("context-state.json")) return "configured";
|
|
45533
46313
|
} catch {
|
|
45534
46314
|
}
|
|
@@ -45542,7 +46322,7 @@ function getStatuslineConfig(cleoHome) {
|
|
|
45542
46322
|
return {
|
|
45543
46323
|
statusLine: {
|
|
45544
46324
|
type: "command",
|
|
45545
|
-
command:
|
|
46325
|
+
command: join12(cleoHome, "lib", "session", "context-monitor.sh")
|
|
45546
46326
|
}
|
|
45547
46327
|
};
|
|
45548
46328
|
}
|
|
@@ -45764,12 +46544,12 @@ var init_hooks2 = __esm({
|
|
|
45764
46544
|
* @returns Cursor native event name (e.g. "preToolUse") or null
|
|
45765
46545
|
* @task T165
|
|
45766
46546
|
*/
|
|
45767
|
-
async toNativeEvent(
|
|
46547
|
+
async toNativeEvent(canonical2) {
|
|
45768
46548
|
try {
|
|
45769
46549
|
const { toNative } = await import("@cleocode/caamp");
|
|
45770
|
-
return toNative(
|
|
46550
|
+
return toNative(canonical2, PROVIDER_ID2);
|
|
45771
46551
|
} catch {
|
|
45772
|
-
const entry = Object.entries(CURSOR_EVENT_MAP).find(([, v]) => v ===
|
|
46552
|
+
const entry = Object.entries(CURSOR_EVENT_MAP).find(([, v]) => v === canonical2);
|
|
45773
46553
|
return entry?.[0] ?? null;
|
|
45774
46554
|
}
|
|
45775
46555
|
}
|
|
@@ -45778,12 +46558,12 @@ var init_hooks2 = __esm({
|
|
|
45778
46558
|
});
|
|
45779
46559
|
|
|
45780
46560
|
// packages/adapters/src/providers/cursor/install.ts
|
|
45781
|
-
import { existsSync as
|
|
45782
|
-
import { join as
|
|
46561
|
+
import { existsSync as existsSync12, readFileSync as readFileSync8 } from "node:fs";
|
|
46562
|
+
import { join as join18 } from "node:path";
|
|
45783
46563
|
import {
|
|
45784
46564
|
ensureProviderInstructionFile as ensureProviderInstructionFile3,
|
|
45785
46565
|
ensureProviderRuleFile,
|
|
45786
|
-
updateJsonConfigFile as
|
|
46566
|
+
updateJsonConfigFile as updateJsonConfigFile4
|
|
45787
46567
|
} from "@cleocode/caamp";
|
|
45788
46568
|
function isRecord(value) {
|
|
45789
46569
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -45850,14 +46630,14 @@ var init_install2 = __esm({
|
|
|
45850
46630
|
* Checks for .cursor/rules/cleo.mdc or .cursorrules with CLEO references.
|
|
45851
46631
|
*/
|
|
45852
46632
|
async isInstalled() {
|
|
45853
|
-
const mdcPath =
|
|
45854
|
-
if (
|
|
46633
|
+
const mdcPath = join18(process.cwd(), ".cursor", "rules", "cleo.mdc");
|
|
46634
|
+
if (existsSync12(mdcPath)) {
|
|
45855
46635
|
return true;
|
|
45856
46636
|
}
|
|
45857
|
-
const rulesPath =
|
|
45858
|
-
if (
|
|
46637
|
+
const rulesPath = join18(process.cwd(), ".cursorrules");
|
|
46638
|
+
if (existsSync12(rulesPath)) {
|
|
45859
46639
|
try {
|
|
45860
|
-
const content =
|
|
46640
|
+
const content = readFileSync8(rulesPath, "utf-8");
|
|
45861
46641
|
const injectionRef = `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`;
|
|
45862
46642
|
if (content.includes(injectionRef) || content.includes("@.cleo/memory-bridge.md")) {
|
|
45863
46643
|
return true;
|
|
@@ -45902,7 +46682,7 @@ var init_install2 = __esm({
|
|
|
45902
46682
|
onlyIfExists: true
|
|
45903
46683
|
}),
|
|
45904
46684
|
await ensureProviderRuleFile("cursor", projectDir, {
|
|
45905
|
-
relativePath:
|
|
46685
|
+
relativePath: join18(".cursor", "rules", "cleo.mdc"),
|
|
45906
46686
|
preamble: CLEO_MDC_FRONTMATTER
|
|
45907
46687
|
})
|
|
45908
46688
|
];
|
|
@@ -45913,10 +46693,10 @@ var init_install2 = __esm({
|
|
|
45913
46693
|
*/
|
|
45914
46694
|
getUpdatedFileList(projectDir) {
|
|
45915
46695
|
const files = [];
|
|
45916
|
-
if (
|
|
45917
|
-
files.push(
|
|
46696
|
+
if (existsSync12(join18(projectDir, ".cursorrules"))) {
|
|
46697
|
+
files.push(join18(projectDir, ".cursorrules"));
|
|
45918
46698
|
}
|
|
45919
|
-
files.push(
|
|
46699
|
+
files.push(join18(projectDir, ".cursor", "rules", "cleo.mdc"));
|
|
45920
46700
|
return files;
|
|
45921
46701
|
}
|
|
45922
46702
|
/**
|
|
@@ -45938,7 +46718,7 @@ var init_install2 = __esm({
|
|
|
45938
46718
|
* @task T1013
|
|
45939
46719
|
*/
|
|
45940
46720
|
async installHookTemplates(projectDir) {
|
|
45941
|
-
const hooksDir =
|
|
46721
|
+
const hooksDir = join18(projectDir, ".cursor", "hooks");
|
|
45942
46722
|
let templates;
|
|
45943
46723
|
try {
|
|
45944
46724
|
templates = installProviderHookTemplates({
|
|
@@ -45950,7 +46730,7 @@ var init_install2 = __esm({
|
|
|
45950
46730
|
}
|
|
45951
46731
|
const hooksJsonEntryAdded = await this.registerPreCompactHook(
|
|
45952
46732
|
projectDir,
|
|
45953
|
-
|
|
46733
|
+
join18(hooksDir, "precompact.sh")
|
|
45954
46734
|
);
|
|
45955
46735
|
if (templates.installedFiles.length === 0 && !hooksJsonEntryAdded) {
|
|
45956
46736
|
return null;
|
|
@@ -45971,8 +46751,8 @@ var init_install2 = __esm({
|
|
|
45971
46751
|
* @task T1013
|
|
45972
46752
|
*/
|
|
45973
46753
|
async registerPreCompactHook(projectDir, shimPath) {
|
|
45974
|
-
const hooksJsonPath =
|
|
45975
|
-
return
|
|
46754
|
+
const hooksJsonPath = join18(projectDir, ".cursor", "hooks.json");
|
|
46755
|
+
return updateJsonConfigFile4(hooksJsonPath, (config2) => {
|
|
45976
46756
|
const hooks = config2.hooks ?? {};
|
|
45977
46757
|
if (!isRecord(hooks)) {
|
|
45978
46758
|
throw new Error('.cursor/hooks.json "hooks" is not an object; not modifying it');
|
|
@@ -46000,8 +46780,8 @@ var init_install2 = __esm({
|
|
|
46000
46780
|
});
|
|
46001
46781
|
|
|
46002
46782
|
// packages/adapters/src/providers/cursor/adapter.ts
|
|
46003
|
-
import { existsSync as
|
|
46004
|
-
import { join as
|
|
46783
|
+
import { existsSync as existsSync13 } from "node:fs";
|
|
46784
|
+
import { join as join19 } from "node:path";
|
|
46005
46785
|
var CursorAdapter;
|
|
46006
46786
|
var init_adapter2 = __esm({
|
|
46007
46787
|
"packages/adapters/src/providers/cursor/adapter.ts"() {
|
|
@@ -46095,14 +46875,14 @@ var init_adapter2 = __esm({
|
|
|
46095
46875
|
}
|
|
46096
46876
|
let configExists = false;
|
|
46097
46877
|
if (this.projectDir) {
|
|
46098
|
-
const cursorConfigDir =
|
|
46099
|
-
configExists =
|
|
46878
|
+
const cursorConfigDir = join19(this.projectDir, ".cursor");
|
|
46879
|
+
configExists = existsSync13(cursorConfigDir);
|
|
46100
46880
|
details.configDirExists = configExists;
|
|
46101
46881
|
}
|
|
46102
46882
|
const editorEnvSet = process.env.CURSOR_EDITOR !== void 0;
|
|
46103
46883
|
details.editorEnvSet = editorEnvSet;
|
|
46104
46884
|
if (this.projectDir) {
|
|
46105
|
-
const legacyRulesExist =
|
|
46885
|
+
const legacyRulesExist = existsSync13(join19(this.projectDir, ".cursorrules"));
|
|
46106
46886
|
details.legacyRulesExist = legacyRulesExist;
|
|
46107
46887
|
}
|
|
46108
46888
|
const healthy = configExists || editorEnvSet;
|
|
@@ -46292,12 +47072,12 @@ var init_hooks3 = __esm({
|
|
|
46292
47072
|
* @returns OpenCode native event name or null
|
|
46293
47073
|
* @task T164
|
|
46294
47074
|
*/
|
|
46295
|
-
async toNativeEvent(
|
|
47075
|
+
async toNativeEvent(canonical2) {
|
|
46296
47076
|
try {
|
|
46297
47077
|
const { toNative } = await import("@cleocode/caamp");
|
|
46298
|
-
return toNative(
|
|
47078
|
+
return toNative(canonical2, PROVIDER_ID3);
|
|
46299
47079
|
} catch {
|
|
46300
|
-
const entry = Object.entries(OPENCODE_EVENT_MAP).find(([, v]) => v ===
|
|
47080
|
+
const entry = Object.entries(OPENCODE_EVENT_MAP).find(([, v]) => v === canonical2);
|
|
46301
47081
|
return entry?.[0] ?? null;
|
|
46302
47082
|
}
|
|
46303
47083
|
}
|
|
@@ -46306,13 +47086,14 @@ var init_hooks3 = __esm({
|
|
|
46306
47086
|
});
|
|
46307
47087
|
|
|
46308
47088
|
// packages/adapters/src/providers/opencode/install.ts
|
|
46309
|
-
import { existsSync as
|
|
46310
|
-
import { join as
|
|
47089
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync4, readFileSync as readFileSync11, writeFileSync as writeFileSync3 } from "node:fs";
|
|
47090
|
+
import { join as join25 } from "node:path";
|
|
46311
47091
|
import { ensureProviderInstructionFile as ensureProviderInstructionFile6 } from "@cleocode/caamp";
|
|
46312
47092
|
var OpenCodeInstallProvider;
|
|
46313
47093
|
var init_install3 = __esm({
|
|
46314
47094
|
"packages/adapters/src/providers/opencode/install.ts"() {
|
|
46315
47095
|
"use strict";
|
|
47096
|
+
init_heavy_command_hook_install();
|
|
46316
47097
|
init_hook_template_installer();
|
|
46317
47098
|
init_paths2();
|
|
46318
47099
|
OpenCodeInstallProvider = class {
|
|
@@ -46332,14 +47113,28 @@ var init_install3 = __esm({
|
|
|
46332
47113
|
});
|
|
46333
47114
|
const instructionFileUpdated = instructResult.action !== "intact";
|
|
46334
47115
|
if (instructionFileUpdated) {
|
|
46335
|
-
details.instructionFile =
|
|
47116
|
+
details.instructionFile = join25(projectDir, instructResult.instructFile);
|
|
46336
47117
|
}
|
|
46337
47118
|
const hookResult = this.installHookTemplates(projectDir);
|
|
46338
47119
|
if (hookResult) {
|
|
46339
47120
|
details.hookTemplates = hookResult;
|
|
46340
47121
|
}
|
|
47122
|
+
let success2 = true;
|
|
47123
|
+
if (options.heavyCommandHook !== void 0 && isUserHomeDir(projectDir)) {
|
|
47124
|
+
details.heavyCommandHook = "skipped";
|
|
47125
|
+
} else if (options.heavyCommandHook !== void 0) {
|
|
47126
|
+
try {
|
|
47127
|
+
details.heavyCommandHook = syncOpencodeHeavyCommandPlugin(
|
|
47128
|
+
projectDir,
|
|
47129
|
+
options.heavyCommandHook
|
|
47130
|
+
);
|
|
47131
|
+
} catch (err) {
|
|
47132
|
+
details.settingsErrors = [err instanceof Error ? err.message : String(err)];
|
|
47133
|
+
success2 = false;
|
|
47134
|
+
}
|
|
47135
|
+
}
|
|
46341
47136
|
return {
|
|
46342
|
-
success:
|
|
47137
|
+
success: success2,
|
|
46343
47138
|
installedAt,
|
|
46344
47139
|
instructionFileUpdated,
|
|
46345
47140
|
details
|
|
@@ -46405,8 +47200,8 @@ var init_install3 = __esm({
|
|
|
46405
47200
|
* @task T1013
|
|
46406
47201
|
*/
|
|
46407
47202
|
installHookTemplates(projectDir) {
|
|
46408
|
-
const pluginsDir =
|
|
46409
|
-
const hooksDir =
|
|
47203
|
+
const pluginsDir = join25(projectDir, ".opencode", "plugins");
|
|
47204
|
+
const hooksDir = join25(pluginsDir, "hooks");
|
|
46410
47205
|
let templates;
|
|
46411
47206
|
try {
|
|
46412
47207
|
templates = installProviderHookTemplates({
|
|
@@ -46418,7 +47213,7 @@ var init_install3 = __esm({
|
|
|
46418
47213
|
}
|
|
46419
47214
|
let pluginWritten = false;
|
|
46420
47215
|
try {
|
|
46421
|
-
pluginWritten = this.writePrecompactPlugin(pluginsDir,
|
|
47216
|
+
pluginWritten = this.writePrecompactPlugin(pluginsDir, join25(hooksDir, "precompact.sh"));
|
|
46422
47217
|
} catch {
|
|
46423
47218
|
}
|
|
46424
47219
|
if (templates.installedFiles.length === 0 && !pluginWritten) {
|
|
@@ -46442,7 +47237,7 @@ var init_install3 = __esm({
|
|
|
46442
47237
|
* @task T1013
|
|
46443
47238
|
*/
|
|
46444
47239
|
writePrecompactPlugin(pluginsDir, shimPath) {
|
|
46445
|
-
const pluginPath =
|
|
47240
|
+
const pluginPath = join25(pluginsDir, "cleo-precompact.js");
|
|
46446
47241
|
const generated = [
|
|
46447
47242
|
"// CLEO PreCompact plugin for OpenCode (generated by @cleocode/adapters).",
|
|
46448
47243
|
"// Bridges the canonical CAAMP `PreCompact` event",
|
|
@@ -46468,16 +47263,16 @@ var init_install3 = __esm({
|
|
|
46468
47263
|
"}",
|
|
46469
47264
|
""
|
|
46470
47265
|
].join("\n");
|
|
46471
|
-
if (
|
|
47266
|
+
if (existsSync18(pluginPath)) {
|
|
46472
47267
|
try {
|
|
46473
|
-
if (
|
|
47268
|
+
if (readFileSync11(pluginPath, "utf-8") === generated) {
|
|
46474
47269
|
return false;
|
|
46475
47270
|
}
|
|
46476
47271
|
} catch {
|
|
46477
47272
|
}
|
|
46478
47273
|
}
|
|
46479
|
-
|
|
46480
|
-
|
|
47274
|
+
mkdirSync4(pluginsDir, { recursive: true });
|
|
47275
|
+
writeFileSync3(pluginPath, generated, "utf-8");
|
|
46481
47276
|
return true;
|
|
46482
47277
|
}
|
|
46483
47278
|
};
|
|
@@ -46486,7 +47281,7 @@ var init_install3 = __esm({
|
|
|
46486
47281
|
|
|
46487
47282
|
// packages/adapters/src/providers/opencode/spawn.ts
|
|
46488
47283
|
import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
|
|
46489
|
-
import { join as
|
|
47284
|
+
import { join as join26 } from "node:path";
|
|
46490
47285
|
import { findOnPath as findOnPath9 } from "@cleocode/paths";
|
|
46491
47286
|
function buildOpenCodeAgentMarkdown(description, instructions) {
|
|
46492
47287
|
const normalizedDesc = description.replace(/\s+/g, " ").trim();
|
|
@@ -46502,8 +47297,8 @@ function buildOpenCodeAgentMarkdown(description, instructions) {
|
|
|
46502
47297
|
].join("\n");
|
|
46503
47298
|
}
|
|
46504
47299
|
async function ensureSubagentDefinition(workingDirectory, enrichedInstructions) {
|
|
46505
|
-
const agentDir =
|
|
46506
|
-
const agentPath =
|
|
47300
|
+
const agentDir = join26(workingDirectory, ".opencode", "agent");
|
|
47301
|
+
const agentPath = join26(agentDir, `${OPENCODE_SUBAGENT_NAME}.md`);
|
|
46507
47302
|
const description = "CLEO task executor with protocol compliance and CANT context.";
|
|
46508
47303
|
const instructions = enrichedInstructions ?? [
|
|
46509
47304
|
"# CLEO Subagent",
|
|
@@ -46667,8 +47462,8 @@ var init_spawn3 = __esm({
|
|
|
46667
47462
|
});
|
|
46668
47463
|
|
|
46669
47464
|
// packages/adapters/src/providers/opencode/adapter.ts
|
|
46670
|
-
import { existsSync as
|
|
46671
|
-
import { join as
|
|
47465
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
47466
|
+
import { join as join27 } from "node:path";
|
|
46672
47467
|
import { findOnPath as findOnPath10 } from "@cleocode/paths";
|
|
46673
47468
|
var OpenCodeAdapter;
|
|
46674
47469
|
var init_adapter3 = __esm({
|
|
@@ -46776,8 +47571,8 @@ var init_adapter3 = __esm({
|
|
|
46776
47571
|
if (resolvedCli) details.cliPath = resolvedCli;
|
|
46777
47572
|
else details.cliAvailable = false;
|
|
46778
47573
|
if (this.projectDir) {
|
|
46779
|
-
const openCodeConfigDir =
|
|
46780
|
-
const configExists =
|
|
47574
|
+
const openCodeConfigDir = join27(this.projectDir, ".opencode");
|
|
47575
|
+
const configExists = existsSync19(openCodeConfigDir);
|
|
46781
47576
|
details.configDirExists = configExists;
|
|
46782
47577
|
}
|
|
46783
47578
|
const versionEnvSet = process.env.OPENCODE_VERSION !== void 0;
|
|
@@ -46972,12 +47767,12 @@ var init_hooks4 = __esm({
|
|
|
46972
47767
|
* @returns Pi native event name or null
|
|
46973
47768
|
* @task T553
|
|
46974
47769
|
*/
|
|
46975
|
-
async toNativeEvent(
|
|
47770
|
+
async toNativeEvent(canonical2) {
|
|
46976
47771
|
try {
|
|
46977
47772
|
const { toNative } = await import("@cleocode/caamp");
|
|
46978
|
-
return toNative(
|
|
47773
|
+
return toNative(canonical2, PROVIDER_ID4);
|
|
46979
47774
|
} catch {
|
|
46980
|
-
const entry = Object.entries(PI_EVENT_MAP).find(([, v]) => v ===
|
|
47775
|
+
const entry = Object.entries(PI_EVENT_MAP).find(([, v]) => v === canonical2);
|
|
46981
47776
|
return entry?.[0] ?? null;
|
|
46982
47777
|
}
|
|
46983
47778
|
}
|
|
@@ -46986,7 +47781,7 @@ var init_hooks4 = __esm({
|
|
|
46986
47781
|
});
|
|
46987
47782
|
|
|
46988
47783
|
// packages/adapters/src/providers/pi/install.ts
|
|
46989
|
-
import { join as
|
|
47784
|
+
import { join as join28 } from "node:path";
|
|
46990
47785
|
import { ensureProviderInstructionFile as ensureProviderInstructionFile7 } from "@cleocode/caamp";
|
|
46991
47786
|
function getCleoReferences() {
|
|
46992
47787
|
return [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"];
|
|
@@ -47013,7 +47808,7 @@ var init_install4 = __esm({
|
|
|
47013
47808
|
});
|
|
47014
47809
|
const projectUpdated = projectResult.action !== "intact";
|
|
47015
47810
|
if (projectUpdated) {
|
|
47016
|
-
details.instructionFile =
|
|
47811
|
+
details.instructionFile = join28(projectDir, projectResult.instructFile);
|
|
47017
47812
|
}
|
|
47018
47813
|
let globalUpdated = false;
|
|
47019
47814
|
try {
|
|
@@ -47218,22 +48013,22 @@ var init_spawn4 = __esm({
|
|
|
47218
48013
|
});
|
|
47219
48014
|
|
|
47220
48015
|
// packages/adapters/src/providers/pi/adapter.ts
|
|
47221
|
-
import { existsSync as
|
|
47222
|
-
import { homedir as
|
|
47223
|
-
import { join as
|
|
48016
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
48017
|
+
import { homedir as homedir13 } from "node:os";
|
|
48018
|
+
import { join as join29 } from "node:path";
|
|
47224
48019
|
import { findOnPath as findOnPath12 } from "@cleocode/paths";
|
|
47225
48020
|
function getPiAgentDir() {
|
|
47226
48021
|
const env = process.env["PI_CODING_AGENT_DIR"];
|
|
47227
48022
|
if (env !== void 0 && env.length > 0) {
|
|
47228
|
-
if (env === "~") return
|
|
47229
|
-
if (env.startsWith("~/")) return
|
|
48023
|
+
if (env === "~") return homedir13();
|
|
48024
|
+
if (env.startsWith("~/")) return join29(homedir13(), env.slice(2));
|
|
47230
48025
|
return env;
|
|
47231
48026
|
}
|
|
47232
48027
|
const piHome = process.env["PI_HOME"];
|
|
47233
48028
|
if (piHome !== void 0 && piHome.length > 0) {
|
|
47234
|
-
return
|
|
48029
|
+
return join29(piHome, "agent");
|
|
47235
48030
|
}
|
|
47236
|
-
return
|
|
48031
|
+
return join29(homedir13(), ".pi", "agent");
|
|
47237
48032
|
}
|
|
47238
48033
|
var PiAdapter;
|
|
47239
48034
|
var init_adapter4 = __esm({
|
|
@@ -47341,12 +48136,12 @@ var init_adapter4 = __esm({
|
|
|
47341
48136
|
if (resolvedCli) details.cliPath = cliPath === "pi" ? resolvedCli : cliPath;
|
|
47342
48137
|
else details.cliAvailable = false;
|
|
47343
48138
|
const agentDir = getPiAgentDir();
|
|
47344
|
-
const agentDirExists =
|
|
48139
|
+
const agentDirExists = existsSync20(agentDir);
|
|
47345
48140
|
details.agentDirExists = agentDirExists;
|
|
47346
48141
|
details.agentDir = agentDir;
|
|
47347
48142
|
if (this.projectDir) {
|
|
47348
|
-
const projectPiDir =
|
|
47349
|
-
details.projectPiDirExists =
|
|
48143
|
+
const projectPiDir = join29(this.projectDir, ".pi");
|
|
48144
|
+
details.projectPiDirExists = existsSync20(projectPiDir);
|
|
47350
48145
|
}
|
|
47351
48146
|
details.piCodingAgentDirSet = process.env["PI_CODING_AGENT_DIR"] !== void 0;
|
|
47352
48147
|
details.piHomeSet = process.env["PI_HOME"] !== void 0;
|
|
@@ -47519,16 +48314,16 @@ var ClaudeSDKAdapter = class {
|
|
|
47519
48314
|
};
|
|
47520
48315
|
|
|
47521
48316
|
// packages/adapters/src/providers/claude-sdk/mcp-registry.ts
|
|
47522
|
-
import { existsSync as
|
|
47523
|
-
import { join as
|
|
48317
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
48318
|
+
import { join as join13 } from "node:path";
|
|
47524
48319
|
var CLEO_MCP_CANDIDATES = [
|
|
47525
48320
|
{ name: "brain", binary: "cleo-mcp-brain" },
|
|
47526
48321
|
{ name: "nexus", binary: "cleo-mcp-nexus" },
|
|
47527
48322
|
{ name: "tasks", binary: "cleo-mcp-tasks" }
|
|
47528
48323
|
];
|
|
47529
48324
|
function findInNodeModules(binary, workingDir) {
|
|
47530
|
-
const binPath =
|
|
47531
|
-
if (
|
|
48325
|
+
const binPath = join13(workingDir, "node_modules", ".bin", binary);
|
|
48326
|
+
if (existsSync10(binPath)) {
|
|
47532
48327
|
return binPath;
|
|
47533
48328
|
}
|
|
47534
48329
|
return void 0;
|
|
@@ -47557,18 +48352,18 @@ function createAdapter2() {
|
|
|
47557
48352
|
}
|
|
47558
48353
|
|
|
47559
48354
|
// packages/adapters/src/providers/codex/adapter.ts
|
|
47560
|
-
import { existsSync as
|
|
47561
|
-
import { homedir as
|
|
47562
|
-
import { join as
|
|
48355
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
48356
|
+
import { homedir as homedir9 } from "node:os";
|
|
48357
|
+
import { join as join17 } from "node:path";
|
|
47563
48358
|
import { findOnPath as findOnPath3 } from "@cleocode/paths";
|
|
47564
48359
|
|
|
47565
48360
|
// packages/adapters/src/providers/codex/hooks.ts
|
|
47566
|
-
import { homedir as
|
|
47567
|
-
import { join as
|
|
48361
|
+
import { homedir as homedir8 } from "node:os";
|
|
48362
|
+
import { join as join15 } from "node:path";
|
|
47568
48363
|
|
|
47569
48364
|
// packages/adapters/src/providers/shared/transcript-reader.ts
|
|
47570
48365
|
import { readdir as readdir2, readFile as readFile3 } from "node:fs/promises";
|
|
47571
|
-
import { join as
|
|
48366
|
+
import { join as join14 } from "node:path";
|
|
47572
48367
|
function parseTranscriptLines(raw) {
|
|
47573
48368
|
const turns = [];
|
|
47574
48369
|
const lines = raw.split("\n").filter((l) => l.trim());
|
|
@@ -47593,7 +48388,7 @@ async function readLatestTranscript(providerDir) {
|
|
|
47593
48388
|
if (!entry.isFile()) continue;
|
|
47594
48389
|
const name15 = entry.name;
|
|
47595
48390
|
if (name15.endsWith(".json") || name15.endsWith(".jsonl")) {
|
|
47596
|
-
allFiles.push(
|
|
48391
|
+
allFiles.push(join14(providerDir, name15));
|
|
47597
48392
|
}
|
|
47598
48393
|
}
|
|
47599
48394
|
} catch {
|
|
@@ -47683,13 +48478,14 @@ var CodexHookProvider = class {
|
|
|
47683
48478
|
* @task T162 @epic T134
|
|
47684
48479
|
*/
|
|
47685
48480
|
async getTranscript(_sessionId, _projectDir) {
|
|
47686
|
-
return readLatestTranscript(
|
|
48481
|
+
return readLatestTranscript(join15(homedir8(), ".codex"));
|
|
47687
48482
|
}
|
|
47688
48483
|
};
|
|
47689
48484
|
|
|
47690
48485
|
// packages/adapters/src/providers/codex/install.ts
|
|
48486
|
+
init_heavy_command_hook_install();
|
|
47691
48487
|
init_paths2();
|
|
47692
|
-
import { join as
|
|
48488
|
+
import { join as join16 } from "node:path";
|
|
47693
48489
|
import { ensureProviderInstructionFile as ensureProviderInstructionFile2 } from "@cleocode/caamp";
|
|
47694
48490
|
var CodexInstallProvider = class {
|
|
47695
48491
|
/**
|
|
@@ -47709,10 +48505,25 @@ var CodexInstallProvider = class {
|
|
|
47709
48505
|
});
|
|
47710
48506
|
const instructionFileUpdated = result.action !== "intact";
|
|
47711
48507
|
if (instructionFileUpdated) {
|
|
47712
|
-
details.instructionFile =
|
|
48508
|
+
details.instructionFile = join16(projectDir, result.instructFile);
|
|
48509
|
+
}
|
|
48510
|
+
let success2 = true;
|
|
48511
|
+
if (options.heavyCommandHook !== void 0 && isUserHomeDir(projectDir)) {
|
|
48512
|
+
details.heavyCommandHook = "skipped";
|
|
48513
|
+
} else if (options.heavyCommandHook !== void 0) {
|
|
48514
|
+
try {
|
|
48515
|
+
details.heavyCommandHook = await syncJsonHeavyCommandHook(
|
|
48516
|
+
join16(projectDir, ".codex", "hooks.json"),
|
|
48517
|
+
"codex",
|
|
48518
|
+
options.heavyCommandHook
|
|
48519
|
+
);
|
|
48520
|
+
} catch (err) {
|
|
48521
|
+
details.settingsErrors = [err instanceof Error ? err.message : String(err)];
|
|
48522
|
+
success2 = false;
|
|
48523
|
+
}
|
|
47713
48524
|
}
|
|
47714
48525
|
return {
|
|
47715
|
-
success:
|
|
48526
|
+
success: success2,
|
|
47716
48527
|
installedAt,
|
|
47717
48528
|
instructionFileUpdated,
|
|
47718
48529
|
details
|
|
@@ -47843,8 +48654,8 @@ var CodexAdapter = class {
|
|
|
47843
48654
|
cliAvailable = resolvedCli !== null;
|
|
47844
48655
|
if (resolvedCli) details.cliPath = resolvedCli;
|
|
47845
48656
|
else details.cliAvailable = false;
|
|
47846
|
-
const codexConfigDir =
|
|
47847
|
-
const configExists =
|
|
48657
|
+
const codexConfigDir = join17(homedir9(), ".codex");
|
|
48658
|
+
const configExists = existsSync11(codexConfigDir);
|
|
47848
48659
|
details.configDirExists = configExists;
|
|
47849
48660
|
const healthy = cliAvailable;
|
|
47850
48661
|
details.cliAvailable = cliAvailable;
|
|
@@ -47885,14 +48696,14 @@ function createAdapter3() {
|
|
|
47885
48696
|
init_cursor();
|
|
47886
48697
|
|
|
47887
48698
|
// packages/adapters/src/providers/gemini-cli/adapter.ts
|
|
47888
|
-
import { existsSync as
|
|
47889
|
-
import { homedir as
|
|
47890
|
-
import { join as
|
|
48699
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
48700
|
+
import { homedir as homedir11 } from "node:os";
|
|
48701
|
+
import { join as join22 } from "node:path";
|
|
47891
48702
|
import { findOnPath as findOnPath5 } from "@cleocode/paths";
|
|
47892
48703
|
|
|
47893
48704
|
// packages/adapters/src/providers/gemini-cli/hooks.ts
|
|
47894
|
-
import { homedir as
|
|
47895
|
-
import { join as
|
|
48705
|
+
import { homedir as homedir10 } from "node:os";
|
|
48706
|
+
import { join as join20 } from "node:path";
|
|
47896
48707
|
var GEMINI_CLI_EVENT_MAP = {
|
|
47897
48708
|
SessionStart: "SessionStart",
|
|
47898
48709
|
SessionEnd: "SessionEnd",
|
|
@@ -47970,14 +48781,14 @@ var GeminiCliHookProvider = class {
|
|
|
47970
48781
|
* @task T161 @epic T134
|
|
47971
48782
|
*/
|
|
47972
48783
|
async getTranscript(_sessionId, _projectDir) {
|
|
47973
|
-
return readLatestTranscript(
|
|
48784
|
+
return readLatestTranscript(join20(homedir10(), ".gemini"));
|
|
47974
48785
|
}
|
|
47975
48786
|
};
|
|
47976
48787
|
|
|
47977
48788
|
// packages/adapters/src/providers/gemini-cli/install.ts
|
|
47978
48789
|
init_paths2();
|
|
47979
|
-
import { existsSync as
|
|
47980
|
-
import { join as
|
|
48790
|
+
import { existsSync as existsSync14, readFileSync as readFileSync9 } from "node:fs";
|
|
48791
|
+
import { join as join21 } from "node:path";
|
|
47981
48792
|
import { ensureProviderInstructionFile as ensureProviderInstructionFile4 } from "@cleocode/caamp";
|
|
47982
48793
|
var GeminiCliInstallProvider = class {
|
|
47983
48794
|
/**
|
|
@@ -48022,10 +48833,10 @@ var GeminiCliInstallProvider = class {
|
|
|
48022
48833
|
*/
|
|
48023
48834
|
async isInstalled() {
|
|
48024
48835
|
const instructionRef = `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`;
|
|
48025
|
-
const geminiMdPath =
|
|
48026
|
-
if (
|
|
48836
|
+
const geminiMdPath = join21(process.cwd(), "GEMINI.md");
|
|
48837
|
+
if (existsSync14(geminiMdPath)) {
|
|
48027
48838
|
try {
|
|
48028
|
-
const content =
|
|
48839
|
+
const content = readFileSync9(geminiMdPath, "utf-8");
|
|
48029
48840
|
if (content.includes(instructionRef)) {
|
|
48030
48841
|
return true;
|
|
48031
48842
|
}
|
|
@@ -48142,8 +48953,8 @@ var GeminiCliAdapter = class {
|
|
|
48142
48953
|
cliAvailable = resolvedCli !== null;
|
|
48143
48954
|
if (resolvedCli) details.cliPath = resolvedCli;
|
|
48144
48955
|
else details.cliAvailable = false;
|
|
48145
|
-
const geminiConfigDir =
|
|
48146
|
-
const configExists =
|
|
48956
|
+
const geminiConfigDir = join22(homedir11(), ".gemini");
|
|
48957
|
+
const configExists = existsSync15(geminiConfigDir);
|
|
48147
48958
|
details.configDirExists = configExists;
|
|
48148
48959
|
const healthy = cliAvailable;
|
|
48149
48960
|
details.cliAvailable = cliAvailable;
|
|
@@ -48180,9 +48991,9 @@ function createAdapter5() {
|
|
|
48180
48991
|
}
|
|
48181
48992
|
|
|
48182
48993
|
// packages/adapters/src/providers/kimi/adapter.ts
|
|
48183
|
-
import { existsSync as
|
|
48184
|
-
import { homedir as
|
|
48185
|
-
import { join as
|
|
48994
|
+
import { existsSync as existsSync17 } from "node:fs";
|
|
48995
|
+
import { homedir as homedir12 } from "node:os";
|
|
48996
|
+
import { join as join24 } from "node:path";
|
|
48186
48997
|
import { findOnPath as findOnPath7 } from "@cleocode/paths";
|
|
48187
48998
|
|
|
48188
48999
|
// packages/adapters/src/providers/kimi/hooks.ts
|
|
@@ -48242,8 +49053,8 @@ var KimiHookProvider = class {
|
|
|
48242
49053
|
|
|
48243
49054
|
// packages/adapters/src/providers/kimi/install.ts
|
|
48244
49055
|
init_paths2();
|
|
48245
|
-
import { existsSync as
|
|
48246
|
-
import { join as
|
|
49056
|
+
import { existsSync as existsSync16, readFileSync as readFileSync10 } from "node:fs";
|
|
49057
|
+
import { join as join23 } from "node:path";
|
|
48247
49058
|
import { ensureProviderInstructionFile as ensureProviderInstructionFile5 } from "@cleocode/caamp";
|
|
48248
49059
|
var KimiInstallProvider = class {
|
|
48249
49060
|
/**
|
|
@@ -48288,10 +49099,10 @@ var KimiInstallProvider = class {
|
|
|
48288
49099
|
*/
|
|
48289
49100
|
async isInstalled() {
|
|
48290
49101
|
const instructionRef = `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`;
|
|
48291
|
-
const agentsMdPath =
|
|
48292
|
-
if (
|
|
49102
|
+
const agentsMdPath = join23(process.cwd(), "AGENTS.md");
|
|
49103
|
+
if (existsSync16(agentsMdPath)) {
|
|
48293
49104
|
try {
|
|
48294
|
-
const content =
|
|
49105
|
+
const content = readFileSync10(agentsMdPath, "utf-8");
|
|
48295
49106
|
if (content.includes(instructionRef)) {
|
|
48296
49107
|
return true;
|
|
48297
49108
|
}
|
|
@@ -48395,8 +49206,8 @@ var KimiAdapter = class {
|
|
|
48395
49206
|
cliAvailable = resolvedCli !== null;
|
|
48396
49207
|
if (resolvedCli) details.cliPath = resolvedCli;
|
|
48397
49208
|
else details.cliAvailable = false;
|
|
48398
|
-
const kimiConfigDir =
|
|
48399
|
-
const configExists =
|
|
49209
|
+
const kimiConfigDir = join24(homedir12(), ".kimi");
|
|
49210
|
+
const configExists = existsSync17(kimiConfigDir);
|
|
48400
49211
|
details.configDirExists = configExists;
|
|
48401
49212
|
const healthy = cliAvailable;
|
|
48402
49213
|
details.cliAvailable = cliAvailable;
|
|
@@ -48436,17 +49247,17 @@ init_opencode();
|
|
|
48436
49247
|
init_hook_template_installer();
|
|
48437
49248
|
|
|
48438
49249
|
// packages/adapters/src/registry.ts
|
|
48439
|
-
import { readFileSync as
|
|
48440
|
-
import { dirname as
|
|
49250
|
+
import { readFileSync as readFileSync12 } from "node:fs";
|
|
49251
|
+
import { dirname as dirname6, join as join30, resolve as resolve4 } from "node:path";
|
|
48441
49252
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
48442
49253
|
var PROVIDER_IDS = ["claude-code", "opencode", "cursor", "pi"];
|
|
48443
49254
|
function getProviderManifests() {
|
|
48444
49255
|
const manifests = [];
|
|
48445
|
-
const baseDir =
|
|
49256
|
+
const baseDir = resolve4(dirname6(fileURLToPath3(import.meta.url)), "providers");
|
|
48446
49257
|
for (const providerId of PROVIDER_IDS) {
|
|
48447
49258
|
try {
|
|
48448
|
-
const manifestPath =
|
|
48449
|
-
const raw =
|
|
49259
|
+
const manifestPath = join30(baseDir, providerId, "manifest.json");
|
|
49260
|
+
const raw = readFileSync12(manifestPath, "utf-8");
|
|
48450
49261
|
manifests.push(JSON.parse(raw));
|
|
48451
49262
|
} catch {
|
|
48452
49263
|
}
|