primitive-admin 1.2.0-alpha.6 → 1.2.0-alpha.7

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 (63) hide show
  1. package/README.md +1 -1
  2. package/dist/src/commands/apps-children.d.ts +1 -1
  3. package/dist/src/commands/apps-children.js +170 -28
  4. package/dist/src/commands/apps-children.js.map +1 -1
  5. package/dist/src/commands/auth.js +41 -6
  6. package/dist/src/commands/auth.js.map +1 -1
  7. package/dist/src/commands/config.js +43 -4
  8. package/dist/src/commands/config.js.map +1 -1
  9. package/dist/src/commands/database-types.js +313 -13
  10. package/dist/src/commands/database-types.js.map +1 -1
  11. package/dist/src/commands/databases.js +130 -53
  12. package/dist/src/commands/databases.js.map +1 -1
  13. package/dist/src/commands/init.d.ts +7 -0
  14. package/dist/src/commands/init.js +9 -1
  15. package/dist/src/commands/init.js.map +1 -1
  16. package/dist/src/commands/llm.js +6 -9
  17. package/dist/src/commands/llm.js.map +1 -1
  18. package/dist/src/commands/settings.d.ts +9 -12
  19. package/dist/src/commands/settings.js +79 -31
  20. package/dist/src/commands/settings.js.map +1 -1
  21. package/dist/src/commands/sync.d.ts +118 -6
  22. package/dist/src/commands/sync.js +594 -55
  23. package/dist/src/commands/sync.js.map +1 -1
  24. package/dist/src/lib/child-apps-local.d.ts +45 -21
  25. package/dist/src/lib/child-apps-local.js +68 -30
  26. package/dist/src/lib/child-apps-local.js.map +1 -1
  27. package/dist/src/lib/credentials-store.d.ts +38 -3
  28. package/dist/src/lib/credentials-store.js +175 -9
  29. package/dist/src/lib/credentials-store.js.map +1 -1
  30. package/dist/src/lib/function-collect.d.ts +1 -1
  31. package/dist/src/lib/function-collect.js +4 -0
  32. package/dist/src/lib/function-collect.js.map +1 -1
  33. package/dist/src/lib/function-triggers.d.ts +3 -15
  34. package/dist/src/lib/function-triggers.js +10 -72
  35. package/dist/src/lib/function-triggers.js.map +1 -1
  36. package/dist/src/lib/generated-config-surfaces.d.ts +148 -0
  37. package/dist/src/lib/generated-config-surfaces.js +208 -25
  38. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  39. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  40. package/dist/src/lib/generated-sdk-types.js +1 -1
  41. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  42. package/dist/src/lib/local-state.d.ts +21 -6
  43. package/dist/src/lib/local-state.js +78 -34
  44. package/dist/src/lib/local-state.js.map +1 -1
  45. package/dist/src/lib/push-failure-report.d.ts +45 -0
  46. package/dist/src/lib/push-failure-report.js +57 -0
  47. package/dist/src/lib/push-failure-report.js.map +1 -0
  48. package/dist/src/lib/sync-selectors.d.ts +5 -1
  49. package/dist/src/lib/sync-selectors.js +23 -13
  50. package/dist/src/lib/sync-selectors.js.map +1 -1
  51. package/dist/src/lib/transient-retry.d.ts +9 -0
  52. package/dist/src/lib/transient-retry.js +37 -0
  53. package/dist/src/lib/transient-retry.js.map +1 -1
  54. package/dist/src/lib/vars-override.d.ts +105 -0
  55. package/dist/src/lib/vars-override.js +143 -0
  56. package/dist/src/lib/vars-override.js.map +1 -0
  57. package/package.json +2 -2
  58. package/dist/src/lib/generated-workflow-model-fields.d.ts +0 -20
  59. package/dist/src/lib/generated-workflow-model-fields.js +0 -53
  60. package/dist/src/lib/generated-workflow-model-fields.js.map +0 -1
  61. package/dist/src/lib/workflow-field-descriptor.d.ts +0 -91
  62. package/dist/src/lib/workflow-field-descriptor.js +0 -153
  63. package/dist/src/lib/workflow-field-descriptor.js.map +0 -1
