@massu/core 1.13.1 → 1.14.0

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.
@@ -1052,6 +1052,45 @@ function initMemorySchema(db) {
1052
1052
  CREATE INDEX IF NOT EXISTS idx_so_file ON shared_observations(file_path);
1053
1053
  CREATE INDEX IF NOT EXISTS idx_so_module ON shared_observations(module);
1054
1054
  `);
1055
+ db.exec(`
1056
+ CREATE TABLE IF NOT EXISTS team_promotion_outbound (
1057
+ prompt_hash TEXT PRIMARY KEY,
1058
+ destination TEXT NOT NULL,
1059
+ draft_text TEXT NOT NULL,
1060
+ score REAL,
1061
+ signals_json TEXT NOT NULL DEFAULT '[]',
1062
+ content_hash TEXT NOT NULL,
1063
+ -- PA3-004 (Phase 3 Stream A): hardened-destination publish carries the
1064
+ -- publisher's review attestation so the server CHECK (hardened rows need a
1065
+ -- review_attestation) is satisfiable. hardened=0 for the Phase-2 rows.
1066
+ hardened INTEGER NOT NULL DEFAULT 0,
1067
+ review_attestation_json TEXT,
1068
+ created_at TEXT DEFAULT (datetime('now'))
1069
+ );
1070
+ CREATE TABLE IF NOT EXISTS team_revocation_outbound (
1071
+ prompt_hash TEXT PRIMARY KEY,
1072
+ created_at TEXT DEFAULT (datetime('now'))
1073
+ );
1074
+ `);
1075
+ db.exec(`
1076
+ CREATE TABLE IF NOT EXISTS rule_promotion_events_outbound (
1077
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1078
+ prompt_hash TEXT NOT NULL,
1079
+ event_type TEXT NOT NULL,
1080
+ metadata_json TEXT NOT NULL DEFAULT '{}',
1081
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
1082
+ );
1083
+ CREATE INDEX IF NOT EXISTS idx_rpe_outbound_created ON rule_promotion_events_outbound(created_at);
1084
+ `);
1085
+ db.exec(`
1086
+ CREATE TABLE IF NOT EXISTS analytics_events (
1087
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1088
+ event_type TEXT NOT NULL,
1089
+ event_data TEXT NOT NULL DEFAULT '{}',
1090
+ created_at TEXT DEFAULT (datetime('now'))
1091
+ );
1092
+ CREATE INDEX IF NOT EXISTS idx_analytics_events_type ON analytics_events(event_type);
1093
+ `);
1055
1094
  db.exec(`
1056
1095
  CREATE TABLE IF NOT EXISTS knowledge_conflicts (
1057
1096
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1132,6 +1171,13 @@ function initMemorySchema(db) {
1132
1171
  `ALTER TABLE license_cache ADD COLUMN signed_payload_json TEXT NOT NULL DEFAULT ''`
1133
1172
  );
1134
1173
  }
1174
+ const outboundCols = db.prepare(`PRAGMA table_info(team_promotion_outbound)`).all();
1175
+ if (!outboundCols.some((c) => c.name === "hardened")) {
1176
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN hardened INTEGER NOT NULL DEFAULT 0`);
1177
+ }
1178
+ if (!outboundCols.some((c) => c.name === "review_attestation_json")) {
1179
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN review_attestation_json TEXT`);
1180
+ }
1135
1181
  db.exec(`
1136
1182
  CREATE TABLE IF NOT EXISTS failure_classes (
1137
1183
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1049,6 +1049,45 @@ function initMemorySchema(db) {
1049
1049
  CREATE INDEX IF NOT EXISTS idx_so_file ON shared_observations(file_path);
1050
1050
  CREATE INDEX IF NOT EXISTS idx_so_module ON shared_observations(module);
1051
1051
  `);
