Skip to content

Commit 862c86a

Browse files
V48 (specification-implementation): Attachment hierarchy file|external; retire integration
Add @bitcode/attachment-generics (BaseAttachment, categories file|external only), @bitcode/generic-attachments-file, and @bitcode/generic-attachments-external. Rename integration→external everywhere to align with the Externals auxillary. Remove vcs and url attachment categories (VCS attaches as external). BC barrel @bitcode/attachments-generics re-exports the hierarchy.
1 parent 461d0d3 commit 862c86a

49 files changed

Lines changed: 1020 additions & 1041 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BITCODE_SPEC_V48_NOTES.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,21 @@ AssetPack path+op envelopes without requiring raw source. Product binds
16661666
`assetPackId`. Existing `saveArtifact` / `putArtifactAtKey` callers keep
16671667
`@bitcode/artifacts`.
16681668

1669+
## Attachment hierarchy: file | external only (Garrett, 2026-07-13)
1670+
1671+
```
1672+
@bitcode/attachment-generics # primitive (BaseAttachment, categories)
1673+
→ @bitcode/generic-attachments-file # FileAttachment
1674+
→ @bitcode/generic-attachments-external # ExternalAttachment
1675+
@bitcode/attachments-generics # BC barrel
1676+
```
1677+
1678+
- Categories admitted: **`file` | `external`** only.
1679+
- **`integration``external`** everywhere (aligns with Externals auxillary:
1680+
GitHub VCS, future Jira/Notion/etc. attach as external connections).
1681+
- **`vcs` and `url` categories removed** (VCS is external; bare URL is not a category).
1682+
1683+
16691684
## AssetPack product pipelines: no lens; Simple settle-reads (Garrett, 2026-07-13)
16701685

16711686
Removed the deposit|read **lens** on a single SynthesizeAssetPacks factory.

