@principal-ai/subsystems-core 0.50.0 → 0.51.0

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/node.d.ts CHANGED
@@ -9,8 +9,7 @@
9
9
  export * from './types';
10
10
  export { TopicStore, PRINCIPAL_DIR, TOPICS_DIR, LEGACY_TOPICS_BLOB, } from './storage/topicStore';
11
11
  export type { TopicIndexEntry, TopicCreate, TopicUpdate, MigrationResult, } from './storage/topicStore';
12
- export { publishedFromDraft } from './storage/topic-types';
13
- export type { DraftTopic, PublishedTopic, PublishProjection, TopicStatus, TopicAsset, TopicCreator, TopicSubsystemModelRef, } from './storage/topic-types';
12
+ export type { DraftTopic, TopicAsset, TopicCreator, TopicSubsystemModelRef, } from './storage/topic-types';
14
13
  export { OpenCodeEventStore, defaultOpenCodeDBPath } from './opencode/OpenCodeEventStore';
15
14
  export type { OpenCodeRawEvent, OpenCodeSessionEvents, OpenCodeEventRetriever, OpenCodeStoreOptions, SessionSummary, SessionListResult, } from './opencode/types';
16
15
  export { listAgentSessions, detectAgent, fetchRawEvents } from './opencode/agent-sessions';
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,UAAU,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EACV,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,+BA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O,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3F,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,4BAA4B,EAC5B,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/node.js CHANGED
@@ -22,7 +22,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
22
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.opencodeRowsToUniversalEvents = exports.collectRepositories = exports.accumulateEvents = exports.normalizeEventsWithAdapter = exports.normalizeEvents = exports.NodePathNormalizationAdapter = exports.buildAgentSessionFixture = exports.fetchRawEvents = exports.detectAgent = exports.listAgentSessions = exports.defaultOpenCodeDBPath = exports.OpenCodeEventStore = exports.publishedFromDraft = exports.LEGACY_TOPICS_BLOB = exports.TOPICS_DIR = exports.PRINCIPAL_DIR = exports.TopicStore = void 0;
25
+ exports.opencodeRowsToUniversalEvents = exports.collectRepositories = exports.accumulateEvents = exports.normalizeEventsWithAdapter = exports.normalizeEvents = exports.NodePathNormalizationAdapter = exports.buildAgentSessionFixture = exports.fetchRawEvents = exports.detectAgent = exports.listAgentSessions = exports.defaultOpenCodeDBPath = exports.OpenCodeEventStore = exports.LEGACY_TOPICS_BLOB = exports.TOPICS_DIR = exports.PRINCIPAL_DIR = exports.TopicStore = void 0;
26
26
  __exportStar(require("./types"), exports);
27
27
  // File-per-topic store (~/.principal/topics) — node:fs only
28
28
  var topicStore_1 = require("./storage/topicStore");