1052
+ db.exec(`
1053
+ CREATE TABLE IF NOT EXISTS team_promotion_outbound (
1054
+ prompt_hash TEXT PRIMARY KEY,
1055
+ destination TEXT NOT NULL,
1056
+ draft_text TEXT NOT NULL,
1057
+ score REAL,
1058
+ signals_json TEXT NOT NULL DEFAULT '[]',
1059
+ content_hash TEXT NOT NULL,
1060
+ -- PA3-004 (Phase 3 Stream A): hardened-destination publish carries the
1061
+ -- publisher's review attestation so the server CHECK (hardened rows need a
1062
+ -- review_attestation) is satisfiable. hardened=0 for the Phase-2 rows.
1063
+ hardened INTEGER NOT NULL DEFAULT 0,
1064
+ review_attestation_json TEXT,
1065
+ created_at TEXT DEFAULT (datetime('now'))
1066
+ );
1067
+ CREATE TABLE IF NOT EXISTS team_revocation_outbound (
1068
+ prompt_hash TEXT PRIMARY KEY,
1069
+ created_at TEXT DEFAULT (datetime('now'))
1070
+ );
1071
+ `);
1072
+ db.exec(`
1073
+ CREATE TABLE IF NOT EXISTS rule_promotion_events_outbound (
1074
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1075
+ prompt_hash TEXT NOT NULL,
1076
+ event_type TEXT NOT NULL,
1077
+ metadata_json TEXT NOT NULL DEFAULT '{}',
1078
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
1079
+ );
1080
+ CREATE INDEX IF NOT EXISTS idx_rpe_outbound_created ON rule_promotion_events_outbound(created_at);
1081
+ `);
1082
+ db.exec(`
1083
+ CREATE TABLE IF NOT EXISTS analytics_events (
1084
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1085
+ event_type TEXT NOT NULL,
1086
+ event_data TEXT NOT NULL DEFAULT '{}',
1087
+ created_at TEXT DEFAULT (datetime('now'))
1088
+ );
1089
+ CREATE INDEX IF NOT EXISTS idx_analytics_events_type ON analytics_events(event_type);
1090
+ `);
1052
1091
  db.exec(`
1053
1092
  CREATE TABLE IF NOT EXISTS knowledge_conflicts (
1054
1093
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1129,6 +1168,13 @@ function initMemorySchema(db) {
1129
1168
  `ALTER TABLE license_cache ADD COLUMN signed_payload_json TEXT NOT NULL DEFAULT ''`
1130
1169
  );
1131
1170
  }
1171
+ const outboundCols = db.prepare(`PRAGMA table_info(team_promotion_outbound)`).all();
1172
+ if (!outboundCols.some((c) => c.name === "hardened")) {
1173
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN hardened INTEGER NOT NULL DEFAULT 0`);
1174
+ }
1175
+ if (!outboundCols.some((c) => c.name === "review_attestation_json")) {
1176
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN review_attestation_json TEXT`);
1177
+ }
1132
1178
  db.exec(`
1133
1179
  CREATE TABLE IF NOT EXISTS failure_classes (
1134
1180
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1051,6 +1051,45 @@ function initMemorySchema(db) {
1051
1051
  CREATE INDEX IF NOT EXISTS idx_so_file ON shared_observations(file_path);
1052
1052
  CREATE INDEX IF NOT EXISTS idx_so_module ON shared_observations(module);
1053
1053
  `);
1054
+ db.exec(`
1055
+ CREATE TABLE IF NOT EXISTS team_promotion_outbound (
1056
+ prompt_hash TEXT PRIMARY KEY,
1057
+ destination TEXT NOT NULL,
1058
+ draft_text TEXT NOT NULL,
1059
+ score REAL,
1060
+ signals_json TEXT NOT NULL DEFAULT '[]',
1061
+ content_hash TEXT NOT NULL,
1062
+ -- PA3-004 (Phase 3 Stream A): hardened-destination publish carries the
1063
+ -- publisher's review attestation so the server CHECK (hardened rows need a
1064
+ -- review_attestation) is satisfiable. hardened=0 for the Phase-2 rows.
1065
+ hardened INTEGER NOT NULL DEFAULT 0,
1066
+ review_attestation_json TEXT,
1067
+ created_at TEXT DEFAULT (datetime('now'))
1068
+ );
1069
+ CREATE TABLE IF NOT EXISTS team_revocation_outbound (
1070
+ prompt_hash TEXT PRIMARY KEY,
1071
+ created_at TEXT DEFAULT (datetime('now'))
1072
+ );
1073
+ `);
1074
+ db.exec(`
1075
+ CREATE TABLE IF NOT EXISTS rule_promotion_events_outbound (
1076
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1077
+ prompt_hash TEXT NOT NULL,
1078
+ event_type TEXT NOT NULL,
1079
+ metadata_json TEXT NOT NULL DEFAULT '{}',
1080
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
1081
+ );
1082
+ CREATE INDEX IF NOT EXISTS idx_rpe_outbound_created ON rule_promotion_events_outbound(created_at);
1083
+ `);
1084
+ db.exec(`
1085
+ CREATE TABLE IF NOT EXISTS analytics_events (
1086
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1087
+ event_type TEXT NOT NULL,
1088
+ event_data TEXT NOT NULL DEFAULT '{}',
1089
+ created_at TEXT DEFAULT (datetime('now'))
1090
+ );
1091
+ CREATE INDEX IF NOT EXISTS idx_analytics_events_type ON analytics_events(event_type);
1092
+ `);
1054
1093
  db.exec(`
1055
1094
  CREATE TABLE IF NOT EXISTS knowledge_conflicts (
1056
1095
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1131,6 +1170,13 @@ function initMemorySchema(db) {
1131
1170
  `ALTER TABLE license_cache ADD COLUMN signed_payload_json TEXT NOT NULL DEFAULT ''`
1132
1171
  );
1133
1172
  }
1173
+ const outboundCols = db.prepare(`PRAGMA table_info(team_promotion_outbound)`).all();
1174
+ if (!outboundCols.some((c) => c.name === "hardened")) {
1175
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN hardened INTEGER NOT NULL DEFAULT 0`);
1176
+ }
1177
+ if (!outboundCols.some((c) => c.name === "review_attestation_json")) {
1178
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN review_attestation_json TEXT`);
1179
+ }
1134
1180
  db.exec(`
1135
1181
  CREATE TABLE IF NOT EXISTS failure_classes (
1136
1182
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1055,6 +1055,45 @@ function initMemorySchema(db) {
1055
1055
  CREATE INDEX IF NOT EXISTS idx_so_file ON shared_observations(file_path);
1056
1056
  CREATE INDEX IF NOT EXISTS idx_so_module ON shared_observations(module);
1057
1057
  `);
1058
+ db.exec(`
1059
+ CREATE TABLE IF NOT EXISTS team_promotion_outbound (
1060
+ prompt_hash TEXT PRIMARY KEY,
1061
+ destination TEXT NOT NULL,
1062
+ draft_text TEXT NOT NULL,
1063
+ score REAL,
1064
+ signals_json TEXT NOT NULL DEFAULT '[]',
1065
+ content_hash TEXT NOT NULL,
1066
+ -- PA3-004 (Phase 3 Stream A): hardened-destination publish carries the
1067
+ -- publisher's review attestation so the server CHECK (hardened rows need a
1068
+ -- review_attestation) is satisfiable. hardened=0 for the Phase-2 rows.
1069
+ hardened INTEGER NOT NULL DEFAULT 0,
1070
+ review_attestation_json TEXT,
1071
+ created_at TEXT DEFAULT (datetime('now'))
1072
+ );
1073
+ CREATE TABLE IF NOT EXISTS team_revocation_outbound (
1074
+ prompt_hash TEXT PRIMARY KEY,
1075
+ created_at TEXT DEFAULT (datetime('now'))
1076
+ );
1077
+ `);
1078
+ db.exec(`
1079
+ CREATE TABLE IF NOT EXISTS rule_promotion_events_outbound (
1080
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1081
+ prompt_hash TEXT NOT NULL,
1082
+ event_type TEXT NOT NULL,
1083
+ metadata_json TEXT NOT NULL DEFAULT '{}',
1084
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
1085
+ );
1086
+ CREATE INDEX IF NOT EXISTS idx_rpe_outbound_created ON rule_promotion_events_outbound(created_at);
1087
+ `);
1088
+ db.exec(`
1089
+ CREATE TABLE IF NOT EXISTS analytics_events (
1090
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1091
+ event_type TEXT NOT NULL,
1092
+ event_data TEXT NOT NULL DEFAULT '{}',
1093
+ created_at TEXT DEFAULT (datetime('now'))
1094
+ );
1095
+ CREATE INDEX IF NOT EXISTS idx_analytics_events_type ON analytics_events(event_type);
1096
+ `);
1058
1097
  db.exec(`
1059
1098
  CREATE TABLE IF NOT EXISTS knowledge_conflicts (
1060
1099
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1135,6 +1174,13 @@ function initMemorySchema(db) {
1135
1174
  `ALTER TABLE license_cache ADD COLUMN signed_payload_json TEXT NOT NULL DEFAULT ''`
1136
1175
  );
1137
1176
  }
1177
+ const outboundCols = db.prepare(`PRAGMA table_info(team_promotion_outbound)`).all();
1178
+ if (!outboundCols.some((c) => c.name === "hardened")) {
1179
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN hardened INTEGER NOT NULL DEFAULT 0`);
1180
+ }
1181
+ if (!outboundCols.some((c) => c.name === "review_attestation_json")) {
1182
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN review_attestation_json TEXT`);
1183
+ }
1138
1184
  db.exec(`
1139
1185
  CREATE TABLE IF NOT EXISTS failure_classes (
1140
1186
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1049,6 +1049,45 @@ function initMemorySchema(db) {
1049
1049
  CREATE INDEX IF NOT EXISTS idx_so_file ON shared_observations(file_path);
1050
1050
  CREATE INDEX IF NOT EXISTS idx_so_module ON shared_observations(module);
1051
1051
  `);
1052
+ db.exec(`
1053
+ CREATE TABLE IF NOT EXISTS team_promotion_outbound (
1054
+ prompt_hash TEXT PRIMARY KEY,
1055
+ destination TEXT NOT NULL,
1056
+ draft_text TEXT NOT NULL,
1057
+ score REAL,
1058
+ signals_json TEXT NOT NULL DEFAULT '[]',
1059
+ content_hash TEXT NOT NULL,
1060
+ -- PA3-004 (Phase 3 Stream A): hardened-destination publish carries the
1061
+ -- publisher's review attestation so the server CHECK (hardened rows need a
1062
+ -- review_attestation) is satisfiable. hardened=0 for the Phase-2 rows.
1063
+ hardened INTEGER NOT NULL DEFAULT 0,
1064
+ review_attestation_json TEXT,
1065
+ created_at TEXT DEFAULT (datetime('now'))
1066
+ );
1067
+ CREATE TABLE IF NOT EXISTS team_revocation_outbound (
1068
+ prompt_hash TEXT PRIMARY KEY,
1069
+ created_at TEXT DEFAULT (datetime('now'))
1070
+ );
1071
+ `);
1072
+ db.exec(`
1073
+ CREATE TABLE IF NOT EXISTS rule_promotion_events_outbound (
1074
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1075
+ prompt_hash TEXT NOT NULL,
1076
+ event_type TEXT NOT NULL,
1077
+ metadata_json TEXT NOT NULL DEFAULT '{}',
1078
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
1079
+ );
1080
+ CREATE INDEX IF NOT EXISTS idx_rpe_outbound_created ON rule_promotion_events_outbound(created_at);
1081
+ `);
1082
+ db.exec(`
1083
+ CREATE TABLE IF NOT EXISTS analytics_events (
1084
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1085
+ event_type TEXT NOT NULL,
1086
+ event_data TEXT NOT NULL DEFAULT '{}',
1087
+ created_at TEXT DEFAULT (datetime('now'))
1088
+ );
1089
+ CREATE INDEX IF NOT EXISTS idx_analytics_events_type ON analytics_events(event_type);
1090
+ `);
1052
1091
  db.exec(`
1053
1092
  CREATE TABLE IF NOT EXISTS knowledge_conflicts (
1054
1093
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1129,6 +1168,13 @@ function initMemorySchema(db) {
1129
1168
  `ALTER TABLE license_cache ADD COLUMN signed_payload_json TEXT NOT NULL DEFAULT ''`
1130
1169
  );
1131
1170
  }
1171
+ const outboundCols = db.prepare(`PRAGMA table_info(team_promotion_outbound)`).all();
1172
+ if (!outboundCols.some((c) => c.name === "hardened")) {
1173
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN hardened INTEGER NOT NULL DEFAULT 0`);
1174
+ }
1175
+ if (!outboundCols.some((c) => c.name === "review_attestation_json")) {
1176
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN review_attestation_json TEXT`);
1177
+ }
1132
1178
  db.exec(`
1133
1179
  CREATE TABLE IF NOT EXISTS failure_classes (
1134
1180
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1049,6 +1049,45 @@ function initMemorySchema(db) {
1049
1049
  CREATE INDEX IF NOT EXISTS idx_so_file ON shared_observations(file_path);
1050
1050
  CREATE INDEX IF NOT EXISTS idx_so_module ON shared_observations(module);
1051
1051
  `);
1052
+ db.exec(`
1053
+ CREATE TABLE IF NOT EXISTS team_promotion_outbound (
1054
+ prompt_hash TEXT PRIMARY KEY,
1055
+ destination TEXT NOT NULL,
1056
+ draft_text TEXT NOT NULL,
1057
+ score REAL,
1058
+ signals_json TEXT NOT NULL DEFAULT '[]',
1059
+ content_hash TEXT NOT NULL,
1060
+ -- PA3-004 (Phase 3 Stream A): hardened-destination publish carries the
1061
+ -- publisher's review attestation so the server CHECK (hardened rows need a
1062
+ -- review_attestation) is satisfiable. hardened=0 for the Phase-2 rows.
1063
+ hardened INTEGER NOT NULL DEFAULT 0,
1064
+ review_attestation_json TEXT,
1065
+ created_at TEXT DEFAULT (datetime('now'))
1066
+ );
1067
+ CREATE TABLE IF NOT EXISTS team_revocation_outbound (
1068
+ prompt_hash TEXT PRIMARY KEY,
1069
+ created_at TEXT DEFAULT (datetime('now'))
1070
+ );
1071
+ `);
1072
+ db.exec(`
1073
+ CREATE TABLE IF NOT EXISTS rule_promotion_events_outbound (
1074
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1075
+ prompt_hash TEXT NOT NULL,
1076
+ event_type TEXT NOT NULL,
1077
+ metadata_json TEXT NOT NULL DEFAULT '{}',
1078
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
1079
+ );
1080
+ CREATE INDEX IF NOT EXISTS idx_rpe_outbound_created ON rule_promotion_events_outbound(created_at);
1081
+ `);
1082
+ db.exec(`
1083
+ CREATE TABLE IF NOT EXISTS analytics_events (
1084
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
1085
+ event_type TEXT NOT NULL,
1086
+ event_data TEXT NOT NULL DEFAULT '{}',
1087
+ created_at TEXT DEFAULT (datetime('now'))
1088
+ );
1089
+ CREATE INDEX IF NOT EXISTS idx_analytics_events_type ON analytics_events(event_type);
1090
+ `);
1052
1091
  db.exec(`
1053
1092
  CREATE TABLE IF NOT EXISTS knowledge_conflicts (
1054
1093
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1129,6 +1168,13 @@ function initMemorySchema(db) {
1129
1168
  `ALTER TABLE license_cache ADD COLUMN signed_payload_json TEXT NOT NULL DEFAULT ''`
1130
1169
  );
1131
1170
  }
1171
+ const outboundCols = db.prepare(`PRAGMA table_info(team_promotion_outbound)`).all();
1172
+ if (!outboundCols.some((c) => c.name === "hardened")) {
1173
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN hardened INTEGER NOT NULL DEFAULT 0`);
1174
+ }
1175
+ if (!outboundCols.some((c) => c.name === "review_attestation_json")) {
1176
+ db.exec(`ALTER TABLE team_promotion_outbound ADD COLUMN review_attestation_json TEXT`);
1177
+ }
1132
1178
  db.exec(`
1133
1179
  CREATE TABLE IF NOT EXISTS failure_classes (
1134
1180
  id INTEGER PRIMARY KEY AUTOINCREMENT,