@rubytech/create-maxy-code 0.1.474 → 0.1.476
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/package.json +1 -1
- package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts.map +1 -1
- package/payload/platform/lib/storage-broker/dist/cf-exec.js +3 -2
- package/payload/platform/lib/storage-broker/dist/cf-exec.js.map +1 -1
- package/payload/platform/lib/storage-broker/src/cf-exec.ts +3 -2
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +18 -9
- package/payload/platform/plugins/cloudflare/skills/calendar-site/template/schema.sql +13 -3
- package/payload/platform/plugins/docs/references/calendar-booking.md +2 -2
- package/payload/platform/plugins/docs/references/google-guide.md +15 -6
- package/payload/platform/plugins/google/.claude-plugin/plugin.json +1 -1
- package/payload/platform/plugins/google/PLUGIN.md +60 -12
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-audit.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-audit.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-audit.test.js +229 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-audit.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-register.test.js +9 -9
- package/payload/platform/plugins/google/mcp/dist/__tests__/account-register.test.js.map +1 -1
- package/payload/platform/plugins/google/mcp/dist/__tests__/consent-url-redirect.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/consent-url-redirect.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/consent-url-redirect.test.js +17 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/consent-url-redirect.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/loopback-listener.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/loopback-listener.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/loopback-listener.test.js +146 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/loopback-listener.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/pending-redirect.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/pending-redirect.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/pending-redirect.test.js +19 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/pending-redirect.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/register-redirect-chain.test.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/register-redirect-chain.test.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/register-redirect-chain.test.js +41 -0
- package/payload/platform/plugins/google/mcp/dist/__tests__/register-redirect-chain.test.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/auth/account-audit.d.ts +44 -0
- package/payload/platform/plugins/google/mcp/dist/auth/account-audit.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/auth/account-audit.js +112 -0
- package/payload/platform/plugins/google/mcp/dist/auth/account-audit.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/auth/loopback-listener.d.ts +17 -0
- package/payload/platform/plugins/google/mcp/dist/auth/loopback-listener.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/auth/loopback-listener.js +143 -0
- package/payload/platform/plugins/google/mcp/dist/auth/loopback-listener.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/auth/pending-store.d.ts +9 -0
- package/payload/platform/plugins/google/mcp/dist/auth/pending-store.d.ts.map +1 -1
- package/payload/platform/plugins/google/mcp/dist/auth/pending-store.js.map +1 -1
- package/payload/platform/plugins/google/mcp/dist/index.js +73 -5
- package/payload/platform/plugins/google/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/google/mcp/dist/scripts/account-audit.d.ts +2 -0
- package/payload/platform/plugins/google/mcp/dist/scripts/account-audit.d.ts.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/scripts/account-audit.js +37 -0
- package/payload/platform/plugins/google/mcp/dist/scripts/account-audit.js.map +1 -0
- package/payload/platform/plugins/google/mcp/dist/tools/account-register.d.ts +20 -4
- package/payload/platform/plugins/google/mcp/dist/tools/account-register.d.ts.map +1 -1
- package/payload/platform/plugins/google/mcp/dist/tools/account-register.js +19 -9
- package/payload/platform/plugins/google/mcp/dist/tools/account-register.js.map +1 -1
- package/payload/platform/plugins/google/references/auth.md +93 -14
- package/payload/platform/plugins/scheduling/PLUGIN.md +2 -2
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/booking-reconcile.test.js +158 -23
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/booking-reconcile.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/booking-schema-migration.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/booking-schema-migration.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/booking-schema-migration.test.js +200 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/booking-schema-migration.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/connector-sync-provision.test.d.ts +2 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/connector-sync-provision.test.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/connector-sync-provision.test.js +309 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/connector-sync-provision.test.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/d1-command.test.js +219 -19
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/d1-command.test.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.d.ts +94 -11
- package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.js +106 -22
- package/payload/platform/plugins/scheduling/mcp/dist/lib/booking-reconcile.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/connector-sync-provision.d.ts +109 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/connector-sync-provision.d.ts.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/connector-sync-provision.js +213 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/connector-sync-provision.js.map +1 -0
- package/payload/platform/plugins/scheduling/mcp/dist/lib/d1-command.d.ts +80 -8
- package/payload/platform/plugins/scheduling/mcp/dist/lib/d1-command.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/d1-command.js +202 -8
- package/payload/platform/plugins/scheduling/mcp/dist/lib/d1-command.js.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/reconcile-bookings.d.ts +6 -4
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/reconcile-bookings.d.ts.map +1 -1
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/reconcile-bookings.js +334 -142
- package/payload/platform/plugins/scheduling/mcp/dist/scripts/reconcile-bookings.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/activity-rows.d.ts +21 -3
- package/payload/platform/services/claude-session-manager/dist/activity-rows.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/activity-rows.js +6 -2
- package/payload/platform/services/claude-session-manager/dist/activity-rows.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/fs-watcher.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/fs-watcher.js +43 -5
- package/payload/platform/services/claude-session-manager/dist/fs-watcher.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.d.ts +9 -0
- package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.js +78 -0
- package/payload/platform/services/claude-session-manager/dist/jsonl-enumerator.js.map +1 -1
- package/payload/server/{chunk-Y6V45R6M.js → chunk-LBCMFD4O.js} +173 -29
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/public/activity.html +6 -6
- package/payload/server/public/assets/{AdminLoginScreens-B44KbEuC.js → AdminLoginScreens-DximwPlS.js} +1 -1
- package/payload/server/public/assets/{AdminShell-BjxV2qkb.js → AdminShell-BehbH-Oa.js} +1 -1
- package/payload/server/public/assets/{Checkbox-DSeZNGNA.js → Checkbox-DM-eHqOS.js} +1 -1
- package/payload/server/public/assets/activity-hDwUeQd6.js +1 -0
- package/payload/server/public/assets/{admin-B4LpTCur.js → admin-CAkDnGdk.js} +1 -1
- package/payload/server/public/assets/{browser-CEFvaWwI.js → browser-DXl8hOoi.js} +1 -1
- package/payload/server/public/assets/{calendar-B3zo6V34.js → calendar-DP6hn4-6.js} +1 -1
- package/payload/server/public/assets/chat-DhOfVGYM.js +1 -0
- package/payload/server/public/assets/chevron-left-DYNBoLii.js +1 -0
- package/payload/server/public/assets/data-bq8fTo_s.js +1 -0
- package/payload/server/public/assets/{graph-RaOrnSf2.js → graph-CHcYoEJ5.js} +1 -1
- package/payload/server/public/assets/{graph-labels-GlTEIYJj.js → graph-labels-CZykslZM.js} +1 -1
- package/payload/server/public/assets/{maximize-2-CHDa8p5h.js → maximize-2-31AZEcMS.js} +1 -1
- package/payload/server/public/assets/{operator-DtqHY4jV.js → operator-BGGpdsO_.js} +1 -1
- package/payload/server/public/assets/{page-CkhFj8GQ.js → page-BloC6ygA.js} +1 -1
- package/payload/server/public/assets/{page-DxnWgPtd.js → page-DOeiiqbR.js} +1 -1
- package/payload/server/public/assets/{public-D5TUfQ3I.js → public-CGgO6IZv.js} +1 -1
- package/payload/server/public/assets/{rotate-ccw-BJjVAQQY.js → rotate-ccw-BlAi6iFg.js} +1 -1
- package/payload/server/public/assets/{tasks-CM9pYYG1.js → tasks-C1giFRRL.js} +1 -1
- package/payload/server/public/assets/{time-entry-format-C5RYEYjM.js → time-entry-format-CiUUQdq7.js} +1 -1
- package/payload/server/public/assets/{triangle-alert-DLfIsuo_.js → triangle-alert-CVqKuLoa.js} +1 -1
- package/payload/server/public/assets/{useCopyFeedback-7yKeiAzV.js → useCopyFeedback-ksyUe_g1.js} +1 -1
- package/payload/server/public/assets/{useSelectionMode-CWlh6AEq.js → useSelectionMode-BPrBkdTd.js} +1 -1
- package/payload/server/public/assets/{useSubAccountSwitcher-B2n9QPVI.css → useSubAccountSwitcher-K4kYeN6i.css} +1 -1
- package/payload/server/public/assets/{useVoiceRecorder-j3ZArZ2H.js → useVoiceRecorder-CTXP8oTW.js} +1 -1
- package/payload/server/public/browser.html +5 -5
- package/payload/server/public/calendar.html +6 -6
- package/payload/server/public/chat.html +12 -12
- package/payload/server/public/data.html +11 -11
- package/payload/server/public/graph.html +11 -11
- package/payload/server/public/index.html +14 -14
- package/payload/server/public/operator.html +14 -14
- package/payload/server/public/public.html +12 -12
- package/payload/server/public/tasks.html +5 -5
- package/payload/server/server.js +547 -423
- package/payload/server/public/assets/activity-CdipMTDp.js +0 -1
- package/payload/server/public/assets/chat-5tJdo9i_.js +0 -1
- package/payload/server/public/assets/chevron-left-BJllrPBj.js +0 -1
- package/payload/server/public/assets/data-Du79EgR-.js +0 -1
- /package/payload/server/public/assets/{useSubAccountSwitcher-CBlKgwms.js → useSubAccountSwitcher-DzgzTRRn.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d1-command.test.js","sourceRoot":"","sources":["../../../src/lib/__tests__/d1-command.test.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,yEAAyE;AACzE,4EAA4E;AAC5E,kEAAkE;AAClE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAA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,CAAC;YAC7E,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YACjD,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;YAC7E,MAAM,EAAE,CAAC,wBAAwB,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;YACrD,MAAM,SAAS,CAAC;YAChB,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC;gBAAS,CAAC;YACT,EAAE,CAAC,aAAa,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Session } from "neo4j-driver";
|
|
2
|
+
import type { DispatchDestination } from "./connector-sync-provision.js";
|
|
2
3
|
export interface BookingRow {
|
|
3
4
|
bookingId: string;
|
|
4
5
|
slotStart: string;
|
|
@@ -13,16 +14,77 @@ export interface ReconcileResult {
|
|
|
13
14
|
}
|
|
14
15
|
export declare function bookingUid(bookingId: string): string;
|
|
15
16
|
export declare function reconcileOne(session: Session, accountId: string, booking: BookingRow): Promise<ReconcileResult>;
|
|
17
|
+
/**
|
|
18
|
+
* The single definition of a row the reconcile loop acts on.
|
|
19
|
+
*
|
|
20
|
+
* `status='accepted'` is the row the booking page captured. `kind='booking'` is
|
|
21
|
+
* the row that must become a :Meeting — a `kind='block'` row only reserves a
|
|
22
|
+
* slot and has no meeting by design, so counting it as unreconciled is a false
|
|
23
|
+
* positive that is indistinguishable in the log from a genuinely lost booking.
|
|
24
|
+
*
|
|
25
|
+
* Both call sites build their statements from this constant. Two literals is
|
|
26
|
+
* the defect: the sweep and the audit disagreed about what needed reconciling,
|
|
27
|
+
* and only the sweep's opinion could act.
|
|
28
|
+
*/
|
|
29
|
+
export declare const ELIGIBLE_BOOKING_PREDICATE = "status='accepted' AND kind='booking'";
|
|
30
|
+
/** The one D1 read that serves both the sweep and the audit. */
|
|
31
|
+
export declare const ELIGIBLE_BOOKING_SELECT = "SELECT bookingId, slotStart, slotEnd, name, email, note, attempts FROM bookings WHERE status='accepted' AND kind='booking' ORDER BY id";
|
|
32
|
+
/** This account's booking :Meeting uids. Read once per run and used for both
|
|
33
|
+
* the sweep's claim decision and the audit's counts. */
|
|
34
|
+
export declare function fetchBookingMeetingUids(session: Session, accountId: string): Promise<string[]>;
|
|
35
|
+
/**
|
|
36
|
+
* The rows the sweep must claim: eligible, and with no :Meeting carrying their
|
|
37
|
+
* uid.
|
|
38
|
+
*
|
|
39
|
+
* Task 1807 — this deliberately does not consult `swept`. `swept` records that
|
|
40
|
+
* a write was attempted, not that a meeting exists; gating retry on it made a
|
|
41
|
+
* booking whose meeting later went missing permanently unreachable, while the
|
|
42
|
+
* audit reported it every tick. Re-entry is safe because `reconcileOne` is
|
|
43
|
+
* idempotent on (accountId, uid) and returns created=false on a re-run.
|
|
44
|
+
*/
|
|
45
|
+
export declare function selectUnreconciled<T extends Record<string, unknown>>(rows: T[], meetingUids: Set<string>): T[];
|
|
16
46
|
export interface AuditCounts {
|
|
47
|
+
/** Eligible rows the audit looked at. Without it, pendingUnreconciled=0 out
|
|
48
|
+
* of 0 (nothing to do) is indistinguishable from 0 out of 28 (verified
|
|
49
|
+
* clean), and an audit that returns the same value for both is not an audit. */
|
|
50
|
+
eligibleExamined: number;
|
|
17
51
|
pendingUnreconciled: number;
|
|
18
52
|
orphanMeetings: number;
|
|
19
53
|
}
|
|
20
54
|
/**
|
|
21
|
-
* Compare D1's
|
|
22
|
-
* pendingUnreconciled —
|
|
23
|
-
* orphanMeetings — a booking :Meeting with no backing D1 row.
|
|
55
|
+
* Compare D1's eligible booking ids against the account's booking :Meeting set.
|
|
56
|
+
* pendingUnreconciled — eligible in D1 but no :Meeting (reconcile lagging or lost).
|
|
57
|
+
* orphanMeetings — a booking :Meeting with no backing eligible D1 row.
|
|
58
|
+
*
|
|
59
|
+
* Pure: both inputs are read by the caller, which uses the same two lists for
|
|
60
|
+
* the sweep, so the sweep and the audit cannot disagree about the population.
|
|
24
61
|
*/
|
|
25
|
-
export declare function auditCounts(
|
|
62
|
+
export declare function auditCounts(eligibleIds: string[], meetingUids: string[]): AuditCounts;
|
|
63
|
+
/**
|
|
64
|
+
* Statements that bring an already-provisioned bookings table up to the schema
|
|
65
|
+
* the sweep needs. Run once, on the first tick after upgrade, triggered by the
|
|
66
|
+
* eligible-row read failing on the missing column.
|
|
67
|
+
*
|
|
68
|
+
* A template schema change alone cannot reach an existing install: schema.sql
|
|
69
|
+
* is CREATE TABLE IF NOT EXISTS and is applied once at provisioning, so
|
|
70
|
+
* re-applying it to a live database is a no-op. Without this the first
|
|
71
|
+
* kind-qualified read would throw on every existing install and reconcile would
|
|
72
|
+
* stop entirely — strictly worse than the defect being fixed.
|
|
73
|
+
*
|
|
74
|
+
* The third statement classifies rows that predate the column. It is the only
|
|
75
|
+
* place the platform reads a block row's note: the marker is a free-text string
|
|
76
|
+
* owned by an out-of-tree script (Task 1811 absorbs that writer, after which
|
|
77
|
+
* kind='block' is set natively), so it may be used to interpret legacy rows once
|
|
78
|
+
* but never to decide control flow. It is safe to re-run.
|
|
79
|
+
*/
|
|
80
|
+
export declare const BOOKING_SCHEMA_MIGRATION: string[];
|
|
81
|
+
/** True when a D1 failure is the absent-column case the migration answers.
|
|
82
|
+
* Every other failure must stay a failure. */
|
|
83
|
+
export declare function isMissingColumnError(message: string): boolean;
|
|
84
|
+
/** True when an ALTER failed because the column is already there. SQLite has no
|
|
85
|
+
* ADD COLUMN IF NOT EXISTS, so each statement tolerates this independently and
|
|
86
|
+
* a half-migrated table completes rather than aborting. */
|
|
87
|
+
export declare function isDuplicateColumnError(message: string): boolean;
|
|
26
88
|
/** The exact instruction the recurring connector-sync admin turn runs. Silent on
|
|
27
89
|
* a clean run: the operator only hears from it on a failure or a change worth
|
|
28
90
|
* flagging. The op=cal-sync stderr line is the standing proof, not a chat reply. */
|
|
@@ -30,18 +92,39 @@ export declare const CONNECTOR_SYNC_PROMPT: string;
|
|
|
30
92
|
/**
|
|
31
93
|
* Create-only provisioning of the recurring connector-sync :Event. Idempotent:
|
|
32
94
|
* the existence probe keys on the `connectorSync` marker so a re-run never
|
|
33
|
-
* duplicates the event nor resets its advancing nextRun. Returns '
|
|
34
|
-
* first arming, '
|
|
95
|
+
* duplicates the event nor resets its advancing nextRun. Returns 'provisioned'
|
|
96
|
+
* on the first arming, 'already-provisioned' thereafter.
|
|
97
|
+
*
|
|
98
|
+
* Task 1809 — `dispatch` is the resolved EXCEPTION destination, not a gate. The
|
|
99
|
+
* caller decides whether to provision from the presence of a calendar
|
|
100
|
+
* connector (the sync's actual input) and resolves where an exception is
|
|
101
|
+
* reported separately; this function writes whichever channel it is handed.
|
|
35
102
|
*/
|
|
36
|
-
export declare function ensureConnectorSyncEvent(session: Session, accountId: string,
|
|
103
|
+
export declare function ensureConnectorSyncEvent(session: Session, accountId: string, dispatch: DispatchDestination): Promise<"provisioned" | "already-provisioned">;
|
|
37
104
|
export interface BusyInterval {
|
|
38
105
|
start: string;
|
|
39
106
|
end: string;
|
|
40
107
|
}
|
|
108
|
+
/** Which of the three states the drift comparison was actually in. `verified` is
|
|
109
|
+
* the only one where `conflicts` carries information: on the other two the
|
|
110
|
+
* comparison had nothing to compare and its 0 is vacuous. */
|
|
111
|
+
export type PublishedDriftOutcome = "verified" | "no-busy-data" | "no-published-slots";
|
|
112
|
+
export interface PublishedDrift {
|
|
113
|
+
outcome: PublishedDriftOutcome;
|
|
114
|
+
/** Size of the published-open set the comparison ran against. */
|
|
115
|
+
published: number;
|
|
116
|
+
/** Size of the connector-busy set the comparison ran against. */
|
|
117
|
+
busy: number;
|
|
118
|
+
/** Published-open slots overlapping any busy interval. Necessarily 0 on the
|
|
119
|
+
* two degraded outcomes, which is why the outcome token has to be read. */
|
|
120
|
+
conflicts: number;
|
|
121
|
+
}
|
|
41
122
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* is currently offering a slot the connector
|
|
123
|
+
* Classify published-open booking slots against the connector-busy set — the
|
|
124
|
+
* drift the standing audit reports. `outcome: "verified"` with a nonzero
|
|
125
|
+
* `conflicts` means the booking page is currently offering a slot the connector
|
|
126
|
+
* shows busy. An empty published set reports `no-published-slots` even when the
|
|
127
|
+
* busy set is also empty: the site never publishing is the upstream condition.
|
|
45
128
|
*/
|
|
46
|
-
export declare function
|
|
129
|
+
export declare function classifyPublishedDrift(published: BusyInterval[], busy: BusyInterval[]): PublishedDrift;
|
|
47
130
|
//# sourceMappingURL=booking-reconcile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking-reconcile.d.ts","sourceRoot":"","sources":["../../src/lib/booking-reconcile.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"booking-reconcile.d.ts","sourceRoot":"","sources":["../../src/lib/booking-reconcile.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,E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AM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAcD;;8DAE8D;AAC9D,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,cAAc,GAAG,oBAAoB,CAAC;AAEvF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb;gFAC4E;IAC5E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,cAAc,CAQtG"}
|
|
@@ -47,19 +47,95 @@ export async function reconcileOne(session, accountId, booking) {
|
|
|
47
47
|
ON CREATE SET r.role = 'booker', r.createdAt = datetime(), r.createdBySource = 'booking-reconcile'`, { meetingId, email: booking.email, accountId, name: booking.name });
|
|
48
48
|
return { created, meetingId };
|
|
49
49
|
}
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Task 1806 — one eligibility predicate, shared by the sweep and the audit
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
50
53
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
+
* The single definition of a row the reconcile loop acts on.
|
|
55
|
+
*
|
|
56
|
+
* `status='accepted'` is the row the booking page captured. `kind='booking'` is
|
|
57
|
+
* the row that must become a :Meeting — a `kind='block'` row only reserves a
|
|
58
|
+
* slot and has no meeting by design, so counting it as unreconciled is a false
|
|
59
|
+
* positive that is indistinguishable in the log from a genuinely lost booking.
|
|
60
|
+
*
|
|
61
|
+
* Both call sites build their statements from this constant. Two literals is
|
|
62
|
+
* the defect: the sweep and the audit disagreed about what needed reconciling,
|
|
63
|
+
* and only the sweep's opinion could act.
|
|
54
64
|
*/
|
|
55
|
-
export
|
|
65
|
+
export const ELIGIBLE_BOOKING_PREDICATE = "status='accepted' AND kind='booking'";
|
|
66
|
+
/** The one D1 read that serves both the sweep and the audit. */
|
|
67
|
+
export const ELIGIBLE_BOOKING_SELECT = `SELECT bookingId, slotStart, slotEnd, name, email, note, attempts FROM bookings WHERE ${ELIGIBLE_BOOKING_PREDICATE} ORDER BY id`;
|
|
68
|
+
/** This account's booking :Meeting uids. Read once per run and used for both
|
|
69
|
+
* the sweep's claim decision and the audit's counts. */
|
|
70
|
+
export async function fetchBookingMeetingUids(session, accountId) {
|
|
56
71
|
const res = await session.run(`MATCH (m:Meeting {accountId: $accountId, source: 'booking'}) RETURN collect(m.uid) AS uids`, { accountId });
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
return res.records[0]?.get("uids") ?? [];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The rows the sweep must claim: eligible, and with no :Meeting carrying their
|
|
76
|
+
* uid.
|
|
77
|
+
*
|
|
78
|
+
* Task 1807 — this deliberately does not consult `swept`. `swept` records that
|
|
79
|
+
* a write was attempted, not that a meeting exists; gating retry on it made a
|
|
80
|
+
* booking whose meeting later went missing permanently unreachable, while the
|
|
81
|
+
* audit reported it every tick. Re-entry is safe because `reconcileOne` is
|
|
82
|
+
* idempotent on (accountId, uid) and returns created=false on a re-run.
|
|
83
|
+
*/
|
|
84
|
+
export function selectUnreconciled(rows, meetingUids) {
|
|
85
|
+
return rows.filter((r) => !meetingUids.has(bookingUid(String(r.bookingId))));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Compare D1's eligible booking ids against the account's booking :Meeting set.
|
|
89
|
+
* pendingUnreconciled — eligible in D1 but no :Meeting (reconcile lagging or lost).
|
|
90
|
+
* orphanMeetings — a booking :Meeting with no backing eligible D1 row.
|
|
91
|
+
*
|
|
92
|
+
* Pure: both inputs are read by the caller, which uses the same two lists for
|
|
93
|
+
* the sweep, so the sweep and the audit cannot disagree about the population.
|
|
94
|
+
*/
|
|
95
|
+
export function auditCounts(eligibleIds, meetingUids) {
|
|
96
|
+
const uidSet = new Set(meetingUids);
|
|
97
|
+
const idSet = new Set(eligibleIds);
|
|
98
|
+
return {
|
|
99
|
+
eligibleExamined: eligibleIds.length,
|
|
100
|
+
pendingUnreconciled: eligibleIds.filter((id) => !uidSet.has(bookingUid(id))).length,
|
|
101
|
+
orphanMeetings: meetingUids.filter((uid) => !idSet.has(uid.replace(/^booking-/, ""))).length,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
// Task 1806/1807 — lazy schema migration
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
/**
|
|
108
|
+
* Statements that bring an already-provisioned bookings table up to the schema
|
|
109
|
+
* the sweep needs. Run once, on the first tick after upgrade, triggered by the
|
|
110
|
+
* eligible-row read failing on the missing column.
|
|
111
|
+
*
|
|
112
|
+
* A template schema change alone cannot reach an existing install: schema.sql
|
|
113
|
+
* is CREATE TABLE IF NOT EXISTS and is applied once at provisioning, so
|
|
114
|
+
* re-applying it to a live database is a no-op. Without this the first
|
|
115
|
+
* kind-qualified read would throw on every existing install and reconcile would
|
|
116
|
+
* stop entirely — strictly worse than the defect being fixed.
|
|
117
|
+
*
|
|
118
|
+
* The third statement classifies rows that predate the column. It is the only
|
|
119
|
+
* place the platform reads a block row's note: the marker is a free-text string
|
|
120
|
+
* owned by an out-of-tree script (Task 1811 absorbs that writer, after which
|
|
121
|
+
* kind='block' is set natively), so it may be used to interpret legacy rows once
|
|
122
|
+
* but never to decide control flow. It is safe to re-run.
|
|
123
|
+
*/
|
|
124
|
+
export const BOOKING_SCHEMA_MIGRATION = [
|
|
125
|
+
"ALTER TABLE bookings ADD COLUMN kind TEXT NOT NULL DEFAULT 'booking'",
|
|
126
|
+
"ALTER TABLE bookings ADD COLUMN attempts INTEGER NOT NULL DEFAULT 0",
|
|
127
|
+
"UPDATE bookings SET kind='block' WHERE note='Auto-block: Google Calendar'",
|
|
128
|
+
];
|
|
129
|
+
/** True when a D1 failure is the absent-column case the migration answers.
|
|
130
|
+
* Every other failure must stay a failure. */
|
|
131
|
+
export function isMissingColumnError(message) {
|
|
132
|
+
return /no such column/i.test(message);
|
|
133
|
+
}
|
|
134
|
+
/** True when an ALTER failed because the column is already there. SQLite has no
|
|
135
|
+
* ADD COLUMN IF NOT EXISTS, so each statement tolerates this independently and
|
|
136
|
+
* a half-migrated table completes rather than aborting. */
|
|
137
|
+
export function isDuplicateColumnError(message) {
|
|
138
|
+
return /duplicate column name/i.test(message);
|
|
63
139
|
}
|
|
64
140
|
// ---------------------------------------------------------------------------
|
|
65
141
|
// Task 1654 — connector calendar → booking availability sync
|
|
@@ -76,10 +152,15 @@ export const CONNECTOR_SYNC_PROMPT = "Keep your booking page in step with your r
|
|
|
76
152
|
/**
|
|
77
153
|
* Create-only provisioning of the recurring connector-sync :Event. Idempotent:
|
|
78
154
|
* the existence probe keys on the `connectorSync` marker so a re-run never
|
|
79
|
-
* duplicates the event nor resets its advancing nextRun. Returns '
|
|
80
|
-
* first arming, '
|
|
155
|
+
* duplicates the event nor resets its advancing nextRun. Returns 'provisioned'
|
|
156
|
+
* on the first arming, 'already-provisioned' thereafter.
|
|
157
|
+
*
|
|
158
|
+
* Task 1809 — `dispatch` is the resolved EXCEPTION destination, not a gate. The
|
|
159
|
+
* caller decides whether to provision from the presence of a calendar
|
|
160
|
+
* connector (the sync's actual input) and resolves where an exception is
|
|
161
|
+
* reported separately; this function writes whichever channel it is handed.
|
|
81
162
|
*/
|
|
82
|
-
export async function ensureConnectorSyncEvent(session, accountId,
|
|
163
|
+
export async function ensureConnectorSyncEvent(session, accountId, dispatch) {
|
|
83
164
|
const probe = await session.run(`MATCH (e:Event {accountId: $accountId, connectorSync: true})
|
|
84
165
|
WHERE e.eventStatus IN ['scheduled', 'due']
|
|
85
166
|
RETURN count(e) AS n`, { accountId });
|
|
@@ -88,7 +169,7 @@ export async function ensureConnectorSyncEvent(session, accountId, adminPhone) {
|
|
|
88
169
|
? raw.toNumber()
|
|
89
170
|
: Number(raw ?? 0);
|
|
90
171
|
if (n > 0)
|
|
91
|
-
return "
|
|
172
|
+
return "already-provisioned";
|
|
92
173
|
const now = new Date().toISOString();
|
|
93
174
|
const eventId = randomUUID();
|
|
94
175
|
await session.run(`CREATE (e:Event {
|
|
@@ -111,11 +192,11 @@ export async function ensureConnectorSyncEvent(session, accountId, adminPhone) {
|
|
|
111
192
|
accountId,
|
|
112
193
|
recurrence: "*/30 * * * *",
|
|
113
194
|
now,
|
|
114
|
-
agentChannel:
|
|
115
|
-
agentDestination:
|
|
195
|
+
agentChannel: dispatch.channel,
|
|
196
|
+
agentDestination: dispatch.destination,
|
|
116
197
|
agentPrompt: CONNECTOR_SYNC_PROMPT,
|
|
117
198
|
});
|
|
118
|
-
return "
|
|
199
|
+
return "provisioned";
|
|
119
200
|
}
|
|
120
201
|
/** Half-open overlap: [aStart,aEnd) intersects [bStart,bEnd). Edge-touching
|
|
121
202
|
* intervals (a.end === b.start) do NOT overlap. Any unparseable bound is
|
|
@@ -128,16 +209,19 @@ function intervalsOverlap(a, b) {
|
|
|
128
209
|
return aS < bE && bS < aE;
|
|
129
210
|
}
|
|
130
211
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* is currently offering a slot the connector
|
|
212
|
+
* Classify published-open booking slots against the connector-busy set — the
|
|
213
|
+
* drift the standing audit reports. `outcome: "verified"` with a nonzero
|
|
214
|
+
* `conflicts` means the booking page is currently offering a slot the connector
|
|
215
|
+
* shows busy. An empty published set reports `no-published-slots` even when the
|
|
216
|
+
* busy set is also empty: the site never publishing is the upstream condition.
|
|
134
217
|
*/
|
|
135
|
-
export function
|
|
218
|
+
export function classifyPublishedDrift(published, busy) {
|
|
136
219
|
let conflicts = 0;
|
|
137
220
|
for (const slot of published) {
|
|
138
221
|
if (busy.some((b) => intervalsOverlap(slot, b)))
|
|
139
222
|
conflicts++;
|
|
140
223
|
}
|
|
141
|
-
|
|
224
|
+
const outcome = published.length === 0 ? "no-published-slots" : busy.length === 0 ? "no-busy-data" : "verified";
|
|
225
|
+
return { outcome, published: published.length, busy: busy.length, conflicts };
|
|
142
226
|
}
|
|
143
227
|
//# sourceMappingURL=booking-reconcile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking-reconcile.js","sourceRoot":"","sources":["../../src/lib/booking-reconcile.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"booking-reconcile.js","sourceRoot":"","sources":["../../src/lib/booking-reconcile.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAiBzC,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,WAAW,SAAS,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAgB,EAChB,SAAiB,EACjB,OAAmB;IAEnB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE1C,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAClC;;;;;;;;;;;;;;;;;;+CAkB2C,EAC3C;QACE,SAAS;QACT,GAAG;QACH,KAAK,EAAE,YAAY,OAAO,CAAC,IAAI,EAAE;QACjC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;KACzB,CACF,CAAC;IACF,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAY,CAAC;IAChE,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC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AAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AAC5B,CAAC;AAkBD;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAyB,EAAE,IAAoB;IACpF,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAAE,SAAS,EAAE,CAAC;IAC/D,CAAC;IACD,MAAM,OAAO,GACX,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC;IAClG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { type AgentChannel } from "./agent-dispatch.js";
|
|
2
|
+
/** A calendar the connector-sync turn can read free/busy from. */
|
|
3
|
+
export type CalendarConnector = "google" | "m365";
|
|
4
|
+
/**
|
|
5
|
+
* The outcome of one account's provisioning pass.
|
|
6
|
+
* - `not-applicable` — no calendar connector, so there is nothing to sync.
|
|
7
|
+
* - `provisioned` — the recurring :Event was created by this pass.
|
|
8
|
+
* - `already-provisioned`— a live :Event was already armed.
|
|
9
|
+
* - `unconfigured` — a connector exists but no exception destination does.
|
|
10
|
+
* - `error` — the pass threw; the reason is on the log line.
|
|
11
|
+
*/
|
|
12
|
+
export type ProvisionOutcome = "not-applicable" | "provisioned" | "already-provisioned" | "unconfigured" | "error";
|
|
13
|
+
/** Where a provisioned turn sends an exception it needs the operator to see. */
|
|
14
|
+
export interface DispatchDestination {
|
|
15
|
+
channel: AgentChannel;
|
|
16
|
+
destination: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The calendar connectors currently authorised for an account, sorted. An
|
|
20
|
+
* authorised identity is one whose directory holds a `tokens.enc` — a
|
|
21
|
+
* half-registered identity (directory created, consent never completed) is
|
|
22
|
+
* deliberately NOT counted, so provisioning does not arm a turn that has
|
|
23
|
+
* nothing to read.
|
|
24
|
+
*/
|
|
25
|
+
export declare function detectCalendarConnectors(accountDir: string): CalendarConnector[];
|
|
26
|
+
/**
|
|
27
|
+
* Why no destination could be resolved. The platform computes the true cause
|
|
28
|
+
* (Task 1439 gave `validateAgentDestination` reason codes precisely so the
|
|
29
|
+
* diagnosis is not guessed); discarding it one frame below the log statement
|
|
30
|
+
* would leave the operator reading `unconfigured` at an account whose
|
|
31
|
+
* `account.json` visibly holds a phone number.
|
|
32
|
+
*
|
|
33
|
+
* - `none-configured` — no WhatsApp phone and no Telegram admin on the account.
|
|
34
|
+
* - `not-registered` — a candidate exists but is in no authoritative list.
|
|
35
|
+
* - `cross-account` — a candidate is registered, but to another account.
|
|
36
|
+
* - `house-unresolvable` — the socket-owning house could not be resolved. This
|
|
37
|
+
* is an INSTALL-WIDE fault, not a per-account configuration gap.
|
|
38
|
+
* - `unreadable-config` — `account.json` is present but unreadable or malformed.
|
|
39
|
+
*/
|
|
40
|
+
export type DestinationRefusal = "none-configured" | "not-registered" | "cross-account" | "house-unresolvable" | "unreadable-config";
|
|
41
|
+
export type DispatchResolution = {
|
|
42
|
+
destination: DispatchDestination;
|
|
43
|
+
reason: null;
|
|
44
|
+
} | {
|
|
45
|
+
destination: null;
|
|
46
|
+
reason: DestinationRefusal;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Where this account's connector-sync turn reports an exception, or the reason
|
|
50
|
+
* no channel destination is reachable.
|
|
51
|
+
*
|
|
52
|
+
* WhatsApp is preferred, Telegram is the fallback. Every candidate is passed
|
|
53
|
+
* through `validateAgentDestination` — the same authority the dispatcher's
|
|
54
|
+
* standing audit applies at fire time — so provisioning can never arm a binding
|
|
55
|
+
* the audit would immediately report as stale. `accountsDir` is the parent
|
|
56
|
+
* accounts directory (`$PLATFORM_ROOT/../data/accounts`).
|
|
57
|
+
*/
|
|
58
|
+
export declare function resolveDispatchDestination(accountsDir: string, accountId: string): DispatchResolution;
|
|
59
|
+
/** The last outcome reported for one account, and when it was reported.
|
|
60
|
+
*
|
|
61
|
+
* `signature` is the value the change detector compares, not `outcome`: an
|
|
62
|
+
* `error` carries a prefix of its message, so a CHANGED error is reported
|
|
63
|
+
* immediately while an unchanged one heartbeats like any other steady state.
|
|
64
|
+
* Without it a persistently failing account would log every 120 s forever,
|
|
65
|
+
* reproducing the noise this task removes, and its eventual recovery would be
|
|
66
|
+
* invisible because the state map would still hold the pre-error outcome. */
|
|
67
|
+
export interface ProvisionStateEntry {
|
|
68
|
+
outcome: ProvisionOutcome;
|
|
69
|
+
signature: string;
|
|
70
|
+
loggedAtMs: number;
|
|
71
|
+
}
|
|
72
|
+
/** The comparison key for one observation. */
|
|
73
|
+
export declare function provisionSignature(outcome: ProvisionOutcome, detail?: string): string;
|
|
74
|
+
export type ProvisionState = Record<string, ProvisionStateEntry>;
|
|
75
|
+
/**
|
|
76
|
+
* Whether this tick reports the account's outcome.
|
|
77
|
+
*
|
|
78
|
+
* A permanent condition reported at tick rate is noise that hides its own
|
|
79
|
+
* meaning: the evidence for the Task 1809 defect was 5,688 identical lines that
|
|
80
|
+
* everyone read as benign. So a line is emitted when the outcome CHANGES, when
|
|
81
|
+
* the account has never been reported, or when the heartbeat window has
|
|
82
|
+
* elapsed — the heartbeat being what keeps "inert on every account" and "steady
|
|
83
|
+
* state" distinguishable without counting log lines by hand.
|
|
84
|
+
*/
|
|
85
|
+
export declare function shouldEmitProvisionLine(prev: ProvisionStateEntry | undefined, nextSignature: string, nowMs: number, heartbeatMs: number): boolean;
|
|
86
|
+
/** How this observation is labelled on the log line. `first` is NOT `change`:
|
|
87
|
+
* labelling a first observation as a change means that any state loss produces
|
|
88
|
+
* a synchronised fleet-wide burst of `emit=change`, indistinguishable from
|
|
89
|
+
* every account genuinely flipping outcome at once — which is a real
|
|
90
|
+
* emergency, and the one moment the label most needs to be trustworthy. */
|
|
91
|
+
export declare function emitLabel(prev: ProvisionStateEntry | undefined, nextSignature: string): "first" | "change" | "heartbeat";
|
|
92
|
+
/** Read the persisted state. An absent or corrupt file reads as empty, which
|
|
93
|
+
* costs one redundant line per account and never suppresses one. A corrupt
|
|
94
|
+
* file is reported: it is the trigger for a fleet-wide `emit=first` burst, and
|
|
95
|
+
* that burst must carry its own explanation. */
|
|
96
|
+
export declare function readProvisionState(path: string): ProvisionState;
|
|
97
|
+
/**
|
|
98
|
+
* Persist the state. Written to a temp path and renamed, so a kill or a hard
|
|
99
|
+
* freeze mid-write cannot leave truncated JSON — which would read back as empty
|
|
100
|
+
* and produce the fleet-wide burst described above.
|
|
101
|
+
*
|
|
102
|
+
* A failed write must never abort the reconcile pass, but it must not be silent
|
|
103
|
+
* either: every realistic cause (disk full, filesystem remounted read-only,
|
|
104
|
+
* mode drift) is PERSISTENT, so the failure degrades emit-on-change back to
|
|
105
|
+
* per-tick logging indefinitely — worse than what it replaced, because every
|
|
106
|
+
* line then falsely claims to be a first observation.
|
|
107
|
+
*/
|
|
108
|
+
export declare function writeProvisionState(path: string, state: ProvisionState): void;
|
|
109
|
+
//# sourceMappingURL=connector-sync-provision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-sync-provision.d.ts","sourceRoot":"","sources":["../../src/lib/connector-sync-provision.ts"],"names":[],"mappings":"AAuBA,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAElF,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GACxB,gBAAgB,GAChB,aAA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