primitive-admin 1.1.0 → 1.2.0-alpha.1

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 (71) hide show
  1. package/README.md +14 -13
  2. package/assets/skill/skills/primitive-platform/SKILL.md +6 -0
  3. package/dist/src/commands/collections.js +20 -17
  4. package/dist/src/commands/collections.js.map +1 -1
  5. package/dist/src/commands/connections.js +1 -5
  6. package/dist/src/commands/connections.js.map +1 -1
  7. package/dist/src/commands/database-types.js +13 -313
  8. package/dist/src/commands/database-types.js.map +1 -1
  9. package/dist/src/commands/databases.js +7 -128
  10. package/dist/src/commands/databases.js.map +1 -1
  11. package/dist/src/commands/groups.js +16 -0
  12. package/dist/src/commands/groups.js.map +1 -1
  13. package/dist/src/commands/llm.js +9 -6
  14. package/dist/src/commands/llm.js.map +1 -1
  15. package/dist/src/commands/sessions.js +3 -8
  16. package/dist/src/commands/sessions.js.map +1 -1
  17. package/dist/src/commands/settings.d.ts +18 -0
  18. package/dist/src/commands/settings.js +54 -0
  19. package/dist/src/commands/settings.js.map +1 -0
  20. package/dist/src/commands/sync.d.ts +77 -7
  21. package/dist/src/commands/sync.js +368 -198
  22. package/dist/src/commands/sync.js.map +1 -1
  23. package/dist/src/commands/tokens.js +1 -6
  24. package/dist/src/commands/tokens.js.map +1 -1
  25. package/dist/src/commands/workflows.js +3 -3
  26. package/dist/src/commands/workflows.js.map +1 -1
  27. package/dist/src/lib/api-client.d.ts +3 -70
  28. package/dist/src/lib/api-client.js +20 -106
  29. package/dist/src/lib/api-client.js.map +1 -1
  30. package/dist/src/lib/app-match-guard.d.ts +44 -0
  31. package/dist/src/lib/app-match-guard.js +72 -0
  32. package/dist/src/lib/app-match-guard.js.map +1 -0
  33. package/dist/src/lib/collection-export.d.ts +37 -9
  34. package/dist/src/lib/collection-export.js +48 -12
  35. package/dist/src/lib/collection-export.js.map +1 -1
  36. package/dist/src/lib/config-object-descriptor.js +2 -3
  37. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  38. package/dist/src/lib/function-triggers.d.ts +66 -0
  39. package/dist/src/lib/function-triggers.js +285 -0
  40. package/dist/src/lib/function-triggers.js.map +1 -0
  41. package/dist/src/lib/generated-allowlist.js +0 -1
  42. package/dist/src/lib/generated-allowlist.js.map +1 -1
  43. package/dist/src/lib/generated-config-surfaces.d.ts +4 -2
  44. package/dist/src/lib/generated-config-surfaces.js +138 -68
  45. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  46. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  47. package/dist/src/lib/generated-sdk-types.js +1 -1
  48. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  49. package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
  50. package/dist/src/lib/generated-workflow-model-fields.js +53 -0
  51. package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
  52. package/dist/src/lib/google-client-secret-status.d.ts +35 -0
  53. package/dist/src/lib/google-client-secret-status.js +56 -0
  54. package/dist/src/lib/google-client-secret-status.js.map +1 -0
  55. package/dist/src/lib/log-inspection.d.ts +1 -6
  56. package/dist/src/lib/log-inspection.js +5 -7
  57. package/dist/src/lib/log-inspection.js.map +1 -1
  58. package/dist/src/lib/migration-nag.d.ts +2 -2
  59. package/dist/src/lib/migration-nag.js +4 -3
  60. package/dist/src/lib/migration-nag.js.map +1 -1
  61. package/dist/src/lib/paginate.d.ts +8 -24
  62. package/dist/src/lib/paginate.js +8 -21
  63. package/dist/src/lib/paginate.js.map +1 -1
  64. package/dist/src/lib/sync-dir-selector.d.ts +1 -1
  65. package/dist/src/lib/sync-dir-selector.js +1 -1
  66. package/dist/src/lib/toml-database-config.js +2 -2
  67. package/dist/src/lib/toml-database-config.js.map +1 -1
  68. package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
  69. package/dist/src/lib/workflow-field-descriptor.js +153 -0
  70. package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
  71. package/package.json +2 -2
