Skip to content

Releases

v1.6.0 — source ACL contract

Choose a tag to compare

@lopadova lopadova released this 29 Aug 19:22
8e44f55

Adds the contract for a connector to report who a source says may read an item, so the host can mirror those permissions instead of discarding them.

Until now ingestion had nowhere to put that fact. A file shared with three people upstream became visible to everyone in the project the moment it was ingested, because project membership was the only gate and it is far coarser than what the source actually said.

New

  • SourcePrincipal — one entry in a source's permission list: user, group, domain or anyone, allow or deny. The external identifier is kept verbatim; normalising it here would destroy the only thing the host can match on, and every source spells identity differently.
  • SourceAccess — the list, plus the two ways it can be incomplete. inheritsFromParent means "as the folder says"; complete: false means "we could not find out". Neither may be read as "nobody", which is why they are separate flags rather than an empty array.
  • SupportsSourceAcl — the opt-in capability. Detected via instanceof, never by connector name (R23).
  • BaseConnector::withSourceAccess() — writes the DTO into ingestion metadata so no call site handles the reserved key by hand.

The ingestion contract is unchanged. An optional trailing parameter on dispatchIngestion() was tried first and reverted: PHP rejects an implementation declaring fewer parameters than its interface, so even an optional one is a breaking change for every HOST that implements the contract — it fatals at class-declaration time on upgrade, before any of its own code runs. Connectors are callers and would have been fine; hosts are not. The list travels in $metadata instead.

Fully backward compatible. A connector that does not implement the capability behaves exactly as it does today, and none of the eleven existing connectors change.

123 tests, 306 assertions.

v1.5.0 - ingest provenance (DeclaresProvenance)

Choose a tag to compare

@lopadova lopadova released this 29 Aug 01:15
00c2d32

Adds an opt-in capability letting a connector declare where the authority of the content it ingests comes from.

Phase 1 of AskMyDocs ADR 0028.

Why

dispatchIngestion() records what a document is and nothing about who wrote it. That is invisible until you line up what connectors actually do: Drive, Confluence, Jira, Notion, OneDrive, Evernote and Fabric carry text written inside the organisation, while IMAP carries text written by anyone who can send an email to the mailbox. Both become retrieval grounding, and on a host that also exposes tools to an agent the second is attacker-reachable text arriving in a tool-calling context. Stored identically, no deployment can answer "how much of our corpus is externally authored?".

What's new

enum ProvenanceTier: string {
    case TrustedInternal   = 'trusted-internal';
    case UntrustedExternal = 'untrusted-external';
    case MachineGenerated  = 'machine-generated';
}

interface DeclaresProvenance {
    public function provenanceTier(int $installationId): ProvenanceTier;
}

Resolved per installation, like SupportsFolderDiscovery::listAvailableFolders() — two installations of one connector routinely differ, and an internal distribution list and a public contact address are the same IMAP code against sources with opposite authorship models.

Backward compatible

  • Opt-in interface, detected by the host via instanceof.
  • ConnectorIngestionContract signature unchanged.
  • A connector implementing nothing keeps its exact current meaning, falling back to ProvenanceTier::default() (TrustedInternal).

Nothing built on the public connector template breaks.

Two deliberate choices

The default is not the most cautious value. Defaulting to untrusted would relabel every existing corpus overnight and make the label mean nothing. External content is the exception a connector has to declare.

Absence and unrecognition are different facts. fromStorage(null) means "no declaration" and reads as the default. An unrecognised value — written by a newer version during a mixed deployment or after a rollback — fails closed to UntrustedExternal, because resolving unknown to trusted would invert the protection this method exists to give.

Not a curation tier

A curation ranking answers "has a human vouched for this?"; provenance answers "who wrote it?". A human-accepted page summarising an external email is both at once. The two must not be collapsed.

Enforcement

None here, by design. The tier is a label — enforcement is only testable against a corpus that is already labelled.

Tests: 107 passing / 249 assertions, across PHP 8.3/8.4/8.5 x Laravel 12/13.

v1.4.0 — Folder discovery + connection-settings capabilities

