@wildo-ai/saas-models 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/applications/applications-context.schemas.d.ts +14 -10
- package/dist/esm/applications/applications-context.schemas.d.ts.map +1 -1
- package/dist/esm/applications/applications.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/applications/applications.shared.resources-config.schemas.js +4 -3
- package/dist/esm/applications/applications.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/billing/billing-configuration.shared.schemas.d.ts +0 -4
- package/dist/esm/billing/billing-configuration.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/billing-configuration.shared.schemas.js +59 -17
- package/dist/esm/billing/billing-configuration.shared.schemas.js.map +1 -1
- package/dist/esm/billing/billing-enums.shared.schemas.d.ts +77 -21
- package/dist/esm/billing/billing-enums.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/billing-enums.shared.schemas.js +85 -23
- package/dist/esm/billing/billing-enums.shared.schemas.js.map +1 -1
- package/dist/esm/billing/billing-types.shared.schemas.d.ts +3 -3
- package/dist/esm/billing/price.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/price.shared.schemas.js +7 -1
- package/dist/esm/billing/price.shared.schemas.js.map +1 -1
- package/dist/esm/billing/product-behavior-policy.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/product-behavior-policy.shared.schemas.js +52 -11
- package/dist/esm/billing/product-behavior-policy.shared.schemas.js.map +1 -1
- package/dist/esm/billing/product-definition.shared.schemas.d.ts +2 -2
- package/dist/esm/billing/product.shared.resources-config.schemas.d.ts +2 -2
- package/dist/esm/billing/product.shared.schemas.d.ts +2 -2
- package/dist/esm/billing/product.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/product.shared.schemas.js +7 -3
- package/dist/esm/billing/product.shared.schemas.js.map +1 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts +1 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.js +15 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/billing/usage-record.shared.schemas.d.ts +7 -3
- package/dist/esm/billing/usage-record.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/usage-record.shared.schemas.js +22 -3
- package/dist/esm/billing/usage-record.shared.schemas.js.map +1 -1
- package/dist/esm/companion/provider-discovery.shared.schemas.d.ts +69 -2
- package/dist/esm/companion/provider-discovery.shared.schemas.d.ts.map +1 -1
- package/dist/esm/companion/provider-discovery.shared.schemas.js +20 -1
- package/dist/esm/companion/provider-discovery.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts +85 -0
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js +157 -0
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts +23 -0
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js +56 -0
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts +480 -20
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js +547 -23
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js.map +1 -1
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js +82 -3
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js.map +1 -1
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts +31 -30
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js +98 -3
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts +17 -0
- package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/privacy.shared.schemas.js +27 -4
- package/dist/esm/compliance/privacy/privacy.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts +82 -29
- package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/redaction.shared.schemas.js +95 -29
- package/dist/esm/compliance/privacy/redaction.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/privacy/subject-export.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/subject-export.shared.schemas.js +12 -5
- package/dist/esm/compliance/privacy/subject-export.shared.schemas.js.map +1 -1
- package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts +21 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts.map +1 -1
- package/dist/esm/config/analytics-value-moments.shared.schemas.js +20 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.js.map +1 -1
- package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts +7 -5
- package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts.map +1 -1
- package/dist/esm/config/auth-config-resolution.shared.utils.d.ts +8 -1
- package/dist/esm/config/auth-config-resolution.shared.utils.d.ts.map +1 -1
- package/dist/esm/config/auth-config-resolution.shared.utils.js +29 -0
- package/dist/esm/config/auth-config-resolution.shared.utils.js.map +1 -1
- package/dist/esm/config/entity-identity-config.shared.schemas.d.ts +95 -17
- package/dist/esm/config/entity-identity-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/config/entity-identity-config.shared.schemas.js +86 -8
- package/dist/esm/config/entity-identity-config.shared.schemas.js.map +1 -1
- package/dist/esm/config/frontend/chart-definition.shared.schemas.d.ts +12 -12
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts +28 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts.map +1 -1
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js +28 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js.map +1 -1
- package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts +45 -12
- package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-data/external-data-pipeline.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts +103 -58
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.js +176 -15
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts +15 -3
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts.map +1 -1
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js +32 -5
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js.map +1 -1
- package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts +83 -7
- package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts +59 -0
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js +61 -0
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js.map +1 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts +97 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts.map +1 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js +41 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js.map +1 -0
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts +148 -2
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js +56 -1
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts +5 -28
- package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-capability.shared.schemas.js +4 -2
- package/dist/esm/external-providers/provider-capability.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts +18 -8
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js +9 -4
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts +338 -0
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js +332 -0
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js.map +1 -0
- package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts +178 -9
- package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-metadata.shared.schemas.js +181 -9
- package/dist/esm/external-providers/provider-metadata.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts +7 -5
- package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-protocol.shared.schemas.js +7 -5
- package/dist/esm/external-providers/provider-protocol.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts +40 -0
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts.map +1 -0
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.js +80 -0
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.js.map +1 -0
- package/dist/esm/features/core-feature-definitions.shared.d.ts.map +1 -1
- package/dist/esm/features/core-feature-definitions.shared.js +7 -1
- package/dist/esm/features/core-feature-definitions.shared.js.map +1 -1
- package/dist/esm/features/feature-builders.shared.d.ts +32 -0
- package/dist/esm/features/feature-builders.shared.d.ts.map +1 -1
- package/dist/esm/features/feature-builders.shared.js +32 -0
- package/dist/esm/features/feature-builders.shared.js.map +1 -1
- package/dist/esm/files/file-upload-grant.shared.schemas.d.ts +14 -2
- package/dist/esm/files/file-upload-grant.shared.schemas.d.ts.map +1 -1
- package/dist/esm/files/file-upload-grant.shared.schemas.js +44 -5
- package/dist/esm/files/file-upload-grant.shared.schemas.js.map +1 -1
- package/dist/esm/files/files.shared.schemas.d.ts +15 -8
- package/dist/esm/files/files.shared.schemas.d.ts.map +1 -1
- package/dist/esm/files/files.shared.schemas.js +15 -8
- package/dist/esm/files/files.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/actors.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/actors.shared.schemas.js +3 -2
- package/dist/esm/flows-actors/actors.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/agents.shared.schemas.d.ts +54 -5
- package/dist/esm/flows-actors/agents.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/agents.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/apps-blueprint/apps-blueprint.shared.schemas.d.ts +6 -6
- package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts +0 -3
- package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/deliberation.shared.schemas.js +0 -5
- package/dist/esm/flows-actors/deliberation.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts +14 -0
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js +40 -3
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts +19 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js +33 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts +14 -9
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js +14 -9
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js +3 -2
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows.shared.schemas.js +3 -2
- package/dist/esm/flows-actors/flows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts +128 -0
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.js +142 -0
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts +0 -3
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js +1 -4
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts +0 -16
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js +1 -17
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.d.ts +3 -3
- package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js +3 -3
- package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts +2 -8
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js +4 -15
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/guidance/guidance-state.shared.utils.d.ts.map +1 -1
- package/dist/esm/guidance/guidance-state.shared.utils.js +1 -0
- package/dist/esm/guidance/guidance-state.shared.utils.js.map +1 -1
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts +8 -0
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/guidance/progression-state.shared.schemas.d.ts +46 -0
- package/dist/esm/guidance/progression-state.shared.schemas.d.ts.map +1 -1
- package/dist/esm/guidance/progression-state.shared.schemas.js +49 -0
- package/dist/esm/guidance/progression-state.shared.schemas.js.map +1 -1
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts +320 -50
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts.map +1 -1
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js +137 -36
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js.map +1 -1
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts +11 -2
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.js.map +1 -1
- package/dist/esm/notifications/email/email-template.shared.enums.d.ts +15 -0
- package/dist/esm/notifications/email/email-template.shared.enums.d.ts.map +1 -1
- package/dist/esm/notifications/email/email-template.shared.enums.js +15 -0
- package/dist/esm/notifications/email/email-template.shared.enums.js.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts +1 -0
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js +19 -0
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts +30 -0
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js +65 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js.map +1 -1
- package/dist/esm/notifications/notification-badges.core.definitions.d.ts +6 -4
- package/dist/esm/notifications/notification-badges.core.definitions.d.ts.map +1 -1
- package/dist/esm/notifications/notification-badges.core.definitions.js +6 -4
- package/dist/esm/notifications/notification-badges.core.definitions.js.map +1 -1
- package/dist/esm/notifications/notification-badges.schemas.d.ts +167 -5
- package/dist/esm/notifications/notification-badges.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/notification-badges.schemas.js +191 -6
- package/dist/esm/notifications/notification-badges.schemas.js.map +1 -1
- package/dist/esm/notifications/notifications.shared.schemas.d.ts +107 -0
- package/dist/esm/notifications/notifications.shared.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/notifications.shared.schemas.js +149 -1
- package/dist/esm/notifications/notifications.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-notifications.shared.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organization-notifications.shared.schemas.js +22 -1
- package/dist/esm/organizations/organization-notifications.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts +26 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organization-preferences.shared.schemas.js +25 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-profile.shared.schemas.d.ts +25 -0
- package/dist/esm/organizations/organization-profile.shared.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organization-profile.shared.schemas.js +42 -17
- package/dist/esm/organizations/organization-profile.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts +3 -2
- package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts.map +1 -1
- package/dist/esm/organizations/organization-unit-narrowing.shared.js +9 -2
- package/dist/esm/organizations/organization-unit-narrowing.shared.js.map +1 -1
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.js +18 -3
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/public-runtime/index.d.ts +49 -2
- package/dist/esm/public-runtime/index.d.ts.map +1 -1
- package/dist/esm/public-runtime/index.js +48 -1
- package/dist/esm/public-runtime/index.js.map +1 -1
- package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts +6 -5
- package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/queue/jobs.shared.resources-config.schemas.js +6 -5
- package/dist/esm/queue/jobs.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/queue/jobs.shared.schemas.d.ts +16 -3
- package/dist/esm/queue/jobs.shared.schemas.d.ts.map +1 -1
- package/dist/esm/queue/jobs.shared.schemas.js +16 -3
- package/dist/esm/queue/jobs.shared.schemas.js.map +1 -1
- package/dist/esm/requests/manual-controllers-routes-documentation.d.ts +137 -0
- package/dist/esm/requests/manual-controllers-routes-documentation.d.ts.map +1 -0
- package/dist/esm/requests/manual-controllers-routes-documentation.js +1201 -0
- package/dist/esm/requests/manual-controllers-routes-documentation.js.map +1 -0
- package/dist/esm/requests/manual-controllers-routes-urls.d.ts +67 -0
- package/dist/esm/requests/manual-controllers-routes-urls.d.ts.map +1 -1
- package/dist/esm/requests/manual-controllers-routes-urls.js +78 -0
- package/dist/esm/requests/manual-controllers-routes-urls.js.map +1 -1
- package/dist/esm/requests/rate-limits.shared.schemas.d.ts +11 -1
- package/dist/esm/requests/rate-limits.shared.schemas.d.ts.map +1 -1
- package/dist/esm/requests/rate-limits.shared.schemas.js +11 -1
- package/dist/esm/requests/rate-limits.shared.schemas.js.map +1 -1
- package/dist/esm/requests/websocket.shared.schemas.d.ts +27 -4
- package/dist/esm/requests/websocket.shared.schemas.d.ts.map +1 -1
- package/dist/esm/requests/websocket.shared.schemas.js +35 -0
- package/dist/esm/requests/websocket.shared.schemas.js.map +1 -1
- package/dist/esm/resources/resources-config.shared.factory.d.ts +1 -0
- package/dist/esm/resources/resources-config.shared.factory.d.ts.map +1 -1
- package/dist/esm/resources/resources-config.shared.factory.js +105 -20
- package/dist/esm/resources/resources-config.shared.factory.js.map +1 -1
- package/dist/esm/resources/resources-config.shared.schemas.d.ts +254 -72
- package/dist/esm/resources/resources-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/resources/resources-config.shared.schemas.js.map +1 -1
- package/dist/esm/resources/resources-registry.shared.core.definitions.d.ts.map +1 -1
- package/dist/esm/resources/resources-registry.shared.core.definitions.js +97 -5
- package/dist/esm/resources/resources-registry.shared.core.definitions.js.map +1 -1
- package/dist/esm/resources/resources-relationships.shared.factory.d.ts.map +1 -1
- package/dist/esm/resources/resources-relationships.shared.factory.js +15 -0
- package/dist/esm/resources/resources-relationships.shared.factory.js.map +1 -1
- package/dist/esm/resources/resources.shared.core.definitions.d.ts +37 -0
- package/dist/esm/resources/resources.shared.core.definitions.d.ts.map +1 -1
- package/dist/esm/resources/resources.shared.core.definitions.js +51 -0
- package/dist/esm/resources/resources.shared.core.definitions.js.map +1 -1
- package/dist/esm/resources/resources.shared.schemas.d.ts +11 -2
- package/dist/esm/resources/resources.shared.schemas.d.ts.map +1 -1
- package/dist/esm/resources/resources.shared.schemas.js +34 -3
- package/dist/esm/resources/resources.shared.schemas.js.map +1 -1
- package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts +51 -0
- package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/field-value-disclosure.utils.js +53 -0
- package/dist/esm/resources/utils/field-value-disclosure.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-summary.utils.d.ts +16 -2
- package/dist/esm/resources/utils/resources-summary.utils.d.ts.map +1 -1
- package/dist/esm/resources/utils/resources-summary.utils.js +19 -5
- package/dist/esm/resources/utils/resources-summary.utils.js.map +1 -1
- package/dist/esm/resources/utils/shared-persistence-collection.utils.d.ts.map +1 -1
- package/dist/esm/resources/utils/shared-persistence-collection.utils.js +11 -0
- package/dist/esm/resources/utils/shared-persistence-collection.utils.js.map +1 -1
- package/dist/esm/runtime/domain-module.shared.definitions.d.ts +25 -0
- package/dist/esm/runtime/domain-module.shared.definitions.d.ts.map +1 -1
- package/dist/esm/runtime/domain-module.shared.definitions.js.map +1 -1
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts +1 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js +38 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts +1 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js +38 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts +4 -11
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.js +0 -1
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.js.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.schemas.d.ts +84 -5
- package/dist/esm/security/authentications/authentication.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.schemas.js +83 -3
- package/dist/esm/security/authentications/authentication.shared.schemas.js.map +1 -1
- package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts +1 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/registration.shared.dto.schemas.js +11 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.js.map +1 -1
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts +15 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js +21 -4
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts +61 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js +208 -6
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts +37 -27
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js +134 -12
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js.map +1 -1
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts +0 -6
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js +17 -8
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js +27 -0
- package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts +52 -7
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js +45 -8
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js.map +1 -1
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts +31 -0
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js +198 -0
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts +31 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js +191 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts +250 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js +486 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js.map +1 -0
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts +4 -1
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js +29 -0
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts +4 -1
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js +29 -0
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts +6 -0
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js +31 -0
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts +13 -0
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js +24 -3
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js.map +1 -1
- package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts +4 -4
- package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts +4 -4
- package/dist/esm/users/user-self.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/users/user-self.shared.resources-config.schemas.js +33 -3
- package/dist/esm/users/user-self.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/users/users.shared.resources-config.schemas.d.ts +17 -1
- package/dist/esm/users/users.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/users/users.shared.resources-config.schemas.js +136 -5
- package/dist/esm/users/users.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/users/users.shared.schemas.d.ts +43 -12
- package/dist/esm/users/users.shared.schemas.d.ts.map +1 -1
- package/dist/esm/users/users.shared.schemas.js +38 -7
- package/dist/esm/users/users.shared.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deliberation.shared.schemas.js","sourceRoot":"","sources":["../../../../src/flows-actors/deliberation.shared.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,iEAAiE;AACjE,kDAAkD;AAClD,+DAA+D;AAC/D,oEAAoE;AACpE,uEAAuE;AACvE,qEAAqE;AACrE,qEAAqE;AACrE,WAAW;AACX,EAAE;AACF,mDAAmD;AACnD,yEAAyE;AACzE,qEAAqE;AACrE,sEAAsE;AACtE,oEAAoE;AACpE,YAAY;AACZ,qEAAqE;AACrE,4DAA4D;AAC5D,wEAAwE;AACxE,sEAAsE;AACtE,qEAAqE;AACrE,EAAE;AACF,sEAAsE;AACtE,kEAAkE;AAClE,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,oEAAoE;AACpE,wEAAwE;AACxE,iEAAiE;AACjE,uDAAuD;AACvD,oCAAoC;AACpC,iEAAiE;AAEjE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAN,IAAY,gBAuBX;AAvBD,WAAY,gBAAgB;IAC1B,8DAA8D;IAC9D,2DAAuC,CAAA;IACvC,yEAAyE;IACzE,qDAAiC,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WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxC,uDAAuD;QACvD,WAAW,IAAI,SAAS,CAAC,MAAM,GAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAY,CAAC;QAC5E,SAAS,IAAI,SAAS,CAAC,MAAM,CAAC;IAChC,CAAC;IACD,OAAO,WAAW,GAAG,SAAS,CAAC;AACjC,CAAC","sourcesContent":["import { z } from \"zod\";\n\nimport { FlowsActors_IO_PartKind } from \"./flows-actors.io.shared.schemas\";\n\n//===============================================================\n// Expert-Persona Deliberation — shared contracts\n// ------------------------------------------------------------\n// The GENERIC vocabulary of the agentic deliberation system: narrow\n// expert personas (derived per-app from the specification tier) review\n// candidate work products against a DERIVED evaluation rubric across\n// bounded critique-revise rounds, a coordinator synthesizes, a human\n// decides.\n//\n// TIER SPLIT (dependency direction — do not blur):\n// - The DERIVED artifacts (`ExpertRoleTemplate`, `ExpertPersonaCharter`)\n// live in `@wildo-ai/saas-specifications` `_core/expert-personas/`\n// (spec tier — committed, human-reviewable). `saas-backend-lib` can\n// NEVER import them (specifications sits BELOW backend-lib in the\n// graph).\n// - THIS file is the runtime-visible half: the enums the spec family\n// imports (single-sourced here — `ExpertWorkDomain`), the\n// `RuntimeExpertProfile` projection the COMPANION maps a charter into\n// before handing it to engine machinery, and the rubric / verdict /\n// deliberation-record contracts the engine round loop operates on.\n//\n// KEY DESIGN DECISION (the anti-\"taste-as-code\" contract): evaluation\n// CRITERIA ARE DATA, not schema fields. The rubric is derived per\n// deliberation run by an expert persona and travels in the judge PROMPT;\n// the verdict schema below stays FIXED and GENERIC (criterion-ref-keyed\n// score array), so one schema serves every work domain and every derived\n// rubric while remaining strict-structured-output compatible (flat,\n// all-required, no dynamic keys). Weighted aggregation is DETERMINISTIC\n// CODE (`aggregateWeightedScore`) — never model arithmetic — and\n// hallucinated criterion refs are rejected fail-closed\n// (`validateVerdictCriterionRefs`).\n//===============================================================\n\n/**\n * The narrow work-product domain an expert persona is specialized on —\n * the ROUTING AXIS of the narrowness principle. An expert declares a\n * small closed set of domains; the deliberation orchestrator REFUSES to\n * invoke an expert outside its declared domains (fail-closed).\n *\n * Deliberate design: agent personas are NARROW, unlike human employees\n * who wear several hats. A review needing three angles convenes three\n * experts + a coordinator, never one generalist.\n *\n * Single-sourced HERE (the spec-tier `expert-personas` family imports\n * this enum) so the vocabulary cannot drift across tiers. Extend\n * per-capability as new deliberation domains ship — never speculatively.\n */\nexport enum ExpertWorkDomain {\n /** Visual brand marks: logo symbols, icons, brand imagery. */\n VISUAL_BRAND_MARK = \"visual_brand_mark\",\n /** Marketing / product copy: website sections, email prose, taglines. */\n MARKETING_COPY = \"marketing_copy\",\n /** UI/design-system coherence: tokens, palette, typography discipline. */\n UI_DESIGN_COHERENCE = \"ui_design_coherence\",\n /** Brand strategy: positioning fit, differentiation, ICP resonance. */\n BRAND_STRATEGY = \"brand_strategy\",\n /**\n * Information architecture: WHERE a destination, operation or view belongs in\n * the application shell — surface assignment, grouping, ordering, findability.\n *\n * Distinct from {@link UI_DESIGN_COHERENCE}, which is tokens, palette and\n * typography discipline. A settings section can be perfectly on-palette and\n * still be in the wrong place; \"can a user find this, and does it sit with the\n * things it belongs with\" is a different question with a different expert.\n *\n * Added 2026-08-29, when placement became a deliberated decision rather than a\n * framework default — per this enum's rule, per-capability and never\n * speculatively.\n */\n INFORMATION_ARCHITECTURE = \"information_architecture\",\n}\n\n/**\n * A reviewer's headline recommendation for one candidate. Deliberately\n * the same three-state vocabulary as the interim brand accept judge —\n * accept as-is / fixable via revision / materially misses the brief.\n */\nexport enum DeliberationRecommendation {\n /** The candidate satisfies the rubric and can win as-is. */\n ACCEPT = \"accept\",\n /** Close, but has fixable concerns — revise before it can win. */\n REVISE = \"revise\",\n /** Materially misses the rubric — should not survive the shortlist. */\n REJECT = \"reject\",\n}\n\n/** How a candidate entered a round's candidate set. */\nexport enum DeliberationCandidateProvenance {\n /** Produced in round 1 from the creative brief. */\n ORIGINAL = \"original\",\n /** Produced by a critique-driven revision of a prior candidate. */\n REVISED = \"revised\",\n}\n\n/** Terminal + live states of a deliberation. */\nexport enum DeliberationStatus {\n /** Rounds are still executing. */\n RUNNING = \"running\",\n /** The coordinator judged the outcome converged before budget. */\n CONVERGED = \"converged\",\n /** The round budget was exhausted; synthesis used the last round. */\n BUDGET_EXHAUSTED = \"budget_exhausted\",\n /** The deliberation could not complete (provider/validation failure). */\n FAILED = \"failed\",\n /**\n * Every candidate was REJECTED by the panel. There is no winner, and that is a\n * RESULT — not a failure.\n *\n * Distinct from {@link FAILED}, which means the machinery could not complete;\n * here it completed and the answer is \"none of these\". Distinct from\n * {@link CONVERGED}, which asserts a winner. Collapsing rejection into either\n * would be the defect this state exists to remove: a coordinator asked to pick a\n * winner will pick one, so without a terminal rejection the least-bad candidate\n * of a uniformly rejected field lands carrying the panel's authority.\n *\n * A record in this state carries no `synthesis`. The caller decides what to do —\n * retry with a new brief, widen the candidate set, or surface the critiques —\n * because only the caller knows whether \"none of these\" is recoverable.\n */\n REJECTED = \"rejected\",\n}\n\n/**\n * The runtime projection of an `ExpertPersonaCharter` — everything the\n * engine deliberation machinery needs of a persona, WITHOUT importing the\n * spec tier (same pattern as the runtime brand-asset siblings). The\n * COMPANION (which imports both tiers) maps charter → profile when\n * composing a deliberation plan, and builds the expert's agent from it at\n * startup (fail-closed when the charter is missing/unaccepted).\n */\nconst _RuntimeExpertProfileSchema = z.object({\n /** The committed charter this profile projects (audit back-pointer). */\n charterRef: z.string().min(1),\n /** The framework role template the charter was derived from. */\n roleRef: z.string().min(1),\n /** The narrow domains this expert may produce briefs / reviews for. */\n workDomains: z.array(z.enum(ExpertWorkDomain)).min(1),\n /** The compiled app-specific persona prose (\"who I am for THIS app\"). */\n personaProse: z.string().min(1),\n /** Ordered priorities the persona judges by (highest first). */\n priorities: z.array(z.string().min(1)).min(1),\n /** Hard taboos — things this persona must never reward or produce. */\n taboos: z.array(z.string().min(1)).default([]),\n /**\n * What a top-tier candidate looks like for this app (rubric scale-anchor\n * seeds). Mirrors the charter's optional Lever-2 extension.\n */\n qualityBar: z.array(z.string().min(1)).optional(),\n /** The persona's ordered review checks (systematic judging method). */\n reviewProtocol: z.array(z.string().min(1)).optional(),\n});\nexport const RuntimeExpertProfileSchema: typeof _RuntimeExpertProfileSchema =\n _RuntimeExpertProfileSchema;\nexport type RuntimeExpertProfile = z.infer<typeof _RuntimeExpertProfileSchema>;\n\n/**\n * One derived evaluation criterion. `ref` is the join key verdicts score\n * against; `weight` feeds the DETERMINISTIC aggregation (never model\n * arithmetic); `scaleAnchors` pin what the scale ends MEAN so two\n * reviewers score commensurably.\n */\nconst _EvaluationCriterionSchema = z.object({\n /** Stable kebab-case key verdict scores reference (e.g. `favicon-legibility`). */\n ref: z.string().min(1),\n /** What is being evaluated, in one or two sentences. */\n description: z.string().min(1),\n /**\n * Relative importance, > 0 and FINITE. Normalization happens in\n * `aggregateWeightedScore` (weights need not sum to anything);\n * `.finite()` closes the Infinity/Infinity → NaN aggregate hole.\n */\n weight: z.number().positive().finite(),\n /** What the scale extremes mean — pins reviewer calibration. */\n scaleAnchors: z.object({\n /** What a 0 looks like for this criterion. */\n low: z.string().min(1),\n /** What a 100 looks like for this criterion. */\n high: z.string().min(1),\n }),\n});\nexport const EvaluationCriterionSchema: typeof _EvaluationCriterionSchema =\n _EvaluationCriterionSchema;\nexport type EvaluationCriterion = z.infer<typeof _EvaluationCriterionSchema>;\n\n/**\n * The DERIVED rubric a deliberation evaluates against. Derived ONCE at\n * deliberation start by the responsible expert persona (per-run — locked\n * decision), held CONSTANT across that deliberation's rounds (revise\n * targets must not move mid-discussion), and EMBEDDED in the\n * `DeliberationRecord` (auditability without a standalone artifact).\n * Never persisted as its own resource.\n */\nconst _EvaluationRubricSchema = z.object({\n /** The work domain this rubric evaluates. */\n workDomain: z.enum(ExpertWorkDomain),\n /** The charter of the expert who derived the rubric. */\n derivedFromCharterRef: z.string().min(1),\n /** The derived criteria (the DATA that replaces hardcoded score fields). */\n criteria: z.array(_EvaluationCriterionSchema).min(1),\n /** ISO-8601 derivation moment. */\n derivedAt: z.iso.datetime(),\n}).refine(\n (rubric) => new Set(rubric.criteria.map((criterion) => criterion.ref)).size === rubric.criteria.length,\n {\n // The rubric is LLM-DERIVED data — a model emitting the same ref twice\n // (with different weights) is a plausible output, and a duplicated ref\n // would silently DOUBLE-WEIGHT that criterion in the aggregate. Reject\n // at parse; `validateVerdictCriterionRefs` re-checks as defense for\n // in-process-constructed rubrics that skipped parsing.\n message: 'criteria[].ref must be unique — a duplicated ref would silently double-weight it in the aggregate.',\n path: ['criteria'],\n },\n);\nexport const EvaluationRubricSchema: typeof _EvaluationRubricSchema =\n _EvaluationRubricSchema;\nexport type EvaluationRubric = z.infer<typeof _EvaluationRubricSchema>;\n\n/**\n * One criterion score inside a verdict. `criterionRef` MUST match a\n * rubric criterion — enforced fail-closed by\n * `validateVerdictCriterionRefs` (a hallucinated ref rejects the verdict,\n * one retry with the error surfaced, then the reviewer is dropped from\n * the round with a quorum note).\n */\nconst _RubricScoreSchema = z.object({\n /** The rubric criterion this score answers. */\n criterionRef: z.string().min(1),\n /** 0–100 against the criterion's scale anchors. */\n score: z.number().min(0).max(100),\n /** One crisp sentence grounding the score in what was observed. */\n note: z.string().min(1),\n});\nexport const RubricScoreSchema: typeof _RubricScoreSchema = _RubricScoreSchema;\nexport type RubricScore = z.infer<typeof _RubricScoreSchema>;\n\n/**\n * One actionable critique inside a verdict — the REVISION FUEL. The\n * producer's revise step compiles the shortlist's critiques into the\n * revision (text: rewrite the draft; image: a regeneration prompt\n * addendum — the image transport has no edit operation).\n */\nconst _RubricCritiqueSchema = z.object({\n /** Which aspect of the candidate the critique targets. */\n targetAspect: z.string().min(1),\n /** What is wrong, grounded in the rubric/persona view. */\n critique: z.string().min(1),\n /** The concrete change that would address it. */\n suggestion: z.string().min(1),\n});\nexport const RubricCritiqueSchema: typeof _RubricCritiqueSchema =\n _RubricCritiqueSchema;\nexport type RubricCritique = z.infer<typeof _RubricCritiqueSchema>;\n\n/**\n * One reviewer's verdict on one candidate — the GENERIC,\n * strict-structured-output-safe judge contract (flat, all-required,\n * ref-keyed; \"nothing to report\" is an empty array, never an absent key).\n * This is the schema handed to the LLM; the rubric it scores against\n * travels in the PROMPT.\n */\nconst _RubricVerdictSchema = z.object({\n /** The reviewing expert's charter ref. */\n reviewerCharterRef: z.string().min(1),\n /** The candidate under review. */\n candidateRef: z.string().min(1),\n /** One score per rubric criterion (validated fail-closed, both ways). */\n scores: z.array(_RubricScoreSchema).min(1),\n /** Headline recommendation. */\n recommendation: z.enum(DeliberationRecommendation),\n /**\n * Actionable critiques (revision fuel). REQUIRED — \"no critiques\" is an\n * explicit empty array, never an absent key: this schema is handed to the\n * LLM, and the strict structured-output transport rejects any non-required\n * property (a `.default()` would emit one). The prompt contract mandates\n * `[]`, not the schema.\n */\n critiques: z.array(_RubricCritiqueSchema),\n /** The reviewer's overall reading of the candidate, one short paragraph. */\n overallNote: z.string().min(1),\n});\nexport const RubricVerdictSchema: typeof _RubricVerdictSchema =\n _RubricVerdictSchema;\nexport type RubricVerdict = z.infer<typeof _RubricVerdictSchema>;\n\n/**\n * One candidate as it exists inside a round's candidate set — a\n * DISCRIMINATED UNION on `provenance` so the audit invariant is enforced by\n * the schema, not by convention: a `REVISED` candidate MUST carry both\n * `revisedFromRef` and `revisionPrompt` (\"every revision is reproducible\n * from the record\"), while an `ORIGINAL` candidate carries neither.\n */\nconst _DeliberationCandidateOriginalSchema = z.object({\n /** Stable candidate ref (unique within the deliberation). */\n ref: z.string().min(1),\n /** Produced in round 1 from the creative brief. */\n provenance: z.literal(DeliberationCandidateProvenance.ORIGINAL),\n /**\n * Where the candidate's payload lives (staging-relative path or\n * artifact locator). The record stores locators, never payload bytes.\n */\n storageRef: z.string().min(1),\n});\nconst _DeliberationCandidateRevisedSchema = z.object({\n /** Stable candidate ref (unique within the deliberation). */\n ref: z.string().min(1),\n /** Produced by a critique-driven revision of a prior candidate. */\n provenance: z.literal(DeliberationCandidateProvenance.REVISED),\n /** The candidate this one revises. REQUIRED for revisions. */\n revisedFromRef: z.string().min(1),\n /**\n * The compiled revision instruction (text) or regeneration prompt\n * (image) — REQUIRED so every revision is reproducible from the record.\n */\n revisionPrompt: z.string().min(1),\n /** Where the candidate's payload lives (locator, never bytes). */\n storageRef: z.string().min(1),\n});\nconst _DeliberationCandidateSchema = z.discriminatedUnion('provenance', [\n _DeliberationCandidateOriginalSchema,\n _DeliberationCandidateRevisedSchema,\n]);\nexport const DeliberationCandidateSchema: typeof _DeliberationCandidateSchema =\n _DeliberationCandidateSchema;\nexport type DeliberationCandidate = z.infer<typeof _DeliberationCandidateSchema>;\n\n/**\n * One critique-revise round: the candidate set reviewed, every verdict\n * collected, and the coordinator's shortlist (the COST SPINE — round 1\n * reviews the full set, the coordinator shortlists top-K, rounds 2+\n * operate on the shortlist only; the panel never re-litigates eliminated\n * options).\n */\nconst _DeliberationRoundSchema = z.object({\n /** 1-based round number. */\n roundNumber: z.number().int().min(1),\n /** The candidates reviewed this round. */\n candidateSet: z.array(_DeliberationCandidateSchema).min(1),\n /** Every reviewer verdict collected this round (dissent preserved). */\n verdicts: z.array(_RubricVerdictSchema),\n /** The coordinator's shortlist feeding the next round (absent on the final round). */\n shortlistRefs: z.array(z.string().min(1)).optional(),\n});\nexport const DeliberationRoundSchema: typeof _DeliberationRoundSchema =\n _DeliberationRoundSchema;\nexport type DeliberationRound = z.infer<typeof _DeliberationRoundSchema>;\n\n/** A dissenting position preserved in the synthesis (never averaged away). */\nconst _DeliberationDissentSchema = z.object({\n /** The dissenting expert's charter ref. */\n charterRef: z.string().min(1),\n /** The dissenting position, in the expert's own terms. */\n position: z.string().min(1),\n});\nexport const DeliberationDissentSchema: typeof _DeliberationDissentSchema =\n _DeliberationDissentSchema;\nexport type DeliberationDissent = z.infer<typeof _DeliberationDissentSchema>;\n\n/**\n * The coordinator's synthesis — the \"manager's\" decision over the panel:\n * a winner, the grounded rationale, and every preserved dissent.\n * ADVISORY: the human decision seam on the record is the authority.\n */\nconst _DeliberationSynthesisSchema = z.object({\n /** The winning candidate ref. */\n winnerRef: z.string().min(1),\n /** Why the winner beats the field, grounded in verdicts + rubric. */\n rationale: z.string().min(1),\n /**\n * Dissenting positions, preserved verbatim. REQUIRED — unanimity is an\n * explicit empty array (the coordinator's synthesis is LLM-generated;\n * same strict structured-output discipline as the verdict's `critiques`).\n */\n dissent: z.array(_DeliberationDissentSchema),\n});\nexport const DeliberationSynthesisSchema: typeof _DeliberationSynthesisSchema =\n _DeliberationSynthesisSchema;\nexport type DeliberationSynthesis = z.infer<typeof _DeliberationSynthesisSchema>;\n\n/**\n * DETERMINISTIC lens accounting for the winner — computed by the machinery from the\n * final round's verdicts, never asked of a model.\n *\n * The floor and the coverage rules guarantee the winner was scored by every required\n * lens. What they cannot show is HOW those lenses split, and that is the difference\n * between consensus and a bare majority: \"two lenses accepted\" and \"one accepted, one\n * wanted revision\" produce an identical `synthesis`, because the coordinator writes\n * prose and prose can round a split into agreement.\n *\n * Kept OUT of {@link DeliberationSynthesis} on purpose. That object is model-generated;\n * a count that can be generated is a count that can be wrong, and the whole point here\n * is a number a reader can trust without re-reading every verdict.\n */\nconst _DeliberationConcurrenceSchema = z.object({\n /** The candidate these counts describe. */\n winnerRef: z.string().min(1),\n /** Distinct reviewer lenses that scored the winner. */\n lensCount: z.number().int().min(0),\n /** How those lenses split. Unanimity is `accept === lensCount`. */\n byRecommendation: z.object({\n accept: z.number().int().min(0),\n revise: z.number().int().min(0),\n reject: z.number().int().min(0),\n }),\n});\nexport const DeliberationConcurrenceSchema: typeof _DeliberationConcurrenceSchema =\n _DeliberationConcurrenceSchema;\nexport type DeliberationConcurrence = z.infer<typeof _DeliberationConcurrenceSchema>;\n\n/** Who sat at the table. */\nconst _DeliberationParticipantsSchema = z.object({\n /** The producing agent (image/text generator) — an agent ref, not a charter. */\n producerAgentRef: z.string().min(1),\n /** The reviewing experts' charter refs (the panel). */\n reviewerCharterRefs: z.array(z.string().min(1)).min(1),\n /** The coordinating expert's charter ref (synthesis + shortlist + convergence). */\n coordinatorCharterRef: z.string().min(1),\n});\nexport const DeliberationParticipantsSchema: typeof _DeliberationParticipantsSchema =\n _DeliberationParticipantsSchema;\nexport type DeliberationParticipants = z.infer<typeof _DeliberationParticipantsSchema>;\n\n/** The human decision over an advisory synthesis (the actual authority). */\nconst _DeliberationHumanDecisionSchema = z.object({\n /** What the human decided (accepted ref, override, or rejection note). */\n decision: z.string().min(1),\n /** ISO-8601 decision moment. */\n decidedAt: z.iso.datetime(),\n});\nexport const DeliberationHumanDecisionSchema: typeof _DeliberationHumanDecisionSchema =\n _DeliberationHumanDecisionSchema;\nexport type DeliberationHumanDecision = z.infer<typeof _DeliberationHumanDecisionSchema>;\n\n/**\n * The full minutes of one deliberation — rubric (embedded, constant),\n * participants, every round with every verdict, the synthesis, and the\n * human decision seam.\n *\n * PERSISTENCE: a deliberation is a BUILD-TIME companion artifact. The\n * engine machinery RETURNS this record and never persists it; the\n * companion writes it to its staging area\n * (`.wildo-saas/generated/deliberations/`). It is deliberately NOT hosted\n * on the flows-actors execution resources (`user`/`organization`/`applicationFlowActorExecutions`)\n * — those are scope-owned RUNTIME data (conversational history), the wrong tier\n * for build-time creative decisions.\n */\nconst _DeliberationRecordSchema = z.object({\n /** Unique deliberation id (companion-minted). */\n deliberationRef: z.string().min(1),\n /** The work domain deliberated. */\n workDomain: z.enum(ExpertWorkDomain),\n /**\n * The candidate payload modality. Drives the revision path: TEXT\n * revises the draft; IMAGE regenerates with a critique addendum (the\n * image transport has no edit operation). Other kinds are fail-closed\n * at execution until they have honest transports.\n */\n subjectKind: z.enum(FlowsActors_IO_PartKind),\n /** The derived rubric (embedded; constant across this record's rounds). */\n rubric: _EvaluationRubricSchema,\n participants: _DeliberationParticipantsSchema,\n /** The rounds, in order. Appended as the deliberation progresses. */\n rounds: z.array(_DeliberationRoundSchema).default([]),\n /**\n * Deterministic lens accounting for the winner, beside the synthesis it describes.\n * Absent exactly when `synthesis` is.\n */\n concurrence: _DeliberationConcurrenceSchema.optional(),\n /** The coordinator's synthesis (absent while RUNNING, on FAILED, and on REJECTED — a rejected field has no winner to synthesise). */\n synthesis: _DeliberationSynthesisSchema.optional(),\n /** Max rounds before the coordinator must synthesize (cost bound). */\n roundBudget: z.number().int().min(1),\n status: z.enum(DeliberationStatus),\n /**\n * The charters' `inputsDigest`s at deliberation time — lets an audit\n * see a decision was made under a stale persona (keyed by charterRef).\n */\n charterInputsDigests: z.record(z.string(), z.string()).default({}),\n /** The human authority's decision; null until the human acts. */\n humanDecision: _DeliberationHumanDecisionSchema.nullable().default(null),\n /** ISO-8601 timestamps. */\n startedAt: z.iso.datetime(),\n finishedAt: z.iso.datetime().optional(),\n});\nexport const DeliberationRecordSchema: typeof _DeliberationRecordSchema =\n _DeliberationRecordSchema;\nexport type DeliberationRecord = z.infer<typeof _DeliberationRecordSchema>;\n\n//===============================================================\n// LLM-facing pass contracts (deliberation orchestration)\n// ------------------------------------------------------------\n// The schemas HANDED TO THE MODEL by each orchestration pass. They are\n// the stamped-fields-free projections of the record contracts above:\n// identity/provenance fields (charter refs, candidate refs, timestamps,\n// work domain) are stamped DETERMINISTICALLY by the machinery — a model\n// never authors its own audit trail. Flat, all-required (strict\n// structured-output discipline; \"empty\" is []/'' by prompt contract).\n//===============================================================\n\n/**\n * Rubric-derivation pass output: the criteria only. The machinery stamps\n * `workDomain` / `derivedFromCharterRef` / `derivedAt` and validates the\n * assembled rubric through `EvaluationRubricSchema` (unique-ref refine).\n */\nconst _DeliberationRubricOutputSchema = z.object({\n criteria: z.array(_EvaluationCriterionSchema).min(1),\n});\nexport const DeliberationRubricOutputSchema: typeof _DeliberationRubricOutputSchema =\n _DeliberationRubricOutputSchema;\nexport type DeliberationRubricOutput = z.infer<typeof _DeliberationRubricOutputSchema>;\nconst _DeliberationRubricOutputStrictSchema = z.object({\n criteria: z.array(_EvaluationCriterionSchema.strict()).min(1),\n}).strict();\nexport const DeliberationRubricOutputStrictSchema: typeof _DeliberationRubricOutputStrictSchema =\n _DeliberationRubricOutputStrictSchema;\n\n/** One wire-level score entry inside {@link DeliberationReviewWireOutput}. */\nexport interface DeliberationReviewWireScore {\n /** 0–100 against the criterion's scale anchors. */\n score: number;\n /** One crisp sentence grounding the score in what was observed. */\n note: string;\n}\n\n/**\n * Review pass output as it crosses the LLM wire: `RubricVerdict` minus the\n * stamped identity fields, with `scores` as an OBJECT keyed by criterion ref.\n */\nexport interface DeliberationReviewWireOutput {\n scores: Record<string, DeliberationReviewWireScore>;\n recommendation: DeliberationRecommendation;\n critiques: RubricCritique[];\n overallNote: string;\n}\n\n/**\n * Build the PER-RUN review wire schema for one rubric: `scores` is a strict\n * object with EXACTLY the rubric's criterion refs as required keys.\n *\n * Why per-run instead of a static array-of-scores contract: the rubric is\n * per-run DATA (derived at deliberation start), and an array `scores` shape\n * leaves the \"one score per criterion\" invariant to the model's discipline —\n * live runs showed a ~25% first-attempt rejection rate from DUPLICATED\n * criterion entries (the model restating the criterion it cared most about;\n * 3/12 reviews on 2026-07-17, each burning a full vision-call retry). Keying\n * the object by the exact refs makes duplicates and omissions STRUCTURALLY\n * impossible at the decode layer instead of prompt-begged. The machinery\n * reshapes the record into the array-shaped `RubricVerdict` for storage and\n * still runs `validateVerdictCriterionRefs` as the belt-and-braces invariant.\n *\n * The schema is `.strict()` end-to-end (hallucinated refs fail decode) and\n * all-required (strict structured-output transports reject optionals).\n */\nexport function buildDeliberationReviewWireSchema(\n rubric: EvaluationRubric,\n): z.ZodType<DeliberationReviewWireOutput> {\n const scoreValue = z.object({\n score: z.number().min(0).max(100),\n note: z.string().min(1),\n }).strict();\n const scoresShape = Object.fromEntries(\n rubric.criteria.map((criterion) => [criterion.ref, scoreValue]),\n );\n return z.object({\n scores: z.object(scoresShape).strict(),\n recommendation: z.enum(DeliberationRecommendation),\n critiques: z.array(_RubricCritiqueSchema.strict()),\n overallNote: z.string().min(1),\n }).strict() as unknown as z.ZodType<DeliberationReviewWireOutput>;\n}\n\n/** The coordinator's per-round directive. */\nexport enum DeliberationRoundDirective {\n /** The outcome is settled — proceed to synthesis (converged). */\n FINALIZE = \"finalize\",\n /** Shortlist the strongest candidates and run a revision round. */\n REVISE_SHORTLIST = \"revise_shortlist\",\n}\n\n/**\n * Coordinator round pass output. On `FINALIZE`, `shortlistRefs` is an\n * explicit empty array (prompt contract). The machinery validates\n * `shortlistRefs` ⊆ the round's candidate refs and caps it at the plan's\n * shortlist size — an invalid echo falls back to the top-K by\n * deterministic aggregate.\n */\nconst _DeliberationCoordinatorRoundOutputSchema = z.object({\n directive: z.enum(DeliberationRoundDirective),\n /** The candidates to revise next round (empty on FINALIZE). */\n shortlistRefs: z.array(z.string().min(1)),\n /** Why this directive, grounded in the verdicts. */\n rationale: z.string().min(1),\n});\nexport const DeliberationCoordinatorRoundOutputSchema: typeof _DeliberationCoordinatorRoundOutputSchema =\n _DeliberationCoordinatorRoundOutputSchema;\nexport type DeliberationCoordinatorRoundOutput = z.infer<typeof _DeliberationCoordinatorRoundOutputSchema>;\nconst _DeliberationCoordinatorRoundOutputStrictSchema =\n _DeliberationCoordinatorRoundOutputSchema.strict();\nexport const DeliberationCoordinatorRoundOutputStrictSchema: typeof _DeliberationCoordinatorRoundOutputStrictSchema =\n _DeliberationCoordinatorRoundOutputStrictSchema;\n\n// The synthesis pass hands `DeliberationSynthesisSchema` itself to the model\n// (it is already flat + all-required); the machinery validates `winnerRef`\n// against the final candidate set (fallback: top deterministic aggregate)\n// and filters dissent entries to known reviewer charter refs.\nconst _DeliberationSynthesisStrictSchema = z.object({\n winnerRef: z.string().min(1),\n rationale: z.string().min(1),\n dissent: z.array(_DeliberationDissentSchema.strict()),\n}).strict();\nexport const DeliberationSynthesisStrictSchema: typeof _DeliberationSynthesisStrictSchema =\n _DeliberationSynthesisStrictSchema;\n\n//===============================================================\n// Deliberation plan (engine-machinery input — TS types, not Zod:\n// the plan carries a live PRODUCER CALLBACK)\n//===============================================================\n\n/**\n * A candidate's payload as the machinery consumes it (kind-discriminated).\n *\n * STRUCTURED exists because some subjects a panel must judge are DATA, not prose\n * or pixels — a placement plan, a schema proposal, a configuration. Serializing\n * such a candidate to text and parsing the winner back was the alternative, and\n * it was rejected: it makes the artifact's shape a prompt-formatting concern and\n * gives the round-trip somewhere to lose a field.\n */\nexport type DeliberationCandidateContent =\n | { kind: FlowsActors_IO_PartKind.TEXT; text: string }\n | { kind: FlowsActors_IO_PartKind.IMAGE; imageDataUri: string }\n | {\n kind: FlowsActors_IO_PartKind.STRUCTURED;\n /** The candidate value itself. This is what wins, and it is what reviewers are shown. */\n value: unknown;\n /**\n * OPTIONAL human-readable framing rendered ABOVE the value — never instead of it.\n *\n * The caller owns domain knowledge the engine does not (what a `groupRef`\n * means, why an order matters), so it may help a reviewer read the data. It\n * may NOT replace the data: a projection can drift from the value it\n * describes, and then the panel scores the prose while the winner is the\n * bytes — real evidence about the wrong target, with a green run concealing\n * it because the conclusion still looks plausible. The engine therefore\n * always renders `value`, and pins that a contradicting projection loses.\n */\n projection?: string;\n };\n\n/** One candidate handed to (or produced for) the machinery. */\nexport interface DeliberationCandidateInput {\n /** Stable candidate ref (unique within the deliberation). */\n ref: string;\n /** Locator the record stores (the caller owns the bytes). */\n storageRef: string;\n content: DeliberationCandidateContent;\n}\n\n/**\n * The CALLER-owned revision producer (RF-2: the engine never persists; the\n * companion owns candidate bytes). The machinery compiles the deterministic\n * `revisionPrompt` from the shortlisted candidate's critiques (RF-4:\n * TEXT revises the draft, IMAGE regenerates — both reduce to \"produce a new\n * candidate from parent + instruction\" at this seam) and the producer\n * returns the NEW candidate (fresh ref + persisted payload).\n */\nexport interface DeliberationProducer {\n produceRevision(\n parent: DeliberationCandidateInput,\n revisionPrompt: string,\n ): Promise<DeliberationCandidateInput>;\n}\n\n/** One expert seat at the table: the runtime profile + the agent built from its charter. */\nexport interface DeliberationExpertBinding {\n profile: RuntimeExpertProfile;\n agentRef: string;\n}\n\n/**\n * The full input of `executeDeliberation` — composed by the COMPANION\n * (which owns charters, agents, candidate bytes, and persistence); the\n * engine machinery owns only the orchestration semantics.\n */\nexport interface DeliberationPlan {\n deliberationRef: string;\n workDomain: ExpertWorkDomain;\n /** TEXT | IMAGE — anything else is fail-closed at execution. */\n subjectKind: FlowsActors_IO_PartKind;\n /** The assembled work-product brief every pass is grounded on. */\n briefContext: string;\n /** The reviewing panel (min 1). Narrowness is enforced by the COMPOSER. */\n reviewers: DeliberationExpertBinding[];\n /** The coordinator (shortlist + convergence + synthesis). */\n coordinator: DeliberationExpertBinding;\n /** The expert who derives the rubric (usually the domain owner). */\n rubricDeriver: DeliberationExpertBinding;\n /** Recorded as `participants.producerAgentRef` (audit). */\n producerAgentRef: string;\n producer: DeliberationProducer;\n initialCandidates: DeliberationCandidateInput[];\n /** Max rounds before forced synthesis (locked default 2, max 3). */\n roundBudget: number;\n /** Top-K candidates revised per round (RF-5 cost funnel). */\n shortlistSize: number;\n /** Participating charters' inputsDigests (staleness audit stamps). */\n charterInputsDigests: Record<string, string>;\n}\n\n//===============================================================\n// Deterministic helpers (never model arithmetic)\n//===============================================================\n\n/**\n * Result of the fail-closed criterion-ref validation of one verdict\n * against the rubric it claims to score.\n */\nexport interface VerdictCriterionRefsValidation {\n /** `true` iff the rubric is well-formed AND the verdict scores EXACTLY its criteria (no more, no less, no dupes). */\n ok: boolean;\n /** Refs in the verdict that do not exist in the rubric (hallucinated). Deduplicated. */\n unknownRefs: string[];\n /** Rubric criteria the verdict did not score. */\n missingRefs: string[];\n /** Refs scored more than once in the verdict. */\n duplicateRefs: string[];\n /**\n * Refs appearing more than once in the RUBRIC itself. The schema's\n * uniqueness refine rejects these at parse time; this re-check is the\n * fail-closed defense for in-process-constructed rubrics that skipped\n * parsing — a duplicated rubric ref would silently DOUBLE-WEIGHT that\n * criterion in the aggregate.\n */\n duplicateRubricRefs: string[];\n}\n\n/**\n * Fail-closed validation that a verdict's scores line up 1:1 with a\n * well-formed rubric's criteria. A verdict with hallucinated, missing, or\n * duplicated refs must be rejected (the machinery retries once with the\n * error surfaced, then drops the reviewer from the round with a quorum\n * note); a malformed rubric (duplicate refs) fails regardless of the\n * verdict.\n */\nexport function validateVerdictCriterionRefs(\n rubric: EvaluationRubric,\n verdict: RubricVerdict,\n): VerdictCriterionRefsValidation {\n const rubricRefs = new Set<string>();\n const duplicateRubricRefs: string[] = [];\n for (const criterion of rubric.criteria) {\n if (rubricRefs.has(criterion.ref) && !duplicateRubricRefs.includes(criterion.ref)) {\n duplicateRubricRefs.push(criterion.ref);\n }\n rubricRefs.add(criterion.ref);\n }\n\n const seen = new Set<string>();\n const unknownRefs: string[] = [];\n const duplicateRefs: string[] = [];\n for (const score of verdict.scores) {\n if (!rubricRefs.has(score.criterionRef) && !unknownRefs.includes(score.criterionRef)) {\n unknownRefs.push(score.criterionRef);\n }\n if (seen.has(score.criterionRef) && !duplicateRefs.includes(score.criterionRef)) {\n duplicateRefs.push(score.criterionRef);\n }\n seen.add(score.criterionRef);\n }\n\n const missingRefs = [...rubricRefs].filter((ref) => !seen.has(ref));\n return {\n ok:\n unknownRefs.length === 0\n && missingRefs.length === 0\n && duplicateRefs.length === 0\n && duplicateRubricRefs.length === 0,\n unknownRefs,\n missingRefs,\n duplicateRefs,\n duplicateRubricRefs,\n };\n}\n\n/**\n * Deterministic weighted aggregate of one verdict against the rubric:\n * `sum(weight_i × score_i) / sum(weight_i)` over the rubric's criteria,\n * on the verdict's 0–100 scale. Model-computed totals are never trusted —\n * this is the ONLY sanctioned aggregation.\n *\n * Throws if the verdict does not validate against the rubric\n * (`validateVerdictCriterionRefs`) — aggregating a malformed verdict\n * would silently misweight; callers must validate (and retry/drop) first.\n */\nexport function aggregateWeightedScore(\n rubric: EvaluationRubric,\n verdict: RubricVerdict,\n): number {\n const validation = validateVerdictCriterionRefs(rubric, verdict);\n if (!validation.ok) {\n throw new Error(\n `Cannot aggregate a verdict that does not match its rubric ` +\n `(unknown: [${validation.unknownRefs.join(\", \")}], ` +\n `missing: [${validation.missingRefs.join(\", \")}], ` +\n `duplicate: [${validation.duplicateRefs.join(\", \")}], ` +\n `duplicate rubric refs: [${validation.duplicateRubricRefs.join(\", \")}]).`,\n );\n }\n\n const scoreByRef = new Map(verdict.scores.map((score) => [score.criterionRef, score.score]));\n let weightedSum = 0;\n let weightSum = 0;\n for (const criterion of rubric.criteria) {\n // Ref alignment is guaranteed by the validation above.\n weightedSum += criterion.weight * (scoreByRef.get(criterion.ref) as number);\n weightSum += criterion.weight;\n }\n return weightedSum / weightSum;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deliberation.shared.schemas.js","sourceRoot":"","sources":["../../../../src/flows-actors/deliberation.shared.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,iEAAiE;AACjE,kDAAkD;AAClD,+DAA+D;AAC/D,oEAAoE;AACpE,uEAAuE;AACvE,qEAAqE;AACrE,qEAAqE;AACrE,WAAW;AACX,EAAE;AACF,mDAAmD;AACnD,yEAAyE;AACzE,qEAAqE;AACrE,sEAAsE;AACtE,oEAAoE;AACpE,YAAY;AACZ,qEAAqE;AACrE,4DAA4D;AAC5D,wEAAwE;AACxE,sEAAsE;AACtE,qEAAqE;AACrE,EAAE;AACF,sEAAsE;AACtE,kEAAkE;AAClE,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,oEAAoE;AACpE,wEAAwE;AACxE,iEAAiE;AACjE,uDAAuD;AACvD,oCAAoC;AACpC,iEAAiE;AAEjE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAN,IAAY,gBAuBX;AAvBD,WAAY,gBAAgB;IAC1B,8DAA8D;IAC9D,2DAAuC,CAAA;IACvC,yEAAyE;IACzE,qDAAiC,CAAA;IACj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S,CAAC,MAAM,GAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAY,CAAC;QAC5E,SAAS,IAAI,SAAS,CAAC,MAAM,CAAC;IAChC,CAAC;IACD,OAAO,WAAW,GAAG,SAAS,CAAC;AACjC,CAAC","sourcesContent":["import { z } from \"zod\";\n\nimport { FlowsActors_IO_PartKind } from \"./flows-actors.io.shared.schemas\";\n\n//===============================================================\n// Expert-Persona Deliberation — shared contracts\n// ------------------------------------------------------------\n// The GENERIC vocabulary of the agentic deliberation system: narrow\n// expert personas (derived per-app from the specification tier) review\n// candidate work products against a DERIVED evaluation rubric across\n// bounded critique-revise rounds, a coordinator synthesizes, a human\n// decides.\n//\n// TIER SPLIT (dependency direction — do not blur):\n// - The DERIVED artifacts (`ExpertRoleTemplate`, `ExpertPersonaCharter`)\n// live in `@wildo-ai/saas-specifications` `_core/expert-personas/`\n// (spec tier — committed, human-reviewable). `saas-backend-lib` can\n// NEVER import them (specifications sits BELOW backend-lib in the\n// graph).\n// - THIS file is the runtime-visible half: the enums the spec family\n// imports (single-sourced here — `ExpertWorkDomain`), the\n// `RuntimeExpertProfile` projection the COMPANION maps a charter into\n// before handing it to engine machinery, and the rubric / verdict /\n// deliberation-record contracts the engine round loop operates on.\n//\n// KEY DESIGN DECISION (the anti-\"taste-as-code\" contract): evaluation\n// CRITERIA ARE DATA, not schema fields. The rubric is derived per\n// deliberation run by an expert persona and travels in the judge PROMPT;\n// the verdict schema below stays FIXED and GENERIC (criterion-ref-keyed\n// score array), so one schema serves every work domain and every derived\n// rubric while remaining strict-structured-output compatible (flat,\n// all-required, no dynamic keys). Weighted aggregation is DETERMINISTIC\n// CODE (`aggregateWeightedScore`) — never model arithmetic — and\n// hallucinated criterion refs are rejected fail-closed\n// (`validateVerdictCriterionRefs`).\n//===============================================================\n\n/**\n * The narrow work-product domain an expert persona is specialized on —\n * the ROUTING AXIS of the narrowness principle. An expert declares a\n * small closed set of domains; the deliberation orchestrator REFUSES to\n * invoke an expert outside its declared domains (fail-closed).\n *\n * Deliberate design: agent personas are NARROW, unlike human employees\n * who wear several hats. A review needing three angles convenes three\n * experts + a coordinator, never one generalist.\n *\n * Single-sourced HERE (the spec-tier `expert-personas` family imports\n * this enum) so the vocabulary cannot drift across tiers. Extend\n * per-capability as new deliberation domains ship — never speculatively.\n */\nexport enum ExpertWorkDomain {\n /** Visual brand marks: logo symbols, icons, brand imagery. */\n VISUAL_BRAND_MARK = \"visual_brand_mark\",\n /** Marketing / product copy: website sections, email prose, taglines. */\n MARKETING_COPY = \"marketing_copy\",\n /** UI/design-system coherence: tokens, palette, typography discipline. */\n UI_DESIGN_COHERENCE = \"ui_design_coherence\",\n /** Brand strategy: positioning fit, differentiation, ICP resonance. */\n BRAND_STRATEGY = \"brand_strategy\",\n /**\n * Information architecture: WHERE a destination, operation or view belongs in\n * the application shell — surface assignment, grouping, ordering, findability.\n *\n * Distinct from {@link UI_DESIGN_COHERENCE}, which is tokens, palette and\n * typography discipline. A settings section can be perfectly on-palette and\n * still be in the wrong place; \"can a user find this, and does it sit with the\n * things it belongs with\" is a different question with a different expert.\n *\n * Added 2026-08-29, when placement became a deliberated decision rather than a\n * framework default — per this enum's rule, per-capability and never\n * speculatively.\n */\n INFORMATION_ARCHITECTURE = \"information_architecture\",\n}\n\n/**\n * A reviewer's headline recommendation for one candidate. Deliberately\n * the same three-state vocabulary as the interim brand accept judge —\n * accept as-is / fixable via revision / materially misses the brief.\n */\nexport enum DeliberationRecommendation {\n /** The candidate satisfies the rubric and can win as-is. */\n ACCEPT = \"accept\",\n /** Close, but has fixable concerns — revise before it can win. */\n REVISE = \"revise\",\n /** Materially misses the rubric — should not survive the shortlist. */\n REJECT = \"reject\",\n}\n\n/** How a candidate entered a round's candidate set. */\nexport enum DeliberationCandidateProvenance {\n /** Produced in round 1 from the creative brief. */\n ORIGINAL = \"original\",\n /** Produced by a critique-driven revision of a prior candidate. */\n REVISED = \"revised\",\n}\n\n/** Terminal + live states of a deliberation. */\nexport enum DeliberationStatus {\n /** Rounds are still executing. */\n RUNNING = \"running\",\n /** The coordinator judged the outcome converged before budget. */\n CONVERGED = \"converged\",\n /** The round budget was exhausted; synthesis used the last round. */\n BUDGET_EXHAUSTED = \"budget_exhausted\",\n /** The deliberation could not complete (provider/validation failure). */\n FAILED = \"failed\",\n /**\n * Every candidate was REJECTED by the panel. There is no winner, and that is a\n * RESULT — not a failure.\n *\n * Distinct from {@link FAILED}, which means the machinery could not complete;\n * here it completed and the answer is \"none of these\". Distinct from\n * {@link CONVERGED}, which asserts a winner. Collapsing rejection into either\n * would be the defect this state exists to remove: a coordinator asked to pick a\n * winner will pick one, so without a terminal rejection the least-bad candidate\n * of a uniformly rejected field lands carrying the panel's authority.\n *\n * A record in this state carries no `synthesis`. The caller decides what to do —\n * retry with a new brief, widen the candidate set, or surface the critiques —\n * because only the caller knows whether \"none of these\" is recoverable.\n */\n REJECTED = \"rejected\",\n}\n\n/**\n * The runtime projection of an `ExpertPersonaCharter` — everything the\n * engine deliberation machinery needs of a persona, WITHOUT importing the\n * spec tier (same pattern as the runtime brand-asset siblings). The\n * COMPANION (which imports both tiers) maps charter → profile when\n * composing a deliberation plan, and builds the expert's agent from it at\n * startup (fail-closed when the charter is missing/unaccepted).\n */\nconst _RuntimeExpertProfileSchema = z.object({\n /** The committed charter this profile projects (audit back-pointer). */\n charterRef: z.string().min(1),\n /** The framework role template the charter was derived from. */\n roleRef: z.string().min(1),\n /** The narrow domains this expert may produce briefs / reviews for. */\n workDomains: z.array(z.enum(ExpertWorkDomain)).min(1),\n /** The compiled app-specific persona prose (\"who I am for THIS app\"). */\n personaProse: z.string().min(1),\n /** Ordered priorities the persona judges by (highest first). */\n priorities: z.array(z.string().min(1)).min(1),\n /** Hard taboos — things this persona must never reward or produce. */\n taboos: z.array(z.string().min(1)).default([]),\n /**\n * What a top-tier candidate looks like for this app (rubric scale-anchor\n * seeds). Mirrors the charter's optional Lever-2 extension.\n */\n qualityBar: z.array(z.string().min(1)).optional(),\n /** The persona's ordered review checks (systematic judging method). */\n reviewProtocol: z.array(z.string().min(1)).optional(),\n});\nexport const RuntimeExpertProfileSchema: typeof _RuntimeExpertProfileSchema =\n _RuntimeExpertProfileSchema;\nexport type RuntimeExpertProfile = z.infer<typeof _RuntimeExpertProfileSchema>;\n\n/**\n * One derived evaluation criterion. `ref` is the join key verdicts score\n * against; `weight` feeds the DETERMINISTIC aggregation (never model\n * arithmetic); `scaleAnchors` pin what the scale ends MEAN so two\n * reviewers score commensurably.\n */\nconst _EvaluationCriterionSchema = z.object({\n /** Stable kebab-case key verdict scores reference (e.g. `favicon-legibility`). */\n ref: z.string().min(1),\n /** What is being evaluated, in one or two sentences. */\n description: z.string().min(1),\n /**\n * Relative importance, > 0 and FINITE. Normalization happens in\n * `aggregateWeightedScore` (weights need not sum to anything);\n * `.finite()` closes the Infinity/Infinity → NaN aggregate hole.\n */\n weight: z.number().positive().finite(),\n /** What the scale extremes mean — pins reviewer calibration. */\n scaleAnchors: z.object({\n /** What a 0 looks like for this criterion. */\n low: z.string().min(1),\n /** What a 100 looks like for this criterion. */\n high: z.string().min(1),\n }),\n});\nexport const EvaluationCriterionSchema: typeof _EvaluationCriterionSchema =\n _EvaluationCriterionSchema;\nexport type EvaluationCriterion = z.infer<typeof _EvaluationCriterionSchema>;\n\n/**\n * The DERIVED rubric a deliberation evaluates against. Derived ONCE at\n * deliberation start by the responsible expert persona (per-run — locked\n * decision), held CONSTANT across that deliberation's rounds (revise\n * targets must not move mid-discussion), and EMBEDDED in the\n * `DeliberationRecord` (auditability without a standalone artifact).\n * Never persisted as its own resource.\n */\nconst _EvaluationRubricSchema = z.object({\n /** The work domain this rubric evaluates. */\n workDomain: z.enum(ExpertWorkDomain),\n /** The charter of the expert who derived the rubric. */\n derivedFromCharterRef: z.string().min(1),\n /** The derived criteria (the DATA that replaces hardcoded score fields). */\n criteria: z.array(_EvaluationCriterionSchema).min(1),\n /** ISO-8601 derivation moment. */\n derivedAt: z.iso.datetime(),\n}).refine(\n (rubric) => new Set(rubric.criteria.map((criterion) => criterion.ref)).size === rubric.criteria.length,\n {\n // The rubric is LLM-DERIVED data — a model emitting the same ref twice\n // (with different weights) is a plausible output, and a duplicated ref\n // would silently DOUBLE-WEIGHT that criterion in the aggregate. Reject\n // at parse; `validateVerdictCriterionRefs` re-checks as defense for\n // in-process-constructed rubrics that skipped parsing.\n message: 'criteria[].ref must be unique — a duplicated ref would silently double-weight it in the aggregate.',\n path: ['criteria'],\n },\n);\nexport const EvaluationRubricSchema: typeof _EvaluationRubricSchema =\n _EvaluationRubricSchema;\nexport type EvaluationRubric = z.infer<typeof _EvaluationRubricSchema>;\n\n/**\n * One criterion score inside a verdict. `criterionRef` MUST match a\n * rubric criterion — enforced fail-closed by\n * `validateVerdictCriterionRefs` (a hallucinated ref rejects the verdict,\n * one retry with the error surfaced, then the reviewer is dropped from\n * the round with a quorum note).\n */\nconst _RubricScoreSchema = z.object({\n /** The rubric criterion this score answers. */\n criterionRef: z.string().min(1),\n /** 0–100 against the criterion's scale anchors. */\n score: z.number().min(0).max(100),\n /** One crisp sentence grounding the score in what was observed. */\n note: z.string().min(1),\n});\nexport const RubricScoreSchema: typeof _RubricScoreSchema = _RubricScoreSchema;\nexport type RubricScore = z.infer<typeof _RubricScoreSchema>;\n\n/**\n * One actionable critique inside a verdict — the REVISION FUEL. The\n * producer's revise step compiles the shortlist's critiques into the\n * revision (text: rewrite the draft; image: a regeneration prompt\n * addendum — the image transport has no edit operation).\n */\nconst _RubricCritiqueSchema = z.object({\n /** Which aspect of the candidate the critique targets. */\n targetAspect: z.string().min(1),\n /** What is wrong, grounded in the rubric/persona view. */\n critique: z.string().min(1),\n /** The concrete change that would address it. */\n suggestion: z.string().min(1),\n});\nexport const RubricCritiqueSchema: typeof _RubricCritiqueSchema =\n _RubricCritiqueSchema;\nexport type RubricCritique = z.infer<typeof _RubricCritiqueSchema>;\n\n/**\n * One reviewer's verdict on one candidate — the GENERIC,\n * strict-structured-output-safe judge contract (flat, all-required,\n * ref-keyed; \"nothing to report\" is an empty array, never an absent key).\n * This is the schema handed to the LLM; the rubric it scores against\n * travels in the PROMPT.\n */\nconst _RubricVerdictSchema = z.object({\n /** The reviewing expert's charter ref. */\n reviewerCharterRef: z.string().min(1),\n /** The candidate under review. */\n candidateRef: z.string().min(1),\n /** One score per rubric criterion (validated fail-closed, both ways). */\n scores: z.array(_RubricScoreSchema).min(1),\n /** Headline recommendation. */\n recommendation: z.enum(DeliberationRecommendation),\n /**\n * Actionable critiques (revision fuel). REQUIRED — \"no critiques\" is an\n * explicit empty array, never an absent key: this schema is handed to the\n * LLM, and the strict structured-output transport rejects any non-required\n * property (a `.default()` would emit one). The prompt contract mandates\n * `[]`, not the schema.\n */\n critiques: z.array(_RubricCritiqueSchema),\n /** The reviewer's overall reading of the candidate, one short paragraph. */\n overallNote: z.string().min(1),\n});\nexport const RubricVerdictSchema: typeof _RubricVerdictSchema =\n _RubricVerdictSchema;\nexport type RubricVerdict = z.infer<typeof _RubricVerdictSchema>;\n\n/**\n * One candidate as it exists inside a round's candidate set — a\n * DISCRIMINATED UNION on `provenance` so the audit invariant is enforced by\n * the schema, not by convention: a `REVISED` candidate MUST carry both\n * `revisedFromRef` and `revisionPrompt` (\"every revision is reproducible\n * from the record\"), while an `ORIGINAL` candidate carries neither.\n */\nconst _DeliberationCandidateOriginalSchema = z.object({\n /** Stable candidate ref (unique within the deliberation). */\n ref: z.string().min(1),\n /** Produced in round 1 from the creative brief. */\n provenance: z.literal(DeliberationCandidateProvenance.ORIGINAL),\n /**\n * Where the candidate's payload lives (staging-relative path or\n * artifact locator). The record stores locators, never payload bytes.\n */\n storageRef: z.string().min(1),\n});\nconst _DeliberationCandidateRevisedSchema = z.object({\n /** Stable candidate ref (unique within the deliberation). */\n ref: z.string().min(1),\n /** Produced by a critique-driven revision of a prior candidate. */\n provenance: z.literal(DeliberationCandidateProvenance.REVISED),\n /** The candidate this one revises. REQUIRED for revisions. */\n revisedFromRef: z.string().min(1),\n /**\n * The compiled revision instruction (text) or regeneration prompt\n * (image) — REQUIRED so every revision is reproducible from the record.\n */\n revisionPrompt: z.string().min(1),\n /** Where the candidate's payload lives (locator, never bytes). */\n storageRef: z.string().min(1),\n});\nconst _DeliberationCandidateSchema = z.discriminatedUnion('provenance', [\n _DeliberationCandidateOriginalSchema,\n _DeliberationCandidateRevisedSchema,\n]);\nexport const DeliberationCandidateSchema: typeof _DeliberationCandidateSchema =\n _DeliberationCandidateSchema;\nexport type DeliberationCandidate = z.infer<typeof _DeliberationCandidateSchema>;\n\n/**\n * One critique-revise round: the candidate set reviewed, every verdict\n * collected, and the coordinator's shortlist (the COST SPINE — round 1\n * reviews the full set, the coordinator shortlists top-K, rounds 2+\n * operate on the shortlist only; the panel never re-litigates eliminated\n * options).\n */\nconst _DeliberationRoundSchema = z.object({\n /** 1-based round number. */\n roundNumber: z.number().int().min(1),\n /** The candidates reviewed this round. */\n candidateSet: z.array(_DeliberationCandidateSchema).min(1),\n /** Every reviewer verdict collected this round (dissent preserved). */\n verdicts: z.array(_RubricVerdictSchema),\n /** The coordinator's shortlist feeding the next round (absent on the final round). */\n shortlistRefs: z.array(z.string().min(1)).optional(),\n});\nexport const DeliberationRoundSchema: typeof _DeliberationRoundSchema =\n _DeliberationRoundSchema;\nexport type DeliberationRound = z.infer<typeof _DeliberationRoundSchema>;\n\n/** A dissenting position preserved in the synthesis (never averaged away). */\nconst _DeliberationDissentSchema = z.object({\n /** The dissenting expert's charter ref. */\n charterRef: z.string().min(1),\n /** The dissenting position, in the expert's own terms. */\n position: z.string().min(1),\n});\nexport const DeliberationDissentSchema: typeof _DeliberationDissentSchema =\n _DeliberationDissentSchema;\nexport type DeliberationDissent = z.infer<typeof _DeliberationDissentSchema>;\n\n/**\n * The coordinator's synthesis — the \"manager's\" decision over the panel:\n * a winner, the grounded rationale, and every preserved dissent.\n * ADVISORY: the human decision seam on the record is the authority.\n */\nconst _DeliberationSynthesisSchema = z.object({\n /** The winning candidate ref. */\n winnerRef: z.string().min(1),\n /** Why the winner beats the field, grounded in verdicts + rubric. */\n rationale: z.string().min(1),\n /**\n * Dissenting positions, preserved verbatim. REQUIRED — unanimity is an\n * explicit empty array (the coordinator's synthesis is LLM-generated;\n * same strict structured-output discipline as the verdict's `critiques`).\n */\n dissent: z.array(_DeliberationDissentSchema),\n});\nexport const DeliberationSynthesisSchema: typeof _DeliberationSynthesisSchema =\n _DeliberationSynthesisSchema;\nexport type DeliberationSynthesis = z.infer<typeof _DeliberationSynthesisSchema>;\n\n/**\n * DETERMINISTIC lens accounting for the winner — computed by the machinery from the\n * final round's verdicts, never asked of a model.\n *\n * The floor and the coverage rules guarantee the winner was scored by every required\n * lens. What they cannot show is HOW those lenses split, and that is the difference\n * between consensus and a bare majority: \"two lenses accepted\" and \"one accepted, one\n * wanted revision\" produce an identical `synthesis`, because the coordinator writes\n * prose and prose can round a split into agreement.\n *\n * Kept OUT of {@link DeliberationSynthesis} on purpose. That object is model-generated;\n * a count that can be generated is a count that can be wrong, and the whole point here\n * is a number a reader can trust without re-reading every verdict.\n */\nconst _DeliberationConcurrenceSchema = z.object({\n /** The candidate these counts describe. */\n winnerRef: z.string().min(1),\n /** Distinct reviewer lenses that scored the winner. */\n lensCount: z.number().int().min(0),\n /** How those lenses split. Unanimity is `accept === lensCount`. */\n byRecommendation: z.object({\n accept: z.number().int().min(0),\n revise: z.number().int().min(0),\n reject: z.number().int().min(0),\n }),\n});\nexport const DeliberationConcurrenceSchema: typeof _DeliberationConcurrenceSchema =\n _DeliberationConcurrenceSchema;\nexport type DeliberationConcurrence = z.infer<typeof _DeliberationConcurrenceSchema>;\n\n/** Who sat at the table. */\nconst _DeliberationParticipantsSchema = z.object({\n /** The producing agent (image/text generator) — an agent ref, not a charter. */\n producerAgentRef: z.string().min(1),\n /** The reviewing experts' charter refs (the panel). */\n reviewerCharterRefs: z.array(z.string().min(1)).min(1),\n /** The coordinating expert's charter ref (synthesis + shortlist + convergence). */\n coordinatorCharterRef: z.string().min(1),\n});\nexport const DeliberationParticipantsSchema: typeof _DeliberationParticipantsSchema =\n _DeliberationParticipantsSchema;\nexport type DeliberationParticipants = z.infer<typeof _DeliberationParticipantsSchema>;\n\n/** The human decision over an advisory synthesis (the actual authority). */\nconst _DeliberationHumanDecisionSchema = z.object({\n /** What the human decided (accepted ref, override, or rejection note). */\n decision: z.string().min(1),\n /** ISO-8601 decision moment. */\n decidedAt: z.iso.datetime(),\n});\nexport const DeliberationHumanDecisionSchema: typeof _DeliberationHumanDecisionSchema =\n _DeliberationHumanDecisionSchema;\nexport type DeliberationHumanDecision = z.infer<typeof _DeliberationHumanDecisionSchema>;\n\n/**\n * The full minutes of one deliberation — rubric (embedded, constant),\n * participants, every round with every verdict, the synthesis, and the\n * human decision seam.\n *\n * PERSISTENCE: a deliberation is a BUILD-TIME companion artifact. The\n * engine machinery RETURNS this record and never persists it; the\n * companion writes it to its staging area\n * (`.wildo-saas/generated/deliberations/`). It is deliberately NOT hosted\n * on the flows-actors execution resources (`user`/`organization`/`applicationFlowActorExecutions`)\n * — those are scope-owned RUNTIME data (conversational history), the wrong tier\n * for build-time creative decisions.\n */\nconst _DeliberationRecordSchema = z.object({\n /** Unique deliberation id (companion-minted). */\n deliberationRef: z.string().min(1),\n /** The work domain deliberated. */\n workDomain: z.enum(ExpertWorkDomain),\n /**\n * The candidate payload modality. Drives the revision path: TEXT\n * revises the draft; IMAGE regenerates with a critique addendum (the\n * image transport has no edit operation). Other kinds are fail-closed\n * at execution until they have honest transports.\n */\n subjectKind: z.enum(FlowsActors_IO_PartKind),\n /** The derived rubric (embedded; constant across this record's rounds). */\n rubric: _EvaluationRubricSchema,\n participants: _DeliberationParticipantsSchema,\n /** The rounds, in order. Appended as the deliberation progresses. */\n rounds: z.array(_DeliberationRoundSchema).default([]),\n /**\n * Deterministic lens accounting for the winner, beside the synthesis it describes.\n * Absent exactly when `synthesis` is.\n */\n concurrence: _DeliberationConcurrenceSchema.optional(),\n /** The coordinator's synthesis (absent while RUNNING, on FAILED, and on REJECTED — a rejected field has no winner to synthesise). */\n synthesis: _DeliberationSynthesisSchema.optional(),\n /** Max rounds before the coordinator must synthesize (cost bound). */\n roundBudget: z.number().int().min(1),\n status: z.enum(DeliberationStatus),\n /** The human authority's decision; null until the human acts. */\n humanDecision: _DeliberationHumanDecisionSchema.nullable().default(null),\n /** ISO-8601 timestamps. */\n startedAt: z.iso.datetime(),\n finishedAt: z.iso.datetime().optional(),\n});\nexport const DeliberationRecordSchema: typeof _DeliberationRecordSchema =\n _DeliberationRecordSchema;\nexport type DeliberationRecord = z.infer<typeof _DeliberationRecordSchema>;\n\n//===============================================================\n// LLM-facing pass contracts (deliberation orchestration)\n// ------------------------------------------------------------\n// The schemas HANDED TO THE MODEL by each orchestration pass. They are\n// the stamped-fields-free projections of the record contracts above:\n// identity/provenance fields (charter refs, candidate refs, timestamps,\n// work domain) are stamped DETERMINISTICALLY by the machinery — a model\n// never authors its own audit trail. Flat, all-required (strict\n// structured-output discipline; \"empty\" is []/'' by prompt contract).\n//===============================================================\n\n/**\n * Rubric-derivation pass output: the criteria only. The machinery stamps\n * `workDomain` / `derivedFromCharterRef` / `derivedAt` and validates the\n * assembled rubric through `EvaluationRubricSchema` (unique-ref refine).\n */\nconst _DeliberationRubricOutputSchema = z.object({\n criteria: z.array(_EvaluationCriterionSchema).min(1),\n});\nexport const DeliberationRubricOutputSchema: typeof _DeliberationRubricOutputSchema =\n _DeliberationRubricOutputSchema;\nexport type DeliberationRubricOutput = z.infer<typeof _DeliberationRubricOutputSchema>;\nconst _DeliberationRubricOutputStrictSchema = z.object({\n criteria: z.array(_EvaluationCriterionSchema.strict()).min(1),\n}).strict();\nexport const DeliberationRubricOutputStrictSchema: typeof _DeliberationRubricOutputStrictSchema =\n _DeliberationRubricOutputStrictSchema;\n\n/** One wire-level score entry inside {@link DeliberationReviewWireOutput}. */\nexport interface DeliberationReviewWireScore {\n /** 0–100 against the criterion's scale anchors. */\n score: number;\n /** One crisp sentence grounding the score in what was observed. */\n note: string;\n}\n\n/**\n * Review pass output as it crosses the LLM wire: `RubricVerdict` minus the\n * stamped identity fields, with `scores` as an OBJECT keyed by criterion ref.\n */\nexport interface DeliberationReviewWireOutput {\n scores: Record<string, DeliberationReviewWireScore>;\n recommendation: DeliberationRecommendation;\n critiques: RubricCritique[];\n overallNote: string;\n}\n\n/**\n * Build the PER-RUN review wire schema for one rubric: `scores` is a strict\n * object with EXACTLY the rubric's criterion refs as required keys.\n *\n * Why per-run instead of a static array-of-scores contract: the rubric is\n * per-run DATA (derived at deliberation start), and an array `scores` shape\n * leaves the \"one score per criterion\" invariant to the model's discipline —\n * live runs showed a ~25% first-attempt rejection rate from DUPLICATED\n * criterion entries (the model restating the criterion it cared most about;\n * 3/12 reviews on 2026-07-17, each burning a full vision-call retry). Keying\n * the object by the exact refs makes duplicates and omissions STRUCTURALLY\n * impossible at the decode layer instead of prompt-begged. The machinery\n * reshapes the record into the array-shaped `RubricVerdict` for storage and\n * still runs `validateVerdictCriterionRefs` as the belt-and-braces invariant.\n *\n * The schema is `.strict()` end-to-end (hallucinated refs fail decode) and\n * all-required (strict structured-output transports reject optionals).\n */\nexport function buildDeliberationReviewWireSchema(\n rubric: EvaluationRubric,\n): z.ZodType<DeliberationReviewWireOutput> {\n const scoreValue = z.object({\n score: z.number().min(0).max(100),\n note: z.string().min(1),\n }).strict();\n const scoresShape = Object.fromEntries(\n rubric.criteria.map((criterion) => [criterion.ref, scoreValue]),\n );\n return z.object({\n scores: z.object(scoresShape).strict(),\n recommendation: z.enum(DeliberationRecommendation),\n critiques: z.array(_RubricCritiqueSchema.strict()),\n overallNote: z.string().min(1),\n }).strict() as unknown as z.ZodType<DeliberationReviewWireOutput>;\n}\n\n/** The coordinator's per-round directive. */\nexport enum DeliberationRoundDirective {\n /** The outcome is settled — proceed to synthesis (converged). */\n FINALIZE = \"finalize\",\n /** Shortlist the strongest candidates and run a revision round. */\n REVISE_SHORTLIST = \"revise_shortlist\",\n}\n\n/**\n * Coordinator round pass output. On `FINALIZE`, `shortlistRefs` is an\n * explicit empty array (prompt contract). The machinery validates\n * `shortlistRefs` ⊆ the round's candidate refs and caps it at the plan's\n * shortlist size — an invalid echo falls back to the top-K by\n * deterministic aggregate.\n */\nconst _DeliberationCoordinatorRoundOutputSchema = z.object({\n directive: z.enum(DeliberationRoundDirective),\n /** The candidates to revise next round (empty on FINALIZE). */\n shortlistRefs: z.array(z.string().min(1)),\n /** Why this directive, grounded in the verdicts. */\n rationale: z.string().min(1),\n});\nexport const DeliberationCoordinatorRoundOutputSchema: typeof _DeliberationCoordinatorRoundOutputSchema =\n _DeliberationCoordinatorRoundOutputSchema;\nexport type DeliberationCoordinatorRoundOutput = z.infer<typeof _DeliberationCoordinatorRoundOutputSchema>;\nconst _DeliberationCoordinatorRoundOutputStrictSchema =\n _DeliberationCoordinatorRoundOutputSchema.strict();\nexport const DeliberationCoordinatorRoundOutputStrictSchema: typeof _DeliberationCoordinatorRoundOutputStrictSchema =\n _DeliberationCoordinatorRoundOutputStrictSchema;\n\n// The synthesis pass hands `DeliberationSynthesisSchema` itself to the model\n// (it is already flat + all-required); the machinery validates `winnerRef`\n// against the final candidate set (fallback: top deterministic aggregate)\n// and filters dissent entries to known reviewer charter refs.\nconst _DeliberationSynthesisStrictSchema = z.object({\n winnerRef: z.string().min(1),\n rationale: z.string().min(1),\n dissent: z.array(_DeliberationDissentSchema.strict()),\n}).strict();\nexport const DeliberationSynthesisStrictSchema: typeof _DeliberationSynthesisStrictSchema =\n _DeliberationSynthesisStrictSchema;\n\n//===============================================================\n// Deliberation plan (engine-machinery input — TS types, not Zod:\n// the plan carries a live PRODUCER CALLBACK)\n//===============================================================\n\n/**\n * A candidate's payload as the machinery consumes it (kind-discriminated).\n *\n * STRUCTURED exists because some subjects a panel must judge are DATA, not prose\n * or pixels — a placement plan, a schema proposal, a configuration. Serializing\n * such a candidate to text and parsing the winner back was the alternative, and\n * it was rejected: it makes the artifact's shape a prompt-formatting concern and\n * gives the round-trip somewhere to lose a field.\n */\nexport type DeliberationCandidateContent =\n | { kind: FlowsActors_IO_PartKind.TEXT; text: string }\n | { kind: FlowsActors_IO_PartKind.IMAGE; imageDataUri: string }\n | {\n kind: FlowsActors_IO_PartKind.STRUCTURED;\n /** The candidate value itself. This is what wins, and it is what reviewers are shown. */\n value: unknown;\n /**\n * OPTIONAL human-readable framing rendered ABOVE the value — never instead of it.\n *\n * The caller owns domain knowledge the engine does not (what a `groupRef`\n * means, why an order matters), so it may help a reviewer read the data. It\n * may NOT replace the data: a projection can drift from the value it\n * describes, and then the panel scores the prose while the winner is the\n * bytes — real evidence about the wrong target, with a green run concealing\n * it because the conclusion still looks plausible. The engine therefore\n * always renders `value`, and pins that a contradicting projection loses.\n */\n projection?: string;\n };\n\n/** One candidate handed to (or produced for) the machinery. */\nexport interface DeliberationCandidateInput {\n /** Stable candidate ref (unique within the deliberation). */\n ref: string;\n /** Locator the record stores (the caller owns the bytes). */\n storageRef: string;\n content: DeliberationCandidateContent;\n}\n\n/**\n * The CALLER-owned revision producer (RF-2: the engine never persists; the\n * companion owns candidate bytes). The machinery compiles the deterministic\n * `revisionPrompt` from the shortlisted candidate's critiques (RF-4:\n * TEXT revises the draft, IMAGE regenerates — both reduce to \"produce a new\n * candidate from parent + instruction\" at this seam) and the producer\n * returns the NEW candidate (fresh ref + persisted payload).\n */\nexport interface DeliberationProducer {\n produceRevision(\n parent: DeliberationCandidateInput,\n revisionPrompt: string,\n ): Promise<DeliberationCandidateInput>;\n}\n\n/** One expert seat at the table: the runtime profile + the agent built from its charter. */\nexport interface DeliberationExpertBinding {\n profile: RuntimeExpertProfile;\n agentRef: string;\n}\n\n/**\n * The full input of `executeDeliberation` — composed by the COMPANION\n * (which owns charters, agents, candidate bytes, and persistence); the\n * engine machinery owns only the orchestration semantics.\n */\nexport interface DeliberationPlan {\n deliberationRef: string;\n workDomain: ExpertWorkDomain;\n /** TEXT | IMAGE — anything else is fail-closed at execution. */\n subjectKind: FlowsActors_IO_PartKind;\n /** The assembled work-product brief every pass is grounded on. */\n briefContext: string;\n /** The reviewing panel (min 1). Narrowness is enforced by the COMPOSER. */\n reviewers: DeliberationExpertBinding[];\n /** The coordinator (shortlist + convergence + synthesis). */\n coordinator: DeliberationExpertBinding;\n /** The expert who derives the rubric (usually the domain owner). */\n rubricDeriver: DeliberationExpertBinding;\n /** Recorded as `participants.producerAgentRef` (audit). */\n producerAgentRef: string;\n producer: DeliberationProducer;\n initialCandidates: DeliberationCandidateInput[];\n /** Max rounds before forced synthesis (locked default 2, max 3). */\n roundBudget: number;\n /** Top-K candidates revised per round (RF-5 cost funnel). */\n shortlistSize: number;\n}\n\n//===============================================================\n// Deterministic helpers (never model arithmetic)\n//===============================================================\n\n/**\n * Result of the fail-closed criterion-ref validation of one verdict\n * against the rubric it claims to score.\n */\nexport interface VerdictCriterionRefsValidation {\n /** `true` iff the rubric is well-formed AND the verdict scores EXACTLY its criteria (no more, no less, no dupes). */\n ok: boolean;\n /** Refs in the verdict that do not exist in the rubric (hallucinated). Deduplicated. */\n unknownRefs: string[];\n /** Rubric criteria the verdict did not score. */\n missingRefs: string[];\n /** Refs scored more than once in the verdict. */\n duplicateRefs: string[];\n /**\n * Refs appearing more than once in the RUBRIC itself. The schema's\n * uniqueness refine rejects these at parse time; this re-check is the\n * fail-closed defense for in-process-constructed rubrics that skipped\n * parsing — a duplicated rubric ref would silently DOUBLE-WEIGHT that\n * criterion in the aggregate.\n */\n duplicateRubricRefs: string[];\n}\n\n/**\n * Fail-closed validation that a verdict's scores line up 1:1 with a\n * well-formed rubric's criteria. A verdict with hallucinated, missing, or\n * duplicated refs must be rejected (the machinery retries once with the\n * error surfaced, then drops the reviewer from the round with a quorum\n * note); a malformed rubric (duplicate refs) fails regardless of the\n * verdict.\n */\nexport function validateVerdictCriterionRefs(\n rubric: EvaluationRubric,\n verdict: RubricVerdict,\n): VerdictCriterionRefsValidation {\n const rubricRefs = new Set<string>();\n const duplicateRubricRefs: string[] = [];\n for (const criterion of rubric.criteria) {\n if (rubricRefs.has(criterion.ref) && !duplicateRubricRefs.includes(criterion.ref)) {\n duplicateRubricRefs.push(criterion.ref);\n }\n rubricRefs.add(criterion.ref);\n }\n\n const seen = new Set<string>();\n const unknownRefs: string[] = [];\n const duplicateRefs: string[] = [];\n for (const score of verdict.scores) {\n if (!rubricRefs.has(score.criterionRef) && !unknownRefs.includes(score.criterionRef)) {\n unknownRefs.push(score.criterionRef);\n }\n if (seen.has(score.criterionRef) && !duplicateRefs.includes(score.criterionRef)) {\n duplicateRefs.push(score.criterionRef);\n }\n seen.add(score.criterionRef);\n }\n\n const missingRefs = [...rubricRefs].filter((ref) => !seen.has(ref));\n return {\n ok:\n unknownRefs.length === 0\n && missingRefs.length === 0\n && duplicateRefs.length === 0\n && duplicateRubricRefs.length === 0,\n unknownRefs,\n missingRefs,\n duplicateRefs,\n duplicateRubricRefs,\n };\n}\n\n/**\n * Deterministic weighted aggregate of one verdict against the rubric:\n * `sum(weight_i × score_i) / sum(weight_i)` over the rubric's criteria,\n * on the verdict's 0–100 scale. Model-computed totals are never trusted —\n * this is the ONLY sanctioned aggregation.\n *\n * Throws if the verdict does not validate against the rubric\n * (`validateVerdictCriterionRefs`) — aggregating a malformed verdict\n * would silently misweight; callers must validate (and retry/drop) first.\n */\nexport function aggregateWeightedScore(\n rubric: EvaluationRubric,\n verdict: RubricVerdict,\n): number {\n const validation = validateVerdictCriterionRefs(rubric, verdict);\n if (!validation.ok) {\n throw new Error(\n `Cannot aggregate a verdict that does not match its rubric ` +\n `(unknown: [${validation.unknownRefs.join(\", \")}], ` +\n `missing: [${validation.missingRefs.join(\", \")}], ` +\n `duplicate: [${validation.duplicateRefs.join(\", \")}], ` +\n `duplicate rubric refs: [${validation.duplicateRubricRefs.join(\", \")}]).`,\n );\n }\n\n const scoreByRef = new Map(verdict.scores.map((score) => [score.criterionRef, score.score]));\n let weightedSum = 0;\n let weightSum = 0;\n for (const criterion of rubric.criteria) {\n // Ref alignment is guaranteed by the validation above.\n weightedSum += criterion.weight * (scoreByRef.get(criterion.ref) as number);\n weightSum += criterion.weight;\n }\n return weightedSum / weightSum;\n}\n"]}
|
|
@@ -84,6 +84,20 @@ export declare const FlowActorExecution_PausedApprovalSchema: z.ZodObject<{
|
|
|
84
84
|
expiresAt: z.ZodOptional<z.ZodString>;
|
|
85
85
|
}, z.core.$strip>;
|
|
86
86
|
export type FlowActorExecution_PausedApproval = z.infer<typeof FlowActorExecution_PausedApprovalSchema>;
|
|
87
|
+
/**
|
|
88
|
+
* How long a human has to answer an approval-gated tool call before the turn is refused.
|
|
89
|
+
*
|
|
90
|
+
* **24 hours.** An agent pausing for a person should span a working day plus a night, so a request
|
|
91
|
+
* raised late in the afternoon is still answerable the next morning. Much beyond that and the
|
|
92
|
+
* decision stops being meaningful rather than merely late: the person is approving a tool call made
|
|
93
|
+
* against a conversation, a world and an intent that have all moved on, and "do you approve this?"
|
|
94
|
+
* with no memory of the question is a prompt people click through.
|
|
95
|
+
*
|
|
96
|
+
* A framework default rather than an operator knob, for now. If an application ever needs its own,
|
|
97
|
+
* the knob goes beside the consent lifetime in the auth config — but nobody has asked, and a
|
|
98
|
+
* timeout that every application authors identically is a default wearing a config field.
|
|
99
|
+
*/
|
|
100
|
+
export declare const FLOW_ACTOR_APPROVAL_DEFAULT_TIMEOUT_MS: number;
|
|
87
101
|
/** Serialize paused-approval state for the scalar `pausedApproval` string column. */
|
|
88
102
|
export declare function serializeFlowActorPausedApproval(state: FlowActorExecution_PausedApproval): string;
|
|
89
103
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows-actors-execution.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/flows-actors/flows-actors-execution.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAA2E,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAGpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAM5E,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,kDAAkD,CAAC;AAQ1D;;;;;GAKG;AACH,oBAAY,4BAA4B;IACtC,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED;;;;;GAKG;AACH,oBAAY,8BAA8B;IACxC,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED,eAAO,MAAM,gCAAgC;;;;;;;
|
|
1
|
+
{"version":3,"file":"flows-actors-execution.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/flows-actors/flows-actors-execution.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAA2E,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAGpJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAM5E,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,kDAAkD,CAAC;AAQ1D;;;;;GAKG;AACH,oBAAY,4BAA4B;IACtC,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED;;;;;GAKG;AACH,oBAAY,8BAA8B;IACxC,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED,eAAO,MAAM,gCAAgC;;;;;;;iBAwB3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F;;;;;;;GAOG;AACH,eAAO,MAAM,uCAAuC;;;;;;;iBA4ClD,CAAC;AACH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAExG;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sCAAsC,QAAsB,CAAC;AAE1E,qFAAqF;AACrF,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,iCAAiC,GAAG,MAAM,CAEjG;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,iCAAiC,CAE3F;AAuBD;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;iBAoIvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAMlF;;;;;;;;GAQG;AACH,eAAO,MAAM,mCAAmC,EAAE,4BAA4B,EAIvC,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;kBAMpD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;iBAqBjD,CAAC;AAMH;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|
|
@@ -72,8 +72,18 @@ export var FlowsActors_MessageContentType;
|
|
|
72
72
|
export const FlowActorExecution_MessageSchema = z.object({
|
|
73
73
|
/** Stable per-message id (client-correlatable across stream deltas). */
|
|
74
74
|
id: z.uuid(),
|
|
75
|
-
role: z.enum(FlowsActors_ConversationRole)
|
|
76
|
-
|
|
75
|
+
role: z.enum(FlowsActors_ConversationRole)
|
|
76
|
+
.describe('Who produced this message.\n\nValues:\n'
|
|
77
|
+
+ '- `user`: the person, or the client acting for them.\n'
|
|
78
|
+
+ '- `assistant`: the agent.\n'
|
|
79
|
+
+ '- `system`: instructions the agent was given, not part of the conversation a person sees.\n'
|
|
80
|
+
+ '- `tool`: the result of something the agent called.'),
|
|
81
|
+
contentType: z.enum(FlowsActors_MessageContentType).default(FlowsActors_MessageContentType.TEXT)
|
|
82
|
+
.describe('How to render `content`.\n\nValues:\n'
|
|
83
|
+
+ '- `text`: plain text.\n'
|
|
84
|
+
+ '- `markdown`: text with Markdown formatting.\n'
|
|
85
|
+
+ '- `progress`: an interim note about work in flight; `data` carries the detail.\n'
|
|
86
|
+
+ '- `data`: a structured payload rather than prose; read `data`, not `content`.'),
|
|
77
87
|
/** Rendered text content (may be assembled from streamed deltas). */
|
|
78
88
|
content: z.string(),
|
|
79
89
|
/** Structured payload for `DATA`/`PROGRESS` messages (tool results, progress). */
|
|
@@ -117,9 +127,36 @@ export const FlowActorExecution_PausedApprovalSchema = z.object({
|
|
|
117
127
|
pendingToolArgs: z.record(z.string(), z.unknown()).optional(),
|
|
118
128
|
/** ISO timestamp when the approval was requested. */
|
|
119
129
|
requestedAt: z.string(),
|
|
120
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* ISO instant after which the paused turn must not be resumed.
|
|
132
|
+
*
|
|
133
|
+
* SET ON EVERY SUSPENSION since 2026-09-08 (#465). It was declared here, carried on the
|
|
134
|
+
* approval-request WebSocket payload and read and converted by the browser, and NO WRITER EVER SET
|
|
135
|
+
* IT — so a pending approval never expired and the field described a timeout that did not exist.
|
|
136
|
+
*
|
|
137
|
+
* The terminal state on expiry is `FlowsActors_Status.FAILED`, which the status vocabulary already
|
|
138
|
+
* named ("resolves to PROCESSING→COMPLETED on approval, or a terminal state on denial/expiry").
|
|
139
|
+
* Nothing new was invented for it.
|
|
140
|
+
*
|
|
141
|
+
* Still optional: a suspension persisted before that date carries none, and an absent expiry means
|
|
142
|
+
* the pause does not lapse — which is what those turns were paused under.
|
|
143
|
+
*/
|
|
121
144
|
expiresAt: z.string().optional(),
|
|
122
145
|
});
|
|
146
|
+
/**
|
|
147
|
+
* How long a human has to answer an approval-gated tool call before the turn is refused.
|
|
148
|
+
*
|
|
149
|
+
* **24 hours.** An agent pausing for a person should span a working day plus a night, so a request
|
|
150
|
+
* raised late in the afternoon is still answerable the next morning. Much beyond that and the
|
|
151
|
+
* decision stops being meaningful rather than merely late: the person is approving a tool call made
|
|
152
|
+
* against a conversation, a world and an intent that have all moved on, and "do you approve this?"
|
|
153
|
+
* with no memory of the question is a prompt people click through.
|
|
154
|
+
*
|
|
155
|
+
* A framework default rather than an operator knob, for now. If an application ever needs its own,
|
|
156
|
+
* the knob goes beside the consent lifetime in the auth config — but nobody has asked, and a
|
|
157
|
+
* timeout that every application authors identically is a default wearing a config field.
|
|
158
|
+
*/
|
|
159
|
+
export const FLOW_ACTOR_APPROVAL_DEFAULT_TIMEOUT_MS = 24 * 60 * 60 * 1000;
|
|
123
160
|
/** Serialize paused-approval state for the scalar `pausedApproval` string column. */
|
|
124
161
|
export function serializeFlowActorPausedApproval(state) {
|
|
125
162
|
return JSON.stringify(state);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows-actors-execution.shared.schemas.js","sourceRoot":"","sources":["../../../../src/flows-actors/flows-actors-execution.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,OAAO,EAA2E,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACpJ,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAChB,kCAAkC,GACnC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,gCAAgC,GAEjC,MAA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,WAAW,EAAI,qBAAqB,EAAE,kCAAkC,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAI,cAAc,EAAE,IAAI,EAAE;CACxK,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,yBAAyB,CAAC;IACjF,gBAAgB,EAAE,qBAAqB;IACvC,mBAAmB,EAAE,sBAAsB;IAC3C,WAAW,EAAE,uBAAuB;IACpC,UAAU,EAAE,4BAA4B;IACxC,QAAQ,EAAE,mCAAmC;CAC9C,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,MAAM,EAAE,4BAA4B,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;IAC5D,aAAa,EAAE,4BAA4B,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE;IAC1E,QAAQ,EAAE,4BAA4B,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE;IAChE,UAAU,EAAE,4BAA4B,CAAC,KAAK,CAAC,UAAU;IACzD;;;;;;;;;;;;;;OAcG;IACH,cAAc,EAAE,4BAA4B,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE;CAC5E,CAAC,CAAC","sourcesContent":["/**\n * Flows-Actors Execution — Persisted Resource Schema (POLYMORPHIC)\n * ================================================================\n *\n * A persisted record of a single flow/actor **system execution** — in v1 the\n * durable source of truth for a conversational chat log (`messages[]`) plus the\n * execution's lifecycle status.\n *\n * POLYMORPHIC ACROSS OWNER SCOPE. The SAME base envelope is stamped out as THREE\n * genuine single-scope resources by `declarePolymorphicSchemas()`, one owner FK\n * injected per variant:\n * - `userFlowActorExecutions` (USER_SELF — `userId`) ← WS chat + user-delegated A2A\n * - `organizationFlowActorExecutions` (ORGANIZATIONS — `organizationId`) ← org-machine A2A\n * - `applicationFlowActorExecutions` (APPLICATION — `applicationId`) ← app-machine A2A\n *\n * A conversation is owned by EXACTLY ONE scope (its injected owner FK). There is\n * no cross-scope audit dimension on the base — ownership IS the scope. This is the\n * honest \"one concept, N owners\" model (mirrors billing accounts / subscriptions)\n * and needs ZERO core-authorizer change: each variant satisfies its own scope\n * authorizer, and `polymorphicRole` resolves the operation roles per scope. A\n * machine (API key / OIDC client) reaches its org/app variant exactly as it\n * reaches any other org/app resource — standard RBAC via its granted roles.\n *\n * KIND-AGNOSTIC BY DESIGN. A `FlowActorSystem_Kind` discriminant lets the SAME\n * resource persist both flow and actor executions. v1 implements the ACTOR\n * conversational path; the FLOW path drops in without reshaping the base envelope.\n *\n * @see flows-actors.system.shared.schemas.ts — the base execution envelope\n * @see billing-account.shared.schemas.ts — the polymorphic-scope precedent\n * @see requests/websocket.shared.schemas.ts — the streamed message payload this\n * log mirrors (`WS_FlowsActorsMessagePayloadSchema`)\n */\n\nimport { z } from 'zod';\nimport { initZodDecorators, addImpersonalizeWith } from '@wildo-ai/zod-decorators';\n\nimport { FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE, FLOWS_ACTORS_NO_MACHINE_CREDENTIAL, FlowsActors_Status } from './flows-actors.commons.shared.schemas';\nimport { DataPortabilityProvenance } from '../compliance/privacy/subject-export.shared.schemas';\nimport { PersonalDataCategory } from '../compliance/privacy/personal-data-category.shared.schemas';\nimport { FlowActorSystem_Kind } from './flows-actors.system.shared.schemas';\nimport { RedactionType } from '../compliance/privacy/redaction.shared.schemas';\nimport {\n CoreResourceType,\n coreResourceShared_FieldIdentifier,\n} from '../resources/resources.shared.core.definitions';\nimport {\n declarePolymorphicSchemas,\n optOutPolymorphicAutoBusinessKey,\n type PolymorphicVariantDefinition,\n} from '../resources/utils/resource-polymorphism.schemas';\n\ninitZodDecorators(z);\n\n//===============================================================\n// Conversational message log\n//===============================================================\n\n/**\n * Author of a persisted conversational message. `TOOL` records a tool-call /\n * tool-result turn (grounding retrieval); `SYSTEM` records a system/status note.\n * WS-streamed messages are always server→client, so the transport shape carries\n * no role — the persisted log adds it to reconstruct a full transcript.\n */\nexport enum FlowsActors_ConversationRole {\n USER = 'user',\n ASSISTANT = 'assistant',\n SYSTEM = 'system',\n TOOL = 'tool',\n}\n\n/**\n * Rendering hint for a message body. Mirrors the streamed\n * `WS_FlowsActorsMessagePayloadSchema.messageType` literal union exactly\n * (`text | markdown | progress | data`) as an enum so the persisted log and the\n * live stream share one vocabulary (framework rule: enums over literal unions).\n */\nexport enum FlowsActors_MessageContentType {\n TEXT = 'text',\n MARKDOWN = 'markdown',\n PROGRESS = 'progress',\n DATA = 'data',\n}\n\nexport const FlowActorExecution_MessageSchema = z.object({\n /** Stable per-message id (client-correlatable across stream deltas). */\n id: z.uuid(),\n role: z.enum(FlowsActors_ConversationRole),\n contentType: z.enum(FlowsActors_MessageContentType).default(FlowsActors_MessageContentType.TEXT),\n /** Rendered text content (may be assembled from streamed deltas). */\n content: z.string(),\n /** Structured payload for `DATA`/`PROGRESS` messages (tool results, progress). */\n data: z.record(z.string(), z.unknown()).optional(),\n createdAt: z.date().default(() => new Date()),\n});\nexport type FlowActorExecution_Message = z.infer<typeof FlowActorExecution_MessageSchema>;\n\n/**\n * The SUSPENDED-TURN state persisted when an agent turn pauses at a human-in-the-loop\n * approval boundary (execution `status` = `AWAITING_APPROVAL`). It is stored SERIALIZED as a\n * JSON string in the `pausedApproval` scalar field — NOT as a nested Zod object — because heavy\n * nested sub-structures do not round-trip through the Zod→Mongoose embedded-subdocument\n * conversion (see the per-kind state note below). Parse/serialize ONLY via the helpers below at\n * the persistence boundary; the record column itself stays a plain string.\n */\nexport const FlowActorExecution_PausedApprovalSchema = z.object({\n /**\n * Correlates the emitted approval REQUEST with the inbound decision (idempotency key).\n *\n * An OPAQUE identifier minted by the model SDK — NOT a Wildo id and NOT a UUID. It was typed\n * `z.uuid()` on the reasonable-looking assumption that an id is a uuid, and the SDK produces\n * values like `aitxt-3Xfhq68r7GTRXEuV1YzU4eEc`.\n *\n * That single wrong assumption made EVERY paused turn unresumable, and hid completely: serializing\n * is `JSON.stringify` and does not validate, so the pause persisted perfectly; only the resume's\n * `parse` rejected it, as a CORRUPTED blob. The turn then stayed paused forever with a\n * \"state is unreadable\" error naming the wrong cause. Unit fixtures used a real uuid, so they were\n * more conformant than production and could never reproduce it — the live lane found it.\n *\n * Validate it as an opaque non-empty string. We do not own the format and must not assert one.\n */\n approvalId: z.string().min(1),\n /**\n * The AI-SDK model-message array to RESUME from — opaque to us (the SDK's own resume\n * contract). Captured when the approval-gated tool call suspended the stream; on the human\n * decision the runtime appends a tool-approval-response and re-invokes with these messages.\n */\n sdkModelMessages: z.array(z.record(z.string(), z.unknown())),\n /** The approval-gated tool the model wants to call (drives the human-facing prompt). */\n pendingToolName: z.string(),\n /** The pending tool call's arguments (drives the human-facing action description). */\n pendingToolArgs: z.record(z.string(), z.unknown()).optional(),\n /** ISO timestamp when the approval was requested. */\n requestedAt: z.string(),\n /** Optional ISO expiry after which the paused turn is auto-failed. */\n expiresAt: z.string().optional(),\n});\nexport type FlowActorExecution_PausedApproval = z.infer<typeof FlowActorExecution_PausedApprovalSchema>;\n\n/** Serialize paused-approval state for the scalar `pausedApproval` string column. */\nexport function serializeFlowActorPausedApproval(state: FlowActorExecution_PausedApproval): string {\n return JSON.stringify(state);\n}\n\n/**\n * Parse the scalar `pausedApproval` string column back to typed state. Throws (ZodError /\n * SyntaxError) on a malformed blob — a corrupted paused record must fail loudly at resume,\n * never silently resume from garbage.\n */\nexport function parseFlowActorPausedApproval(raw: string): FlowActorExecution_PausedApproval {\n return FlowActorExecution_PausedApprovalSchema.parse(JSON.parse(raw));\n}\n\n//===============================================================\n// Per-kind execution state (reused from the shared execution types)\n//===============================================================\n\n// NOTE (v1 scope): the persisted record is the CONVERSATIONAL envelope only —\n// `kind` + `status`/`statusChanges` + the `messages[]` chat log. The richer\n// per-kind graph-state slots (`flowState` node-states / `actorState` plan+tasks,\n// sliced from `FlowSystem_Execution` / `ActorSystem_Execution`) are intentionally\n// NOT persisted yet: the v1 conversational runtime never writes them, and those\n// heavy nested sub-structures (required `plan`/`walkthrough`/`standaloneTasks`\n// with embedded `_id`s) do not round-trip through the Zod→Mongoose embedded-\n// subdocument conversion as optional slots (empty subdocs get instantiated and\n// fail required-path validation). When the flow/actor orchestration runtime\n// actually produces graph state, add typed `flowState`/`actorState` back WITH the\n// embedded-subdocument treatment (see the zod↔mongoose nested-union / embedded-id\n// notes) rather than a raw `.pick()`. `kind` already preserves discrimination.\n\n//===============================================================\n// Base execution record — NO owner scope FK (injected per variant)\n//===============================================================\n\n/**\n * The conversation envelope shared by every scope variant. It carries NO owner\n * scope FK: `declarePolymorphicSchemas()` injects exactly ONE (`userId` /\n * `organizationId` / `applicationId`) per variant. Do NOT add an `initiator`\n * snapshot here — a nested `initiator.userId`/`.organizationId` collides with the\n * contextual scope filter (it matches the field identifier at every schema path\n * and injects an exact-subdocument clause that never equals the stored snapshot,\n * so every scoped read/update silently matches zero rows). Ownership lives ONLY on\n * the single injected top-level owner FK.\n */\nexport const FlowActorExecutionBaseSchema = z.object({\n /** MongoDB document id — auto-generated / auto-managed (excluded from create). */\n _id: z.string().min(1).isPrimaryKey(),\n\n /**\n * Stable business id of the execution, generated by the conversational runtime\n * and echoed over the WebSocket channel (`WS_FlowsActors*.executionId`). Unique\n * per variant collection (a UUID — no cross-collection collision). Immutable\n * once created.\n */\n executionId: z.uuid().isUnique({ scope: 'global', sparse: false }).excludeFromUpdate().isSummaryField(),\n\n // === System identity (set on create, immutable) ===\n /** Ref of the executed flow/actor system (`FlowActorSystem.ref`). */\n systemRef: z.string().isDBIndexed().excludeFromUpdate().isSummaryField(),\n /** Discriminant selecting which state slot is populated. */\n kind: z.enum(FlowActorSystem_Kind).isDBIndexed().excludeFromUpdate().isSummaryField(),\n\n // === Runtime status ===\n /**\n * WHICH agent this conversation was opened through — part of the read filter, not metadata.\n *\n * The task family carried this from gate #3; executions did not, so a caller holding a\n * `contextId` could continue that thread through a DIFFERENT declared agent and load the prior\n * transcript into the other agent's context. A2A agents are declared as separate resource servers\n * with per-instance token audiences, and the plane at risk here holds the full message log — not\n * a 120-character title (review finding G5-8).\n *\n * The WebSocket surface has no agent, and the default A2A agent is an identity of its own; both\n * store {@link FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE}.\n */\n resourceServerInstanceRef: z.string().min(1).isDBIndexed(),\n\n /**\n * WHICH machine credential opened this conversation — part of the read filter, not metadata.\n *\n * Identical axis and identical reasoning to the task family: the injected scope FK does not\n * identify the principal on the machine variants (`applicationId` is a deployment singleton;\n * `organizationId` is shared by every machine client of one tenant), so without it a\n * separately-credentialed client could read and continue another client's conversation — which\n * carries the full message log, not merely a title.\n *\n * User-delegated turns store {@link FLOWS_ACTORS_NO_MACHINE_CREDENTIAL}: the human is the\n * principal there and the `userId` owner FK already discriminates.\n */\n machineCredentialId: z.string().min(1).isDBIndexed(),\n\n status: z.enum(FlowsActors_Status).isDBIndexed().isSummaryField(),\n statusChanges: z.array(z.object({\n status: z.enum(FlowsActors_Status),\n timestamp: z.date(),\n })).default([]),\n\n // === Conversational log (chat history) ===\n /**\n * The conversation transcript.\n *\n * ## Provenance: SUBJECT_PROVIDED, and the asymmetry is the reason (review finding F5-6)\n *\n * This array MIXES subject-authored turns (`role: USER`) with model-generated ones\n * (`role: ASSISTANT`), and provenance is declared per FIELD — there is no per-element mechanism,\n * so one classification must cover both. The two ways of being wrong are not equally bad:\n *\n * • Classifying DERIVED would EXCLUDE the subject's own words from an Art. 20 bundle. That is a\n * failure of the right the article exists to serve.\n * • Classifying SUBJECT_PROVIDED includes the assistant's replies alongside them. That is\n * over-delivery — but of a transcript the subject was a party to and already saw, which is the\n * natural unit a person means by \"my conversation\".\n *\n * So the classification follows the ASYMMETRY, not a per-element truth we cannot express. Revisit\n * only if per-element provenance ever exists; splitting the array by role at export time was\n * considered and rejected as inventing a second mechanism for one field.\n *\n * ⚠️ **This is a LABELLING change, not a behaviour change**, and the first version of this note\n * failed to say so. `resolvePortabilityFieldScope` maps `SUBJECT_PROVIDED` *and* `OBSERVED` to\n * `INCLUDED`, and the resource default was already `OBSERVED` — so `messages` was in the Art. 20\n * bundle before and after. Nothing about an export changes.\n *\n * The rejected alternative the first version omitted is the one that was actually in force:\n * **`OBSERVED`** — \"data generated by the subject's USE of the service\", a defensible reading of a\n * mixed transcript. It is rejected for precision rather than effect: the USER turns are authored\n * BY the subject, not merely observed of them, and a classification should say the truest thing\n * available even when two values resolve alike today.\n *\n * The task family's `output`/`artifacts` are DERIVED by contrast, and that is not an\n * inconsistency: those are model output ABOUT the work, with no subject-authored content mixed in.\n */\n // RESET on erasure — returns this field to its schema default. It holds the conversation itself,\n // which the category above correctly declares as personal data. RESET rather than REMOVE or MASK\n // because the field is non-nullable WITH a `.default()`: REMOVE needs a clearable field and MASK\n // needs a string. The value comes from the schema, so there is no second copy to drift.\n messages: addImpersonalizeWith(\n FlowActorExecution_MessageSchema.array().default([])\n .portabilityProvenance(DataPortabilityProvenance.SUBJECT_PROVIDED)\n // The conversation itself. Category as well as provenance, so a notice can enumerate it: the two\n // axes answer different questions and a provenance alone leaves the field an OUTSTANDING gap.\n .dataCategories(PersonalDataCategory.USER_CONTENT),\n RedactionType.RESET,\n ),\n\n // === HITL (human-in-the-loop) suspension ===\n /**\n * Serialized {@link FlowActorExecution_PausedApproval} — present ONLY while `status` is\n * `AWAITING_APPROVAL`. A scalar JSON string (see that schema's doc for why it is NOT a nested\n * object: the Zod→Mongoose round-trip). Set on pause, cleared on resume / terminal completion;\n * never authored on create.\n */\n /**\n * Serialized suspended-turn state; `null` once a decision releases the pause.\n *\n * `.nullish()`, not `.optional()`, and the difference is load-bearing at the READ. Clearing writes\n * an explicit `null`; the write then re-parses the row to project its response, and under\n * `.optional()` that projection throws `expected string, received null`. The clear PERSISTS (there\n * is no transaction to roll back) and the operation still fails — so the pause was released and\n * the resume aborted, leaving the turn `failed` with its work never done, reported as a resource\n * transformation error that names nothing about approvals.\n *\n * The input contract needing `.nullish()` (see `FlowActorExecutionUpdateInternalSchema`) is a\n * SEPARATE surface from this one. Fixing only that gets the value written and still throws on the\n * way out — both must admit null or neither does.\n */\n // This blob contains SDK resume messages and pending tool arguments. It is\n // runtime continuation state, not conversation content: generic client reads,\n // summaries and generated API schemas must never disclose it.\n pausedApproval: z.string().nullish().excludeFromCreate().isBackendOnly(),\n\n // === Timing (system-managed; defaults are load-bearing — the create pipeline\n // strips these then date-coerces, so a missing default → Invalid Date) ===\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate().isSummaryField(),\n /** Set on terminal completion (via UPDATE); never on create. */\n finishedAt: z.date().optional().excludeFromCreate().isSummaryField(),\n});\nexport type FlowActorExecutionBase = z.infer<typeof FlowActorExecutionBaseSchema>;\n\n//===============================================================\n// Polymorphic declaration — one owner-scope variant per scope\n//===============================================================\n\n/**\n * The three owner-scope variants a flows-actors execution is stamped out for.\n * Each is `isPrimaryScope: true` (the injected owner FK is the primary scope), and\n * each opts OUT of the singleton auto-business-key: a conversation is MULTI-ROW\n * per scope (many discussions per user/org/app), so the injected owner FK must NOT\n * be marked `.isUnique()` — otherwise the second conversation per scope would fail\n * with a duplicate-key error. Mirrors subscriptions / usage-records / SSO\n * connections (all multi-row polymorphic resources).\n */\nexport const FLOW_ACTOR_EXECUTION_SCOPE_VARIANTS: PolymorphicVariantDefinition[] = [\n { parentResourceType: CoreResourceType.USERS, parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.USERS], isPrimaryScope: true },\n { parentResourceType: CoreResourceType.ORGANIZATIONS, parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.ORGANIZATIONS], isPrimaryScope: true },\n { parentResourceType: CoreResourceType.APPLICATION, parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.APPLICATION], isPrimaryScope: true },\n].map(optOutPolymorphicAutoBusinessKey);\n\n/**\n * Polymorphic declaration for flows-actors executions. Produces 3 variants:\n * - users → `userFlowActorExecutions` (`userId` injected)\n * - organizations→ `organizationFlowActorExecutions` (`organizationId` injected)\n * - applications → `applicationFlowActorExecutions` (`applicationId` injected)\n */\nexport const flowActorExecutionsPolymorphicDeclaration = declarePolymorphicSchemas({\n baseResourceType: 'flowActorExecutions',\n baseFieldIdentifier: 'flowActorExecutionId',\n baseEnumKey: 'FLOW_ACTOR_EXECUTIONS',\n baseSchema: FlowActorExecutionBaseSchema,\n variants: FLOW_ACTOR_EXECUTION_SCOPE_VARIANTS,\n});\n\n/**\n * Owner-agnostic UPDATE DTO — status transitions, appended messages, completion\n * time. Shared across all variants because it references NO owner FK (owner is\n * immutable). `updatedAt` is system-managed; identity fields are `.excludeFromUpdate()`.\n */\nexport const FlowActorExecutionUpdateInternalSchema = z.object({\n status: FlowActorExecutionBaseSchema.shape.status.optional(),\n statusChanges: FlowActorExecutionBaseSchema.shape.statusChanges.optional(),\n messages: FlowActorExecutionBaseSchema.shape.messages.optional(),\n finishedAt: FlowActorExecutionBaseSchema.shape.finishedAt,\n /**\n * The suspended-turn state, written when a turn pauses for a human decision and cleared when one\n * arrives.\n *\n * ⚠️ THIS SCHEMA IS AN ALLOW-LIST, and omitting a field here does not fail — it makes the write\n * SUCCEED and persist nothing. `pausedApproval` was added to the base envelope when the column was\n * introduced but never here, so every approval pause wrote its status and its messages and\n * silently dropped the one field that makes the turn resumable. The row read back as\n * `AWAITING_APPROVAL` with no state to resume from: a turn stuck forever, with no error anywhere.\n * Adding a persisted field is therefore never done without adding it to this contract.\n *\n * `.nullish()` rather than `.optional()` because clearing is a real transition: the resume writes\n * an explicit `null` to release the pause, and under `.optional()` that null is rejected — which\n * would leave a resumed turn still advertising a decision nobody can answer.\n */\n pausedApproval: FlowActorExecutionBaseSchema.shape.pausedApproval.nullish(),\n});\n\n//===============================================================\n// Exported runtime type\n//===============================================================\n\n/**\n * Runtime shape of a persisted execution (the base envelope). The owner FK is\n * variant-specific (`userId` | `organizationId` | `applicationId`) and read from\n * the concrete variant; the conversational runtime supplies it explicitly on create.\n */\nexport type FlowActorExecution = z.infer<typeof FlowActorExecutionBaseSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"flows-actors-execution.shared.schemas.js","sourceRoot":"","sources":["../../../../src/flows-actors/flows-actors-execution.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,OAAO,EAA2E,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACpJ,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAChB,kCAAkC,GACnC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,gCAAgC,GAEjC,MAAM,kDAAkD,CAAC;AAE1D,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAErB,iEAAiE;AACjE,8BAA8B;AAC9B,iEAAiE;AAEjE;;;;;GAKG;AACH,MAAM,CAAN,IAAY,4BAKX;AALD,WAAY,4BAA4B;IACtC,6CAAa,CAAA;IACb,uDAAuB,CAAA;IACvB,iDAAiB,CAAA;IACjB,6CAAa,CAAA;AACf,CAAC,EALW,4BAA4B,KAA5B,4BAA4B,QAKvC;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,8BAKX;AALD,WAAY,8BAA8B;IACxC,+CAAa,CAAA;IACb,uDAAqB,CAAA;IACrB,uDAAqB,CAAA;IACrB,+CAAa,CAAA;AACf,CAAC,EALW,8BAA8B,KAA9B,8B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AM,CAAC,MAAM,yCAAyC,GAAG,yBAAyB,CAAC;IACjF,gBAAgB,EAAE,qBAAqB;IACvC,mBAAmB,EAAE,sBAAsB;IAC3C,WAAW,EAAE,uBAAuB;IACpC,UAAU,EAAE,4BAA4B;IACxC,QAAQ,EAAE,mCAAmC;CAC9C,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,MAAM,EAAE,4BAA4B,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;IAC5D,aAAa,EAAE,4BAA4B,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE;IAC1E,QAAQ,EAAE,4BAA4B,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE;IAChE,UAAU,EAAE,4BAA4B,CAAC,KAAK,CAAC,UAAU;IACzD;;;;;;;;;;;;;;OAcG;IACH,cAAc,EAAE,4BAA4B,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE;CAC5E,CAAC,CAAC","sourcesContent":["/**\n * Flows-Actors Execution — Persisted Resource Schema (POLYMORPHIC)\n * ================================================================\n *\n * A persisted record of a single flow/actor **system execution** — in v1 the\n * durable source of truth for a conversational chat log (`messages[]`) plus the\n * execution's lifecycle status.\n *\n * POLYMORPHIC ACROSS OWNER SCOPE. The SAME base envelope is stamped out as THREE\n * genuine single-scope resources by `declarePolymorphicSchemas()`, one owner FK\n * injected per variant:\n * - `userFlowActorExecutions` (USER_SELF — `userId`) ← WS chat + user-delegated A2A\n * - `organizationFlowActorExecutions` (ORGANIZATIONS — `organizationId`) ← org-machine A2A\n * - `applicationFlowActorExecutions` (APPLICATION — `applicationId`) ← app-machine A2A\n *\n * A conversation is owned by EXACTLY ONE scope (its injected owner FK). There is\n * no cross-scope audit dimension on the base — ownership IS the scope. This is the\n * honest \"one concept, N owners\" model (mirrors billing accounts / subscriptions)\n * and needs ZERO core-authorizer change: each variant satisfies its own scope\n * authorizer, and `polymorphicRole` resolves the operation roles per scope. A\n * machine (API key / OIDC client) reaches its org/app variant exactly as it\n * reaches any other org/app resource — standard RBAC via its granted roles.\n *\n * KIND-AGNOSTIC BY DESIGN. A `FlowActorSystem_Kind` discriminant lets the SAME\n * resource persist both flow and actor executions. v1 implements the ACTOR\n * conversational path; the FLOW path drops in without reshaping the base envelope.\n *\n * @see flows-actors.system.shared.schemas.ts — the base execution envelope\n * @see billing-account.shared.schemas.ts — the polymorphic-scope precedent\n * @see requests/websocket.shared.schemas.ts — the streamed message payload this\n * log mirrors (`WS_FlowsActorsMessagePayloadSchema`)\n */\n\nimport { z } from 'zod';\nimport { initZodDecorators, addImpersonalizeWith } from '@wildo-ai/zod-decorators';\n\nimport { FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE, FLOWS_ACTORS_NO_MACHINE_CREDENTIAL, FlowsActors_Status } from './flows-actors.commons.shared.schemas';\nimport { DataPortabilityProvenance } from '../compliance/privacy/subject-export.shared.schemas';\nimport { PersonalDataCategory } from '../compliance/privacy/personal-data-category.shared.schemas';\nimport { FlowActorSystem_Kind } from './flows-actors.system.shared.schemas';\nimport { RedactionType } from '../compliance/privacy/redaction.shared.schemas';\nimport {\n CoreResourceType,\n coreResourceShared_FieldIdentifier,\n} from '../resources/resources.shared.core.definitions';\nimport {\n declarePolymorphicSchemas,\n optOutPolymorphicAutoBusinessKey,\n type PolymorphicVariantDefinition,\n} from '../resources/utils/resource-polymorphism.schemas';\n\ninitZodDecorators(z);\n\n//===============================================================\n// Conversational message log\n//===============================================================\n\n/**\n * Author of a persisted conversational message. `TOOL` records a tool-call /\n * tool-result turn (grounding retrieval); `SYSTEM` records a system/status note.\n * WS-streamed messages are always server→client, so the transport shape carries\n * no role — the persisted log adds it to reconstruct a full transcript.\n */\nexport enum FlowsActors_ConversationRole {\n USER = 'user',\n ASSISTANT = 'assistant',\n SYSTEM = 'system',\n TOOL = 'tool',\n}\n\n/**\n * Rendering hint for a message body. Mirrors the streamed\n * `WS_FlowsActorsMessagePayloadSchema.messageType` literal union exactly\n * (`text | markdown | progress | data`) as an enum so the persisted log and the\n * live stream share one vocabulary (framework rule: enums over literal unions).\n */\nexport enum FlowsActors_MessageContentType {\n TEXT = 'text',\n MARKDOWN = 'markdown',\n PROGRESS = 'progress',\n DATA = 'data',\n}\n\nexport const FlowActorExecution_MessageSchema = z.object({\n /** Stable per-message id (client-correlatable across stream deltas). */\n id: z.uuid(),\n role: z.enum(FlowsActors_ConversationRole)\n .describe(\n 'Who produced this message.\\n\\nValues:\\n'\n + '- `user`: the person, or the client acting for them.\\n'\n + '- `assistant`: the agent.\\n'\n + '- `system`: instructions the agent was given, not part of the conversation a person sees.\\n'\n + '- `tool`: the result of something the agent called.',\n ),\n contentType: z.enum(FlowsActors_MessageContentType).default(FlowsActors_MessageContentType.TEXT)\n .describe(\n 'How to render `content`.\\n\\nValues:\\n'\n + '- `text`: plain text.\\n'\n + '- `markdown`: text with Markdown formatting.\\n'\n + '- `progress`: an interim note about work in flight; `data` carries the detail.\\n'\n + '- `data`: a structured payload rather than prose; read `data`, not `content`.',\n ),\n /** Rendered text content (may be assembled from streamed deltas). */\n content: z.string(),\n /** Structured payload for `DATA`/`PROGRESS` messages (tool results, progress). */\n data: z.record(z.string(), z.unknown()).optional(),\n createdAt: z.date().default(() => new Date()),\n});\nexport type FlowActorExecution_Message = z.infer<typeof FlowActorExecution_MessageSchema>;\n\n/**\n * The SUSPENDED-TURN state persisted when an agent turn pauses at a human-in-the-loop\n * approval boundary (execution `status` = `AWAITING_APPROVAL`). It is stored SERIALIZED as a\n * JSON string in the `pausedApproval` scalar field — NOT as a nested Zod object — because heavy\n * nested sub-structures do not round-trip through the Zod→Mongoose embedded-subdocument\n * conversion (see the per-kind state note below). Parse/serialize ONLY via the helpers below at\n * the persistence boundary; the record column itself stays a plain string.\n */\nexport const FlowActorExecution_PausedApprovalSchema = z.object({\n /**\n * Correlates the emitted approval REQUEST with the inbound decision (idempotency key).\n *\n * An OPAQUE identifier minted by the model SDK — NOT a Wildo id and NOT a UUID. It was typed\n * `z.uuid()` on the reasonable-looking assumption that an id is a uuid, and the SDK produces\n * values like `aitxt-3Xfhq68r7GTRXEuV1YzU4eEc`.\n *\n * That single wrong assumption made EVERY paused turn unresumable, and hid completely: serializing\n * is `JSON.stringify` and does not validate, so the pause persisted perfectly; only the resume's\n * `parse` rejected it, as a CORRUPTED blob. The turn then stayed paused forever with a\n * \"state is unreadable\" error naming the wrong cause. Unit fixtures used a real uuid, so they were\n * more conformant than production and could never reproduce it — the live lane found it.\n *\n * Validate it as an opaque non-empty string. We do not own the format and must not assert one.\n */\n approvalId: z.string().min(1),\n /**\n * The AI-SDK model-message array to RESUME from — opaque to us (the SDK's own resume\n * contract). Captured when the approval-gated tool call suspended the stream; on the human\n * decision the runtime appends a tool-approval-response and re-invokes with these messages.\n */\n sdkModelMessages: z.array(z.record(z.string(), z.unknown())),\n /** The approval-gated tool the model wants to call (drives the human-facing prompt). */\n pendingToolName: z.string(),\n /** The pending tool call's arguments (drives the human-facing action description). */\n pendingToolArgs: z.record(z.string(), z.unknown()).optional(),\n /** ISO timestamp when the approval was requested. */\n requestedAt: z.string(),\n /**\n * ISO instant after which the paused turn must not be resumed.\n *\n * SET ON EVERY SUSPENSION since 2026-09-08 (#465). It was declared here, carried on the\n * approval-request WebSocket payload and read and converted by the browser, and NO WRITER EVER SET\n * IT — so a pending approval never expired and the field described a timeout that did not exist.\n *\n * The terminal state on expiry is `FlowsActors_Status.FAILED`, which the status vocabulary already\n * named (\"resolves to PROCESSING→COMPLETED on approval, or a terminal state on denial/expiry\").\n * Nothing new was invented for it.\n *\n * Still optional: a suspension persisted before that date carries none, and an absent expiry means\n * the pause does not lapse — which is what those turns were paused under.\n */\n expiresAt: z.string().optional(),\n});\nexport type FlowActorExecution_PausedApproval = z.infer<typeof FlowActorExecution_PausedApprovalSchema>;\n\n/**\n * How long a human has to answer an approval-gated tool call before the turn is refused.\n *\n * **24 hours.** An agent pausing for a person should span a working day plus a night, so a request\n * raised late in the afternoon is still answerable the next morning. Much beyond that and the\n * decision stops being meaningful rather than merely late: the person is approving a tool call made\n * against a conversation, a world and an intent that have all moved on, and \"do you approve this?\"\n * with no memory of the question is a prompt people click through.\n *\n * A framework default rather than an operator knob, for now. If an application ever needs its own,\n * the knob goes beside the consent lifetime in the auth config — but nobody has asked, and a\n * timeout that every application authors identically is a default wearing a config field.\n */\nexport const FLOW_ACTOR_APPROVAL_DEFAULT_TIMEOUT_MS = 24 * 60 * 60 * 1000;\n\n/** Serialize paused-approval state for the scalar `pausedApproval` string column. */\nexport function serializeFlowActorPausedApproval(state: FlowActorExecution_PausedApproval): string {\n return JSON.stringify(state);\n}\n\n/**\n * Parse the scalar `pausedApproval` string column back to typed state. Throws (ZodError /\n * SyntaxError) on a malformed blob — a corrupted paused record must fail loudly at resume,\n * never silently resume from garbage.\n */\nexport function parseFlowActorPausedApproval(raw: string): FlowActorExecution_PausedApproval {\n return FlowActorExecution_PausedApprovalSchema.parse(JSON.parse(raw));\n}\n\n//===============================================================\n// Per-kind execution state (reused from the shared execution types)\n//===============================================================\n\n// NOTE (v1 scope): the persisted record is the CONVERSATIONAL envelope only —\n// `kind` + `status`/`statusChanges` + the `messages[]` chat log. The richer\n// per-kind graph-state slots (`flowState` node-states / `actorState` plan+tasks,\n// sliced from `FlowSystem_Execution` / `ActorSystem_Execution`) are intentionally\n// NOT persisted yet: the v1 conversational runtime never writes them, and those\n// heavy nested sub-structures (required `plan`/`walkthrough`/`standaloneTasks`\n// with embedded `_id`s) do not round-trip through the Zod→Mongoose embedded-\n// subdocument conversion as optional slots (empty subdocs get instantiated and\n// fail required-path validation). When the flow/actor orchestration runtime\n// actually produces graph state, add typed `flowState`/`actorState` back WITH the\n// embedded-subdocument treatment (see the zod↔mongoose nested-union / embedded-id\n// notes) rather than a raw `.pick()`. `kind` already preserves discrimination.\n\n//===============================================================\n// Base execution record — NO owner scope FK (injected per variant)\n//===============================================================\n\n/**\n * The conversation envelope shared by every scope variant. It carries NO owner\n * scope FK: `declarePolymorphicSchemas()` injects exactly ONE (`userId` /\n * `organizationId` / `applicationId`) per variant. Do NOT add an `initiator`\n * snapshot here — a nested `initiator.userId`/`.organizationId` collides with the\n * contextual scope filter (it matches the field identifier at every schema path\n * and injects an exact-subdocument clause that never equals the stored snapshot,\n * so every scoped read/update silently matches zero rows). Ownership lives ONLY on\n * the single injected top-level owner FK.\n */\nexport const FlowActorExecutionBaseSchema = z.object({\n /** MongoDB document id — auto-generated / auto-managed (excluded from create). */\n _id: z.string().min(1).isPrimaryKey(),\n\n /**\n * Stable business id of the execution, generated by the conversational runtime\n * and echoed over the WebSocket channel (`WS_FlowsActors*.executionId`). Unique\n * per variant collection (a UUID — no cross-collection collision). Immutable\n * once created.\n */\n executionId: z.uuid().isUnique({ scope: 'global', sparse: false }).excludeFromUpdate().isSummaryField(),\n\n // === System identity (set on create, immutable) ===\n /** Ref of the executed flow/actor system (`FlowActorSystem.ref`). */\n systemRef: z.string().isDBIndexed().excludeFromUpdate().isSummaryField(),\n /** Discriminant selecting which state slot is populated. */\n kind: z.enum(FlowActorSystem_Kind).isDBIndexed().excludeFromUpdate().isSummaryField(),\n\n // === Runtime status ===\n /**\n * WHICH agent this conversation was opened through — part of the read filter, not metadata.\n *\n * The task family carried this from gate #3; executions did not, so a caller holding a\n * `contextId` could continue that thread through a DIFFERENT declared agent and load the prior\n * transcript into the other agent's context. A2A agents are declared as separate resource servers\n * with per-instance token audiences, and the plane at risk here holds the full message log — not\n * a 120-character title (review finding G5-8).\n *\n * The WebSocket surface has no agent, and the default A2A agent is an identity of its own; both\n * store {@link FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE}.\n */\n resourceServerInstanceRef: z.string().min(1).isDBIndexed(),\n\n /**\n * WHICH machine credential opened this conversation — part of the read filter, not metadata.\n *\n * Identical axis and identical reasoning to the task family: the injected scope FK does not\n * identify the principal on the machine variants (`applicationId` is a deployment singleton;\n * `organizationId` is shared by every machine client of one tenant), so without it a\n * separately-credentialed client could read and continue another client's conversation — which\n * carries the full message log, not merely a title.\n *\n * User-delegated turns store {@link FLOWS_ACTORS_NO_MACHINE_CREDENTIAL}: the human is the\n * principal there and the `userId` owner FK already discriminates.\n */\n machineCredentialId: z.string().min(1).isDBIndexed(),\n\n status: z.enum(FlowsActors_Status).isDBIndexed().isSummaryField(),\n statusChanges: z.array(z.object({\n status: z.enum(FlowsActors_Status),\n timestamp: z.date(),\n })).default([]),\n\n // === Conversational log (chat history) ===\n /**\n * The conversation transcript.\n *\n * ## Provenance: SUBJECT_PROVIDED, and the asymmetry is the reason (review finding F5-6)\n *\n * This array MIXES subject-authored turns (`role: USER`) with model-generated ones\n * (`role: ASSISTANT`), and provenance is declared per FIELD — there is no per-element mechanism,\n * so one classification must cover both. The two ways of being wrong are not equally bad:\n *\n * • Classifying DERIVED would EXCLUDE the subject's own words from an Art. 20 bundle. That is a\n * failure of the right the article exists to serve.\n * • Classifying SUBJECT_PROVIDED includes the assistant's replies alongside them. That is\n * over-delivery — but of a transcript the subject was a party to and already saw, which is the\n * natural unit a person means by \"my conversation\".\n *\n * So the classification follows the ASYMMETRY, not a per-element truth we cannot express. Revisit\n * only if per-element provenance ever exists; splitting the array by role at export time was\n * considered and rejected as inventing a second mechanism for one field.\n *\n * ⚠️ **This is a LABELLING change, not a behaviour change**, and the first version of this note\n * failed to say so. `resolvePortabilityFieldScope` maps `SUBJECT_PROVIDED` *and* `OBSERVED` to\n * `INCLUDED`, and the resource default was already `OBSERVED` — so `messages` was in the Art. 20\n * bundle before and after. Nothing about an export changes.\n *\n * The rejected alternative the first version omitted is the one that was actually in force:\n * **`OBSERVED`** — \"data generated by the subject's USE of the service\", a defensible reading of a\n * mixed transcript. It is rejected for precision rather than effect: the USER turns are authored\n * BY the subject, not merely observed of them, and a classification should say the truest thing\n * available even when two values resolve alike today.\n *\n * The task family's `output`/`artifacts` are DERIVED by contrast, and that is not an\n * inconsistency: those are model output ABOUT the work, with no subject-authored content mixed in.\n */\n // RESET on erasure — returns this field to its schema default. It holds the conversation itself,\n // which the category above correctly declares as personal data. RESET rather than REMOVE or MASK\n // because the field is non-nullable WITH a `.default()`: REMOVE needs a clearable field and MASK\n // needs a string. The value comes from the schema, so there is no second copy to drift.\n messages: addImpersonalizeWith(\n FlowActorExecution_MessageSchema.array().default([])\n .portabilityProvenance(DataPortabilityProvenance.SUBJECT_PROVIDED)\n // The conversation itself. Category as well as provenance, so a notice can enumerate it: the two\n // axes answer different questions and a provenance alone leaves the field an OUTSTANDING gap.\n .dataCategories(PersonalDataCategory.USER_CONTENT),\n RedactionType.RESET,\n ),\n\n // === HITL (human-in-the-loop) suspension ===\n /**\n * Serialized {@link FlowActorExecution_PausedApproval} — present ONLY while `status` is\n * `AWAITING_APPROVAL`. A scalar JSON string (see that schema's doc for why it is NOT a nested\n * object: the Zod→Mongoose round-trip). Set on pause, cleared on resume / terminal completion;\n * never authored on create.\n */\n /**\n * Serialized suspended-turn state; `null` once a decision releases the pause.\n *\n * `.nullish()`, not `.optional()`, and the difference is load-bearing at the READ. Clearing writes\n * an explicit `null`; the write then re-parses the row to project its response, and under\n * `.optional()` that projection throws `expected string, received null`. The clear PERSISTS (there\n * is no transaction to roll back) and the operation still fails — so the pause was released and\n * the resume aborted, leaving the turn `failed` with its work never done, reported as a resource\n * transformation error that names nothing about approvals.\n *\n * The input contract needing `.nullish()` (see `FlowActorExecutionUpdateInternalSchema`) is a\n * SEPARATE surface from this one. Fixing only that gets the value written and still throws on the\n * way out — both must admit null or neither does.\n */\n // This blob contains SDK resume messages and pending tool arguments. It is\n // runtime continuation state, not conversation content: generic client reads,\n // summaries and generated API schemas must never disclose it.\n pausedApproval: z.string().nullish().excludeFromCreate().isBackendOnly(),\n\n // === Timing (system-managed; defaults are load-bearing — the create pipeline\n // strips these then date-coerces, so a missing default → Invalid Date) ===\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate().isSummaryField(),\n /** Set on terminal completion (via UPDATE); never on create. */\n finishedAt: z.date().optional().excludeFromCreate().isSummaryField(),\n});\nexport type FlowActorExecutionBase = z.infer<typeof FlowActorExecutionBaseSchema>;\n\n//===============================================================\n// Polymorphic declaration — one owner-scope variant per scope\n//===============================================================\n\n/**\n * The three owner-scope variants a flows-actors execution is stamped out for.\n * Each is `isPrimaryScope: true` (the injected owner FK is the primary scope), and\n * each opts OUT of the singleton auto-business-key: a conversation is MULTI-ROW\n * per scope (many discussions per user/org/app), so the injected owner FK must NOT\n * be marked `.isUnique()` — otherwise the second conversation per scope would fail\n * with a duplicate-key error. Mirrors subscriptions / usage-records / SSO\n * connections (all multi-row polymorphic resources).\n */\nexport const FLOW_ACTOR_EXECUTION_SCOPE_VARIANTS: PolymorphicVariantDefinition[] = [\n { parentResourceType: CoreResourceType.USERS, parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.USERS], isPrimaryScope: true },\n { parentResourceType: CoreResourceType.ORGANIZATIONS, parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.ORGANIZATIONS], isPrimaryScope: true },\n { parentResourceType: CoreResourceType.APPLICATION, parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.APPLICATION], isPrimaryScope: true },\n].map(optOutPolymorphicAutoBusinessKey);\n\n/**\n * Polymorphic declaration for flows-actors executions. Produces 3 variants:\n * - users → `userFlowActorExecutions` (`userId` injected)\n * - organizations→ `organizationFlowActorExecutions` (`organizationId` injected)\n * - applications → `applicationFlowActorExecutions` (`applicationId` injected)\n */\nexport const flowActorExecutionsPolymorphicDeclaration = declarePolymorphicSchemas({\n baseResourceType: 'flowActorExecutions',\n baseFieldIdentifier: 'flowActorExecutionId',\n baseEnumKey: 'FLOW_ACTOR_EXECUTIONS',\n baseSchema: FlowActorExecutionBaseSchema,\n variants: FLOW_ACTOR_EXECUTION_SCOPE_VARIANTS,\n});\n\n/**\n * Owner-agnostic UPDATE DTO — status transitions, appended messages, completion\n * time. Shared across all variants because it references NO owner FK (owner is\n * immutable). `updatedAt` is system-managed; identity fields are `.excludeFromUpdate()`.\n */\nexport const FlowActorExecutionUpdateInternalSchema = z.object({\n status: FlowActorExecutionBaseSchema.shape.status.optional(),\n statusChanges: FlowActorExecutionBaseSchema.shape.statusChanges.optional(),\n messages: FlowActorExecutionBaseSchema.shape.messages.optional(),\n finishedAt: FlowActorExecutionBaseSchema.shape.finishedAt,\n /**\n * The suspended-turn state, written when a turn pauses for a human decision and cleared when one\n * arrives.\n *\n * ⚠️ THIS SCHEMA IS AN ALLOW-LIST, and omitting a field here does not fail — it makes the write\n * SUCCEED and persist nothing. `pausedApproval` was added to the base envelope when the column was\n * introduced but never here, so every approval pause wrote its status and its messages and\n * silently dropped the one field that makes the turn resumable. The row read back as\n * `AWAITING_APPROVAL` with no state to resume from: a turn stuck forever, with no error anywhere.\n * Adding a persisted field is therefore never done without adding it to this contract.\n *\n * `.nullish()` rather than `.optional()` because clearing is a real transition: the resume writes\n * an explicit `null` to release the pause, and under `.optional()` that null is rejected — which\n * would leave a resumed turn still advertising a decision nobody can answer.\n */\n pausedApproval: FlowActorExecutionBaseSchema.shape.pausedApproval.nullish(),\n});\n\n//===============================================================\n// Exported runtime type\n//===============================================================\n\n/**\n * Runtime shape of a persisted execution (the base envelope). The owner FK is\n * variant-specific (`userId` | `organizationId` | `applicationId`) and read from\n * the concrete variant; the conversational runtime supplies it explicitly on create.\n */\nexport type FlowActorExecution = z.infer<typeof FlowActorExecutionBaseSchema>;\n"]}
|
|
@@ -27,6 +27,25 @@ export declare enum FlowsActors_Status {
|
|
|
27
27
|
CANCELLED = "cancelled",
|
|
28
28
|
ABORTED = "aborted"
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* What each run state MEANS to somebody watching a run — the words, made reachable.
|
|
32
|
+
*
|
|
33
|
+
* The members carry their meanings in JSDoc, which no runtime surface can read, so every surface
|
|
34
|
+
* that had to SHOW one either invented words or printed a bare token. The published API reference
|
|
35
|
+
* did the second: the top-level `status` field carries a description from its resource
|
|
36
|
+
* specification, and the identical enum one level down in `statusChanges[]` carried nothing,
|
|
37
|
+
* because field-doc injection reaches top-level properties only.
|
|
38
|
+
*
|
|
39
|
+
* Authored once here and rendered into every `.describe()` that needs it, so three schemas cannot
|
|
40
|
+
* drift into three accounts of one vocabulary. Exhaustive by type: a tenth state does not compile
|
|
41
|
+
* until it has been worded.
|
|
42
|
+
*/
|
|
43
|
+
export declare const FLOWS_ACTORS_STATUS_MEANINGS: Readonly<Record<FlowsActors_Status, string>>;
|
|
44
|
+
/**
|
|
45
|
+
* One `Values:` legend, in the shape the generated API reference already uses for a described enum,
|
|
46
|
+
* so a NESTED field reads exactly like a top-level one rather than like a second convention.
|
|
47
|
+
*/
|
|
48
|
+
export declare function describeFlowsActorsStatus(lead: string): string;
|
|
30
49
|
export declare const FlowsActors_LeafElements_RelationshipSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
31
50
|
kind: z.ZodLiteral<FlowsActors_ElementKind.ACTOR>;
|
|
32
51
|
actorId: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows-actors.commons.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/flows-actors/flows-actors.commons.shared.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,IAAI,eAAe;IACnB,IAAI,eAAe;IACnB,SAAS,oBAAoB;CAC9B;AAED,oBAAY,kBAAkB;IAC5B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB;;;;;;;;OAQG;IACH,iBAAiB,sBAAsB;IACvC,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY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BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAK1F,oBAAY,iCAAiC;IAC3C,MAAM,WAAW,CAAE,0CAA0C;IAC7D,IAAI,SAAS,CAAE,wCAAwC;IACvD,SAAS,cAAc;CACxB;AAED,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;iBAIxC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEnF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI7C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAI9F;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kCAAkC,qBAAqB,CAAC;AAErE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mCAAmC,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"flows-actors.commons.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/flows-actors/flows-actors.commons.shared.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,SAAS,cAAc;IACvB,IAAI,eAAe;IACnB,IAAI,eAAe;IACnB,SAAS,oBAAoB;CAC9B;AAED,oBAAY,kBAAkB;IAC5B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB;;;;;;;;OAQG;IACH,iBAAiB,sBAAsB;IACvC,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MA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C,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,gCAAgC;;;;;iBAM3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAK1F,oBAAY,iCAAiC;IAC3C,MAAM,WAAW,CAAE,0CAA0C;IAC7D,IAAI,SAAS,CAAE,wCAAwC;IACvD,SAAS,cAAc;CACxB;AAED,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;iBAIxC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEnF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI7C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAI9F;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kCAAkC,qBAAqB,CAAC;AAErE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mCAAmC,cAAc,CAAC"}
|
|
@@ -33,6 +33,39 @@ export var FlowsActors_Status;
|
|
|
33
33
|
FlowsActors_Status["CANCELLED"] = "cancelled";
|
|
34
34
|
FlowsActors_Status["ABORTED"] = "aborted";
|
|
35
35
|
})(FlowsActors_Status || (FlowsActors_Status = {}));
|
|
36
|
+
/**
|
|
37
|
+
* What each run state MEANS to somebody watching a run — the words, made reachable.
|
|
38
|
+
*
|
|
39
|
+
* The members carry their meanings in JSDoc, which no runtime surface can read, so every surface
|
|
40
|
+
* that had to SHOW one either invented words or printed a bare token. The published API reference
|
|
41
|
+
* did the second: the top-level `status` field carries a description from its resource
|
|
42
|
+
* specification, and the identical enum one level down in `statusChanges[]` carried nothing,
|
|
43
|
+
* because field-doc injection reaches top-level properties only.
|
|
44
|
+
*
|
|
45
|
+
* Authored once here and rendered into every `.describe()` that needs it, so three schemas cannot
|
|
46
|
+
* drift into three accounts of one vocabulary. Exhaustive by type: a tenth state does not compile
|
|
47
|
+
* until it has been worded.
|
|
48
|
+
*/
|
|
49
|
+
export const FLOWS_ACTORS_STATUS_MEANINGS = {
|
|
50
|
+
[FlowsActors_Status.READY]: 'Created and ready to start; no work has been done yet.',
|
|
51
|
+
[FlowsActors_Status.PENDING]: 'Accepted and queued, waiting for a runner to pick it up.',
|
|
52
|
+
[FlowsActors_Status.PROCESSING]: 'Running now.',
|
|
53
|
+
[FlowsActors_Status.AWAITING_APPROVAL]: 'Paused at an approval point: it called something a person must authorize, and it resumes or ends when that decision arrives.',
|
|
54
|
+
[FlowsActors_Status.COMPLETED]: 'Finished, and did what it set out to do.',
|
|
55
|
+
[FlowsActors_Status.FAILED]: 'Stopped because something went wrong.',
|
|
56
|
+
[FlowsActors_Status.CANCELLED]: 'Stopped because somebody asked it to stop.',
|
|
57
|
+
[FlowsActors_Status.ABORTED]: 'Stopped by the system rather than by a person — a shutdown, a timeout, a lost runner.',
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* One `Values:` legend, in the shape the generated API reference already uses for a described enum,
|
|
61
|
+
* so a NESTED field reads exactly like a top-level one rather than like a second convention.
|
|
62
|
+
*/
|
|
63
|
+
export function describeFlowsActorsStatus(lead) {
|
|
64
|
+
const legend = Object.entries(FLOWS_ACTORS_STATUS_MEANINGS)
|
|
65
|
+
.map(([value, meaning]) => `- \`${value}\`: ${meaning}`)
|
|
66
|
+
.join('\n');
|
|
67
|
+
return `${lead}\n\nValues:\n${legend}`;
|
|
68
|
+
}
|
|
36
69
|
//===============================================================
|
|
37
70
|
// Relationship
|
|
38
71
|
//===============================================================
|