@synap-core/api-types 1.16.1 → 1.17.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.
@@ -456,6 +456,25 @@ export interface WorkspaceDefaultSource {
456
456
  profileSlug?: string;
457
457
  label?: string;
458
458
  }
459
+ /**
460
+ * Provenance record for a workspace composed via `definition.extends`
461
+ * (Wave 7 / north star §10 — workspace composition). One entry per resolved
462
+ * source. COPY semantics: the imported profiles/views are independent copies
463
+ * on this workspace; this is a snapshot of where they came from, not a live
464
+ * link. Surfaced in the frontend so an imported brick reads "from <source>".
465
+ */
466
+ export interface WorkspaceComposedFromEntry {
467
+ /** Resolved source workspace id. */
468
+ sourceWorkspaceId: string;
469
+ /** The original `source` ref as declared (workspaceId or systemSlug). */
470
+ source: string;
471
+ /** Profile slugs imported from this source. */
472
+ profiles: string[];
473
+ /** View names imported from this source. */
474
+ views: string[];
475
+ /** ISO timestamp of when the import was resolved. */
476
+ importedAt: string;
477
+ }
459
478
  export interface WorkspaceSettings {
460
479
  defaultEntityTypes?: string[];
461
480
  theme?: string;
@@ -489,6 +508,12 @@ export interface WorkspaceSettings {
489
508
  * workspaces so features can resolve defaults without copying data.
490
509
  */
491
510
  defaultSources?: Record<string, WorkspaceDefaultSource>;
511
+ /**
512
+ * Provenance of bricks (profiles/views) imported from other workspaces via
513
+ * `definition.extends`. COPY semantics — a snapshot of origin, not a live
514
+ * dependency. Used by the UI to tag imported bricks with their source.
515
+ */
516
+ composedFrom?: WorkspaceComposedFromEntry[];
492
517
  /** External MCP servers whose tools will be available to AI agents in this workspace */
493
518
  mcpServers?: McpServerConfig[];
494
519
  layout?: WorkspaceLayoutConfig;
@@ -1336,256 +1361,1013 @@ export interface AiProviderModelEntry {
1336
1361
  costPer1MInput?: number;
1337
1362
  costPer1MOutput?: number;
1338
1363
  }
1339
- /**
1340
- * EventRecord - Database representation of an event
1341
- *
1342
- * This is the format returned from the database.
1343
- * It maps directly to the events table structure.
1344
- */
1345
- export interface EventRecord {
1346
- id: string;
1347
- timestamp: Date;
1348
- subjectId: string;
1349
- subjectType: string;
1350
- eventType: string;
1351
- userId: string;
1352
- data: Record<string, unknown>;
1353
- metadata?: Record<string, unknown>;
1354
- version: number;
1355
- causationId?: string;
1356
- correlationId?: string;
1357
- source: string;
1358
- }
1359
- /** Minimal message fields for list/preview */
1360
- export interface LinkedMessagePreview {
1361
- id: string;
1362
- channelId: string;
1363
- role: string;
1364
- content: string;
1365
- timestamp: Date;
1366
- userId: string;
1367
- }
1368
- export interface LinkedMessageItem {
1369
- link: MessageLink;
1370
- message: LinkedMessagePreview;
1371
- }
1372
- export interface EffectiveProperty extends PropertyDef {
1373
- required: boolean;
1374
- defaultValue: unknown;
1375
- displayOrder: number;
1376
- }
1377
- /**
1378
- * RendererRef — what a profile or workspace stores as its renderer choice
1379
- * for a (slot, profile) pair.
1380
- *
1381
- * Structural mirror of `RendererTarget` from `@synap-core/renderer-runtime`.
1382
- * Kept as a structural type in the database layer (rather than importing the
1383
- * frontend package) so the schema package stays UI-free. The canonical type
1384
- * lives in `@synap-core/renderer-runtime` and is re-exported by
1385
- * `@synap-core/profile-renderer` as `RendererRef`.
1386
- *
1387
- * Stored as JSONB on `profiles.default_(list|detail)_renderer` and inside
1388
- * `workspaces.settings.profileRenderers[slug]`.
1389
- *
1390
- * Spec: synap-team-docs/content/team/platform/profile-renderer.mdx
1391
- */
1392
- export type RendererRef = {
1393
- kind: "cell";
1394
- cellKey: string;
1395
- props: Record<string, unknown>;
1396
- title?: string;
1397
- displayMode?: string;
1398
- rendererHint?: Record<string, unknown>;
1399
- } | {
1400
- kind: "view";
1401
- viewId: string;
1402
- title?: string;
1403
- displayMode?: string;
1404
- } | {
1405
- kind: "iframe-srcdoc";
1406
- appId: string;
1407
- srcdoc: string;
1408
- title?: string;
1409
- props?: Record<string, unknown>;
1410
- } | {
1411
- kind: "external-app";
1412
- appId: string;
1413
- url: string;
1414
- title?: string;
1415
- props?: Record<string, unknown>;
1416
- } | {
1417
- kind: "url";
1418
- url: string;
1419
- external?: boolean;
1420
- title?: string;
1421
- } | {
1422
- kind: "view-adapter";
1423
- adapterKey: string;
1424
- props?: Record<string, unknown>;
1425
- title?: string;
1426
- };
1427
- /**
1428
- * Column definition for views
1429
- */
1430
- export interface ViewColumn {
1431
- id: string;
1432
- field: string;
1433
- title?: string;
1434
- valueType?: string;
1435
- indexed?: boolean;
1436
- visible?: boolean;
1437
- width?: number;
1438
- }
1439
- /**
1440
- * View Query Types
1441
- *
1442
- * Single source of truth for all view query and filter types.
1443
- */
1444
- /**
1445
- * Filter operator types
1446
- */
1447
- export type FilterOperator = "equals" | "not_equals" | "contains" | "not_contains" | "in" | "not_in" | "is_empty" | "is_not_empty" | "greater_than" | "less_than" | "greater_than_or_equal" | "less_than_or_equal";
1448
- /**
1449
- * Filter definition for entity queries
1450
- */
1451
- export interface EntityFilter {
1452
- field: string;
1453
- operator: FilterOperator;
1454
- value?: unknown;
1455
- }
1456
- /**
1457
- * Sort rule for entity queries
1458
- */
1459
- export interface SortRule {
1460
- field: string;
1461
- direction: "asc" | "desc";
1462
- }
1463
- /**
1464
- * Query definition for structured views
1465
- * Defines which entities to show and how to filter them
1466
- *
1467
- * NOTE: profileIds/profileSlugs are now stored in views.scopeProfileIds
1468
- * This query structure only contains filters, sorts, search, pagination, and groupBy
1469
- */
1470
- export interface EntityQuery {
1471
- /** @deprecated - Profile IDs now stored in views.scopeProfileIds */
1472
- profileIds?: string[];
1473
- /** @deprecated - Profile slugs now stored in views.scopeProfileIds (resolved to IDs) */
1474
- profileSlugs?: string[];
1475
- /** @deprecated - Use profileSlugs instead, which is also deprecated */
1476
- entityTypes?: string[];
1477
- /** Specific entity IDs (for fixed sets) */
1478
- entityIds?: string[];
1479
- /** Filter conditions */
1480
- filters?: EntityFilter[];
1481
- /** Sort rules (multiple sorts supported) */
1482
- sorts?: SortRule[];
1483
- /** Full-text search query */
1484
- search?: string;
1485
- /** Maximum number of entities to return */
1486
- limit?: number;
1487
- /** Offset for pagination */
1488
- offset?: number;
1489
- /** Group by field (for kanban, timeline) */
1490
- groupBy?: string;
1491
- }
1492
- declare enum AgentType {
1493
- DEFAULT = "default",
1494
- META = "meta",
1495
- PROMPTING = "prompting",
1496
- KNOWLEDGE_SEARCH = "knowledge-search",
1497
- CODE = "code",
1498
- WRITING = "writing",
1499
- ACTION = "action",
1500
- ONBOARDING = "onboarding",
1501
- WORKSPACE_CREATION = "workspace-creation"
1502
- }
1503
- /**
1504
- * Agent type as string literal union (for flexibility)
1505
- */
1506
- export type AgentTypeString = `${AgentType}` | (string & {});
1507
- declare enum AIStepType {
1508
- THINKING = "thinking",
1509
- TOOL_CALL = "tool_call",
1510
- TOOL_RESULT = "tool_result",
1511
- DECISION = "decision",
1512
- ERROR = "error"
1513
- }
1514
- /**
1515
- * AI step - shows what the AI is doing
1516
- *
1517
- * Represents any step in the AI's reasoning/execution process:
1518
- * - thinking: General analysis and reasoning
1519
- * - tool_call: When AI calls a tool
1520
- * - tool_result: Result from tool execution
1521
- * - decision: AI making a decision
1522
- * - error: Error during processing
1523
- */
1524
- export interface AIStep {
1525
- id: string;
1526
- type: AIStepType | string;
1527
- content: string;
1528
- toolName?: string;
1529
- toolInput?: unknown;
1530
- toolOutput?: unknown;
1531
- timestamp: string;
1532
- duration?: number;
1533
- error?: string;
1534
- title?: string;
1535
- description?: string;
1536
- status?: "pending" | "running" | "complete" | "error";
1537
- }
1538
- /**
1539
- * Branch decision from meta-agent
1540
- */
1541
- export interface BranchDecision {
1542
- shouldBranch: boolean;
1543
- reason: string;
1544
- suggestedAgentType?: AgentTypeString;
1545
- suggestedTitle?: string;
1546
- suggestedPurpose?: string;
1547
- }
1548
- declare const EVENT_ACTIONS: readonly [
1549
- "create",
1550
- "update",
1551
- "delete",
1552
- "archive",
1553
- "restore"
1554
- ];
1555
- export type EventAction = (typeof EVENT_ACTIONS)[number];
1556
- /**
1557
- * Universal Update Request
1558
- *
1559
- * The standard envelope for all change requests in the system.
1560
- * This object is stored in the `proposals` table (as part of StoredProposalData)
1561
- * and passed in events. changeType aligns with EventAction for event-sourced flow.
1562
- */
1563
- export interface UpdateRequest {
1564
- /** Unique ID for this specific request */
1565
- requestId: string;
1566
- /** Who initiated the change? */
1567
- source: "user" | "ai" | "system" | "intelligence" | "agent" | "openwebui-pipeline" | "openclaw" | "extension" | "cli" | "n8n" | "raycast";
1568
- sourceId: string;
1569
- /** Context */
1570
- workspaceId: string | null;
1571
- /** Target Entity */
1572
- targetType: "document" | "entity" | "whiteboard" | "view" | "profile";
1573
- targetId: string;
1574
- /** Human-readable target label resolved server-side when available. */
1575
- targetName?: string;
1576
- /** What kind of change? (aligns with EventAction) */
1577
- changeType: EventAction;
1578
- /**
1579
- * Lightweight metadata changes (e.g. title rename, status change).
1580
- * For entities: create/update payload. For documents: not used when proposedContent is used.
1581
- */
1582
- data?: Record<string, unknown>;
1583
- /**
1584
- * Heavy Content Reference (S3/MinIO).
1585
- * Used for Documents, Whiteboards, etc.
1586
- */
1587
- contentRef?: {
1588
- storageKey: string;
1364
+ declare const focusSessions: import("drizzle-orm/pg-core").PgTableWithColumns<{
1365
+ name: "focus_sessions";
1366
+ schema: undefined;
1367
+ columns: {
1368
+ id: import("drizzle-orm/pg-core").PgColumn<{
1369
+ name: "id";
1370
+ tableName: "focus_sessions";
1371
+ dataType: "string";
1372
+ columnType: "PgUUID";
1373
+ data: string;
1374
+ driverParam: string;
1375
+ notNull: true;
1376
+ hasDefault: true;
1377
+ isPrimaryKey: true;
1378
+ isAutoincrement: false;
1379
+ hasRuntimeDefault: false;
1380
+ enumValues: undefined;
1381
+ baseColumn: never;
1382
+ identity: undefined;
1383
+ generated: undefined;
1384
+ }, {}, {}>;
1385
+ workspaceId: import("drizzle-orm/pg-core").PgColumn<{
1386
+ name: "workspace_id";
1387
+ tableName: "focus_sessions";
1388
+ dataType: "string";
1389
+ columnType: "PgText";
1390
+ data: string;
1391
+ driverParam: string;
1392
+ notNull: true;
1393
+ hasDefault: false;
1394
+ isPrimaryKey: false;
1395
+ isAutoincrement: false;
1396
+ hasRuntimeDefault: false;
1397
+ enumValues: [
1398
+ string,
1399
+ ...string[]
1400
+ ];
1401
+ baseColumn: never;
1402
+ identity: undefined;
1403
+ generated: undefined;
1404
+ }, {}, {}>;
1405
+ userId: import("drizzle-orm/pg-core").PgColumn<{
1406
+ name: "user_id";
1407
+ tableName: "focus_sessions";
1408
+ dataType: "string";
1409
+ columnType: "PgText";
1410
+ data: string;
1411
+ driverParam: string;
1412
+ notNull: true;
1413
+ hasDefault: false;
1414
+ isPrimaryKey: false;
1415
+ isAutoincrement: false;
1416
+ hasRuntimeDefault: false;
1417
+ enumValues: [
1418
+ string,
1419
+ ...string[]
1420
+ ];
1421
+ baseColumn: never;
1422
+ identity: undefined;
1423
+ generated: undefined;
1424
+ }, {}, {}>;
1425
+ correlationId: import("drizzle-orm/pg-core").PgColumn<{
1426
+ name: "correlation_id";
1427
+ tableName: "focus_sessions";
1428
+ dataType: "string";
1429
+ columnType: "PgText";
1430
+ data: string;
1431
+ driverParam: string;
1432
+ notNull: false;
1433
+ hasDefault: false;
1434
+ isPrimaryKey: false;
1435
+ isAutoincrement: false;
1436
+ hasRuntimeDefault: false;
1437
+ enumValues: [
1438
+ string,
1439
+ ...string[]
1440
+ ];
1441
+ baseColumn: never;
1442
+ identity: undefined;
1443
+ generated: undefined;
1444
+ }, {}, {}>;
1445
+ goal: import("drizzle-orm/pg-core").PgColumn<{
1446
+ name: "goal";
1447
+ tableName: "focus_sessions";
1448
+ dataType: "string";
1449
+ columnType: "PgText";
1450
+ data: string;
1451
+ driverParam: string;
1452
+ notNull: true;
1453
+ hasDefault: false;
1454
+ isPrimaryKey: false;
1455
+ isAutoincrement: false;
1456
+ hasRuntimeDefault: false;
1457
+ enumValues: [
1458
+ string,
1459
+ ...string[]
1460
+ ];
1461
+ baseColumn: never;
1462
+ identity: undefined;
1463
+ generated: undefined;
1464
+ }, {}, {}>;
1465
+ status: import("drizzle-orm/pg-core").PgColumn<{
1466
+ name: "status";
1467
+ tableName: "focus_sessions";
1468
+ dataType: "string";
1469
+ columnType: "PgText";
1470
+ data: "active" | "paused" | "closed";
1471
+ driverParam: string;
1472
+ notNull: true;
1473
+ hasDefault: true;
1474
+ isPrimaryKey: false;
1475
+ isAutoincrement: false;
1476
+ hasRuntimeDefault: false;
1477
+ enumValues: [
1478
+ "active",
1479
+ "paused",
1480
+ "closed"
1481
+ ];
1482
+ baseColumn: never;
1483
+ identity: undefined;
1484
+ generated: undefined;
1485
+ }, {}, {}>;
1486
+ templateId: import("drizzle-orm/pg-core").PgColumn<{
1487
+ name: "template_id";
1488
+ tableName: "focus_sessions";
1489
+ dataType: "string";
1490
+ columnType: "PgText";
1491
+ data: string;
1492
+ driverParam: string;
1493
+ notNull: false;
1494
+ hasDefault: false;
1495
+ isPrimaryKey: false;
1496
+ isAutoincrement: false;
1497
+ hasRuntimeDefault: false;
1498
+ enumValues: [
1499
+ string,
1500
+ ...string[]
1501
+ ];
1502
+ baseColumn: never;
1503
+ identity: undefined;
1504
+ generated: undefined;
1505
+ }, {}, {}>;
1506
+ playbookId: import("drizzle-orm/pg-core").PgColumn<{
1507
+ name: "playbook_id";
1508
+ tableName: "focus_sessions";
1509
+ dataType: "string";
1510
+ columnType: "PgUUID";
1511
+ data: string;
1512
+ driverParam: string;
1513
+ notNull: false;
1514
+ hasDefault: false;
1515
+ isPrimaryKey: false;
1516
+ isAutoincrement: false;
1517
+ hasRuntimeDefault: false;
1518
+ enumValues: undefined;
1519
+ baseColumn: never;
1520
+ identity: undefined;
1521
+ generated: undefined;
1522
+ }, {}, {}>;
1523
+ expectedOutputs: import("drizzle-orm/pg-core").PgColumn<{
1524
+ name: "expected_outputs";
1525
+ tableName: "focus_sessions";
1526
+ dataType: "json";
1527
+ columnType: "PgJsonb";
1528
+ data: unknown;
1529
+ driverParam: unknown;
1530
+ notNull: false;
1531
+ hasDefault: true;
1532
+ isPrimaryKey: false;
1533
+ isAutoincrement: false;
1534
+ hasRuntimeDefault: false;
1535
+ enumValues: undefined;
1536
+ baseColumn: never;
1537
+ identity: undefined;
1538
+ generated: undefined;
1539
+ }, {}, {}>;
1540
+ channelId: import("drizzle-orm/pg-core").PgColumn<{
1541
+ name: "channel_id";
1542
+ tableName: "focus_sessions";
1543
+ dataType: "string";
1544
+ columnType: "PgUUID";
1545
+ data: string;
1546
+ driverParam: string;
1547
+ notNull: false;
1548
+ hasDefault: false;
1549
+ isPrimaryKey: false;
1550
+ isAutoincrement: false;
1551
+ hasRuntimeDefault: false;
1552
+ enumValues: undefined;
1553
+ baseColumn: never;
1554
+ identity: undefined;
1555
+ generated: undefined;
1556
+ }, {}, {}>;
1557
+ progress: import("drizzle-orm/pg-core").PgColumn<{
1558
+ name: "progress";
1559
+ tableName: "focus_sessions";
1560
+ dataType: "number";
1561
+ columnType: "PgInteger";
1562
+ data: number;
1563
+ driverParam: string | number;
1564
+ notNull: false;
1565
+ hasDefault: false;
1566
+ isPrimaryKey: false;
1567
+ isAutoincrement: false;
1568
+ hasRuntimeDefault: false;
1569
+ enumValues: undefined;
1570
+ baseColumn: never;
1571
+ identity: undefined;
1572
+ generated: undefined;
1573
+ }, {}, {}>;
1574
+ agentIds: import("drizzle-orm/pg-core").PgColumn<{
1575
+ name: "agent_ids";
1576
+ tableName: "focus_sessions";
1577
+ dataType: "array";
1578
+ columnType: "PgArray";
1579
+ data: string[];
1580
+ driverParam: string | string[];
1581
+ notNull: false;
1582
+ hasDefault: true;
1583
+ isPrimaryKey: false;
1584
+ isAutoincrement: false;
1585
+ hasRuntimeDefault: false;
1586
+ enumValues: [
1587
+ string,
1588
+ ...string[]
1589
+ ];
1590
+ baseColumn: import("drizzle-orm").Column<{
1591
+ name: "agent_ids";
1592
+ tableName: "focus_sessions";
1593
+ dataType: "string";
1594
+ columnType: "PgText";
1595
+ data: string;
1596
+ driverParam: string;
1597
+ notNull: false;
1598
+ hasDefault: false;
1599
+ isPrimaryKey: false;
1600
+ isAutoincrement: false;
1601
+ hasRuntimeDefault: false;
1602
+ enumValues: [
1603
+ string,
1604
+ ...string[]
1605
+ ];
1606
+ baseColumn: never;
1607
+ identity: undefined;
1608
+ generated: undefined;
1609
+ }, {}, {}>;
1610
+ identity: undefined;
1611
+ generated: undefined;
1612
+ }, {}, {
1613
+ size: undefined;
1614
+ baseBuilder: import("drizzle-orm/pg-core").PgColumnBuilder<{
1615
+ name: "agent_ids";
1616
+ dataType: "string";
1617
+ columnType: "PgText";
1618
+ data: string;
1619
+ enumValues: [
1620
+ string,
1621
+ ...string[]
1622
+ ];
1623
+ driverParam: string;
1624
+ }, {}, {}, import("drizzle-orm").ColumnBuilderExtraConfig>;
1625
+ }>;
1626
+ closedAt: import("drizzle-orm/pg-core").PgColumn<{
1627
+ name: "closed_at";
1628
+ tableName: "focus_sessions";
1629
+ dataType: "date";
1630
+ columnType: "PgTimestamp";
1631
+ data: Date;
1632
+ driverParam: string;
1633
+ notNull: false;
1634
+ hasDefault: false;
1635
+ isPrimaryKey: false;
1636
+ isAutoincrement: false;
1637
+ hasRuntimeDefault: false;
1638
+ enumValues: undefined;
1639
+ baseColumn: never;
1640
+ identity: undefined;
1641
+ generated: undefined;
1642
+ }, {}, {}>;
1643
+ contextReport: import("drizzle-orm/pg-core").PgColumn<{
1644
+ name: "context_report";
1645
+ tableName: "focus_sessions";
1646
+ dataType: "json";
1647
+ columnType: "PgJsonb";
1648
+ data: unknown;
1649
+ driverParam: unknown;
1650
+ notNull: false;
1651
+ hasDefault: false;
1652
+ isPrimaryKey: false;
1653
+ isAutoincrement: false;
1654
+ hasRuntimeDefault: false;
1655
+ enumValues: undefined;
1656
+ baseColumn: never;
1657
+ identity: undefined;
1658
+ generated: undefined;
1659
+ }, {}, {}>;
1660
+ planReport: import("drizzle-orm/pg-core").PgColumn<{
1661
+ name: "plan_report";
1662
+ tableName: "focus_sessions";
1663
+ dataType: "json";
1664
+ columnType: "PgJsonb";
1665
+ data: unknown;
1666
+ driverParam: unknown;
1667
+ notNull: false;
1668
+ hasDefault: false;
1669
+ isPrimaryKey: false;
1670
+ isAutoincrement: false;
1671
+ hasRuntimeDefault: false;
1672
+ enumValues: undefined;
1673
+ baseColumn: never;
1674
+ identity: undefined;
1675
+ generated: undefined;
1676
+ }, {}, {}>;
1677
+ executionLog: import("drizzle-orm/pg-core").PgColumn<{
1678
+ name: "execution_log";
1679
+ tableName: "focus_sessions";
1680
+ dataType: "json";
1681
+ columnType: "PgJsonb";
1682
+ data: unknown;
1683
+ driverParam: unknown;
1684
+ notNull: false;
1685
+ hasDefault: false;
1686
+ isPrimaryKey: false;
1687
+ isAutoincrement: false;
1688
+ hasRuntimeDefault: false;
1689
+ enumValues: undefined;
1690
+ baseColumn: never;
1691
+ identity: undefined;
1692
+ generated: undefined;
1693
+ }, {}, {}>;
1694
+ verificationReport: import("drizzle-orm/pg-core").PgColumn<{
1695
+ name: "verification_report";
1696
+ tableName: "focus_sessions";
1697
+ dataType: "json";
1698
+ columnType: "PgJsonb";
1699
+ data: unknown;
1700
+ driverParam: unknown;
1701
+ notNull: false;
1702
+ hasDefault: false;
1703
+ isPrimaryKey: false;
1704
+ isAutoincrement: false;
1705
+ hasRuntimeDefault: false;
1706
+ enumValues: undefined;
1707
+ baseColumn: never;
1708
+ identity: undefined;
1709
+ generated: undefined;
1710
+ }, {}, {}>;
1711
+ startedAt: import("drizzle-orm/pg-core").PgColumn<{
1712
+ name: "started_at";
1713
+ tableName: "focus_sessions";
1714
+ dataType: "date";
1715
+ columnType: "PgTimestamp";
1716
+ data: Date;
1717
+ driverParam: string;
1718
+ notNull: true;
1719
+ hasDefault: true;
1720
+ isPrimaryKey: false;
1721
+ isAutoincrement: false;
1722
+ hasRuntimeDefault: false;
1723
+ enumValues: undefined;
1724
+ baseColumn: never;
1725
+ identity: undefined;
1726
+ generated: undefined;
1727
+ }, {}, {}>;
1728
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
1729
+ name: "created_at";
1730
+ tableName: "focus_sessions";
1731
+ dataType: "date";
1732
+ columnType: "PgTimestamp";
1733
+ data: Date;
1734
+ driverParam: string;
1735
+ notNull: true;
1736
+ hasDefault: true;
1737
+ isPrimaryKey: false;
1738
+ isAutoincrement: false;
1739
+ hasRuntimeDefault: false;
1740
+ enumValues: undefined;
1741
+ baseColumn: never;
1742
+ identity: undefined;
1743
+ generated: undefined;
1744
+ }, {}, {}>;
1745
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
1746
+ name: "updated_at";
1747
+ tableName: "focus_sessions";
1748
+ dataType: "date";
1749
+ columnType: "PgTimestamp";
1750
+ data: Date;
1751
+ driverParam: string;
1752
+ notNull: true;
1753
+ hasDefault: true;
1754
+ isPrimaryKey: false;
1755
+ isAutoincrement: false;
1756
+ hasRuntimeDefault: false;
1757
+ enumValues: undefined;
1758
+ baseColumn: never;
1759
+ identity: undefined;
1760
+ generated: undefined;
1761
+ }, {}, {}>;
1762
+ };
1763
+ dialect: "pg";
1764
+ }>;
1765
+ export type FocusSession = typeof focusSessions.$inferSelect;
1766
+ /**
1767
+ * Playbooks Schema — session templates (CONFIGURATION)
1768
+ *
1769
+ * A Playbook is a *template* of a Session: a goal (with params), the
1770
+ * capabilities (tools/skills/commands) the AI may use, an input-strategy
1771
+ * ("what to check"), a channel spec (the room), expected outputs, an optional
1772
+ * schedule, and an executor target (IS / BYOA / hybrid).
1773
+ *
1774
+ * CONFIGURATION, not entity DATA — playbooks live in their own table; a runtime
1775
+ * `focus_sessions` row is an *instance* of a playbook (focus_sessions.playbook_id).
1776
+ * The richer JSONB shapes (params/input_strategy/channel_spec/expected_outputs/
1777
+ * schedule) conform to the contracts in @synap/playbooks; they are stored loosely
1778
+ * here and interpreted at the domain/API boundary.
1779
+ *
1780
+ * Design doc: team/platform/playbooks-capability-substrate.mdx
1781
+ */
1782
+ /** Which "hands" run this playbook. Mirrors @synap/playbooks ExecutorRef. */
1783
+ export type PlaybookExecutorRef = "is-agent" | "external-agent" | "hybrid";
1784
+ declare const playbooks: import("drizzle-orm/pg-core").PgTableWithColumns<{
1785
+ name: "playbooks";
1786
+ schema: undefined;
1787
+ columns: {
1788
+ id: import("drizzle-orm/pg-core").PgColumn<{
1789
+ name: "id";
1790
+ tableName: "playbooks";
1791
+ dataType: "string";
1792
+ columnType: "PgUUID";
1793
+ data: string;
1794
+ driverParam: string;
1795
+ notNull: true;
1796
+ hasDefault: true;
1797
+ isPrimaryKey: true;
1798
+ isAutoincrement: false;
1799
+ hasRuntimeDefault: false;
1800
+ enumValues: undefined;
1801
+ baseColumn: never;
1802
+ identity: undefined;
1803
+ generated: undefined;
1804
+ }, {}, {}>;
1805
+ workspaceId: import("drizzle-orm/pg-core").PgColumn<{
1806
+ name: "workspace_id";
1807
+ tableName: "playbooks";
1808
+ dataType: "string";
1809
+ columnType: "PgUUID";
1810
+ data: string;
1811
+ driverParam: string;
1812
+ notNull: false;
1813
+ hasDefault: false;
1814
+ isPrimaryKey: false;
1815
+ isAutoincrement: false;
1816
+ hasRuntimeDefault: false;
1817
+ enumValues: undefined;
1818
+ baseColumn: never;
1819
+ identity: undefined;
1820
+ generated: undefined;
1821
+ }, {}, {}>;
1822
+ createdBy: import("drizzle-orm/pg-core").PgColumn<{
1823
+ name: "created_by";
1824
+ tableName: "playbooks";
1825
+ dataType: "string";
1826
+ columnType: "PgText";
1827
+ data: string;
1828
+ driverParam: string;
1829
+ notNull: true;
1830
+ hasDefault: false;
1831
+ isPrimaryKey: false;
1832
+ isAutoincrement: false;
1833
+ hasRuntimeDefault: false;
1834
+ enumValues: [
1835
+ string,
1836
+ ...string[]
1837
+ ];
1838
+ baseColumn: never;
1839
+ identity: undefined;
1840
+ generated: undefined;
1841
+ }, {}, {}>;
1842
+ name: import("drizzle-orm/pg-core").PgColumn<{
1843
+ name: "name";
1844
+ tableName: "playbooks";
1845
+ dataType: "string";
1846
+ columnType: "PgText";
1847
+ data: string;
1848
+ driverParam: string;
1849
+ notNull: true;
1850
+ hasDefault: false;
1851
+ isPrimaryKey: false;
1852
+ isAutoincrement: false;
1853
+ hasRuntimeDefault: false;
1854
+ enumValues: [
1855
+ string,
1856
+ ...string[]
1857
+ ];
1858
+ baseColumn: never;
1859
+ identity: undefined;
1860
+ generated: undefined;
1861
+ }, {}, {}>;
1862
+ description: import("drizzle-orm/pg-core").PgColumn<{
1863
+ name: "description";
1864
+ tableName: "playbooks";
1865
+ dataType: "string";
1866
+ columnType: "PgText";
1867
+ data: string;
1868
+ driverParam: string;
1869
+ notNull: false;
1870
+ hasDefault: false;
1871
+ isPrimaryKey: false;
1872
+ isAutoincrement: false;
1873
+ hasRuntimeDefault: false;
1874
+ enumValues: [
1875
+ string,
1876
+ ...string[]
1877
+ ];
1878
+ baseColumn: never;
1879
+ identity: undefined;
1880
+ generated: undefined;
1881
+ }, {}, {}>;
1882
+ goalTemplate: import("drizzle-orm/pg-core").PgColumn<{
1883
+ name: "goal_template";
1884
+ tableName: "playbooks";
1885
+ dataType: "string";
1886
+ columnType: "PgText";
1887
+ data: string;
1888
+ driverParam: string;
1889
+ notNull: true;
1890
+ hasDefault: false;
1891
+ isPrimaryKey: false;
1892
+ isAutoincrement: false;
1893
+ hasRuntimeDefault: false;
1894
+ enumValues: [
1895
+ string,
1896
+ ...string[]
1897
+ ];
1898
+ baseColumn: never;
1899
+ identity: undefined;
1900
+ generated: undefined;
1901
+ }, {}, {}>;
1902
+ params: import("drizzle-orm/pg-core").PgColumn<{
1903
+ name: "params";
1904
+ tableName: "playbooks";
1905
+ dataType: "json";
1906
+ columnType: "PgJsonb";
1907
+ data: unknown;
1908
+ driverParam: unknown;
1909
+ notNull: true;
1910
+ hasDefault: true;
1911
+ isPrimaryKey: false;
1912
+ isAutoincrement: false;
1913
+ hasRuntimeDefault: false;
1914
+ enumValues: undefined;
1915
+ baseColumn: never;
1916
+ identity: undefined;
1917
+ generated: undefined;
1918
+ }, {}, {}>;
1919
+ inputStrategy: import("drizzle-orm/pg-core").PgColumn<{
1920
+ name: "input_strategy";
1921
+ tableName: "playbooks";
1922
+ dataType: "json";
1923
+ columnType: "PgJsonb";
1924
+ data: unknown;
1925
+ driverParam: unknown;
1926
+ notNull: true;
1927
+ hasDefault: true;
1928
+ isPrimaryKey: false;
1929
+ isAutoincrement: false;
1930
+ hasRuntimeDefault: false;
1931
+ enumValues: undefined;
1932
+ baseColumn: never;
1933
+ identity: undefined;
1934
+ generated: undefined;
1935
+ }, {}, {}>;
1936
+ channelSpec: import("drizzle-orm/pg-core").PgColumn<{
1937
+ name: "channel_spec";
1938
+ tableName: "playbooks";
1939
+ dataType: "json";
1940
+ columnType: "PgJsonb";
1941
+ data: unknown;
1942
+ driverParam: unknown;
1943
+ notNull: true;
1944
+ hasDefault: true;
1945
+ isPrimaryKey: false;
1946
+ isAutoincrement: false;
1947
+ hasRuntimeDefault: false;
1948
+ enumValues: undefined;
1949
+ baseColumn: never;
1950
+ identity: undefined;
1951
+ generated: undefined;
1952
+ }, {}, {}>;
1953
+ expectedOutputs: import("drizzle-orm/pg-core").PgColumn<{
1954
+ name: "expected_outputs";
1955
+ tableName: "playbooks";
1956
+ dataType: "json";
1957
+ columnType: "PgJsonb";
1958
+ data: unknown;
1959
+ driverParam: unknown;
1960
+ notNull: true;
1961
+ hasDefault: true;
1962
+ isPrimaryKey: false;
1963
+ isAutoincrement: false;
1964
+ hasRuntimeDefault: false;
1965
+ enumValues: undefined;
1966
+ baseColumn: never;
1967
+ identity: undefined;
1968
+ generated: undefined;
1969
+ }, {}, {}>;
1970
+ schedule: import("drizzle-orm/pg-core").PgColumn<{
1971
+ name: "schedule";
1972
+ tableName: "playbooks";
1973
+ dataType: "json";
1974
+ columnType: "PgJsonb";
1975
+ data: unknown;
1976
+ driverParam: unknown;
1977
+ notNull: false;
1978
+ hasDefault: false;
1979
+ isPrimaryKey: false;
1980
+ isAutoincrement: false;
1981
+ hasRuntimeDefault: false;
1982
+ enumValues: undefined;
1983
+ baseColumn: never;
1984
+ identity: undefined;
1985
+ generated: undefined;
1986
+ }, {}, {}>;
1987
+ executor: import("drizzle-orm/pg-core").PgColumn<{
1988
+ name: "executor";
1989
+ tableName: "playbooks";
1990
+ dataType: "string";
1991
+ columnType: "PgText";
1992
+ data: PlaybookExecutorRef;
1993
+ driverParam: string;
1994
+ notNull: true;
1995
+ hasDefault: true;
1996
+ isPrimaryKey: false;
1997
+ isAutoincrement: false;
1998
+ hasRuntimeDefault: false;
1999
+ enumValues: [
2000
+ "is-agent",
2001
+ "external-agent",
2002
+ "hybrid"
2003
+ ];
2004
+ baseColumn: never;
2005
+ identity: undefined;
2006
+ generated: undefined;
2007
+ }, {}, {
2008
+ $type: PlaybookExecutorRef;
2009
+ }>;
2010
+ status: import("drizzle-orm/pg-core").PgColumn<{
2011
+ name: "status";
2012
+ tableName: "playbooks";
2013
+ dataType: "string";
2014
+ columnType: "PgText";
2015
+ data: "active" | "draft" | "paused" | "archived";
2016
+ driverParam: string;
2017
+ notNull: true;
2018
+ hasDefault: true;
2019
+ isPrimaryKey: false;
2020
+ isAutoincrement: false;
2021
+ hasRuntimeDefault: false;
2022
+ enumValues: [
2023
+ "draft",
2024
+ "active",
2025
+ "paused",
2026
+ "archived"
2027
+ ];
2028
+ baseColumn: never;
2029
+ identity: undefined;
2030
+ generated: undefined;
2031
+ }, {}, {}>;
2032
+ metadata: import("drizzle-orm/pg-core").PgColumn<{
2033
+ name: "metadata";
2034
+ tableName: "playbooks";
2035
+ dataType: "json";
2036
+ columnType: "PgJsonb";
2037
+ data: unknown;
2038
+ driverParam: unknown;
2039
+ notNull: true;
2040
+ hasDefault: true;
2041
+ isPrimaryKey: false;
2042
+ isAutoincrement: false;
2043
+ hasRuntimeDefault: false;
2044
+ enumValues: undefined;
2045
+ baseColumn: never;
2046
+ identity: undefined;
2047
+ generated: undefined;
2048
+ }, {}, {}>;
2049
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
2050
+ name: "created_at";
2051
+ tableName: "playbooks";
2052
+ dataType: "date";
2053
+ columnType: "PgTimestamp";
2054
+ data: Date;
2055
+ driverParam: string;
2056
+ notNull: true;
2057
+ hasDefault: true;
2058
+ isPrimaryKey: false;
2059
+ isAutoincrement: false;
2060
+ hasRuntimeDefault: false;
2061
+ enumValues: undefined;
2062
+ baseColumn: never;
2063
+ identity: undefined;
2064
+ generated: undefined;
2065
+ }, {}, {}>;
2066
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
2067
+ name: "updated_at";
2068
+ tableName: "playbooks";
2069
+ dataType: "date";
2070
+ columnType: "PgTimestamp";
2071
+ data: Date;
2072
+ driverParam: string;
2073
+ notNull: true;
2074
+ hasDefault: true;
2075
+ isPrimaryKey: false;
2076
+ isAutoincrement: false;
2077
+ hasRuntimeDefault: false;
2078
+ enumValues: undefined;
2079
+ baseColumn: never;
2080
+ identity: undefined;
2081
+ generated: undefined;
2082
+ }, {}, {}>;
2083
+ };
2084
+ dialect: "pg";
2085
+ }>;
2086
+ export type Playbook = typeof playbooks.$inferSelect;
2087
+ /**
2088
+ * Links Schema — the config/runtime graph edges
2089
+ *
2090
+ * A polymorphic edge between CONFIGURATION/RUNTIME objects (playbook · tool ·
2091
+ * skill · command · session · source) and, where useful, entity DATA. This is
2092
+ * the deliberate mirror of the entity `relations` table — `relations` is the
2093
+ * graph for entity DATA; `links` is the graph for everything else — keeping the
2094
+ * data/config separation clean while still letting config point at data.
2095
+ *
2096
+ * ONE table powers every detail page's "related" panel and the capability graph:
2097
+ * `SELECT * FROM links WHERE (from_type,from_id)=$ OR (to_type,to_id)=$`.
2098
+ *
2099
+ * Edge semantics (linkType):
2100
+ * playbook --grants--> tool | skill | command
2101
+ * skill --requires--> tool
2102
+ * command --requires--> tool (command tool deps)
2103
+ * session --instantiated_from--> playbook
2104
+ * session --used--> tool | skill (run provenance)
2105
+ * session --targets--> entity (e.g. a linked task)
2106
+ * session --produced--> entity (run output)
2107
+ * session --promoted_to--> playbook (promotion lineage)
2108
+ * source --feeds--> playbook (input-strategy source)
2109
+ * tool --provided_by--> source (tool backed by a provider)
2110
+ * participant|channel --member_of--> session (room participants)
2111
+ *
2112
+ * Design doc: team/platform/playbooks-capability-substrate.mdx
2113
+ */
2114
+ /**
2115
+ * The kind of object on either end of a link edge.
2116
+ * `participant` = a user-id OR agent-user-id (both live in the `users` table).
2117
+ */
2118
+ export type LinkEndpointType = "playbook" | "tool" | "skill" | "command" | "session" | "source" | "entity" | "channel" | "participant";
2119
+ /** The relationship an edge expresses. */
2120
+ export type LinkType = "grants" | "requires" | "instantiated_from" | "used" | "targets" | "produced" | "member_of" | "feeds" | "promoted_to" | "provided_by";
2121
+ /**
2122
+ * EventRecord - Database representation of an event
2123
+ *
2124
+ * This is the format returned from the database.
2125
+ * It maps directly to the events table structure.
2126
+ */
2127
+ export interface EventRecord {
2128
+ id: string;
2129
+ timestamp: Date;
2130
+ subjectId: string;
2131
+ subjectType: string;
2132
+ eventType: string;
2133
+ userId: string;
2134
+ data: Record<string, unknown>;
2135
+ metadata?: Record<string, unknown>;
2136
+ version: number;
2137
+ causationId?: string;
2138
+ correlationId?: string;
2139
+ source: string;
2140
+ }
2141
+ /** Minimal message fields for list/preview */
2142
+ export interface LinkedMessagePreview {
2143
+ id: string;
2144
+ channelId: string;
2145
+ role: string;
2146
+ content: string;
2147
+ timestamp: Date;
2148
+ userId: string;
2149
+ }
2150
+ export interface LinkedMessageItem {
2151
+ link: MessageLink;
2152
+ message: LinkedMessagePreview;
2153
+ }
2154
+ export interface EffectiveProperty extends PropertyDef {
2155
+ required: boolean;
2156
+ defaultValue: unknown;
2157
+ displayOrder: number;
2158
+ }
2159
+ /**
2160
+ * RendererRef — what a profile or workspace stores as its renderer choice
2161
+ * for a (slot, profile) pair.
2162
+ *
2163
+ * Structural mirror of `RendererTarget` from `@synap-core/renderer-runtime`.
2164
+ * Kept as a structural type in the database layer (rather than importing the
2165
+ * frontend package) so the schema package stays UI-free. The canonical type
2166
+ * lives in `@synap-core/renderer-runtime` and is re-exported by
2167
+ * `@synap-core/profile-renderer` as `RendererRef`.
2168
+ *
2169
+ * Stored as JSONB on `profiles.default_(list|detail)_renderer` and inside
2170
+ * `workspaces.settings.profileRenderers[slug]`.
2171
+ *
2172
+ * Spec: synap-team-docs/content/team/platform/profile-renderer.mdx
2173
+ */
2174
+ export type RendererRef = {
2175
+ kind: "cell";
2176
+ cellKey: string;
2177
+ props: Record<string, unknown>;
2178
+ title?: string;
2179
+ displayMode?: string;
2180
+ rendererHint?: Record<string, unknown>;
2181
+ } | {
2182
+ kind: "view";
2183
+ viewId: string;
2184
+ title?: string;
2185
+ displayMode?: string;
2186
+ } | {
2187
+ kind: "iframe-srcdoc";
2188
+ appId: string;
2189
+ srcdoc: string;
2190
+ title?: string;
2191
+ props?: Record<string, unknown>;
2192
+ } | {
2193
+ kind: "external-app";
2194
+ appId: string;
2195
+ url: string;
2196
+ title?: string;
2197
+ props?: Record<string, unknown>;
2198
+ } | {
2199
+ kind: "url";
2200
+ url: string;
2201
+ external?: boolean;
2202
+ title?: string;
2203
+ } | {
2204
+ kind: "view-adapter";
2205
+ adapterKey: string;
2206
+ props?: Record<string, unknown>;
2207
+ title?: string;
2208
+ };
2209
+ /**
2210
+ * Column definition for views
2211
+ */
2212
+ export interface ViewColumn {
2213
+ id: string;
2214
+ field: string;
2215
+ title?: string;
2216
+ valueType?: string;
2217
+ indexed?: boolean;
2218
+ visible?: boolean;
2219
+ width?: number;
2220
+ }
2221
+ /**
2222
+ * View Query Types
2223
+ *
2224
+ * Single source of truth for all view query and filter types.
2225
+ */
2226
+ /**
2227
+ * Filter operator types
2228
+ */
2229
+ export type FilterOperator = "equals" | "not_equals" | "contains" | "not_contains" | "in" | "not_in" | "is_empty" | "is_not_empty" | "greater_than" | "less_than" | "greater_than_or_equal" | "less_than_or_equal";
2230
+ /**
2231
+ * Filter definition for entity queries
2232
+ */
2233
+ export interface EntityFilter {
2234
+ field: string;
2235
+ operator: FilterOperator;
2236
+ value?: unknown;
2237
+ }
2238
+ /**
2239
+ * Sort rule for entity queries
2240
+ */
2241
+ export interface SortRule {
2242
+ field: string;
2243
+ direction: "asc" | "desc";
2244
+ }
2245
+ /**
2246
+ * Query definition for structured views
2247
+ * Defines which entities to show and how to filter them
2248
+ *
2249
+ * NOTE: profileIds/profileSlugs are now stored in views.scopeProfileIds
2250
+ * This query structure only contains filters, sorts, search, pagination, and groupBy
2251
+ */
2252
+ export interface EntityQuery {
2253
+ /** @deprecated - Profile IDs now stored in views.scopeProfileIds */
2254
+ profileIds?: string[];
2255
+ /** @deprecated - Profile slugs now stored in views.scopeProfileIds (resolved to IDs) */
2256
+ profileSlugs?: string[];
2257
+ /** @deprecated - Use profileSlugs instead, which is also deprecated */
2258
+ entityTypes?: string[];
2259
+ /** Specific entity IDs (for fixed sets) */
2260
+ entityIds?: string[];
2261
+ /** Filter conditions */
2262
+ filters?: EntityFilter[];
2263
+ /** Sort rules (multiple sorts supported) */
2264
+ sorts?: SortRule[];
2265
+ /** Full-text search query */
2266
+ search?: string;
2267
+ /** Maximum number of entities to return */
2268
+ limit?: number;
2269
+ /** Offset for pagination */
2270
+ offset?: number;
2271
+ /** Group by field (for kanban, timeline) */
2272
+ groupBy?: string;
2273
+ }
2274
+ declare enum AgentType {
2275
+ DEFAULT = "default",
2276
+ META = "meta",
2277
+ PROMPTING = "prompting",
2278
+ KNOWLEDGE_SEARCH = "knowledge-search",
2279
+ CODE = "code",
2280
+ WRITING = "writing",
2281
+ ACTION = "action",
2282
+ ONBOARDING = "onboarding",
2283
+ WORKSPACE_CREATION = "workspace-creation"
2284
+ }
2285
+ /**
2286
+ * Agent type as string literal union (for flexibility)
2287
+ */
2288
+ export type AgentTypeString = `${AgentType}` | (string & {});
2289
+ declare enum AIStepType {
2290
+ THINKING = "thinking",
2291
+ TOOL_CALL = "tool_call",
2292
+ TOOL_RESULT = "tool_result",
2293
+ DECISION = "decision",
2294
+ ERROR = "error"
2295
+ }
2296
+ /**
2297
+ * AI step - shows what the AI is doing
2298
+ *
2299
+ * Represents any step in the AI's reasoning/execution process:
2300
+ * - thinking: General analysis and reasoning
2301
+ * - tool_call: When AI calls a tool
2302
+ * - tool_result: Result from tool execution
2303
+ * - decision: AI making a decision
2304
+ * - error: Error during processing
2305
+ */
2306
+ export interface AIStep {
2307
+ id: string;
2308
+ type: AIStepType | string;
2309
+ content: string;
2310
+ toolName?: string;
2311
+ toolInput?: unknown;
2312
+ toolOutput?: unknown;
2313
+ timestamp: string;
2314
+ duration?: number;
2315
+ error?: string;
2316
+ title?: string;
2317
+ description?: string;
2318
+ status?: "pending" | "running" | "complete" | "error";
2319
+ }
2320
+ /**
2321
+ * Branch decision from meta-agent
2322
+ */
2323
+ export interface BranchDecision {
2324
+ shouldBranch: boolean;
2325
+ reason: string;
2326
+ suggestedAgentType?: AgentTypeString;
2327
+ suggestedTitle?: string;
2328
+ suggestedPurpose?: string;
2329
+ }
2330
+ declare const EVENT_ACTIONS: readonly [
2331
+ "create",
2332
+ "update",
2333
+ "delete",
2334
+ "archive",
2335
+ "restore"
2336
+ ];
2337
+ export type EventAction = (typeof EVENT_ACTIONS)[number];
2338
+ /**
2339
+ * Universal Update Request
2340
+ *
2341
+ * The standard envelope for all change requests in the system.
2342
+ * This object is stored in the `proposals` table (as part of StoredProposalData)
2343
+ * and passed in events. changeType aligns with EventAction for event-sourced flow.
2344
+ */
2345
+ export interface UpdateRequest {
2346
+ /** Unique ID for this specific request */
2347
+ requestId: string;
2348
+ /** Who initiated the change? */
2349
+ source: "user" | "ai" | "system" | "intelligence" | "agent" | "openwebui-pipeline" | "openclaw" | "extension" | "cli" | "n8n" | "raycast";
2350
+ sourceId: string;
2351
+ /** Context */
2352
+ workspaceId: string | null;
2353
+ /** Target Entity */
2354
+ targetType: "document" | "entity" | "whiteboard" | "view" | "profile";
2355
+ targetId: string;
2356
+ /** Human-readable target label resolved server-side when available. */
2357
+ targetName?: string;
2358
+ /** What kind of change? (aligns with EventAction) */
2359
+ changeType: EventAction;
2360
+ /**
2361
+ * Lightweight metadata changes (e.g. title rename, status change).
2362
+ * For entities: create/update payload. For documents: not used when proposedContent is used.
2363
+ */
2364
+ data?: Record<string, unknown>;
2365
+ /**
2366
+ * Heavy Content Reference (S3/MinIO).
2367
+ * Used for Documents, Whiteboards, etc.
2368
+ */
2369
+ contentRef?: {
2370
+ storageKey: string;
1589
2371
  mimeType: string;
1590
2372
  size: number;
1591
2373
  checksum?: string;
@@ -1674,6 +2456,43 @@ export interface ProposalReviewModel {
1674
2456
  graph?: ProposalReviewGraph;
1675
2457
  events: ProposalReviewEvent[];
1676
2458
  }
2459
+ export interface CompositeCreateEntityOp {
2460
+ op: "create_entity";
2461
+ /** Profile slug for the new entity (e.g. "question"). */
2462
+ profileSlug: string;
2463
+ title?: string;
2464
+ description?: string;
2465
+ properties?: Record<string, unknown>;
2466
+ /**
2467
+ * Long-form body. When set, the entity-create path materializes a LINKED
2468
+ * DOCUMENT (versioned, MinIO-stored) instead of inlining into properties.
2469
+ * Used by markdown/document import.
2470
+ */
2471
+ content?: string;
2472
+ /**
2473
+ * Link to an EXISTING entity instead of creating one. When set, the writer
2474
+ * registers this op's ref → existingEntityId (so relations can target it) and
2475
+ * skips creation. Lets a graph mix new and pre-existing entities (capture's
2476
+ * "link don't create" path).
2477
+ */
2478
+ existingEntityId?: string;
2479
+ /**
2480
+ * Stable handle for THIS entity within the proposal, used by relation ops to
2481
+ * reference it (e.g. "t1"). Optional — the positional `$opN` ref always works.
2482
+ */
2483
+ ref?: string;
2484
+ }
2485
+ export interface CompositeCreateRelationOp {
2486
+ op: "create_relation";
2487
+ /** Relation type slug (system type or workspace relation_def). */
2488
+ type: string;
2489
+ /** Source: an op ref ("t1"/"$op0"/PRIMARY_REF) or a real entity UUID. */
2490
+ sourceRef: string;
2491
+ /** Target: an op ref ("t1"/"$op0"/PRIMARY_REF) or a real entity UUID. */
2492
+ targetRef: string;
2493
+ metadata?: Record<string, unknown>;
2494
+ }
2495
+ export type CompositeProposalOperation = CompositeCreateEntityOp | CompositeCreateRelationOp;
1677
2496
  /**
1678
2497
  * Record of what a proposal MATERIALIZED on approval.
1679
2498
  *
@@ -2143,6 +2962,7 @@ export type PaginatedResponse<T> = {
2143
2962
  offset: number;
2144
2963
  };
2145
2964
  };
2965
+ export type ImportRevealSource = "obsidian" | "markdown" | "csv" | "bookmark";
2146
2966
  export interface EnrichmentResult {
2147
2967
  source: string;
2148
2968
  confidence: number;
@@ -2230,6 +3050,52 @@ export interface ReactionEvent {
2230
3050
  /** the fan-out */
2231
3051
  reactions: Reaction[];
2232
3052
  }
3053
+ /**
3054
+ * @synap/playbooks — Playbooks & Capability Substrate contracts
3055
+ *
3056
+ * The pure, I/O-free DOMAIN contracts for the autonomous-capability spine:
3057
+ * Tool · Skill(ref) · Playbook · Link · Executor · PlaybookRun.
3058
+ *
3059
+ * Contains NO database / event / proposal side effects — ONLY types + the
3060
+ * Executor interface. Persistence ROW types live in @synap/database/schema
3061
+ * (tools / playbooks / links); the interfaces here describe the behavioral
3062
+ * shapes the loosely-typed JSONB columns conform to, applied at the domain/API
3063
+ * boundary. Small string-unions are intentionally re-declared here (rather than
3064
+ * imported from @synap/database) so this package stays dependency-free — they
3065
+ * must stay in lock-step with the `.$type<>()` unions in the schema files.
3066
+ *
3067
+ * Design doc: team/platform/playbooks-capability-substrate.mdx
3068
+ */
3069
+ /** IS persona-agent · BYOA external agent (Claude Code, CLI) · hybrid. */
3070
+ export type ExecutorRef = "is-agent" | "external-agent" | "hybrid";
3071
+ /** A credential a Tool/Skill needs at run time — mirrors the vault taxonomy. */
3072
+ export interface CredentialRequirement {
3073
+ /** Logical name the tool/skill references (e.g. "apiKey"). */
3074
+ name: string;
3075
+ secretType: "api-key" | "credential" | "ssh-key" | "oauth-token" | "env-variable" | "connection-string";
3076
+ /** Human-facing reason, surfaced in the vault approval proposal. */
3077
+ purpose?: string;
3078
+ }
3079
+ /** What a Playbook can GRANT / a run uses. (Tools and Skills are linked, not merged.) */
3080
+ export type GrantableKind = "tool" | "skill" | "command";
3081
+ /**
3082
+ * The normalized shape the Phase-1 adapters produce from builtin IS tools,
3083
+ * code/instruction skills, intelligence_commands, and source providers — so a
3084
+ * Playbook can grant capabilities uniformly and the AI can discover them.
3085
+ */
3086
+ /** The full read-model kind set: grantables + the discoverable source systems. */
3087
+ export type CapabilityKind = GrantableKind | "source-provider" | "builtin-tool";
3088
+ export interface Capability {
3089
+ kind: CapabilityKind;
3090
+ id: string;
3091
+ name: string;
3092
+ description?: string | null;
3093
+ inputSchema: Record<string, unknown>;
3094
+ credentials?: CredentialRequirement[];
3095
+ executor: ExecutorRef;
3096
+ /** Whether AI use is auto-approved or routed through a proposal. */
3097
+ governance: "auto" | "propose";
3098
+ }
2233
3099
  /**
2234
3100
  * Core API Router
2235
3101
  */
@@ -2376,7 +3242,13 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
2376
3242
  }>;
