primitive-admin 1.1.0-alpha.84 → 1.1.0-alpha.86

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 (132) hide show
  1. package/README.md +77 -1
  2. package/assets/skill/skills/primitive-platform/SKILL.md +8 -0
  3. package/dist/src/commands/admins.js +29 -32
  4. package/dist/src/commands/admins.js.map +1 -1
  5. package/dist/src/commands/analytics.js +15 -2
  6. package/dist/src/commands/analytics.js.map +1 -1
  7. package/dist/src/commands/apps.js +12 -5
  8. package/dist/src/commands/apps.js.map +1 -1
  9. package/dist/src/commands/blob-buckets.js +2 -1
  10. package/dist/src/commands/blob-buckets.js.map +1 -1
  11. package/dist/src/commands/catalog.js +26 -10
  12. package/dist/src/commands/catalog.js.map +1 -1
  13. package/dist/src/commands/collection-type-configs.js +2 -1
  14. package/dist/src/commands/collection-type-configs.js.map +1 -1
  15. package/dist/src/commands/collections.js +675 -19
  16. package/dist/src/commands/collections.js.map +1 -1
  17. package/dist/src/commands/connections.js +8 -9
  18. package/dist/src/commands/connections.js.map +1 -1
  19. package/dist/src/commands/cron-triggers.js +2 -1
  20. package/dist/src/commands/cron-triggers.js.map +1 -1
  21. package/dist/src/commands/database-type-configs.js +4 -3
  22. package/dist/src/commands/database-type-configs.js.map +1 -1
  23. package/dist/src/commands/databases.js +27 -10
  24. package/dist/src/commands/databases.js.map +1 -1
  25. package/dist/src/commands/documents.d.ts +20 -0
  26. package/dist/src/commands/documents.js +236 -28
  27. package/dist/src/commands/documents.js.map +1 -1
  28. package/dist/src/commands/email-templates.js +2 -1
  29. package/dist/src/commands/email-templates.js.map +1 -1
  30. package/dist/src/commands/env.js +11 -1
  31. package/dist/src/commands/env.js.map +1 -1
  32. package/dist/src/commands/feature-flags.js +2 -1
  33. package/dist/src/commands/feature-flags.js.map +1 -1
  34. package/dist/src/commands/functions.js +58 -6
  35. package/dist/src/commands/functions.js.map +1 -1
  36. package/dist/src/commands/group-type-configs.js +2 -1
  37. package/dist/src/commands/group-type-configs.js.map +1 -1
  38. package/dist/src/commands/groups.js +29 -8
  39. package/dist/src/commands/groups.js.map +1 -1
  40. package/dist/src/commands/guides.js +17 -11
  41. package/dist/src/commands/guides.js.map +1 -1
  42. package/dist/src/commands/integrations.js +30 -9
  43. package/dist/src/commands/integrations.js.map +1 -1
  44. package/dist/src/commands/locks.js +2 -1
  45. package/dist/src/commands/locks.js.map +1 -1
  46. package/dist/src/commands/metadata-category-configs.js +2 -1
  47. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  48. package/dist/src/commands/metadata.js +8 -1
  49. package/dist/src/commands/metadata.js.map +1 -1
  50. package/dist/src/commands/prompts.js +28 -11
  51. package/dist/src/commands/prompts.js.map +1 -1
  52. package/dist/src/commands/rule-sets.js +2 -1
  53. package/dist/src/commands/rule-sets.js.map +1 -1
  54. package/dist/src/commands/scripts.js +15 -6
  55. package/dist/src/commands/scripts.js.map +1 -1
  56. package/dist/src/commands/secrets.js +2 -1
  57. package/dist/src/commands/secrets.js.map +1 -1
  58. package/dist/src/commands/sessions.js +10 -9
  59. package/dist/src/commands/sessions.js.map +1 -1
  60. package/dist/src/commands/sync.d.ts +125 -29
  61. package/dist/src/commands/sync.js +865 -88
  62. package/dist/src/commands/sync.js.map +1 -1
  63. package/dist/src/commands/tokens.js +2 -1
  64. package/dist/src/commands/tokens.js.map +1 -1
  65. package/dist/src/commands/users.js +19 -10
  66. package/dist/src/commands/users.js.map +1 -1
  67. package/dist/src/commands/vars.js +2 -1
  68. package/dist/src/commands/vars.js.map +1 -1
  69. package/dist/src/commands/waitlist.js +2 -1
  70. package/dist/src/commands/waitlist.js.map +1 -1
  71. package/dist/src/commands/webhooks.js +17 -10
  72. package/dist/src/commands/webhooks.js.map +1 -1
  73. package/dist/src/commands/workflows.js +36 -18
  74. package/dist/src/commands/workflows.js.map +1 -1
  75. package/dist/src/lib/api-client.d.ts +176 -8
  76. package/dist/src/lib/api-client.js +205 -68
  77. package/dist/src/lib/api-client.js.map +1 -1
  78. package/dist/src/lib/collection-export.d.ts +184 -0
  79. package/dist/src/lib/collection-export.js +252 -0
  80. package/dist/src/lib/collection-export.js.map +1 -0
  81. package/dist/src/lib/config-object-descriptor.js +44 -8
  82. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  83. package/dist/src/lib/config-payload.d.ts +8 -1
  84. package/dist/src/lib/config-payload.js +49 -4
  85. package/dist/src/lib/config-payload.js.map +1 -1
  86. package/dist/src/lib/config-surface.d.ts +2 -1
  87. package/dist/src/lib/config-surface.js +54 -3
  88. package/dist/src/lib/config-surface.js.map +1 -1
  89. package/dist/src/lib/deprecation.d.ts +22 -0
  90. package/dist/src/lib/deprecation.js +43 -0
  91. package/dist/src/lib/deprecation.js.map +1 -0
  92. package/dist/src/lib/function-db-types.d.ts +14 -3
  93. package/dist/src/lib/function-db-types.js +55 -11
  94. package/dist/src/lib/function-db-types.js.map +1 -1
  95. package/dist/src/lib/function-trigger-listing.d.ts +27 -0
  96. package/dist/src/lib/function-trigger-listing.js +70 -0
  97. package/dist/src/lib/function-trigger-listing.js.map +1 -0
  98. package/dist/src/lib/generated-config-surfaces.d.ts +715 -4
  99. package/dist/src/lib/generated-config-surfaces.js +2424 -226
  100. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  101. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  102. package/dist/src/lib/generated-sdk-types.js +1 -1
  103. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  104. package/dist/src/lib/list-options.d.ts +68 -0
  105. package/dist/src/lib/list-options.js +89 -0
  106. package/dist/src/lib/list-options.js.map +1 -0
  107. package/dist/src/lib/log-inspection.d.ts +34 -1
  108. package/dist/src/lib/log-inspection.js +28 -0
  109. package/dist/src/lib/log-inspection.js.map +1 -1
  110. package/dist/src/lib/paginate.d.ts +15 -0
  111. package/dist/src/lib/paginate.js +17 -0
  112. package/dist/src/lib/paginate.js.map +1 -1
  113. package/dist/src/lib/prompt-cost-format.d.ts +11 -0
  114. package/dist/src/lib/prompt-cost-format.js +41 -0
  115. package/dist/src/lib/prompt-cost-format.js.map +1 -0
  116. package/dist/src/lib/prompt-schema-codegen.d.ts +53 -0
  117. package/dist/src/lib/prompt-schema-codegen.js +253 -3
  118. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  119. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +42 -0
  120. package/dist/src/lib/swift-codegen/agentGenerator.js +118 -0
  121. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -0
  122. package/dist/src/lib/swift-codegen/banners.d.ts +6 -0
  123. package/dist/src/lib/swift-codegen/banners.js +6 -0
  124. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  125. package/dist/src/lib/swift-codegen/dbGenerator.js +11 -3
  126. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
  127. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +7 -0
  128. package/dist/src/lib/swift-codegen/functionGenerator.js +41 -3
  129. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  130. package/dist/src/lib/swift-codegen/generator.js +8 -2
  131. package/dist/src/lib/swift-codegen/generator.js.map +1 -1
  132. package/package.json +2 -2