@@ -30,8 +30,6 @@ Object.defineProperty(exports, "TopicStore", { enumerable: true, get: function (
30
30
  Object.defineProperty(exports, "PRINCIPAL_DIR", { enumerable: true, get: function () { return topicStore_1.PRINCIPAL_DIR; } });
31
31
  Object.defineProperty(exports, "TOPICS_DIR", { enumerable: true, get: function () { return topicStore_1.TOPICS_DIR; } });
32
32
  Object.defineProperty(exports, "LEGACY_TOPICS_BLOB", { enumerable: true, get: function () { return topicStore_1.LEGACY_TOPICS_BLOB; } });
33
- var topic_types_1 = require("./storage/topic-types");
34
- Object.defineProperty(exports, "publishedFromDraft", { enumerable: true, get: function () { return topic_types_1.publishedFromDraft; } });
35
33
  // OpenCode event retrieval (Node.js only - SQLite)
36
34
  var OpenCodeEventStore_1 = require("./opencode/OpenCodeEventStore");
37
35
  Object.defineProperty(exports, "OpenCodeEventStore", { enumerable: true, get: function () { return OpenCodeEventStore_1.OpenCodeEventStore; } });
package/dist/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AAExB,4DAA4D;AAC5D,mDAK8B;AAJ5B,wGAAA,UAAU,OAAA;AACV,2GAAA,aAAa,OAAA;AACb,wGAAA,UAAU,OAAA;AACV,gHAAA,kBAAkB,OAAA;AAQpB,qDAA2D;AAAlD,iHAAA,kBAAkB,OAAA;AAW3B,mDAAmD;AACnD,oEAA0F;AAAjF,wHAAA,kBAAkB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AAUlD,iEAAiE;AACjE,4DAA2F;AAAlF,mHAAA,iBAAiB,OAAA;AAAE,6GAAA,WAAW,OAAA;AAAE,gHAAA,cAAc,OAAA;AAOvD,mDAAmD;AACnD,oDAAoE;AAA3D,mHAAA,wBAAwB,OAAA;AAWjC,sEAAsE;AACtE,gDAO6B;AAN3B,wHAAA,4BAA4B,OAAA;AAC5B,2GAAA,eAAe,OAAA;AACf,sHAAA,0BAA0B,OAAA;AAC1B,4GAAA,gBAAgB,OAAA;AAChB,+GAAA,mBAAmB,OAAA;AACnB,yHAAA,6BAA6B,OAAA"}
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AAExB,4DAA4D;AAC5D,mDAK8B;AAJ5B,wGAAA,UAAU,OAAA;AACV,2GAAA,aAAa,OAAA;AACb,wGAAA,UAAU,OAAA;AACV,gHAAA,kBAAkB,OAAA;AAepB,mDAAmD;AACnD,oEAA0F;AAAjF,wHAAA,kBAAkB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AAUlD,iEAAiE;AACjE,4DAA2F;AAAlF,mHAAA,iBAAiB,OAAA;AAAE,6GAAA,WAAW,OAAA;AAAE,gHAAA,cAAc,OAAA;AAOvD,mDAAmD;AACnD,oDAAoE;AAA3D,mHAAA,wBAAwB,OAAA;AAWjC,sEAAsE;AACtE,gDAO6B;AAN3B,wHAAA,4BAA4B,OAAA;AAC5B,2GAAA,eAAe,OAAA;AACf,sHAAA,0BAA0B,OAAA;AAC1B,4GAAA,gBAAgB,OAAA;AAChB,+GAAA,mBAAmB,OAAA;AACnB,yHAAA,6BAA6B,OAAA"}
@@ -3,75 +3,24 @@
3
3
  * agrees on. Browser-safe (no `node:*`); the file-per-topic store that reads and
4
4
  * writes these lives in `./node` (see `topicStore.ts`).
5
5
  *
6
- * A **topic** is a locally authored subject brief that may be published. Two
7
- * distinct named shapes, split by id-namespace / ownership, with an explicit
8
- * translation between them — NOT one shared shape. Their `id` fields live in
9
- * different namespaces (local vs server), so passing one where the other is
10
- * expected corrupts topic identity.
6
+ * A **topic** is a locally authored subject brief. {@link DraftTopic} is the
7
+ * shape desktop persists to `~/.principal/topics/<id>.json` and edits.
11
8
  *
12
- * - {@link DraftTopic} — locally-authored, what desktop persists + edits.
13
- * - {@link PublishedTopic} — server-authoritative, what the server returns and
14
- * mobile reads.
15
- * - {@link publishedFromDraft} — the Draft -> Published projection (one-way;
16
- * there is no reverse hydration).
17
- *
18
- * All timestamps are ISO 8601 strings because this contract crosses the
19
- * desktop/web boundary.
20
- */
21
- /**
22
- * Status of a topic — a small structured axis plus optional human nuance.
23
- *
24
- * `state` is the machine-meaningful signal (drives badge color, sorting, and
25
- * filtering). `label` is free-form text shown in place of the default per-state
26
- * label. `waitingOn` describes an external blocker and is meaningful when
27
- * `state` is `waiting`.
28
- *
29
- * The structured shape is deliberate: it lets automations check and resolve a
30
- * blocker without parsing prose — e.g. flip `waiting` -> `paused` once `until`
31
- * passes, or once a referenced PR merges.
9
+ * All timestamps are ISO 8601 strings.
32
10
  */
33
- export interface TopicStatus {
34
- /**
35
- * Structured lifecycle axis, ordered by a feature's "aliveness" from nascent
36
- * to retired. Readers treat an absent OR unrecognized `state` as
37
- * `new-thought`, so legacy topics and renamed values need no migration.
38
- */
39
- state: 'new-thought' | 'working' | 'paused' | 'waiting' | 'done-for-now' | 'deprecated' | 'abandoned';
40
- /** Free-form text shown in place of the default label for the state. */
41
- label?: string;
42
- /** External blocker description. Meaningful when `state` is `waiting`. */
43
- waitingOn?: {
44
- /** Human description of the blocker, e.g. "design sign-off". */
45
- note?: string;
46
- /** ISO 8601 — when the hold is expected to lift. */
47
- until?: string;
48
- /** Structured pointer to the thing being waited on, for automations. */
49
- ref?: {
50
- kind: 'url' | 'pr' | 'issue' | 'topic';
51
- /** The address/id of the referenced thing. */
52
- value: string;
53
- /** Optional human label for display. */
54
- title?: string;
55
- };
56
- };
57
- }
58
11
  /**
59
12
  * An image attached to a topic — primarily a screenshot dragged into the
60
13
  * description. Bytes live on the topic (referenced from the description via an
61
14
  * `asset://<id>` markdown link), not inlined into the description string. A
62
15
  * render-time resolver swaps `asset://<id>` for `url` (preferred) or a data-URL
63
- * built from `data`, keeping a local (data-only) and a published (url-bearing)
64
- * topic interchangeable on read.
65
- *
66
- * Local-only on a {@link DraftTopic}: assets are uploaded/resolved at publish
67
- * time, so a {@link PublishedTopic} carries the resolved `url`, not raw `data`.
16
+ * built from `data`.
68
17
  */
69
18
  export interface TopicAsset {
70
19
  /** Content hash — free dedup and the stable `asset://` target. */
71
20
  id: string;
72
21
  /** MIME type, e.g. "image/png". */
73
22
  mime: string;
74
- /** Base64-encoded bytes. Present locally and on publish. */
23
+ /** Base64-encoded bytes. */
75
24
  data?: string;
76
25
  /** Resolvable URL, when the bytes have been offloaded (e.g. to S3). */
77
26
  url?: string;
@@ -86,7 +35,7 @@ export interface TopicAsset {
86
35
  /**
87
36
  * GitHub identity of a topic's creator. Populated when a signed-in user
88
37
  * authors a topic; left undefined for local-only topics created before
89
- * sign-in. The server requires this on publish.
38
+ * sign-in.
90
39
  */
91
40
  export interface TopicCreator {
92
41
  githubId: number;
@@ -97,8 +46,8 @@ export interface TopicCreator {
97
46
  * specific runtime trails (flows) within that model.
98
47
  *
99
48
  * The link lives on the **topic** side, in the local store id namespace, and
100
- * never on the model: a subsystem-model document is a portable, host-free
101
- * artifact (shared/published) that must not embed local topic or store ids.
49
+ * never on the model: a subsystem-model document is a portable artifact that
50
+ * must not embed local topic or store ids.
102
51
  */
103
52
  export interface TopicSubsystemModelRef {
104
53
  /** Store-assigned model id, e.g. "sg-1781...". */
@@ -110,14 +59,9 @@ export interface TopicSubsystemModelRef {
110
59
  * Locally-authored topic — the shape desktop persists to
111
60
  * `~/.principal/topics/<id>.json` and edits.
112
61
  *
113
- * Local id namespace. `description` / `createdBy` are optional (a Draft may be
114
- * authored before sign-in). Carries local-only {@link TopicAsset}s
115
- * (`asset://<id>` screenshots, raw `data`). Has NO `visibility` — that's a
116
- * published concept.
117
- *
118
- * A Draft keeps existing after publish (it can be in a "published state"); its
119
- * link to the server identity lives in the desktop's `topics-sync.json`
120
- * sidecar, not in this shape.
62
+ * `description` / `createdBy` are optional (a Draft may be authored before
63
+ * sign-in). Carries local-only {@link TopicAsset}s (`asset://<id>` screenshots,
64
+ * raw `data`).
121
65
  */
122
66
  export interface DraftTopic {
123
67
  /** Unique identifier in the LOCAL id namespace. */
@@ -131,7 +75,7 @@ export interface DraftTopic {
131
75
  * `pkg:github/owner/repo`). The topic's own source of truth for "which repos"
132
76
  * — portable and machine-independent, matching `WorkspaceMembership.repositoryId`.
133
77
  * Machine-local clone paths stay a workspace-membership concern and never
134
- * appear here, so this round-trips across machines on publish/fetch.
78
+ * appear here, so this round-trips across machines.
135
79
  */
136
80
  repos?: string[];
137
81
  /** ISO 8601. */
@@ -140,74 +84,12 @@ export interface DraftTopic {
140
84
  updatedAt: string;
141
85
  /** Creator identity; undefined for topics authored before sign-in. */
142
86
  createdBy?: TopicCreator;
143
- /** Optional workflow status. Absent reads as `new-thought`. */
144
- status?: TopicStatus;
145
87
  /** Local image attachments, referenced from the description via `asset://<id>`. */
146
88
  assets?: TopicAsset[];
147
89
  /**
148
- * Subsystem models this topic concerns, as local store ids. Local-only: not
149
- * carried on publish, since the referenced models are a local artifact.
90
+ * Subsystem models this topic concerns, as local store ids. Local-only, since
91
+ * the referenced models are a local artifact.
150
92
  */
151
93
  subsystemModels?: TopicSubsystemModelRef[];
152
94
  }
153
- /**
154
- * Server-authoritative topic — the shape the server returns and mobile reads.
155
- *
156
- * Remote id namespace. `description` / `createdBy` are required (publish is the
157
- * validation gate). Carries `visibility`; assets have been resolved to `url`s.
158
- *
159
- * CAVEAT: "Published" means "has a server identity", NOT "public" — a
160
- * PublishedTopic can be `visibility: 'private'`.
161
- */
162
- export interface PublishedTopic {
163
- /** Unique identifier in the REMOTE (server) id namespace. */
164
- id: string;
165
- /** Display title. */
166
- title: string;
167
- /** Markdown body — required on the server. */
168
- description: string;
169
- /**
170
- * Repositories this topic is about, as PURL strings (e.g.
171
- * `pkg:github/owner/repo`). Travels with the topic across the wire so a
172
- * received shared topic carries its repos; preserved on publish/fetch.
173
- */
174
- repos?: string[];
175
- /** ISO 8601. */
176
- createdAt: string;
177
- /** ISO 8601. */
178
- updatedAt: string;
179
- /** Creator identity — required on the server. */
180
- createdBy: TopicCreator;
181
- /** Optional workflow status, travels with the topic when published. */
182
- status?: TopicStatus;
183
- /** Server visibility. "private" is still a PublishedTopic. */
184
- visibility: 'private' | 'public';
185
- }
186
- /**
187
- * Inputs the {@link DraftTopic} cannot supply on its own — the namespace
188
- * crossing and the fields publish must enforce. The caller resolves these
189
- * before projecting:
190
- * - `createdBy`: required on the server; supplied here if the draft lacks it.
191
- * - `visibility`: a published concept the draft never carries.
192
- */
193
- export interface PublishProjection {
194
- createdBy: TopicCreator;
195
- visibility: 'private' | 'public';
196
- }
197
- /**
198
- * Project a {@link DraftTopic} into a {@link PublishedTopic} — the one-way
199
- * Draft -> Published translation. It does NOT perform any I/O (no id minting,
200
- * no asset upload, no network): the caller resolves the namespace-crossing and
201
- * required fields into {@link PublishProjection} first (uploading assets,
202
- * choosing visibility), and this enforces the shape.
203
- *
204
- * One-way by design: there is no reverse `PublishedTopic -> DraftTopic`
205
- * hydration. A published topic's edits write through to the server; the local
206
- * Draft is reconciled from the server's response field-by-field, never by
207
- * rebuilding a Draft from a Published shape.
208
- *
209
- * Throws if `description` is empty — publish is also the validation gate, and
210
- * the server rejects a description-less topic.
211
- */
212
- export declare function publishedFromDraft(draft: DraftTopic, projection: PublishProjection): PublishedTopic;
213
95
  //# sourceMappingURL=topic-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"topic-types.d.ts","sourceRoot":"","sources":["../../src/storage/topic-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,KAAK,EACH,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,cAAc,GAA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node:*`); the file-per-topic store that reads and
5
5
  * writes these lives in `./node` (see `topicStore.ts`).
6
6
  *
7
- * A **topic** is a locally authored subject brief that may be published. Two
8
- * distinct named shapes, split by id-namespace / ownership, with an explicit
9
- * translation between them — NOT one shared shape. Their `id` fields live in
10
- * different namespaces (local vs server), so passing one where the other is
11
- * expected corrupts topic identity.
7
+ * A **topic** is a locally authored subject brief. {@link DraftTopic} is the
8
+ * shape desktop persists to `~/.principal/topics/<id>.json` and edits.
12
9
  *
13
- * - {@link DraftTopic} — locally-authored, what desktop persists + edits.
14
- * - {@link PublishedTopic} — server-authoritative, what the server returns and
15
- * mobile reads.
16
- * - {@link publishedFromDraft} — the Draft -> Published projection (one-way;
17
- * there is no reverse hydration).
18
- *
19
- * All timestamps are ISO 8601 strings because this contract crosses the
20
- * desktop/web boundary.
10
+ * All timestamps are ISO 8601 strings.
21
11
  */
22
12
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.publishedFromDraft = void 0;
24
- /**
25
- * Project a {@link DraftTopic} into a {@link PublishedTopic} — the one-way
26
- * Draft -> Published translation. It does NOT perform any I/O (no id minting,
27
- * no asset upload, no network): the caller resolves the namespace-crossing and
28
- * required fields into {@link PublishProjection} first (uploading assets,
29
- * choosing visibility), and this enforces the shape.
30
- *
31
- * One-way by design: there is no reverse `PublishedTopic -> DraftTopic`
32
- * hydration. A published topic's edits write through to the server; the local
33
- * Draft is reconciled from the server's response field-by-field, never by
34
- * rebuilding a Draft from a Published shape.
35
- *
36
- * Throws if `description` is empty — publish is also the validation gate, and
37
- * the server rejects a description-less topic.
38
- */
39
- function publishedFromDraft(draft, projection) {
40
- const description = (draft.description ?? '').trim();
41
- if (description.length === 0) {
42
- throw new Error(`Topic ${draft.id} has no description; a description is required to publish.`);
43
- }
44
- return {
45
- id: draft.id,
46
- title: draft.title,
47
- description,
48
- ...(draft.repos !== undefined ? { repos: draft.repos } : {}),
49
- createdAt: draft.createdAt,
50
- updatedAt: draft.updatedAt,
51
- createdBy: projection.createdBy,
52
- ...(draft.status !== undefined ? { status: draft.status } : {}),
53
- visibility: projection.visibility,
54
- };
55
- }
56
- exports.publishedFromDraft = publishedFromDraft;
57
13
  //# sourceMappingURL=topic-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"topic-types.js","sourceRoot":"","sources":["../../src/storage/topic-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAuLH;;;;;;;;;;;;;;GAcG;AACH,SAAgB,kBAAkB,CAChC,KAAiB,EACjB,UAA6B;IAE7B,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,CAAC,EAAE,4DAA4D,CAAC,CAAC;KAChG;IACD,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,WAAW;QACX,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,UAAU,EAAE,UAAU,CAAC,UAAU;KAClC,CAAC;AACJ,CAAC;AAnBD,gDAmBC"}
1
+ {"version":3,"file":"topic-types.js","sourceRoot":"","sources":["../../src/storage/topic-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG"}
@@ -23,7 +23,7 @@
23
23
  * (`migrateFromLegacyBlob`) — it is never run automatically on load; the desktop
24
24
  * triggers it from a Settings action.
25
25
  */
26
- import type { DraftTopic, TopicStatus } from './topic-types';
26
+ import type { DraftTopic } from './topic-types';
27
27
  /** Root of the global, cross-repo principal narration store. */
28
28
  export declare const PRINCIPAL_DIR: string;
29
29
  /** File-per-topic directory. */
@@ -39,8 +39,6 @@ export interface TopicIndexEntry {
39
39
  id: string;
40
40
  title: string;
41
41
  descriptionPreview: string;
42
- /** `status.state` lifted out for filtering/sorting without a file read. */
43
- state?: TopicStatus['state'];
44
42
  createdAt: string;
45
43
  updatedAt: string;
46
44
  createdBy?: {
@@ -66,7 +64,7 @@ export interface MigrationResult {
66
64
  * Fields a caller may set when updating a topic. `id` and `createdAt` are set
67
65
  * once at creation and cannot be changed by an update.
68
66
  */
69
- export type TopicUpdate = Partial<Pick<DraftTopic, 'title' | 'description' | 'status' | 'createdBy' | 'assets' | 'repos' | 'subsystemModels'>>;
67
+ export type TopicUpdate = Partial<Pick<DraftTopic, 'title' | 'description' | 'createdBy' | 'assets' | 'repos' | 'subsystemModels'>>;
70
68
  /**
71
69
  * Fields a caller may set when creating a topic. `id`, `createdAt`,
72
70
  * `updatedAt` are filled in when omitted; passing `id` lets a caller control
@@ -1 +1 @@
1
- {"version":3,"file":"topicStore.d.ts","sourceRoot":"","sources":["../../src/storage/topicStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7D,gEAAgE;AAChE,eAAO,MAAM,aAAa,QAAgC,CAAC;AAC3D,gCAAgC;AAChC,eAAO,MAAM,UAAU,QAAgC,CAAC;AACxD,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,QAAgD,CAAC;AAKhF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM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MAAmB,EAAE,cAAc,GAAE,MAA2B;IAQrF;;;;;;;;;OASG;IACG,SAAS,CAAC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAUrE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAOtD;;;;;OAKG;IACG,IAAI,CAAC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAKrE,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAkBpD,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAclE,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAa/C;;;;;;;;;;OAUG;IACG,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC;YAmEzC,QAAQ;YAQR,YAAY;IAQ1B,4EAA4E;YAC9D,UAAU;YAaV,SAAS;YAUT,cAAc;YAWd,UAAU;YASV,SAAS;IAkBvB,2EAA2E;YAC7D,YAAY;IA2B1B,OAAO,CAAC,YAAY;CAWrB"}
@@ -54,7 +54,6 @@ const buildEntry = (topic, sizeBytes) => ({
54
54
  id: topic.id,
55
55
  title: topic.title || 'Untitled topic',
56
56
  descriptionPreview: descriptionPreview(topic.description),
57
- state: topic.status?.state,
58
57
  createdAt: topic.createdAt,
59
58
  updatedAt: topic.updatedAt,
60
59
  createdBy: topic.createdBy,
@@ -1 +1 @@
1
- {"version":3,"file":"topicStore.js","sourceRoot":"","sources":["../../src/storage/topicStore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;AAEH,qCAAkC;AAClC,yCAA0C;AAC1C,+CAA+F;AAG/F,gEAAgE;AAC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I,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU;aAC9B,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;aACtB,IAAI,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,IAAA,gBAAK,EAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC/C,MAAM,IAAA,oBAAS,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;QACL,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF;AA1SD,gCA0SC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/subsystems-core",
3
- "version": "0.50.0",
3
+ "version": "0.51.0",
4
4
  "description": "Subsystem model types and agent-session tooling for Principal AI",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/src/node.ts CHANGED
@@ -22,12 +22,8 @@ export type {
22
22
  TopicUpdate,
23
23
  MigrationResult,
24
24
  } from './storage/topicStore';
25
- export { publishedFromDraft } from './storage/topic-types';
26
25
  export type {
27
26
  DraftTopic,
28
- PublishedTopic,
29
- PublishProjection,
30
- TopicStatus,
31
27
  TopicAsset,
32
28
  TopicCreator,
33
29
  TopicSubsystemModelRef,
@@ -3,78 +3,25 @@
3
3
  * agrees on. Browser-safe (no `node:*`); the file-per-topic store that reads and
4
4
  * writes these lives in `./node` (see `topicStore.ts`).
5
5
  *
6
- * A **topic** is a locally authored subject brief that may be published. Two
7
- * distinct named shapes, split by id-namespace / ownership, with an explicit
8
- * translation between them — NOT one shared shape. Their `id` fields live in
9
- * different namespaces (local vs server), so passing one where the other is
10
- * expected corrupts topic identity.
6
+ * A **topic** is a locally authored subject brief. {@link DraftTopic} is the
7
+ * shape desktop persists to `~/.principal/topics/<id>.json` and edits.
11
8
  *
12
- * - {@link DraftTopic} — locally-authored, what desktop persists + edits.
13
- * - {@link PublishedTopic} — server-authoritative, what the server returns and
14
- * mobile reads.
15
- * - {@link publishedFromDraft} — the Draft -> Published projection (one-way;
16
- * there is no reverse hydration).
17
- *
18
- * All timestamps are ISO 8601 strings because this contract crosses the
19
- * desktop/web boundary.
20
- */
21
-
22
- /**
23
- * Status of a topic — a small structured axis plus optional human nuance.
24
- *
25
- * `state` is the machine-meaningful signal (drives badge color, sorting, and
26
- * filtering). `label` is free-form text shown in place of the default per-state
27
- * label. `waitingOn` describes an external blocker and is meaningful when
28
- * `state` is `waiting`.
29
- *
30
- * The structured shape is deliberate: it lets automations check and resolve a
31
- * blocker without parsing prose — e.g. flip `waiting` -> `paused` once `until`
32
- * passes, or once a referenced PR merges.
9
+ * All timestamps are ISO 8601 strings.
33
10
  */
34
- export interface TopicStatus {
35
- /**
36
- * Structured lifecycle axis, ordered by a feature's "aliveness" from nascent
37
- * to retired. Readers treat an absent OR unrecognized `state` as
38
- * `new-thought`, so legacy topics and renamed values need no migration.
39
- */
40
- state:
41
- 'new-thought' | 'working' | 'paused' | 'waiting' | 'done-for-now' | 'deprecated' | 'abandoned';
42
- /** Free-form text shown in place of the default label for the state. */
43
- label?: string;
44
- /** External blocker description. Meaningful when `state` is `waiting`. */
45
- waitingOn?: {
46
- /** Human description of the blocker, e.g. "design sign-off". */
47
- note?: string;
48
- /** ISO 8601 — when the hold is expected to lift. */
49
- until?: string;
50
- /** Structured pointer to the thing being waited on, for automations. */
51
- ref?: {
52
- kind: 'url' | 'pr' | 'issue' | 'topic';
53
- /** The address/id of the referenced thing. */
54
- value: string;
55
- /** Optional human label for display. */
56
- title?: string;
57
- };
58
- };
59
- }
60
11
 
61
12
  /**
62
13
  * An image attached to a topic — primarily a screenshot dragged into the
63
14
  * description. Bytes live on the topic (referenced from the description via an
64
15
  * `asset://<id>` markdown link), not inlined into the description string. A
65
16
  * render-time resolver swaps `asset://<id>` for `url` (preferred) or a data-URL
66
- * built from `data`, keeping a local (data-only) and a published (url-bearing)
67
- * topic interchangeable on read.
68
- *
69
- * Local-only on a {@link DraftTopic}: assets are uploaded/resolved at publish
70
- * time, so a {@link PublishedTopic} carries the resolved `url`, not raw `data`.
17
+ * built from `data`.
71
18
  */
72
19
  export interface TopicAsset {
73
20
  /** Content hash — free dedup and the stable `asset://` target. */
74
21
  id: string;
75
22
  /** MIME type, e.g. "image/png". */
76
23
  mime: string;
77
- /** Base64-encoded bytes. Present locally and on publish. */
24
+ /** Base64-encoded bytes. */
78
25
  data?: string;
79
26
  /** Resolvable URL, when the bytes have been offloaded (e.g. to S3). */
80
27
  url?: string;
@@ -87,7 +34,7 @@ export interface TopicAsset {
87
34
  /**
88
35
  * GitHub identity of a topic's creator. Populated when a signed-in user
89
36
  * authors a topic; left undefined for local-only topics created before
90
- * sign-in. The server requires this on publish.
37
+ * sign-in.
91
38
  */
92
39
  export interface TopicCreator {
93
40
  githubId: number;
@@ -99,8 +46,8 @@ export interface TopicCreator {
99
46
  * specific runtime trails (flows) within that model.
100
47
  *
101
48
  * The link lives on the **topic** side, in the local store id namespace, and
102
- * never on the model: a subsystem-model document is a portable, host-free
103
- * artifact (shared/published) that must not embed local topic or store ids.
49
+ * never on the model: a subsystem-model document is a portable artifact that
50
+ * must not embed local topic or store ids.
104
51
  */
105
52
  export interface TopicSubsystemModelRef {
106
53
  /** Store-assigned model id, e.g. "sg-1781...". */
@@ -113,14 +60,9 @@ export interface TopicSubsystemModelRef {
113
60
  * Locally-authored topic — the shape desktop persists to
114
61
  * `~/.principal/topics/<id>.json` and edits.
115
62
  *
116
- * Local id namespace. `description` / `createdBy` are optional (a Draft may be
117
- * authored before sign-in). Carries local-only {@link TopicAsset}s
118
- * (`asset://<id>` screenshots, raw `data`). Has NO `visibility` — that's a
119
- * published concept.
120
- *
121
- * A Draft keeps existing after publish (it can be in a "published state"); its
122
- * link to the server identity lives in the desktop's `topics-sync.json`
123
- * sidecar, not in this shape.
63
+ * `description` / `createdBy` are optional (a Draft may be authored before
64
+ * sign-in). Carries local-only {@link TopicAsset}s (`asset://<id>` screenshots,
65
+ * raw `data`).
124
66
  */
125
67
  export interface DraftTopic {
126
68
  /** Unique identifier in the LOCAL id namespace. */
@@ -134,7 +76,7 @@ export interface DraftTopic {
134
76
  * `pkg:github/owner/repo`). The topic's own source of truth for "which repos"
135
77
  * — portable and machine-independent, matching `WorkspaceMembership.repositoryId`.
136
78
  * Machine-local clone paths stay a workspace-membership concern and never
137
- * appear here, so this round-trips across machines on publish/fetch.
79
+ * appear here, so this round-trips across machines.
138
80
  */
139
81
  repos?: string[];
140
82
  /** ISO 8601. */
@@ -143,95 +85,11 @@ export interface DraftTopic {
143
85
  updatedAt: string;
144
86
  /** Creator identity; undefined for topics authored before sign-in. */
145
87
  createdBy?: TopicCreator;
146
- /** Optional workflow status. Absent reads as `new-thought`. */
147
- status?: TopicStatus;
148
88
  /** Local image attachments, referenced from the description via `asset://<id>`. */
149
89
  assets?: TopicAsset[];
150
90
  /**
151
- * Subsystem models this topic concerns, as local store ids. Local-only: not
152
- * carried on publish, since the referenced models are a local artifact.
91
+ * Subsystem models this topic concerns, as local store ids. Local-only, since
92
+ * the referenced models are a local artifact.
153
93
  */
154
94
  subsystemModels?: TopicSubsystemModelRef[];
155
95
  }
156
-
157
- /**
158
- * Server-authoritative topic — the shape the server returns and mobile reads.
159
- *
160
- * Remote id namespace. `description` / `createdBy` are required (publish is the
161
- * validation gate). Carries `visibility`; assets have been resolved to `url`s.
162
- *
163
- * CAVEAT: "Published" means "has a server identity", NOT "public" — a
164
- * PublishedTopic can be `visibility: 'private'`.
165
- */
166
- export interface PublishedTopic {
167
- /** Unique identifier in the REMOTE (server) id namespace. */
168
- id: string;
169
- /** Display title. */
170
- title: string;
171
- /** Markdown body — required on the server. */
172
- description: string;
173
- /**
174
- * Repositories this topic is about, as PURL strings (e.g.
175
- * `pkg:github/owner/repo`). Travels with the topic across the wire so a
176
- * received shared topic carries its repos; preserved on publish/fetch.
177
- */
178
- repos?: string[];
179
- /** ISO 8601. */
180
- createdAt: string;
181
- /** ISO 8601. */
182
- updatedAt: string;
183
- /** Creator identity — required on the server. */
184
- createdBy: TopicCreator;
185
- /** Optional workflow status, travels with the topic when published. */
186
- status?: TopicStatus;
187
- /** Server visibility. "private" is still a PublishedTopic. */
188
- visibility: 'private' | 'public';
189
- }
190
-
191
- /**
192
- * Inputs the {@link DraftTopic} cannot supply on its own — the namespace
193
- * crossing and the fields publish must enforce. The caller resolves these
194
- * before projecting:
195
- * - `createdBy`: required on the server; supplied here if the draft lacks it.
196
- * - `visibility`: a published concept the draft never carries.
197
- */
198
- export interface PublishProjection {
199
- createdBy: TopicCreator;
200
- visibility: 'private' | 'public';
201
- }
202
-
203
- /**
204
- * Project a {@link DraftTopic} into a {@link PublishedTopic} — the one-way
205
- * Draft -> Published translation. It does NOT perform any I/O (no id minting,
206
- * no asset upload, no network): the caller resolves the namespace-crossing and
207
- * required fields into {@link PublishProjection} first (uploading assets,
208
- * choosing visibility), and this enforces the shape.
209
- *
210
- * One-way by design: there is no reverse `PublishedTopic -> DraftTopic`
211
- * hydration. A published topic's edits write through to the server; the local
212
- * Draft is reconciled from the server's response field-by-field, never by
213
- * rebuilding a Draft from a Published shape.
214
- *
215
- * Throws if `description` is empty — publish is also the validation gate, and
216
- * the server rejects a description-less topic.
217
- */
218
- export function publishedFromDraft(
219
- draft: DraftTopic,
220
- projection: PublishProjection
221
- ): PublishedTopic {
222
- const description = (draft.description ?? '').trim();
223
- if (description.length === 0) {
224
- throw new Error(`Topic ${draft.id} has no description; a description is required to publish.`);
225
- }
226
- return {
227
- id: draft.id,
228
- title: draft.title,
229
- description,
230
- ...(draft.repos !== undefined ? { repos: draft.repos } : {}),
231
- createdAt: draft.createdAt,
232
- updatedAt: draft.updatedAt,
233
- createdBy: projection.createdBy,
234
- ...(draft.status !== undefined ? { status: draft.status } : {}),
235
- visibility: projection.visibility,
236
- };
237
- }
@@ -7,7 +7,6 @@ import { mkdtempSync, rmSync, writeFileSync, existsSync, readFileSync } from 'fs
7
7
  import { tmpdir } from 'os';
8
8
  import { join } from 'path';
9
9
  import { TopicStore } from './topicStore';
10
- import { publishedFromDraft, type DraftTopic } from './topic-types';
11
10
 
12
11
  let dir: string;
13
12
  let topicsDir: string;
@@ -74,26 +73,6 @@ describe('CRUD', () => {
74
73
  expect(updated.repos).toEqual(['pkg:github/acme/web', 'pkg:github/acme/api']);
75
74
  });
76
75
 
77
- test('publishedFromDraft carries repos through the projection', () => {
78
- const draft: DraftTopic = {
79
- id: 'topic-pub',
80
- title: 'Pub',
81
- description: 'has a description',
82
- repos: ['pkg:github/acme/web'],
83
- subsystemModels: [{ modelId: 'sg-1-abc', trailIds: ['trail-a'] }],
84
- createdAt: '2026-01-01T00:00:00.000Z',
85
- updatedAt: '2026-01-02T00:00:00.000Z',
86
- };
87
- const published = publishedFromDraft(draft, {
88
- createdBy: { githubId: 1, githubLogin: 'u1' },
89
- visibility: 'private',
90
- });
91
- expect(published.repos).toEqual(['pkg:github/acme/web']);
92
- expect(published).not.toHaveProperty('trailIds');
93
- // Local-only model refs must not travel on publish.
94
- expect(published).not.toHaveProperty('subsystemModels');
95
- });
96
-
97
76
  test('subsystemModels persist on create and are updatable', async () => {
98
77
  const store = makeStore();
99
78
  const created = await store.createTopic({
@@ -188,6 +167,7 @@ describe('index rebuild', () => {
188
167
  const legacy = {
189
168
  ...JSON.parse(readFileSync(topicPath, 'utf8')),
190
169
  trailIds: ['old-trail'],
170
+ status: { state: 'working', label: 'in flight' },
191
171
  description: 'Keep this description',
192
172
  };
193
173
  writeFileSync(topicPath, JSON.stringify(legacy), 'utf8');
@@ -201,6 +181,9 @@ describe('index rebuild', () => {
201
181
  repos: ['pkg:github/a/b'],
202
182
  });
203
183
  expect(loaded).toHaveProperty('trailIds', ['old-trail']);
184
+ // `status` was removed from the contract; legacy files still load and are
185
+ // read back verbatim until the desktop cleans them up.
186
+ expect(loaded).toHaveProperty('status', { state: 'working', label: 'in flight' });
204
187
  expect(JSON.parse(readFileSync(topicPath, 'utf8'))).toHaveProperty('trailIds', ['old-trail']);
205
188
  });
206
189
  });
@@ -27,7 +27,7 @@
27
27
  import { homedir } from 'node:os';
28
28
  import { dirname, join } from 'node:path';
29
29
  import { mkdir, readFile, writeFile, unlink, readdir, rename, access } from 'node:fs/promises';
30
- import type { DraftTopic, TopicStatus } from './topic-types';
30
+ import type { DraftTopic } from './topic-types';
31
31
 
32
32
  /** Root of the global, cross-repo principal narration store. */
33
33
  export const PRINCIPAL_DIR = join(homedir(), '.principal');
@@ -48,8 +48,6 @@ export interface TopicIndexEntry {
48
48
  id: string;
49
49
  title: string;
50
50
  descriptionPreview: string;
51
- /** `status.state` lifted out for filtering/sorting without a file read. */
52
- state?: TopicStatus['state'];
53
51
  createdAt: string;
54
52
  updatedAt: string;
55
53
  createdBy?: { githubId: number; githubLogin: string };
@@ -85,7 +83,6 @@ const buildEntry = (topic: DraftTopic, sizeBytes: number): TopicIndexEntry => ({
85
83
  id: topic.id,
86
84
  title: topic.title || 'Untitled topic',
87
85
  descriptionPreview: descriptionPreview(topic.description),
88
- state: topic.status?.state,
89
86
  createdAt: topic.createdAt,
90
87
  updatedAt: topic.updatedAt,
91
88
  createdBy: topic.createdBy,
@@ -118,7 +115,7 @@ export interface MigrationResult {
118
115
  export type TopicUpdate = Partial<
119
116
  Pick<
120
117
  DraftTopic,
121
- 'title' | 'description' | 'status' | 'createdBy' | 'assets' | 'repos' | 'subsystemModels'
118
+ 'title' | 'description' | 'createdBy' | 'assets' | 'repos' | 'subsystemModels'
122
119
  >
123
120
  >;
124
121