FAMILIARIZATION.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,24 @@ Package paths: `packages/artifact-generics/`, `packages/generic-artifacts/patch/
245245
| Base | `PatchArtifact` | path+op patchfile envelope for AssetPack patches |
246246
| Product | `AssetPackPatchArtifact` | patch bound to `assetPackId` for synthesis |
247247

248+
### 3.1.5 Attachments (primitive → file | external)
249+
250+
```
251+
@bitcode/attachment-generics BaseAttachment; categories file|external
252+
253+
@bitcode/generic-attachments-file FileAttachment
254+
@bitcode/generic-attachments-external ExternalAttachment (Externals auxillary)
255+
256+
@bitcode/attachments-generics BC barrel
257+
```
258+
259+
| Category | Role |
260+
| --- | --- |
261+
| `file` | Direct uploads |
262+
| `external` | Externals connections (GitHub, Jira, Notion, …) — not “integration” |
263+
264+
Removed: `vcs`, `url`. VCS attaches as **external**.
265+
248266
### 3.2.0 VCS
249267

250268

internal-docs/BITCODE_SOURCE_LAYOUT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ packages/generic-<family>/ # README only (no package.json)
228228
| `artifact-generics/` | (package root) | `@bitcode/artifact-generics` (Artifact + storage contract) |
229229
| `generic-artifacts/` | `patch/` | `@bitcode/generic-artifacts-patch` (PatchArtifact base) |
230230
| `artifacts/` | (package root) | `@bitcode/artifacts` (S3/Supabase ArtifactStorage backend) |
231+
| `attachment-generics/` | (package root) | `@bitcode/attachment-generics` (file|external primitives) |
232+
| `generic-attachments/` | `file/`, `external/` | `@bitcode/generic-attachments-*` |
233+
| `attachments-generics/` | (package root) | BC barrel over attachment hierarchy |
231234
| `generic-doc-comment-plugins/` | `doc-developing/` | `@bitcode/doc-comment-developing` |
232235

233236
**Do not** put a root `package.json` on the family folder. Workspace globs are

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"packages/asset-packs/*",
2222
"packages/generic-asset-packs/*",
2323
"packages/generic-artifacts/*",
24+
"packages/generic-attachments/*",
2425
"packages/asset-packs-pipelines/*",
2526
"packages/generic-doc-comment-plugins/*",
2627
"packages/pipelines/*",

packages/api/src/conversations/__tests__/branch-conversation.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('branchConversation', () => {
103103
id: 'att-source-1',
104104
message_id: 'm1',
105105
attachment_id: 'repo-1',
106-
attachment_category: 'integration',
106+
attachment_category: 'external',
107107
attachment_type: 'github_repo',
108108
metadata: { token_type: 'source', title: 'bitcode/terminal' },
109109
created_at: new Date().toISOString(),
@@ -112,7 +112,7 @@ describe('branchConversation', () => {
112112
id: 'att-destination-1',
113113
message_id: 'm2',
114114
attachment_id: 'dest-1',
115-
attachment_category: 'integration',
115+
attachment_category: 'external',
116116
attachment_type: 'settlement_target',
117117
metadata: { token_type: 'destination', title: 'Settlement lane' },
118118
created_at: new Date().toISOString(),
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# @bitcode/attachment-generics
2+
3+
**Attachment** primitive contracts — base identity, admitted categories, and references.
4+
5+
## Hierarchy
6+
7+
```
8+
@bitcode/attachment-generics # this package (Attachment primitive)
9+
10+
@bitcode/generic-attachments-file # FileAttachment base
11+
@bitcode/generic-attachments-external # ExternalAttachment base (Externals auxillary)
12+
13+
product conversations / API / UI
14+
```
15+
16+
## Admitted categories (only)
17+
18+
| Category | Role |
19+
| --- | --- |
20+
| `file` | Direct file uploads |
21+
| `external` | Connections from Externals (GitHub VCS, Jira, Notion, …) |
22+
23+
**Not admitted (removed):** `vcs`, `url` — VCS/repo linking is an **external** connection; bare URLs are not a separate attachment category.
24+
25+
## Law
26+
27+
- Primitive does not own file MIME tables or provider payloads.
28+
- Bases live under `packages/generic-attachments/{file,external}/`.
29+
- **External** vocabulary aligns with the Externals auxillary (not “integration”).
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
preset: 'ts-jest/presets/js-with-ts',
3+
testEnvironment: 'node',
4+
testMatch: ['**/__tests__/**/*.test.ts'],
5+
moduleNameMapper: {
6+
'^@bitcode/attachment-generics$': '<rootDir>/src/index.ts',
7+
},
8+
globals: {
9+
'ts-jest': { tsconfig: '<rootDir>/../../tsconfig.json', diagnostics: false },
10+
},
11+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "@bitcode/attachment-generics",
3+
"version": "0.1.0",
4+
"private": true,
5+
"description": "Attachment primitive: BaseAttachment, categories file|external, references, type guards",
6+
"main": "src/index.ts",
7+
"types": "src/index.ts",
8+
"exports": {
9+
".": "./src/index.ts",
10+
"./types": "./src/types.ts"
11+
},
12+
"scripts": {
13+
"typecheck": "tsc --noEmit",
14+
"test": "pnpm exec jest --config jest.config.cjs --passWithNoTests"
15+
},
16+
"devDependencies": {
17+
"@types/jest": "^29.5.12",
18+
"@types/node": "^25.0.0",
19+
"jest": "^29.7.0",
20+
"ts-jest": "^29.1.1",
21+
"typescript": "^5.0.0"
22+
}
23+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {
2+
validateAttachmentCategory,
3+
isBaseAttachment,
4+
type BaseAttachment,
5+
} from '../index';
6+
7+
describe('attachment-generics primitives', () => {
8+
it('admits only file and external categories', () => {
9+
expect(validateAttachmentCategory('file')).toBe(true);
10+
expect(validateAttachmentCategory('external')).toBe(true);
11+
expect(validateAttachmentCategory('vcs')).toBe(false);
12+
expect(validateAttachmentCategory('url')).toBe(false);
13+
expect(validateAttachmentCategory('integration')).toBe(false);
14+
});
15+
16+
it('recognizes a base attachment shape', () => {
17+
const attachment: BaseAttachment = {
18+
id: 'att-1',
19+
category: 'file',
20+
title: 'Screenshot',
21+
created_at: new Date().toISOString(),
22+
};
23+
expect(isBaseAttachment(attachment)).toBe(true);
24+
});
25+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @bitcode/attachment-generics
3+
*
4+
* Attachment **primitive** — base fields, categories file|external, references.
5+
*
6+
* Prefer:
7+
* @bitcode/attachment-generics
8+
* @bitcode/generic-attachments-file
9+
* @bitcode/generic-attachments-external
10+
*
11+
* BC: @bitcode/attachments-generics re-exports this surface + bases.
12+
*/
13+
14+
export type {
15+
AttachmentCategory,
16+
BaseAttachment,
17+
AttachmentReference,
18+
CreateAttachmentInput,
19+
} from './types';
20+
export {
21+
isAttachmentCategory,
22+
validateAttachmentCategory,
23+
isBaseAttachment,
24+
} from './types';

0 commit comments

Comments
 (0)