2377
3243
  structure: import("@trpc/server").TRPCMutationProcedure<{
2378
3244
  input: {
2379
- text: string;
3245
+ text?: string | undefined;
3246
+ file?: {
3247
+ content: string;
3248
+ mimeType: string;
3249
+ filename?: string | undefined;
3250
+ encoding?: "base64" | "utf8" | undefined;
3251
+ } | undefined;
2380
3252
  url?: string | undefined;
2381
3253
  html?: string | undefined;
2382
3254
  context?: string | undefined;
@@ -2413,8 +3285,38 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
2413
3285
  score: number;
2414
3286
  }>>;
2415
3287
  degraded: true;
2416
- degradedReason: "is_auth_error" | "is_invalid_response";
3288
+ degradedReason: "is_auth_error" | "is_invalid_response" | "is_empty_result";
3289
+ } | {
3290
+ extraction: {
3291
+ kind: string;
3292
+ extractor: string;
3293
+ metadata?: Record<string, unknown>;
3294
+ warnings?: string[];
3295
+ };
3296
+ dedupSkipped?: true | undefined;
3297
+ proposals: {
3298
+ tempId: string;
3299
+ profileSlug: string;
3300
+ title: string;
3301
+ description?: string;
3302
+ properties?: Record<string, unknown>;
3303
+ confidence: number;
3304
+ }[];
3305
+ relations: {
3306
+ sourceTempId: string;
3307
+ targetTempId: string;
3308
+ relationType: string;
3309
+ }[];
3310
+ followUp: string | null;
3311
+ targetWorkspaceId: string | null;
3312
+ dedupCandidates: Record<string, {
3313
+ entityId: string;
3314
+ title: string;
3315
+ profileSlug: string;
3316
+ score: number;
3317
+ }[]>;
2417
3318
  } | {
3319
+ extraction?: undefined;
2418
3320
  dedupSkipped?: true | undefined;
2419
3321
  proposals: {
2420
3322
  tempId: string;
@@ -2585,9 +3487,9 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
2585
3487
  output: {
2586
3488
  status: string;
2587
3489
  message: string;
2588
- id: `${string}-${string}-${string}-${string}-${string}`;
2589
3490
  entity: Record<string, unknown> | null;
2590
3491
  proposalId: string;
3492
+ id?: undefined;
2591
3493
  } | {
2592
3494
  status: string;
2593
3495
  message: string;
@@ -2624,6 +3526,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
2624
3526
  profileSlug?: string | undefined;
2625
3527
  includeDescendants?: boolean | undefined;
2626
3528
  globalOnly?: boolean | undefined;
3529
+ includePodWide?: boolean | undefined;
2627
3530
  sourceProposalId?: string | undefined;
2628
3531
  };
2629
3532
  output: {
@@ -3057,7 +3960,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3057
3960
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
3058
3961
  resolveOrCreateChannel: import("@trpc/server").TRPCQueryProcedure<{
3059
3962
  input: {
3060
- channelType: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab";
3963
+ channelType: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab";
3061
3964
  workspaceId?: string | undefined;
3062
3965
  contextObjectType?: "user" | "entity" | "external" | "workspace" | "document" | "view" | "task" | "project" | undefined;
3063
3966
  contextObjectId?: string | undefined;
@@ -3098,7 +4001,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3098
4001
  externalSource: string | null;
3099
4002
  status: "active" | "merged" | "archived";
3100
4003
  scope: "user" | "pod" | "workspace";
3101
- channelType: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab" | "group";
4004
+ channelType: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab" | "group";
3102
4005
  feedScope: "user" | "workspace" | null;
3103
4006
  contextObjectType: string | null;
3104
4007
  contextObjectId: string | null;
@@ -3219,7 +4122,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3219
4122
  externalSource: string | null;
3220
4123
  status: "active" | "merged" | "archived";
3221
4124
  scope: "user" | "pod" | "workspace";
3222
- channelType: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab" | "group";
4125
+ channelType: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab" | "group";
3223
4126
  feedScope: "user" | "workspace" | null;
3224
4127
  contextObjectType: string | null;
3225
4128
  contextObjectId: string | null;
@@ -3377,7 +4280,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3377
4280
  listChannels: import("@trpc/server").TRPCQueryProcedure<{
3378
4281
  input: {
3379
4282
  workspaceId?: string | undefined;
3380
- channelType?: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab" | undefined;
4283
+ channelType?: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab" | undefined;
3381
4284
  limit?: number | undefined;
3382
4285
  contextObjectId?: string | undefined;
3383
4286
  contextObjectType?: "entity" | "document" | "view" | undefined;
@@ -3517,7 +4420,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3517
4420
  externalSource: string | null;
3518
4421
  status: "active" | "merged" | "archived";
3519
4422
  scope: "user" | "pod" | "workspace";
3520
- channelType: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab" | "group";
4423
+ channelType: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab" | "group";
3521
4424
  feedScope: "user" | "workspace" | null;
3522
4425
  contextObjectType: string | null;
3523
4426
  contextObjectId: string | null;
@@ -3583,7 +4486,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3583
4486
  externalSource: string | null;
3584
4487
  status: "active" | "merged" | "archived";
3585
4488
  scope: "user" | "pod" | "workspace";
3586
- channelType: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab" | "group";
4489
+ channelType: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab" | "group";
3587
4490
  feedScope: "user" | "workspace" | null;
3588
4491
  contextObjectType: string | null;
3589
4492
  contextObjectId: string | null;
@@ -3692,7 +4595,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3692
4595
  externalSource: string | null;
3693
4596
  status: "active" | "merged" | "archived";
3694
4597
  scope: "user" | "pod" | "workspace";
3695
- channelType: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab" | "group";
4598
+ channelType: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab" | "group";
3696
4599
  feedScope: "user" | "workspace" | null;
3697
4600
  contextObjectType: string | null;
3698
4601
  contextObjectId: string | null;
@@ -3722,7 +4625,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3722
4625
  externalSource: string | null;
3723
4626
  status: "active" | "merged" | "archived";
3724
4627
  scope: "user" | "pod" | "workspace";
3725
- channelType: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab" | "group";
4628
+ channelType: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab" | "group";
3726
4629
  feedScope: "user" | "workspace" | null;
3727
4630
  contextObjectType: string | null;
3728
4631
  contextObjectId: string | null;
@@ -3752,7 +4655,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3752
4655
  externalSource: string | null;
3753
4656
  status: "active" | "merged" | "archived";
3754
4657
  scope: "user" | "pod" | "workspace";
3755
- channelType: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab" | "group";
4658
+ channelType: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab" | "group";
3756
4659
  feedScope: "user" | "workspace" | null;
3757
4660
  contextObjectType: string | null;
3758
4661
  contextObjectId: string | null;
@@ -3917,7 +4820,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
3917
4820
  externalSource: string | null;
3918
4821
  status: "active" | "merged" | "archived";
3919
4822
  scope: "user" | "pod" | "workspace";
3920
- channelType: "external" | "personal" | "feed" | "thread" | "sub_thread" | "agent_collab" | "group";
4823
+ channelType: "external" | "personal" | "thread" | "sub_thread" | "feed" | "agent_collab" | "group";
3921
4824
  feedScope: "user" | "workspace" | null;
3922
4825
  contextObjectType: string | null;
3923
4826
  contextObjectId: string | null;
@@ -6674,7 +7577,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
6674
7577
  id: string;
6675
7578
  errorMessage: string | null;
6676
7579
  startedAt: Date;
6677
- status: "completed" | "failed" | "running";
7580
+ status: "completed" | "running" | "failed";
6678
7581
  threadId: string;
6679
7582
  commandId: string;
6680
7583
  permissionsSnapshot: Record<string, unknown> | null;
@@ -6700,7 +7603,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
6700
7603
  id: string;
6701
7604
  errorMessage: string | null;
6702
7605
  startedAt: Date;
6703
- status: "completed" | "failed" | "running";
7606
+ status: "completed" | "running" | "failed";
6704
7607
  threadId: string;
6705
7608
  commandId: string;
6706
7609
  permissionsSnapshot: Record<string, unknown> | null;
@@ -8183,6 +9086,13 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
8183
9086
  [x: string]: unknown;
8184
9087
  workspaceName?: string | undefined;
8185
9088
  description?: string | undefined;
9089
+ extends?: {
9090
+ source: string;
9091
+ import?: {
9092
+ profiles?: string[] | undefined;
9093
+ views?: string[] | undefined;
9094
+ } | undefined;
9095
+ }[] | undefined;
8186
9096
  profiles?: {
8187
9097
  slug: string;
8188
9098
  displayName: string;
@@ -8310,7 +9220,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
8310
9220
  profileEntityBentoTemplates?: Record<string, {
8311
9221
  blocks: Record<string, unknown>[];
8312
9222
  }> | undefined;
8313
- workspacePurpose?: "personal" | "agent" | "project" | "library" | "operational" | undefined;
9223
+ workspacePurpose?: "personal" | "agent" | "library" | "project" | "operational" | undefined;
8314
9224
  workspaceSubtype?: string | undefined;
8315
9225
  workspaceVisibility?: "members" | "private" | "pod_visible" | "pod_joinable" | "public_link" | undefined;
8316
9226
  workspaceCapabilities?: string[] | undefined;
@@ -12144,6 +13054,44 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
12144
13054
  };
12145
13055
  meta: object;
12146
13056
  }>;
13057
+ analyze: import("@trpc/server").TRPCMutationProcedure<{
13058
+ input: {
13059
+ source: "markdown" | "obsidian" | "csv" | "bookmark";
13060
+ items: {
13061
+ path: string;
13062
+ content: string;
13063
+ }[];
13064
+ workspaceId?: string | undefined;
13065
+ relationType?: string | undefined;
13066
+ aiStructure?: boolean | undefined;
13067
+ };
13068
+ output: {
13069
+ workspaceId: string;
13070
+ source: ImportRevealSource;
13071
+ mode: "deep" | "shallow";
13072
+ proposalId: string | null;
13073
+ operations: CompositeProposalOperation[];
13074
+ summary: string;
13075
+ stats: Record<string, unknown>;
13076
+ droppedReferences: number;
13077
+ aiTyped: number;
13078
+ };
13079
+ meta: object;
13080
+ }>;
13081
+ applyImport: import("@trpc/server").TRPCMutationProcedure<{
13082
+ input: {
13083
+ source: "markdown" | "obsidian" | "csv" | "bookmark";
13084
+ operations: Record<string, unknown>[];
13085
+ workspaceId?: string | undefined;
13086
+ };
13087
+ output: {
13088
+ workspaceId: string;
13089
+ source: ImportRevealSource;
13090
+ created: number;
13091
+ linked: number;
13092
+ };
13093
+ meta: object;
13094
+ }>;
12147
13095
  linkedInContacts: import("@trpc/server").TRPCMutationProcedure<{
12148
13096
  input: {
12149
13097
  contacts: {
@@ -13386,7 +14334,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
13386
14334
  id: string;
13387
14335
  title: string;
13388
14336
  recipeId: string | null;
13389
- runStatus: "success" | "failed" | "running" | "cancelled" | null;
14337
+ runStatus: "success" | "running" | "failed" | "cancelled" | null;
13390
14338
  runSteps: RunStep[];
13391
14339
  runStartedAt: string | null;
13392
14340
  runFinishedAt: string | null;
@@ -13552,16 +14500,16 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
13552
14500
  }>;
13553
14501
  setupVault: import("@trpc/server").TRPCMutationProcedure<{
13554
14502
  input: {
13555
- salt: string;
13556
- keyDerivationAlgorithm: string;
13557
- keyDerivationParams: {
14503
+ salt?: string | undefined;
14504
+ keyDerivationAlgorithm?: string | undefined;
14505
+ keyDerivationParams?: {
13558
14506
  N: number;
13559
14507
  r: number;
13560
14508
  p: number;
13561
- };
13562
- verificationCipher: string;
13563
- verificationIv: string;
13564
- verificationTag: string;
14509
+ } | undefined;
14510
+ verificationCipher?: string | undefined;
14511
+ verificationIv?: string | undefined;
14512
+ verificationTag?: string | undefined;
13565
14513
  recoveryKeyHash?: string | undefined;
13566
14514
  };
13567
14515
  output: {
@@ -13626,13 +14574,20 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
13626
14574
  };
13627
14575
  meta: object;
13628
14576
  }>;
14577
+ reveal: import("@trpc/server").TRPCMutationProcedure<{
14578
+ input: {
14579
+ id: string;
14580
+ };
14581
+ output: {
14582
+ value: string | Record<string, unknown>;
14583
+ };
14584
+ meta: object;
14585
+ }>;
13629
14586
  create: import("@trpc/server").TRPCMutationProcedure<{
13630
14587
  input: {
13631
14588
  name: string;
13632
14589
  type: "identity" | "password" | "api_key" | "credential" | "note" | "card" | "ssh_key" | "certificate" | "env_variable" | "database" | "oauth";
13633
- encryptedData: string;
13634
- iv: string;
13635
- authTag: string;
14590
+ value: string | Record<string, unknown>;
13636
14591
  url?: string | undefined;
13637
14592
  category?: string | undefined;
13638
14593
  description?: string | undefined;
@@ -13657,9 +14612,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
13657
14612
  category?: string | null | undefined;
13658
14613
  description?: string | null | undefined;
13659
14614
  iconUrl?: string | null | undefined;
13660
- encryptedData?: string | undefined;
13661
- iv?: string | undefined;
13662
- authTag?: string | undefined;
14615
+ value?: string | Record<string, unknown> | undefined;
13663
14616
  isFavorite?: boolean | undefined;
13664
14617
  sortOrder?: number | undefined;
13665
14618
  passwordStrength?: number | undefined;
@@ -13785,11 +14738,61 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
13785
14738
  input: {
13786
14739
  secretId: string;
13787
14740
  proposalId: string;
14741
+ scope?: "session" | "once" | "permanent" | undefined;
14742
+ ttlMinutes?: number | undefined;
14743
+ };
14744
+ output: {
14745
+ vaultRef: string;
14746
+ secretId: string;
14747
+ proposalId: string;
14748
+ grantId: string;
14749
+ scope: "session" | "once" | "permanent";
14750
+ expiresAt: string | null;
14751
+ };
14752
+ meta: object;
14753
+ }>;
14754
+ listGrants: import("@trpc/server").TRPCQueryProcedure<{
14755
+ input: {
14756
+ secretId: string;
14757
+ };
14758
+ output: {
14759
+ id: string;
14760
+ scope: "session" | "once" | "permanent";
14761
+ grantedTo: string | null;
14762
+ proposalId: string | null;
14763
+ expiresAt: string | null;
14764
+ maxUses: number | null;
14765
+ useCount: number;
14766
+ revokedAt: string | null;
14767
+ createdAt: string;
14768
+ active: boolean;
14769
+ }[];
14770
+ meta: object;
14771
+ }>;
14772
+ listAllGrants: import("@trpc/server").TRPCQueryProcedure<{
14773
+ input: void;
14774
+ output: {
14775
+ grantId: string;
14776
+ secretId: string;
14777
+ secretName: string | null;
14778
+ grantedTo: string | null;
14779
+ proposalId: string | null;
14780
+ scope: "session" | "once" | "permanent";
14781
+ expiresAt: string | null;
14782
+ maxUses: number | null;
14783
+ useCount: number;
14784
+ revokedAt: string | null;
14785
+ createdAt: string;
14786
+ active: boolean;
14787
+ }[];
14788
+ meta: object;
14789
+ }>;
14790
+ revokeGrant: import("@trpc/server").TRPCMutationProcedure<{
14791
+ input: {
14792
+ grantId: string;
13788
14793
  };
13789
14794
  output: {
13790
- vaultRef: string;
13791
- secretId: string;
13792
- proposalId: string;
14795
+ success: boolean;
13793
14796
  };
13794
14797
  meta: object;
13795
14798
  }>;
@@ -14079,6 +15082,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
14079
15082
  goal: string;
14080
15083
  status: "active" | "paused" | "closed";
14081
15084
  templateId: string | null;
15085
+ playbookId: string | null;
14082
15086
  expectedOutputs: unknown;
14083
15087
  channelId: string | null;
14084
15088
  progress: number | null;
@@ -14107,6 +15111,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
14107
15111
  goal: string;
14108
15112
  status: "active" | "paused" | "closed";
14109
15113
  templateId: string | null;
15114
+ playbookId: string | null;
14110
15115
  expectedOutputs: unknown;
14111
15116
  channelId: string | null;
14112
15117
  progress: number | null;
@@ -14138,6 +15143,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
14138
15143
  status: "active" | "paused" | "closed";
14139
15144
  goal: string;
14140
15145
  templateId: string | null;
15146
+ playbookId: string | null;
14141
15147
  expectedOutputs: unknown;
14142
15148
  progress: number | null;
14143
15149
  agentIds: string[] | null;
@@ -14165,6 +15171,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
14165
15171
  status: "active" | "paused" | "closed";
14166
15172
  goal: string;
14167
15173
  templateId: string | null;
15174
+ playbookId: string | null;
14168
15175
  expectedOutputs: unknown;
14169
15176
  progress: number | null;
14170
15177
  agentIds: string[] | null;
@@ -14201,6 +15208,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
14201
15208
  status: "active" | "paused" | "closed";
14202
15209
  goal: string;
14203
15210
  templateId: string | null;
15211
+ playbookId: string | null;
14204
15212
  expectedOutputs: unknown;
14205
15213
  progress: number | null;
14206
15214
  agentIds: string[] | null;
@@ -14239,6 +15247,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
14239
15247
  status: "active" | "paused" | "closed";
14240
15248
  goal: string;
14241
15249
  templateId: string | null;
15250
+ playbookId: string | null;
14242
15251
  expectedOutputs: unknown;
14243
15252
  progress: number | null;
14244
15253
  agentIds: string[] | null;
@@ -14266,6 +15275,7 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
14266
15275
  status: "active" | "paused" | "closed";
14267
15276
  goal: string;
14268
15277
  templateId: string | null;
15278
+ playbookId: string | null;
14269
15279
  expectedOutputs: unknown;
14270
15280
  progress: number | null;
14271
15281
  agentIds: string[] | null;
@@ -14278,6 +15288,426 @@ export declare const coreRouter: import("@trpc/server").TRPCBuiltRouter<{
14278
15288
  meta: object;
14279
15289
  }>;
14280
15290
  }>>;
15291
+ playbooks: import("@trpc/server").TRPCBuiltRouter<{
15292
+ ctx: Context;
15293
+ meta: object;
15294
+ errorShape: {
15295
+ message: string;
15296
+ code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
15297
+ data: import("@trpc/server").TRPCDefaultErrorData;
15298
+ };
15299
+ transformer: true;
15300
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
15301
+ links: import("@trpc/server").TRPCBuiltRouter<{
15302
+ ctx: Context;
15303
+ meta: object;
15304
+ errorShape: {
15305
+ message: string;
15306
+ code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
15307
+ data: import("@trpc/server").TRPCDefaultErrorData;
15308
+ };
15309
+ transformer: true;
15310
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
15311
+ getFor: import("@trpc/server").TRPCQueryProcedure<{
15312
+ input: {
15313
+ type: "session" | "source" | "channel" | "command" | "entity" | "playbook" | "tool" | "skill" | "participant";
15314
+ id: string;
15315
+ };
15316
+ output: {
15317
+ workspaceId: string | null;
15318
+ id: string;
15319
+ createdAt: Date;
15320
+ metadata: unknown;
15321
+ createdBy: string | null;
15322
+ linkType: LinkType;
15323
+ fromType: LinkEndpointType;
15324
+ fromId: string;
15325
+ toType: LinkEndpointType;
15326
+ toId: string;
15327
+ }[];
15328
+ meta: object;
15329
+ }>;
15330
+ }>>;
15331
+ capabilityRegistry: import("@trpc/server").TRPCBuiltRouter<{
15332
+ ctx: Context;
15333
+ meta: object;
15334
+ errorShape: {
15335
+ message: string;
15336
+ code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
15337
+ data: import("@trpc/server").TRPCDefaultErrorData;
15338
+ };
15339
+ transformer: true;
15340
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
15341
+ list: import("@trpc/server").TRPCQueryProcedure<{
15342
+ input: void;
15343
+ output: Capability[];
15344
+ meta: object;
15345
+ }>;
15346
+ }>>;
15347
+ list: import("@trpc/server").TRPCQueryProcedure<{
15348
+ input: {
15349
+ status?: "active" | "paused" | "archived" | "draft" | undefined;
15350
+ limit?: number | undefined;
15351
+ } | undefined;
15352
+ output: {
15353
+ id: string;
15354
+ workspaceId: string | null;
15355
+ createdBy: string;
15356
+ name: string;
15357
+ description: string | null;
15358
+ goalTemplate: string;
15359
+ params: unknown;
15360
+ inputStrategy: unknown;
15361
+ channelSpec: unknown;
15362
+ expectedOutputs: unknown;
15363
+ schedule: unknown;
15364
+ executor: PlaybookExecutorRef;
15365
+ status: "active" | "paused" | "archived" | "draft";
15366
+ metadata: unknown;
15367
+ createdAt: Date;
15368
+ updatedAt: Date;
15369
+ }[];
15370
+ meta: object;
15371
+ }>;
15372
+ get: import("@trpc/server").TRPCQueryProcedure<{
15373
+ input: {
15374
+ id: string;
15375
+ };
15376
+ output: {
15377
+ name: string;
15378
+ workspaceId: string | null;
15379
+ id: string;
15380
+ updatedAt: Date;
15381
+ createdAt: Date;
15382
+ metadata: unknown;
15383
+ status: "active" | "paused" | "archived" | "draft";
15384
+ description: string | null;
15385
+ createdBy: string;
15386
+ schedule: unknown;
15387
+ params: unknown;
15388
+ expectedOutputs: unknown;
15389
+ executor: PlaybookExecutorRef;
15390
+ goalTemplate: string;
15391
+ inputStrategy: unknown;
15392
+ channelSpec: unknown;
15393
+ };
15394
+ meta: object;
15395
+ }>;
15396
+ create: import("@trpc/server").TRPCMutationProcedure<{
15397
+ input: {
15398
+ name: string;
15399
+ goalTemplate: string;
15400
+ agentUserId?: string | undefined;
15401
+ source?: string | undefined;
15402
+ reasoning?: string | undefined;
15403
+ description?: string | undefined;
15404
+ params?: Record<string, unknown>[] | undefined;
15405
+ inputStrategy?: Record<string, unknown> | undefined;
15406
+ channelSpec?: Record<string, unknown> | undefined;
15407
+ expectedOutputs?: Record<string, unknown>[] | undefined;
15408
+ schedule?: unknown;
15409
+ executor?: "is-agent" | "external-agent" | "hybrid" | undefined;
15410
+ status?: "active" | "paused" | "archived" | "draft" | undefined;
15411
+ };
15412
+ output: {
15413
+ playbook: Playbook | null;
15414
+ status: "proposed";
15415
+ message: string;
15416
+ proposalId: string;
15417
+ } | {
15418
+ playbook: Playbook;
15419
+ status: "created";
15420
+ message: string;
15421
+ proposalId: string | null;
15422
+ };
15423
+ meta: object;
15424
+ }>;
15425
+ update: import("@trpc/server").TRPCMutationProcedure<{
15426
+ input: {
15427
+ id: string;
15428
+ agentUserId?: string | undefined;
15429
+ source?: string | undefined;
15430
+ reasoning?: string | undefined;
15431
+ name?: string | undefined;
15432
+ description?: string | undefined;
15433
+ goalTemplate?: string | undefined;
15434
+ params?: Record<string, unknown>[] | undefined;
15435
+ inputStrategy?: Record<string, unknown> | undefined;
15436
+ channelSpec?: Record<string, unknown> | undefined;
15437
+ expectedOutputs?: Record<string, unknown>[] | undefined;
15438
+ schedule?: unknown;
15439
+ executor?: "is-agent" | "external-agent" | "hybrid" | undefined;
15440
+ status?: "active" | "paused" | "archived" | "draft" | undefined;
15441
+ };
15442
+ output: {
15443
+ playbook: Playbook | null;
15444
+ status: "proposed";
15445
+ message: string;
15446
+ proposalId: string;
15447
+ } | {
15448
+ playbook: Playbook;
15449
+ status: "updated";
15450
+ message: string;
15451
+ proposalId: string | null;
15452
+ };
15453
+ meta: object;
15454
+ }>;
15455
+ archive: import("@trpc/server").TRPCMutationProcedure<{
15456
+ input: {
15457
+ id: string;
15458
+ agentUserId?: string | undefined;
15459
+ source?: string | undefined;
15460
+ reasoning?: string | undefined;
15461
+ };
15462
+ output: {
15463
+ playbook: Playbook | null;
15464
+ status: "proposed";
15465
+ message: string;
15466
+ proposalId: string;
15467
+ } | {
15468
+ playbook: Playbook;
15469
+ status: "archived";
15470
+ message: string;
15471
+ proposalId: string | null;
15472
+ };
15473
+ meta: object;
15474
+ }>;
15475
+ instantiate: import("@trpc/server").TRPCMutationProcedure<{
15476
+ input: {
15477
+ playbookId: string;
15478
+ params?: Record<string, unknown> | undefined;
15479
+ agentIds?: string[] | undefined;
15480
+ channelId?: string | undefined;
15481
+ agentUserId?: string | undefined;
15482
+ source?: string | undefined;
15483
+ reasoning?: string | undefined;
15484
+ };
15485
+ output: {
15486
+ session: FocusSession | null;
15487
+ status: "proposed";
15488
+ message: string;
15489
+ proposalId: string;
15490
+ } | {
15491
+ session: {
15492
+ userId: string;
15493
+ workspaceId: string;
15494
+ id: string;
15495
+ updatedAt: Date;
15496
+ createdAt: Date;
15497
+ correlationId: string | null;
15498
+ channelId: string | null;
15499
+ startedAt: Date;
15500
+ status: "active" | "paused" | "closed";
15501
+ goal: string;
15502
+ templateId: string | null;
15503
+ playbookId: string | null;
15504
+ expectedOutputs: unknown;
15505
+ progress: number | null;
15506
+ agentIds: string[] | null;
15507
+ closedAt: Date | null;
15508
+ contextReport: unknown;
15509
+ planReport: unknown;
15510
+ executionLog: unknown;
15511
+ verificationReport: unknown;
15512
+ };
15513
+ status: "created";
15514
+ message: string;
15515
+ proposalId: string | null;
15516
+ };
15517
+ meta: object;
15518
+ }>;
15519
+ promote: import("@trpc/server").TRPCMutationProcedure<{
15520
+ input: {
15521
+ sessionId: string;
15522
+ name?: string | undefined;
15523
+ description?: string | undefined;
15524
+ agentUserId?: string | undefined;
15525
+ source?: string | undefined;
15526
+ reasoning?: string | undefined;
15527
+ };
15528
+ output: {
15529
+ playbook: Playbook | null;
15530
+ status: "proposed";
15531
+ message: string;
15532
+ proposalId: string;
15533
+ } | {
15534
+ playbook: {
15535
+ name: string;
15536
+ workspaceId: string | null;
15537
+ id: string;
15538
+ updatedAt: Date;
15539
+ createdAt: Date;
15540
+ metadata: unknown;
15541
+ status: "active" | "paused" | "archived" | "draft";
15542
+ description: string | null;
15543
+ createdBy: string;
15544
+ schedule: unknown;
15545
+ params: unknown;
15546
+ expectedOutputs: unknown;
15547
+ executor: PlaybookExecutorRef;
15548
+ goalTemplate: string;
15549
+ inputStrategy: unknown;
15550
+ channelSpec: unknown;
15551
+ };
15552
+ status: "promoted";
15553
+ message: string;
15554
+ proposalId: string | null;
15555
+ };
15556
+ meta: object;
15557
+ }>;
15558
+ }>>;
15559
+ artifacts: import("@trpc/server").TRPCBuiltRouter<{
15560
+ ctx: Context;
15561
+ meta: object;
15562
+ errorShape: {
15563
+ message: string;
15564
+ code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
15565
+ data: import("@trpc/server").TRPCDefaultErrorData;
15566
+ };
15567
+ transformer: true;
15568
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
15569
+ list: import("@trpc/server").TRPCQueryProcedure<{
15570
+ input: {
15571
+ state?: "working" | "kept" | "swept" | undefined;
15572
+ placement?: "desk" | "home" | "sidebar" | "library" | undefined;
15573
+ sessionId?: string | undefined;
15574
+ limit?: number | undefined;
15575
+ };
15576
+ output: {
15577
+ id: string;
15578
+ workspaceId: string;
15579
+ userId: string;
15580
+ kind: "url" | "entity" | "cell" | "document" | "view";
15581
+ refId: string | null;
15582
+ cellKey: string | null;
15583
+ props: unknown;
15584
+ title: string;
15585
+ originKind: "user" | "system" | "agent" | "deeplink";
15586
+ actorId: string | null;
15587
+ sessionId: string | null;
15588
+ state: "working" | "kept" | "swept";
15589
+ placement: "desk" | "home" | "sidebar" | "library";
15590
+ keptAt: Date | null;
15591
+ sweptAt: Date | null;
15592
+ createdAt: Date;
15593
+ updatedAt: Date;
15594
+ }[];
15595
+ meta: object;
15596
+ }>;
15597
+ listAll: import("@trpc/server").TRPCQueryProcedure<{
15598
+ input: {
15599
+ state?: "working" | "kept" | "swept" | undefined;
15600
+ placement?: "desk" | "home" | "sidebar" | "library" | undefined;
15601
+ sessionId?: string | undefined;
15602
+ limit?: number | undefined;
15603
+ };
15604
+ output: {
15605
+ id: string;
15606
+ workspaceId: string;
15607
+ userId: string;
15608
+ kind: "url" | "entity" | "cell" | "document" | "view";
15609
+ refId: string | null;
15610
+ cellKey: string | null;
15611
+ props: unknown;
15612
+ title: string;
15613
+ originKind: "user" | "system" | "agent" | "deeplink";
15614
+ actorId: string | null;
15615
+ sessionId: string | null;
15616
+ state: "working" | "kept" | "swept";
15617
+ placement: "desk" | "home" | "sidebar" | "library";
15618
+ keptAt: Date | null;
15619
+ sweptAt: Date | null;
15620
+ createdAt: Date;
15621
+ updatedAt: Date;
15622
+ }[];
15623
+ meta: object;
15624
+ }>;
15625
+ get: import("@trpc/server").TRPCQueryProcedure<{
15626
+ input: {
15627
+ id: string;
15628
+ };
15629
+ output: {
15630
+ userId: string;
15631
+ workspaceId: string;
15632
+ sessionId: string | null;
15633
+ id: string;
15634
+ updatedAt: Date;
15635
+ createdAt: Date;
15636
+ title: string;
15637
+ kind: "url" | "entity" | "cell" | "document" | "view";
15638
+ refId: string | null;
15639
+ cellKey: string | null;
15640
+ props: unknown;
15641
+ originKind: "user" | "system" | "agent" | "deeplink";
15642
+ actorId: string | null;
15643
+ state: "working" | "kept" | "swept";
15644
+ placement: "desk" | "home" | "sidebar" | "library";
15645
+ keptAt: Date | null;
15646
+ sweptAt: Date | null;
15647
+ };
15648
+ meta: object;
15649
+ }>;
15650
+ create: import("@trpc/server").TRPCMutationProcedure<{
15651
+ input: {
15652
+ kind: "url" | "entity" | "cell" | "document" | "view";
15653
+ title: string;
15654
+ refId?: string | undefined;
15655
+ cellKey?: string | undefined;
15656
+ props?: unknown;
15657
+ originKind?: "user" | "system" | "agent" | "deeplink" | undefined;
15658
+ actorId?: string | undefined;
15659
+ sessionId?: string | undefined;
15660
+ placement?: "desk" | "home" | "sidebar" | "library" | undefined;
15661
+ };
15662
+ output: {
15663
+ userId: string;
15664
+ workspaceId: string;
15665
+ sessionId: string | null;
15666
+ id: string;
15667
+ updatedAt: Date;
15668
+ createdAt: Date;
15669
+ title: string;
15670
+ kind: "url" | "entity" | "cell" | "document" | "view";
15671
+ refId: string | null;
15672
+ cellKey: string | null;
15673
+ props: unknown;
15674
+ originKind: "user" | "system" | "agent" | "deeplink";
15675
+ actorId: string | null;
15676
+ state: "working" | "kept" | "swept";
15677
+ placement: "desk" | "home" | "sidebar" | "library";
15678
+ keptAt: Date | null;
15679
+ sweptAt: Date | null;
15680
+ };
15681
+ meta: object;
15682
+ }>;
15683
+ setState: import("@trpc/server").TRPCMutationProcedure<{
15684
+ input: {
15685
+ id: string;
15686
+ state: "working" | "kept" | "swept";
15687
+ placement?: "desk" | "home" | "sidebar" | "library" | undefined;
15688
+ };
15689
+ output: {
15690
+ userId: string;
15691
+ workspaceId: string;
15692
+ sessionId: string | null;
15693
+ id: string;
15694
+ updatedAt: Date;
15695
+ createdAt: Date;
15696
+ title: string;
15697
+ kind: "url" | "entity" | "cell" | "document" | "view";
15698
+ refId: string | null;
15699
+ cellKey: string | null;
15700
+ props: unknown;
15701
+ originKind: "user" | "system" | "agent" | "deeplink";
15702
+ actorId: string | null;
15703
+ state: "working" | "kept" | "swept";
15704
+ placement: "desk" | "home" | "sidebar" | "library";
15705
+ keptAt: Date | null;
15706
+ sweptAt: Date | null;
15707
+ };
15708
+ meta: object;
15709
+ }>;
15710
+ }>>;
14281
15711
  }>>;
14282
15712
  export type AppRouter = typeof coreRouter;
14283
15713