@@ -4,7 +4,8 @@ import { type PullWriteTally } from "../lib/pull-write.js";
4
4
  import { type PushMode } from "../lib/config-payload.js";
5
5
  import { type ConfigObjectSurface, type ConfigTable } from "../lib/generated-config-surfaces.js";
6
6
  import { type PromptKind } from "../lib/generated-config-surfaces.js";
7
- import { type AgentFunctionFacts } from "../lib/generated-config-surfaces.js";
7
+ import { type AgentFunctionFact, type AgentFunctionFacts } from "../lib/generated-config-surfaces.js";
8
+ import { type AgentSchemaConfigFact } from "../lib/generated-config-surfaces.js";
8
9
  import { type DocumentSchemaResolution } from "../lib/function-document-types.js";
9
10
  import { type PresenceOutcome, type TestBlockType } from "../lib/sync-resource-types.js";
10
11
  export { resolveSlugCollisions, slugifyTestCaseName, testCaseFileBasenames, } from "../lib/test-case-file-names.js";
@@ -324,6 +325,10 @@ export declare function validateWebhookCapForPush(localKeys: string[], remoteKey
324
325
  */
325
326
  export declare function validateVarsFile(parsedVars: Record<string, unknown>, options?: {
326
327
  onlyKeys?: ReadonlySet<string>;
328
+ /** The file the entries came from, for the messages (#4485). */
329
+ fileName?: string;
330
+ /** Skip the count cap — the caller measures it on a layered set (#4485). */
331
+ skipCountCap?: boolean;
327
332
  }): string[];
328
333
  /**
329
334
  * Plan the config-var writes a `config push` should make, detecting concurrent
@@ -428,7 +433,12 @@ export declare function countVarsAfterPush(remoteVars: Array<{
428
433
  * local value). Pure and side-effect-free so it's unit-testable without a live
429
434
  * server.
430
435
  */
431
- export declare function diffVars(localVars: Map<string, string>, remoteVars: Map<string, string>): Array<{
436
+ export declare function diffVars(localVars: Map<string, string>, remoteVars: Map<string, string>,
437
+ /**
438
+ * The file `config pull` would write a server value into — a machine-local
439
+ * environment's override file (#4485). Defaults to `vars.toml`.
440
+ */
441
+ pullTargetFile?: string): Array<{
432
442
  type: "var";
433
443
  key: string;
434
444
  status: string;
@@ -958,9 +968,18 @@ export declare function runConfigPushPreflight(input: {
958
968
  * tree's, never this app's, so it is out of the validated body.
959
969
  */
960
970
  localEnvironment?: boolean;
961
- client: Pick<ApiClient, "listIntegrations" | "listFunctions">;
971
+ client: Pick<ApiClient, "listIntegrations" | "listFunctions" | "listPrompts" | "listPromptConfigs">;
972
+ /** #4485 — the environment's vars override file, layered over vars.toml. */
973
+ varsOverridePath?: string | null;
962
974
  }): Promise<{
963
975
  parsedVars: Record<string, unknown> | null;
976
+ /** #4441 — agent files to apply before the functions leg. */
977
+ agentFilesFirst: string[];
978
+ /** #4485 — which override keys replace or add, when an override was read. */
979
+ varsOverrideKeys: {
980
+ overridingKeys: string[];
981
+ addedKeys: string[];
982
+ } | null;
964
983
  }>;
965
984
  export declare function promptKindFileErrors(filePath: string, tomlData: any): string[];
966
985
  /**
@@ -990,6 +1009,90 @@ export declare function agentFunctionFactsForPush(input: {
990
1009
  facts: AgentFunctionFacts;
991
1010
  liveListed: boolean;
992
1011
  };
1012
+ /**
1013
+ * The functions the app holds now, as the agent rules read them — #3798. A
1014
+ * live row that is archived is a tombstone, not a function, so it is absent.
1015
+ */
1016
+ export declare function liveAgentFunctionFacts(live: ReadonlyArray<Record<string, unknown>> | null): Record<string, AgentFunctionFact>;
1017
+ /** A selected `functions/<file>` and the key push resolves it to. */
1018
+ export interface FunctionChangePreflightFile {
1019
+ file: string;
1020
+ key: string;
1021
+ }
1022
+ /** A prompt of the app's live listing, as `functionChangePreflight` reads it. */
1023
+ export interface FunctionChangePreflightPrompt {
1024
+ promptId: string;
1025
+ promptKey: string;
1026
+ kind?: unknown;
1027
+ status?: unknown;
1028
+ /** `[prompt.agent]` as stored. */
1029
+ agent?: unknown;
1030
+ }
1031
+ /** A selected agent prompt file. */
1032
+ export interface FunctionChangePreflightAgentFile {
1033
+ /** The file name under `prompts/`. */
1034
+ file: string;
1035
+ promptKey: string;
1036
+ /** The parsed file. */
1037
+ tomlData: any;
1038
+ }
1039
+ /** What `functionChangePreflight` reads: everything the push already listed or parsed. */
1040
+ export interface FunctionChangePreflightInput {
1041
+ /** The function files this push selects. */
1042
+ selectedFunctionFiles: ReadonlyArray<FunctionChangePreflightFile>;
1043
+ /** The functions the app holds now (`liveAgentFunctionFacts`). */
1044
+ live: AgentFunctionFacts;
1045
+ /** What this push believes: the live functions overlaid by the selected files. */
1046
+ pushed: AgentFunctionFacts;
1047
+ /** The app's prompts, or `null` when they could not be listed. */
1048
+ prompts: ReadonlyArray<FunctionChangePreflightPrompt> | null;
1049
+ /** Every config of each live agent that names a changed function, by `promptId`. */
1050
+ configsOf: ReadonlyMap<string, ReadonlyArray<AgentSchemaConfigFact>>;
1051
+ /** The agent prompt files this push selects. */
1052
+ selectedAgentFiles: ReadonlyArray<FunctionChangePreflightAgentFile>;
1053
+ }
1054
+ /** The preflight errors, the warnings, and the agent files to apply first. */
1055
+ export interface FunctionChangePreflightResult {
1056
+ errors: string[];
1057
+ warnings: string[];
1058
+ /** Agent files to apply before the server-functions leg (`partitionPromptFilesForPush`). */
1059
+ agentFilesFirst: string[];
1060
+ }
1061
+ /**
1062
+ * The selected function files that CHANGE a live function — #4441. A file
1063
+ * whose function is not live creates it, which no agent can depend on yet.
1064
+ * The push lists the app's prompts only when this is non-empty.
1065
+ */
1066
+ export declare function functionChangePreflightKeys(selectedFunctionFiles: ReadonlyArray<FunctionChangePreflightFile>, live: AgentFunctionFacts): FunctionChangePreflightFile[];
1067
+ /**
1068
+ * The live, non-archived agent prompts that name at least one of `keys`.
1069
+ * Whose configs the push reads for `functionChangePreflight`.
1070
+ */
1071
+ export declare function functionChangePreflightAgents(prompts: ReadonlyArray<FunctionChangePreflightPrompt>, keys: ReadonlyArray<string>): FunctionChangePreflightPrompt[];
1072
+ /**
1073
+ * Would a function change this push makes break a live agent? — #4441.
1074
+ *
1075
+ * The same rule the function routes run (`agentFunctionChangeRefusals`), so a
1076
+ * change the preflight lets through is one the server accepts, run for every
1077
+ * selected file that changes a live function against every live non-archived
1078
+ * agent that names it, with every config of that agent:
1079
+ *
1080
+ * - an agent whose prompt file this push does NOT select would be broken by
1081
+ * the change: a preflight error naming the function file, the agent and its
1082
+ * uses, and the remedy (change the agent in the same push, or retire it);
1083
+ * - an agent whose file IS selected keeps the existing order (applied after
1084
+ * the functions leg) unless its LIVE declaration would be broken by the
1085
+ * change. Then the file must go first to release the reference, which it
1086
+ * can only do when it is valid against the functions the app holds NOW —
1087
+ * its references, the providers of its non-archived configs, and the
1088
+ * providers of the configs the server still holds at its prompt PATCH. When it
1089
+ * is, it joins `agentFilesFirst`; when it is not, the push cannot be
1090
+ * ordered in one run and the error names the sequence that can.
1091
+ *
1092
+ * `prompts: null` (the listing failed) checks nothing and says so once; the
1093
+ * server's refusal remains.
1094
+ */
1095
+ export declare function functionChangePreflight(input: FunctionChangePreflightInput): FunctionChangePreflightResult;
993
1096
  /**
994
1097
  * The function half of an agent's declaration — #3798: every tool, turn
995
1098
  * context and history function that the functions this push believes
@@ -1007,9 +1110,10 @@ export declare function promptAgentFunctionErrors(filePath: string, tomlData: an
1007
1110
  * server functions that must exist when it is created, and the push applies
1008
1111
  * prompts before functions, so agent files go AFTER the server-functions leg;
1009
1112
  * every other file keeps its place. A file that does not parse stays first, so
1010
- * the leg reports it where it always has.
1113
+ * the leg reports it where it always has. #4441 — the agent files in
1114
+ * `agentFilesFirst` (`functionChangePreflight`) go before the leg instead.
1011
1115
  */
1012
- export declare function partitionPromptFilesForPush(promptsDir: string, files: readonly string[]): {
1116
+ export declare function partitionPromptFilesForPush(promptsDir: string, files: readonly string[], agentFilesFirst?: readonly string[]): {
1013
1117
  beforeFunctions: string[];
1014
1118
  afterFunctions: string[];
1015
1119
  };
@@ -1590,6 +1694,7 @@ export interface PushFieldDiff {
1590
1694
  */
1591
1695
  export type PushGateOutcome = {
1592
1696
  action: "live-unavailable";
1697
+ transient?: boolean;
1593
1698
  } | {
1594
1699
  action: "create";
1595
1700
  } | {
@@ -2377,6 +2482,7 @@ export declare function listAllTestCases(client: ApiClient, appId: string, block
2377
2482
  items: any[];
2378
2483
  } | {
2379
2484
  ok: false;
2485
+ error: unknown;
2380
2486
  }>;
2381
2487
  /**
2382
2488
  * Copy a block's prior `entities.testCases` records into the pull's fresh map
@@ -2460,11 +2566,17 @@ interface PushResolutionMaps {
2460
2566
  /** Whether a block is authored locally but not on the server yet. */
2461
2567
  isPlannedBlock?: (blockType: TestBlockType, blockKey: string) => boolean;
2462
2568
  }
2463
- /** A failure row the push reports and exits nonzero on (`applyFailures`). */
2569
+ /**
2570
+ * A failure row the push reports and exits nonzero on (`applyFailures`).
2571
+ * `transient` is set where a request failed without an answer, or with a
2572
+ * transient status: a push that failed only on such rows may succeed when run
2573
+ * again (#4491).
2574
+ */
2464
2575
  type ApplyFailure = {
2465
2576
  type: string;
2466
2577
  key: string;
2467
2578
  message: string;
2579
+ transient?: boolean;
2468
2580
  };
2469
2581
  /** The attachment bookkeeping a test case's sync-state record carries. */
2470
2582
  type RecordedAttachments = {