Choose a tag to compare

@lopadova lopadova released this 25 Jun 00:34
1e23e61

Two opt-in capability interfaces so a connector can declare its full editable config surface and the host renders a generic, schema-driven settings editor (R23).

  • SupportsFolderDiscovery — listAvailableFolders(int): list<string> enumerates live containers (IMAP folders, labels, …); the connector owns auth + client lifecycle. Failure taxonomy: transient/unreachable → ConnectorApiException, rejected creds / failed refresh → ConnectorAuthException (R14).
  • SupportsConnectionSettings — connectionSettingsSchema(): list<array> declares editable post-install sync knobs as CredentialField shapes (target='config', never secret; field name = dotted config_json path).
  • CredentialField gains multiselect + tags types and an optional trailing discovery: ?string arg; toArray() appends discovery as the 12th key — additive, fully backward compatible.

First half of AskMyDocs v8.25. Requires no host change to adopt; connector-imap v1.4.0 implements these.

v1.3.1 — Legacy config_json project_key compatibility

Choose a tag to compare

@lopadova lopadova released this 22 Jun 15:42
a00f8d0

Backward-compat fix for the v1.3.0 multi-account / project-scoped change.

Fixed

  • BaseConnector::resolveProjectKey() now honours a legacy config_json['project_key'] when the project_key column is empty, before the host default. Resolution: column → config_json['project_key'] → config('kb.ingest.default_project') → 'default'. Installs created before the v1.3.0 column existed (which stored the binding in config_json) no longer silently re-scope to the default after upgrade.

Added

  • Backfill migration 2026_06_22_000002_backfill_project_key_from_config_json — moves a legacy config_json['project_key'] into the column (adopting it only when the column is empty) and always strips the legacy key from config_json, so the column becomes the single source of truth (a legacy install can then be unbound to the host default by clearing the column alone). Idempotent, R3 memory-safe (chunkById), PHP-side JSON (portable across SQLite/Postgres/MySQL).

The 8 connectors require ^1.3 and pick this up automatically.

v1.3.0 — Multi-account + project-scoped installations

Choose a tag to compare

@lopadova lopadova released this 22 Jun 14:52
7cfe2cd

Multi-account + project-scoped connector installations.

Added

  • Multi-account installations — connector_installations.label (default 'default') relaxes the composite unique to (tenant_id, connector_name, label). A tenant can connect more than one account per connector (e.g. two IMAP mailboxes, several Drive/OneDrive accounts, multiple Notion workspaces), each disambiguated by label. Tenant-first (R30/R31).
  • Optional project binding — connector_installations.project_key (nullable, indexed (tenant_id, project_key)) binds an account to a real KB project; empty inherits the tenant default.
  • BaseConnector::resolveProjectKey(ConnectorInstallation): string — single source of truth for the ingest project: explicit project_key → config('kb.ingest.default_project') → 'default'. Replaces the per-connector connector-<key> fallback.

Migration notes

  • label backfills to 'default' on existing rows (prior single-account installs preserved). The migration up() is idempotent and fully convergent across migrate→rollback→migrate cycles, with non-destructive label disambiguation (collision-proof across the whole tenant/connector scope, 64-char-safe).
  • Fully backward compatible for hosts that create one installation per connector.

v1.2.0 — SupportsCredentialForm interface

Choose a tag to compare

@lopadova lopadova released this 19 Jun 12:15

Adds an optional capability interface so AskMyDocs (and any host) can render a native admin form for credential-based connectors (host/port/username/password — e.g. IMAP), instead of being limited to the OAuth-redirect flow.

  • Padosoft\AskMyDocsConnectorBase\Contracts\SupportsCredentialForm — credentialFormSchema(): array advertises the fields the host should render.
  • Padosoft\AskMyDocsConnectorBase\Support\CredentialField — readonly value object (name/label/type/target/required/secret/default/options/showIf/help/group) with toArray().

Field target tells the host where to store each value (connection/config → config_json, auth_mode/provider → installation, secret → routed through handleOAuthCallback to the encrypted vault).

