primitive-admin 1.1.0-alpha.78 → 1.1.0-alpha.79

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 (105) hide show
  1. package/README.md +38 -17
  2. package/assets/skill/skills/primitive-platform/SKILL.md +39 -52
  3. package/dist/bin/primitive.js +14 -25
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/admins.js +8 -18
  6. package/dist/src/commands/admins.js.map +1 -1
  7. package/dist/src/commands/analytics.js +46 -5
  8. package/dist/src/commands/analytics.js.map +1 -1
  9. package/dist/src/commands/auth.js +16 -1
  10. package/dist/src/commands/auth.js.map +1 -1
  11. package/dist/src/commands/collection-type-configs.js +1 -9
  12. package/dist/src/commands/collection-type-configs.js.map +1 -1
  13. package/dist/src/commands/config.js +11 -29
  14. package/dist/src/commands/config.js.map +1 -1
  15. package/dist/src/commands/database-type-configs.js +1 -9
  16. package/dist/src/commands/database-type-configs.js.map +1 -1
  17. package/dist/src/commands/databases.js +8 -38
  18. package/dist/src/commands/databases.js.map +1 -1
  19. package/dist/src/commands/env.js +27 -32
  20. package/dist/src/commands/env.js.map +1 -1
  21. package/dist/src/commands/functions.js +197 -23
  22. package/dist/src/commands/functions.js.map +1 -1
  23. package/dist/src/commands/groups.js +1 -9
  24. package/dist/src/commands/groups.js.map +1 -1
  25. package/dist/src/commands/init.js +6 -0
  26. package/dist/src/commands/init.js.map +1 -1
  27. package/dist/src/commands/rule-sets.js +1 -9
  28. package/dist/src/commands/rule-sets.js.map +1 -1
  29. package/dist/src/commands/scripts.js +12 -28
  30. package/dist/src/commands/scripts.js.map +1 -1
  31. package/dist/src/commands/sync.d.ts +119 -0
  32. package/dist/src/commands/sync.js +387 -196
  33. package/dist/src/commands/sync.js.map +1 -1
  34. package/dist/src/commands/workflows.js +2 -14
  35. package/dist/src/commands/workflows.js.map +1 -1
  36. package/dist/src/lib/api-client.d.ts +46 -11
  37. package/dist/src/lib/api-client.js +21 -11
  38. package/dist/src/lib/api-client.js.map +1 -1
  39. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +24 -57
  40. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +30 -204
  41. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -1
  42. package/dist/src/lib/config-json-field.d.ts +28 -0
  43. package/dist/src/lib/config-json-field.js +56 -0
  44. package/dist/src/lib/config-json-field.js.map +1 -0
  45. package/dist/src/lib/config-object-descriptor.js +4 -3
  46. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  47. package/dist/src/lib/config-surface.js +1 -1
  48. package/dist/src/lib/config-surface.js.map +1 -1
  49. package/dist/src/lib/config.d.ts +21 -14
  50. package/dist/src/lib/config.js +25 -44
  51. package/dist/src/lib/config.js.map +1 -1
  52. package/dist/src/lib/credentials-store.d.ts +31 -8
  53. package/dist/src/lib/credentials-store.js +52 -13
  54. package/dist/src/lib/credentials-store.js.map +1 -1
  55. package/dist/src/lib/env-resolver-core.d.ts +18 -0
  56. package/dist/src/lib/env-resolver-core.js +26 -3
  57. package/dist/src/lib/env-resolver-core.js.map +1 -1
  58. package/dist/src/lib/env-resolver.d.ts +15 -0
  59. package/dist/src/lib/env-resolver.js +21 -1
  60. package/dist/src/lib/env-resolver.js.map +1 -1
  61. package/dist/src/lib/function-collect.d.ts +1 -1
  62. package/dist/src/lib/function-collect.js +138 -7
  63. package/dist/src/lib/function-collect.js.map +1 -1
  64. package/dist/src/lib/function-db-types.d.ts +49 -11
  65. package/dist/src/lib/function-db-types.js +234 -39
  66. package/dist/src/lib/function-db-types.js.map +1 -1
  67. package/dist/src/lib/function-document-types.d.ts +50 -0
  68. package/dist/src/lib/function-document-types.js +163 -0
  69. package/dist/src/lib/function-document-types.js.map +1 -0
  70. package/dist/src/lib/function-log-tail.d.ts +83 -0
  71. package/dist/src/lib/function-log-tail.js +115 -0
  72. package/dist/src/lib/function-log-tail.js.map +1 -0
  73. package/dist/src/lib/function-schema-codegen.d.ts +118 -0
  74. package/dist/src/lib/function-schema-codegen.js +402 -0
  75. package/dist/src/lib/function-schema-codegen.js.map +1 -0
  76. package/dist/src/lib/function-sync.d.ts +85 -2
  77. package/dist/src/lib/function-sync.js +196 -27
  78. package/dist/src/lib/function-sync.js.map +1 -1
  79. package/dist/src/lib/function-triggers.d.ts +9 -3
  80. package/dist/src/lib/function-triggers.js +12 -9
  81. package/dist/src/lib/function-triggers.js.map +1 -1
  82. package/dist/src/lib/function-typecheck.d.ts +86 -0
  83. package/dist/src/lib/function-typecheck.js +370 -0
  84. package/dist/src/lib/function-typecheck.js.map +1 -0
  85. package/dist/src/lib/generated-allowlist.js +4 -0
  86. package/dist/src/lib/generated-allowlist.js.map +1 -1
  87. package/dist/src/lib/generated-config-surfaces.d.ts +422 -0
  88. package/dist/src/lib/generated-config-surfaces.js +838 -9
  89. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  90. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  91. package/dist/src/lib/generated-sdk-types.js +1 -1
  92. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  93. package/dist/src/lib/log-inspection.d.ts +116 -4
  94. package/dist/src/lib/log-inspection.js +147 -2
  95. package/dist/src/lib/log-inspection.js.map +1 -1
  96. package/dist/src/lib/snapshots.d.ts +6 -7
  97. package/dist/src/lib/snapshots.js +18 -81
  98. package/dist/src/lib/snapshots.js.map +1 -1
  99. package/dist/src/lib/sync-paths.d.ts +29 -53
  100. package/dist/src/lib/sync-paths.js +46 -97
  101. package/dist/src/lib/sync-paths.js.map +1 -1
  102. package/dist/src/lib/workflow-toml-validator.d.ts +8 -3
  103. package/dist/src/lib/workflow-toml-validator.js +8 -3
  104. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  105. package/package.json +3 -3
