@audiofool/moondog 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +125 -0
  2. package/assets/brand/moondog-lunar-record/moondog-logo-1x1.png +0 -0
  3. package/contracts/v1/capability-policy.schema.json +572 -0
  4. package/contracts/v1/definitions.schema.json +365 -0
  5. package/contracts/v1/library-track-observation.schema.json +138 -0
  6. package/contracts/v1/listening-event.schema.json +111 -0
  7. package/contracts/v1/profile-evidence.schema.json +237 -0
  8. package/contracts/v1/taste-event.schema.json +258 -0
  9. package/contracts/v1/tool-invocation.schema.json +318 -0
  10. package/contracts/v1/tool-receipt.schema.json +1066 -0
  11. package/contracts/v1/track-ref.schema.json +275 -0
  12. package/contracts/v2/profile-evidence.schema.json +284 -0
  13. package/package.json +105 -0
  14. package/scripts/contract-lib.mjs +361 -0
  15. package/scripts/contract-semantics.mjs +2630 -0
  16. package/scripts/demo-studio.mjs +58 -0
  17. package/scripts/moondog +52 -0
  18. package/scripts/moondog.mjs +954 -0
  19. package/src/core/apple-data-migration.mjs +50 -0
  20. package/src/core/apple-library-source-status.mjs +220 -0
  21. package/src/core/apple-projection-domain-services.mjs +2356 -0
  22. package/src/core/capability-catalog.mjs +577 -0
  23. package/src/core/listening-profile-domain-services.mjs +1010 -0
  24. package/src/core/lyric-library.mjs +121 -0
  25. package/src/core/lyric-profile.mjs +50 -0
  26. package/src/core/lyric-service.mjs +41 -0
  27. package/src/core/moondog-application.mjs +1827 -0
  28. package/src/core/state-directory.mjs +19 -0
  29. package/src/core/synthetic-domain-services.mjs +1485 -0
  30. package/src/core/uuid-v5.mjs +42 -0
  31. package/src/demo/fictional-spotify-history.mjs +400 -0
  32. package/src/demo/moondog-demo.mjs +355 -0
  33. package/src/demo/moondog-interactive-tasteprint-demo.mjs +293 -0
  34. package/src/demo/moondog-tasteprint-demo.mjs +631 -0
  35. package/src/importers/apple-music-library/import-batch.mjs +290 -0
  36. package/src/importers/apple-music-library/index.mjs +76 -0
  37. package/src/importers/apple-music-library/normalize.mjs +1126 -0
  38. package/src/importers/apple-music-library/parse-plist.mjs +357 -0
  39. package/src/importers/apple-music-library/projection-records.mjs +557 -0
  40. package/src/importers/apple-music-library/read-batch.mjs +276 -0
  41. package/src/importers/apple-music-library/sqlite-projection.mjs +1307 -0
  42. package/src/importers/apple-music-library/stable-ids.mjs +19 -0
  43. package/src/importers/apple-music-library/track-snapshot.schema.json +136 -0
  44. package/src/integrations/apple-music/catalog.mjs +770 -0
  45. package/src/integrations/cross-catalog-artist-identity.mjs +222 -0
  46. package/src/integrations/listenbrainz/history-file.mjs +560 -0
  47. package/src/integrations/lyrics/lrclib.mjs +55 -0
  48. package/src/integrations/open-music-similarity/artist-radio.mjs +806 -0
  49. package/src/integrations/public-playlists.mjs +104 -0
  50. package/src/integrations/spotify/account-data-history.mjs +545 -0
  51. package/src/integrations/spotify/account-data-profile.mjs +918 -0
  52. package/src/integrations/spotify/authentication.mjs +791 -0
  53. package/src/integrations/spotify/catalog-resolver.mjs +657 -0
  54. package/src/integrations/spotify/connection.mjs +125 -0
  55. package/src/integrations/spotify/credential-store.mjs +26 -0
  56. package/src/integrations/spotify/extended-streaming-history.mjs +525 -0
  57. package/src/integrations/spotify/history-archive.mjs +59 -0
  58. package/src/integrations/spotify/index.mjs +80 -0
  59. package/src/integrations/spotify/recent-activity.mjs +198 -0
  60. package/src/integrations/spotify/resolution-cache.mjs +260 -0
  61. package/src/integrations/spotify/service.mjs +713 -0
  62. package/src/integrations/spotify/settings.mjs +89 -0
  63. package/src/integrations/spotify/web-api-client.mjs +761 -0
  64. package/src/integrations/web/codex-web.mjs +263 -0
  65. package/src/integrations/youtube-music/takeout.mjs +143 -0
  66. package/src/memory/local-memory-store.mjs +1705 -0
  67. package/src/memory/reflection-worker.mjs +87 -0
  68. package/src/profile/apple-library-import.mjs +28 -0
  69. package/src/profile/history-import.mjs +163 -0
  70. package/src/profile/listener-corrections.mjs +217 -0
  71. package/src/profile/listening-history-store.mjs +2055 -0
  72. package/src/profile/listening-profile-projection.mjs +2520 -0
  73. package/src/profile/local-music-data.mjs +812 -0
  74. package/src/profile/music-import-bundle.mjs +91 -0
  75. package/src/profile/music-providers.mjs +25 -0
  76. package/src/profile/spotify-archive-catalog-hints.mjs +210 -0
  77. package/src/profile/spotify-archive-taste.mjs +482 -0
  78. package/src/runtime/pi/agent-runtime.mjs +6444 -0
  79. package/src/runtime/pi/authentication.mjs +104 -0
  80. package/src/runtime/pi/configured-runtime.mjs +98 -0
  81. package/src/runtime/pi/memory-agent-runtime.mjs +337 -0
  82. package/src/runtime/pi/model-catalog.mjs +62 -0
  83. package/src/runtime/pi/model-transport.mjs +117 -0
  84. package/src/runtime/pi/persistent-credential-store.mjs +670 -0
  85. package/src/runtime/pi/provider-registry.mjs +74 -0
  86. package/src/runtime/pi/runtime-settings.mjs +81 -0
  87. package/src/surfaces/cli/auth-command.mjs +355 -0
  88. package/src/surfaces/cli/brand-components.mjs +390 -0
  89. package/src/surfaces/cli/brand-theme.mjs +231 -0
  90. package/src/surfaces/cli/catalog-command.mjs +509 -0
  91. package/src/surfaces/cli/command-completions.mjs +113 -0
  92. package/src/surfaces/cli/data-command.mjs +214 -0
  93. package/src/surfaces/cli/format-output.mjs +750 -0
  94. package/src/surfaces/cli/history-import-view.mjs +445 -0
  95. package/src/surfaces/cli/import-guides.mjs +9 -0
  96. package/src/surfaces/cli/listenbrainz-command.mjs +129 -0
  97. package/src/surfaces/cli/listening-menu.mjs +171 -0
  98. package/src/surfaces/cli/profile-command.mjs +290 -0
  99. package/src/surfaces/cli/spotify-command.mjs +849 -0
  100. package/src/surfaces/cli/taste-profile-model.mjs +306 -0
  101. package/src/surfaces/cli/taste-profile-view.mjs +272 -0
  102. package/src/surfaces/cli/terminal-art.mjs +295 -0
  103. package/src/surfaces/cli/tui.mjs +1714 -0
  104. package/src/surfaces/cli/web-command.mjs +52 -0
  105. package/src/surfaces/html/tasteprint-artifact.mjs +96 -0
  106. package/src/surfaces/html/tasteprint.mjs +3575 -0
  107. package/src/surfaces/web/showcase.mjs +272 -0
  108. package/src/surfaces/web/studio-page.mjs +4148 -0
  109. package/src/surfaces/web/studio.mjs +2288 -0
