@elizaos/plugin-health 2.0.0-beta.1 → 2.0.3-beta.2

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.
Files changed (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +33 -27
  3. package/assets/hero.svg +67 -0
  4. package/package.json +67 -4
  5. package/dist/actions/index.d.ts +0 -20
  6. package/dist/actions/index.d.ts.map +0 -1
  7. package/dist/actions/index.js +0 -5
  8. package/dist/actions/index.js.map +0 -1
  9. package/dist/anchors/index.d.ts +0 -19
  10. package/dist/anchors/index.d.ts.map +0 -1
  11. package/dist/anchors/index.js +0 -9
  12. package/dist/anchors/index.js.map +0 -1
  13. package/dist/connectors/contract-stubs.d.ts +0 -112
  14. package/dist/connectors/contract-stubs.d.ts.map +0 -1
  15. package/dist/connectors/contract-stubs.js +0 -1
  16. package/dist/connectors/contract-stubs.js.map +0 -1
  17. package/dist/connectors/index.d.ts +0 -28
  18. package/dist/connectors/index.d.ts.map +0 -1
  19. package/dist/connectors/index.js +0 -202
  20. package/dist/connectors/index.js.map +0 -1
  21. package/dist/contracts/circadian-default.d.ts +0 -15
  22. package/dist/contracts/circadian-default.d.ts.map +0 -1
  23. package/dist/contracts/circadian-default.js +0 -30
  24. package/dist/contracts/circadian-default.js.map +0 -1
  25. package/dist/contracts/circadian.d.ts +0 -92
  26. package/dist/contracts/circadian.d.ts.map +0 -1
  27. package/dist/contracts/circadian.js +0 -14
  28. package/dist/contracts/circadian.js.map +0 -1
  29. package/dist/contracts/health.d.ts +0 -9
  30. package/dist/contracts/health.d.ts.map +0 -1
  31. package/dist/contracts/health.js +0 -21
  32. package/dist/contracts/health.js.map +0 -1
  33. package/dist/contracts/lifeops-connector-degradation.d.ts +0 -9
  34. package/dist/contracts/lifeops-connector-degradation.d.ts.map +0 -1
  35. package/dist/contracts/lifeops-connector-degradation.js +0 -17
  36. package/dist/contracts/lifeops-connector-degradation.js.map +0 -1
  37. package/dist/contracts/lifeops.d.ts +0 -3123
  38. package/dist/contracts/lifeops.d.ts.map +0 -1
  39. package/dist/contracts/lifeops.js +0 -635
  40. package/dist/contracts/lifeops.js.map +0 -1
  41. package/dist/contracts/permissions.d.ts +0 -39
  42. package/dist/contracts/permissions.d.ts.map +0 -1
  43. package/dist/contracts/permissions.js +0 -1
  44. package/dist/contracts/permissions.js.map +0 -1
  45. package/dist/default-packs/bedtime.d.ts +0 -14
  46. package/dist/default-packs/bedtime.d.ts.map +0 -1
  47. package/dist/default-packs/bedtime.js +0 -48
  48. package/dist/default-packs/bedtime.js.map +0 -1
  49. package/dist/default-packs/contract-stubs.d.ts +0 -161
  50. package/dist/default-packs/contract-stubs.d.ts.map +0 -1
  51. package/dist/default-packs/contract-stubs.js +0 -1
  52. package/dist/default-packs/contract-stubs.js.map +0 -1
  53. package/dist/default-packs/index.d.ts +0 -18
  54. package/dist/default-packs/index.d.ts.map +0 -1
  55. package/dist/default-packs/index.js +0 -39
  56. package/dist/default-packs/index.js.map +0 -1
  57. package/dist/default-packs/sleep-recap.d.ts +0 -14
  58. package/dist/default-packs/sleep-recap.d.ts.map +0 -1
  59. package/dist/default-packs/sleep-recap.js +0 -51
  60. package/dist/default-packs/sleep-recap.js.map +0 -1
  61. package/dist/default-packs/wake-up.d.ts +0 -14
  62. package/dist/default-packs/wake-up.d.ts.map +0 -1
  63. package/dist/default-packs/wake-up.js +0 -61
  64. package/dist/default-packs/wake-up.js.map +0 -1
  65. package/dist/health-bridge/health-bridge.d.ts +0 -57
  66. package/dist/health-bridge/health-bridge.d.ts.map +0 -1
  67. package/dist/health-bridge/health-bridge.js +0 -558
  68. package/dist/health-bridge/health-bridge.js.map +0 -1
  69. package/dist/health-bridge/health-connectors.d.ts +0 -23
  70. package/dist/health-bridge/health-connectors.d.ts.map +0 -1
  71. package/dist/health-bridge/health-connectors.js +0 -1018
  72. package/dist/health-bridge/health-connectors.js.map +0 -1
  73. package/dist/health-bridge/health-oauth.d.ts +0 -62
  74. package/dist/health-bridge/health-oauth.d.ts.map +0 -1
  75. package/dist/health-bridge/health-oauth.js +0 -432
  76. package/dist/health-bridge/health-oauth.js.map +0 -1
  77. package/dist/health-bridge/health-provider-registry.d.ts +0 -89
  78. package/dist/health-bridge/health-provider-registry.d.ts.map +0 -1
  79. package/dist/health-bridge/health-provider-registry.js +0 -141
  80. package/dist/health-bridge/health-provider-registry.js.map +0 -1
  81. package/dist/health-bridge/health-records.d.ts +0 -14
  82. package/dist/health-bridge/health-records.d.ts.map +0 -1
  83. package/dist/health-bridge/health-records.js +0 -45
  84. package/dist/health-bridge/health-records.js.map +0 -1
  85. package/dist/health-bridge/index.d.ts +0 -22
  86. package/dist/health-bridge/index.d.ts.map +0 -1
  87. package/dist/health-bridge/index.js +0 -7
  88. package/dist/health-bridge/index.js.map +0 -1
  89. package/dist/health-bridge/service-normalize-health.d.ts +0 -3
  90. package/dist/health-bridge/service-normalize-health.d.ts.map +0 -1
  91. package/dist/health-bridge/service-normalize-health.js +0 -96
  92. package/dist/health-bridge/service-normalize-health.js.map +0 -1
  93. package/dist/index.d.ts +0 -41
  94. package/dist/index.d.ts.map +0 -1
  95. package/dist/index.js +0 -62
  96. package/dist/index.js.map +0 -1
  97. package/dist/screen-time/index.d.ts +0 -23
  98. package/dist/screen-time/index.d.ts.map +0 -1
  99. package/dist/screen-time/index.js +0 -1
  100. package/dist/screen-time/index.js.map +0 -1
  101. package/dist/sleep/awake-probability.d.ts +0 -11
  102. package/dist/sleep/awake-probability.d.ts.map +0 -1
  103. package/dist/sleep/awake-probability.js +0 -163
  104. package/dist/sleep/awake-probability.js.map +0 -1
  105. package/dist/sleep/circadian-rules.d.ts +0 -45
  106. package/dist/sleep/circadian-rules.d.ts.map +0 -1
  107. package/dist/sleep/circadian-rules.js +0 -258
  108. package/dist/sleep/circadian-rules.js.map +0 -1
  109. package/dist/sleep/index.d.ts +0 -21
  110. package/dist/sleep/index.d.ts.map +0 -1
  111. package/dist/sleep/index.js +0 -11
  112. package/dist/sleep/index.js.map +0 -1
  113. package/dist/sleep/sleep-cycle-dispatch.d.ts +0 -75
  114. package/dist/sleep/sleep-cycle-dispatch.d.ts.map +0 -1
  115. package/dist/sleep/sleep-cycle-dispatch.js +0 -102
  116. package/dist/sleep/sleep-cycle-dispatch.js.map +0 -1
  117. package/dist/sleep/sleep-cycle.d.ts +0 -38
  118. package/dist/sleep/sleep-cycle.d.ts.map +0 -1
  119. package/dist/sleep/sleep-cycle.js +0 -418
  120. package/dist/sleep/sleep-cycle.js.map +0 -1
  121. package/dist/sleep/sleep-episode-store.d.ts +0 -25
  122. package/dist/sleep/sleep-episode-store.d.ts.map +0 -1
  123. package/dist/sleep/sleep-episode-store.js +0 -69
  124. package/dist/sleep/sleep-episode-store.js.map +0 -1
  125. package/dist/sleep/sleep-episode-types.d.ts +0 -38
  126. package/dist/sleep/sleep-episode-types.d.ts.map +0 -1
  127. package/dist/sleep/sleep-episode-types.js +0 -14
  128. package/dist/sleep/sleep-episode-types.js.map +0 -1
  129. package/dist/sleep/sleep-recap.d.ts +0 -19
  130. package/dist/sleep/sleep-recap.d.ts.map +0 -1
  131. package/dist/sleep/sleep-recap.js +0 -1
  132. package/dist/sleep/sleep-recap.js.map +0 -1
  133. package/dist/sleep/sleep-regularity.d.ts +0 -19
  134. package/dist/sleep/sleep-regularity.d.ts.map +0 -1
  135. package/dist/sleep/sleep-regularity.js +0 -242
  136. package/dist/sleep/sleep-regularity.js.map +0 -1
  137. package/dist/sleep/sleep-wake-events.d.ts +0 -58
  138. package/dist/sleep/sleep-wake-events.d.ts.map +0 -1
  139. package/dist/sleep/sleep-wake-events.js +0 -135
  140. package/dist/sleep/sleep-wake-events.js.map +0 -1
  141. package/dist/sleep/source-reliability.d.ts +0 -38
  142. package/dist/sleep/source-reliability.d.ts.map +0 -1
  143. package/dist/sleep/source-reliability.js +0 -62
  144. package/dist/sleep/source-reliability.js.map +0 -1
  145. package/dist/util/index.d.ts +0 -10
  146. package/dist/util/index.d.ts.map +0 -1
  147. package/dist/util/index.js +0 -3
  148. package/dist/util/index.js.map +0 -1
  149. package/dist/util/normalize.d.ts +0 -22
  150. package/dist/util/normalize.d.ts.map +0 -1
  151. package/dist/util/normalize.js +0 -62
  152. package/dist/util/normalize.js.map +0 -1
  153. package/dist/util/time-util.d.ts +0 -10
  154. package/dist/util/time-util.d.ts.map +0 -1
  155. package/dist/util/time-util.js +0 -14
  156. package/dist/util/time-util.js.map +0 -1
  157. package/dist/util/time.d.ts +0 -17
  158. package/dist/util/time.d.ts.map +0 -1
  159. package/dist/util/time.js +0 -152
  160. package/dist/util/time.js.map +0 -1
  161. package/dist/util/token-encryption.d.ts +0 -42
  162. package/dist/util/token-encryption.d.ts.map +0 -1
  163. package/dist/util/token-encryption.js +0 -96
  164. package/dist/util/token-encryption.js.map +0 -1
@@ -1,202 +0,0 @@
1
- import { logger } from "@elizaos/core";
2
- import { getHealthProviderSpec } from "../health-bridge/health-provider-registry.js";
3
- export * from "./contract-stubs.js";
4
- const HEALTH_CONNECTOR_KINDS = [
5
- "apple_health",
6
- "google_fit",
7
- "strava",
8
- "fitbit",
9
- "withings",
10
- "oura"
11
- ];
12
- const HEALTH_ANCHORS = [
13
- "wake.observed",
14
- "wake.confirmed",
15
- "bedtime.target",
16
- "nap.start"
17
- ];
18
- const HEALTH_BUS_FAMILIES = [
19
- "health.sleep.detected",
20
- "health.sleep.ended",
21
- "health.wake.observed",
22
- "health.wake.confirmed",
23
- "health.nap.detected",
24
- "health.bedtime.imminent",
25
- "health.regularity.changed",
26
- "health.workout.completed"
27
- ];
28
- const HEALTH_CONNECTOR_CAPABILITIES = {
29
- apple_health: [
30
- "health.sleep.read",
31
- "health.activity.read",
32
- "health.workouts.read",
33
- "health.body.read",
34
- "health.vitals.read"
35
- ],
36
- google_fit: [
37
- "health.sleep.read",
38
- "health.activity.read",
39
- "health.workouts.read",
40
- "health.body.read",
41
- "health.vitals.read"
42
- ],
43
- strava: ["health.activity.read", "health.workouts.read"],
44
- fitbit: [
45
- "health.sleep.read",
46
- "health.activity.read",
47
- "health.workouts.read",
48
- "health.body.read",
49
- "health.vitals.read",
50
- "health.readiness.read"
51
- ],
52
- withings: ["health.sleep.read", "health.body.read", "health.vitals.read"],
53
- oura: [
54
- "health.sleep.read",
55
- "health.activity.read",
56
- "health.workouts.read",
57
- "health.readiness.read"
58
- ]
59
- };
60
- const CONNECTOR_LABELS = {
61
- apple_health: "Apple Health (HealthKit)",
62
- google_fit: "Google Fit",
63
- strava: "Strava",
64
- fitbit: "Fitbit",
65
- withings: "Withings",
66
- oura: "Oura"
67
- };
68
- function buildConnectorContribution(kind) {
69
- const stubStatus = async () => ({
70
- state: "disconnected",
71
- message: "plugin-health Wave-1 stub: full dispatcher wiring lands when W1-F's runtime context shape is finalised.",
72
- observedAt: (/* @__PURE__ */ new Date()).toISOString()
73
- });
74
- const stubSend = async () => ({
75
- ok: false,
76
- reason: "transport_error",
77
- userActionable: true,
78
- message: "plugin-health Wave-1 stub: connector send is not yet wired; configure via the legacy lifeops health-connectors path."
79
- });
80
- const providerSpec = getHealthProviderSpec(kind);
81
- const oauth = providerSpec ? {
82
- authorizeUrl: providerSpec.oauth.authorizeUrl,
83
- tokenUrl: providerSpec.oauth.tokenUrl,
84
- revokeUrl: providerSpec.oauth.revokeUrl,
85
- scopes: providerSpec.oauth.defaultScopes
86
- } : void 0;
87
- const apiBaseUrl = providerSpec?.apiBaseUrl;
88
- return {
89
- kind,
90
- capabilities: [...HEALTH_CONNECTOR_CAPABILITIES[kind]],
91
- modes: kind === "apple_health" ? ["local"] : kind === "google_fit" ? ["local", "cloud"] : ["cloud"],
92
- describe: { label: CONNECTOR_LABELS[kind] },
93
- oauth,
94
- apiBaseUrl,
95
- start: async () => {
96
- },
97
- disconnect: async () => {
98
- },
99
- verify: async () => false,
100
- status: stubStatus,
101
- send: stubSend,
102
- read: async () => null
103
- };
104
- }
105
- function buildAnchorContribution(anchorKey) {
106
- return {
107
- anchorKey,
108
- description: `plugin-health anchor: ${anchorKey}`,
109
- source: "plugin-health"
110
- };
111
- }
112
- function buildBusFamilyContribution(family) {
113
- return {
114
- family,
115
- description: `plugin-health bus family: ${family}`,
116
- source: "plugin-health"
117
- };
118
- }
119
- function getConnectorRegistry(runtime) {
120
- return runtime.connectorRegistry;
121
- }
122
- function getAnchorRegistry(runtime) {
123
- return runtime.anchorRegistry;
124
- }
125
- function getBusFamilyRegistry(runtime) {
126
- return runtime.busFamilyRegistry;
127
- }
128
- function registerHealthConnectors(runtime) {
129
- const registry = getConnectorRegistry(runtime);
130
- if (!registry) {
131
- logger.info(
132
- { src: "plugin:health", waiting_on: "W1-F connectorRegistry" },
133
- "Skipping plugin-health connector registration (registry not yet available)"
134
- );
135
- return;
136
- }
137
- for (const kind of HEALTH_CONNECTOR_KINDS) {
138
- registry.register(buildConnectorContribution(kind));
139
- }
140
- logger.info(
141
- {
142
- src: "plugin:health",
143
- registered: HEALTH_CONNECTOR_KINDS.length,
144
- kinds: HEALTH_CONNECTOR_KINDS
145
- },
146
- "Registered plugin-health connectors"
147
- );
148
- }
149
- function registerHealthAnchors(runtime) {
150
- const registry = getAnchorRegistry(runtime);
151
- if (!registry) {
152
- logger.info(
153
- { src: "plugin:health", waiting_on: "W1-A anchorRegistry" },
154
- "Skipping plugin-health anchor registration (registry not yet available)"
155
- );
156
- return;
157
- }
158
- for (const anchorKey of HEALTH_ANCHORS) {
159
- if (registry.get(anchorKey)) {
160
- continue;
161
- }
162
- registry.register(buildAnchorContribution(anchorKey));
163
- }
164
- logger.info(
165
- {
166
- src: "plugin:health",
167
- registered: HEALTH_ANCHORS.length,
168
- anchors: HEALTH_ANCHORS
169
- },
170
- "Registered plugin-health anchors"
171
- );
172
- }
173
- function registerHealthBusFamilies(runtime) {
174
- const registry = getBusFamilyRegistry(runtime);
175
- if (!registry) {
176
- logger.info(
177
- { src: "plugin:health", waiting_on: "W1-A or W2-D busFamilyRegistry" },
178
- "Skipping plugin-health bus-family registration (registry not yet available)"
179
- );
180
- return;
181
- }
182
- for (const family of HEALTH_BUS_FAMILIES) {
183
- registry.register(buildBusFamilyContribution(family));
184
- }
185
- logger.info(
186
- {
187
- src: "plugin:health",
188
- registered: HEALTH_BUS_FAMILIES.length,
189
- families: HEALTH_BUS_FAMILIES
190
- },
191
- "Registered plugin-health bus families"
192
- );
193
- }
194
- export {
195
- HEALTH_ANCHORS,
196
- HEALTH_BUS_FAMILIES,
197
- HEALTH_CONNECTOR_KINDS,
198
- registerHealthAnchors,
199
- registerHealthBusFamilies,
200
- registerHealthConnectors
201
- };
202
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/connectors/index.ts"],"sourcesContent":["/**\n * Connector / anchor / bus-family registration entry point.\n *\n * Per `wave1-interfaces.md` §5.1 / §5.2 / §5.3, plugin-health contributes:\n *\n * - 6 ConnectorContributions: apple_health, google_fit, strava, fitbit,\n * withings, oura\n * - 4 anchors: wake.observed, wake.confirmed, bedtime.target, nap.start\n * - 8 bus families: health.sleep.detected, health.sleep.ended,\n * health.wake.observed, health.wake.confirmed, health.nap.detected,\n * health.bedtime.imminent, health.regularity.changed,\n * health.workout.completed\n *\n * Registration is best-effort: if W1-A / W1-F's runtime registries have not\n * landed yet, this module logs a one-line skip and continues. The connector\n * / anchor / bus-family identifiers are still exported as constants so\n * other Wave-1 agents can reference them.\n */\n\nimport { logger } from \"@elizaos/core\";\nimport { getHealthProviderSpec } from \"../health-bridge/health-provider-registry.js\";\nimport type {\n AnchorContribution,\n AnchorRegistry,\n BusFamilyContribution,\n BusFamilyRegistry,\n ConnectorContribution,\n ConnectorOAuthConfig,\n ConnectorRegistry,\n ConnectorStatus,\n DispatchResult,\n RuntimeWithHealthRegistries,\n} from \"./contract-stubs.js\";\n\nexport * from \"./contract-stubs.js\";\n\ntype RuntimeHealthRegistryHost = object & RuntimeWithHealthRegistries;\n\nexport const HEALTH_CONNECTOR_KINDS = [\n \"apple_health\",\n \"google_fit\",\n \"strava\",\n \"fitbit\",\n \"withings\",\n \"oura\",\n] as const satisfies readonly string[];\n\nexport const HEALTH_ANCHORS = [\n \"wake.observed\",\n \"wake.confirmed\",\n \"bedtime.target\",\n \"nap.start\",\n] as const satisfies readonly string[];\n\nexport const HEALTH_BUS_FAMILIES = [\n \"health.sleep.detected\",\n \"health.sleep.ended\",\n \"health.wake.observed\",\n \"health.wake.confirmed\",\n \"health.nap.detected\",\n \"health.bedtime.imminent\",\n \"health.regularity.changed\",\n \"health.workout.completed\",\n] as const satisfies readonly string[];\n\n/**\n * Capability strings published by plugin-health connectors. Matches the\n * `LIFEOPS_HEALTH_CONNECTOR_CAPABILITIES` set in `../contracts/health.js` so a\n * planner querying `connectorRegistry.byCapability(\"health.sleep.read\")`\n * resolves the correct contributors.\n */\nconst HEALTH_CONNECTOR_CAPABILITIES: Record<\n (typeof HEALTH_CONNECTOR_KINDS)[number],\n readonly string[]\n> = {\n apple_health: [\n \"health.sleep.read\",\n \"health.activity.read\",\n \"health.workouts.read\",\n \"health.body.read\",\n \"health.vitals.read\",\n ],\n google_fit: [\n \"health.sleep.read\",\n \"health.activity.read\",\n \"health.workouts.read\",\n \"health.body.read\",\n \"health.vitals.read\",\n ],\n strava: [\"health.activity.read\", \"health.workouts.read\"],\n fitbit: [\n \"health.sleep.read\",\n \"health.activity.read\",\n \"health.workouts.read\",\n \"health.body.read\",\n \"health.vitals.read\",\n \"health.readiness.read\",\n ],\n withings: [\"health.sleep.read\", \"health.body.read\", \"health.vitals.read\"],\n oura: [\n \"health.sleep.read\",\n \"health.activity.read\",\n \"health.workouts.read\",\n \"health.readiness.read\",\n ],\n};\n\nconst CONNECTOR_LABELS: Record<\n (typeof HEALTH_CONNECTOR_KINDS)[number],\n string\n> = {\n apple_health: \"Apple Health (HealthKit)\",\n google_fit: \"Google Fit\",\n strava: \"Strava\",\n fitbit: \"Fitbit\",\n withings: \"Withings\",\n oura: \"Oura\",\n};\n\n/**\n * Wave-1 placeholder dispatcher. The actual `start` / `verify` / `status` /\n * `read` implementations live in `health-bridge.ts` + `health-connectors.ts`\n * and require a fully-wired runtime context (credentials store, OAuth\n * sessions, repository factory) that the W1-F generic ConnectorRegistry\n * hasn't standardised yet.\n *\n * Until W1-F publishes the runtime context shape, the contribution emits\n * `disconnected` for status checks and `transport_error` for send/read so\n * downstream task scheduling treats the connector as unavailable rather\n * than silently no-op'ing.\n */\nfunction buildConnectorContribution(\n kind: (typeof HEALTH_CONNECTOR_KINDS)[number],\n): ConnectorContribution {\n const stubStatus = async (): Promise<ConnectorStatus> => ({\n state: \"disconnected\",\n message:\n \"plugin-health Wave-1 stub: full dispatcher wiring lands when W1-F's runtime context shape is finalised.\",\n observedAt: new Date().toISOString(),\n });\n const stubSend = async (): Promise<DispatchResult> => ({\n ok: false,\n reason: \"transport_error\",\n userActionable: true,\n message:\n \"plugin-health Wave-1 stub: connector send is not yet wired; configure via the legacy lifeops health-connectors path.\",\n });\n // URL provided by the connector contribution; the dispatcher does not\n // hardcode. The OAuth-bridged providers (strava / fitbit / withings / oura)\n // surface their authorize / token / api-base URLs from the canonical\n // health-provider registry.\n const providerSpec = getHealthProviderSpec(kind);\n const oauth: ConnectorOAuthConfig | undefined = providerSpec\n ? {\n authorizeUrl: providerSpec.oauth.authorizeUrl,\n tokenUrl: providerSpec.oauth.tokenUrl,\n revokeUrl: providerSpec.oauth.revokeUrl,\n scopes: providerSpec.oauth.defaultScopes,\n }\n : undefined;\n const apiBaseUrl = providerSpec?.apiBaseUrl;\n return {\n kind,\n capabilities: [...HEALTH_CONNECTOR_CAPABILITIES[kind]],\n modes:\n kind === \"apple_health\"\n ? [\"local\"]\n : kind === \"google_fit\"\n ? [\"local\", \"cloud\"]\n : [\"cloud\"],\n describe: { label: CONNECTOR_LABELS[kind] },\n oauth,\n apiBaseUrl,\n start: async () => {\n // Wave-1 stub — concrete start lives in `health-bridge.ts` /\n // `health-connectors.ts` and is invoked through the legacy\n // app-lifeops mixin path until W1-F's generic dispatcher lands.\n },\n disconnect: async () => {\n // Wave-1 stub — concrete disconnect lives in `health-oauth.ts`.\n },\n verify: async () => false,\n status: stubStatus,\n send: stubSend,\n read: async () => null,\n };\n}\n\nfunction buildAnchorContribution(anchorKey: string): AnchorContribution {\n return {\n anchorKey,\n description: `plugin-health anchor: ${anchorKey}`,\n source: \"plugin-health\",\n };\n}\n\nfunction buildBusFamilyContribution(family: string): BusFamilyContribution {\n return {\n family,\n description: `plugin-health bus family: ${family}`,\n source: \"plugin-health\",\n };\n}\n\nfunction getConnectorRegistry(\n runtime: RuntimeHealthRegistryHost,\n): ConnectorRegistry | undefined {\n return runtime.connectorRegistry;\n}\n\nfunction getAnchorRegistry(\n runtime: RuntimeHealthRegistryHost,\n): AnchorRegistry | undefined {\n return runtime.anchorRegistry;\n}\n\nfunction getBusFamilyRegistry(\n runtime: RuntimeHealthRegistryHost,\n): BusFamilyRegistry | undefined {\n return runtime.busFamilyRegistry;\n}\n\nexport function registerHealthConnectors(\n runtime: RuntimeHealthRegistryHost,\n): void {\n const registry = getConnectorRegistry(runtime);\n if (!registry) {\n logger.info(\n { src: \"plugin:health\", waiting_on: \"W1-F connectorRegistry\" },\n \"Skipping plugin-health connector registration (registry not yet available)\",\n );\n return;\n }\n for (const kind of HEALTH_CONNECTOR_KINDS) {\n registry.register(buildConnectorContribution(kind));\n }\n logger.info(\n {\n src: \"plugin:health\",\n registered: HEALTH_CONNECTOR_KINDS.length,\n kinds: HEALTH_CONNECTOR_KINDS,\n },\n \"Registered plugin-health connectors\",\n );\n}\n\nexport function registerHealthAnchors(\n runtime: RuntimeHealthRegistryHost,\n): void {\n const registry = getAnchorRegistry(runtime);\n if (!registry) {\n logger.info(\n { src: \"plugin:health\", waiting_on: \"W1-A anchorRegistry\" },\n \"Skipping plugin-health anchor registration (registry not yet available)\",\n );\n return;\n }\n for (const anchorKey of HEALTH_ANCHORS) {\n if (registry.get(anchorKey)) {\n continue;\n }\n registry.register(buildAnchorContribution(anchorKey));\n }\n logger.info(\n {\n src: \"plugin:health\",\n registered: HEALTH_ANCHORS.length,\n anchors: HEALTH_ANCHORS,\n },\n \"Registered plugin-health anchors\",\n );\n}\n\nexport function registerHealthBusFamilies(\n runtime: RuntimeHealthRegistryHost,\n): void {\n const registry = getBusFamilyRegistry(runtime);\n if (!registry) {\n logger.info(\n { src: \"plugin:health\", waiting_on: \"W1-A or W2-D busFamilyRegistry\" },\n \"Skipping plugin-health bus-family registration (registry not yet available)\",\n );\n return;\n }\n for (const family of HEALTH_BUS_FAMILIES) {\n registry.register(buildBusFamilyContribution(family));\n }\n logger.info(\n {\n src: \"plugin:health\",\n registered: HEALTH_BUS_FAMILIES.length,\n families: HEALTH_BUS_FAMILIES,\n },\n \"Registered plugin-health bus families\",\n );\n}\n"],"mappings":"AAmBA,SAAS,cAAc;AACvB,SAAS,6BAA6B;AActC,cAAc;AAIP,MAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAQA,MAAM,gCAGF;AAAA,EACF,cAAc;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,QAAQ,CAAC,wBAAwB,sBAAsB;AAAA,EACvD,QAAQ;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,UAAU,CAAC,qBAAqB,oBAAoB,oBAAoB;AAAA,EACxE,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA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A,MACE,KAAK;AAAA,MACL,YAAY,oBAAoB;AAAA,MAChC,UAAU;AAAA,IACZ;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1,15 +0,0 @@
1
- /**
2
- * Default `CircadianInsightContract` registered by `plugin-health` during
3
- * `init`. Consumers (e.g. `app-lifeops` SCHEDULE / SCHEDULED_TASK) read
4
- * through this contract instead of importing plugin-health internals.
5
- *
6
- * The default implementation is intentionally conservative: it returns
7
- * `state=null` / `recommendedAtIso=null` until a richer impl is registered
8
- * (e.g. by app-lifeops once its scheduler tick produces a fresh insight).
9
- * This keeps the contract honest — callers can always tell whether
10
- * inference is calibrated, and never mistake an uninitialized field for a
11
- * meaningful zero.
12
- */
13
- import type { CircadianInsightContract } from "./circadian.js";
14
- export declare function createDefaultCircadianInsightContract(): CircadianInsightContract;
15
- //# sourceMappingURL=circadian-default.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"circadian-default.d.ts","sourceRoot":"","sources":["../../src/contracts/circadian-default.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,wBAAwB,EAGzB,MAAM,gBAAgB,CAAC;AAExB,wBAAgB,qCAAqC,IAAI,wBAAwB,CAyBhF"}
@@ -1,30 +0,0 @@
1
- function createDefaultCircadianInsightContract() {
2
- return {
3
- async getCurrentSleepWindow() {
4
- return {
5
- state: null,
6
- confidence: 0,
7
- lastWakeAtIso: null,
8
- currentSleepStartedAtIso: null,
9
- bedtimeTargetAtIso: null
10
- };
11
- },
12
- async inferOptimalSchedulingWindow() {
13
- return {
14
- recommendedAtIso: null,
15
- nextMealLabel: null,
16
- windowStartIso: null,
17
- windowEndIso: null,
18
- confidence: 0,
19
- reason: "circadian inference not calibrated"
20
- };
21
- },
22
- async getLatestInsight() {
23
- return null;
24
- }
25
- };
26
- }
27
- export {
28
- createDefaultCircadianInsightContract
29
- };
30
- //# sourceMappingURL=circadian-default.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/contracts/circadian-default.ts"],"sourcesContent":["/**\n * Default `CircadianInsightContract` registered by `plugin-health` during\n * `init`. Consumers (e.g. `app-lifeops` SCHEDULE / SCHEDULED_TASK) read\n * through this contract instead of importing plugin-health internals.\n *\n * The default implementation is intentionally conservative: it returns\n * `state=null` / `recommendedAtIso=null` until a richer impl is registered\n * (e.g. by app-lifeops once its scheduler tick produces a fresh insight).\n * This keeps the contract honest — callers can always tell whether\n * inference is calibrated, and never mistake an uninitialized field for a\n * meaningful zero.\n */\n\nimport type {\n CircadianInsightContract,\n SchedulingWindow,\n SleepWindow,\n} from \"./circadian.js\";\n\nexport function createDefaultCircadianInsightContract(): CircadianInsightContract {\n return {\n async getCurrentSleepWindow(): Promise<SleepWindow> {\n return {\n state: null,\n confidence: 0,\n lastWakeAtIso: null,\n currentSleepStartedAtIso: null,\n bedtimeTargetAtIso: null,\n };\n },\n async inferOptimalSchedulingWindow(): Promise<SchedulingWindow> {\n return {\n recommendedAtIso: null,\n nextMealLabel: null,\n windowStartIso: null,\n windowEndIso: null,\n confidence: 0,\n reason: \"circadian inference not calibrated\",\n };\n },\n async getLatestInsight() {\n return null;\n },\n };\n}\n"],"mappings":"AAmBO,SAAS,wCAAkE;AAChF,SAAO;AAAA,IACL,MAAM,wBAA8C;AAClD,aAAO;AAAA,QACL,OAAO;AAAA,QACP,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,0BAA0B;AAAA,QAC1B,oBAAoB;AAAA,MACtB;AAAA,IACF;AAAA,IACA,MAAM,+BAA0D;AAC9D,aAAO;AAAA,QACL,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,gBAAgB;AAAA,QAChB,cAAc;AAAA,QACd,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,IACA,MAAM,mBAAmB;AACvB,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
@@ -1,92 +0,0 @@
1
- /**
2
- * `CircadianInsightContract` — runtime-registered seam between
3
- * `app-lifeops` (and other consumers) and the plugin-health circadian +
4
- * sleep-inference internals.
5
- *
6
- * W3-C drift D-4: prior to this contract, `app-lifeops/src/lifeops/
7
- * schedule-insight.ts` and downstream actions reached directly into
8
- * `@elizaos/plugin-health/src/sleep/*` for circadian scoring, awake
9
- * probability, sleep-cycle resolution, regularity scoring, and historical
10
- * episode reads. Per `post-cleanup-architecture.md` the sleep / circadian
11
- * / screen-time domain is owned by `plugin-health`. Consumers now read
12
- * through the contract registered on the runtime; the concrete
13
- * implementation continues to live inside `plugin-health` (where the
14
- * domain helpers live), so deep imports stay private to the plugin.
15
- *
16
- * The contract is read-only — the only writer of fresh inference is the
17
- * scheduler tick wired through `LifeOpsService.inspectSchedule`. Consumers
18
- * that just want "what does the scheduler currently believe" should call
19
- * `getCurrentSleepWindow` / `inferOptimalSchedulingWindow` instead of
20
- * driving fresh inspection themselves.
21
- */
22
- import type { IAgentRuntime } from "@elizaos/core";
23
- import type { LifeOpsCircadianState, LifeOpsScheduleInsight, LifeOpsScheduleMealLabel } from "@elizaos/shared";
24
- /**
25
- * The contract's view of "the current sleep window". `state` is null when
26
- * inference has not produced a high-confidence answer yet.
27
- */
28
- export interface SleepWindow {
29
- /** Current circadian phase, or null when inference is still calibrating. */
30
- state: LifeOpsCircadianState | null;
31
- /** Confidence in `state` on [0, 1]. */
32
- confidence: number;
33
- /** ISO-8601 timestamp of the last inferred wake event, when known. */
34
- lastWakeAtIso: string | null;
35
- /** ISO-8601 timestamp of the current sleep onset, when the user is asleep. */
36
- currentSleepStartedAtIso: string | null;
37
- /** ISO-8601 next bedtime target, when the model has one. */
38
- bedtimeTargetAtIso: string | null;
39
- }
40
- /**
41
- * "When should I schedule something so it lands in the user's optimal
42
- * window?" The contract exposes the inference output without committing
43
- * callers to a particular meal/sleep cycle representation.
44
- */
45
- export interface SchedulingWindow {
46
- /** Most appropriate ISO-8601 fire time for the next scheduled task. */
47
- recommendedAtIso: string | null;
48
- /** Optional meal label when the scheduler is targeting a meal-window. */
49
- nextMealLabel: LifeOpsScheduleMealLabel | null;
50
- /** ISO-8601 lower bound of the window. */
51
- windowStartIso: string | null;
52
- /** ISO-8601 upper bound of the window. */
53
- windowEndIso: string | null;
54
- /** Confidence in the recommendation on [0, 1]. */
55
- confidence: number;
56
- /**
57
- * Free-form reason for the recommendation, e.g. "next meal window
58
- * (lunch) starts in 12 minutes" or "still calibrating, defer to manual".
59
- * The string is stable and intended for surfacing to the user.
60
- */
61
- reason: string;
62
- }
63
- export interface SleepWindowOptions {
64
- /** Optional IANA timezone override (defaults to the owner's resolved tz). */
65
- timezone?: string;
66
- }
67
- export interface SchedulingWindowOptions {
68
- timezone?: string;
69
- }
70
- /**
71
- * Public contract every consumer reads. The implementation lives in
72
- * `plugin-health`; consumers resolve it via `getCircadianInsightContract`.
73
- */
74
- export interface CircadianInsightContract {
75
- /** Snapshot of "are they awake / asleep / napping right now?". */
76
- getCurrentSleepWindow(opts?: SleepWindowOptions): Promise<SleepWindow>;
77
- /**
78
- * Snapshot of "when should the next scheduled task fire to land in the
79
- * owner's optimal window?". Returns recommendedAtIso=null when
80
- * inference is still calibrating.
81
- */
82
- inferOptimalSchedulingWindow(opts?: SchedulingWindowOptions): Promise<SchedulingWindow>;
83
- /**
84
- * Direct accessor for the underlying scheduler-tick insight record.
85
- * Returned for read-only consumption (UI, debug routes); writers must
86
- * go through the scheduler tick.
87
- */
88
- getLatestInsight(opts?: SchedulingWindowOptions): Promise<LifeOpsScheduleInsight | null>;
89
- }
90
- export declare function registerCircadianInsightContract(runtime: IAgentRuntime, contract: CircadianInsightContract): void;
91
- export declare function getCircadianInsightContract(runtime: IAgentRuntime): CircadianInsightContract | null;
92
- //# sourceMappingURL=circadian.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"circadian.d.ts","sourceRoot":"","sources":["../../src/contracts/circadian.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,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,IAAI,CAAC,EAAE,uBAAuB,GAC7B,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;CAC3C;AAYD,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,wBAAwB,GACjC,IAAI,CAEN;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,aAAa,GACrB,wBAAwB,GAAG,IAAI,CAIjC"}
@@ -1,14 +0,0 @@
1
- const CIRCADIAN_CONTRACT_KEY = /* @__PURE__ */ Symbol.for(
2
- "@elizaos/plugin-health:circadian-insight-contract"
3
- );
4
- function registerCircadianInsightContract(runtime, contract) {
5
- runtime[CIRCADIAN_CONTRACT_KEY] = contract;
6
- }
7
- function getCircadianInsightContract(runtime) {
8
- return runtime[CIRCADIAN_CONTRACT_KEY] ?? null;
9
- }
10
- export {
11
- getCircadianInsightContract,
12
- registerCircadianInsightContract
13
- };
14
- //# sourceMappingURL=circadian.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/contracts/circadian.ts"],"sourcesContent":["/**\n * `CircadianInsightContract` — runtime-registered seam between\n * `app-lifeops` (and other consumers) and the plugin-health circadian +\n * sleep-inference internals.\n *\n * W3-C drift D-4: prior to this contract, `app-lifeops/src/lifeops/\n * schedule-insight.ts` and downstream actions reached directly into\n * `@elizaos/plugin-health/src/sleep/*` for circadian scoring, awake\n * probability, sleep-cycle resolution, regularity scoring, and historical\n * episode reads. Per `post-cleanup-architecture.md` the sleep / circadian\n * / screen-time domain is owned by `plugin-health`. Consumers now read\n * through the contract registered on the runtime; the concrete\n * implementation continues to live inside `plugin-health` (where the\n * domain helpers live), so deep imports stay private to the plugin.\n *\n * The contract is read-only — the only writer of fresh inference is the\n * scheduler tick wired through `LifeOpsService.inspectSchedule`. Consumers\n * that just want \"what does the scheduler currently believe\" should call\n * `getCurrentSleepWindow` / `inferOptimalSchedulingWindow` instead of\n * driving fresh inspection themselves.\n */\n\nimport type { IAgentRuntime } from \"@elizaos/core\";\nimport type {\n LifeOpsCircadianState,\n LifeOpsScheduleInsight,\n LifeOpsScheduleMealLabel,\n} from \"@elizaos/shared\";\n\n/**\n * The contract's view of \"the current sleep window\". `state` is null when\n * inference has not produced a high-confidence answer yet.\n */\nexport interface SleepWindow {\n /** Current circadian phase, or null when inference is still calibrating. */\n state: LifeOpsCircadianState | null;\n /** Confidence in `state` on [0, 1]. */\n confidence: number;\n /** ISO-8601 timestamp of the last inferred wake event, when known. */\n lastWakeAtIso: string | null;\n /** ISO-8601 timestamp of the current sleep onset, when the user is asleep. */\n currentSleepStartedAtIso: string | null;\n /** ISO-8601 next bedtime target, when the model has one. */\n bedtimeTargetAtIso: string | null;\n}\n\n/**\n * \"When should I schedule something so it lands in the user's optimal\n * window?\" The contract exposes the inference output without committing\n * callers to a particular meal/sleep cycle representation.\n */\nexport interface SchedulingWindow {\n /** Most appropriate ISO-8601 fire time for the next scheduled task. */\n recommendedAtIso: string | null;\n /** Optional meal label when the scheduler is targeting a meal-window. */\n nextMealLabel: LifeOpsScheduleMealLabel | null;\n /** ISO-8601 lower bound of the window. */\n windowStartIso: string | null;\n /** ISO-8601 upper bound of the window. */\n windowEndIso: string | null;\n /** Confidence in the recommendation on [0, 1]. */\n confidence: number;\n /**\n * Free-form reason for the recommendation, e.g. \"next meal window\n * (lunch) starts in 12 minutes\" or \"still calibrating, defer to manual\".\n * The string is stable and intended for surfacing to the user.\n */\n reason: string;\n}\n\nexport interface SleepWindowOptions {\n /** Optional IANA timezone override (defaults to the owner's resolved tz). */\n timezone?: string;\n}\n\nexport interface SchedulingWindowOptions {\n timezone?: string;\n}\n\n/**\n * Public contract every consumer reads. The implementation lives in\n * `plugin-health`; consumers resolve it via `getCircadianInsightContract`.\n */\nexport interface CircadianInsightContract {\n /** Snapshot of \"are they awake / asleep / napping right now?\". */\n getCurrentSleepWindow(opts?: SleepWindowOptions): Promise<SleepWindow>;\n\n /**\n * Snapshot of \"when should the next scheduled task fire to land in the\n * owner's optimal window?\". Returns recommendedAtIso=null when\n * inference is still calibrating.\n */\n inferOptimalSchedulingWindow(\n opts?: SchedulingWindowOptions,\n ): Promise<SchedulingWindow>;\n\n /**\n * Direct accessor for the underlying scheduler-tick insight record.\n * Returned for read-only consumption (UI, debug routes); writers must\n * go through the scheduler tick.\n */\n getLatestInsight(\n opts?: SchedulingWindowOptions,\n ): Promise<LifeOpsScheduleInsight | null>;\n}\n\n// --- Runtime registration ---------------------------------------------------\n\nconst CIRCADIAN_CONTRACT_KEY = Symbol.for(\n \"@elizaos/plugin-health:circadian-insight-contract\",\n);\n\ninterface CircadianContractHostRuntime extends IAgentRuntime {\n [CIRCADIAN_CONTRACT_KEY]?: CircadianInsightContract;\n}\n\nexport function registerCircadianInsightContract(\n runtime: IAgentRuntime,\n contract: CircadianInsightContract,\n): void {\n (runtime as CircadianContractHostRuntime)[CIRCADIAN_CONTRACT_KEY] = contract;\n}\n\nexport function getCircadianInsightContract(\n runtime: IAgentRuntime,\n): CircadianInsightContract | null {\n return (\n (runtime as CircadianContractHostRuntime)[CIRCADIAN_CONTRACT_KEY] ?? null\n );\n}\n"],"mappings":"AA4GA,MAAM,yBAAyB,uBAAO;AAAA,EACpC;AACF;AAMO,SAAS,iCACd,SACA,UACM;AACN,EAAC,QAAyC,sBAAsB,IAAI;AACtE;AAEO,SAAS,4BACd,SACiC;AACjC,SACG,QAAyC,sBAAsB,KAAK;AAEzE;","names":[]}
@@ -1,9 +0,0 @@
1
- /**
2
- * plugin-health canonical contract surface.
3
- *
4
- * Owns the sleep / circadian / health-metric / screen-time types locally so
5
- * runtime plugins stay decoupled from app/shared packages.
6
- */
7
- export type { DisconnectLifeOpsHealthConnectorRequest, GetLifeOpsHealthSummaryRequest, LifeOpsActivitySignal, LifeOpsActivitySignalSource, LifeOpsAwakeProbability, LifeOpsAwakeProbabilityContributor, LifeOpsAwakeProbabilitySource, LifeOpsBedtimeImminentFilters, LifeOpsCircadianRuleFiring, LifeOpsCircadianState, LifeOpsConnectorDegradation, LifeOpsConnectorExecutionTarget, LifeOpsConnectorGrant, LifeOpsConnectorMode, LifeOpsConnectorSide, LifeOpsConnectorSourceOfTruth, LifeOpsDayBoundary, LifeOpsDayBoundaryAnchor, LifeOpsEventKind, LifeOpsHealthConnectorCapability, LifeOpsHealthConnectorProvider, LifeOpsHealthConnectorReason, LifeOpsHealthConnectorStatus, LifeOpsHealthDailySummary, LifeOpsHealthMetric, LifeOpsHealthMetricSample, LifeOpsHealthSignal, LifeOpsHealthSignalBiometrics, LifeOpsHealthSignalSleepSummary, LifeOpsHealthSignalSource, LifeOpsHealthSleepEpisode, LifeOpsHealthSleepStage, LifeOpsHealthSleepStageSample, LifeOpsHealthSummaryResponse, LifeOpsHealthSyncState, LifeOpsHealthWorkout, LifeOpsMobileHealthPayload, LifeOpsNapDetectedFilters, LifeOpsPersonalBaseline, LifeOpsRegularityChangedFilters, LifeOpsRegularityClass, LifeOpsRelativeTime, LifeOpsRelativeTimeAnchorSource, LifeOpsScheduleInsight, LifeOpsScheduleMealInsight, LifeOpsScheduleMealLabel, LifeOpsScheduleMealSource, LifeOpsScheduleRegularity, LifeOpsScheduleSleepStatus, LifeOpsScreenTimePerAppUsage, LifeOpsScreenTimeSummaryPayload, LifeOpsSleepCycle, LifeOpsSleepCycleEvidence, LifeOpsSleepCycleEvidenceSource, LifeOpsSleepCycleType, LifeOpsSleepDetectedFilters, LifeOpsSleepEndedFilters, LifeOpsSleepOnsetCandidateFilters, LifeOpsUnclearReason, LifeOpsWakeConfirmedFilters, LifeOpsWakeObservedFilters, StartLifeOpsHealthConnectorRequest, StartLifeOpsHealthConnectorResponse, SyncLifeOpsHealthConnectorRequest, } from "./lifeops.js";
8
- export { LIFEOPS_CIRCADIAN_STATES, LIFEOPS_HEALTH_CONNECTOR_CAPABILITIES, LIFEOPS_HEALTH_CONNECTOR_PROVIDERS, LIFEOPS_HEALTH_CONNECTOR_REASONS, LIFEOPS_HEALTH_METRICS, LIFEOPS_HEALTH_SIGNAL_SOURCES, LIFEOPS_HEALTH_SLEEP_STAGES, LIFEOPS_UNCLEAR_REASONS, } from "./lifeops.js";
9
- //# sourceMappingURL=health.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/contracts/health.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACV,uCAAuC,EAEvC,8BAA8B,EAC9B,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,kCAAkC,EAClC,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAE1B,qBAAqB,EACrB,2BAA2B,EAC3B,+BAA+B,EAC/B,qBAAqB,EAErB,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,gCAAgC,EAEhC,8BAA8B,EAE9B,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,EAC7B,+BAA+B,EAE/B,yBAAyB,EACzB,yBAAyB,EAEzB,uBAAuB,EACvB,6BAA6B,EAC7B,4BAA4B,EAC5B,sBAAsB,EACtB,oBAAoB,EAEpB,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,+BAA+B,EAC/B,sBAAsB,EACtB,mBAAmB,EACnB,+BAA+B,EAC/B,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAE1B,4BAA4B,EAC5B,+BAA+B,EAC/B,iBAAiB,EACjB,yBAAyB,EACzB,+BAA+B,EAC/B,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,EAExB,iCAAiC,EACjC,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,kCAAkC,EAClC,mCAAmC,EACnC,iCAAiC,GAClC,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,wBAAwB,EACxB,qCAAqC,EACrC,kCAAkC,EAClC,gCAAgC,EAChC,sBAAsB,EACtB,6BAA6B,EAC7B,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,cAAc,CAAC"}
@@ -1,21 +0,0 @@
1
- import {
2
- LIFEOPS_CIRCADIAN_STATES,
3
- LIFEOPS_HEALTH_CONNECTOR_CAPABILITIES,
4
- LIFEOPS_HEALTH_CONNECTOR_PROVIDERS,
5
- LIFEOPS_HEALTH_CONNECTOR_REASONS,
6
- LIFEOPS_HEALTH_METRICS,
7
- LIFEOPS_HEALTH_SIGNAL_SOURCES,
8
- LIFEOPS_HEALTH_SLEEP_STAGES,
9
- LIFEOPS_UNCLEAR_REASONS
10
- } from "./lifeops.js";
11
- export {
12
- LIFEOPS_CIRCADIAN_STATES,
13
- LIFEOPS_HEALTH_CONNECTOR_CAPABILITIES,
14
- LIFEOPS_HEALTH_CONNECTOR_PROVIDERS,
15
- LIFEOPS_HEALTH_CONNECTOR_REASONS,
16
- LIFEOPS_HEALTH_METRICS,
17
- LIFEOPS_HEALTH_SIGNAL_SOURCES,
18
- LIFEOPS_HEALTH_SLEEP_STAGES,
19
- LIFEOPS_UNCLEAR_REASONS
20
- };
21
- //# sourceMappingURL=health.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/contracts/health.ts"],"sourcesContent":["/**\n * plugin-health canonical contract surface.\n *\n * Owns the sleep / circadian / health-metric / screen-time types locally so\n * runtime plugins stay decoupled from app/shared packages.\n */\n\nexport type {\n DisconnectLifeOpsHealthConnectorRequest,\n // REST request/response surface\n GetLifeOpsHealthSummaryRequest,\n LifeOpsActivitySignal,\n LifeOpsActivitySignalSource,\n LifeOpsAwakeProbability,\n LifeOpsAwakeProbabilityContributor,\n LifeOpsAwakeProbabilitySource,\n LifeOpsBedtimeImminentFilters,\n LifeOpsCircadianRuleFiring,\n // Circadian inference\n LifeOpsCircadianState,\n LifeOpsConnectorDegradation,\n LifeOpsConnectorExecutionTarget,\n LifeOpsConnectorGrant,\n // Auxiliary types referenced by health surface\n LifeOpsConnectorMode,\n LifeOpsConnectorSide,\n LifeOpsConnectorSourceOfTruth,\n LifeOpsDayBoundary,\n LifeOpsDayBoundaryAnchor,\n LifeOpsEventKind,\n LifeOpsHealthConnectorCapability,\n // Connector provider / capability / metric\n LifeOpsHealthConnectorProvider,\n // Connector status / wire envelopes\n LifeOpsHealthConnectorReason,\n LifeOpsHealthConnectorStatus,\n LifeOpsHealthDailySummary,\n LifeOpsHealthMetric,\n LifeOpsHealthMetricSample,\n LifeOpsHealthSignal,\n LifeOpsHealthSignalBiometrics,\n LifeOpsHealthSignalSleepSummary,\n // Health-signal source + signal payload\n LifeOpsHealthSignalSource,\n LifeOpsHealthSleepEpisode,\n // Sleep-stage + sleep-episode model\n LifeOpsHealthSleepStage,\n LifeOpsHealthSleepStageSample,\n LifeOpsHealthSummaryResponse,\n LifeOpsHealthSyncState,\n LifeOpsHealthWorkout,\n // Telemetry mobile-health envelope\n LifeOpsMobileHealthPayload,\n LifeOpsNapDetectedFilters,\n LifeOpsPersonalBaseline,\n LifeOpsRegularityChangedFilters,\n LifeOpsRegularityClass,\n LifeOpsRelativeTime,\n LifeOpsRelativeTimeAnchorSource,\n LifeOpsScheduleInsight,\n LifeOpsScheduleMealInsight,\n LifeOpsScheduleMealLabel,\n LifeOpsScheduleMealSource,\n LifeOpsScheduleRegularity,\n LifeOpsScheduleSleepStatus,\n // Screen-time\n LifeOpsScreenTimePerAppUsage,\n LifeOpsScreenTimeSummaryPayload,\n LifeOpsSleepCycle,\n LifeOpsSleepCycleEvidence,\n LifeOpsSleepCycleEvidenceSource,\n LifeOpsSleepCycleType,\n LifeOpsSleepDetectedFilters,\n LifeOpsSleepEndedFilters,\n // Sleep / wake event filters\n LifeOpsSleepOnsetCandidateFilters,\n LifeOpsUnclearReason,\n LifeOpsWakeConfirmedFilters,\n LifeOpsWakeObservedFilters,\n StartLifeOpsHealthConnectorRequest,\n StartLifeOpsHealthConnectorResponse,\n SyncLifeOpsHealthConnectorRequest,\n} from \"./lifeops.js\";\n\nexport {\n LIFEOPS_CIRCADIAN_STATES,\n LIFEOPS_HEALTH_CONNECTOR_CAPABILITIES,\n LIFEOPS_HEALTH_CONNECTOR_PROVIDERS,\n LIFEOPS_HEALTH_CONNECTOR_REASONS,\n LIFEOPS_HEALTH_METRICS,\n LIFEOPS_HEALTH_SIGNAL_SOURCES,\n LIFEOPS_HEALTH_SLEEP_STAGES,\n LIFEOPS_UNCLEAR_REASONS,\n} from \"./lifeops.js\";\n"],"mappings":"AAoFA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
@@ -1,9 +0,0 @@
1
- export declare const LIFEOPS_CONNECTOR_DEGRADATION_AXES: readonly ["missing-scope", "rate-limited", "disconnected", "auth-expired", "session-revoked", "delivery-degraded", "helper-disconnected", "retry-idempotent", "hold-expired", "transport-offline", "blocked-resume"];
2
- export type LifeOpsConnectorDegradationAxis = (typeof LIFEOPS_CONNECTOR_DEGRADATION_AXES)[number];
3
- export interface LifeOpsConnectorDegradation {
4
- axis: LifeOpsConnectorDegradationAxis;
5
- code: string;
6
- message: string;
7
- retryable: boolean;
8
- }
9
- //# sourceMappingURL=lifeops-connector-degradation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lifeops-connector-degradation.d.ts","sourceRoot":"","sources":["../../src/contracts/lifeops-connector-degradation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kCAAkC,sNAYrC,CAAC;AAEX,MAAM,MAAM,+BAA+B,GACzC,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,+BAA+B,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB"}
@@ -1,17 +0,0 @@
1
- const LIFEOPS_CONNECTOR_DEGRADATION_AXES = [
2
- "missing-scope",
3
- "rate-limited",
4
- "disconnected",
5
- "auth-expired",
6
- "session-revoked",
7
- "delivery-degraded",
8
- "helper-disconnected",
9
- "retry-idempotent",
10
- "hold-expired",
11
- "transport-offline",
12
- "blocked-resume"
13
- ];
14
- export {
15
- LIFEOPS_CONNECTOR_DEGRADATION_AXES
16
- };
17
- //# sourceMappingURL=lifeops-connector-degradation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/contracts/lifeops-connector-degradation.ts"],"sourcesContent":["export const LIFEOPS_CONNECTOR_DEGRADATION_AXES = [\n \"missing-scope\",\n \"rate-limited\",\n \"disconnected\",\n \"auth-expired\",\n \"session-revoked\",\n \"delivery-degraded\",\n \"helper-disconnected\",\n \"retry-idempotent\",\n \"hold-expired\",\n \"transport-offline\",\n \"blocked-resume\",\n] as const;\n\nexport type LifeOpsConnectorDegradationAxis =\n (typeof LIFEOPS_CONNECTOR_DEGRADATION_AXES)[number];\n\nexport interface LifeOpsConnectorDegradation {\n axis: LifeOpsConnectorDegradationAxis;\n code: string;\n message: string;\n retryable: boolean;\n}\n"],"mappings":"AAAO,MAAM,qCAAqC;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}