# agent refactor metadata

## guidelines

* **Imports Order & logalot**:
  * Imports should be organized in the following order:
    1. non-@ibgib external dependencies
    2. blank line
    3. @ibgib external dependencies (order: helper-gib, ts-gib, encrypt-gib, core-gib, node-gib, web-gib)
    4. blank line
    5. `import { GLOBAL_LOG_A_LOT } from '../path/to/constants/file.mts';` (if applicable)
    6. other local file imports
    7. blank line
    8. `const logalot = GLOBAL_LOG_A_LOT` (if applicable)
    9. blank line
  * So the `GLOBAL_LOG_A_LOT` is a local import, and this should be first iif the file contains any functions with logging.
* **Tag Logging Messages with UUIDs**:
  * Tag ALL logging messages, warnings, and errors with the proper prefix (e.g., I:, W:, E:) and a uuid inside parens, e.g., `(I: cfe7c7f220c84bd832bad493a9453826)`. Note: we will use `generate-id.js` for this.
  * **Exception**: `console.error` logs inside a `catch` block should NOT have their own `(E: uuid)` since the thrown error or rejected promise should already contain it. Simply use `console.error(\`${lc} ${extractErrorMsg(error)}\`);`.

## libs/core-gib/src/sync/sync-peer/sync-peer-http-receiver/sync-peer-http-receiver-v1.mts

[changes will go here]

### 2026/02/27 - 10:49 AM

#### line 5 - Imports Order & logalot

```typescript
import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';

import { GLOBAL_LOG_A_LOT } from '../../../core-constants.mjs';
import { SyncPeer_V1 } from '../sync-peer-v1.mjs';
import { SyncSagaContextIbGib_V1 } from '../../sync-saga-context/sync-saga-context-types.mjs';
import { IbGibSpaceAny } from '../../../witness/space/space-base-v1.mjs';
import {
    InitializeSyncPeerHttpReceiverOpts,
    SyncPeerHttpReceiverData_V1,
    SyncPeerHttpReceiverRel8ns_V1,
    SyncPeerHttpReceiverIbGib_V1
} from './sync-peer-http-receiver-types.mjs';
import { putInSpace } from '../../../witness/space/space-helper.mjs';

const logalot = GLOBAL_LOG_A_LOT;
```

#### line 48+ - Tag Logging Messages with UUIDs

```typescript
    protected async ensureLocalTempSpace(): Promise<IbGibSpaceAny> {
        // ...
            if (!this.opts) { throw new Error(`opts not initialized. (E: 3a77d1f466b92cc7940c0f241ac6c926)`); }
        // ...
```

```typescript
    protected override async sendContextRequest(context: SyncSagaContextIbGib_V1): Promise<SyncSagaContextIbGib_V1 | undefined> {
        const lc = `${this.lc}[${this.sendContextRequest.name}]`;
        try {
            if (logalot) { console.log(`${lc} starting... (I: 5297013216ae491894600b5a81115d26)`); }
            // ...
```

```typescript
    public async handleIncomingSyncRequest({ ... }): Promise<SyncSagaContextIbGib_V1 | undefined> {
        const lc = `${this.lc}[${this.handleIncomingSyncRequest.name}]`;
        try {
            if (logalot) { console.log(`${lc} starting... (I: 1de30d7db7e404ddf59eeed22a3bde26)`); }
            // ...
```