@@ -888,6 +888,35 @@ export interface ConfigFileValidationError {
888
888
  * to the per-type loop that reads it, which names the parse error itself.
889
889
  */
890
890
  export declare function collectConfigFileValidationErrors(configDir: string): ConfigFileValidationError[];
891
+ /**
892
+ * Every `functions/<key>.toml` whose file-decidable errors `config push` would
893
+ * refuse (#3320).
894
+ *
895
+ * A second collector rather than a branch inside
896
+ * `collectConfigFileValidationErrors`, and deliberately so: push calls that one
897
+ * UNBOUNDED over the whole tree, which is right for the checks it runs (a
898
+ * mistyped key anywhere means the tree is not pushable) and wrong for these — a
899
+ * `config push --only webhook/<key>` must not be blocked by a broken function
900
+ * the operator did not select (#2645). The push path therefore runs these
901
+ * inside its own `selectFiles`-bounded function loop, and `config diff`, which
902
+ * compares the whole tree by construction, runs them from here.
903
+ *
904
+ * A file that does not parse is skipped: the per-type loop that reads it names
905
+ * the parse error itself, and reporting it twice helps nobody.
906
+ */
907
+ export declare function collectFunctionTomlValidationErrors(configDir: string): ConfigFileValidationError[];
908
+ /**
909
+ * The collectors' rows, one per diff row (#2880 symmetry, #3320).
910
+ *
911
+ * Two collectors reach the same function file — the definition-driven one
912
+ * every per-entity type runs, and the function preflight — and a file can
913
+ * break both at once (a mistyped `entrty`, which then leaves no `entry`).
914
+ * Push reports every message from both, so an overlay that let one row's
915
+ * messages REPLACE the other's would drop a diagnostic push prints, which is
916
+ * exactly the asymmetry #2880 forbids. Merging by row keeps the two commands
917
+ * reading identically.
918
+ */
919
+ export declare function mergeConfigFileValidationErrors(collected: ConfigFileValidationError[]): ConfigFileValidationError[];
891
920
  /**
892
921
  * Every `<key>.tests/*.toml` sidecar under a config directory.
893
922
  *
@@ -1218,6 +1247,19 @@ export declare function classifyPushChange(input: {
1218
1247
  localHash: string;
1219
1248
  remoteHash: string;
1220
1249
  baselineHash?: string;
1250
+ /**
1251
+ * The server record has NOT been written since the last sync (#3317).
1252
+ *
1253
+ * Its own `modifiedAt` is what says so, and that is evidence no hash can
1254
+ * contradict: a record nothing has written cannot have drifted, so the local
1255
+ * file is the only side that can have moved. A baseline hash disagreeing
1256
+ * with the current remote projection then says something about the BASELINE
1257
+ * — recorded by a CLI whose projection of the same record differed — and not
1258
+ * about the server. Left false by callers whose row timestamp does not cover
1259
+ * everything the projection compares; `decidePushForConfig` owns that
1260
+ * judgement.
1261
+ */
1262
+ serverUnchangedSinceSync?: boolean;
1221
1263
  legacy?: {
1222
1264
  localBytesMatchStoredContentHash?: boolean;
1223
1265
  liveModifiedAtMatchesStored?: boolean;
@@ -1414,6 +1456,13 @@ export interface PushBaselineEntry {
1414
1456
  modifiedAt?: string;
1415
1457
  contentHash?: string;
1416
1458
  semanticHash?: string;
1459
+ /**
1460
+ * The version the manifest last saw active, for a versioned type (#3317).
1461
+ * Read only beside `serverModifiedAtCoversProjection`: a recorded pointer
1462
+ * that is not the live one denies the timestamp's claim that the server
1463
+ * stood still.
1464
+ */
1465
+ activeConfigId?: string;
1417
1466
  }
1418
1467
  /**
1419
1468
  * `config push`'s change decision for one configuration file (#2731 B1/B3/B4/B8).
@@ -1493,6 +1542,33 @@ export declare function decidePushForConfig(input: {
1493
1542
  */
1494
1543
  localExtra?: any;
1495
1544
  force?: boolean;
1545
+ /**
1546
+ * Whether the live record's `modifiedAt` covers EVERYTHING this type's
1547
+ * projection compares (#3317).
1548
+ *
1549
+ * Opt-in, because it is a claim about the data model rather than about this
1550
+ * push. A server function's header row carries its fields and the
1551
+ * `activeConfigId` pointer, and a version is immutable, so any change to
1552
+ * what the comparison reads moves that one timestamp — an equal timestamp
1553
+ * therefore PROVES the server stood still, and a baseline hash that
1554
+ * disagrees is stale rather than evidence of drift (the reporter's conflict,
1555
+ * printed over two identical timestamps).
1556
+ *
1557
+ * A database type's is the counter-example and the reason this is not the
1558
+ * default: its operations and subscriptions are rows of their own, so an
1559
+ * out-of-band edit to one changes the projection while the type's own
1560
+ * `modifiedAt` stands still. Claiming coverage there would turn a real
1561
+ * server change into a silent overwrite.
1562
+ *
1563
+ * The timestamp is trusted only alongside the version pointer: when the
1564
+ * manifest recorded an `activeConfigId`, the live record must still point at
1565
+ * it. The baseline is written from a header refetched AFTER the push, and a
1566
+ * concurrent activation landing in that window leaves the manifest carrying
1567
+ * the other operator's timestamp beside the version this push activated —
1568
+ * two timestamps that agree about a server that moved to a version the local
1569
+ * file never saw. The pointer is what moved, so it is what settles it.
1570
+ */
1571
+ serverModifiedAtCoversProjection?: boolean;
1496
1572
  /**
1497
1573
  * Whether this type's push path ADOPTS an existing object by key (#2909).
1498
1574
  *
@@ -1941,6 +2017,49 @@ selects?: (name: string) => boolean): Promise<{
1941
2017
  /** Names the server listed, empty when the listing failed. */
1942
2018
  serverKeys: string[];
1943
2019
  }>;
2020
+ /**
2021
+ * The manifest row `config push` records for a function it just pushed
2022
+ * (#3317), and whether the server had already moved past that push.
2023
+ *
2024
+ * The header is refetched AFTER the version push, so the row's `modifiedAt`
2025
+ * is the live timestamp — but the version pointer and the envelope are the
2026
+ * push's own: the manifest names what THIS run activated, not whatever the
2027
+ * refetch happened to find. A concurrent activation landing between the push
2028
+ * and the refetch is exactly the case those two must not be conflated in:
2029
+ * recording the refetched pointer would make the other operator's version the
2030
+ * baseline the local file is then read as a plain edit of, and the next push
2031
+ * would roll it back without `--force`. Recording the pushed pointer beside
2032
+ * the live timestamp is what `decidePushForConfig` reads as "the pointer
2033
+ * moved" — a refusal, until the operator pulls or forces.
2034
+ *
2035
+ * `movedTo` names the version the refetched header points at when it is not
2036
+ * the pushed one, so the caller can say so at the moment it is known rather
2037
+ * than leaving it for the next push to report.
2038
+ */
2039
+ export declare function pushedFunctionBaseline(input: {
2040
+ functionId: string;
2041
+ /** The header refetched after the push, or the pre-push listing row. */
2042
+ refreshed: any;
2043
+ existingModifiedAt?: string;
2044
+ contentHash: string;
2045
+ /** The version the push activated (created, or the matched no-op). */
2046
+ pushedVersion: any;
2047
+ envelopeHash: string;
2048
+ sources: string[];
2049
+ spec: ConfigDiffSpec;
2050
+ maps: ConfigDiffMaps;
2051
+ }): {
2052
+ entity: {
2053
+ id: string;
2054
+ modifiedAt: string;
2055
+ contentHash: string;
2056
+ semanticHash?: string;
2057
+ envelopeHash: string;
2058
+ activeConfigId?: string;
2059
+ sources: string[];
2060
+ };
2061
+ movedTo: string | null;
2062
+ };
1944
2063
  /**
1945
2064
  * Pull server-side `ServerFunction` rows into `functions/` (#3179).
1946
2065
  *