Continue AI features and improve protocol support

This commit is contained in:
2026-02-15 16:57:32 +00:00
parent 2d3b8fdac6
commit 85e97e895d
62 changed files with 5472 additions and 441 deletions

View File

@@ -1,7 +1,8 @@
# Generated by Django 5.2.11 on 2026-02-14 22:52
import django.db.models.deletion
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models

View File

@@ -1,11 +1,13 @@
# Generated by Django 5.2.11 on 2026-02-15 00:14
import core.models
import django.db.models.deletion
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import core.models
class Migration(migrations.Migration):

View File

@@ -1,7 +1,8 @@
# Generated by Django 5.2.11 on 2026-02-15 00:58
import django.db.models.deletion
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models

View File

@@ -1,7 +1,8 @@
# Generated by Django 5.2.11 on 2026-02-15 01:13
import django.db.models.deletion
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models

View File

@@ -1,7 +1,8 @@
# Generated by Django 5.2.11 on 2026-02-15 02:38
import django.db.models.deletion
import uuid
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models

View File

@@ -0,0 +1,53 @@
# Generated by Django 5.2.11 on 2026-02-15 15:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0022_patternmitigationautosettings'),
]
operations = [
migrations.AddField(
model_name='message',
name='delivered_ts',
field=models.BigIntegerField(blank=True, help_text='Delivery timestamp (unix ms) when known.', null=True),
),
migrations.AddField(
model_name='message',
name='read_by_identifier',
field=models.CharField(blank=True, help_text='Identifier that read this message (service-native value).', max_length=255, null=True),
),
migrations.AddField(
model_name='message',
name='read_source_service',
field=models.CharField(blank=True, choices=[('signal', 'Signal'), ('whatsapp', 'WhatsApp'), ('xmpp', 'XMPP'), ('instagram', 'Instagram')], help_text='Service that reported the read receipt.', max_length=255, null=True),
),
migrations.AddField(
model_name='message',
name='read_ts',
field=models.BigIntegerField(blank=True, help_text='Read timestamp (unix ms) when known.', null=True),
),
migrations.AddField(
model_name='message',
name='receipt_payload',
field=models.JSONField(blank=True, default=dict, help_text='Raw normalized delivery/read receipt metadata.'),
),
migrations.AlterField(
model_name='messageevent',
name='source_system',
field=models.CharField(choices=[('signal', 'Signal'), ('whatsapp', 'WhatsApp'), ('xmpp', 'XMPP'), ('instagram', 'Instagram'), ('workspace', 'Workspace'), ('ai', 'AI')], default='signal', help_text='System that produced this event record.', max_length=32),
),
migrations.AlterField(
model_name='personidentifier',
name='service',
field=models.CharField(choices=[('signal', 'Signal'), ('whatsapp', 'WhatsApp'), ('xmpp', 'XMPP'), ('instagram', 'Instagram')], max_length=255),
),
migrations.AlterField(
model_name='workspaceconversation',
name='platform_type',
field=models.CharField(choices=[('signal', 'Signal'), ('whatsapp', 'WhatsApp'), ('xmpp', 'XMPP'), ('instagram', 'Instagram')], default='signal', help_text='Primary transport for this conversation (reuses SERVICE_CHOICES).', max_length=255),
),
]

View File

@@ -0,0 +1,45 @@
# Generated by Django 5.2.7 on 2026-02-15 16:55
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0023_message_delivered_ts_message_read_by_identifier_and_more'),
]
operations = [
migrations.CreateModel(
name='WorkspaceMetricSnapshot',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('computed_at', models.DateTimeField(auto_now_add=True, db_index=True, help_text='When this snapshot was persisted.')),
('source_event_ts', models.BigIntegerField(blank=True, help_text='Latest message timestamp used during this metric computation.', null=True)),
('stability_state', models.CharField(choices=[('calibrating', 'Calibrating'), ('stable', 'Stable'), ('watch', 'Watch'), ('fragile', 'Fragile')], default='calibrating', help_text='Stability state at computation time.', max_length=32)),
('stability_score', models.FloatField(blank=True, help_text='Stability score (0-100).', null=True)),
('stability_confidence', models.FloatField(default=0.0, help_text='Confidence in stability score (0.0-1.0).')),
('stability_sample_messages', models.PositiveIntegerField(default=0, help_text='How many messages were in the sampled window.')),
('stability_sample_days', models.PositiveIntegerField(default=0, help_text='How many days were in the sampled window.')),
('commitment_inbound_score', models.FloatField(blank=True, help_text='Commitment estimate counterpart -> user (0-100).', null=True)),
('commitment_outbound_score', models.FloatField(blank=True, help_text='Commitment estimate user -> counterpart (0-100).', null=True)),
('commitment_confidence', models.FloatField(default=0.0, help_text='Confidence in commitment scores (0.0-1.0).')),
('inbound_messages', models.PositiveIntegerField(default=0, help_text='Inbound message count in the sampled window.')),
('outbound_messages', models.PositiveIntegerField(default=0, help_text='Outbound message count in the sampled window.')),
('reciprocity_score', models.FloatField(blank=True, help_text='Balance component used for stability.', null=True)),
('continuity_score', models.FloatField(blank=True, help_text='Continuity component used for stability.', null=True)),
('response_score', models.FloatField(blank=True, help_text='Response-time component used for stability.', null=True)),
('volatility_score', models.FloatField(blank=True, help_text='Volatility component used for stability.', null=True)),
('inbound_response_score', models.FloatField(blank=True, help_text='Inbound response-lag score used for commitment.', null=True)),
('outbound_response_score', models.FloatField(blank=True, help_text='Outbound response-lag score used for commitment.', null=True)),
('balance_inbound_score', models.FloatField(blank=True, help_text='Inbound balance score used for commitment.', null=True)),
('balance_outbound_score', models.FloatField(blank=True, help_text='Outbound balance score used for commitment.', null=True)),
('conversation', models.ForeignKey(help_text='Workspace conversation this metric snapshot belongs to.', on_delete=django.db.models.deletion.CASCADE, related_name='metric_snapshots', to='core.workspaceconversation')),
],
options={
'ordering': ('-computed_at',),
'indexes': [models.Index(fields=['conversation', 'computed_at'], name='core_worksp_convers_4ee793_idx')],
},
),
]