@@ -0,0 +1,318 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:moondog:contract:tool-invocation:1",
4
+ "title": "Moondog ToolInvocation v1",
5
+ "type": "object",
6
+ "properties": {
7
+ "schema_version": {
8
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/schema_version"
9
+ },
10
+ "invocation_id": {
11
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/uuid"
12
+ },
13
+ "subject_id": {
14
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/uuid"
15
+ },
16
+ "actor": {
17
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/actor_ref"
18
+ },
19
+ "surface": {
20
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/namespaced_key"
21
+ },
22
+ "capability_id": {
23
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/namespaced_key"
24
+ },
25
+ "capability_version": {
26
+ "type": "integer",
27
+ "minimum": 1
28
+ },
29
+ "tool_ref": {
30
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/tool_ref"
31
+ },
32
+ "execution_mode": {
33
+ "enum": [
34
+ "plan",
35
+ "dry_run",
36
+ "execute"
37
+ ]
38
+ },
39
+ "account_ref": {
40
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/external_ref"
41
+ },
42
+ "target": {
43
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/entity_ref"
44
+ },
45
+ "arguments": {
46
+ "type": "object",
47
+ "maxProperties": 128
48
+ },
49
+ "purpose": {
50
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/non_empty_string"
51
+ },
52
+ "purpose_id": {
53
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/namespaced_key"
54
+ },
55
+ "declared_effects": {
56
+ "type": "array",
57
+ "minItems": 1,
58
+ "items": {
59
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/effect_kind"
60
+ },
61
+ "uniqueItems": true
62
+ },
63
+ "declared_risk_flags": {
64
+ "type": "array",
65
+ "items": {
66
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/risk_domain"
67
+ },
68
+ "uniqueItems": true
69
+ },
70
+ "data_manifest": {
71
+ "type": "object",
72
+ "properties": {
73
+ "source_refs": {
74
+ "type": "array",
75
+ "items": {
76
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/typed_record_ref"
77
+ },
78
+ "uniqueItems": true
79
+ },
80
+ "data_classes": {
81
+ "type": "array",
82
+ "minItems": 1,
83
+ "items": {
84
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/data_class"
85
+ },
86
+ "uniqueItems": true
87
+ },
88
+ "planned_destinations": {
89
+ "type": "array",
90
+ "minItems": 1,
91
+ "items": {
92
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/external_destination"
93
+ },
94
+ "uniqueItems": true
95
+ },
96
+ "raw_data_included": {
97
+ "type": "boolean"
98
+ },
99
+ "minimization_summary": {
100
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/non_empty_string"
101
+ }
102
+ },
103
+ "required": [
104
+ "source_refs",
105
+ "data_classes",
106
+ "planned_destinations",
107
+ "raw_data_included",
108
+ "minimization_summary"
109
+ ],
110
+ "additionalProperties": false
111
+ },
112
+ "rights_basis_refs": {
113
+ "type": "array",
114
+ "items": {
115
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/namespaced_key"
116
+ },
117
+ "uniqueItems": true
118
+ },
119
+ "budget_request": {
120
+ "type": "array",
121
+ "items": {
122
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/budget_amount"
123
+ },
124
+ "uniqueItems": true
125
+ },
126
+ "policy_ref": {
127
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/policy_ref"
128
+ },
129
+ "confirmation_grant_ref": {
130
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/uuid"
131
+ },
132
+ "idempotency_key": {
133
+ "type": "string",
134
+ "minLength": 16,
135
+ "maxLength": 256,
136
+ "pattern": "\\S"
137
+ },
138
+ "semantic_digest": {
139
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/sha256"
140
+ },
141
+ "requested_at": {
142
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/utc_timestamp"
143
+ },
144
+ "expires_at": {
145
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/utc_timestamp"
146
+ },
147
+ "correlation_id": {
148
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/uuid"
149
+ },
150
+ "parent_invocation_id": {
151
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/uuid"
152
+ },
153
+ "extensions": {
154
+ "$ref": "urn:moondog:contract:definitions:1#/$defs/extensions"
155
+ }
156
+ },
157
+ "required": [
158
+ "schema_version",
159
+ "invocation_id",
160
+ "subject_id",
161
+ "actor",
162
+ "surface",
163
+ "capability_id",
164
+ "capability_version",
165
+ "tool_ref",
166
+ "execution_mode",
167
+ "arguments",
168
+ "purpose_id",
169
+ "purpose",
170
+ "declared_effects",
171
+ "declared_risk_flags",
172
+ "data_manifest",
173
+ "rights_basis_refs",
174
+ "budget_request",
175
+ "policy_ref",
176
+ "semantic_digest",
177
+ "requested_at",
178
+ "expires_at"
179
+ ],
180
+ "allOf": [
181
+ {
182
+ "if": {
183
+ "properties": {
184
+ "execution_mode": {
185
+ "enum": [
186
+ "plan",
187
+ "dry_run"
188
+ ]
189
+ }
190
+ },
191
+ "required": [
192
+ "execution_mode"
193
+ ]
194
+ },
195
+ "then": {
196
+ "properties": {
197
+ "data_manifest": {
198
+ "type": "object",
199
+ "not": {
200
+ "allOf": [
201
+ {
202
+ "properties": {
203
+ "raw_data_included": {
204
+ "const": true
205
+ }
206
+ },
207
+ "required": [
208
+ "raw_data_included"
209
+ ]
210
+ },
211
+ {
212
+ "properties": {
213
+ "planned_destinations": {
214
+ "type": "array",
215
+ "contains": {
216
+ "type": "object",
217
+ "properties": {
218
+ "destination_type": {
219
+ "const": "external"
220
+ }
221
+ },
222
+ "required": [
223
+ "destination_type"
224
+ ]
225
+ }
226
+ }
227
+ },
228
+ "required": [
229
+ "planned_destinations"
230
+ ]
231
+ }
232
+ ]
233
+ }
234
+ }
235
+ }
236
+ }
237
+ },
238
+ {
239
+ "if": {
240
+ "properties": {
241
+ "declared_effects": {
242
+ "type": "array",
243
+ "contains": {
244
+ "enum": [
245
+ "write_local",
246
+ "write_external",
247
+ "send_message",
248
+ "spend",
249
+ "publish",
250
+ "delete"
251
+ ]
252
+ }
253
+ }
254
+ },
255
+ "required": [
256
+ "declared_effects"
257
+ ]
258
+ },
259
+ "then": {
260
+ "required": [
261
+ "idempotency_key"
262
+ ]
263
+ }
264
+ },
265
+ {
266
+ "if": {
267
+ "properties": {
268
+ "declared_effects": {
269
+ "type": "array",
270
+ "contains": {
271
+ "const": "spend"
272
+ }
273
+ }
274
+ },
275
+ "required": [
276
+ "declared_effects"
277
+ ]
278
+ },
279
+ "then": {
280
+ "properties": {
281
+ "budget_request": {
282
+ "type": "array",
283
+ "minItems": 1
284
+ }
285
+ }
286
+ }
287
+ },
288
+ {
289
+ "if": {
290
+ "properties": {
291
+ "declared_effects": {
292
+ "type": "array",
293
+ "contains": {
294
+ "enum": [
295
+ "write_external",
296
+ "send_message",
297
+ "spend",
298
+ "publish",
299
+ "delete",
300
+ "use_credentials"
301
+ ]
302
+ }
303
+ }
304
+ },
305
+ "required": [
306
+ "declared_effects"
307
+ ]
308
+ },
309
+ "then": {
310
+ "required": [
311
+ "account_ref",
312
+ "confirmation_grant_ref"
313
+ ]
314
+ }
315
+ }
316
+ ],
317
+ "additionalProperties": false
318
+ }