Purely additive and backward compatible — OAuth-only connectors are unaffected and need no changes. 72 tests, PHPStan + Pint clean.

v1.1.1 — Pint code style fixes

Choose a tag to compare

@lopadova lopadova released this 12 May 06:27

Patch release: 8 auto-fixed Pint style issues across src/ and tests/. No functional change. Static analysis CI now passes.

v1.1.0 — Ingestion contract + source-aware metadata helpers

Choose a tag to compare

@lopadova lopadova released this 12 May 05:34

What's new

Adds the inversion-of-control bridge that lets per-connector OS packages (padosoft/askmydocs-connector-notion, padosoft/askmydocs-connector-google-drive, ...) stay 100% standalone-agnostic while still routing through any host's ingest pipeline.

Added

  • Contracts\ConnectorIngestionContract — 5-method IoC contract: dispatchIngestion(), resolveKbSourcePath(), redactContent(), emitAudit(), softDeleteByRemoteId(). Hosts bind their own implementation in a ServiceProvider.
  • Contracts\NullConnectorIngestionContract — fail-loud default bound automatically when no host implementation is registered.
  • Support\Metadata\SourceAwareMetadataBuilder — rich-metadata envelope builder (converter_hints.<source> + _derived).
  • Support\Metadata\RecencyBucketer — coarse `this_week | this_month | this_quarter | older` buckets for reranker recency boost.
  • Support\Metadata\VendorMimeSelector — synthetic vendor MIME chooser for Drive / OneDrive / Notion / Confluence / Jira / Evernote / Fabric.
  • BaseConnector — constructor-injects the contract + exposes 5 proxy helpers.

Changed

  • BaseConnector::__construct now takes a third parameter (ConnectorIngestionContract). Container-resolved subclasses pick it up automatically.

Notes

Backward-compatible at the ConnectorInterface level. Tests: 68 green (+23 from v1.0.0).

v1.0.0 — Initial extraction

Choose a tag to compare

@lopadova lopadova released this 12 May 05:15

v1.0.0 — Initial release

First standalone release of the AskMyDocs connector framework. Extracted from the AskMyDocs v4.5 inline app/Connectors/* namespace into a reusable Laravel package. Any consumer can now ship a per-source connector as a separate composer package, drop it into any AskMyDocs install, and have it auto-discovered + scheduled + tenant-isolated for free.

What's inside

  • ConnectorInterface — 10-method contract every connector implements.
  • BaseConnector — OAuth state-token CSRF, refresh helper, tenant-scoped installation lookup.
  • ConnectorRegistry — R23 boot-time FQCN validation + composer.lock auto-discovery via extra.askmydocs.connectors.
  • OAuthCredentialVault — AES-encrypted at rest, R30 tenant-scoped, R21 atomic setExtraKey via DB::transaction + lockForUpdate.
  • ConnectorSyncJob — queued, $tries=3, exponential $backoff=[60,300,900], tenant-restore safety.
  • SyncScheduler — minute-grain cadence walker, chunkById(100), ACTIVE-only filter.
  • Exceptions — ConnectorAuthException (no retry), ConnectorApiException (retry), ConnectorPaginationLimitException, RegistryConfigurationException.
  • Models — ConnectorInstallation + ConnectorCredential with BelongsToTenant trait, cascade-on-delete.
  • Support — TenantContext + BelongsToTenant trait lifted from AskMyDocs (pure code, no host coupling).
  • Migrations — connector_installations (composite UNIQUE on (tenant_id, connector_name)) + connector_credentials (one-to-one with installation, encrypted tokens + opaque extra_json).

Testing

  • 45 tests passing, 93 assertions.
  • PHP 8.3 / 8.4 / 8.5 × Laravel 12 / 13 matrix (6 jobs) + static-analysis (Pint --test).
  • SQLite in-memory via Orchestra Testbench.

Install

composer require padosoft/askmydocs-connector-base
php artisan migrate

Write your first connector

See the Quick start — 50 lines from blank Laravel package to working connector.


🤖 Initial extraction commit: a9027c7