@@ -4,6 +4,8 @@ import { type OperationFormHints } from "../lib/toml-database-config.js";
4
4
  import { type FieldForm } from "../lib/toml-native-form.js";
5
5
  import { type PushMode } from "../lib/config-payload.js";
6
6
  import { type ConfigObjectSurface, type ConfigTable } from "../lib/generated-config-surfaces.js";
7
+ import { type PromptKind } from "../lib/generated-config-surfaces.js";
8
+ import { type AgentFunctionFacts } from "../lib/generated-config-surfaces.js";
7
9
  import { type PresenceOutcome, type TestBlockType } from "../lib/sync-resource-types.js";
8
10
  export { resolveSlugCollisions, slugifyTestCaseName, testCaseFileBasenames, } from "../lib/test-case-file-names.js";
9
11
  import type { SyncState } from "../types/index.js";
@@ -335,6 +337,20 @@ export declare function validateVarsFile(parsedVars: Record<string, unknown>, op
335
337
  * edit — reported as a conflict instead. `force` skips the conflict guard,
336
338
  * matching `config push --force` for every other entity.
337
339
  *
340
+ * A var only the SERVER moved is the other half of the same comparison, and it
341
+ * is reported rather than skipped (issue #3714). Its local value still equals
342
+ * the baseline, so there is nothing to push and no conflict — but the skip that
343
+ * follows from "local is unchanged" used to be taken before the snapshot was
344
+ * consulted at all, so the push said nothing about a var edited in the Admin
345
+ * Console and counted it among the skipped-unchanged. The `drifted[]` keys are
346
+ * what every other synced type reaches through `classifyPushChange` →
347
+ * `server-drifted`: the caller prints `DRIFT var: <key>` under "Server drift —
348
+ * not pushed", writes nothing, and leaves the exit code alone. A baseline key
349
+ * the snapshot no longer holds at all is the same one-sided move (the server
350
+ * deleted the row; the local file stands still) and is reported the same way.
351
+ * `--force` is the resolution that keeps the local value, `config pull` the one
352
+ * that takes the server's.
353
+ *
338
354
  * Pure and side-effect-free (the caller owns the API calls and sync-state
339
355
  * updates) so the guard is unit-testable without a live server. Assumes
340
356
  * `parsedVars` has already passed `validateVarsFile` (values are strings). The
@@ -364,6 +380,11 @@ export declare function planVarsPush(parsedVars: Record<string, string>, baselin
364
380
  serverModifiedAt: string;
365
381
  localModifiedAt: string;
366
382
  }>;
383
+ /** Keys the SERVER alone moved — reported, never written (issue #3714). */
384
+ drifted: Array<{
385
+ key: string;
386
+ serverModifiedAt: string;
387
+ }>;
367
388
  skippedCount: number;
368
389
  };
369
390
  /**
@@ -663,19 +684,20 @@ export declare function serializeBlobBucket(bucket: any, logger?: (message: stri
663
684
  */
664
685
  export declare function buildBlobBucketUpdatePayload(bucket: any): any;
665
686
  /**
666
- * The status a freshly CREATED prompt config still owes the file, or null
667
- * (#3201).
687
+ * #3201's post-create status patch is RETIRED — #3799 (DSO-3799-005).
668
688
  *
669
- * `status` is update-only — `POST /prompts` and `POST /prompts/:id/configs`
670
- * both assign `active` whatever the body says — so an authored
671
- * `status = "archived"` was silently dropped on every create path: a pulled
672
- * tree pushed from a clean clone into a fresh environment brought every
673
- * retired config back into service. Read through the push payload builder, so
674
- * a file that omits the key asks for the default and needs no request.
689
+ * `status` was update-only, so `POST /prompts` and `POST /prompts/:id/configs`
690
+ * both assigned `active` whatever the body said, and an authored
691
+ * `status = "archived"` needed a follow-up PATCH ordered after the activation of
692
+ * the entry the file marks live. Both create paths honor the key now
693
+ * (`writableOn: BOTH`, validated by one rule on all three paths), so the entry
694
+ * lands retired on its own create: the same end state, two fewer calls per
695
+ * retired config, and no window in which the server holds a status the file
696
+ * never asked for. That window is what made a pulled tree unpushable into a
697
+ * fresh environment once an agent's schemas are checked against each
698
+ * non-archived config's provider — the check fired on the transient active
699
+ * state.
675
700
  */
676
- export declare function createdConfigStatusPatch(tomlConfig: any): {
677
- status: string;
678
- } | null;
679
701
  /**
680
702
  * Which `[[configs]]` entry a prompt file marks as live (issue #2645).
681
703
  *
@@ -782,12 +804,11 @@ export declare function buildPromptCreatePayload(key: string, tomlData: any): Re
782
804
  * response rather than assumed, so a handler that one day honors the name
783
805
  * produces no needless PATCH.
784
806
  *
785
- * #3201 — the entry's `status` is deferred the OTHER way and is deliberately
786
- * not here. The create points the prompt's `activeConfigId` at this seeded
787
- * config, so retiring it in this early patch would archive the config the
788
- * prompt is serving from and leave it there until the marked entry is created
789
- * and activated — a window a failed create or activation freezes. It is
790
- * applied after activation instead (`createdConfigStatusPatch`).
807
+ * #3201 — the entry's `status` was deferred the OTHER way, to a patch after the
808
+ * activation, because the create pointed the prompt's `activeConfigId` at a
809
+ * config it had forced live. #3799 (DSO-3799-005) — the create carries the
810
+ * entry's `status` itself now, so there is no deferral either way and this patch
811
+ * is the two fields `POST /prompts` cannot express, nothing more.
791
812
  */
792
813
  export declare function seededOnlyPromptConfigFields(firstConfig: any, seededConfigName?: string): Record<string, any> | null;
793
814
  /**
@@ -907,25 +928,100 @@ export declare function runConfigPushPreflight(input: {
907
928
  syncState: SyncState | null;
908
929
  force: boolean;
909
930
  isCrossAppPush: boolean;
910
- client: Pick<ApiClient, "listIntegrations">;
931
+ client: Pick<ApiClient, "listIntegrations" | "listFunctions">;
911
932
  }): Promise<{
912
933
  parsedVars: Record<string, unknown> | null;
913
934
  }>;
935
+ export declare function promptKindFileErrors(filePath: string, tomlData: any): string[];
936
+ /**
937
+ * The functions an agent's references are checked against at push — #3798,
938
+ * DSO-3798-002.
939
+ *
940
+ * `config push` applies prompts, then (for agents) the server functions leg,
941
+ * so a reference may be satisfied by a function that is live already or by one
942
+ * this push creates. What the push BELIEVES is therefore the live listing
943
+ * overlaid by the function files this push SELECTS (`--only`, every file when
944
+ * unscoped): a selected file's schemas are what the server will hold after the
945
+ * push, so it wins over the live row. An UNSELECTED file is not read at all —
946
+ * its edits will not be applied, and a function only it declares will not
947
+ * exist afterwards.
948
+ *
949
+ * `live` is `null` when the listing could not be fetched: the selected files
950
+ * still count, and `liveListed` lets the refusal say why every other reference
951
+ * could not be confirmed. A live row that is archived is a tombstone, not a
952
+ * function; an inactive one is accepted (the turn engine re-checks
953
+ * availability on every call).
954
+ */
955
+ export declare function agentFunctionFactsForPush(input: {
956
+ configDir: string;
957
+ pushSelection: SyncSelection | null;
958
+ live: ReadonlyArray<Record<string, unknown>> | null;
959
+ }): {
960
+ facts: AgentFunctionFacts;
961
+ liveListed: boolean;
962
+ };
963
+ /**
964
+ * The function half of an agent's declaration — #3798: every tool, turn
965
+ * context and history function that the functions this push believes
966
+ * (`agentFunctionFactsForPush`) do not have, and every tool function lacking an
967
+ * input or output schema. The same `resolveAgentDeclaration` the admin routes
968
+ * run; only its function refusals are reported here, because the collector
969
+ * (`promptKindFileErrors`) already reported the file-decidable ones.
970
+ */
971
+ export declare function promptAgentFunctionErrors(filePath: string, tomlData: any, known: {
972
+ facts: AgentFunctionFacts;
973
+ liveListed: boolean;
974
+ }): string[];
975
+ /**
976
+ * The order `config push` applies prompt files in — #3798. An agent names
977
+ * server functions that must exist when it is created, and the push applies
978
+ * prompts before functions, so agent files go AFTER the server-functions leg;
979
+ * every other file keeps its place. A file that does not parse stays first, so
980
+ * the leg reports it where it always has.
981
+ */
982
+ export declare function partitionPromptFilesForPush(promptsDir: string, files: readonly string[]): {
983
+ beforeFunctions: string[];
984
+ afterFunctions: string[];
985
+ };
986
+ /**
987
+ * Every `prompts/<key>.tests/*.toml` sidecar whose prompt is an agent — #3798
988
+ * (§D1: prompt test cases are refused for the kind in v1). The admin test-case
989
+ * routes refuse the same case with `AGENT_TEST_CASE_NOT_SUPPORTED`; this says
990
+ * so before anything is applied.
991
+ */
992
+ export declare function promptAgentSidecarErrors(configDir: string): string[];
914
993
  /**
915
- * Every per-entity config file whose TOML `config push` would refuse (#2880
916
- * criterion 1, symmetry).
994
+ * The immutable-`kind` refusal for a prompt update the comparison gate did not
995
+ * decide — #3626, CR3626-001.
917
996
  *
918
- * One collector, two commands. Push aborts on the messages before issuing a
919
- * request; `config diff` renders them as their own rows, because the failure
920
- * this closes is a file diff calls Synced and push then rejects — the state the
921
- * issue's reporter hit after #2803 retired `[prompt].status`, where a local key
922
- * with no server counterpart is invisible to a comparison and fatal to a push.
997
+ * `kind` is create-only (D3626-008), and the gate refuses a change to it on
998
+ * every path that compares the two sides. Two update paths do not compare: a
999
+ * prompt whose DETAIL read failed falls back to the manifest byte-hash gate,
1000
+ * which `--force` writes straight through, and a prompt ADOPTED after a
1001
+ * create's 409 is re-issued as an update without a comparison at all. Both
1002
+ * would otherwise PATCH the file's schemas, access rule and metadata onto a
1003
+ * row of the other kind, and only then have its configs refused against the
1004
+ * kind the update cannot change.
1005
+ *
1006
+ * Returns the gate's own outcome shape, so `recordDeclined` prints the same
1007
+ * two values and the same remedy — create the prompt under a new key.
1008
+ *
1009
+ * `null` when the kinds agree and when the server's kind is simply not KNOWN:
1010
+ * a push that could not read live state at all has nothing to compare, and
1011
+ * that path's contract (`decideDegradedPush`, #2880) is already "decline
1012
+ * unless the operator forces it", stated for every field at once.
1013
+ */
1014
+ export declare function promptKindImmutableOutcome(storedKind: PromptKind | undefined, localDoc: any): Extract<PushGateOutcome, {
1015
+ action: "immutable";
1016
+ }> | null;
1017
+ /**
1018
+ * The one deprecation notice a prompt file using the FLAT chat spelling earns
1019
+ * — #3626 §4, beside the `celContextAccess` notice's precedent.
923
1020
  *
924
- * Three checks, all definition-driven: the document's table shape, keys no
925
- * definition declares (retired keys among them), and — since #2880 — values
926
- * whose spelling is not the declared type. A file that does not parse is left
927
- * to the per-type loop that reads it, which names the parse error itself.
1021
+ * Advisory: the push continues and the keys are applied. `null` when the file
1022
+ * is already written in the grouped spelling, so a migrated tree is silent.
928
1023
  */
1024
+ export declare function promptFlatChatKeyWarning(filePath: string, tomlData: any): string | null;
929
1025
  export declare function collectConfigFileValidationErrors(configDir: string): ConfigFileValidationError[];
930
1026
  /**
931
1027
  * Every `functions/<key>.toml` whose file-decidable errors `config push` would