@@ -0,0 +1,54 @@
1
+ /**
2
+ * `primitive settings` — the app-settings READER (issue #1033, Phase 2;
3
+ * narrowed to a reader by #2645).
4
+ *
5
+ * App settings are authored in `app.toml` and applied with `sync push`, so
6
+ * this group carries the one thing the file cannot answer: what the server is
7
+ * actually running. `settings get` renders the server-effective settings —
8
+ * `get` rather than `show`, so the read verb is the same word on every
9
+ * configuration surface.
10
+ *
11
+ * `settings pull`, `settings diff` and `settings push` are gone. They operated
12
+ * on the same `app.toml` and the same `entities.app` hash `sync` owns, so they
13
+ * were a second pathway to one piece of state; `sync pull|diff|push --only app`
14
+ * is the single one. The remaining command logic lives in
15
+ * `sync-app-settings.ts`, shared with `sync`.
16
+ */
17
+ import { ApiClient } from "../lib/api-client.js";
18
+ import { resolveAppId } from "../lib/config.js";
19
+ import { showAppSettings } from "./sync-app-settings.js";
20
+ export function registerSettingsCommands(program) {
21
+ const settings = program
22
+ .command("settings")
23
+ .description("View the app settings the server is running")
24
+ .addHelpText("after", `
25
+ Examples:
26
+ $ primitive settings get # Render current server settings
27
+ $ primitive settings get --json # Machine-readable
28
+ $ primitive sync pull --only app # Write server settings to app.toml
29
+ $ primitive config set app app.baseUrl=https://example.com
30
+ $ primitive sync diff --only app # Show local app.toml vs server
31
+ $ primitive sync push --only app # Apply app.toml edits to the server
32
+
33
+ app.toml is the ONLY way to manage app configuration (issue #2645): a full
34
+ \`sync push\` applies it, and \`sync push --only app\` applies it alone.
35
+ \`primitive config fields app\` lists its keys, types and defaults. The Google OAuth
36
+ client secret is an ordinary [auth] key holding a reference into the app's
37
+ secret store, never the secret itself: store the value with
38
+ 'primitive secrets set GOOGLE_CLIENT_SECRET --value <secret>', then set
39
+ googleClientSecret = "{{secrets.GOOGLE_CLIENT_SECRET}}" in app.toml. A literal
40
+ secret there is rejected by the server.
41
+ `);
42
+ // settings get
43
+ settings
44
+ .command("get")
45
+ .description("Show the current server-effective app settings")
46
+ .argument("[app-id]", "App ID (uses current app if not specified)")
47
+ .option("--app <app-id>", "App ID")
48
+ .option("--json", "Output as JSON")
49
+ .action(async (appId, options) => {
50
+ const resolvedAppId = resolveAppId(appId, options);
51
+ await showAppSettings(new ApiClient(), resolvedAppId, options);
52
+ });
53
+ }
54
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../src/commands/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,6CAA6C,CAAC;SAC1D,WAAW,CACV,OAAO,EACP;;;;;;;;;;;;;;;;;CAiBL,CACI,CAAC;IAEJ,eAAe;IACf,QAAQ;SACL,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,gDAAgD,CAAC;SAC7D,QAAQ,CAAC,UAAU,EAAE,4CAA4C,CAAC;SAClE,MAAM,CAAC,gBAAgB,EAAE,QAAQ,CAAC;SAClC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAC/B,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACnD,MAAM,eAAe,CAAC,IAAI,SAAS,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -676,8 +676,8 @@ export declare function serializeBlobBucket(bucket: any, logger?: (message: stri
676
676
  *
677
677
  * EXACT extraction of the inline builder shared by the existing-update and
678
678
  * 409-adopt branches — do NOT "clean up" the truthiness checks on the access
679
- * model. The server treats `preset` and `accessPolicy` as mutually exclusive,
680
- * only clears `ruleSetId` when a preset/accessPolicy is also present, and
679
+ * model. The server treats `preset` and `ruleSetId` as mutually exclusive,
680
+ * only clears `ruleSetId` when a preset is also present, and
681
681
  * refuses to leave a bucket with no access model or a blank name — so those
682
682
  * fields are not clearable. `bucketKey` and `ttlTier` are immutable and never
683
683
  * sent. Both call sites must go through this helper so their field sets never
@@ -706,9 +706,6 @@ export declare function buildBlobBucketUpdatePayload(bucket: any): any;
706
706
  * first-wins rule: making the file's meaning depend on entry order is the kind
707
707
  * of implicit behavior this issue exists to remove, and silently picking one
708
708
  * would let the repo claim something the server does not do.
709
- *
710
- * `isActive` is accepted as a legacy spelling — the create leg read it before
711
- * pull ever wrote a marker, so a hand-authored file carrying it keeps working.
712
709
  */
713
710
  export declare function promptActiveConfigName(configs: any[]): string | undefined;
714
711
  /**
@@ -1554,7 +1551,7 @@ export declare function hashLocalConfigForDiff(spec: ConfigDiffSpec, parsedToml:
1554
1551
  * Hash a SERVER entity the same way, by serializing it into the file `sync
1555
1552
  * pull` would write and hashing that — so the two sides are normalized
1556
1553
  * identically by construction, and a legacy encoding on disk (a JSON-string
1557
- * operation, an id-based rule-set reference) is not a false `Modified`.
1554
+ * operation) is not a false `Modified`.
1558
1555
  *
1559
1556
  * `extra` carries the sibling rows a type's file also holds: a database type's
1560
1557
  * operations and subscriptions, which the list response does not include.
@@ -2104,11 +2101,40 @@ export interface TestCaseLookupMaps {
2104
2101
  configIdToName: Map<string, string>;
2105
2102
  promptIdToKey: Map<string, string>;
2106
2103
  }
2104
+ /**
2105
+ * A test-case reference the id→name lookups could not name (#3998): the TOML
2106
+ * key it is authored under, the wire field it is stored in, and the raw id.
2107
+ */
2108
+ export interface TestCaseUnresolvedReference {
2109
+ tomlKey: "configName" | "evaluatorPromptKey" | "evaluatorConfigName";
2110
+ field: "configId" | "evaluatorPromptId" | "evaluatorConfigId";
2111
+ id: string;
2112
+ }
2113
+ /**
2114
+ * The sidecar `config pull` writes for one server record. It never emits an id
2115
+ * key (#3998): a reference the lookups cannot name is written as an empty name
2116
+ * and reported through `onUnresolved`, and `pullTestCasesForBlock` declines to
2117
+ * write such a case rather than unpin it on disk.
2118
+ */
2107
2119
  export declare function serializeTestCase(testCase: any, lookupMaps?: TestCaseLookupMaps, options?: {
2108
2120
  /** The sidecar path the warning names, e.g. `prompts/greet.tests/a.toml`. */
2109
2121
  file?: string;
2110
2122
  logger?: (message: string) => void;
2123
+ /** Called with the references the lookups could not name, when any. */
2124
+ onUnresolved?: (references: TestCaseUnresolvedReference[]) => void;
2111
2125
  }): string;
2126
+ /**
2127
+ * The rendering of a server record that the comparison parses (#3998) — never
2128
+ * written to disk.
2129
+ *
2130
+ * It differs from the file pull writes in one place: a reference the lookups
2131
+ * cannot name carries its raw id in the NAME slot. A live case pinned to a
2132
+ * deleted or unlistable configuration must stay a difference against an
2133
+ * unpinned file; projecting it as "no reference" would read the pair as Synced,
2134
+ * and the next content edit would push `configId: null` and clear the pin in
2135
+ * silence.
2136
+ */
2137
+ export declare function serializeTestCaseForComparison(testCase: any, lookupMaps?: TestCaseLookupMaps): string;
2112
2138
  export declare function parseTestCaseToml(tomlData: any): any;
2113
2139
  /**
2114
2140
  * Pull server-side `Script` rows into `transforms/*.rhai` and record
@@ -2258,12 +2284,55 @@ export declare function pullFunctions(client: ApiClient, appId: string, configDi
2258
2284
  */
2259
2285
  items: any[];
2260
2286
  }>;
2287
+ /**
2288
+ * A listed test case `config pull` did NOT write, because a reference could not
2289
+ * be named (#3998). Its existing sidecar files (`preservedSlugs`, those still
2290
+ * on disk) and its prior sync-state records were kept as they were.
2291
+ */
2292
+ export interface TestCaseUnwritten {
2293
+ blockType: TestBlockType;
2294
+ blockKey: string;
2295
+ /** The file name the case would be written to now. */
2296
+ slug: string;
2297
+ name: string;
2298
+ testCaseId: string;
2299
+ references: TestCaseUnresolvedReference[];
2300
+ preservedSlugs: string[];
2301
+ }
2302
+ /**
2303
+ * The id→name lookups `config pull` writes test-case references through
2304
+ * (#3998).
2305
+ *
2306
+ * The prompt half is built from EVERY prompt's detail — the pull fetches them
2307
+ * all before `--only` filters the list — so a judge prompt outside the
2308
+ * selection still names. Configurations come from the pulled blocks (a case
2309
+ * pins one of its own block's) and from every prompt (a judge's config is the
2310
+ * judge prompt's). An entry without both an id and a name is skipped.
2311
+ */
2312
+ export declare function testCaseLookupMapsForPull(input: {
2313
+ prompts: ReadonlyArray<{
2314
+ promptId?: string;
2315
+ promptKey?: string;
2316
+ configs?: ReadonlyArray<{
2317
+ configId?: string;
2318
+ configName?: string;
2319
+ }> | null;
2320
+ }>;
2321
+ configs: ReadonlyArray<{
2322
+ configId?: string;
2323
+ configName?: string;
2324
+ }>;
2325
+ }): TestCaseLookupMaps;
2261
2326
  /** The outcome of one block's test-case pull (#2769). */
2262
2327
  export type TestCasePullOutcome =
2263
- /** The listing succeeded; `count` cases were written and stale files removed. */
2328
+ /**
2329
+ * The listing succeeded; `count` cases were written and stale files removed.
2330
+ * `unwritten` are the listed cases skipped for an unresolvable reference.
2331
+ */
2264
2332
  {
2265
2333
  ok: true;
2266
2334
  count: number;
2335
+ unwritten: TestCaseUnwritten[];
2267
2336
  }
2268
2337
  /** The listing failed: nothing was written, and the caller preserves state. */
2269
2338
  | {
@@ -2339,6 +2408,7 @@ export declare function pullTestCasesForBlocks(params: {
2339
2408
  }): Promise<{
2340
2409
  count: number;
2341
2410
  skippedBlocks: string[];
2411
+ unwritten: TestCaseUnwritten[];
2342
2412
  }>;
2343
2413
  interface PushResolutionMaps {
2344
2414
  promptKeyToId: Map<string, string>;