@itphx/synth-storage-postgres 0.13.8 → 0.13.10
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.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/migrations/026-instance-skills.d.ts +1 -1
- package/dist/migrations/026-instance-skills.js +1 -1
- package/dist/migrations/035-project-access.d.ts +16 -0
- package/dist/migrations/035-project-access.js +22 -0
- package/dist/migrations/036-message-mentions.d.ts +8 -0
- package/dist/migrations/036-message-mentions.js +12 -0
- package/dist/migrations/037-timers.d.ts +19 -0
- package/dist/migrations/037-timers.js +60 -0
- package/dist/migrations/038-schedule-project-id.d.ts +18 -0
- package/dist/migrations/038-schedule-project-id.js +38 -0
- package/dist/migrations/index.js +8 -0
- package/dist/ports/context-files.d.ts +5 -0
- package/dist/ports/context-files.js +10 -0
- package/dist/ports/events-scheduler.js +19 -4
- package/dist/ports/principals-defaults.js +10 -0
- package/dist/ports/principals-projects.d.ts +7 -1
- package/dist/ports/principals-projects.js +66 -11
- package/dist/ports/principals-settings.js +40 -0
- package/dist/ports/sessions-mapping.d.ts +28 -5
- package/dist/ports/sessions-mapping.js +27 -3
- package/dist/ports/sessions.d.ts +49 -4
- package/dist/ports/sessions.js +234 -27
- package/dist/ports/skills.d.ts +2 -2
- package/dist/ports/skills.js +2 -2
- package/dist/ports/timers.d.ts +54 -0
- package/dist/ports/timers.js +247 -0
- package/dist/storage-context.d.ts +3 -1
- package/dist/storage-context.js +9 -1
- package/package.json +4 -4
package/dist/ports/skills.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PG-реализация порта **instance-скиллов** (ADR-
|
|
2
|
+
* PG-реализация порта **instance-скиллов** (ADR-126 §9, ADR-116, ADR-097).
|
|
3
3
|
*
|
|
4
4
|
* Разделение хранения (ADR-116 §«Что переводится»):
|
|
5
5
|
* - **метаданные** (заголовок `SKILL.md` — `name`/`description`/прочие ключи) —
|
|
@@ -197,7 +197,7 @@ export class PgSkillRepository {
|
|
|
197
197
|
updated_at = now()`, [name, jsonbParam(frontmatter)]);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
/** Собрать порт instance-скиллов (ADR-
|
|
200
|
+
/** Собрать порт instance-скиллов (ADR-126 §9, ADR-116). */
|
|
201
201
|
export function buildSkillPorts(deps, blobs) {
|
|
202
202
|
return {
|
|
203
203
|
skills: new PgSkillRepository(deps, blobs),
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PG-реализация портов **таймеров/будильников** и **истории их срабатываний**
|
|
3
|
+
* (PROP-141, Часть B; ADR-097 — драйвер слоя хранения).
|
|
4
|
+
*
|
|
5
|
+
* Таблицы `timers`/`timer_firings` (миграция 037): реестр автоматизаций
|
|
6
|
+
* (привязка к проекту и сессии, режим повтора, статус, ближайшее
|
|
7
|
+
* срабатывание) и append-only журнал срабатываний.
|
|
8
|
+
*
|
|
9
|
+
* Семантика повторяет файловые реализации core (`FileTimerStore`/
|
|
10
|
+
* `FileTimerFiringStore`) и in-memory (`MemoryTimerRepository`):
|
|
11
|
+
* - `list` — фильтры по «И», порядок **по ближайшему срабатыванию**
|
|
12
|
+
* (`fires_at` возраст., тайбрейкер `id`), постраничный срез;
|
|
13
|
+
* - `listDue` — `status = 'active'` и `fires_at <= at`;
|
|
14
|
+
* - `countActive` — счётчик активных таймеров сессии;
|
|
15
|
+
* - `update`/`setStatus` — частичная правка, `updated_at` = now();
|
|
16
|
+
* - `remove` идемпотентно, `removeBySession` — каскад по сессии;
|
|
17
|
+
* - история срабатываний — порядок добавления (`seq`), `limit` — последние N,
|
|
18
|
+
* `prune` — записи **строго старше** отсечки.
|
|
19
|
+
*
|
|
20
|
+
* Драйвер не тянет core рантаймом (только `import type`), поэтому потолок
|
|
21
|
+
* выборки и правила порядка повторены здесь локально — как в
|
|
22
|
+
* `ports/background-runs.ts`.
|
|
23
|
+
*/
|
|
24
|
+
import type { StorageContext, TimerFiringRepository, TimerRepository } from '@itphx/synth-core';
|
|
25
|
+
import type { Timer, TimerCreateInput, TimerFiring, TimerFilter, TimerPatch, TimerStatus } from '@itphx/synth-shared';
|
|
26
|
+
import type { PortDeps } from './deps.js';
|
|
27
|
+
/** Часть `StorageContext`, которой владеет группа «таймеры». */
|
|
28
|
+
export type TimerPorts = Pick<StorageContext, 'timers' | 'timerFirings'>;
|
|
29
|
+
/** Порт реестра таймеров поверх таблицы `timers`. */
|
|
30
|
+
export declare class PgTimerRepository implements TimerRepository {
|
|
31
|
+
private readonly _deps;
|
|
32
|
+
constructor(_deps: PortDeps);
|
|
33
|
+
list(filter?: TimerFilter): Promise<Timer[]>;
|
|
34
|
+
get(id: string): Promise<Timer | null>;
|
|
35
|
+
create(input: TimerCreateInput & {
|
|
36
|
+
firesAt: string;
|
|
37
|
+
}): Promise<Timer>;
|
|
38
|
+
update(id: string, patch: TimerPatch): Promise<Timer | null>;
|
|
39
|
+
remove(id: string): Promise<boolean>;
|
|
40
|
+
listDue(at: string): Promise<Timer[]>;
|
|
41
|
+
countActive(sessionId: string): Promise<number>;
|
|
42
|
+
setStatus(id: string, status: TimerStatus, patch?: TimerPatch): Promise<Timer | null>;
|
|
43
|
+
removeBySession(sessionId: string): Promise<number>;
|
|
44
|
+
}
|
|
45
|
+
/** Порт истории срабатываний поверх таблицы `timer_firings`. */
|
|
46
|
+
export declare class PgTimerFiringRepository implements TimerFiringRepository {
|
|
47
|
+
private readonly _deps;
|
|
48
|
+
constructor(_deps: PortDeps);
|
|
49
|
+
append(firing: TimerFiring): Promise<void>;
|
|
50
|
+
list(timerId: string, limit?: number): Promise<TimerFiring[]>;
|
|
51
|
+
prune(before: string): Promise<number>;
|
|
52
|
+
}
|
|
53
|
+
/** Собрать порты группы «таймеры» (PROP-141, Часть B). */
|
|
54
|
+
export declare function buildTimerPorts(deps: PortDeps): TimerPorts;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PG-реализация портов **таймеров/будильников** и **истории их срабатываний**
|
|
3
|
+
* (PROP-141, Часть B; ADR-097 — драйвер слоя хранения).
|
|
4
|
+
*
|
|
5
|
+
* Таблицы `timers`/`timer_firings` (миграция 037): реестр автоматизаций
|
|
6
|
+
* (привязка к проекту и сессии, режим повтора, статус, ближайшее
|
|
7
|
+
* срабатывание) и append-only журнал срабатываний.
|
|
8
|
+
*
|
|
9
|
+
* Семантика повторяет файловые реализации core (`FileTimerStore`/
|
|
10
|
+
* `FileTimerFiringStore`) и in-memory (`MemoryTimerRepository`):
|
|
11
|
+
* - `list` — фильтры по «И», порядок **по ближайшему срабатыванию**
|
|
12
|
+
* (`fires_at` возраст., тайбрейкер `id`), постраничный срез;
|
|
13
|
+
* - `listDue` — `status = 'active'` и `fires_at <= at`;
|
|
14
|
+
* - `countActive` — счётчик активных таймеров сессии;
|
|
15
|
+
* - `update`/`setStatus` — частичная правка, `updated_at` = now();
|
|
16
|
+
* - `remove` идемпотентно, `removeBySession` — каскад по сессии;
|
|
17
|
+
* - история срабатываний — порядок добавления (`seq`), `limit` — последние N,
|
|
18
|
+
* `prune` — записи **строго старше** отсечки.
|
|
19
|
+
*
|
|
20
|
+
* Драйвер не тянет core рантаймом (только `import type`), поэтому потолок
|
|
21
|
+
* выборки и правила порядка повторены здесь локально — как в
|
|
22
|
+
* `ports/background-runs.ts`.
|
|
23
|
+
*/
|
|
24
|
+
import { randomUUID } from 'node:crypto';
|
|
25
|
+
import { jsonbParam } from '../json-param.js';
|
|
26
|
+
import { compact, toIso, toIsoRequired } from './events-core.js';
|
|
27
|
+
// ── Локальные реплики core-хелперов (core рантаймом не тянем) ────────────────
|
|
28
|
+
/** Дефолтный потолок выборки (паритет с core `COLLECTION_LIMIT_DEFAULT`). */
|
|
29
|
+
const LIST_DEFAULT_LIMIT = 100;
|
|
30
|
+
/** Абсолютный потолок выборки (паритет с core `COLLECTION_LIMIT_MAX`). */
|
|
31
|
+
const LIST_MAX_LIMIT = 1000;
|
|
32
|
+
/** Привести `limit` к допустимому виду: дефолт 100, потолок 1000. */
|
|
33
|
+
function resolveLimit(limit) {
|
|
34
|
+
if (limit === undefined || !Number.isFinite(limit) || limit <= 0)
|
|
35
|
+
return LIST_DEFAULT_LIMIT;
|
|
36
|
+
return Math.min(Math.floor(limit), LIST_MAX_LIMIT);
|
|
37
|
+
}
|
|
38
|
+
/** Привести `offset` к допустимому виду: неотрицательное целое (иначе 0). */
|
|
39
|
+
function resolveOffset(offset) {
|
|
40
|
+
if (offset === undefined || !Number.isFinite(offset) || offset <= 0)
|
|
41
|
+
return 0;
|
|
42
|
+
return Math.floor(offset);
|
|
43
|
+
}
|
|
44
|
+
/** Разобрать `repeat` из `jsonb` — объект с полем `mode`. */
|
|
45
|
+
function toTimerRepeat(value) {
|
|
46
|
+
const raw = (value ?? {});
|
|
47
|
+
if (raw.mode === 'daily') {
|
|
48
|
+
return { mode: 'daily', time: String(raw.time ?? ''), timezone: String(raw.timezone ?? '') };
|
|
49
|
+
}
|
|
50
|
+
if (raw.mode === 'every')
|
|
51
|
+
return { mode: 'every', everySec: Number(raw.everySec ?? 0) };
|
|
52
|
+
return { mode: 'once' };
|
|
53
|
+
}
|
|
54
|
+
/** Запись таймера из колонок. */
|
|
55
|
+
function toTimer(row) {
|
|
56
|
+
return compact({
|
|
57
|
+
id: row.id,
|
|
58
|
+
kind: row.kind,
|
|
59
|
+
name: row.name ?? undefined,
|
|
60
|
+
comment: row.comment,
|
|
61
|
+
projectId: row.project_id,
|
|
62
|
+
sessionId: row.session_id,
|
|
63
|
+
ownerId: row.owner_id,
|
|
64
|
+
repeat: toTimerRepeat(row.repeat),
|
|
65
|
+
status: row.status,
|
|
66
|
+
firesAt: toIsoRequired(row.fires_at),
|
|
67
|
+
createdAt: toIsoRequired(row.created_at),
|
|
68
|
+
updatedAt: toIsoRequired(row.updated_at),
|
|
69
|
+
firedAt: toIso(row.fired_at),
|
|
70
|
+
lastError: row.last_error ?? undefined,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/** Порт реестра таймеров поверх таблицы `timers`. */
|
|
74
|
+
export class PgTimerRepository {
|
|
75
|
+
_deps;
|
|
76
|
+
constructor(_deps) {
|
|
77
|
+
this._deps = _deps;
|
|
78
|
+
}
|
|
79
|
+
async list(filter) {
|
|
80
|
+
const params = [];
|
|
81
|
+
const where = [];
|
|
82
|
+
if (filter?.sessionId !== undefined) {
|
|
83
|
+
params.push(filter.sessionId);
|
|
84
|
+
where.push(`session_id = $${params.length}`);
|
|
85
|
+
}
|
|
86
|
+
if (filter?.projectId !== undefined) {
|
|
87
|
+
params.push(filter.projectId);
|
|
88
|
+
where.push(`project_id = $${params.length}`);
|
|
89
|
+
}
|
|
90
|
+
if (filter?.status !== undefined) {
|
|
91
|
+
params.push(filter.status);
|
|
92
|
+
where.push(`status = $${params.length}`);
|
|
93
|
+
}
|
|
94
|
+
if (filter?.kind !== undefined) {
|
|
95
|
+
params.push(filter.kind);
|
|
96
|
+
where.push(`kind = $${params.length}`);
|
|
97
|
+
}
|
|
98
|
+
// Порядок — по ближайшему срабатыванию (`fires_at` возраст., тайбрейкер `id`).
|
|
99
|
+
params.push(resolveLimit(filter?.limit));
|
|
100
|
+
const limitParam = params.length;
|
|
101
|
+
params.push(resolveOffset(filter?.offset));
|
|
102
|
+
const offsetParam = params.length;
|
|
103
|
+
const sql = 'SELECT * FROM timers' +
|
|
104
|
+
(where.length ? ` WHERE ${where.join(' AND ')}` : '') +
|
|
105
|
+
' ORDER BY fires_at ASC, id ASC' +
|
|
106
|
+
` LIMIT $${limitParam} OFFSET $${offsetParam}`;
|
|
107
|
+
const rows = await this._deps.connection.query(sql, params);
|
|
108
|
+
return rows.map(toTimer);
|
|
109
|
+
}
|
|
110
|
+
async get(id) {
|
|
111
|
+
const rows = await this._deps.connection.query('SELECT * FROM timers WHERE id = $1 LIMIT 1', [id]);
|
|
112
|
+
return rows[0] ? toTimer(rows[0]) : null;
|
|
113
|
+
}
|
|
114
|
+
async create(input) {
|
|
115
|
+
const rows = await this._deps.connection.query(`INSERT INTO timers
|
|
116
|
+
(id, kind, name, comment, project_id, session_id, owner_id, repeat, status,
|
|
117
|
+
fires_at, created_at, updated_at)
|
|
118
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8::jsonb, $9, $10::timestamptz,
|
|
119
|
+
now()::timestamptz, now()::timestamptz)
|
|
120
|
+
RETURNING *`, [
|
|
121
|
+
`${input.kind === 'alarm' ? 'alm' : 'tmr'}_${randomUUID()}`,
|
|
122
|
+
input.kind,
|
|
123
|
+
input.name ?? null,
|
|
124
|
+
input.comment,
|
|
125
|
+
input.projectId,
|
|
126
|
+
input.sessionId,
|
|
127
|
+
input.ownerId,
|
|
128
|
+
jsonbParam(input.repeat),
|
|
129
|
+
input.status ?? 'active',
|
|
130
|
+
input.firesAt,
|
|
131
|
+
]);
|
|
132
|
+
const row = rows[0];
|
|
133
|
+
if (!row)
|
|
134
|
+
throw new Error('PG: не удалось создать таймер (пустой RETURNING)');
|
|
135
|
+
return toTimer(row);
|
|
136
|
+
}
|
|
137
|
+
async update(id, patch) {
|
|
138
|
+
const sets = [];
|
|
139
|
+
const params = [];
|
|
140
|
+
const push = (value) => {
|
|
141
|
+
params.push(value);
|
|
142
|
+
return `$${params.length}`;
|
|
143
|
+
};
|
|
144
|
+
if (patch.kind !== undefined)
|
|
145
|
+
sets.push(`kind = ${push(patch.kind)}`);
|
|
146
|
+
if (patch.comment !== undefined)
|
|
147
|
+
sets.push(`comment = ${push(patch.comment)}`);
|
|
148
|
+
if (patch.repeat !== undefined)
|
|
149
|
+
sets.push(`repeat = ${push(jsonbParam(patch.repeat))}::jsonb`);
|
|
150
|
+
if (patch.status !== undefined)
|
|
151
|
+
sets.push(`status = ${push(patch.status)}`);
|
|
152
|
+
if (patch.firesAt !== undefined)
|
|
153
|
+
sets.push(`fires_at = ${push(patch.firesAt)}::timestamptz`);
|
|
154
|
+
// `null` — сброс необязательного поля (`name`/`fired_at`/`last_error`).
|
|
155
|
+
if (patch.name !== undefined)
|
|
156
|
+
sets.push(`name = ${push(patch.name)}`);
|
|
157
|
+
if (patch.firedAt !== undefined)
|
|
158
|
+
sets.push(`fired_at = ${push(patch.firedAt)}`);
|
|
159
|
+
if (patch.lastError !== undefined)
|
|
160
|
+
sets.push(`last_error = ${push(patch.lastError)}`);
|
|
161
|
+
sets.push('updated_at = now()::timestamptz');
|
|
162
|
+
params.push(id);
|
|
163
|
+
const rows = await this._deps.connection.query(`UPDATE timers SET ${sets.join(', ')} WHERE id = $${params.length} RETURNING *`, params);
|
|
164
|
+
return rows[0] ? toTimer(rows[0]) : null;
|
|
165
|
+
}
|
|
166
|
+
async remove(id) {
|
|
167
|
+
const rows = await this._deps.connection.query('DELETE FROM timers WHERE id = $1 RETURNING id', [id]);
|
|
168
|
+
return rows.length > 0;
|
|
169
|
+
}
|
|
170
|
+
async listDue(at) {
|
|
171
|
+
const rows = await this._deps.connection.query(`SELECT * FROM timers
|
|
172
|
+
WHERE status = 'active' AND fires_at <= $1::timestamptz
|
|
173
|
+
ORDER BY fires_at ASC, id ASC`, [at]);
|
|
174
|
+
return rows.map(toTimer);
|
|
175
|
+
}
|
|
176
|
+
async countActive(sessionId) {
|
|
177
|
+
const rows = await this._deps.connection.query(`SELECT COUNT(*)::bigint AS count FROM timers
|
|
178
|
+
WHERE status = 'active' AND session_id = $1`, [sessionId]);
|
|
179
|
+
return Number(rows[0]?.count ?? 0);
|
|
180
|
+
}
|
|
181
|
+
async setStatus(id, status, patch) {
|
|
182
|
+
return this.update(id, { ...(patch ?? {}), status });
|
|
183
|
+
}
|
|
184
|
+
async removeBySession(sessionId) {
|
|
185
|
+
const rows = await this._deps.connection.query('DELETE FROM timers WHERE session_id = $1 RETURNING id', [sessionId]);
|
|
186
|
+
return rows.length;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/** Запись срабатывания из колонок. */
|
|
190
|
+
function toTimerFiring(row) {
|
|
191
|
+
return {
|
|
192
|
+
id: row.id,
|
|
193
|
+
timerId: row.timer_id,
|
|
194
|
+
firedAt: toIsoRequired(row.fired_at),
|
|
195
|
+
scheduledFor: toIsoRequired(row.scheduled_for),
|
|
196
|
+
lagMs: Number(row.lag_ms ?? 0),
|
|
197
|
+
outcome: row.outcome,
|
|
198
|
+
sessionId: row.session_id,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/** Порт истории срабатываний поверх таблицы `timer_firings`. */
|
|
202
|
+
export class PgTimerFiringRepository {
|
|
203
|
+
_deps;
|
|
204
|
+
constructor(_deps) {
|
|
205
|
+
this._deps = _deps;
|
|
206
|
+
}
|
|
207
|
+
async append(firing) {
|
|
208
|
+
await this._deps.connection.query(`INSERT INTO timer_firings
|
|
209
|
+
(id, timer_id, fired_at, scheduled_for, lag_ms, outcome, session_id)
|
|
210
|
+
VALUES ($1, $2, $3::timestamptz, $4::timestamptz, $5, $6, $7)
|
|
211
|
+
ON CONFLICT (id) DO NOTHING`, [
|
|
212
|
+
firing.id,
|
|
213
|
+
firing.timerId,
|
|
214
|
+
firing.firedAt,
|
|
215
|
+
firing.scheduledFor,
|
|
216
|
+
firing.lagMs,
|
|
217
|
+
firing.outcome,
|
|
218
|
+
firing.sessionId,
|
|
219
|
+
]);
|
|
220
|
+
}
|
|
221
|
+
async list(timerId, limit) {
|
|
222
|
+
const bounded = limit !== undefined && Number.isFinite(limit) && limit > 0
|
|
223
|
+
? Math.floor(limit)
|
|
224
|
+
: undefined;
|
|
225
|
+
// Порядок добавления (`seq`), как у Job-истории; `limit` — **последние N**
|
|
226
|
+
// (как в файловой реализации: `slice(-limit)`).
|
|
227
|
+
const rows = bounded === undefined
|
|
228
|
+
? await this._deps.connection.query('SELECT * FROM timer_firings WHERE timer_id = $1 ORDER BY seq ASC', [timerId])
|
|
229
|
+
: await this._deps.connection.query(`SELECT * FROM (
|
|
230
|
+
SELECT * FROM timer_firings WHERE timer_id = $1 ORDER BY seq DESC LIMIT $2
|
|
231
|
+
) t ORDER BY seq ASC`, [timerId, bounded]);
|
|
232
|
+
return rows.map(toTimerFiring);
|
|
233
|
+
}
|
|
234
|
+
async prune(before) {
|
|
235
|
+
const rows = await this._deps.connection.query(`DELETE FROM timer_firings
|
|
236
|
+
WHERE fired_at < $1::timestamptz
|
|
237
|
+
RETURNING id`, [before]);
|
|
238
|
+
return rows.length;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/** Собрать порты группы «таймеры» (PROP-141, Часть B). */
|
|
242
|
+
export function buildTimerPorts(deps) {
|
|
243
|
+
return {
|
|
244
|
+
timers: new PgTimerRepository(deps),
|
|
245
|
+
timerFirings: new PgTimerFiringRepository(deps),
|
|
246
|
+
};
|
|
247
|
+
}
|
|
@@ -33,12 +33,14 @@
|
|
|
33
33
|
* - `buildLegacyPipelinePorts(deps)` → `pipelines` (ADR-051/ADR-100 — реестр
|
|
34
34
|
* определений и экземпляров инстанса; таблицы `pipeline_definitions`/
|
|
35
35
|
* `pipeline_instances`). Не путать с `buildPipelinePorts` (ADR-101).
|
|
36
|
-
* - `buildSkillPorts(deps, blobs)` → `skills` (ADR-
|
|
36
|
+
* - `buildSkillPorts(deps, blobs)` → `skills` (ADR-126 §9 / ADR-116 —
|
|
37
37
|
* метаданные в таблице `instance_skills`, содержимое — в blob-сторе
|
|
38
38
|
* `skills/<name>/…`).
|
|
39
39
|
* - `buildContextFilePorts(deps, opts)` → `contextFiles` (ADR-069/ADR-070 /
|
|
40
40
|
* ADR-116 — пользовательская часть в таблице `context_files`, системные
|
|
41
41
|
* промпты образа остаются ФС).
|
|
42
|
+
* - `buildTimerPorts(deps)` → `timers`/`timerFirings` (PROP-141, Часть B —
|
|
43
|
+
* таймеры и будильники; таблицы `timers`/`timer_firings`).
|
|
42
44
|
*
|
|
43
45
|
* Все доменные порты реализованы поверх SQL; **`blobs`** остаётся файловым по
|
|
44
46
|
* конструкции (байты вложений/логов/содержимого скиллов — на томе, в БД только
|
package/dist/storage-context.js
CHANGED
|
@@ -33,12 +33,14 @@
|
|
|
33
33
|
* - `buildLegacyPipelinePorts(deps)` → `pipelines` (ADR-051/ADR-100 — реестр
|
|
34
34
|
* определений и экземпляров инстанса; таблицы `pipeline_definitions`/
|
|
35
35
|
* `pipeline_instances`). Не путать с `buildPipelinePorts` (ADR-101).
|
|
36
|
-
* - `buildSkillPorts(deps, blobs)` → `skills` (ADR-
|
|
36
|
+
* - `buildSkillPorts(deps, blobs)` → `skills` (ADR-126 §9 / ADR-116 —
|
|
37
37
|
* метаданные в таблице `instance_skills`, содержимое — в blob-сторе
|
|
38
38
|
* `skills/<name>/…`).
|
|
39
39
|
* - `buildContextFilePorts(deps, opts)` → `contextFiles` (ADR-069/ADR-070 /
|
|
40
40
|
* ADR-116 — пользовательская часть в таблице `context_files`, системные
|
|
41
41
|
* промпты образа остаются ФС).
|
|
42
|
+
* - `buildTimerPorts(deps)` → `timers`/`timerFirings` (PROP-141, Часть B —
|
|
43
|
+
* таймеры и будильники; таблицы `timers`/`timer_firings`).
|
|
42
44
|
*
|
|
43
45
|
* Все доменные порты реализованы поверх SQL; **`blobs`** остаётся файловым по
|
|
44
46
|
* конструкции (байты вложений/логов/содержимого скиллов — на томе, в БД только
|
|
@@ -87,6 +89,9 @@ import { buildWorktreePorts } from './ports/worktrees.js';
|
|
|
87
89
|
// ADR-029: ожидания подтверждения прав — отдельный стор (таблица
|
|
88
90
|
// `pending_approvals`, миграция 035), а не поле документа сессии.
|
|
89
91
|
import { buildPendingApprovalPorts } from './ports/pending-approvals.js';
|
|
92
|
+
// PROP-141 (Часть B): реестр таймеров/будильников (`timers`) и append-only
|
|
93
|
+
// история их срабатываний (`timer_firings`) — миграция 037.
|
|
94
|
+
import { buildTimerPorts } from './ports/timers.js';
|
|
90
95
|
// ADR-115/ADR-116: учёт ссылок на объекты blob-хранилища (таблица `blob_refs`).
|
|
91
96
|
import { buildBlobRefPorts } from './ports/blob-refs.js';
|
|
92
97
|
import { buildPluginLockPorts } from './ports/plugin-lock.js';
|
|
@@ -217,6 +222,9 @@ export function buildPostgresStorageContext(opts) {
|
|
|
217
222
|
// ADR-029: ожидания подтверждения прав — отдельная таблица
|
|
218
223
|
// `pending_approvals` (миграция 035); документ сессии не трогаем.
|
|
219
224
|
...buildPendingApprovalPorts(deps),
|
|
225
|
+
// PROP-141 (Часть B): реестр таймеров/будильников (`timers`) и история
|
|
226
|
+
// их срабатываний (`timer_firings`) — миграция 037.
|
|
227
|
+
...buildTimerPorts(deps),
|
|
220
228
|
// ADR-115/ADR-116: учёт ссылок на объекты blob-хранилища — таблица
|
|
221
229
|
// `blob_refs` (миграция 024). Байты объектов остаются на томе (`blobs`).
|
|
222
230
|
...buildBlobRefPorts(deps),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itphx/synth-storage-postgres",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@itphx/synth-shared": "0.13.
|
|
18
|
+
"@itphx/synth-shared": "0.13.10"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@itphx/synth-core": "0.13.
|
|
21
|
+
"@itphx/synth-core": "0.13.10"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@itphx/synth-core": "0.13.
|
|
24
|
+
"@itphx/synth-core": "0.13.10",
|
|
25
25
|
"@types/node": "^22.0.0",
|
|
26
26
|
"@types/pg": "^8.15.0",
|
|
27
27
|
"typescript": "^5.8.0"
|