@camstack/addon-ai 0.1.1 → 0.1.2

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.
package/dist/addon.js CHANGED
@@ -24865,6 +24865,13 @@ var openAiAdapter = {
24865
24865
  * stable selector key so `set` upserts and `set(selector, null)` deletes.
24866
24866
  */
24867
24867
  var DEFAULTS_COLLECTION = "llm-defaults";
24868
+ /** KV JSON-blob shape — a single `data` column routes through the settings
24869
+ * backend's canonical key/value path (id TEXT PK, data TEXT). */
24870
+ var KV_BLOB_COLUMNS$1 = [{
24871
+ name: "data",
24872
+ type: "TEXT",
24873
+ notNull: true
24874
+ }];
24868
24875
  function selectorKey(selector) {
24869
24876
  return "consumer" in selector ? `consumer:${selector.consumer}` : `purpose:${selector.purpose}`;
24870
24877
  }
@@ -24873,6 +24880,11 @@ var DefaultsStore = class {
24873
24880
  constructor(store) {
24874
24881
  this.store = store;
24875
24882
  }
24883
+ /** Declare the backing collection before any read/write — the SQLite
24884
+ * settings backend rejects undeclared collections (fail-fast). */
24885
+ async init() {
24886
+ await this.store.declareCollection(DEFAULTS_COLLECTION, KV_BLOB_COLUMNS$1);
24887
+ }
24876
24888
  async list() {
24877
24889
  const rows = await this.store.query(DEFAULTS_COLLECTION);
24878
24890
  const out = [];
@@ -24911,6 +24923,13 @@ var PROFILES_COLLECTION = "llm-profiles";
24911
24923
  var META_COLLECTION = "llm-meta";
24912
24924
  var SEED_PROFILE_ID = "seed-ollama-lan";
24913
24925
  var SEED_MARKER_ID = "seededDefaults";
24926
+ /** KV JSON-blob shape — a single `data` column routes the row through the
24927
+ * settings backend's canonical key/value path (id TEXT PK, data TEXT). */
24928
+ var KV_BLOB_COLUMNS = [{
24929
+ name: "data",
24930
+ type: "TEXT",
24931
+ notNull: true
24932
+ }];
24914
24933
  function rowToProfile(id, data) {
24915
24934
  const parsed = LlmProfileSchema.safeParse({
24916
24935
  ...data,
@@ -24927,6 +24946,13 @@ var ProfileStore = class {
24927
24946
  constructor(store) {
24928
24947
  this.store = store;
24929
24948
  }
24949
+ /** Declare the backing collections before any read/write. The SQLite
24950
+ * settings backend rejects undeclared collections (fail-fast), so this
24951
+ * MUST run before `ensureSeeded`/`list`/`upsert` — mirrors UsageStore.init. */
24952
+ async init() {
24953
+ await this.store.declareCollection(PROFILES_COLLECTION, KV_BLOB_COLUMNS);
24954
+ await this.store.declareCollection(META_COLLECTION, KV_BLOB_COLUMNS);
24955
+ }
24930
24956
  /** RAW rows (apiKey present); invalid rows dropped. */
24931
24957
  async list() {
24932
24958
  const rows = await this.store.query(PROFILES_COLLECTION);
@@ -25936,6 +25962,8 @@ async function assembleAi(deps) {
25936
25962
  const store = new ProfileStore(deps.settingsPort);
25937
25963
  const defaults = new DefaultsStore(deps.settingsPort);
25938
25964
  const usage = new UsageStore(deps.settingsPort);
25965
+ await store.init();
25966
+ await defaults.init();
25939
25967
  await usage.init();
25940
25968
  await store.ensureSeeded();
25941
25969
  const llmProvider = createLlmProvider({
package/dist/addon.mjs CHANGED
@@ -24827,6 +24827,13 @@ var openAiAdapter = {
24827
24827
  * stable selector key so `set` upserts and `set(selector, null)` deletes.
24828
24828
  */
24829
24829
  var DEFAULTS_COLLECTION = "llm-defaults";
24830
+ /** KV JSON-blob shape — a single `data` column routes through the settings
24831
+ * backend's canonical key/value path (id TEXT PK, data TEXT). */
24832
+ var KV_BLOB_COLUMNS$1 = [{
24833
+ name: "data",
24834
+ type: "TEXT",
24835
+ notNull: true
24836
+ }];
24830
24837
  function selectorKey(selector) {
24831
24838
  return "consumer" in selector ? `consumer:${selector.consumer}` : `purpose:${selector.purpose}`;
24832
24839
  }
@@ -24835,6 +24842,11 @@ var DefaultsStore = class {
24835
24842
  constructor(store) {
24836
24843
  this.store = store;
24837
24844
  }
24845
+ /** Declare the backing collection before any read/write — the SQLite
24846
+ * settings backend rejects undeclared collections (fail-fast). */
24847
+ async init() {
24848
+ await this.store.declareCollection(DEFAULTS_COLLECTION, KV_BLOB_COLUMNS$1);
24849
+ }
24838
24850
  async list() {
24839
24851
  const rows = await this.store.query(DEFAULTS_COLLECTION);
24840
24852
  const out = [];
@@ -24873,6 +24885,13 @@ var PROFILES_COLLECTION = "llm-profiles";
24873
24885
  var META_COLLECTION = "llm-meta";
24874
24886
  var SEED_PROFILE_ID = "seed-ollama-lan";
24875
24887
  var SEED_MARKER_ID = "seededDefaults";
24888
+ /** KV JSON-blob shape — a single `data` column routes the row through the
24889
+ * settings backend's canonical key/value path (id TEXT PK, data TEXT). */
24890
+ var KV_BLOB_COLUMNS = [{
24891
+ name: "data",
24892
+ type: "TEXT",
24893
+ notNull: true
24894
+ }];
24876
24895
  function rowToProfile(id, data) {
24877
24896
  const parsed = LlmProfileSchema.safeParse({
24878
24897
  ...data,
@@ -24889,6 +24908,13 @@ var ProfileStore = class {
24889
24908
  constructor(store) {
24890
24909
  this.store = store;
24891
24910
  }
24911
+ /** Declare the backing collections before any read/write. The SQLite
24912
+ * settings backend rejects undeclared collections (fail-fast), so this
24913
+ * MUST run before `ensureSeeded`/`list`/`upsert` — mirrors UsageStore.init. */
24914
+ async init() {
24915
+ await this.store.declareCollection(PROFILES_COLLECTION, KV_BLOB_COLUMNS);
24916
+ await this.store.declareCollection(META_COLLECTION, KV_BLOB_COLUMNS);
24917
+ }
24892
24918
  /** RAW rows (apiKey present); invalid rows dropped. */
24893
24919
  async list() {
24894
24920
  const rows = await this.store.query(PROFILES_COLLECTION);
@@ -25898,6 +25924,8 @@ async function assembleAi(deps) {
25898
25924
  const store = new ProfileStore(deps.settingsPort);
25899
25925
  const defaults = new DefaultsStore(deps.settingsPort);
25900
25926
  const usage = new UsageStore(deps.settingsPort);
25927
+ await store.init();
25928
+ await defaults.init();
25901
25929
  await usage.init();
25902
25930
  await store.ensureSeeded();
25903
25931
  const llmProvider = createLlmProvider({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-ai",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "AI addon for CamStack — the `llm` collection provider (cloud, LAN, and camstack-managed local llama.cpp profiles) plus the per-node `llm-runtime` managed executor.",
5
5
  "keywords": [
6
6
  "camstack",